@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.
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-insiders.20220525";
297
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220527";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -3704,16 +3704,34 @@ var ts;
3704
3704
  /** Performance measurements for the compiler. */
3705
3705
  var ts;
3706
3706
  (function (ts) {
3707
- var performance;
3708
- (function (performance) {
3707
+ var nullTimer = { enter: ts.noop, exit: ts.noop };
3708
+ ts.performance = createPerformanceTracker();
3709
+ ts.solutionPerformance = createPerformanceTracker();
3710
+ function createPerformanceTracker() {
3709
3711
  var perfHooks;
3710
3712
  // when set, indicates the implementation of `Performance` to use for user timing.
3711
3713
  // when unset, indicates user timing is unavailable or disabled.
3712
3714
  var performanceImpl;
3715
+ var enabled = false;
3716
+ var timeorigin = ts.timestamp();
3717
+ var marks = new ts.Map();
3718
+ var counts = new ts.Map();
3719
+ var durations = new ts.Map();
3720
+ return {
3721
+ createTimerIf: createTimerIf,
3722
+ createTimer: createTimer,
3723
+ mark: mark,
3724
+ measure: measure,
3725
+ getCount: getCount,
3726
+ getDuration: getDuration,
3727
+ forEachMeasure: forEachMeasure,
3728
+ isEnabled: isEnabled,
3729
+ enable: enable,
3730
+ disable: disable,
3731
+ };
3713
3732
  function createTimerIf(condition, measureName, startMarkName, endMarkName) {
3714
- return condition ? createTimer(measureName, startMarkName, endMarkName) : performance.nullTimer;
3733
+ return condition ? createTimer(measureName, startMarkName, endMarkName) : nullTimer;
3715
3734
  }
3716
- performance.createTimerIf = createTimerIf;
3717
3735
  function createTimer(measureName, startMarkName, endMarkName) {
3718
3736
  var enterCount = 0;
3719
3737
  return {
@@ -3735,13 +3753,6 @@ var ts;
3735
3753
  }
3736
3754
  }
3737
3755
  }
3738
- performance.createTimer = createTimer;
3739
- performance.nullTimer = { enter: ts.noop, exit: ts.noop };
3740
- var enabled = false;
3741
- var timeorigin = ts.timestamp();
3742
- var marks = new ts.Map();
3743
- var counts = new ts.Map();
3744
- var durations = new ts.Map();
3745
3756
  /**
3746
3757
  * Marks a performance event.
3747
3758
  *
@@ -3756,7 +3767,6 @@ var ts;
3756
3767
  performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.mark(markName);
3757
3768
  }
3758
3769
  }
3759
- performance.mark = mark;
3760
3770
  /**
3761
3771
  * Adds a performance measurement with the specified name.
3762
3772
  *
@@ -3769,14 +3779,13 @@ var ts;
3769
3779
  function measure(measureName, startMarkName, endMarkName) {
3770
3780
  var _a, _b;
3771
3781
  if (enabled) {
3772
- var end = (_a = (endMarkName !== undefined ? marks.get(endMarkName) : undefined)) !== null && _a !== void 0 ? _a : ts.timestamp();
3773
- var start = (_b = (startMarkName !== undefined ? marks.get(startMarkName) : undefined)) !== null && _b !== void 0 ? _b : timeorigin;
3782
+ var end = (_a = marks.get(endMarkName)) !== null && _a !== void 0 ? _a : ts.timestamp();
3783
+ var start = (_b = marks.get(startMarkName)) !== null && _b !== void 0 ? _b : timeorigin;
3774
3784
  var previousDuration = durations.get(measureName) || 0;
3775
3785
  durations.set(measureName, previousDuration + (end - start));
3776
3786
  performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.measure(measureName, startMarkName, endMarkName);
3777
3787
  }
3778
3788
  }
3779
- performance.measure = measure;
3780
3789
  /**
3781
3790
  * Gets the number of times a marker was encountered.
3782
3791
  *
@@ -3785,7 +3794,6 @@ var ts;
3785
3794
  function getCount(markName) {
3786
3795
  return counts.get(markName) || 0;
3787
3796
  }
3788
- performance.getCount = getCount;
3789
3797
  /**
3790
3798
  * Gets the total duration of all measurements with the supplied name.
3791
3799
  *
@@ -3794,7 +3802,6 @@ var ts;
3794
3802
  function getDuration(measureName) {
3795
3803
  return durations.get(measureName) || 0;
3796
3804
  }
3797
- performance.getDuration = getDuration;
3798
3805
  /**
3799
3806
  * Iterate over each measure, performing some action
3800
3807
  *
@@ -3803,14 +3810,12 @@ var ts;
3803
3810
  function forEachMeasure(cb) {
3804
3811
  durations.forEach(function (duration, measureName) { return cb(measureName, duration); });
3805
3812
  }
3806
- performance.forEachMeasure = forEachMeasure;
3807
3813
  /**
3808
3814
  * Indicates whether the performance API is enabled.
3809
3815
  */
3810
3816
  function isEnabled() {
3811
3817
  return enabled;
3812
3818
  }
3813
- performance.isEnabled = isEnabled;
3814
3819
  /** Enables (and resets) performance measurements for the compiler. */
3815
3820
  function enable(system) {
3816
3821
  var _a;
@@ -3831,7 +3836,6 @@ var ts;
3831
3836
  }
3832
3837
  return true;
3833
3838
  }
3834
- performance.enable = enable;
3835
3839
  /** Disables performance measurements for the compiler. */
3836
3840
  function disable() {
3837
3841
  if (enabled) {
@@ -3842,8 +3846,7 @@ var ts;
3842
3846
  enabled = false;
3843
3847
  }
3844
3848
  }
3845
- performance.disable = disable;
3846
- })(performance = ts.performance || (ts.performance = {}));
3849
+ }
3847
3850
  })(ts || (ts = {}));
3848
3851
  /* @internal */
3849
3852
  var ts;
@@ -6386,7 +6389,7 @@ var ts;
6386
6389
  };
6387
6390
  }
6388
6391
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
6389
- var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName) {
6392
+ var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName, modifiedTime) {
6390
6393
  // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
6391
6394
  if (!ts.isString(relativeFileName))
6392
6395
  return;
@@ -6396,7 +6399,7 @@ var ts;
6396
6399
  if (callbacks) {
6397
6400
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
6398
6401
  var fileCallback = callbacks_1[_i];
6399
- fileCallback(fileName, FileWatcherEventKind.Changed);
6402
+ fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6400
6403
  }
6401
6404
  }
6402
6405
  },
@@ -6450,7 +6453,7 @@ var ts;
6450
6453
  }
6451
6454
  else {
6452
6455
  cache.set(path, {
6453
- watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
6456
+ watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6454
6457
  refCount: 1
6455
6458
  });
6456
6459
  }
@@ -6478,7 +6481,7 @@ var ts;
6478
6481
  var newTime = modifiedTime.getTime();
6479
6482
  if (oldTime !== newTime) {
6480
6483
  watchedFile.mtime = modifiedTime;
6481
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
6484
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
6482
6485
  return true;
6483
6486
  }
6484
6487
  return false;
@@ -6513,7 +6516,7 @@ var ts;
6513
6516
  */
6514
6517
  /*@internal*/
6515
6518
  function createDirectoryWatcherSupportingRecursive(_a) {
6516
- 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;
6519
+ 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;
6517
6520
  var cache = new ts.Map();
6518
6521
  var callbackCache = ts.createMultiMap();
6519
6522
  var cacheToUpdateChildWatches = new ts.Map();
@@ -6613,7 +6616,7 @@ var ts;
6613
6616
  function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
6614
6617
  // Iterate through existing children and update the watches if needed
6615
6618
  var parentWatcher = cache.get(dirPath);
6616
- if (parentWatcher && fileSystemEntryExists(dirName, 1 /* Directory */)) {
6619
+ if (parentWatcher && directoryExists(dirName)) {
6617
6620
  // Schedule the update and postpone invoke for callbacks
6618
6621
  scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
6619
6622
  return;
@@ -6686,7 +6689,7 @@ var ts;
6686
6689
  if (!parentWatcher)
6687
6690
  return false;
6688
6691
  var newChildWatches;
6689
- var hasChanges = ts.enumerateInsertsAndDeletes(fileSystemEntryExists(parentDir, 1 /* Directory */) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
6692
+ var hasChanges = ts.enumerateInsertsAndDeletes(directoryExists(parentDir) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
6690
6693
  var childFullName = ts.getNormalizedAbsolutePath(child, parentDir);
6691
6694
  // Filter our the symbolic link directories since those arent included in recursive watch
6692
6695
  // which is same behaviour when recursive: true is passed to fs.watch
@@ -6729,17 +6732,18 @@ var ts;
6729
6732
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6730
6733
  /*@internal*/
6731
6734
  function createFileWatcherCallback(callback) {
6732
- return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
6735
+ return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6733
6736
  }
6734
6737
  ts.createFileWatcherCallback = createFileWatcherCallback;
6735
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileSystemEntryExists) {
6736
- return function (eventName) {
6738
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6739
+ return function (eventName, _relativeFileName, modifiedTime) {
6737
6740
  if (eventName === "rename") {
6738
- callback(fileName, fileSystemEntryExists(fileName, 0 /* File */) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6741
+ modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
6742
+ callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
6739
6743
  }
6740
6744
  else {
6741
6745
  // Change
6742
- callback(fileName, FileWatcherEventKind.Changed);
6746
+ callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6743
6747
  }
6744
6748
  };
6745
6749
  }
@@ -6763,12 +6767,11 @@ var ts;
6763
6767
  }
6764
6768
  /*@internal*/
6765
6769
  function createSystemWatchFunctions(_a) {
6766
- 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;
6770
+ 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;
6767
6771
  var dynamicPollingWatchFile;
6768
6772
  var fixedChunkSizePollingWatchFile;
6769
6773
  var nonPollingWatchFile;
6770
6774
  var hostRecursiveDirectoryWatcher;
6771
- var hitSystemWatcherLimit = false;
6772
6775
  return {
6773
6776
  watchFile: watchFile,
6774
6777
  watchDirectory: watchDirectory
@@ -6786,7 +6789,7 @@ var ts;
6786
6789
  case ts.WatchFileKind.FixedChunkSizePolling:
6787
6790
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, /* pollingInterval */ undefined, /*options*/ undefined);
6788
6791
  case ts.WatchFileKind.UseFsEvents:
6789
- return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileSystemEntryExists),
6792
+ return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime),
6790
6793
  /*recursive*/ false, pollingInterval, ts.getFallbackOptions(options));
6791
6794
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
6792
6795
  if (!nonPollingWatchFile) {
@@ -6847,7 +6850,7 @@ var ts;
6847
6850
  hostRecursiveDirectoryWatcher = createDirectoryWatcherSupportingRecursive({
6848
6851
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6849
6852
  getCurrentDirectory: getCurrentDirectory,
6850
- fileSystemEntryExists: fileSystemEntryExists,
6853
+ directoryExists: directoryExists,
6851
6854
  getAccessibleSortedChildDirectories: getAccessibleSortedChildDirectories,
6852
6855
  watchDirectory: nonRecursiveWatchDirectory,
6853
6856
  realpath: realpath,
@@ -6898,114 +6901,6 @@ var ts;
6898
6901
  };
6899
6902
  }
6900
6903
  }
6901
- function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
6902
- var lastDirectoryPartWithDirectorySeparator;
6903
- var lastDirectoryPart;
6904
- if (inodeWatching) {
6905
- lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substring(fileOrDirectory.lastIndexOf(ts.directorySeparator));
6906
- lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
6907
- }
6908
- /** Watcher for the file system entry depending on whether it is missing or present */
6909
- var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
6910
- watchMissingFileSystemEntry() :
6911
- watchPresentFileSystemEntry();
6912
- return {
6913
- close: function () {
6914
- // Close the watcher (either existing file system entry watcher or missing file system entry watcher)
6915
- watcher.close();
6916
- watcher = undefined;
6917
- }
6918
- };
6919
- function updateWatcher(createWatcher) {
6920
- // If watcher is not closed, update it
6921
- if (watcher) {
6922
- sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
6923
- watcher.close();
6924
- watcher = createWatcher();
6925
- }
6926
- }
6927
- /**
6928
- * Watch the file or directory that is currently present
6929
- * and when the watched file or directory is deleted, switch to missing file system entry watcher
6930
- */
6931
- function watchPresentFileSystemEntry() {
6932
- if (hitSystemWatcherLimit) {
6933
- sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to watchFile");
6934
- return watchPresentFileSystemEntryWithFsWatchFile();
6935
- }
6936
- try {
6937
- var presentWatcher = fsWatchWorker(fileOrDirectory, recursive, inodeWatching ?
6938
- callbackChangingToMissingFileSystemEntry :
6939
- function (eventName, relativeFileName) {
6940
- sysLog("sysLog:: watchPresentFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + eventName + ":: " + relativeFileName);
6941
- callback(eventName, relativeFileName);
6942
- });
6943
- // Watch the missing file or directory or error
6944
- presentWatcher.on("error", function () {
6945
- sysLog("sysLog:: watchPresentFileSystemEntry:: on Error " + fileOrDirectory + " " + entryKind + " rename, \"\"");
6946
- callback("rename", "");
6947
- updateWatcher(watchMissingFileSystemEntry);
6948
- });
6949
- return presentWatcher;
6950
- }
6951
- catch (e) {
6952
- // Catch the exception and use polling instead
6953
- // 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
6954
- // so instead of throwing error, use fs.watchFile
6955
- hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
6956
- sysLog("sysLog:: " + fileOrDirectory + ":: Changing to watchFile");
6957
- return watchPresentFileSystemEntryWithFsWatchFile();
6958
- }
6959
- }
6960
- function callbackChangingToMissingFileSystemEntry(event, relativeName) {
6961
- sysLog("sysLog:: callbackChangingToMissingFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + event + ":: " + relativeName + " " + inodeWatching + " " + lastDirectoryPart + " " + lastDirectoryPartWithDirectorySeparator);
6962
- if (relativeName && ts.endsWith(relativeName, "~")) {
6963
- relativeName = relativeName.slice(0, relativeName.length - 1);
6964
- sysLog("sysLog:: callbackChangingToMissingFileSystemEntry:: changed the relative name to " + relativeName);
6965
- }
6966
- callback(event, relativeName);
6967
- // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
6968
- // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
6969
- if (event === "rename" &&
6970
- (!relativeName ||
6971
- relativeName === lastDirectoryPart ||
6972
- ts.endsWith(relativeName, lastDirectoryPartWithDirectorySeparator))) {
6973
- if (inodeWatching) {
6974
- updateWatcher(!fileSystemEntryExists(fileOrDirectory, entryKind) ? watchMissingFileSystemEntry : watchPresentFileSystemEntry);
6975
- }
6976
- else if (!fileSystemEntryExists(fileOrDirectory, entryKind)) {
6977
- updateWatcher(watchMissingFileSystemEntry);
6978
- }
6979
- }
6980
- }
6981
- /**
6982
- * Watch the file or directory using fs.watchFile since fs.watch threw exception
6983
- * 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
6984
- */
6985
- function watchPresentFileSystemEntryWithFsWatchFile() {
6986
- return watchFile(fileOrDirectory, createFileWatcherCallback(function (eventName, relativeFileName) {
6987
- sysLog("sysLog:: watchPresentFileSystemEntryWithFsWatchFile:: " + fileOrDirectory + " " + entryKind + " " + eventName + ":: " + relativeFileName);
6988
- callback(eventName, relativeFileName);
6989
- }), fallbackPollingInterval, fallbackOptions);
6990
- }
6991
- /**
6992
- * Watch the file or directory that is missing
6993
- * and switch to existing file or directory when the missing filesystem entry is created
6994
- */
6995
- function watchMissingFileSystemEntry() {
6996
- return watchFile(fileOrDirectory, function (_fileName, eventKind) {
6997
- sysLog("sysLog:: watchMissingFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + _fileName + ":: " + eventKind);
6998
- if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
6999
- sysLog("sysLog:: watchMissingFileSystemEntry:: Callback :: rename, \"\" and will update the watcher");
7000
- callback("rename", "");
7001
- // Call the callback for current file or directory
7002
- // For now it could be callback for the inner directory creation,
7003
- // but just return current directory, better than current no-op
7004
- updateWatcher(watchPresentFileSystemEntry);
7005
- }
7006
- }, fallbackPollingInterval, fallbackOptions);
7007
- }
7008
- }
7009
6904
  }
7010
6905
  ts.createSystemWatchFunctions = createSystemWatchFunctions;
7011
6906
  /**
@@ -7058,6 +6953,7 @@ var ts;
7058
6953
  }
7059
6954
  var activeSession;
7060
6955
  var profilePath = "./profile.cpuprofile";
6956
+ var hitSystemWatcherLimit = false;
7061
6957
  var Buffer = require("buffer").Buffer;
7062
6958
  var nodeVersion = getNodeMajorVersion();
7063
6959
  var isNode4OrLater = nodeVersion >= 4;
@@ -7072,21 +6968,19 @@ var ts;
7072
6968
  getModifiedTime: getModifiedTime,
7073
6969
  setTimeout: setTimeout,
7074
6970
  clearTimeout: clearTimeout,
7075
- fsWatchWorker: fsWatchWorker,
6971
+ fsWatch: fsWatch,
7076
6972
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
7077
6973
  getCurrentDirectory: getCurrentDirectory,
7078
- fileSystemEntryExists: fileSystemEntryExists,
7079
6974
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
7080
6975
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
7081
6976
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
6977
+ directoryExists: directoryExists,
7082
6978
  getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; },
7083
6979
  realpath: realpath,
7084
6980
  tscWatchFile: process.env.TSC_WATCHFILE,
7085
6981
  useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
7086
6982
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
7087
6983
  defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
7088
- inodeWatching: isLinuxOrMacOs,
7089
- sysLog: sysLog,
7090
6984
  }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
7091
6985
  var nodeSystem = {
7092
6986
  args: process.argv.slice(2),
@@ -7336,14 +7230,114 @@ var ts;
7336
7230
  // File changed
7337
7231
  eventKind = FileWatcherEventKind.Changed;
7338
7232
  }
7339
- callback(fileName, eventKind);
7233
+ callback(fileName, eventKind, curr.mtime);
7340
7234
  }
7341
7235
  }
7342
- function fsWatchWorker(fileOrDirectory, recursive, callback) {
7343
- // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
7344
- // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
7345
- return _fs.watch(fileOrDirectory, fsSupportsRecursiveFsWatch ?
7346
- { persistent: true, recursive: !!recursive } : { persistent: true }, callback);
7236
+ function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
7237
+ var options;
7238
+ var lastDirectoryPartWithDirectorySeparator;
7239
+ var lastDirectoryPart;
7240
+ if (isLinuxOrMacOs) {
7241
+ lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
7242
+ lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
7243
+ }
7244
+ /** Watcher for the file system entry depending on whether it is missing or present */
7245
+ var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7246
+ watchMissingFileSystemEntry() :
7247
+ watchPresentFileSystemEntry();
7248
+ return {
7249
+ close: function () {
7250
+ // Close the watcher (either existing file system entry watcher or missing file system entry watcher)
7251
+ watcher.close();
7252
+ watcher = undefined;
7253
+ }
7254
+ };
7255
+ /**
7256
+ * Invoke the callback with rename and update the watcher if not closed
7257
+ * @param createWatcher
7258
+ */
7259
+ function invokeCallbackAndUpdateWatcher(createWatcher, modifiedTime) {
7260
+ sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
7261
+ // Call the callback for current directory
7262
+ callback("rename", "", modifiedTime);
7263
+ // If watcher is not closed, update it
7264
+ if (watcher) {
7265
+ watcher.close();
7266
+ watcher = createWatcher();
7267
+ }
7268
+ }
7269
+ /**
7270
+ * Watch the file or directory that is currently present
7271
+ * and when the watched file or directory is deleted, switch to missing file system entry watcher
7272
+ */
7273
+ function watchPresentFileSystemEntry() {
7274
+ // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
7275
+ // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
7276
+ if (options === undefined) {
7277
+ if (fsSupportsRecursiveFsWatch) {
7278
+ options = { persistent: true, recursive: !!recursive };
7279
+ }
7280
+ else {
7281
+ options = { persistent: true };
7282
+ }
7283
+ }
7284
+ if (hitSystemWatcherLimit) {
7285
+ sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to fsWatchFile");
7286
+ return watchPresentFileSystemEntryWithFsWatchFile();
7287
+ }
7288
+ try {
7289
+ var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
7290
+ callbackChangingToMissingFileSystemEntry :
7291
+ callback);
7292
+ // Watch the missing file or directory or error
7293
+ presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
7294
+ return presentWatcher;
7295
+ }
7296
+ catch (e) {
7297
+ // Catch the exception and use polling instead
7298
+ // 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
7299
+ // so instead of throwing error, use fs.watchFile
7300
+ hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
7301
+ sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
7302
+ return watchPresentFileSystemEntryWithFsWatchFile();
7303
+ }
7304
+ }
7305
+ function callbackChangingToMissingFileSystemEntry(event, relativeName) {
7306
+ // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
7307
+ // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
7308
+ var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
7309
+ return event === "rename" &&
7310
+ (!relativeName ||
7311
+ relativeName === lastDirectoryPart ||
7312
+ (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
7313
+ modifiedTime === ts.missingFileModifiedTime ?
7314
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry, modifiedTime) :
7315
+ callback(event, relativeName, modifiedTime);
7316
+ }
7317
+ /**
7318
+ * Watch the file or directory using fs.watchFile since fs.watch threw exception
7319
+ * 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
7320
+ */
7321
+ function watchPresentFileSystemEntryWithFsWatchFile() {
7322
+ return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions);
7323
+ }
7324
+ /**
7325
+ * Watch the file or directory that is missing
7326
+ * and switch to existing file or directory when the missing filesystem entry is created
7327
+ */
7328
+ function watchMissingFileSystemEntry() {
7329
+ return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
7330
+ if (eventKind === FileWatcherEventKind.Created) {
7331
+ modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
7332
+ if (modifiedTime !== ts.missingFileModifiedTime) {
7333
+ // Call the callback for current file or directory
7334
+ // For now it could be callback for the inner directory creation,
7335
+ // but just return current directory, better than current no-op
7336
+ invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry, modifiedTime);
7337
+ }
7338
+ }
7339
+ }, fallbackPollingInterval, fallbackOptions);
7340
+ }
7347
7341
  }
7348
7342
  function readFileWorker(fileName, _encoding) {
7349
7343
  var buffer;
@@ -7490,12 +7484,19 @@ var ts;
7490
7484
  }
7491
7485
  function getModifiedTime(path) {
7492
7486
  var _a;
7487
+ // Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
7488
+ // the CPU time performance.
7489
+ var originalStackTraceLimit = Error.stackTraceLimit;
7490
+ Error.stackTraceLimit = 0;
7493
7491
  try {
7494
7492
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
7495
7493
  }
7496
7494
  catch (e) {
7497
7495
  return undefined;
7498
7496
  }
7497
+ finally {
7498
+ Error.stackTraceLimit = originalStackTraceLimit;
7499
+ }
7499
7500
  }
7500
7501
  function setModifiedTime(path, time) {
7501
7502
  try {
@@ -9516,8 +9517,8 @@ var ts;
9516
9517
  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"),
9517
9518
  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"),
9518
9519
  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."),
9519
- 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}'"),
9520
- 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}'"),
9520
+ 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}'"),
9521
+ 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}'"),
9521
9522
  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"),
9522
9523
  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"),
9523
9524
  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"),
@@ -9561,6 +9562,8 @@ var ts;
9561
9562
  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}'."),
9562
9563
  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}'."),
9563
9564
  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."),
9565
+ 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"),
9566
+ 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"),
9564
9567
  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}'"),
9565
9568
  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."),
9566
9569
  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."),
@@ -16425,9 +16428,6 @@ var ts;
16425
16428
  }
16426
16429
  ts.isVariableDeclarationInitializedToBareOrAccessedRequire = isVariableDeclarationInitializedToBareOrAccessedRequire;
16427
16430
  function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) {
16428
- if (node.kind === 203 /* BindingElement */) {
16429
- node = node.parent.parent;
16430
- }
16431
16431
  return ts.isVariableDeclaration(node) &&
16432
16432
  !!node.initializer &&
16433
16433
  isRequireCall(allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, /*requireStringLiteralLikeArgument*/ true);
@@ -20239,8 +20239,9 @@ var ts;
20239
20239
  */
20240
20240
  function isFileForcedToBeModuleByFormat(file) {
20241
20241
  // Excludes declaration files - they still require an explicit `export {}` or the like
20242
- // for back compat purposes.
20243
- return file.impliedNodeFormat === ts.ModuleKind.ESNext && !file.isDeclarationFile ? true : undefined;
20242
+ // for back compat purposes. The only non-declaration files _not_ forced to be a module are `.js` files
20243
+ // that aren't esm-mode (meaning not in a `type: module` scope).
20244
+ return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) && !file.isDeclarationFile ? true : undefined;
20244
20245
  }
20245
20246
  function getSetExternalModuleIndicator(options) {
20246
20247
  // TODO: Should this callback be cached?
@@ -20248,7 +20249,7 @@ var ts;
20248
20249
  case ts.ModuleDetectionKind.Force:
20249
20250
  // All non-declaration files are modules, declaration files still do the usual isFileProbablyExternalModule
20250
20251
  return function (file) {
20251
- file.externalModuleIndicator = !file.isDeclarationFile || ts.isFileProbablyExternalModule(file);
20252
+ file.externalModuleIndicator = ts.isFileProbablyExternalModule(file) || !file.isDeclarationFile || undefined;
20252
20253
  };
20253
20254
  case ts.ModuleDetectionKind.Legacy:
20254
20255
  // Files are modules if they have imports, exports, or import.meta
@@ -20308,7 +20309,8 @@ var ts;
20308
20309
  }
20309
20310
  ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
20310
20311
  function getEmitModuleDetectionKind(options) {
20311
- return options.moduleDetection || ts.ModuleDetectionKind.Auto;
20312
+ return options.moduleDetection ||
20313
+ (getEmitModuleKind(options) === ts.ModuleKind.Node16 || getEmitModuleKind(options) === ts.ModuleKind.NodeNext ? ts.ModuleDetectionKind.Force : ts.ModuleDetectionKind.Auto);
20312
20314
  }
20313
20315
  ts.getEmitModuleDetectionKind = getEmitModuleDetectionKind;
20314
20316
  function hasJsonModuleEmitEnabled(options) {
@@ -20391,6 +20393,10 @@ var ts;
20391
20393
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
20392
20394
  }
20393
20395
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
20396
+ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
20397
+ return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
20398
+ }
20399
+ ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
20394
20400
  function getCompilerOptionValue(options, option) {
20395
20401
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
20396
20402
  }
@@ -39431,6 +39437,7 @@ var ts;
39431
39437
  type: "boolean",
39432
39438
  affectsSemanticDiagnostics: true,
39433
39439
  affectsEmit: true,
39440
+ affectsMultiFileEmitBuildInfo: true,
39434
39441
  category: ts.Diagnostics.Watch_and_Build_Modes,
39435
39442
  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,
39436
39443
  defaultValueDescription: false,
@@ -39465,12 +39472,40 @@ var ts;
39465
39472
  affectsSourceFile: true,
39466
39473
  affectsModuleResolution: true,
39467
39474
  affectsEmit: true,
39475
+ affectsMultiFileEmitBuildInfo: true,
39468
39476
  paramType: ts.Diagnostics.VERSION,
39469
39477
  showInSimplifiedHelpView: true,
39470
39478
  category: ts.Diagnostics.Language_and_Environment,
39471
39479
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
39472
39480
  defaultValueDescription: 0 /* ES3 */,
39473
39481
  };
39482
+ /*@internal*/
39483
+ ts.moduleOptionDeclaration = {
39484
+ name: "module",
39485
+ shortName: "m",
39486
+ type: new ts.Map(ts.getEntries({
39487
+ none: ts.ModuleKind.None,
39488
+ commonjs: ts.ModuleKind.CommonJS,
39489
+ amd: ts.ModuleKind.AMD,
39490
+ system: ts.ModuleKind.System,
39491
+ umd: ts.ModuleKind.UMD,
39492
+ es6: ts.ModuleKind.ES2015,
39493
+ es2015: ts.ModuleKind.ES2015,
39494
+ es2020: ts.ModuleKind.ES2020,
39495
+ es2022: ts.ModuleKind.ES2022,
39496
+ esnext: ts.ModuleKind.ESNext,
39497
+ node16: ts.ModuleKind.Node16,
39498
+ nodenext: ts.ModuleKind.NodeNext,
39499
+ })),
39500
+ affectsModuleResolution: true,
39501
+ affectsEmit: true,
39502
+ affectsMultiFileEmitBuildInfo: true,
39503
+ paramType: ts.Diagnostics.KIND,
39504
+ showInSimplifiedHelpView: true,
39505
+ category: ts.Diagnostics.Modules,
39506
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
39507
+ defaultValueDescription: undefined,
39508
+ };
39474
39509
  var commandOptionsWithoutBuild = [
39475
39510
  // CommandLine only options
39476
39511
  {
@@ -39532,37 +39567,14 @@ var ts;
39532
39567
  category: ts.Diagnostics.Command_line_Options,
39533
39568
  affectsSemanticDiagnostics: true,
39534
39569
  affectsEmit: true,
39570
+ affectsMultiFileEmitBuildInfo: true,
39535
39571
  isCommandLineOnly: true,
39536
39572
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
39537
39573
  defaultValueDescription: false,
39538
39574
  },
39539
39575
  // Basic
39540
39576
  ts.targetOptionDeclaration,
39541
- {
39542
- name: "module",
39543
- shortName: "m",
39544
- type: new ts.Map(ts.getEntries({
39545
- none: ts.ModuleKind.None,
39546
- commonjs: ts.ModuleKind.CommonJS,
39547
- amd: ts.ModuleKind.AMD,
39548
- system: ts.ModuleKind.System,
39549
- umd: ts.ModuleKind.UMD,
39550
- es6: ts.ModuleKind.ES2015,
39551
- es2015: ts.ModuleKind.ES2015,
39552
- es2020: ts.ModuleKind.ES2020,
39553
- es2022: ts.ModuleKind.ES2022,
39554
- esnext: ts.ModuleKind.ESNext,
39555
- node16: ts.ModuleKind.Node16,
39556
- nodenext: ts.ModuleKind.NodeNext,
39557
- })),
39558
- affectsModuleResolution: true,
39559
- affectsEmit: true,
39560
- paramType: ts.Diagnostics.KIND,
39561
- showInSimplifiedHelpView: true,
39562
- category: ts.Diagnostics.Modules,
39563
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
39564
- defaultValueDescription: undefined,
39565
- },
39577
+ ts.moduleOptionDeclaration,
39566
39578
  {
39567
39579
  name: "lib",
39568
39580
  type: "list",
@@ -39599,6 +39611,7 @@ var ts;
39599
39611
  type: jsxOptionMap,
39600
39612
  affectsSourceFile: true,
39601
39613
  affectsEmit: true,
39614
+ affectsMultiFileEmitBuildInfo: true,
39602
39615
  affectsModuleResolution: true,
39603
39616
  paramType: ts.Diagnostics.KIND,
39604
39617
  showInSimplifiedHelpView: true,
@@ -39611,6 +39624,7 @@ var ts;
39611
39624
  shortName: "d",
39612
39625
  type: "boolean",
39613
39626
  affectsEmit: true,
39627
+ affectsMultiFileEmitBuildInfo: true,
39614
39628
  showInSimplifiedHelpView: true,
39615
39629
  category: ts.Diagnostics.Emit,
39616
39630
  transpileOptionValue: undefined,
@@ -39621,6 +39635,7 @@ var ts;
39621
39635
  name: "declarationMap",
39622
39636
  type: "boolean",
39623
39637
  affectsEmit: true,
39638
+ affectsMultiFileEmitBuildInfo: true,
39624
39639
  showInSimplifiedHelpView: true,
39625
39640
  category: ts.Diagnostics.Emit,
39626
39641
  transpileOptionValue: undefined,
@@ -39631,6 +39646,7 @@ var ts;
39631
39646
  name: "emitDeclarationOnly",
39632
39647
  type: "boolean",
39633
39648
  affectsEmit: true,
39649
+ affectsMultiFileEmitBuildInfo: true,
39634
39650
  showInSimplifiedHelpView: true,
39635
39651
  category: ts.Diagnostics.Emit,
39636
39652
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -39641,6 +39657,7 @@ var ts;
39641
39657
  name: "sourceMap",
39642
39658
  type: "boolean",
39643
39659
  affectsEmit: true,
39660
+ affectsMultiFileEmitBuildInfo: true,
39644
39661
  showInSimplifiedHelpView: true,
39645
39662
  category: ts.Diagnostics.Emit,
39646
39663
  defaultValueDescription: false,
@@ -39650,6 +39667,9 @@ var ts;
39650
39667
  name: "outFile",
39651
39668
  type: "string",
39652
39669
  affectsEmit: true,
39670
+ affectsMultiFileEmitBuildInfo: true,
39671
+ affectsDeclarationPath: true,
39672
+ affectsBundleEmitBuildInfo: true,
39653
39673
  isFilePath: true,
39654
39674
  paramType: ts.Diagnostics.FILE,
39655
39675
  showInSimplifiedHelpView: true,
@@ -39661,6 +39681,8 @@ var ts;
39661
39681
  name: "outDir",
39662
39682
  type: "string",
39663
39683
  affectsEmit: true,
39684
+ affectsMultiFileEmitBuildInfo: true,
39685
+ affectsDeclarationPath: true,
39664
39686
  isFilePath: true,
39665
39687
  paramType: ts.Diagnostics.DIRECTORY,
39666
39688
  showInSimplifiedHelpView: true,
@@ -39671,6 +39693,8 @@ var ts;
39671
39693
  name: "rootDir",
39672
39694
  type: "string",
39673
39695
  affectsEmit: true,
39696
+ affectsMultiFileEmitBuildInfo: true,
39697
+ affectsDeclarationPath: true,
39674
39698
  isFilePath: true,
39675
39699
  paramType: ts.Diagnostics.LOCATION,
39676
39700
  category: ts.Diagnostics.Modules,
@@ -39681,6 +39705,8 @@ var ts;
39681
39705
  name: "composite",
39682
39706
  type: "boolean",
39683
39707
  affectsEmit: true,
39708
+ affectsMultiFileEmitBuildInfo: true,
39709
+ affectsBundleEmitBuildInfo: true,
39684
39710
  isTSConfigOnly: true,
39685
39711
  category: ts.Diagnostics.Projects,
39686
39712
  transpileOptionValue: undefined,
@@ -39691,6 +39717,8 @@ var ts;
39691
39717
  name: "tsBuildInfoFile",
39692
39718
  type: "string",
39693
39719
  affectsEmit: true,
39720
+ affectsMultiFileEmitBuildInfo: true,
39721
+ affectsBundleEmitBuildInfo: true,
39694
39722
  isFilePath: true,
39695
39723
  paramType: ts.Diagnostics.FILE,
39696
39724
  category: ts.Diagnostics.Projects,
@@ -39702,6 +39730,7 @@ var ts;
39702
39730
  name: "removeComments",
39703
39731
  type: "boolean",
39704
39732
  affectsEmit: true,
39733
+ affectsMultiFileEmitBuildInfo: true,
39705
39734
  showInSimplifiedHelpView: true,
39706
39735
  category: ts.Diagnostics.Emit,
39707
39736
  defaultValueDescription: false,
@@ -39720,6 +39749,7 @@ var ts;
39720
39749
  name: "importHelpers",
39721
39750
  type: "boolean",
39722
39751
  affectsEmit: true,
39752
+ affectsMultiFileEmitBuildInfo: true,
39723
39753
  category: ts.Diagnostics.Emit,
39724
39754
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
39725
39755
  defaultValueDescription: false,
@@ -39733,6 +39763,7 @@ var ts;
39733
39763
  })),
39734
39764
  affectsEmit: true,
39735
39765
  affectsSemanticDiagnostics: true,
39766
+ affectsMultiFileEmitBuildInfo: true,
39736
39767
  category: ts.Diagnostics.Emit,
39737
39768
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
39738
39769
  defaultValueDescription: 0 /* Remove */,
@@ -39741,6 +39772,7 @@ var ts;
39741
39772
  name: "downlevelIteration",
39742
39773
  type: "boolean",
39743
39774
  affectsEmit: true,
39775
+ affectsMultiFileEmitBuildInfo: true,
39744
39776
  category: ts.Diagnostics.Emit,
39745
39777
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
39746
39778
  defaultValueDescription: false,
@@ -39759,6 +39791,9 @@ var ts;
39759
39791
  type: "boolean",
39760
39792
  // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
39761
39793
  // The value of each strictFlag depends on own strictFlag value or this and never accessed directly.
39794
+ // But we need to store `strict` in builf info, even though it won't be examined directly, so that the
39795
+ // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly
39796
+ affectsMultiFileEmitBuildInfo: true,
39762
39797
  showInSimplifiedHelpView: true,
39763
39798
  category: ts.Diagnostics.Type_Checking,
39764
39799
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -39768,6 +39803,7 @@ var ts;
39768
39803
  name: "noImplicitAny",
39769
39804
  type: "boolean",
39770
39805
  affectsSemanticDiagnostics: true,
39806
+ affectsMultiFileEmitBuildInfo: true,
39771
39807
  strictFlag: true,
39772
39808
  category: ts.Diagnostics.Type_Checking,
39773
39809
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -39777,6 +39813,7 @@ var ts;
39777
39813
  name: "strictNullChecks",
39778
39814
  type: "boolean",
39779
39815
  affectsSemanticDiagnostics: true,
39816
+ affectsMultiFileEmitBuildInfo: true,
39780
39817
  strictFlag: true,
39781
39818
  category: ts.Diagnostics.Type_Checking,
39782
39819
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -39785,6 +39822,8 @@ var ts;
39785
39822
  {
39786
39823
  name: "strictFunctionTypes",
39787
39824
  type: "boolean",
39825
+ affectsSemanticDiagnostics: true,
39826
+ affectsMultiFileEmitBuildInfo: true,
39788
39827
  strictFlag: true,
39789
39828
  category: ts.Diagnostics.Type_Checking,
39790
39829
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -39793,6 +39832,8 @@ var ts;
39793
39832
  {
39794
39833
  name: "strictBindCallApply",
39795
39834
  type: "boolean",
39835
+ affectsSemanticDiagnostics: true,
39836
+ affectsMultiFileEmitBuildInfo: true,
39796
39837
  strictFlag: true,
39797
39838
  category: ts.Diagnostics.Type_Checking,
39798
39839
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -39802,6 +39843,7 @@ var ts;
39802
39843
  name: "strictPropertyInitialization",
39803
39844
  type: "boolean",
39804
39845
  affectsSemanticDiagnostics: true,
39846
+ affectsMultiFileEmitBuildInfo: true,
39805
39847
  strictFlag: true,
39806
39848
  category: ts.Diagnostics.Type_Checking,
39807
39849
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -39811,6 +39853,7 @@ var ts;
39811
39853
  name: "noImplicitThis",
39812
39854
  type: "boolean",
39813
39855
  affectsSemanticDiagnostics: true,
39856
+ affectsMultiFileEmitBuildInfo: true,
39814
39857
  strictFlag: true,
39815
39858
  category: ts.Diagnostics.Type_Checking,
39816
39859
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -39820,6 +39863,7 @@ var ts;
39820
39863
  name: "useUnknownInCatchVariables",
39821
39864
  type: "boolean",
39822
39865
  affectsSemanticDiagnostics: true,
39866
+ affectsMultiFileEmitBuildInfo: true,
39823
39867
  strictFlag: true,
39824
39868
  category: ts.Diagnostics.Type_Checking,
39825
39869
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -39829,6 +39873,8 @@ var ts;
39829
39873
  name: "alwaysStrict",
39830
39874
  type: "boolean",
39831
39875
  affectsSourceFile: true,
39876
+ affectsEmit: true,
39877
+ affectsMultiFileEmitBuildInfo: true,
39832
39878
  strictFlag: true,
39833
39879
  category: ts.Diagnostics.Type_Checking,
39834
39880
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -39839,6 +39885,7 @@ var ts;
39839
39885
  name: "noUnusedLocals",
39840
39886
  type: "boolean",
39841
39887
  affectsSemanticDiagnostics: true,
39888
+ affectsMultiFileEmitBuildInfo: true,
39842
39889
  category: ts.Diagnostics.Type_Checking,
39843
39890
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
39844
39891
  defaultValueDescription: false,
@@ -39847,6 +39894,7 @@ var ts;
39847
39894
  name: "noUnusedParameters",
39848
39895
  type: "boolean",
39849
39896
  affectsSemanticDiagnostics: true,
39897
+ affectsMultiFileEmitBuildInfo: true,
39850
39898
  category: ts.Diagnostics.Type_Checking,
39851
39899
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
39852
39900
  defaultValueDescription: false,
@@ -39855,6 +39903,7 @@ var ts;
39855
39903
  name: "exactOptionalPropertyTypes",
39856
39904
  type: "boolean",
39857
39905
  affectsSemanticDiagnostics: true,
39906
+ affectsMultiFileEmitBuildInfo: true,
39858
39907
  category: ts.Diagnostics.Type_Checking,
39859
39908
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
39860
39909
  defaultValueDescription: false,
@@ -39863,6 +39912,7 @@ var ts;
39863
39912
  name: "noImplicitReturns",
39864
39913
  type: "boolean",
39865
39914
  affectsSemanticDiagnostics: true,
39915
+ affectsMultiFileEmitBuildInfo: true,
39866
39916
  category: ts.Diagnostics.Type_Checking,
39867
39917
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
39868
39918
  defaultValueDescription: false,
@@ -39872,6 +39922,7 @@ var ts;
39872
39922
  type: "boolean",
39873
39923
  affectsBindDiagnostics: true,
39874
39924
  affectsSemanticDiagnostics: true,
39925
+ affectsMultiFileEmitBuildInfo: true,
39875
39926
  category: ts.Diagnostics.Type_Checking,
39876
39927
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
39877
39928
  defaultValueDescription: false,
@@ -39880,6 +39931,7 @@ var ts;
39880
39931
  name: "noUncheckedIndexedAccess",
39881
39932
  type: "boolean",
39882
39933
  affectsSemanticDiagnostics: true,
39934
+ affectsMultiFileEmitBuildInfo: true,
39883
39935
  category: ts.Diagnostics.Type_Checking,
39884
39936
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
39885
39937
  defaultValueDescription: false,
@@ -39888,6 +39940,7 @@ var ts;
39888
39940
  name: "noImplicitOverride",
39889
39941
  type: "boolean",
39890
39942
  affectsSemanticDiagnostics: true,
39943
+ affectsMultiFileEmitBuildInfo: true,
39891
39944
  category: ts.Diagnostics.Type_Checking,
39892
39945
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
39893
39946
  defaultValueDescription: false,
@@ -39895,6 +39948,8 @@ var ts;
39895
39948
  {
39896
39949
  name: "noPropertyAccessFromIndexSignature",
39897
39950
  type: "boolean",
39951
+ affectsSemanticDiagnostics: true,
39952
+ affectsMultiFileEmitBuildInfo: true,
39898
39953
  showInSimplifiedHelpView: false,
39899
39954
  category: ts.Diagnostics.Type_Checking,
39900
39955
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -39980,6 +40035,7 @@ var ts;
39980
40035
  name: "allowSyntheticDefaultImports",
39981
40036
  type: "boolean",
39982
40037
  affectsSemanticDiagnostics: true,
40038
+ affectsMultiFileEmitBuildInfo: true,
39983
40039
  category: ts.Diagnostics.Interop_Constraints,
39984
40040
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
39985
40041
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -39989,6 +40045,7 @@ var ts;
39989
40045
  type: "boolean",
39990
40046
  affectsSemanticDiagnostics: true,
39991
40047
  affectsEmit: true,
40048
+ affectsMultiFileEmitBuildInfo: true,
39992
40049
  showInSimplifiedHelpView: true,
39993
40050
  category: ts.Diagnostics.Interop_Constraints,
39994
40051
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -40005,6 +40062,7 @@ var ts;
40005
40062
  name: "allowUmdGlobalAccess",
40006
40063
  type: "boolean",
40007
40064
  affectsSemanticDiagnostics: true,
40065
+ affectsMultiFileEmitBuildInfo: true,
40008
40066
  category: ts.Diagnostics.Modules,
40009
40067
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
40010
40068
  defaultValueDescription: false,
@@ -40026,6 +40084,7 @@ var ts;
40026
40084
  name: "sourceRoot",
40027
40085
  type: "string",
40028
40086
  affectsEmit: true,
40087
+ affectsMultiFileEmitBuildInfo: true,
40029
40088
  paramType: ts.Diagnostics.LOCATION,
40030
40089
  category: ts.Diagnostics.Emit,
40031
40090
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -40034,6 +40093,7 @@ var ts;
40034
40093
  name: "mapRoot",
40035
40094
  type: "string",
40036
40095
  affectsEmit: true,
40096
+ affectsMultiFileEmitBuildInfo: true,
40037
40097
  paramType: ts.Diagnostics.LOCATION,
40038
40098
  category: ts.Diagnostics.Emit,
40039
40099
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -40042,6 +40102,7 @@ var ts;
40042
40102
  name: "inlineSourceMap",
40043
40103
  type: "boolean",
40044
40104
  affectsEmit: true,
40105
+ affectsMultiFileEmitBuildInfo: true,
40045
40106
  category: ts.Diagnostics.Emit,
40046
40107
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
40047
40108
  defaultValueDescription: false,
@@ -40050,6 +40111,7 @@ var ts;
40050
40111
  name: "inlineSources",
40051
40112
  type: "boolean",
40052
40113
  affectsEmit: true,
40114
+ affectsMultiFileEmitBuildInfo: true,
40053
40115
  category: ts.Diagnostics.Emit,
40054
40116
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
40055
40117
  defaultValueDescription: false,
@@ -40059,6 +40121,7 @@ var ts;
40059
40121
  name: "experimentalDecorators",
40060
40122
  type: "boolean",
40061
40123
  affectsSemanticDiagnostics: true,
40124
+ affectsMultiFileEmitBuildInfo: true,
40062
40125
  category: ts.Diagnostics.Language_and_Environment,
40063
40126
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
40064
40127
  defaultValueDescription: false,
@@ -40068,6 +40131,7 @@ var ts;
40068
40131
  type: "boolean",
40069
40132
  affectsSemanticDiagnostics: true,
40070
40133
  affectsEmit: true,
40134
+ affectsMultiFileEmitBuildInfo: true,
40071
40135
  category: ts.Diagnostics.Language_and_Environment,
40072
40136
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
40073
40137
  defaultValueDescription: false,
@@ -40092,6 +40156,7 @@ var ts;
40092
40156
  type: "string",
40093
40157
  affectsSemanticDiagnostics: true,
40094
40158
  affectsEmit: true,
40159
+ affectsMultiFileEmitBuildInfo: true,
40095
40160
  affectsModuleResolution: true,
40096
40161
  category: ts.Diagnostics.Language_and_Environment,
40097
40162
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -40109,6 +40174,9 @@ var ts;
40109
40174
  name: "out",
40110
40175
  type: "string",
40111
40176
  affectsEmit: true,
40177
+ affectsMultiFileEmitBuildInfo: true,
40178
+ affectsDeclarationPath: true,
40179
+ affectsBundleEmitBuildInfo: true,
40112
40180
  isFilePath: false,
40113
40181
  // for correct behaviour, please use outFile
40114
40182
  category: ts.Diagnostics.Backwards_Compatibility,
@@ -40120,6 +40188,7 @@ var ts;
40120
40188
  name: "reactNamespace",
40121
40189
  type: "string",
40122
40190
  affectsEmit: true,
40191
+ affectsMultiFileEmitBuildInfo: true,
40123
40192
  category: ts.Diagnostics.Language_and_Environment,
40124
40193
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
40125
40194
  defaultValueDescription: "`React`",
@@ -40127,6 +40196,8 @@ var ts;
40127
40196
  {
40128
40197
  name: "skipDefaultLibCheck",
40129
40198
  type: "boolean",
40199
+ // We need to store these to determine whether `lib` files need to be rechecked
40200
+ affectsMultiFileEmitBuildInfo: true,
40130
40201
  category: ts.Diagnostics.Completeness,
40131
40202
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
40132
40203
  defaultValueDescription: false,
@@ -40142,6 +40213,7 @@ var ts;
40142
40213
  name: "emitBOM",
40143
40214
  type: "boolean",
40144
40215
  affectsEmit: true,
40216
+ affectsMultiFileEmitBuildInfo: true,
40145
40217
  category: ts.Diagnostics.Emit,
40146
40218
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
40147
40219
  defaultValueDescription: false,
@@ -40153,6 +40225,7 @@ var ts;
40153
40225
  lf: 1 /* LineFeed */
40154
40226
  })),
40155
40227
  affectsEmit: true,
40228
+ affectsMultiFileEmitBuildInfo: true,
40156
40229
  paramType: ts.Diagnostics.NEWLINE,
40157
40230
  category: ts.Diagnostics.Emit,
40158
40231
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -40162,6 +40235,7 @@ var ts;
40162
40235
  name: "noErrorTruncation",
40163
40236
  type: "boolean",
40164
40237
  affectsSemanticDiagnostics: true,
40238
+ affectsMultiFileEmitBuildInfo: true,
40165
40239
  category: ts.Diagnostics.Output_Formatting,
40166
40240
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
40167
40241
  defaultValueDescription: false,
@@ -40192,6 +40266,7 @@ var ts;
40192
40266
  name: "stripInternal",
40193
40267
  type: "boolean",
40194
40268
  affectsEmit: true,
40269
+ affectsMultiFileEmitBuildInfo: true,
40195
40270
  category: ts.Diagnostics.Emit,
40196
40271
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
40197
40272
  defaultValueDescription: false,
@@ -40232,6 +40307,7 @@ var ts;
40232
40307
  name: "noImplicitUseStrict",
40233
40308
  type: "boolean",
40234
40309
  affectsSemanticDiagnostics: true,
40310
+ affectsMultiFileEmitBuildInfo: true,
40235
40311
  category: ts.Diagnostics.Backwards_Compatibility,
40236
40312
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
40237
40313
  defaultValueDescription: false,
@@ -40240,6 +40316,7 @@ var ts;
40240
40316
  name: "noEmitHelpers",
40241
40317
  type: "boolean",
40242
40318
  affectsEmit: true,
40319
+ affectsMultiFileEmitBuildInfo: true,
40243
40320
  category: ts.Diagnostics.Emit,
40244
40321
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
40245
40322
  defaultValueDescription: false,
@@ -40248,6 +40325,7 @@ var ts;
40248
40325
  name: "noEmitOnError",
40249
40326
  type: "boolean",
40250
40327
  affectsEmit: true,
40328
+ affectsMultiFileEmitBuildInfo: true,
40251
40329
  category: ts.Diagnostics.Emit,
40252
40330
  transpileOptionValue: undefined,
40253
40331
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -40257,6 +40335,7 @@ var ts;
40257
40335
  name: "preserveConstEnums",
40258
40336
  type: "boolean",
40259
40337
  affectsEmit: true,
40338
+ affectsMultiFileEmitBuildInfo: true,
40260
40339
  category: ts.Diagnostics.Emit,
40261
40340
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
40262
40341
  defaultValueDescription: false,
@@ -40265,6 +40344,8 @@ var ts;
40265
40344
  name: "declarationDir",
40266
40345
  type: "string",
40267
40346
  affectsEmit: true,
40347
+ affectsMultiFileEmitBuildInfo: true,
40348
+ affectsDeclarationPath: true,
40268
40349
  isFilePath: true,
40269
40350
  paramType: ts.Diagnostics.DIRECTORY,
40270
40351
  category: ts.Diagnostics.Emit,
@@ -40274,6 +40355,8 @@ var ts;
40274
40355
  {
40275
40356
  name: "skipLibCheck",
40276
40357
  type: "boolean",
40358
+ // We need to store these to determine whether `lib` files need to be rechecked
40359
+ affectsMultiFileEmitBuildInfo: true,
40277
40360
  category: ts.Diagnostics.Completeness,
40278
40361
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
40279
40362
  defaultValueDescription: false,
@@ -40283,6 +40366,7 @@ var ts;
40283
40366
  type: "boolean",
40284
40367
  affectsBindDiagnostics: true,
40285
40368
  affectsSemanticDiagnostics: true,
40369
+ affectsMultiFileEmitBuildInfo: true,
40286
40370
  category: ts.Diagnostics.Type_Checking,
40287
40371
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
40288
40372
  defaultValueDescription: undefined,
@@ -40292,6 +40376,7 @@ var ts;
40292
40376
  type: "boolean",
40293
40377
  affectsBindDiagnostics: true,
40294
40378
  affectsSemanticDiagnostics: true,
40379
+ affectsMultiFileEmitBuildInfo: true,
40295
40380
  category: ts.Diagnostics.Type_Checking,
40296
40381
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
40297
40382
  defaultValueDescription: undefined,
@@ -40300,6 +40385,7 @@ var ts;
40300
40385
  name: "suppressExcessPropertyErrors",
40301
40386
  type: "boolean",
40302
40387
  affectsSemanticDiagnostics: true,
40388
+ affectsMultiFileEmitBuildInfo: true,
40303
40389
  category: ts.Diagnostics.Backwards_Compatibility,
40304
40390
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
40305
40391
  defaultValueDescription: false,
@@ -40308,6 +40394,7 @@ var ts;
40308
40394
  name: "suppressImplicitAnyIndexErrors",
40309
40395
  type: "boolean",
40310
40396
  affectsSemanticDiagnostics: true,
40397
+ affectsMultiFileEmitBuildInfo: true,
40311
40398
  category: ts.Diagnostics.Backwards_Compatibility,
40312
40399
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
40313
40400
  defaultValueDescription: false,
@@ -40332,6 +40419,7 @@ var ts;
40332
40419
  name: "noStrictGenericChecks",
40333
40420
  type: "boolean",
40334
40421
  affectsSemanticDiagnostics: true,
40422
+ affectsMultiFileEmitBuildInfo: true,
40335
40423
  category: ts.Diagnostics.Backwards_Compatibility,
40336
40424
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
40337
40425
  defaultValueDescription: false,
@@ -40341,6 +40429,7 @@ var ts;
40341
40429
  type: "boolean",
40342
40430
  affectsSemanticDiagnostics: true,
40343
40431
  affectsEmit: true,
40432
+ affectsMultiFileEmitBuildInfo: true,
40344
40433
  category: ts.Diagnostics.Language_and_Environment,
40345
40434
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
40346
40435
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -40349,6 +40438,7 @@ var ts;
40349
40438
  name: "preserveValueImports",
40350
40439
  type: "boolean",
40351
40440
  affectsEmit: true,
40441
+ affectsMultiFileEmitBuildInfo: true,
40352
40442
  category: ts.Diagnostics.Emit,
40353
40443
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
40354
40444
  defaultValueDescription: false,
@@ -40392,6 +40482,8 @@ var ts;
40392
40482
  /* @internal */
40393
40483
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
40394
40484
  /* @internal */
40485
+ ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
40486
+ /* @internal */
40395
40487
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
40396
40488
  /* @internal */
40397
40489
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -41247,6 +41339,7 @@ var ts;
41247
41339
  return optionDefinition.type;
41248
41340
  }
41249
41341
  }
41342
+ /* @internal */
41250
41343
  function getNameOfCompilerOptionValue(value, customTypeMap) {
41251
41344
  // There is a typeMap associated with this command-line option so use it to map value back to its name
41252
41345
  return ts.forEachEntry(customTypeMap, function (mapValue, key) {
@@ -41255,6 +41348,7 @@ var ts;
41255
41348
  }
41256
41349
  });
41257
41350
  }
41351
+ ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
41258
41352
  function serializeCompilerOptions(options, pathOptions) {
41259
41353
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
41260
41354
  }
@@ -43355,16 +43449,20 @@ var ts;
43355
43449
  function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
43356
43450
  return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
43357
43451
  }
43452
+ var jsOnlyExtensions = [Extensions.JavaScript];
43453
+ var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
43454
+ var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
43455
+ var tsconfigExtensions = [Extensions.TSConfig];
43358
43456
  function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
43359
43457
  var containingDirectory = ts.getDirectoryPath(containingFile);
43360
43458
  // es module file or cjs-like input file, use a variant of the legacy cjs resolver that supports the selected modern features
43361
43459
  var esmMode = resolutionMode === ts.ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0;
43362
- return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions, redirectedReference);
43460
+ var extensions = compilerOptions.noDtsResolution ? [Extensions.TsOnly, Extensions.JavaScript] : tsExtensions;
43461
+ if (compilerOptions.resolveJsonModule) {
43462
+ extensions = __spreadArray(__spreadArray([], extensions, true), [Extensions.Json], false);
43463
+ }
43464
+ return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference);
43363
43465
  }
43364
- var jsOnlyExtensions = [Extensions.JavaScript];
43365
- var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
43366
- var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
43367
- var tsconfigExtensions = [Extensions.TSConfig];
43368
43466
  function tryResolveJSModuleWorker(moduleName, initialDir, host) {
43369
43467
  return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
43370
43468
  }
@@ -47149,12 +47247,14 @@ var ts;
47149
47247
  }
47150
47248
  }
47151
47249
  function setCommonJsModuleIndicator(node) {
47152
- if (file.externalModuleIndicator) {
47250
+ if (file.externalModuleIndicator && file.externalModuleIndicator !== true) {
47153
47251
  return false;
47154
47252
  }
47155
47253
  if (!file.commonJsModuleIndicator) {
47156
47254
  file.commonJsModuleIndicator = node;
47157
- bindSourceFileAsExternalModule();
47255
+ if (!file.externalModuleIndicator) {
47256
+ bindSourceFileAsExternalModule();
47257
+ }
47158
47258
  }
47159
47259
  return true;
47160
47260
  }
@@ -47568,7 +47668,11 @@ var ts;
47568
47668
  checkStrictModeEvalOrArguments(node, node.name);
47569
47669
  }
47570
47670
  if (!ts.isBindingPattern(node.name)) {
47571
- if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) && !ts.getJSDocTypeTag(node) && !(ts.getCombinedModifierFlags(node) & 1 /* Export */)) {
47671
+ var possibleVariableDecl = node.kind === 254 /* VariableDeclaration */ ? node : node.parent.parent;
47672
+ if (ts.isInJSFile(node) &&
47673
+ ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) &&
47674
+ !ts.getJSDocTypeTag(node) &&
47675
+ !(ts.getCombinedModifierFlags(node) & 1 /* Export */)) {
47572
47676
  declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
47573
47677
  }
47574
47678
  else if (ts.isBlockOrCatchScoped(node)) {
@@ -50395,7 +50499,8 @@ var ts;
50395
50499
  && isAliasableOrJsExpression(node.parent.right)
50396
50500
  || node.kind === 297 /* ShorthandPropertyAssignment */
50397
50501
  || node.kind === 296 /* PropertyAssignment */ && isAliasableOrJsExpression(node.initializer)
50398
- || ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node);
50502
+ || node.kind === 254 /* VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)
50503
+ || node.kind === 203 /* BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent);
50399
50504
  }
50400
50505
  function isAliasableOrJsExpression(e) {
50401
50506
  return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e);
@@ -50488,7 +50593,7 @@ var ts;
50488
50593
  return hasExportAssignmentSymbol(moduleSymbol);
50489
50594
  }
50490
50595
  // 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
50491
- return !file.externalModuleIndicator && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), /*sourceNode*/ undefined, dontResolveAlias);
50596
+ return typeof file.externalModuleIndicator !== "object" && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), /*sourceNode*/ undefined, dontResolveAlias);
50492
50597
  }
50493
50598
  function getTargetOfImportClause(node, dontResolveAlias) {
50494
50599
  var _a;
@@ -68352,13 +68457,40 @@ var ts;
68352
68457
  return sourceStart.slice(0, startLen) !== targetStart.slice(0, startLen) ||
68353
68458
  sourceEnd.slice(sourceEnd.length - endLen) !== targetEnd.slice(targetEnd.length - endLen);
68354
68459
  }
68355
- function isValidBigIntString(s) {
68460
+ /**
68461
+ * Tests whether the provided string can be parsed as a number.
68462
+ * @param s The string to test.
68463
+ * @param roundTripOnly Indicates the resulting number matches the input when converted back to a string.
68464
+ */
68465
+ function isValidNumberString(s, roundTripOnly) {
68466
+ if (s === "")
68467
+ return false;
68468
+ var n = +s;
68469
+ return isFinite(n) && (!roundTripOnly || "" + n === s);
68470
+ }
68471
+ /**
68472
+ * @param text a valid bigint string excluding a trailing `n`, but including a possible prefix `-`. Use `isValidBigIntString(text, roundTripOnly)` before calling this function.
68473
+ */
68474
+ function parseBigIntLiteralType(text) {
68475
+ var negative = text.startsWith("-");
68476
+ var base10Value = ts.parsePseudoBigInt((negative ? text.slice(1) : text) + "n");
68477
+ return getBigIntLiteralType({ negative: negative, base10Value: base10Value });
68478
+ }
68479
+ /**
68480
+ * Tests whether the provided string can be parsed as a bigint.
68481
+ * @param s The string to test.
68482
+ * @param roundTripOnly Indicates the resulting bigint matches the input when converted back to a string.
68483
+ */
68484
+ function isValidBigIntString(s, roundTripOnly) {
68485
+ if (s === "")
68486
+ return false;
68356
68487
  var scanner = ts.createScanner(99 /* ESNext */, /*skipTrivia*/ false);
68357
68488
  var success = true;
68358
68489
  scanner.setOnError(function () { return success = false; });
68359
68490
  scanner.setText(s + "n");
68360
68491
  var result = scanner.scan();
68361
- if (result === 40 /* MinusToken */) {
68492
+ var negative = result === 40 /* MinusToken */;
68493
+ if (negative) {
68362
68494
  result = scanner.scan();
68363
68495
  }
68364
68496
  var flags = scanner.getTokenFlags();
@@ -68367,7 +68499,8 @@ var ts;
68367
68499
  // * a bigint can be scanned, and that when it is scanned, it is
68368
68500
  // * the full length of the input string (so the scanner is one character beyond the augmented input length)
68369
68501
  // * it does not contain a numeric seperator (the `BigInt` constructor does not accept a numeric seperator in its input)
68370
- return success && result === 9 /* BigIntLiteral */ && scanner.getTextPos() === (s.length + 1) && !(flags & 512 /* ContainsSeparator */);
68502
+ return success && result === 9 /* BigIntLiteral */ && scanner.getTextPos() === (s.length + 1) && !(flags & 512 /* ContainsSeparator */)
68503
+ && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
68371
68504
  }
68372
68505
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
68373
68506
  if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
@@ -68375,8 +68508,8 @@ var ts;
68375
68508
  }
68376
68509
  if (source.flags & 128 /* StringLiteral */) {
68377
68510
  var value = source.value;
68378
- return !!(target.flags & 8 /* Number */ && value !== "" && isFinite(+value) ||
68379
- target.flags & 64 /* BigInt */ && value !== "" && isValidBigIntString(value) ||
68511
+ return !!(target.flags & 8 /* Number */ && isValidNumberString(value, /*roundTripOnly*/ false) ||
68512
+ target.flags & 64 /* BigInt */ && isValidBigIntString(value, /*roundTripOnly*/ false) ||
68380
68513
  target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName);
68381
68514
  }
68382
68515
  if (source.flags & 134217728 /* TemplateLiteral */) {
@@ -68949,8 +69082,57 @@ var ts;
68949
69082
  // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
68950
69083
  // succeed. That would be a pointless and confusing outcome.
68951
69084
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
69085
+ var _loop_23 = function (i) {
69086
+ var source_1 = matches ? matches[i] : neverType;
69087
+ var target_3 = types[i];
69088
+ // If we are inferring from a string literal type to a type variable whose constraint includes one of the
69089
+ // allowed template literal placeholder types, infer from a literal type corresponding to the constraint.
69090
+ if (source_1.flags & 128 /* StringLiteral */ && target_3.flags & 8650752 /* TypeVariable */) {
69091
+ var inferenceContext = getInferenceInfoForType(target_3);
69092
+ var constraint = inferenceContext ? getBaseConstraintOfType(inferenceContext.typeParameter) : undefined;
69093
+ if (constraint && !isTypeAny(constraint)) {
69094
+ var constraintTypes = constraint.flags & 1048576 /* Union */ ? constraint.types : [constraint];
69095
+ var allTypeFlags_1 = ts.reduceLeft(constraintTypes, function (flags, t) { return flags | t.flags; }, 0);
69096
+ // If the constraint contains `string`, we don't need to look for a more preferred type
69097
+ if (!(allTypeFlags_1 & 4 /* String */)) {
69098
+ var str_1 = source_1.value;
69099
+ // If the type contains `number` or a number literal and the string isn't a valid number, exclude numbers
69100
+ if (allTypeFlags_1 & 296 /* NumberLike */ && !isValidNumberString(str_1, /*roundTripOnly*/ true)) {
69101
+ allTypeFlags_1 &= ~296 /* NumberLike */;
69102
+ }
69103
+ // If the type contains `bigint` or a bigint literal and the string isn't a valid bigint, exclude bigints
69104
+ if (allTypeFlags_1 & 2112 /* BigIntLike */ && !isValidBigIntString(str_1, /*roundTripOnly*/ true)) {
69105
+ allTypeFlags_1 &= ~2112 /* BigIntLike */;
69106
+ }
69107
+ // for each type in the constraint, find the highest priority matching type
69108
+ var matchingType = ts.reduceLeft(constraintTypes, function (left, right) {
69109
+ return !(right.flags & allTypeFlags_1) ? left :
69110
+ left.flags & 4 /* String */ ? left : right.flags & 4 /* String */ ? source_1 :
69111
+ left.flags & 134217728 /* TemplateLiteral */ ? left : right.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source_1, right) ? source_1 :
69112
+ left.flags & 268435456 /* StringMapping */ ? left : right.flags & 268435456 /* StringMapping */ && str_1 === applyStringMapping(right.symbol, str_1) ? source_1 :
69113
+ left.flags & 128 /* StringLiteral */ ? left : right.flags & 128 /* StringLiteral */ && right.value === str_1 ? right :
69114
+ left.flags & 8 /* Number */ ? left : right.flags & 8 /* Number */ ? getNumberLiteralType(+str_1) :
69115
+ left.flags & 32 /* Enum */ ? left : right.flags & 32 /* Enum */ ? getNumberLiteralType(+str_1) :
69116
+ left.flags & 256 /* NumberLiteral */ ? left : right.flags & 256 /* NumberLiteral */ && right.value === +str_1 ? right :
69117
+ left.flags & 64 /* BigInt */ ? left : right.flags & 64 /* BigInt */ ? parseBigIntLiteralType(str_1) :
69118
+ left.flags & 2048 /* BigIntLiteral */ ? left : right.flags & 2048 /* BigIntLiteral */ && ts.pseudoBigIntToString(right.value) === str_1 ? right :
69119
+ left.flags & 16 /* Boolean */ ? left : right.flags & 16 /* Boolean */ ? str_1 === "true" ? trueType : str_1 === "false" ? falseType : booleanType :
69120
+ left.flags & 512 /* BooleanLiteral */ ? left : right.flags & 512 /* BooleanLiteral */ && right.intrinsicName === str_1 ? right :
69121
+ left.flags & 32768 /* Undefined */ ? left : right.flags & 32768 /* Undefined */ && right.intrinsicName === str_1 ? right :
69122
+ left.flags & 65536 /* Null */ ? left : right.flags & 65536 /* Null */ && right.intrinsicName === str_1 ? right :
69123
+ left;
69124
+ }, neverType);
69125
+ if (!(matchingType.flags & 131072 /* Never */)) {
69126
+ inferFromTypes(matchingType, target_3);
69127
+ return "continue";
69128
+ }
69129
+ }
69130
+ }
69131
+ }
69132
+ inferFromTypes(source_1, target_3);
69133
+ };
68952
69134
  for (var i = 0; i < types.length; i++) {
68953
- inferFromTypes(matches ? matches[i] : neverType, types[i]);
69135
+ _loop_23(i);
68954
69136
  }
68955
69137
  }
68956
69138
  }
@@ -69468,7 +69650,7 @@ var ts;
69468
69650
  function mapTypesByKeyProperty(types, name) {
69469
69651
  var map = new ts.Map();
69470
69652
  var count = 0;
69471
- var _loop_23 = function (type) {
69653
+ var _loop_24 = function (type) {
69472
69654
  if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
69473
69655
  var discriminant = getTypeOfPropertyOfType(type, name);
69474
69656
  if (discriminant) {
@@ -69494,7 +69676,7 @@ var ts;
69494
69676
  };
69495
69677
  for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
69496
69678
  var type = types_16[_i];
69497
- var state_9 = _loop_23(type);
69679
+ var state_9 = _loop_24(type);
69498
69680
  if (typeof state_9 === "object")
69499
69681
  return state_9.value;
69500
69682
  }
@@ -75882,7 +76064,7 @@ var ts;
75882
76064
  if (spreadIndex >= 0) {
75883
76065
  // Create synthetic arguments from spreads of tuple types.
75884
76066
  var effectiveArgs_1 = args.slice(0, spreadIndex);
75885
- var _loop_24 = function (i) {
76067
+ var _loop_25 = function (i) {
75886
76068
  var arg = args[i];
75887
76069
  // We can call checkExpressionCached because spread expressions never have a contextual type.
75888
76070
  var spreadType = arg.kind === 225 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@@ -75899,7 +76081,7 @@ var ts;
75899
76081
  }
75900
76082
  };
75901
76083
  for (var i = spreadIndex; i < args.length; i++) {
75902
- _loop_24(i);
76084
+ _loop_25(i);
75903
76085
  }
75904
76086
  return effectiveArgs_1;
75905
76087
  }
@@ -76219,7 +76401,7 @@ var ts;
76219
76401
  var min_3 = Number.MAX_VALUE;
76220
76402
  var minIndex = 0;
76221
76403
  var i_1 = 0;
76222
- var _loop_25 = function (c) {
76404
+ var _loop_26 = function (c) {
76223
76405
  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)); };
76224
76406
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2);
76225
76407
  if (diags_2) {
@@ -76237,7 +76419,7 @@ var ts;
76237
76419
  };
76238
76420
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
76239
76421
  var c = candidatesForArgumentError_1[_a];
76240
- _loop_25(c);
76422
+ _loop_26(c);
76241
76423
  }
76242
76424
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
76243
76425
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -76395,7 +76577,7 @@ var ts;
76395
76577
  }
76396
76578
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
76397
76579
  var parameters = [];
76398
- var _loop_26 = function (i) {
76580
+ var _loop_27 = function (i) {
76399
76581
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
76400
76582
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
76401
76583
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -76403,7 +76585,7 @@ var ts;
76403
76585
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
76404
76586
  };
76405
76587
  for (var i = 0; i < maxNonRestParam; i++) {
76406
- _loop_26(i);
76588
+ _loop_27(i);
76407
76589
  }
76408
76590
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
76409
76591
  var flags = 0 /* None */;
@@ -80460,7 +80642,7 @@ var ts;
80460
80642
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
80461
80643
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
80462
80644
  var indexSignatureMap_1 = new ts.Map();
80463
- var _loop_27 = function (declaration) {
80645
+ var _loop_28 = function (declaration) {
80464
80646
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
80465
80647
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
80466
80648
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -80475,7 +80657,7 @@ var ts;
80475
80657
  };
80476
80658
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
80477
80659
  var declaration = _a[_i];
80478
- _loop_27(declaration);
80660
+ _loop_28(declaration);
80479
80661
  }
80480
80662
  indexSignatureMap_1.forEach(function (entry) {
80481
80663
  if (entry.declarations.length > 1) {
@@ -82671,7 +82853,7 @@ var ts;
82671
82853
  }
82672
82854
  // For a commonjs `const x = require`, validate the alias and exit
82673
82855
  var symbol = getSymbolOfNode(node);
82674
- if (symbol.flags & 2097152 /* Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)) {
82856
+ if (symbol.flags & 2097152 /* Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 /* BindingElement */ ? node.parent.parent : node)) {
82675
82857
  checkAliasSymbol(node);
82676
82858
  return;
82677
82859
  }
@@ -83936,7 +84118,7 @@ var ts;
83936
84118
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
83937
84119
  var localPropDeclaration = declaration && declaration.kind === 221 /* BinaryExpression */ ||
83938
84120
  name && name.kind === 162 /* ComputedPropertyName */ || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
83939
- var _loop_28 = function (info) {
84121
+ var _loop_29 = function (info) {
83940
84122
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
83941
84123
  // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
83942
84124
  // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@@ -83949,7 +84131,7 @@ var ts;
83949
84131
  };
83950
84132
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
83951
84133
  var info = indexInfos_9[_i];
83952
- _loop_28(info);
84134
+ _loop_29(info);
83953
84135
  }
83954
84136
  }
83955
84137
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -83957,7 +84139,7 @@ var ts;
83957
84139
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
83958
84140
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
83959
84141
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
83960
- var _loop_29 = function (info) {
84142
+ var _loop_30 = function (info) {
83961
84143
  if (info === checkInfo)
83962
84144
  return "continue";
83963
84145
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -83972,7 +84154,7 @@ var ts;
83972
84154
  };
83973
84155
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
83974
84156
  var info = indexInfos_10[_i];
83975
- _loop_29(info);
84157
+ _loop_30(info);
83976
84158
  }
83977
84159
  }
83978
84160
  function checkTypeNameIsReserved(name, message) {
@@ -84291,7 +84473,7 @@ var ts;
84291
84473
  var baseTypes = baseTypeNode && getBaseTypes(type);
84292
84474
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
84293
84475
  var baseStaticType = getBaseConstructorTypeOfClass(type);
84294
- var _loop_30 = function (member) {
84476
+ var _loop_31 = function (member) {
84295
84477
  if (ts.hasAmbientModifier(member)) {
84296
84478
  return "continue";
84297
84479
  }
@@ -84308,7 +84490,7 @@ var ts;
84308
84490
  };
84309
84491
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
84310
84492
  var member = _a[_i];
84311
- _loop_30(member);
84493
+ _loop_31(member);
84312
84494
  }
84313
84495
  }
84314
84496
  /**
@@ -84396,7 +84578,7 @@ var ts;
84396
84578
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
84397
84579
  // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
84398
84580
  var issuedMemberError = false;
84399
- var _loop_31 = function (member) {
84581
+ var _loop_32 = function (member) {
84400
84582
  if (ts.isStatic(member)) {
84401
84583
  return "continue";
84402
84584
  }
@@ -84415,7 +84597,7 @@ var ts;
84415
84597
  };
84416
84598
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
84417
84599
  var member = _a[_i];
84418
- _loop_31(member);
84600
+ _loop_32(member);
84419
84601
  }
84420
84602
  if (!issuedMemberError) {
84421
84603
  // check again with diagnostics to generate a less-specific error
@@ -90075,9 +90257,7 @@ var ts;
90075
90257
  var ts;
90076
90258
  (function (ts) {
90077
90259
  function createSourceMapGenerator(host, file, sourceRoot, sourcesDirectoryPath, generatorOptions) {
90078
- var _a = generatorOptions.extendedDiagnostics
90079
- ? ts.performance.createTimer("Source Map", "beforeSourcemap", "afterSourcemap")
90080
- : ts.performance.nullTimer, enter = _a.enter, exit = _a.exit;
90260
+ var _a = ts.performance.createTimerIf(!!generatorOptions.extendedDiagnostics, "Source Map", "beforeSourcemap", "afterSourcemap"), enter = _a.enter, exit = _a.exit;
90081
90261
  // Current source map file and its index in the sources list
90082
90262
  var rawSources = [];
90083
90263
  var sources = [];
@@ -110394,7 +110574,8 @@ var ts;
110394
110574
  return;
110395
110575
  }
110396
110576
  var version = ts.version; // Extracted into a const so the form is stable between namespace and module
110397
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), /*writeByteOrderMark*/ false);
110577
+ var buildInfo = { bundle: bundle, program: program, version: version };
110578
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
110398
110579
  }
110399
110580
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
110400
110581
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -110548,13 +110729,18 @@ var ts;
110548
110729
  if (sourceMapFilePath) {
110549
110730
  var sourceMap = sourceMapGenerator.toString();
110550
110731
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110732
+ if (printer.bundleFileInfo)
110733
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
110551
110734
  }
110552
110735
  }
110553
110736
  else {
110554
110737
  writer.writeLine();
110555
110738
  }
110556
110739
  // Write the output file
110557
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110740
+ var text = writer.getText();
110741
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110742
+ if (printer.bundleFileInfo)
110743
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
110558
110744
  // Reset state
110559
110745
  writer.clear();
110560
110746
  }
@@ -110697,34 +110883,54 @@ var ts;
110697
110883
  }
110698
110884
  /*@internal*/
110699
110885
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
110886
+ var createHash = ts.maybeBind(host, host.createHash);
110700
110887
  var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
110701
- var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
110702
- if (!buildInfoText)
110888
+ var buildInfo;
110889
+ if (host.getBuildInfo) {
110890
+ var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
110891
+ if (!hostBuildInfo)
110892
+ return buildInfoPath;
110893
+ buildInfo = hostBuildInfo;
110894
+ }
110895
+ else {
110896
+ var buildInfoText = host.readFile(buildInfoPath);
110897
+ if (!buildInfoText)
110898
+ return buildInfoPath;
110899
+ buildInfo = getBuildInfo(buildInfoText);
110900
+ }
110901
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
110703
110902
  return buildInfoPath;
110704
110903
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
110705
110904
  if (!jsFileText)
110706
110905
  return jsFilePath;
110906
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
110907
+ return jsFilePath;
110707
110908
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
110708
110909
  // error if no source map or for now if inline sourcemap
110709
110910
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
110710
110911
  return sourceMapFilePath || "inline sourcemap decoding";
110912
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
110913
+ return sourceMapFilePath;
110711
110914
  // read declaration text
110712
110915
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
110713
110916
  if (declarationFilePath && !declarationText)
110714
110917
  return declarationFilePath;
110918
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
110919
+ return declarationFilePath;
110715
110920
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
110716
110921
  // error if no source map or for now if inline sourcemap
110717
110922
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
110718
110923
  return declarationMapPath || "inline sourcemap decoding";
110719
- var buildInfo = getBuildInfo(buildInfoText);
110720
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
110721
- return buildInfoPath;
110924
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
110925
+ return declarationMapPath;
110722
110926
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110723
110927
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
110724
110928
  /*onlyOwnText*/ true);
110725
110929
  var outputFiles = [];
110726
110930
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
110727
110931
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
110932
+ var changedDtsText;
110933
+ var changedDtsData;
110728
110934
  var emitHost = {
110729
110935
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
110730
110936
  getCanonicalFileName: host.getCanonicalFileName,
@@ -110740,7 +110946,7 @@ var ts;
110740
110946
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
110741
110947
  getProjectReferenceRedirect: ts.returnUndefined,
110742
110948
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
110743
- writeFile: function (name, text, writeByteOrderMark) {
110949
+ writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
110744
110950
  switch (name) {
110745
110951
  case jsFilePath:
110746
110952
  if (jsFileText === text)
@@ -110751,8 +110957,13 @@ var ts;
110751
110957
  return;
110752
110958
  break;
110753
110959
  case buildInfoPath:
110754
- var newBuildInfo = getBuildInfo(text);
110960
+ var newBuildInfo = data.buildInfo;
110755
110961
  newBuildInfo.program = buildInfo.program;
110962
+ if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
110963
+ // Update the output signature
110964
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
110965
+ newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
110966
+ }
110756
110967
  // Update sourceFileInfo
110757
110968
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
110758
110969
  newBuildInfo.bundle.js.sources = js.sources;
@@ -110760,11 +110971,13 @@ var ts;
110760
110971
  newBuildInfo.bundle.dts.sources = dts.sources;
110761
110972
  }
110762
110973
  newBuildInfo.bundle.sourceFiles = sourceFiles;
110763
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
110974
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
110764
110975
  return;
110765
110976
  case declarationFilePath:
110766
110977
  if (declarationText === text)
110767
110978
  return;
110979
+ changedDtsText = text;
110980
+ changedDtsData = data;
110768
110981
  break;
110769
110982
  case declarationMapPath:
110770
110983
  if (declarationMapText === text)
@@ -110783,6 +110996,7 @@ var ts;
110783
110996
  getSourceFileFromReference: ts.returnUndefined,
110784
110997
  redirectTargetsMap: ts.createMultiMap(),
110785
110998
  getFileIncludeReasons: ts.notImplemented,
110999
+ createHash: createHash,
110786
111000
  };
110787
111001
  emitFiles(ts.notImplementedResolver, emitHost,
110788
111002
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
@@ -115867,12 +116081,10 @@ var ts;
115867
116081
  }
115868
116082
  ts.createCompilerHost = createCompilerHost;
115869
116083
  /*@internal*/
115870
- // TODO(shkamat): update this after reworking ts build API
115871
116084
  function createCompilerHostWorker(options, setParentNodes, system) {
115872
116085
  if (system === void 0) { system = ts.sys; }
115873
116086
  var existingDirectories = new ts.Map();
115874
116087
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
115875
- var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
115876
116088
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
115877
116089
  var text;
115878
116090
  try {
@@ -115905,7 +116117,7 @@ var ts;
115905
116117
  // NOTE: If patchWriteFileEnsuringDirectory has been called,
115906
116118
  // the system.writeFile will do its own directory creation and
115907
116119
  // the ensureDirectoriesExist call will always be redundant.
115908
- 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); });
116120
+ 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); });
115909
116121
  ts.performance.mark("afterIOWrite");
115910
116122
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
115911
116123
  }
@@ -115915,35 +116127,6 @@ var ts;
115915
116127
  }
115916
116128
  }
115917
116129
  }
115918
- var outputFingerprints;
115919
- function writeFileWorker(fileName, data, writeByteOrderMark) {
115920
- if (!ts.isWatchSet(options) || !system.getModifiedTime) {
115921
- system.writeFile(fileName, data, writeByteOrderMark);
115922
- return;
115923
- }
115924
- if (!outputFingerprints) {
115925
- outputFingerprints = new ts.Map();
115926
- }
115927
- var hash = computeHash(data);
115928
- var mtimeBefore = system.getModifiedTime(fileName);
115929
- if (mtimeBefore) {
115930
- var fingerprint = outputFingerprints.get(fileName);
115931
- // If output has not been changed, and the file has no external modification
115932
- if (fingerprint &&
115933
- fingerprint.byteOrderMark === writeByteOrderMark &&
115934
- fingerprint.hash === hash &&
115935
- fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
115936
- return;
115937
- }
115938
- }
115939
- system.writeFile(fileName, data, writeByteOrderMark);
115940
- var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
115941
- outputFingerprints.set(fileName, {
115942
- hash: hash,
115943
- byteOrderMark: writeByteOrderMark,
115944
- mtime: mtimeAfter
115945
- });
115946
- }
115947
116130
  function getDefaultLibLocation() {
115948
116131
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
115949
116132
  }
@@ -117533,6 +117716,7 @@ var ts;
117533
117716
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
117534
117717
  redirectTargetsMap: redirectTargetsMap,
117535
117718
  getFileIncludeReasons: program.getFileIncludeReasons,
117719
+ createHash: ts.maybeBind(host, host.createHash),
117536
117720
  };
117537
117721
  }
117538
117722
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -119646,13 +119830,9 @@ var ts;
119646
119830
  function createManyToManyPathMap() {
119647
119831
  function create(forward, reverse, deleted) {
119648
119832
  var map = {
119649
- clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119650
- forEach: function (fn) { return forward.forEach(fn); },
119651
119833
  getKeys: function (v) { return reverse.get(v); },
119652
119834
  getValues: function (k) { return forward.get(k); },
119653
- hasKey: function (k) { return forward.has(k); },
119654
119835
  keys: function () { return forward.keys(); },
119655
- deletedKeys: function () { return deleted; },
119656
119836
  deleteKey: function (k) {
119657
119837
  (deleted || (deleted = new ts.Set())).add(k);
119658
119838
  var set = forward.get(k);
@@ -119679,11 +119859,6 @@ var ts;
119679
119859
  });
119680
119860
  return map;
119681
119861
  },
119682
- clear: function () {
119683
- forward.clear();
119684
- reverse.clear();
119685
- deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119686
- }
119687
119862
  };
119688
119863
  return map;
119689
119864
  }
@@ -119811,18 +119986,21 @@ var ts;
119811
119986
  * Creates the state of file references and signature for the new program from oldState if it is safe
119812
119987
  */
119813
119988
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119989
+ var _a, _b, _c;
119814
119990
  var fileInfos = new ts.Map();
119815
119991
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
119816
119992
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
119817
- var hasCalledUpdateShapeSignature = new ts.Set();
119818
119993
  var useOldState = canReuseOldState(referencedMap, oldState);
119819
119994
  // Ensure source files have parent pointers set
119820
119995
  newProgram.getTypeChecker();
119821
119996
  // Create the reference map, and set the file infos
119822
- for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
119823
- var sourceFile = _a[_i];
119997
+ for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
119998
+ var sourceFile = _d[_i];
119824
119999
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
119825
- var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
120000
+ var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
120001
+ var signature = oldUncommitedSignature === undefined ?
120002
+ useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
120003
+ oldUncommitedSignature || undefined;
119826
120004
  if (referencedMap) {
119827
120005
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
119828
120006
  if (newReferences) {
@@ -119830,19 +120008,26 @@ var ts;
119830
120008
  }
119831
120009
  // Copy old visible to outside files map
119832
120010
  if (useOldState) {
119833
- var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
120011
+ var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
120012
+ var exportedModules = oldUncommitedExportedModules === undefined ?
120013
+ oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
120014
+ oldUncommitedExportedModules || undefined;
119834
120015
  if (exportedModules) {
119835
120016
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119836
120017
  }
119837
120018
  }
119838
120019
  }
119839
- fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
120020
+ fileInfos.set(sourceFile.resolvedPath, {
120021
+ version: version_2,
120022
+ signature: signature,
120023
+ affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
120024
+ impliedFormat: sourceFile.impliedNodeFormat
120025
+ });
119840
120026
  }
119841
120027
  return {
119842
120028
  fileInfos: fileInfos,
119843
120029
  referencedMap: referencedMap,
119844
120030
  exportedModulesMap: exportedModulesMap,
119845
- hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
119846
120031
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
119847
120032
  };
119848
120033
  }
@@ -119856,71 +120041,42 @@ var ts;
119856
120041
  }
119857
120042
  BuilderState.releaseCache = releaseCache;
119858
120043
  /**
119859
- * Creates a clone of the state
120044
+ * Gets the files affected by the path from the program
119860
120045
  */
119861
- function clone(state) {
120046
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
119862
120047
  var _a, _b;
119863
- // Dont need to backup allFiles info since its cache anyway
119864
- return {
119865
- fileInfos: new ts.Map(state.fileInfos),
119866
- referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
119867
- exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
119868
- hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
119869
- useFileVersionAsSignature: state.useFileVersionAsSignature,
119870
- };
120048
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
120049
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
120050
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120051
+ return result;
119871
120052
  }
119872
- BuilderState.clone = clone;
119873
- /**
119874
- * Gets the files affected by the path from the program
119875
- */
119876
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
119877
- // Since the operation could be cancelled, the signatures are always stored in the cache
119878
- // They will be committed once it is safe to use them
119879
- // eg when calling this api from tsserver, if there is no cancellation of the operation
119880
- // In the other cases the affected files signatures are committed only after the iteration through the result is complete
119881
- var signatureCache = cacheToUpdateSignature || new ts.Map();
120053
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
120054
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
119882
120055
  var sourceFile = programOfThisState.getSourceFileByPath(path);
119883
120056
  if (!sourceFile) {
119884
120057
  return ts.emptyArray;
119885
120058
  }
119886
- if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
120059
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
119887
120060
  return [sourceFile];
119888
120061
  }
119889
- var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
119890
- if (!cacheToUpdateSignature) {
119891
- // Commit all the signatures in the signature cache
119892
- updateSignaturesFromCache(state, signatureCache);
119893
- }
119894
- return result;
119895
- }
119896
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119897
- /**
119898
- * Updates the signatures from the cache into state's fileinfo signatures
119899
- * This should be called whenever it is safe to commit the state of the builder
119900
- */
119901
- function updateSignaturesFromCache(state, signatureCache) {
119902
- signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
120062
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
119903
120063
  }
119904
- BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
120064
+ BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
119905
120065
  function updateSignatureOfFile(state, signature, path) {
119906
120066
  state.fileInfos.get(path).signature = signature;
119907
- state.hasCalledUpdateShapeSignature.add(path);
120067
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
119908
120068
  }
119909
120069
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
119910
120070
  /**
119911
120071
  * Returns if the shape of the signature has changed since last emit
119912
120072
  */
119913
- function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
120073
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
120074
+ var _a;
119914
120075
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
119915
- ts.Debug.assert(!!sourceFile);
119916
- ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
119917
120076
  // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
119918
- if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
120077
+ if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
119919
120078
  return false;
119920
- }
119921
120079
  var info = state.fileInfos.get(sourceFile.resolvedPath);
119922
- if (!info)
119923
- return ts.Debug.fail();
119924
120080
  var prevSignature = info.signature;
119925
120081
  var latestSignature;
119926
120082
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -119931,45 +120087,55 @@ var ts;
119931
120087
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119932
120088
  if (firstDts_1) {
119933
120089
  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; })); });
119934
- latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119935
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119936
- updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
120090
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
120091
+ if (latestSignature !== prevSignature) {
120092
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
119937
120093
  }
119938
120094
  }
119939
120095
  }
119940
120096
  // Default is to use file version as signature
119941
120097
  if (latestSignature === undefined) {
119942
120098
  latestSignature = sourceFile.version;
119943
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
120099
+ if (state.exportedModulesMap && latestSignature !== prevSignature) {
120100
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119944
120101
  // All the references in this file are exported
119945
120102
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
119946
120103
  if (references) {
119947
- exportedModulesMapCache.set(sourceFile.resolvedPath, references);
120104
+ state.exportedModulesMap.set(sourceFile.resolvedPath, references);
119948
120105
  }
119949
120106
  else {
119950
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
120107
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119951
120108
  }
119952
120109
  }
119953
120110
  }
119954
- cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
120111
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
120112
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
120113
+ info.signature = latestSignature;
119955
120114
  return latestSignature !== prevSignature;
119956
120115
  }
119957
120116
  BuilderState.updateShapeSignature = updateShapeSignature;
120117
+ function computeSignature(text, computeHash) {
120118
+ return (computeHash || ts.generateDjb2Hash)(text);
120119
+ }
120120
+ BuilderState.computeSignature = computeSignature;
119958
120121
  /**
119959
120122
  * Coverts the declaration emit result into exported modules map
119960
120123
  */
119961
- function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
120124
+ function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
120125
+ if (!state.exportedModulesMap)
120126
+ return;
120127
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119962
120128
  if (!exportedModulesFromDeclarationEmit) {
119963
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
120129
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119964
120130
  return;
119965
120131
  }
119966
120132
  var exportedModules;
119967
120133
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
119968
120134
  if (exportedModules) {
119969
- exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
120135
+ state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119970
120136
  }
119971
120137
  else {
119972
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
120138
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119973
120139
  }
119974
120140
  function addExportedModule(exportedModulePaths) {
119975
120141
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -119981,19 +120147,6 @@ var ts;
119981
120147
  }
119982
120148
  }
119983
120149
  BuilderState.updateExportedModules = updateExportedModules;
119984
- /**
119985
- * Updates the exported modules from cache into state's exported modules map
119986
- * This should be called whenever it is safe to commit the state of the builder
119987
- */
119988
- function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
119989
- var _a;
119990
- if (exportedModulesMapCache) {
119991
- ts.Debug.assert(!!state.exportedModulesMap);
119992
- (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
119993
- exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
119994
- }
119995
- }
119996
- BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
119997
120150
  /**
119998
120151
  * Get all the dependencies of the sourceFile
119999
120152
  */
@@ -120114,7 +120267,7 @@ var ts;
120114
120267
  /**
120115
120268
  * When program emits modular code, gets the files affected by the sourceFile whose shape has changed
120116
120269
  */
120117
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
120270
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
120118
120271
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
120119
120272
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
120120
120273
  }
@@ -120134,7 +120287,7 @@ var ts;
120134
120287
  if (!seenFileNamesMap.has(currentPath)) {
120135
120288
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
120136
120289
  seenFileNamesMap.set(currentPath, currentSourceFile);
120137
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
120290
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
120138
120291
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
120139
120292
  }
120140
120293
  }
@@ -120160,32 +120313,33 @@ var ts;
120160
120313
  * Create the state so that we can iterate on changedFiles/affected files
120161
120314
  */
120162
120315
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
120316
+ var _a, _b;
120163
120317
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
120164
120318
  state.program = newProgram;
120165
120319
  var compilerOptions = newProgram.getCompilerOptions();
120166
120320
  state.compilerOptions = compilerOptions;
120321
+ var outFilePath = ts.outFile(compilerOptions);
120167
120322
  // With --out or --outFile, any change affects all semantic diagnostics so no need to cache them
120168
- if (!ts.outFile(compilerOptions)) {
120323
+ if (!outFilePath) {
120169
120324
  state.semanticDiagnosticsPerFile = new ts.Map();
120170
120325
  }
120326
+ 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)) {
120327
+ state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
120328
+ }
120171
120329
  state.changedFilesSet = new ts.Set();
120330
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
120172
120331
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
120173
120332
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
120174
120333
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
120175
120334
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
120335
+ var canCopyEmitSignatures = compilerOptions.composite &&
120336
+ (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
120337
+ !outFilePath &&
120338
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
120176
120339
  if (useOldState) {
120177
- // Verify the sanity of old state
120178
- if (!oldState.currentChangedFilePath) {
120179
- var affectedSignatures = oldState.currentAffectedFilesSignatures;
120180
- ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
120181
- }
120182
- var changedFilesSet = oldState.changedFilesSet;
120183
- if (canCopySemanticDiagnostics) {
120184
- ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
120185
- }
120186
120340
  // Copy old state's changed files set
120187
- changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
120188
- if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
120341
+ (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
120342
+ if (!outFilePath && oldState.affectedFilesPendingEmit) {
120189
120343
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
120190
120344
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
120191
120345
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -120206,6 +120360,8 @@ var ts;
120206
120360
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
120207
120361
  // versions dont match
120208
120362
  oldInfo.version !== info.version ||
120363
+ // Implied formats dont match
120364
+ oldInfo.impliedFormat !== info.impliedFormat ||
120209
120365
  // Referenced files changed
120210
120366
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
120211
120367
  // Referenced file was deleted in the new program
@@ -120229,27 +120385,25 @@ var ts;
120229
120385
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
120230
120386
  }
120231
120387
  }
120388
+ if (canCopyEmitSignatures) {
120389
+ var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
120390
+ if (oldEmitSignature)
120391
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
120392
+ }
120232
120393
  });
120233
120394
  // If the global file is removed, add all files as changed
120234
120395
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
120235
120396
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, /*firstSourceFile*/ undefined)
120236
120397
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
120237
120398
  }
120238
- else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
120399
+ else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
120239
120400
  // Add all files to affectedFilesPendingEmit since emit changed
120240
120401
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1 /* Full */); });
120241
120402
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
120242
120403
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
120243
120404
  }
120244
- if (useOldState) {
120245
- // Any time the interpretation of a source file changes, mark it as changed
120246
- ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
120247
- if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
120248
- state.changedFilesSet.add(sourceFilePath);
120249
- }
120250
- });
120251
- }
120252
- state.buildInfoEmitPending = !!state.changedFilesSet.size;
120405
+ // Since old states change files set is copied, any additional change means we would need to emit build info
120406
+ state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
120253
120407
  return state;
120254
120408
  }
120255
120409
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -120285,30 +120439,35 @@ var ts;
120285
120439
  ts.BuilderState.releaseCache(state);
120286
120440
  state.program = undefined;
120287
120441
  }
120288
- /**
120289
- * Creates a clone of the state
120290
- */
120291
- function cloneBuilderProgramState(state) {
120292
- var _a;
120293
- var newState = ts.BuilderState.clone(state);
120294
- newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
120295
- newState.changedFilesSet = new ts.Set(state.changedFilesSet);
120296
- newState.affectedFiles = state.affectedFiles;
120297
- newState.affectedFilesIndex = state.affectedFilesIndex;
120298
- newState.currentChangedFilePath = state.currentChangedFilePath;
120299
- newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
120300
- newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
120301
- newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
120302
- newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
120303
- newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
120304
- newState.program = state.program;
120305
- newState.compilerOptions = state.compilerOptions;
120306
- newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
120307
- newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
120308
- newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
120309
- newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
120310
- newState.programEmitComplete = state.programEmitComplete;
120311
- return newState;
120442
+ function backupEmitBuilderProgramState(state) {
120443
+ var outFilePath = ts.outFile(state.compilerOptions);
120444
+ // Only in --out changeFileSet is kept around till emit
120445
+ ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
120446
+ return {
120447
+ affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
120448
+ affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
120449
+ affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
120450
+ seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
120451
+ programEmitComplete: state.programEmitComplete,
120452
+ emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
120453
+ outSignature: state.outSignature,
120454
+ dtsChangeTime: state.dtsChangeTime,
120455
+ hasChangedEmitSignature: state.hasChangedEmitSignature,
120456
+ changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
120457
+ };
120458
+ }
120459
+ function restoreEmitBuilderProgramState(state, backupEmitState) {
120460
+ state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
120461
+ state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
120462
+ state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
120463
+ state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
120464
+ state.programEmitComplete = backupEmitState.programEmitComplete;
120465
+ state.emitSignatures = backupEmitState.emitSignatures;
120466
+ state.outSignature = backupEmitState.outSignature;
120467
+ state.dtsChangeTime = backupEmitState.dtsChangeTime;
120468
+ state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
120469
+ if (backupEmitState.changedFilesSet)
120470
+ state.changedFilesSet = backupEmitState.changedFilesSet;
120312
120471
  }
120313
120472
  /**
120314
120473
  * Verifies that source file is ok to be used in calls that arent handled by next
@@ -120323,7 +120482,7 @@ var ts;
120323
120482
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
120324
120483
  */
120325
120484
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
120326
- var _a;
120485
+ var _a, _b;
120327
120486
  while (true) {
120328
120487
  var affectedFiles = state.affectedFiles;
120329
120488
  if (affectedFiles) {
@@ -120343,10 +120502,8 @@ var ts;
120343
120502
  state.changedFilesSet.delete(state.currentChangedFilePath);
120344
120503
  state.currentChangedFilePath = undefined;
120345
120504
  // Commit the changes in file signature
120346
- ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
120347
- state.currentAffectedFilesSignatures.clear();
120348
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120349
- (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
120505
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
120506
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120350
120507
  state.affectedFiles = undefined;
120351
120508
  }
120352
120509
  // Get next changed file
@@ -120364,12 +120521,7 @@ var ts;
120364
120521
  return program;
120365
120522
  }
120366
120523
  // Get next batch of affected files
120367
- if (!state.currentAffectedFilesSignatures)
120368
- state.currentAffectedFilesSignatures = new ts.Map();
120369
- if (state.exportedModulesMap) {
120370
- state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
120371
- }
120372
- state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
120524
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
120373
120525
  state.currentChangedFilePath = nextKey.value;
120374
120526
  state.affectedFilesIndex = 0;
120375
120527
  if (!state.seenAffectedFiles)
@@ -120421,7 +120573,6 @@ var ts;
120421
120573
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
120422
120574
  */
120423
120575
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120424
- var _a;
120425
120576
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
120426
120577
  // If affected files is everything except default library, then nothing more to do
120427
120578
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -120429,10 +120580,9 @@ var ts;
120429
120580
  // When a change affects the global scope, all files are considered to be affected without updating their signature
120430
120581
  // That means when affected file is handled, its signature can be out of date
120431
120582
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
120432
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
120583
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
120433
120584
  return;
120434
120585
  }
120435
- 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);
120436
120586
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
120437
120587
  return;
120438
120588
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -120452,7 +120602,7 @@ var ts;
120452
120602
  // This ensures that we dont later during incremental builds considering wrong signature.
120453
120603
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
120454
120604
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
120455
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
120605
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
120456
120606
  // If not dts emit, nothing more to do
120457
120607
  if (ts.getEmitDeclarations(state.compilerOptions)) {
120458
120608
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -120473,27 +120623,10 @@ var ts;
120473
120623
  return !state.semanticDiagnosticsFromOldState.size;
120474
120624
  }
120475
120625
  function isChangedSignature(state, path) {
120476
- var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
120477
- var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120626
+ var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
120627
+ var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120478
120628
  return newSignature !== oldSignature;
120479
120629
  }
120480
- function forEachKeyOfExportedModulesMap(state, filePath, fn) {
120481
- // Go through exported modules from cache first
120482
- var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
120483
- var result = keys && ts.forEachKey(keys, fn);
120484
- if (result)
120485
- return result;
120486
- // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
120487
- keys = state.exportedModulesMap.getKeys(filePath);
120488
- return keys && ts.forEachKey(keys, function (exportedFromPath) {
120489
- var _a;
120490
- // If the cache had an updated value, skip
120491
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
120492
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
120493
- fn(exportedFromPath) :
120494
- undefined;
120495
- });
120496
- }
120497
120630
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
120498
120631
  var _a;
120499
120632
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -120508,6 +120641,7 @@ var ts;
120508
120641
  * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
120509
120642
  */
120510
120643
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120644
+ var _a;
120511
120645
  // If there was change in signature (dts output) for the changed file,
120512
120646
  // then only we need to handle pending file emit
120513
120647
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
@@ -120534,11 +120668,10 @@ var ts;
120534
120668
  }
120535
120669
  }
120536
120670
  }
120537
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120538
120671
  var seenFileAndExportsOfFile = new ts.Set();
120539
120672
  // Go through exported modules from cache first
120540
120673
  // If exported modules has path, all files referencing file exported from are affected
120541
- forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
120674
+ (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120542
120675
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
120543
120676
  return true;
120544
120677
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -120552,19 +120685,18 @@ var ts;
120552
120685
  * return true when all work is done and we can exit handling dts emit and semantic diagnostics
120553
120686
  */
120554
120687
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
120555
- var _a;
120688
+ var _a, _b;
120556
120689
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
120557
120690
  return undefined;
120558
120691
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
120559
120692
  return true;
120560
120693
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
120561
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120562
120694
  // If exported modules has path, all files referencing file exported from are affected
120563
- forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
120695
+ (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120564
120696
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
120565
120697
  });
120566
120698
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
120567
- (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
120699
+ (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
120568
120700
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
120569
120701
  handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
120570
120702
  state, referencingFilePath, cancellationToken, computeHash, host);
@@ -120585,12 +120717,13 @@ var ts;
120585
120717
  }
120586
120718
  else {
120587
120719
  state.seenAffectedFiles.add(affected.resolvedPath);
120720
+ // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted
120721
+ state.buildInfoEmitPending = true;
120588
120722
  if (emitKind !== undefined) {
120589
120723
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
120590
120724
  }
120591
120725
  if (isPendingEmit) {
120592
120726
  state.affectedFilesPendingEmitIndex++;
120593
- state.buildInfoEmitPending = true;
120594
120727
  }
120595
120728
  else {
120596
120729
  state.affectedFilesIndex++;
@@ -120638,25 +120771,61 @@ var ts;
120638
120771
  }
120639
120772
  return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
120640
120773
  }
120774
+ function isProgramBundleEmitBuildInfo(info) {
120775
+ return !!ts.outFile(info.options || {});
120776
+ }
120777
+ ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
120641
120778
  /**
120642
120779
  * Gets the program information to be emitted in buildInfo so that we can use it to create new program
120643
120780
  */
120644
- function getProgramBuildInfo(state, getCanonicalFileName) {
120645
- if (ts.outFile(state.compilerOptions))
120646
- return undefined;
120781
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
120782
+ var outFilePath = ts.outFile(state.compilerOptions);
120783
+ if (outFilePath && !state.compilerOptions.composite)
120784
+ return;
120647
120785
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
120648
120786
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
120787
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
120788
+ if (outFilePath) {
120789
+ var fileNames_1 = [];
120790
+ var fileInfos_1 = [];
120791
+ state.program.getRootFileNames().forEach(function (f) {
120792
+ var sourceFile = state.program.getSourceFile(f);
120793
+ if (!sourceFile)
120794
+ return;
120795
+ fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
120796
+ fileInfos_1.push(sourceFile.version);
120797
+ });
120798
+ var result_15 = {
120799
+ fileNames: fileNames_1,
120800
+ fileInfos: fileInfos_1,
120801
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
120802
+ outSignature: state.outSignature,
120803
+ dtsChangeTime: state.dtsChangeTime,
120804
+ };
120805
+ return result_15;
120806
+ }
120649
120807
  var fileNames = [];
120650
120808
  var fileNameToFileId = new ts.Map();
120651
120809
  var fileIdsList;
120652
120810
  var fileNamesToFileIdListId;
120811
+ var emitSignatures;
120653
120812
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
120813
+ var _b, _c;
120654
120814
  var key = _a[0], value = _a[1];
120655
120815
  // Ensure fileId
120656
120816
  var fileId = toFileId(key);
120657
120817
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
120658
- var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120659
- var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120818
+ var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
120819
+ var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
120820
+ if (state.compilerOptions.composite) {
120821
+ var file = state.program.getSourceFileByPath(key);
120822
+ if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
120823
+ var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
120824
+ if (emitSignature !== actualSignature) {
120825
+ (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
120826
+ }
120827
+ }
120828
+ }
120660
120829
  return value.version === actualSignature ?
120661
120830
  value.affectsGlobalScope || value.impliedFormat ?
120662
120831
  // If file version is same as signature, dont serialize signature
@@ -120664,11 +120833,11 @@ var ts;
120664
120833
  // If file info only contains version and signature and both are same we can just write string
120665
120834
  value.version :
120666
120835
  actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120667
- signature === undefined ?
120836
+ oldSignature === undefined ?
120668
120837
  // If we havent computed signature, use fileInfo as is
120669
120838
  value :
120670
120839
  // Serialize fileInfo with new updated signature
120671
- { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120840
+ { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120672
120841
  // Signature of the FileInfo is undefined, serialize it as false
120673
120842
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120674
120843
  });
@@ -120683,17 +120852,13 @@ var ts;
120683
120852
  if (state.exportedModulesMap) {
120684
120853
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
120685
120854
  var _a;
120686
- if (state.currentAffectedFilesExportedModulesMap) {
120687
- if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
120688
- return undefined;
120689
- }
120690
- var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
120691
- if (newValue) {
120692
- return [toFileId(key), toFileIdListId(newValue)];
120693
- }
120694
- }
120855
+ var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
120695
120856
  // Not in temporary cache, use existing value
120696
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120857
+ if (oldValue === undefined)
120858
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120859
+ if (oldValue)
120860
+ return [toFileId(key), toFileIdListId(oldValue)];
120861
+ return undefined;
120697
120862
  });
120698
120863
  }
120699
120864
  var semanticDiagnosticsPerFile;
@@ -120704,9 +120869,7 @@ var ts;
120704
120869
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
120705
120870
  [
120706
120871
  toFileId(key),
120707
- state.hasReusableDiagnostic ?
120708
- value :
120709
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120872
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
120710
120873
  ] :
120711
120874
  toFileId(key));
120712
120875
  }
@@ -120721,16 +120884,27 @@ var ts;
120721
120884
  }
120722
120885
  }
120723
120886
  }
120724
- return {
120887
+ var changeFileSet;
120888
+ if (state.changedFilesSet.size) {
120889
+ for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
120890
+ var path = _e[_d];
120891
+ (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120892
+ }
120893
+ }
120894
+ var result = {
120725
120895
  fileNames: fileNames,
120726
120896
  fileInfos: fileInfos,
120727
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
120897
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
120728
120898
  fileIdsList: fileIdsList,
120729
120899
  referencedMap: referencedMap,
120730
120900
  exportedModulesMap: exportedModulesMap,
120731
120901
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
120732
120902
  affectedFilesPendingEmit: affectedFilesPendingEmit,
120903
+ changeFileSet: changeFileSet,
120904
+ emitSignatures: emitSignatures,
120905
+ dtsChangeTime: state.dtsChangeTime,
120733
120906
  };
120907
+ return result;
120734
120908
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
120735
120909
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
120736
120910
  }
@@ -120755,24 +120929,18 @@ var ts;
120755
120929
  }
120756
120930
  return fileIdListId;
120757
120931
  }
120758
- }
120759
- function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
120760
- var result;
120761
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120762
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120763
- var name = _a[_i];
120764
- var optionKey = name.toLowerCase();
120765
- var optionInfo = optionsNameMap.get(optionKey);
120766
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
120767
- // We need to store `strict`, even though it won't be examined directly, so that the
120768
- // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
120769
- optionKey === "strict" ||
120770
- // We need to store these to determine whether `lib` files need to be rechecked.
120771
- optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
120772
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
120932
+ function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
120933
+ var result;
120934
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120935
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120936
+ var name = _a[_i];
120937
+ var optionInfo = optionsNameMap.get(name.toLowerCase());
120938
+ if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
120939
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
120940
+ }
120773
120941
  }
120942
+ return result;
120774
120943
  }
120775
- return result;
120776
120944
  }
120777
120945
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120778
120946
  if (option) {
@@ -120846,6 +121014,10 @@ var ts;
120846
121014
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
120847
121015
  }
120848
121016
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
121017
+ function computeSignature(text, data, computeHash) {
121018
+ return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
121019
+ }
121020
+ ts.computeSignature = computeSignature;
120849
121021
  function createBuilderProgram(kind, _a) {
120850
121022
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
120851
121023
  // Return same program if underlying program doesnt change
@@ -120864,8 +121036,8 @@ var ts;
120864
121036
  */
120865
121037
  var computeHash = ts.maybeBind(host, host.createHash);
120866
121038
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
120867
- var backupState;
120868
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
121039
+ var backupEmitState;
121040
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
120869
121041
  // To ensure that we arent storing any references to old program or new program without state
120870
121042
  newProgram = undefined; // TODO: GH#18217
120871
121043
  oldProgram = undefined;
@@ -120873,20 +121045,20 @@ var ts;
120873
121045
  var getState = function () { return state; };
120874
121046
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
120875
121047
  builderProgram.getState = getState;
120876
- builderProgram.backupState = function () {
120877
- ts.Debug.assert(backupState === undefined);
120878
- backupState = cloneBuilderProgramState(state);
121048
+ builderProgram.backupEmitState = function () {
121049
+ ts.Debug.assert(backupEmitState === undefined);
121050
+ backupEmitState = backupEmitBuilderProgramState(state);
120879
121051
  };
120880
- builderProgram.restoreState = function () {
120881
- state = ts.Debug.checkDefined(backupState);
120882
- backupState = undefined;
121052
+ builderProgram.restoreEmitState = function () {
121053
+ restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
121054
+ backupEmitState = undefined;
120883
121055
  };
120884
121056
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
120885
121057
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
120886
121058
  builderProgram.emit = emit;
120887
121059
  builderProgram.releaseProgram = function () {
120888
121060
  releaseCache(state);
120889
- backupState = undefined;
121061
+ backupEmitState = undefined;
120890
121062
  };
120891
121063
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
120892
121064
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -120945,35 +121117,59 @@ var ts;
120945
121117
  return toAffectedFileEmitResult(state,
120946
121118
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
120947
121119
  // Otherwise just affected file
120948
- ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120949
- getWriteFileUpdatingSignatureCallback(writeFile) :
121120
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
121121
+ getWriteFileCallback(writeFile, customTransformers) :
120950
121122
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
120951
121123
  }
120952
- function getWriteFileUpdatingSignatureCallback(writeFile) {
121124
+ function getWriteFileCallback(writeFile, customTransformers) {
120953
121125
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
120954
- var _a;
121126
+ var _a, _b, _c;
120955
121127
  if (ts.isDeclarationFileName(fileName)) {
120956
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120957
- var file = sourceFiles[0];
120958
- var info = state.fileInfos.get(file.resolvedPath);
120959
- var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120960
- if (signature === file.version) {
120961
- var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120962
- if (newSignature !== file.version) { // Update it
120963
- if (host.storeFilesChangingSignatureDuringEmit)
120964
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120965
- if (state.exportedModulesMap)
120966
- ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
120967
- if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
120968
- state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
121128
+ if (!ts.outFile(state.compilerOptions)) {
121129
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
121130
+ var newSignature = void 0;
121131
+ if (!customTransformers) {
121132
+ var file = sourceFiles[0];
121133
+ var info = state.fileInfos.get(file.resolvedPath);
121134
+ if (info.signature === file.version) {
121135
+ newSignature = computeSignature(text, data, computeHash);
121136
+ if (newSignature !== file.version) { // Update it
121137
+ if (host.storeFilesChangingSignatureDuringEmit)
121138
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
121139
+ if (state.exportedModulesMap)
121140
+ ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
121141
+ if (state.affectedFiles) {
121142
+ // Keep old signature so we know what to undo if cancellation happens
121143
+ var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
121144
+ if (existing === undefined)
121145
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
121146
+ info.signature = newSignature;
121147
+ }
121148
+ else {
121149
+ // These are directly commited
121150
+ info.signature = newSignature;
121151
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
121152
+ }
121153
+ }
120969
121154
  }
120970
- else {
120971
- info.signature = newSignature;
120972
- if (state.exportedModulesMap)
120973
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
121155
+ }
121156
+ if (state.compilerOptions.composite) {
121157
+ var filePath = sourceFiles[0].resolvedPath;
121158
+ var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
121159
+ newSignature || (newSignature = computeSignature(text, data, computeHash));
121160
+ if (newSignature !== oldSignature) {
121161
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
121162
+ state.hasChangedEmitSignature = true;
120974
121163
  }
120975
121164
  }
120976
121165
  }
121166
+ else if (state.compilerOptions.composite) {
121167
+ var newSignature = computeSignature(text, data, computeHash);
121168
+ if (newSignature !== state.outSignature) {
121169
+ state.outSignature = newSignature;
121170
+ state.hasChangedEmitSignature = true;
121171
+ }
121172
+ }
120977
121173
  }
120978
121174
  if (writeFile)
120979
121175
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -121038,8 +121234,8 @@ var ts;
121038
121234
  }
121039
121235
  }
121040
121236
  }
121041
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
121042
- getWriteFileUpdatingSignatureCallback(writeFile) :
121237
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
121238
+ getWriteFileCallback(writeFile, customTransformers) :
121043
121239
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
121044
121240
  }
121045
121241
  /**
@@ -121128,29 +121324,58 @@ var ts;
121128
121324
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
121129
121325
  }
121130
121326
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
121131
- function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
121132
- var _a;
121327
+ function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
121328
+ var _a, _b, _c, _d;
121133
121329
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
121134
121330
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
121135
- var filePaths = program.fileNames.map(toPath);
121136
- var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
121137
- var fileInfos = new ts.Map();
121138
- program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
121139
- var state = {
121140
- fileInfos: fileInfos,
121141
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121142
- referencedMap: toManyToManyPathMap(program.referencedMap),
121143
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121144
- 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]; }),
121145
- hasReusableDiagnostic: true,
121146
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
121147
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
121148
- affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
121149
- };
121331
+ var state;
121332
+ var filePaths;
121333
+ var filePathsSetList;
121334
+ if (isProgramBundleEmitBuildInfo(program)) {
121335
+ state = {
121336
+ fileInfos: new ts.Map(),
121337
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121338
+ dtsChangeTime: program.dtsChangeTime,
121339
+ outSignature: program.outSignature,
121340
+ };
121341
+ }
121342
+ else {
121343
+ filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
121344
+ filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
121345
+ var fileInfos_2 = new ts.Map();
121346
+ var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
121347
+ program.fileInfos.forEach(function (fileInfo, index) {
121348
+ var path = toFilePath(index + 1);
121349
+ var stateFileInfo = toBuilderStateFileInfo(fileInfo);
121350
+ fileInfos_2.set(path, stateFileInfo);
121351
+ if (emitSignatures_1 && stateFileInfo.signature)
121352
+ emitSignatures_1.set(path, stateFileInfo.signature);
121353
+ });
121354
+ (_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
121355
+ if (ts.isNumber(value))
121356
+ emitSignatures_1.delete(toFilePath(value));
121357
+ else
121358
+ emitSignatures_1.set(toFilePath(value[0]), value[1]);
121359
+ });
121360
+ state = {
121361
+ fileInfos: fileInfos_2,
121362
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121363
+ referencedMap: toManyToManyPathMap(program.referencedMap),
121364
+ exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121365
+ 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]; }),
121366
+ hasReusableDiagnostic: true,
121367
+ affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
121368
+ affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
121369
+ affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
121370
+ changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
121371
+ dtsChangeTime: program.dtsChangeTime,
121372
+ emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
121373
+ };
121374
+ }
121150
121375
  return {
121151
121376
  getState: function () { return state; },
121152
- backupState: ts.noop,
121153
- restoreState: ts.noop,
121377
+ backupEmitState: ts.noop,
121378
+ restoreEmitState: ts.noop,
121154
121379
  getProgram: ts.notImplemented,
121155
121380
  getProgramOrUndefined: ts.returnUndefined,
121156
121381
  releaseProgram: ts.noop,
@@ -121195,12 +121420,24 @@ var ts;
121195
121420
  return map;
121196
121421
  }
121197
121422
  }
121198
- ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
121423
+ ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
121424
+ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
121425
+ var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
121426
+ var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
121427
+ var fileInfos = new ts.Map();
121428
+ program.fileInfos.forEach(function (fileInfo, index) {
121429
+ var path = ts.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
121430
+ var version = ts.isString(fileInfo) ? fileInfo : fileInfo.version; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
121431
+ fileInfos.set(path, version);
121432
+ });
121433
+ return fileInfos;
121434
+ }
121435
+ ts.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap;
121199
121436
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
121200
121437
  return {
121201
121438
  getState: ts.notImplemented,
121202
- backupState: ts.noop,
121203
- restoreState: ts.noop,
121439
+ backupEmitState: ts.noop,
121440
+ restoreEmitState: ts.noop,
121204
121441
  getProgram: getProgram,
121205
121442
  getProgramOrUndefined: function () { return getState().program; },
121206
121443
  releaseProgram: function () { return getState().program = undefined; },
@@ -122316,9 +122553,9 @@ var ts;
122316
122553
  if (!preferSymlinks) {
122317
122554
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
122318
122555
  // so we only need to remove them from the realpath filenames.
122319
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122320
- if (result_15)
122321
- return result_15;
122556
+ var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122557
+ if (result_16)
122558
+ return result_16;
122322
122559
  }
122323
122560
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
122324
122561
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -122338,10 +122575,10 @@ var ts;
122338
122575
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
122339
122576
  var symlinkDirectory = symlinkDirectories_1[_i];
122340
122577
  var option = ts.resolvePath(symlinkDirectory, relative);
122341
- var result_16 = cb(option, target === referenceRedirect);
122578
+ var result_17 = cb(option, target === referenceRedirect);
122342
122579
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
122343
- if (result_16)
122344
- return result_16;
122580
+ if (result_17)
122581
+ return result_17;
122345
122582
  }
122346
122583
  });
122347
122584
  });
@@ -122383,7 +122620,7 @@ var ts;
122383
122620
  });
122384
122621
  // Sort by paths closest to importing file Name directory
122385
122622
  var sortedPaths = [];
122386
- var _loop_32 = function (directory) {
122623
+ var _loop_33 = function (directory) {
122387
122624
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
122388
122625
  var pathsInDirectory;
122389
122626
  allFileNames.forEach(function (_a, fileName) {
@@ -122407,7 +122644,7 @@ var ts;
122407
122644
  };
122408
122645
  var out_directory_1;
122409
122646
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
122410
- var state_10 = _loop_32(directory);
122647
+ var state_10 = _loop_33(directory);
122411
122648
  directory = out_directory_1;
122412
122649
  if (state_10 === "break")
122413
122650
  break;
@@ -123251,6 +123488,7 @@ var ts;
123251
123488
  readDirectory: ts.maybeBind(host, host.readDirectory),
123252
123489
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
123253
123490
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
123491
+ now: ts.maybeBind(host, host.now),
123254
123492
  };
123255
123493
  function writeFile(fileName, text, writeByteOrderMark, onError) {
123256
123494
  try {
@@ -123311,6 +123549,7 @@ var ts;
123311
123549
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
123312
123550
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
123313
123551
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
123552
+ now: ts.maybeBind(system, system.now),
123314
123553
  };
123315
123554
  }
123316
123555
  ts.createProgramHost = createProgramHost;
@@ -123378,20 +123617,26 @@ var ts;
123378
123617
  var ts;
123379
123618
  (function (ts) {
123380
123619
  function readBuilderProgram(compilerOptions, host) {
123381
- if (ts.outFile(compilerOptions))
123382
- return undefined;
123383
123620
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
123384
123621
  if (!buildInfoPath)
123385
123622
  return undefined;
123386
- var content = host.readFile(buildInfoPath);
123387
- if (!content)
123388
- return undefined;
123389
- var buildInfo = ts.getBuildInfo(content);
123623
+ var buildInfo;
123624
+ if (host.getBuildInfo) {
123625
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
123626
+ if (!buildInfo)
123627
+ return undefined;
123628
+ }
123629
+ else {
123630
+ var content = host.readFile(buildInfoPath);
123631
+ if (!content)
123632
+ return undefined;
123633
+ buildInfo = ts.getBuildInfo(content);
123634
+ }
123390
123635
  if (buildInfo.version !== ts.version)
123391
123636
  return undefined;
123392
123637
  if (!buildInfo.program)
123393
123638
  return undefined;
123394
- return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123639
+ return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123395
123640
  }
123396
123641
  ts.readBuilderProgram = readBuilderProgram;
123397
123642
  function createIncrementalCompilerHost(options, system) {
@@ -123400,6 +123645,7 @@ var ts;
123400
123645
  host.createHash = ts.maybeBind(system, system.createHash);
123401
123646
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
123402
123647
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
123648
+ host.now = ts.maybeBind(system, system.now);
123403
123649
  ts.setGetSourceFileAsHashVersioned(host, system);
123404
123650
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
123405
123651
  return host;
@@ -124135,14 +124381,17 @@ var ts;
124135
124381
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
124136
124382
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
124137
124383
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
124138
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
124139
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
124140
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
124141
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
124384
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
124385
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
124386
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
124387
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
124388
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
124389
+ UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
124142
124390
  /**
124143
124391
  * Projects with no outputs (i.e. "solution" files)
124144
124392
  */
124145
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
124393
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
124394
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
124146
124395
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
124147
124396
  function resolveConfigFileProjectName(project) {
124148
124397
  if (ts.fileExtensionIs(project, ".json" /* Json */)) {
@@ -124187,9 +124436,11 @@ var ts;
124187
124436
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
124188
124437
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
124189
124438
  }
124190
- function newer(date1, date2) {
124191
- return date2 > date1 ? date2 : date1;
124439
+ /*@internal*/
124440
+ function getCurrentTime(host) {
124441
+ return host.now ? host.now() : new Date();
124192
124442
  }
124443
+ ts.getCurrentTime = getCurrentTime;
124193
124444
  /*@internal*/
124194
124445
  function isCircularBuildOrder(buildOrder) {
124195
124446
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -124279,6 +124530,7 @@ var ts;
124279
124530
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
124280
124531
  };
124281
124532
  }
124533
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
124282
124534
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
124283
124535
  var state = {
124284
124536
  host: host,
@@ -124295,8 +124547,9 @@ var ts;
124295
124547
  resolvedConfigFilePaths: new ts.Map(),
124296
124548
  configFileCache: new ts.Map(),
124297
124549
  projectStatus: new ts.Map(),
124298
- buildInfoChecked: new ts.Map(),
124299
124550
  extendedConfigCache: new ts.Map(),
124551
+ buildInfoCache: new ts.Map(),
124552
+ outputTimeStamps: new ts.Map(),
124300
124553
  builderPrograms: new ts.Map(),
124301
124554
  diagnostics: new ts.Map(),
124302
124555
  projectPendingBuild: new ts.Map(),
@@ -124319,6 +124572,7 @@ var ts;
124319
124572
  allWatchedConfigFiles: new ts.Map(),
124320
124573
  allWatchedExtendedConfigFiles: new ts.Map(),
124321
124574
  allWatchedPackageJsonFiles: new ts.Map(),
124575
+ filesWatched: new ts.Map(),
124322
124576
  lastCachedPackageJsonLookups: new ts.Map(),
124323
124577
  timerToBuildInvalidatedProject: undefined,
124324
124578
  reportFileChangeDetected: false,
@@ -124353,6 +124607,7 @@ var ts;
124353
124607
  if (value) {
124354
124608
  return isParsedCommandLine(value) ? value : undefined;
124355
124609
  }
124610
+ ts.solutionPerformance.mark("beforeParseConfigFile");
124356
124611
  var diagnostic;
124357
124612
  var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host;
124358
124613
  var parsed;
@@ -124367,6 +124622,8 @@ var ts;
124367
124622
  parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
124368
124623
  }
124369
124624
  configFileCache.set(configFilePath, parsed || diagnostic);
124625
+ ts.solutionPerformance.mark("afterParseConfigFile");
124626
+ ts.solutionPerformance.measure("ParseConfigFile", "beforeParseConfigFile", "afterParseConfigFile");
124370
124627
  return parsed;
124371
124628
  }
124372
124629
  function resolveProjectName(state, name) {
@@ -124416,6 +124673,7 @@ var ts;
124416
124673
  return state.buildOrder || createStateBuildOrder(state);
124417
124674
  }
124418
124675
  function createStateBuildOrder(state) {
124676
+ ts.solutionPerformance.mark("beforeCreateBuildOrder");
124419
124677
  var buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); }));
124420
124678
  // Clear all to ResolvedConfigFilePaths cache to start fresh
124421
124679
  state.resolvedConfigFilePaths.clear();
@@ -124425,11 +124683,12 @@ var ts;
124425
124683
  // Config file cache
124426
124684
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
124427
124685
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
124428
- ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
124429
124686
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
124430
124687
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
124431
124688
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
124432
124689
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
124690
+ ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
124691
+ ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
124433
124692
  // Remove watches for the program no longer in the solution
124434
124693
  if (state.watch) {
124435
124694
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
@@ -124445,6 +124704,8 @@ var ts;
124445
124704
  ts.mutateMapSkippingNewValues(state.allWatchedInputFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
124446
124705
  ts.mutateMapSkippingNewValues(state.allWatchedPackageJsonFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
124447
124706
  }
124707
+ ts.solutionPerformance.mark("afterCreateBuildOrder");
124708
+ ts.solutionPerformance.measure("CreateBuildOrder", "beforeCreateBuildOrder", "afterCreateBuildOrder");
124448
124709
  return state.buildOrder = buildOrder;
124449
124710
  }
124450
124711
  function getBuildOrderFor(state, project, onlyReferences) {
@@ -124565,6 +124826,7 @@ var ts;
124565
124826
  if (updateOutputFileStampsPending) {
124566
124827
  updateOutputTimestamps(state, config, projectPath);
124567
124828
  }
124829
+ ts.solutionPerformance.mark("timestampUpdated");
124568
124830
  return doneInvalidatedProject(state, projectPath);
124569
124831
  }
124570
124832
  };
@@ -124658,6 +124920,10 @@ var ts;
124658
124920
  };
124659
124921
  function done(cancellationToken, writeFile, customTransformers) {
124660
124922
  executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers);
124923
+ if (kind === InvalidatedProjectKind.Build)
124924
+ ts.solutionPerformance.mark("projectsBuilt");
124925
+ else
124926
+ ts.solutionPerformance.mark("bundlesUpdated");
124661
124927
  return doneInvalidatedProject(state, projectPath);
124662
124928
  }
124663
124929
  function withProgramOrUndefined(action) {
@@ -124719,21 +124985,21 @@ var ts;
124719
124985
  }
124720
124986
  function emit(writeFileCallback, cancellationToken, customTransformers) {
124721
124987
  var _a;
124722
- var _b, _c;
124988
+ var _b, _c, _d;
124723
124989
  ts.Debug.assertIsDefined(program);
124724
124990
  ts.Debug.assert(step === BuildStep.Emit);
124725
124991
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
124726
- program.backupState();
124992
+ program.backupEmitState();
124727
124993
  var declDiagnostics;
124728
124994
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
124729
124995
  var outputFiles = [];
124730
124996
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
124731
124997
  /*write*/ undefined,
124732
- /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
124998
+ /*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,
124733
124999
  /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
124734
125000
  // Don't emit .d.ts if there are decl file errors
124735
125001
  if (declDiagnostics) {
124736
- program.restoreState();
125002
+ program.restoreEmitState();
124737
125003
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
124738
125004
  return {
124739
125005
  emitSkipped: true,
@@ -124743,37 +125009,46 @@ var ts;
124743
125009
  // Actual Emit
124744
125010
  var host = state.host, compilerHost = state.compilerHost;
124745
125011
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124746
- var newestDeclarationFileContentChangedTime = minimumDate;
124747
- var anyDtsChanged = false;
125012
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
124748
125013
  var emitterDiagnostics = ts.createDiagnosticCollection();
124749
125014
  var emittedOutputs = new ts.Map();
125015
+ var options = program.getCompilerOptions();
125016
+ var isIncremental = ts.isIncrementalCompilation(options);
125017
+ var outputTimeStampMap;
125018
+ var now;
125019
+ ts.solutionPerformance.mark("beforeOutputFilesWrite");
124750
125020
  outputFiles.forEach(function (_a) {
124751
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124752
- var priorChangeTime;
124753
- if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124754
- // Check for unchanged .d.ts files
124755
- if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124756
- priorChangeTime = host.getModifiedTime(name);
124757
- }
124758
- else {
125021
+ var _b, _c;
125022
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
125023
+ var path = toPath(state, name);
125024
+ emittedOutputs.set(toPath(state, name), name);
125025
+ if (buildInfo) {
125026
+ setBuildInfo(state, buildInfo, projectPath, options);
125027
+ 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)) {
124759
125028
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124760
- anyDtsChanged = true;
124761
125029
  }
124762
125030
  }
124763
- emittedOutputs.set(toPath(state, name), name);
124764
125031
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124765
- if (priorChangeTime !== undefined) {
124766
- newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
125032
+ if (!isIncremental && state.watch) {
125033
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
124767
125034
  }
124768
125035
  });
124769
- finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime,
124770
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
125036
+ ts.solutionPerformance.mark("afterOutputFilesWrite");
125037
+ ts.solutionPerformance.measure("OutputFilesWrite", "beforeOutputFilesWrite", "afterOutputFilesWrite");
125038
+ finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124771
125039
  return emitResult;
124772
125040
  }
124773
125041
  function emitBuildInfo(writeFileCallback, cancellationToken) {
124774
125042
  ts.Debug.assertIsDefined(program);
124775
125043
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
124776
- var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
125044
+ var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
125045
+ if (data === null || data === void 0 ? void 0 : data.buildInfo)
125046
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
125047
+ if (writeFileCallback)
125048
+ writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
125049
+ else
125050
+ state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
125051
+ }, cancellationToken);
124777
125052
  if (emitResult.diagnostics.length) {
124778
125053
  reportErrors(state, emitResult.diagnostics);
124779
125054
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -124786,7 +125061,7 @@ var ts;
124786
125061
  step = BuildStep.QueueReferencingProjects;
124787
125062
  return emitResult;
124788
125063
  }
124789
- function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
125064
+ function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
124790
125065
  var _a;
124791
125066
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
124792
125067
  if (emitDiagnostics.length) {
@@ -124797,13 +125072,11 @@ var ts;
124797
125072
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
124798
125073
  }
124799
125074
  // Update time stamps for rest of the outputs
124800
- var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
125075
+ updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124801
125076
  state.diagnostics.delete(projectPath);
124802
125077
  state.projectStatus.set(projectPath, {
124803
125078
  type: ts.UpToDateStatusType.UpToDate,
124804
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
124805
- maximumDate :
124806
- newestDeclarationFileContentChangedTime,
125079
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
124807
125080
  oldestOutputFileName: oldestOutputFileName
124808
125081
  });
124809
125082
  afterProgramDone(state, program, config);
@@ -124838,13 +125111,21 @@ var ts;
124838
125111
  ts.Debug.assert(!!outputFiles.length);
124839
125112
  var emitterDiagnostics = ts.createDiagnosticCollection();
124840
125113
  var emittedOutputs = new ts.Map();
125114
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
125115
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
124841
125116
  outputFiles.forEach(function (_a) {
124842
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
125117
+ var _b, _c;
125118
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124843
125119
  emittedOutputs.set(toPath(state, name), name);
125120
+ if (buildInfo) {
125121
+ setBuildInfo(state, buildInfo, projectPath, config.options);
125122
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
125123
+ resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
125124
+ }
125125
+ }
124844
125126
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124845
125127
  });
124846
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate,
124847
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
125128
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
124848
125129
  return { emitSkipped: false, diagnostics: emitDiagnostics };
124849
125130
  }
124850
125131
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -124895,6 +125176,13 @@ var ts;
124895
125176
  !ts.isIncrementalCompilation(config.options);
124896
125177
  }
124897
125178
  function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
125179
+ ts.solutionPerformance.mark("beforeGetNextInvalidatedProjectCreateInfo");
125180
+ var result = getNextInvalidatedProjectCreateInfoWorker(state, buildOrder, reportQueue);
125181
+ ts.solutionPerformance.mark("afterGetNextInvalidatedProjectCreateInfo");
125182
+ ts.solutionPerformance.measure("GetNextInvalidatedProjectCreateInfo", "beforeGetNextInvalidatedProjectCreateInfo", "afterGetNextInvalidatedProjectCreateInfo");
125183
+ return result;
125184
+ }
125185
+ function getNextInvalidatedProjectCreateInfoWorker(state, buildOrder, reportQueue) {
124898
125186
  if (!state.projectPendingBuild.size)
124899
125187
  return undefined;
124900
125188
  if (isCircularBuildOrder(buildOrder))
@@ -124943,7 +125231,7 @@ var ts;
124943
125231
  }
124944
125232
  continue;
124945
125233
  }
124946
- if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
125234
+ if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
124947
125235
  reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
124948
125236
  return {
124949
125237
  kind: InvalidatedProjectKind.UpdateOutputFileStamps,
@@ -124994,9 +125282,7 @@ var ts;
124994
125282
  }
124995
125283
  function getNextInvalidatedProject(state, buildOrder, reportQueue) {
124996
125284
  var info = getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue);
124997
- if (!info)
124998
- return info;
124999
- return createInvalidatedProjectWithInfo(state, info, buildOrder);
125285
+ return info && createInvalidatedProjectWithInfo(state, info, buildOrder);
125000
125286
  }
125001
125287
  function listEmittedFile(_a, proj, file) {
125002
125288
  var write = _a.write;
@@ -125004,14 +125290,17 @@ var ts;
125004
125290
  write("TSFILE: " + file);
125005
125291
  }
125006
125292
  }
125007
- function getOldProgram(_a, proj, parsed) {
125008
- var options = _a.options, builderPrograms = _a.builderPrograms, compilerHost = _a.compilerHost;
125009
- if (options.force)
125293
+ function getOldProgram(state, proj, parsed) {
125294
+ if (state.options.force)
125010
125295
  return undefined;
125011
- var value = builderPrograms.get(proj);
125296
+ var value = state.builderPrograms.get(proj);
125012
125297
  if (value)
125013
125298
  return value;
125014
- return ts.readBuilderProgram(parsed.options, compilerHost);
125299
+ ts.solutionPerformance.mark("beforeReadBuilderProgram");
125300
+ var program = ts.readBuilderProgram(parsed.options, state.compilerHost);
125301
+ ts.solutionPerformance.mark("afterReadBuilderProgram");
125302
+ ts.solutionPerformance.measure("ReadBuilderProgram", "beforeReadBuilderProgram", "afterReadBuilderProgram");
125303
+ return program;
125015
125304
  }
125016
125305
  function afterProgramDone(state, program, config) {
125017
125306
  if (program) {
@@ -125028,7 +125317,7 @@ var ts;
125028
125317
  state.projectCompilerOptions = state.baseCompilerOptions;
125029
125318
  }
125030
125319
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
125031
- var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
125320
+ var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
125032
125321
  reportAndStoreErrors(state, resolvedPath, diagnostics);
125033
125322
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
125034
125323
  if (canEmitBuildInfo)
@@ -125036,9 +125325,101 @@ var ts;
125036
125325
  afterProgramDone(state, program, config);
125037
125326
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
125038
125327
  }
125328
+ function isFileWatcherWithModifiedTime(value) {
125329
+ return !!value.watcher;
125330
+ }
125331
+ function getModifiedTime(state, fileName) {
125332
+ var path = toPath(state, fileName);
125333
+ var existing = state.filesWatched.get(path);
125334
+ if (state.watch && !!existing) {
125335
+ if (!isFileWatcherWithModifiedTime(existing))
125336
+ return existing;
125337
+ if (existing.modifiedTime)
125338
+ return existing.modifiedTime;
125339
+ }
125340
+ var result = ts.getModifiedTime(state.host, fileName);
125341
+ if (state.watch) {
125342
+ if (existing)
125343
+ existing.modifiedTime = result;
125344
+ else
125345
+ state.filesWatched.set(path, result);
125346
+ }
125347
+ return result;
125348
+ }
125349
+ function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
125350
+ var path = toPath(state, file);
125351
+ var existing = state.filesWatched.get(path);
125352
+ if (existing && isFileWatcherWithModifiedTime(existing)) {
125353
+ existing.callbacks.push(callback);
125354
+ }
125355
+ else {
125356
+ var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
125357
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
125358
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
125359
+ existing.modifiedTime = modifiedTime;
125360
+ existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
125361
+ }, pollingInterval, options, watchType, project);
125362
+ state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
125363
+ }
125364
+ return {
125365
+ close: function () {
125366
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
125367
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
125368
+ if (existing.callbacks.length === 1) {
125369
+ state.filesWatched.delete(path);
125370
+ ts.closeFileWatcherOf(existing);
125371
+ }
125372
+ else {
125373
+ ts.unorderedRemoveItem(existing.callbacks, callback);
125374
+ }
125375
+ }
125376
+ };
125377
+ }
125378
+ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
125379
+ if (!state.watch)
125380
+ return undefined;
125381
+ var result = state.outputTimeStamps.get(resolvedConfigFilePath);
125382
+ if (!result)
125383
+ state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
125384
+ return result;
125385
+ }
125386
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
125387
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125388
+ var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
125389
+ if (existing) {
125390
+ existing.buildInfo = buildInfo;
125391
+ existing.modifiedTime = getCurrentTime(state.host);
125392
+ }
125393
+ else {
125394
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
125395
+ }
125396
+ }
125397
+ function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
125398
+ var path = toPath(state, buildInfoPath);
125399
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
125400
+ return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
125401
+ }
125402
+ function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
125403
+ var path = toPath(state, buildInfoPath);
125404
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
125405
+ if (existing !== undefined && existing.path === path) {
125406
+ return existing.buildInfo || undefined;
125407
+ }
125408
+ ts.solutionPerformance.mark("beforeGetBuildInfo");
125409
+ ts.solutionPerformance.mark("beforeBuildInfoRead");
125410
+ var value = state.readFileWithCache(buildInfoPath);
125411
+ ts.solutionPerformance.mark("afterBuildInfoRead");
125412
+ ts.solutionPerformance.measure("BuildInfoRead", "beforeBuildInfoRead", "afterBuildInfoRead");
125413
+ var buildInfo = value ? ts.getBuildInfo(value) : undefined;
125414
+ ts.Debug.assert(modifiedTime || !buildInfo);
125415
+ state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
125416
+ ts.solutionPerformance.mark("afterGetBuildInfo");
125417
+ ts.solutionPerformance.measure("GetBuildInfo", "beforeGetBuildInfo", "afterGetBuildInfo");
125418
+ return buildInfo;
125419
+ }
125039
125420
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
125040
125421
  // Check tsconfig time
125041
- var tsconfigTime = ts.getModifiedTime(state.host, configFile);
125422
+ var tsconfigTime = getModifiedTime(state, configFile);
125042
125423
  if (oldestOutputFileTime < tsconfigTime) {
125043
125424
  return {
125044
125425
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -125048,88 +125429,24 @@ var ts;
125048
125429
  }
125049
125430
  }
125050
125431
  function getUpToDateStatusWorker(state, project, resolvedPath) {
125051
- var force = !!state.options.force;
125052
- var newestInputFileName = undefined;
125053
- var newestInputFileTime = minimumDate;
125054
- var host = state.host;
125055
- // Get timestamps of input files
125056
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
125057
- var inputFile = _a[_i];
125058
- if (!host.fileExists(inputFile)) {
125059
- return {
125060
- type: ts.UpToDateStatusType.Unbuildable,
125061
- reason: inputFile + " does not exist"
125062
- };
125063
- }
125064
- if (!force) {
125065
- var inputTime = ts.getModifiedTime(host, inputFile);
125066
- if (inputTime > newestInputFileTime) {
125067
- newestInputFileName = inputFile;
125068
- newestInputFileTime = inputTime;
125069
- }
125070
- }
125071
- }
125432
+ var _a, _b, _c;
125072
125433
  // Container if no files are specified in the project
125073
125434
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
125074
125435
  return {
125075
125436
  type: ts.UpToDateStatusType.ContainerOnly
125076
125437
  };
125077
125438
  }
125078
- // Collect the expected outputs of this project
125079
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
125080
- // Now see if all outputs are newer than the newest input
125081
- var oldestOutputFileName = "(none)";
125082
- var oldestOutputFileTime = maximumDate;
125083
- var newestOutputFileName = "(none)";
125084
- var newestOutputFileTime = minimumDate;
125085
- var missingOutputFileName;
125086
- var newestDeclarationFileContentChangedTime = minimumDate;
125087
- var isOutOfDateWithInputs = false;
125088
- if (!force) {
125089
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
125090
- var output = outputs_1[_b];
125091
- // Output is missing; can stop checking
125092
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
125093
- if (!host.fileExists(output)) {
125094
- missingOutputFileName = output;
125095
- break;
125096
- }
125097
- var outputTime = ts.getModifiedTime(host, output);
125098
- if (outputTime < oldestOutputFileTime) {
125099
- oldestOutputFileTime = outputTime;
125100
- oldestOutputFileName = output;
125101
- }
125102
- // If an output is older than the newest input, we can stop checking
125103
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
125104
- if (outputTime < newestInputFileTime) {
125105
- isOutOfDateWithInputs = true;
125106
- break;
125107
- }
125108
- if (outputTime > newestOutputFileTime) {
125109
- newestOutputFileTime = outputTime;
125110
- newestOutputFileName = output;
125111
- }
125112
- // Keep track of when the most recent time a .d.ts file was changed.
125113
- // In addition to file timestamps, we also keep track of when a .d.ts file
125114
- // had its file touched but not had its contents changed - this allows us
125115
- // to skip a downstream typecheck
125116
- if (ts.isDeclarationFileName(output)) {
125117
- var outputModifiedTime = ts.getModifiedTime(host, output);
125118
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
125119
- }
125120
- }
125121
- }
125122
- var pseudoUpToDate = false;
125123
- var usesPrepend = false;
125124
- var upstreamChangedProject;
125439
+ // Fast check to see if reference projects are buildable
125440
+ var referenceStatuses;
125441
+ var force = !!state.options.force;
125125
125442
  if (project.projectReferences) {
125126
125443
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
125127
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
125128
- var ref = _d[_c];
125129
- usesPrepend = usesPrepend || !!(ref.prepend);
125444
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
125445
+ var ref = _d[_i];
125130
125446
  var resolvedRef = ts.resolveProjectReferencePath(ref);
125131
125447
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
125132
- var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
125448
+ var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
125449
+ var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
125133
125450
  // Its a circular reference ignore the status of this project
125134
125451
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
125135
125452
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) { // Container only ignore this project
@@ -125151,75 +125468,188 @@ var ts;
125151
125468
  upstreamProjectName: ref.path
125152
125469
  };
125153
125470
  }
125154
- // Check oldest output file name only if there is no missing output file name
125155
- // (a check we will have skipped if this is a forced build)
125156
- if (!force && !missingOutputFileName) {
125157
- // If the upstream project's newest file is older than our oldest output, we
125158
- // can't be out of date because of it
125159
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
125160
- continue;
125161
- }
125162
- // If the upstream project has only change .d.ts files, and we've built
125163
- // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
125164
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
125165
- pseudoUpToDate = true;
125166
- upstreamChangedProject = ref.path;
125167
- continue;
125168
- }
125169
- // We have an output older than an upstream output - we are out of date
125170
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125471
+ if (!force)
125472
+ (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
125473
+ }
125474
+ }
125475
+ if (force)
125476
+ return { type: ts.UpToDateStatusType.ForceBuild };
125477
+ // Check buildinfo first
125478
+ var host = state.host;
125479
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125480
+ var oldestOutputFileName = "(none)";
125481
+ var oldestOutputFileTime = maximumDate;
125482
+ var buildInfoTime;
125483
+ var buildInfoProgram;
125484
+ var buildInfoVersionMap;
125485
+ var newestDeclarationFileContentChangedTime;
125486
+ if (buildInfoPath) {
125487
+ var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
125488
+ buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
125489
+ if (buildInfoTime === ts.missingFileModifiedTime) {
125490
+ if (!buildInfoCacheEntry_1) {
125491
+ state.buildInfoCache.set(resolvedPath, {
125492
+ path: toPath(state, buildInfoPath),
125493
+ buildInfo: false,
125494
+ modifiedTime: buildInfoTime
125495
+ });
125496
+ }
125497
+ return {
125498
+ type: ts.UpToDateStatusType.OutputMissing,
125499
+ missingOutputFileName: buildInfoPath
125500
+ };
125501
+ }
125502
+ var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
125503
+ if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125504
+ return {
125505
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
125506
+ version: buildInfo.version
125507
+ };
125508
+ }
125509
+ if (buildInfo.program) {
125510
+ if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
125511
+ (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
125171
125512
  return {
125172
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125173
- outOfDateOutputFileName: oldestOutputFileName,
125174
- newerProjectName: ref.path
125513
+ type: ts.UpToDateStatusType.OutOfDateBuildInfo,
125514
+ buildInfoFile: buildInfoPath
125175
125515
  };
125176
125516
  }
125517
+ buildInfoProgram = buildInfo.program;
125177
125518
  }
125519
+ oldestOutputFileTime = buildInfoTime;
125520
+ oldestOutputFileName = buildInfoPath;
125521
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
125178
125522
  }
125179
- if (missingOutputFileName !== undefined) {
125180
- return {
125181
- type: ts.UpToDateStatusType.OutputMissing,
125182
- missingOutputFileName: missingOutputFileName
125183
- };
125523
+ // Check input files
125524
+ var newestInputFileName = undefined;
125525
+ var newestInputFileTime = minimumDate;
125526
+ var pseudoInputUptodate = false;
125527
+ // Get timestamps of input files
125528
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
125529
+ var inputFile = _f[_e];
125530
+ var inputTime = getModifiedTime(state, inputFile);
125531
+ if (inputTime === ts.missingFileModifiedTime) {
125532
+ return {
125533
+ type: ts.UpToDateStatusType.Unbuildable,
125534
+ reason: inputFile + " does not exist"
125535
+ };
125536
+ }
125537
+ // If an buildInfo is older than the newest input, we can stop checking
125538
+ if (buildInfoTime && buildInfoTime < inputTime) {
125539
+ var version_3 = void 0;
125540
+ var currentVersion = void 0;
125541
+ if (buildInfoProgram) {
125542
+ // Read files and see if they are same, read is anyways cached
125543
+ if (!buildInfoVersionMap)
125544
+ buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
125545
+ version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
125546
+ var text = version_3 ? state.readFileWithCache(inputFile) : undefined;
125547
+ currentVersion = text && (host.createHash || ts.generateDjb2Hash)(text);
125548
+ if (version_3 && version_3 === currentVersion)
125549
+ pseudoInputUptodate = true;
125550
+ }
125551
+ if (!version_3 || version_3 !== currentVersion) {
125552
+ return {
125553
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125554
+ outOfDateOutputFileName: buildInfoPath,
125555
+ newerInputFileName: inputFile
125556
+ };
125557
+ }
125558
+ }
125559
+ if (inputTime > newestInputFileTime) {
125560
+ newestInputFileName = inputFile;
125561
+ newestInputFileTime = inputTime;
125562
+ }
125184
125563
  }
125185
- if (isOutOfDateWithInputs) {
125186
- return {
125187
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
125188
- outOfDateOutputFileName: oldestOutputFileName,
125189
- newerInputFileName: newestInputFileName
125190
- };
125564
+ // Now see if all outputs are newer than the newest input
125565
+ // Dont check output timestamps if we have buildinfo telling us output is uptodate
125566
+ if (!buildInfoPath) {
125567
+ // Collect the expected outputs of this project
125568
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
125569
+ var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
125570
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
125571
+ var output = outputs_1[_g];
125572
+ var path = toPath(state, output);
125573
+ // Output is missing; can stop checking
125574
+ var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
125575
+ if (!outputTime) {
125576
+ outputTime = ts.getModifiedTime(state.host, output);
125577
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
125578
+ }
125579
+ if (outputTime === ts.missingFileModifiedTime) {
125580
+ return {
125581
+ type: ts.UpToDateStatusType.OutputMissing,
125582
+ missingOutputFileName: output
125583
+ };
125584
+ }
125585
+ if (outputTime < oldestOutputFileTime) {
125586
+ oldestOutputFileTime = outputTime;
125587
+ oldestOutputFileName = output;
125588
+ }
125589
+ // If an output is older than the newest input, we can stop checking
125590
+ if (outputTime < newestInputFileTime) {
125591
+ return {
125592
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125593
+ outOfDateOutputFileName: oldestOutputFileName,
125594
+ newerInputFileName: newestInputFileName
125595
+ };
125596
+ }
125597
+ }
125191
125598
  }
125192
- else {
125193
- // Check tsconfig time
125194
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125195
- if (configStatus)
125196
- return configStatus;
125197
- // Check extended config time
125198
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125199
- if (extendedConfigStatus)
125200
- return extendedConfigStatus;
125201
- // Check package file time
125202
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125203
- var path = _a[0];
125204
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125205
- });
125206
- if (dependentPackageFileStatus)
125207
- return dependentPackageFileStatus;
125208
- }
125209
- if (!force && !state.buildInfoChecked.has(resolvedPath)) {
125210
- state.buildInfoChecked.set(resolvedPath, true);
125211
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125212
- if (buildInfoPath) {
125213
- var value = state.readFileWithCache(buildInfoPath);
125214
- var buildInfo = value && ts.getBuildInfo(value);
125215
- if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125599
+ var seenRefs = buildInfoPath ? new ts.Set() : undefined;
125600
+ var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
125601
+ seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
125602
+ var pseudoUpToDate = false;
125603
+ var usesPrepend = false;
125604
+ var upstreamChangedProject;
125605
+ if (referenceStatuses) {
125606
+ for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
125607
+ var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
125608
+ usesPrepend = usesPrepend || !!(ref.prepend);
125609
+ // If the upstream project's newest file is older than our oldest output, we
125610
+ // can't be out of date because of it
125611
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
125612
+ continue;
125613
+ }
125614
+ // Check if tsbuildinfo path is shared, then we need to rebuild
125615
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
125216
125616
  return {
125217
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
125218
- version: buildInfo.version
125617
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125618
+ outOfDateOutputFileName: buildInfoPath,
125619
+ newerProjectName: ref.path
125219
125620
  };
125220
125621
  }
125622
+ // If the upstream project has only change .d.ts files, and we've built
125623
+ // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
125624
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
125625
+ pseudoUpToDate = true;
125626
+ upstreamChangedProject = ref.path;
125627
+ continue;
125628
+ }
125629
+ // We have an output older than an upstream output - we are out of date
125630
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125631
+ return {
125632
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125633
+ outOfDateOutputFileName: oldestOutputFileName,
125634
+ newerProjectName: ref.path
125635
+ };
125221
125636
  }
125222
125637
  }
125638
+ // Check tsconfig time
125639
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125640
+ if (configStatus)
125641
+ return configStatus;
125642
+ // Check extended config time
125643
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125644
+ if (extendedConfigStatus)
125645
+ return extendedConfigStatus;
125646
+ // Check package file time
125647
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125648
+ var path = _a[0];
125649
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125650
+ });
125651
+ if (dependentPackageFileStatus)
125652
+ return dependentPackageFileStatus;
125223
125653
  if (usesPrepend && pseudoUpToDate) {
125224
125654
  return {
125225
125655
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -125229,15 +125659,37 @@ var ts;
125229
125659
  }
125230
125660
  // Up to date
125231
125661
  return {
125232
- type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
125662
+ type: pseudoUpToDate ?
125663
+ ts.UpToDateStatusType.UpToDateWithUpstreamTypes :
125664
+ pseudoInputUptodate ?
125665
+ ts.UpToDateStatusType.UpToDateWithInputFileText :
125666
+ ts.UpToDateStatusType.UpToDate,
125233
125667
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
125234
125668
  newestInputFileTime: newestInputFileTime,
125235
- newestOutputFileTime: newestOutputFileTime,
125236
125669
  newestInputFileName: newestInputFileName,
125237
- newestOutputFileName: newestOutputFileName,
125238
125670
  oldestOutputFileName: oldestOutputFileName
125239
125671
  };
125240
125672
  }
125673
+ function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
125674
+ if (seenRefs.has(resolvedRefPath))
125675
+ return false;
125676
+ seenRefs.add(resolvedRefPath);
125677
+ var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
125678
+ if (refBuildInfo.path === buildInfoCacheEntry.path)
125679
+ return true;
125680
+ if (resolvedConfig.projectReferences) {
125681
+ // Check references
125682
+ for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
125683
+ var ref = _a[_i];
125684
+ var resolvedRef = ts.resolveProjectReferencePath(ref);
125685
+ var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
125686
+ var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
125687
+ if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
125688
+ return true;
125689
+ }
125690
+ }
125691
+ return false;
125692
+ }
125241
125693
  function getUpToDateStatus(state, project, resolvedPath) {
125242
125694
  if (project === undefined) {
125243
125695
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -125246,43 +125698,76 @@ var ts;
125246
125698
  if (prior !== undefined) {
125247
125699
  return prior;
125248
125700
  }
125701
+ ts.solutionPerformance.mark("beforeGetUpToDateStatus");
125249
125702
  var actual = getUpToDateStatusWorker(state, project, resolvedPath);
125703
+ ts.solutionPerformance.mark("afterGetUpToDateStatus");
125704
+ ts.solutionPerformance.measure("GetUpToDateStatus", "beforeGetUpToDateStatus", "afterGetUpToDateStatus");
125250
125705
  state.projectStatus.set(resolvedPath, actual);
125251
125706
  return actual;
125252
125707
  }
125253
- function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
125708
+ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
125254
125709
  if (proj.options.noEmit)
125255
- return priorNewestUpdateTime;
125256
- var host = state.host;
125257
- var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125258
- if (!skipOutputs || outputs.length !== skipOutputs.size) {
125259
- var reportVerbose = !!state.options.verbose;
125260
- var now = host.now ? host.now() : new Date();
125261
- for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125262
- var file = outputs_2[_i];
125263
- if (skipOutputs && skipOutputs.has(toPath(state, file))) {
125264
- continue;
125265
- }
125266
- if (reportVerbose) {
125267
- reportVerbose = false;
125710
+ return;
125711
+ var now;
125712
+ ts.solutionPerformance.mark("beforeUpdateOutputTimestamps");
125713
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
125714
+ if (buildInfoPath) {
125715
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
125716
+ if (!!state.options.verbose)
125268
125717
  reportStatus(state, verboseMessage, proj.options.configFilePath);
125718
+ state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
125719
+ getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
125720
+ }
125721
+ state.outputTimeStamps.delete(projectPath);
125722
+ }
125723
+ else {
125724
+ var host = state.host;
125725
+ var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125726
+ var outputTimeStampMap_1 = getOutputTimeStampMap(state, projectPath);
125727
+ var modifiedOutputs_1 = outputTimeStampMap_1 ? new ts.Set() : undefined;
125728
+ if (!skipOutputs || outputs.length !== skipOutputs.size) {
125729
+ var reportVerbose = !!state.options.verbose;
125730
+ for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125731
+ var file = outputs_2[_i];
125732
+ var path = toPath(state, file);
125733
+ if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
125734
+ continue;
125735
+ if (reportVerbose) {
125736
+ reportVerbose = false;
125737
+ reportStatus(state, verboseMessage, proj.options.configFilePath);
125738
+ }
125739
+ host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
125740
+ if (outputTimeStampMap_1) {
125741
+ outputTimeStampMap_1.set(path, now);
125742
+ modifiedOutputs_1.add(path);
125743
+ }
125269
125744
  }
125270
- if (ts.isDeclarationFileName(file)) {
125271
- priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
125272
- }
125273
- host.setModifiedTime(file, now);
125274
125745
  }
125746
+ // Clear out timestamps not in output list any more
125747
+ outputTimeStampMap_1 === null || outputTimeStampMap_1 === void 0 ? void 0 : outputTimeStampMap_1.forEach(function (_value, key) {
125748
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs_1.has(key))
125749
+ outputTimeStampMap_1.delete(key);
125750
+ });
125275
125751
  }
125276
- return priorNewestUpdateTime;
125752
+ ts.solutionPerformance.mark("afterUpdateOutputTimestamps");
125753
+ ts.solutionPerformance.measure("UpdateOutputTimestamps", "beforeUpdateOutputTimestamps", "afterUpdateOutputTimestamps");
125754
+ }
125755
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
125756
+ var _a;
125757
+ if (!options.composite)
125758
+ return undefined;
125759
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125760
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, /*modifiedTime*/ undefined);
125761
+ 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;
125277
125762
  }
125278
125763
  function updateOutputTimestamps(state, proj, resolvedPath) {
125279
125764
  if (state.options.dry) {
125280
125765
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
125281
125766
  }
125282
- var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125767
+ updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125283
125768
  state.projectStatus.set(resolvedPath, {
125284
125769
  type: ts.UpToDateStatusType.UpToDate,
125285
- newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
125770
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
125286
125771
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
125287
125772
  });
125288
125773
  }
@@ -125328,6 +125813,7 @@ var ts;
125328
125813
  break;
125329
125814
  }
125330
125815
  // falls through
125816
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
125331
125817
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125332
125818
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
125333
125819
  if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
@@ -125351,6 +125837,13 @@ var ts;
125351
125837
  }
125352
125838
  }
125353
125839
  function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
125840
+ ts.solutionPerformance.mark("beforeBuild");
125841
+ var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences);
125842
+ ts.solutionPerformance.mark("afterBuild");
125843
+ ts.solutionPerformance.measure("Build", "beforeBuild", "afterBuild");
125844
+ return result;
125845
+ }
125846
+ function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
125354
125847
  var buildOrder = getBuildOrderFor(state, project, onlyReferences);
125355
125848
  if (!buildOrder)
125356
125849
  return ts.ExitStatus.InvalidProject_OutputsSkipped;
@@ -125362,7 +125855,10 @@ var ts;
125362
125855
  if (!invalidatedProject)
125363
125856
  break;
125364
125857
  reportQueue = false;
125858
+ ts.solutionPerformance.mark("beforeInvalidatedProjectBuild");
125365
125859
  invalidatedProject.done(cancellationToken, writeFile, getCustomTransformers === null || getCustomTransformers === void 0 ? void 0 : getCustomTransformers(invalidatedProject.project));
125860
+ ts.solutionPerformance.mark("afterInvalidatedProjectBuild");
125861
+ ts.solutionPerformance.measure("InvalidatedProjectBuild", "beforeInvalidatedProjectBuild", "afterInvalidatedProjectBuild");
125366
125862
  if (!state.diagnostics.has(invalidatedProject.projectPath))
125367
125863
  successfulProjects++;
125368
125864
  }
@@ -125451,6 +125947,14 @@ var ts;
125451
125947
  state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
125452
125948
  }
125453
125949
  function buildNextInvalidatedProject(state, changeDetected) {
125950
+ ts.solutionPerformance.mark("beforeBuild");
125951
+ var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
125952
+ ts.solutionPerformance.mark("afterBuild");
125953
+ ts.solutionPerformance.measure("Build", "beforeBuild", "afterBuild");
125954
+ if (buildOrder)
125955
+ reportErrorSummary(state, buildOrder);
125956
+ }
125957
+ function buildNextInvalidatedProjectWorker(state, changeDetected) {
125454
125958
  state.timerToBuildInvalidatedProject = undefined;
125455
125959
  if (state.reportFileChangeDetected) {
125456
125960
  state.reportFileChangeDetected = false;
@@ -125461,7 +125965,10 @@ var ts;
125461
125965
  var buildOrder = getBuildOrder(state);
125462
125966
  var invalidatedProject = getNextInvalidatedProject(state, buildOrder, /*reportQueue*/ false);
125463
125967
  if (invalidatedProject) {
125968
+ ts.solutionPerformance.mark("beforeInvalidatedProjectBuild");
125464
125969
  invalidatedProject.done();
125970
+ ts.solutionPerformance.mark("afterInvalidatedProjectBuild");
125971
+ ts.solutionPerformance.measure("InvalidatedProjectBuild", "beforeInvalidatedProjectBuild", "afterInvalidatedProjectBuild");
125465
125972
  projectsBuilt++;
125466
125973
  while (state.projectPendingBuild.size) {
125467
125974
  // If already scheduled, skip
@@ -125477,23 +125984,24 @@ var ts;
125477
125984
  return;
125478
125985
  }
125479
125986
  var project = createInvalidatedProjectWithInfo(state, info, buildOrder);
125987
+ ts.solutionPerformance.mark("beforeInvalidatedProjectBuild");
125480
125988
  project.done();
125989
+ ts.solutionPerformance.mark("afterInvalidatedProjectBuild");
125990
+ ts.solutionPerformance.measure("InvalidatedProjectBuild", "beforeInvalidatedProjectBuild", "afterInvalidatedProjectBuild");
125481
125991
  if (info.kind !== InvalidatedProjectKind.UpdateOutputFileStamps)
125482
125992
  projectsBuilt++;
125483
125993
  }
125484
125994
  }
125485
125995
  disableCache(state);
125486
- reportErrorSummary(state, buildOrder);
125996
+ return buildOrder;
125487
125997
  }
125488
125998
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
125489
125999
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
125490
126000
  return;
125491
- state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
125492
- invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
125493
- }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
126001
+ 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));
125494
126002
  }
125495
126003
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
125496
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
126004
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
125497
126005
  var _a;
125498
126006
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
125499
126007
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -125525,7 +126033,7 @@ var ts;
125525
126033
  if (!state.watch)
125526
126034
  return;
125527
126035
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
125528
- 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); },
126036
+ 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); },
125529
126037
  onDeleteValue: ts.closeFileWatcher,
125530
126038
  });
125531
126039
  }
@@ -125533,13 +126041,14 @@ var ts;
125533
126041
  if (!state.watch || !state.lastCachedPackageJsonLookups)
125534
126042
  return;
125535
126043
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
125536
- 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); },
126044
+ 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); },
125537
126045
  onDeleteValue: ts.closeFileWatcher,
125538
126046
  });
125539
126047
  }
125540
126048
  function startWatching(state, buildOrder) {
125541
126049
  if (!state.watchAllProjectsPending)
125542
126050
  return;
126051
+ ts.solutionPerformance.mark("beforeStartWatching");
125543
126052
  state.watchAllProjectsPending = false;
125544
126053
  for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) {
125545
126054
  var resolved = _a[_i];
@@ -125557,6 +126066,8 @@ var ts;
125557
126066
  watchPackageJsonFiles(state, resolved, resolvedPath, cfg);
125558
126067
  }
125559
126068
  }
126069
+ ts.solutionPerformance.mark("afterStartWatching");
126070
+ ts.solutionPerformance.measure("StartWatching", "beforeStartWatching", "afterStartWatching");
125560
126071
  }
125561
126072
  function stopWatching(state) {
125562
126073
  ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher);
@@ -125663,19 +126174,18 @@ var ts;
125663
126174
  }
125664
126175
  }
125665
126176
  function reportUpToDateStatus(state, configFileName, status) {
125666
- if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
125667
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125668
- }
125669
126177
  switch (status.type) {
125670
126178
  case ts.UpToDateStatusType.OutOfDateWithSelf:
125671
- 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));
126179
+ 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));
125672
126180
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
125673
- 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));
126181
+ 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));
125674
126182
  case ts.UpToDateStatusType.OutputMissing:
125675
126183
  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));
126184
+ case ts.UpToDateStatusType.OutOfDateBuildInfo:
126185
+ 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));
125676
126186
  case ts.UpToDateStatusType.UpToDate:
125677
126187
  if (status.newestInputFileTime !== undefined) {
125678
- 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 || ""));
126188
+ 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 || ""));
125679
126189
  }
125680
126190
  // Don't report anything for "up to date because it was already built" -- too verbose
125681
126191
  break;
@@ -125683,6 +126193,8 @@ var ts;
125683
126193
  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));
125684
126194
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125685
126195
  return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
126196
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
126197
+ 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));
125686
126198
  case ts.UpToDateStatusType.UpstreamOutOfDate:
125687
126199
  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));
125688
126200
  case ts.UpToDateStatusType.UpstreamBlocked:
@@ -125693,6 +126205,8 @@ var ts;
125693
126205
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
125694
126206
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
125695
126207
  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);
126208
+ case ts.UpToDateStatusType.ForceBuild:
126209
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125696
126210
  case ts.UpToDateStatusType.ContainerOnly:
125697
126211
  // Don't report status on "solution" projects
125698
126212
  // falls through
@@ -136952,7 +137466,7 @@ var ts;
136952
137466
  ts.Debug.assert(parent.name === node);
136953
137467
  return true;
136954
137468
  case 203 /* BindingElement */:
136955
- return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent);
137469
+ return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent.parent.parent);
136956
137470
  default:
136957
137471
  return false;
136958
137472
  }
@@ -138418,7 +138932,7 @@ var ts;
138418
138932
  // Use the parent symbol if the location is commonjs require syntax on javascript files only.
138419
138933
  if (ts.isInJSFile(referenceLocation)
138420
138934
  && referenceLocation.parent.kind === 203 /* BindingElement */
138421
- && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent)) {
138935
+ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent.parent.parent)) {
138422
138936
  referenceSymbol = referenceLocation.parent.symbol;
138423
138937
  // The parent will not have a symbol if it's an ObjectBindingPattern (when destructuring is used). In
138424
138938
  // this case, just skip it, since the bound identifiers are not an alias of the import.
@@ -147794,11 +148308,9 @@ var ts;
147794
148308
  if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
147795
148309
  var tokenInfo = formattingScanner.readTokenInfo(parent);
147796
148310
  if (tokenInfo.token.kind === 27 /* CommaToken */ && ts.isCallLikeExpression(parent)) {
147797
- var commaTokenLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line;
147798
- if (startLine !== commaTokenLine) {
147799
- formattingScanner.advance();
147800
- tokenInfo = formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(parent) : undefined;
147801
- }
148311
+ // consume the comma
148312
+ consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent);
148313
+ tokenInfo = formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(parent) : undefined;
147802
148314
  }
147803
148315
  // consume the list end token only if it is still belong to the parent
147804
148316
  // there might be the case when current token matches end token but does not considered as one
@@ -175087,6 +175599,7 @@ var ts;
175087
175599
  return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : undefined;
175088
175600
  }
175089
175601
  function getReferencesWorker(projects, defaultProject, initialLocation, logger) {
175602
+ var _a;
175090
175603
  var perProjectResults = getPerProjectReferences(projects, defaultProject, initialLocation,
175091
175604
  /*isForRename*/ false, function (project, position) {
175092
175605
  logger.info("Finding references to " + position.fileName + " position " + position.pos + " in project " + project.getProjectName());
@@ -175106,7 +175619,7 @@ var ts;
175106
175619
  // have started the other project searches from related symbols. Propagate the
175107
175620
  // correct results to all other projects.
175108
175621
  var defaultProjectResults = perProjectResults.get(defaultProject);
175109
- if (defaultProjectResults[0].references[0].isDefinition === undefined) {
175622
+ if (((_a = defaultProjectResults === null || defaultProjectResults === void 0 ? void 0 : defaultProjectResults[0].references[0]) === null || _a === void 0 ? void 0 : _a.isDefinition) === undefined) {
175110
175623
  // Clear all isDefinition properties
175111
175624
  perProjectResults.forEach(function (projectResults) {
175112
175625
  for (var _i = 0, projectResults_2 = projectResults; _i < projectResults_2.length; _i++) {
@@ -175123,8 +175636,8 @@ var ts;
175123
175636
  var knownSymbolSpans_1 = createDocumentSpanSet();
175124
175637
  for (var _i = 0, defaultProjectResults_1 = defaultProjectResults; _i < defaultProjectResults_1.length; _i++) {
175125
175638
  var referencedSymbol = defaultProjectResults_1[_i];
175126
- for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) {
175127
- var ref = _b[_a];
175639
+ for (var _b = 0, _c = referencedSymbol.references; _b < _c.length; _b++) {
175640
+ var ref = _c[_b];
175128
175641
  if (ref.isDefinition) {
175129
175642
  knownSymbolSpans_1.add(ref);
175130
175643
  // One is enough - updateIsDefinitionOfReferencedSymbols will fill out the set based on symbols
@@ -175284,11 +175797,9 @@ var ts;
175284
175797
  // it easier for the caller to skip post-processing.
175285
175798
  if (searchedProjects.size === 1) {
175286
175799
  var it = resultsMap.values().next();
175287
- ts.Debug.assert(!it.done);
175288
- return it.value;
175800
+ return it.done ? server.emptyArray : it.value; // There may not be any results at all
175289
175801
  }
175290
175802
  return resultsMap;
175291
- // May enqueue to otherPositionQueue
175292
175803
  function searchPosition(project, location) {
175293
175804
  var projectResults = getResultsForPosition(project, location);
175294
175805
  if (!projectResults)