@typescript-deploys/pr-build 4.8.0-pr-49285-5 → 4.8.0-pr-48784-17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/typescript.js CHANGED
@@ -6394,7 +6394,7 @@ var ts;
6394
6394
  };
6395
6395
  }
6396
6396
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
6397
- var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName) {
6397
+ var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName, modifiedTime) {
6398
6398
  // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
6399
6399
  if (!ts.isString(relativeFileName))
6400
6400
  return;
@@ -6404,7 +6404,7 @@ var ts;
6404
6404
  if (callbacks) {
6405
6405
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
6406
6406
  var fileCallback = callbacks_1[_i];
6407
- fileCallback(fileName, FileWatcherEventKind.Changed);
6407
+ fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6408
6408
  }
6409
6409
  }
6410
6410
  },
@@ -6458,7 +6458,7 @@ var ts;
6458
6458
  }
6459
6459
  else {
6460
6460
  cache.set(path, {
6461
- watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
6461
+ watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6462
6462
  refCount: 1
6463
6463
  });
6464
6464
  }
@@ -6486,7 +6486,7 @@ var ts;
6486
6486
  var newTime = modifiedTime.getTime();
6487
6487
  if (oldTime !== newTime) {
6488
6488
  watchedFile.mtime = modifiedTime;
6489
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
6489
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
6490
6490
  return true;
6491
6491
  }
6492
6492
  return false;
@@ -6737,17 +6737,18 @@ var ts;
6737
6737
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6738
6738
  /*@internal*/
6739
6739
  function createFileWatcherCallback(callback) {
6740
- return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
6740
+ return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6741
6741
  }
6742
6742
  ts.createFileWatcherCallback = createFileWatcherCallback;
6743
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists) {
6744
- return function (eventName) {
6743
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6744
+ return function (eventName, _relativeFileName, modifiedTime) {
6745
6745
  if (eventName === "rename") {
6746
- callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6746
+ modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
6747
+ callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
6747
6748
  }
6748
6749
  else {
6749
6750
  // Change
6750
- callback(fileName, FileWatcherEventKind.Changed);
6751
+ callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6751
6752
  }
6752
6753
  };
6753
6754
  }
@@ -6771,7 +6772,7 @@ var ts;
6771
6772
  }
6772
6773
  /*@internal*/
6773
6774
  function createSystemWatchFunctions(_a) {
6774
- 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;
6775
+ 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;
6775
6776
  var dynamicPollingWatchFile;
6776
6777
  var fixedChunkSizePollingWatchFile;
6777
6778
  var nonPollingWatchFile;
@@ -6793,7 +6794,7 @@ var ts;
6793
6794
  case ts.WatchFileKind.FixedChunkSizePolling:
6794
6795
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, /* pollingInterval */ undefined, /*options*/ undefined);
6795
6796
  case ts.WatchFileKind.UseFsEvents:
6796
- return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists),
6797
+ return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime),
6797
6798
  /*recursive*/ false, pollingInterval, ts.getFallbackOptions(options));
6798
6799
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
6799
6800
  if (!nonPollingWatchFile) {
@@ -6975,7 +6976,6 @@ var ts;
6975
6976
  fsWatch: fsWatch,
6976
6977
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6977
6978
  getCurrentDirectory: getCurrentDirectory,
6978
- fileExists: fileExists,
6979
6979
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
6980
6980
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
6981
6981
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
@@ -7235,7 +7235,7 @@ var ts;
7235
7235
  // File changed
7236
7236
  eventKind = FileWatcherEventKind.Changed;
7237
7237
  }
7238
- callback(fileName, eventKind);
7238
+ callback(fileName, eventKind, curr.mtime);
7239
7239
  }
7240
7240
  }
7241
7241
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
@@ -7261,10 +7261,10 @@ var ts;
7261
7261
  * Invoke the callback with rename and update the watcher if not closed
7262
7262
  * @param createWatcher
7263
7263
  */
7264
- function invokeCallbackAndUpdateWatcher(createWatcher) {
7264
+ function invokeCallbackAndUpdateWatcher(createWatcher, modifiedTime) {
7265
7265
  sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
7266
7266
  // Call the callback for current directory
7267
- callback("rename", "");
7267
+ callback("rename", "", modifiedTime);
7268
7268
  // If watcher is not closed, update it
7269
7269
  if (watcher) {
7270
7270
  watcher.close();
@@ -7310,13 +7310,14 @@ var ts;
7310
7310
  function callbackChangingToMissingFileSystemEntry(event, relativeName) {
7311
7311
  // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
7312
7312
  // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
7313
+ var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
7313
7314
  return event === "rename" &&
7314
7315
  (!relativeName ||
7315
7316
  relativeName === lastDirectoryPart ||
7316
7317
  (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
7317
- !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7318
- invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
7319
- callback(event, relativeName);
7318
+ modifiedTime === ts.missingFileModifiedTime ?
7319
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry, modifiedTime) :
7320
+ callback(event, relativeName, modifiedTime);
7320
7321
  }
7321
7322
  /**
7322
7323
  * Watch the file or directory using fs.watchFile since fs.watch threw exception
@@ -7330,12 +7331,15 @@ var ts;
7330
7331
  * and switch to existing file or directory when the missing filesystem entry is created
7331
7332
  */
7332
7333
  function watchMissingFileSystemEntry() {
7333
- return watchFile(fileOrDirectory, function (_fileName, eventKind) {
7334
- if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
7335
- // Call the callback for current file or directory
7336
- // For now it could be callback for the inner directory creation,
7337
- // but just return current directory, better than current no-op
7338
- invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
7334
+ return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
7335
+ if (eventKind === FileWatcherEventKind.Created) {
7336
+ modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
7337
+ if (modifiedTime !== ts.missingFileModifiedTime) {
7338
+ // Call the callback for current file or directory
7339
+ // For now it could be callback for the inner directory creation,
7340
+ // but just return current directory, better than current no-op
7341
+ invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry, modifiedTime);
7342
+ }
7339
7343
  }
7340
7344
  }, fallbackPollingInterval, fallbackOptions);
7341
7345
  }
@@ -7485,12 +7489,19 @@ var ts;
7485
7489
  }
7486
7490
  function getModifiedTime(path) {
7487
7491
  var _a;
7492
+ // Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
7493
+ // the CPU time performance.
7494
+ var originalStackTraceLimit = Error.stackTraceLimit;
7495
+ Error.stackTraceLimit = 0;
7488
7496
  try {
7489
7497
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
7490
7498
  }
7491
7499
  catch (e) {
7492
7500
  return undefined;
7493
7501
  }
7502
+ finally {
7503
+ Error.stackTraceLimit = originalStackTraceLimit;
7504
+ }
7494
7505
  }
7495
7506
  function setModifiedTime(path, time) {
7496
7507
  try {
@@ -9513,8 +9524,8 @@ var ts;
9513
9524
  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"),
9514
9525
  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"),
9515
9526
  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."),
9516
- 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}'"),
9517
- 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}'"),
9527
+ 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}'"),
9528
+ 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}'"),
9518
9529
  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"),
9519
9530
  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"),
9520
9531
  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"),
@@ -9558,6 +9569,8 @@ var ts;
9558
9569
  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}'."),
9559
9570
  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}'."),
9560
9571
  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."),
9572
+ 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"),
9573
+ Project_0_is_up_to_date_but_needs_update_to_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_update_to_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs update to timestamps of output files that are older than input files"),
9561
9574
  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}'"),
9562
9575
  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."),
9563
9576
  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."),
@@ -20387,6 +20400,10 @@ var ts;
20387
20400
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
20388
20401
  }
20389
20402
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
20403
+ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
20404
+ return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
20405
+ }
20406
+ ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
20390
20407
  function getCompilerOptionValue(options, option) {
20391
20408
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
20392
20409
  }
@@ -39427,6 +39444,7 @@ var ts;
39427
39444
  type: "boolean",
39428
39445
  affectsSemanticDiagnostics: true,
39429
39446
  affectsEmit: true,
39447
+ affectsMultiFileEmitBuildInfo: true,
39430
39448
  category: ts.Diagnostics.Watch_and_Build_Modes,
39431
39449
  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,
39432
39450
  defaultValueDescription: false,
@@ -39461,12 +39479,40 @@ var ts;
39461
39479
  affectsSourceFile: true,
39462
39480
  affectsModuleResolution: true,
39463
39481
  affectsEmit: true,
39482
+ affectsMultiFileEmitBuildInfo: true,
39464
39483
  paramType: ts.Diagnostics.VERSION,
39465
39484
  showInSimplifiedHelpView: true,
39466
39485
  category: ts.Diagnostics.Language_and_Environment,
39467
39486
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
39468
39487
  defaultValueDescription: 0 /* ES3 */,
39469
39488
  };
39489
+ /*@internal*/
39490
+ ts.moduleOptionDeclaration = {
39491
+ name: "module",
39492
+ shortName: "m",
39493
+ type: new ts.Map(ts.getEntries({
39494
+ none: ts.ModuleKind.None,
39495
+ commonjs: ts.ModuleKind.CommonJS,
39496
+ amd: ts.ModuleKind.AMD,
39497
+ system: ts.ModuleKind.System,
39498
+ umd: ts.ModuleKind.UMD,
39499
+ es6: ts.ModuleKind.ES2015,
39500
+ es2015: ts.ModuleKind.ES2015,
39501
+ es2020: ts.ModuleKind.ES2020,
39502
+ es2022: ts.ModuleKind.ES2022,
39503
+ esnext: ts.ModuleKind.ESNext,
39504
+ node16: ts.ModuleKind.Node16,
39505
+ nodenext: ts.ModuleKind.NodeNext,
39506
+ })),
39507
+ affectsModuleResolution: true,
39508
+ affectsEmit: true,
39509
+ affectsMultiFileEmitBuildInfo: true,
39510
+ paramType: ts.Diagnostics.KIND,
39511
+ showInSimplifiedHelpView: true,
39512
+ category: ts.Diagnostics.Modules,
39513
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
39514
+ defaultValueDescription: undefined,
39515
+ };
39470
39516
  var commandOptionsWithoutBuild = [
39471
39517
  // CommandLine only options
39472
39518
  {
@@ -39528,37 +39574,14 @@ var ts;
39528
39574
  category: ts.Diagnostics.Command_line_Options,
39529
39575
  affectsSemanticDiagnostics: true,
39530
39576
  affectsEmit: true,
39577
+ affectsMultiFileEmitBuildInfo: true,
39531
39578
  isCommandLineOnly: true,
39532
39579
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
39533
39580
  defaultValueDescription: false,
39534
39581
  },
39535
39582
  // Basic
39536
39583
  ts.targetOptionDeclaration,
39537
- {
39538
- name: "module",
39539
- shortName: "m",
39540
- type: new ts.Map(ts.getEntries({
39541
- none: ts.ModuleKind.None,
39542
- commonjs: ts.ModuleKind.CommonJS,
39543
- amd: ts.ModuleKind.AMD,
39544
- system: ts.ModuleKind.System,
39545
- umd: ts.ModuleKind.UMD,
39546
- es6: ts.ModuleKind.ES2015,
39547
- es2015: ts.ModuleKind.ES2015,
39548
- es2020: ts.ModuleKind.ES2020,
39549
- es2022: ts.ModuleKind.ES2022,
39550
- esnext: ts.ModuleKind.ESNext,
39551
- node16: ts.ModuleKind.Node16,
39552
- nodenext: ts.ModuleKind.NodeNext,
39553
- })),
39554
- affectsModuleResolution: true,
39555
- affectsEmit: true,
39556
- paramType: ts.Diagnostics.KIND,
39557
- showInSimplifiedHelpView: true,
39558
- category: ts.Diagnostics.Modules,
39559
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
39560
- defaultValueDescription: undefined,
39561
- },
39584
+ ts.moduleOptionDeclaration,
39562
39585
  {
39563
39586
  name: "lib",
39564
39587
  type: "list",
@@ -39595,6 +39618,7 @@ var ts;
39595
39618
  type: jsxOptionMap,
39596
39619
  affectsSourceFile: true,
39597
39620
  affectsEmit: true,
39621
+ affectsMultiFileEmitBuildInfo: true,
39598
39622
  affectsModuleResolution: true,
39599
39623
  paramType: ts.Diagnostics.KIND,
39600
39624
  showInSimplifiedHelpView: true,
@@ -39607,6 +39631,7 @@ var ts;
39607
39631
  shortName: "d",
39608
39632
  type: "boolean",
39609
39633
  affectsEmit: true,
39634
+ affectsMultiFileEmitBuildInfo: true,
39610
39635
  showInSimplifiedHelpView: true,
39611
39636
  category: ts.Diagnostics.Emit,
39612
39637
  transpileOptionValue: undefined,
@@ -39617,6 +39642,7 @@ var ts;
39617
39642
  name: "declarationMap",
39618
39643
  type: "boolean",
39619
39644
  affectsEmit: true,
39645
+ affectsMultiFileEmitBuildInfo: true,
39620
39646
  showInSimplifiedHelpView: true,
39621
39647
  category: ts.Diagnostics.Emit,
39622
39648
  transpileOptionValue: undefined,
@@ -39627,6 +39653,7 @@ var ts;
39627
39653
  name: "emitDeclarationOnly",
39628
39654
  type: "boolean",
39629
39655
  affectsEmit: true,
39656
+ affectsMultiFileEmitBuildInfo: true,
39630
39657
  showInSimplifiedHelpView: true,
39631
39658
  category: ts.Diagnostics.Emit,
39632
39659
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -39637,6 +39664,7 @@ var ts;
39637
39664
  name: "sourceMap",
39638
39665
  type: "boolean",
39639
39666
  affectsEmit: true,
39667
+ affectsMultiFileEmitBuildInfo: true,
39640
39668
  showInSimplifiedHelpView: true,
39641
39669
  category: ts.Diagnostics.Emit,
39642
39670
  defaultValueDescription: false,
@@ -39646,6 +39674,9 @@ var ts;
39646
39674
  name: "outFile",
39647
39675
  type: "string",
39648
39676
  affectsEmit: true,
39677
+ affectsMultiFileEmitBuildInfo: true,
39678
+ affectsDeclarationPath: true,
39679
+ affectsBundleEmitBuildInfo: true,
39649
39680
  isFilePath: true,
39650
39681
  paramType: ts.Diagnostics.FILE,
39651
39682
  showInSimplifiedHelpView: true,
@@ -39657,6 +39688,8 @@ var ts;
39657
39688
  name: "outDir",
39658
39689
  type: "string",
39659
39690
  affectsEmit: true,
39691
+ affectsMultiFileEmitBuildInfo: true,
39692
+ affectsDeclarationPath: true,
39660
39693
  isFilePath: true,
39661
39694
  paramType: ts.Diagnostics.DIRECTORY,
39662
39695
  showInSimplifiedHelpView: true,
@@ -39667,6 +39700,8 @@ var ts;
39667
39700
  name: "rootDir",
39668
39701
  type: "string",
39669
39702
  affectsEmit: true,
39703
+ affectsMultiFileEmitBuildInfo: true,
39704
+ affectsDeclarationPath: true,
39670
39705
  isFilePath: true,
39671
39706
  paramType: ts.Diagnostics.LOCATION,
39672
39707
  category: ts.Diagnostics.Modules,
@@ -39677,6 +39712,8 @@ var ts;
39677
39712
  name: "composite",
39678
39713
  type: "boolean",
39679
39714
  affectsEmit: true,
39715
+ affectsMultiFileEmitBuildInfo: true,
39716
+ affectsBundleEmitBuildInfo: true,
39680
39717
  isTSConfigOnly: true,
39681
39718
  category: ts.Diagnostics.Projects,
39682
39719
  transpileOptionValue: undefined,
@@ -39687,6 +39724,8 @@ var ts;
39687
39724
  name: "tsBuildInfoFile",
39688
39725
  type: "string",
39689
39726
  affectsEmit: true,
39727
+ affectsMultiFileEmitBuildInfo: true,
39728
+ affectsBundleEmitBuildInfo: true,
39690
39729
  isFilePath: true,
39691
39730
  paramType: ts.Diagnostics.FILE,
39692
39731
  category: ts.Diagnostics.Projects,
@@ -39698,6 +39737,7 @@ var ts;
39698
39737
  name: "removeComments",
39699
39738
  type: "boolean",
39700
39739
  affectsEmit: true,
39740
+ affectsMultiFileEmitBuildInfo: true,
39701
39741
  showInSimplifiedHelpView: true,
39702
39742
  category: ts.Diagnostics.Emit,
39703
39743
  defaultValueDescription: false,
@@ -39716,6 +39756,7 @@ var ts;
39716
39756
  name: "importHelpers",
39717
39757
  type: "boolean",
39718
39758
  affectsEmit: true,
39759
+ affectsMultiFileEmitBuildInfo: true,
39719
39760
  category: ts.Diagnostics.Emit,
39720
39761
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
39721
39762
  defaultValueDescription: false,
@@ -39729,6 +39770,7 @@ var ts;
39729
39770
  })),
39730
39771
  affectsEmit: true,
39731
39772
  affectsSemanticDiagnostics: true,
39773
+ affectsMultiFileEmitBuildInfo: true,
39732
39774
  category: ts.Diagnostics.Emit,
39733
39775
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
39734
39776
  defaultValueDescription: 0 /* Remove */,
@@ -39737,6 +39779,7 @@ var ts;
39737
39779
  name: "downlevelIteration",
39738
39780
  type: "boolean",
39739
39781
  affectsEmit: true,
39782
+ affectsMultiFileEmitBuildInfo: true,
39740
39783
  category: ts.Diagnostics.Emit,
39741
39784
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
39742
39785
  defaultValueDescription: false,
@@ -39755,6 +39798,9 @@ var ts;
39755
39798
  type: "boolean",
39756
39799
  // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
39757
39800
  // The value of each strictFlag depends on own strictFlag value or this and never accessed directly.
39801
+ // But we need to store `strict` in builf info, even though it won't be examined directly, so that the
39802
+ // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly
39803
+ affectsMultiFileEmitBuildInfo: true,
39758
39804
  showInSimplifiedHelpView: true,
39759
39805
  category: ts.Diagnostics.Type_Checking,
39760
39806
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -39764,6 +39810,7 @@ var ts;
39764
39810
  name: "noImplicitAny",
39765
39811
  type: "boolean",
39766
39812
  affectsSemanticDiagnostics: true,
39813
+ affectsMultiFileEmitBuildInfo: true,
39767
39814
  strictFlag: true,
39768
39815
  category: ts.Diagnostics.Type_Checking,
39769
39816
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -39773,6 +39820,7 @@ var ts;
39773
39820
  name: "strictNullChecks",
39774
39821
  type: "boolean",
39775
39822
  affectsSemanticDiagnostics: true,
39823
+ affectsMultiFileEmitBuildInfo: true,
39776
39824
  strictFlag: true,
39777
39825
  category: ts.Diagnostics.Type_Checking,
39778
39826
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -39781,6 +39829,8 @@ var ts;
39781
39829
  {
39782
39830
  name: "strictFunctionTypes",
39783
39831
  type: "boolean",
39832
+ affectsSemanticDiagnostics: true,
39833
+ affectsMultiFileEmitBuildInfo: true,
39784
39834
  strictFlag: true,
39785
39835
  category: ts.Diagnostics.Type_Checking,
39786
39836
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -39789,6 +39839,8 @@ var ts;
39789
39839
  {
39790
39840
  name: "strictBindCallApply",
39791
39841
  type: "boolean",
39842
+ affectsSemanticDiagnostics: true,
39843
+ affectsMultiFileEmitBuildInfo: true,
39792
39844
  strictFlag: true,
39793
39845
  category: ts.Diagnostics.Type_Checking,
39794
39846
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -39798,6 +39850,7 @@ var ts;
39798
39850
  name: "strictPropertyInitialization",
39799
39851
  type: "boolean",
39800
39852
  affectsSemanticDiagnostics: true,
39853
+ affectsMultiFileEmitBuildInfo: true,
39801
39854
  strictFlag: true,
39802
39855
  category: ts.Diagnostics.Type_Checking,
39803
39856
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -39807,6 +39860,7 @@ var ts;
39807
39860
  name: "noImplicitThis",
39808
39861
  type: "boolean",
39809
39862
  affectsSemanticDiagnostics: true,
39863
+ affectsMultiFileEmitBuildInfo: true,
39810
39864
  strictFlag: true,
39811
39865
  category: ts.Diagnostics.Type_Checking,
39812
39866
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -39816,6 +39870,7 @@ var ts;
39816
39870
  name: "useUnknownInCatchVariables",
39817
39871
  type: "boolean",
39818
39872
  affectsSemanticDiagnostics: true,
39873
+ affectsMultiFileEmitBuildInfo: true,
39819
39874
  strictFlag: true,
39820
39875
  category: ts.Diagnostics.Type_Checking,
39821
39876
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -39825,6 +39880,8 @@ var ts;
39825
39880
  name: "alwaysStrict",
39826
39881
  type: "boolean",
39827
39882
  affectsSourceFile: true,
39883
+ affectsEmit: true,
39884
+ affectsMultiFileEmitBuildInfo: true,
39828
39885
  strictFlag: true,
39829
39886
  category: ts.Diagnostics.Type_Checking,
39830
39887
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -39835,6 +39892,7 @@ var ts;
39835
39892
  name: "noUnusedLocals",
39836
39893
  type: "boolean",
39837
39894
  affectsSemanticDiagnostics: true,
39895
+ affectsMultiFileEmitBuildInfo: true,
39838
39896
  category: ts.Diagnostics.Type_Checking,
39839
39897
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
39840
39898
  defaultValueDescription: false,
@@ -39843,6 +39901,7 @@ var ts;
39843
39901
  name: "noUnusedParameters",
39844
39902
  type: "boolean",
39845
39903
  affectsSemanticDiagnostics: true,
39904
+ affectsMultiFileEmitBuildInfo: true,
39846
39905
  category: ts.Diagnostics.Type_Checking,
39847
39906
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
39848
39907
  defaultValueDescription: false,
@@ -39851,6 +39910,7 @@ var ts;
39851
39910
  name: "exactOptionalPropertyTypes",
39852
39911
  type: "boolean",
39853
39912
  affectsSemanticDiagnostics: true,
39913
+ affectsMultiFileEmitBuildInfo: true,
39854
39914
  category: ts.Diagnostics.Type_Checking,
39855
39915
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
39856
39916
  defaultValueDescription: false,
@@ -39859,6 +39919,7 @@ var ts;
39859
39919
  name: "noImplicitReturns",
39860
39920
  type: "boolean",
39861
39921
  affectsSemanticDiagnostics: true,
39922
+ affectsMultiFileEmitBuildInfo: true,
39862
39923
  category: ts.Diagnostics.Type_Checking,
39863
39924
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
39864
39925
  defaultValueDescription: false,
@@ -39868,6 +39929,7 @@ var ts;
39868
39929
  type: "boolean",
39869
39930
  affectsBindDiagnostics: true,
39870
39931
  affectsSemanticDiagnostics: true,
39932
+ affectsMultiFileEmitBuildInfo: true,
39871
39933
  category: ts.Diagnostics.Type_Checking,
39872
39934
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
39873
39935
  defaultValueDescription: false,
@@ -39876,6 +39938,7 @@ var ts;
39876
39938
  name: "noUncheckedIndexedAccess",
39877
39939
  type: "boolean",
39878
39940
  affectsSemanticDiagnostics: true,
39941
+ affectsMultiFileEmitBuildInfo: true,
39879
39942
  category: ts.Diagnostics.Type_Checking,
39880
39943
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
39881
39944
  defaultValueDescription: false,
@@ -39884,6 +39947,7 @@ var ts;
39884
39947
  name: "noImplicitOverride",
39885
39948
  type: "boolean",
39886
39949
  affectsSemanticDiagnostics: true,
39950
+ affectsMultiFileEmitBuildInfo: true,
39887
39951
  category: ts.Diagnostics.Type_Checking,
39888
39952
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
39889
39953
  defaultValueDescription: false,
@@ -39891,6 +39955,8 @@ var ts;
39891
39955
  {
39892
39956
  name: "noPropertyAccessFromIndexSignature",
39893
39957
  type: "boolean",
39958
+ affectsSemanticDiagnostics: true,
39959
+ affectsMultiFileEmitBuildInfo: true,
39894
39960
  showInSimplifiedHelpView: false,
39895
39961
  category: ts.Diagnostics.Type_Checking,
39896
39962
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -39976,6 +40042,7 @@ var ts;
39976
40042
  name: "allowSyntheticDefaultImports",
39977
40043
  type: "boolean",
39978
40044
  affectsSemanticDiagnostics: true,
40045
+ affectsMultiFileEmitBuildInfo: true,
39979
40046
  category: ts.Diagnostics.Interop_Constraints,
39980
40047
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
39981
40048
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -39985,6 +40052,7 @@ var ts;
39985
40052
  type: "boolean",
39986
40053
  affectsSemanticDiagnostics: true,
39987
40054
  affectsEmit: true,
40055
+ affectsMultiFileEmitBuildInfo: true,
39988
40056
  showInSimplifiedHelpView: true,
39989
40057
  category: ts.Diagnostics.Interop_Constraints,
39990
40058
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -40001,6 +40069,7 @@ var ts;
40001
40069
  name: "allowUmdGlobalAccess",
40002
40070
  type: "boolean",
40003
40071
  affectsSemanticDiagnostics: true,
40072
+ affectsMultiFileEmitBuildInfo: true,
40004
40073
  category: ts.Diagnostics.Modules,
40005
40074
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
40006
40075
  defaultValueDescription: false,
@@ -40022,6 +40091,7 @@ var ts;
40022
40091
  name: "sourceRoot",
40023
40092
  type: "string",
40024
40093
  affectsEmit: true,
40094
+ affectsMultiFileEmitBuildInfo: true,
40025
40095
  paramType: ts.Diagnostics.LOCATION,
40026
40096
  category: ts.Diagnostics.Emit,
40027
40097
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -40030,6 +40100,7 @@ var ts;
40030
40100
  name: "mapRoot",
40031
40101
  type: "string",
40032
40102
  affectsEmit: true,
40103
+ affectsMultiFileEmitBuildInfo: true,
40033
40104
  paramType: ts.Diagnostics.LOCATION,
40034
40105
  category: ts.Diagnostics.Emit,
40035
40106
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -40038,6 +40109,7 @@ var ts;
40038
40109
  name: "inlineSourceMap",
40039
40110
  type: "boolean",
40040
40111
  affectsEmit: true,
40112
+ affectsMultiFileEmitBuildInfo: true,
40041
40113
  category: ts.Diagnostics.Emit,
40042
40114
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
40043
40115
  defaultValueDescription: false,
@@ -40046,6 +40118,7 @@ var ts;
40046
40118
  name: "inlineSources",
40047
40119
  type: "boolean",
40048
40120
  affectsEmit: true,
40121
+ affectsMultiFileEmitBuildInfo: true,
40049
40122
  category: ts.Diagnostics.Emit,
40050
40123
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
40051
40124
  defaultValueDescription: false,
@@ -40055,6 +40128,7 @@ var ts;
40055
40128
  name: "experimentalDecorators",
40056
40129
  type: "boolean",
40057
40130
  affectsSemanticDiagnostics: true,
40131
+ affectsMultiFileEmitBuildInfo: true,
40058
40132
  category: ts.Diagnostics.Language_and_Environment,
40059
40133
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
40060
40134
  defaultValueDescription: false,
@@ -40064,6 +40138,7 @@ var ts;
40064
40138
  type: "boolean",
40065
40139
  affectsSemanticDiagnostics: true,
40066
40140
  affectsEmit: true,
40141
+ affectsMultiFileEmitBuildInfo: true,
40067
40142
  category: ts.Diagnostics.Language_and_Environment,
40068
40143
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
40069
40144
  defaultValueDescription: false,
@@ -40088,6 +40163,7 @@ var ts;
40088
40163
  type: "string",
40089
40164
  affectsSemanticDiagnostics: true,
40090
40165
  affectsEmit: true,
40166
+ affectsMultiFileEmitBuildInfo: true,
40091
40167
  affectsModuleResolution: true,
40092
40168
  category: ts.Diagnostics.Language_and_Environment,
40093
40169
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -40105,6 +40181,9 @@ var ts;
40105
40181
  name: "out",
40106
40182
  type: "string",
40107
40183
  affectsEmit: true,
40184
+ affectsMultiFileEmitBuildInfo: true,
40185
+ affectsDeclarationPath: true,
40186
+ affectsBundleEmitBuildInfo: true,
40108
40187
  isFilePath: false,
40109
40188
  // for correct behaviour, please use outFile
40110
40189
  category: ts.Diagnostics.Backwards_Compatibility,
@@ -40116,6 +40195,7 @@ var ts;
40116
40195
  name: "reactNamespace",
40117
40196
  type: "string",
40118
40197
  affectsEmit: true,
40198
+ affectsMultiFileEmitBuildInfo: true,
40119
40199
  category: ts.Diagnostics.Language_and_Environment,
40120
40200
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
40121
40201
  defaultValueDescription: "`React`",
@@ -40123,6 +40203,8 @@ var ts;
40123
40203
  {
40124
40204
  name: "skipDefaultLibCheck",
40125
40205
  type: "boolean",
40206
+ // We need to store these to determine whether `lib` files need to be rechecked
40207
+ affectsMultiFileEmitBuildInfo: true,
40126
40208
  category: ts.Diagnostics.Completeness,
40127
40209
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
40128
40210
  defaultValueDescription: false,
@@ -40138,6 +40220,7 @@ var ts;
40138
40220
  name: "emitBOM",
40139
40221
  type: "boolean",
40140
40222
  affectsEmit: true,
40223
+ affectsMultiFileEmitBuildInfo: true,
40141
40224
  category: ts.Diagnostics.Emit,
40142
40225
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
40143
40226
  defaultValueDescription: false,
@@ -40149,6 +40232,7 @@ var ts;
40149
40232
  lf: 1 /* LineFeed */
40150
40233
  })),
40151
40234
  affectsEmit: true,
40235
+ affectsMultiFileEmitBuildInfo: true,
40152
40236
  paramType: ts.Diagnostics.NEWLINE,
40153
40237
  category: ts.Diagnostics.Emit,
40154
40238
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -40158,6 +40242,7 @@ var ts;
40158
40242
  name: "noErrorTruncation",
40159
40243
  type: "boolean",
40160
40244
  affectsSemanticDiagnostics: true,
40245
+ affectsMultiFileEmitBuildInfo: true,
40161
40246
  category: ts.Diagnostics.Output_Formatting,
40162
40247
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
40163
40248
  defaultValueDescription: false,
@@ -40188,6 +40273,7 @@ var ts;
40188
40273
  name: "stripInternal",
40189
40274
  type: "boolean",
40190
40275
  affectsEmit: true,
40276
+ affectsMultiFileEmitBuildInfo: true,
40191
40277
  category: ts.Diagnostics.Emit,
40192
40278
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
40193
40279
  defaultValueDescription: false,
@@ -40228,6 +40314,7 @@ var ts;
40228
40314
  name: "noImplicitUseStrict",
40229
40315
  type: "boolean",
40230
40316
  affectsSemanticDiagnostics: true,
40317
+ affectsMultiFileEmitBuildInfo: true,
40231
40318
  category: ts.Diagnostics.Backwards_Compatibility,
40232
40319
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
40233
40320
  defaultValueDescription: false,
@@ -40236,6 +40323,7 @@ var ts;
40236
40323
  name: "noEmitHelpers",
40237
40324
  type: "boolean",
40238
40325
  affectsEmit: true,
40326
+ affectsMultiFileEmitBuildInfo: true,
40239
40327
  category: ts.Diagnostics.Emit,
40240
40328
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
40241
40329
  defaultValueDescription: false,
@@ -40244,6 +40332,7 @@ var ts;
40244
40332
  name: "noEmitOnError",
40245
40333
  type: "boolean",
40246
40334
  affectsEmit: true,
40335
+ affectsMultiFileEmitBuildInfo: true,
40247
40336
  category: ts.Diagnostics.Emit,
40248
40337
  transpileOptionValue: undefined,
40249
40338
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -40253,6 +40342,7 @@ var ts;
40253
40342
  name: "preserveConstEnums",
40254
40343
  type: "boolean",
40255
40344
  affectsEmit: true,
40345
+ affectsMultiFileEmitBuildInfo: true,
40256
40346
  category: ts.Diagnostics.Emit,
40257
40347
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
40258
40348
  defaultValueDescription: false,
@@ -40261,6 +40351,8 @@ var ts;
40261
40351
  name: "declarationDir",
40262
40352
  type: "string",
40263
40353
  affectsEmit: true,
40354
+ affectsMultiFileEmitBuildInfo: true,
40355
+ affectsDeclarationPath: true,
40264
40356
  isFilePath: true,
40265
40357
  paramType: ts.Diagnostics.DIRECTORY,
40266
40358
  category: ts.Diagnostics.Emit,
@@ -40270,6 +40362,8 @@ var ts;
40270
40362
  {
40271
40363
  name: "skipLibCheck",
40272
40364
  type: "boolean",
40365
+ // We need to store these to determine whether `lib` files need to be rechecked
40366
+ affectsMultiFileEmitBuildInfo: true,
40273
40367
  category: ts.Diagnostics.Completeness,
40274
40368
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
40275
40369
  defaultValueDescription: false,
@@ -40279,6 +40373,7 @@ var ts;
40279
40373
  type: "boolean",
40280
40374
  affectsBindDiagnostics: true,
40281
40375
  affectsSemanticDiagnostics: true,
40376
+ affectsMultiFileEmitBuildInfo: true,
40282
40377
  category: ts.Diagnostics.Type_Checking,
40283
40378
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
40284
40379
  defaultValueDescription: undefined,
@@ -40288,6 +40383,7 @@ var ts;
40288
40383
  type: "boolean",
40289
40384
  affectsBindDiagnostics: true,
40290
40385
  affectsSemanticDiagnostics: true,
40386
+ affectsMultiFileEmitBuildInfo: true,
40291
40387
  category: ts.Diagnostics.Type_Checking,
40292
40388
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
40293
40389
  defaultValueDescription: undefined,
@@ -40296,6 +40392,7 @@ var ts;
40296
40392
  name: "suppressExcessPropertyErrors",
40297
40393
  type: "boolean",
40298
40394
  affectsSemanticDiagnostics: true,
40395
+ affectsMultiFileEmitBuildInfo: true,
40299
40396
  category: ts.Diagnostics.Backwards_Compatibility,
40300
40397
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
40301
40398
  defaultValueDescription: false,
@@ -40304,6 +40401,7 @@ var ts;
40304
40401
  name: "suppressImplicitAnyIndexErrors",
40305
40402
  type: "boolean",
40306
40403
  affectsSemanticDiagnostics: true,
40404
+ affectsMultiFileEmitBuildInfo: true,
40307
40405
  category: ts.Diagnostics.Backwards_Compatibility,
40308
40406
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
40309
40407
  defaultValueDescription: false,
@@ -40328,6 +40426,7 @@ var ts;
40328
40426
  name: "noStrictGenericChecks",
40329
40427
  type: "boolean",
40330
40428
  affectsSemanticDiagnostics: true,
40429
+ affectsMultiFileEmitBuildInfo: true,
40331
40430
  category: ts.Diagnostics.Backwards_Compatibility,
40332
40431
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
40333
40432
  defaultValueDescription: false,
@@ -40337,6 +40436,7 @@ var ts;
40337
40436
  type: "boolean",
40338
40437
  affectsSemanticDiagnostics: true,
40339
40438
  affectsEmit: true,
40439
+ affectsMultiFileEmitBuildInfo: true,
40340
40440
  category: ts.Diagnostics.Language_and_Environment,
40341
40441
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
40342
40442
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -40345,6 +40445,7 @@ var ts;
40345
40445
  name: "preserveValueImports",
40346
40446
  type: "boolean",
40347
40447
  affectsEmit: true,
40448
+ affectsMultiFileEmitBuildInfo: true,
40348
40449
  category: ts.Diagnostics.Emit,
40349
40450
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
40350
40451
  defaultValueDescription: false,
@@ -40388,6 +40489,8 @@ var ts;
40388
40489
  /* @internal */
40389
40490
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
40390
40491
  /* @internal */
40492
+ ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
40493
+ /* @internal */
40391
40494
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
40392
40495
  /* @internal */
40393
40496
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -41243,6 +41346,7 @@ var ts;
41243
41346
  return optionDefinition.type;
41244
41347
  }
41245
41348
  }
41349
+ /* @internal */
41246
41350
  function getNameOfCompilerOptionValue(value, customTypeMap) {
41247
41351
  // There is a typeMap associated with this command-line option so use it to map value back to its name
41248
41352
  return ts.forEachEntry(customTypeMap, function (mapValue, key) {
@@ -41251,6 +41355,7 @@ var ts;
41251
41355
  }
41252
41356
  });
41253
41357
  }
41358
+ ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
41254
41359
  function serializeCompilerOptions(options, pathOptions) {
41255
41360
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
41256
41361
  }
@@ -110533,7 +110638,8 @@ var ts;
110533
110638
  return;
110534
110639
  }
110535
110640
  var version = ts.version; // Extracted into a const so the form is stable between namespace and module
110536
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), /*writeByteOrderMark*/ false);
110641
+ var buildInfo = { bundle: bundle, program: program, version: version };
110642
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
110537
110643
  }
110538
110644
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
110539
110645
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -110687,13 +110793,18 @@ var ts;
110687
110793
  if (sourceMapFilePath) {
110688
110794
  var sourceMap = sourceMapGenerator.toString();
110689
110795
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110796
+ if (printer.bundleFileInfo)
110797
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
110690
110798
  }
110691
110799
  }
110692
110800
  else {
110693
110801
  writer.writeLine();
110694
110802
  }
110695
110803
  // Write the output file
110696
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110804
+ var text = writer.getText();
110805
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110806
+ if (printer.bundleFileInfo)
110807
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
110697
110808
  // Reset state
110698
110809
  writer.clear();
110699
110810
  }
@@ -110836,34 +110947,54 @@ var ts;
110836
110947
  }
110837
110948
  /*@internal*/
110838
110949
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
110950
+ var createHash = ts.maybeBind(host, host.createHash);
110839
110951
  var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
110840
- var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
110841
- if (!buildInfoText)
110952
+ var buildInfo;
110953
+ if (host.getBuildInfo) {
110954
+ var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
110955
+ if (!hostBuildInfo)
110956
+ return buildInfoPath;
110957
+ buildInfo = hostBuildInfo;
110958
+ }
110959
+ else {
110960
+ var buildInfoText = host.readFile(buildInfoPath);
110961
+ if (!buildInfoText)
110962
+ return buildInfoPath;
110963
+ buildInfo = getBuildInfo(buildInfoText);
110964
+ }
110965
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
110842
110966
  return buildInfoPath;
110843
110967
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
110844
110968
  if (!jsFileText)
110845
110969
  return jsFilePath;
110970
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
110971
+ return jsFilePath;
110846
110972
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
110847
110973
  // error if no source map or for now if inline sourcemap
110848
110974
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
110849
110975
  return sourceMapFilePath || "inline sourcemap decoding";
110976
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
110977
+ return sourceMapFilePath;
110850
110978
  // read declaration text
110851
110979
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
110852
110980
  if (declarationFilePath && !declarationText)
110853
110981
  return declarationFilePath;
110982
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
110983
+ return declarationFilePath;
110854
110984
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
110855
110985
  // error if no source map or for now if inline sourcemap
110856
110986
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
110857
110987
  return declarationMapPath || "inline sourcemap decoding";
110858
- var buildInfo = getBuildInfo(buildInfoText);
110859
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
110860
- return buildInfoPath;
110988
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
110989
+ return declarationMapPath;
110861
110990
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110862
110991
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
110863
110992
  /*onlyOwnText*/ true);
110864
110993
  var outputFiles = [];
110865
110994
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
110866
110995
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
110996
+ var changedDtsText;
110997
+ var changedDtsData;
110867
110998
  var emitHost = {
110868
110999
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
110869
111000
  getCanonicalFileName: host.getCanonicalFileName,
@@ -110879,7 +111010,7 @@ var ts;
110879
111010
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
110880
111011
  getProjectReferenceRedirect: ts.returnUndefined,
110881
111012
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
110882
- writeFile: function (name, text, writeByteOrderMark) {
111013
+ writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
110883
111014
  switch (name) {
110884
111015
  case jsFilePath:
110885
111016
  if (jsFileText === text)
@@ -110890,8 +111021,13 @@ var ts;
110890
111021
  return;
110891
111022
  break;
110892
111023
  case buildInfoPath:
110893
- var newBuildInfo = getBuildInfo(text);
111024
+ var newBuildInfo = data.buildInfo;
110894
111025
  newBuildInfo.program = buildInfo.program;
111026
+ if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
111027
+ // Update the output signature
111028
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
111029
+ newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
111030
+ }
110895
111031
  // Update sourceFileInfo
110896
111032
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
110897
111033
  newBuildInfo.bundle.js.sources = js.sources;
@@ -110899,11 +111035,13 @@ var ts;
110899
111035
  newBuildInfo.bundle.dts.sources = dts.sources;
110900
111036
  }
110901
111037
  newBuildInfo.bundle.sourceFiles = sourceFiles;
110902
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
111038
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
110903
111039
  return;
110904
111040
  case declarationFilePath:
110905
111041
  if (declarationText === text)
110906
111042
  return;
111043
+ changedDtsText = text;
111044
+ changedDtsData = data;
110907
111045
  break;
110908
111046
  case declarationMapPath:
110909
111047
  if (declarationMapText === text)
@@ -110922,6 +111060,7 @@ var ts;
110922
111060
  getSourceFileFromReference: ts.returnUndefined,
110923
111061
  redirectTargetsMap: ts.createMultiMap(),
110924
111062
  getFileIncludeReasons: ts.notImplemented,
111063
+ createHash: createHash,
110925
111064
  };
110926
111065
  emitFiles(ts.notImplementedResolver, emitHost,
110927
111066
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
@@ -116006,12 +116145,10 @@ var ts;
116006
116145
  }
116007
116146
  ts.createCompilerHost = createCompilerHost;
116008
116147
  /*@internal*/
116009
- // TODO(shkamat): update this after reworking ts build API
116010
116148
  function createCompilerHostWorker(options, setParentNodes, system) {
116011
116149
  if (system === void 0) { system = ts.sys; }
116012
116150
  var existingDirectories = new ts.Map();
116013
116151
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
116014
- var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
116015
116152
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
116016
116153
  var text;
116017
116154
  try {
@@ -116044,7 +116181,7 @@ var ts;
116044
116181
  // NOTE: If patchWriteFileEnsuringDirectory has been called,
116045
116182
  // the system.writeFile will do its own directory creation and
116046
116183
  // the ensureDirectoriesExist call will always be redundant.
116047
- 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); });
116184
+ 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); });
116048
116185
  ts.performance.mark("afterIOWrite");
116049
116186
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
116050
116187
  }
@@ -116054,35 +116191,6 @@ var ts;
116054
116191
  }
116055
116192
  }
116056
116193
  }
116057
- var outputFingerprints;
116058
- function writeFileWorker(fileName, data, writeByteOrderMark) {
116059
- if (!ts.isWatchSet(options) || !system.getModifiedTime) {
116060
- system.writeFile(fileName, data, writeByteOrderMark);
116061
- return;
116062
- }
116063
- if (!outputFingerprints) {
116064
- outputFingerprints = new ts.Map();
116065
- }
116066
- var hash = computeHash(data);
116067
- var mtimeBefore = system.getModifiedTime(fileName);
116068
- if (mtimeBefore) {
116069
- var fingerprint = outputFingerprints.get(fileName);
116070
- // If output has not been changed, and the file has no external modification
116071
- if (fingerprint &&
116072
- fingerprint.byteOrderMark === writeByteOrderMark &&
116073
- fingerprint.hash === hash &&
116074
- fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
116075
- return;
116076
- }
116077
- }
116078
- system.writeFile(fileName, data, writeByteOrderMark);
116079
- var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
116080
- outputFingerprints.set(fileName, {
116081
- hash: hash,
116082
- byteOrderMark: writeByteOrderMark,
116083
- mtime: mtimeAfter
116084
- });
116085
- }
116086
116194
  function getDefaultLibLocation() {
116087
116195
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
116088
116196
  }
@@ -117672,6 +117780,7 @@ var ts;
117672
117780
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
117673
117781
  redirectTargetsMap: redirectTargetsMap,
117674
117782
  getFileIncludeReasons: program.getFileIncludeReasons,
117783
+ createHash: ts.maybeBind(host, host.createHash),
117675
117784
  };
117676
117785
  }
117677
117786
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -119785,13 +119894,9 @@ var ts;
119785
119894
  function createManyToManyPathMap() {
119786
119895
  function create(forward, reverse, deleted) {
119787
119896
  var map = {
119788
- clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119789
- forEach: function (fn) { return forward.forEach(fn); },
119790
119897
  getKeys: function (v) { return reverse.get(v); },
119791
119898
  getValues: function (k) { return forward.get(k); },
119792
- hasKey: function (k) { return forward.has(k); },
119793
119899
  keys: function () { return forward.keys(); },
119794
- deletedKeys: function () { return deleted; },
119795
119900
  deleteKey: function (k) {
119796
119901
  (deleted || (deleted = new ts.Set())).add(k);
119797
119902
  var set = forward.get(k);
@@ -119818,11 +119923,6 @@ var ts;
119818
119923
  });
119819
119924
  return map;
119820
119925
  },
119821
- clear: function () {
119822
- forward.clear();
119823
- reverse.clear();
119824
- deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119825
- }
119826
119926
  };
119827
119927
  return map;
119828
119928
  }
@@ -119950,18 +120050,21 @@ var ts;
119950
120050
  * Creates the state of file references and signature for the new program from oldState if it is safe
119951
120051
  */
119952
120052
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
120053
+ var _a, _b, _c;
119953
120054
  var fileInfos = new ts.Map();
119954
120055
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
119955
120056
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
119956
- var hasCalledUpdateShapeSignature = new ts.Set();
119957
120057
  var useOldState = canReuseOldState(referencedMap, oldState);
119958
120058
  // Ensure source files have parent pointers set
119959
120059
  newProgram.getTypeChecker();
119960
120060
  // Create the reference map, and set the file infos
119961
- for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
119962
- var sourceFile = _a[_i];
120061
+ for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
120062
+ var sourceFile = _d[_i];
119963
120063
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
119964
- var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
120064
+ var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
120065
+ var signature = oldUncommitedSignature === undefined ?
120066
+ useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
120067
+ oldUncommitedSignature || undefined;
119965
120068
  if (referencedMap) {
119966
120069
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
119967
120070
  if (newReferences) {
@@ -119969,19 +120072,26 @@ var ts;
119969
120072
  }
119970
120073
  // Copy old visible to outside files map
119971
120074
  if (useOldState) {
119972
- var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
120075
+ var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
120076
+ var exportedModules = oldUncommitedExportedModules === undefined ?
120077
+ oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
120078
+ oldUncommitedExportedModules || undefined;
119973
120079
  if (exportedModules) {
119974
120080
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119975
120081
  }
119976
120082
  }
119977
120083
  }
119978
- fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
120084
+ fileInfos.set(sourceFile.resolvedPath, {
120085
+ version: version_2,
120086
+ signature: signature,
120087
+ affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
120088
+ impliedFormat: sourceFile.impliedNodeFormat
120089
+ });
119979
120090
  }
119980
120091
  return {
119981
120092
  fileInfos: fileInfos,
119982
120093
  referencedMap: referencedMap,
119983
120094
  exportedModulesMap: exportedModulesMap,
119984
- hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
119985
120095
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
119986
120096
  };
119987
120097
  }
@@ -119995,71 +120105,42 @@ var ts;
119995
120105
  }
119996
120106
  BuilderState.releaseCache = releaseCache;
119997
120107
  /**
119998
- * Creates a clone of the state
120108
+ * Gets the files affected by the path from the program
119999
120109
  */
120000
- function clone(state) {
120110
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
120001
120111
  var _a, _b;
120002
- // Dont need to backup allFiles info since its cache anyway
120003
- return {
120004
- fileInfos: new ts.Map(state.fileInfos),
120005
- referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
120006
- exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
120007
- hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
120008
- useFileVersionAsSignature: state.useFileVersionAsSignature,
120009
- };
120112
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
120113
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
120114
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120115
+ return result;
120010
120116
  }
120011
- BuilderState.clone = clone;
120012
- /**
120013
- * Gets the files affected by the path from the program
120014
- */
120015
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
120016
- // Since the operation could be cancelled, the signatures are always stored in the cache
120017
- // They will be committed once it is safe to use them
120018
- // eg when calling this api from tsserver, if there is no cancellation of the operation
120019
- // In the other cases the affected files signatures are committed only after the iteration through the result is complete
120020
- var signatureCache = cacheToUpdateSignature || new ts.Map();
120117
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
120118
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
120021
120119
  var sourceFile = programOfThisState.getSourceFileByPath(path);
120022
120120
  if (!sourceFile) {
120023
120121
  return ts.emptyArray;
120024
120122
  }
120025
- if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
120123
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
120026
120124
  return [sourceFile];
120027
120125
  }
120028
- var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
120029
- if (!cacheToUpdateSignature) {
120030
- // Commit all the signatures in the signature cache
120031
- updateSignaturesFromCache(state, signatureCache);
120032
- }
120033
- return result;
120034
- }
120035
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
120036
- /**
120037
- * Updates the signatures from the cache into state's fileinfo signatures
120038
- * This should be called whenever it is safe to commit the state of the builder
120039
- */
120040
- function updateSignaturesFromCache(state, signatureCache) {
120041
- signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
120126
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
120042
120127
  }
120043
- BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
120128
+ BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
120044
120129
  function updateSignatureOfFile(state, signature, path) {
120045
120130
  state.fileInfos.get(path).signature = signature;
120046
- state.hasCalledUpdateShapeSignature.add(path);
120131
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
120047
120132
  }
120048
120133
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
120049
120134
  /**
120050
120135
  * Returns if the shape of the signature has changed since last emit
120051
120136
  */
120052
- function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
120137
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
120138
+ var _a;
120053
120139
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
120054
- ts.Debug.assert(!!sourceFile);
120055
- ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
120056
120140
  // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
120057
- if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
120141
+ if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
120058
120142
  return false;
120059
- }
120060
120143
  var info = state.fileInfos.get(sourceFile.resolvedPath);
120061
- if (!info)
120062
- return ts.Debug.fail();
120063
120144
  var prevSignature = info.signature;
120064
120145
  var latestSignature;
120065
120146
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -120070,45 +120151,55 @@ var ts;
120070
120151
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
120071
120152
  if (firstDts_1) {
120072
120153
  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; })); });
120073
- latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
120074
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
120075
- updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
120154
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
120155
+ if (latestSignature !== prevSignature) {
120156
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
120076
120157
  }
120077
120158
  }
120078
120159
  }
120079
120160
  // Default is to use file version as signature
120080
120161
  if (latestSignature === undefined) {
120081
120162
  latestSignature = sourceFile.version;
120082
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
120163
+ if (state.exportedModulesMap && latestSignature !== prevSignature) {
120164
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
120083
120165
  // All the references in this file are exported
120084
120166
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
120085
120167
  if (references) {
120086
- exportedModulesMapCache.set(sourceFile.resolvedPath, references);
120168
+ state.exportedModulesMap.set(sourceFile.resolvedPath, references);
120087
120169
  }
120088
120170
  else {
120089
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
120171
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
120090
120172
  }
120091
120173
  }
120092
120174
  }
120093
- cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
120175
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
120176
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
120177
+ info.signature = latestSignature;
120094
120178
  return latestSignature !== prevSignature;
120095
120179
  }
120096
120180
  BuilderState.updateShapeSignature = updateShapeSignature;
120181
+ function computeSignature(text, computeHash) {
120182
+ return (computeHash || ts.generateDjb2Hash)(text);
120183
+ }
120184
+ BuilderState.computeSignature = computeSignature;
120097
120185
  /**
120098
120186
  * Coverts the declaration emit result into exported modules map
120099
120187
  */
120100
- function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
120188
+ function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
120189
+ if (!state.exportedModulesMap)
120190
+ return;
120191
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
120101
120192
  if (!exportedModulesFromDeclarationEmit) {
120102
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
120193
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
120103
120194
  return;
120104
120195
  }
120105
120196
  var exportedModules;
120106
120197
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
120107
120198
  if (exportedModules) {
120108
- exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
120199
+ state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
120109
120200
  }
120110
120201
  else {
120111
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
120202
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
120112
120203
  }
120113
120204
  function addExportedModule(exportedModulePaths) {
120114
120205
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -120120,19 +120211,6 @@ var ts;
120120
120211
  }
120121
120212
  }
120122
120213
  BuilderState.updateExportedModules = updateExportedModules;
120123
- /**
120124
- * Updates the exported modules from cache into state's exported modules map
120125
- * This should be called whenever it is safe to commit the state of the builder
120126
- */
120127
- function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
120128
- var _a;
120129
- if (exportedModulesMapCache) {
120130
- ts.Debug.assert(!!state.exportedModulesMap);
120131
- (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
120132
- exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
120133
- }
120134
- }
120135
- BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
120136
120214
  /**
120137
120215
  * Get all the dependencies of the sourceFile
120138
120216
  */
@@ -120253,7 +120331,7 @@ var ts;
120253
120331
  /**
120254
120332
  * When program emits modular code, gets the files affected by the sourceFile whose shape has changed
120255
120333
  */
120256
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
120334
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
120257
120335
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
120258
120336
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
120259
120337
  }
@@ -120273,7 +120351,7 @@ var ts;
120273
120351
  if (!seenFileNamesMap.has(currentPath)) {
120274
120352
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
120275
120353
  seenFileNamesMap.set(currentPath, currentSourceFile);
120276
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
120354
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
120277
120355
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
120278
120356
  }
120279
120357
  }
@@ -120299,32 +120377,33 @@ var ts;
120299
120377
  * Create the state so that we can iterate on changedFiles/affected files
120300
120378
  */
120301
120379
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
120380
+ var _a, _b;
120302
120381
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
120303
120382
  state.program = newProgram;
120304
120383
  var compilerOptions = newProgram.getCompilerOptions();
120305
120384
  state.compilerOptions = compilerOptions;
120385
+ var outFilePath = ts.outFile(compilerOptions);
120306
120386
  // With --out or --outFile, any change affects all semantic diagnostics so no need to cache them
120307
- if (!ts.outFile(compilerOptions)) {
120387
+ if (!outFilePath) {
120308
120388
  state.semanticDiagnosticsPerFile = new ts.Map();
120309
120389
  }
120390
+ 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)) {
120391
+ state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
120392
+ }
120310
120393
  state.changedFilesSet = new ts.Set();
120394
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
120311
120395
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
120312
120396
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
120313
120397
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
120314
120398
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
120399
+ var canCopyEmitSignatures = compilerOptions.composite &&
120400
+ (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
120401
+ !outFilePath &&
120402
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
120315
120403
  if (useOldState) {
120316
- // Verify the sanity of old state
120317
- if (!oldState.currentChangedFilePath) {
120318
- var affectedSignatures = oldState.currentAffectedFilesSignatures;
120319
- ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
120320
- }
120321
- var changedFilesSet = oldState.changedFilesSet;
120322
- if (canCopySemanticDiagnostics) {
120323
- ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
120324
- }
120325
120404
  // Copy old state's changed files set
120326
- changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
120327
- if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
120405
+ (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
120406
+ if (!outFilePath && oldState.affectedFilesPendingEmit) {
120328
120407
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
120329
120408
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
120330
120409
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -120345,6 +120424,8 @@ var ts;
120345
120424
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
120346
120425
  // versions dont match
120347
120426
  oldInfo.version !== info.version ||
120427
+ // Implied formats dont match
120428
+ oldInfo.impliedFormat !== info.impliedFormat ||
120348
120429
  // Referenced files changed
120349
120430
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
120350
120431
  // Referenced file was deleted in the new program
@@ -120368,27 +120449,25 @@ var ts;
120368
120449
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
120369
120450
  }
120370
120451
  }
120452
+ if (canCopyEmitSignatures) {
120453
+ var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
120454
+ if (oldEmitSignature)
120455
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
120456
+ }
120371
120457
  });
120372
120458
  // If the global file is removed, add all files as changed
120373
120459
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
120374
120460
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, /*firstSourceFile*/ undefined)
120375
120461
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
120376
120462
  }
120377
- else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
120463
+ else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
120378
120464
  // Add all files to affectedFilesPendingEmit since emit changed
120379
120465
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1 /* Full */); });
120380
120466
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
120381
120467
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
120382
120468
  }
120383
- if (useOldState) {
120384
- // Any time the interpretation of a source file changes, mark it as changed
120385
- ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
120386
- if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
120387
- state.changedFilesSet.add(sourceFilePath);
120388
- }
120389
- });
120390
- }
120391
- state.buildInfoEmitPending = !!state.changedFilesSet.size;
120469
+ // Since old states change files set is copied, any additional change means we would need to emit build info
120470
+ state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
120392
120471
  return state;
120393
120472
  }
120394
120473
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -120424,30 +120503,35 @@ var ts;
120424
120503
  ts.BuilderState.releaseCache(state);
120425
120504
  state.program = undefined;
120426
120505
  }
120427
- /**
120428
- * Creates a clone of the state
120429
- */
120430
- function cloneBuilderProgramState(state) {
120431
- var _a;
120432
- var newState = ts.BuilderState.clone(state);
120433
- newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
120434
- newState.changedFilesSet = new ts.Set(state.changedFilesSet);
120435
- newState.affectedFiles = state.affectedFiles;
120436
- newState.affectedFilesIndex = state.affectedFilesIndex;
120437
- newState.currentChangedFilePath = state.currentChangedFilePath;
120438
- newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
120439
- newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
120440
- newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
120441
- newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
120442
- newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
120443
- newState.program = state.program;
120444
- newState.compilerOptions = state.compilerOptions;
120445
- newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
120446
- newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
120447
- newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
120448
- newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
120449
- newState.programEmitComplete = state.programEmitComplete;
120450
- return newState;
120506
+ function backupEmitBuilderProgramState(state) {
120507
+ var outFilePath = ts.outFile(state.compilerOptions);
120508
+ // Only in --out changeFileSet is kept around till emit
120509
+ ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
120510
+ return {
120511
+ affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
120512
+ affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
120513
+ affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
120514
+ seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
120515
+ programEmitComplete: state.programEmitComplete,
120516
+ emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
120517
+ outSignature: state.outSignature,
120518
+ dtsChangeTime: state.dtsChangeTime,
120519
+ hasChangedEmitSignature: state.hasChangedEmitSignature,
120520
+ changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
120521
+ };
120522
+ }
120523
+ function restoreEmitBuilderProgramState(state, backupEmitState) {
120524
+ state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
120525
+ state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
120526
+ state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
120527
+ state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
120528
+ state.programEmitComplete = backupEmitState.programEmitComplete;
120529
+ state.emitSignatures = backupEmitState.emitSignatures;
120530
+ state.outSignature = backupEmitState.outSignature;
120531
+ state.dtsChangeTime = backupEmitState.dtsChangeTime;
120532
+ state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
120533
+ if (backupEmitState.changedFilesSet)
120534
+ state.changedFilesSet = backupEmitState.changedFilesSet;
120451
120535
  }
120452
120536
  /**
120453
120537
  * Verifies that source file is ok to be used in calls that arent handled by next
@@ -120462,7 +120546,7 @@ var ts;
120462
120546
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
120463
120547
  */
120464
120548
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
120465
- var _a;
120549
+ var _a, _b;
120466
120550
  while (true) {
120467
120551
  var affectedFiles = state.affectedFiles;
120468
120552
  if (affectedFiles) {
@@ -120482,10 +120566,8 @@ var ts;
120482
120566
  state.changedFilesSet.delete(state.currentChangedFilePath);
120483
120567
  state.currentChangedFilePath = undefined;
120484
120568
  // Commit the changes in file signature
120485
- ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
120486
- state.currentAffectedFilesSignatures.clear();
120487
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120488
- (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
120569
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
120570
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120489
120571
  state.affectedFiles = undefined;
120490
120572
  }
120491
120573
  // Get next changed file
@@ -120503,12 +120585,7 @@ var ts;
120503
120585
  return program;
120504
120586
  }
120505
120587
  // Get next batch of affected files
120506
- if (!state.currentAffectedFilesSignatures)
120507
- state.currentAffectedFilesSignatures = new ts.Map();
120508
- if (state.exportedModulesMap) {
120509
- state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
120510
- }
120511
- state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
120588
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
120512
120589
  state.currentChangedFilePath = nextKey.value;
120513
120590
  state.affectedFilesIndex = 0;
120514
120591
  if (!state.seenAffectedFiles)
@@ -120560,7 +120637,6 @@ var ts;
120560
120637
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
120561
120638
  */
120562
120639
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120563
- var _a;
120564
120640
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
120565
120641
  // If affected files is everything except default library, then nothing more to do
120566
120642
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -120568,10 +120644,9 @@ var ts;
120568
120644
  // When a change affects the global scope, all files are considered to be affected without updating their signature
120569
120645
  // That means when affected file is handled, its signature can be out of date
120570
120646
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
120571
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
120647
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
120572
120648
  return;
120573
120649
  }
120574
- 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);
120575
120650
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
120576
120651
  return;
120577
120652
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -120591,7 +120666,7 @@ var ts;
120591
120666
  // This ensures that we dont later during incremental builds considering wrong signature.
120592
120667
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
120593
120668
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
120594
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
120669
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
120595
120670
  // If not dts emit, nothing more to do
120596
120671
  if (ts.getEmitDeclarations(state.compilerOptions)) {
120597
120672
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -120612,27 +120687,10 @@ var ts;
120612
120687
  return !state.semanticDiagnosticsFromOldState.size;
120613
120688
  }
120614
120689
  function isChangedSignature(state, path) {
120615
- var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
120616
- var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120690
+ var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
120691
+ var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120617
120692
  return newSignature !== oldSignature;
120618
120693
  }
120619
- function forEachKeyOfExportedModulesMap(state, filePath, fn) {
120620
- // Go through exported modules from cache first
120621
- var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
120622
- var result = keys && ts.forEachKey(keys, fn);
120623
- if (result)
120624
- return result;
120625
- // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
120626
- keys = state.exportedModulesMap.getKeys(filePath);
120627
- return keys && ts.forEachKey(keys, function (exportedFromPath) {
120628
- var _a;
120629
- // If the cache had an updated value, skip
120630
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
120631
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
120632
- fn(exportedFromPath) :
120633
- undefined;
120634
- });
120635
- }
120636
120694
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
120637
120695
  var _a;
120638
120696
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -120647,6 +120705,7 @@ var ts;
120647
120705
  * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
120648
120706
  */
120649
120707
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120708
+ var _a;
120650
120709
  // If there was change in signature (dts output) for the changed file,
120651
120710
  // then only we need to handle pending file emit
120652
120711
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
@@ -120673,11 +120732,10 @@ var ts;
120673
120732
  }
120674
120733
  }
120675
120734
  }
120676
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120677
120735
  var seenFileAndExportsOfFile = new ts.Set();
120678
120736
  // Go through exported modules from cache first
120679
120737
  // If exported modules has path, all files referencing file exported from are affected
120680
- forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
120738
+ (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120681
120739
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
120682
120740
  return true;
120683
120741
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -120691,19 +120749,18 @@ var ts;
120691
120749
  * return true when all work is done and we can exit handling dts emit and semantic diagnostics
120692
120750
  */
120693
120751
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
120694
- var _a;
120752
+ var _a, _b;
120695
120753
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
120696
120754
  return undefined;
120697
120755
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
120698
120756
  return true;
120699
120757
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
120700
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120701
120758
  // If exported modules has path, all files referencing file exported from are affected
120702
- forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
120759
+ (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120703
120760
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
120704
120761
  });
120705
120762
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
120706
- (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
120763
+ (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
120707
120764
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
120708
120765
  handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
120709
120766
  state, referencingFilePath, cancellationToken, computeHash, host);
@@ -120724,12 +120781,13 @@ var ts;
120724
120781
  }
120725
120782
  else {
120726
120783
  state.seenAffectedFiles.add(affected.resolvedPath);
120784
+ // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted
120785
+ state.buildInfoEmitPending = true;
120727
120786
  if (emitKind !== undefined) {
120728
120787
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
120729
120788
  }
120730
120789
  if (isPendingEmit) {
120731
120790
  state.affectedFilesPendingEmitIndex++;
120732
- state.buildInfoEmitPending = true;
120733
120791
  }
120734
120792
  else {
120735
120793
  state.affectedFilesIndex++;
@@ -120777,25 +120835,61 @@ var ts;
120777
120835
  }
120778
120836
  return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
120779
120837
  }
120838
+ function isProgramBundleEmitBuildInfo(info) {
120839
+ return !!ts.outFile(info.options || {});
120840
+ }
120841
+ ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
120780
120842
  /**
120781
120843
  * Gets the program information to be emitted in buildInfo so that we can use it to create new program
120782
120844
  */
120783
- function getProgramBuildInfo(state, getCanonicalFileName) {
120784
- if (ts.outFile(state.compilerOptions))
120785
- return undefined;
120845
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
120846
+ var outFilePath = ts.outFile(state.compilerOptions);
120847
+ if (outFilePath && !state.compilerOptions.composite)
120848
+ return;
120786
120849
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
120787
120850
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
120851
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
120852
+ if (outFilePath) {
120853
+ var fileNames_1 = [];
120854
+ var fileInfos_1 = [];
120855
+ state.program.getRootFileNames().forEach(function (f) {
120856
+ var sourceFile = state.program.getSourceFile(f);
120857
+ if (!sourceFile)
120858
+ return;
120859
+ fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
120860
+ fileInfos_1.push(sourceFile.version);
120861
+ });
120862
+ var result_15 = {
120863
+ fileNames: fileNames_1,
120864
+ fileInfos: fileInfos_1,
120865
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
120866
+ outSignature: state.outSignature,
120867
+ dtsChangeTime: state.dtsChangeTime,
120868
+ };
120869
+ return result_15;
120870
+ }
120788
120871
  var fileNames = [];
120789
120872
  var fileNameToFileId = new ts.Map();
120790
120873
  var fileIdsList;
120791
120874
  var fileNamesToFileIdListId;
120875
+ var emitSignatures;
120792
120876
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
120877
+ var _b, _c;
120793
120878
  var key = _a[0], value = _a[1];
120794
120879
  // Ensure fileId
120795
120880
  var fileId = toFileId(key);
120796
120881
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
120797
- var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120798
- var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120882
+ var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
120883
+ var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
120884
+ if (state.compilerOptions.composite) {
120885
+ var file = state.program.getSourceFileByPath(key);
120886
+ if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
120887
+ var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
120888
+ if (emitSignature !== actualSignature) {
120889
+ (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
120890
+ }
120891
+ }
120892
+ }
120799
120893
  return value.version === actualSignature ?
120800
120894
  value.affectsGlobalScope || value.impliedFormat ?
120801
120895
  // If file version is same as signature, dont serialize signature
@@ -120803,11 +120897,11 @@ var ts;
120803
120897
  // If file info only contains version and signature and both are same we can just write string
120804
120898
  value.version :
120805
120899
  actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120806
- signature === undefined ?
120900
+ oldSignature === undefined ?
120807
120901
  // If we havent computed signature, use fileInfo as is
120808
120902
  value :
120809
120903
  // Serialize fileInfo with new updated signature
120810
- { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120904
+ { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120811
120905
  // Signature of the FileInfo is undefined, serialize it as false
120812
120906
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120813
120907
  });
@@ -120822,17 +120916,13 @@ var ts;
120822
120916
  if (state.exportedModulesMap) {
120823
120917
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
120824
120918
  var _a;
120825
- if (state.currentAffectedFilesExportedModulesMap) {
120826
- if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
120827
- return undefined;
120828
- }
120829
- var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
120830
- if (newValue) {
120831
- return [toFileId(key), toFileIdListId(newValue)];
120832
- }
120833
- }
120919
+ var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
120834
120920
  // Not in temporary cache, use existing value
120835
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120921
+ if (oldValue === undefined)
120922
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120923
+ if (oldValue)
120924
+ return [toFileId(key), toFileIdListId(oldValue)];
120925
+ return undefined;
120836
120926
  });
120837
120927
  }
120838
120928
  var semanticDiagnosticsPerFile;
@@ -120843,9 +120933,7 @@ var ts;
120843
120933
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
120844
120934
  [
120845
120935
  toFileId(key),
120846
- state.hasReusableDiagnostic ?
120847
- value :
120848
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120936
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
120849
120937
  ] :
120850
120938
  toFileId(key));
120851
120939
  }
@@ -120860,16 +120948,27 @@ var ts;
120860
120948
  }
120861
120949
  }
120862
120950
  }
120863
- return {
120951
+ var changeFileSet;
120952
+ if (state.changedFilesSet.size) {
120953
+ for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
120954
+ var path = _e[_d];
120955
+ (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120956
+ }
120957
+ }
120958
+ var result = {
120864
120959
  fileNames: fileNames,
120865
120960
  fileInfos: fileInfos,
120866
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
120961
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
120867
120962
  fileIdsList: fileIdsList,
120868
120963
  referencedMap: referencedMap,
120869
120964
  exportedModulesMap: exportedModulesMap,
120870
120965
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
120871
120966
  affectedFilesPendingEmit: affectedFilesPendingEmit,
120967
+ changeFileSet: changeFileSet,
120968
+ emitSignatures: emitSignatures,
120969
+ dtsChangeTime: state.dtsChangeTime,
120872
120970
  };
120971
+ return result;
120873
120972
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
120874
120973
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
120875
120974
  }
@@ -120894,24 +120993,18 @@ var ts;
120894
120993
  }
120895
120994
  return fileIdListId;
120896
120995
  }
120897
- }
120898
- function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
120899
- var result;
120900
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120901
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120902
- var name = _a[_i];
120903
- var optionKey = name.toLowerCase();
120904
- var optionInfo = optionsNameMap.get(optionKey);
120905
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
120906
- // We need to store `strict`, even though it won't be examined directly, so that the
120907
- // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
120908
- optionKey === "strict" ||
120909
- // We need to store these to determine whether `lib` files need to be rechecked.
120910
- optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
120911
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
120996
+ function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
120997
+ var result;
120998
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120999
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
121000
+ var name = _a[_i];
121001
+ var optionInfo = optionsNameMap.get(name.toLowerCase());
121002
+ if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
121003
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
121004
+ }
120912
121005
  }
121006
+ return result;
120913
121007
  }
120914
- return result;
120915
121008
  }
120916
121009
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120917
121010
  if (option) {
@@ -120985,6 +121078,10 @@ var ts;
120985
121078
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
120986
121079
  }
120987
121080
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
121081
+ function computeSignature(text, data, computeHash) {
121082
+ return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
121083
+ }
121084
+ ts.computeSignature = computeSignature;
120988
121085
  function createBuilderProgram(kind, _a) {
120989
121086
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
120990
121087
  // Return same program if underlying program doesnt change
@@ -121003,8 +121100,8 @@ var ts;
121003
121100
  */
121004
121101
  var computeHash = ts.maybeBind(host, host.createHash);
121005
121102
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
121006
- var backupState;
121007
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
121103
+ var backupEmitState;
121104
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
121008
121105
  // To ensure that we arent storing any references to old program or new program without state
121009
121106
  newProgram = undefined; // TODO: GH#18217
121010
121107
  oldProgram = undefined;
@@ -121012,20 +121109,20 @@ var ts;
121012
121109
  var getState = function () { return state; };
121013
121110
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
121014
121111
  builderProgram.getState = getState;
121015
- builderProgram.backupState = function () {
121016
- ts.Debug.assert(backupState === undefined);
121017
- backupState = cloneBuilderProgramState(state);
121112
+ builderProgram.backupEmitState = function () {
121113
+ ts.Debug.assert(backupEmitState === undefined);
121114
+ backupEmitState = backupEmitBuilderProgramState(state);
121018
121115
  };
121019
- builderProgram.restoreState = function () {
121020
- state = ts.Debug.checkDefined(backupState);
121021
- backupState = undefined;
121116
+ builderProgram.restoreEmitState = function () {
121117
+ restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
121118
+ backupEmitState = undefined;
121022
121119
  };
121023
121120
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
121024
121121
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
121025
121122
  builderProgram.emit = emit;
121026
121123
  builderProgram.releaseProgram = function () {
121027
121124
  releaseCache(state);
121028
- backupState = undefined;
121125
+ backupEmitState = undefined;
121029
121126
  };
121030
121127
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
121031
121128
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -121084,35 +121181,59 @@ var ts;
121084
121181
  return toAffectedFileEmitResult(state,
121085
121182
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
121086
121183
  // Otherwise just affected file
121087
- ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
121088
- getWriteFileUpdatingSignatureCallback(writeFile) :
121184
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
121185
+ getWriteFileCallback(writeFile, customTransformers) :
121089
121186
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
121090
121187
  }
121091
- function getWriteFileUpdatingSignatureCallback(writeFile) {
121188
+ function getWriteFileCallback(writeFile, customTransformers) {
121092
121189
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
121093
- var _a;
121190
+ var _a, _b, _c;
121094
121191
  if (ts.isDeclarationFileName(fileName)) {
121095
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
121096
- var file = sourceFiles[0];
121097
- var info = state.fileInfos.get(file.resolvedPath);
121098
- var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
121099
- if (signature === file.version) {
121100
- var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
121101
- if (newSignature !== file.version) { // Update it
121102
- if (host.storeFilesChangingSignatureDuringEmit)
121103
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
121104
- if (state.exportedModulesMap)
121105
- ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
121106
- if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
121107
- state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
121192
+ if (!ts.outFile(state.compilerOptions)) {
121193
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
121194
+ var newSignature = void 0;
121195
+ if (!customTransformers) {
121196
+ var file = sourceFiles[0];
121197
+ var info = state.fileInfos.get(file.resolvedPath);
121198
+ if (info.signature === file.version) {
121199
+ newSignature = computeSignature(text, data, computeHash);
121200
+ if (newSignature !== file.version) { // Update it
121201
+ if (host.storeFilesChangingSignatureDuringEmit)
121202
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
121203
+ if (state.exportedModulesMap)
121204
+ ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
121205
+ if (state.affectedFiles) {
121206
+ // Keep old signature so we know what to undo if cancellation happens
121207
+ var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
121208
+ if (existing === undefined)
121209
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
121210
+ info.signature = newSignature;
121211
+ }
121212
+ else {
121213
+ // These are directly commited
121214
+ info.signature = newSignature;
121215
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
121216
+ }
121217
+ }
121108
121218
  }
121109
- else {
121110
- info.signature = newSignature;
121111
- if (state.exportedModulesMap)
121112
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
121219
+ }
121220
+ if (state.compilerOptions.composite) {
121221
+ var filePath = sourceFiles[0].resolvedPath;
121222
+ var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
121223
+ newSignature || (newSignature = computeSignature(text, data, computeHash));
121224
+ if (newSignature !== oldSignature) {
121225
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
121226
+ state.hasChangedEmitSignature = true;
121113
121227
  }
121114
121228
  }
121115
121229
  }
121230
+ else if (state.compilerOptions.composite) {
121231
+ var newSignature = computeSignature(text, data, computeHash);
121232
+ if (newSignature !== state.outSignature) {
121233
+ state.outSignature = newSignature;
121234
+ state.hasChangedEmitSignature = true;
121235
+ }
121236
+ }
121116
121237
  }
121117
121238
  if (writeFile)
121118
121239
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -121177,8 +121298,8 @@ var ts;
121177
121298
  }
121178
121299
  }
121179
121300
  }
121180
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
121181
- getWriteFileUpdatingSignatureCallback(writeFile) :
121301
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
121302
+ getWriteFileCallback(writeFile, customTransformers) :
121182
121303
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
121183
121304
  }
121184
121305
  /**
@@ -121267,29 +121388,58 @@ var ts;
121267
121388
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
121268
121389
  }
121269
121390
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
121270
- function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
121271
- var _a;
121391
+ function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
121392
+ var _a, _b, _c, _d;
121272
121393
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
121273
121394
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
121274
- var filePaths = program.fileNames.map(toPath);
121275
- var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
121276
- var fileInfos = new ts.Map();
121277
- program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
121278
- var state = {
121279
- fileInfos: fileInfos,
121280
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121281
- referencedMap: toManyToManyPathMap(program.referencedMap),
121282
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121283
- semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return toFilePath(ts.isNumber(value) ? value : value[0]); }, function (value) { return ts.isNumber(value) ? ts.emptyArray : value[1]; }),
121284
- hasReusableDiagnostic: true,
121285
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
121286
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
121287
- affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
121288
- };
121395
+ var state;
121396
+ var filePaths;
121397
+ var filePathsSetList;
121398
+ if (isProgramBundleEmitBuildInfo(program)) {
121399
+ state = {
121400
+ fileInfos: new ts.Map(),
121401
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121402
+ dtsChangeTime: program.dtsChangeTime,
121403
+ outSignature: program.outSignature,
121404
+ };
121405
+ }
121406
+ else {
121407
+ filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
121408
+ filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
121409
+ var fileInfos_2 = new ts.Map();
121410
+ var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
121411
+ program.fileInfos.forEach(function (fileInfo, index) {
121412
+ var path = toFilePath(index + 1);
121413
+ var stateFileInfo = toBuilderStateFileInfo(fileInfo);
121414
+ fileInfos_2.set(path, stateFileInfo);
121415
+ if (emitSignatures_1 && stateFileInfo.signature)
121416
+ emitSignatures_1.set(path, stateFileInfo.signature);
121417
+ });
121418
+ (_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
121419
+ if (ts.isNumber(value))
121420
+ emitSignatures_1.delete(toFilePath(value));
121421
+ else
121422
+ emitSignatures_1.set(toFilePath(value[0]), value[1]);
121423
+ });
121424
+ state = {
121425
+ fileInfos: fileInfos_2,
121426
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121427
+ referencedMap: toManyToManyPathMap(program.referencedMap),
121428
+ exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121429
+ semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return toFilePath(ts.isNumber(value) ? value : value[0]); }, function (value) { return ts.isNumber(value) ? ts.emptyArray : value[1]; }),
121430
+ hasReusableDiagnostic: true,
121431
+ affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
121432
+ affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
121433
+ affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
121434
+ changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
121435
+ dtsChangeTime: program.dtsChangeTime,
121436
+ emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
121437
+ };
121438
+ }
121289
121439
  return {
121290
121440
  getState: function () { return state; },
121291
- backupState: ts.noop,
121292
- restoreState: ts.noop,
121441
+ backupEmitState: ts.noop,
121442
+ restoreEmitState: ts.noop,
121293
121443
  getProgram: ts.notImplemented,
121294
121444
  getProgramOrUndefined: ts.returnUndefined,
121295
121445
  releaseProgram: ts.noop,
@@ -121334,12 +121484,24 @@ var ts;
121334
121484
  return map;
121335
121485
  }
121336
121486
  }
121337
- ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
121487
+ ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
121488
+ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
121489
+ var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
121490
+ var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
121491
+ var fileInfos = new ts.Map();
121492
+ program.fileInfos.forEach(function (fileInfo, index) {
121493
+ var path = ts.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
121494
+ var version = ts.isString(fileInfo) ? fileInfo : fileInfo.version; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
121495
+ fileInfos.set(path, version);
121496
+ });
121497
+ return fileInfos;
121498
+ }
121499
+ ts.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap;
121338
121500
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
121339
121501
  return {
121340
121502
  getState: ts.notImplemented,
121341
- backupState: ts.noop,
121342
- restoreState: ts.noop,
121503
+ backupEmitState: ts.noop,
121504
+ restoreEmitState: ts.noop,
121343
121505
  getProgram: getProgram,
121344
121506
  getProgramOrUndefined: function () { return getState().program; },
121345
121507
  releaseProgram: function () { return getState().program = undefined; },
@@ -122455,9 +122617,9 @@ var ts;
122455
122617
  if (!preferSymlinks) {
122456
122618
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
122457
122619
  // so we only need to remove them from the realpath filenames.
122458
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122459
- if (result_15)
122460
- return result_15;
122620
+ var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122621
+ if (result_16)
122622
+ return result_16;
122461
122623
  }
122462
122624
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
122463
122625
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -122477,10 +122639,10 @@ var ts;
122477
122639
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
122478
122640
  var symlinkDirectory = symlinkDirectories_1[_i];
122479
122641
  var option = ts.resolvePath(symlinkDirectory, relative);
122480
- var result_16 = cb(option, target === referenceRedirect);
122642
+ var result_17 = cb(option, target === referenceRedirect);
122481
122643
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
122482
- if (result_16)
122483
- return result_16;
122644
+ if (result_17)
122645
+ return result_17;
122484
122646
  }
122485
122647
  });
122486
122648
  });
@@ -123390,6 +123552,7 @@ var ts;
123390
123552
  readDirectory: ts.maybeBind(host, host.readDirectory),
123391
123553
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
123392
123554
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
123555
+ now: ts.maybeBind(host, host.now),
123393
123556
  };
123394
123557
  function writeFile(fileName, text, writeByteOrderMark, onError) {
123395
123558
  try {
@@ -123450,6 +123613,7 @@ var ts;
123450
123613
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
123451
123614
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
123452
123615
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
123616
+ now: ts.maybeBind(system, system.now),
123453
123617
  };
123454
123618
  }
123455
123619
  ts.createProgramHost = createProgramHost;
@@ -123517,20 +123681,26 @@ var ts;
123517
123681
  var ts;
123518
123682
  (function (ts) {
123519
123683
  function readBuilderProgram(compilerOptions, host) {
123520
- if (ts.outFile(compilerOptions))
123521
- return undefined;
123522
123684
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
123523
123685
  if (!buildInfoPath)
123524
123686
  return undefined;
123525
- var content = host.readFile(buildInfoPath);
123526
- if (!content)
123527
- return undefined;
123528
- var buildInfo = ts.getBuildInfo(content);
123687
+ var buildInfo;
123688
+ if (host.getBuildInfo) {
123689
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
123690
+ if (!buildInfo)
123691
+ return undefined;
123692
+ }
123693
+ else {
123694
+ var content = host.readFile(buildInfoPath);
123695
+ if (!content)
123696
+ return undefined;
123697
+ buildInfo = ts.getBuildInfo(content);
123698
+ }
123529
123699
  if (buildInfo.version !== ts.version)
123530
123700
  return undefined;
123531
123701
  if (!buildInfo.program)
123532
123702
  return undefined;
123533
- return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123703
+ return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123534
123704
  }
123535
123705
  ts.readBuilderProgram = readBuilderProgram;
123536
123706
  function createIncrementalCompilerHost(options, system) {
@@ -123539,6 +123709,7 @@ var ts;
123539
123709
  host.createHash = ts.maybeBind(system, system.createHash);
123540
123710
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
123541
123711
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
123712
+ host.now = ts.maybeBind(system, system.now);
123542
123713
  ts.setGetSourceFileAsHashVersioned(host, system);
123543
123714
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
123544
123715
  return host;
@@ -124274,14 +124445,17 @@ var ts;
124274
124445
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
124275
124446
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
124276
124447
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
124277
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
124278
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
124279
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
124280
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
124448
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
124449
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
124450
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
124451
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
124452
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
124453
+ UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
124281
124454
  /**
124282
124455
  * Projects with no outputs (i.e. "solution" files)
124283
124456
  */
124284
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
124457
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
124458
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
124285
124459
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
124286
124460
  function resolveConfigFileProjectName(project) {
124287
124461
  if (ts.fileExtensionIs(project, ".json" /* Json */)) {
@@ -124326,9 +124500,11 @@ var ts;
124326
124500
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
124327
124501
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
124328
124502
  }
124329
- function newer(date1, date2) {
124330
- return date2 > date1 ? date2 : date1;
124503
+ /*@internal*/
124504
+ function getCurrentTime(host) {
124505
+ return host.now ? host.now() : new Date();
124331
124506
  }
124507
+ ts.getCurrentTime = getCurrentTime;
124332
124508
  /*@internal*/
124333
124509
  function isCircularBuildOrder(buildOrder) {
124334
124510
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -124418,6 +124594,7 @@ var ts;
124418
124594
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
124419
124595
  };
124420
124596
  }
124597
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
124421
124598
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
124422
124599
  var state = {
124423
124600
  host: host,
@@ -124434,8 +124611,9 @@ var ts;
124434
124611
  resolvedConfigFilePaths: new ts.Map(),
124435
124612
  configFileCache: new ts.Map(),
124436
124613
  projectStatus: new ts.Map(),
124437
- buildInfoChecked: new ts.Map(),
124438
124614
  extendedConfigCache: new ts.Map(),
124615
+ buildInfoCache: new ts.Map(),
124616
+ outputTimeStamps: new ts.Map(),
124439
124617
  builderPrograms: new ts.Map(),
124440
124618
  diagnostics: new ts.Map(),
124441
124619
  projectPendingBuild: new ts.Map(),
@@ -124458,6 +124636,7 @@ var ts;
124458
124636
  allWatchedConfigFiles: new ts.Map(),
124459
124637
  allWatchedExtendedConfigFiles: new ts.Map(),
124460
124638
  allWatchedPackageJsonFiles: new ts.Map(),
124639
+ filesWatched: new ts.Map(),
124461
124640
  lastCachedPackageJsonLookups: new ts.Map(),
124462
124641
  timerToBuildInvalidatedProject: undefined,
124463
124642
  reportFileChangeDetected: false,
@@ -124568,11 +124747,12 @@ var ts;
124568
124747
  // Config file cache
124569
124748
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
124570
124749
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
124571
- ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
124572
124750
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
124573
124751
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
124574
124752
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
124575
124753
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
124754
+ ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
124755
+ ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
124576
124756
  // Remove watches for the program no longer in the solution
124577
124757
  if (state.watch) {
124578
124758
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
@@ -124869,21 +125049,21 @@ var ts;
124869
125049
  }
124870
125050
  function emit(writeFileCallback, cancellationToken, customTransformers) {
124871
125051
  var _a;
124872
- var _b, _c;
125052
+ var _b, _c, _d;
124873
125053
  ts.Debug.assertIsDefined(program);
124874
125054
  ts.Debug.assert(step === BuildStep.Emit);
124875
125055
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
124876
- program.backupState();
125056
+ program.backupEmitState();
124877
125057
  var declDiagnostics;
124878
125058
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
124879
125059
  var outputFiles = [];
124880
125060
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
124881
125061
  /*write*/ undefined,
124882
- /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
125062
+ /*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,
124883
125063
  /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
124884
125064
  // Don't emit .d.ts if there are decl file errors
124885
125065
  if (declDiagnostics) {
124886
- program.restoreState();
125066
+ program.restoreEmitState();
124887
125067
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
124888
125068
  return {
124889
125069
  emitSkipped: true,
@@ -124893,40 +125073,46 @@ var ts;
124893
125073
  // Actual Emit
124894
125074
  var host = state.host, compilerHost = state.compilerHost;
124895
125075
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124896
- var newestDeclarationFileContentChangedTime = minimumDate;
124897
- var anyDtsChanged = false;
125076
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
124898
125077
  var emitterDiagnostics = ts.createDiagnosticCollection();
124899
125078
  var emittedOutputs = new ts.Map();
125079
+ var options = program.getCompilerOptions();
125080
+ var isIncremental = ts.isIncrementalCompilation(options);
125081
+ var outputTimeStampMap;
125082
+ var now;
124900
125083
  ts.solutionPerformance.mark("beforeOutputFilesWrite");
124901
125084
  outputFiles.forEach(function (_a) {
124902
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124903
- var priorChangeTime;
124904
- if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124905
- // Check for unchanged .d.ts files
124906
- if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124907
- priorChangeTime = host.getModifiedTime(name);
124908
- }
124909
- else {
125085
+ var _b, _c;
125086
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
125087
+ var path = toPath(state, name);
125088
+ emittedOutputs.set(toPath(state, name), name);
125089
+ if (buildInfo) {
125090
+ setBuildInfo(state, buildInfo, projectPath, options);
125091
+ 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)) {
124910
125092
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124911
- anyDtsChanged = true;
124912
125093
  }
124913
125094
  }
124914
- emittedOutputs.set(toPath(state, name), name);
124915
125095
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124916
- if (priorChangeTime !== undefined) {
124917
- newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
125096
+ if (!isIncremental && state.watch) {
125097
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
124918
125098
  }
124919
125099
  });
124920
125100
  ts.solutionPerformance.mark("afterOutputFilesWrite");
124921
125101
  ts.solutionPerformance.measure("OutputFilesWrite", "beforeOutputFilesWrite", "afterOutputFilesWrite");
124922
- finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime,
124923
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
125102
+ finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124924
125103
  return emitResult;
124925
125104
  }
124926
125105
  function emitBuildInfo(writeFileCallback, cancellationToken) {
124927
125106
  ts.Debug.assertIsDefined(program);
124928
125107
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
124929
- var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
125108
+ var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
125109
+ if (data === null || data === void 0 ? void 0 : data.buildInfo)
125110
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
125111
+ if (writeFileCallback)
125112
+ writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
125113
+ else
125114
+ state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
125115
+ }, cancellationToken);
124930
125116
  if (emitResult.diagnostics.length) {
124931
125117
  reportErrors(state, emitResult.diagnostics);
124932
125118
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -124939,7 +125125,7 @@ var ts;
124939
125125
  step = BuildStep.QueueReferencingProjects;
124940
125126
  return emitResult;
124941
125127
  }
124942
- function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
125128
+ function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
124943
125129
  var _a;
124944
125130
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
124945
125131
  if (emitDiagnostics.length) {
@@ -124950,13 +125136,11 @@ var ts;
124950
125136
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
124951
125137
  }
124952
125138
  // Update time stamps for rest of the outputs
124953
- var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
125139
+ updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124954
125140
  state.diagnostics.delete(projectPath);
124955
125141
  state.projectStatus.set(projectPath, {
124956
125142
  type: ts.UpToDateStatusType.UpToDate,
124957
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
124958
- maximumDate :
124959
- newestDeclarationFileContentChangedTime,
125143
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
124960
125144
  oldestOutputFileName: oldestOutputFileName
124961
125145
  });
124962
125146
  afterProgramDone(state, program, config);
@@ -124991,13 +125175,21 @@ var ts;
124991
125175
  ts.Debug.assert(!!outputFiles.length);
124992
125176
  var emitterDiagnostics = ts.createDiagnosticCollection();
124993
125177
  var emittedOutputs = new ts.Map();
125178
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
125179
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
124994
125180
  outputFiles.forEach(function (_a) {
124995
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
125181
+ var _b, _c;
125182
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124996
125183
  emittedOutputs.set(toPath(state, name), name);
125184
+ if (buildInfo) {
125185
+ setBuildInfo(state, buildInfo, projectPath, config.options);
125186
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
125187
+ resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
125188
+ }
125189
+ }
124997
125190
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124998
125191
  });
124999
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate,
125000
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
125192
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
125001
125193
  return { emitSkipped: false, diagnostics: emitDiagnostics };
125002
125194
  }
125003
125195
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -125103,7 +125295,7 @@ var ts;
125103
125295
  }
125104
125296
  continue;
125105
125297
  }
125106
- if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
125298
+ if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
125107
125299
  reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
125108
125300
  return {
125109
125301
  kind: InvalidatedProjectKind.UpdateOutputFileStamps,
@@ -125189,7 +125381,7 @@ var ts;
125189
125381
  state.projectCompilerOptions = state.baseCompilerOptions;
125190
125382
  }
125191
125383
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
125192
- var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
125384
+ var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
125193
125385
  reportAndStoreErrors(state, resolvedPath, diagnostics);
125194
125386
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
125195
125387
  if (canEmitBuildInfo)
@@ -125197,9 +125389,101 @@ var ts;
125197
125389
  afterProgramDone(state, program, config);
125198
125390
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
125199
125391
  }
125392
+ function isFileWatcherWithModifiedTime(value) {
125393
+ return !!value.watcher;
125394
+ }
125395
+ function getModifiedTime(state, fileName) {
125396
+ var path = toPath(state, fileName);
125397
+ var existing = state.filesWatched.get(path);
125398
+ if (state.watch && !!existing) {
125399
+ if (!isFileWatcherWithModifiedTime(existing))
125400
+ return existing;
125401
+ if (existing.modifiedTime)
125402
+ return existing.modifiedTime;
125403
+ }
125404
+ var result = ts.getModifiedTime(state.host, fileName);
125405
+ if (state.watch) {
125406
+ if (existing)
125407
+ existing.modifiedTime = result;
125408
+ else
125409
+ state.filesWatched.set(path, result);
125410
+ }
125411
+ return result;
125412
+ }
125413
+ function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
125414
+ var path = toPath(state, file);
125415
+ var existing = state.filesWatched.get(path);
125416
+ if (existing && isFileWatcherWithModifiedTime(existing)) {
125417
+ existing.callbacks.push(callback);
125418
+ }
125419
+ else {
125420
+ var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
125421
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
125422
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
125423
+ existing.modifiedTime = modifiedTime;
125424
+ existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
125425
+ }, pollingInterval, options, watchType, project);
125426
+ state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
125427
+ }
125428
+ return {
125429
+ close: function () {
125430
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
125431
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
125432
+ if (existing.callbacks.length === 1) {
125433
+ state.filesWatched.delete(path);
125434
+ ts.closeFileWatcherOf(existing);
125435
+ }
125436
+ else {
125437
+ ts.unorderedRemoveItem(existing.callbacks, callback);
125438
+ }
125439
+ }
125440
+ };
125441
+ }
125442
+ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
125443
+ if (!state.watch)
125444
+ return undefined;
125445
+ var result = state.outputTimeStamps.get(resolvedConfigFilePath);
125446
+ if (!result)
125447
+ state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
125448
+ return result;
125449
+ }
125450
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
125451
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125452
+ var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
125453
+ if (existing) {
125454
+ existing.buildInfo = buildInfo;
125455
+ existing.modifiedTime = getCurrentTime(state.host);
125456
+ }
125457
+ else {
125458
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
125459
+ }
125460
+ }
125461
+ function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
125462
+ var path = toPath(state, buildInfoPath);
125463
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
125464
+ return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
125465
+ }
125466
+ function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
125467
+ var path = toPath(state, buildInfoPath);
125468
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
125469
+ if (existing !== undefined && existing.path === path) {
125470
+ return existing.buildInfo || undefined;
125471
+ }
125472
+ ts.solutionPerformance.mark("beforeGetBuildInfo");
125473
+ ts.solutionPerformance.mark("beforeBuildInfoRead");
125474
+ var value = state.readFileWithCache(buildInfoPath);
125475
+ ts.solutionPerformance.mark("afterBuildInfoRead");
125476
+ ts.solutionPerformance.measure("BuildInfoRead", "beforeBuildInfoRead", "afterBuildInfoRead");
125477
+ var buildInfo = value ? ts.getBuildInfo(value) : undefined;
125478
+ ts.Debug.assert(modifiedTime || !buildInfo);
125479
+ state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
125480
+ ts.solutionPerformance.mark("afterGetBuildInfo");
125481
+ ts.solutionPerformance.measure("GetBuildInfo", "beforeGetBuildInfo", "afterGetBuildInfo");
125482
+ return buildInfo;
125483
+ }
125200
125484
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
125201
125485
  // Check tsconfig time
125202
- var tsconfigTime = ts.getModifiedTime(state.host, configFile);
125486
+ var tsconfigTime = getModifiedTime(state, configFile);
125203
125487
  if (oldestOutputFileTime < tsconfigTime) {
125204
125488
  return {
125205
125489
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -125209,88 +125493,24 @@ var ts;
125209
125493
  }
125210
125494
  }
125211
125495
  function getUpToDateStatusWorker(state, project, resolvedPath) {
125212
- var force = !!state.options.force;
125213
- var newestInputFileName = undefined;
125214
- var newestInputFileTime = minimumDate;
125215
- var host = state.host;
125216
- // Get timestamps of input files
125217
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
125218
- var inputFile = _a[_i];
125219
- if (!host.fileExists(inputFile)) {
125220
- return {
125221
- type: ts.UpToDateStatusType.Unbuildable,
125222
- reason: inputFile + " does not exist"
125223
- };
125224
- }
125225
- if (!force) {
125226
- var inputTime = ts.getModifiedTime(host, inputFile);
125227
- if (inputTime > newestInputFileTime) {
125228
- newestInputFileName = inputFile;
125229
- newestInputFileTime = inputTime;
125230
- }
125231
- }
125232
- }
125496
+ var _a, _b, _c;
125233
125497
  // Container if no files are specified in the project
125234
125498
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
125235
125499
  return {
125236
125500
  type: ts.UpToDateStatusType.ContainerOnly
125237
125501
  };
125238
125502
  }
125239
- // Collect the expected outputs of this project
125240
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
125241
- // Now see if all outputs are newer than the newest input
125242
- var oldestOutputFileName = "(none)";
125243
- var oldestOutputFileTime = maximumDate;
125244
- var newestOutputFileName = "(none)";
125245
- var newestOutputFileTime = minimumDate;
125246
- var missingOutputFileName;
125247
- var newestDeclarationFileContentChangedTime = minimumDate;
125248
- var isOutOfDateWithInputs = false;
125249
- if (!force) {
125250
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
125251
- var output = outputs_1[_b];
125252
- // Output is missing; can stop checking
125253
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
125254
- if (!host.fileExists(output)) {
125255
- missingOutputFileName = output;
125256
- break;
125257
- }
125258
- var outputTime = ts.getModifiedTime(host, output);
125259
- if (outputTime < oldestOutputFileTime) {
125260
- oldestOutputFileTime = outputTime;
125261
- oldestOutputFileName = output;
125262
- }
125263
- // If an output is older than the newest input, we can stop checking
125264
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
125265
- if (outputTime < newestInputFileTime) {
125266
- isOutOfDateWithInputs = true;
125267
- break;
125268
- }
125269
- if (outputTime > newestOutputFileTime) {
125270
- newestOutputFileTime = outputTime;
125271
- newestOutputFileName = output;
125272
- }
125273
- // Keep track of when the most recent time a .d.ts file was changed.
125274
- // In addition to file timestamps, we also keep track of when a .d.ts file
125275
- // had its file touched but not had its contents changed - this allows us
125276
- // to skip a downstream typecheck
125277
- if (ts.isDeclarationFileName(output)) {
125278
- var outputModifiedTime = ts.getModifiedTime(host, output);
125279
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
125280
- }
125281
- }
125282
- }
125283
- var pseudoUpToDate = false;
125284
- var usesPrepend = false;
125285
- var upstreamChangedProject;
125503
+ // Fast check to see if reference projects are buildable
125504
+ var referenceStatuses;
125505
+ var force = !!state.options.force;
125286
125506
  if (project.projectReferences) {
125287
125507
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
125288
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
125289
- var ref = _d[_c];
125290
- usesPrepend = usesPrepend || !!(ref.prepend);
125508
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
125509
+ var ref = _d[_i];
125291
125510
  var resolvedRef = ts.resolveProjectReferencePath(ref);
125292
125511
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
125293
- var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
125512
+ var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
125513
+ var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
125294
125514
  // Its a circular reference ignore the status of this project
125295
125515
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
125296
125516
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) { // Container only ignore this project
@@ -125312,78 +125532,188 @@ var ts;
125312
125532
  upstreamProjectName: ref.path
125313
125533
  };
125314
125534
  }
125315
- // Check oldest output file name only if there is no missing output file name
125316
- // (a check we will have skipped if this is a forced build)
125317
- if (!force && !missingOutputFileName) {
125318
- // If the upstream project's newest file is older than our oldest output, we
125319
- // can't be out of date because of it
125320
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
125321
- continue;
125322
- }
125323
- // If the upstream project has only change .d.ts files, and we've built
125324
- // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
125325
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
125326
- pseudoUpToDate = true;
125327
- upstreamChangedProject = ref.path;
125328
- continue;
125329
- }
125330
- // We have an output older than an upstream output - we are out of date
125331
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125535
+ if (!force)
125536
+ (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
125537
+ }
125538
+ }
125539
+ if (force)
125540
+ return { type: ts.UpToDateStatusType.ForceBuild };
125541
+ // Check buildinfo first
125542
+ var host = state.host;
125543
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125544
+ var oldestOutputFileName = "(none)";
125545
+ var oldestOutputFileTime = maximumDate;
125546
+ var buildInfoTime;
125547
+ var buildInfoProgram;
125548
+ var buildInfoVersionMap;
125549
+ var newestDeclarationFileContentChangedTime;
125550
+ if (buildInfoPath) {
125551
+ var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
125552
+ buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
125553
+ if (buildInfoTime === ts.missingFileModifiedTime) {
125554
+ if (!buildInfoCacheEntry_1) {
125555
+ state.buildInfoCache.set(resolvedPath, {
125556
+ path: toPath(state, buildInfoPath),
125557
+ buildInfo: false,
125558
+ modifiedTime: buildInfoTime
125559
+ });
125560
+ }
125561
+ return {
125562
+ type: ts.UpToDateStatusType.OutputMissing,
125563
+ missingOutputFileName: buildInfoPath
125564
+ };
125565
+ }
125566
+ var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
125567
+ if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125568
+ return {
125569
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
125570
+ version: buildInfo.version
125571
+ };
125572
+ }
125573
+ if (buildInfo.program) {
125574
+ if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
125575
+ (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
125332
125576
  return {
125333
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125334
- outOfDateOutputFileName: oldestOutputFileName,
125335
- newerProjectName: ref.path
125577
+ type: ts.UpToDateStatusType.OutOfDateBuildInfo,
125578
+ buildInfoFile: buildInfoPath
125336
125579
  };
125337
125580
  }
125581
+ buildInfoProgram = buildInfo.program;
125338
125582
  }
125583
+ oldestOutputFileTime = buildInfoTime;
125584
+ oldestOutputFileName = buildInfoPath;
125585
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
125339
125586
  }
125340
- if (missingOutputFileName !== undefined) {
125341
- return {
125342
- type: ts.UpToDateStatusType.OutputMissing,
125343
- missingOutputFileName: missingOutputFileName
125344
- };
125587
+ // Check input files
125588
+ var newestInputFileName = undefined;
125589
+ var newestInputFileTime = minimumDate;
125590
+ var pseudoInputUptodate = false;
125591
+ // Get timestamps of input files
125592
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
125593
+ var inputFile = _f[_e];
125594
+ var inputTime = getModifiedTime(state, inputFile);
125595
+ if (inputTime === ts.missingFileModifiedTime) {
125596
+ return {
125597
+ type: ts.UpToDateStatusType.Unbuildable,
125598
+ reason: inputFile + " does not exist"
125599
+ };
125600
+ }
125601
+ // If an buildInfo is older than the newest input, we can stop checking
125602
+ if (buildInfoTime && buildInfoTime < inputTime) {
125603
+ var version_3 = void 0;
125604
+ var currentVersion = void 0;
125605
+ if (buildInfoProgram) {
125606
+ // Read files and see if they are same, read is anyways cached
125607
+ if (!buildInfoVersionMap)
125608
+ buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
125609
+ version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
125610
+ var text = version_3 ? state.readFileWithCache(inputFile) : undefined;
125611
+ currentVersion = text && (host.createHash || ts.generateDjb2Hash)(text);
125612
+ if (version_3 && version_3 === currentVersion)
125613
+ pseudoInputUptodate = true;
125614
+ }
125615
+ if (!version_3 || version_3 !== currentVersion) {
125616
+ return {
125617
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125618
+ outOfDateOutputFileName: buildInfoPath,
125619
+ newerInputFileName: inputFile
125620
+ };
125621
+ }
125622
+ }
125623
+ if (inputTime > newestInputFileTime) {
125624
+ newestInputFileName = inputFile;
125625
+ newestInputFileTime = inputTime;
125626
+ }
125345
125627
  }
125346
- if (isOutOfDateWithInputs) {
125347
- return {
125348
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
125349
- outOfDateOutputFileName: oldestOutputFileName,
125350
- newerInputFileName: newestInputFileName
125351
- };
125628
+ // Now see if all outputs are newer than the newest input
125629
+ // Dont check output timestamps if we have buildinfo telling us output is uptodate
125630
+ if (!buildInfoPath) {
125631
+ // Collect the expected outputs of this project
125632
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
125633
+ var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
125634
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
125635
+ var output = outputs_1[_g];
125636
+ var path = toPath(state, output);
125637
+ // Output is missing; can stop checking
125638
+ var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
125639
+ if (!outputTime) {
125640
+ outputTime = ts.getModifiedTime(state.host, output);
125641
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
125642
+ }
125643
+ if (outputTime === ts.missingFileModifiedTime) {
125644
+ return {
125645
+ type: ts.UpToDateStatusType.OutputMissing,
125646
+ missingOutputFileName: output
125647
+ };
125648
+ }
125649
+ if (outputTime < oldestOutputFileTime) {
125650
+ oldestOutputFileTime = outputTime;
125651
+ oldestOutputFileName = output;
125652
+ }
125653
+ // If an output is older than the newest input, we can stop checking
125654
+ if (outputTime < newestInputFileTime) {
125655
+ return {
125656
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125657
+ outOfDateOutputFileName: oldestOutputFileName,
125658
+ newerInputFileName: newestInputFileName
125659
+ };
125660
+ }
125661
+ }
125352
125662
  }
125353
- else {
125354
- // Check tsconfig time
125355
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125356
- if (configStatus)
125357
- return configStatus;
125358
- // Check extended config time
125359
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125360
- if (extendedConfigStatus)
125361
- return extendedConfigStatus;
125362
- // Check package file time
125363
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125364
- var path = _a[0];
125365
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125366
- });
125367
- if (dependentPackageFileStatus)
125368
- return dependentPackageFileStatus;
125369
- }
125370
- if (!force && !state.buildInfoChecked.has(resolvedPath)) {
125371
- state.buildInfoChecked.set(resolvedPath, true);
125372
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125373
- if (buildInfoPath) {
125374
- ts.solutionPerformance.mark("beforeBuildInfoRead");
125375
- var value = state.readFileWithCache(buildInfoPath);
125376
- ts.solutionPerformance.mark("afterBuildInfoRead");
125377
- ts.solutionPerformance.measure("BuildInfoRead", "beforeBuildInfoRead", "afterBuildInfoRead");
125378
- var buildInfo = value && ts.getBuildInfo(value);
125379
- if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125663
+ var seenRefs = buildInfoPath ? new ts.Set() : undefined;
125664
+ var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
125665
+ seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
125666
+ var pseudoUpToDate = false;
125667
+ var usesPrepend = false;
125668
+ var upstreamChangedProject;
125669
+ if (referenceStatuses) {
125670
+ for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
125671
+ var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
125672
+ usesPrepend = usesPrepend || !!(ref.prepend);
125673
+ // If the upstream project's newest file is older than our oldest output, we
125674
+ // can't be out of date because of it
125675
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
125676
+ continue;
125677
+ }
125678
+ // Check if tsbuildinfo path is shared, then we need to rebuild
125679
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
125380
125680
  return {
125381
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
125382
- version: buildInfo.version
125681
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125682
+ outOfDateOutputFileName: buildInfoPath,
125683
+ newerProjectName: ref.path
125383
125684
  };
125384
125685
  }
125686
+ // If the upstream project has only change .d.ts files, and we've built
125687
+ // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
125688
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
125689
+ pseudoUpToDate = true;
125690
+ upstreamChangedProject = ref.path;
125691
+ continue;
125692
+ }
125693
+ // We have an output older than an upstream output - we are out of date
125694
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125695
+ return {
125696
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125697
+ outOfDateOutputFileName: oldestOutputFileName,
125698
+ newerProjectName: ref.path
125699
+ };
125385
125700
  }
125386
125701
  }
125702
+ // Check tsconfig time
125703
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125704
+ if (configStatus)
125705
+ return configStatus;
125706
+ // Check extended config time
125707
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125708
+ if (extendedConfigStatus)
125709
+ return extendedConfigStatus;
125710
+ // Check package file time
125711
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125712
+ var path = _a[0];
125713
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125714
+ });
125715
+ if (dependentPackageFileStatus)
125716
+ return dependentPackageFileStatus;
125387
125717
  if (usesPrepend && pseudoUpToDate) {
125388
125718
  return {
125389
125719
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -125393,15 +125723,37 @@ var ts;
125393
125723
  }
125394
125724
  // Up to date
125395
125725
  return {
125396
- type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
125726
+ type: pseudoUpToDate ?
125727
+ ts.UpToDateStatusType.UpToDateWithUpstreamTypes :
125728
+ pseudoInputUptodate ?
125729
+ ts.UpToDateStatusType.UpToDateWithInputFileText :
125730
+ ts.UpToDateStatusType.UpToDate,
125397
125731
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
125398
125732
  newestInputFileTime: newestInputFileTime,
125399
- newestOutputFileTime: newestOutputFileTime,
125400
125733
  newestInputFileName: newestInputFileName,
125401
- newestOutputFileName: newestOutputFileName,
125402
125734
  oldestOutputFileName: oldestOutputFileName
125403
125735
  };
125404
125736
  }
125737
+ function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
125738
+ if (seenRefs.has(resolvedRefPath))
125739
+ return false;
125740
+ seenRefs.add(resolvedRefPath);
125741
+ var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
125742
+ if (refBuildInfo.path === buildInfoCacheEntry.path)
125743
+ return true;
125744
+ if (resolvedConfig.projectReferences) {
125745
+ // Check references
125746
+ for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
125747
+ var ref = _a[_i];
125748
+ var resolvedRef = ts.resolveProjectReferencePath(ref);
125749
+ var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
125750
+ var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
125751
+ if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
125752
+ return true;
125753
+ }
125754
+ }
125755
+ return false;
125756
+ }
125405
125757
  function getUpToDateStatus(state, project, resolvedPath) {
125406
125758
  if (project === undefined) {
125407
125759
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -125417,42 +125769,69 @@ var ts;
125417
125769
  state.projectStatus.set(resolvedPath, actual);
125418
125770
  return actual;
125419
125771
  }
125420
- function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
125772
+ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
125421
125773
  if (proj.options.noEmit)
125422
- return priorNewestUpdateTime;
125774
+ return;
125775
+ var now;
125423
125776
  ts.solutionPerformance.mark("beforeUpdateOutputTimestamps");
125424
- var host = state.host;
125425
- var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125426
- if (!skipOutputs || outputs.length !== skipOutputs.size) {
125427
- var reportVerbose = !!state.options.verbose;
125428
- var now = host.now ? host.now() : new Date();
125429
- for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125430
- var file = outputs_2[_i];
125431
- if (skipOutputs && skipOutputs.has(toPath(state, file))) {
125432
- continue;
125433
- }
125434
- if (reportVerbose) {
125435
- reportVerbose = false;
125777
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
125778
+ if (buildInfoPath) {
125779
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
125780
+ if (!!state.options.verbose)
125436
125781
  reportStatus(state, verboseMessage, proj.options.configFilePath);
125782
+ state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
125783
+ getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
125784
+ }
125785
+ state.outputTimeStamps.delete(projectPath);
125786
+ }
125787
+ else {
125788
+ var host = state.host;
125789
+ var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125790
+ var outputTimeStampMap_1 = getOutputTimeStampMap(state, projectPath);
125791
+ var modifiedOutputs_1 = outputTimeStampMap_1 ? new ts.Set() : undefined;
125792
+ if (!skipOutputs || outputs.length !== skipOutputs.size) {
125793
+ var reportVerbose = !!state.options.verbose;
125794
+ for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125795
+ var file = outputs_2[_i];
125796
+ var path = toPath(state, file);
125797
+ if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
125798
+ continue;
125799
+ if (reportVerbose) {
125800
+ reportVerbose = false;
125801
+ reportStatus(state, verboseMessage, proj.options.configFilePath);
125802
+ }
125803
+ host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
125804
+ if (outputTimeStampMap_1) {
125805
+ outputTimeStampMap_1.set(path, now);
125806
+ modifiedOutputs_1.add(path);
125807
+ }
125437
125808
  }
125438
- if (ts.isDeclarationFileName(file)) {
125439
- priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
125440
- }
125441
- host.setModifiedTime(file, now);
125442
125809
  }
125810
+ // Clear out timestamps not in output list any more
125811
+ outputTimeStampMap_1 === null || outputTimeStampMap_1 === void 0 ? void 0 : outputTimeStampMap_1.forEach(function (_value, key) {
125812
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs_1.has(key))
125813
+ outputTimeStampMap_1.delete(key);
125814
+ });
125443
125815
  }
125444
125816
  ts.solutionPerformance.mark("afterUpdateOutputTimestamps");
125445
125817
  ts.solutionPerformance.measure("UpdateOutputTimestamps", "beforeUpdateOutputTimestamps", "afterUpdateOutputTimestamps");
125446
- return priorNewestUpdateTime;
125818
+ }
125819
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
125820
+ var _a;
125821
+ if (!options.composite)
125822
+ return undefined;
125823
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125824
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, /*modifiedTime*/ undefined);
125825
+ 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;
125447
125826
  }
125448
125827
  function updateOutputTimestamps(state, proj, resolvedPath) {
125449
125828
  if (state.options.dry) {
125450
125829
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
125451
125830
  }
125452
- var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125831
+ updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125453
125832
  state.projectStatus.set(resolvedPath, {
125454
125833
  type: ts.UpToDateStatusType.UpToDate,
125455
- newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
125834
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
125456
125835
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
125457
125836
  });
125458
125837
  }
@@ -125498,6 +125877,7 @@ var ts;
125498
125877
  break;
125499
125878
  }
125500
125879
  // falls through
125880
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
125501
125881
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125502
125882
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
125503
125883
  if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
@@ -125682,12 +126062,10 @@ var ts;
125682
126062
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
125683
126063
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
125684
126064
  return;
125685
- state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
125686
- invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
125687
- }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
126065
+ 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));
125688
126066
  }
125689
126067
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
125690
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
126068
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
125691
126069
  var _a;
125692
126070
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
125693
126071
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -125719,7 +126097,7 @@ var ts;
125719
126097
  if (!state.watch)
125720
126098
  return;
125721
126099
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
125722
- 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); },
126100
+ 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); },
125723
126101
  onDeleteValue: ts.closeFileWatcher,
125724
126102
  });
125725
126103
  }
@@ -125727,7 +126105,7 @@ var ts;
125727
126105
  if (!state.watch || !state.lastCachedPackageJsonLookups)
125728
126106
  return;
125729
126107
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
125730
- createNewValue: function (path, _input) { return state.watchFile(path, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.None); }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.PackageJson, resolved); },
126108
+ createNewValue: function (path, _input) { return watchFile(state, path, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.None); }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.PackageJson, resolved); },
125731
126109
  onDeleteValue: ts.closeFileWatcher,
125732
126110
  });
125733
126111
  }
@@ -125860,19 +126238,18 @@ var ts;
125860
126238
  }
125861
126239
  }
125862
126240
  function reportUpToDateStatus(state, configFileName, status) {
125863
- if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
125864
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125865
- }
125866
126241
  switch (status.type) {
125867
126242
  case ts.UpToDateStatusType.OutOfDateWithSelf:
125868
- 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));
126243
+ 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));
125869
126244
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
125870
- 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));
126245
+ 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));
125871
126246
  case ts.UpToDateStatusType.OutputMissing:
125872
126247
  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));
126248
+ case ts.UpToDateStatusType.OutOfDateBuildInfo:
126249
+ 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));
125873
126250
  case ts.UpToDateStatusType.UpToDate:
125874
126251
  if (status.newestInputFileTime !== undefined) {
125875
- 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 || ""));
126252
+ 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 || ""));
125876
126253
  }
125877
126254
  // Don't report anything for "up to date because it was already built" -- too verbose
125878
126255
  break;
@@ -125880,6 +126257,8 @@ var ts;
125880
126257
  return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed, relName(state, configFileName), relName(state, status.newerProjectName));
125881
126258
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125882
126259
  return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
126260
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
126261
+ return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_but_needs_update_to_timestamps_of_output_files_that_are_older_than_input_files, relName(state, configFileName));
125883
126262
  case ts.UpToDateStatusType.UpstreamOutOfDate:
125884
126263
  return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date, relName(state, configFileName), relName(state, status.upstreamProjectName));
125885
126264
  case ts.UpToDateStatusType.UpstreamBlocked:
@@ -125890,6 +126269,8 @@ var ts;
125890
126269
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
125891
126270
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
125892
126271
  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);
126272
+ case ts.UpToDateStatusType.ForceBuild:
126273
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125893
126274
  case ts.UpToDateStatusType.ContainerOnly:
125894
126275
  // Don't report status on "solution" projects
125895
126276
  // falls through