@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.
package/lib/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-insiders.20220525";
103
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220527";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -3510,16 +3510,34 @@ var ts;
3510
3510
  /** Performance measurements for the compiler. */
3511
3511
  var ts;
3512
3512
  (function (ts) {
3513
- var performance;
3514
- (function (performance) {
3513
+ var nullTimer = { enter: ts.noop, exit: ts.noop };
3514
+ ts.performance = createPerformanceTracker();
3515
+ ts.solutionPerformance = createPerformanceTracker();
3516
+ function createPerformanceTracker() {
3515
3517
  var perfHooks;
3516
3518
  // when set, indicates the implementation of `Performance` to use for user timing.
3517
3519
  // when unset, indicates user timing is unavailable or disabled.
3518
3520
  var performanceImpl;
3521
+ var enabled = false;
3522
+ var timeorigin = ts.timestamp();
3523
+ var marks = new ts.Map();
3524
+ var counts = new ts.Map();
3525
+ var durations = new ts.Map();
3526
+ return {
3527
+ createTimerIf: createTimerIf,
3528
+ createTimer: createTimer,
3529
+ mark: mark,
3530
+ measure: measure,
3531
+ getCount: getCount,
3532
+ getDuration: getDuration,
3533
+ forEachMeasure: forEachMeasure,
3534
+ isEnabled: isEnabled,
3535
+ enable: enable,
3536
+ disable: disable,
3537
+ };
3519
3538
  function createTimerIf(condition, measureName, startMarkName, endMarkName) {
3520
- return condition ? createTimer(measureName, startMarkName, endMarkName) : performance.nullTimer;
3539
+ return condition ? createTimer(measureName, startMarkName, endMarkName) : nullTimer;
3521
3540
  }
3522
- performance.createTimerIf = createTimerIf;
3523
3541
  function createTimer(measureName, startMarkName, endMarkName) {
3524
3542
  var enterCount = 0;
3525
3543
  return {
@@ -3541,13 +3559,6 @@ var ts;
3541
3559
  }
3542
3560
  }
3543
3561
  }
3544
- performance.createTimer = createTimer;
3545
- performance.nullTimer = { enter: ts.noop, exit: ts.noop };
3546
- var enabled = false;
3547
- var timeorigin = ts.timestamp();
3548
- var marks = new ts.Map();
3549
- var counts = new ts.Map();
3550
- var durations = new ts.Map();
3551
3562
  /**
3552
3563
  * Marks a performance event.
3553
3564
  *
@@ -3562,7 +3573,6 @@ var ts;
3562
3573
  performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.mark(markName);
3563
3574
  }
3564
3575
  }
3565
- performance.mark = mark;
3566
3576
  /**
3567
3577
  * Adds a performance measurement with the specified name.
3568
3578
  *
@@ -3575,14 +3585,13 @@ var ts;
3575
3585
  function measure(measureName, startMarkName, endMarkName) {
3576
3586
  var _a, _b;
3577
3587
  if (enabled) {
3578
- var end = (_a = (endMarkName !== undefined ? marks.get(endMarkName) : undefined)) !== null && _a !== void 0 ? _a : ts.timestamp();
3579
- var start = (_b = (startMarkName !== undefined ? marks.get(startMarkName) : undefined)) !== null && _b !== void 0 ? _b : timeorigin;
3588
+ var end = (_a = marks.get(endMarkName)) !== null && _a !== void 0 ? _a : ts.timestamp();
3589
+ var start = (_b = marks.get(startMarkName)) !== null && _b !== void 0 ? _b : timeorigin;
3580
3590
  var previousDuration = durations.get(measureName) || 0;
3581
3591
  durations.set(measureName, previousDuration + (end - start));
3582
3592
  performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.measure(measureName, startMarkName, endMarkName);
3583
3593
  }
3584
3594
  }
3585
- performance.measure = measure;
3586
3595
  /**
3587
3596
  * Gets the number of times a marker was encountered.
3588
3597
  *
@@ -3591,7 +3600,6 @@ var ts;
3591
3600
  function getCount(markName) {
3592
3601
  return counts.get(markName) || 0;
3593
3602
  }
3594
- performance.getCount = getCount;
3595
3603
  /**
3596
3604
  * Gets the total duration of all measurements with the supplied name.
3597
3605
  *
@@ -3600,7 +3608,6 @@ var ts;
3600
3608
  function getDuration(measureName) {
3601
3609
  return durations.get(measureName) || 0;
3602
3610
  }
3603
- performance.getDuration = getDuration;
3604
3611
  /**
3605
3612
  * Iterate over each measure, performing some action
3606
3613
  *
@@ -3609,14 +3616,12 @@ var ts;
3609
3616
  function forEachMeasure(cb) {
3610
3617
  durations.forEach(function (duration, measureName) { return cb(measureName, duration); });
3611
3618
  }
3612
- performance.forEachMeasure = forEachMeasure;
3613
3619
  /**
3614
3620
  * Indicates whether the performance API is enabled.
3615
3621
  */
3616
3622
  function isEnabled() {
3617
3623
  return enabled;
3618
3624
  }
3619
- performance.isEnabled = isEnabled;
3620
3625
  /** Enables (and resets) performance measurements for the compiler. */
3621
3626
  function enable(system) {
3622
3627
  var _a;
@@ -3637,7 +3642,6 @@ var ts;
3637
3642
  }
3638
3643
  return true;
3639
3644
  }
3640
- performance.enable = enable;
3641
3645
  /** Disables performance measurements for the compiler. */
3642
3646
  function disable() {
3643
3647
  if (enabled) {
@@ -3648,8 +3652,7 @@ var ts;
3648
3652
  enabled = false;
3649
3653
  }
3650
3654
  }
3651
- performance.disable = disable;
3652
- })(performance = ts.performance || (ts.performance = {}));
3655
+ }
3653
3656
  })(ts || (ts = {}));
3654
3657
  /* @internal */
3655
3658
  var ts;
@@ -6192,7 +6195,7 @@ var ts;
6192
6195
  };
6193
6196
  }
6194
6197
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
6195
- var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName) {
6198
+ var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName, modifiedTime) {
6196
6199
  // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
6197
6200
  if (!ts.isString(relativeFileName))
6198
6201
  return;
@@ -6202,7 +6205,7 @@ var ts;
6202
6205
  if (callbacks) {
6203
6206
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
6204
6207
  var fileCallback = callbacks_1[_i];
6205
- fileCallback(fileName, FileWatcherEventKind.Changed);
6208
+ fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6206
6209
  }
6207
6210
  }
6208
6211
  },
@@ -6256,7 +6259,7 @@ var ts;
6256
6259
  }
6257
6260
  else {
6258
6261
  cache.set(path, {
6259
- watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
6262
+ watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6260
6263
  refCount: 1
6261
6264
  });
6262
6265
  }
@@ -6284,7 +6287,7 @@ var ts;
6284
6287
  var newTime = modifiedTime.getTime();
6285
6288
  if (oldTime !== newTime) {
6286
6289
  watchedFile.mtime = modifiedTime;
6287
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
6290
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
6288
6291
  return true;
6289
6292
  }
6290
6293
  return false;
@@ -6319,7 +6322,7 @@ var ts;
6319
6322
  */
6320
6323
  /*@internal*/
6321
6324
  function createDirectoryWatcherSupportingRecursive(_a) {
6322
- 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;
6325
+ 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;
6323
6326
  var cache = new ts.Map();
6324
6327
  var callbackCache = ts.createMultiMap();
6325
6328
  var cacheToUpdateChildWatches = new ts.Map();
@@ -6419,7 +6422,7 @@ var ts;
6419
6422
  function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
6420
6423
  // Iterate through existing children and update the watches if needed
6421
6424
  var parentWatcher = cache.get(dirPath);
6422
- if (parentWatcher && fileSystemEntryExists(dirName, 1 /* Directory */)) {
6425
+ if (parentWatcher && directoryExists(dirName)) {
6423
6426
  // Schedule the update and postpone invoke for callbacks
6424
6427
  scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
6425
6428
  return;
@@ -6492,7 +6495,7 @@ var ts;
6492
6495
  if (!parentWatcher)
6493
6496
  return false;
6494
6497
  var newChildWatches;
6495
- var hasChanges = ts.enumerateInsertsAndDeletes(fileSystemEntryExists(parentDir, 1 /* Directory */) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
6498
+ var hasChanges = ts.enumerateInsertsAndDeletes(directoryExists(parentDir) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
6496
6499
  var childFullName = ts.getNormalizedAbsolutePath(child, parentDir);
6497
6500
  // Filter our the symbolic link directories since those arent included in recursive watch
6498
6501
  // which is same behaviour when recursive: true is passed to fs.watch
@@ -6535,17 +6538,18 @@ var ts;
6535
6538
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6536
6539
  /*@internal*/
6537
6540
  function createFileWatcherCallback(callback) {
6538
- return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
6541
+ return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6539
6542
  }
6540
6543
  ts.createFileWatcherCallback = createFileWatcherCallback;
6541
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileSystemEntryExists) {
6542
- return function (eventName) {
6544
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6545
+ return function (eventName, _relativeFileName, modifiedTime) {
6543
6546
  if (eventName === "rename") {
6544
- callback(fileName, fileSystemEntryExists(fileName, 0 /* File */) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6547
+ modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
6548
+ callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
6545
6549
  }
6546
6550
  else {
6547
6551
  // Change
6548
- callback(fileName, FileWatcherEventKind.Changed);
6552
+ callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6549
6553
  }
6550
6554
  };
6551
6555
  }
@@ -6569,12 +6573,11 @@ var ts;
6569
6573
  }
6570
6574
  /*@internal*/
6571
6575
  function createSystemWatchFunctions(_a) {
6572
- 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;
6576
+ 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;
6573
6577
  var dynamicPollingWatchFile;
6574
6578
  var fixedChunkSizePollingWatchFile;
6575
6579
  var nonPollingWatchFile;
6576
6580
  var hostRecursiveDirectoryWatcher;
6577
- var hitSystemWatcherLimit = false;
6578
6581
  return {
6579
6582
  watchFile: watchFile,
6580
6583
  watchDirectory: watchDirectory
@@ -6592,7 +6595,7 @@ var ts;
6592
6595
  case ts.WatchFileKind.FixedChunkSizePolling:
6593
6596
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, /* pollingInterval */ undefined, /*options*/ undefined);
6594
6597
  case ts.WatchFileKind.UseFsEvents:
6595
- return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileSystemEntryExists),
6598
+ return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime),
6596
6599
  /*recursive*/ false, pollingInterval, ts.getFallbackOptions(options));
6597
6600
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
6598
6601
  if (!nonPollingWatchFile) {
@@ -6653,7 +6656,7 @@ var ts;
6653
6656
  hostRecursiveDirectoryWatcher = createDirectoryWatcherSupportingRecursive({
6654
6657
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6655
6658
  getCurrentDirectory: getCurrentDirectory,
6656
- fileSystemEntryExists: fileSystemEntryExists,
6659
+ directoryExists: directoryExists,
6657
6660
  getAccessibleSortedChildDirectories: getAccessibleSortedChildDirectories,
6658
6661
  watchDirectory: nonRecursiveWatchDirectory,
6659
6662
  realpath: realpath,
@@ -6704,114 +6707,6 @@ var ts;
6704
6707
  };
6705
6708
  }
6706
6709
  }
6707
- function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
6708
- var lastDirectoryPartWithDirectorySeparator;
6709
- var lastDirectoryPart;
6710
- if (inodeWatching) {
6711
- lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substring(fileOrDirectory.lastIndexOf(ts.directorySeparator));
6712
- lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
6713
- }
6714
- /** Watcher for the file system entry depending on whether it is missing or present */
6715
- var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
6716
- watchMissingFileSystemEntry() :
6717
- watchPresentFileSystemEntry();
6718
- return {
6719
- close: function () {
6720
- // Close the watcher (either existing file system entry watcher or missing file system entry watcher)
6721
- watcher.close();
6722
- watcher = undefined;
6723
- }
6724
- };
6725
- function updateWatcher(createWatcher) {
6726
- // If watcher is not closed, update it
6727
- if (watcher) {
6728
- sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
6729
- watcher.close();
6730
- watcher = createWatcher();
6731
- }
6732
- }
6733
- /**
6734
- * Watch the file or directory that is currently present
6735
- * and when the watched file or directory is deleted, switch to missing file system entry watcher
6736
- */
6737
- function watchPresentFileSystemEntry() {
6738
- if (hitSystemWatcherLimit) {
6739
- sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to watchFile");
6740
- return watchPresentFileSystemEntryWithFsWatchFile();
6741
- }
6742
- try {
6743
- var presentWatcher = fsWatchWorker(fileOrDirectory, recursive, inodeWatching ?
6744
- callbackChangingToMissingFileSystemEntry :
6745
- function (eventName, relativeFileName) {
6746
- sysLog("sysLog:: watchPresentFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + eventName + ":: " + relativeFileName);
6747
- callback(eventName, relativeFileName);
6748
- });
6749
- // Watch the missing file or directory or error
6750
- presentWatcher.on("error", function () {
6751
- sysLog("sysLog:: watchPresentFileSystemEntry:: on Error " + fileOrDirectory + " " + entryKind + " rename, \"\"");
6752
- callback("rename", "");
6753
- updateWatcher(watchMissingFileSystemEntry);
6754
- });
6755
- return presentWatcher;
6756
- }
6757
- catch (e) {
6758
- // Catch the exception and use polling instead
6759
- // 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
6760
- // so instead of throwing error, use fs.watchFile
6761
- hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
6762
- sysLog("sysLog:: " + fileOrDirectory + ":: Changing to watchFile");
6763
- return watchPresentFileSystemEntryWithFsWatchFile();
6764
- }
6765
- }
6766
- function callbackChangingToMissingFileSystemEntry(event, relativeName) {
6767
- sysLog("sysLog:: callbackChangingToMissingFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + event + ":: " + relativeName + " " + inodeWatching + " " + lastDirectoryPart + " " + lastDirectoryPartWithDirectorySeparator);
6768
- if (relativeName && ts.endsWith(relativeName, "~")) {
6769
- relativeName = relativeName.slice(0, relativeName.length - 1);
6770
- sysLog("sysLog:: callbackChangingToMissingFileSystemEntry:: changed the relative name to " + relativeName);
6771
- }
6772
- callback(event, relativeName);
6773
- // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
6774
- // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
6775
- if (event === "rename" &&
6776
- (!relativeName ||
6777
- relativeName === lastDirectoryPart ||
6778
- ts.endsWith(relativeName, lastDirectoryPartWithDirectorySeparator))) {
6779
- if (inodeWatching) {
6780
- updateWatcher(!fileSystemEntryExists(fileOrDirectory, entryKind) ? watchMissingFileSystemEntry : watchPresentFileSystemEntry);
6781
- }
6782
- else if (!fileSystemEntryExists(fileOrDirectory, entryKind)) {
6783
- updateWatcher(watchMissingFileSystemEntry);
6784
- }
6785
- }
6786
- }
6787
- /**
6788
- * Watch the file or directory using fs.watchFile since fs.watch threw exception
6789
- * 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
6790
- */
6791
- function watchPresentFileSystemEntryWithFsWatchFile() {
6792
- return watchFile(fileOrDirectory, createFileWatcherCallback(function (eventName, relativeFileName) {
6793
- sysLog("sysLog:: watchPresentFileSystemEntryWithFsWatchFile:: " + fileOrDirectory + " " + entryKind + " " + eventName + ":: " + relativeFileName);
6794
- callback(eventName, relativeFileName);
6795
- }), fallbackPollingInterval, fallbackOptions);
6796
- }
6797
- /**
6798
- * Watch the file or directory that is missing
6799
- * and switch to existing file or directory when the missing filesystem entry is created
6800
- */
6801
- function watchMissingFileSystemEntry() {
6802
- return watchFile(fileOrDirectory, function (_fileName, eventKind) {
6803
- sysLog("sysLog:: watchMissingFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + _fileName + ":: " + eventKind);
6804
- if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
6805
- sysLog("sysLog:: watchMissingFileSystemEntry:: Callback :: rename, \"\" and will update the watcher");
6806
- callback("rename", "");
6807
- // Call the callback for current file or directory
6808
- // For now it could be callback for the inner directory creation,
6809
- // but just return current directory, better than current no-op
6810
- updateWatcher(watchPresentFileSystemEntry);
6811
- }
6812
- }, fallbackPollingInterval, fallbackOptions);
6813
- }
6814
- }
6815
6710
  }
6816
6711
  ts.createSystemWatchFunctions = createSystemWatchFunctions;
6817
6712
  /**
@@ -6864,6 +6759,7 @@ var ts;
6864
6759
  }
6865
6760
  var activeSession;
6866
6761
  var profilePath = "./profile.cpuprofile";
6762
+ var hitSystemWatcherLimit = false;
6867
6763
  var Buffer = require("buffer").Buffer;
6868
6764
  var nodeVersion = getNodeMajorVersion();
6869
6765
  var isNode4OrLater = nodeVersion >= 4;
@@ -6878,21 +6774,19 @@ var ts;
6878
6774
  getModifiedTime: getModifiedTime,
6879
6775
  setTimeout: setTimeout,
6880
6776
  clearTimeout: clearTimeout,
6881
- fsWatchWorker: fsWatchWorker,
6777
+ fsWatch: fsWatch,
6882
6778
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6883
6779
  getCurrentDirectory: getCurrentDirectory,
6884
- fileSystemEntryExists: fileSystemEntryExists,
6885
6780
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
6886
6781
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
6887
6782
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
6783
+ directoryExists: directoryExists,
6888
6784
  getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; },
6889
6785
  realpath: realpath,
6890
6786
  tscWatchFile: process.env.TSC_WATCHFILE,
6891
6787
  useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
6892
6788
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
6893
6789
  defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
6894
- inodeWatching: isLinuxOrMacOs,
6895
- sysLog: sysLog,
6896
6790
  }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
6897
6791
  var nodeSystem = {
6898
6792
  args: process.argv.slice(2),
@@ -7142,14 +7036,114 @@ var ts;
7142
7036
  // File changed
7143
7037
  eventKind = FileWatcherEventKind.Changed;
7144
7038
  }
7145
- callback(fileName, eventKind);
7039
+ callback(fileName, eventKind, curr.mtime);
7146
7040
  }
7147
7041
  }
7148
- function fsWatchWorker(fileOrDirectory, recursive, callback) {
7149
- // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
7150
- // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
7151
- return _fs.watch(fileOrDirectory, fsSupportsRecursiveFsWatch ?
7152
- { persistent: true, recursive: !!recursive } : { persistent: true }, callback);
7042
+ function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
7043
+ var options;
7044
+ var lastDirectoryPartWithDirectorySeparator;
7045
+ var lastDirectoryPart;
7046
+ if (isLinuxOrMacOs) {
7047
+ lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
7048
+ lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
7049
+ }
7050
+ /** Watcher for the file system entry depending on whether it is missing or present */
7051
+ var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7052
+ watchMissingFileSystemEntry() :
7053
+ watchPresentFileSystemEntry();
7054
+ return {
7055
+ close: function () {
7056
+ // Close the watcher (either existing file system entry watcher or missing file system entry watcher)
7057
+ watcher.close();
7058
+ watcher = undefined;
7059
+ }
7060
+ };
7061
+ /**
7062
+ * Invoke the callback with rename and update the watcher if not closed
7063
+ * @param createWatcher
7064
+ */
7065
+ function invokeCallbackAndUpdateWatcher(createWatcher, modifiedTime) {
7066
+ sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
7067
+ // Call the callback for current directory
7068
+ callback("rename", "", modifiedTime);
7069
+ // If watcher is not closed, update it
7070
+ if (watcher) {
7071
+ watcher.close();
7072
+ watcher = createWatcher();
7073
+ }
7074
+ }
7075
+ /**
7076
+ * Watch the file or directory that is currently present
7077
+ * and when the watched file or directory is deleted, switch to missing file system entry watcher
7078
+ */
7079
+ function watchPresentFileSystemEntry() {
7080
+ // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
7081
+ // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
7082
+ if (options === undefined) {
7083
+ if (fsSupportsRecursiveFsWatch) {
7084
+ options = { persistent: true, recursive: !!recursive };
7085
+ }
7086
+ else {
7087
+ options = { persistent: true };
7088
+ }
7089
+ }
7090
+ if (hitSystemWatcherLimit) {
7091
+ sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to fsWatchFile");
7092
+ return watchPresentFileSystemEntryWithFsWatchFile();
7093
+ }
7094
+ try {
7095
+ var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
7096
+ callbackChangingToMissingFileSystemEntry :
7097
+ callback);
7098
+ // Watch the missing file or directory or error
7099
+ presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
7100
+ return presentWatcher;
7101
+ }
7102
+ catch (e) {
7103
+ // Catch the exception and use polling instead
7104
+ // 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
7105
+ // so instead of throwing error, use fs.watchFile
7106
+ hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
7107
+ sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
7108
+ return watchPresentFileSystemEntryWithFsWatchFile();
7109
+ }
7110
+ }
7111
+ function callbackChangingToMissingFileSystemEntry(event, relativeName) {
7112
+ // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
7113
+ // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
7114
+ var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
7115
+ return event === "rename" &&
7116
+ (!relativeName ||
7117
+ relativeName === lastDirectoryPart ||
7118
+ (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
7119
+ modifiedTime === ts.missingFileModifiedTime ?
7120
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry, modifiedTime) :
7121
+ callback(event, relativeName, modifiedTime);
7122
+ }
7123
+ /**
7124
+ * Watch the file or directory using fs.watchFile since fs.watch threw exception
7125
+ * 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
7126
+ */
7127
+ function watchPresentFileSystemEntryWithFsWatchFile() {
7128
+ return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions);
7129
+ }
7130
+ /**
7131
+ * Watch the file or directory that is missing
7132
+ * and switch to existing file or directory when the missing filesystem entry is created
7133
+ */
7134
+ function watchMissingFileSystemEntry() {
7135
+ return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
7136
+ if (eventKind === FileWatcherEventKind.Created) {
7137
+ modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
7138
+ if (modifiedTime !== ts.missingFileModifiedTime) {
7139
+ // Call the callback for current file or directory
7140
+ // For now it could be callback for the inner directory creation,
7141
+ // but just return current directory, better than current no-op
7142
+ invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry, modifiedTime);
7143
+ }
7144
+ }
7145
+ }, fallbackPollingInterval, fallbackOptions);
7146
+ }
7153
7147
  }
7154
7148
  function readFileWorker(fileName, _encoding) {
7155
7149
  var buffer;
@@ -7296,12 +7290,19 @@ var ts;
7296
7290
  }
7297
7291
  function getModifiedTime(path) {
7298
7292
  var _a;
7293
+ // Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
7294
+ // the CPU time performance.
7295
+ var originalStackTraceLimit = Error.stackTraceLimit;
7296
+ Error.stackTraceLimit = 0;
7299
7297
  try {
7300
7298
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
7301
7299
  }
7302
7300
  catch (e) {
7303
7301
  return undefined;
7304
7302
  }
7303
+ finally {
7304
+ Error.stackTraceLimit = originalStackTraceLimit;
7305
+ }
7305
7306
  }
7306
7307
  function setModifiedTime(path, time) {
7307
7308
  try {
@@ -9322,8 +9323,8 @@ var ts;
9322
9323
  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"),
9323
9324
  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"),
9324
9325
  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."),
9325
- 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}'"),
9326
- 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}'"),
9326
+ 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}'"),
9327
+ 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}'"),
9327
9328
  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"),
9328
9329
  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"),
9329
9330
  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"),
@@ -9367,6 +9368,8 @@ var ts;
9367
9368
  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}'."),
9368
9369
  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}'."),
9369
9370
  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."),
9371
+ 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"),
9372
+ 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"),
9370
9373
  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}'"),
9371
9374
  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."),
9372
9375
  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."),
@@ -16231,9 +16234,6 @@ var ts;
16231
16234
  }
16232
16235
  ts.isVariableDeclarationInitializedToBareOrAccessedRequire = isVariableDeclarationInitializedToBareOrAccessedRequire;
16233
16236
  function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) {
16234
- if (node.kind === 203 /* BindingElement */) {
16235
- node = node.parent.parent;
16236
- }
16237
16237
  return ts.isVariableDeclaration(node) &&
16238
16238
  !!node.initializer &&
16239
16239
  isRequireCall(allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, /*requireStringLiteralLikeArgument*/ true);
@@ -20045,8 +20045,9 @@ var ts;
20045
20045
  */
20046
20046
  function isFileForcedToBeModuleByFormat(file) {
20047
20047
  // Excludes declaration files - they still require an explicit `export {}` or the like
20048
- // for back compat purposes.
20049
- return file.impliedNodeFormat === ts.ModuleKind.ESNext && !file.isDeclarationFile ? true : undefined;
20048
+ // for back compat purposes. The only non-declaration files _not_ forced to be a module are `.js` files
20049
+ // that aren't esm-mode (meaning not in a `type: module` scope).
20050
+ return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) && !file.isDeclarationFile ? true : undefined;
20050
20051
  }
20051
20052
  function getSetExternalModuleIndicator(options) {
20052
20053
  // TODO: Should this callback be cached?
@@ -20054,7 +20055,7 @@ var ts;
20054
20055
  case ts.ModuleDetectionKind.Force:
20055
20056
  // All non-declaration files are modules, declaration files still do the usual isFileProbablyExternalModule
20056
20057
  return function (file) {
20057
- file.externalModuleIndicator = !file.isDeclarationFile || ts.isFileProbablyExternalModule(file);
20058
+ file.externalModuleIndicator = ts.isFileProbablyExternalModule(file) || !file.isDeclarationFile || undefined;
20058
20059
  };
20059
20060
  case ts.ModuleDetectionKind.Legacy:
20060
20061
  // Files are modules if they have imports, exports, or import.meta
@@ -20114,7 +20115,8 @@ var ts;
20114
20115
  }
20115
20116
  ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
20116
20117
  function getEmitModuleDetectionKind(options) {
20117
- return options.moduleDetection || ts.ModuleDetectionKind.Auto;
20118
+ return options.moduleDetection ||
20119
+ (getEmitModuleKind(options) === ts.ModuleKind.Node16 || getEmitModuleKind(options) === ts.ModuleKind.NodeNext ? ts.ModuleDetectionKind.Force : ts.ModuleDetectionKind.Auto);
20118
20120
  }
20119
20121
  ts.getEmitModuleDetectionKind = getEmitModuleDetectionKind;
20120
20122
  function hasJsonModuleEmitEnabled(options) {
@@ -20197,6 +20199,10 @@ var ts;
20197
20199
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
20198
20200
  }
20199
20201
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
20202
+ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
20203
+ return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
20204
+ }
20205
+ ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
20200
20206
  function getCompilerOptionValue(options, option) {
20201
20207
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
20202
20208
  }
@@ -39237,6 +39243,7 @@ var ts;
39237
39243
  type: "boolean",
39238
39244
  affectsSemanticDiagnostics: true,
39239
39245
  affectsEmit: true,
39246
+ affectsMultiFileEmitBuildInfo: true,
39240
39247
  category: ts.Diagnostics.Watch_and_Build_Modes,
39241
39248
  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,
39242
39249
  defaultValueDescription: false,
@@ -39271,12 +39278,40 @@ var ts;
39271
39278
  affectsSourceFile: true,
39272
39279
  affectsModuleResolution: true,
39273
39280
  affectsEmit: true,
39281
+ affectsMultiFileEmitBuildInfo: true,
39274
39282
  paramType: ts.Diagnostics.VERSION,
39275
39283
  showInSimplifiedHelpView: true,
39276
39284
  category: ts.Diagnostics.Language_and_Environment,
39277
39285
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
39278
39286
  defaultValueDescription: 0 /* ES3 */,
39279
39287
  };
39288
+ /*@internal*/
39289
+ ts.moduleOptionDeclaration = {
39290
+ name: "module",
39291
+ shortName: "m",
39292
+ type: new ts.Map(ts.getEntries({
39293
+ none: ts.ModuleKind.None,
39294
+ commonjs: ts.ModuleKind.CommonJS,
39295
+ amd: ts.ModuleKind.AMD,
39296
+ system: ts.ModuleKind.System,
39297
+ umd: ts.ModuleKind.UMD,
39298
+ es6: ts.ModuleKind.ES2015,
39299
+ es2015: ts.ModuleKind.ES2015,
39300
+ es2020: ts.ModuleKind.ES2020,
39301
+ es2022: ts.ModuleKind.ES2022,
39302
+ esnext: ts.ModuleKind.ESNext,
39303
+ node16: ts.ModuleKind.Node16,
39304
+ nodenext: ts.ModuleKind.NodeNext,
39305
+ })),
39306
+ affectsModuleResolution: true,
39307
+ affectsEmit: true,
39308
+ affectsMultiFileEmitBuildInfo: true,
39309
+ paramType: ts.Diagnostics.KIND,
39310
+ showInSimplifiedHelpView: true,
39311
+ category: ts.Diagnostics.Modules,
39312
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
39313
+ defaultValueDescription: undefined,
39314
+ };
39280
39315
  var commandOptionsWithoutBuild = [
39281
39316
  // CommandLine only options
39282
39317
  {
@@ -39338,37 +39373,14 @@ var ts;
39338
39373
  category: ts.Diagnostics.Command_line_Options,
39339
39374
  affectsSemanticDiagnostics: true,
39340
39375
  affectsEmit: true,
39376
+ affectsMultiFileEmitBuildInfo: true,
39341
39377
  isCommandLineOnly: true,
39342
39378
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
39343
39379
  defaultValueDescription: false,
39344
39380
  },
39345
39381
  // Basic
39346
39382
  ts.targetOptionDeclaration,
39347
- {
39348
- name: "module",
39349
- shortName: "m",
39350
- type: new ts.Map(ts.getEntries({
39351
- none: ts.ModuleKind.None,
39352
- commonjs: ts.ModuleKind.CommonJS,
39353
- amd: ts.ModuleKind.AMD,
39354
- system: ts.ModuleKind.System,
39355
- umd: ts.ModuleKind.UMD,
39356
- es6: ts.ModuleKind.ES2015,
39357
- es2015: ts.ModuleKind.ES2015,
39358
- es2020: ts.ModuleKind.ES2020,
39359
- es2022: ts.ModuleKind.ES2022,
39360
- esnext: ts.ModuleKind.ESNext,
39361
- node16: ts.ModuleKind.Node16,
39362
- nodenext: ts.ModuleKind.NodeNext,
39363
- })),
39364
- affectsModuleResolution: true,
39365
- affectsEmit: true,
39366
- paramType: ts.Diagnostics.KIND,
39367
- showInSimplifiedHelpView: true,
39368
- category: ts.Diagnostics.Modules,
39369
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
39370
- defaultValueDescription: undefined,
39371
- },
39383
+ ts.moduleOptionDeclaration,
39372
39384
  {
39373
39385
  name: "lib",
39374
39386
  type: "list",
@@ -39405,6 +39417,7 @@ var ts;
39405
39417
  type: jsxOptionMap,
39406
39418
  affectsSourceFile: true,
39407
39419
  affectsEmit: true,
39420
+ affectsMultiFileEmitBuildInfo: true,
39408
39421
  affectsModuleResolution: true,
39409
39422
  paramType: ts.Diagnostics.KIND,
39410
39423
  showInSimplifiedHelpView: true,
@@ -39417,6 +39430,7 @@ var ts;
39417
39430
  shortName: "d",
39418
39431
  type: "boolean",
39419
39432
  affectsEmit: true,
39433
+ affectsMultiFileEmitBuildInfo: true,
39420
39434
  showInSimplifiedHelpView: true,
39421
39435
  category: ts.Diagnostics.Emit,
39422
39436
  transpileOptionValue: undefined,
@@ -39427,6 +39441,7 @@ var ts;
39427
39441
  name: "declarationMap",
39428
39442
  type: "boolean",
39429
39443
  affectsEmit: true,
39444
+ affectsMultiFileEmitBuildInfo: true,
39430
39445
  showInSimplifiedHelpView: true,
39431
39446
  category: ts.Diagnostics.Emit,
39432
39447
  transpileOptionValue: undefined,
@@ -39437,6 +39452,7 @@ var ts;
39437
39452
  name: "emitDeclarationOnly",
39438
39453
  type: "boolean",
39439
39454
  affectsEmit: true,
39455
+ affectsMultiFileEmitBuildInfo: true,
39440
39456
  showInSimplifiedHelpView: true,
39441
39457
  category: ts.Diagnostics.Emit,
39442
39458
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -39447,6 +39463,7 @@ var ts;
39447
39463
  name: "sourceMap",
39448
39464
  type: "boolean",
39449
39465
  affectsEmit: true,
39466
+ affectsMultiFileEmitBuildInfo: true,
39450
39467
  showInSimplifiedHelpView: true,
39451
39468
  category: ts.Diagnostics.Emit,
39452
39469
  defaultValueDescription: false,
@@ -39456,6 +39473,9 @@ var ts;
39456
39473
  name: "outFile",
39457
39474
  type: "string",
39458
39475
  affectsEmit: true,
39476
+ affectsMultiFileEmitBuildInfo: true,
39477
+ affectsDeclarationPath: true,
39478
+ affectsBundleEmitBuildInfo: true,
39459
39479
  isFilePath: true,
39460
39480
  paramType: ts.Diagnostics.FILE,
39461
39481
  showInSimplifiedHelpView: true,
@@ -39467,6 +39487,8 @@ var ts;
39467
39487
  name: "outDir",
39468
39488
  type: "string",
39469
39489
  affectsEmit: true,
39490
+ affectsMultiFileEmitBuildInfo: true,
39491
+ affectsDeclarationPath: true,
39470
39492
  isFilePath: true,
39471
39493
  paramType: ts.Diagnostics.DIRECTORY,
39472
39494
  showInSimplifiedHelpView: true,
@@ -39477,6 +39499,8 @@ var ts;
39477
39499
  name: "rootDir",
39478
39500
  type: "string",
39479
39501
  affectsEmit: true,
39502
+ affectsMultiFileEmitBuildInfo: true,
39503
+ affectsDeclarationPath: true,
39480
39504
  isFilePath: true,
39481
39505
  paramType: ts.Diagnostics.LOCATION,
39482
39506
  category: ts.Diagnostics.Modules,
@@ -39487,6 +39511,8 @@ var ts;
39487
39511
  name: "composite",
39488
39512
  type: "boolean",
39489
39513
  affectsEmit: true,
39514
+ affectsMultiFileEmitBuildInfo: true,
39515
+ affectsBundleEmitBuildInfo: true,
39490
39516
  isTSConfigOnly: true,
39491
39517
  category: ts.Diagnostics.Projects,
39492
39518
  transpileOptionValue: undefined,
@@ -39497,6 +39523,8 @@ var ts;
39497
39523
  name: "tsBuildInfoFile",
39498
39524
  type: "string",
39499
39525
  affectsEmit: true,
39526
+ affectsMultiFileEmitBuildInfo: true,
39527
+ affectsBundleEmitBuildInfo: true,
39500
39528
  isFilePath: true,
39501
39529
  paramType: ts.Diagnostics.FILE,
39502
39530
  category: ts.Diagnostics.Projects,
@@ -39508,6 +39536,7 @@ var ts;
39508
39536
  name: "removeComments",
39509
39537
  type: "boolean",
39510
39538
  affectsEmit: true,
39539
+ affectsMultiFileEmitBuildInfo: true,
39511
39540
  showInSimplifiedHelpView: true,
39512
39541
  category: ts.Diagnostics.Emit,
39513
39542
  defaultValueDescription: false,
@@ -39526,6 +39555,7 @@ var ts;
39526
39555
  name: "importHelpers",
39527
39556
  type: "boolean",
39528
39557
  affectsEmit: true,
39558
+ affectsMultiFileEmitBuildInfo: true,
39529
39559
  category: ts.Diagnostics.Emit,
39530
39560
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
39531
39561
  defaultValueDescription: false,
@@ -39539,6 +39569,7 @@ var ts;
39539
39569
  })),
39540
39570
  affectsEmit: true,
39541
39571
  affectsSemanticDiagnostics: true,
39572
+ affectsMultiFileEmitBuildInfo: true,
39542
39573
  category: ts.Diagnostics.Emit,
39543
39574
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
39544
39575
  defaultValueDescription: 0 /* Remove */,
@@ -39547,6 +39578,7 @@ var ts;
39547
39578
  name: "downlevelIteration",
39548
39579
  type: "boolean",
39549
39580
  affectsEmit: true,
39581
+ affectsMultiFileEmitBuildInfo: true,
39550
39582
  category: ts.Diagnostics.Emit,
39551
39583
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
39552
39584
  defaultValueDescription: false,
@@ -39565,6 +39597,9 @@ var ts;
39565
39597
  type: "boolean",
39566
39598
  // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
39567
39599
  // The value of each strictFlag depends on own strictFlag value or this and never accessed directly.
39600
+ // But we need to store `strict` in builf info, even though it won't be examined directly, so that the
39601
+ // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly
39602
+ affectsMultiFileEmitBuildInfo: true,
39568
39603
  showInSimplifiedHelpView: true,
39569
39604
  category: ts.Diagnostics.Type_Checking,
39570
39605
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -39574,6 +39609,7 @@ var ts;
39574
39609
  name: "noImplicitAny",
39575
39610
  type: "boolean",
39576
39611
  affectsSemanticDiagnostics: true,
39612
+ affectsMultiFileEmitBuildInfo: true,
39577
39613
  strictFlag: true,
39578
39614
  category: ts.Diagnostics.Type_Checking,
39579
39615
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -39583,6 +39619,7 @@ var ts;
39583
39619
  name: "strictNullChecks",
39584
39620
  type: "boolean",
39585
39621
  affectsSemanticDiagnostics: true,
39622
+ affectsMultiFileEmitBuildInfo: true,
39586
39623
  strictFlag: true,
39587
39624
  category: ts.Diagnostics.Type_Checking,
39588
39625
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -39591,6 +39628,8 @@ var ts;
39591
39628
  {
39592
39629
  name: "strictFunctionTypes",
39593
39630
  type: "boolean",
39631
+ affectsSemanticDiagnostics: true,
39632
+ affectsMultiFileEmitBuildInfo: true,
39594
39633
  strictFlag: true,
39595
39634
  category: ts.Diagnostics.Type_Checking,
39596
39635
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -39599,6 +39638,8 @@ var ts;
39599
39638
  {
39600
39639
  name: "strictBindCallApply",
39601
39640
  type: "boolean",
39641
+ affectsSemanticDiagnostics: true,
39642
+ affectsMultiFileEmitBuildInfo: true,
39602
39643
  strictFlag: true,
39603
39644
  category: ts.Diagnostics.Type_Checking,
39604
39645
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -39608,6 +39649,7 @@ var ts;
39608
39649
  name: "strictPropertyInitialization",
39609
39650
  type: "boolean",
39610
39651
  affectsSemanticDiagnostics: true,
39652
+ affectsMultiFileEmitBuildInfo: true,
39611
39653
  strictFlag: true,
39612
39654
  category: ts.Diagnostics.Type_Checking,
39613
39655
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -39617,6 +39659,7 @@ var ts;
39617
39659
  name: "noImplicitThis",
39618
39660
  type: "boolean",
39619
39661
  affectsSemanticDiagnostics: true,
39662
+ affectsMultiFileEmitBuildInfo: true,
39620
39663
  strictFlag: true,
39621
39664
  category: ts.Diagnostics.Type_Checking,
39622
39665
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -39626,6 +39669,7 @@ var ts;
39626
39669
  name: "useUnknownInCatchVariables",
39627
39670
  type: "boolean",
39628
39671
  affectsSemanticDiagnostics: true,
39672
+ affectsMultiFileEmitBuildInfo: true,
39629
39673
  strictFlag: true,
39630
39674
  category: ts.Diagnostics.Type_Checking,
39631
39675
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -39635,6 +39679,8 @@ var ts;
39635
39679
  name: "alwaysStrict",
39636
39680
  type: "boolean",
39637
39681
  affectsSourceFile: true,
39682
+ affectsEmit: true,
39683
+ affectsMultiFileEmitBuildInfo: true,
39638
39684
  strictFlag: true,
39639
39685
  category: ts.Diagnostics.Type_Checking,
39640
39686
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -39645,6 +39691,7 @@ var ts;
39645
39691
  name: "noUnusedLocals",
39646
39692
  type: "boolean",
39647
39693
  affectsSemanticDiagnostics: true,
39694
+ affectsMultiFileEmitBuildInfo: true,
39648
39695
  category: ts.Diagnostics.Type_Checking,
39649
39696
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
39650
39697
  defaultValueDescription: false,
@@ -39653,6 +39700,7 @@ var ts;
39653
39700
  name: "noUnusedParameters",
39654
39701
  type: "boolean",
39655
39702
  affectsSemanticDiagnostics: true,
39703
+ affectsMultiFileEmitBuildInfo: true,
39656
39704
  category: ts.Diagnostics.Type_Checking,
39657
39705
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
39658
39706
  defaultValueDescription: false,
@@ -39661,6 +39709,7 @@ var ts;
39661
39709
  name: "exactOptionalPropertyTypes",
39662
39710
  type: "boolean",
39663
39711
  affectsSemanticDiagnostics: true,
39712
+ affectsMultiFileEmitBuildInfo: true,
39664
39713
  category: ts.Diagnostics.Type_Checking,
39665
39714
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
39666
39715
  defaultValueDescription: false,
@@ -39669,6 +39718,7 @@ var ts;
39669
39718
  name: "noImplicitReturns",
39670
39719
  type: "boolean",
39671
39720
  affectsSemanticDiagnostics: true,
39721
+ affectsMultiFileEmitBuildInfo: true,
39672
39722
  category: ts.Diagnostics.Type_Checking,
39673
39723
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
39674
39724
  defaultValueDescription: false,
@@ -39678,6 +39728,7 @@ var ts;
39678
39728
  type: "boolean",
39679
39729
  affectsBindDiagnostics: true,
39680
39730
  affectsSemanticDiagnostics: true,
39731
+ affectsMultiFileEmitBuildInfo: true,
39681
39732
  category: ts.Diagnostics.Type_Checking,
39682
39733
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
39683
39734
  defaultValueDescription: false,
@@ -39686,6 +39737,7 @@ var ts;
39686
39737
  name: "noUncheckedIndexedAccess",
39687
39738
  type: "boolean",
39688
39739
  affectsSemanticDiagnostics: true,
39740
+ affectsMultiFileEmitBuildInfo: true,
39689
39741
  category: ts.Diagnostics.Type_Checking,
39690
39742
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
39691
39743
  defaultValueDescription: false,
@@ -39694,6 +39746,7 @@ var ts;
39694
39746
  name: "noImplicitOverride",
39695
39747
  type: "boolean",
39696
39748
  affectsSemanticDiagnostics: true,
39749
+ affectsMultiFileEmitBuildInfo: true,
39697
39750
  category: ts.Diagnostics.Type_Checking,
39698
39751
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
39699
39752
  defaultValueDescription: false,
@@ -39701,6 +39754,8 @@ var ts;
39701
39754
  {
39702
39755
  name: "noPropertyAccessFromIndexSignature",
39703
39756
  type: "boolean",
39757
+ affectsSemanticDiagnostics: true,
39758
+ affectsMultiFileEmitBuildInfo: true,
39704
39759
  showInSimplifiedHelpView: false,
39705
39760
  category: ts.Diagnostics.Type_Checking,
39706
39761
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -39786,6 +39841,7 @@ var ts;
39786
39841
  name: "allowSyntheticDefaultImports",
39787
39842
  type: "boolean",
39788
39843
  affectsSemanticDiagnostics: true,
39844
+ affectsMultiFileEmitBuildInfo: true,
39789
39845
  category: ts.Diagnostics.Interop_Constraints,
39790
39846
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
39791
39847
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -39795,6 +39851,7 @@ var ts;
39795
39851
  type: "boolean",
39796
39852
  affectsSemanticDiagnostics: true,
39797
39853
  affectsEmit: true,
39854
+ affectsMultiFileEmitBuildInfo: true,
39798
39855
  showInSimplifiedHelpView: true,
39799
39856
  category: ts.Diagnostics.Interop_Constraints,
39800
39857
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -39811,6 +39868,7 @@ var ts;
39811
39868
  name: "allowUmdGlobalAccess",
39812
39869
  type: "boolean",
39813
39870
  affectsSemanticDiagnostics: true,
39871
+ affectsMultiFileEmitBuildInfo: true,
39814
39872
  category: ts.Diagnostics.Modules,
39815
39873
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
39816
39874
  defaultValueDescription: false,
@@ -39832,6 +39890,7 @@ var ts;
39832
39890
  name: "sourceRoot",
39833
39891
  type: "string",
39834
39892
  affectsEmit: true,
39893
+ affectsMultiFileEmitBuildInfo: true,
39835
39894
  paramType: ts.Diagnostics.LOCATION,
39836
39895
  category: ts.Diagnostics.Emit,
39837
39896
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -39840,6 +39899,7 @@ var ts;
39840
39899
  name: "mapRoot",
39841
39900
  type: "string",
39842
39901
  affectsEmit: true,
39902
+ affectsMultiFileEmitBuildInfo: true,
39843
39903
  paramType: ts.Diagnostics.LOCATION,
39844
39904
  category: ts.Diagnostics.Emit,
39845
39905
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -39848,6 +39908,7 @@ var ts;
39848
39908
  name: "inlineSourceMap",
39849
39909
  type: "boolean",
39850
39910
  affectsEmit: true,
39911
+ affectsMultiFileEmitBuildInfo: true,
39851
39912
  category: ts.Diagnostics.Emit,
39852
39913
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
39853
39914
  defaultValueDescription: false,
@@ -39856,6 +39917,7 @@ var ts;
39856
39917
  name: "inlineSources",
39857
39918
  type: "boolean",
39858
39919
  affectsEmit: true,
39920
+ affectsMultiFileEmitBuildInfo: true,
39859
39921
  category: ts.Diagnostics.Emit,
39860
39922
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
39861
39923
  defaultValueDescription: false,
@@ -39865,6 +39927,7 @@ var ts;
39865
39927
  name: "experimentalDecorators",
39866
39928
  type: "boolean",
39867
39929
  affectsSemanticDiagnostics: true,
39930
+ affectsMultiFileEmitBuildInfo: true,
39868
39931
  category: ts.Diagnostics.Language_and_Environment,
39869
39932
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
39870
39933
  defaultValueDescription: false,
@@ -39874,6 +39937,7 @@ var ts;
39874
39937
  type: "boolean",
39875
39938
  affectsSemanticDiagnostics: true,
39876
39939
  affectsEmit: true,
39940
+ affectsMultiFileEmitBuildInfo: true,
39877
39941
  category: ts.Diagnostics.Language_and_Environment,
39878
39942
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
39879
39943
  defaultValueDescription: false,
@@ -39898,6 +39962,7 @@ var ts;
39898
39962
  type: "string",
39899
39963
  affectsSemanticDiagnostics: true,
39900
39964
  affectsEmit: true,
39965
+ affectsMultiFileEmitBuildInfo: true,
39901
39966
  affectsModuleResolution: true,
39902
39967
  category: ts.Diagnostics.Language_and_Environment,
39903
39968
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -39915,6 +39980,9 @@ var ts;
39915
39980
  name: "out",
39916
39981
  type: "string",
39917
39982
  affectsEmit: true,
39983
+ affectsMultiFileEmitBuildInfo: true,
39984
+ affectsDeclarationPath: true,
39985
+ affectsBundleEmitBuildInfo: true,
39918
39986
  isFilePath: false,
39919
39987
  // for correct behaviour, please use outFile
39920
39988
  category: ts.Diagnostics.Backwards_Compatibility,
@@ -39926,6 +39994,7 @@ var ts;
39926
39994
  name: "reactNamespace",
39927
39995
  type: "string",
39928
39996
  affectsEmit: true,
39997
+ affectsMultiFileEmitBuildInfo: true,
39929
39998
  category: ts.Diagnostics.Language_and_Environment,
39930
39999
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
39931
40000
  defaultValueDescription: "`React`",
@@ -39933,6 +40002,8 @@ var ts;
39933
40002
  {
39934
40003
  name: "skipDefaultLibCheck",
39935
40004
  type: "boolean",
40005
+ // We need to store these to determine whether `lib` files need to be rechecked
40006
+ affectsMultiFileEmitBuildInfo: true,
39936
40007
  category: ts.Diagnostics.Completeness,
39937
40008
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
39938
40009
  defaultValueDescription: false,
@@ -39948,6 +40019,7 @@ var ts;
39948
40019
  name: "emitBOM",
39949
40020
  type: "boolean",
39950
40021
  affectsEmit: true,
40022
+ affectsMultiFileEmitBuildInfo: true,
39951
40023
  category: ts.Diagnostics.Emit,
39952
40024
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
39953
40025
  defaultValueDescription: false,
@@ -39959,6 +40031,7 @@ var ts;
39959
40031
  lf: 1 /* LineFeed */
39960
40032
  })),
39961
40033
  affectsEmit: true,
40034
+ affectsMultiFileEmitBuildInfo: true,
39962
40035
  paramType: ts.Diagnostics.NEWLINE,
39963
40036
  category: ts.Diagnostics.Emit,
39964
40037
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -39968,6 +40041,7 @@ var ts;
39968
40041
  name: "noErrorTruncation",
39969
40042
  type: "boolean",
39970
40043
  affectsSemanticDiagnostics: true,
40044
+ affectsMultiFileEmitBuildInfo: true,
39971
40045
  category: ts.Diagnostics.Output_Formatting,
39972
40046
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
39973
40047
  defaultValueDescription: false,
@@ -39998,6 +40072,7 @@ var ts;
39998
40072
  name: "stripInternal",
39999
40073
  type: "boolean",
40000
40074
  affectsEmit: true,
40075
+ affectsMultiFileEmitBuildInfo: true,
40001
40076
  category: ts.Diagnostics.Emit,
40002
40077
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
40003
40078
  defaultValueDescription: false,
@@ -40038,6 +40113,7 @@ var ts;
40038
40113
  name: "noImplicitUseStrict",
40039
40114
  type: "boolean",
40040
40115
  affectsSemanticDiagnostics: true,
40116
+ affectsMultiFileEmitBuildInfo: true,
40041
40117
  category: ts.Diagnostics.Backwards_Compatibility,
40042
40118
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
40043
40119
  defaultValueDescription: false,
@@ -40046,6 +40122,7 @@ var ts;
40046
40122
  name: "noEmitHelpers",
40047
40123
  type: "boolean",
40048
40124
  affectsEmit: true,
40125
+ affectsMultiFileEmitBuildInfo: true,
40049
40126
  category: ts.Diagnostics.Emit,
40050
40127
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
40051
40128
  defaultValueDescription: false,
@@ -40054,6 +40131,7 @@ var ts;
40054
40131
  name: "noEmitOnError",
40055
40132
  type: "boolean",
40056
40133
  affectsEmit: true,
40134
+ affectsMultiFileEmitBuildInfo: true,
40057
40135
  category: ts.Diagnostics.Emit,
40058
40136
  transpileOptionValue: undefined,
40059
40137
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -40063,6 +40141,7 @@ var ts;
40063
40141
  name: "preserveConstEnums",
40064
40142
  type: "boolean",
40065
40143
  affectsEmit: true,
40144
+ affectsMultiFileEmitBuildInfo: true,
40066
40145
  category: ts.Diagnostics.Emit,
40067
40146
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
40068
40147
  defaultValueDescription: false,
@@ -40071,6 +40150,8 @@ var ts;
40071
40150
  name: "declarationDir",
40072
40151
  type: "string",
40073
40152
  affectsEmit: true,
40153
+ affectsMultiFileEmitBuildInfo: true,
40154
+ affectsDeclarationPath: true,
40074
40155
  isFilePath: true,
40075
40156
  paramType: ts.Diagnostics.DIRECTORY,
40076
40157
  category: ts.Diagnostics.Emit,
@@ -40080,6 +40161,8 @@ var ts;
40080
40161
  {
40081
40162
  name: "skipLibCheck",
40082
40163
  type: "boolean",
40164
+ // We need to store these to determine whether `lib` files need to be rechecked
40165
+ affectsMultiFileEmitBuildInfo: true,
40083
40166
  category: ts.Diagnostics.Completeness,
40084
40167
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
40085
40168
  defaultValueDescription: false,
@@ -40089,6 +40172,7 @@ var ts;
40089
40172
  type: "boolean",
40090
40173
  affectsBindDiagnostics: true,
40091
40174
  affectsSemanticDiagnostics: true,
40175
+ affectsMultiFileEmitBuildInfo: true,
40092
40176
  category: ts.Diagnostics.Type_Checking,
40093
40177
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
40094
40178
  defaultValueDescription: undefined,
@@ -40098,6 +40182,7 @@ var ts;
40098
40182
  type: "boolean",
40099
40183
  affectsBindDiagnostics: true,
40100
40184
  affectsSemanticDiagnostics: true,
40185
+ affectsMultiFileEmitBuildInfo: true,
40101
40186
  category: ts.Diagnostics.Type_Checking,
40102
40187
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
40103
40188
  defaultValueDescription: undefined,
@@ -40106,6 +40191,7 @@ var ts;
40106
40191
  name: "suppressExcessPropertyErrors",
40107
40192
  type: "boolean",
40108
40193
  affectsSemanticDiagnostics: true,
40194
+ affectsMultiFileEmitBuildInfo: true,
40109
40195
  category: ts.Diagnostics.Backwards_Compatibility,
40110
40196
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
40111
40197
  defaultValueDescription: false,
@@ -40114,6 +40200,7 @@ var ts;
40114
40200
  name: "suppressImplicitAnyIndexErrors",
40115
40201
  type: "boolean",
40116
40202
  affectsSemanticDiagnostics: true,
40203
+ affectsMultiFileEmitBuildInfo: true,
40117
40204
  category: ts.Diagnostics.Backwards_Compatibility,
40118
40205
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
40119
40206
  defaultValueDescription: false,
@@ -40138,6 +40225,7 @@ var ts;
40138
40225
  name: "noStrictGenericChecks",
40139
40226
  type: "boolean",
40140
40227
  affectsSemanticDiagnostics: true,
40228
+ affectsMultiFileEmitBuildInfo: true,
40141
40229
  category: ts.Diagnostics.Backwards_Compatibility,
40142
40230
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
40143
40231
  defaultValueDescription: false,
@@ -40147,6 +40235,7 @@ var ts;
40147
40235
  type: "boolean",
40148
40236
  affectsSemanticDiagnostics: true,
40149
40237
  affectsEmit: true,
40238
+ affectsMultiFileEmitBuildInfo: true,
40150
40239
  category: ts.Diagnostics.Language_and_Environment,
40151
40240
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
40152
40241
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -40155,6 +40244,7 @@ var ts;
40155
40244
  name: "preserveValueImports",
40156
40245
  type: "boolean",
40157
40246
  affectsEmit: true,
40247
+ affectsMultiFileEmitBuildInfo: true,
40158
40248
  category: ts.Diagnostics.Emit,
40159
40249
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
40160
40250
  defaultValueDescription: false,
@@ -40198,6 +40288,8 @@ var ts;
40198
40288
  /* @internal */
40199
40289
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
40200
40290
  /* @internal */
40291
+ ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
40292
+ /* @internal */
40201
40293
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
40202
40294
  /* @internal */
40203
40295
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -41053,6 +41145,7 @@ var ts;
41053
41145
  return optionDefinition.type;
41054
41146
  }
41055
41147
  }
41148
+ /* @internal */
41056
41149
  function getNameOfCompilerOptionValue(value, customTypeMap) {
41057
41150
  // There is a typeMap associated with this command-line option so use it to map value back to its name
41058
41151
  return ts.forEachEntry(customTypeMap, function (mapValue, key) {
@@ -41061,6 +41154,7 @@ var ts;
41061
41154
  }
41062
41155
  });
41063
41156
  }
41157
+ ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
41064
41158
  function serializeCompilerOptions(options, pathOptions) {
41065
41159
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
41066
41160
  }
@@ -43161,16 +43255,20 @@ var ts;
43161
43255
  function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
43162
43256
  return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
43163
43257
  }
43258
+ var jsOnlyExtensions = [Extensions.JavaScript];
43259
+ var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
43260
+ var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
43261
+ var tsconfigExtensions = [Extensions.TSConfig];
43164
43262
  function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
43165
43263
  var containingDirectory = ts.getDirectoryPath(containingFile);
43166
43264
  // es module file or cjs-like input file, use a variant of the legacy cjs resolver that supports the selected modern features
43167
43265
  var esmMode = resolutionMode === ts.ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0;
43168
- return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions, redirectedReference);
43266
+ var extensions = compilerOptions.noDtsResolution ? [Extensions.TsOnly, Extensions.JavaScript] : tsExtensions;
43267
+ if (compilerOptions.resolveJsonModule) {
43268
+ extensions = __spreadArray(__spreadArray([], extensions, true), [Extensions.Json], false);
43269
+ }
43270
+ return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference);
43169
43271
  }
43170
- var jsOnlyExtensions = [Extensions.JavaScript];
43171
- var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
43172
- var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
43173
- var tsconfigExtensions = [Extensions.TSConfig];
43174
43272
  function tryResolveJSModuleWorker(moduleName, initialDir, host) {
43175
43273
  return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
43176
43274
  }
@@ -46955,12 +47053,14 @@ var ts;
46955
47053
  }
46956
47054
  }
46957
47055
  function setCommonJsModuleIndicator(node) {
46958
- if (file.externalModuleIndicator) {
47056
+ if (file.externalModuleIndicator && file.externalModuleIndicator !== true) {
46959
47057
  return false;
46960
47058
  }
46961
47059
  if (!file.commonJsModuleIndicator) {
46962
47060
  file.commonJsModuleIndicator = node;
46963
- bindSourceFileAsExternalModule();
47061
+ if (!file.externalModuleIndicator) {
47062
+ bindSourceFileAsExternalModule();
47063
+ }
46964
47064
  }
46965
47065
  return true;
46966
47066
  }
@@ -47374,7 +47474,11 @@ var ts;
47374
47474
  checkStrictModeEvalOrArguments(node, node.name);
47375
47475
  }
47376
47476
  if (!ts.isBindingPattern(node.name)) {
47377
- if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) && !ts.getJSDocTypeTag(node) && !(ts.getCombinedModifierFlags(node) & 1 /* Export */)) {
47477
+ var possibleVariableDecl = node.kind === 254 /* VariableDeclaration */ ? node : node.parent.parent;
47478
+ if (ts.isInJSFile(node) &&
47479
+ ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) &&
47480
+ !ts.getJSDocTypeTag(node) &&
47481
+ !(ts.getCombinedModifierFlags(node) & 1 /* Export */)) {
47378
47482
  declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
47379
47483
  }
47380
47484
  else if (ts.isBlockOrCatchScoped(node)) {
@@ -50201,7 +50305,8 @@ var ts;
50201
50305
  && isAliasableOrJsExpression(node.parent.right)
50202
50306
  || node.kind === 297 /* ShorthandPropertyAssignment */
50203
50307
  || node.kind === 296 /* PropertyAssignment */ && isAliasableOrJsExpression(node.initializer)
50204
- || ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node);
50308
+ || node.kind === 254 /* VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)
50309
+ || node.kind === 203 /* BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent);
50205
50310
  }
50206
50311
  function isAliasableOrJsExpression(e) {
50207
50312
  return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e);
@@ -50294,7 +50399,7 @@ var ts;
50294
50399
  return hasExportAssignmentSymbol(moduleSymbol);
50295
50400
  }
50296
50401
  // 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
50297
- return !file.externalModuleIndicator && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), /*sourceNode*/ undefined, dontResolveAlias);
50402
+ return typeof file.externalModuleIndicator !== "object" && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), /*sourceNode*/ undefined, dontResolveAlias);
50298
50403
  }
50299
50404
  function getTargetOfImportClause(node, dontResolveAlias) {
50300
50405
  var _a;
@@ -68158,13 +68263,40 @@ var ts;
68158
68263
  return sourceStart.slice(0, startLen) !== targetStart.slice(0, startLen) ||
68159
68264
  sourceEnd.slice(sourceEnd.length - endLen) !== targetEnd.slice(targetEnd.length - endLen);
68160
68265
  }
68161
- function isValidBigIntString(s) {
68266
+ /**
68267
+ * Tests whether the provided string can be parsed as a number.
68268
+ * @param s The string to test.
68269
+ * @param roundTripOnly Indicates the resulting number matches the input when converted back to a string.
68270
+ */
68271
+ function isValidNumberString(s, roundTripOnly) {
68272
+ if (s === "")
68273
+ return false;
68274
+ var n = +s;
68275
+ return isFinite(n) && (!roundTripOnly || "" + n === s);
68276
+ }
68277
+ /**
68278
+ * @param text a valid bigint string excluding a trailing `n`, but including a possible prefix `-`. Use `isValidBigIntString(text, roundTripOnly)` before calling this function.
68279
+ */
68280
+ function parseBigIntLiteralType(text) {
68281
+ var negative = text.startsWith("-");
68282
+ var base10Value = ts.parsePseudoBigInt((negative ? text.slice(1) : text) + "n");
68283
+ return getBigIntLiteralType({ negative: negative, base10Value: base10Value });
68284
+ }
68285
+ /**
68286
+ * Tests whether the provided string can be parsed as a bigint.
68287
+ * @param s The string to test.
68288
+ * @param roundTripOnly Indicates the resulting bigint matches the input when converted back to a string.
68289
+ */
68290
+ function isValidBigIntString(s, roundTripOnly) {
68291
+ if (s === "")
68292
+ return false;
68162
68293
  var scanner = ts.createScanner(99 /* ESNext */, /*skipTrivia*/ false);
68163
68294
  var success = true;
68164
68295
  scanner.setOnError(function () { return success = false; });
68165
68296
  scanner.setText(s + "n");
68166
68297
  var result = scanner.scan();
68167
- if (result === 40 /* MinusToken */) {
68298
+ var negative = result === 40 /* MinusToken */;
68299
+ if (negative) {
68168
68300
  result = scanner.scan();
68169
68301
  }
68170
68302
  var flags = scanner.getTokenFlags();
@@ -68173,7 +68305,8 @@ var ts;
68173
68305
  // * a bigint can be scanned, and that when it is scanned, it is
68174
68306
  // * the full length of the input string (so the scanner is one character beyond the augmented input length)
68175
68307
  // * it does not contain a numeric seperator (the `BigInt` constructor does not accept a numeric seperator in its input)
68176
- return success && result === 9 /* BigIntLiteral */ && scanner.getTextPos() === (s.length + 1) && !(flags & 512 /* ContainsSeparator */);
68308
+ return success && result === 9 /* BigIntLiteral */ && scanner.getTextPos() === (s.length + 1) && !(flags & 512 /* ContainsSeparator */)
68309
+ && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
68177
68310
  }
68178
68311
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
68179
68312
  if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
@@ -68181,8 +68314,8 @@ var ts;
68181
68314
  }
68182
68315
  if (source.flags & 128 /* StringLiteral */) {
68183
68316
  var value = source.value;
68184
- return !!(target.flags & 8 /* Number */ && value !== "" && isFinite(+value) ||
68185
- target.flags & 64 /* BigInt */ && value !== "" && isValidBigIntString(value) ||
68317
+ return !!(target.flags & 8 /* Number */ && isValidNumberString(value, /*roundTripOnly*/ false) ||
68318
+ target.flags & 64 /* BigInt */ && isValidBigIntString(value, /*roundTripOnly*/ false) ||
68186
68319
  target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName);
68187
68320
  }
68188
68321
  if (source.flags & 134217728 /* TemplateLiteral */) {
@@ -68755,8 +68888,57 @@ var ts;
68755
68888
  // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
68756
68889
  // succeed. That would be a pointless and confusing outcome.
68757
68890
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
68891
+ var _loop_23 = function (i) {
68892
+ var source_1 = matches ? matches[i] : neverType;
68893
+ var target_3 = types[i];
68894
+ // If we are inferring from a string literal type to a type variable whose constraint includes one of the
68895
+ // allowed template literal placeholder types, infer from a literal type corresponding to the constraint.
68896
+ if (source_1.flags & 128 /* StringLiteral */ && target_3.flags & 8650752 /* TypeVariable */) {
68897
+ var inferenceContext = getInferenceInfoForType(target_3);
68898
+ var constraint = inferenceContext ? getBaseConstraintOfType(inferenceContext.typeParameter) : undefined;
68899
+ if (constraint && !isTypeAny(constraint)) {
68900
+ var constraintTypes = constraint.flags & 1048576 /* Union */ ? constraint.types : [constraint];
68901
+ var allTypeFlags_1 = ts.reduceLeft(constraintTypes, function (flags, t) { return flags | t.flags; }, 0);
68902
+ // If the constraint contains `string`, we don't need to look for a more preferred type
68903
+ if (!(allTypeFlags_1 & 4 /* String */)) {
68904
+ var str_1 = source_1.value;
68905
+ // If the type contains `number` or a number literal and the string isn't a valid number, exclude numbers
68906
+ if (allTypeFlags_1 & 296 /* NumberLike */ && !isValidNumberString(str_1, /*roundTripOnly*/ true)) {
68907
+ allTypeFlags_1 &= ~296 /* NumberLike */;
68908
+ }
68909
+ // If the type contains `bigint` or a bigint literal and the string isn't a valid bigint, exclude bigints
68910
+ if (allTypeFlags_1 & 2112 /* BigIntLike */ && !isValidBigIntString(str_1, /*roundTripOnly*/ true)) {
68911
+ allTypeFlags_1 &= ~2112 /* BigIntLike */;
68912
+ }
68913
+ // for each type in the constraint, find the highest priority matching type
68914
+ var matchingType = ts.reduceLeft(constraintTypes, function (left, right) {
68915
+ return !(right.flags & allTypeFlags_1) ? left :
68916
+ left.flags & 4 /* String */ ? left : right.flags & 4 /* String */ ? source_1 :
68917
+ left.flags & 134217728 /* TemplateLiteral */ ? left : right.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source_1, right) ? source_1 :
68918
+ left.flags & 268435456 /* StringMapping */ ? left : right.flags & 268435456 /* StringMapping */ && str_1 === applyStringMapping(right.symbol, str_1) ? source_1 :
68919
+ left.flags & 128 /* StringLiteral */ ? left : right.flags & 128 /* StringLiteral */ && right.value === str_1 ? right :
68920
+ left.flags & 8 /* Number */ ? left : right.flags & 8 /* Number */ ? getNumberLiteralType(+str_1) :
68921
+ left.flags & 32 /* Enum */ ? left : right.flags & 32 /* Enum */ ? getNumberLiteralType(+str_1) :
68922
+ left.flags & 256 /* NumberLiteral */ ? left : right.flags & 256 /* NumberLiteral */ && right.value === +str_1 ? right :
68923
+ left.flags & 64 /* BigInt */ ? left : right.flags & 64 /* BigInt */ ? parseBigIntLiteralType(str_1) :
68924
+ left.flags & 2048 /* BigIntLiteral */ ? left : right.flags & 2048 /* BigIntLiteral */ && ts.pseudoBigIntToString(right.value) === str_1 ? right :
68925
+ left.flags & 16 /* Boolean */ ? left : right.flags & 16 /* Boolean */ ? str_1 === "true" ? trueType : str_1 === "false" ? falseType : booleanType :
68926
+ left.flags & 512 /* BooleanLiteral */ ? left : right.flags & 512 /* BooleanLiteral */ && right.intrinsicName === str_1 ? right :
68927
+ left.flags & 32768 /* Undefined */ ? left : right.flags & 32768 /* Undefined */ && right.intrinsicName === str_1 ? right :
68928
+ left.flags & 65536 /* Null */ ? left : right.flags & 65536 /* Null */ && right.intrinsicName === str_1 ? right :
68929
+ left;
68930
+ }, neverType);
68931
+ if (!(matchingType.flags & 131072 /* Never */)) {
68932
+ inferFromTypes(matchingType, target_3);
68933
+ return "continue";
68934
+ }
68935
+ }
68936
+ }
68937
+ }
68938
+ inferFromTypes(source_1, target_3);
68939
+ };
68758
68940
  for (var i = 0; i < types.length; i++) {
68759
- inferFromTypes(matches ? matches[i] : neverType, types[i]);
68941
+ _loop_23(i);
68760
68942
  }
68761
68943
  }
68762
68944
  }
@@ -69274,7 +69456,7 @@ var ts;
69274
69456
  function mapTypesByKeyProperty(types, name) {
69275
69457
  var map = new ts.Map();
69276
69458
  var count = 0;
69277
- var _loop_23 = function (type) {
69459
+ var _loop_24 = function (type) {
69278
69460
  if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
69279
69461
  var discriminant = getTypeOfPropertyOfType(type, name);
69280
69462
  if (discriminant) {
@@ -69300,7 +69482,7 @@ var ts;
69300
69482
  };
69301
69483
  for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
69302
69484
  var type = types_16[_i];
69303
- var state_9 = _loop_23(type);
69485
+ var state_9 = _loop_24(type);
69304
69486
  if (typeof state_9 === "object")
69305
69487
  return state_9.value;
69306
69488
  }
@@ -75688,7 +75870,7 @@ var ts;
75688
75870
  if (spreadIndex >= 0) {
75689
75871
  // Create synthetic arguments from spreads of tuple types.
75690
75872
  var effectiveArgs_1 = args.slice(0, spreadIndex);
75691
- var _loop_24 = function (i) {
75873
+ var _loop_25 = function (i) {
75692
75874
  var arg = args[i];
75693
75875
  // We can call checkExpressionCached because spread expressions never have a contextual type.
75694
75876
  var spreadType = arg.kind === 225 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@@ -75705,7 +75887,7 @@ var ts;
75705
75887
  }
75706
75888
  };
75707
75889
  for (var i = spreadIndex; i < args.length; i++) {
75708
- _loop_24(i);
75890
+ _loop_25(i);
75709
75891
  }
75710
75892
  return effectiveArgs_1;
75711
75893
  }
@@ -76025,7 +76207,7 @@ var ts;
76025
76207
  var min_3 = Number.MAX_VALUE;
76026
76208
  var minIndex = 0;
76027
76209
  var i_1 = 0;
76028
- var _loop_25 = function (c) {
76210
+ var _loop_26 = function (c) {
76029
76211
  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)); };
76030
76212
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2);
76031
76213
  if (diags_2) {
@@ -76043,7 +76225,7 @@ var ts;
76043
76225
  };
76044
76226
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
76045
76227
  var c = candidatesForArgumentError_1[_a];
76046
- _loop_25(c);
76228
+ _loop_26(c);
76047
76229
  }
76048
76230
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
76049
76231
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -76201,7 +76383,7 @@ var ts;
76201
76383
  }
76202
76384
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
76203
76385
  var parameters = [];
76204
- var _loop_26 = function (i) {
76386
+ var _loop_27 = function (i) {
76205
76387
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
76206
76388
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
76207
76389
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -76209,7 +76391,7 @@ var ts;
76209
76391
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
76210
76392
  };
76211
76393
  for (var i = 0; i < maxNonRestParam; i++) {
76212
- _loop_26(i);
76394
+ _loop_27(i);
76213
76395
  }
76214
76396
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
76215
76397
  var flags = 0 /* None */;
@@ -80266,7 +80448,7 @@ var ts;
80266
80448
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
80267
80449
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
80268
80450
  var indexSignatureMap_1 = new ts.Map();
80269
- var _loop_27 = function (declaration) {
80451
+ var _loop_28 = function (declaration) {
80270
80452
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
80271
80453
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
80272
80454
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -80281,7 +80463,7 @@ var ts;
80281
80463
  };
80282
80464
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
80283
80465
  var declaration = _a[_i];
80284
- _loop_27(declaration);
80466
+ _loop_28(declaration);
80285
80467
  }
80286
80468
  indexSignatureMap_1.forEach(function (entry) {
80287
80469
  if (entry.declarations.length > 1) {
@@ -82477,7 +82659,7 @@ var ts;
82477
82659
  }
82478
82660
  // For a commonjs `const x = require`, validate the alias and exit
82479
82661
  var symbol = getSymbolOfNode(node);
82480
- if (symbol.flags & 2097152 /* Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)) {
82662
+ if (symbol.flags & 2097152 /* Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 /* BindingElement */ ? node.parent.parent : node)) {
82481
82663
  checkAliasSymbol(node);
82482
82664
  return;
82483
82665
  }
@@ -83742,7 +83924,7 @@ var ts;
83742
83924
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
83743
83925
  var localPropDeclaration = declaration && declaration.kind === 221 /* BinaryExpression */ ||
83744
83926
  name && name.kind === 162 /* ComputedPropertyName */ || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
83745
- var _loop_28 = function (info) {
83927
+ var _loop_29 = function (info) {
83746
83928
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
83747
83929
  // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
83748
83930
  // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@@ -83755,7 +83937,7 @@ var ts;
83755
83937
  };
83756
83938
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
83757
83939
  var info = indexInfos_9[_i];
83758
- _loop_28(info);
83940
+ _loop_29(info);
83759
83941
  }
83760
83942
  }
83761
83943
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -83763,7 +83945,7 @@ var ts;
83763
83945
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
83764
83946
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
83765
83947
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
83766
- var _loop_29 = function (info) {
83948
+ var _loop_30 = function (info) {
83767
83949
  if (info === checkInfo)
83768
83950
  return "continue";
83769
83951
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -83778,7 +83960,7 @@ var ts;
83778
83960
  };
83779
83961
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
83780
83962
  var info = indexInfos_10[_i];
83781
- _loop_29(info);
83963
+ _loop_30(info);
83782
83964
  }
83783
83965
  }
83784
83966
  function checkTypeNameIsReserved(name, message) {
@@ -84097,7 +84279,7 @@ var ts;
84097
84279
  var baseTypes = baseTypeNode && getBaseTypes(type);
84098
84280
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
84099
84281
  var baseStaticType = getBaseConstructorTypeOfClass(type);
84100
- var _loop_30 = function (member) {
84282
+ var _loop_31 = function (member) {
84101
84283
  if (ts.hasAmbientModifier(member)) {
84102
84284
  return "continue";
84103
84285
  }
@@ -84114,7 +84296,7 @@ var ts;
84114
84296
  };
84115
84297
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
84116
84298
  var member = _a[_i];
84117
- _loop_30(member);
84299
+ _loop_31(member);
84118
84300
  }
84119
84301
  }
84120
84302
  /**
@@ -84202,7 +84384,7 @@ var ts;
84202
84384
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
84203
84385
  // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
84204
84386
  var issuedMemberError = false;
84205
- var _loop_31 = function (member) {
84387
+ var _loop_32 = function (member) {
84206
84388
  if (ts.isStatic(member)) {
84207
84389
  return "continue";
84208
84390
  }
@@ -84221,7 +84403,7 @@ var ts;
84221
84403
  };
84222
84404
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
84223
84405
  var member = _a[_i];
84224
- _loop_31(member);
84406
+ _loop_32(member);
84225
84407
  }
84226
84408
  if (!issuedMemberError) {
84227
84409
  // check again with diagnostics to generate a less-specific error
@@ -89881,9 +90063,7 @@ var ts;
89881
90063
  var ts;
89882
90064
  (function (ts) {
89883
90065
  function createSourceMapGenerator(host, file, sourceRoot, sourcesDirectoryPath, generatorOptions) {
89884
- var _a = generatorOptions.extendedDiagnostics
89885
- ? ts.performance.createTimer("Source Map", "beforeSourcemap", "afterSourcemap")
89886
- : ts.performance.nullTimer, enter = _a.enter, exit = _a.exit;
90066
+ var _a = ts.performance.createTimerIf(!!generatorOptions.extendedDiagnostics, "Source Map", "beforeSourcemap", "afterSourcemap"), enter = _a.enter, exit = _a.exit;
89887
90067
  // Current source map file and its index in the sources list
89888
90068
  var rawSources = [];
89889
90069
  var sources = [];
@@ -110200,7 +110380,8 @@ var ts;
110200
110380
  return;
110201
110381
  }
110202
110382
  var version = ts.version; // Extracted into a const so the form is stable between namespace and module
110203
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), /*writeByteOrderMark*/ false);
110383
+ var buildInfo = { bundle: bundle, program: program, version: version };
110384
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
110204
110385
  }
110205
110386
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
110206
110387
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -110354,13 +110535,18 @@ var ts;
110354
110535
  if (sourceMapFilePath) {
110355
110536
  var sourceMap = sourceMapGenerator.toString();
110356
110537
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110538
+ if (printer.bundleFileInfo)
110539
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
110357
110540
  }
110358
110541
  }
110359
110542
  else {
110360
110543
  writer.writeLine();
110361
110544
  }
110362
110545
  // Write the output file
110363
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110546
+ var text = writer.getText();
110547
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110548
+ if (printer.bundleFileInfo)
110549
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
110364
110550
  // Reset state
110365
110551
  writer.clear();
110366
110552
  }
@@ -110503,34 +110689,54 @@ var ts;
110503
110689
  }
110504
110690
  /*@internal*/
110505
110691
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
110692
+ var createHash = ts.maybeBind(host, host.createHash);
110506
110693
  var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
110507
- var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
110508
- if (!buildInfoText)
110694
+ var buildInfo;
110695
+ if (host.getBuildInfo) {
110696
+ var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
110697
+ if (!hostBuildInfo)
110698
+ return buildInfoPath;
110699
+ buildInfo = hostBuildInfo;
110700
+ }
110701
+ else {
110702
+ var buildInfoText = host.readFile(buildInfoPath);
110703
+ if (!buildInfoText)
110704
+ return buildInfoPath;
110705
+ buildInfo = getBuildInfo(buildInfoText);
110706
+ }
110707
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
110509
110708
  return buildInfoPath;
110510
110709
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
110511
110710
  if (!jsFileText)
110512
110711
  return jsFilePath;
110712
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
110713
+ return jsFilePath;
110513
110714
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
110514
110715
  // error if no source map or for now if inline sourcemap
110515
110716
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
110516
110717
  return sourceMapFilePath || "inline sourcemap decoding";
110718
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
110719
+ return sourceMapFilePath;
110517
110720
  // read declaration text
110518
110721
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
110519
110722
  if (declarationFilePath && !declarationText)
110520
110723
  return declarationFilePath;
110724
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
110725
+ return declarationFilePath;
110521
110726
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
110522
110727
  // error if no source map or for now if inline sourcemap
110523
110728
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
110524
110729
  return declarationMapPath || "inline sourcemap decoding";
110525
- var buildInfo = getBuildInfo(buildInfoText);
110526
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
110527
- return buildInfoPath;
110730
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
110731
+ return declarationMapPath;
110528
110732
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110529
110733
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
110530
110734
  /*onlyOwnText*/ true);
110531
110735
  var outputFiles = [];
110532
110736
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
110533
110737
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
110738
+ var changedDtsText;
110739
+ var changedDtsData;
110534
110740
  var emitHost = {
110535
110741
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
110536
110742
  getCanonicalFileName: host.getCanonicalFileName,
@@ -110546,7 +110752,7 @@ var ts;
110546
110752
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
110547
110753
  getProjectReferenceRedirect: ts.returnUndefined,
110548
110754
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
110549
- writeFile: function (name, text, writeByteOrderMark) {
110755
+ writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
110550
110756
  switch (name) {
110551
110757
  case jsFilePath:
110552
110758
  if (jsFileText === text)
@@ -110557,8 +110763,13 @@ var ts;
110557
110763
  return;
110558
110764
  break;
110559
110765
  case buildInfoPath:
110560
- var newBuildInfo = getBuildInfo(text);
110766
+ var newBuildInfo = data.buildInfo;
110561
110767
  newBuildInfo.program = buildInfo.program;
110768
+ if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
110769
+ // Update the output signature
110770
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
110771
+ newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
110772
+ }
110562
110773
  // Update sourceFileInfo
110563
110774
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
110564
110775
  newBuildInfo.bundle.js.sources = js.sources;
@@ -110566,11 +110777,13 @@ var ts;
110566
110777
  newBuildInfo.bundle.dts.sources = dts.sources;
110567
110778
  }
110568
110779
  newBuildInfo.bundle.sourceFiles = sourceFiles;
110569
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
110780
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
110570
110781
  return;
110571
110782
  case declarationFilePath:
110572
110783
  if (declarationText === text)
110573
110784
  return;
110785
+ changedDtsText = text;
110786
+ changedDtsData = data;
110574
110787
  break;
110575
110788
  case declarationMapPath:
110576
110789
  if (declarationMapText === text)
@@ -110589,6 +110802,7 @@ var ts;
110589
110802
  getSourceFileFromReference: ts.returnUndefined,
110590
110803
  redirectTargetsMap: ts.createMultiMap(),
110591
110804
  getFileIncludeReasons: ts.notImplemented,
110805
+ createHash: createHash,
110592
110806
  };
110593
110807
  emitFiles(ts.notImplementedResolver, emitHost,
110594
110808
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
@@ -115673,12 +115887,10 @@ var ts;
115673
115887
  }
115674
115888
  ts.createCompilerHost = createCompilerHost;
115675
115889
  /*@internal*/
115676
- // TODO(shkamat): update this after reworking ts build API
115677
115890
  function createCompilerHostWorker(options, setParentNodes, system) {
115678
115891
  if (system === void 0) { system = ts.sys; }
115679
115892
  var existingDirectories = new ts.Map();
115680
115893
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
115681
- var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
115682
115894
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
115683
115895
  var text;
115684
115896
  try {
@@ -115711,7 +115923,7 @@ var ts;
115711
115923
  // NOTE: If patchWriteFileEnsuringDirectory has been called,
115712
115924
  // the system.writeFile will do its own directory creation and
115713
115925
  // the ensureDirectoriesExist call will always be redundant.
115714
- 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); });
115926
+ 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); });
115715
115927
  ts.performance.mark("afterIOWrite");
115716
115928
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
115717
115929
  }
@@ -115721,35 +115933,6 @@ var ts;
115721
115933
  }
115722
115934
  }
115723
115935
  }
115724
- var outputFingerprints;
115725
- function writeFileWorker(fileName, data, writeByteOrderMark) {
115726
- if (!ts.isWatchSet(options) || !system.getModifiedTime) {
115727
- system.writeFile(fileName, data, writeByteOrderMark);
115728
- return;
115729
- }
115730
- if (!outputFingerprints) {
115731
- outputFingerprints = new ts.Map();
115732
- }
115733
- var hash = computeHash(data);
115734
- var mtimeBefore = system.getModifiedTime(fileName);
115735
- if (mtimeBefore) {
115736
- var fingerprint = outputFingerprints.get(fileName);
115737
- // If output has not been changed, and the file has no external modification
115738
- if (fingerprint &&
115739
- fingerprint.byteOrderMark === writeByteOrderMark &&
115740
- fingerprint.hash === hash &&
115741
- fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
115742
- return;
115743
- }
115744
- }
115745
- system.writeFile(fileName, data, writeByteOrderMark);
115746
- var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
115747
- outputFingerprints.set(fileName, {
115748
- hash: hash,
115749
- byteOrderMark: writeByteOrderMark,
115750
- mtime: mtimeAfter
115751
- });
115752
- }
115753
115936
  function getDefaultLibLocation() {
115754
115937
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
115755
115938
  }
@@ -117339,6 +117522,7 @@ var ts;
117339
117522
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
117340
117523
  redirectTargetsMap: redirectTargetsMap,
117341
117524
  getFileIncludeReasons: program.getFileIncludeReasons,
117525
+ createHash: ts.maybeBind(host, host.createHash),
117342
117526
  };
117343
117527
  }
117344
117528
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -119452,13 +119636,9 @@ var ts;
119452
119636
  function createManyToManyPathMap() {
119453
119637
  function create(forward, reverse, deleted) {
119454
119638
  var map = {
119455
- clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119456
- forEach: function (fn) { return forward.forEach(fn); },
119457
119639
  getKeys: function (v) { return reverse.get(v); },
119458
119640
  getValues: function (k) { return forward.get(k); },
119459
- hasKey: function (k) { return forward.has(k); },
119460
119641
  keys: function () { return forward.keys(); },
119461
- deletedKeys: function () { return deleted; },
119462
119642
  deleteKey: function (k) {
119463
119643
  (deleted || (deleted = new ts.Set())).add(k);
119464
119644
  var set = forward.get(k);
@@ -119485,11 +119665,6 @@ var ts;
119485
119665
  });
119486
119666
  return map;
119487
119667
  },
119488
- clear: function () {
119489
- forward.clear();
119490
- reverse.clear();
119491
- deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119492
- }
119493
119668
  };
119494
119669
  return map;
119495
119670
  }
@@ -119617,18 +119792,21 @@ var ts;
119617
119792
  * Creates the state of file references and signature for the new program from oldState if it is safe
119618
119793
  */
119619
119794
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119795
+ var _a, _b, _c;
119620
119796
  var fileInfos = new ts.Map();
119621
119797
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
119622
119798
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
119623
- var hasCalledUpdateShapeSignature = new ts.Set();
119624
119799
  var useOldState = canReuseOldState(referencedMap, oldState);
119625
119800
  // Ensure source files have parent pointers set
119626
119801
  newProgram.getTypeChecker();
119627
119802
  // Create the reference map, and set the file infos
119628
- for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
119629
- var sourceFile = _a[_i];
119803
+ for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
119804
+ var sourceFile = _d[_i];
119630
119805
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
119631
- var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
119806
+ var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
119807
+ var signature = oldUncommitedSignature === undefined ?
119808
+ useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
119809
+ oldUncommitedSignature || undefined;
119632
119810
  if (referencedMap) {
119633
119811
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
119634
119812
  if (newReferences) {
@@ -119636,19 +119814,26 @@ var ts;
119636
119814
  }
119637
119815
  // Copy old visible to outside files map
119638
119816
  if (useOldState) {
119639
- var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
119817
+ var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
119818
+ var exportedModules = oldUncommitedExportedModules === undefined ?
119819
+ oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
119820
+ oldUncommitedExportedModules || undefined;
119640
119821
  if (exportedModules) {
119641
119822
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119642
119823
  }
119643
119824
  }
119644
119825
  }
119645
- fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
119826
+ fileInfos.set(sourceFile.resolvedPath, {
119827
+ version: version_2,
119828
+ signature: signature,
119829
+ affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
119830
+ impliedFormat: sourceFile.impliedNodeFormat
119831
+ });
119646
119832
  }
119647
119833
  return {
119648
119834
  fileInfos: fileInfos,
119649
119835
  referencedMap: referencedMap,
119650
119836
  exportedModulesMap: exportedModulesMap,
119651
- hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
119652
119837
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
119653
119838
  };
119654
119839
  }
@@ -119662,71 +119847,42 @@ var ts;
119662
119847
  }
119663
119848
  BuilderState.releaseCache = releaseCache;
119664
119849
  /**
119665
- * Creates a clone of the state
119850
+ * Gets the files affected by the path from the program
119666
119851
  */
119667
- function clone(state) {
119852
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
119668
119853
  var _a, _b;
119669
- // Dont need to backup allFiles info since its cache anyway
119670
- return {
119671
- fileInfos: new ts.Map(state.fileInfos),
119672
- referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
119673
- exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
119674
- hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
119675
- useFileVersionAsSignature: state.useFileVersionAsSignature,
119676
- };
119854
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
119855
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119856
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119857
+ return result;
119677
119858
  }
119678
- BuilderState.clone = clone;
119679
- /**
119680
- * Gets the files affected by the path from the program
119681
- */
119682
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
119683
- // Since the operation could be cancelled, the signatures are always stored in the cache
119684
- // They will be committed once it is safe to use them
119685
- // eg when calling this api from tsserver, if there is no cancellation of the operation
119686
- // In the other cases the affected files signatures are committed only after the iteration through the result is complete
119687
- var signatureCache = cacheToUpdateSignature || new ts.Map();
119859
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119860
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
119688
119861
  var sourceFile = programOfThisState.getSourceFileByPath(path);
119689
119862
  if (!sourceFile) {
119690
119863
  return ts.emptyArray;
119691
119864
  }
119692
- if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
119865
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
119693
119866
  return [sourceFile];
119694
119867
  }
119695
- var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
119696
- if (!cacheToUpdateSignature) {
119697
- // Commit all the signatures in the signature cache
119698
- updateSignaturesFromCache(state, signatureCache);
119699
- }
119700
- return result;
119701
- }
119702
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119703
- /**
119704
- * Updates the signatures from the cache into state's fileinfo signatures
119705
- * This should be called whenever it is safe to commit the state of the builder
119706
- */
119707
- function updateSignaturesFromCache(state, signatureCache) {
119708
- signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
119868
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
119709
119869
  }
119710
- BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
119870
+ BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
119711
119871
  function updateSignatureOfFile(state, signature, path) {
119712
119872
  state.fileInfos.get(path).signature = signature;
119713
- state.hasCalledUpdateShapeSignature.add(path);
119873
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
119714
119874
  }
119715
119875
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
119716
119876
  /**
119717
119877
  * Returns if the shape of the signature has changed since last emit
119718
119878
  */
119719
- function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
119879
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
119880
+ var _a;
119720
119881
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
119721
- ts.Debug.assert(!!sourceFile);
119722
- ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
119723
119882
  // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
119724
- if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
119883
+ if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
119725
119884
  return false;
119726
- }
119727
119885
  var info = state.fileInfos.get(sourceFile.resolvedPath);
119728
- if (!info)
119729
- return ts.Debug.fail();
119730
119886
  var prevSignature = info.signature;
119731
119887
  var latestSignature;
119732
119888
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -119737,45 +119893,55 @@ var ts;
119737
119893
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119738
119894
  if (firstDts_1) {
119739
119895
  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; })); });
119740
- latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119741
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119742
- updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
119896
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
119897
+ if (latestSignature !== prevSignature) {
119898
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
119743
119899
  }
119744
119900
  }
119745
119901
  }
119746
119902
  // Default is to use file version as signature
119747
119903
  if (latestSignature === undefined) {
119748
119904
  latestSignature = sourceFile.version;
119749
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119905
+ if (state.exportedModulesMap && latestSignature !== prevSignature) {
119906
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119750
119907
  // All the references in this file are exported
119751
119908
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
119752
119909
  if (references) {
119753
- exportedModulesMapCache.set(sourceFile.resolvedPath, references);
119910
+ state.exportedModulesMap.set(sourceFile.resolvedPath, references);
119754
119911
  }
119755
119912
  else {
119756
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119913
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119757
119914
  }
119758
119915
  }
119759
119916
  }
119760
- cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
119917
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
119918
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
119919
+ info.signature = latestSignature;
119761
119920
  return latestSignature !== prevSignature;
119762
119921
  }
119763
119922
  BuilderState.updateShapeSignature = updateShapeSignature;
119923
+ function computeSignature(text, computeHash) {
119924
+ return (computeHash || ts.generateDjb2Hash)(text);
119925
+ }
119926
+ BuilderState.computeSignature = computeSignature;
119764
119927
  /**
119765
119928
  * Coverts the declaration emit result into exported modules map
119766
119929
  */
119767
- function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
119930
+ function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
119931
+ if (!state.exportedModulesMap)
119932
+ return;
119933
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119768
119934
  if (!exportedModulesFromDeclarationEmit) {
119769
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119935
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119770
119936
  return;
119771
119937
  }
119772
119938
  var exportedModules;
119773
119939
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
119774
119940
  if (exportedModules) {
119775
- exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
119941
+ state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119776
119942
  }
119777
119943
  else {
119778
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119944
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119779
119945
  }
119780
119946
  function addExportedModule(exportedModulePaths) {
119781
119947
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -119787,19 +119953,6 @@ var ts;
119787
119953
  }
119788
119954
  }
119789
119955
  BuilderState.updateExportedModules = updateExportedModules;
119790
- /**
119791
- * Updates the exported modules from cache into state's exported modules map
119792
- * This should be called whenever it is safe to commit the state of the builder
119793
- */
119794
- function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
119795
- var _a;
119796
- if (exportedModulesMapCache) {
119797
- ts.Debug.assert(!!state.exportedModulesMap);
119798
- (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
119799
- exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
119800
- }
119801
- }
119802
- BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
119803
119956
  /**
119804
119957
  * Get all the dependencies of the sourceFile
119805
119958
  */
@@ -119920,7 +120073,7 @@ var ts;
119920
120073
  /**
119921
120074
  * When program emits modular code, gets the files affected by the sourceFile whose shape has changed
119922
120075
  */
119923
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
120076
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
119924
120077
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
119925
120078
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
119926
120079
  }
@@ -119940,7 +120093,7 @@ var ts;
119940
120093
  if (!seenFileNamesMap.has(currentPath)) {
119941
120094
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
119942
120095
  seenFileNamesMap.set(currentPath, currentSourceFile);
119943
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
120096
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
119944
120097
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
119945
120098
  }
119946
120099
  }
@@ -119966,32 +120119,33 @@ var ts;
119966
120119
  * Create the state so that we can iterate on changedFiles/affected files
119967
120120
  */
119968
120121
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
120122
+ var _a, _b;
119969
120123
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
119970
120124
  state.program = newProgram;
119971
120125
  var compilerOptions = newProgram.getCompilerOptions();
119972
120126
  state.compilerOptions = compilerOptions;
120127
+ var outFilePath = ts.outFile(compilerOptions);
119973
120128
  // With --out or --outFile, any change affects all semantic diagnostics so no need to cache them
119974
- if (!ts.outFile(compilerOptions)) {
120129
+ if (!outFilePath) {
119975
120130
  state.semanticDiagnosticsPerFile = new ts.Map();
119976
120131
  }
120132
+ 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)) {
120133
+ state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
120134
+ }
119977
120135
  state.changedFilesSet = new ts.Set();
120136
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
119978
120137
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
119979
120138
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
119980
120139
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
119981
120140
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
120141
+ var canCopyEmitSignatures = compilerOptions.composite &&
120142
+ (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
120143
+ !outFilePath &&
120144
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
119982
120145
  if (useOldState) {
119983
- // Verify the sanity of old state
119984
- if (!oldState.currentChangedFilePath) {
119985
- var affectedSignatures = oldState.currentAffectedFilesSignatures;
119986
- ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
119987
- }
119988
- var changedFilesSet = oldState.changedFilesSet;
119989
- if (canCopySemanticDiagnostics) {
119990
- ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
119991
- }
119992
120146
  // Copy old state's changed files set
119993
- changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
119994
- if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
120147
+ (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
120148
+ if (!outFilePath && oldState.affectedFilesPendingEmit) {
119995
120149
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
119996
120150
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
119997
120151
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -120012,6 +120166,8 @@ var ts;
120012
120166
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
120013
120167
  // versions dont match
120014
120168
  oldInfo.version !== info.version ||
120169
+ // Implied formats dont match
120170
+ oldInfo.impliedFormat !== info.impliedFormat ||
120015
120171
  // Referenced files changed
120016
120172
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
120017
120173
  // Referenced file was deleted in the new program
@@ -120035,27 +120191,25 @@ var ts;
120035
120191
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
120036
120192
  }
120037
120193
  }
120194
+ if (canCopyEmitSignatures) {
120195
+ var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
120196
+ if (oldEmitSignature)
120197
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
120198
+ }
120038
120199
  });
120039
120200
  // If the global file is removed, add all files as changed
120040
120201
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
120041
120202
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, /*firstSourceFile*/ undefined)
120042
120203
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
120043
120204
  }
120044
- else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
120205
+ else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
120045
120206
  // Add all files to affectedFilesPendingEmit since emit changed
120046
120207
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1 /* Full */); });
120047
120208
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
120048
120209
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
120049
120210
  }
120050
- if (useOldState) {
120051
- // Any time the interpretation of a source file changes, mark it as changed
120052
- ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
120053
- if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
120054
- state.changedFilesSet.add(sourceFilePath);
120055
- }
120056
- });
120057
- }
120058
- state.buildInfoEmitPending = !!state.changedFilesSet.size;
120211
+ // Since old states change files set is copied, any additional change means we would need to emit build info
120212
+ state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
120059
120213
  return state;
120060
120214
  }
120061
120215
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -120091,30 +120245,35 @@ var ts;
120091
120245
  ts.BuilderState.releaseCache(state);
120092
120246
  state.program = undefined;
120093
120247
  }
120094
- /**
120095
- * Creates a clone of the state
120096
- */
120097
- function cloneBuilderProgramState(state) {
120098
- var _a;
120099
- var newState = ts.BuilderState.clone(state);
120100
- newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
120101
- newState.changedFilesSet = new ts.Set(state.changedFilesSet);
120102
- newState.affectedFiles = state.affectedFiles;
120103
- newState.affectedFilesIndex = state.affectedFilesIndex;
120104
- newState.currentChangedFilePath = state.currentChangedFilePath;
120105
- newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
120106
- newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
120107
- newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
120108
- newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
120109
- newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
120110
- newState.program = state.program;
120111
- newState.compilerOptions = state.compilerOptions;
120112
- newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
120113
- newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
120114
- newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
120115
- newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
120116
- newState.programEmitComplete = state.programEmitComplete;
120117
- return newState;
120248
+ function backupEmitBuilderProgramState(state) {
120249
+ var outFilePath = ts.outFile(state.compilerOptions);
120250
+ // Only in --out changeFileSet is kept around till emit
120251
+ ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
120252
+ return {
120253
+ affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
120254
+ affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
120255
+ affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
120256
+ seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
120257
+ programEmitComplete: state.programEmitComplete,
120258
+ emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
120259
+ outSignature: state.outSignature,
120260
+ dtsChangeTime: state.dtsChangeTime,
120261
+ hasChangedEmitSignature: state.hasChangedEmitSignature,
120262
+ changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
120263
+ };
120264
+ }
120265
+ function restoreEmitBuilderProgramState(state, backupEmitState) {
120266
+ state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
120267
+ state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
120268
+ state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
120269
+ state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
120270
+ state.programEmitComplete = backupEmitState.programEmitComplete;
120271
+ state.emitSignatures = backupEmitState.emitSignatures;
120272
+ state.outSignature = backupEmitState.outSignature;
120273
+ state.dtsChangeTime = backupEmitState.dtsChangeTime;
120274
+ state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
120275
+ if (backupEmitState.changedFilesSet)
120276
+ state.changedFilesSet = backupEmitState.changedFilesSet;
120118
120277
  }
120119
120278
  /**
120120
120279
  * Verifies that source file is ok to be used in calls that arent handled by next
@@ -120129,7 +120288,7 @@ var ts;
120129
120288
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
120130
120289
  */
120131
120290
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
120132
- var _a;
120291
+ var _a, _b;
120133
120292
  while (true) {
120134
120293
  var affectedFiles = state.affectedFiles;
120135
120294
  if (affectedFiles) {
@@ -120149,10 +120308,8 @@ var ts;
120149
120308
  state.changedFilesSet.delete(state.currentChangedFilePath);
120150
120309
  state.currentChangedFilePath = undefined;
120151
120310
  // Commit the changes in file signature
120152
- ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
120153
- state.currentAffectedFilesSignatures.clear();
120154
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120155
- (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
120311
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
120312
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120156
120313
  state.affectedFiles = undefined;
120157
120314
  }
120158
120315
  // Get next changed file
@@ -120170,12 +120327,7 @@ var ts;
120170
120327
  return program;
120171
120328
  }
120172
120329
  // Get next batch of affected files
120173
- if (!state.currentAffectedFilesSignatures)
120174
- state.currentAffectedFilesSignatures = new ts.Map();
120175
- if (state.exportedModulesMap) {
120176
- state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
120177
- }
120178
- state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
120330
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
120179
120331
  state.currentChangedFilePath = nextKey.value;
120180
120332
  state.affectedFilesIndex = 0;
120181
120333
  if (!state.seenAffectedFiles)
@@ -120227,7 +120379,6 @@ var ts;
120227
120379
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
120228
120380
  */
120229
120381
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120230
- var _a;
120231
120382
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
120232
120383
  // If affected files is everything except default library, then nothing more to do
120233
120384
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -120235,10 +120386,9 @@ var ts;
120235
120386
  // When a change affects the global scope, all files are considered to be affected without updating their signature
120236
120387
  // That means when affected file is handled, its signature can be out of date
120237
120388
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
120238
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
120389
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
120239
120390
  return;
120240
120391
  }
120241
- 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);
120242
120392
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
120243
120393
  return;
120244
120394
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -120258,7 +120408,7 @@ var ts;
120258
120408
  // This ensures that we dont later during incremental builds considering wrong signature.
120259
120409
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
120260
120410
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
120261
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
120411
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
120262
120412
  // If not dts emit, nothing more to do
120263
120413
  if (ts.getEmitDeclarations(state.compilerOptions)) {
120264
120414
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -120279,27 +120429,10 @@ var ts;
120279
120429
  return !state.semanticDiagnosticsFromOldState.size;
120280
120430
  }
120281
120431
  function isChangedSignature(state, path) {
120282
- var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
120283
- var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120432
+ var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
120433
+ var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120284
120434
  return newSignature !== oldSignature;
120285
120435
  }
120286
- function forEachKeyOfExportedModulesMap(state, filePath, fn) {
120287
- // Go through exported modules from cache first
120288
- var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
120289
- var result = keys && ts.forEachKey(keys, fn);
120290
- if (result)
120291
- return result;
120292
- // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
120293
- keys = state.exportedModulesMap.getKeys(filePath);
120294
- return keys && ts.forEachKey(keys, function (exportedFromPath) {
120295
- var _a;
120296
- // If the cache had an updated value, skip
120297
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
120298
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
120299
- fn(exportedFromPath) :
120300
- undefined;
120301
- });
120302
- }
120303
120436
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
120304
120437
  var _a;
120305
120438
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -120314,6 +120447,7 @@ var ts;
120314
120447
  * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
120315
120448
  */
120316
120449
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120450
+ var _a;
120317
120451
  // If there was change in signature (dts output) for the changed file,
120318
120452
  // then only we need to handle pending file emit
120319
120453
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
@@ -120340,11 +120474,10 @@ var ts;
120340
120474
  }
120341
120475
  }
120342
120476
  }
120343
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120344
120477
  var seenFileAndExportsOfFile = new ts.Set();
120345
120478
  // Go through exported modules from cache first
120346
120479
  // If exported modules has path, all files referencing file exported from are affected
120347
- forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
120480
+ (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120348
120481
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
120349
120482
  return true;
120350
120483
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -120358,19 +120491,18 @@ var ts;
120358
120491
  * return true when all work is done and we can exit handling dts emit and semantic diagnostics
120359
120492
  */
120360
120493
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
120361
- var _a;
120494
+ var _a, _b;
120362
120495
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
120363
120496
  return undefined;
120364
120497
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
120365
120498
  return true;
120366
120499
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
120367
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120368
120500
  // If exported modules has path, all files referencing file exported from are affected
120369
- forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
120501
+ (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120370
120502
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
120371
120503
  });
120372
120504
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
120373
- (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
120505
+ (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
120374
120506
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
120375
120507
  handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
120376
120508
  state, referencingFilePath, cancellationToken, computeHash, host);
@@ -120391,12 +120523,13 @@ var ts;
120391
120523
  }
120392
120524
  else {
120393
120525
  state.seenAffectedFiles.add(affected.resolvedPath);
120526
+ // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted
120527
+ state.buildInfoEmitPending = true;
120394
120528
  if (emitKind !== undefined) {
120395
120529
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
120396
120530
  }
120397
120531
  if (isPendingEmit) {
120398
120532
  state.affectedFilesPendingEmitIndex++;
120399
- state.buildInfoEmitPending = true;
120400
120533
  }
120401
120534
  else {
120402
120535
  state.affectedFilesIndex++;
@@ -120444,25 +120577,61 @@ var ts;
120444
120577
  }
120445
120578
  return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
120446
120579
  }
120580
+ function isProgramBundleEmitBuildInfo(info) {
120581
+ return !!ts.outFile(info.options || {});
120582
+ }
120583
+ ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
120447
120584
  /**
120448
120585
  * Gets the program information to be emitted in buildInfo so that we can use it to create new program
120449
120586
  */
120450
- function getProgramBuildInfo(state, getCanonicalFileName) {
120451
- if (ts.outFile(state.compilerOptions))
120452
- return undefined;
120587
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
120588
+ var outFilePath = ts.outFile(state.compilerOptions);
120589
+ if (outFilePath && !state.compilerOptions.composite)
120590
+ return;
120453
120591
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
120454
120592
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
120593
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
120594
+ if (outFilePath) {
120595
+ var fileNames_1 = [];
120596
+ var fileInfos_1 = [];
120597
+ state.program.getRootFileNames().forEach(function (f) {
120598
+ var sourceFile = state.program.getSourceFile(f);
120599
+ if (!sourceFile)
120600
+ return;
120601
+ fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
120602
+ fileInfos_1.push(sourceFile.version);
120603
+ });
120604
+ var result_15 = {
120605
+ fileNames: fileNames_1,
120606
+ fileInfos: fileInfos_1,
120607
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
120608
+ outSignature: state.outSignature,
120609
+ dtsChangeTime: state.dtsChangeTime,
120610
+ };
120611
+ return result_15;
120612
+ }
120455
120613
  var fileNames = [];
120456
120614
  var fileNameToFileId = new ts.Map();
120457
120615
  var fileIdsList;
120458
120616
  var fileNamesToFileIdListId;
120617
+ var emitSignatures;
120459
120618
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
120619
+ var _b, _c;
120460
120620
  var key = _a[0], value = _a[1];
120461
120621
  // Ensure fileId
120462
120622
  var fileId = toFileId(key);
120463
120623
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
120464
- var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120465
- var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120624
+ var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
120625
+ var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
120626
+ if (state.compilerOptions.composite) {
120627
+ var file = state.program.getSourceFileByPath(key);
120628
+ if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
120629
+ var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
120630
+ if (emitSignature !== actualSignature) {
120631
+ (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
120632
+ }
120633
+ }
120634
+ }
120466
120635
  return value.version === actualSignature ?
120467
120636
  value.affectsGlobalScope || value.impliedFormat ?
120468
120637
  // If file version is same as signature, dont serialize signature
@@ -120470,11 +120639,11 @@ var ts;
120470
120639
  // If file info only contains version and signature and both are same we can just write string
120471
120640
  value.version :
120472
120641
  actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120473
- signature === undefined ?
120642
+ oldSignature === undefined ?
120474
120643
  // If we havent computed signature, use fileInfo as is
120475
120644
  value :
120476
120645
  // Serialize fileInfo with new updated signature
120477
- { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120646
+ { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120478
120647
  // Signature of the FileInfo is undefined, serialize it as false
120479
120648
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120480
120649
  });
@@ -120489,17 +120658,13 @@ var ts;
120489
120658
  if (state.exportedModulesMap) {
120490
120659
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
120491
120660
  var _a;
120492
- if (state.currentAffectedFilesExportedModulesMap) {
120493
- if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
120494
- return undefined;
120495
- }
120496
- var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
120497
- if (newValue) {
120498
- return [toFileId(key), toFileIdListId(newValue)];
120499
- }
120500
- }
120661
+ var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
120501
120662
  // Not in temporary cache, use existing value
120502
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120663
+ if (oldValue === undefined)
120664
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120665
+ if (oldValue)
120666
+ return [toFileId(key), toFileIdListId(oldValue)];
120667
+ return undefined;
120503
120668
  });
120504
120669
  }
120505
120670
  var semanticDiagnosticsPerFile;
@@ -120510,9 +120675,7 @@ var ts;
120510
120675
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
120511
120676
  [
120512
120677
  toFileId(key),
120513
- state.hasReusableDiagnostic ?
120514
- value :
120515
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120678
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
120516
120679
  ] :
120517
120680
  toFileId(key));
120518
120681
  }
@@ -120527,16 +120690,27 @@ var ts;
120527
120690
  }
120528
120691
  }
120529
120692
  }
120530
- return {
120693
+ var changeFileSet;
120694
+ if (state.changedFilesSet.size) {
120695
+ for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
120696
+ var path = _e[_d];
120697
+ (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120698
+ }
120699
+ }
120700
+ var result = {
120531
120701
  fileNames: fileNames,
120532
120702
  fileInfos: fileInfos,
120533
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
120703
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
120534
120704
  fileIdsList: fileIdsList,
120535
120705
  referencedMap: referencedMap,
120536
120706
  exportedModulesMap: exportedModulesMap,
120537
120707
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
120538
120708
  affectedFilesPendingEmit: affectedFilesPendingEmit,
120709
+ changeFileSet: changeFileSet,
120710
+ emitSignatures: emitSignatures,
120711
+ dtsChangeTime: state.dtsChangeTime,
120539
120712
  };
120713
+ return result;
120540
120714
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
120541
120715
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
120542
120716
  }
@@ -120561,24 +120735,18 @@ var ts;
120561
120735
  }
120562
120736
  return fileIdListId;
120563
120737
  }
120564
- }
120565
- function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
120566
- var result;
120567
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120568
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120569
- var name = _a[_i];
120570
- var optionKey = name.toLowerCase();
120571
- var optionInfo = optionsNameMap.get(optionKey);
120572
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
120573
- // We need to store `strict`, even though it won't be examined directly, so that the
120574
- // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
120575
- optionKey === "strict" ||
120576
- // We need to store these to determine whether `lib` files need to be rechecked.
120577
- optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
120578
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
120738
+ function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
120739
+ var result;
120740
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120741
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120742
+ var name = _a[_i];
120743
+ var optionInfo = optionsNameMap.get(name.toLowerCase());
120744
+ if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
120745
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
120746
+ }
120579
120747
  }
120748
+ return result;
120580
120749
  }
120581
- return result;
120582
120750
  }
120583
120751
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120584
120752
  if (option) {
@@ -120652,6 +120820,10 @@ var ts;
120652
120820
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
120653
120821
  }
120654
120822
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
120823
+ function computeSignature(text, data, computeHash) {
120824
+ return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
120825
+ }
120826
+ ts.computeSignature = computeSignature;
120655
120827
  function createBuilderProgram(kind, _a) {
120656
120828
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
120657
120829
  // Return same program if underlying program doesnt change
@@ -120670,8 +120842,8 @@ var ts;
120670
120842
  */
120671
120843
  var computeHash = ts.maybeBind(host, host.createHash);
120672
120844
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
120673
- var backupState;
120674
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
120845
+ var backupEmitState;
120846
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
120675
120847
  // To ensure that we arent storing any references to old program or new program without state
120676
120848
  newProgram = undefined; // TODO: GH#18217
120677
120849
  oldProgram = undefined;
@@ -120679,20 +120851,20 @@ var ts;
120679
120851
  var getState = function () { return state; };
120680
120852
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
120681
120853
  builderProgram.getState = getState;
120682
- builderProgram.backupState = function () {
120683
- ts.Debug.assert(backupState === undefined);
120684
- backupState = cloneBuilderProgramState(state);
120854
+ builderProgram.backupEmitState = function () {
120855
+ ts.Debug.assert(backupEmitState === undefined);
120856
+ backupEmitState = backupEmitBuilderProgramState(state);
120685
120857
  };
120686
- builderProgram.restoreState = function () {
120687
- state = ts.Debug.checkDefined(backupState);
120688
- backupState = undefined;
120858
+ builderProgram.restoreEmitState = function () {
120859
+ restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
120860
+ backupEmitState = undefined;
120689
120861
  };
120690
120862
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
120691
120863
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
120692
120864
  builderProgram.emit = emit;
120693
120865
  builderProgram.releaseProgram = function () {
120694
120866
  releaseCache(state);
120695
- backupState = undefined;
120867
+ backupEmitState = undefined;
120696
120868
  };
120697
120869
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
120698
120870
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -120751,35 +120923,59 @@ var ts;
120751
120923
  return toAffectedFileEmitResult(state,
120752
120924
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
120753
120925
  // Otherwise just affected file
120754
- ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120755
- getWriteFileUpdatingSignatureCallback(writeFile) :
120926
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
120927
+ getWriteFileCallback(writeFile, customTransformers) :
120756
120928
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
120757
120929
  }
120758
- function getWriteFileUpdatingSignatureCallback(writeFile) {
120930
+ function getWriteFileCallback(writeFile, customTransformers) {
120759
120931
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
120760
- var _a;
120932
+ var _a, _b, _c;
120761
120933
  if (ts.isDeclarationFileName(fileName)) {
120762
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120763
- var file = sourceFiles[0];
120764
- var info = state.fileInfos.get(file.resolvedPath);
120765
- var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120766
- if (signature === file.version) {
120767
- var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120768
- if (newSignature !== file.version) { // Update it
120769
- if (host.storeFilesChangingSignatureDuringEmit)
120770
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120771
- if (state.exportedModulesMap)
120772
- ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
120773
- if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
120774
- state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
120934
+ if (!ts.outFile(state.compilerOptions)) {
120935
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120936
+ var newSignature = void 0;
120937
+ if (!customTransformers) {
120938
+ var file = sourceFiles[0];
120939
+ var info = state.fileInfos.get(file.resolvedPath);
120940
+ if (info.signature === file.version) {
120941
+ newSignature = computeSignature(text, data, computeHash);
120942
+ if (newSignature !== file.version) { // Update it
120943
+ if (host.storeFilesChangingSignatureDuringEmit)
120944
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120945
+ if (state.exportedModulesMap)
120946
+ ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
120947
+ if (state.affectedFiles) {
120948
+ // Keep old signature so we know what to undo if cancellation happens
120949
+ var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
120950
+ if (existing === undefined)
120951
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
120952
+ info.signature = newSignature;
120953
+ }
120954
+ else {
120955
+ // These are directly commited
120956
+ info.signature = newSignature;
120957
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120958
+ }
120959
+ }
120775
120960
  }
120776
- else {
120777
- info.signature = newSignature;
120778
- if (state.exportedModulesMap)
120779
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120961
+ }
120962
+ if (state.compilerOptions.composite) {
120963
+ var filePath = sourceFiles[0].resolvedPath;
120964
+ var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
120965
+ newSignature || (newSignature = computeSignature(text, data, computeHash));
120966
+ if (newSignature !== oldSignature) {
120967
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
120968
+ state.hasChangedEmitSignature = true;
120780
120969
  }
120781
120970
  }
120782
120971
  }
120972
+ else if (state.compilerOptions.composite) {
120973
+ var newSignature = computeSignature(text, data, computeHash);
120974
+ if (newSignature !== state.outSignature) {
120975
+ state.outSignature = newSignature;
120976
+ state.hasChangedEmitSignature = true;
120977
+ }
120978
+ }
120783
120979
  }
120784
120980
  if (writeFile)
120785
120981
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -120844,8 +121040,8 @@ var ts;
120844
121040
  }
120845
121041
  }
120846
121042
  }
120847
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120848
- getWriteFileUpdatingSignatureCallback(writeFile) :
121043
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
121044
+ getWriteFileCallback(writeFile, customTransformers) :
120849
121045
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120850
121046
  }
120851
121047
  /**
@@ -120934,29 +121130,58 @@ var ts;
120934
121130
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
120935
121131
  }
120936
121132
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
120937
- function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
120938
- var _a;
121133
+ function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
121134
+ var _a, _b, _c, _d;
120939
121135
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
120940
121136
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
120941
- var filePaths = program.fileNames.map(toPath);
120942
- var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
120943
- var fileInfos = new ts.Map();
120944
- program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
120945
- var state = {
120946
- fileInfos: fileInfos,
120947
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
120948
- referencedMap: toManyToManyPathMap(program.referencedMap),
120949
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
120950
- 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]; }),
120951
- hasReusableDiagnostic: true,
120952
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
120953
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
120954
- affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
120955
- };
121137
+ var state;
121138
+ var filePaths;
121139
+ var filePathsSetList;
121140
+ if (isProgramBundleEmitBuildInfo(program)) {
121141
+ state = {
121142
+ fileInfos: new ts.Map(),
121143
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121144
+ dtsChangeTime: program.dtsChangeTime,
121145
+ outSignature: program.outSignature,
121146
+ };
121147
+ }
121148
+ else {
121149
+ filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
121150
+ filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
121151
+ var fileInfos_2 = new ts.Map();
121152
+ var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
121153
+ program.fileInfos.forEach(function (fileInfo, index) {
121154
+ var path = toFilePath(index + 1);
121155
+ var stateFileInfo = toBuilderStateFileInfo(fileInfo);
121156
+ fileInfos_2.set(path, stateFileInfo);
121157
+ if (emitSignatures_1 && stateFileInfo.signature)
121158
+ emitSignatures_1.set(path, stateFileInfo.signature);
121159
+ });
121160
+ (_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
121161
+ if (ts.isNumber(value))
121162
+ emitSignatures_1.delete(toFilePath(value));
121163
+ else
121164
+ emitSignatures_1.set(toFilePath(value[0]), value[1]);
121165
+ });
121166
+ state = {
121167
+ fileInfos: fileInfos_2,
121168
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121169
+ referencedMap: toManyToManyPathMap(program.referencedMap),
121170
+ exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121171
+ 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]; }),
121172
+ hasReusableDiagnostic: true,
121173
+ affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
121174
+ affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
121175
+ affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
121176
+ changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
121177
+ dtsChangeTime: program.dtsChangeTime,
121178
+ emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
121179
+ };
121180
+ }
120956
121181
  return {
120957
121182
  getState: function () { return state; },
120958
- backupState: ts.noop,
120959
- restoreState: ts.noop,
121183
+ backupEmitState: ts.noop,
121184
+ restoreEmitState: ts.noop,
120960
121185
  getProgram: ts.notImplemented,
120961
121186
  getProgramOrUndefined: ts.returnUndefined,
120962
121187
  releaseProgram: ts.noop,
@@ -121001,12 +121226,24 @@ var ts;
121001
121226
  return map;
121002
121227
  }
121003
121228
  }
121004
- ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
121229
+ ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
121230
+ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
121231
+ var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
121232
+ var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
121233
+ var fileInfos = new ts.Map();
121234
+ program.fileInfos.forEach(function (fileInfo, index) {
121235
+ var path = ts.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
121236
+ var version = ts.isString(fileInfo) ? fileInfo : fileInfo.version; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
121237
+ fileInfos.set(path, version);
121238
+ });
121239
+ return fileInfos;
121240
+ }
121241
+ ts.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap;
121005
121242
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
121006
121243
  return {
121007
121244
  getState: ts.notImplemented,
121008
- backupState: ts.noop,
121009
- restoreState: ts.noop,
121245
+ backupEmitState: ts.noop,
121246
+ restoreEmitState: ts.noop,
121010
121247
  getProgram: getProgram,
121011
121248
  getProgramOrUndefined: function () { return getState().program; },
121012
121249
  releaseProgram: function () { return getState().program = undefined; },
@@ -122122,9 +122359,9 @@ var ts;
122122
122359
  if (!preferSymlinks) {
122123
122360
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
122124
122361
  // so we only need to remove them from the realpath filenames.
122125
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122126
- if (result_15)
122127
- return result_15;
122362
+ var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122363
+ if (result_16)
122364
+ return result_16;
122128
122365
  }
122129
122366
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
122130
122367
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -122144,10 +122381,10 @@ var ts;
122144
122381
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
122145
122382
  var symlinkDirectory = symlinkDirectories_1[_i];
122146
122383
  var option = ts.resolvePath(symlinkDirectory, relative);
122147
- var result_16 = cb(option, target === referenceRedirect);
122384
+ var result_17 = cb(option, target === referenceRedirect);
122148
122385
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
122149
- if (result_16)
122150
- return result_16;
122386
+ if (result_17)
122387
+ return result_17;
122151
122388
  }
122152
122389
  });
122153
122390
  });
@@ -122189,7 +122426,7 @@ var ts;
122189
122426
  });
122190
122427
  // Sort by paths closest to importing file Name directory
122191
122428
  var sortedPaths = [];
122192
- var _loop_32 = function (directory) {
122429
+ var _loop_33 = function (directory) {
122193
122430
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
122194
122431
  var pathsInDirectory;
122195
122432
  allFileNames.forEach(function (_a, fileName) {
@@ -122213,7 +122450,7 @@ var ts;
122213
122450
  };
122214
122451
  var out_directory_1;
122215
122452
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
122216
- var state_10 = _loop_32(directory);
122453
+ var state_10 = _loop_33(directory);
122217
122454
  directory = out_directory_1;
122218
122455
  if (state_10 === "break")
122219
122456
  break;
@@ -123057,6 +123294,7 @@ var ts;
123057
123294
  readDirectory: ts.maybeBind(host, host.readDirectory),
123058
123295
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
123059
123296
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
123297
+ now: ts.maybeBind(host, host.now),
123060
123298
  };
123061
123299
  function writeFile(fileName, text, writeByteOrderMark, onError) {
123062
123300
  try {
@@ -123117,6 +123355,7 @@ var ts;
123117
123355
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
123118
123356
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
123119
123357
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
123358
+ now: ts.maybeBind(system, system.now),
123120
123359
  };
123121
123360
  }
123122
123361
  ts.createProgramHost = createProgramHost;
@@ -123184,20 +123423,26 @@ var ts;
123184
123423
  var ts;
123185
123424
  (function (ts) {
123186
123425
  function readBuilderProgram(compilerOptions, host) {
123187
- if (ts.outFile(compilerOptions))
123188
- return undefined;
123189
123426
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
123190
123427
  if (!buildInfoPath)
123191
123428
  return undefined;
123192
- var content = host.readFile(buildInfoPath);
123193
- if (!content)
123194
- return undefined;
123195
- var buildInfo = ts.getBuildInfo(content);
123429
+ var buildInfo;
123430
+ if (host.getBuildInfo) {
123431
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
123432
+ if (!buildInfo)
123433
+ return undefined;
123434
+ }
123435
+ else {
123436
+ var content = host.readFile(buildInfoPath);
123437
+ if (!content)
123438
+ return undefined;
123439
+ buildInfo = ts.getBuildInfo(content);
123440
+ }
123196
123441
  if (buildInfo.version !== ts.version)
123197
123442
  return undefined;
123198
123443
  if (!buildInfo.program)
123199
123444
  return undefined;
123200
- return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123445
+ return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123201
123446
  }
123202
123447
  ts.readBuilderProgram = readBuilderProgram;
123203
123448
  function createIncrementalCompilerHost(options, system) {
@@ -123206,6 +123451,7 @@ var ts;
123206
123451
  host.createHash = ts.maybeBind(system, system.createHash);
123207
123452
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
123208
123453
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
123454
+ host.now = ts.maybeBind(system, system.now);
123209
123455
  ts.setGetSourceFileAsHashVersioned(host, system);
123210
123456
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
123211
123457
  return host;
@@ -123941,14 +124187,17 @@ var ts;
123941
124187
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
123942
124188
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
123943
124189
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
123944
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
123945
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
123946
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
123947
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
124190
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
124191
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
124192
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
124193
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
124194
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
124195
+ UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
123948
124196
  /**
123949
124197
  * Projects with no outputs (i.e. "solution" files)
123950
124198
  */
123951
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
124199
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
124200
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
123952
124201
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
123953
124202
  function resolveConfigFileProjectName(project) {
123954
124203
  if (ts.fileExtensionIs(project, ".json" /* Json */)) {
@@ -123993,9 +124242,11 @@ var ts;
123993
124242
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
123994
124243
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
123995
124244
  }
123996
- function newer(date1, date2) {
123997
- return date2 > date1 ? date2 : date1;
124245
+ /*@internal*/
124246
+ function getCurrentTime(host) {
124247
+ return host.now ? host.now() : new Date();
123998
124248
  }
124249
+ ts.getCurrentTime = getCurrentTime;
123999
124250
  /*@internal*/
124000
124251
  function isCircularBuildOrder(buildOrder) {
124001
124252
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -124085,6 +124336,7 @@ var ts;
124085
124336
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
124086
124337
  };
124087
124338
  }
124339
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
124088
124340
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
124089
124341
  var state = {
124090
124342
  host: host,
@@ -124101,8 +124353,9 @@ var ts;
124101
124353
  resolvedConfigFilePaths: new ts.Map(),
124102
124354
  configFileCache: new ts.Map(),
124103
124355
  projectStatus: new ts.Map(),
124104
- buildInfoChecked: new ts.Map(),
124105
124356
  extendedConfigCache: new ts.Map(),
124357
+ buildInfoCache: new ts.Map(),
124358
+ outputTimeStamps: new ts.Map(),
124106
124359
  builderPrograms: new ts.Map(),
124107
124360
  diagnostics: new ts.Map(),
124108
124361
  projectPendingBuild: new ts.Map(),
@@ -124125,6 +124378,7 @@ var ts;
124125
124378
  allWatchedConfigFiles: new ts.Map(),
124126
124379
  allWatchedExtendedConfigFiles: new ts.Map(),
124127
124380
  allWatchedPackageJsonFiles: new ts.Map(),
124381
+ filesWatched: new ts.Map(),
124128
124382
  lastCachedPackageJsonLookups: new ts.Map(),
124129
124383
  timerToBuildInvalidatedProject: undefined,
124130
124384
  reportFileChangeDetected: false,
@@ -124159,6 +124413,7 @@ var ts;
124159
124413
  if (value) {
124160
124414
  return isParsedCommandLine(value) ? value : undefined;
124161
124415
  }
124416
+ ts.solutionPerformance.mark("beforeParseConfigFile");
124162
124417
  var diagnostic;
124163
124418
  var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host;
124164
124419
  var parsed;
@@ -124173,6 +124428,8 @@ var ts;
124173
124428
  parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
124174
124429
  }
124175
124430
  configFileCache.set(configFilePath, parsed || diagnostic);
124431
+ ts.solutionPerformance.mark("afterParseConfigFile");
124432
+ ts.solutionPerformance.measure("ParseConfigFile", "beforeParseConfigFile", "afterParseConfigFile");
124176
124433
  return parsed;
124177
124434
  }
124178
124435
  function resolveProjectName(state, name) {
@@ -124222,6 +124479,7 @@ var ts;
124222
124479
  return state.buildOrder || createStateBuildOrder(state);
124223
124480
  }
124224
124481
  function createStateBuildOrder(state) {
124482
+ ts.solutionPerformance.mark("beforeCreateBuildOrder");
124225
124483
  var buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); }));
124226
124484
  // Clear all to ResolvedConfigFilePaths cache to start fresh
124227
124485
  state.resolvedConfigFilePaths.clear();
@@ -124231,11 +124489,12 @@ var ts;
124231
124489
  // Config file cache
124232
124490
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
124233
124491
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
124234
- ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
124235
124492
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
124236
124493
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
124237
124494
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
124238
124495
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
124496
+ ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
124497
+ ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
124239
124498
  // Remove watches for the program no longer in the solution
124240
124499
  if (state.watch) {
124241
124500
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
@@ -124251,6 +124510,8 @@ var ts;
124251
124510
  ts.mutateMapSkippingNewValues(state.allWatchedInputFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
124252
124511
  ts.mutateMapSkippingNewValues(state.allWatchedPackageJsonFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
124253
124512
  }
124513
+ ts.solutionPerformance.mark("afterCreateBuildOrder");
124514
+ ts.solutionPerformance.measure("CreateBuildOrder", "beforeCreateBuildOrder", "afterCreateBuildOrder");
124254
124515
  return state.buildOrder = buildOrder;
124255
124516
  }
124256
124517
  function getBuildOrderFor(state, project, onlyReferences) {
@@ -124371,6 +124632,7 @@ var ts;
124371
124632
  if (updateOutputFileStampsPending) {
124372
124633
  updateOutputTimestamps(state, config, projectPath);
124373
124634
  }
124635
+ ts.solutionPerformance.mark("timestampUpdated");
124374
124636
  return doneInvalidatedProject(state, projectPath);
124375
124637
  }
124376
124638
  };
@@ -124464,6 +124726,10 @@ var ts;
124464
124726
  };
124465
124727
  function done(cancellationToken, writeFile, customTransformers) {
124466
124728
  executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers);
124729
+ if (kind === InvalidatedProjectKind.Build)
124730
+ ts.solutionPerformance.mark("projectsBuilt");
124731
+ else
124732
+ ts.solutionPerformance.mark("bundlesUpdated");
124467
124733
  return doneInvalidatedProject(state, projectPath);
124468
124734
  }
124469
124735
  function withProgramOrUndefined(action) {
@@ -124525,21 +124791,21 @@ var ts;
124525
124791
  }
124526
124792
  function emit(writeFileCallback, cancellationToken, customTransformers) {
124527
124793
  var _a;
124528
- var _b, _c;
124794
+ var _b, _c, _d;
124529
124795
  ts.Debug.assertIsDefined(program);
124530
124796
  ts.Debug.assert(step === BuildStep.Emit);
124531
124797
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
124532
- program.backupState();
124798
+ program.backupEmitState();
124533
124799
  var declDiagnostics;
124534
124800
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
124535
124801
  var outputFiles = [];
124536
124802
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
124537
124803
  /*write*/ undefined,
124538
- /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
124804
+ /*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,
124539
124805
  /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
124540
124806
  // Don't emit .d.ts if there are decl file errors
124541
124807
  if (declDiagnostics) {
124542
- program.restoreState();
124808
+ program.restoreEmitState();
124543
124809
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
124544
124810
  return {
124545
124811
  emitSkipped: true,
@@ -124549,37 +124815,46 @@ var ts;
124549
124815
  // Actual Emit
124550
124816
  var host = state.host, compilerHost = state.compilerHost;
124551
124817
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124552
- var newestDeclarationFileContentChangedTime = minimumDate;
124553
- var anyDtsChanged = false;
124818
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
124554
124819
  var emitterDiagnostics = ts.createDiagnosticCollection();
124555
124820
  var emittedOutputs = new ts.Map();
124821
+ var options = program.getCompilerOptions();
124822
+ var isIncremental = ts.isIncrementalCompilation(options);
124823
+ var outputTimeStampMap;
124824
+ var now;
124825
+ ts.solutionPerformance.mark("beforeOutputFilesWrite");
124556
124826
  outputFiles.forEach(function (_a) {
124557
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124558
- var priorChangeTime;
124559
- if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124560
- // Check for unchanged .d.ts files
124561
- if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124562
- priorChangeTime = host.getModifiedTime(name);
124563
- }
124564
- else {
124827
+ var _b, _c;
124828
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124829
+ var path = toPath(state, name);
124830
+ emittedOutputs.set(toPath(state, name), name);
124831
+ if (buildInfo) {
124832
+ setBuildInfo(state, buildInfo, projectPath, options);
124833
+ 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)) {
124565
124834
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124566
- anyDtsChanged = true;
124567
124835
  }
124568
124836
  }
124569
- emittedOutputs.set(toPath(state, name), name);
124570
124837
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124571
- if (priorChangeTime !== undefined) {
124572
- newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
124838
+ if (!isIncremental && state.watch) {
124839
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
124573
124840
  }
124574
124841
  });
124575
- finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime,
124576
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124842
+ ts.solutionPerformance.mark("afterOutputFilesWrite");
124843
+ ts.solutionPerformance.measure("OutputFilesWrite", "beforeOutputFilesWrite", "afterOutputFilesWrite");
124844
+ finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124577
124845
  return emitResult;
124578
124846
  }
124579
124847
  function emitBuildInfo(writeFileCallback, cancellationToken) {
124580
124848
  ts.Debug.assertIsDefined(program);
124581
124849
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
124582
- var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
124850
+ var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
124851
+ if (data === null || data === void 0 ? void 0 : data.buildInfo)
124852
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
124853
+ if (writeFileCallback)
124854
+ writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
124855
+ else
124856
+ state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
124857
+ }, cancellationToken);
124583
124858
  if (emitResult.diagnostics.length) {
124584
124859
  reportErrors(state, emitResult.diagnostics);
124585
124860
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -124592,7 +124867,7 @@ var ts;
124592
124867
  step = BuildStep.QueueReferencingProjects;
124593
124868
  return emitResult;
124594
124869
  }
124595
- function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
124870
+ function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
124596
124871
  var _a;
124597
124872
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
124598
124873
  if (emitDiagnostics.length) {
@@ -124603,13 +124878,11 @@ var ts;
124603
124878
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
124604
124879
  }
124605
124880
  // Update time stamps for rest of the outputs
124606
- var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124881
+ updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124607
124882
  state.diagnostics.delete(projectPath);
124608
124883
  state.projectStatus.set(projectPath, {
124609
124884
  type: ts.UpToDateStatusType.UpToDate,
124610
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
124611
- maximumDate :
124612
- newestDeclarationFileContentChangedTime,
124885
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
124613
124886
  oldestOutputFileName: oldestOutputFileName
124614
124887
  });
124615
124888
  afterProgramDone(state, program, config);
@@ -124644,13 +124917,21 @@ var ts;
124644
124917
  ts.Debug.assert(!!outputFiles.length);
124645
124918
  var emitterDiagnostics = ts.createDiagnosticCollection();
124646
124919
  var emittedOutputs = new ts.Map();
124920
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124921
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
124647
124922
  outputFiles.forEach(function (_a) {
124648
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124923
+ var _b, _c;
124924
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124649
124925
  emittedOutputs.set(toPath(state, name), name);
124926
+ if (buildInfo) {
124927
+ setBuildInfo(state, buildInfo, projectPath, config.options);
124928
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
124929
+ resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124930
+ }
124931
+ }
124650
124932
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124651
124933
  });
124652
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate,
124653
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
124934
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
124654
124935
  return { emitSkipped: false, diagnostics: emitDiagnostics };
124655
124936
  }
124656
124937
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -124701,6 +124982,13 @@ var ts;
124701
124982
  !ts.isIncrementalCompilation(config.options);
124702
124983
  }
124703
124984
  function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
124985
+ ts.solutionPerformance.mark("beforeGetNextInvalidatedProjectCreateInfo");
124986
+ var result = getNextInvalidatedProjectCreateInfoWorker(state, buildOrder, reportQueue);
124987
+ ts.solutionPerformance.mark("afterGetNextInvalidatedProjectCreateInfo");
124988
+ ts.solutionPerformance.measure("GetNextInvalidatedProjectCreateInfo", "beforeGetNextInvalidatedProjectCreateInfo", "afterGetNextInvalidatedProjectCreateInfo");
124989
+ return result;
124990
+ }
124991
+ function getNextInvalidatedProjectCreateInfoWorker(state, buildOrder, reportQueue) {
124704
124992
  if (!state.projectPendingBuild.size)
124705
124993
  return undefined;
124706
124994
  if (isCircularBuildOrder(buildOrder))
@@ -124749,7 +125037,7 @@ var ts;
124749
125037
  }
124750
125038
  continue;
124751
125039
  }
124752
- if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
125040
+ if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
124753
125041
  reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
124754
125042
  return {
124755
125043
  kind: InvalidatedProjectKind.UpdateOutputFileStamps,
@@ -124800,9 +125088,7 @@ var ts;
124800
125088
  }
124801
125089
  function getNextInvalidatedProject(state, buildOrder, reportQueue) {
124802
125090
  var info = getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue);
124803
- if (!info)
124804
- return info;
124805
- return createInvalidatedProjectWithInfo(state, info, buildOrder);
125091
+ return info && createInvalidatedProjectWithInfo(state, info, buildOrder);
124806
125092
  }
124807
125093
  function listEmittedFile(_a, proj, file) {
124808
125094
  var write = _a.write;
@@ -124810,14 +125096,17 @@ var ts;
124810
125096
  write("TSFILE: " + file);
124811
125097
  }
124812
125098
  }
124813
- function getOldProgram(_a, proj, parsed) {
124814
- var options = _a.options, builderPrograms = _a.builderPrograms, compilerHost = _a.compilerHost;
124815
- if (options.force)
125099
+ function getOldProgram(state, proj, parsed) {
125100
+ if (state.options.force)
124816
125101
  return undefined;
124817
- var value = builderPrograms.get(proj);
125102
+ var value = state.builderPrograms.get(proj);
124818
125103
  if (value)
124819
125104
  return value;
124820
- return ts.readBuilderProgram(parsed.options, compilerHost);
125105
+ ts.solutionPerformance.mark("beforeReadBuilderProgram");
125106
+ var program = ts.readBuilderProgram(parsed.options, state.compilerHost);
125107
+ ts.solutionPerformance.mark("afterReadBuilderProgram");
125108
+ ts.solutionPerformance.measure("ReadBuilderProgram", "beforeReadBuilderProgram", "afterReadBuilderProgram");
125109
+ return program;
124821
125110
  }
124822
125111
  function afterProgramDone(state, program, config) {
124823
125112
  if (program) {
@@ -124834,7 +125123,7 @@ var ts;
124834
125123
  state.projectCompilerOptions = state.baseCompilerOptions;
124835
125124
  }
124836
125125
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
124837
- var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
125126
+ var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
124838
125127
  reportAndStoreErrors(state, resolvedPath, diagnostics);
124839
125128
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
124840
125129
  if (canEmitBuildInfo)
@@ -124842,9 +125131,101 @@ var ts;
124842
125131
  afterProgramDone(state, program, config);
124843
125132
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
124844
125133
  }
125134
+ function isFileWatcherWithModifiedTime(value) {
125135
+ return !!value.watcher;
125136
+ }
125137
+ function getModifiedTime(state, fileName) {
125138
+ var path = toPath(state, fileName);
125139
+ var existing = state.filesWatched.get(path);
125140
+ if (state.watch && !!existing) {
125141
+ if (!isFileWatcherWithModifiedTime(existing))
125142
+ return existing;
125143
+ if (existing.modifiedTime)
125144
+ return existing.modifiedTime;
125145
+ }
125146
+ var result = ts.getModifiedTime(state.host, fileName);
125147
+ if (state.watch) {
125148
+ if (existing)
125149
+ existing.modifiedTime = result;
125150
+ else
125151
+ state.filesWatched.set(path, result);
125152
+ }
125153
+ return result;
125154
+ }
125155
+ function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
125156
+ var path = toPath(state, file);
125157
+ var existing = state.filesWatched.get(path);
125158
+ if (existing && isFileWatcherWithModifiedTime(existing)) {
125159
+ existing.callbacks.push(callback);
125160
+ }
125161
+ else {
125162
+ var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
125163
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
125164
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
125165
+ existing.modifiedTime = modifiedTime;
125166
+ existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
125167
+ }, pollingInterval, options, watchType, project);
125168
+ state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
125169
+ }
125170
+ return {
125171
+ close: function () {
125172
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
125173
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
125174
+ if (existing.callbacks.length === 1) {
125175
+ state.filesWatched.delete(path);
125176
+ ts.closeFileWatcherOf(existing);
125177
+ }
125178
+ else {
125179
+ ts.unorderedRemoveItem(existing.callbacks, callback);
125180
+ }
125181
+ }
125182
+ };
125183
+ }
125184
+ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
125185
+ if (!state.watch)
125186
+ return undefined;
125187
+ var result = state.outputTimeStamps.get(resolvedConfigFilePath);
125188
+ if (!result)
125189
+ state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
125190
+ return result;
125191
+ }
125192
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
125193
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125194
+ var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
125195
+ if (existing) {
125196
+ existing.buildInfo = buildInfo;
125197
+ existing.modifiedTime = getCurrentTime(state.host);
125198
+ }
125199
+ else {
125200
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
125201
+ }
125202
+ }
125203
+ function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
125204
+ var path = toPath(state, buildInfoPath);
125205
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
125206
+ return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
125207
+ }
125208
+ function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
125209
+ var path = toPath(state, buildInfoPath);
125210
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
125211
+ if (existing !== undefined && existing.path === path) {
125212
+ return existing.buildInfo || undefined;
125213
+ }
125214
+ ts.solutionPerformance.mark("beforeGetBuildInfo");
125215
+ ts.solutionPerformance.mark("beforeBuildInfoRead");
125216
+ var value = state.readFileWithCache(buildInfoPath);
125217
+ ts.solutionPerformance.mark("afterBuildInfoRead");
125218
+ ts.solutionPerformance.measure("BuildInfoRead", "beforeBuildInfoRead", "afterBuildInfoRead");
125219
+ var buildInfo = value ? ts.getBuildInfo(value) : undefined;
125220
+ ts.Debug.assert(modifiedTime || !buildInfo);
125221
+ state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
125222
+ ts.solutionPerformance.mark("afterGetBuildInfo");
125223
+ ts.solutionPerformance.measure("GetBuildInfo", "beforeGetBuildInfo", "afterGetBuildInfo");
125224
+ return buildInfo;
125225
+ }
124845
125226
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
124846
125227
  // Check tsconfig time
124847
- var tsconfigTime = ts.getModifiedTime(state.host, configFile);
125228
+ var tsconfigTime = getModifiedTime(state, configFile);
124848
125229
  if (oldestOutputFileTime < tsconfigTime) {
124849
125230
  return {
124850
125231
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -124854,88 +125235,24 @@ var ts;
124854
125235
  }
124855
125236
  }
124856
125237
  function getUpToDateStatusWorker(state, project, resolvedPath) {
124857
- var force = !!state.options.force;
124858
- var newestInputFileName = undefined;
124859
- var newestInputFileTime = minimumDate;
124860
- var host = state.host;
124861
- // Get timestamps of input files
124862
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
124863
- var inputFile = _a[_i];
124864
- if (!host.fileExists(inputFile)) {
124865
- return {
124866
- type: ts.UpToDateStatusType.Unbuildable,
124867
- reason: inputFile + " does not exist"
124868
- };
124869
- }
124870
- if (!force) {
124871
- var inputTime = ts.getModifiedTime(host, inputFile);
124872
- if (inputTime > newestInputFileTime) {
124873
- newestInputFileName = inputFile;
124874
- newestInputFileTime = inputTime;
124875
- }
124876
- }
124877
- }
125238
+ var _a, _b, _c;
124878
125239
  // Container if no files are specified in the project
124879
125240
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
124880
125241
  return {
124881
125242
  type: ts.UpToDateStatusType.ContainerOnly
124882
125243
  };
124883
125244
  }
124884
- // Collect the expected outputs of this project
124885
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
124886
- // Now see if all outputs are newer than the newest input
124887
- var oldestOutputFileName = "(none)";
124888
- var oldestOutputFileTime = maximumDate;
124889
- var newestOutputFileName = "(none)";
124890
- var newestOutputFileTime = minimumDate;
124891
- var missingOutputFileName;
124892
- var newestDeclarationFileContentChangedTime = minimumDate;
124893
- var isOutOfDateWithInputs = false;
124894
- if (!force) {
124895
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
124896
- var output = outputs_1[_b];
124897
- // Output is missing; can stop checking
124898
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124899
- if (!host.fileExists(output)) {
124900
- missingOutputFileName = output;
124901
- break;
124902
- }
124903
- var outputTime = ts.getModifiedTime(host, output);
124904
- if (outputTime < oldestOutputFileTime) {
124905
- oldestOutputFileTime = outputTime;
124906
- oldestOutputFileName = output;
124907
- }
124908
- // If an output is older than the newest input, we can stop checking
124909
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124910
- if (outputTime < newestInputFileTime) {
124911
- isOutOfDateWithInputs = true;
124912
- break;
124913
- }
124914
- if (outputTime > newestOutputFileTime) {
124915
- newestOutputFileTime = outputTime;
124916
- newestOutputFileName = output;
124917
- }
124918
- // Keep track of when the most recent time a .d.ts file was changed.
124919
- // In addition to file timestamps, we also keep track of when a .d.ts file
124920
- // had its file touched but not had its contents changed - this allows us
124921
- // to skip a downstream typecheck
124922
- if (ts.isDeclarationFileName(output)) {
124923
- var outputModifiedTime = ts.getModifiedTime(host, output);
124924
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
124925
- }
124926
- }
124927
- }
124928
- var pseudoUpToDate = false;
124929
- var usesPrepend = false;
124930
- var upstreamChangedProject;
125245
+ // Fast check to see if reference projects are buildable
125246
+ var referenceStatuses;
125247
+ var force = !!state.options.force;
124931
125248
  if (project.projectReferences) {
124932
125249
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
124933
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
124934
- var ref = _d[_c];
124935
- usesPrepend = usesPrepend || !!(ref.prepend);
125250
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
125251
+ var ref = _d[_i];
124936
125252
  var resolvedRef = ts.resolveProjectReferencePath(ref);
124937
125253
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
124938
- var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
125254
+ var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
125255
+ var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
124939
125256
  // Its a circular reference ignore the status of this project
124940
125257
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
124941
125258
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) { // Container only ignore this project
@@ -124957,75 +125274,188 @@ var ts;
124957
125274
  upstreamProjectName: ref.path
124958
125275
  };
124959
125276
  }
124960
- // Check oldest output file name only if there is no missing output file name
124961
- // (a check we will have skipped if this is a forced build)
124962
- if (!force && !missingOutputFileName) {
124963
- // If the upstream project's newest file is older than our oldest output, we
124964
- // can't be out of date because of it
124965
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
124966
- continue;
124967
- }
124968
- // If the upstream project has only change .d.ts files, and we've built
124969
- // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
124970
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
124971
- pseudoUpToDate = true;
124972
- upstreamChangedProject = ref.path;
124973
- continue;
124974
- }
124975
- // We have an output older than an upstream output - we are out of date
124976
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125277
+ if (!force)
125278
+ (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
125279
+ }
125280
+ }
125281
+ if (force)
125282
+ return { type: ts.UpToDateStatusType.ForceBuild };
125283
+ // Check buildinfo first
125284
+ var host = state.host;
125285
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125286
+ var oldestOutputFileName = "(none)";
125287
+ var oldestOutputFileTime = maximumDate;
125288
+ var buildInfoTime;
125289
+ var buildInfoProgram;
125290
+ var buildInfoVersionMap;
125291
+ var newestDeclarationFileContentChangedTime;
125292
+ if (buildInfoPath) {
125293
+ var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
125294
+ buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
125295
+ if (buildInfoTime === ts.missingFileModifiedTime) {
125296
+ if (!buildInfoCacheEntry_1) {
125297
+ state.buildInfoCache.set(resolvedPath, {
125298
+ path: toPath(state, buildInfoPath),
125299
+ buildInfo: false,
125300
+ modifiedTime: buildInfoTime
125301
+ });
125302
+ }
125303
+ return {
125304
+ type: ts.UpToDateStatusType.OutputMissing,
125305
+ missingOutputFileName: buildInfoPath
125306
+ };
125307
+ }
125308
+ var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
125309
+ if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125310
+ return {
125311
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
125312
+ version: buildInfo.version
125313
+ };
125314
+ }
125315
+ if (buildInfo.program) {
125316
+ if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
125317
+ (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
124977
125318
  return {
124978
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124979
- outOfDateOutputFileName: oldestOutputFileName,
124980
- newerProjectName: ref.path
125319
+ type: ts.UpToDateStatusType.OutOfDateBuildInfo,
125320
+ buildInfoFile: buildInfoPath
124981
125321
  };
124982
125322
  }
125323
+ buildInfoProgram = buildInfo.program;
124983
125324
  }
125325
+ oldestOutputFileTime = buildInfoTime;
125326
+ oldestOutputFileName = buildInfoPath;
125327
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
124984
125328
  }
124985
- if (missingOutputFileName !== undefined) {
124986
- return {
124987
- type: ts.UpToDateStatusType.OutputMissing,
124988
- missingOutputFileName: missingOutputFileName
124989
- };
125329
+ // Check input files
125330
+ var newestInputFileName = undefined;
125331
+ var newestInputFileTime = minimumDate;
125332
+ var pseudoInputUptodate = false;
125333
+ // Get timestamps of input files
125334
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
125335
+ var inputFile = _f[_e];
125336
+ var inputTime = getModifiedTime(state, inputFile);
125337
+ if (inputTime === ts.missingFileModifiedTime) {
125338
+ return {
125339
+ type: ts.UpToDateStatusType.Unbuildable,
125340
+ reason: inputFile + " does not exist"
125341
+ };
125342
+ }
125343
+ // If an buildInfo is older than the newest input, we can stop checking
125344
+ if (buildInfoTime && buildInfoTime < inputTime) {
125345
+ var version_3 = void 0;
125346
+ var currentVersion = void 0;
125347
+ if (buildInfoProgram) {
125348
+ // Read files and see if they are same, read is anyways cached
125349
+ if (!buildInfoVersionMap)
125350
+ buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
125351
+ version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
125352
+ var text = version_3 ? state.readFileWithCache(inputFile) : undefined;
125353
+ currentVersion = text && (host.createHash || ts.generateDjb2Hash)(text);
125354
+ if (version_3 && version_3 === currentVersion)
125355
+ pseudoInputUptodate = true;
125356
+ }
125357
+ if (!version_3 || version_3 !== currentVersion) {
125358
+ return {
125359
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125360
+ outOfDateOutputFileName: buildInfoPath,
125361
+ newerInputFileName: inputFile
125362
+ };
125363
+ }
125364
+ }
125365
+ if (inputTime > newestInputFileTime) {
125366
+ newestInputFileName = inputFile;
125367
+ newestInputFileTime = inputTime;
125368
+ }
124990
125369
  }
124991
- if (isOutOfDateWithInputs) {
124992
- return {
124993
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
124994
- outOfDateOutputFileName: oldestOutputFileName,
124995
- newerInputFileName: newestInputFileName
124996
- };
125370
+ // Now see if all outputs are newer than the newest input
125371
+ // Dont check output timestamps if we have buildinfo telling us output is uptodate
125372
+ if (!buildInfoPath) {
125373
+ // Collect the expected outputs of this project
125374
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
125375
+ var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
125376
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
125377
+ var output = outputs_1[_g];
125378
+ var path = toPath(state, output);
125379
+ // Output is missing; can stop checking
125380
+ var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
125381
+ if (!outputTime) {
125382
+ outputTime = ts.getModifiedTime(state.host, output);
125383
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
125384
+ }
125385
+ if (outputTime === ts.missingFileModifiedTime) {
125386
+ return {
125387
+ type: ts.UpToDateStatusType.OutputMissing,
125388
+ missingOutputFileName: output
125389
+ };
125390
+ }
125391
+ if (outputTime < oldestOutputFileTime) {
125392
+ oldestOutputFileTime = outputTime;
125393
+ oldestOutputFileName = output;
125394
+ }
125395
+ // If an output is older than the newest input, we can stop checking
125396
+ if (outputTime < newestInputFileTime) {
125397
+ return {
125398
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125399
+ outOfDateOutputFileName: oldestOutputFileName,
125400
+ newerInputFileName: newestInputFileName
125401
+ };
125402
+ }
125403
+ }
124997
125404
  }
124998
- else {
124999
- // Check tsconfig time
125000
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125001
- if (configStatus)
125002
- return configStatus;
125003
- // Check extended config time
125004
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125005
- if (extendedConfigStatus)
125006
- return extendedConfigStatus;
125007
- // Check package file time
125008
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125009
- var path = _a[0];
125010
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125011
- });
125012
- if (dependentPackageFileStatus)
125013
- return dependentPackageFileStatus;
125014
- }
125015
- if (!force && !state.buildInfoChecked.has(resolvedPath)) {
125016
- state.buildInfoChecked.set(resolvedPath, true);
125017
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125018
- if (buildInfoPath) {
125019
- var value = state.readFileWithCache(buildInfoPath);
125020
- var buildInfo = value && ts.getBuildInfo(value);
125021
- if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125405
+ var seenRefs = buildInfoPath ? new ts.Set() : undefined;
125406
+ var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
125407
+ seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
125408
+ var pseudoUpToDate = false;
125409
+ var usesPrepend = false;
125410
+ var upstreamChangedProject;
125411
+ if (referenceStatuses) {
125412
+ for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
125413
+ var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
125414
+ usesPrepend = usesPrepend || !!(ref.prepend);
125415
+ // If the upstream project's newest file is older than our oldest output, we
125416
+ // can't be out of date because of it
125417
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
125418
+ continue;
125419
+ }
125420
+ // Check if tsbuildinfo path is shared, then we need to rebuild
125421
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
125022
125422
  return {
125023
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
125024
- version: buildInfo.version
125423
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125424
+ outOfDateOutputFileName: buildInfoPath,
125425
+ newerProjectName: ref.path
125025
125426
  };
125026
125427
  }
125428
+ // If the upstream project has only change .d.ts files, and we've built
125429
+ // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
125430
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
125431
+ pseudoUpToDate = true;
125432
+ upstreamChangedProject = ref.path;
125433
+ continue;
125434
+ }
125435
+ // We have an output older than an upstream output - we are out of date
125436
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125437
+ return {
125438
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125439
+ outOfDateOutputFileName: oldestOutputFileName,
125440
+ newerProjectName: ref.path
125441
+ };
125027
125442
  }
125028
125443
  }
125444
+ // Check tsconfig time
125445
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125446
+ if (configStatus)
125447
+ return configStatus;
125448
+ // Check extended config time
125449
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125450
+ if (extendedConfigStatus)
125451
+ return extendedConfigStatus;
125452
+ // Check package file time
125453
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125454
+ var path = _a[0];
125455
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125456
+ });
125457
+ if (dependentPackageFileStatus)
125458
+ return dependentPackageFileStatus;
125029
125459
  if (usesPrepend && pseudoUpToDate) {
125030
125460
  return {
125031
125461
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -125035,15 +125465,37 @@ var ts;
125035
125465
  }
125036
125466
  // Up to date
125037
125467
  return {
125038
- type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
125468
+ type: pseudoUpToDate ?
125469
+ ts.UpToDateStatusType.UpToDateWithUpstreamTypes :
125470
+ pseudoInputUptodate ?
125471
+ ts.UpToDateStatusType.UpToDateWithInputFileText :
125472
+ ts.UpToDateStatusType.UpToDate,
125039
125473
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
125040
125474
  newestInputFileTime: newestInputFileTime,
125041
- newestOutputFileTime: newestOutputFileTime,
125042
125475
  newestInputFileName: newestInputFileName,
125043
- newestOutputFileName: newestOutputFileName,
125044
125476
  oldestOutputFileName: oldestOutputFileName
125045
125477
  };
125046
125478
  }
125479
+ function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
125480
+ if (seenRefs.has(resolvedRefPath))
125481
+ return false;
125482
+ seenRefs.add(resolvedRefPath);
125483
+ var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
125484
+ if (refBuildInfo.path === buildInfoCacheEntry.path)
125485
+ return true;
125486
+ if (resolvedConfig.projectReferences) {
125487
+ // Check references
125488
+ for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
125489
+ var ref = _a[_i];
125490
+ var resolvedRef = ts.resolveProjectReferencePath(ref);
125491
+ var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
125492
+ var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
125493
+ if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
125494
+ return true;
125495
+ }
125496
+ }
125497
+ return false;
125498
+ }
125047
125499
  function getUpToDateStatus(state, project, resolvedPath) {
125048
125500
  if (project === undefined) {
125049
125501
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -125052,43 +125504,76 @@ var ts;
125052
125504
  if (prior !== undefined) {
125053
125505
  return prior;
125054
125506
  }
125507
+ ts.solutionPerformance.mark("beforeGetUpToDateStatus");
125055
125508
  var actual = getUpToDateStatusWorker(state, project, resolvedPath);
125509
+ ts.solutionPerformance.mark("afterGetUpToDateStatus");
125510
+ ts.solutionPerformance.measure("GetUpToDateStatus", "beforeGetUpToDateStatus", "afterGetUpToDateStatus");
125056
125511
  state.projectStatus.set(resolvedPath, actual);
125057
125512
  return actual;
125058
125513
  }
125059
- function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
125514
+ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
125060
125515
  if (proj.options.noEmit)
125061
- return priorNewestUpdateTime;
125062
- var host = state.host;
125063
- var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125064
- if (!skipOutputs || outputs.length !== skipOutputs.size) {
125065
- var reportVerbose = !!state.options.verbose;
125066
- var now = host.now ? host.now() : new Date();
125067
- for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125068
- var file = outputs_2[_i];
125069
- if (skipOutputs && skipOutputs.has(toPath(state, file))) {
125070
- continue;
125071
- }
125072
- if (reportVerbose) {
125073
- reportVerbose = false;
125516
+ return;
125517
+ var now;
125518
+ ts.solutionPerformance.mark("beforeUpdateOutputTimestamps");
125519
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
125520
+ if (buildInfoPath) {
125521
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
125522
+ if (!!state.options.verbose)
125074
125523
  reportStatus(state, verboseMessage, proj.options.configFilePath);
125524
+ state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
125525
+ getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
125526
+ }
125527
+ state.outputTimeStamps.delete(projectPath);
125528
+ }
125529
+ else {
125530
+ var host = state.host;
125531
+ var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125532
+ var outputTimeStampMap_1 = getOutputTimeStampMap(state, projectPath);
125533
+ var modifiedOutputs_1 = outputTimeStampMap_1 ? new ts.Set() : undefined;
125534
+ if (!skipOutputs || outputs.length !== skipOutputs.size) {
125535
+ var reportVerbose = !!state.options.verbose;
125536
+ for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125537
+ var file = outputs_2[_i];
125538
+ var path = toPath(state, file);
125539
+ if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
125540
+ continue;
125541
+ if (reportVerbose) {
125542
+ reportVerbose = false;
125543
+ reportStatus(state, verboseMessage, proj.options.configFilePath);
125544
+ }
125545
+ host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
125546
+ if (outputTimeStampMap_1) {
125547
+ outputTimeStampMap_1.set(path, now);
125548
+ modifiedOutputs_1.add(path);
125549
+ }
125075
125550
  }
125076
- if (ts.isDeclarationFileName(file)) {
125077
- priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
125078
- }
125079
- host.setModifiedTime(file, now);
125080
125551
  }
125552
+ // Clear out timestamps not in output list any more
125553
+ outputTimeStampMap_1 === null || outputTimeStampMap_1 === void 0 ? void 0 : outputTimeStampMap_1.forEach(function (_value, key) {
125554
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs_1.has(key))
125555
+ outputTimeStampMap_1.delete(key);
125556
+ });
125081
125557
  }
125082
- return priorNewestUpdateTime;
125558
+ ts.solutionPerformance.mark("afterUpdateOutputTimestamps");
125559
+ ts.solutionPerformance.measure("UpdateOutputTimestamps", "beforeUpdateOutputTimestamps", "afterUpdateOutputTimestamps");
125560
+ }
125561
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
125562
+ var _a;
125563
+ if (!options.composite)
125564
+ return undefined;
125565
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125566
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, /*modifiedTime*/ undefined);
125567
+ 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;
125083
125568
  }
125084
125569
  function updateOutputTimestamps(state, proj, resolvedPath) {
125085
125570
  if (state.options.dry) {
125086
125571
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
125087
125572
  }
125088
- var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125573
+ updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125089
125574
  state.projectStatus.set(resolvedPath, {
125090
125575
  type: ts.UpToDateStatusType.UpToDate,
125091
- newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
125576
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
125092
125577
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
125093
125578
  });
125094
125579
  }
@@ -125134,6 +125619,7 @@ var ts;
125134
125619
  break;
125135
125620
  }
125136
125621
  // falls through
125622
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
125137
125623
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125138
125624
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
125139
125625
  if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
@@ -125157,6 +125643,13 @@ var ts;
125157
125643
  }
125158
125644
  }
125159
125645
  function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
125646
+ ts.solutionPerformance.mark("beforeBuild");
125647
+ var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences);
125648
+ ts.solutionPerformance.mark("afterBuild");
125649
+ ts.solutionPerformance.measure("Build", "beforeBuild", "afterBuild");
125650
+ return result;
125651
+ }
125652
+ function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
125160
125653
  var buildOrder = getBuildOrderFor(state, project, onlyReferences);
125161
125654
  if (!buildOrder)
125162
125655
  return ts.ExitStatus.InvalidProject_OutputsSkipped;
@@ -125168,7 +125661,10 @@ var ts;
125168
125661
  if (!invalidatedProject)
125169
125662
  break;
125170
125663
  reportQueue = false;
125664
+ ts.solutionPerformance.mark("beforeInvalidatedProjectBuild");
125171
125665
  invalidatedProject.done(cancellationToken, writeFile, getCustomTransformers === null || getCustomTransformers === void 0 ? void 0 : getCustomTransformers(invalidatedProject.project));
125666
+ ts.solutionPerformance.mark("afterInvalidatedProjectBuild");
125667
+ ts.solutionPerformance.measure("InvalidatedProjectBuild", "beforeInvalidatedProjectBuild", "afterInvalidatedProjectBuild");
125172
125668
  if (!state.diagnostics.has(invalidatedProject.projectPath))
125173
125669
  successfulProjects++;
125174
125670
  }
@@ -125257,6 +125753,14 @@ var ts;
125257
125753
  state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
125258
125754
  }
125259
125755
  function buildNextInvalidatedProject(state, changeDetected) {
125756
+ ts.solutionPerformance.mark("beforeBuild");
125757
+ var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
125758
+ ts.solutionPerformance.mark("afterBuild");
125759
+ ts.solutionPerformance.measure("Build", "beforeBuild", "afterBuild");
125760
+ if (buildOrder)
125761
+ reportErrorSummary(state, buildOrder);
125762
+ }
125763
+ function buildNextInvalidatedProjectWorker(state, changeDetected) {
125260
125764
  state.timerToBuildInvalidatedProject = undefined;
125261
125765
  if (state.reportFileChangeDetected) {
125262
125766
  state.reportFileChangeDetected = false;
@@ -125267,7 +125771,10 @@ var ts;
125267
125771
  var buildOrder = getBuildOrder(state);
125268
125772
  var invalidatedProject = getNextInvalidatedProject(state, buildOrder, /*reportQueue*/ false);
125269
125773
  if (invalidatedProject) {
125774
+ ts.solutionPerformance.mark("beforeInvalidatedProjectBuild");
125270
125775
  invalidatedProject.done();
125776
+ ts.solutionPerformance.mark("afterInvalidatedProjectBuild");
125777
+ ts.solutionPerformance.measure("InvalidatedProjectBuild", "beforeInvalidatedProjectBuild", "afterInvalidatedProjectBuild");
125271
125778
  projectsBuilt++;
125272
125779
  while (state.projectPendingBuild.size) {
125273
125780
  // If already scheduled, skip
@@ -125283,23 +125790,24 @@ var ts;
125283
125790
  return;
125284
125791
  }
125285
125792
  var project = createInvalidatedProjectWithInfo(state, info, buildOrder);
125793
+ ts.solutionPerformance.mark("beforeInvalidatedProjectBuild");
125286
125794
  project.done();
125795
+ ts.solutionPerformance.mark("afterInvalidatedProjectBuild");
125796
+ ts.solutionPerformance.measure("InvalidatedProjectBuild", "beforeInvalidatedProjectBuild", "afterInvalidatedProjectBuild");
125287
125797
  if (info.kind !== InvalidatedProjectKind.UpdateOutputFileStamps)
125288
125798
  projectsBuilt++;
125289
125799
  }
125290
125800
  }
125291
125801
  disableCache(state);
125292
- reportErrorSummary(state, buildOrder);
125802
+ return buildOrder;
125293
125803
  }
125294
125804
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
125295
125805
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
125296
125806
  return;
125297
- state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
125298
- invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
125299
- }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
125807
+ 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));
125300
125808
  }
125301
125809
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
125302
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
125810
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
125303
125811
  var _a;
125304
125812
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
125305
125813
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -125331,7 +125839,7 @@ var ts;
125331
125839
  if (!state.watch)
125332
125840
  return;
125333
125841
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
125334
- 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); },
125842
+ 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); },
125335
125843
  onDeleteValue: ts.closeFileWatcher,
125336
125844
  });
125337
125845
  }
@@ -125339,13 +125847,14 @@ var ts;
125339
125847
  if (!state.watch || !state.lastCachedPackageJsonLookups)
125340
125848
  return;
125341
125849
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
125342
- 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); },
125850
+ 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); },
125343
125851
  onDeleteValue: ts.closeFileWatcher,
125344
125852
  });
125345
125853
  }
125346
125854
  function startWatching(state, buildOrder) {
125347
125855
  if (!state.watchAllProjectsPending)
125348
125856
  return;
125857
+ ts.solutionPerformance.mark("beforeStartWatching");
125349
125858
  state.watchAllProjectsPending = false;
125350
125859
  for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) {
125351
125860
  var resolved = _a[_i];
@@ -125363,6 +125872,8 @@ var ts;
125363
125872
  watchPackageJsonFiles(state, resolved, resolvedPath, cfg);
125364
125873
  }
125365
125874
  }
125875
+ ts.solutionPerformance.mark("afterStartWatching");
125876
+ ts.solutionPerformance.measure("StartWatching", "beforeStartWatching", "afterStartWatching");
125366
125877
  }
125367
125878
  function stopWatching(state) {
125368
125879
  ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher);
@@ -125469,19 +125980,18 @@ var ts;
125469
125980
  }
125470
125981
  }
125471
125982
  function reportUpToDateStatus(state, configFileName, status) {
125472
- if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
125473
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125474
- }
125475
125983
  switch (status.type) {
125476
125984
  case ts.UpToDateStatusType.OutOfDateWithSelf:
125477
- 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));
125985
+ 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));
125478
125986
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
125479
- 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));
125987
+ 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));
125480
125988
  case ts.UpToDateStatusType.OutputMissing:
125481
125989
  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));
125990
+ case ts.UpToDateStatusType.OutOfDateBuildInfo:
125991
+ 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));
125482
125992
  case ts.UpToDateStatusType.UpToDate:
125483
125993
  if (status.newestInputFileTime !== undefined) {
125484
- 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 || ""));
125994
+ 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 || ""));
125485
125995
  }
125486
125996
  // Don't report anything for "up to date because it was already built" -- too verbose
125487
125997
  break;
@@ -125489,6 +125999,8 @@ var ts;
125489
125999
  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));
125490
126000
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125491
126001
  return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
126002
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
126003
+ 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));
125492
126004
  case ts.UpToDateStatusType.UpstreamOutOfDate:
125493
126005
  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));
125494
126006
  case ts.UpToDateStatusType.UpstreamBlocked:
@@ -125499,6 +126011,8 @@ var ts;
125499
126011
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
125500
126012
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
125501
126013
  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);
126014
+ case ts.UpToDateStatusType.ForceBuild:
126015
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125502
126016
  case ts.UpToDateStatusType.ContainerOnly:
125503
126017
  // Don't report status on "solution" projects
125504
126018
  // falls through
@@ -136341,7 +136855,7 @@ var ts;
136341
136855
  ts.Debug.assert(parent.name === node);
136342
136856
  return true;
136343
136857
  case 203 /* BindingElement */:
136344
- return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent);
136858
+ return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent.parent.parent);
136345
136859
  default:
136346
136860
  return false;
136347
136861
  }
@@ -137807,7 +138321,7 @@ var ts;
137807
138321
  // Use the parent symbol if the location is commonjs require syntax on javascript files only.
137808
138322
  if (ts.isInJSFile(referenceLocation)
137809
138323
  && referenceLocation.parent.kind === 203 /* BindingElement */
137810
- && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent)) {
138324
+ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent.parent.parent)) {
137811
138325
  referenceSymbol = referenceLocation.parent.symbol;
137812
138326
  // The parent will not have a symbol if it's an ObjectBindingPattern (when destructuring is used). In
137813
138327
  // this case, just skip it, since the bound identifiers are not an alias of the import.
@@ -147183,11 +147697,9 @@ var ts;
147183
147697
  if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
147184
147698
  var tokenInfo = formattingScanner.readTokenInfo(parent);
147185
147699
  if (tokenInfo.token.kind === 27 /* CommaToken */ && ts.isCallLikeExpression(parent)) {
147186
- var commaTokenLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line;
147187
- if (startLine !== commaTokenLine) {
147188
- formattingScanner.advance();
147189
- tokenInfo = formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(parent) : undefined;
147190
- }
147700
+ // consume the comma
147701
+ consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent);
147702
+ tokenInfo = formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(parent) : undefined;
147191
147703
  }
147192
147704
  // consume the list end token only if it is still belong to the parent
147193
147705
  // there might be the case when current token matches end token but does not considered as one
@@ -174893,6 +175405,7 @@ var ts;
174893
175405
  return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : undefined;
174894
175406
  }
174895
175407
  function getReferencesWorker(projects, defaultProject, initialLocation, logger) {
175408
+ var _a;
174896
175409
  var perProjectResults = getPerProjectReferences(projects, defaultProject, initialLocation,
174897
175410
  /*isForRename*/ false, function (project, position) {
174898
175411
  logger.info("Finding references to " + position.fileName + " position " + position.pos + " in project " + project.getProjectName());
@@ -174912,7 +175425,7 @@ var ts;
174912
175425
  // have started the other project searches from related symbols. Propagate the
174913
175426
  // correct results to all other projects.
174914
175427
  var defaultProjectResults = perProjectResults.get(defaultProject);
174915
- if (defaultProjectResults[0].references[0].isDefinition === undefined) {
175428
+ if (((_a = defaultProjectResults === null || defaultProjectResults === void 0 ? void 0 : defaultProjectResults[0].references[0]) === null || _a === void 0 ? void 0 : _a.isDefinition) === undefined) {
174916
175429
  // Clear all isDefinition properties
174917
175430
  perProjectResults.forEach(function (projectResults) {
174918
175431
  for (var _i = 0, projectResults_2 = projectResults; _i < projectResults_2.length; _i++) {
@@ -174929,8 +175442,8 @@ var ts;
174929
175442
  var knownSymbolSpans_1 = createDocumentSpanSet();
174930
175443
  for (var _i = 0, defaultProjectResults_1 = defaultProjectResults; _i < defaultProjectResults_1.length; _i++) {
174931
175444
  var referencedSymbol = defaultProjectResults_1[_i];
174932
- for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) {
174933
- var ref = _b[_a];
175445
+ for (var _b = 0, _c = referencedSymbol.references; _b < _c.length; _b++) {
175446
+ var ref = _c[_b];
174934
175447
  if (ref.isDefinition) {
174935
175448
  knownSymbolSpans_1.add(ref);
174936
175449
  // One is enough - updateIsDefinitionOfReferencedSymbols will fill out the set based on symbols
@@ -175090,11 +175603,9 @@ var ts;
175090
175603
  // it easier for the caller to skip post-processing.
175091
175604
  if (searchedProjects.size === 1) {
175092
175605
  var it = resultsMap.values().next();
175093
- ts.Debug.assert(!it.done);
175094
- return it.value;
175606
+ return it.done ? server.emptyArray : it.value; // There may not be any results at all
175095
175607
  }
175096
175608
  return resultsMap;
175097
- // May enqueue to otherPositionQueue
175098
175609
  function searchPosition(project, location) {
175099
175610
  var projectResults = getResultsForPosition(project, location);
175100
175611
  if (!projectResults)