@typescript-deploys/pr-build 4.8.0-pr-48997-21 → 4.8.0-pr-48784-14

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.
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-insiders.20220525";
92
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220527";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -3499,16 +3499,34 @@ var ts;
3499
3499
  /** Performance measurements for the compiler. */
3500
3500
  var ts;
3501
3501
  (function (ts) {
3502
- var performance;
3503
- (function (performance) {
3502
+ var nullTimer = { enter: ts.noop, exit: ts.noop };
3503
+ ts.performance = createPerformanceTracker();
3504
+ ts.solutionPerformance = createPerformanceTracker();
3505
+ function createPerformanceTracker() {
3504
3506
  var perfHooks;
3505
3507
  // when set, indicates the implementation of `Performance` to use for user timing.
3506
3508
  // when unset, indicates user timing is unavailable or disabled.
3507
3509
  var performanceImpl;
3510
+ var enabled = false;
3511
+ var timeorigin = ts.timestamp();
3512
+ var marks = new ts.Map();
3513
+ var counts = new ts.Map();
3514
+ var durations = new ts.Map();
3515
+ return {
3516
+ createTimerIf: createTimerIf,
3517
+ createTimer: createTimer,
3518
+ mark: mark,
3519
+ measure: measure,
3520
+ getCount: getCount,
3521
+ getDuration: getDuration,
3522
+ forEachMeasure: forEachMeasure,
3523
+ isEnabled: isEnabled,
3524
+ enable: enable,
3525
+ disable: disable,
3526
+ };
3508
3527
  function createTimerIf(condition, measureName, startMarkName, endMarkName) {
3509
- return condition ? createTimer(measureName, startMarkName, endMarkName) : performance.nullTimer;
3528
+ return condition ? createTimer(measureName, startMarkName, endMarkName) : nullTimer;
3510
3529
  }
3511
- performance.createTimerIf = createTimerIf;
3512
3530
  function createTimer(measureName, startMarkName, endMarkName) {
3513
3531
  var enterCount = 0;
3514
3532
  return {
@@ -3530,13 +3548,6 @@ var ts;
3530
3548
  }
3531
3549
  }
3532
3550
  }
3533
- performance.createTimer = createTimer;
3534
- performance.nullTimer = { enter: ts.noop, exit: ts.noop };
3535
- var enabled = false;
3536
- var timeorigin = ts.timestamp();
3537
- var marks = new ts.Map();
3538
- var counts = new ts.Map();
3539
- var durations = new ts.Map();
3540
3551
  /**
3541
3552
  * Marks a performance event.
3542
3553
  *
@@ -3551,7 +3562,6 @@ var ts;
3551
3562
  performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.mark(markName);
3552
3563
  }
3553
3564
  }
3554
- performance.mark = mark;
3555
3565
  /**
3556
3566
  * Adds a performance measurement with the specified name.
3557
3567
  *
@@ -3564,14 +3574,13 @@ var ts;
3564
3574
  function measure(measureName, startMarkName, endMarkName) {
3565
3575
  var _a, _b;
3566
3576
  if (enabled) {
3567
- var end = (_a = (endMarkName !== undefined ? marks.get(endMarkName) : undefined)) !== null && _a !== void 0 ? _a : ts.timestamp();
3568
- var start = (_b = (startMarkName !== undefined ? marks.get(startMarkName) : undefined)) !== null && _b !== void 0 ? _b : timeorigin;
3577
+ var end = (_a = marks.get(endMarkName)) !== null && _a !== void 0 ? _a : ts.timestamp();
3578
+ var start = (_b = marks.get(startMarkName)) !== null && _b !== void 0 ? _b : timeorigin;
3569
3579
  var previousDuration = durations.get(measureName) || 0;
3570
3580
  durations.set(measureName, previousDuration + (end - start));
3571
3581
  performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.measure(measureName, startMarkName, endMarkName);
3572
3582
  }
3573
3583
  }
3574
- performance.measure = measure;
3575
3584
  /**
3576
3585
  * Gets the number of times a marker was encountered.
3577
3586
  *
@@ -3580,7 +3589,6 @@ var ts;
3580
3589
  function getCount(markName) {
3581
3590
  return counts.get(markName) || 0;
3582
3591
  }
3583
- performance.getCount = getCount;
3584
3592
  /**
3585
3593
  * Gets the total duration of all measurements with the supplied name.
3586
3594
  *
@@ -3589,7 +3597,6 @@ var ts;
3589
3597
  function getDuration(measureName) {
3590
3598
  return durations.get(measureName) || 0;
3591
3599
  }
3592
- performance.getDuration = getDuration;
3593
3600
  /**
3594
3601
  * Iterate over each measure, performing some action
3595
3602
  *
@@ -3598,14 +3605,12 @@ var ts;
3598
3605
  function forEachMeasure(cb) {
3599
3606
  durations.forEach(function (duration, measureName) { return cb(measureName, duration); });
3600
3607
  }
3601
- performance.forEachMeasure = forEachMeasure;
3602
3608
  /**
3603
3609
  * Indicates whether the performance API is enabled.
3604
3610
  */
3605
3611
  function isEnabled() {
3606
3612
  return enabled;
3607
3613
  }
3608
- performance.isEnabled = isEnabled;
3609
3614
  /** Enables (and resets) performance measurements for the compiler. */
3610
3615
  function enable(system) {
3611
3616
  var _a;
@@ -3626,7 +3631,6 @@ var ts;
3626
3631
  }
3627
3632
  return true;
3628
3633
  }
3629
- performance.enable = enable;
3630
3634
  /** Disables performance measurements for the compiler. */
3631
3635
  function disable() {
3632
3636
  if (enabled) {
@@ -3637,8 +3641,7 @@ var ts;
3637
3641
  enabled = false;
3638
3642
  }
3639
3643
  }
3640
- performance.disable = disable;
3641
- })(performance = ts.performance || (ts.performance = {}));
3644
+ }
3642
3645
  })(ts || (ts = {}));
3643
3646
  /* @internal */
3644
3647
  var ts;
@@ -6181,7 +6184,7 @@ var ts;
6181
6184
  };
6182
6185
  }
6183
6186
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
6184
- var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName) {
6187
+ var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName, modifiedTime) {
6185
6188
  // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
6186
6189
  if (!ts.isString(relativeFileName))
6187
6190
  return;
@@ -6191,7 +6194,7 @@ var ts;
6191
6194
  if (callbacks) {
6192
6195
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
6193
6196
  var fileCallback = callbacks_1[_i];
6194
- fileCallback(fileName, FileWatcherEventKind.Changed);
6197
+ fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6195
6198
  }
6196
6199
  }
6197
6200
  },
@@ -6245,7 +6248,7 @@ var ts;
6245
6248
  }
6246
6249
  else {
6247
6250
  cache.set(path, {
6248
- watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
6251
+ watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6249
6252
  refCount: 1
6250
6253
  });
6251
6254
  }
@@ -6273,7 +6276,7 @@ var ts;
6273
6276
  var newTime = modifiedTime.getTime();
6274
6277
  if (oldTime !== newTime) {
6275
6278
  watchedFile.mtime = modifiedTime;
6276
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
6279
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
6277
6280
  return true;
6278
6281
  }
6279
6282
  return false;
@@ -6308,7 +6311,7 @@ var ts;
6308
6311
  */
6309
6312
  /*@internal*/
6310
6313
  function createDirectoryWatcherSupportingRecursive(_a) {
6311
- var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout;
6314
+ var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, directoryExists = _a.directoryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout;
6312
6315
  var cache = new ts.Map();
6313
6316
  var callbackCache = ts.createMultiMap();
6314
6317
  var cacheToUpdateChildWatches = new ts.Map();
@@ -6408,7 +6411,7 @@ var ts;
6408
6411
  function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
6409
6412
  // Iterate through existing children and update the watches if needed
6410
6413
  var parentWatcher = cache.get(dirPath);
6411
- if (parentWatcher && fileSystemEntryExists(dirName, 1 /* Directory */)) {
6414
+ if (parentWatcher && directoryExists(dirName)) {
6412
6415
  // Schedule the update and postpone invoke for callbacks
6413
6416
  scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
6414
6417
  return;
@@ -6481,7 +6484,7 @@ var ts;
6481
6484
  if (!parentWatcher)
6482
6485
  return false;
6483
6486
  var newChildWatches;
6484
- var hasChanges = ts.enumerateInsertsAndDeletes(fileSystemEntryExists(parentDir, 1 /* Directory */) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
6487
+ var hasChanges = ts.enumerateInsertsAndDeletes(directoryExists(parentDir) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
6485
6488
  var childFullName = ts.getNormalizedAbsolutePath(child, parentDir);
6486
6489
  // Filter our the symbolic link directories since those arent included in recursive watch
6487
6490
  // which is same behaviour when recursive: true is passed to fs.watch
@@ -6524,17 +6527,18 @@ var ts;
6524
6527
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6525
6528
  /*@internal*/
6526
6529
  function createFileWatcherCallback(callback) {
6527
- return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
6530
+ return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6528
6531
  }
6529
6532
  ts.createFileWatcherCallback = createFileWatcherCallback;
6530
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileSystemEntryExists) {
6531
- return function (eventName) {
6533
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6534
+ return function (eventName, _relativeFileName, modifiedTime) {
6532
6535
  if (eventName === "rename") {
6533
- callback(fileName, fileSystemEntryExists(fileName, 0 /* File */) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6536
+ modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
6537
+ callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
6534
6538
  }
6535
6539
  else {
6536
6540
  // Change
6537
- callback(fileName, FileWatcherEventKind.Changed);
6541
+ callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6538
6542
  }
6539
6543
  };
6540
6544
  }
@@ -6558,12 +6562,11 @@ var ts;
6558
6562
  }
6559
6563
  /*@internal*/
6560
6564
  function createSystemWatchFunctions(_a) {
6561
- var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog;
6565
+ 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;
6562
6566
  var dynamicPollingWatchFile;
6563
6567
  var fixedChunkSizePollingWatchFile;
6564
6568
  var nonPollingWatchFile;
6565
6569
  var hostRecursiveDirectoryWatcher;
6566
- var hitSystemWatcherLimit = false;
6567
6570
  return {
6568
6571
  watchFile: watchFile,
6569
6572
  watchDirectory: watchDirectory
@@ -6581,7 +6584,7 @@ var ts;
6581
6584
  case ts.WatchFileKind.FixedChunkSizePolling:
6582
6585
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, /* pollingInterval */ undefined, /*options*/ undefined);
6583
6586
  case ts.WatchFileKind.UseFsEvents:
6584
- return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileSystemEntryExists),
6587
+ return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime),
6585
6588
  /*recursive*/ false, pollingInterval, ts.getFallbackOptions(options));
6586
6589
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
6587
6590
  if (!nonPollingWatchFile) {
@@ -6642,7 +6645,7 @@ var ts;
6642
6645
  hostRecursiveDirectoryWatcher = createDirectoryWatcherSupportingRecursive({
6643
6646
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6644
6647
  getCurrentDirectory: getCurrentDirectory,
6645
- fileSystemEntryExists: fileSystemEntryExists,
6648
+ directoryExists: directoryExists,
6646
6649
  getAccessibleSortedChildDirectories: getAccessibleSortedChildDirectories,
6647
6650
  watchDirectory: nonRecursiveWatchDirectory,
6648
6651
  realpath: realpath,
@@ -6693,114 +6696,6 @@ var ts;
6693
6696
  };
6694
6697
  }
6695
6698
  }
6696
- function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
6697
- var lastDirectoryPartWithDirectorySeparator;
6698
- var lastDirectoryPart;
6699
- if (inodeWatching) {
6700
- lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substring(fileOrDirectory.lastIndexOf(ts.directorySeparator));
6701
- lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
6702
- }
6703
- /** Watcher for the file system entry depending on whether it is missing or present */
6704
- var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
6705
- watchMissingFileSystemEntry() :
6706
- watchPresentFileSystemEntry();
6707
- return {
6708
- close: function () {
6709
- // Close the watcher (either existing file system entry watcher or missing file system entry watcher)
6710
- watcher.close();
6711
- watcher = undefined;
6712
- }
6713
- };
6714
- function updateWatcher(createWatcher) {
6715
- // If watcher is not closed, update it
6716
- if (watcher) {
6717
- sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
6718
- watcher.close();
6719
- watcher = createWatcher();
6720
- }
6721
- }
6722
- /**
6723
- * Watch the file or directory that is currently present
6724
- * and when the watched file or directory is deleted, switch to missing file system entry watcher
6725
- */
6726
- function watchPresentFileSystemEntry() {
6727
- if (hitSystemWatcherLimit) {
6728
- sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to watchFile");
6729
- return watchPresentFileSystemEntryWithFsWatchFile();
6730
- }
6731
- try {
6732
- var presentWatcher = fsWatchWorker(fileOrDirectory, recursive, inodeWatching ?
6733
- callbackChangingToMissingFileSystemEntry :
6734
- function (eventName, relativeFileName) {
6735
- sysLog("sysLog:: watchPresentFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + eventName + ":: " + relativeFileName);
6736
- callback(eventName, relativeFileName);
6737
- });
6738
- // Watch the missing file or directory or error
6739
- presentWatcher.on("error", function () {
6740
- sysLog("sysLog:: watchPresentFileSystemEntry:: on Error " + fileOrDirectory + " " + entryKind + " rename, \"\"");
6741
- callback("rename", "");
6742
- updateWatcher(watchMissingFileSystemEntry);
6743
- });
6744
- return presentWatcher;
6745
- }
6746
- catch (e) {
6747
- // Catch the exception and use polling instead
6748
- // Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
6749
- // so instead of throwing error, use fs.watchFile
6750
- hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
6751
- sysLog("sysLog:: " + fileOrDirectory + ":: Changing to watchFile");
6752
- return watchPresentFileSystemEntryWithFsWatchFile();
6753
- }
6754
- }
6755
- function callbackChangingToMissingFileSystemEntry(event, relativeName) {
6756
- sysLog("sysLog:: callbackChangingToMissingFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + event + ":: " + relativeName + " " + inodeWatching + " " + lastDirectoryPart + " " + lastDirectoryPartWithDirectorySeparator);
6757
- if (relativeName && ts.endsWith(relativeName, "~")) {
6758
- relativeName = relativeName.slice(0, relativeName.length - 1);
6759
- sysLog("sysLog:: callbackChangingToMissingFileSystemEntry:: changed the relative name to " + relativeName);
6760
- }
6761
- callback(event, relativeName);
6762
- // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
6763
- // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
6764
- if (event === "rename" &&
6765
- (!relativeName ||
6766
- relativeName === lastDirectoryPart ||
6767
- ts.endsWith(relativeName, lastDirectoryPartWithDirectorySeparator))) {
6768
- if (inodeWatching) {
6769
- updateWatcher(!fileSystemEntryExists(fileOrDirectory, entryKind) ? watchMissingFileSystemEntry : watchPresentFileSystemEntry);
6770
- }
6771
- else if (!fileSystemEntryExists(fileOrDirectory, entryKind)) {
6772
- updateWatcher(watchMissingFileSystemEntry);
6773
- }
6774
- }
6775
- }
6776
- /**
6777
- * Watch the file or directory using fs.watchFile since fs.watch threw exception
6778
- * Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
6779
- */
6780
- function watchPresentFileSystemEntryWithFsWatchFile() {
6781
- return watchFile(fileOrDirectory, createFileWatcherCallback(function (eventName, relativeFileName) {
6782
- sysLog("sysLog:: watchPresentFileSystemEntryWithFsWatchFile:: " + fileOrDirectory + " " + entryKind + " " + eventName + ":: " + relativeFileName);
6783
- callback(eventName, relativeFileName);
6784
- }), fallbackPollingInterval, fallbackOptions);
6785
- }
6786
- /**
6787
- * Watch the file or directory that is missing
6788
- * and switch to existing file or directory when the missing filesystem entry is created
6789
- */
6790
- function watchMissingFileSystemEntry() {
6791
- return watchFile(fileOrDirectory, function (_fileName, eventKind) {
6792
- sysLog("sysLog:: watchMissingFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + _fileName + ":: " + eventKind);
6793
- if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
6794
- sysLog("sysLog:: watchMissingFileSystemEntry:: Callback :: rename, \"\" and will update the watcher");
6795
- callback("rename", "");
6796
- // Call the callback for current file or directory
6797
- // For now it could be callback for the inner directory creation,
6798
- // but just return current directory, better than current no-op
6799
- updateWatcher(watchPresentFileSystemEntry);
6800
- }
6801
- }, fallbackPollingInterval, fallbackOptions);
6802
- }
6803
- }
6804
6699
  }
6805
6700
  ts.createSystemWatchFunctions = createSystemWatchFunctions;
6806
6701
  /**
@@ -6853,6 +6748,7 @@ var ts;
6853
6748
  }
6854
6749
  var activeSession;
6855
6750
  var profilePath = "./profile.cpuprofile";
6751
+ var hitSystemWatcherLimit = false;
6856
6752
  var Buffer = require("buffer").Buffer;
6857
6753
  var nodeVersion = getNodeMajorVersion();
6858
6754
  var isNode4OrLater = nodeVersion >= 4;
@@ -6867,21 +6763,19 @@ var ts;
6867
6763
  getModifiedTime: getModifiedTime,
6868
6764
  setTimeout: setTimeout,
6869
6765
  clearTimeout: clearTimeout,
6870
- fsWatchWorker: fsWatchWorker,
6766
+ fsWatch: fsWatch,
6871
6767
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6872
6768
  getCurrentDirectory: getCurrentDirectory,
6873
- fileSystemEntryExists: fileSystemEntryExists,
6874
6769
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
6875
6770
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
6876
6771
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
6772
+ directoryExists: directoryExists,
6877
6773
  getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; },
6878
6774
  realpath: realpath,
6879
6775
  tscWatchFile: process.env.TSC_WATCHFILE,
6880
6776
  useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
6881
6777
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
6882
6778
  defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
6883
- inodeWatching: isLinuxOrMacOs,
6884
- sysLog: sysLog,
6885
6779
  }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
6886
6780
  var nodeSystem = {
6887
6781
  args: process.argv.slice(2),
@@ -7131,14 +7025,114 @@ var ts;
7131
7025
  // File changed
7132
7026
  eventKind = FileWatcherEventKind.Changed;
7133
7027
  }
7134
- callback(fileName, eventKind);
7028
+ callback(fileName, eventKind, curr.mtime);
7135
7029
  }
7136
7030
  }
7137
- function fsWatchWorker(fileOrDirectory, recursive, callback) {
7138
- // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
7139
- // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
7140
- return _fs.watch(fileOrDirectory, fsSupportsRecursiveFsWatch ?
7141
- { persistent: true, recursive: !!recursive } : { persistent: true }, callback);
7031
+ function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
7032
+ var options;
7033
+ var lastDirectoryPartWithDirectorySeparator;
7034
+ var lastDirectoryPart;
7035
+ if (isLinuxOrMacOs) {
7036
+ lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
7037
+ lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
7038
+ }
7039
+ /** Watcher for the file system entry depending on whether it is missing or present */
7040
+ var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7041
+ watchMissingFileSystemEntry() :
7042
+ watchPresentFileSystemEntry();
7043
+ return {
7044
+ close: function () {
7045
+ // Close the watcher (either existing file system entry watcher or missing file system entry watcher)
7046
+ watcher.close();
7047
+ watcher = undefined;
7048
+ }
7049
+ };
7050
+ /**
7051
+ * Invoke the callback with rename and update the watcher if not closed
7052
+ * @param createWatcher
7053
+ */
7054
+ function invokeCallbackAndUpdateWatcher(createWatcher, modifiedTime) {
7055
+ sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
7056
+ // Call the callback for current directory
7057
+ callback("rename", "", modifiedTime);
7058
+ // If watcher is not closed, update it
7059
+ if (watcher) {
7060
+ watcher.close();
7061
+ watcher = createWatcher();
7062
+ }
7063
+ }
7064
+ /**
7065
+ * Watch the file or directory that is currently present
7066
+ * and when the watched file or directory is deleted, switch to missing file system entry watcher
7067
+ */
7068
+ function watchPresentFileSystemEntry() {
7069
+ // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
7070
+ // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
7071
+ if (options === undefined) {
7072
+ if (fsSupportsRecursiveFsWatch) {
7073
+ options = { persistent: true, recursive: !!recursive };
7074
+ }
7075
+ else {
7076
+ options = { persistent: true };
7077
+ }
7078
+ }
7079
+ if (hitSystemWatcherLimit) {
7080
+ sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to fsWatchFile");
7081
+ return watchPresentFileSystemEntryWithFsWatchFile();
7082
+ }
7083
+ try {
7084
+ var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
7085
+ callbackChangingToMissingFileSystemEntry :
7086
+ callback);
7087
+ // Watch the missing file or directory or error
7088
+ presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
7089
+ return presentWatcher;
7090
+ }
7091
+ catch (e) {
7092
+ // Catch the exception and use polling instead
7093
+ // Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
7094
+ // so instead of throwing error, use fs.watchFile
7095
+ hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
7096
+ sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
7097
+ return watchPresentFileSystemEntryWithFsWatchFile();
7098
+ }
7099
+ }
7100
+ function callbackChangingToMissingFileSystemEntry(event, relativeName) {
7101
+ // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
7102
+ // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
7103
+ var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
7104
+ return event === "rename" &&
7105
+ (!relativeName ||
7106
+ relativeName === lastDirectoryPart ||
7107
+ (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
7108
+ modifiedTime === ts.missingFileModifiedTime ?
7109
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry, modifiedTime) :
7110
+ callback(event, relativeName, modifiedTime);
7111
+ }
7112
+ /**
7113
+ * Watch the file or directory using fs.watchFile since fs.watch threw exception
7114
+ * Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
7115
+ */
7116
+ function watchPresentFileSystemEntryWithFsWatchFile() {
7117
+ return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions);
7118
+ }
7119
+ /**
7120
+ * Watch the file or directory that is missing
7121
+ * and switch to existing file or directory when the missing filesystem entry is created
7122
+ */
7123
+ function watchMissingFileSystemEntry() {
7124
+ return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
7125
+ if (eventKind === FileWatcherEventKind.Created) {
7126
+ modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
7127
+ if (modifiedTime !== ts.missingFileModifiedTime) {
7128
+ // Call the callback for current file or directory
7129
+ // For now it could be callback for the inner directory creation,
7130
+ // but just return current directory, better than current no-op
7131
+ invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry, modifiedTime);
7132
+ }
7133
+ }
7134
+ }, fallbackPollingInterval, fallbackOptions);
7135
+ }
7142
7136
  }
7143
7137
  function readFileWorker(fileName, _encoding) {
7144
7138
  var buffer;
@@ -7285,12 +7279,19 @@ var ts;
7285
7279
  }
7286
7280
  function getModifiedTime(path) {
7287
7281
  var _a;
7282
+ // Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
7283
+ // the CPU time performance.
7284
+ var originalStackTraceLimit = Error.stackTraceLimit;
7285
+ Error.stackTraceLimit = 0;
7288
7286
  try {
7289
7287
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
7290
7288
  }
7291
7289
  catch (e) {
7292
7290
  return undefined;
7293
7291
  }
7292
+ finally {
7293
+ Error.stackTraceLimit = originalStackTraceLimit;
7294
+ }
7294
7295
  }
7295
7296
  function setModifiedTime(path, time) {
7296
7297
  try {
@@ -9311,8 +9312,8 @@ var ts;
9311
9312
  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"),
9312
9313
  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"),
9313
9314
  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."),
9314
- 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}'"),
9315
- 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}'"),
9315
+ 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}'"),
9316
+ 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}'"),
9316
9317
  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"),
9317
9318
  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"),
9318
9319
  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"),
@@ -9356,6 +9357,8 @@ var ts;
9356
9357
  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}'."),
9357
9358
  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}'."),
9358
9359
  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."),
9360
+ 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"),
9361
+ 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"),
9359
9362
  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}'"),
9360
9363
  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."),
9361
9364
  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."),
@@ -16220,9 +16223,6 @@ var ts;
16220
16223
  }
16221
16224
  ts.isVariableDeclarationInitializedToBareOrAccessedRequire = isVariableDeclarationInitializedToBareOrAccessedRequire;
16222
16225
  function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) {
16223
- if (node.kind === 203 /* BindingElement */) {
16224
- node = node.parent.parent;
16225
- }
16226
16226
  return ts.isVariableDeclaration(node) &&
16227
16227
  !!node.initializer &&
16228
16228
  isRequireCall(allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, /*requireStringLiteralLikeArgument*/ true);
@@ -20034,8 +20034,9 @@ var ts;
20034
20034
  */
20035
20035
  function isFileForcedToBeModuleByFormat(file) {
20036
20036
  // Excludes declaration files - they still require an explicit `export {}` or the like
20037
- // for back compat purposes.
20038
- return file.impliedNodeFormat === ts.ModuleKind.ESNext && !file.isDeclarationFile ? true : undefined;
20037
+ // for back compat purposes. The only non-declaration files _not_ forced to be a module are `.js` files
20038
+ // that aren't esm-mode (meaning not in a `type: module` scope).
20039
+ return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) && !file.isDeclarationFile ? true : undefined;
20039
20040
  }
20040
20041
  function getSetExternalModuleIndicator(options) {
20041
20042
  // TODO: Should this callback be cached?
@@ -20043,7 +20044,7 @@ var ts;
20043
20044
  case ts.ModuleDetectionKind.Force:
20044
20045
  // All non-declaration files are modules, declaration files still do the usual isFileProbablyExternalModule
20045
20046
  return function (file) {
20046
- file.externalModuleIndicator = !file.isDeclarationFile || ts.isFileProbablyExternalModule(file);
20047
+ file.externalModuleIndicator = ts.isFileProbablyExternalModule(file) || !file.isDeclarationFile || undefined;
20047
20048
  };
20048
20049
  case ts.ModuleDetectionKind.Legacy:
20049
20050
  // Files are modules if they have imports, exports, or import.meta
@@ -20103,7 +20104,8 @@ var ts;
20103
20104
  }
20104
20105
  ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
20105
20106
  function getEmitModuleDetectionKind(options) {
20106
- return options.moduleDetection || ts.ModuleDetectionKind.Auto;
20107
+ return options.moduleDetection ||
20108
+ (getEmitModuleKind(options) === ts.ModuleKind.Node16 || getEmitModuleKind(options) === ts.ModuleKind.NodeNext ? ts.ModuleDetectionKind.Force : ts.ModuleDetectionKind.Auto);
20107
20109
  }
20108
20110
  ts.getEmitModuleDetectionKind = getEmitModuleDetectionKind;
20109
20111
  function hasJsonModuleEmitEnabled(options) {
@@ -20186,6 +20188,10 @@ var ts;
20186
20188
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
20187
20189
  }
20188
20190
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
20191
+ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
20192
+ return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
20193
+ }
20194
+ ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
20189
20195
  function getCompilerOptionValue(options, option) {
20190
20196
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
20191
20197
  }
@@ -39226,6 +39232,7 @@ var ts;
39226
39232
  type: "boolean",
39227
39233
  affectsSemanticDiagnostics: true,
39228
39234
  affectsEmit: true,
39235
+ affectsMultiFileEmitBuildInfo: true,
39229
39236
  category: ts.Diagnostics.Watch_and_Build_Modes,
39230
39237
  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,
39231
39238
  defaultValueDescription: false,
@@ -39260,12 +39267,40 @@ var ts;
39260
39267
  affectsSourceFile: true,
39261
39268
  affectsModuleResolution: true,
39262
39269
  affectsEmit: true,
39270
+ affectsMultiFileEmitBuildInfo: true,
39263
39271
  paramType: ts.Diagnostics.VERSION,
39264
39272
  showInSimplifiedHelpView: true,
39265
39273
  category: ts.Diagnostics.Language_and_Environment,
39266
39274
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
39267
39275
  defaultValueDescription: 0 /* ES3 */,
39268
39276
  };
39277
+ /*@internal*/
39278
+ ts.moduleOptionDeclaration = {
39279
+ name: "module",
39280
+ shortName: "m",
39281
+ type: new ts.Map(ts.getEntries({
39282
+ none: ts.ModuleKind.None,
39283
+ commonjs: ts.ModuleKind.CommonJS,
39284
+ amd: ts.ModuleKind.AMD,
39285
+ system: ts.ModuleKind.System,
39286
+ umd: ts.ModuleKind.UMD,
39287
+ es6: ts.ModuleKind.ES2015,
39288
+ es2015: ts.ModuleKind.ES2015,
39289
+ es2020: ts.ModuleKind.ES2020,
39290
+ es2022: ts.ModuleKind.ES2022,
39291
+ esnext: ts.ModuleKind.ESNext,
39292
+ node16: ts.ModuleKind.Node16,
39293
+ nodenext: ts.ModuleKind.NodeNext,
39294
+ })),
39295
+ affectsModuleResolution: true,
39296
+ affectsEmit: true,
39297
+ affectsMultiFileEmitBuildInfo: true,
39298
+ paramType: ts.Diagnostics.KIND,
39299
+ showInSimplifiedHelpView: true,
39300
+ category: ts.Diagnostics.Modules,
39301
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
39302
+ defaultValueDescription: undefined,
39303
+ };
39269
39304
  var commandOptionsWithoutBuild = [
39270
39305
  // CommandLine only options
39271
39306
  {
@@ -39327,37 +39362,14 @@ var ts;
39327
39362
  category: ts.Diagnostics.Command_line_Options,
39328
39363
  affectsSemanticDiagnostics: true,
39329
39364
  affectsEmit: true,
39365
+ affectsMultiFileEmitBuildInfo: true,
39330
39366
  isCommandLineOnly: true,
39331
39367
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
39332
39368
  defaultValueDescription: false,
39333
39369
  },
39334
39370
  // Basic
39335
39371
  ts.targetOptionDeclaration,
39336
- {
39337
- name: "module",
39338
- shortName: "m",
39339
- type: new ts.Map(ts.getEntries({
39340
- none: ts.ModuleKind.None,
39341
- commonjs: ts.ModuleKind.CommonJS,
39342
- amd: ts.ModuleKind.AMD,
39343
- system: ts.ModuleKind.System,
39344
- umd: ts.ModuleKind.UMD,
39345
- es6: ts.ModuleKind.ES2015,
39346
- es2015: ts.ModuleKind.ES2015,
39347
- es2020: ts.ModuleKind.ES2020,
39348
- es2022: ts.ModuleKind.ES2022,
39349
- esnext: ts.ModuleKind.ESNext,
39350
- node16: ts.ModuleKind.Node16,
39351
- nodenext: ts.ModuleKind.NodeNext,
39352
- })),
39353
- affectsModuleResolution: true,
39354
- affectsEmit: true,
39355
- paramType: ts.Diagnostics.KIND,
39356
- showInSimplifiedHelpView: true,
39357
- category: ts.Diagnostics.Modules,
39358
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
39359
- defaultValueDescription: undefined,
39360
- },
39372
+ ts.moduleOptionDeclaration,
39361
39373
  {
39362
39374
  name: "lib",
39363
39375
  type: "list",
@@ -39394,6 +39406,7 @@ var ts;
39394
39406
  type: jsxOptionMap,
39395
39407
  affectsSourceFile: true,
39396
39408
  affectsEmit: true,
39409
+ affectsMultiFileEmitBuildInfo: true,
39397
39410
  affectsModuleResolution: true,
39398
39411
  paramType: ts.Diagnostics.KIND,
39399
39412
  showInSimplifiedHelpView: true,
@@ -39406,6 +39419,7 @@ var ts;
39406
39419
  shortName: "d",
39407
39420
  type: "boolean",
39408
39421
  affectsEmit: true,
39422
+ affectsMultiFileEmitBuildInfo: true,
39409
39423
  showInSimplifiedHelpView: true,
39410
39424
  category: ts.Diagnostics.Emit,
39411
39425
  transpileOptionValue: undefined,
@@ -39416,6 +39430,7 @@ var ts;
39416
39430
  name: "declarationMap",
39417
39431
  type: "boolean",
39418
39432
  affectsEmit: true,
39433
+ affectsMultiFileEmitBuildInfo: true,
39419
39434
  showInSimplifiedHelpView: true,
39420
39435
  category: ts.Diagnostics.Emit,
39421
39436
  transpileOptionValue: undefined,
@@ -39426,6 +39441,7 @@ var ts;
39426
39441
  name: "emitDeclarationOnly",
39427
39442
  type: "boolean",
39428
39443
  affectsEmit: true,
39444
+ affectsMultiFileEmitBuildInfo: true,
39429
39445
  showInSimplifiedHelpView: true,
39430
39446
  category: ts.Diagnostics.Emit,
39431
39447
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -39436,6 +39452,7 @@ var ts;
39436
39452
  name: "sourceMap",
39437
39453
  type: "boolean",
39438
39454
  affectsEmit: true,
39455
+ affectsMultiFileEmitBuildInfo: true,
39439
39456
  showInSimplifiedHelpView: true,
39440
39457
  category: ts.Diagnostics.Emit,
39441
39458
  defaultValueDescription: false,
@@ -39445,6 +39462,9 @@ var ts;
39445
39462
  name: "outFile",
39446
39463
  type: "string",
39447
39464
  affectsEmit: true,
39465
+ affectsMultiFileEmitBuildInfo: true,
39466
+ affectsDeclarationPath: true,
39467
+ affectsBundleEmitBuildInfo: true,
39448
39468
  isFilePath: true,
39449
39469
  paramType: ts.Diagnostics.FILE,
39450
39470
  showInSimplifiedHelpView: true,
@@ -39456,6 +39476,8 @@ var ts;
39456
39476
  name: "outDir",
39457
39477
  type: "string",
39458
39478
  affectsEmit: true,
39479
+ affectsMultiFileEmitBuildInfo: true,
39480
+ affectsDeclarationPath: true,
39459
39481
  isFilePath: true,
39460
39482
  paramType: ts.Diagnostics.DIRECTORY,
39461
39483
  showInSimplifiedHelpView: true,
@@ -39466,6 +39488,8 @@ var ts;
39466
39488
  name: "rootDir",
39467
39489
  type: "string",
39468
39490
  affectsEmit: true,
39491
+ affectsMultiFileEmitBuildInfo: true,
39492
+ affectsDeclarationPath: true,
39469
39493
  isFilePath: true,
39470
39494
  paramType: ts.Diagnostics.LOCATION,
39471
39495
  category: ts.Diagnostics.Modules,
@@ -39476,6 +39500,8 @@ var ts;
39476
39500
  name: "composite",
39477
39501
  type: "boolean",
39478
39502
  affectsEmit: true,
39503
+ affectsMultiFileEmitBuildInfo: true,
39504
+ affectsBundleEmitBuildInfo: true,
39479
39505
  isTSConfigOnly: true,
39480
39506
  category: ts.Diagnostics.Projects,
39481
39507
  transpileOptionValue: undefined,
@@ -39486,6 +39512,8 @@ var ts;
39486
39512
  name: "tsBuildInfoFile",
39487
39513
  type: "string",
39488
39514
  affectsEmit: true,
39515
+ affectsMultiFileEmitBuildInfo: true,
39516
+ affectsBundleEmitBuildInfo: true,
39489
39517
  isFilePath: true,
39490
39518
  paramType: ts.Diagnostics.FILE,
39491
39519
  category: ts.Diagnostics.Projects,
@@ -39497,6 +39525,7 @@ var ts;
39497
39525
  name: "removeComments",
39498
39526
  type: "boolean",
39499
39527
  affectsEmit: true,
39528
+ affectsMultiFileEmitBuildInfo: true,
39500
39529
  showInSimplifiedHelpView: true,
39501
39530
  category: ts.Diagnostics.Emit,
39502
39531
  defaultValueDescription: false,
@@ -39515,6 +39544,7 @@ var ts;
39515
39544
  name: "importHelpers",
39516
39545
  type: "boolean",
39517
39546
  affectsEmit: true,
39547
+ affectsMultiFileEmitBuildInfo: true,
39518
39548
  category: ts.Diagnostics.Emit,
39519
39549
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
39520
39550
  defaultValueDescription: false,
@@ -39528,6 +39558,7 @@ var ts;
39528
39558
  })),
39529
39559
  affectsEmit: true,
39530
39560
  affectsSemanticDiagnostics: true,
39561
+ affectsMultiFileEmitBuildInfo: true,
39531
39562
  category: ts.Diagnostics.Emit,
39532
39563
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
39533
39564
  defaultValueDescription: 0 /* Remove */,
@@ -39536,6 +39567,7 @@ var ts;
39536
39567
  name: "downlevelIteration",
39537
39568
  type: "boolean",
39538
39569
  affectsEmit: true,
39570
+ affectsMultiFileEmitBuildInfo: true,
39539
39571
  category: ts.Diagnostics.Emit,
39540
39572
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
39541
39573
  defaultValueDescription: false,
@@ -39554,6 +39586,9 @@ var ts;
39554
39586
  type: "boolean",
39555
39587
  // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
39556
39588
  // The value of each strictFlag depends on own strictFlag value or this and never accessed directly.
39589
+ // But we need to store `strict` in builf info, even though it won't be examined directly, so that the
39590
+ // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly
39591
+ affectsMultiFileEmitBuildInfo: true,
39557
39592
  showInSimplifiedHelpView: true,
39558
39593
  category: ts.Diagnostics.Type_Checking,
39559
39594
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -39563,6 +39598,7 @@ var ts;
39563
39598
  name: "noImplicitAny",
39564
39599
  type: "boolean",
39565
39600
  affectsSemanticDiagnostics: true,
39601
+ affectsMultiFileEmitBuildInfo: true,
39566
39602
  strictFlag: true,
39567
39603
  category: ts.Diagnostics.Type_Checking,
39568
39604
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -39572,6 +39608,7 @@ var ts;
39572
39608
  name: "strictNullChecks",
39573
39609
  type: "boolean",
39574
39610
  affectsSemanticDiagnostics: true,
39611
+ affectsMultiFileEmitBuildInfo: true,
39575
39612
  strictFlag: true,
39576
39613
  category: ts.Diagnostics.Type_Checking,
39577
39614
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -39580,6 +39617,8 @@ var ts;
39580
39617
  {
39581
39618
  name: "strictFunctionTypes",
39582
39619
  type: "boolean",
39620
+ affectsSemanticDiagnostics: true,
39621
+ affectsMultiFileEmitBuildInfo: true,
39583
39622
  strictFlag: true,
39584
39623
  category: ts.Diagnostics.Type_Checking,
39585
39624
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -39588,6 +39627,8 @@ var ts;
39588
39627
  {
39589
39628
  name: "strictBindCallApply",
39590
39629
  type: "boolean",
39630
+ affectsSemanticDiagnostics: true,
39631
+ affectsMultiFileEmitBuildInfo: true,
39591
39632
  strictFlag: true,
39592
39633
  category: ts.Diagnostics.Type_Checking,
39593
39634
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -39597,6 +39638,7 @@ var ts;
39597
39638
  name: "strictPropertyInitialization",
39598
39639
  type: "boolean",
39599
39640
  affectsSemanticDiagnostics: true,
39641
+ affectsMultiFileEmitBuildInfo: true,
39600
39642
  strictFlag: true,
39601
39643
  category: ts.Diagnostics.Type_Checking,
39602
39644
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -39606,6 +39648,7 @@ var ts;
39606
39648
  name: "noImplicitThis",
39607
39649
  type: "boolean",
39608
39650
  affectsSemanticDiagnostics: true,
39651
+ affectsMultiFileEmitBuildInfo: true,
39609
39652
  strictFlag: true,
39610
39653
  category: ts.Diagnostics.Type_Checking,
39611
39654
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -39615,6 +39658,7 @@ var ts;
39615
39658
  name: "useUnknownInCatchVariables",
39616
39659
  type: "boolean",
39617
39660
  affectsSemanticDiagnostics: true,
39661
+ affectsMultiFileEmitBuildInfo: true,
39618
39662
  strictFlag: true,
39619
39663
  category: ts.Diagnostics.Type_Checking,
39620
39664
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -39624,6 +39668,8 @@ var ts;
39624
39668
  name: "alwaysStrict",
39625
39669
  type: "boolean",
39626
39670
  affectsSourceFile: true,
39671
+ affectsEmit: true,
39672
+ affectsMultiFileEmitBuildInfo: true,
39627
39673
  strictFlag: true,
39628
39674
  category: ts.Diagnostics.Type_Checking,
39629
39675
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -39634,6 +39680,7 @@ var ts;
39634
39680
  name: "noUnusedLocals",
39635
39681
  type: "boolean",
39636
39682
  affectsSemanticDiagnostics: true,
39683
+ affectsMultiFileEmitBuildInfo: true,
39637
39684
  category: ts.Diagnostics.Type_Checking,
39638
39685
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
39639
39686
  defaultValueDescription: false,
@@ -39642,6 +39689,7 @@ var ts;
39642
39689
  name: "noUnusedParameters",
39643
39690
  type: "boolean",
39644
39691
  affectsSemanticDiagnostics: true,
39692
+ affectsMultiFileEmitBuildInfo: true,
39645
39693
  category: ts.Diagnostics.Type_Checking,
39646
39694
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
39647
39695
  defaultValueDescription: false,
@@ -39650,6 +39698,7 @@ var ts;
39650
39698
  name: "exactOptionalPropertyTypes",
39651
39699
  type: "boolean",
39652
39700
  affectsSemanticDiagnostics: true,
39701
+ affectsMultiFileEmitBuildInfo: true,
39653
39702
  category: ts.Diagnostics.Type_Checking,
39654
39703
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
39655
39704
  defaultValueDescription: false,
@@ -39658,6 +39707,7 @@ var ts;
39658
39707
  name: "noImplicitReturns",
39659
39708
  type: "boolean",
39660
39709
  affectsSemanticDiagnostics: true,
39710
+ affectsMultiFileEmitBuildInfo: true,
39661
39711
  category: ts.Diagnostics.Type_Checking,
39662
39712
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
39663
39713
  defaultValueDescription: false,
@@ -39667,6 +39717,7 @@ var ts;
39667
39717
  type: "boolean",
39668
39718
  affectsBindDiagnostics: true,
39669
39719
  affectsSemanticDiagnostics: true,
39720
+ affectsMultiFileEmitBuildInfo: true,
39670
39721
  category: ts.Diagnostics.Type_Checking,
39671
39722
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
39672
39723
  defaultValueDescription: false,
@@ -39675,6 +39726,7 @@ var ts;
39675
39726
  name: "noUncheckedIndexedAccess",
39676
39727
  type: "boolean",
39677
39728
  affectsSemanticDiagnostics: true,
39729
+ affectsMultiFileEmitBuildInfo: true,
39678
39730
  category: ts.Diagnostics.Type_Checking,
39679
39731
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
39680
39732
  defaultValueDescription: false,
@@ -39683,6 +39735,7 @@ var ts;
39683
39735
  name: "noImplicitOverride",
39684
39736
  type: "boolean",
39685
39737
  affectsSemanticDiagnostics: true,
39738
+ affectsMultiFileEmitBuildInfo: true,
39686
39739
  category: ts.Diagnostics.Type_Checking,
39687
39740
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
39688
39741
  defaultValueDescription: false,
@@ -39690,6 +39743,8 @@ var ts;
39690
39743
  {
39691
39744
  name: "noPropertyAccessFromIndexSignature",
39692
39745
  type: "boolean",
39746
+ affectsSemanticDiagnostics: true,
39747
+ affectsMultiFileEmitBuildInfo: true,
39693
39748
  showInSimplifiedHelpView: false,
39694
39749
  category: ts.Diagnostics.Type_Checking,
39695
39750
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -39775,6 +39830,7 @@ var ts;
39775
39830
  name: "allowSyntheticDefaultImports",
39776
39831
  type: "boolean",
39777
39832
  affectsSemanticDiagnostics: true,
39833
+ affectsMultiFileEmitBuildInfo: true,
39778
39834
  category: ts.Diagnostics.Interop_Constraints,
39779
39835
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
39780
39836
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -39784,6 +39840,7 @@ var ts;
39784
39840
  type: "boolean",
39785
39841
  affectsSemanticDiagnostics: true,
39786
39842
  affectsEmit: true,
39843
+ affectsMultiFileEmitBuildInfo: true,
39787
39844
  showInSimplifiedHelpView: true,
39788
39845
  category: ts.Diagnostics.Interop_Constraints,
39789
39846
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -39800,6 +39857,7 @@ var ts;
39800
39857
  name: "allowUmdGlobalAccess",
39801
39858
  type: "boolean",
39802
39859
  affectsSemanticDiagnostics: true,
39860
+ affectsMultiFileEmitBuildInfo: true,
39803
39861
  category: ts.Diagnostics.Modules,
39804
39862
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
39805
39863
  defaultValueDescription: false,
@@ -39821,6 +39879,7 @@ var ts;
39821
39879
  name: "sourceRoot",
39822
39880
  type: "string",
39823
39881
  affectsEmit: true,
39882
+ affectsMultiFileEmitBuildInfo: true,
39824
39883
  paramType: ts.Diagnostics.LOCATION,
39825
39884
  category: ts.Diagnostics.Emit,
39826
39885
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -39829,6 +39888,7 @@ var ts;
39829
39888
  name: "mapRoot",
39830
39889
  type: "string",
39831
39890
  affectsEmit: true,
39891
+ affectsMultiFileEmitBuildInfo: true,
39832
39892
  paramType: ts.Diagnostics.LOCATION,
39833
39893
  category: ts.Diagnostics.Emit,
39834
39894
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -39837,6 +39897,7 @@ var ts;
39837
39897
  name: "inlineSourceMap",
39838
39898
  type: "boolean",
39839
39899
  affectsEmit: true,
39900
+ affectsMultiFileEmitBuildInfo: true,
39840
39901
  category: ts.Diagnostics.Emit,
39841
39902
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
39842
39903
  defaultValueDescription: false,
@@ -39845,6 +39906,7 @@ var ts;
39845
39906
  name: "inlineSources",
39846
39907
  type: "boolean",
39847
39908
  affectsEmit: true,
39909
+ affectsMultiFileEmitBuildInfo: true,
39848
39910
  category: ts.Diagnostics.Emit,
39849
39911
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
39850
39912
  defaultValueDescription: false,
@@ -39854,6 +39916,7 @@ var ts;
39854
39916
  name: "experimentalDecorators",
39855
39917
  type: "boolean",
39856
39918
  affectsSemanticDiagnostics: true,
39919
+ affectsMultiFileEmitBuildInfo: true,
39857
39920
  category: ts.Diagnostics.Language_and_Environment,
39858
39921
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
39859
39922
  defaultValueDescription: false,
@@ -39863,6 +39926,7 @@ var ts;
39863
39926
  type: "boolean",
39864
39927
  affectsSemanticDiagnostics: true,
39865
39928
  affectsEmit: true,
39929
+ affectsMultiFileEmitBuildInfo: true,
39866
39930
  category: ts.Diagnostics.Language_and_Environment,
39867
39931
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
39868
39932
  defaultValueDescription: false,
@@ -39887,6 +39951,7 @@ var ts;
39887
39951
  type: "string",
39888
39952
  affectsSemanticDiagnostics: true,
39889
39953
  affectsEmit: true,
39954
+ affectsMultiFileEmitBuildInfo: true,
39890
39955
  affectsModuleResolution: true,
39891
39956
  category: ts.Diagnostics.Language_and_Environment,
39892
39957
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -39904,6 +39969,9 @@ var ts;
39904
39969
  name: "out",
39905
39970
  type: "string",
39906
39971
  affectsEmit: true,
39972
+ affectsMultiFileEmitBuildInfo: true,
39973
+ affectsDeclarationPath: true,
39974
+ affectsBundleEmitBuildInfo: true,
39907
39975
  isFilePath: false,
39908
39976
  // for correct behaviour, please use outFile
39909
39977
  category: ts.Diagnostics.Backwards_Compatibility,
@@ -39915,6 +39983,7 @@ var ts;
39915
39983
  name: "reactNamespace",
39916
39984
  type: "string",
39917
39985
  affectsEmit: true,
39986
+ affectsMultiFileEmitBuildInfo: true,
39918
39987
  category: ts.Diagnostics.Language_and_Environment,
39919
39988
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
39920
39989
  defaultValueDescription: "`React`",
@@ -39922,6 +39991,8 @@ var ts;
39922
39991
  {
39923
39992
  name: "skipDefaultLibCheck",
39924
39993
  type: "boolean",
39994
+ // We need to store these to determine whether `lib` files need to be rechecked
39995
+ affectsMultiFileEmitBuildInfo: true,
39925
39996
  category: ts.Diagnostics.Completeness,
39926
39997
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
39927
39998
  defaultValueDescription: false,
@@ -39937,6 +40008,7 @@ var ts;
39937
40008
  name: "emitBOM",
39938
40009
  type: "boolean",
39939
40010
  affectsEmit: true,
40011
+ affectsMultiFileEmitBuildInfo: true,
39940
40012
  category: ts.Diagnostics.Emit,
39941
40013
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
39942
40014
  defaultValueDescription: false,
@@ -39948,6 +40020,7 @@ var ts;
39948
40020
  lf: 1 /* LineFeed */
39949
40021
  })),
39950
40022
  affectsEmit: true,
40023
+ affectsMultiFileEmitBuildInfo: true,
39951
40024
  paramType: ts.Diagnostics.NEWLINE,
39952
40025
  category: ts.Diagnostics.Emit,
39953
40026
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -39957,6 +40030,7 @@ var ts;
39957
40030
  name: "noErrorTruncation",
39958
40031
  type: "boolean",
39959
40032
  affectsSemanticDiagnostics: true,
40033
+ affectsMultiFileEmitBuildInfo: true,
39960
40034
  category: ts.Diagnostics.Output_Formatting,
39961
40035
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
39962
40036
  defaultValueDescription: false,
@@ -39987,6 +40061,7 @@ var ts;
39987
40061
  name: "stripInternal",
39988
40062
  type: "boolean",
39989
40063
  affectsEmit: true,
40064
+ affectsMultiFileEmitBuildInfo: true,
39990
40065
  category: ts.Diagnostics.Emit,
39991
40066
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
39992
40067
  defaultValueDescription: false,
@@ -40027,6 +40102,7 @@ var ts;
40027
40102
  name: "noImplicitUseStrict",
40028
40103
  type: "boolean",
40029
40104
  affectsSemanticDiagnostics: true,
40105
+ affectsMultiFileEmitBuildInfo: true,
40030
40106
  category: ts.Diagnostics.Backwards_Compatibility,
40031
40107
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
40032
40108
  defaultValueDescription: false,
@@ -40035,6 +40111,7 @@ var ts;
40035
40111
  name: "noEmitHelpers",
40036
40112
  type: "boolean",
40037
40113
  affectsEmit: true,
40114
+ affectsMultiFileEmitBuildInfo: true,
40038
40115
  category: ts.Diagnostics.Emit,
40039
40116
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
40040
40117
  defaultValueDescription: false,
@@ -40043,6 +40120,7 @@ var ts;
40043
40120
  name: "noEmitOnError",
40044
40121
  type: "boolean",
40045
40122
  affectsEmit: true,
40123
+ affectsMultiFileEmitBuildInfo: true,
40046
40124
  category: ts.Diagnostics.Emit,
40047
40125
  transpileOptionValue: undefined,
40048
40126
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -40052,6 +40130,7 @@ var ts;
40052
40130
  name: "preserveConstEnums",
40053
40131
  type: "boolean",
40054
40132
  affectsEmit: true,
40133
+ affectsMultiFileEmitBuildInfo: true,
40055
40134
  category: ts.Diagnostics.Emit,
40056
40135
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
40057
40136
  defaultValueDescription: false,
@@ -40060,6 +40139,8 @@ var ts;
40060
40139
  name: "declarationDir",
40061
40140
  type: "string",
40062
40141
  affectsEmit: true,
40142
+ affectsMultiFileEmitBuildInfo: true,
40143
+ affectsDeclarationPath: true,
40063
40144
  isFilePath: true,
40064
40145
  paramType: ts.Diagnostics.DIRECTORY,
40065
40146
  category: ts.Diagnostics.Emit,
@@ -40069,6 +40150,8 @@ var ts;
40069
40150
  {
40070
40151
  name: "skipLibCheck",
40071
40152
  type: "boolean",
40153
+ // We need to store these to determine whether `lib` files need to be rechecked
40154
+ affectsMultiFileEmitBuildInfo: true,
40072
40155
  category: ts.Diagnostics.Completeness,
40073
40156
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
40074
40157
  defaultValueDescription: false,
@@ -40078,6 +40161,7 @@ var ts;
40078
40161
  type: "boolean",
40079
40162
  affectsBindDiagnostics: true,
40080
40163
  affectsSemanticDiagnostics: true,
40164
+ affectsMultiFileEmitBuildInfo: true,
40081
40165
  category: ts.Diagnostics.Type_Checking,
40082
40166
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
40083
40167
  defaultValueDescription: undefined,
@@ -40087,6 +40171,7 @@ var ts;
40087
40171
  type: "boolean",
40088
40172
  affectsBindDiagnostics: true,
40089
40173
  affectsSemanticDiagnostics: true,
40174
+ affectsMultiFileEmitBuildInfo: true,
40090
40175
  category: ts.Diagnostics.Type_Checking,
40091
40176
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
40092
40177
  defaultValueDescription: undefined,
@@ -40095,6 +40180,7 @@ var ts;
40095
40180
  name: "suppressExcessPropertyErrors",
40096
40181
  type: "boolean",
40097
40182
  affectsSemanticDiagnostics: true,
40183
+ affectsMultiFileEmitBuildInfo: true,
40098
40184
  category: ts.Diagnostics.Backwards_Compatibility,
40099
40185
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
40100
40186
  defaultValueDescription: false,
@@ -40103,6 +40189,7 @@ var ts;
40103
40189
  name: "suppressImplicitAnyIndexErrors",
40104
40190
  type: "boolean",
40105
40191
  affectsSemanticDiagnostics: true,
40192
+ affectsMultiFileEmitBuildInfo: true,
40106
40193
  category: ts.Diagnostics.Backwards_Compatibility,
40107
40194
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
40108
40195
  defaultValueDescription: false,
@@ -40127,6 +40214,7 @@ var ts;
40127
40214
  name: "noStrictGenericChecks",
40128
40215
  type: "boolean",
40129
40216
  affectsSemanticDiagnostics: true,
40217
+ affectsMultiFileEmitBuildInfo: true,
40130
40218
  category: ts.Diagnostics.Backwards_Compatibility,
40131
40219
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
40132
40220
  defaultValueDescription: false,
@@ -40136,6 +40224,7 @@ var ts;
40136
40224
  type: "boolean",
40137
40225
  affectsSemanticDiagnostics: true,
40138
40226
  affectsEmit: true,
40227
+ affectsMultiFileEmitBuildInfo: true,
40139
40228
  category: ts.Diagnostics.Language_and_Environment,
40140
40229
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
40141
40230
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -40144,6 +40233,7 @@ var ts;
40144
40233
  name: "preserveValueImports",
40145
40234
  type: "boolean",
40146
40235
  affectsEmit: true,
40236
+ affectsMultiFileEmitBuildInfo: true,
40147
40237
  category: ts.Diagnostics.Emit,
40148
40238
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
40149
40239
  defaultValueDescription: false,
@@ -40187,6 +40277,8 @@ var ts;
40187
40277
  /* @internal */
40188
40278
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
40189
40279
  /* @internal */
40280
+ ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
40281
+ /* @internal */
40190
40282
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
40191
40283
  /* @internal */
40192
40284
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -41042,6 +41134,7 @@ var ts;
41042
41134
  return optionDefinition.type;
41043
41135
  }
41044
41136
  }
41137
+ /* @internal */
41045
41138
  function getNameOfCompilerOptionValue(value, customTypeMap) {
41046
41139
  // There is a typeMap associated with this command-line option so use it to map value back to its name
41047
41140
  return ts.forEachEntry(customTypeMap, function (mapValue, key) {
@@ -41050,6 +41143,7 @@ var ts;
41050
41143
  }
41051
41144
  });
41052
41145
  }
41146
+ ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
41053
41147
  function serializeCompilerOptions(options, pathOptions) {
41054
41148
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
41055
41149
  }
@@ -43150,16 +43244,20 @@ var ts;
43150
43244
  function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
43151
43245
  return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
43152
43246
  }
43247
+ var jsOnlyExtensions = [Extensions.JavaScript];
43248
+ var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
43249
+ var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
43250
+ var tsconfigExtensions = [Extensions.TSConfig];
43153
43251
  function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
43154
43252
  var containingDirectory = ts.getDirectoryPath(containingFile);
43155
43253
  // es module file or cjs-like input file, use a variant of the legacy cjs resolver that supports the selected modern features
43156
43254
  var esmMode = resolutionMode === ts.ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0;
43157
- return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions, redirectedReference);
43255
+ var extensions = compilerOptions.noDtsResolution ? [Extensions.TsOnly, Extensions.JavaScript] : tsExtensions;
43256
+ if (compilerOptions.resolveJsonModule) {
43257
+ extensions = __spreadArray(__spreadArray([], extensions, true), [Extensions.Json], false);
43258
+ }
43259
+ return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference);
43158
43260
  }
43159
- var jsOnlyExtensions = [Extensions.JavaScript];
43160
- var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
43161
- var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
43162
- var tsconfigExtensions = [Extensions.TSConfig];
43163
43261
  function tryResolveJSModuleWorker(moduleName, initialDir, host) {
43164
43262
  return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
43165
43263
  }
@@ -46944,12 +47042,14 @@ var ts;
46944
47042
  }
46945
47043
  }
46946
47044
  function setCommonJsModuleIndicator(node) {
46947
- if (file.externalModuleIndicator) {
47045
+ if (file.externalModuleIndicator && file.externalModuleIndicator !== true) {
46948
47046
  return false;
46949
47047
  }
46950
47048
  if (!file.commonJsModuleIndicator) {
46951
47049
  file.commonJsModuleIndicator = node;
46952
- bindSourceFileAsExternalModule();
47050
+ if (!file.externalModuleIndicator) {
47051
+ bindSourceFileAsExternalModule();
47052
+ }
46953
47053
  }
46954
47054
  return true;
46955
47055
  }
@@ -47363,7 +47463,11 @@ var ts;
47363
47463
  checkStrictModeEvalOrArguments(node, node.name);
47364
47464
  }
47365
47465
  if (!ts.isBindingPattern(node.name)) {
47366
- if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) && !ts.getJSDocTypeTag(node) && !(ts.getCombinedModifierFlags(node) & 1 /* Export */)) {
47466
+ var possibleVariableDecl = node.kind === 254 /* VariableDeclaration */ ? node : node.parent.parent;
47467
+ if (ts.isInJSFile(node) &&
47468
+ ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) &&
47469
+ !ts.getJSDocTypeTag(node) &&
47470
+ !(ts.getCombinedModifierFlags(node) & 1 /* Export */)) {
47367
47471
  declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
47368
47472
  }
47369
47473
  else if (ts.isBlockOrCatchScoped(node)) {
@@ -50190,7 +50294,8 @@ var ts;
50190
50294
  && isAliasableOrJsExpression(node.parent.right)
50191
50295
  || node.kind === 297 /* ShorthandPropertyAssignment */
50192
50296
  || node.kind === 296 /* PropertyAssignment */ && isAliasableOrJsExpression(node.initializer)
50193
- || ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node);
50297
+ || node.kind === 254 /* VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)
50298
+ || node.kind === 203 /* BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent);
50194
50299
  }
50195
50300
  function isAliasableOrJsExpression(e) {
50196
50301
  return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e);
@@ -50283,7 +50388,7 @@ var ts;
50283
50388
  return hasExportAssignmentSymbol(moduleSymbol);
50284
50389
  }
50285
50390
  // JS files have a synthetic default if they do not contain ES2015+ module syntax (export = is not valid in js) _and_ do not have an __esModule marker
50286
- return !file.externalModuleIndicator && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), /*sourceNode*/ undefined, dontResolveAlias);
50391
+ return typeof file.externalModuleIndicator !== "object" && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), /*sourceNode*/ undefined, dontResolveAlias);
50287
50392
  }
50288
50393
  function getTargetOfImportClause(node, dontResolveAlias) {
50289
50394
  var _a;
@@ -68147,13 +68252,40 @@ var ts;
68147
68252
  return sourceStart.slice(0, startLen) !== targetStart.slice(0, startLen) ||
68148
68253
  sourceEnd.slice(sourceEnd.length - endLen) !== targetEnd.slice(targetEnd.length - endLen);
68149
68254
  }
68150
- function isValidBigIntString(s) {
68255
+ /**
68256
+ * Tests whether the provided string can be parsed as a number.
68257
+ * @param s The string to test.
68258
+ * @param roundTripOnly Indicates the resulting number matches the input when converted back to a string.
68259
+ */
68260
+ function isValidNumberString(s, roundTripOnly) {
68261
+ if (s === "")
68262
+ return false;
68263
+ var n = +s;
68264
+ return isFinite(n) && (!roundTripOnly || "" + n === s);
68265
+ }
68266
+ /**
68267
+ * @param text a valid bigint string excluding a trailing `n`, but including a possible prefix `-`. Use `isValidBigIntString(text, roundTripOnly)` before calling this function.
68268
+ */
68269
+ function parseBigIntLiteralType(text) {
68270
+ var negative = text.startsWith("-");
68271
+ var base10Value = ts.parsePseudoBigInt((negative ? text.slice(1) : text) + "n");
68272
+ return getBigIntLiteralType({ negative: negative, base10Value: base10Value });
68273
+ }
68274
+ /**
68275
+ * Tests whether the provided string can be parsed as a bigint.
68276
+ * @param s The string to test.
68277
+ * @param roundTripOnly Indicates the resulting bigint matches the input when converted back to a string.
68278
+ */
68279
+ function isValidBigIntString(s, roundTripOnly) {
68280
+ if (s === "")
68281
+ return false;
68151
68282
  var scanner = ts.createScanner(99 /* ESNext */, /*skipTrivia*/ false);
68152
68283
  var success = true;
68153
68284
  scanner.setOnError(function () { return success = false; });
68154
68285
  scanner.setText(s + "n");
68155
68286
  var result = scanner.scan();
68156
- if (result === 40 /* MinusToken */) {
68287
+ var negative = result === 40 /* MinusToken */;
68288
+ if (negative) {
68157
68289
  result = scanner.scan();
68158
68290
  }
68159
68291
  var flags = scanner.getTokenFlags();
@@ -68162,7 +68294,8 @@ var ts;
68162
68294
  // * a bigint can be scanned, and that when it is scanned, it is
68163
68295
  // * the full length of the input string (so the scanner is one character beyond the augmented input length)
68164
68296
  // * it does not contain a numeric seperator (the `BigInt` constructor does not accept a numeric seperator in its input)
68165
- return success && result === 9 /* BigIntLiteral */ && scanner.getTextPos() === (s.length + 1) && !(flags & 512 /* ContainsSeparator */);
68297
+ return success && result === 9 /* BigIntLiteral */ && scanner.getTextPos() === (s.length + 1) && !(flags & 512 /* ContainsSeparator */)
68298
+ && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
68166
68299
  }
68167
68300
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
68168
68301
  if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
@@ -68170,8 +68303,8 @@ var ts;
68170
68303
  }
68171
68304
  if (source.flags & 128 /* StringLiteral */) {
68172
68305
  var value = source.value;
68173
- return !!(target.flags & 8 /* Number */ && value !== "" && isFinite(+value) ||
68174
- target.flags & 64 /* BigInt */ && value !== "" && isValidBigIntString(value) ||
68306
+ return !!(target.flags & 8 /* Number */ && isValidNumberString(value, /*roundTripOnly*/ false) ||
68307
+ target.flags & 64 /* BigInt */ && isValidBigIntString(value, /*roundTripOnly*/ false) ||
68175
68308
  target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName);
68176
68309
  }
68177
68310
  if (source.flags & 134217728 /* TemplateLiteral */) {
@@ -68744,8 +68877,57 @@ var ts;
68744
68877
  // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
68745
68878
  // succeed. That would be a pointless and confusing outcome.
68746
68879
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
68880
+ var _loop_23 = function (i) {
68881
+ var source_1 = matches ? matches[i] : neverType;
68882
+ var target_3 = types[i];
68883
+ // If we are inferring from a string literal type to a type variable whose constraint includes one of the
68884
+ // allowed template literal placeholder types, infer from a literal type corresponding to the constraint.
68885
+ if (source_1.flags & 128 /* StringLiteral */ && target_3.flags & 8650752 /* TypeVariable */) {
68886
+ var inferenceContext = getInferenceInfoForType(target_3);
68887
+ var constraint = inferenceContext ? getBaseConstraintOfType(inferenceContext.typeParameter) : undefined;
68888
+ if (constraint && !isTypeAny(constraint)) {
68889
+ var constraintTypes = constraint.flags & 1048576 /* Union */ ? constraint.types : [constraint];
68890
+ var allTypeFlags_1 = ts.reduceLeft(constraintTypes, function (flags, t) { return flags | t.flags; }, 0);
68891
+ // If the constraint contains `string`, we don't need to look for a more preferred type
68892
+ if (!(allTypeFlags_1 & 4 /* String */)) {
68893
+ var str_1 = source_1.value;
68894
+ // If the type contains `number` or a number literal and the string isn't a valid number, exclude numbers
68895
+ if (allTypeFlags_1 & 296 /* NumberLike */ && !isValidNumberString(str_1, /*roundTripOnly*/ true)) {
68896
+ allTypeFlags_1 &= ~296 /* NumberLike */;
68897
+ }
68898
+ // If the type contains `bigint` or a bigint literal and the string isn't a valid bigint, exclude bigints
68899
+ if (allTypeFlags_1 & 2112 /* BigIntLike */ && !isValidBigIntString(str_1, /*roundTripOnly*/ true)) {
68900
+ allTypeFlags_1 &= ~2112 /* BigIntLike */;
68901
+ }
68902
+ // for each type in the constraint, find the highest priority matching type
68903
+ var matchingType = ts.reduceLeft(constraintTypes, function (left, right) {
68904
+ return !(right.flags & allTypeFlags_1) ? left :
68905
+ left.flags & 4 /* String */ ? left : right.flags & 4 /* String */ ? source_1 :
68906
+ left.flags & 134217728 /* TemplateLiteral */ ? left : right.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source_1, right) ? source_1 :
68907
+ left.flags & 268435456 /* StringMapping */ ? left : right.flags & 268435456 /* StringMapping */ && str_1 === applyStringMapping(right.symbol, str_1) ? source_1 :
68908
+ left.flags & 128 /* StringLiteral */ ? left : right.flags & 128 /* StringLiteral */ && right.value === str_1 ? right :
68909
+ left.flags & 8 /* Number */ ? left : right.flags & 8 /* Number */ ? getNumberLiteralType(+str_1) :
68910
+ left.flags & 32 /* Enum */ ? left : right.flags & 32 /* Enum */ ? getNumberLiteralType(+str_1) :
68911
+ left.flags & 256 /* NumberLiteral */ ? left : right.flags & 256 /* NumberLiteral */ && right.value === +str_1 ? right :
68912
+ left.flags & 64 /* BigInt */ ? left : right.flags & 64 /* BigInt */ ? parseBigIntLiteralType(str_1) :
68913
+ left.flags & 2048 /* BigIntLiteral */ ? left : right.flags & 2048 /* BigIntLiteral */ && ts.pseudoBigIntToString(right.value) === str_1 ? right :
68914
+ left.flags & 16 /* Boolean */ ? left : right.flags & 16 /* Boolean */ ? str_1 === "true" ? trueType : str_1 === "false" ? falseType : booleanType :
68915
+ left.flags & 512 /* BooleanLiteral */ ? left : right.flags & 512 /* BooleanLiteral */ && right.intrinsicName === str_1 ? right :
68916
+ left.flags & 32768 /* Undefined */ ? left : right.flags & 32768 /* Undefined */ && right.intrinsicName === str_1 ? right :
68917
+ left.flags & 65536 /* Null */ ? left : right.flags & 65536 /* Null */ && right.intrinsicName === str_1 ? right :
68918
+ left;
68919
+ }, neverType);
68920
+ if (!(matchingType.flags & 131072 /* Never */)) {
68921
+ inferFromTypes(matchingType, target_3);
68922
+ return "continue";
68923
+ }
68924
+ }
68925
+ }
68926
+ }
68927
+ inferFromTypes(source_1, target_3);
68928
+ };
68747
68929
  for (var i = 0; i < types.length; i++) {
68748
- inferFromTypes(matches ? matches[i] : neverType, types[i]);
68930
+ _loop_23(i);
68749
68931
  }
68750
68932
  }
68751
68933
  }
@@ -69263,7 +69445,7 @@ var ts;
69263
69445
  function mapTypesByKeyProperty(types, name) {
69264
69446
  var map = new ts.Map();
69265
69447
  var count = 0;
69266
- var _loop_23 = function (type) {
69448
+ var _loop_24 = function (type) {
69267
69449
  if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
69268
69450
  var discriminant = getTypeOfPropertyOfType(type, name);
69269
69451
  if (discriminant) {
@@ -69289,7 +69471,7 @@ var ts;
69289
69471
  };
69290
69472
  for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
69291
69473
  var type = types_16[_i];
69292
- var state_9 = _loop_23(type);
69474
+ var state_9 = _loop_24(type);
69293
69475
  if (typeof state_9 === "object")
69294
69476
  return state_9.value;
69295
69477
  }
@@ -75677,7 +75859,7 @@ var ts;
75677
75859
  if (spreadIndex >= 0) {
75678
75860
  // Create synthetic arguments from spreads of tuple types.
75679
75861
  var effectiveArgs_1 = args.slice(0, spreadIndex);
75680
- var _loop_24 = function (i) {
75862
+ var _loop_25 = function (i) {
75681
75863
  var arg = args[i];
75682
75864
  // We can call checkExpressionCached because spread expressions never have a contextual type.
75683
75865
  var spreadType = arg.kind === 225 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@@ -75694,7 +75876,7 @@ var ts;
75694
75876
  }
75695
75877
  };
75696
75878
  for (var i = spreadIndex; i < args.length; i++) {
75697
- _loop_24(i);
75879
+ _loop_25(i);
75698
75880
  }
75699
75881
  return effectiveArgs_1;
75700
75882
  }
@@ -76014,7 +76196,7 @@ var ts;
76014
76196
  var min_3 = Number.MAX_VALUE;
76015
76197
  var minIndex = 0;
76016
76198
  var i_1 = 0;
76017
- var _loop_25 = function (c) {
76199
+ var _loop_26 = function (c) {
76018
76200
  var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
76019
76201
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2);
76020
76202
  if (diags_2) {
@@ -76032,7 +76214,7 @@ var ts;
76032
76214
  };
76033
76215
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
76034
76216
  var c = candidatesForArgumentError_1[_a];
76035
- _loop_25(c);
76217
+ _loop_26(c);
76036
76218
  }
76037
76219
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
76038
76220
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -76190,7 +76372,7 @@ var ts;
76190
76372
  }
76191
76373
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
76192
76374
  var parameters = [];
76193
- var _loop_26 = function (i) {
76375
+ var _loop_27 = function (i) {
76194
76376
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
76195
76377
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
76196
76378
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -76198,7 +76380,7 @@ var ts;
76198
76380
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
76199
76381
  };
76200
76382
  for (var i = 0; i < maxNonRestParam; i++) {
76201
- _loop_26(i);
76383
+ _loop_27(i);
76202
76384
  }
76203
76385
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
76204
76386
  var flags = 0 /* None */;
@@ -80255,7 +80437,7 @@ var ts;
80255
80437
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
80256
80438
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
80257
80439
  var indexSignatureMap_1 = new ts.Map();
80258
- var _loop_27 = function (declaration) {
80440
+ var _loop_28 = function (declaration) {
80259
80441
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
80260
80442
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
80261
80443
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -80270,7 +80452,7 @@ var ts;
80270
80452
  };
80271
80453
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
80272
80454
  var declaration = _a[_i];
80273
- _loop_27(declaration);
80455
+ _loop_28(declaration);
80274
80456
  }
80275
80457
  indexSignatureMap_1.forEach(function (entry) {
80276
80458
  if (entry.declarations.length > 1) {
@@ -82466,7 +82648,7 @@ var ts;
82466
82648
  }
82467
82649
  // For a commonjs `const x = require`, validate the alias and exit
82468
82650
  var symbol = getSymbolOfNode(node);
82469
- if (symbol.flags & 2097152 /* Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)) {
82651
+ if (symbol.flags & 2097152 /* Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 /* BindingElement */ ? node.parent.parent : node)) {
82470
82652
  checkAliasSymbol(node);
82471
82653
  return;
82472
82654
  }
@@ -83731,7 +83913,7 @@ var ts;
83731
83913
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
83732
83914
  var localPropDeclaration = declaration && declaration.kind === 221 /* BinaryExpression */ ||
83733
83915
  name && name.kind === 162 /* ComputedPropertyName */ || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
83734
- var _loop_28 = function (info) {
83916
+ var _loop_29 = function (info) {
83735
83917
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
83736
83918
  // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
83737
83919
  // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@@ -83744,7 +83926,7 @@ var ts;
83744
83926
  };
83745
83927
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
83746
83928
  var info = indexInfos_9[_i];
83747
- _loop_28(info);
83929
+ _loop_29(info);
83748
83930
  }
83749
83931
  }
83750
83932
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -83752,7 +83934,7 @@ var ts;
83752
83934
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
83753
83935
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
83754
83936
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
83755
- var _loop_29 = function (info) {
83937
+ var _loop_30 = function (info) {
83756
83938
  if (info === checkInfo)
83757
83939
  return "continue";
83758
83940
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -83767,7 +83949,7 @@ var ts;
83767
83949
  };
83768
83950
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
83769
83951
  var info = indexInfos_10[_i];
83770
- _loop_29(info);
83952
+ _loop_30(info);
83771
83953
  }
83772
83954
  }
83773
83955
  function checkTypeNameIsReserved(name, message) {
@@ -84086,7 +84268,7 @@ var ts;
84086
84268
  var baseTypes = baseTypeNode && getBaseTypes(type);
84087
84269
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
84088
84270
  var baseStaticType = getBaseConstructorTypeOfClass(type);
84089
- var _loop_30 = function (member) {
84271
+ var _loop_31 = function (member) {
84090
84272
  if (ts.hasAmbientModifier(member)) {
84091
84273
  return "continue";
84092
84274
  }
@@ -84103,7 +84285,7 @@ var ts;
84103
84285
  };
84104
84286
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
84105
84287
  var member = _a[_i];
84106
- _loop_30(member);
84288
+ _loop_31(member);
84107
84289
  }
84108
84290
  }
84109
84291
  /**
@@ -84191,7 +84373,7 @@ var ts;
84191
84373
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
84192
84374
  // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
84193
84375
  var issuedMemberError = false;
84194
- var _loop_31 = function (member) {
84376
+ var _loop_32 = function (member) {
84195
84377
  if (ts.isStatic(member)) {
84196
84378
  return "continue";
84197
84379
  }
@@ -84210,7 +84392,7 @@ var ts;
84210
84392
  };
84211
84393
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
84212
84394
  var member = _a[_i];
84213
- _loop_31(member);
84395
+ _loop_32(member);
84214
84396
  }
84215
84397
  if (!issuedMemberError) {
84216
84398
  // check again with diagnostics to generate a less-specific error
@@ -89870,9 +90052,7 @@ var ts;
89870
90052
  var ts;
89871
90053
  (function (ts) {
89872
90054
  function createSourceMapGenerator(host, file, sourceRoot, sourcesDirectoryPath, generatorOptions) {
89873
- var _a = generatorOptions.extendedDiagnostics
89874
- ? ts.performance.createTimer("Source Map", "beforeSourcemap", "afterSourcemap")
89875
- : ts.performance.nullTimer, enter = _a.enter, exit = _a.exit;
90055
+ var _a = ts.performance.createTimerIf(!!generatorOptions.extendedDiagnostics, "Source Map", "beforeSourcemap", "afterSourcemap"), enter = _a.enter, exit = _a.exit;
89876
90056
  // Current source map file and its index in the sources list
89877
90057
  var rawSources = [];
89878
90058
  var sources = [];
@@ -110189,7 +110369,8 @@ var ts;
110189
110369
  return;
110190
110370
  }
110191
110371
  var version = ts.version; // Extracted into a const so the form is stable between namespace and module
110192
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), /*writeByteOrderMark*/ false);
110372
+ var buildInfo = { bundle: bundle, program: program, version: version };
110373
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
110193
110374
  }
110194
110375
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
110195
110376
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -110343,13 +110524,18 @@ var ts;
110343
110524
  if (sourceMapFilePath) {
110344
110525
  var sourceMap = sourceMapGenerator.toString();
110345
110526
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110527
+ if (printer.bundleFileInfo)
110528
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
110346
110529
  }
110347
110530
  }
110348
110531
  else {
110349
110532
  writer.writeLine();
110350
110533
  }
110351
110534
  // Write the output file
110352
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110535
+ var text = writer.getText();
110536
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110537
+ if (printer.bundleFileInfo)
110538
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
110353
110539
  // Reset state
110354
110540
  writer.clear();
110355
110541
  }
@@ -110492,34 +110678,54 @@ var ts;
110492
110678
  }
110493
110679
  /*@internal*/
110494
110680
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
110681
+ var createHash = ts.maybeBind(host, host.createHash);
110495
110682
  var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
110496
- var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
110497
- if (!buildInfoText)
110683
+ var buildInfo;
110684
+ if (host.getBuildInfo) {
110685
+ var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
110686
+ if (!hostBuildInfo)
110687
+ return buildInfoPath;
110688
+ buildInfo = hostBuildInfo;
110689
+ }
110690
+ else {
110691
+ var buildInfoText = host.readFile(buildInfoPath);
110692
+ if (!buildInfoText)
110693
+ return buildInfoPath;
110694
+ buildInfo = getBuildInfo(buildInfoText);
110695
+ }
110696
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
110498
110697
  return buildInfoPath;
110499
110698
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
110500
110699
  if (!jsFileText)
110501
110700
  return jsFilePath;
110701
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
110702
+ return jsFilePath;
110502
110703
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
110503
110704
  // error if no source map or for now if inline sourcemap
110504
110705
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
110505
110706
  return sourceMapFilePath || "inline sourcemap decoding";
110707
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
110708
+ return sourceMapFilePath;
110506
110709
  // read declaration text
110507
110710
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
110508
110711
  if (declarationFilePath && !declarationText)
110509
110712
  return declarationFilePath;
110713
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
110714
+ return declarationFilePath;
110510
110715
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
110511
110716
  // error if no source map or for now if inline sourcemap
110512
110717
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
110513
110718
  return declarationMapPath || "inline sourcemap decoding";
110514
- var buildInfo = getBuildInfo(buildInfoText);
110515
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
110516
- return buildInfoPath;
110719
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
110720
+ return declarationMapPath;
110517
110721
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110518
110722
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
110519
110723
  /*onlyOwnText*/ true);
110520
110724
  var outputFiles = [];
110521
110725
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
110522
110726
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
110727
+ var changedDtsText;
110728
+ var changedDtsData;
110523
110729
  var emitHost = {
110524
110730
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
110525
110731
  getCanonicalFileName: host.getCanonicalFileName,
@@ -110535,7 +110741,7 @@ var ts;
110535
110741
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
110536
110742
  getProjectReferenceRedirect: ts.returnUndefined,
110537
110743
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
110538
- writeFile: function (name, text, writeByteOrderMark) {
110744
+ writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
110539
110745
  switch (name) {
110540
110746
  case jsFilePath:
110541
110747
  if (jsFileText === text)
@@ -110546,8 +110752,13 @@ var ts;
110546
110752
  return;
110547
110753
  break;
110548
110754
  case buildInfoPath:
110549
- var newBuildInfo = getBuildInfo(text);
110755
+ var newBuildInfo = data.buildInfo;
110550
110756
  newBuildInfo.program = buildInfo.program;
110757
+ if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
110758
+ // Update the output signature
110759
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
110760
+ newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
110761
+ }
110551
110762
  // Update sourceFileInfo
110552
110763
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
110553
110764
  newBuildInfo.bundle.js.sources = js.sources;
@@ -110555,11 +110766,13 @@ var ts;
110555
110766
  newBuildInfo.bundle.dts.sources = dts.sources;
110556
110767
  }
110557
110768
  newBuildInfo.bundle.sourceFiles = sourceFiles;
110558
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
110769
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
110559
110770
  return;
110560
110771
  case declarationFilePath:
110561
110772
  if (declarationText === text)
110562
110773
  return;
110774
+ changedDtsText = text;
110775
+ changedDtsData = data;
110563
110776
  break;
110564
110777
  case declarationMapPath:
110565
110778
  if (declarationMapText === text)
@@ -110578,6 +110791,7 @@ var ts;
110578
110791
  getSourceFileFromReference: ts.returnUndefined,
110579
110792
  redirectTargetsMap: ts.createMultiMap(),
110580
110793
  getFileIncludeReasons: ts.notImplemented,
110794
+ createHash: createHash,
110581
110795
  };
110582
110796
  emitFiles(ts.notImplementedResolver, emitHost,
110583
110797
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
@@ -115662,12 +115876,10 @@ var ts;
115662
115876
  }
115663
115877
  ts.createCompilerHost = createCompilerHost;
115664
115878
  /*@internal*/
115665
- // TODO(shkamat): update this after reworking ts build API
115666
115879
  function createCompilerHostWorker(options, setParentNodes, system) {
115667
115880
  if (system === void 0) { system = ts.sys; }
115668
115881
  var existingDirectories = new ts.Map();
115669
115882
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
115670
- var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
115671
115883
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
115672
115884
  var text;
115673
115885
  try {
@@ -115700,7 +115912,7 @@ var ts;
115700
115912
  // NOTE: If patchWriteFileEnsuringDirectory has been called,
115701
115913
  // the system.writeFile will do its own directory creation and
115702
115914
  // the ensureDirectoriesExist call will always be redundant.
115703
- 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); });
115915
+ 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); });
115704
115916
  ts.performance.mark("afterIOWrite");
115705
115917
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
115706
115918
  }
@@ -115710,35 +115922,6 @@ var ts;
115710
115922
  }
115711
115923
  }
115712
115924
  }
115713
- var outputFingerprints;
115714
- function writeFileWorker(fileName, data, writeByteOrderMark) {
115715
- if (!ts.isWatchSet(options) || !system.getModifiedTime) {
115716
- system.writeFile(fileName, data, writeByteOrderMark);
115717
- return;
115718
- }
115719
- if (!outputFingerprints) {
115720
- outputFingerprints = new ts.Map();
115721
- }
115722
- var hash = computeHash(data);
115723
- var mtimeBefore = system.getModifiedTime(fileName);
115724
- if (mtimeBefore) {
115725
- var fingerprint = outputFingerprints.get(fileName);
115726
- // If output has not been changed, and the file has no external modification
115727
- if (fingerprint &&
115728
- fingerprint.byteOrderMark === writeByteOrderMark &&
115729
- fingerprint.hash === hash &&
115730
- fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
115731
- return;
115732
- }
115733
- }
115734
- system.writeFile(fileName, data, writeByteOrderMark);
115735
- var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
115736
- outputFingerprints.set(fileName, {
115737
- hash: hash,
115738
- byteOrderMark: writeByteOrderMark,
115739
- mtime: mtimeAfter
115740
- });
115741
- }
115742
115925
  function getDefaultLibLocation() {
115743
115926
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
115744
115927
  }
@@ -117328,6 +117511,7 @@ var ts;
117328
117511
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
117329
117512
  redirectTargetsMap: redirectTargetsMap,
117330
117513
  getFileIncludeReasons: program.getFileIncludeReasons,
117514
+ createHash: ts.maybeBind(host, host.createHash),
117331
117515
  };
117332
117516
  }
117333
117517
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -119441,13 +119625,9 @@ var ts;
119441
119625
  function createManyToManyPathMap() {
119442
119626
  function create(forward, reverse, deleted) {
119443
119627
  var map = {
119444
- clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119445
- forEach: function (fn) { return forward.forEach(fn); },
119446
119628
  getKeys: function (v) { return reverse.get(v); },
119447
119629
  getValues: function (k) { return forward.get(k); },
119448
- hasKey: function (k) { return forward.has(k); },
119449
119630
  keys: function () { return forward.keys(); },
119450
- deletedKeys: function () { return deleted; },
119451
119631
  deleteKey: function (k) {
119452
119632
  (deleted || (deleted = new ts.Set())).add(k);
119453
119633
  var set = forward.get(k);
@@ -119474,11 +119654,6 @@ var ts;
119474
119654
  });
119475
119655
  return map;
119476
119656
  },
119477
- clear: function () {
119478
- forward.clear();
119479
- reverse.clear();
119480
- deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119481
- }
119482
119657
  };
119483
119658
  return map;
119484
119659
  }
@@ -119606,18 +119781,21 @@ var ts;
119606
119781
  * Creates the state of file references and signature for the new program from oldState if it is safe
119607
119782
  */
119608
119783
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119784
+ var _a, _b, _c;
119609
119785
  var fileInfos = new ts.Map();
119610
119786
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
119611
119787
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
119612
- var hasCalledUpdateShapeSignature = new ts.Set();
119613
119788
  var useOldState = canReuseOldState(referencedMap, oldState);
119614
119789
  // Ensure source files have parent pointers set
119615
119790
  newProgram.getTypeChecker();
119616
119791
  // Create the reference map, and set the file infos
119617
- for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
119618
- var sourceFile = _a[_i];
119792
+ for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
119793
+ var sourceFile = _d[_i];
119619
119794
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
119620
- var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
119795
+ var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
119796
+ var signature = oldUncommitedSignature === undefined ?
119797
+ useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
119798
+ oldUncommitedSignature || undefined;
119621
119799
  if (referencedMap) {
119622
119800
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
119623
119801
  if (newReferences) {
@@ -119625,19 +119803,26 @@ var ts;
119625
119803
  }
119626
119804
  // Copy old visible to outside files map
119627
119805
  if (useOldState) {
119628
- var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
119806
+ var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
119807
+ var exportedModules = oldUncommitedExportedModules === undefined ?
119808
+ oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
119809
+ oldUncommitedExportedModules || undefined;
119629
119810
  if (exportedModules) {
119630
119811
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119631
119812
  }
119632
119813
  }
119633
119814
  }
119634
- fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
119815
+ fileInfos.set(sourceFile.resolvedPath, {
119816
+ version: version_2,
119817
+ signature: signature,
119818
+ affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
119819
+ impliedFormat: sourceFile.impliedNodeFormat
119820
+ });
119635
119821
  }
119636
119822
  return {
119637
119823
  fileInfos: fileInfos,
119638
119824
  referencedMap: referencedMap,
119639
119825
  exportedModulesMap: exportedModulesMap,
119640
- hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
119641
119826
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
119642
119827
  };
119643
119828
  }
@@ -119651,71 +119836,42 @@ var ts;
119651
119836
  }
119652
119837
  BuilderState.releaseCache = releaseCache;
119653
119838
  /**
119654
- * Creates a clone of the state
119839
+ * Gets the files affected by the path from the program
119655
119840
  */
119656
- function clone(state) {
119841
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
119657
119842
  var _a, _b;
119658
- // Dont need to backup allFiles info since its cache anyway
119659
- return {
119660
- fileInfos: new ts.Map(state.fileInfos),
119661
- referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
119662
- exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
119663
- hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
119664
- useFileVersionAsSignature: state.useFileVersionAsSignature,
119665
- };
119843
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
119844
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119845
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119846
+ return result;
119666
119847
  }
119667
- BuilderState.clone = clone;
119668
- /**
119669
- * Gets the files affected by the path from the program
119670
- */
119671
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
119672
- // Since the operation could be cancelled, the signatures are always stored in the cache
119673
- // They will be committed once it is safe to use them
119674
- // eg when calling this api from tsserver, if there is no cancellation of the operation
119675
- // In the other cases the affected files signatures are committed only after the iteration through the result is complete
119676
- var signatureCache = cacheToUpdateSignature || new ts.Map();
119848
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119849
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
119677
119850
  var sourceFile = programOfThisState.getSourceFileByPath(path);
119678
119851
  if (!sourceFile) {
119679
119852
  return ts.emptyArray;
119680
119853
  }
119681
- if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
119854
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
119682
119855
  return [sourceFile];
119683
119856
  }
119684
- var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
119685
- if (!cacheToUpdateSignature) {
119686
- // Commit all the signatures in the signature cache
119687
- updateSignaturesFromCache(state, signatureCache);
119688
- }
119689
- return result;
119857
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
119690
119858
  }
119691
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119692
- /**
119693
- * Updates the signatures from the cache into state's fileinfo signatures
119694
- * This should be called whenever it is safe to commit the state of the builder
119695
- */
119696
- function updateSignaturesFromCache(state, signatureCache) {
119697
- signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
119698
- }
119699
- BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
119859
+ BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
119700
119860
  function updateSignatureOfFile(state, signature, path) {
119701
119861
  state.fileInfos.get(path).signature = signature;
119702
- state.hasCalledUpdateShapeSignature.add(path);
119862
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
119703
119863
  }
119704
119864
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
119705
119865
  /**
119706
119866
  * Returns if the shape of the signature has changed since last emit
119707
119867
  */
119708
- function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
119868
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
119869
+ var _a;
119709
119870
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
119710
- ts.Debug.assert(!!sourceFile);
119711
- ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
119712
119871
  // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
119713
- if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
119872
+ if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
119714
119873
  return false;
119715
- }
119716
119874
  var info = state.fileInfos.get(sourceFile.resolvedPath);
119717
- if (!info)
119718
- return ts.Debug.fail();
119719
119875
  var prevSignature = info.signature;
119720
119876
  var latestSignature;
119721
119877
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -119726,45 +119882,55 @@ var ts;
119726
119882
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119727
119883
  if (firstDts_1) {
119728
119884
  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; })); });
119729
- latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119730
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119731
- updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
119885
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
119886
+ if (latestSignature !== prevSignature) {
119887
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
119732
119888
  }
119733
119889
  }
119734
119890
  }
119735
119891
  // Default is to use file version as signature
119736
119892
  if (latestSignature === undefined) {
119737
119893
  latestSignature = sourceFile.version;
119738
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119894
+ if (state.exportedModulesMap && latestSignature !== prevSignature) {
119895
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119739
119896
  // All the references in this file are exported
119740
119897
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
119741
119898
  if (references) {
119742
- exportedModulesMapCache.set(sourceFile.resolvedPath, references);
119899
+ state.exportedModulesMap.set(sourceFile.resolvedPath, references);
119743
119900
  }
119744
119901
  else {
119745
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119902
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119746
119903
  }
119747
119904
  }
119748
119905
  }
119749
- cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
119906
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
119907
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
119908
+ info.signature = latestSignature;
119750
119909
  return latestSignature !== prevSignature;
119751
119910
  }
119752
119911
  BuilderState.updateShapeSignature = updateShapeSignature;
119912
+ function computeSignature(text, computeHash) {
119913
+ return (computeHash || ts.generateDjb2Hash)(text);
119914
+ }
119915
+ BuilderState.computeSignature = computeSignature;
119753
119916
  /**
119754
119917
  * Coverts the declaration emit result into exported modules map
119755
119918
  */
119756
- function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
119919
+ function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
119920
+ if (!state.exportedModulesMap)
119921
+ return;
119922
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119757
119923
  if (!exportedModulesFromDeclarationEmit) {
119758
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119924
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119759
119925
  return;
119760
119926
  }
119761
119927
  var exportedModules;
119762
119928
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
119763
119929
  if (exportedModules) {
119764
- exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
119930
+ state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119765
119931
  }
119766
119932
  else {
119767
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119933
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119768
119934
  }
119769
119935
  function addExportedModule(exportedModulePaths) {
119770
119936
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -119776,19 +119942,6 @@ var ts;
119776
119942
  }
119777
119943
  }
119778
119944
  BuilderState.updateExportedModules = updateExportedModules;
119779
- /**
119780
- * Updates the exported modules from cache into state's exported modules map
119781
- * This should be called whenever it is safe to commit the state of the builder
119782
- */
119783
- function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
119784
- var _a;
119785
- if (exportedModulesMapCache) {
119786
- ts.Debug.assert(!!state.exportedModulesMap);
119787
- (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
119788
- exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
119789
- }
119790
- }
119791
- BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
119792
119945
  /**
119793
119946
  * Get all the dependencies of the sourceFile
119794
119947
  */
@@ -119909,7 +120062,7 @@ var ts;
119909
120062
  /**
119910
120063
  * When program emits modular code, gets the files affected by the sourceFile whose shape has changed
119911
120064
  */
119912
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
120065
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
119913
120066
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
119914
120067
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
119915
120068
  }
@@ -119929,7 +120082,7 @@ var ts;
119929
120082
  if (!seenFileNamesMap.has(currentPath)) {
119930
120083
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
119931
120084
  seenFileNamesMap.set(currentPath, currentSourceFile);
119932
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
120085
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
119933
120086
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
119934
120087
  }
119935
120088
  }
@@ -119955,32 +120108,33 @@ var ts;
119955
120108
  * Create the state so that we can iterate on changedFiles/affected files
119956
120109
  */
119957
120110
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
120111
+ var _a, _b;
119958
120112
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
119959
120113
  state.program = newProgram;
119960
120114
  var compilerOptions = newProgram.getCompilerOptions();
119961
120115
  state.compilerOptions = compilerOptions;
120116
+ var outFilePath = ts.outFile(compilerOptions);
119962
120117
  // With --out or --outFile, any change affects all semantic diagnostics so no need to cache them
119963
- if (!ts.outFile(compilerOptions)) {
120118
+ if (!outFilePath) {
119964
120119
  state.semanticDiagnosticsPerFile = new ts.Map();
119965
120120
  }
120121
+ 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)) {
120122
+ state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
120123
+ }
119966
120124
  state.changedFilesSet = new ts.Set();
120125
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
119967
120126
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
119968
120127
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
119969
120128
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
119970
120129
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
120130
+ var canCopyEmitSignatures = compilerOptions.composite &&
120131
+ (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
120132
+ !outFilePath &&
120133
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
119971
120134
  if (useOldState) {
119972
- // Verify the sanity of old state
119973
- if (!oldState.currentChangedFilePath) {
119974
- var affectedSignatures = oldState.currentAffectedFilesSignatures;
119975
- ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
119976
- }
119977
- var changedFilesSet = oldState.changedFilesSet;
119978
- if (canCopySemanticDiagnostics) {
119979
- ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
119980
- }
119981
120135
  // Copy old state's changed files set
119982
- changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
119983
- if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
120136
+ (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
120137
+ if (!outFilePath && oldState.affectedFilesPendingEmit) {
119984
120138
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
119985
120139
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
119986
120140
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -120001,6 +120155,8 @@ var ts;
120001
120155
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
120002
120156
  // versions dont match
120003
120157
  oldInfo.version !== info.version ||
120158
+ // Implied formats dont match
120159
+ oldInfo.impliedFormat !== info.impliedFormat ||
120004
120160
  // Referenced files changed
120005
120161
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
120006
120162
  // Referenced file was deleted in the new program
@@ -120024,27 +120180,25 @@ var ts;
120024
120180
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
120025
120181
  }
120026
120182
  }
120183
+ if (canCopyEmitSignatures) {
120184
+ var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
120185
+ if (oldEmitSignature)
120186
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
120187
+ }
120027
120188
  });
120028
120189
  // If the global file is removed, add all files as changed
120029
120190
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
120030
120191
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, /*firstSourceFile*/ undefined)
120031
120192
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
120032
120193
  }
120033
- else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
120194
+ else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
120034
120195
  // Add all files to affectedFilesPendingEmit since emit changed
120035
120196
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1 /* Full */); });
120036
120197
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
120037
120198
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
120038
120199
  }
120039
- if (useOldState) {
120040
- // Any time the interpretation of a source file changes, mark it as changed
120041
- ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
120042
- if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
120043
- state.changedFilesSet.add(sourceFilePath);
120044
- }
120045
- });
120046
- }
120047
- state.buildInfoEmitPending = !!state.changedFilesSet.size;
120200
+ // Since old states change files set is copied, any additional change means we would need to emit build info
120201
+ state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
120048
120202
  return state;
120049
120203
  }
120050
120204
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -120080,30 +120234,35 @@ var ts;
120080
120234
  ts.BuilderState.releaseCache(state);
120081
120235
  state.program = undefined;
120082
120236
  }
120083
- /**
120084
- * Creates a clone of the state
120085
- */
120086
- function cloneBuilderProgramState(state) {
120087
- var _a;
120088
- var newState = ts.BuilderState.clone(state);
120089
- newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
120090
- newState.changedFilesSet = new ts.Set(state.changedFilesSet);
120091
- newState.affectedFiles = state.affectedFiles;
120092
- newState.affectedFilesIndex = state.affectedFilesIndex;
120093
- newState.currentChangedFilePath = state.currentChangedFilePath;
120094
- newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
120095
- newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
120096
- newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
120097
- newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
120098
- newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
120099
- newState.program = state.program;
120100
- newState.compilerOptions = state.compilerOptions;
120101
- newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
120102
- newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
120103
- newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
120104
- newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
120105
- newState.programEmitComplete = state.programEmitComplete;
120106
- return newState;
120237
+ function backupEmitBuilderProgramState(state) {
120238
+ var outFilePath = ts.outFile(state.compilerOptions);
120239
+ // Only in --out changeFileSet is kept around till emit
120240
+ ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
120241
+ return {
120242
+ affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
120243
+ affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
120244
+ affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
120245
+ seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
120246
+ programEmitComplete: state.programEmitComplete,
120247
+ emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
120248
+ outSignature: state.outSignature,
120249
+ dtsChangeTime: state.dtsChangeTime,
120250
+ hasChangedEmitSignature: state.hasChangedEmitSignature,
120251
+ changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
120252
+ };
120253
+ }
120254
+ function restoreEmitBuilderProgramState(state, backupEmitState) {
120255
+ state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
120256
+ state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
120257
+ state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
120258
+ state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
120259
+ state.programEmitComplete = backupEmitState.programEmitComplete;
120260
+ state.emitSignatures = backupEmitState.emitSignatures;
120261
+ state.outSignature = backupEmitState.outSignature;
120262
+ state.dtsChangeTime = backupEmitState.dtsChangeTime;
120263
+ state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
120264
+ if (backupEmitState.changedFilesSet)
120265
+ state.changedFilesSet = backupEmitState.changedFilesSet;
120107
120266
  }
120108
120267
  /**
120109
120268
  * Verifies that source file is ok to be used in calls that arent handled by next
@@ -120118,7 +120277,7 @@ var ts;
120118
120277
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
120119
120278
  */
120120
120279
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
120121
- var _a;
120280
+ var _a, _b;
120122
120281
  while (true) {
120123
120282
  var affectedFiles = state.affectedFiles;
120124
120283
  if (affectedFiles) {
@@ -120138,10 +120297,8 @@ var ts;
120138
120297
  state.changedFilesSet.delete(state.currentChangedFilePath);
120139
120298
  state.currentChangedFilePath = undefined;
120140
120299
  // Commit the changes in file signature
120141
- ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
120142
- state.currentAffectedFilesSignatures.clear();
120143
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120144
- (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
120300
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
120301
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120145
120302
  state.affectedFiles = undefined;
120146
120303
  }
120147
120304
  // Get next changed file
@@ -120159,12 +120316,7 @@ var ts;
120159
120316
  return program;
120160
120317
  }
120161
120318
  // Get next batch of affected files
120162
- if (!state.currentAffectedFilesSignatures)
120163
- state.currentAffectedFilesSignatures = new ts.Map();
120164
- if (state.exportedModulesMap) {
120165
- state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
120166
- }
120167
- state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
120319
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
120168
120320
  state.currentChangedFilePath = nextKey.value;
120169
120321
  state.affectedFilesIndex = 0;
120170
120322
  if (!state.seenAffectedFiles)
@@ -120216,7 +120368,6 @@ var ts;
120216
120368
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
120217
120369
  */
120218
120370
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120219
- var _a;
120220
120371
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
120221
120372
  // If affected files is everything except default library, then nothing more to do
120222
120373
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -120224,10 +120375,9 @@ var ts;
120224
120375
  // When a change affects the global scope, all files are considered to be affected without updating their signature
120225
120376
  // That means when affected file is handled, its signature can be out of date
120226
120377
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
120227
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
120378
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
120228
120379
  return;
120229
120380
  }
120230
- 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);
120231
120381
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
120232
120382
  return;
120233
120383
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -120247,7 +120397,7 @@ var ts;
120247
120397
  // This ensures that we dont later during incremental builds considering wrong signature.
120248
120398
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
120249
120399
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
120250
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
120400
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
120251
120401
  // If not dts emit, nothing more to do
120252
120402
  if (ts.getEmitDeclarations(state.compilerOptions)) {
120253
120403
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -120268,27 +120418,10 @@ var ts;
120268
120418
  return !state.semanticDiagnosticsFromOldState.size;
120269
120419
  }
120270
120420
  function isChangedSignature(state, path) {
120271
- var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
120272
- var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120421
+ var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
120422
+ var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120273
120423
  return newSignature !== oldSignature;
120274
120424
  }
120275
- function forEachKeyOfExportedModulesMap(state, filePath, fn) {
120276
- // Go through exported modules from cache first
120277
- var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
120278
- var result = keys && ts.forEachKey(keys, fn);
120279
- if (result)
120280
- return result;
120281
- // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
120282
- keys = state.exportedModulesMap.getKeys(filePath);
120283
- return keys && ts.forEachKey(keys, function (exportedFromPath) {
120284
- var _a;
120285
- // If the cache had an updated value, skip
120286
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
120287
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
120288
- fn(exportedFromPath) :
120289
- undefined;
120290
- });
120291
- }
120292
120425
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
120293
120426
  var _a;
120294
120427
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -120303,6 +120436,7 @@ var ts;
120303
120436
  * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
120304
120437
  */
120305
120438
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120439
+ var _a;
120306
120440
  // If there was change in signature (dts output) for the changed file,
120307
120441
  // then only we need to handle pending file emit
120308
120442
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
@@ -120329,11 +120463,10 @@ var ts;
120329
120463
  }
120330
120464
  }
120331
120465
  }
120332
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120333
120466
  var seenFileAndExportsOfFile = new ts.Set();
120334
120467
  // Go through exported modules from cache first
120335
120468
  // If exported modules has path, all files referencing file exported from are affected
120336
- forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
120469
+ (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120337
120470
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
120338
120471
  return true;
120339
120472
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -120347,19 +120480,18 @@ var ts;
120347
120480
  * return true when all work is done and we can exit handling dts emit and semantic diagnostics
120348
120481
  */
120349
120482
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
120350
- var _a;
120483
+ var _a, _b;
120351
120484
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
120352
120485
  return undefined;
120353
120486
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
120354
120487
  return true;
120355
120488
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
120356
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120357
120489
  // If exported modules has path, all files referencing file exported from are affected
120358
- forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
120490
+ (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120359
120491
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
120360
120492
  });
120361
120493
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
120362
- (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
120494
+ (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
120363
120495
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
120364
120496
  handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
120365
120497
  state, referencingFilePath, cancellationToken, computeHash, host);
@@ -120380,12 +120512,13 @@ var ts;
120380
120512
  }
120381
120513
  else {
120382
120514
  state.seenAffectedFiles.add(affected.resolvedPath);
120515
+ // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted
120516
+ state.buildInfoEmitPending = true;
120383
120517
  if (emitKind !== undefined) {
120384
120518
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
120385
120519
  }
120386
120520
  if (isPendingEmit) {
120387
120521
  state.affectedFilesPendingEmitIndex++;
120388
- state.buildInfoEmitPending = true;
120389
120522
  }
120390
120523
  else {
120391
120524
  state.affectedFilesIndex++;
@@ -120433,25 +120566,61 @@ var ts;
120433
120566
  }
120434
120567
  return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
120435
120568
  }
120569
+ function isProgramBundleEmitBuildInfo(info) {
120570
+ return !!ts.outFile(info.options || {});
120571
+ }
120572
+ ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
120436
120573
  /**
120437
120574
  * Gets the program information to be emitted in buildInfo so that we can use it to create new program
120438
120575
  */
120439
- function getProgramBuildInfo(state, getCanonicalFileName) {
120440
- if (ts.outFile(state.compilerOptions))
120441
- return undefined;
120576
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
120577
+ var outFilePath = ts.outFile(state.compilerOptions);
120578
+ if (outFilePath && !state.compilerOptions.composite)
120579
+ return;
120442
120580
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
120443
120581
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
120582
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
120583
+ if (outFilePath) {
120584
+ var fileNames_1 = [];
120585
+ var fileInfos_1 = [];
120586
+ state.program.getRootFileNames().forEach(function (f) {
120587
+ var sourceFile = state.program.getSourceFile(f);
120588
+ if (!sourceFile)
120589
+ return;
120590
+ fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
120591
+ fileInfos_1.push(sourceFile.version);
120592
+ });
120593
+ var result_15 = {
120594
+ fileNames: fileNames_1,
120595
+ fileInfos: fileInfos_1,
120596
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
120597
+ outSignature: state.outSignature,
120598
+ dtsChangeTime: state.dtsChangeTime,
120599
+ };
120600
+ return result_15;
120601
+ }
120444
120602
  var fileNames = [];
120445
120603
  var fileNameToFileId = new ts.Map();
120446
120604
  var fileIdsList;
120447
120605
  var fileNamesToFileIdListId;
120606
+ var emitSignatures;
120448
120607
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
120608
+ var _b, _c;
120449
120609
  var key = _a[0], value = _a[1];
120450
120610
  // Ensure fileId
120451
120611
  var fileId = toFileId(key);
120452
120612
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
120453
- var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120454
- var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120613
+ var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
120614
+ var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
120615
+ if (state.compilerOptions.composite) {
120616
+ var file = state.program.getSourceFileByPath(key);
120617
+ if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
120618
+ var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
120619
+ if (emitSignature !== actualSignature) {
120620
+ (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
120621
+ }
120622
+ }
120623
+ }
120455
120624
  return value.version === actualSignature ?
120456
120625
  value.affectsGlobalScope || value.impliedFormat ?
120457
120626
  // If file version is same as signature, dont serialize signature
@@ -120459,11 +120628,11 @@ var ts;
120459
120628
  // If file info only contains version and signature and both are same we can just write string
120460
120629
  value.version :
120461
120630
  actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120462
- signature === undefined ?
120631
+ oldSignature === undefined ?
120463
120632
  // If we havent computed signature, use fileInfo as is
120464
120633
  value :
120465
120634
  // Serialize fileInfo with new updated signature
120466
- { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120635
+ { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120467
120636
  // Signature of the FileInfo is undefined, serialize it as false
120468
120637
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120469
120638
  });
@@ -120478,17 +120647,13 @@ var ts;
120478
120647
  if (state.exportedModulesMap) {
120479
120648
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
120480
120649
  var _a;
120481
- if (state.currentAffectedFilesExportedModulesMap) {
120482
- if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
120483
- return undefined;
120484
- }
120485
- var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
120486
- if (newValue) {
120487
- return [toFileId(key), toFileIdListId(newValue)];
120488
- }
120489
- }
120650
+ var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
120490
120651
  // Not in temporary cache, use existing value
120491
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120652
+ if (oldValue === undefined)
120653
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120654
+ if (oldValue)
120655
+ return [toFileId(key), toFileIdListId(oldValue)];
120656
+ return undefined;
120492
120657
  });
120493
120658
  }
120494
120659
  var semanticDiagnosticsPerFile;
@@ -120499,9 +120664,7 @@ var ts;
120499
120664
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
120500
120665
  [
120501
120666
  toFileId(key),
120502
- state.hasReusableDiagnostic ?
120503
- value :
120504
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120667
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
120505
120668
  ] :
120506
120669
  toFileId(key));
120507
120670
  }
@@ -120516,16 +120679,27 @@ var ts;
120516
120679
  }
120517
120680
  }
120518
120681
  }
120519
- return {
120682
+ var changeFileSet;
120683
+ if (state.changedFilesSet.size) {
120684
+ for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
120685
+ var path = _e[_d];
120686
+ (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120687
+ }
120688
+ }
120689
+ var result = {
120520
120690
  fileNames: fileNames,
120521
120691
  fileInfos: fileInfos,
120522
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
120692
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
120523
120693
  fileIdsList: fileIdsList,
120524
120694
  referencedMap: referencedMap,
120525
120695
  exportedModulesMap: exportedModulesMap,
120526
120696
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
120527
120697
  affectedFilesPendingEmit: affectedFilesPendingEmit,
120698
+ changeFileSet: changeFileSet,
120699
+ emitSignatures: emitSignatures,
120700
+ dtsChangeTime: state.dtsChangeTime,
120528
120701
  };
120702
+ return result;
120529
120703
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
120530
120704
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
120531
120705
  }
@@ -120550,24 +120724,18 @@ var ts;
120550
120724
  }
120551
120725
  return fileIdListId;
120552
120726
  }
120553
- }
120554
- function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
120555
- var result;
120556
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120557
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120558
- var name = _a[_i];
120559
- var optionKey = name.toLowerCase();
120560
- var optionInfo = optionsNameMap.get(optionKey);
120561
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
120562
- // We need to store `strict`, even though it won't be examined directly, so that the
120563
- // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
120564
- optionKey === "strict" ||
120565
- // We need to store these to determine whether `lib` files need to be rechecked.
120566
- optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
120567
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
120727
+ function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
120728
+ var result;
120729
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120730
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120731
+ var name = _a[_i];
120732
+ var optionInfo = optionsNameMap.get(name.toLowerCase());
120733
+ if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
120734
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
120735
+ }
120568
120736
  }
120737
+ return result;
120569
120738
  }
120570
- return result;
120571
120739
  }
120572
120740
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120573
120741
  if (option) {
@@ -120641,6 +120809,10 @@ var ts;
120641
120809
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
120642
120810
  }
120643
120811
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
120812
+ function computeSignature(text, data, computeHash) {
120813
+ return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
120814
+ }
120815
+ ts.computeSignature = computeSignature;
120644
120816
  function createBuilderProgram(kind, _a) {
120645
120817
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
120646
120818
  // Return same program if underlying program doesnt change
@@ -120659,8 +120831,8 @@ var ts;
120659
120831
  */
120660
120832
  var computeHash = ts.maybeBind(host, host.createHash);
120661
120833
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
120662
- var backupState;
120663
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
120834
+ var backupEmitState;
120835
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
120664
120836
  // To ensure that we arent storing any references to old program or new program without state
120665
120837
  newProgram = undefined; // TODO: GH#18217
120666
120838
  oldProgram = undefined;
@@ -120668,20 +120840,20 @@ var ts;
120668
120840
  var getState = function () { return state; };
120669
120841
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
120670
120842
  builderProgram.getState = getState;
120671
- builderProgram.backupState = function () {
120672
- ts.Debug.assert(backupState === undefined);
120673
- backupState = cloneBuilderProgramState(state);
120843
+ builderProgram.backupEmitState = function () {
120844
+ ts.Debug.assert(backupEmitState === undefined);
120845
+ backupEmitState = backupEmitBuilderProgramState(state);
120674
120846
  };
120675
- builderProgram.restoreState = function () {
120676
- state = ts.Debug.checkDefined(backupState);
120677
- backupState = undefined;
120847
+ builderProgram.restoreEmitState = function () {
120848
+ restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
120849
+ backupEmitState = undefined;
120678
120850
  };
120679
120851
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
120680
120852
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
120681
120853
  builderProgram.emit = emit;
120682
120854
  builderProgram.releaseProgram = function () {
120683
120855
  releaseCache(state);
120684
- backupState = undefined;
120856
+ backupEmitState = undefined;
120685
120857
  };
120686
120858
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
120687
120859
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -120740,35 +120912,59 @@ var ts;
120740
120912
  return toAffectedFileEmitResult(state,
120741
120913
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
120742
120914
  // Otherwise just affected file
120743
- ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120744
- getWriteFileUpdatingSignatureCallback(writeFile) :
120915
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
120916
+ getWriteFileCallback(writeFile, customTransformers) :
120745
120917
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
120746
120918
  }
120747
- function getWriteFileUpdatingSignatureCallback(writeFile) {
120919
+ function getWriteFileCallback(writeFile, customTransformers) {
120748
120920
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
120749
- var _a;
120921
+ var _a, _b, _c;
120750
120922
  if (ts.isDeclarationFileName(fileName)) {
120751
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120752
- var file = sourceFiles[0];
120753
- var info = state.fileInfos.get(file.resolvedPath);
120754
- var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120755
- if (signature === file.version) {
120756
- var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120757
- if (newSignature !== file.version) { // Update it
120758
- if (host.storeFilesChangingSignatureDuringEmit)
120759
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120760
- if (state.exportedModulesMap)
120761
- ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
120762
- if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
120763
- state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
120923
+ if (!ts.outFile(state.compilerOptions)) {
120924
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120925
+ var newSignature = void 0;
120926
+ if (!customTransformers) {
120927
+ var file = sourceFiles[0];
120928
+ var info = state.fileInfos.get(file.resolvedPath);
120929
+ if (info.signature === file.version) {
120930
+ newSignature = computeSignature(text, data, computeHash);
120931
+ if (newSignature !== file.version) { // Update it
120932
+ if (host.storeFilesChangingSignatureDuringEmit)
120933
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120934
+ if (state.exportedModulesMap)
120935
+ ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
120936
+ if (state.affectedFiles) {
120937
+ // Keep old signature so we know what to undo if cancellation happens
120938
+ var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
120939
+ if (existing === undefined)
120940
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
120941
+ info.signature = newSignature;
120942
+ }
120943
+ else {
120944
+ // These are directly commited
120945
+ info.signature = newSignature;
120946
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120947
+ }
120948
+ }
120764
120949
  }
120765
- else {
120766
- info.signature = newSignature;
120767
- if (state.exportedModulesMap)
120768
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120950
+ }
120951
+ if (state.compilerOptions.composite) {
120952
+ var filePath = sourceFiles[0].resolvedPath;
120953
+ var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
120954
+ newSignature || (newSignature = computeSignature(text, data, computeHash));
120955
+ if (newSignature !== oldSignature) {
120956
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
120957
+ state.hasChangedEmitSignature = true;
120769
120958
  }
120770
120959
  }
120771
120960
  }
120961
+ else if (state.compilerOptions.composite) {
120962
+ var newSignature = computeSignature(text, data, computeHash);
120963
+ if (newSignature !== state.outSignature) {
120964
+ state.outSignature = newSignature;
120965
+ state.hasChangedEmitSignature = true;
120966
+ }
120967
+ }
120772
120968
  }
120773
120969
  if (writeFile)
120774
120970
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -120833,8 +121029,8 @@ var ts;
120833
121029
  }
120834
121030
  }
120835
121031
  }
120836
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120837
- getWriteFileUpdatingSignatureCallback(writeFile) :
121032
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
121033
+ getWriteFileCallback(writeFile, customTransformers) :
120838
121034
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120839
121035
  }
120840
121036
  /**
@@ -120923,29 +121119,58 @@ var ts;
120923
121119
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
120924
121120
  }
120925
121121
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
120926
- function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
120927
- var _a;
121122
+ function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
121123
+ var _a, _b, _c, _d;
120928
121124
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
120929
121125
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
120930
- var filePaths = program.fileNames.map(toPath);
120931
- var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
120932
- var fileInfos = new ts.Map();
120933
- program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
120934
- var state = {
120935
- fileInfos: fileInfos,
120936
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
120937
- referencedMap: toManyToManyPathMap(program.referencedMap),
120938
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
120939
- 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]; }),
120940
- hasReusableDiagnostic: true,
120941
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
120942
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
120943
- affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
120944
- };
121126
+ var state;
121127
+ var filePaths;
121128
+ var filePathsSetList;
121129
+ if (isProgramBundleEmitBuildInfo(program)) {
121130
+ state = {
121131
+ fileInfos: new ts.Map(),
121132
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121133
+ dtsChangeTime: program.dtsChangeTime,
121134
+ outSignature: program.outSignature,
121135
+ };
121136
+ }
121137
+ else {
121138
+ filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
121139
+ filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
121140
+ var fileInfos_2 = new ts.Map();
121141
+ var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
121142
+ program.fileInfos.forEach(function (fileInfo, index) {
121143
+ var path = toFilePath(index + 1);
121144
+ var stateFileInfo = toBuilderStateFileInfo(fileInfo);
121145
+ fileInfos_2.set(path, stateFileInfo);
121146
+ if (emitSignatures_1 && stateFileInfo.signature)
121147
+ emitSignatures_1.set(path, stateFileInfo.signature);
121148
+ });
121149
+ (_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
121150
+ if (ts.isNumber(value))
121151
+ emitSignatures_1.delete(toFilePath(value));
121152
+ else
121153
+ emitSignatures_1.set(toFilePath(value[0]), value[1]);
121154
+ });
121155
+ state = {
121156
+ fileInfos: fileInfos_2,
121157
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121158
+ referencedMap: toManyToManyPathMap(program.referencedMap),
121159
+ exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121160
+ 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]; }),
121161
+ hasReusableDiagnostic: true,
121162
+ affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
121163
+ affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
121164
+ affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
121165
+ changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
121166
+ dtsChangeTime: program.dtsChangeTime,
121167
+ emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
121168
+ };
121169
+ }
120945
121170
  return {
120946
121171
  getState: function () { return state; },
120947
- backupState: ts.noop,
120948
- restoreState: ts.noop,
121172
+ backupEmitState: ts.noop,
121173
+ restoreEmitState: ts.noop,
120949
121174
  getProgram: ts.notImplemented,
120950
121175
  getProgramOrUndefined: ts.returnUndefined,
120951
121176
  releaseProgram: ts.noop,
@@ -120990,12 +121215,24 @@ var ts;
120990
121215
  return map;
120991
121216
  }
120992
121217
  }
120993
- ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
121218
+ ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
121219
+ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
121220
+ var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
121221
+ var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
121222
+ var fileInfos = new ts.Map();
121223
+ program.fileInfos.forEach(function (fileInfo, index) {
121224
+ var path = ts.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
121225
+ var version = ts.isString(fileInfo) ? fileInfo : fileInfo.version; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
121226
+ fileInfos.set(path, version);
121227
+ });
121228
+ return fileInfos;
121229
+ }
121230
+ ts.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap;
120994
121231
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
120995
121232
  return {
120996
121233
  getState: ts.notImplemented,
120997
- backupState: ts.noop,
120998
- restoreState: ts.noop,
121234
+ backupEmitState: ts.noop,
121235
+ restoreEmitState: ts.noop,
120999
121236
  getProgram: getProgram,
121000
121237
  getProgramOrUndefined: function () { return getState().program; },
121001
121238
  releaseProgram: function () { return getState().program = undefined; },
@@ -122111,9 +122348,9 @@ var ts;
122111
122348
  if (!preferSymlinks) {
122112
122349
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
122113
122350
  // so we only need to remove them from the realpath filenames.
122114
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122115
- if (result_15)
122116
- return result_15;
122351
+ var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122352
+ if (result_16)
122353
+ return result_16;
122117
122354
  }
122118
122355
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
122119
122356
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -122133,10 +122370,10 @@ var ts;
122133
122370
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
122134
122371
  var symlinkDirectory = symlinkDirectories_1[_i];
122135
122372
  var option = ts.resolvePath(symlinkDirectory, relative);
122136
- var result_16 = cb(option, target === referenceRedirect);
122373
+ var result_17 = cb(option, target === referenceRedirect);
122137
122374
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
122138
- if (result_16)
122139
- return result_16;
122375
+ if (result_17)
122376
+ return result_17;
122140
122377
  }
122141
122378
  });
122142
122379
  });
@@ -122178,7 +122415,7 @@ var ts;
122178
122415
  });
122179
122416
  // Sort by paths closest to importing file Name directory
122180
122417
  var sortedPaths = [];
122181
- var _loop_32 = function (directory) {
122418
+ var _loop_33 = function (directory) {
122182
122419
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
122183
122420
  var pathsInDirectory;
122184
122421
  allFileNames.forEach(function (_a, fileName) {
@@ -122202,7 +122439,7 @@ var ts;
122202
122439
  };
122203
122440
  var out_directory_1;
122204
122441
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
122205
- var state_10 = _loop_32(directory);
122442
+ var state_10 = _loop_33(directory);
122206
122443
  directory = out_directory_1;
122207
122444
  if (state_10 === "break")
122208
122445
  break;
@@ -123046,6 +123283,7 @@ var ts;
123046
123283
  readDirectory: ts.maybeBind(host, host.readDirectory),
123047
123284
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
123048
123285
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
123286
+ now: ts.maybeBind(host, host.now),
123049
123287
  };
123050
123288
  function writeFile(fileName, text, writeByteOrderMark, onError) {
123051
123289
  try {
@@ -123106,6 +123344,7 @@ var ts;
123106
123344
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
123107
123345
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
123108
123346
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
123347
+ now: ts.maybeBind(system, system.now),
123109
123348
  };
123110
123349
  }
123111
123350
  ts.createProgramHost = createProgramHost;
@@ -123173,20 +123412,26 @@ var ts;
123173
123412
  var ts;
123174
123413
  (function (ts) {
123175
123414
  function readBuilderProgram(compilerOptions, host) {
123176
- if (ts.outFile(compilerOptions))
123177
- return undefined;
123178
123415
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
123179
123416
  if (!buildInfoPath)
123180
123417
  return undefined;
123181
- var content = host.readFile(buildInfoPath);
123182
- if (!content)
123183
- return undefined;
123184
- var buildInfo = ts.getBuildInfo(content);
123418
+ var buildInfo;
123419
+ if (host.getBuildInfo) {
123420
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
123421
+ if (!buildInfo)
123422
+ return undefined;
123423
+ }
123424
+ else {
123425
+ var content = host.readFile(buildInfoPath);
123426
+ if (!content)
123427
+ return undefined;
123428
+ buildInfo = ts.getBuildInfo(content);
123429
+ }
123185
123430
  if (buildInfo.version !== ts.version)
123186
123431
  return undefined;
123187
123432
  if (!buildInfo.program)
123188
123433
  return undefined;
123189
- return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123434
+ return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123190
123435
  }
123191
123436
  ts.readBuilderProgram = readBuilderProgram;
123192
123437
  function createIncrementalCompilerHost(options, system) {
@@ -123195,6 +123440,7 @@ var ts;
123195
123440
  host.createHash = ts.maybeBind(system, system.createHash);
123196
123441
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
123197
123442
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
123443
+ host.now = ts.maybeBind(system, system.now);
123198
123444
  ts.setGetSourceFileAsHashVersioned(host, system);
123199
123445
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
123200
123446
  return host;
@@ -123930,14 +124176,17 @@ var ts;
123930
124176
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
123931
124177
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
123932
124178
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
123933
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
123934
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
123935
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
123936
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
124179
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
124180
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
124181
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
124182
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
124183
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
124184
+ UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
123937
124185
  /**
123938
124186
  * Projects with no outputs (i.e. "solution" files)
123939
124187
  */
123940
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
124188
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
124189
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
123941
124190
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
123942
124191
  function resolveConfigFileProjectName(project) {
123943
124192
  if (ts.fileExtensionIs(project, ".json" /* Json */)) {
@@ -123982,9 +124231,11 @@ var ts;
123982
124231
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
123983
124232
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
123984
124233
  }
123985
- function newer(date1, date2) {
123986
- return date2 > date1 ? date2 : date1;
124234
+ /*@internal*/
124235
+ function getCurrentTime(host) {
124236
+ return host.now ? host.now() : new Date();
123987
124237
  }
124238
+ ts.getCurrentTime = getCurrentTime;
123988
124239
  /*@internal*/
123989
124240
  function isCircularBuildOrder(buildOrder) {
123990
124241
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -124074,6 +124325,7 @@ var ts;
124074
124325
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
124075
124326
  };
124076
124327
  }
124328
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
124077
124329
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
124078
124330
  var state = {
124079
124331
  host: host,
@@ -124090,8 +124342,9 @@ var ts;
124090
124342
  resolvedConfigFilePaths: new ts.Map(),
124091
124343
  configFileCache: new ts.Map(),
124092
124344
  projectStatus: new ts.Map(),
124093
- buildInfoChecked: new ts.Map(),
124094
124345
  extendedConfigCache: new ts.Map(),
124346
+ buildInfoCache: new ts.Map(),
124347
+ outputTimeStamps: new ts.Map(),
124095
124348
  builderPrograms: new ts.Map(),
124096
124349
  diagnostics: new ts.Map(),
124097
124350
  projectPendingBuild: new ts.Map(),
@@ -124114,6 +124367,7 @@ var ts;
124114
124367
  allWatchedConfigFiles: new ts.Map(),
124115
124368
  allWatchedExtendedConfigFiles: new ts.Map(),
124116
124369
  allWatchedPackageJsonFiles: new ts.Map(),
124370
+ filesWatched: new ts.Map(),
124117
124371
  lastCachedPackageJsonLookups: new ts.Map(),
124118
124372
  timerToBuildInvalidatedProject: undefined,
124119
124373
  reportFileChangeDetected: false,
@@ -124148,6 +124402,7 @@ var ts;
124148
124402
  if (value) {
124149
124403
  return isParsedCommandLine(value) ? value : undefined;
124150
124404
  }
124405
+ ts.solutionPerformance.mark("beforeParseConfigFile");
124151
124406
  var diagnostic;
124152
124407
  var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host;
124153
124408
  var parsed;
@@ -124162,6 +124417,8 @@ var ts;
124162
124417
  parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
124163
124418
  }
124164
124419
  configFileCache.set(configFilePath, parsed || diagnostic);
124420
+ ts.solutionPerformance.mark("afterParseConfigFile");
124421
+ ts.solutionPerformance.measure("ParseConfigFile", "beforeParseConfigFile", "afterParseConfigFile");
124165
124422
  return parsed;
124166
124423
  }
124167
124424
  function resolveProjectName(state, name) {
@@ -124211,6 +124468,7 @@ var ts;
124211
124468
  return state.buildOrder || createStateBuildOrder(state);
124212
124469
  }
124213
124470
  function createStateBuildOrder(state) {
124471
+ ts.solutionPerformance.mark("beforeCreateBuildOrder");
124214
124472
  var buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); }));
124215
124473
  // Clear all to ResolvedConfigFilePaths cache to start fresh
124216
124474
  state.resolvedConfigFilePaths.clear();
@@ -124220,11 +124478,12 @@ var ts;
124220
124478
  // Config file cache
124221
124479
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
124222
124480
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
124223
- ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
124224
124481
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
124225
124482
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
124226
124483
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
124227
124484
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
124485
+ ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
124486
+ ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
124228
124487
  // Remove watches for the program no longer in the solution
124229
124488
  if (state.watch) {
124230
124489
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
@@ -124240,6 +124499,8 @@ var ts;
124240
124499
  ts.mutateMapSkippingNewValues(state.allWatchedInputFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
124241
124500
  ts.mutateMapSkippingNewValues(state.allWatchedPackageJsonFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
124242
124501
  }
124502
+ ts.solutionPerformance.mark("afterCreateBuildOrder");
124503
+ ts.solutionPerformance.measure("CreateBuildOrder", "beforeCreateBuildOrder", "afterCreateBuildOrder");
124243
124504
  return state.buildOrder = buildOrder;
124244
124505
  }
124245
124506
  function getBuildOrderFor(state, project, onlyReferences) {
@@ -124360,6 +124621,7 @@ var ts;
124360
124621
  if (updateOutputFileStampsPending) {
124361
124622
  updateOutputTimestamps(state, config, projectPath);
124362
124623
  }
124624
+ ts.solutionPerformance.mark("timestampUpdated");
124363
124625
  return doneInvalidatedProject(state, projectPath);
124364
124626
  }
124365
124627
  };
@@ -124453,6 +124715,10 @@ var ts;
124453
124715
  };
124454
124716
  function done(cancellationToken, writeFile, customTransformers) {
124455
124717
  executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers);
124718
+ if (kind === InvalidatedProjectKind.Build)
124719
+ ts.solutionPerformance.mark("projectsBuilt");
124720
+ else
124721
+ ts.solutionPerformance.mark("bundlesUpdated");
124456
124722
  return doneInvalidatedProject(state, projectPath);
124457
124723
  }
124458
124724
  function withProgramOrUndefined(action) {
@@ -124514,21 +124780,21 @@ var ts;
124514
124780
  }
124515
124781
  function emit(writeFileCallback, cancellationToken, customTransformers) {
124516
124782
  var _a;
124517
- var _b, _c;
124783
+ var _b, _c, _d;
124518
124784
  ts.Debug.assertIsDefined(program);
124519
124785
  ts.Debug.assert(step === BuildStep.Emit);
124520
124786
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
124521
- program.backupState();
124787
+ program.backupEmitState();
124522
124788
  var declDiagnostics;
124523
124789
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
124524
124790
  var outputFiles = [];
124525
124791
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
124526
124792
  /*write*/ undefined,
124527
- /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
124793
+ /*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,
124528
124794
  /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
124529
124795
  // Don't emit .d.ts if there are decl file errors
124530
124796
  if (declDiagnostics) {
124531
- program.restoreState();
124797
+ program.restoreEmitState();
124532
124798
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
124533
124799
  return {
124534
124800
  emitSkipped: true,
@@ -124538,37 +124804,46 @@ var ts;
124538
124804
  // Actual Emit
124539
124805
  var host = state.host, compilerHost = state.compilerHost;
124540
124806
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124541
- var newestDeclarationFileContentChangedTime = minimumDate;
124542
- var anyDtsChanged = false;
124807
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
124543
124808
  var emitterDiagnostics = ts.createDiagnosticCollection();
124544
124809
  var emittedOutputs = new ts.Map();
124810
+ var options = program.getCompilerOptions();
124811
+ var isIncremental = ts.isIncrementalCompilation(options);
124812
+ var outputTimeStampMap;
124813
+ var now;
124814
+ ts.solutionPerformance.mark("beforeOutputFilesWrite");
124545
124815
  outputFiles.forEach(function (_a) {
124546
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124547
- var priorChangeTime;
124548
- if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124549
- // Check for unchanged .d.ts files
124550
- if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124551
- priorChangeTime = host.getModifiedTime(name);
124552
- }
124553
- else {
124816
+ var _b, _c;
124817
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124818
+ var path = toPath(state, name);
124819
+ emittedOutputs.set(toPath(state, name), name);
124820
+ if (buildInfo) {
124821
+ setBuildInfo(state, buildInfo, projectPath, options);
124822
+ 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)) {
124554
124823
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124555
- anyDtsChanged = true;
124556
124824
  }
124557
124825
  }
124558
- emittedOutputs.set(toPath(state, name), name);
124559
124826
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124560
- if (priorChangeTime !== undefined) {
124561
- newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
124827
+ if (!isIncremental && state.watch) {
124828
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
124562
124829
  }
124563
124830
  });
124564
- finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime,
124565
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124831
+ ts.solutionPerformance.mark("afterOutputFilesWrite");
124832
+ ts.solutionPerformance.measure("OutputFilesWrite", "beforeOutputFilesWrite", "afterOutputFilesWrite");
124833
+ finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124566
124834
  return emitResult;
124567
124835
  }
124568
124836
  function emitBuildInfo(writeFileCallback, cancellationToken) {
124569
124837
  ts.Debug.assertIsDefined(program);
124570
124838
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
124571
- var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
124839
+ var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
124840
+ if (data === null || data === void 0 ? void 0 : data.buildInfo)
124841
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
124842
+ if (writeFileCallback)
124843
+ writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
124844
+ else
124845
+ state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
124846
+ }, cancellationToken);
124572
124847
  if (emitResult.diagnostics.length) {
124573
124848
  reportErrors(state, emitResult.diagnostics);
124574
124849
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -124581,7 +124856,7 @@ var ts;
124581
124856
  step = BuildStep.QueueReferencingProjects;
124582
124857
  return emitResult;
124583
124858
  }
124584
- function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
124859
+ function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
124585
124860
  var _a;
124586
124861
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
124587
124862
  if (emitDiagnostics.length) {
@@ -124592,13 +124867,11 @@ var ts;
124592
124867
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
124593
124868
  }
124594
124869
  // Update time stamps for rest of the outputs
124595
- var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124870
+ updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124596
124871
  state.diagnostics.delete(projectPath);
124597
124872
  state.projectStatus.set(projectPath, {
124598
124873
  type: ts.UpToDateStatusType.UpToDate,
124599
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
124600
- maximumDate :
124601
- newestDeclarationFileContentChangedTime,
124874
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
124602
124875
  oldestOutputFileName: oldestOutputFileName
124603
124876
  });
124604
124877
  afterProgramDone(state, program, config);
@@ -124633,13 +124906,21 @@ var ts;
124633
124906
  ts.Debug.assert(!!outputFiles.length);
124634
124907
  var emitterDiagnostics = ts.createDiagnosticCollection();
124635
124908
  var emittedOutputs = new ts.Map();
124909
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124910
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
124636
124911
  outputFiles.forEach(function (_a) {
124637
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124912
+ var _b, _c;
124913
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124638
124914
  emittedOutputs.set(toPath(state, name), name);
124915
+ if (buildInfo) {
124916
+ setBuildInfo(state, buildInfo, projectPath, config.options);
124917
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
124918
+ resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124919
+ }
124920
+ }
124639
124921
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124640
124922
  });
124641
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate,
124642
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
124923
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
124643
124924
  return { emitSkipped: false, diagnostics: emitDiagnostics };
124644
124925
  }
124645
124926
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -124690,6 +124971,13 @@ var ts;
124690
124971
  !ts.isIncrementalCompilation(config.options);
124691
124972
  }
124692
124973
  function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
124974
+ ts.solutionPerformance.mark("beforeGetNextInvalidatedProjectCreateInfo");
124975
+ var result = getNextInvalidatedProjectCreateInfoWorker(state, buildOrder, reportQueue);
124976
+ ts.solutionPerformance.mark("afterGetNextInvalidatedProjectCreateInfo");
124977
+ ts.solutionPerformance.measure("GetNextInvalidatedProjectCreateInfo", "beforeGetNextInvalidatedProjectCreateInfo", "afterGetNextInvalidatedProjectCreateInfo");
124978
+ return result;
124979
+ }
124980
+ function getNextInvalidatedProjectCreateInfoWorker(state, buildOrder, reportQueue) {
124693
124981
  if (!state.projectPendingBuild.size)
124694
124982
  return undefined;
124695
124983
  if (isCircularBuildOrder(buildOrder))
@@ -124738,7 +125026,7 @@ var ts;
124738
125026
  }
124739
125027
  continue;
124740
125028
  }
124741
- if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
125029
+ if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
124742
125030
  reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
124743
125031
  return {
124744
125032
  kind: InvalidatedProjectKind.UpdateOutputFileStamps,
@@ -124789,9 +125077,7 @@ var ts;
124789
125077
  }
124790
125078
  function getNextInvalidatedProject(state, buildOrder, reportQueue) {
124791
125079
  var info = getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue);
124792
- if (!info)
124793
- return info;
124794
- return createInvalidatedProjectWithInfo(state, info, buildOrder);
125080
+ return info && createInvalidatedProjectWithInfo(state, info, buildOrder);
124795
125081
  }
124796
125082
  function listEmittedFile(_a, proj, file) {
124797
125083
  var write = _a.write;
@@ -124799,14 +125085,17 @@ var ts;
124799
125085
  write("TSFILE: " + file);
124800
125086
  }
124801
125087
  }
124802
- function getOldProgram(_a, proj, parsed) {
124803
- var options = _a.options, builderPrograms = _a.builderPrograms, compilerHost = _a.compilerHost;
124804
- if (options.force)
125088
+ function getOldProgram(state, proj, parsed) {
125089
+ if (state.options.force)
124805
125090
  return undefined;
124806
- var value = builderPrograms.get(proj);
125091
+ var value = state.builderPrograms.get(proj);
124807
125092
  if (value)
124808
125093
  return value;
124809
- return ts.readBuilderProgram(parsed.options, compilerHost);
125094
+ ts.solutionPerformance.mark("beforeReadBuilderProgram");
125095
+ var program = ts.readBuilderProgram(parsed.options, state.compilerHost);
125096
+ ts.solutionPerformance.mark("afterReadBuilderProgram");
125097
+ ts.solutionPerformance.measure("ReadBuilderProgram", "beforeReadBuilderProgram", "afterReadBuilderProgram");
125098
+ return program;
124810
125099
  }
124811
125100
  function afterProgramDone(state, program, config) {
124812
125101
  if (program) {
@@ -124823,7 +125112,7 @@ var ts;
124823
125112
  state.projectCompilerOptions = state.baseCompilerOptions;
124824
125113
  }
124825
125114
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
124826
- var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
125115
+ var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
124827
125116
  reportAndStoreErrors(state, resolvedPath, diagnostics);
124828
125117
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
124829
125118
  if (canEmitBuildInfo)
@@ -124831,9 +125120,101 @@ var ts;
124831
125120
  afterProgramDone(state, program, config);
124832
125121
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
124833
125122
  }
125123
+ function isFileWatcherWithModifiedTime(value) {
125124
+ return !!value.watcher;
125125
+ }
125126
+ function getModifiedTime(state, fileName) {
125127
+ var path = toPath(state, fileName);
125128
+ var existing = state.filesWatched.get(path);
125129
+ if (state.watch && !!existing) {
125130
+ if (!isFileWatcherWithModifiedTime(existing))
125131
+ return existing;
125132
+ if (existing.modifiedTime)
125133
+ return existing.modifiedTime;
125134
+ }
125135
+ var result = ts.getModifiedTime(state.host, fileName);
125136
+ if (state.watch) {
125137
+ if (existing)
125138
+ existing.modifiedTime = result;
125139
+ else
125140
+ state.filesWatched.set(path, result);
125141
+ }
125142
+ return result;
125143
+ }
125144
+ function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
125145
+ var path = toPath(state, file);
125146
+ var existing = state.filesWatched.get(path);
125147
+ if (existing && isFileWatcherWithModifiedTime(existing)) {
125148
+ existing.callbacks.push(callback);
125149
+ }
125150
+ else {
125151
+ var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
125152
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
125153
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
125154
+ existing.modifiedTime = modifiedTime;
125155
+ existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
125156
+ }, pollingInterval, options, watchType, project);
125157
+ state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
125158
+ }
125159
+ return {
125160
+ close: function () {
125161
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
125162
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
125163
+ if (existing.callbacks.length === 1) {
125164
+ state.filesWatched.delete(path);
125165
+ ts.closeFileWatcherOf(existing);
125166
+ }
125167
+ else {
125168
+ ts.unorderedRemoveItem(existing.callbacks, callback);
125169
+ }
125170
+ }
125171
+ };
125172
+ }
125173
+ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
125174
+ if (!state.watch)
125175
+ return undefined;
125176
+ var result = state.outputTimeStamps.get(resolvedConfigFilePath);
125177
+ if (!result)
125178
+ state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
125179
+ return result;
125180
+ }
125181
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
125182
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125183
+ var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
125184
+ if (existing) {
125185
+ existing.buildInfo = buildInfo;
125186
+ existing.modifiedTime = getCurrentTime(state.host);
125187
+ }
125188
+ else {
125189
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
125190
+ }
125191
+ }
125192
+ function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
125193
+ var path = toPath(state, buildInfoPath);
125194
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
125195
+ return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
125196
+ }
125197
+ function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
125198
+ var path = toPath(state, buildInfoPath);
125199
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
125200
+ if (existing !== undefined && existing.path === path) {
125201
+ return existing.buildInfo || undefined;
125202
+ }
125203
+ ts.solutionPerformance.mark("beforeGetBuildInfo");
125204
+ ts.solutionPerformance.mark("beforeBuildInfoRead");
125205
+ var value = state.readFileWithCache(buildInfoPath);
125206
+ ts.solutionPerformance.mark("afterBuildInfoRead");
125207
+ ts.solutionPerformance.measure("BuildInfoRead", "beforeBuildInfoRead", "afterBuildInfoRead");
125208
+ var buildInfo = value ? ts.getBuildInfo(value) : undefined;
125209
+ ts.Debug.assert(modifiedTime || !buildInfo);
125210
+ state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
125211
+ ts.solutionPerformance.mark("afterGetBuildInfo");
125212
+ ts.solutionPerformance.measure("GetBuildInfo", "beforeGetBuildInfo", "afterGetBuildInfo");
125213
+ return buildInfo;
125214
+ }
124834
125215
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
124835
125216
  // Check tsconfig time
124836
- var tsconfigTime = ts.getModifiedTime(state.host, configFile);
125217
+ var tsconfigTime = getModifiedTime(state, configFile);
124837
125218
  if (oldestOutputFileTime < tsconfigTime) {
124838
125219
  return {
124839
125220
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -124843,88 +125224,24 @@ var ts;
124843
125224
  }
124844
125225
  }
124845
125226
  function getUpToDateStatusWorker(state, project, resolvedPath) {
124846
- var force = !!state.options.force;
124847
- var newestInputFileName = undefined;
124848
- var newestInputFileTime = minimumDate;
124849
- var host = state.host;
124850
- // Get timestamps of input files
124851
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
124852
- var inputFile = _a[_i];
124853
- if (!host.fileExists(inputFile)) {
124854
- return {
124855
- type: ts.UpToDateStatusType.Unbuildable,
124856
- reason: inputFile + " does not exist"
124857
- };
124858
- }
124859
- if (!force) {
124860
- var inputTime = ts.getModifiedTime(host, inputFile);
124861
- if (inputTime > newestInputFileTime) {
124862
- newestInputFileName = inputFile;
124863
- newestInputFileTime = inputTime;
124864
- }
124865
- }
124866
- }
125227
+ var _a, _b, _c;
124867
125228
  // Container if no files are specified in the project
124868
125229
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
124869
125230
  return {
124870
125231
  type: ts.UpToDateStatusType.ContainerOnly
124871
125232
  };
124872
125233
  }
124873
- // Collect the expected outputs of this project
124874
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
124875
- // Now see if all outputs are newer than the newest input
124876
- var oldestOutputFileName = "(none)";
124877
- var oldestOutputFileTime = maximumDate;
124878
- var newestOutputFileName = "(none)";
124879
- var newestOutputFileTime = minimumDate;
124880
- var missingOutputFileName;
124881
- var newestDeclarationFileContentChangedTime = minimumDate;
124882
- var isOutOfDateWithInputs = false;
124883
- if (!force) {
124884
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
124885
- var output = outputs_1[_b];
124886
- // Output is missing; can stop checking
124887
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124888
- if (!host.fileExists(output)) {
124889
- missingOutputFileName = output;
124890
- break;
124891
- }
124892
- var outputTime = ts.getModifiedTime(host, output);
124893
- if (outputTime < oldestOutputFileTime) {
124894
- oldestOutputFileTime = outputTime;
124895
- oldestOutputFileName = output;
124896
- }
124897
- // If an output is older than the newest input, we can stop checking
124898
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124899
- if (outputTime < newestInputFileTime) {
124900
- isOutOfDateWithInputs = true;
124901
- break;
124902
- }
124903
- if (outputTime > newestOutputFileTime) {
124904
- newestOutputFileTime = outputTime;
124905
- newestOutputFileName = output;
124906
- }
124907
- // Keep track of when the most recent time a .d.ts file was changed.
124908
- // In addition to file timestamps, we also keep track of when a .d.ts file
124909
- // had its file touched but not had its contents changed - this allows us
124910
- // to skip a downstream typecheck
124911
- if (ts.isDeclarationFileName(output)) {
124912
- var outputModifiedTime = ts.getModifiedTime(host, output);
124913
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
124914
- }
124915
- }
124916
- }
124917
- var pseudoUpToDate = false;
124918
- var usesPrepend = false;
124919
- var upstreamChangedProject;
125234
+ // Fast check to see if reference projects are buildable
125235
+ var referenceStatuses;
125236
+ var force = !!state.options.force;
124920
125237
  if (project.projectReferences) {
124921
125238
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
124922
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
124923
- var ref = _d[_c];
124924
- usesPrepend = usesPrepend || !!(ref.prepend);
125239
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
125240
+ var ref = _d[_i];
124925
125241
  var resolvedRef = ts.resolveProjectReferencePath(ref);
124926
125242
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
124927
- var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
125243
+ var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
125244
+ var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
124928
125245
  // Its a circular reference ignore the status of this project
124929
125246
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
124930
125247
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) { // Container only ignore this project
@@ -124946,75 +125263,188 @@ var ts;
124946
125263
  upstreamProjectName: ref.path
124947
125264
  };
124948
125265
  }
124949
- // Check oldest output file name only if there is no missing output file name
124950
- // (a check we will have skipped if this is a forced build)
124951
- if (!force && !missingOutputFileName) {
124952
- // If the upstream project's newest file is older than our oldest output, we
124953
- // can't be out of date because of it
124954
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
124955
- continue;
124956
- }
124957
- // If the upstream project has only change .d.ts files, and we've built
124958
- // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
124959
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
124960
- pseudoUpToDate = true;
124961
- upstreamChangedProject = ref.path;
124962
- continue;
124963
- }
124964
- // We have an output older than an upstream output - we are out of date
124965
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125266
+ if (!force)
125267
+ (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
125268
+ }
125269
+ }
125270
+ if (force)
125271
+ return { type: ts.UpToDateStatusType.ForceBuild };
125272
+ // Check buildinfo first
125273
+ var host = state.host;
125274
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125275
+ var oldestOutputFileName = "(none)";
125276
+ var oldestOutputFileTime = maximumDate;
125277
+ var buildInfoTime;
125278
+ var buildInfoProgram;
125279
+ var buildInfoVersionMap;
125280
+ var newestDeclarationFileContentChangedTime;
125281
+ if (buildInfoPath) {
125282
+ var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
125283
+ buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
125284
+ if (buildInfoTime === ts.missingFileModifiedTime) {
125285
+ if (!buildInfoCacheEntry_1) {
125286
+ state.buildInfoCache.set(resolvedPath, {
125287
+ path: toPath(state, buildInfoPath),
125288
+ buildInfo: false,
125289
+ modifiedTime: buildInfoTime
125290
+ });
125291
+ }
125292
+ return {
125293
+ type: ts.UpToDateStatusType.OutputMissing,
125294
+ missingOutputFileName: buildInfoPath
125295
+ };
125296
+ }
125297
+ var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
125298
+ if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125299
+ return {
125300
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
125301
+ version: buildInfo.version
125302
+ };
125303
+ }
125304
+ if (buildInfo.program) {
125305
+ if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
125306
+ (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
124966
125307
  return {
124967
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124968
- outOfDateOutputFileName: oldestOutputFileName,
124969
- newerProjectName: ref.path
125308
+ type: ts.UpToDateStatusType.OutOfDateBuildInfo,
125309
+ buildInfoFile: buildInfoPath
124970
125310
  };
124971
125311
  }
125312
+ buildInfoProgram = buildInfo.program;
124972
125313
  }
125314
+ oldestOutputFileTime = buildInfoTime;
125315
+ oldestOutputFileName = buildInfoPath;
125316
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
124973
125317
  }
124974
- if (missingOutputFileName !== undefined) {
124975
- return {
124976
- type: ts.UpToDateStatusType.OutputMissing,
124977
- missingOutputFileName: missingOutputFileName
124978
- };
125318
+ // Check input files
125319
+ var newestInputFileName = undefined;
125320
+ var newestInputFileTime = minimumDate;
125321
+ var pseudoInputUptodate = false;
125322
+ // Get timestamps of input files
125323
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
125324
+ var inputFile = _f[_e];
125325
+ var inputTime = getModifiedTime(state, inputFile);
125326
+ if (inputTime === ts.missingFileModifiedTime) {
125327
+ return {
125328
+ type: ts.UpToDateStatusType.Unbuildable,
125329
+ reason: inputFile + " does not exist"
125330
+ };
125331
+ }
125332
+ // If an buildInfo is older than the newest input, we can stop checking
125333
+ if (buildInfoTime && buildInfoTime < inputTime) {
125334
+ var version_3 = void 0;
125335
+ var currentVersion = void 0;
125336
+ if (buildInfoProgram) {
125337
+ // Read files and see if they are same, read is anyways cached
125338
+ if (!buildInfoVersionMap)
125339
+ buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
125340
+ version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
125341
+ var text = version_3 ? state.readFileWithCache(inputFile) : undefined;
125342
+ currentVersion = text && (host.createHash || ts.generateDjb2Hash)(text);
125343
+ if (version_3 && version_3 === currentVersion)
125344
+ pseudoInputUptodate = true;
125345
+ }
125346
+ if (!version_3 || version_3 !== currentVersion) {
125347
+ return {
125348
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125349
+ outOfDateOutputFileName: buildInfoPath,
125350
+ newerInputFileName: inputFile
125351
+ };
125352
+ }
125353
+ }
125354
+ if (inputTime > newestInputFileTime) {
125355
+ newestInputFileName = inputFile;
125356
+ newestInputFileTime = inputTime;
125357
+ }
124979
125358
  }
124980
- if (isOutOfDateWithInputs) {
124981
- return {
124982
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
124983
- outOfDateOutputFileName: oldestOutputFileName,
124984
- newerInputFileName: newestInputFileName
124985
- };
125359
+ // Now see if all outputs are newer than the newest input
125360
+ // Dont check output timestamps if we have buildinfo telling us output is uptodate
125361
+ if (!buildInfoPath) {
125362
+ // Collect the expected outputs of this project
125363
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
125364
+ var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
125365
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
125366
+ var output = outputs_1[_g];
125367
+ var path = toPath(state, output);
125368
+ // Output is missing; can stop checking
125369
+ var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
125370
+ if (!outputTime) {
125371
+ outputTime = ts.getModifiedTime(state.host, output);
125372
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
125373
+ }
125374
+ if (outputTime === ts.missingFileModifiedTime) {
125375
+ return {
125376
+ type: ts.UpToDateStatusType.OutputMissing,
125377
+ missingOutputFileName: output
125378
+ };
125379
+ }
125380
+ if (outputTime < oldestOutputFileTime) {
125381
+ oldestOutputFileTime = outputTime;
125382
+ oldestOutputFileName = output;
125383
+ }
125384
+ // If an output is older than the newest input, we can stop checking
125385
+ if (outputTime < newestInputFileTime) {
125386
+ return {
125387
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125388
+ outOfDateOutputFileName: oldestOutputFileName,
125389
+ newerInputFileName: newestInputFileName
125390
+ };
125391
+ }
125392
+ }
124986
125393
  }
124987
- else {
124988
- // Check tsconfig time
124989
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
124990
- if (configStatus)
124991
- return configStatus;
124992
- // Check extended config time
124993
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
124994
- if (extendedConfigStatus)
124995
- return extendedConfigStatus;
124996
- // Check package file time
124997
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
124998
- var path = _a[0];
124999
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125000
- });
125001
- if (dependentPackageFileStatus)
125002
- return dependentPackageFileStatus;
125003
- }
125004
- if (!force && !state.buildInfoChecked.has(resolvedPath)) {
125005
- state.buildInfoChecked.set(resolvedPath, true);
125006
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125007
- if (buildInfoPath) {
125008
- var value = state.readFileWithCache(buildInfoPath);
125009
- var buildInfo = value && ts.getBuildInfo(value);
125010
- if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125394
+ var seenRefs = buildInfoPath ? new ts.Set() : undefined;
125395
+ var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
125396
+ seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
125397
+ var pseudoUpToDate = false;
125398
+ var usesPrepend = false;
125399
+ var upstreamChangedProject;
125400
+ if (referenceStatuses) {
125401
+ for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
125402
+ var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
125403
+ usesPrepend = usesPrepend || !!(ref.prepend);
125404
+ // If the upstream project's newest file is older than our oldest output, we
125405
+ // can't be out of date because of it
125406
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
125407
+ continue;
125408
+ }
125409
+ // Check if tsbuildinfo path is shared, then we need to rebuild
125410
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
125011
125411
  return {
125012
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
125013
- version: buildInfo.version
125412
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125413
+ outOfDateOutputFileName: buildInfoPath,
125414
+ newerProjectName: ref.path
125014
125415
  };
125015
125416
  }
125417
+ // If the upstream project has only change .d.ts files, and we've built
125418
+ // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
125419
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
125420
+ pseudoUpToDate = true;
125421
+ upstreamChangedProject = ref.path;
125422
+ continue;
125423
+ }
125424
+ // We have an output older than an upstream output - we are out of date
125425
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125426
+ return {
125427
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125428
+ outOfDateOutputFileName: oldestOutputFileName,
125429
+ newerProjectName: ref.path
125430
+ };
125016
125431
  }
125017
125432
  }
125433
+ // Check tsconfig time
125434
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125435
+ if (configStatus)
125436
+ return configStatus;
125437
+ // Check extended config time
125438
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125439
+ if (extendedConfigStatus)
125440
+ return extendedConfigStatus;
125441
+ // Check package file time
125442
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125443
+ var path = _a[0];
125444
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125445
+ });
125446
+ if (dependentPackageFileStatus)
125447
+ return dependentPackageFileStatus;
125018
125448
  if (usesPrepend && pseudoUpToDate) {
125019
125449
  return {
125020
125450
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -125024,15 +125454,37 @@ var ts;
125024
125454
  }
125025
125455
  // Up to date
125026
125456
  return {
125027
- type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
125457
+ type: pseudoUpToDate ?
125458
+ ts.UpToDateStatusType.UpToDateWithUpstreamTypes :
125459
+ pseudoInputUptodate ?
125460
+ ts.UpToDateStatusType.UpToDateWithInputFileText :
125461
+ ts.UpToDateStatusType.UpToDate,
125028
125462
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
125029
125463
  newestInputFileTime: newestInputFileTime,
125030
- newestOutputFileTime: newestOutputFileTime,
125031
125464
  newestInputFileName: newestInputFileName,
125032
- newestOutputFileName: newestOutputFileName,
125033
125465
  oldestOutputFileName: oldestOutputFileName
125034
125466
  };
125035
125467
  }
125468
+ function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
125469
+ if (seenRefs.has(resolvedRefPath))
125470
+ return false;
125471
+ seenRefs.add(resolvedRefPath);
125472
+ var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
125473
+ if (refBuildInfo.path === buildInfoCacheEntry.path)
125474
+ return true;
125475
+ if (resolvedConfig.projectReferences) {
125476
+ // Check references
125477
+ for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
125478
+ var ref = _a[_i];
125479
+ var resolvedRef = ts.resolveProjectReferencePath(ref);
125480
+ var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
125481
+ var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
125482
+ if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
125483
+ return true;
125484
+ }
125485
+ }
125486
+ return false;
125487
+ }
125036
125488
  function getUpToDateStatus(state, project, resolvedPath) {
125037
125489
  if (project === undefined) {
125038
125490
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -125041,43 +125493,76 @@ var ts;
125041
125493
  if (prior !== undefined) {
125042
125494
  return prior;
125043
125495
  }
125496
+ ts.solutionPerformance.mark("beforeGetUpToDateStatus");
125044
125497
  var actual = getUpToDateStatusWorker(state, project, resolvedPath);
125498
+ ts.solutionPerformance.mark("afterGetUpToDateStatus");
125499
+ ts.solutionPerformance.measure("GetUpToDateStatus", "beforeGetUpToDateStatus", "afterGetUpToDateStatus");
125045
125500
  state.projectStatus.set(resolvedPath, actual);
125046
125501
  return actual;
125047
125502
  }
125048
- function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
125503
+ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
125049
125504
  if (proj.options.noEmit)
125050
- return priorNewestUpdateTime;
125051
- var host = state.host;
125052
- var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125053
- if (!skipOutputs || outputs.length !== skipOutputs.size) {
125054
- var reportVerbose = !!state.options.verbose;
125055
- var now = host.now ? host.now() : new Date();
125056
- for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125057
- var file = outputs_2[_i];
125058
- if (skipOutputs && skipOutputs.has(toPath(state, file))) {
125059
- continue;
125060
- }
125061
- if (reportVerbose) {
125062
- reportVerbose = false;
125505
+ return;
125506
+ var now;
125507
+ ts.solutionPerformance.mark("beforeUpdateOutputTimestamps");
125508
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
125509
+ if (buildInfoPath) {
125510
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
125511
+ if (!!state.options.verbose)
125063
125512
  reportStatus(state, verboseMessage, proj.options.configFilePath);
125513
+ state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
125514
+ getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
125515
+ }
125516
+ state.outputTimeStamps.delete(projectPath);
125517
+ }
125518
+ else {
125519
+ var host = state.host;
125520
+ var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125521
+ var outputTimeStampMap_1 = getOutputTimeStampMap(state, projectPath);
125522
+ var modifiedOutputs_1 = outputTimeStampMap_1 ? new ts.Set() : undefined;
125523
+ if (!skipOutputs || outputs.length !== skipOutputs.size) {
125524
+ var reportVerbose = !!state.options.verbose;
125525
+ for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125526
+ var file = outputs_2[_i];
125527
+ var path = toPath(state, file);
125528
+ if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
125529
+ continue;
125530
+ if (reportVerbose) {
125531
+ reportVerbose = false;
125532
+ reportStatus(state, verboseMessage, proj.options.configFilePath);
125533
+ }
125534
+ host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
125535
+ if (outputTimeStampMap_1) {
125536
+ outputTimeStampMap_1.set(path, now);
125537
+ modifiedOutputs_1.add(path);
125538
+ }
125064
125539
  }
125065
- if (ts.isDeclarationFileName(file)) {
125066
- priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
125067
- }
125068
- host.setModifiedTime(file, now);
125069
125540
  }
125541
+ // Clear out timestamps not in output list any more
125542
+ outputTimeStampMap_1 === null || outputTimeStampMap_1 === void 0 ? void 0 : outputTimeStampMap_1.forEach(function (_value, key) {
125543
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs_1.has(key))
125544
+ outputTimeStampMap_1.delete(key);
125545
+ });
125070
125546
  }
125071
- return priorNewestUpdateTime;
125547
+ ts.solutionPerformance.mark("afterUpdateOutputTimestamps");
125548
+ ts.solutionPerformance.measure("UpdateOutputTimestamps", "beforeUpdateOutputTimestamps", "afterUpdateOutputTimestamps");
125549
+ }
125550
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
125551
+ var _a;
125552
+ if (!options.composite)
125553
+ return undefined;
125554
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125555
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, /*modifiedTime*/ undefined);
125556
+ 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;
125072
125557
  }
125073
125558
  function updateOutputTimestamps(state, proj, resolvedPath) {
125074
125559
  if (state.options.dry) {
125075
125560
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
125076
125561
  }
125077
- var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125562
+ updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125078
125563
  state.projectStatus.set(resolvedPath, {
125079
125564
  type: ts.UpToDateStatusType.UpToDate,
125080
- newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
125565
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
125081
125566
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
125082
125567
  });
125083
125568
  }
@@ -125123,6 +125608,7 @@ var ts;
125123
125608
  break;
125124
125609
  }
125125
125610
  // falls through
125611
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
125126
125612
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125127
125613
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
125128
125614
  if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
@@ -125146,6 +125632,13 @@ var ts;
125146
125632
  }
125147
125633
  }
125148
125634
  function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
125635
+ ts.solutionPerformance.mark("beforeBuild");
125636
+ var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences);
125637
+ ts.solutionPerformance.mark("afterBuild");
125638
+ ts.solutionPerformance.measure("Build", "beforeBuild", "afterBuild");
125639
+ return result;
125640
+ }
125641
+ function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
125149
125642
  var buildOrder = getBuildOrderFor(state, project, onlyReferences);
125150
125643
  if (!buildOrder)
125151
125644
  return ts.ExitStatus.InvalidProject_OutputsSkipped;
@@ -125157,7 +125650,10 @@ var ts;
125157
125650
  if (!invalidatedProject)
125158
125651
  break;
125159
125652
  reportQueue = false;
125653
+ ts.solutionPerformance.mark("beforeInvalidatedProjectBuild");
125160
125654
  invalidatedProject.done(cancellationToken, writeFile, getCustomTransformers === null || getCustomTransformers === void 0 ? void 0 : getCustomTransformers(invalidatedProject.project));
125655
+ ts.solutionPerformance.mark("afterInvalidatedProjectBuild");
125656
+ ts.solutionPerformance.measure("InvalidatedProjectBuild", "beforeInvalidatedProjectBuild", "afterInvalidatedProjectBuild");
125161
125657
  if (!state.diagnostics.has(invalidatedProject.projectPath))
125162
125658
  successfulProjects++;
125163
125659
  }
@@ -125246,6 +125742,14 @@ var ts;
125246
125742
  state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
125247
125743
  }
125248
125744
  function buildNextInvalidatedProject(state, changeDetected) {
125745
+ ts.solutionPerformance.mark("beforeBuild");
125746
+ var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
125747
+ ts.solutionPerformance.mark("afterBuild");
125748
+ ts.solutionPerformance.measure("Build", "beforeBuild", "afterBuild");
125749
+ if (buildOrder)
125750
+ reportErrorSummary(state, buildOrder);
125751
+ }
125752
+ function buildNextInvalidatedProjectWorker(state, changeDetected) {
125249
125753
  state.timerToBuildInvalidatedProject = undefined;
125250
125754
  if (state.reportFileChangeDetected) {
125251
125755
  state.reportFileChangeDetected = false;
@@ -125256,7 +125760,10 @@ var ts;
125256
125760
  var buildOrder = getBuildOrder(state);
125257
125761
  var invalidatedProject = getNextInvalidatedProject(state, buildOrder, /*reportQueue*/ false);
125258
125762
  if (invalidatedProject) {
125763
+ ts.solutionPerformance.mark("beforeInvalidatedProjectBuild");
125259
125764
  invalidatedProject.done();
125765
+ ts.solutionPerformance.mark("afterInvalidatedProjectBuild");
125766
+ ts.solutionPerformance.measure("InvalidatedProjectBuild", "beforeInvalidatedProjectBuild", "afterInvalidatedProjectBuild");
125260
125767
  projectsBuilt++;
125261
125768
  while (state.projectPendingBuild.size) {
125262
125769
  // If already scheduled, skip
@@ -125272,23 +125779,24 @@ var ts;
125272
125779
  return;
125273
125780
  }
125274
125781
  var project = createInvalidatedProjectWithInfo(state, info, buildOrder);
125782
+ ts.solutionPerformance.mark("beforeInvalidatedProjectBuild");
125275
125783
  project.done();
125784
+ ts.solutionPerformance.mark("afterInvalidatedProjectBuild");
125785
+ ts.solutionPerformance.measure("InvalidatedProjectBuild", "beforeInvalidatedProjectBuild", "afterInvalidatedProjectBuild");
125276
125786
  if (info.kind !== InvalidatedProjectKind.UpdateOutputFileStamps)
125277
125787
  projectsBuilt++;
125278
125788
  }
125279
125789
  }
125280
125790
  disableCache(state);
125281
- reportErrorSummary(state, buildOrder);
125791
+ return buildOrder;
125282
125792
  }
125283
125793
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
125284
125794
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
125285
125795
  return;
125286
- state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
125287
- invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
125288
- }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
125796
+ 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));
125289
125797
  }
125290
125798
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
125291
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
125799
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
125292
125800
  var _a;
125293
125801
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
125294
125802
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -125320,7 +125828,7 @@ var ts;
125320
125828
  if (!state.watch)
125321
125829
  return;
125322
125830
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
125323
- 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); },
125831
+ 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); },
125324
125832
  onDeleteValue: ts.closeFileWatcher,
125325
125833
  });
125326
125834
  }
@@ -125328,13 +125836,14 @@ var ts;
125328
125836
  if (!state.watch || !state.lastCachedPackageJsonLookups)
125329
125837
  return;
125330
125838
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
125331
- 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); },
125839
+ 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); },
125332
125840
  onDeleteValue: ts.closeFileWatcher,
125333
125841
  });
125334
125842
  }
125335
125843
  function startWatching(state, buildOrder) {
125336
125844
  if (!state.watchAllProjectsPending)
125337
125845
  return;
125846
+ ts.solutionPerformance.mark("beforeStartWatching");
125338
125847
  state.watchAllProjectsPending = false;
125339
125848
  for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) {
125340
125849
  var resolved = _a[_i];
@@ -125352,6 +125861,8 @@ var ts;
125352
125861
  watchPackageJsonFiles(state, resolved, resolvedPath, cfg);
125353
125862
  }
125354
125863
  }
125864
+ ts.solutionPerformance.mark("afterStartWatching");
125865
+ ts.solutionPerformance.measure("StartWatching", "beforeStartWatching", "afterStartWatching");
125355
125866
  }
125356
125867
  function stopWatching(state) {
125357
125868
  ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher);
@@ -125458,19 +125969,18 @@ var ts;
125458
125969
  }
125459
125970
  }
125460
125971
  function reportUpToDateStatus(state, configFileName, status) {
125461
- if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
125462
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125463
- }
125464
125972
  switch (status.type) {
125465
125973
  case ts.UpToDateStatusType.OutOfDateWithSelf:
125466
- 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));
125974
+ 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));
125467
125975
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
125468
- 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));
125976
+ 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));
125469
125977
  case ts.UpToDateStatusType.OutputMissing:
125470
125978
  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));
125979
+ case ts.UpToDateStatusType.OutOfDateBuildInfo:
125980
+ 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));
125471
125981
  case ts.UpToDateStatusType.UpToDate:
125472
125982
  if (status.newestInputFileTime !== undefined) {
125473
- 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 || ""));
125983
+ 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 || ""));
125474
125984
  }
125475
125985
  // Don't report anything for "up to date because it was already built" -- too verbose
125476
125986
  break;
@@ -125478,6 +125988,8 @@ var ts;
125478
125988
  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));
125479
125989
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125480
125990
  return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
125991
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
125992
+ 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));
125481
125993
  case ts.UpToDateStatusType.UpstreamOutOfDate:
125482
125994
  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));
125483
125995
  case ts.UpToDateStatusType.UpstreamBlocked:
@@ -125488,6 +126000,8 @@ var ts;
125488
126000
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
125489
126001
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
125490
126002
  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);
126003
+ case ts.UpToDateStatusType.ForceBuild:
126004
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125491
126005
  case ts.UpToDateStatusType.ContainerOnly:
125492
126006
  // Don't report status on "solution" projects
125493
126007
  // falls through