@typescript-deploys/pr-build 4.7.0-pr-48784-10 → 4.7.0-pr-48997-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-insiders.20220429";
92
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220506";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -5265,10 +5265,11 @@ var ts;
5265
5265
  ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
5266
5266
  ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
5267
5267
  // Starting with node12, node's module resolver has significant departures from traditional cjs resolution
5268
- // to better support ecmascript modules and their use within node - more features are still being added, so
5269
- // we can expect it to change over time, and as such, offer both a `NodeNext` moving resolution target, and a `Node12`
5270
- // version-anchored resolution target
5271
- ModuleResolutionKind[ModuleResolutionKind["Node12"] = 3] = "Node12";
5268
+ // to better support ecmascript modules and their use within node - however more features are still being added.
5269
+ // TypeScript's Node ESM support was introduced after Node 12 went end-of-life, and Node 14 is the earliest stable
5270
+ // version that supports both pattern trailers - *but*, Node 16 is the first version that also supports ECMASCript 2022.
5271
+ // In turn, we offer both a `NodeNext` moving resolution target, and a `Node16` version-anchored resolution target
5272
+ ModuleResolutionKind[ModuleResolutionKind["Node16"] = 3] = "Node16";
5272
5273
  ModuleResolutionKind[ModuleResolutionKind["NodeNext"] = 99] = "NodeNext";
5273
5274
  })(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
5274
5275
  var ModuleDetectionKind;
@@ -5278,7 +5279,7 @@ var ts;
5278
5279
  */
5279
5280
  ModuleDetectionKind[ModuleDetectionKind["Legacy"] = 1] = "Legacy";
5280
5281
  /**
5281
- * Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node12+
5282
+ * Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node16+
5282
5283
  */
5283
5284
  ModuleDetectionKind[ModuleDetectionKind["Auto"] = 2] = "Auto";
5284
5285
  /**
@@ -5323,8 +5324,8 @@ var ts;
5323
5324
  ModuleKind[ModuleKind["ES2020"] = 6] = "ES2020";
5324
5325
  ModuleKind[ModuleKind["ES2022"] = 7] = "ES2022";
5325
5326
  ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
5326
- // Node12+ is an amalgam of commonjs (albeit updated) and es2020+, and represents a distinct module system from es2020/esnext
5327
- ModuleKind[ModuleKind["Node12"] = 100] = "Node12";
5327
+ // Node16+ is an amalgam of commonjs (albeit updated) and es2022+, and represents a distinct module system from es2020/esnext
5328
+ ModuleKind[ModuleKind["Node16"] = 100] = "Node16";
5328
5329
  ModuleKind[ModuleKind["NodeNext"] = 199] = "NodeNext";
5329
5330
  })(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
5330
5331
  var JsxEmit;
@@ -6179,7 +6180,7 @@ var ts;
6179
6180
  };
6180
6181
  }
6181
6182
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
6182
- var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName, modifiedTime) {
6183
+ var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName) {
6183
6184
  // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
6184
6185
  if (!ts.isString(relativeFileName))
6185
6186
  return;
@@ -6189,7 +6190,7 @@ var ts;
6189
6190
  if (callbacks) {
6190
6191
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
6191
6192
  var fileCallback = callbacks_1[_i];
6192
- fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6193
+ fileCallback(fileName, FileWatcherEventKind.Changed);
6193
6194
  }
6194
6195
  }
6195
6196
  },
@@ -6243,7 +6244,7 @@ var ts;
6243
6244
  }
6244
6245
  else {
6245
6246
  cache.set(path, {
6246
- watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6247
+ watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
6247
6248
  refCount: 1
6248
6249
  });
6249
6250
  }
@@ -6271,7 +6272,7 @@ var ts;
6271
6272
  var newTime = modifiedTime.getTime();
6272
6273
  if (oldTime !== newTime) {
6273
6274
  watchedFile.mtime = modifiedTime;
6274
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
6275
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
6275
6276
  return true;
6276
6277
  }
6277
6278
  return false;
@@ -6306,7 +6307,7 @@ var ts;
6306
6307
  */
6307
6308
  /*@internal*/
6308
6309
  function createDirectoryWatcherSupportingRecursive(_a) {
6309
- 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;
6310
+ 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;
6310
6311
  var cache = new ts.Map();
6311
6312
  var callbackCache = ts.createMultiMap();
6312
6313
  var cacheToUpdateChildWatches = new ts.Map();
@@ -6406,7 +6407,7 @@ var ts;
6406
6407
  function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
6407
6408
  // Iterate through existing children and update the watches if needed
6408
6409
  var parentWatcher = cache.get(dirPath);
6409
- if (parentWatcher && directoryExists(dirName)) {
6410
+ if (parentWatcher && fileSystemEntryExists(dirName, 1 /* Directory */)) {
6410
6411
  // Schedule the update and postpone invoke for callbacks
6411
6412
  scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
6412
6413
  return;
@@ -6479,7 +6480,7 @@ var ts;
6479
6480
  if (!parentWatcher)
6480
6481
  return false;
6481
6482
  var newChildWatches;
6482
- var hasChanges = ts.enumerateInsertsAndDeletes(directoryExists(parentDir) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
6483
+ var hasChanges = ts.enumerateInsertsAndDeletes(fileSystemEntryExists(parentDir, 1 /* Directory */) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
6483
6484
  var childFullName = ts.getNormalizedAbsolutePath(child, parentDir);
6484
6485
  // Filter our the symbolic link directories since those arent included in recursive watch
6485
6486
  // which is same behaviour when recursive: true is passed to fs.watch
@@ -6522,18 +6523,17 @@ var ts;
6522
6523
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6523
6524
  /*@internal*/
6524
6525
  function createFileWatcherCallback(callback) {
6525
- return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6526
+ return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
6526
6527
  }
6527
6528
  ts.createFileWatcherCallback = createFileWatcherCallback;
6528
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6529
- return function (eventName, _relativeFileName, modifiedTime) {
6529
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileSystemEntryExists) {
6530
+ return function (eventName) {
6530
6531
  if (eventName === "rename") {
6531
- modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
6532
- callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
6532
+ callback(fileName, fileSystemEntryExists(fileName, 0 /* File */) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6533
6533
  }
6534
6534
  else {
6535
6535
  // Change
6536
- callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6536
+ callback(fileName, FileWatcherEventKind.Changed);
6537
6537
  }
6538
6538
  };
6539
6539
  }
@@ -6557,11 +6557,12 @@ var ts;
6557
6557
  }
6558
6558
  /*@internal*/
6559
6559
  function createSystemWatchFunctions(_a) {
6560
- 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;
6560
+ 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;
6561
6561
  var dynamicPollingWatchFile;
6562
6562
  var fixedChunkSizePollingWatchFile;
6563
6563
  var nonPollingWatchFile;
6564
6564
  var hostRecursiveDirectoryWatcher;
6565
+ var hitSystemWatcherLimit = false;
6565
6566
  return {
6566
6567
  watchFile: watchFile,
6567
6568
  watchDirectory: watchDirectory
@@ -6579,7 +6580,7 @@ var ts;
6579
6580
  case ts.WatchFileKind.FixedChunkSizePolling:
6580
6581
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, /* pollingInterval */ undefined, /*options*/ undefined);
6581
6582
  case ts.WatchFileKind.UseFsEvents:
6582
- return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime),
6583
+ return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileSystemEntryExists),
6583
6584
  /*recursive*/ false, pollingInterval, ts.getFallbackOptions(options));
6584
6585
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
6585
6586
  if (!nonPollingWatchFile) {
@@ -6640,7 +6641,7 @@ var ts;
6640
6641
  hostRecursiveDirectoryWatcher = createDirectoryWatcherSupportingRecursive({
6641
6642
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6642
6643
  getCurrentDirectory: getCurrentDirectory,
6643
- directoryExists: directoryExists,
6644
+ fileSystemEntryExists: fileSystemEntryExists,
6644
6645
  getAccessibleSortedChildDirectories: getAccessibleSortedChildDirectories,
6645
6646
  watchDirectory: nonRecursiveWatchDirectory,
6646
6647
  realpath: realpath,
@@ -6691,6 +6692,95 @@ var ts;
6691
6692
  };
6692
6693
  }
6693
6694
  }
6695
+ function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
6696
+ var lastDirectoryPartWithDirectorySeparator;
6697
+ var lastDirectoryPart;
6698
+ if (inodeWatching) {
6699
+ lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
6700
+ lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
6701
+ }
6702
+ /** Watcher for the file system entry depending on whether it is missing or present */
6703
+ var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
6704
+ watchMissingFileSystemEntry() :
6705
+ watchPresentFileSystemEntry();
6706
+ return {
6707
+ close: function () {
6708
+ // Close the watcher (either existing file system entry watcher or missing file system entry watcher)
6709
+ watcher.close();
6710
+ watcher = undefined;
6711
+ }
6712
+ };
6713
+ function updateWatcher(createWatcher) {
6714
+ // If watcher is not closed, update it
6715
+ if (watcher) {
6716
+ sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
6717
+ watcher.close();
6718
+ watcher = createWatcher();
6719
+ }
6720
+ }
6721
+ /**
6722
+ * Watch the file or directory that is currently present
6723
+ * and when the watched file or directory is deleted, switch to missing file system entry watcher
6724
+ */
6725
+ function watchPresentFileSystemEntry() {
6726
+ if (hitSystemWatcherLimit) {
6727
+ sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to watchFile");
6728
+ return watchPresentFileSystemEntryWithFsWatchFile();
6729
+ }
6730
+ try {
6731
+ var presentWatcher = fsWatchWorker(fileOrDirectory, recursive, inodeWatching ?
6732
+ callbackChangingToMissingFileSystemEntry :
6733
+ callback);
6734
+ // Watch the missing file or directory or error
6735
+ presentWatcher.on("error", function () {
6736
+ callback("rename", "");
6737
+ updateWatcher(watchMissingFileSystemEntry);
6738
+ });
6739
+ return presentWatcher;
6740
+ }
6741
+ catch (e) {
6742
+ // Catch the exception and use polling instead
6743
+ // 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
6744
+ // so instead of throwing error, use fs.watchFile
6745
+ hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
6746
+ sysLog("sysLog:: " + fileOrDirectory + ":: Changing to watchFile");
6747
+ return watchPresentFileSystemEntryWithFsWatchFile();
6748
+ }
6749
+ }
6750
+ function callbackChangingToMissingFileSystemEntry(event, relativeName) {
6751
+ callback(event, relativeName);
6752
+ // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
6753
+ // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
6754
+ if (event === "rename" &&
6755
+ (!relativeName ||
6756
+ relativeName === lastDirectoryPart ||
6757
+ (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length))) {
6758
+ updateWatcher(!fileSystemEntryExists(fileOrDirectory, entryKind) ? watchMissingFileSystemEntry : watchPresentFileSystemEntry);
6759
+ }
6760
+ }
6761
+ /**
6762
+ * Watch the file or directory using fs.watchFile since fs.watch threw exception
6763
+ * 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
6764
+ */
6765
+ function watchPresentFileSystemEntryWithFsWatchFile() {
6766
+ return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions);
6767
+ }
6768
+ /**
6769
+ * Watch the file or directory that is missing
6770
+ * and switch to existing file or directory when the missing filesystem entry is created
6771
+ */
6772
+ function watchMissingFileSystemEntry() {
6773
+ return watchFile(fileOrDirectory, function (_fileName, eventKind) {
6774
+ if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
6775
+ callback("rename", "");
6776
+ // Call the callback for current file or directory
6777
+ // For now it could be callback for the inner directory creation,
6778
+ // but just return current directory, better than current no-op
6779
+ updateWatcher(watchPresentFileSystemEntry);
6780
+ }
6781
+ }, fallbackPollingInterval, fallbackOptions);
6782
+ }
6783
+ }
6694
6784
  }
6695
6785
  ts.createSystemWatchFunctions = createSystemWatchFunctions;
6696
6786
  /**
@@ -6743,7 +6833,6 @@ var ts;
6743
6833
  }
6744
6834
  var activeSession;
6745
6835
  var profilePath = "./profile.cpuprofile";
6746
- var hitSystemWatcherLimit = false;
6747
6836
  var Buffer = require("buffer").Buffer;
6748
6837
  var nodeVersion = getNodeMajorVersion();
6749
6838
  var isNode4OrLater = nodeVersion >= 4;
@@ -6758,19 +6847,21 @@ var ts;
6758
6847
  getModifiedTime: getModifiedTime,
6759
6848
  setTimeout: setTimeout,
6760
6849
  clearTimeout: clearTimeout,
6761
- fsWatch: fsWatch,
6850
+ fsWatchWorker: fsWatchWorker,
6762
6851
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6763
6852
  getCurrentDirectory: getCurrentDirectory,
6853
+ fileSystemEntryExists: fileSystemEntryExists,
6764
6854
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
6765
6855
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
6766
6856
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
6767
- directoryExists: directoryExists,
6768
6857
  getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; },
6769
6858
  realpath: realpath,
6770
6859
  tscWatchFile: process.env.TSC_WATCHFILE,
6771
6860
  useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
6772
6861
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
6773
6862
  defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
6863
+ inodeWatching: isLinuxOrMacOs,
6864
+ sysLog: sysLog,
6774
6865
  }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
6775
6866
  var nodeSystem = {
6776
6867
  args: process.argv.slice(2),
@@ -7020,114 +7111,14 @@ var ts;
7020
7111
  // File changed
7021
7112
  eventKind = FileWatcherEventKind.Changed;
7022
7113
  }
7023
- callback(fileName, eventKind, curr.mtime);
7114
+ callback(fileName, eventKind);
7024
7115
  }
7025
7116
  }
7026
- function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
7027
- var options;
7028
- var lastDirectoryPartWithDirectorySeparator;
7029
- var lastDirectoryPart;
7030
- if (isLinuxOrMacOs) {
7031
- lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
7032
- lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
7033
- }
7034
- /** Watcher for the file system entry depending on whether it is missing or present */
7035
- var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7036
- watchMissingFileSystemEntry() :
7037
- watchPresentFileSystemEntry();
7038
- return {
7039
- close: function () {
7040
- // Close the watcher (either existing file system entry watcher or missing file system entry watcher)
7041
- watcher.close();
7042
- watcher = undefined;
7043
- }
7044
- };
7045
- /**
7046
- * Invoke the callback with rename and update the watcher if not closed
7047
- * @param createWatcher
7048
- */
7049
- function invokeCallbackAndUpdateWatcher(createWatcher, modifiedTime) {
7050
- sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
7051
- // Call the callback for current directory
7052
- callback("rename", "", modifiedTime);
7053
- // If watcher is not closed, update it
7054
- if (watcher) {
7055
- watcher.close();
7056
- watcher = createWatcher();
7057
- }
7058
- }
7059
- /**
7060
- * Watch the file or directory that is currently present
7061
- * and when the watched file or directory is deleted, switch to missing file system entry watcher
7062
- */
7063
- function watchPresentFileSystemEntry() {
7064
- // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
7065
- // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
7066
- if (options === undefined) {
7067
- if (fsSupportsRecursiveFsWatch) {
7068
- options = { persistent: true, recursive: !!recursive };
7069
- }
7070
- else {
7071
- options = { persistent: true };
7072
- }
7073
- }
7074
- if (hitSystemWatcherLimit) {
7075
- sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to fsWatchFile");
7076
- return watchPresentFileSystemEntryWithFsWatchFile();
7077
- }
7078
- try {
7079
- var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
7080
- callbackChangingToMissingFileSystemEntry :
7081
- callback);
7082
- // Watch the missing file or directory or error
7083
- presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
7084
- return presentWatcher;
7085
- }
7086
- catch (e) {
7087
- // Catch the exception and use polling instead
7088
- // 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
7089
- // so instead of throwing error, use fs.watchFile
7090
- hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
7091
- sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
7092
- return watchPresentFileSystemEntryWithFsWatchFile();
7093
- }
7094
- }
7095
- function callbackChangingToMissingFileSystemEntry(event, relativeName) {
7096
- // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
7097
- // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
7098
- var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
7099
- return event === "rename" &&
7100
- (!relativeName ||
7101
- relativeName === lastDirectoryPart ||
7102
- (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
7103
- modifiedTime === ts.missingFileModifiedTime ?
7104
- invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry, modifiedTime) :
7105
- callback(event, relativeName, modifiedTime);
7106
- }
7107
- /**
7108
- * Watch the file or directory using fs.watchFile since fs.watch threw exception
7109
- * 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
7110
- */
7111
- function watchPresentFileSystemEntryWithFsWatchFile() {
7112
- return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions);
7113
- }
7114
- /**
7115
- * Watch the file or directory that is missing
7116
- * and switch to existing file or directory when the missing filesystem entry is created
7117
- */
7118
- function watchMissingFileSystemEntry() {
7119
- return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
7120
- if (eventKind === FileWatcherEventKind.Created) {
7121
- modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
7122
- if (modifiedTime !== ts.missingFileModifiedTime) {
7123
- // Call the callback for current file or directory
7124
- // For now it could be callback for the inner directory creation,
7125
- // but just return current directory, better than current no-op
7126
- invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry, modifiedTime);
7127
- }
7128
- }
7129
- }, fallbackPollingInterval, fallbackOptions);
7130
- }
7117
+ function fsWatchWorker(fileOrDirectory, recursive, callback) {
7118
+ // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
7119
+ // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
7120
+ return _fs.watch(fileOrDirectory, fsSupportsRecursiveFsWatch ?
7121
+ { persistent: true, recursive: !!recursive } : { persistent: true }, callback);
7131
7122
  }
7132
7123
  function readFileWorker(fileName, _encoding) {
7133
7124
  var buffer;
@@ -7274,19 +7265,12 @@ var ts;
7274
7265
  }
7275
7266
  function getModifiedTime(path) {
7276
7267
  var _a;
7277
- // Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
7278
- // the CPU time performance.
7279
- var originalStackTraceLimit = Error.stackTraceLimit;
7280
- Error.stackTraceLimit = 0;
7281
7268
  try {
7282
7269
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
7283
7270
  }
7284
7271
  catch (e) {
7285
7272
  return undefined;
7286
7273
  }
7287
- finally {
7288
- Error.stackTraceLimit = originalStackTraceLimit;
7289
- }
7290
7274
  }
7291
7275
  function setModifiedTime(path, time) {
7292
7276
  try {
@@ -8257,6 +8241,7 @@ var ts;
8257
8241
  _0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"),
8258
8242
  with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
8259
8243
  await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
8244
+ The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
8260
8245
  Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern: diag(1312, ts.DiagnosticCategory.Error, "Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_1312", "Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern."),
8261
8246
  The_body_of_an_if_statement_cannot_be_the_empty_statement: diag(1313, ts.DiagnosticCategory.Error, "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", "The body of an 'if' statement cannot be the empty statement."),
8262
8247
  Global_module_exports_may_only_appear_in_module_files: diag(1314, ts.DiagnosticCategory.Error, "Global_module_exports_may_only_appear_in_module_files_1314", "Global module exports may only appear in module files."),
@@ -8268,8 +8253,8 @@ var ts;
8268
8253
  Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1320, ts.DiagnosticCategory.Error, "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member."),
8269
8254
  Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, ts.DiagnosticCategory.Error, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),
8270
8255
  Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, ts.DiagnosticCategory.Error, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),
8271
- Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node12_or_nodenext: diag(1323, ts.DiagnosticCategory.Error, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'."),
8272
- Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'."),
8256
+ Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext: diag(1323, ts.DiagnosticCategory.Error, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'."),
8257
+ Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nod_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'."),
8273
8258
  Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, ts.DiagnosticCategory.Error, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
8274
8259
  This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326", "This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments."),
8275
8260
  String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
@@ -8286,7 +8271,7 @@ var ts;
8286
8271
  Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
8287
8272
  Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
8288
8273
  Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
8289
- The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node12_or_nodenext: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'."),
8274
+ The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'."),
8290
8275
  A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
8291
8276
  An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, ts.DiagnosticCategory.Error, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
8292
8277
  This_parameter_is_not_allowed_with_use_strict_directive: diag(1346, ts.DiagnosticCategory.Error, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."),
@@ -8317,7 +8302,7 @@ var ts;
8317
8302
  await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1375, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375", "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
8318
8303
  _0_was_imported_here: diag(1376, ts.DiagnosticCategory.Message, "_0_was_imported_here_1376", "'{0}' was imported here."),
8319
8304
  _0_was_exported_here: diag(1377, ts.DiagnosticCategory.Message, "_0_was_exported_here_1377", "'{0}' was exported here."),
8320
- Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, ts.DiagnosticCategory.Error, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
8305
+ Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, ts.DiagnosticCategory.Error, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
8321
8306
  An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type: diag(1379, ts.DiagnosticCategory.Error, "An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type_1379", "An import alias cannot reference a declaration that was exported using 'export type'."),
8322
8307
  An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, ts.DiagnosticCategory.Error, "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380", "An import alias cannot reference a declaration that was imported using 'import type'."),
8323
8308
  Unexpected_token_Did_you_mean_or_rbrace: diag(1381, ts.DiagnosticCategory.Error, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `&rbrace;`?"),
@@ -8369,7 +8354,7 @@ var ts;
8369
8354
  File_redirects_to_file_0: diag(1429, ts.DiagnosticCategory.Message, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
8370
8355
  The_file_is_in_the_program_because_Colon: diag(1430, ts.DiagnosticCategory.Message, "The_file_is_in_the_program_because_Colon_1430", "The file is in the program because:"),
8371
8356
  for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1431, ts.DiagnosticCategory.Error, "for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_1431", "'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
8372
- Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, ts.DiagnosticCategory.Error, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or__1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
8357
+ Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, ts.DiagnosticCategory.Error, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
8373
8358
  Decorators_may_not_be_applied_to_this_parameters: diag(1433, ts.DiagnosticCategory.Error, "Decorators_may_not_be_applied_to_this_parameters_1433", "Decorators may not be applied to 'this' parameters."),
8374
8359
  Unexpected_keyword_or_identifier: diag(1434, ts.DiagnosticCategory.Error, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
8375
8360
  Unknown_keyword_or_identifier_Did_you_mean_0: diag(1435, ts.DiagnosticCategory.Error, "Unknown_keyword_or_identifier_Did_you_mean_0_1435", "Unknown keyword or identifier. Did you mean '{0}'?"),
@@ -8387,7 +8372,7 @@ var ts;
8387
8372
  Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed: diag(1449, ts.DiagnosticCategory.Message, "Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed_1449", "Preserve unused imported values in the JavaScript output that would otherwise be removed."),
8388
8373
  Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments: diag(1450, ts.DiagnosticCategory.Message, "Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments_1450", "Dynamic imports can only accept a module specifier and an optional assertion as arguments"),
8389
8374
  Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression: diag(1451, ts.DiagnosticCategory.Error, "Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member__1451", "Private identifiers are only allowed in class bodies and may only be used as part of a class member declaration, property access, or on the left-hand-side of an 'in' expression"),
8390
- Resolution_modes_are_only_supported_when_moduleResolution_is_node12_or_nodenext: diag(1452, ts.DiagnosticCategory.Error, "Resolution_modes_are_only_supported_when_moduleResolution_is_node12_or_nodenext_1452", "Resolution modes are only supported when `moduleResolution` is `node12` or `nodenext`."),
8375
+ Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext: diag(1452, ts.DiagnosticCategory.Error, "Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext_1452", "Resolution modes are only supported when `moduleResolution` is `node16` or `nodenext`."),
8391
8376
  resolution_mode_should_be_either_require_or_import: diag(1453, ts.DiagnosticCategory.Error, "resolution_mode_should_be_either_require_or_import_1453", "`resolution-mode` should be either `require` or `import`."),
8392
8377
  resolution_mode_can_only_be_set_for_type_only_imports: diag(1454, ts.DiagnosticCategory.Error, "resolution_mode_can_only_be_set_for_type_only_imports_1454", "`resolution-mode` can only be set for type-only imports."),
8393
8378
  resolution_mode_is_the_only_valid_key_for_type_import_assertions: diag(1455, ts.DiagnosticCategory.Error, "resolution_mode_is_the_only_valid_key_for_type_import_assertions_1455", "`resolution-mode` is the only valid key for type import assertions."),
@@ -8398,7 +8383,7 @@ var ts;
8398
8383
  An_import_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1473, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473", "An import declaration can only be used at the top level of a module."),
8399
8384
  An_export_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1474, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474", "An export declaration can only be used at the top level of a module."),
8400
8385
  Control_what_method_is_used_to_detect_module_format_JS_files: diag(1475, ts.DiagnosticCategory.Message, "Control_what_method_is_used_to_detect_module_format_JS_files_1475", "Control what method is used to detect module-format JS files."),
8401
- auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node12_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node12+) as modules."),
8386
+ auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules."),
8402
8387
  The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
8403
8388
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
8404
8389
  Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
@@ -8407,7 +8392,8 @@ var ts;
8407
8392
  Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1: diag(2205, ts.DiagnosticCategory.Error, "Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2205", "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
8408
8393
  The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement: diag(2206, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206", "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."),
8409
8394
  The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement: diag(2207, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207", "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."),
8410
- This_type_parameter_probably_needs_an_extends_object_constraint: diag(2208, ts.DiagnosticCategory.Error, "This_type_parameter_probably_needs_an_extends_object_constraint_2208", "This type parameter probably needs an `extends object` constraint."),
8395
+ The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8396
+ The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8411
8397
  Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
8412
8398
  Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
8413
8399
  Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
@@ -8885,8 +8871,8 @@ var ts;
8885
8871
  Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext: diag(2821, ts.DiagnosticCategory.Error, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'."),
8886
8872
  Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, ts.DiagnosticCategory.Error, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
8887
8873
  Cannot_find_namespace_0_Did_you_mean_1: diag(2833, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
8888
- Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path."),
8889
- Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?"),
8874
+ Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path."),
8875
+ Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '{0}'?"),
8890
8876
  Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
8891
8877
  Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
8892
8878
  All_declarations_of_0_must_have_identical_constraints: diag(2838, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
@@ -9299,8 +9285,8 @@ var ts;
9299
9285
  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"),
9300
9286
  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"),
9301
9287
  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."),
9302
- 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}'"),
9303
- 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}'"),
9288
+ 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}'"),
9289
+ 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}'"),
9304
9290
  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"),
9305
9291
  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"),
9306
9292
  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"),
@@ -9344,8 +9330,6 @@ var ts;
9344
9330
  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}'."),
9345
9331
  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}'."),
9346
9332
  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."),
9347
- 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"),
9348
- 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"),
9349
9333
  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}'"),
9350
9334
  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."),
9351
9335
  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."),
@@ -9554,7 +9538,6 @@ var ts;
9554
9538
  This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead: diag(7059, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead_7059", "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead."),
9555
9539
  This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint: diag(7060, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_cons_7060", "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint."),
9556
9540
  A_mapped_type_may_not_declare_properties_or_methods: diag(7061, ts.DiagnosticCategory.Error, "A_mapped_type_may_not_declare_properties_or_methods_7061", "A mapped type may not declare properties or methods."),
9557
- JSON_imports_are_experimental_in_ES_module_mode_imports: diag(7062, ts.DiagnosticCategory.Error, "JSON_imports_are_experimental_in_ES_module_mode_imports_7062", "JSON imports are experimental in ES module mode imports."),
9558
9541
  You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
9559
9542
  You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
9560
9543
  import_can_only_be_used_in_TypeScript_files: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_TypeScript_files_8002", "'import ... =' can only be used in TypeScript files."),
@@ -14847,7 +14830,7 @@ var ts;
14847
14830
  }
14848
14831
  ts.getNonAugmentationDeclaration = getNonAugmentationDeclaration;
14849
14832
  function isCommonJSContainingModuleKind(kind) {
14850
- return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.Node12 || kind === ts.ModuleKind.NodeNext;
14833
+ return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.Node16 || kind === ts.ModuleKind.NodeNext;
14851
14834
  }
14852
14835
  function isEffectiveExternalModule(node, compilerOptions) {
14853
14836
  return ts.isExternalModule(node) || compilerOptions.isolatedModules || (isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator);
@@ -18236,6 +18219,16 @@ var ts;
18236
18219
  ".d.ts" /* Dts */;
18237
18220
  }
18238
18221
  ts.getDeclarationEmitExtensionForPath = getDeclarationEmitExtensionForPath;
18222
+ /**
18223
+ * This function is an inverse of `getDeclarationEmitExtensionForPath`.
18224
+ */
18225
+ function getPossibleOriginalInputExtensionForExtension(path) {
18226
+ return ts.fileExtensionIsOneOf(path, [".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".mts" /* Mts */]) ? [".mts" /* Mts */, ".mjs" /* Mjs */] :
18227
+ ts.fileExtensionIsOneOf(path, [".d.cts" /* Dcts */, ".cjs" /* Cjs */, ".cts" /* Cts */]) ? [".cts" /* Cts */, ".cjs" /* Cjs */] :
18228
+ ts.fileExtensionIsOneOf(path, [".json.d.ts"]) ? [".json" /* Json */] :
18229
+ [".tsx" /* Tsx */, ".ts" /* Ts */, ".jsx" /* Jsx */, ".js" /* Js */];
18230
+ }
18231
+ ts.getPossibleOriginalInputExtensionForExtension = getPossibleOriginalInputExtensionForExtension;
18239
18232
  function outFile(options) {
18240
18233
  return options.outFile || options.out;
18241
18234
  }
@@ -20015,7 +20008,7 @@ var ts;
20015
20008
  file.externalModuleIndicator = ts.isFileProbablyExternalModule(file);
20016
20009
  };
20017
20010
  case ts.ModuleDetectionKind.Auto:
20018
- // If module is nodenext or node12, all esm format files are modules
20011
+ // If module is nodenext or node16, all esm format files are modules
20019
20012
  // If jsx is react-jsx or react-jsxdev then jsx tags force module-ness
20020
20013
  // otherwise, the presence of import or export statments (or import.meta) implies module-ness
20021
20014
  var checks = [ts.isFileProbablyExternalModule];
@@ -20023,7 +20016,7 @@ var ts;
20023
20016
  checks.push(isFileModuleFromUsingJSXTag);
20024
20017
  }
20025
20018
  var moduleKind = getEmitModuleKind(options);
20026
- if (moduleKind === ts.ModuleKind.Node12 || moduleKind === ts.ModuleKind.NodeNext) {
20019
+ if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
20027
20020
  checks.push(isFileForcedToBeModuleByFormat);
20028
20021
  }
20029
20022
  var combined_1 = ts.or.apply(void 0, checks);
@@ -20034,7 +20027,7 @@ var ts;
20034
20027
  ts.getSetExternalModuleIndicator = getSetExternalModuleIndicator;
20035
20028
  function getEmitScriptTarget(compilerOptions) {
20036
20029
  return compilerOptions.target ||
20037
- (compilerOptions.module === ts.ModuleKind.Node12 && 7 /* ES2020 */) ||
20030
+ (compilerOptions.module === ts.ModuleKind.Node16 && 9 /* ES2022 */) ||
20038
20031
  (compilerOptions.module === ts.ModuleKind.NodeNext && 99 /* ESNext */) ||
20039
20032
  0 /* ES3 */;
20040
20033
  }
@@ -20052,8 +20045,8 @@ var ts;
20052
20045
  case ts.ModuleKind.CommonJS:
20053
20046
  moduleResolution = ts.ModuleResolutionKind.NodeJs;
20054
20047
  break;
20055
- case ts.ModuleKind.Node12:
20056
- moduleResolution = ts.ModuleResolutionKind.Node12;
20048
+ case ts.ModuleKind.Node16:
20049
+ moduleResolution = ts.ModuleResolutionKind.Node16;
20057
20050
  break;
20058
20051
  case ts.ModuleKind.NodeNext:
20059
20052
  moduleResolution = ts.ModuleResolutionKind.NodeNext;
@@ -20078,7 +20071,7 @@ var ts;
20078
20071
  case ts.ModuleKind.ES2020:
20079
20072
  case ts.ModuleKind.ES2022:
20080
20073
  case ts.ModuleKind.ESNext:
20081
- case ts.ModuleKind.Node12:
20074
+ case ts.ModuleKind.Node16:
20082
20075
  case ts.ModuleKind.NodeNext:
20083
20076
  return true;
20084
20077
  default:
@@ -20103,7 +20096,7 @@ var ts;
20103
20096
  return compilerOptions.esModuleInterop;
20104
20097
  }
20105
20098
  switch (getEmitModuleKind(compilerOptions)) {
20106
- case ts.ModuleKind.Node12:
20099
+ case ts.ModuleKind.Node16:
20107
20100
  case ts.ModuleKind.NodeNext:
20108
20101
  return true;
20109
20102
  }
@@ -20150,10 +20143,6 @@ var ts;
20150
20143
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
20151
20144
  }
20152
20145
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
20153
- function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
20154
- return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
20155
- }
20156
- ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
20157
20146
  function getCompilerOptionValue(options, option) {
20158
20147
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
20159
20148
  }
@@ -26189,7 +26178,7 @@ var ts;
26189
26178
  return node;
26190
26179
  }
26191
26180
  function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) {
26192
- var node = baseFactory.createBaseSourceFileNode(305 /* SourceFile */);
26181
+ var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SourceFile */));
26193
26182
  for (var p in source) {
26194
26183
  if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p))
26195
26184
  continue;
@@ -31314,7 +31303,7 @@ var ts;
31314
31303
  initializeState("", content, languageVersion, /*syntaxCursor*/ undefined, 1 /* JS */);
31315
31304
  // Prime the scanner.
31316
31305
  nextToken();
31317
- var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ false);
31306
+ var entityName = parseEntityName(/*allowReservedWords*/ true);
31318
31307
  var isInvalid = token() === 1 /* EndOfFileToken */ && !parseDiagnostics.length;
31319
31308
  clearState();
31320
31309
  return isInvalid ? entityName : undefined;
@@ -32914,7 +32903,7 @@ var ts;
32914
32903
  }
32915
32904
  return createMissingList();
32916
32905
  }
32917
- function parseEntityName(allowReservedWords, allowPrivateIdentifiers, diagnosticMessage) {
32906
+ function parseEntityName(allowReservedWords, diagnosticMessage) {
32918
32907
  var pos = getNodePos();
32919
32908
  var entity = allowReservedWords ? parseIdentifierName(diagnosticMessage) : parseIdentifier(diagnosticMessage);
32920
32909
  var dotPos = getNodePos();
@@ -32925,7 +32914,7 @@ var ts;
32925
32914
  break;
32926
32915
  }
32927
32916
  dotPos = getNodePos();
32928
- entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, allowPrivateIdentifiers)), pos);
32917
+ entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, /* allowPrivateIdentifiers */ false)), pos);
32929
32918
  }
32930
32919
  return entity;
32931
32920
  }
@@ -33058,7 +33047,7 @@ var ts;
33058
33047
  }
33059
33048
  // TYPES
33060
33049
  function parseEntityNameOfTypeReference() {
33061
- return parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ false, ts.Diagnostics.Type_expected);
33050
+ return parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
33062
33051
  }
33063
33052
  function parseTypeArgumentsOfTypeReference() {
33064
33053
  if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 29 /* LessThanToken */) {
@@ -33191,7 +33180,7 @@ var ts;
33191
33180
  function parseTypeQuery() {
33192
33181
  var pos = getNodePos();
33193
33182
  parseExpected(112 /* TypeOfKeyword */);
33194
- var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
33183
+ var entityName = parseEntityName(/*allowReservedWords*/ true);
33195
33184
  // Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
33196
33185
  var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
33197
33186
  return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
@@ -34159,10 +34148,10 @@ var ts;
34159
34148
  setDecoratorContext(/*val*/ false);
34160
34149
  }
34161
34150
  var pos = getNodePos();
34162
- var expr = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
34151
+ var expr = parseAssignmentExpressionOrHigher();
34163
34152
  var operatorToken;
34164
34153
  while ((operatorToken = parseOptionalToken(27 /* CommaToken */))) {
34165
- expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false), pos);
34154
+ expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(), pos);
34166
34155
  }
34167
34156
  if (saveDecoratorContext) {
34168
34157
  setDecoratorContext(/*val*/ true);
@@ -34170,9 +34159,9 @@ var ts;
34170
34159
  return expr;
34171
34160
  }
34172
34161
  function parseInitializer() {
34173
- return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false) : undefined;
34162
+ return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
34174
34163
  }
34175
- function parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction) {
34164
+ function parseAssignmentExpressionOrHigher() {
34176
34165
  // AssignmentExpression[in,yield]:
34177
34166
  // 1) ConditionalExpression[?in,?yield]
34178
34167
  // 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
@@ -34198,7 +34187,7 @@ var ts;
34198
34187
  // If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
34199
34188
  // not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
34200
34189
  // with AssignmentExpression if we see one.
34201
- var arrowExpression = tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) || tryParseAsyncSimpleArrowFunctionExpression(disallowReturnTypeInArrowFunction);
34190
+ var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
34202
34191
  if (arrowExpression) {
34203
34192
  return arrowExpression;
34204
34193
  }
@@ -34217,7 +34206,7 @@ var ts;
34217
34206
  // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
34218
34207
  // identifier and the current token is an arrow.
34219
34208
  if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
34220
- return parseSimpleArrowFunctionExpression(pos, expr, disallowReturnTypeInArrowFunction, /*asyncModifier*/ undefined);
34209
+ return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
34221
34210
  }
34222
34211
  // Now see if we might be in cases '2' or '3'.
34223
34212
  // If the expression was a LHS expression, and we have an assignment operator, then
@@ -34226,7 +34215,7 @@ var ts;
34226
34215
  // Note: we call reScanGreaterToken so that we get an appropriately merged token
34227
34216
  // for cases like `> > =` becoming `>>=`
34228
34217
  if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
34229
- return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction), pos);
34218
+ return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
34230
34219
  }
34231
34220
  // It wasn't an assignment or a lambda. This is a conditional expression:
34232
34221
  return parseConditionalExpressionRest(expr, pos);
@@ -34269,7 +34258,7 @@ var ts;
34269
34258
  nextToken();
34270
34259
  if (!scanner.hasPrecedingLineBreak() &&
34271
34260
  (token() === 41 /* AsteriskToken */ || isStartOfExpression())) {
34272
- return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false)), pos);
34261
+ return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher()), pos);
34273
34262
  }
34274
34263
  else {
34275
34264
  // if the next token is not on the same line as yield. or we don't have an '*' or
@@ -34277,7 +34266,7 @@ var ts;
34277
34266
  return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
34278
34267
  }
34279
34268
  }
34280
- function parseSimpleArrowFunctionExpression(pos, identifier, disallowReturnTypeInArrowFunction, asyncModifier) {
34269
+ function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
34281
34270
  ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
34282
34271
  var parameter = factory.createParameterDeclaration(
34283
34272
  /*decorators*/ undefined,
@@ -34289,11 +34278,11 @@ var ts;
34289
34278
  finishNode(parameter, identifier.pos);
34290
34279
  var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
34291
34280
  var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
34292
- var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier, disallowReturnTypeInArrowFunction);
34281
+ var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
34293
34282
  var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
34294
34283
  return addJSDocComment(finishNode(node, pos));
34295
34284
  }
34296
- function tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
34285
+ function tryParseParenthesizedArrowFunctionExpression() {
34297
34286
  var triState = isParenthesizedArrowFunctionExpression();
34298
34287
  if (triState === 0 /* False */) {
34299
34288
  // It's definitely not a parenthesized arrow function expression.
@@ -34304,8 +34293,8 @@ var ts;
34304
34293
  // it out, but don't allow any ambiguity, and return 'undefined' if this could be an
34305
34294
  // expression instead.
34306
34295
  return triState === 1 /* True */ ?
34307
- parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, /*disallowReturnTypeInArrowFunction*/ false) :
34308
- tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
34296
+ parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
34297
+ tryParse(parsePossibleParenthesizedArrowFunctionExpression);
34309
34298
  }
34310
34299
  // True -> We definitely expect a parenthesized arrow function here.
34311
34300
  // False -> There *cannot* be a parenthesized arrow function here.
@@ -34435,25 +34424,25 @@ var ts;
34435
34424
  return 2 /* Unknown */;
34436
34425
  }
34437
34426
  }
34438
- function parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
34427
+ function parsePossibleParenthesizedArrowFunctionExpression() {
34439
34428
  var tokenPos = scanner.getTokenPos();
34440
34429
  if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
34441
34430
  return undefined;
34442
34431
  }
34443
- var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false, disallowReturnTypeInArrowFunction);
34432
+ var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
34444
34433
  if (!result) {
34445
34434
  (notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
34446
34435
  }
34447
34436
  return result;
34448
34437
  }
34449
- function tryParseAsyncSimpleArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
34438
+ function tryParseAsyncSimpleArrowFunctionExpression() {
34450
34439
  // We do a check here so that we won't be doing unnecessarily call to "lookAhead"
34451
34440
  if (token() === 131 /* AsyncKeyword */) {
34452
34441
  if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
34453
34442
  var pos = getNodePos();
34454
34443
  var asyncModifier = parseModifiersForArrowFunction();
34455
34444
  var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
34456
- return parseSimpleArrowFunctionExpression(pos, expr, disallowReturnTypeInArrowFunction, asyncModifier);
34445
+ return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
34457
34446
  }
34458
34447
  }
34459
34448
  return undefined;
@@ -34477,7 +34466,7 @@ var ts;
34477
34466
  }
34478
34467
  return 0 /* False */;
34479
34468
  }
34480
- function parseParenthesizedArrowFunctionExpression(allowAmbiguity, disallowReturnTypeInArrowFunction) {
34469
+ function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
34481
34470
  var pos = getNodePos();
34482
34471
  var hasJSDoc = hasPrecedingJSDocComment();
34483
34472
  var modifiers = parseModifiersForArrowFunction();
@@ -34512,23 +34501,6 @@ var ts;
34512
34501
  return undefined;
34513
34502
  }
34514
34503
  }
34515
- // Given:
34516
- // x ? y => ({ y }) : z => ({ z })
34517
- // We try to parse the body of the first arrow function by looking at:
34518
- // ({ y }) : z => ({ z })
34519
- // This is a valid arrow function with "z" as the return type.
34520
- //
34521
- // But, if we're in the true side of a conditional expression, this colon
34522
- // terminates the expression, so we cannot allow a return type if we aren't
34523
- // certain whether or not the preceding text was parsed as a parameter list.
34524
- //
34525
- // For example,
34526
- // a() ? (b: number, c?: string): void => d() : e
34527
- // is determined by isParenthesizedArrowFunctionExpression to unambiguously
34528
- // be an arrow expression, so we allow a return type.
34529
- if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
34530
- return undefined;
34531
- }
34532
34504
  var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
34533
34505
  if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
34534
34506
  return undefined;
@@ -34557,12 +34529,12 @@ var ts;
34557
34529
  var lastToken = token();
34558
34530
  var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
34559
34531
  var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
34560
- ? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), disallowReturnTypeInArrowFunction)
34532
+ ? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier))
34561
34533
  : parseIdentifier();
34562
34534
  var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
34563
34535
  return withJSDoc(finishNode(node, pos), hasJSDoc);
34564
34536
  }
34565
- function parseArrowFunctionExpressionBody(isAsync, disallowReturnTypeInArrowFunction) {
34537
+ function parseArrowFunctionExpressionBody(isAsync) {
34566
34538
  if (token() === 18 /* OpenBraceToken */) {
34567
34539
  return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
34568
34540
  }
@@ -34590,8 +34562,8 @@ var ts;
34590
34562
  var savedTopLevel = topLevel;
34591
34563
  topLevel = false;
34592
34564
  var node = isAsync
34593
- ? doInAwaitContext(function () { return parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction); })
34594
- : doOutsideOfAwaitContext(function () { return parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction); });
34565
+ ? doInAwaitContext(parseAssignmentExpressionOrHigher)
34566
+ : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
34595
34567
  topLevel = savedTopLevel;
34596
34568
  return node;
34597
34569
  }
@@ -34604,8 +34576,8 @@ var ts;
34604
34576
  // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
34605
34577
  // we do not that for the 'whenFalse' part.
34606
34578
  var colonToken;
34607
- return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
34608
- ? parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true)
34579
+ return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
34580
+ ? parseAssignmentExpressionOrHigher()
34609
34581
  : createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
34610
34582
  }
34611
34583
  function parseBinaryExpressionOrHigher(precedence) {
@@ -35497,13 +35469,13 @@ var ts;
35497
35469
  function parseSpreadElement() {
35498
35470
  var pos = getNodePos();
35499
35471
  parseExpected(25 /* DotDotDotToken */);
35500
- var expression = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
35472
+ var expression = parseAssignmentExpressionOrHigher();
35501
35473
  return finishNode(factory.createSpreadElement(expression), pos);
35502
35474
  }
35503
35475
  function parseArgumentOrArrayLiteralElement() {
35504
35476
  return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() :
35505
35477
  token() === 27 /* CommaToken */ ? finishNode(factory.createOmittedExpression(), getNodePos()) :
35506
- parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
35478
+ parseAssignmentExpressionOrHigher();
35507
35479
  }
35508
35480
  function parseArgumentExpression() {
35509
35481
  return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
@@ -35521,7 +35493,7 @@ var ts;
35521
35493
  var pos = getNodePos();
35522
35494
  var hasJSDoc = hasPrecedingJSDocComment();
35523
35495
  if (parseOptionalToken(25 /* DotDotDotToken */)) {
35524
- var expression = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
35496
+ var expression = parseAssignmentExpressionOrHigher();
35525
35497
  return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc);
35526
35498
  }
35527
35499
  var decorators = parseDecorators();
@@ -35550,7 +35522,7 @@ var ts;
35550
35522
  var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 58 /* ColonToken */);
35551
35523
  if (isShorthandPropertyAssignment) {
35552
35524
  var equalsToken = parseOptionalToken(63 /* EqualsToken */);
35553
- var objectAssignmentInitializer = equalsToken ? allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false); }) : undefined;
35525
+ var objectAssignmentInitializer = equalsToken ? allowInAnd(parseAssignmentExpressionOrHigher) : undefined;
35554
35526
  node = factory.createShorthandPropertyAssignment(name, objectAssignmentInitializer);
35555
35527
  // Save equals token for error reporting.
35556
35528
  // TODO(rbuckton): Consider manufacturing this when we need to report an error as it is otherwise not useful.
@@ -35558,7 +35530,7 @@ var ts;
35558
35530
  }
35559
35531
  else {
35560
35532
  parseExpected(58 /* ColonToken */);
35561
- var initializer = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false); });
35533
+ var initializer = allowInAnd(parseAssignmentExpressionOrHigher);
35562
35534
  node = factory.createPropertyAssignment(name, initializer);
35563
35535
  }
35564
35536
  // Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker
@@ -35732,7 +35704,7 @@ var ts;
35732
35704
  }
35733
35705
  var node;
35734
35706
  if (awaitToken ? parseExpected(160 /* OfKeyword */) : parseOptional(160 /* OfKeyword */)) {
35735
- var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false); });
35707
+ var expression = allowInAnd(parseAssignmentExpressionOrHigher);
35736
35708
  parseExpected(21 /* CloseParenToken */);
35737
35709
  node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement());
35738
35710
  }
@@ -36900,7 +36872,7 @@ var ts;
36900
36872
  var pos = getNodePos();
36901
36873
  var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
36902
36874
  parseExpected(58 /* ColonToken */);
36903
- var value = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
36875
+ var value = parseAssignmentExpressionOrHigher();
36904
36876
  return finishNode(factory.createAssertEntry(name, value), pos);
36905
36877
  }
36906
36878
  function parseAssertClause(skipAssertKeyword) {
@@ -36960,7 +36932,7 @@ var ts;
36960
36932
  function parseModuleReference() {
36961
36933
  return isExternalModuleReference()
36962
36934
  ? parseExternalModuleReference()
36963
- : parseEntityName(/*allowReservedWords*/ false, /*allowPrivateIdentifiers*/ false);
36935
+ : parseEntityName(/*allowReservedWords*/ false);
36964
36936
  }
36965
36937
  function parseExternalModuleReference() {
36966
36938
  var pos = getNodePos();
@@ -37139,7 +37111,7 @@ var ts;
37139
37111
  else {
37140
37112
  parseExpected(88 /* DefaultKeyword */);
37141
37113
  }
37142
- var expression = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
37114
+ var expression = parseAssignmentExpressionOrHigher();
37143
37115
  parseSemicolon();
37144
37116
  setAwaitContext(savedAwaitContext);
37145
37117
  var node = factory.createExportAssignment(decorators, modifiers, isExportEquals, expression);
@@ -37213,7 +37185,7 @@ var ts;
37213
37185
  var pos = getNodePos();
37214
37186
  var hasBrace = parseOptional(18 /* OpenBraceToken */);
37215
37187
  var p2 = getNodePos();
37216
- var entityName = parseEntityName(/* allowReservedWords*/ false, /*allowPrivateIdentifiers*/ false);
37188
+ var entityName = parseEntityName(/* allowReservedWords*/ false);
37217
37189
  while (token() === 80 /* PrivateIdentifier */) {
37218
37190
  reScanHashToken(); // rescan #id as # id
37219
37191
  nextTokenJSDoc(); // then skip the #
@@ -37656,7 +37628,7 @@ var ts;
37656
37628
  // parseEntityName logs an error for non-identifier, so create a MissingNode ourselves to avoid the error
37657
37629
  var p2 = getNodePos();
37658
37630
  var name = ts.tokenIsIdentifierOrKeyword(token())
37659
- ? parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ false)
37631
+ ? parseEntityName(/*allowReservedWords*/ true)
37660
37632
  : undefined;
37661
37633
  if (name) {
37662
37634
  while (token() === 80 /* PrivateIdentifier */) {
@@ -38978,6 +38950,7 @@ var ts;
38978
38950
  ["es2021.intl", "lib.es2021.intl.d.ts"],
38979
38951
  ["es2022.array", "lib.es2022.array.d.ts"],
38980
38952
  ["es2022.error", "lib.es2022.error.d.ts"],
38953
+ ["es2022.intl", "lib.es2022.intl.d.ts"],
38981
38954
  ["es2022.object", "lib.es2022.object.d.ts"],
38982
38955
  ["es2022.string", "lib.es2022.string.d.ts"],
38983
38956
  ["esnext.array", "lib.es2022.array.d.ts"],
@@ -39192,7 +39165,6 @@ var ts;
39192
39165
  type: "boolean",
39193
39166
  affectsSemanticDiagnostics: true,
39194
39167
  affectsEmit: true,
39195
- affectsMultiFileEmitBuildInfo: true,
39196
39168
  category: ts.Diagnostics.Watch_and_Build_Modes,
39197
39169
  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,
39198
39170
  defaultValueDescription: false,
@@ -39227,40 +39199,12 @@ var ts;
39227
39199
  affectsSourceFile: true,
39228
39200
  affectsModuleResolution: true,
39229
39201
  affectsEmit: true,
39230
- affectsMultiFileEmitBuildInfo: true,
39231
39202
  paramType: ts.Diagnostics.VERSION,
39232
39203
  showInSimplifiedHelpView: true,
39233
39204
  category: ts.Diagnostics.Language_and_Environment,
39234
39205
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
39235
39206
  defaultValueDescription: 0 /* ES3 */,
39236
39207
  };
39237
- /*@internal*/
39238
- ts.moduleOptionDeclaration = {
39239
- name: "module",
39240
- shortName: "m",
39241
- type: new ts.Map(ts.getEntries({
39242
- none: ts.ModuleKind.None,
39243
- commonjs: ts.ModuleKind.CommonJS,
39244
- amd: ts.ModuleKind.AMD,
39245
- system: ts.ModuleKind.System,
39246
- umd: ts.ModuleKind.UMD,
39247
- es6: ts.ModuleKind.ES2015,
39248
- es2015: ts.ModuleKind.ES2015,
39249
- es2020: ts.ModuleKind.ES2020,
39250
- es2022: ts.ModuleKind.ES2022,
39251
- esnext: ts.ModuleKind.ESNext,
39252
- node12: ts.ModuleKind.Node12,
39253
- nodenext: ts.ModuleKind.NodeNext,
39254
- })),
39255
- affectsModuleResolution: true,
39256
- affectsEmit: true,
39257
- affectsMultiFileEmitBuildInfo: true,
39258
- paramType: ts.Diagnostics.KIND,
39259
- showInSimplifiedHelpView: true,
39260
- category: ts.Diagnostics.Modules,
39261
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
39262
- defaultValueDescription: undefined,
39263
- };
39264
39208
  var commandOptionsWithoutBuild = [
39265
39209
  // CommandLine only options
39266
39210
  {
@@ -39322,14 +39266,37 @@ var ts;
39322
39266
  category: ts.Diagnostics.Command_line_Options,
39323
39267
  affectsSemanticDiagnostics: true,
39324
39268
  affectsEmit: true,
39325
- affectsMultiFileEmitBuildInfo: true,
39326
39269
  isCommandLineOnly: true,
39327
39270
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
39328
39271
  defaultValueDescription: false,
39329
39272
  },
39330
39273
  // Basic
39331
39274
  ts.targetOptionDeclaration,
39332
- ts.moduleOptionDeclaration,
39275
+ {
39276
+ name: "module",
39277
+ shortName: "m",
39278
+ type: new ts.Map(ts.getEntries({
39279
+ none: ts.ModuleKind.None,
39280
+ commonjs: ts.ModuleKind.CommonJS,
39281
+ amd: ts.ModuleKind.AMD,
39282
+ system: ts.ModuleKind.System,
39283
+ umd: ts.ModuleKind.UMD,
39284
+ es6: ts.ModuleKind.ES2015,
39285
+ es2015: ts.ModuleKind.ES2015,
39286
+ es2020: ts.ModuleKind.ES2020,
39287
+ es2022: ts.ModuleKind.ES2022,
39288
+ esnext: ts.ModuleKind.ESNext,
39289
+ node16: ts.ModuleKind.Node16,
39290
+ nodenext: ts.ModuleKind.NodeNext,
39291
+ })),
39292
+ affectsModuleResolution: true,
39293
+ affectsEmit: true,
39294
+ paramType: ts.Diagnostics.KIND,
39295
+ showInSimplifiedHelpView: true,
39296
+ category: ts.Diagnostics.Modules,
39297
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
39298
+ defaultValueDescription: undefined,
39299
+ },
39333
39300
  {
39334
39301
  name: "lib",
39335
39302
  type: "list",
@@ -39366,7 +39333,6 @@ var ts;
39366
39333
  type: jsxOptionMap,
39367
39334
  affectsSourceFile: true,
39368
39335
  affectsEmit: true,
39369
- affectsMultiFileEmitBuildInfo: true,
39370
39336
  affectsModuleResolution: true,
39371
39337
  paramType: ts.Diagnostics.KIND,
39372
39338
  showInSimplifiedHelpView: true,
@@ -39379,7 +39345,6 @@ var ts;
39379
39345
  shortName: "d",
39380
39346
  type: "boolean",
39381
39347
  affectsEmit: true,
39382
- affectsMultiFileEmitBuildInfo: true,
39383
39348
  showInSimplifiedHelpView: true,
39384
39349
  category: ts.Diagnostics.Emit,
39385
39350
  transpileOptionValue: undefined,
@@ -39390,7 +39355,6 @@ var ts;
39390
39355
  name: "declarationMap",
39391
39356
  type: "boolean",
39392
39357
  affectsEmit: true,
39393
- affectsMultiFileEmitBuildInfo: true,
39394
39358
  showInSimplifiedHelpView: true,
39395
39359
  category: ts.Diagnostics.Emit,
39396
39360
  transpileOptionValue: undefined,
@@ -39401,7 +39365,6 @@ var ts;
39401
39365
  name: "emitDeclarationOnly",
39402
39366
  type: "boolean",
39403
39367
  affectsEmit: true,
39404
- affectsMultiFileEmitBuildInfo: true,
39405
39368
  showInSimplifiedHelpView: true,
39406
39369
  category: ts.Diagnostics.Emit,
39407
39370
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -39412,7 +39375,6 @@ var ts;
39412
39375
  name: "sourceMap",
39413
39376
  type: "boolean",
39414
39377
  affectsEmit: true,
39415
- affectsMultiFileEmitBuildInfo: true,
39416
39378
  showInSimplifiedHelpView: true,
39417
39379
  category: ts.Diagnostics.Emit,
39418
39380
  defaultValueDescription: false,
@@ -39422,9 +39384,6 @@ var ts;
39422
39384
  name: "outFile",
39423
39385
  type: "string",
39424
39386
  affectsEmit: true,
39425
- affectsMultiFileEmitBuildInfo: true,
39426
- affectsDeclarationPath: true,
39427
- affectsBundleEmitBuildInfo: true,
39428
39387
  isFilePath: true,
39429
39388
  paramType: ts.Diagnostics.FILE,
39430
39389
  showInSimplifiedHelpView: true,
@@ -39436,8 +39395,6 @@ var ts;
39436
39395
  name: "outDir",
39437
39396
  type: "string",
39438
39397
  affectsEmit: true,
39439
- affectsMultiFileEmitBuildInfo: true,
39440
- affectsDeclarationPath: true,
39441
39398
  isFilePath: true,
39442
39399
  paramType: ts.Diagnostics.DIRECTORY,
39443
39400
  showInSimplifiedHelpView: true,
@@ -39448,8 +39405,6 @@ var ts;
39448
39405
  name: "rootDir",
39449
39406
  type: "string",
39450
39407
  affectsEmit: true,
39451
- affectsMultiFileEmitBuildInfo: true,
39452
- affectsDeclarationPath: true,
39453
39408
  isFilePath: true,
39454
39409
  paramType: ts.Diagnostics.LOCATION,
39455
39410
  category: ts.Diagnostics.Modules,
@@ -39460,8 +39415,6 @@ var ts;
39460
39415
  name: "composite",
39461
39416
  type: "boolean",
39462
39417
  affectsEmit: true,
39463
- affectsMultiFileEmitBuildInfo: true,
39464
- affectsBundleEmitBuildInfo: true,
39465
39418
  isTSConfigOnly: true,
39466
39419
  category: ts.Diagnostics.Projects,
39467
39420
  transpileOptionValue: undefined,
@@ -39472,8 +39425,6 @@ var ts;
39472
39425
  name: "tsBuildInfoFile",
39473
39426
  type: "string",
39474
39427
  affectsEmit: true,
39475
- affectsMultiFileEmitBuildInfo: true,
39476
- affectsBundleEmitBuildInfo: true,
39477
39428
  isFilePath: true,
39478
39429
  paramType: ts.Diagnostics.FILE,
39479
39430
  category: ts.Diagnostics.Projects,
@@ -39485,7 +39436,6 @@ var ts;
39485
39436
  name: "removeComments",
39486
39437
  type: "boolean",
39487
39438
  affectsEmit: true,
39488
- affectsMultiFileEmitBuildInfo: true,
39489
39439
  showInSimplifiedHelpView: true,
39490
39440
  category: ts.Diagnostics.Emit,
39491
39441
  defaultValueDescription: false,
@@ -39504,7 +39454,6 @@ var ts;
39504
39454
  name: "importHelpers",
39505
39455
  type: "boolean",
39506
39456
  affectsEmit: true,
39507
- affectsMultiFileEmitBuildInfo: true,
39508
39457
  category: ts.Diagnostics.Emit,
39509
39458
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
39510
39459
  defaultValueDescription: false,
@@ -39518,7 +39467,6 @@ var ts;
39518
39467
  })),
39519
39468
  affectsEmit: true,
39520
39469
  affectsSemanticDiagnostics: true,
39521
- affectsMultiFileEmitBuildInfo: true,
39522
39470
  category: ts.Diagnostics.Emit,
39523
39471
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
39524
39472
  defaultValueDescription: 0 /* Remove */,
@@ -39527,7 +39475,6 @@ var ts;
39527
39475
  name: "downlevelIteration",
39528
39476
  type: "boolean",
39529
39477
  affectsEmit: true,
39530
- affectsMultiFileEmitBuildInfo: true,
39531
39478
  category: ts.Diagnostics.Emit,
39532
39479
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
39533
39480
  defaultValueDescription: false,
@@ -39546,9 +39493,6 @@ var ts;
39546
39493
  type: "boolean",
39547
39494
  // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
39548
39495
  // The value of each strictFlag depends on own strictFlag value or this and never accessed directly.
39549
- // But we need to store `strict` in builf info, even though it won't be examined directly, so that the
39550
- // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly
39551
- affectsMultiFileEmitBuildInfo: true,
39552
39496
  showInSimplifiedHelpView: true,
39553
39497
  category: ts.Diagnostics.Type_Checking,
39554
39498
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -39558,7 +39502,6 @@ var ts;
39558
39502
  name: "noImplicitAny",
39559
39503
  type: "boolean",
39560
39504
  affectsSemanticDiagnostics: true,
39561
- affectsMultiFileEmitBuildInfo: true,
39562
39505
  strictFlag: true,
39563
39506
  category: ts.Diagnostics.Type_Checking,
39564
39507
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -39568,7 +39511,6 @@ var ts;
39568
39511
  name: "strictNullChecks",
39569
39512
  type: "boolean",
39570
39513
  affectsSemanticDiagnostics: true,
39571
- affectsMultiFileEmitBuildInfo: true,
39572
39514
  strictFlag: true,
39573
39515
  category: ts.Diagnostics.Type_Checking,
39574
39516
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -39577,8 +39519,6 @@ var ts;
39577
39519
  {
39578
39520
  name: "strictFunctionTypes",
39579
39521
  type: "boolean",
39580
- affectsSemanticDiagnostics: true,
39581
- affectsMultiFileEmitBuildInfo: true,
39582
39522
  strictFlag: true,
39583
39523
  category: ts.Diagnostics.Type_Checking,
39584
39524
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -39587,8 +39527,6 @@ var ts;
39587
39527
  {
39588
39528
  name: "strictBindCallApply",
39589
39529
  type: "boolean",
39590
- affectsSemanticDiagnostics: true,
39591
- affectsMultiFileEmitBuildInfo: true,
39592
39530
  strictFlag: true,
39593
39531
  category: ts.Diagnostics.Type_Checking,
39594
39532
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -39598,7 +39536,6 @@ var ts;
39598
39536
  name: "strictPropertyInitialization",
39599
39537
  type: "boolean",
39600
39538
  affectsSemanticDiagnostics: true,
39601
- affectsMultiFileEmitBuildInfo: true,
39602
39539
  strictFlag: true,
39603
39540
  category: ts.Diagnostics.Type_Checking,
39604
39541
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -39608,7 +39545,6 @@ var ts;
39608
39545
  name: "noImplicitThis",
39609
39546
  type: "boolean",
39610
39547
  affectsSemanticDiagnostics: true,
39611
- affectsMultiFileEmitBuildInfo: true,
39612
39548
  strictFlag: true,
39613
39549
  category: ts.Diagnostics.Type_Checking,
39614
39550
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -39618,7 +39554,6 @@ var ts;
39618
39554
  name: "useUnknownInCatchVariables",
39619
39555
  type: "boolean",
39620
39556
  affectsSemanticDiagnostics: true,
39621
- affectsMultiFileEmitBuildInfo: true,
39622
39557
  strictFlag: true,
39623
39558
  category: ts.Diagnostics.Type_Checking,
39624
39559
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -39628,8 +39563,6 @@ var ts;
39628
39563
  name: "alwaysStrict",
39629
39564
  type: "boolean",
39630
39565
  affectsSourceFile: true,
39631
- affectsEmit: true,
39632
- affectsMultiFileEmitBuildInfo: true,
39633
39566
  strictFlag: true,
39634
39567
  category: ts.Diagnostics.Type_Checking,
39635
39568
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -39640,7 +39573,6 @@ var ts;
39640
39573
  name: "noUnusedLocals",
39641
39574
  type: "boolean",
39642
39575
  affectsSemanticDiagnostics: true,
39643
- affectsMultiFileEmitBuildInfo: true,
39644
39576
  category: ts.Diagnostics.Type_Checking,
39645
39577
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
39646
39578
  defaultValueDescription: false,
@@ -39649,7 +39581,6 @@ var ts;
39649
39581
  name: "noUnusedParameters",
39650
39582
  type: "boolean",
39651
39583
  affectsSemanticDiagnostics: true,
39652
- affectsMultiFileEmitBuildInfo: true,
39653
39584
  category: ts.Diagnostics.Type_Checking,
39654
39585
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
39655
39586
  defaultValueDescription: false,
@@ -39658,7 +39589,6 @@ var ts;
39658
39589
  name: "exactOptionalPropertyTypes",
39659
39590
  type: "boolean",
39660
39591
  affectsSemanticDiagnostics: true,
39661
- affectsMultiFileEmitBuildInfo: true,
39662
39592
  category: ts.Diagnostics.Type_Checking,
39663
39593
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
39664
39594
  defaultValueDescription: false,
@@ -39667,7 +39597,6 @@ var ts;
39667
39597
  name: "noImplicitReturns",
39668
39598
  type: "boolean",
39669
39599
  affectsSemanticDiagnostics: true,
39670
- affectsMultiFileEmitBuildInfo: true,
39671
39600
  category: ts.Diagnostics.Type_Checking,
39672
39601
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
39673
39602
  defaultValueDescription: false,
@@ -39677,7 +39606,6 @@ var ts;
39677
39606
  type: "boolean",
39678
39607
  affectsBindDiagnostics: true,
39679
39608
  affectsSemanticDiagnostics: true,
39680
- affectsMultiFileEmitBuildInfo: true,
39681
39609
  category: ts.Diagnostics.Type_Checking,
39682
39610
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
39683
39611
  defaultValueDescription: false,
@@ -39686,7 +39614,6 @@ var ts;
39686
39614
  name: "noUncheckedIndexedAccess",
39687
39615
  type: "boolean",
39688
39616
  affectsSemanticDiagnostics: true,
39689
- affectsMultiFileEmitBuildInfo: true,
39690
39617
  category: ts.Diagnostics.Type_Checking,
39691
39618
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
39692
39619
  defaultValueDescription: false,
@@ -39695,7 +39622,6 @@ var ts;
39695
39622
  name: "noImplicitOverride",
39696
39623
  type: "boolean",
39697
39624
  affectsSemanticDiagnostics: true,
39698
- affectsMultiFileEmitBuildInfo: true,
39699
39625
  category: ts.Diagnostics.Type_Checking,
39700
39626
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
39701
39627
  defaultValueDescription: false,
@@ -39703,8 +39629,6 @@ var ts;
39703
39629
  {
39704
39630
  name: "noPropertyAccessFromIndexSignature",
39705
39631
  type: "boolean",
39706
- affectsSemanticDiagnostics: true,
39707
- affectsMultiFileEmitBuildInfo: true,
39708
39632
  showInSimplifiedHelpView: false,
39709
39633
  category: ts.Diagnostics.Type_Checking,
39710
39634
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -39716,7 +39640,7 @@ var ts;
39716
39640
  type: new ts.Map(ts.getEntries({
39717
39641
  node: ts.ModuleResolutionKind.NodeJs,
39718
39642
  classic: ts.ModuleResolutionKind.Classic,
39719
- node12: ts.ModuleResolutionKind.Node12,
39643
+ node16: ts.ModuleResolutionKind.Node16,
39720
39644
  nodenext: ts.ModuleResolutionKind.NodeNext,
39721
39645
  })),
39722
39646
  affectsModuleResolution: true,
@@ -39790,7 +39714,6 @@ var ts;
39790
39714
  name: "allowSyntheticDefaultImports",
39791
39715
  type: "boolean",
39792
39716
  affectsSemanticDiagnostics: true,
39793
- affectsMultiFileEmitBuildInfo: true,
39794
39717
  category: ts.Diagnostics.Interop_Constraints,
39795
39718
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
39796
39719
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -39800,7 +39723,6 @@ var ts;
39800
39723
  type: "boolean",
39801
39724
  affectsSemanticDiagnostics: true,
39802
39725
  affectsEmit: true,
39803
- affectsMultiFileEmitBuildInfo: true,
39804
39726
  showInSimplifiedHelpView: true,
39805
39727
  category: ts.Diagnostics.Interop_Constraints,
39806
39728
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -39817,7 +39739,6 @@ var ts;
39817
39739
  name: "allowUmdGlobalAccess",
39818
39740
  type: "boolean",
39819
39741
  affectsSemanticDiagnostics: true,
39820
- affectsMultiFileEmitBuildInfo: true,
39821
39742
  category: ts.Diagnostics.Modules,
39822
39743
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
39823
39744
  defaultValueDescription: false,
@@ -39839,7 +39760,6 @@ var ts;
39839
39760
  name: "sourceRoot",
39840
39761
  type: "string",
39841
39762
  affectsEmit: true,
39842
- affectsMultiFileEmitBuildInfo: true,
39843
39763
  paramType: ts.Diagnostics.LOCATION,
39844
39764
  category: ts.Diagnostics.Emit,
39845
39765
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -39848,7 +39768,6 @@ var ts;
39848
39768
  name: "mapRoot",
39849
39769
  type: "string",
39850
39770
  affectsEmit: true,
39851
- affectsMultiFileEmitBuildInfo: true,
39852
39771
  paramType: ts.Diagnostics.LOCATION,
39853
39772
  category: ts.Diagnostics.Emit,
39854
39773
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -39857,7 +39776,6 @@ var ts;
39857
39776
  name: "inlineSourceMap",
39858
39777
  type: "boolean",
39859
39778
  affectsEmit: true,
39860
- affectsMultiFileEmitBuildInfo: true,
39861
39779
  category: ts.Diagnostics.Emit,
39862
39780
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
39863
39781
  defaultValueDescription: false,
@@ -39866,7 +39784,6 @@ var ts;
39866
39784
  name: "inlineSources",
39867
39785
  type: "boolean",
39868
39786
  affectsEmit: true,
39869
- affectsMultiFileEmitBuildInfo: true,
39870
39787
  category: ts.Diagnostics.Emit,
39871
39788
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
39872
39789
  defaultValueDescription: false,
@@ -39876,7 +39793,6 @@ var ts;
39876
39793
  name: "experimentalDecorators",
39877
39794
  type: "boolean",
39878
39795
  affectsSemanticDiagnostics: true,
39879
- affectsMultiFileEmitBuildInfo: true,
39880
39796
  category: ts.Diagnostics.Language_and_Environment,
39881
39797
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
39882
39798
  defaultValueDescription: false,
@@ -39886,7 +39802,6 @@ var ts;
39886
39802
  type: "boolean",
39887
39803
  affectsSemanticDiagnostics: true,
39888
39804
  affectsEmit: true,
39889
- affectsMultiFileEmitBuildInfo: true,
39890
39805
  category: ts.Diagnostics.Language_and_Environment,
39891
39806
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
39892
39807
  defaultValueDescription: false,
@@ -39911,7 +39826,6 @@ var ts;
39911
39826
  type: "string",
39912
39827
  affectsSemanticDiagnostics: true,
39913
39828
  affectsEmit: true,
39914
- affectsMultiFileEmitBuildInfo: true,
39915
39829
  affectsModuleResolution: true,
39916
39830
  category: ts.Diagnostics.Language_and_Environment,
39917
39831
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -39929,9 +39843,6 @@ var ts;
39929
39843
  name: "out",
39930
39844
  type: "string",
39931
39845
  affectsEmit: true,
39932
- affectsMultiFileEmitBuildInfo: true,
39933
- affectsDeclarationPath: true,
39934
- affectsBundleEmitBuildInfo: true,
39935
39846
  isFilePath: false,
39936
39847
  // for correct behaviour, please use outFile
39937
39848
  category: ts.Diagnostics.Backwards_Compatibility,
@@ -39943,7 +39854,6 @@ var ts;
39943
39854
  name: "reactNamespace",
39944
39855
  type: "string",
39945
39856
  affectsEmit: true,
39946
- affectsMultiFileEmitBuildInfo: true,
39947
39857
  category: ts.Diagnostics.Language_and_Environment,
39948
39858
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
39949
39859
  defaultValueDescription: "`React`",
@@ -39951,8 +39861,6 @@ var ts;
39951
39861
  {
39952
39862
  name: "skipDefaultLibCheck",
39953
39863
  type: "boolean",
39954
- // We need to store these to determine whether `lib` files need to be rechecked
39955
- affectsMultiFileEmitBuildInfo: true,
39956
39864
  category: ts.Diagnostics.Completeness,
39957
39865
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
39958
39866
  defaultValueDescription: false,
@@ -39968,7 +39876,6 @@ var ts;
39968
39876
  name: "emitBOM",
39969
39877
  type: "boolean",
39970
39878
  affectsEmit: true,
39971
- affectsMultiFileEmitBuildInfo: true,
39972
39879
  category: ts.Diagnostics.Emit,
39973
39880
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
39974
39881
  defaultValueDescription: false,
@@ -39980,7 +39887,6 @@ var ts;
39980
39887
  lf: 1 /* LineFeed */
39981
39888
  })),
39982
39889
  affectsEmit: true,
39983
- affectsMultiFileEmitBuildInfo: true,
39984
39890
  paramType: ts.Diagnostics.NEWLINE,
39985
39891
  category: ts.Diagnostics.Emit,
39986
39892
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -39990,7 +39896,6 @@ var ts;
39990
39896
  name: "noErrorTruncation",
39991
39897
  type: "boolean",
39992
39898
  affectsSemanticDiagnostics: true,
39993
- affectsMultiFileEmitBuildInfo: true,
39994
39899
  category: ts.Diagnostics.Output_Formatting,
39995
39900
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
39996
39901
  defaultValueDescription: false,
@@ -40021,7 +39926,6 @@ var ts;
40021
39926
  name: "stripInternal",
40022
39927
  type: "boolean",
40023
39928
  affectsEmit: true,
40024
- affectsMultiFileEmitBuildInfo: true,
40025
39929
  category: ts.Diagnostics.Emit,
40026
39930
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
40027
39931
  defaultValueDescription: false,
@@ -40062,7 +39966,6 @@ var ts;
40062
39966
  name: "noImplicitUseStrict",
40063
39967
  type: "boolean",
40064
39968
  affectsSemanticDiagnostics: true,
40065
- affectsMultiFileEmitBuildInfo: true,
40066
39969
  category: ts.Diagnostics.Backwards_Compatibility,
40067
39970
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
40068
39971
  defaultValueDescription: false,
@@ -40071,7 +39974,6 @@ var ts;
40071
39974
  name: "noEmitHelpers",
40072
39975
  type: "boolean",
40073
39976
  affectsEmit: true,
40074
- affectsMultiFileEmitBuildInfo: true,
40075
39977
  category: ts.Diagnostics.Emit,
40076
39978
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
40077
39979
  defaultValueDescription: false,
@@ -40080,7 +39982,6 @@ var ts;
40080
39982
  name: "noEmitOnError",
40081
39983
  type: "boolean",
40082
39984
  affectsEmit: true,
40083
- affectsMultiFileEmitBuildInfo: true,
40084
39985
  category: ts.Diagnostics.Emit,
40085
39986
  transpileOptionValue: undefined,
40086
39987
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -40090,7 +39991,6 @@ var ts;
40090
39991
  name: "preserveConstEnums",
40091
39992
  type: "boolean",
40092
39993
  affectsEmit: true,
40093
- affectsMultiFileEmitBuildInfo: true,
40094
39994
  category: ts.Diagnostics.Emit,
40095
39995
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
40096
39996
  defaultValueDescription: false,
@@ -40099,8 +39999,6 @@ var ts;
40099
39999
  name: "declarationDir",
40100
40000
  type: "string",
40101
40001
  affectsEmit: true,
40102
- affectsMultiFileEmitBuildInfo: true,
40103
- affectsDeclarationPath: true,
40104
40002
  isFilePath: true,
40105
40003
  paramType: ts.Diagnostics.DIRECTORY,
40106
40004
  category: ts.Diagnostics.Emit,
@@ -40110,8 +40008,6 @@ var ts;
40110
40008
  {
40111
40009
  name: "skipLibCheck",
40112
40010
  type: "boolean",
40113
- // We need to store these to determine whether `lib` files need to be rechecked
40114
- affectsMultiFileEmitBuildInfo: true,
40115
40011
  category: ts.Diagnostics.Completeness,
40116
40012
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
40117
40013
  defaultValueDescription: false,
@@ -40121,7 +40017,6 @@ var ts;
40121
40017
  type: "boolean",
40122
40018
  affectsBindDiagnostics: true,
40123
40019
  affectsSemanticDiagnostics: true,
40124
- affectsMultiFileEmitBuildInfo: true,
40125
40020
  category: ts.Diagnostics.Type_Checking,
40126
40021
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
40127
40022
  defaultValueDescription: undefined,
@@ -40131,7 +40026,6 @@ var ts;
40131
40026
  type: "boolean",
40132
40027
  affectsBindDiagnostics: true,
40133
40028
  affectsSemanticDiagnostics: true,
40134
- affectsMultiFileEmitBuildInfo: true,
40135
40029
  category: ts.Diagnostics.Type_Checking,
40136
40030
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
40137
40031
  defaultValueDescription: undefined,
@@ -40140,7 +40034,6 @@ var ts;
40140
40034
  name: "suppressExcessPropertyErrors",
40141
40035
  type: "boolean",
40142
40036
  affectsSemanticDiagnostics: true,
40143
- affectsMultiFileEmitBuildInfo: true,
40144
40037
  category: ts.Diagnostics.Backwards_Compatibility,
40145
40038
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
40146
40039
  defaultValueDescription: false,
@@ -40149,7 +40042,6 @@ var ts;
40149
40042
  name: "suppressImplicitAnyIndexErrors",
40150
40043
  type: "boolean",
40151
40044
  affectsSemanticDiagnostics: true,
40152
- affectsMultiFileEmitBuildInfo: true,
40153
40045
  category: ts.Diagnostics.Backwards_Compatibility,
40154
40046
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
40155
40047
  defaultValueDescription: false,
@@ -40174,7 +40066,6 @@ var ts;
40174
40066
  name: "noStrictGenericChecks",
40175
40067
  type: "boolean",
40176
40068
  affectsSemanticDiagnostics: true,
40177
- affectsMultiFileEmitBuildInfo: true,
40178
40069
  category: ts.Diagnostics.Backwards_Compatibility,
40179
40070
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
40180
40071
  defaultValueDescription: false,
@@ -40184,7 +40075,6 @@ var ts;
40184
40075
  type: "boolean",
40185
40076
  affectsSemanticDiagnostics: true,
40186
40077
  affectsEmit: true,
40187
- affectsMultiFileEmitBuildInfo: true,
40188
40078
  category: ts.Diagnostics.Language_and_Environment,
40189
40079
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
40190
40080
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -40193,7 +40083,6 @@ var ts;
40193
40083
  name: "preserveValueImports",
40194
40084
  type: "boolean",
40195
40085
  affectsEmit: true,
40196
- affectsMultiFileEmitBuildInfo: true,
40197
40086
  category: ts.Diagnostics.Emit,
40198
40087
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
40199
40088
  defaultValueDescription: false,
@@ -40227,7 +40116,7 @@ var ts;
40227
40116
  affectsModuleResolution: true,
40228
40117
  description: ts.Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
40229
40118
  category: ts.Diagnostics.Language_and_Environment,
40230
- defaultValueDescription: ts.Diagnostics.auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node12_as_modules,
40119
+ defaultValueDescription: ts.Diagnostics.auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules,
40231
40120
  }
40232
40121
  ];
40233
40122
  /* @internal */
@@ -40237,8 +40126,6 @@ var ts;
40237
40126
  /* @internal */
40238
40127
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
40239
40128
  /* @internal */
40240
- ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
40241
- /* @internal */
40242
40129
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
40243
40130
  /* @internal */
40244
40131
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -41094,7 +40981,6 @@ var ts;
41094
40981
  return optionDefinition.type;
41095
40982
  }
41096
40983
  }
41097
- /* @internal */
41098
40984
  function getNameOfCompilerOptionValue(value, customTypeMap) {
41099
40985
  // There is a typeMap associated with this command-line option so use it to map value back to its name
41100
40986
  return ts.forEachEntry(customTypeMap, function (mapValue, key) {
@@ -41103,7 +40989,6 @@ var ts;
41103
40989
  }
41104
40990
  });
41105
40991
  }
41106
- ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
41107
40992
  function serializeCompilerOptions(options, pathOptions) {
41108
40993
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
41109
40994
  }
@@ -42264,7 +42149,7 @@ var ts;
42264
42149
  ts.Debug.assert(ts.extensionIsTS(resolved.extension));
42265
42150
  return { fileName: resolved.path, packageId: resolved.packageId };
42266
42151
  }
42267
- function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, resultFromCache) {
42152
+ function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, diagnostics, resultFromCache) {
42268
42153
  var _a;
42269
42154
  if (resultFromCache) {
42270
42155
  (_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
@@ -42272,7 +42157,8 @@ var ts;
42272
42157
  }
42273
42158
  return {
42274
42159
  resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
42275
- failedLookupLocations: failedLookupLocations
42160
+ failedLookupLocations: failedLookupLocations,
42161
+ resolutionDiagnostics: diagnostics
42276
42162
  };
42277
42163
  }
42278
42164
  function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
@@ -42467,13 +42353,24 @@ var ts;
42467
42353
  // set in a non-modal module resolution setting here. Do note that our behavior is not particularly well defined when these mode-overriding imports
42468
42354
  // are present in a non-modal project; while in theory we'd like to either ignore the mode or provide faithful modern resolution, depending on what we feel is best,
42469
42355
  // in practice, not every cache has the options available to intelligently make the choice to ignore the mode request, and it's unclear how modern "faithful modern
42470
- // resolution" should be (`node12`? `nodenext`?). As such, witnessing a mode-overriding triple-slash reference in a non-modal module resolution
42356
+ // resolution" should be (`node16`? `nodenext`?). As such, witnessing a mode-overriding triple-slash reference in a non-modal module resolution
42471
42357
  // context should _probably_ be an error - and that should likely be handled by the `Program` (which is what we do).
42472
- if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext)) {
42358
+ if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext)) {
42473
42359
  features |= NodeResolutionFeatures.EsmMode;
42474
42360
  }
42475
42361
  var conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : [];
42476
- var moduleResolutionState = { compilerOptions: options, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: features, conditions: conditions };
42362
+ var diagnostics = [];
42363
+ var moduleResolutionState = {
42364
+ compilerOptions: options,
42365
+ host: host,
42366
+ traceEnabled: traceEnabled,
42367
+ failedLookupLocations: failedLookupLocations,
42368
+ packageJsonInfoCache: cache,
42369
+ features: features,
42370
+ conditions: conditions,
42371
+ requestContainingDirectory: containingDirectory,
42372
+ reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
42373
+ };
42477
42374
  var resolved = primaryLookup();
42478
42375
  var primary = true;
42479
42376
  if (!resolved) {
@@ -42492,7 +42389,7 @@ var ts;
42492
42389
  isExternalLibraryImport: pathContainsNodeModules(fileName),
42493
42390
  };
42494
42391
  }
42495
- result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
42392
+ result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, resolutionDiagnostics: diagnostics };
42496
42393
  perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, /*mode*/ resolutionMode, result);
42497
42394
  if (traceEnabled)
42498
42395
  traceResult(result);
@@ -42558,7 +42455,7 @@ var ts;
42558
42455
  }
42559
42456
  ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
42560
42457
  function getDefaultNodeResolutionFeatures(options) {
42561
- return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 ? NodeResolutionFeatures.Node12Default :
42458
+ return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 ? NodeResolutionFeatures.Node16Default :
42562
42459
  ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault :
42563
42460
  NodeResolutionFeatures.None;
42564
42461
  }
@@ -42575,6 +42472,8 @@ var ts;
42575
42472
  packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
42576
42473
  conditions: ts.emptyArray,
42577
42474
  features: NodeResolutionFeatures.None,
42475
+ requestContainingDirectory: containingDirectory,
42476
+ reportDiagnostic: ts.noop
42578
42477
  };
42579
42478
  return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
42580
42479
  if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
@@ -42916,8 +42815,8 @@ var ts;
42916
42815
  case ts.ModuleKind.CommonJS:
42917
42816
  moduleResolution = ts.ModuleResolutionKind.NodeJs;
42918
42817
  break;
42919
- case ts.ModuleKind.Node12:
42920
- moduleResolution = ts.ModuleResolutionKind.Node12;
42818
+ case ts.ModuleKind.Node16:
42819
+ moduleResolution = ts.ModuleResolutionKind.Node16;
42921
42820
  break;
42922
42821
  case ts.ModuleKind.NodeNext:
42923
42822
  moduleResolution = ts.ModuleResolutionKind.NodeNext;
@@ -42937,8 +42836,8 @@ var ts;
42937
42836
  }
42938
42837
  ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
42939
42838
  switch (moduleResolution) {
42940
- case ts.ModuleResolutionKind.Node12:
42941
- result = node12ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
42839
+ case ts.ModuleResolutionKind.Node16:
42840
+ result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
42942
42841
  break;
42943
42842
  case ts.ModuleResolutionKind.NodeNext:
42944
42843
  result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
@@ -43172,15 +43071,15 @@ var ts;
43172
43071
  // respecting the `.exports` member of packages' package.json files and its (conditional) mappings of export names
43173
43072
  NodeResolutionFeatures[NodeResolutionFeatures["Exports"] = 8] = "Exports";
43174
43073
  // allowing `*` in the LHS of an export to be followed by more content, eg `"./whatever/*.js"`
43175
- // not currently backported to node 12 - https://github.com/nodejs/Release/issues/690
43074
+ // not supported in node 12 - https://github.com/nodejs/Release/issues/690
43176
43075
  NodeResolutionFeatures[NodeResolutionFeatures["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
43177
43076
  NodeResolutionFeatures[NodeResolutionFeatures["AllFeatures"] = 30] = "AllFeatures";
43178
- NodeResolutionFeatures[NodeResolutionFeatures["Node12Default"] = 14] = "Node12Default";
43077
+ NodeResolutionFeatures[NodeResolutionFeatures["Node16Default"] = 30] = "Node16Default";
43179
43078
  NodeResolutionFeatures[NodeResolutionFeatures["NodeNextDefault"] = 30] = "NodeNextDefault";
43180
43079
  NodeResolutionFeatures[NodeResolutionFeatures["EsmMode"] = 32] = "EsmMode";
43181
43080
  })(NodeResolutionFeatures || (NodeResolutionFeatures = {}));
43182
- function node12ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
43183
- return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Node12Default, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
43081
+ function node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
43082
+ return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Node16Default, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
43184
43083
  }
43185
43084
  function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
43186
43085
  return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
@@ -43220,12 +43119,13 @@ var ts;
43220
43119
  var _a, _b;
43221
43120
  var traceEnabled = isTraceEnabled(compilerOptions, host);
43222
43121
  var failedLookupLocations = [];
43223
- // conditions are only used by the node12/nodenext resolver - there's no priority order in the list,
43122
+ // conditions are only used by the node16/nodenext resolver - there's no priority order in the list,
43224
43123
  //it's essentially a set (priority is determined by object insertion order in the object we look at).
43225
43124
  var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
43226
43125
  if (compilerOptions.noDtsResolution) {
43227
43126
  conditions.pop();
43228
43127
  }
43128
+ var diagnostics = [];
43229
43129
  var state = {
43230
43130
  compilerOptions: compilerOptions,
43231
43131
  host: host,
@@ -43234,9 +43134,11 @@ var ts;
43234
43134
  packageJsonInfoCache: cache,
43235
43135
  features: features,
43236
43136
  conditions: conditions,
43137
+ requestContainingDirectory: containingDirectory,
43138
+ reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
43237
43139
  };
43238
43140
  var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
43239
- return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, state.resultFromCache);
43141
+ return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, diagnostics, state.resultFromCache);
43240
43142
  function tryResolve(extensions) {
43241
43143
  var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, /*considerPackageJson*/ true); };
43242
43144
  var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
@@ -43409,9 +43311,9 @@ var ts;
43409
43311
  }
43410
43312
  }
43411
43313
  function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
43412
- if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.isDeclarationFileName(candidate)) {
43314
+ if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.fileExtensionIsOneOf(candidate, ts.supportedTSExtensionsFlat)) {
43413
43315
  var result = tryFile(candidate, onlyRecordFailures, state);
43414
- return result !== undefined ? { path: candidate, ext: ts.forEach(ts.supportedDeclarationExtensions, function (e) { return ts.fileExtensionIs(candidate, e) ? e : undefined; }) } : undefined;
43316
+ return result !== undefined ? { path: candidate, ext: ts.tryExtractTSExtension(candidate) } : undefined;
43415
43317
  }
43416
43318
  return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
43417
43319
  }
@@ -43534,6 +43436,8 @@ var ts;
43534
43436
  packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
43535
43437
  conditions: ["node", "require", "types"],
43536
43438
  features: features,
43439
+ requestContainingDirectory: packageJsonInfo.packageDirectory,
43440
+ reportDiagnostic: ts.noop
43537
43441
  };
43538
43442
  var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory,
43539
43443
  /*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
@@ -43620,6 +43524,8 @@ var ts;
43620
43524
  packageJsonInfoCache: packageJsonInfoCache,
43621
43525
  features: 0,
43622
43526
  conditions: [],
43527
+ requestContainingDirectory: undefined,
43528
+ reportDiagnostic: ts.noop
43623
43529
  };
43624
43530
  var parts = ts.getPathComponents(fileName);
43625
43531
  parts.pop();
@@ -43911,7 +43817,6 @@ var ts;
43911
43817
  function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
43912
43818
  return loadModuleFromTargetImportOrExport;
43913
43819
  function loadModuleFromTargetImportOrExport(target, subpath, pattern) {
43914
- var _a, _b;
43915
43820
  if (typeof target === "string") {
43916
43821
  if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) {
43917
43822
  if (state.traceEnabled) {
@@ -43948,13 +43853,16 @@ var ts;
43948
43853
  }
43949
43854
  return toSearchResult(/*value*/ undefined);
43950
43855
  }
43951
- var finalPath = ts.getNormalizedAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
43856
+ var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath);
43857
+ var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports);
43858
+ if (inputLink)
43859
+ return inputLink;
43952
43860
  return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, finalPath, /*onlyRecordFailures*/ false, state)));
43953
43861
  }
43954
43862
  else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null
43955
43863
  if (!Array.isArray(target)) {
43956
- for (var _i = 0, _c = ts.getOwnKeys(target); _i < _c.length; _i++) {
43957
- var key = _c[_i];
43864
+ for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) {
43865
+ var key = _a[_i];
43958
43866
  if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) {
43959
43867
  var subTarget = target[key];
43960
43868
  var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern);
@@ -43972,8 +43880,8 @@ var ts;
43972
43880
  }
43973
43881
  return toSearchResult(/*value*/ undefined);
43974
43882
  }
43975
- for (var _d = 0, target_2 = target; _d < target_2.length; _d++) {
43976
- var elem = target_2[_d];
43883
+ for (var _b = 0, target_2 = target; _b < target_2.length; _b++) {
43884
+ var elem = target_2[_b];
43977
43885
  var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
43978
43886
  if (result) {
43979
43887
  return result;
@@ -43991,6 +43899,128 @@ var ts;
43991
43899
  trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
43992
43900
  }
43993
43901
  return toSearchResult(/*value*/ undefined);
43902
+ function toAbsolutePath(path) {
43903
+ var _a, _b;
43904
+ if (path === undefined)
43905
+ return path;
43906
+ return ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames })(ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)));
43907
+ }
43908
+ function combineDirectoryPath(root, dir) {
43909
+ return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
43910
+ }
43911
+ function useCaseSensitiveFileNames() {
43912
+ return !state.host.useCaseSensitiveFileNames ? true :
43913
+ typeof state.host.useCaseSensitiveFileNames === "boolean" ? state.host.useCaseSensitiveFileNames :
43914
+ state.host.useCaseSensitiveFileNames();
43915
+ }
43916
+ function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports) {
43917
+ var _a, _b, _c, _d;
43918
+ // Replace any references to outputs for files in the program with the input files to support package self-names used with outDir
43919
+ // PROBLEM: We don't know how to calculate the output paths yet, because the "common source directory" we use as the base of the file structure
43920
+ // we reproduce into the output directory is based on the set of input files, which we're still in the process of traversing and resolving!
43921
+ // _Given that_, we have to guess what the base of the output directory is (obviously the user wrote the export map, so has some idea what it is!).
43922
+ // We are going to probe _so many_ possible paths. We limit where we'll do this to try to reduce the possibilities of false positive lookups.
43923
+ if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
43924
+ && (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
43925
+ && finalPath.indexOf("/node_modules/") === -1
43926
+ && (state.compilerOptions.configFile ? ts.startsWith(toAbsolutePath(state.compilerOptions.configFile.fileName), scope.packageDirectory) : true)) {
43927
+ // So that all means we'll only try these guesses for files outside `node_modules` in a directory where the `package.json` and `tsconfig.json` are siblings.
43928
+ // Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
43929
+ // `.`, `./src` or any other deeper directory structure. (If project references are used, it's definitely `.` by fiat, so that should be pretty common.)
43930
+ var getCanonicalFileName = ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames });
43931
+ var commonSourceDirGuesses = [];
43932
+ // A `rootDir` compiler option strongly indicates the root location
43933
+ // A `composite` project is using project references and has it's common src dir set to `.`, so it shouldn't need to check any other locations
43934
+ if (state.compilerOptions.rootDir || (state.compilerOptions.composite && state.compilerOptions.configFilePath)) {
43935
+ var commonDir = toAbsolutePath(ts.getCommonSourceDirectory(state.compilerOptions, function () { return []; }, ((_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)) || "", getCanonicalFileName));
43936
+ commonSourceDirGuesses.push(commonDir);
43937
+ }
43938
+ else if (state.requestContainingDirectory) {
43939
+ // However without either of those set we're in the dark. Let's say you have
43940
+ //
43941
+ // ./tools/index.ts
43942
+ // ./src/index.ts
43943
+ // ./dist/index.js
43944
+ // ./package.json <-- references ./dist/index.js
43945
+ // ./tsconfig.json <-- loads ./src/index.ts
43946
+ //
43947
+ // How do we know `./src` is the common src dir, and not `./tools`, given only the `./dist` out dir and `./dist/index.js` filename?
43948
+ // Answer: We... don't. We know we're looking for an `index.ts` input file, but we have _no clue_ which subfolder it's supposed to be loaded from
43949
+ // without more context.
43950
+ // But we do have more context! Just a tiny bit more! We're resolving an import _for some other input file_! And that input file, too
43951
+ // must be inside the common source directory! So we propagate that tidbit of info all the way to here via state.requestContainingDirectory
43952
+ var requestingFile_1 = toAbsolutePath(ts.combinePaths(state.requestContainingDirectory, "index.ts"));
43953
+ // And we can try every folder above the common folder for the request folder and the config/package base directory
43954
+ // This technically can be wrong - we may load ./src/index.ts when ./src/sub/index.ts was right because we don't
43955
+ // know if only `./src/sub` files were loaded by the program; but this has the best chance to be right of just about anything
43956
+ // else we have. And, given that we're about to load `./src/index.ts` because we choose it as likely correct, there will then
43957
+ // be a file outside of `./src/sub` in the program (the file we resolved to), making us de-facto right. So this fallback lookup
43958
+ // logic may influence what files are pulled in by self-names, which in turn influences the output path shape, but it's all
43959
+ // internally consistent so the paths should be stable so long as we prefer the "most general" (meaning: top-most-level directory) possible results first.
43960
+ var commonDir = toAbsolutePath(ts.getCommonSourceDirectory(state.compilerOptions, function () { return [requestingFile_1, toAbsolutePath(packagePath)]; }, ((_d = (_c = state.host).getCurrentDirectory) === null || _d === void 0 ? void 0 : _d.call(_c)) || "", getCanonicalFileName));
43961
+ commonSourceDirGuesses.push(commonDir);
43962
+ var fragment = ts.ensureTrailingDirectorySeparator(commonDir);
43963
+ while (fragment && fragment.length > 1) {
43964
+ var parts = ts.getPathComponents(fragment);
43965
+ parts.pop(); // remove a directory
43966
+ var commonDir_1 = ts.getPathFromPathComponents(parts);
43967
+ commonSourceDirGuesses.unshift(commonDir_1);
43968
+ fragment = ts.ensureTrailingDirectorySeparator(commonDir_1);
43969
+ }
43970
+ }
43971
+ if (commonSourceDirGuesses.length > 1) {
43972
+ state.reportDiagnostic(ts.createCompilerDiagnostic(isImports
43973
+ ? ts.Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate
43974
+ : ts.Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate, entry === "" ? "." : entry, // replace empty string with `.` - the reverse of the operation done when entries are built - so main entrypoint errors don't look weird
43975
+ packagePath));
43976
+ }
43977
+ for (var _i = 0, commonSourceDirGuesses_1 = commonSourceDirGuesses; _i < commonSourceDirGuesses_1.length; _i++) {
43978
+ var commonSourceDirGuess = commonSourceDirGuesses_1[_i];
43979
+ var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
43980
+ for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
43981
+ var candidateDir = candidateDirectories_1[_e];
43982
+ if (ts.startsWith(finalPath, candidateDir)) {
43983
+ // The matched export is looking up something in either the out declaration or js dir, now map the written path back into the source dir and source extension
43984
+ var pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
43985
+ var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
43986
+ var jsAndDtsExtensions = [".mjs" /* Mjs */, ".cjs" /* Cjs */, ".js" /* Js */, ".json" /* Json */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */, ".d.ts" /* Dts */];
43987
+ for (var _f = 0, jsAndDtsExtensions_1 = jsAndDtsExtensions; _f < jsAndDtsExtensions_1.length; _f++) {
43988
+ var ext = jsAndDtsExtensions_1[_f];
43989
+ if (ts.fileExtensionIs(possibleInputBase, ext)) {
43990
+ var inputExts = ts.getPossibleOriginalInputExtensionForExtension(possibleInputBase);
43991
+ for (var _g = 0, inputExts_1 = inputExts; _g < inputExts_1.length; _g++) {
43992
+ var possibleExt = inputExts_1[_g];
43993
+ var possibleInputWithInputExtension = ts.changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
43994
+ if ((extensions === Extensions.TypeScript && ts.hasJSFileExtension(possibleInputWithInputExtension)) ||
43995
+ (extensions === Extensions.JavaScript && ts.hasTSFileExtension(possibleInputWithInputExtension))) {
43996
+ continue;
43997
+ }
43998
+ if (state.host.fileExists(possibleInputWithInputExtension)) {
43999
+ return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, possibleInputWithInputExtension, /*onlyRecordFailures*/ false, state)));
44000
+ }
44001
+ }
44002
+ }
44003
+ }
44004
+ }
44005
+ }
44006
+ }
44007
+ }
44008
+ return undefined;
44009
+ function getOutputDirectoriesForBaseDirectory(commonSourceDirGuess) {
44010
+ var _a, _b;
44011
+ // Config file ouput paths are processed to be relative to the host's current directory, while
44012
+ // otherwise the paths are resolved relative to the common source dir the compiler puts together
44013
+ var currentDir = state.compilerOptions.configFile ? ((_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)) || "" : commonSourceDirGuess;
44014
+ var candidateDirectories = [];
44015
+ if (state.compilerOptions.declarationDir) {
44016
+ candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.declarationDir)));
44017
+ }
44018
+ if (state.compilerOptions.outDir && state.compilerOptions.outDir !== state.compilerOptions.declarationDir) {
44019
+ candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.outDir)));
44020
+ }
44021
+ return candidateDirectories;
44022
+ }
44023
+ }
43994
44024
  }
43995
44025
  }
43996
44026
  /* @internal */
@@ -44181,11 +44211,12 @@ var ts;
44181
44211
  function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
44182
44212
  var traceEnabled = isTraceEnabled(compilerOptions, host);
44183
44213
  var failedLookupLocations = [];
44184
- var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.None, conditions: [] };
44185
44214
  var containingDirectory = ts.getDirectoryPath(containingFile);
44215
+ var diagnostics = [];
44216
+ var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.None, conditions: [], requestContainingDirectory: containingDirectory, reportDiagnostic: function (diag) { return void diagnostics.push(diag); } };
44186
44217
  var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
44187
44218
  // No originalPath because classic resolution doesn't resolve realPath
44188
- return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations, state.resultFromCache);
44219
+ return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations, diagnostics, state.resultFromCache);
44189
44220
  function tryResolve(extensions) {
44190
44221
  var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
44191
44222
  if (resolvedUsingSettings) {
@@ -44228,9 +44259,10 @@ var ts;
44228
44259
  trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, projectName, moduleName, globalCache);
44229
44260
  }
44230
44261
  var failedLookupLocations = [];
44231
- var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: packageJsonInfoCache, features: NodeResolutionFeatures.None, conditions: [] };
44262
+ var diagnostics = [];
44263
+ var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: packageJsonInfoCache, features: NodeResolutionFeatures.None, conditions: [], requestContainingDirectory: undefined, reportDiagnostic: function (diag) { return void diagnostics.push(diag); } };
44232
44264
  var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, /*typesScopeOnly*/ false, /*cache*/ undefined, /*redirectedReference*/ undefined);
44233
- return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations, state.resultFromCache);
44265
+ return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations, diagnostics, state.resultFromCache);
44234
44266
  }
44235
44267
  ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
44236
44268
  /**
@@ -48607,7 +48639,7 @@ var ts;
48607
48639
  var enumRelation = new ts.Map();
48608
48640
  var builtinGlobals = ts.createSymbolTable();
48609
48641
  builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
48610
- // Extensions suggested for path imports when module resolution is node12 or higher.
48642
+ // Extensions suggested for path imports when module resolution is node16 or higher.
48611
48643
  // The first element of each tuple is the extension a file has.
48612
48644
  // The second element of each tuple is the extension that should be used in a path import.
48613
48645
  // e.g. if we want to import file `foo.mts`, we should write `import {} from "./foo.mjs".
@@ -50896,7 +50928,7 @@ var ts;
50896
50928
  if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
50897
50929
  errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
50898
50930
  }
50899
- if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
50931
+ if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
50900
50932
  var isSyncImport = (currentSourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS && !ts.findAncestor(location, ts.isImportCall)) || !!ts.findAncestor(location, ts.isImportEqualsDeclaration);
50901
50933
  var overrideClauseHost = ts.findAncestor(location, function (l) { return ts.isImportTypeNode(l) || ts.isExportDeclaration(l) || ts.isImportDeclaration(l); });
50902
50934
  var overrideClause = overrideClauseHost && ts.isImportTypeNode(overrideClauseHost) ? (_g = overrideClauseHost.assertions) === null || _g === void 0 ? void 0 : _g.assertClause : overrideClauseHost === null || overrideClauseHost === void 0 ? void 0 : overrideClauseHost.assertClause;
@@ -50905,9 +50937,6 @@ var ts;
50905
50937
  if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
50906
50938
  error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference);
50907
50939
  }
50908
- if (mode === ts.ModuleKind.ESNext && compilerOptions.resolveJsonModule && resolvedModule.extension === ".json" /* Json */) {
50909
- error(errorNode, ts.Diagnostics.JSON_imports_are_experimental_in_ES_module_mode_imports);
50910
- }
50911
50940
  }
50912
50941
  // merged symbol is module declaration symbol combined with all augmentations
50913
50942
  return getMergedSymbol(sourceFile.symbol);
@@ -50960,7 +50989,7 @@ var ts;
50960
50989
  var tsExtension = ts.tryExtractTSExtension(moduleReference);
50961
50990
  var isExtensionlessRelativePathImport = ts.pathIsRelative(moduleReference) && !ts.hasExtension(moduleReference);
50962
50991
  var moduleResolutionKind = ts.getEmitModuleResolutionKind(compilerOptions);
50963
- var resolutionIsNode12OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node12 ||
50992
+ var resolutionIsNode16OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node16 ||
50964
50993
  moduleResolutionKind === ts.ModuleResolutionKind.NodeNext;
50965
50994
  if (tsExtension) {
50966
50995
  var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
@@ -50981,17 +51010,17 @@ var ts;
50981
51010
  ts.hasJsonModuleEmitEnabled(compilerOptions)) {
50982
51011
  error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
50983
51012
  }
50984
- else if (mode === ts.ModuleKind.ESNext && resolutionIsNode12OrNext && isExtensionlessRelativePathImport) {
51013
+ else if (mode === ts.ModuleKind.ESNext && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
50985
51014
  var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
50986
51015
  var suggestedExt = (_h = suggestedExtensions.find(function (_a) {
50987
51016
  var actualExt = _a[0], _importExt = _a[1];
50988
51017
  return host.fileExists(absoluteRef_1 + actualExt);
50989
51018
  })) === null || _h === void 0 ? void 0 : _h[1];
50990
51019
  if (suggestedExt) {
50991
- error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
51020
+ error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
50992
51021
  }
50993
51022
  else {
50994
- error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path);
51023
+ error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
50995
51024
  }
50996
51025
  }
50997
51026
  else {
@@ -53313,7 +53342,7 @@ var ts;
53313
53342
  var targetFile = ts.getSourceFileOfModule(chain[0]);
53314
53343
  var specifier = void 0;
53315
53344
  var assertion = void 0;
53316
- if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
53345
+ if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
53317
53346
  // An `import` type directed at an esm format file is only going to resolve in esm mode - set the esm mode assertion
53318
53347
  if ((targetFile === null || targetFile === void 0 ? void 0 : targetFile.impliedNodeFormat) === ts.ModuleKind.ESNext && targetFile.impliedNodeFormat !== (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat)) {
53319
53348
  specifier = getSpecifierForModuleSymbol(chain[0], context, ts.ModuleKind.ESNext);
@@ -53327,7 +53356,7 @@ var ts;
53327
53356
  }
53328
53357
  if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Classic && specifier.indexOf("/node_modules/") >= 0) {
53329
53358
  var oldSpecifier = specifier;
53330
- if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
53359
+ if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
53331
53360
  // We might be able to write a portable import type using a mode override; try specifier generation again, but with a different mode set
53332
53361
  var swappedMode = (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat) === ts.ModuleKind.ESNext ? ts.ModuleKind.CommonJS : ts.ModuleKind.ESNext;
53333
53362
  specifier = getSpecifierForModuleSymbol(chain[0], context, swappedMode);
@@ -58097,7 +58126,8 @@ var ts;
58097
58126
  if (symbol === globalThisSymbol) {
58098
58127
  var varsOnly_1 = new ts.Map();
58099
58128
  members.forEach(function (p) {
58100
- if (!(p.flags & 418 /* BlockScoped */)) {
58129
+ var _a;
58130
+ if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a = p.declarations) === null || _a === void 0 ? void 0 : _a.length) && ts.every(p.declarations, ts.isAmbientModule))) {
58101
58131
  varsOnly_1.set(p.escapedName, p);
58102
58132
  }
58103
58133
  });
@@ -64804,7 +64834,6 @@ var ts;
64804
64834
  return 0 /* False */;
64805
64835
  }
64806
64836
  function reportErrorResults(originalSource, originalTarget, source, target, headMessage) {
64807
- var _a, _b;
64808
64837
  var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
64809
64838
  var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
64810
64839
  source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
@@ -64845,9 +64874,6 @@ var ts;
64845
64874
  return;
64846
64875
  }
64847
64876
  reportRelationError(headMessage, source, target);
64848
- if (strictNullChecks && source.flags & 8650752 /* TypeVariable */ && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source) && isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */))) {
64849
- associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_probably_needs_an_extends_object_constraint));
64850
- }
64851
64877
  }
64852
64878
  function traceUnionsOrIntersectionsTooLarge(source, target) {
64853
64879
  if (!ts.tracing) {
@@ -65620,7 +65646,7 @@ var ts;
65620
65646
  // IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
65621
65647
  if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
65622
65648
  var constraint = getConstraintOfType(source);
65623
- if (!strictNullChecks && (!constraint || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */))) {
65649
+ if (!constraint || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
65624
65650
  // A type variable with no constraint is not related to the non-primitive object type.
65625
65651
  if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
65626
65652
  resetErrorInfo(saveErrorInfo);
@@ -65628,12 +65654,12 @@ var ts;
65628
65654
  }
65629
65655
  }
65630
65656
  // hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed
65631
- else if (constraint && (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState))) {
65657
+ else if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
65632
65658
  resetErrorInfo(saveErrorInfo);
65633
65659
  return result;
65634
65660
  }
65635
65661
  // slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
65636
- else if (constraint && (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState))) {
65662
+ else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
65637
65663
  resetErrorInfo(saveErrorInfo);
65638
65664
  return result;
65639
65665
  }
@@ -71296,7 +71322,7 @@ var ts;
71296
71322
  if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
71297
71323
  var parent = declaration.parent.parent;
71298
71324
  if (parent.kind === 254 /* VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || parent.kind === 164 /* Parameter */) {
71299
- var links = getNodeLinks(location);
71325
+ var links = getNodeLinks(parent);
71300
71326
  if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
71301
71327
  links.flags |= 268435456 /* InCheckIdentifier */;
71302
71328
  var parentType = getTypeForBindingElementParent(parent, 0 /* Normal */);
@@ -77159,13 +77185,13 @@ var ts;
77159
77185
  }
77160
77186
  }
77161
77187
  function checkImportMetaProperty(node) {
77162
- if (moduleKind === ts.ModuleKind.Node12 || moduleKind === ts.ModuleKind.NodeNext) {
77188
+ if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
77163
77189
  if (ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.ESNext) {
77164
77190
  error(node, ts.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
77165
77191
  }
77166
77192
  }
77167
77193
  else if (moduleKind < ts.ModuleKind.ES2020 && moduleKind !== ts.ModuleKind.System) {
77168
- error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node12_or_nodenext);
77194
+ error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext);
77169
77195
  }
77170
77196
  var file = ts.getSourceFileOfNode(node);
77171
77197
  ts.Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
@@ -78116,15 +78142,30 @@ var ts;
78116
78142
  if (!hasParseDiagnostics(sourceFile)) {
78117
78143
  var span = void 0;
78118
78144
  if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
78119
- if (!span)
78120
- span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
78145
+ span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
78121
78146
  var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module);
78122
78147
  diagnostics.add(diagnostic);
78123
78148
  }
78124
- if ((moduleKind !== ts.ModuleKind.ES2022 && moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System && !(moduleKind === ts.ModuleKind.NodeNext && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.ESNext)) || languageVersion < 4 /* ES2017 */) {
78125
- span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
78126
- var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher);
78127
- diagnostics.add(diagnostic);
78149
+ switch (moduleKind) {
78150
+ case ts.ModuleKind.Node16:
78151
+ case ts.ModuleKind.NodeNext:
78152
+ if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
78153
+ span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
78154
+ diagnostics.add(ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level));
78155
+ break;
78156
+ }
78157
+ // fallthrough
78158
+ case ts.ModuleKind.ES2022:
78159
+ case ts.ModuleKind.ESNext:
78160
+ case ts.ModuleKind.System:
78161
+ if (languageVersion >= 4 /* ES2017 */) {
78162
+ break;
78163
+ }
78164
+ // fallthrough
78165
+ default:
78166
+ span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
78167
+ diagnostics.add(ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher));
78168
+ break;
78128
78169
  }
78129
78170
  }
78130
78171
  }
@@ -80566,8 +80607,8 @@ var ts;
80566
80607
  if (node.assertions) {
80567
80608
  var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
80568
80609
  if (override) {
80569
- if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node12 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
80570
- grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node12_or_nodenext);
80610
+ if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
80611
+ grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
80571
80612
  }
80572
80613
  }
80573
80614
  }
@@ -82017,7 +82058,7 @@ var ts;
82017
82058
  }
82018
82059
  function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
82019
82060
  // No need to check for require or exports for ES6 modules and later
82020
- if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.Node12 && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
82061
+ if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.Node16 && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
82021
82062
  return;
82022
82063
  }
82023
82064
  if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
@@ -84937,8 +84978,8 @@ var ts;
84937
84978
  var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
84938
84979
  var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
84939
84980
  if (validForTypeAssertions && override) {
84940
- if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node12 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
84941
- return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node12_or_nodenext);
84981
+ if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
84982
+ return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
84942
84983
  }
84943
84984
  return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
84944
84985
  }
@@ -86277,7 +86318,7 @@ var ts;
86277
86318
  if (ts.isDeclaration(node)) {
86278
86319
  // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration
86279
86320
  var symbol = getSymbolOfNode(node);
86280
- return getTypeOfSymbol(symbol);
86321
+ return symbol ? getTypeOfSymbol(symbol) : errorType;
86281
86322
  }
86282
86323
  if (isDeclarationNameOrImportPropertyName(node)) {
86283
86324
  var symbol = getSymbolAtLocation(node);
@@ -88125,8 +88166,24 @@ var ts;
88125
88166
  if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
88126
88167
  diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module));
88127
88168
  }
88128
- if ((moduleKind !== ts.ModuleKind.ES2022 && moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System && !(moduleKind === ts.ModuleKind.NodeNext && ts.getSourceFileOfNode(forInOrOfStatement).impliedNodeFormat === ts.ModuleKind.ESNext)) || languageVersion < 4 /* ES2017 */) {
88129
- diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher));
88169
+ switch (moduleKind) {
88170
+ case ts.ModuleKind.Node16:
88171
+ case ts.ModuleKind.NodeNext:
88172
+ if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
88173
+ diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level));
88174
+ break;
88175
+ }
88176
+ // fallthrough
88177
+ case ts.ModuleKind.ES2022:
88178
+ case ts.ModuleKind.ESNext:
88179
+ case ts.ModuleKind.System:
88180
+ if (languageVersion >= 4 /* ES2017 */) {
88181
+ break;
88182
+ }
88183
+ // fallthrough
88184
+ default:
88185
+ diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher));
88186
+ break;
88130
88187
  }
88131
88188
  }
88132
88189
  }
@@ -88821,7 +88878,7 @@ var ts;
88821
88878
  }
88822
88879
  function checkGrammarImportCallExpression(node) {
88823
88880
  if (moduleKind === ts.ModuleKind.ES2015) {
88824
- return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node12_or_nodenext);
88881
+ return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext);
88825
88882
  }
88826
88883
  if (node.typeArguments) {
88827
88884
  return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
@@ -88832,7 +88889,7 @@ var ts;
88832
88889
  checkGrammarForDisallowedTrailingComma(nodeArguments);
88833
88890
  if (nodeArguments.length > 1) {
88834
88891
  var assertionArgument = nodeArguments[1];
88835
- return grammarErrorOnNode(assertionArgument, ts.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext);
88892
+ return grammarErrorOnNode(assertionArgument, ts.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);
88836
88893
  }
88837
88894
  }
88838
88895
  if (nodeArguments.length === 0 || nodeArguments.length > 2) {
@@ -109098,7 +109155,7 @@ var ts;
109098
109155
  return ts.transformECMAScriptModule;
109099
109156
  case ts.ModuleKind.System:
109100
109157
  return ts.transformSystemModule;
109101
- case ts.ModuleKind.Node12:
109158
+ case ts.ModuleKind.Node16:
109102
109159
  case ts.ModuleKind.NodeNext:
109103
109160
  return ts.transformNodeModule;
109104
109161
  default:
@@ -109957,8 +110014,7 @@ var ts;
109957
110014
  return;
109958
110015
  }
109959
110016
  var version = ts.version; // Extracted into a const so the form is stable between namespace and module
109960
- var buildInfo = { bundle: bundle, program: program, version: version };
109961
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
110017
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), /*writeByteOrderMark*/ false);
109962
110018
  }
109963
110019
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
109964
110020
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -110112,18 +110168,13 @@ var ts;
110112
110168
  if (sourceMapFilePath) {
110113
110169
  var sourceMap = sourceMapGenerator.toString();
110114
110170
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110115
- if (printer.bundleFileInfo)
110116
- printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
110117
110171
  }
110118
110172
  }
110119
110173
  else {
110120
110174
  writer.writeLine();
110121
110175
  }
110122
110176
  // Write the output file
110123
- var text = writer.getText();
110124
- ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110125
- if (printer.bundleFileInfo)
110126
- printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
110177
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110127
110178
  // Reset state
110128
110179
  writer.clear();
110129
110180
  }
@@ -110266,54 +110317,34 @@ var ts;
110266
110317
  }
110267
110318
  /*@internal*/
110268
110319
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
110269
- var createHash = ts.maybeBind(host, host.createHash);
110270
110320
  var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
110271
- var buildInfo;
110272
- if (host.getBuildInfo) {
110273
- var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
110274
- if (!hostBuildInfo)
110275
- return buildInfoPath;
110276
- buildInfo = hostBuildInfo;
110277
- }
110278
- else {
110279
- var buildInfoText = host.readFile(buildInfoPath);
110280
- if (!buildInfoText)
110281
- return buildInfoPath;
110282
- buildInfo = getBuildInfo(buildInfoText);
110283
- }
110284
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
110321
+ var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
110322
+ if (!buildInfoText)
110285
110323
  return buildInfoPath;
110286
110324
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
110287
110325
  if (!jsFileText)
110288
110326
  return jsFilePath;
110289
- if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
110290
- return jsFilePath;
110291
110327
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
110292
110328
  // error if no source map or for now if inline sourcemap
110293
110329
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
110294
110330
  return sourceMapFilePath || "inline sourcemap decoding";
110295
- if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
110296
- return sourceMapFilePath;
110297
110331
  // read declaration text
110298
110332
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
110299
110333
  if (declarationFilePath && !declarationText)
110300
110334
  return declarationFilePath;
110301
- if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
110302
- return declarationFilePath;
110303
110335
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
110304
110336
  // error if no source map or for now if inline sourcemap
110305
110337
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
110306
110338
  return declarationMapPath || "inline sourcemap decoding";
110307
- if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
110308
- return declarationMapPath;
110339
+ var buildInfo = getBuildInfo(buildInfoText);
110340
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
110341
+ return buildInfoPath;
110309
110342
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110310
110343
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
110311
110344
  /*onlyOwnText*/ true);
110312
110345
  var outputFiles = [];
110313
110346
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
110314
110347
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
110315
- var changedDtsText;
110316
- var changedDtsData;
110317
110348
  var emitHost = {
110318
110349
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
110319
110350
  getCanonicalFileName: host.getCanonicalFileName,
@@ -110329,7 +110360,7 @@ var ts;
110329
110360
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
110330
110361
  getProjectReferenceRedirect: ts.returnUndefined,
110331
110362
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
110332
- writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
110363
+ writeFile: function (name, text, writeByteOrderMark) {
110333
110364
  switch (name) {
110334
110365
  case jsFilePath:
110335
110366
  if (jsFileText === text)
@@ -110340,13 +110371,8 @@ var ts;
110340
110371
  return;
110341
110372
  break;
110342
110373
  case buildInfoPath:
110343
- var newBuildInfo = data.buildInfo;
110374
+ var newBuildInfo = getBuildInfo(text);
110344
110375
  newBuildInfo.program = buildInfo.program;
110345
- if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
110346
- // Update the output signature
110347
- newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
110348
- newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
110349
- }
110350
110376
  // Update sourceFileInfo
110351
110377
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
110352
110378
  newBuildInfo.bundle.js.sources = js.sources;
@@ -110354,13 +110380,11 @@ var ts;
110354
110380
  newBuildInfo.bundle.dts.sources = dts.sources;
110355
110381
  }
110356
110382
  newBuildInfo.bundle.sourceFiles = sourceFiles;
110357
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
110383
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
110358
110384
  return;
110359
110385
  case declarationFilePath:
110360
110386
  if (declarationText === text)
110361
110387
  return;
110362
- changedDtsText = text;
110363
- changedDtsData = data;
110364
110388
  break;
110365
110389
  case declarationMapPath:
110366
110390
  if (declarationMapText === text)
@@ -110379,7 +110403,6 @@ var ts;
110379
110403
  getSourceFileFromReference: ts.returnUndefined,
110380
110404
  redirectTargetsMap: ts.createMultiMap(),
110381
110405
  getFileIncludeReasons: ts.notImplemented,
110382
- createHash: createHash,
110383
110406
  };
110384
110407
  emitFiles(ts.notImplementedResolver, emitHost,
110385
110408
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
@@ -115464,10 +115487,12 @@ var ts;
115464
115487
  }
115465
115488
  ts.createCompilerHost = createCompilerHost;
115466
115489
  /*@internal*/
115490
+ // TODO(shkamat): update this after reworking ts build API
115467
115491
  function createCompilerHostWorker(options, setParentNodes, system) {
115468
115492
  if (system === void 0) { system = ts.sys; }
115469
115493
  var existingDirectories = new ts.Map();
115470
115494
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
115495
+ var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
115471
115496
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
115472
115497
  var text;
115473
115498
  try {
@@ -115500,7 +115525,7 @@ var ts;
115500
115525
  // NOTE: If patchWriteFileEnsuringDirectory has been called,
115501
115526
  // the system.writeFile will do its own directory creation and
115502
115527
  // the ensureDirectoriesExist call will always be redundant.
115503
- 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); });
115528
+ 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); });
115504
115529
  ts.performance.mark("afterIOWrite");
115505
115530
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
115506
115531
  }
@@ -115510,6 +115535,35 @@ var ts;
115510
115535
  }
115511
115536
  }
115512
115537
  }
115538
+ var outputFingerprints;
115539
+ function writeFileWorker(fileName, data, writeByteOrderMark) {
115540
+ if (!ts.isWatchSet(options) || !system.getModifiedTime) {
115541
+ system.writeFile(fileName, data, writeByteOrderMark);
115542
+ return;
115543
+ }
115544
+ if (!outputFingerprints) {
115545
+ outputFingerprints = new ts.Map();
115546
+ }
115547
+ var hash = computeHash(data);
115548
+ var mtimeBefore = system.getModifiedTime(fileName);
115549
+ if (mtimeBefore) {
115550
+ var fingerprint = outputFingerprints.get(fileName);
115551
+ // If output has not been changed, and the file has no external modification
115552
+ if (fingerprint &&
115553
+ fingerprint.byteOrderMark === writeByteOrderMark &&
115554
+ fingerprint.hash === hash &&
115555
+ fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
115556
+ return;
115557
+ }
115558
+ }
115559
+ system.writeFile(fileName, data, writeByteOrderMark);
115560
+ var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
115561
+ outputFingerprints.set(fileName, {
115562
+ hash: hash,
115563
+ byteOrderMark: writeByteOrderMark,
115564
+ mtime: mtimeAfter
115565
+ });
115566
+ }
115513
115567
  function getDefaultLibLocation() {
115514
115568
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
115515
115569
  }
@@ -116124,7 +116178,7 @@ var ts;
116124
116178
  */
116125
116179
  function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
116126
116180
  switch (ts.getEmitModuleResolutionKind(options)) {
116127
- case ts.ModuleResolutionKind.Node12:
116181
+ case ts.ModuleResolutionKind.Node16:
116128
116182
  case ts.ModuleResolutionKind.NodeNext:
116129
116183
  return ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? ts.ModuleKind.ESNext :
116130
116184
  ts.fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? ts.ModuleKind.CommonJS :
@@ -116178,7 +116232,6 @@ var ts;
116178
116232
  ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
116179
116233
  ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
116180
116234
  ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
116181
- ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body.code,
116182
116235
  ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
116183
116236
  ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
116184
116237
  ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
@@ -116423,7 +116476,7 @@ var ts;
116423
116476
  var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
116424
116477
  var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
116425
116478
  for (var i = 0; i < typeReferences.length; i++) {
116426
- // under node12/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
116479
+ // under node16/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
116427
116480
  processTypeReferenceDirective(typeReferences[i], /*mode*/ undefined, resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (_c = resolutions[i]) === null || _c === void 0 ? void 0 : _c.packageId });
116428
116481
  }
116429
116482
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
@@ -116565,6 +116618,40 @@ var ts;
116565
116618
  ts.performance.measure("Program", "beforeProgram", "afterProgram");
116566
116619
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
116567
116620
  return program;
116621
+ function addResolutionDiagnostics(list) {
116622
+ if (!list)
116623
+ return;
116624
+ for (var _i = 0, list_3 = list; _i < list_3.length; _i++) {
116625
+ var elem = list_3[_i];
116626
+ programDiagnostics.add(elem);
116627
+ }
116628
+ }
116629
+ function pullDiagnosticsFromCache(names, containingFile) {
116630
+ var _a;
116631
+ if (!moduleResolutionCache)
116632
+ return;
116633
+ var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
116634
+ var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
116635
+ var containingDir = ts.getDirectoryPath(containingFileName);
116636
+ var redirectedReference = getRedirectReferenceForResolution(containingFile);
116637
+ var i = 0;
116638
+ for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
116639
+ var n = names_4[_i];
116640
+ // mimics logic done in the resolution cache, should be resilient to upgrading it to use `FileReference`s for non-type-reference modal lookups to make it rely on the index in the list less
116641
+ var mode = typeof n === "string" ? getModeForResolutionAtIndex(containingFile, i) : getModeForFileReference(n, containingFileMode);
116642
+ var name = typeof n === "string" ? n : n.fileName;
116643
+ i++;
116644
+ // only nonrelative names hit the cache, and, at least as of right now, only nonrelative names can issue diagnostics
116645
+ // (Since diagnostics are only issued via import or export map lookup)
116646
+ // This may totally change if/when the issue of output paths not mapping to input files is fixed in a broader context
116647
+ // When it is, how we extract diagnostics from the module name resolver will have the be refined - the current cache
116648
+ // APIs wrapping the underlying resolver make it almost impossible to smuggle the diagnostics out in a generalized way
116649
+ if (ts.isExternalModuleNameRelative(name))
116650
+ continue;
116651
+ var diags = (_a = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) === null || _a === void 0 ? void 0 : _a.resolutionDiagnostics;
116652
+ addResolutionDiagnostics(diags);
116653
+ }
116654
+ }
116568
116655
  function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
116569
116656
  if (!moduleNames.length)
116570
116657
  return ts.emptyArray;
@@ -116576,6 +116663,7 @@ var ts;
116576
116663
  ts.performance.mark("afterResolveModule");
116577
116664
  ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
116578
116665
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
116666
+ pullDiagnosticsFromCache(moduleNames, containingFile);
116579
116667
  return result;
116580
116668
  }
116581
116669
  function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) {
@@ -117061,7 +117149,6 @@ var ts;
117061
117149
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
117062
117150
  redirectTargetsMap: redirectTargetsMap,
117063
117151
  getFileIncludeReasons: program.getFileIncludeReasons,
117064
- createHash: ts.maybeBind(host, host.createHash),
117065
117152
  };
117066
117153
  }
117067
117154
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -118077,8 +118164,8 @@ var ts;
118077
118164
  var fileName = ts.toFileNameLowerCase(ref.fileName);
118078
118165
  ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
118079
118166
  var mode = ref.resolutionMode || file.impliedNodeFormat;
118080
- if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node12 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
118081
- programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node12_or_nodenext));
118167
+ if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
118168
+ programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
118082
118169
  }
118083
118170
  processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
118084
118171
  }
@@ -118440,7 +118527,7 @@ var ts;
118440
118527
  }
118441
118528
  if (options.resolveJsonModule) {
118442
118529
  if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs &&
118443
- ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node12 &&
118530
+ ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 &&
118444
118531
  ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
118445
118532
  createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
118446
118533
  }
@@ -119175,9 +119262,13 @@ var ts;
119175
119262
  function createManyToManyPathMap() {
119176
119263
  function create(forward, reverse, deleted) {
119177
119264
  var map = {
119265
+ clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119266
+ forEach: function (fn) { return forward.forEach(fn); },
119178
119267
  getKeys: function (v) { return reverse.get(v); },
119179
119268
  getValues: function (k) { return forward.get(k); },
119269
+ hasKey: function (k) { return forward.has(k); },
119180
119270
  keys: function () { return forward.keys(); },
119271
+ deletedKeys: function () { return deleted; },
119181
119272
  deleteKey: function (k) {
119182
119273
  (deleted || (deleted = new ts.Set())).add(k);
119183
119274
  var set = forward.get(k);
@@ -119204,6 +119295,11 @@ var ts;
119204
119295
  });
119205
119296
  return map;
119206
119297
  },
119298
+ clear: function () {
119299
+ forward.clear();
119300
+ reverse.clear();
119301
+ deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119302
+ }
119207
119303
  };
119208
119304
  return map;
119209
119305
  }
@@ -119331,21 +119427,18 @@ var ts;
119331
119427
  * Creates the state of file references and signature for the new program from oldState if it is safe
119332
119428
  */
119333
119429
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119334
- var _a, _b, _c;
119335
119430
  var fileInfos = new ts.Map();
119336
119431
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
119337
119432
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
119433
+ var hasCalledUpdateShapeSignature = new ts.Set();
119338
119434
  var useOldState = canReuseOldState(referencedMap, oldState);
119339
119435
  // Ensure source files have parent pointers set
119340
119436
  newProgram.getTypeChecker();
119341
119437
  // Create the reference map, and set the file infos
119342
- for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
119343
- var sourceFile = _d[_i];
119438
+ for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
119439
+ var sourceFile = _a[_i];
119344
119440
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
119345
- var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
119346
- var signature = oldUncommitedSignature === undefined ?
119347
- useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
119348
- oldUncommitedSignature || undefined;
119441
+ var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
119349
119442
  if (referencedMap) {
119350
119443
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
119351
119444
  if (newReferences) {
@@ -119353,26 +119446,19 @@ var ts;
119353
119446
  }
119354
119447
  // Copy old visible to outside files map
119355
119448
  if (useOldState) {
119356
- var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
119357
- var exportedModules = oldUncommitedExportedModules === undefined ?
119358
- oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
119359
- oldUncommitedExportedModules || undefined;
119449
+ var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
119360
119450
  if (exportedModules) {
119361
119451
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119362
119452
  }
119363
119453
  }
119364
119454
  }
119365
- fileInfos.set(sourceFile.resolvedPath, {
119366
- version: version_2,
119367
- signature: signature,
119368
- affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
119369
- impliedFormat: sourceFile.impliedNodeFormat
119370
- });
119455
+ fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
119371
119456
  }
119372
119457
  return {
119373
119458
  fileInfos: fileInfos,
119374
119459
  referencedMap: referencedMap,
119375
119460
  exportedModulesMap: exportedModulesMap,
119461
+ hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
119376
119462
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
119377
119463
  };
119378
119464
  }
@@ -119386,42 +119472,71 @@ var ts;
119386
119472
  }
119387
119473
  BuilderState.releaseCache = releaseCache;
119388
119474
  /**
119389
- * Gets the files affected by the path from the program
119475
+ * Creates a clone of the state
119390
119476
  */
119391
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
119477
+ function clone(state) {
119392
119478
  var _a, _b;
119393
- var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
119394
- (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119395
- (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119396
- return result;
119479
+ // Dont need to backup allFiles info since its cache anyway
119480
+ return {
119481
+ fileInfos: new ts.Map(state.fileInfos),
119482
+ referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
119483
+ exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
119484
+ hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
119485
+ useFileVersionAsSignature: state.useFileVersionAsSignature,
119486
+ };
119397
119487
  }
119398
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119399
- function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
119488
+ BuilderState.clone = clone;
119489
+ /**
119490
+ * Gets the files affected by the path from the program
119491
+ */
119492
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
119493
+ // Since the operation could be cancelled, the signatures are always stored in the cache
119494
+ // They will be committed once it is safe to use them
119495
+ // eg when calling this api from tsserver, if there is no cancellation of the operation
119496
+ // In the other cases the affected files signatures are committed only after the iteration through the result is complete
119497
+ var signatureCache = cacheToUpdateSignature || new ts.Map();
119400
119498
  var sourceFile = programOfThisState.getSourceFileByPath(path);
119401
119499
  if (!sourceFile) {
119402
119500
  return ts.emptyArray;
119403
119501
  }
119404
- if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
119502
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
119405
119503
  return [sourceFile];
119406
119504
  }
119407
- return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
119505
+ var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
119506
+ if (!cacheToUpdateSignature) {
119507
+ // Commit all the signatures in the signature cache
119508
+ updateSignaturesFromCache(state, signatureCache);
119509
+ }
119510
+ return result;
119408
119511
  }
119409
- BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
119512
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119513
+ /**
119514
+ * Updates the signatures from the cache into state's fileinfo signatures
119515
+ * This should be called whenever it is safe to commit the state of the builder
119516
+ */
119517
+ function updateSignaturesFromCache(state, signatureCache) {
119518
+ signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
119519
+ }
119520
+ BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
119410
119521
  function updateSignatureOfFile(state, signature, path) {
119411
119522
  state.fileInfos.get(path).signature = signature;
119412
- (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
119523
+ state.hasCalledUpdateShapeSignature.add(path);
119413
119524
  }
119414
119525
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
119415
119526
  /**
119416
119527
  * Returns if the shape of the signature has changed since last emit
119417
119528
  */
119418
- function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
119419
- var _a;
119529
+ function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
119420
119530
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
119531
+ ts.Debug.assert(!!sourceFile);
119532
+ ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
119421
119533
  // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
119422
- if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
119534
+ if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
119423
119535
  return false;
119536
+ }
119424
119537
  var info = state.fileInfos.get(sourceFile.resolvedPath);
119538
+ if (!info)
119539
+ return ts.Debug.fail();
119425
119540
  var prevSignature = info.signature;
119426
119541
  var latestSignature;
119427
119542
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -119432,55 +119547,45 @@ var ts;
119432
119547
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119433
119548
  if (firstDts_1) {
119434
119549
  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; })); });
119435
- latestSignature = computeSignature(firstDts_1.text, computeHash);
119436
- if (latestSignature !== prevSignature) {
119437
- updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
119550
+ latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119551
+ if (exportedModulesMapCache && latestSignature !== prevSignature) {
119552
+ updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
119438
119553
  }
119439
119554
  }
119440
119555
  }
119441
119556
  // Default is to use file version as signature
119442
119557
  if (latestSignature === undefined) {
119443
119558
  latestSignature = sourceFile.version;
119444
- if (state.exportedModulesMap && latestSignature !== prevSignature) {
119445
- (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119559
+ if (exportedModulesMapCache && latestSignature !== prevSignature) {
119446
119560
  // All the references in this file are exported
119447
119561
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
119448
119562
  if (references) {
119449
- state.exportedModulesMap.set(sourceFile.resolvedPath, references);
119563
+ exportedModulesMapCache.set(sourceFile.resolvedPath, references);
119450
119564
  }
119451
119565
  else {
119452
- state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119566
+ exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119453
119567
  }
119454
119568
  }
119455
119569
  }
119456
- (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
119457
- (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
119458
- info.signature = latestSignature;
119570
+ cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
119459
119571
  return latestSignature !== prevSignature;
119460
119572
  }
119461
119573
  BuilderState.updateShapeSignature = updateShapeSignature;
119462
- function computeSignature(text, computeHash) {
119463
- return (computeHash || ts.generateDjb2Hash)(text);
119464
- }
119465
- BuilderState.computeSignature = computeSignature;
119466
119574
  /**
119467
119575
  * Coverts the declaration emit result into exported modules map
119468
119576
  */
119469
- function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
119470
- if (!state.exportedModulesMap)
119471
- return;
119472
- (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119577
+ function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
119473
119578
  if (!exportedModulesFromDeclarationEmit) {
119474
- state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119579
+ exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119475
119580
  return;
119476
119581
  }
119477
119582
  var exportedModules;
119478
119583
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
119479
119584
  if (exportedModules) {
119480
- state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119585
+ exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
119481
119586
  }
119482
119587
  else {
119483
- state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119588
+ exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119484
119589
  }
119485
119590
  function addExportedModule(exportedModulePaths) {
119486
119591
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -119492,6 +119597,19 @@ var ts;
119492
119597
  }
119493
119598
  }
119494
119599
  BuilderState.updateExportedModules = updateExportedModules;
119600
+ /**
119601
+ * Updates the exported modules from cache into state's exported modules map
119602
+ * This should be called whenever it is safe to commit the state of the builder
119603
+ */
119604
+ function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
119605
+ var _a;
119606
+ if (exportedModulesMapCache) {
119607
+ ts.Debug.assert(!!state.exportedModulesMap);
119608
+ (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
119609
+ exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
119610
+ }
119611
+ }
119612
+ BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
119495
119613
  /**
119496
119614
  * Get all the dependencies of the sourceFile
119497
119615
  */
@@ -119612,7 +119730,7 @@ var ts;
119612
119730
  /**
119613
119731
  * When program emits modular code, gets the files affected by the sourceFile whose shape has changed
119614
119732
  */
119615
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
119733
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
119616
119734
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
119617
119735
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
119618
119736
  }
@@ -119632,7 +119750,7 @@ var ts;
119632
119750
  if (!seenFileNamesMap.has(currentPath)) {
119633
119751
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
119634
119752
  seenFileNamesMap.set(currentPath, currentSourceFile);
119635
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
119753
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
119636
119754
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
119637
119755
  }
119638
119756
  }
@@ -119658,33 +119776,32 @@ var ts;
119658
119776
  * Create the state so that we can iterate on changedFiles/affected files
119659
119777
  */
119660
119778
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119661
- var _a, _b;
119662
119779
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
119663
119780
  state.program = newProgram;
119664
119781
  var compilerOptions = newProgram.getCompilerOptions();
119665
119782
  state.compilerOptions = compilerOptions;
119666
- var outFilePath = ts.outFile(compilerOptions);
119667
119783
  // With --out or --outFile, any change affects all semantic diagnostics so no need to cache them
119668
- if (!outFilePath) {
119784
+ if (!ts.outFile(compilerOptions)) {
119669
119785
  state.semanticDiagnosticsPerFile = new ts.Map();
119670
119786
  }
119671
- 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)) {
119672
- state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
119673
- }
119674
119787
  state.changedFilesSet = new ts.Set();
119675
- state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
119676
119788
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
119677
119789
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
119678
119790
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
119679
119791
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
119680
- var canCopyEmitSignatures = compilerOptions.composite &&
119681
- (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
119682
- !outFilePath &&
119683
- !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
119684
119792
  if (useOldState) {
119793
+ // Verify the sanity of old state
119794
+ if (!oldState.currentChangedFilePath) {
119795
+ var affectedSignatures = oldState.currentAffectedFilesSignatures;
119796
+ ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
119797
+ }
119798
+ var changedFilesSet = oldState.changedFilesSet;
119799
+ if (canCopySemanticDiagnostics) {
119800
+ ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
119801
+ }
119685
119802
  // Copy old state's changed files set
119686
- (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
119687
- if (!outFilePath && oldState.affectedFilesPendingEmit) {
119803
+ changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
119804
+ if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
119688
119805
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
119689
119806
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
119690
119807
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -119705,8 +119822,6 @@ var ts;
119705
119822
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
119706
119823
  // versions dont match
119707
119824
  oldInfo.version !== info.version ||
119708
- // Implied formats dont match
119709
- oldInfo.impliedFormat !== info.impliedFormat ||
119710
119825
  // Referenced files changed
119711
119826
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
119712
119827
  // Referenced file was deleted in the new program
@@ -119730,25 +119845,27 @@ var ts;
119730
119845
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
119731
119846
  }
119732
119847
  }
119733
- if (canCopyEmitSignatures) {
119734
- var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
119735
- if (oldEmitSignature)
119736
- (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
119737
- }
119738
119848
  });
119739
119849
  // If the global file is removed, add all files as changed
119740
119850
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
119741
119851
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, /*firstSourceFile*/ undefined)
119742
119852
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
119743
119853
  }
119744
- else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
119854
+ else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
119745
119855
  // Add all files to affectedFilesPendingEmit since emit changed
119746
119856
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1 /* Full */); });
119747
119857
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
119748
119858
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
119749
119859
  }
119750
- // Since old states change files set is copied, any additional change means we would need to emit build info
119751
- state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
119860
+ if (useOldState) {
119861
+ // Any time the interpretation of a source file changes, mark it as changed
119862
+ ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
119863
+ if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
119864
+ state.changedFilesSet.add(sourceFilePath);
119865
+ }
119866
+ });
119867
+ }
119868
+ state.buildInfoEmitPending = !!state.changedFilesSet.size;
119752
119869
  return state;
119753
119870
  }
119754
119871
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -119784,35 +119901,30 @@ var ts;
119784
119901
  ts.BuilderState.releaseCache(state);
119785
119902
  state.program = undefined;
119786
119903
  }
119787
- function backupEmitBuilderProgramState(state) {
119788
- var outFilePath = ts.outFile(state.compilerOptions);
119789
- // Only in --out changeFileSet is kept around till emit
119790
- ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
119791
- return {
119792
- affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
119793
- affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
119794
- affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
119795
- seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
119796
- programEmitComplete: state.programEmitComplete,
119797
- emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
119798
- outSignature: state.outSignature,
119799
- dtsChangeTime: state.dtsChangeTime,
119800
- hasChangedEmitSignature: state.hasChangedEmitSignature,
119801
- changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
119802
- };
119803
- }
119804
- function restoreEmitBuilderProgramState(state, backupEmitState) {
119805
- state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
119806
- state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
119807
- state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
119808
- state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
119809
- state.programEmitComplete = backupEmitState.programEmitComplete;
119810
- state.emitSignatures = backupEmitState.emitSignatures;
119811
- state.outSignature = backupEmitState.outSignature;
119812
- state.dtsChangeTime = backupEmitState.dtsChangeTime;
119813
- state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
119814
- if (backupEmitState.changedFilesSet)
119815
- state.changedFilesSet = backupEmitState.changedFilesSet;
119904
+ /**
119905
+ * Creates a clone of the state
119906
+ */
119907
+ function cloneBuilderProgramState(state) {
119908
+ var _a;
119909
+ var newState = ts.BuilderState.clone(state);
119910
+ newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
119911
+ newState.changedFilesSet = new ts.Set(state.changedFilesSet);
119912
+ newState.affectedFiles = state.affectedFiles;
119913
+ newState.affectedFilesIndex = state.affectedFilesIndex;
119914
+ newState.currentChangedFilePath = state.currentChangedFilePath;
119915
+ newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
119916
+ newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
119917
+ newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
119918
+ newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
119919
+ newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
119920
+ newState.program = state.program;
119921
+ newState.compilerOptions = state.compilerOptions;
119922
+ newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
119923
+ newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
119924
+ newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
119925
+ newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
119926
+ newState.programEmitComplete = state.programEmitComplete;
119927
+ return newState;
119816
119928
  }
119817
119929
  /**
119818
119930
  * Verifies that source file is ok to be used in calls that arent handled by next
@@ -119827,7 +119939,7 @@ var ts;
119827
119939
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
119828
119940
  */
119829
119941
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
119830
- var _a, _b;
119942
+ var _a;
119831
119943
  while (true) {
119832
119944
  var affectedFiles = state.affectedFiles;
119833
119945
  if (affectedFiles) {
@@ -119847,8 +119959,10 @@ var ts;
119847
119959
  state.changedFilesSet.delete(state.currentChangedFilePath);
119848
119960
  state.currentChangedFilePath = undefined;
119849
119961
  // Commit the changes in file signature
119850
- (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119851
- (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119962
+ ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
119963
+ state.currentAffectedFilesSignatures.clear();
119964
+ ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
119965
+ (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
119852
119966
  state.affectedFiles = undefined;
119853
119967
  }
119854
119968
  // Get next changed file
@@ -119866,7 +119980,12 @@ var ts;
119866
119980
  return program;
119867
119981
  }
119868
119982
  // Get next batch of affected files
119869
- state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
119983
+ if (!state.currentAffectedFilesSignatures)
119984
+ state.currentAffectedFilesSignatures = new ts.Map();
119985
+ if (state.exportedModulesMap) {
119986
+ state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
119987
+ }
119988
+ state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
119870
119989
  state.currentChangedFilePath = nextKey.value;
119871
119990
  state.affectedFilesIndex = 0;
119872
119991
  if (!state.seenAffectedFiles)
@@ -119918,6 +120037,7 @@ var ts;
119918
120037
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
119919
120038
  */
119920
120039
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120040
+ var _a;
119921
120041
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
119922
120042
  // If affected files is everything except default library, then nothing more to do
119923
120043
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -119925,9 +120045,10 @@ var ts;
119925
120045
  // When a change affects the global scope, all files are considered to be affected without updating their signature
119926
120046
  // That means when affected file is handled, its signature can be out of date
119927
120047
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
119928
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
120048
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
119929
120049
  return;
119930
120050
  }
120051
+ 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);
119931
120052
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
119932
120053
  return;
119933
120054
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -119947,7 +120068,7 @@ var ts;
119947
120068
  // This ensures that we dont later during incremental builds considering wrong signature.
119948
120069
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
119949
120070
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
119950
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
120071
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
119951
120072
  // If not dts emit, nothing more to do
119952
120073
  if (ts.getEmitDeclarations(state.compilerOptions)) {
119953
120074
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -119968,10 +120089,27 @@ var ts;
119968
120089
  return !state.semanticDiagnosticsFromOldState.size;
119969
120090
  }
119970
120091
  function isChangedSignature(state, path) {
119971
- var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
119972
- var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120092
+ var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
120093
+ var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
119973
120094
  return newSignature !== oldSignature;
119974
120095
  }
120096
+ function forEachKeyOfExportedModulesMap(state, filePath, fn) {
120097
+ // Go through exported modules from cache first
120098
+ var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
120099
+ var result = keys && ts.forEachKey(keys, fn);
120100
+ if (result)
120101
+ return result;
120102
+ // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
120103
+ keys = state.exportedModulesMap.getKeys(filePath);
120104
+ return keys && ts.forEachKey(keys, function (exportedFromPath) {
120105
+ var _a;
120106
+ // If the cache had an updated value, skip
120107
+ return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
120108
+ !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
120109
+ fn(exportedFromPath) :
120110
+ undefined;
120111
+ });
120112
+ }
119975
120113
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
119976
120114
  var _a;
119977
120115
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -119986,7 +120124,6 @@ var ts;
119986
120124
  * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
119987
120125
  */
119988
120126
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
119989
- var _a;
119990
120127
  // If there was change in signature (dts output) for the changed file,
119991
120128
  // then only we need to handle pending file emit
119992
120129
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
@@ -120013,10 +120150,11 @@ var ts;
120013
120150
  }
120014
120151
  }
120015
120152
  }
120153
+ ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120016
120154
  var seenFileAndExportsOfFile = new ts.Set();
120017
120155
  // Go through exported modules from cache first
120018
120156
  // If exported modules has path, all files referencing file exported from are affected
120019
- (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120157
+ forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
120020
120158
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
120021
120159
  return true;
120022
120160
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -120030,18 +120168,19 @@ var ts;
120030
120168
  * return true when all work is done and we can exit handling dts emit and semantic diagnostics
120031
120169
  */
120032
120170
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
120033
- var _a, _b;
120171
+ var _a;
120034
120172
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
120035
120173
  return undefined;
120036
120174
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
120037
120175
  return true;
120038
120176
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
120177
+ ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120039
120178
  // If exported modules has path, all files referencing file exported from are affected
120040
- (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120179
+ forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
120041
120180
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
120042
120181
  });
120043
120182
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
120044
- (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
120183
+ (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
120045
120184
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
120046
120185
  handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
120047
120186
  state, referencingFilePath, cancellationToken, computeHash, host);
@@ -120062,13 +120201,12 @@ var ts;
120062
120201
  }
120063
120202
  else {
120064
120203
  state.seenAffectedFiles.add(affected.resolvedPath);
120065
- // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted
120066
- state.buildInfoEmitPending = true;
120067
120204
  if (emitKind !== undefined) {
120068
120205
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
120069
120206
  }
120070
120207
  if (isPendingEmit) {
120071
120208
  state.affectedFilesPendingEmitIndex++;
120209
+ state.buildInfoEmitPending = true;
120072
120210
  }
120073
120211
  else {
120074
120212
  state.affectedFilesIndex++;
@@ -120116,61 +120254,25 @@ var ts;
120116
120254
  }
120117
120255
  return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
120118
120256
  }
120119
- function isProgramBundleEmitBuildInfo(info) {
120120
- return !!ts.outFile(info.options || {});
120121
- }
120122
- ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
120123
120257
  /**
120124
120258
  * Gets the program information to be emitted in buildInfo so that we can use it to create new program
120125
120259
  */
120126
- function getProgramBuildInfo(state, getCanonicalFileName, host) {
120127
- var outFilePath = ts.outFile(state.compilerOptions);
120128
- if (outFilePath && !state.compilerOptions.composite)
120129
- return;
120260
+ function getProgramBuildInfo(state, getCanonicalFileName) {
120261
+ if (ts.outFile(state.compilerOptions))
120262
+ return undefined;
120130
120263
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
120131
120264
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
120132
- state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
120133
- if (outFilePath) {
120134
- var fileNames_1 = [];
120135
- var fileInfos_1 = [];
120136
- state.program.getRootFileNames().forEach(function (f) {
120137
- var sourceFile = state.program.getSourceFile(f);
120138
- if (!sourceFile)
120139
- return;
120140
- fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
120141
- fileInfos_1.push(sourceFile.version);
120142
- });
120143
- var result_15 = {
120144
- fileNames: fileNames_1,
120145
- fileInfos: fileInfos_1,
120146
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
120147
- outSignature: state.outSignature,
120148
- dtsChangeTime: state.dtsChangeTime,
120149
- };
120150
- return result_15;
120151
- }
120152
120265
  var fileNames = [];
120153
120266
  var fileNameToFileId = new ts.Map();
120154
120267
  var fileIdsList;
120155
120268
  var fileNamesToFileIdListId;
120156
- var emitSignatures;
120157
120269
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
120158
- var _b, _c;
120159
120270
  var key = _a[0], value = _a[1];
120160
120271
  // Ensure fileId
120161
120272
  var fileId = toFileId(key);
120162
120273
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
120163
- var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
120164
- var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
120165
- if (state.compilerOptions.composite) {
120166
- var file = state.program.getSourceFileByPath(key);
120167
- if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
120168
- var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
120169
- if (emitSignature !== actualSignature) {
120170
- (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
120171
- }
120172
- }
120173
- }
120274
+ var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120275
+ var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120174
120276
  return value.version === actualSignature ?
120175
120277
  value.affectsGlobalScope || value.impliedFormat ?
120176
120278
  // If file version is same as signature, dont serialize signature
@@ -120178,11 +120280,11 @@ var ts;
120178
120280
  // If file info only contains version and signature and both are same we can just write string
120179
120281
  value.version :
120180
120282
  actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120181
- oldSignature === undefined ?
120283
+ signature === undefined ?
120182
120284
  // If we havent computed signature, use fileInfo as is
120183
120285
  value :
120184
120286
  // Serialize fileInfo with new updated signature
120185
- { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120287
+ { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120186
120288
  // Signature of the FileInfo is undefined, serialize it as false
120187
120289
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120188
120290
  });
@@ -120197,13 +120299,17 @@ var ts;
120197
120299
  if (state.exportedModulesMap) {
120198
120300
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
120199
120301
  var _a;
120200
- var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
120302
+ if (state.currentAffectedFilesExportedModulesMap) {
120303
+ if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
120304
+ return undefined;
120305
+ }
120306
+ var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
120307
+ if (newValue) {
120308
+ return [toFileId(key), toFileIdListId(newValue)];
120309
+ }
120310
+ }
120201
120311
  // Not in temporary cache, use existing value
120202
- if (oldValue === undefined)
120203
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120204
- if (oldValue)
120205
- return [toFileId(key), toFileIdListId(oldValue)];
120206
- return undefined;
120312
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120207
120313
  });
120208
120314
  }
120209
120315
  var semanticDiagnosticsPerFile;
@@ -120214,7 +120320,9 @@ var ts;
120214
120320
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
120215
120321
  [
120216
120322
  toFileId(key),
120217
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120323
+ state.hasReusableDiagnostic ?
120324
+ value :
120325
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
120218
120326
  ] :
120219
120327
  toFileId(key));
120220
120328
  }
@@ -120229,27 +120337,16 @@ var ts;
120229
120337
  }
120230
120338
  }
120231
120339
  }
120232
- var changeFileSet;
120233
- if (state.changedFilesSet.size) {
120234
- for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
120235
- var path = _e[_d];
120236
- (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120237
- }
120238
- }
120239
- var result = {
120340
+ return {
120240
120341
  fileNames: fileNames,
120241
120342
  fileInfos: fileInfos,
120242
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
120343
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
120243
120344
  fileIdsList: fileIdsList,
120244
120345
  referencedMap: referencedMap,
120245
120346
  exportedModulesMap: exportedModulesMap,
120246
120347
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
120247
120348
  affectedFilesPendingEmit: affectedFilesPendingEmit,
120248
- changeFileSet: changeFileSet,
120249
- emitSignatures: emitSignatures,
120250
- dtsChangeTime: state.dtsChangeTime,
120251
120349
  };
120252
- return result;
120253
120350
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
120254
120351
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
120255
120352
  }
@@ -120274,18 +120371,24 @@ var ts;
120274
120371
  }
120275
120372
  return fileIdListId;
120276
120373
  }
120277
- function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
120278
- var result;
120279
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120280
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120281
- var name = _a[_i];
120282
- var optionInfo = optionsNameMap.get(name.toLowerCase());
120283
- if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
120284
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
120285
- }
120374
+ }
120375
+ function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
120376
+ var result;
120377
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120378
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120379
+ var name = _a[_i];
120380
+ var optionKey = name.toLowerCase();
120381
+ var optionInfo = optionsNameMap.get(optionKey);
120382
+ if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
120383
+ // We need to store `strict`, even though it won't be examined directly, so that the
120384
+ // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
120385
+ optionKey === "strict" ||
120386
+ // We need to store these to determine whether `lib` files need to be rechecked.
120387
+ optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
120388
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
120286
120389
  }
120287
- return result;
120288
120390
  }
120391
+ return result;
120289
120392
  }
120290
120393
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120291
120394
  if (option) {
@@ -120359,10 +120462,6 @@ var ts;
120359
120462
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
120360
120463
  }
120361
120464
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
120362
- function computeSignature(text, data, computeHash) {
120363
- return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
120364
- }
120365
- ts.computeSignature = computeSignature;
120366
120465
  function createBuilderProgram(kind, _a) {
120367
120466
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
120368
120467
  // Return same program if underlying program doesnt change
@@ -120381,8 +120480,8 @@ var ts;
120381
120480
  */
120382
120481
  var computeHash = ts.maybeBind(host, host.createHash);
120383
120482
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
120384
- var backupEmitState;
120385
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
120483
+ var backupState;
120484
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
120386
120485
  // To ensure that we arent storing any references to old program or new program without state
120387
120486
  newProgram = undefined; // TODO: GH#18217
120388
120487
  oldProgram = undefined;
@@ -120390,20 +120489,20 @@ var ts;
120390
120489
  var getState = function () { return state; };
120391
120490
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
120392
120491
  builderProgram.getState = getState;
120393
- builderProgram.backupEmitState = function () {
120394
- ts.Debug.assert(backupEmitState === undefined);
120395
- backupEmitState = backupEmitBuilderProgramState(state);
120492
+ builderProgram.backupState = function () {
120493
+ ts.Debug.assert(backupState === undefined);
120494
+ backupState = cloneBuilderProgramState(state);
120396
120495
  };
120397
- builderProgram.restoreEmitState = function () {
120398
- restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
120399
- backupEmitState = undefined;
120496
+ builderProgram.restoreState = function () {
120497
+ state = ts.Debug.checkDefined(backupState);
120498
+ backupState = undefined;
120400
120499
  };
120401
120500
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
120402
120501
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
120403
120502
  builderProgram.emit = emit;
120404
120503
  builderProgram.releaseProgram = function () {
120405
120504
  releaseCache(state);
120406
- backupEmitState = undefined;
120505
+ backupState = undefined;
120407
120506
  };
120408
120507
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
120409
120508
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -120462,59 +120561,35 @@ var ts;
120462
120561
  return toAffectedFileEmitResult(state,
120463
120562
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
120464
120563
  // Otherwise just affected file
120465
- ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
120466
- getWriteFileCallback(writeFile, customTransformers) :
120564
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120565
+ getWriteFileUpdatingSignatureCallback(writeFile) :
120467
120566
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
120468
120567
  }
120469
- function getWriteFileCallback(writeFile, customTransformers) {
120568
+ function getWriteFileUpdatingSignatureCallback(writeFile) {
120470
120569
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
120471
- var _a, _b, _c;
120570
+ var _a;
120472
120571
  if (ts.isDeclarationFileName(fileName)) {
120473
- if (!ts.outFile(state.compilerOptions)) {
120474
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120475
- var newSignature = void 0;
120476
- if (!customTransformers) {
120477
- var file = sourceFiles[0];
120478
- var info = state.fileInfos.get(file.resolvedPath);
120479
- if (info.signature === file.version) {
120480
- newSignature = computeSignature(text, data, computeHash);
120481
- if (newSignature !== file.version) { // Update it
120482
- if (host.storeFilesChangingSignatureDuringEmit)
120483
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120484
- if (state.exportedModulesMap)
120485
- ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
120486
- if (state.affectedFiles) {
120487
- // Keep old signature so we know what to undo if cancellation happens
120488
- var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
120489
- if (existing === undefined)
120490
- (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
120491
- info.signature = newSignature;
120492
- }
120493
- else {
120494
- // These are directly commited
120495
- info.signature = newSignature;
120496
- (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120497
- }
120498
- }
120572
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120573
+ var file = sourceFiles[0];
120574
+ var info = state.fileInfos.get(file.resolvedPath);
120575
+ var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120576
+ if (signature === file.version) {
120577
+ var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120578
+ if (newSignature !== file.version) { // Update it
120579
+ if (host.storeFilesChangingSignatureDuringEmit)
120580
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120581
+ if (state.exportedModulesMap)
120582
+ ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
120583
+ if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
120584
+ state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
120499
120585
  }
120500
- }
120501
- if (state.compilerOptions.composite) {
120502
- var filePath = sourceFiles[0].resolvedPath;
120503
- var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
120504
- newSignature || (newSignature = computeSignature(text, data, computeHash));
120505
- if (newSignature !== oldSignature) {
120506
- (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
120507
- state.hasChangedEmitSignature = true;
120586
+ else {
120587
+ info.signature = newSignature;
120588
+ if (state.exportedModulesMap)
120589
+ ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120508
120590
  }
120509
120591
  }
120510
120592
  }
120511
- else if (state.compilerOptions.composite) {
120512
- var newSignature = computeSignature(text, data, computeHash);
120513
- if (newSignature !== state.outSignature) {
120514
- state.outSignature = newSignature;
120515
- state.hasChangedEmitSignature = true;
120516
- }
120517
- }
120518
120593
  }
120519
120594
  if (writeFile)
120520
120595
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -120579,8 +120654,8 @@ var ts;
120579
120654
  }
120580
120655
  }
120581
120656
  }
120582
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
120583
- getWriteFileCallback(writeFile, customTransformers) :
120657
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120658
+ getWriteFileUpdatingSignatureCallback(writeFile) :
120584
120659
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120585
120660
  }
120586
120661
  /**
@@ -120669,58 +120744,29 @@ var ts;
120669
120744
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
120670
120745
  }
120671
120746
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
120672
- function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
120673
- var _a, _b, _c, _d;
120747
+ function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
120748
+ var _a;
120674
120749
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
120675
120750
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
120676
- var state;
120677
- var filePaths;
120678
- var filePathsSetList;
120679
- if (isProgramBundleEmitBuildInfo(program)) {
120680
- state = {
120681
- fileInfos: new ts.Map(),
120682
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
120683
- dtsChangeTime: program.dtsChangeTime,
120684
- outSignature: program.outSignature,
120685
- };
120686
- }
120687
- else {
120688
- filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
120689
- filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
120690
- var fileInfos_2 = new ts.Map();
120691
- var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
120692
- program.fileInfos.forEach(function (fileInfo, index) {
120693
- var path = toFilePath(index + 1);
120694
- var stateFileInfo = toBuilderStateFileInfo(fileInfo);
120695
- fileInfos_2.set(path, stateFileInfo);
120696
- if (emitSignatures_1 && stateFileInfo.signature)
120697
- emitSignatures_1.set(path, stateFileInfo.signature);
120698
- });
120699
- (_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
120700
- if (ts.isNumber(value))
120701
- emitSignatures_1.delete(toFilePath(value));
120702
- else
120703
- emitSignatures_1.set(toFilePath(value[0]), value[1]);
120704
- });
120705
- state = {
120706
- fileInfos: fileInfos_2,
120707
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
120708
- referencedMap: toManyToManyPathMap(program.referencedMap),
120709
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
120710
- 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]; }),
120711
- hasReusableDiagnostic: true,
120712
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
120713
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
120714
- affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
120715
- changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
120716
- dtsChangeTime: program.dtsChangeTime,
120717
- emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
120718
- };
120719
- }
120751
+ var filePaths = program.fileNames.map(toPath);
120752
+ var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
120753
+ var fileInfos = new ts.Map();
120754
+ program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
120755
+ var state = {
120756
+ fileInfos: fileInfos,
120757
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
120758
+ referencedMap: toManyToManyPathMap(program.referencedMap),
120759
+ exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
120760
+ 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]; }),
120761
+ hasReusableDiagnostic: true,
120762
+ affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
120763
+ affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
120764
+ affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
120765
+ };
120720
120766
  return {
120721
120767
  getState: function () { return state; },
120722
- backupEmitState: ts.noop,
120723
- restoreEmitState: ts.noop,
120768
+ backupState: ts.noop,
120769
+ restoreState: ts.noop,
120724
120770
  getProgram: ts.notImplemented,
120725
120771
  getProgramOrUndefined: ts.returnUndefined,
120726
120772
  releaseProgram: ts.noop,
@@ -120765,24 +120811,12 @@ var ts;
120765
120811
  return map;
120766
120812
  }
120767
120813
  }
120768
- ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
120769
- function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
120770
- var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
120771
- var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
120772
- var fileInfos = new ts.Map();
120773
- program.fileInfos.forEach(function (fileInfo, index) {
120774
- var path = ts.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
120775
- var version = ts.isString(fileInfo) ? fileInfo : fileInfo.version; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
120776
- fileInfos.set(path, version);
120777
- });
120778
- return fileInfos;
120779
- }
120780
- ts.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap;
120814
+ ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
120781
120815
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
120782
120816
  return {
120783
120817
  getState: ts.notImplemented,
120784
- backupEmitState: ts.noop,
120785
- restoreEmitState: ts.noop,
120818
+ backupState: ts.noop,
120819
+ restoreState: ts.noop,
120786
120820
  getProgram: getProgram,
120787
120821
  getProgramOrUndefined: function () { return getState().program; },
120788
120822
  releaseProgram: function () { return getState().program = undefined; },
@@ -121066,8 +121100,8 @@ var ts;
121066
121100
  !!redirectedReference;
121067
121101
  var seenNamesInFile = ts.createModeAwareCache();
121068
121102
  var i = 0;
121069
- for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
121070
- var entry = names_4[_i];
121103
+ for (var _i = 0, names_5 = names; _i < names_5.length; _i++) {
121104
+ var entry = names_5[_i];
121071
121105
  var name = ts.isString(entry) ? entry : entry.fileName.toLowerCase();
121072
121106
  // Imports supply a `containingSourceFile` but no `containingSourceFileMode` - it would be redundant
121073
121107
  // they require calculating the mode for a given import from it's position in the resolution table, since a given
@@ -121633,7 +121667,7 @@ var ts;
121633
121667
  }
121634
121668
  function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
121635
121669
  var _a;
121636
- if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node12
121670
+ if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16
121637
121671
  && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
121638
121672
  return false;
121639
121673
  }
@@ -121898,9 +121932,9 @@ var ts;
121898
121932
  if (!preferSymlinks) {
121899
121933
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
121900
121934
  // so we only need to remove them from the realpath filenames.
121901
- var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
121902
- if (result_16)
121903
- return result_16;
121935
+ var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
121936
+ if (result_15)
121937
+ return result_15;
121904
121938
  }
121905
121939
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
121906
121940
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -121920,10 +121954,10 @@ var ts;
121920
121954
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
121921
121955
  var symlinkDirectory = symlinkDirectories_1[_i];
121922
121956
  var option = ts.resolvePath(symlinkDirectory, relative);
121923
- var result_17 = cb(option, target === referenceRedirect);
121957
+ var result_16 = cb(option, target === referenceRedirect);
121924
121958
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
121925
- if (result_17)
121926
- return result_17;
121959
+ if (result_16)
121960
+ return result_16;
121927
121961
  }
121928
121962
  });
121929
121963
  });
@@ -122218,7 +122252,7 @@ var ts;
122218
122252
  var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
122219
122253
  if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
122220
122254
  var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
122221
- if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
122255
+ if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
122222
122256
  // `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
122223
122257
  // an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
122224
122258
  // usually called to conjure an import out of thin air, we don't have an existing usage to call `getModeForUsageAtIndex`
@@ -122815,7 +122849,6 @@ var ts;
122815
122849
  readDirectory: ts.maybeBind(host, host.readDirectory),
122816
122850
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
122817
122851
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
122818
- now: ts.maybeBind(host, host.now),
122819
122852
  };
122820
122853
  function writeFile(fileName, text, writeByteOrderMark, onError) {
122821
122854
  try {
@@ -122876,7 +122909,6 @@ var ts;
122876
122909
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
122877
122910
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
122878
122911
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
122879
- now: ts.maybeBind(system, system.now),
122880
122912
  };
122881
122913
  }
122882
122914
  ts.createProgramHost = createProgramHost;
@@ -122944,26 +122976,20 @@ var ts;
122944
122976
  var ts;
122945
122977
  (function (ts) {
122946
122978
  function readBuilderProgram(compilerOptions, host) {
122979
+ if (ts.outFile(compilerOptions))
122980
+ return undefined;
122947
122981
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
122948
122982
  if (!buildInfoPath)
122949
122983
  return undefined;
122950
- var buildInfo;
122951
- if (host.getBuildInfo) {
122952
- buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
122953
- if (!buildInfo)
122954
- return undefined;
122955
- }
122956
- else {
122957
- var content = host.readFile(buildInfoPath);
122958
- if (!content)
122959
- return undefined;
122960
- buildInfo = ts.getBuildInfo(content);
122961
- }
122984
+ var content = host.readFile(buildInfoPath);
122985
+ if (!content)
122986
+ return undefined;
122987
+ var buildInfo = ts.getBuildInfo(content);
122962
122988
  if (buildInfo.version !== ts.version)
122963
122989
  return undefined;
122964
122990
  if (!buildInfo.program)
122965
122991
  return undefined;
122966
- return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
122992
+ return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
122967
122993
  }
122968
122994
  ts.readBuilderProgram = readBuilderProgram;
122969
122995
  function createIncrementalCompilerHost(options, system) {
@@ -122972,7 +122998,6 @@ var ts;
122972
122998
  host.createHash = ts.maybeBind(system, system.createHash);
122973
122999
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
122974
123000
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
122975
- host.now = ts.maybeBind(system, system.now);
122976
123001
  ts.setGetSourceFileAsHashVersioned(host, system);
122977
123002
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
122978
123003
  return host;
@@ -123707,17 +123732,14 @@ var ts;
123707
123732
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
123708
123733
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
123709
123734
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
123710
- UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
123711
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
123712
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
123713
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
123714
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
123715
- UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
123735
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
123736
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
123737
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
123738
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
123716
123739
  /**
123717
123740
  * Projects with no outputs (i.e. "solution" files)
123718
123741
  */
123719
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
123720
- UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
123742
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
123721
123743
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
123722
123744
  function resolveConfigFileProjectName(project) {
123723
123745
  if (ts.fileExtensionIs(project, ".json" /* Json */)) {
@@ -123762,11 +123784,9 @@ var ts;
123762
123784
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
123763
123785
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
123764
123786
  }
123765
- /*@internal*/
123766
- function getCurrentTime(host) {
123767
- return host.now ? host.now() : new Date();
123787
+ function newer(date1, date2) {
123788
+ return date2 > date1 ? date2 : date1;
123768
123789
  }
123769
- ts.getCurrentTime = getCurrentTime;
123770
123790
  /*@internal*/
123771
123791
  function isCircularBuildOrder(buildOrder) {
123772
123792
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -123856,7 +123876,6 @@ var ts;
123856
123876
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
123857
123877
  };
123858
123878
  }
123859
- compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
123860
123879
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
123861
123880
  var state = {
123862
123881
  host: host,
@@ -123873,9 +123892,8 @@ var ts;
123873
123892
  resolvedConfigFilePaths: new ts.Map(),
123874
123893
  configFileCache: new ts.Map(),
123875
123894
  projectStatus: new ts.Map(),
123895
+ buildInfoChecked: new ts.Map(),
123876
123896
  extendedConfigCache: new ts.Map(),
123877
- buildInfoCache: new ts.Map(),
123878
- outputTimeStamps: new ts.Map(),
123879
123897
  builderPrograms: new ts.Map(),
123880
123898
  diagnostics: new ts.Map(),
123881
123899
  projectPendingBuild: new ts.Map(),
@@ -123899,7 +123917,6 @@ var ts;
123899
123917
  allWatchedConfigFiles: new ts.Map(),
123900
123918
  allWatchedExtendedConfigFiles: new ts.Map(),
123901
123919
  allWatchedPackageJsonFiles: new ts.Map(),
123902
- filesWatched: new ts.Map(),
123903
123920
  lastCachedPackageJsonLookups: new ts.Map(),
123904
123921
  timerToBuildInvalidatedProject: undefined,
123905
123922
  reportFileChangeDetected: false,
@@ -124006,12 +124023,11 @@ var ts;
124006
124023
  // Config file cache
124007
124024
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
124008
124025
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
124026
+ ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
124009
124027
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
124010
124028
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
124011
124029
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
124012
124030
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
124013
- ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
124014
- ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
124015
124031
  // Remove watches for the program no longer in the solution
124016
124032
  if (state.watch) {
124017
124033
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
@@ -124302,21 +124318,21 @@ var ts;
124302
124318
  }
124303
124319
  function emit(writeFileCallback, cancellationToken, customTransformers) {
124304
124320
  var _a;
124305
- var _b, _c, _d;
124321
+ var _b, _c;
124306
124322
  ts.Debug.assertIsDefined(program);
124307
124323
  ts.Debug.assert(step === BuildStep.Emit);
124308
124324
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
124309
- program.backupEmitState();
124325
+ program.backupState();
124310
124326
  var declDiagnostics;
124311
124327
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
124312
124328
  var outputFiles = [];
124313
124329
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
124314
124330
  /*write*/ undefined,
124315
- /*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,
124331
+ /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
124316
124332
  /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
124317
124333
  // Don't emit .d.ts if there are decl file errors
124318
124334
  if (declDiagnostics) {
124319
- program.restoreEmitState();
124335
+ program.restoreState();
124320
124336
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
124321
124337
  return {
124322
124338
  emitSkipped: true,
@@ -124326,43 +124342,37 @@ var ts;
124326
124342
  // Actual Emit
124327
124343
  var host = state.host, compilerHost = state.compilerHost;
124328
124344
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124329
- var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
124345
+ var newestDeclarationFileContentChangedTime = minimumDate;
124346
+ var anyDtsChanged = false;
124330
124347
  var emitterDiagnostics = ts.createDiagnosticCollection();
124331
124348
  var emittedOutputs = new ts.Map();
124332
- var options = program.getCompilerOptions();
124333
- var isIncremental = ts.isIncrementalCompilation(options);
124334
- var outputTimeStampMap;
124335
- var now;
124336
124349
  outputFiles.forEach(function (_a) {
124337
- var _b, _c;
124338
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124339
- var path = toPath(state, name);
124340
- emittedOutputs.set(toPath(state, name), name);
124341
- if (buildInfo) {
124342
- setBuildInfo(state, buildInfo, projectPath, options);
124343
- 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)) {
124350
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124351
+ var priorChangeTime;
124352
+ if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124353
+ // Check for unchanged .d.ts files
124354
+ if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124355
+ priorChangeTime = host.getModifiedTime(name);
124356
+ }
124357
+ else {
124344
124358
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124359
+ anyDtsChanged = true;
124345
124360
  }
124346
124361
  }
124362
+ emittedOutputs.set(toPath(state, name), name);
124347
124363
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124348
- if (!isIncremental && state.watch) {
124349
- (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
124364
+ if (priorChangeTime !== undefined) {
124365
+ newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
124350
124366
  }
124351
124367
  });
124352
- finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124368
+ finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime,
124369
+ /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124353
124370
  return emitResult;
124354
124371
  }
124355
124372
  function emitBuildInfo(writeFileCallback, cancellationToken) {
124356
124373
  ts.Debug.assertIsDefined(program);
124357
124374
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
124358
- var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
124359
- if (data === null || data === void 0 ? void 0 : data.buildInfo)
124360
- setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
124361
- if (writeFileCallback)
124362
- writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
124363
- else
124364
- state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
124365
- }, cancellationToken);
124375
+ var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
124366
124376
  if (emitResult.diagnostics.length) {
124367
124377
  reportErrors(state, emitResult.diagnostics);
124368
124378
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -124375,7 +124385,7 @@ var ts;
124375
124385
  step = BuildStep.QueueReferencingProjects;
124376
124386
  return emitResult;
124377
124387
  }
124378
- function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
124388
+ function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
124379
124389
  var _a;
124380
124390
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
124381
124391
  if (emitDiagnostics.length) {
@@ -124386,11 +124396,13 @@ var ts;
124386
124396
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
124387
124397
  }
124388
124398
  // Update time stamps for rest of the outputs
124389
- updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124399
+ var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124390
124400
  state.diagnostics.delete(projectPath);
124391
124401
  state.projectStatus.set(projectPath, {
124392
124402
  type: ts.UpToDateStatusType.UpToDate,
124393
- newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
124403
+ newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
124404
+ maximumDate :
124405
+ newestDeclarationFileContentChangedTime,
124394
124406
  oldestOutputFileName: oldestOutputFileName
124395
124407
  });
124396
124408
  afterProgramDone(state, program, config);
@@ -124425,21 +124437,13 @@ var ts;
124425
124437
  ts.Debug.assert(!!outputFiles.length);
124426
124438
  var emitterDiagnostics = ts.createDiagnosticCollection();
124427
124439
  var emittedOutputs = new ts.Map();
124428
- var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124429
- var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
124430
124440
  outputFiles.forEach(function (_a) {
124431
- var _b, _c;
124432
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124441
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124433
124442
  emittedOutputs.set(toPath(state, name), name);
124434
- if (buildInfo) {
124435
- setBuildInfo(state, buildInfo, projectPath, config.options);
124436
- if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
124437
- resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124438
- }
124439
- }
124440
124443
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124441
124444
  });
124442
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
124445
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate,
124446
+ /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
124443
124447
  return { emitSkipped: false, diagnostics: emitDiagnostics };
124444
124448
  }
124445
124449
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -124544,7 +124548,7 @@ var ts;
124544
124548
  }
124545
124549
  continue;
124546
124550
  }
124547
- if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
124551
+ if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
124548
124552
  reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
124549
124553
  return createUpdateOutputFileStampsProject(state, project, projectPath, config, buildOrder);
124550
124554
  }
@@ -124601,7 +124605,7 @@ var ts;
124601
124605
  state.projectCompilerOptions = state.baseCompilerOptions;
124602
124606
  }
124603
124607
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
124604
- var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
124608
+ var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
124605
124609
  reportAndStoreErrors(state, resolvedPath, diagnostics);
124606
124610
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
124607
124611
  if (canEmitBuildInfo)
@@ -124609,95 +124613,9 @@ var ts;
124609
124613
  afterProgramDone(state, program, config);
124610
124614
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
124611
124615
  }
124612
- function isFileWatcherWithModifiedTime(value) {
124613
- return !!value.watcher;
124614
- }
124615
- function getModifiedTime(state, fileName) {
124616
- var path = toPath(state, fileName);
124617
- var existing = state.filesWatched.get(path);
124618
- if (state.watch && !!existing) {
124619
- if (!isFileWatcherWithModifiedTime(existing))
124620
- return existing;
124621
- if (existing.modifiedTime)
124622
- return existing.modifiedTime;
124623
- }
124624
- var result = ts.getModifiedTime(state.host, fileName);
124625
- if (state.watch) {
124626
- if (existing)
124627
- existing.modifiedTime = result;
124628
- else
124629
- state.filesWatched.set(path, result);
124630
- }
124631
- return result;
124632
- }
124633
- function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
124634
- var path = toPath(state, file);
124635
- var existing = state.filesWatched.get(path);
124636
- if (existing && isFileWatcherWithModifiedTime(existing)) {
124637
- existing.callbacks.push(callback);
124638
- }
124639
- else {
124640
- var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
124641
- var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
124642
- ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
124643
- existing.modifiedTime = modifiedTime;
124644
- existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
124645
- }, pollingInterval, options, watchType, project);
124646
- state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
124647
- }
124648
- return {
124649
- close: function () {
124650
- var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
124651
- ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
124652
- if (existing.callbacks.length === 1) {
124653
- state.filesWatched.delete(path);
124654
- ts.closeFileWatcherOf(existing);
124655
- }
124656
- else {
124657
- ts.unorderedRemoveItem(existing.callbacks, callback);
124658
- }
124659
- }
124660
- };
124661
- }
124662
- function getOutputTimeStampMap(state, resolvedConfigFilePath) {
124663
- if (!state.watch)
124664
- return undefined;
124665
- var result = state.outputTimeStamps.get(resolvedConfigFilePath);
124666
- if (!result)
124667
- state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
124668
- return result;
124669
- }
124670
- function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
124671
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
124672
- var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
124673
- if (existing) {
124674
- existing.buildInfo = buildInfo;
124675
- existing.modifiedTime = getCurrentTime(state.host);
124676
- }
124677
- else {
124678
- state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
124679
- }
124680
- }
124681
- function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
124682
- var path = toPath(state, buildInfoPath);
124683
- var existing = state.buildInfoCache.get(resolvedConfigPath);
124684
- return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
124685
- }
124686
- function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
124687
- var path = toPath(state, buildInfoPath);
124688
- var existing = state.buildInfoCache.get(resolvedConfigPath);
124689
- if (existing !== undefined && existing.path === path) {
124690
- return existing.buildInfo || undefined;
124691
- }
124692
- var value = state.readFileWithCache(buildInfoPath);
124693
- var buildInfo = value ? ts.getBuildInfo(value) : undefined;
124694
- ts.Debug.assert(modifiedTime || !buildInfo);
124695
- state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
124696
- return buildInfo;
124697
- }
124698
124616
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
124699
124617
  // Check tsconfig time
124700
- var tsconfigTime = getModifiedTime(state, configFile);
124618
+ var tsconfigTime = ts.getModifiedTime(state.host, configFile);
124701
124619
  if (oldestOutputFileTime < tsconfigTime) {
124702
124620
  return {
124703
124621
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -124707,24 +124625,88 @@ var ts;
124707
124625
  }
124708
124626
  }
124709
124627
  function getUpToDateStatusWorker(state, project, resolvedPath) {
124710
- var _a, _b, _c;
124628
+ var force = !!state.options.force;
124629
+ var newestInputFileName = undefined;
124630
+ var newestInputFileTime = minimumDate;
124631
+ var host = state.host;
124632
+ // Get timestamps of input files
124633
+ for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
124634
+ var inputFile = _a[_i];
124635
+ if (!host.fileExists(inputFile)) {
124636
+ return {
124637
+ type: ts.UpToDateStatusType.Unbuildable,
124638
+ reason: inputFile + " does not exist"
124639
+ };
124640
+ }
124641
+ if (!force) {
124642
+ var inputTime = ts.getModifiedTime(host, inputFile);
124643
+ if (inputTime > newestInputFileTime) {
124644
+ newestInputFileName = inputFile;
124645
+ newestInputFileTime = inputTime;
124646
+ }
124647
+ }
124648
+ }
124711
124649
  // Container if no files are specified in the project
124712
124650
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
124713
124651
  return {
124714
124652
  type: ts.UpToDateStatusType.ContainerOnly
124715
124653
  };
124716
124654
  }
124717
- // Fast check to see if reference projects are buildable
124718
- var referenceStatuses;
124719
- var force = !!state.options.force;
124655
+ // Collect the expected outputs of this project
124656
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
124657
+ // Now see if all outputs are newer than the newest input
124658
+ var oldestOutputFileName = "(none)";
124659
+ var oldestOutputFileTime = maximumDate;
124660
+ var newestOutputFileName = "(none)";
124661
+ var newestOutputFileTime = minimumDate;
124662
+ var missingOutputFileName;
124663
+ var newestDeclarationFileContentChangedTime = minimumDate;
124664
+ var isOutOfDateWithInputs = false;
124665
+ if (!force) {
124666
+ for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
124667
+ var output = outputs_1[_b];
124668
+ // Output is missing; can stop checking
124669
+ // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124670
+ if (!host.fileExists(output)) {
124671
+ missingOutputFileName = output;
124672
+ break;
124673
+ }
124674
+ var outputTime = ts.getModifiedTime(host, output);
124675
+ if (outputTime < oldestOutputFileTime) {
124676
+ oldestOutputFileTime = outputTime;
124677
+ oldestOutputFileName = output;
124678
+ }
124679
+ // If an output is older than the newest input, we can stop checking
124680
+ // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124681
+ if (outputTime < newestInputFileTime) {
124682
+ isOutOfDateWithInputs = true;
124683
+ break;
124684
+ }
124685
+ if (outputTime > newestOutputFileTime) {
124686
+ newestOutputFileTime = outputTime;
124687
+ newestOutputFileName = output;
124688
+ }
124689
+ // Keep track of when the most recent time a .d.ts file was changed.
124690
+ // In addition to file timestamps, we also keep track of when a .d.ts file
124691
+ // had its file touched but not had its contents changed - this allows us
124692
+ // to skip a downstream typecheck
124693
+ if (ts.isDeclarationFileName(output)) {
124694
+ var outputModifiedTime = ts.getModifiedTime(host, output);
124695
+ newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
124696
+ }
124697
+ }
124698
+ }
124699
+ var pseudoUpToDate = false;
124700
+ var usesPrepend = false;
124701
+ var upstreamChangedProject;
124720
124702
  if (project.projectReferences) {
124721
124703
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
124722
- for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
124723
- var ref = _d[_i];
124704
+ for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
124705
+ var ref = _d[_c];
124706
+ usesPrepend = usesPrepend || !!(ref.prepend);
124724
124707
  var resolvedRef = ts.resolveProjectReferencePath(ref);
124725
124708
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
124726
- var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
124727
- var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
124709
+ var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
124728
124710
  // Its a circular reference ignore the status of this project
124729
124711
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
124730
124712
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) { // Container only ignore this project
@@ -124746,188 +124728,75 @@ var ts;
124746
124728
  upstreamProjectName: ref.path
124747
124729
  };
124748
124730
  }
124749
- if (!force)
124750
- (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
124751
- }
124752
- }
124753
- if (force)
124754
- return { type: ts.UpToDateStatusType.ForceBuild };
124755
- // Check buildinfo first
124756
- var host = state.host;
124757
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
124758
- var oldestOutputFileName = "(none)";
124759
- var oldestOutputFileTime = maximumDate;
124760
- var buildInfoTime;
124761
- var buildInfoProgram;
124762
- var buildInfoVersionMap;
124763
- var newestDeclarationFileContentChangedTime;
124764
- if (buildInfoPath) {
124765
- var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
124766
- buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
124767
- if (buildInfoTime === ts.missingFileModifiedTime) {
124768
- if (!buildInfoCacheEntry_1) {
124769
- state.buildInfoCache.set(resolvedPath, {
124770
- path: toPath(state, buildInfoPath),
124771
- buildInfo: false,
124772
- modifiedTime: buildInfoTime
124773
- });
124774
- }
124775
- return {
124776
- type: ts.UpToDateStatusType.OutputMissing,
124777
- missingOutputFileName: buildInfoPath
124778
- };
124779
- }
124780
- var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
124781
- if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
124782
- return {
124783
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
124784
- version: buildInfo.version
124785
- };
124786
- }
124787
- if (buildInfo.program) {
124788
- if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
124789
- (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
124731
+ // Check oldest output file name only if there is no missing output file name
124732
+ // (a check we will have skipped if this is a forced build)
124733
+ if (!force && !missingOutputFileName) {
124734
+ // If the upstream project's newest file is older than our oldest output, we
124735
+ // can't be out of date because of it
124736
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
124737
+ continue;
124738
+ }
124739
+ // If the upstream project has only change .d.ts files, and we've built
124740
+ // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
124741
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
124742
+ pseudoUpToDate = true;
124743
+ upstreamChangedProject = ref.path;
124744
+ continue;
124745
+ }
124746
+ // We have an output older than an upstream output - we are out of date
124747
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
124790
124748
  return {
124791
- type: ts.UpToDateStatusType.OutOfDateBuildInfo,
124792
- buildInfoFile: buildInfoPath
124749
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124750
+ outOfDateOutputFileName: oldestOutputFileName,
124751
+ newerProjectName: ref.path
124793
124752
  };
124794
124753
  }
124795
- buildInfoProgram = buildInfo.program;
124796
124754
  }
124797
- oldestOutputFileTime = buildInfoTime;
124798
- oldestOutputFileName = buildInfoPath;
124799
- newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
124800
124755
  }
124801
- // Check input files
124802
- var newestInputFileName = undefined;
124803
- var newestInputFileTime = minimumDate;
124804
- var pseudoInputUptodate = false;
124805
- // Get timestamps of input files
124806
- for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
124807
- var inputFile = _f[_e];
124808
- var inputTime = getModifiedTime(state, inputFile);
124809
- if (inputTime === ts.missingFileModifiedTime) {
124810
- return {
124811
- type: ts.UpToDateStatusType.Unbuildable,
124812
- reason: inputFile + " does not exist"
124813
- };
124814
- }
124815
- // If an buildInfo is older than the newest input, we can stop checking
124816
- if (buildInfoTime && buildInfoTime < inputTime) {
124817
- var version_3 = void 0;
124818
- var currentVersion = void 0;
124819
- if (buildInfoProgram) {
124820
- // Read files and see if they are same, read is anyways cached
124821
- if (!buildInfoVersionMap)
124822
- buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
124823
- version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
124824
- var text = version_3 ? state.readFileWithCache(inputFile) : undefined;
124825
- currentVersion = text && (host.createHash || ts.generateDjb2Hash)(text);
124826
- if (version_3 && version_3 === currentVersion)
124827
- pseudoInputUptodate = true;
124828
- }
124829
- if (!version_3 || version_3 !== currentVersion) {
124830
- return {
124831
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
124832
- outOfDateOutputFileName: buildInfoPath,
124833
- newerInputFileName: inputFile
124834
- };
124835
- }
124836
- }
124837
- if (inputTime > newestInputFileTime) {
124838
- newestInputFileName = inputFile;
124839
- newestInputFileTime = inputTime;
124840
- }
124756
+ if (missingOutputFileName !== undefined) {
124757
+ return {
124758
+ type: ts.UpToDateStatusType.OutputMissing,
124759
+ missingOutputFileName: missingOutputFileName
124760
+ };
124841
124761
  }
124842
- // Now see if all outputs are newer than the newest input
124843
- // Dont check output timestamps if we have buildinfo telling us output is uptodate
124844
- if (!buildInfoPath) {
124845
- // Collect the expected outputs of this project
124846
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
124847
- var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
124848
- for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
124849
- var output = outputs_1[_g];
124850
- var path = toPath(state, output);
124851
- // Output is missing; can stop checking
124852
- var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
124853
- if (!outputTime) {
124854
- outputTime = ts.getModifiedTime(state.host, output);
124855
- outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
124856
- }
124857
- if (outputTime === ts.missingFileModifiedTime) {
124858
- return {
124859
- type: ts.UpToDateStatusType.OutputMissing,
124860
- missingOutputFileName: output
124861
- };
124862
- }
124863
- if (outputTime < oldestOutputFileTime) {
124864
- oldestOutputFileTime = outputTime;
124865
- oldestOutputFileName = output;
124866
- }
124867
- // If an output is older than the newest input, we can stop checking
124868
- if (outputTime < newestInputFileTime) {
124869
- return {
124870
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
124871
- outOfDateOutputFileName: oldestOutputFileName,
124872
- newerInputFileName: newestInputFileName
124873
- };
124874
- }
124875
- }
124762
+ if (isOutOfDateWithInputs) {
124763
+ return {
124764
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
124765
+ outOfDateOutputFileName: oldestOutputFileName,
124766
+ newerInputFileName: newestInputFileName
124767
+ };
124876
124768
  }
124877
- var seenRefs = buildInfoPath ? new ts.Set() : undefined;
124878
- var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
124879
- seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
124880
- var pseudoUpToDate = false;
124881
- var usesPrepend = false;
124882
- var upstreamChangedProject;
124883
- if (referenceStatuses) {
124884
- for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
124885
- var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
124886
- usesPrepend = usesPrepend || !!(ref.prepend);
124887
- // If the upstream project's newest file is older than our oldest output, we
124888
- // can't be out of date because of it
124889
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
124890
- continue;
124891
- }
124892
- // Check if tsbuildinfo path is shared, then we need to rebuild
124893
- if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
124769
+ else {
124770
+ // Check tsconfig time
124771
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
124772
+ if (configStatus)
124773
+ return configStatus;
124774
+ // Check extended config time
124775
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
124776
+ if (extendedConfigStatus)
124777
+ return extendedConfigStatus;
124778
+ // Check package file time
124779
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
124780
+ var path = _a[0];
124781
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
124782
+ });
124783
+ if (dependentPackageFileStatus)
124784
+ return dependentPackageFileStatus;
124785
+ }
124786
+ if (!force && !state.buildInfoChecked.has(resolvedPath)) {
124787
+ state.buildInfoChecked.set(resolvedPath, true);
124788
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
124789
+ if (buildInfoPath) {
124790
+ var value = state.readFileWithCache(buildInfoPath);
124791
+ var buildInfo = value && ts.getBuildInfo(value);
124792
+ if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
124894
124793
  return {
124895
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124896
- outOfDateOutputFileName: buildInfoPath,
124897
- newerProjectName: ref.path
124794
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
124795
+ version: buildInfo.version
124898
124796
  };
124899
124797
  }
124900
- // If the upstream project has only change .d.ts files, and we've built
124901
- // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
124902
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
124903
- pseudoUpToDate = true;
124904
- upstreamChangedProject = ref.path;
124905
- continue;
124906
- }
124907
- // We have an output older than an upstream output - we are out of date
124908
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
124909
- return {
124910
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124911
- outOfDateOutputFileName: oldestOutputFileName,
124912
- newerProjectName: ref.path
124913
- };
124914
124798
  }
124915
124799
  }
124916
- // Check tsconfig time
124917
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
124918
- if (configStatus)
124919
- return configStatus;
124920
- // Check extended config time
124921
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
124922
- if (extendedConfigStatus)
124923
- return extendedConfigStatus;
124924
- // Check package file time
124925
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
124926
- var path = _a[0];
124927
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
124928
- });
124929
- if (dependentPackageFileStatus)
124930
- return dependentPackageFileStatus;
124931
124800
  if (usesPrepend && pseudoUpToDate) {
124932
124801
  return {
124933
124802
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -124937,37 +124806,15 @@ var ts;
124937
124806
  }
124938
124807
  // Up to date
124939
124808
  return {
124940
- type: pseudoUpToDate ?
124941
- ts.UpToDateStatusType.UpToDateWithUpstreamTypes :
124942
- pseudoInputUptodate ?
124943
- ts.UpToDateStatusType.UpToDateWithInputFileText :
124944
- ts.UpToDateStatusType.UpToDate,
124809
+ type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
124945
124810
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
124946
124811
  newestInputFileTime: newestInputFileTime,
124812
+ newestOutputFileTime: newestOutputFileTime,
124947
124813
  newestInputFileName: newestInputFileName,
124814
+ newestOutputFileName: newestOutputFileName,
124948
124815
  oldestOutputFileName: oldestOutputFileName
124949
124816
  };
124950
124817
  }
124951
- function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
124952
- if (seenRefs.has(resolvedRefPath))
124953
- return false;
124954
- seenRefs.add(resolvedRefPath);
124955
- var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
124956
- if (refBuildInfo.path === buildInfoCacheEntry.path)
124957
- return true;
124958
- if (resolvedConfig.projectReferences) {
124959
- // Check references
124960
- for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
124961
- var ref = _a[_i];
124962
- var resolvedRef = ts.resolveProjectReferencePath(ref);
124963
- var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
124964
- var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
124965
- if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
124966
- return true;
124967
- }
124968
- }
124969
- return false;
124970
- }
124971
124818
  function getUpToDateStatus(state, project, resolvedPath) {
124972
124819
  if (project === undefined) {
124973
124820
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -124980,65 +124827,39 @@ var ts;
124980
124827
  state.projectStatus.set(resolvedPath, actual);
124981
124828
  return actual;
124982
124829
  }
124983
- function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
124830
+ function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
124984
124831
  if (proj.options.noEmit)
124985
- return;
124986
- var now;
124987
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
124988
- if (buildInfoPath) {
124989
- if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
124990
- if (!!state.options.verbose)
124991
- reportStatus(state, verboseMessage, proj.options.configFilePath);
124992
- state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
124993
- getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
124994
- }
124995
- state.outputTimeStamps.delete(projectPath);
124996
- return;
124997
- }
124832
+ return priorNewestUpdateTime;
124998
124833
  var host = state.host;
124999
124834
  var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125000
- var outputTimeStampMap = getOutputTimeStampMap(state, projectPath);
125001
- var modifiedOutputs = outputTimeStampMap ? new ts.Set() : undefined;
125002
124835
  if (!skipOutputs || outputs.length !== skipOutputs.size) {
125003
124836
  var reportVerbose = !!state.options.verbose;
124837
+ var now = host.now ? host.now() : new Date();
125004
124838
  for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125005
124839
  var file = outputs_2[_i];
125006
- var path = toPath(state, file);
125007
- if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
124840
+ if (skipOutputs && skipOutputs.has(toPath(state, file))) {
125008
124841
  continue;
124842
+ }
125009
124843
  if (reportVerbose) {
125010
124844
  reportVerbose = false;
125011
124845
  reportStatus(state, verboseMessage, proj.options.configFilePath);
125012
124846
  }
125013
- host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
125014
- if (outputTimeStampMap) {
125015
- outputTimeStampMap.set(path, now);
125016
- modifiedOutputs.add(path);
124847
+ if (ts.isDeclarationFileName(file)) {
124848
+ priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
125017
124849
  }
124850
+ host.setModifiedTime(file, now);
125018
124851
  }
125019
124852
  }
125020
- // Clear out timestamps not in output list any more
125021
- outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.forEach(function (_value, key) {
125022
- if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs.has(key))
125023
- outputTimeStampMap.delete(key);
125024
- });
125025
- }
125026
- function getDtsChangeTime(state, options, resolvedConfigPath) {
125027
- var _a;
125028
- if (!options.composite)
125029
- return undefined;
125030
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125031
- var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, /*modifiedTime*/ undefined);
125032
- 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;
124853
+ return priorNewestUpdateTime;
125033
124854
  }
125034
124855
  function updateOutputTimestamps(state, proj, resolvedPath) {
125035
124856
  if (state.options.dry) {
125036
124857
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
125037
124858
  }
125038
- updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
124859
+ var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125039
124860
  state.projectStatus.set(resolvedPath, {
125040
124861
  type: ts.UpToDateStatusType.UpToDate,
125041
- newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
124862
+ newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
125042
124863
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
125043
124864
  });
125044
124865
  }
@@ -125084,7 +124905,6 @@ var ts;
125084
124905
  break;
125085
124906
  }
125086
124907
  // falls through
125087
- case ts.UpToDateStatusType.UpToDateWithInputFileText:
125088
124908
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125089
124909
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
125090
124910
  if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
@@ -125232,10 +125052,12 @@ var ts;
125232
125052
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
125233
125053
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
125234
125054
  return;
125235
- 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));
125055
+ state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
125056
+ invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
125057
+ }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
125236
125058
  }
125237
125059
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
125238
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
125060
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
125239
125061
  var _a;
125240
125062
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
125241
125063
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -125267,7 +125089,7 @@ var ts;
125267
125089
  if (!state.watch)
125268
125090
  return;
125269
125091
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
125270
- 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); },
125092
+ 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); },
125271
125093
  onDeleteValue: ts.closeFileWatcher,
125272
125094
  });
125273
125095
  }
@@ -125275,7 +125097,7 @@ var ts;
125275
125097
  if (!state.watch || !state.lastCachedPackageJsonLookups)
125276
125098
  return;
125277
125099
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
125278
- 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); },
125100
+ 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); },
125279
125101
  onDeleteValue: ts.closeFileWatcher,
125280
125102
  });
125281
125103
  }
@@ -125407,18 +125229,19 @@ var ts;
125407
125229
  }
125408
125230
  }
125409
125231
  function reportUpToDateStatus(state, configFileName, status) {
125232
+ if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
125233
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125234
+ }
125410
125235
  switch (status.type) {
125411
125236
  case ts.UpToDateStatusType.OutOfDateWithSelf:
125412
- 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));
125237
+ 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));
125413
125238
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
125414
- 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));
125239
+ 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));
125415
125240
  case ts.UpToDateStatusType.OutputMissing:
125416
125241
  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));
125417
- case ts.UpToDateStatusType.OutOfDateBuildInfo:
125418
- 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));
125419
125242
  case ts.UpToDateStatusType.UpToDate:
125420
125243
  if (status.newestInputFileTime !== undefined) {
125421
- 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 || ""));
125244
+ 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 || ""));
125422
125245
  }
125423
125246
  // Don't report anything for "up to date because it was already built" -- too verbose
125424
125247
  break;
@@ -125426,8 +125249,6 @@ var ts;
125426
125249
  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));
125427
125250
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125428
125251
  return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
125429
- case ts.UpToDateStatusType.UpToDateWithInputFileText:
125430
- 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));
125431
125252
  case ts.UpToDateStatusType.UpstreamOutOfDate:
125432
125253
  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));
125433
125254
  case ts.UpToDateStatusType.UpstreamBlocked:
@@ -125438,8 +125259,6 @@ var ts;
125438
125259
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
125439
125260
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
125440
125261
  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);
125441
- case ts.UpToDateStatusType.ForceBuild:
125442
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125443
125262
  case ts.UpToDateStatusType.ContainerOnly:
125444
125263
  // Don't report status on "solution" projects
125445
125264
  // falls through