@typescript-deploys/pr-build 4.7.0-pr-48784-4 → 4.7.0-pr-48997-6

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.20220427";
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,100 @@ 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
+ if (inodeWatching) {
6759
+ updateWatcher(!fileSystemEntryExists(fileOrDirectory, entryKind) ? watchMissingFileSystemEntry : watchPresentFileSystemEntry);
6760
+ }
6761
+ else if (!fileSystemEntryExists(fileOrDirectory, entryKind)) {
6762
+ updateWatcher(watchMissingFileSystemEntry);
6763
+ }
6764
+ }
6765
+ }
6766
+ /**
6767
+ * Watch the file or directory using fs.watchFile since fs.watch threw exception
6768
+ * 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
6769
+ */
6770
+ function watchPresentFileSystemEntryWithFsWatchFile() {
6771
+ return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions);
6772
+ }
6773
+ /**
6774
+ * Watch the file or directory that is missing
6775
+ * and switch to existing file or directory when the missing filesystem entry is created
6776
+ */
6777
+ function watchMissingFileSystemEntry() {
6778
+ return watchFile(fileOrDirectory, function (_fileName, eventKind) {
6779
+ if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
6780
+ callback("rename", "");
6781
+ // Call the callback for current file or directory
6782
+ // For now it could be callback for the inner directory creation,
6783
+ // but just return current directory, better than current no-op
6784
+ updateWatcher(watchPresentFileSystemEntry);
6785
+ }
6786
+ }, fallbackPollingInterval, fallbackOptions);
6787
+ }
6788
+ }
6694
6789
  }
6695
6790
  ts.createSystemWatchFunctions = createSystemWatchFunctions;
6696
6791
  /**
@@ -6743,7 +6838,6 @@ var ts;
6743
6838
  }
6744
6839
  var activeSession;
6745
6840
  var profilePath = "./profile.cpuprofile";
6746
- var hitSystemWatcherLimit = false;
6747
6841
  var Buffer = require("buffer").Buffer;
6748
6842
  var nodeVersion = getNodeMajorVersion();
6749
6843
  var isNode4OrLater = nodeVersion >= 4;
@@ -6758,19 +6852,21 @@ var ts;
6758
6852
  getModifiedTime: getModifiedTime,
6759
6853
  setTimeout: setTimeout,
6760
6854
  clearTimeout: clearTimeout,
6761
- fsWatch: fsWatch,
6855
+ fsWatchWorker: fsWatchWorker,
6762
6856
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6763
6857
  getCurrentDirectory: getCurrentDirectory,
6858
+ fileSystemEntryExists: fileSystemEntryExists,
6764
6859
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
6765
6860
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
6766
6861
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
6767
- directoryExists: directoryExists,
6768
6862
  getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; },
6769
6863
  realpath: realpath,
6770
6864
  tscWatchFile: process.env.TSC_WATCHFILE,
6771
6865
  useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
6772
6866
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
6773
6867
  defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
6868
+ inodeWatching: isLinuxOrMacOs,
6869
+ sysLog: sysLog,
6774
6870
  }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
6775
6871
  var nodeSystem = {
6776
6872
  args: process.argv.slice(2),
@@ -7020,114 +7116,14 @@ var ts;
7020
7116
  // File changed
7021
7117
  eventKind = FileWatcherEventKind.Changed;
7022
7118
  }
7023
- callback(fileName, eventKind, curr.mtime);
7119
+ callback(fileName, eventKind);
7024
7120
  }
7025
7121
  }
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
- }
7122
+ function fsWatchWorker(fileOrDirectory, recursive, callback) {
7123
+ // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
7124
+ // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
7125
+ return _fs.watch(fileOrDirectory, fsSupportsRecursiveFsWatch ?
7126
+ { persistent: true, recursive: !!recursive } : { persistent: true }, callback);
7131
7127
  }
7132
7128
  function readFileWorker(fileName, _encoding) {
7133
7129
  var buffer;
@@ -7274,19 +7270,12 @@ var ts;
7274
7270
  }
7275
7271
  function getModifiedTime(path) {
7276
7272
  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
7273
  try {
7282
7274
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
7283
7275
  }
7284
7276
  catch (e) {
7285
7277
  return undefined;
7286
7278
  }
7287
- finally {
7288
- Error.stackTraceLimit = originalStackTraceLimit;
7289
- }
7290
7279
  }
7291
7280
  function setModifiedTime(path, time) {
7292
7281
  try {
@@ -8257,6 +8246,7 @@ var ts;
8257
8246
  _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
8247
  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
8248
  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."),
8249
+ 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
8250
  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
8251
  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
8252
  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,10 +8258,10 @@ var ts;
8268
8258
  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
8259
  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
8260
  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'."),
8261
+ 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'."),
8262
+ 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
8263
  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
- Dynamic_import_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "Dynamic_import_cannot_have_type_arguments_1326", "Dynamic import cannot have type arguments."),
8264
+ 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
8265
  String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
8276
8266
  Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal: diag(1328, ts.DiagnosticCategory.Error, "Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_li_1328", "Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal."),
8277
8267
  _0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0: diag(1329, ts.DiagnosticCategory.Error, "_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329", "'{0}' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@{0}()'?"),
@@ -8286,7 +8276,7 @@ var ts;
8286
8276
  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
8277
  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
8278
  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'."),
8279
+ 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
8280
  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
8281
  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
8282
  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 +8307,7 @@ var ts;
8317
8307
  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
8308
  _0_was_imported_here: diag(1376, ts.DiagnosticCategory.Message, "_0_was_imported_here_1376", "'{0}' was imported here."),
8319
8309
  _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."),
8310
+ 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
8311
  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
8312
  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
8313
  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 +8359,7 @@ var ts;
8369
8359
  File_redirects_to_file_0: diag(1429, ts.DiagnosticCategory.Message, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
8370
8360
  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
8361
  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."),
8362
+ 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
8363
  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
8364
  Unexpected_keyword_or_identifier: diag(1434, ts.DiagnosticCategory.Error, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
8375
8365
  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 +8377,7 @@ var ts;
8387
8377
  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
8378
  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
8379
  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`."),
8380
+ 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
8381
  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
8382
  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
8383
  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 +8388,7 @@ var ts;
8398
8388
  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
8389
  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
8390
  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."),
8391
+ 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
8392
  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
8393
  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
8394
  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 +8397,8 @@ var ts;
8407
8397
  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
8398
  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
8399
  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."),
8400
+ 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."),
8401
+ 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
8402
  Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
8412
8403
  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
8404
  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."),
@@ -8658,7 +8649,6 @@ var ts;
8658
8649
  A_rest_element_cannot_have_a_property_name: diag(2566, ts.DiagnosticCategory.Error, "A_rest_element_cannot_have_a_property_name_2566", "A rest element cannot have a property name."),
8659
8650
  Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations: diag(2567, ts.DiagnosticCategory.Error, "Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567", "Enum declarations can only merge with namespace or other enum declarations."),
8660
8651
  Property_0_may_not_exist_on_type_1_Did_you_mean_2: diag(2568, ts.DiagnosticCategory.Error, "Property_0_may_not_exist_on_type_1_Did_you_mean_2_2568", "Property '{0}' may not exist on type '{1}'. Did you mean '{2}'?"),
8661
- Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: diag(2569, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569", "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators."),
8662
8652
  Could_not_find_name_0_Did_you_mean_1: diag(2570, ts.DiagnosticCategory.Error, "Could_not_find_name_0_Did_you_mean_1_2570", "Could not find name '{0}'. Did you mean '{1}'?"),
8663
8653
  Object_is_of_type_unknown: diag(2571, ts.DiagnosticCategory.Error, "Object_is_of_type_unknown_2571", "Object is of type 'unknown'."),
8664
8654
  A_rest_element_type_must_be_an_array_type: diag(2574, ts.DiagnosticCategory.Error, "A_rest_element_type_must_be_an_array_type_2574", "A rest element type must be an array type."),
@@ -8886,8 +8876,8 @@ var ts;
8886
8876
  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'."),
8887
8877
  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."),
8888
8878
  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}'?"),
8889
- 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."),
8890
- 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}'?"),
8879
+ 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."),
8880
+ 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}'?"),
8891
8881
  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."),
8892
8882
  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."),
8893
8883
  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."),
@@ -9300,8 +9290,8 @@ var ts;
9300
9290
  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"),
9301
9291
  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"),
9302
9292
  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."),
9303
- 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}'"),
9304
- 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}'"),
9293
+ 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}'"),
9294
+ 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}'"),
9305
9295
  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"),
9306
9296
  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"),
9307
9297
  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"),
@@ -9345,7 +9335,6 @@ var ts;
9345
9335
  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}'."),
9346
9336
  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}'."),
9347
9337
  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."),
9348
- 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"),
9349
9338
  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
9339
  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
9340
  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 +9543,6 @@ var ts;
9554
9543
  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
9544
  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
9545
  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
9546
  You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
9559
9547
  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
9548
  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 +14835,7 @@ var ts;
14847
14835
  }
14848
14836
  ts.getNonAugmentationDeclaration = getNonAugmentationDeclaration;
14849
14837
  function isCommonJSContainingModuleKind(kind) {
14850
- return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.Node12 || kind === ts.ModuleKind.NodeNext;
14838
+ return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.Node16 || kind === ts.ModuleKind.NodeNext;
14851
14839
  }
14852
14840
  function isEffectiveExternalModule(node, compilerOptions) {
14853
14841
  return ts.isExternalModule(node) || compilerOptions.isolatedModules || (isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator);
@@ -18236,6 +18224,16 @@ var ts;
18236
18224
  ".d.ts" /* Dts */;
18237
18225
  }
18238
18226
  ts.getDeclarationEmitExtensionForPath = getDeclarationEmitExtensionForPath;
18227
+ /**
18228
+ * This function is an inverse of `getDeclarationEmitExtensionForPath`.
18229
+ */
18230
+ function getPossibleOriginalInputExtensionForExtension(path) {
18231
+ return ts.fileExtensionIsOneOf(path, [".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".mts" /* Mts */]) ? [".mts" /* Mts */, ".mjs" /* Mjs */] :
18232
+ ts.fileExtensionIsOneOf(path, [".d.cts" /* Dcts */, ".cjs" /* Cjs */, ".cts" /* Cts */]) ? [".cts" /* Cts */, ".cjs" /* Cjs */] :
18233
+ ts.fileExtensionIsOneOf(path, [".json.d.ts"]) ? [".json" /* Json */] :
18234
+ [".tsx" /* Tsx */, ".ts" /* Ts */, ".jsx" /* Jsx */, ".js" /* Js */];
18235
+ }
18236
+ ts.getPossibleOriginalInputExtensionForExtension = getPossibleOriginalInputExtensionForExtension;
18239
18237
  function outFile(options) {
18240
18238
  return options.outFile || options.out;
18241
18239
  }
@@ -20015,7 +20013,7 @@ var ts;
20015
20013
  file.externalModuleIndicator = ts.isFileProbablyExternalModule(file);
20016
20014
  };
20017
20015
  case ts.ModuleDetectionKind.Auto:
20018
- // If module is nodenext or node12, all esm format files are modules
20016
+ // If module is nodenext or node16, all esm format files are modules
20019
20017
  // If jsx is react-jsx or react-jsxdev then jsx tags force module-ness
20020
20018
  // otherwise, the presence of import or export statments (or import.meta) implies module-ness
20021
20019
  var checks = [ts.isFileProbablyExternalModule];
@@ -20023,7 +20021,7 @@ var ts;
20023
20021
  checks.push(isFileModuleFromUsingJSXTag);
20024
20022
  }
20025
20023
  var moduleKind = getEmitModuleKind(options);
20026
- if (moduleKind === ts.ModuleKind.Node12 || moduleKind === ts.ModuleKind.NodeNext) {
20024
+ if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
20027
20025
  checks.push(isFileForcedToBeModuleByFormat);
20028
20026
  }
20029
20027
  var combined_1 = ts.or.apply(void 0, checks);
@@ -20034,7 +20032,7 @@ var ts;
20034
20032
  ts.getSetExternalModuleIndicator = getSetExternalModuleIndicator;
20035
20033
  function getEmitScriptTarget(compilerOptions) {
20036
20034
  return compilerOptions.target ||
20037
- (compilerOptions.module === ts.ModuleKind.Node12 && 7 /* ES2020 */) ||
20035
+ (compilerOptions.module === ts.ModuleKind.Node16 && 9 /* ES2022 */) ||
20038
20036
  (compilerOptions.module === ts.ModuleKind.NodeNext && 99 /* ESNext */) ||
20039
20037
  0 /* ES3 */;
20040
20038
  }
@@ -20052,8 +20050,8 @@ var ts;
20052
20050
  case ts.ModuleKind.CommonJS:
20053
20051
  moduleResolution = ts.ModuleResolutionKind.NodeJs;
20054
20052
  break;
20055
- case ts.ModuleKind.Node12:
20056
- moduleResolution = ts.ModuleResolutionKind.Node12;
20053
+ case ts.ModuleKind.Node16:
20054
+ moduleResolution = ts.ModuleResolutionKind.Node16;
20057
20055
  break;
20058
20056
  case ts.ModuleKind.NodeNext:
20059
20057
  moduleResolution = ts.ModuleResolutionKind.NodeNext;
@@ -20078,7 +20076,7 @@ var ts;
20078
20076
  case ts.ModuleKind.ES2020:
20079
20077
  case ts.ModuleKind.ES2022:
20080
20078
  case ts.ModuleKind.ESNext:
20081
- case ts.ModuleKind.Node12:
20079
+ case ts.ModuleKind.Node16:
20082
20080
  case ts.ModuleKind.NodeNext:
20083
20081
  return true;
20084
20082
  default:
@@ -20103,7 +20101,7 @@ var ts;
20103
20101
  return compilerOptions.esModuleInterop;
20104
20102
  }
20105
20103
  switch (getEmitModuleKind(compilerOptions)) {
20106
- case ts.ModuleKind.Node12:
20104
+ case ts.ModuleKind.Node16:
20107
20105
  case ts.ModuleKind.NodeNext:
20108
20106
  return true;
20109
20107
  }
@@ -20150,10 +20148,6 @@ var ts;
20150
20148
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
20151
20149
  }
20152
20150
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
20153
- function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
20154
- return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
20155
- }
20156
- ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
20157
20151
  function getCompilerOptionValue(options, option) {
20158
20152
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
20159
20153
  }
@@ -26189,7 +26183,7 @@ var ts;
26189
26183
  return node;
26190
26184
  }
26191
26185
  function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) {
26192
- var node = baseFactory.createBaseSourceFileNode(305 /* SourceFile */);
26186
+ var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SourceFile */));
26193
26187
  for (var p in source) {
26194
26188
  if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p))
26195
26189
  continue;
@@ -31314,7 +31308,7 @@ var ts;
31314
31308
  initializeState("", content, languageVersion, /*syntaxCursor*/ undefined, 1 /* JS */);
31315
31309
  // Prime the scanner.
31316
31310
  nextToken();
31317
- var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ false);
31311
+ var entityName = parseEntityName(/*allowReservedWords*/ true);
31318
31312
  var isInvalid = token() === 1 /* EndOfFileToken */ && !parseDiagnostics.length;
31319
31313
  clearState();
31320
31314
  return isInvalid ? entityName : undefined;
@@ -32847,6 +32841,7 @@ var ts;
32847
32841
  var startPos = scanner.getStartPos();
32848
32842
  var result = parseListElement(kind, parseElement);
32849
32843
  if (!result) {
32844
+ parsingContext = saveParsingContext;
32850
32845
  return undefined;
32851
32846
  }
32852
32847
  list.push(result);
@@ -32914,7 +32909,7 @@ var ts;
32914
32909
  }
32915
32910
  return createMissingList();
32916
32911
  }
32917
- function parseEntityName(allowReservedWords, allowPrivateIdentifiers, diagnosticMessage) {
32912
+ function parseEntityName(allowReservedWords, diagnosticMessage) {
32918
32913
  var pos = getNodePos();
32919
32914
  var entity = allowReservedWords ? parseIdentifierName(diagnosticMessage) : parseIdentifier(diagnosticMessage);
32920
32915
  var dotPos = getNodePos();
@@ -32925,7 +32920,7 @@ var ts;
32925
32920
  break;
32926
32921
  }
32927
32922
  dotPos = getNodePos();
32928
- entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, allowPrivateIdentifiers)), pos);
32923
+ entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, /* allowPrivateIdentifiers */ false)), pos);
32929
32924
  }
32930
32925
  return entity;
32931
32926
  }
@@ -33058,7 +33053,7 @@ var ts;
33058
33053
  }
33059
33054
  // TYPES
33060
33055
  function parseEntityNameOfTypeReference() {
33061
- return parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ false, ts.Diagnostics.Type_expected);
33056
+ return parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
33062
33057
  }
33063
33058
  function parseTypeArgumentsOfTypeReference() {
33064
33059
  if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 29 /* LessThanToken */) {
@@ -33191,7 +33186,7 @@ var ts;
33191
33186
  function parseTypeQuery() {
33192
33187
  var pos = getNodePos();
33193
33188
  parseExpected(112 /* TypeOfKeyword */);
33194
- var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
33189
+ var entityName = parseEntityName(/*allowReservedWords*/ true);
33195
33190
  // Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
33196
33191
  var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
33197
33192
  return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
@@ -34159,10 +34154,10 @@ var ts;
34159
34154
  setDecoratorContext(/*val*/ false);
34160
34155
  }
34161
34156
  var pos = getNodePos();
34162
- var expr = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
34157
+ var expr = parseAssignmentExpressionOrHigher();
34163
34158
  var operatorToken;
34164
34159
  while ((operatorToken = parseOptionalToken(27 /* CommaToken */))) {
34165
- expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false), pos);
34160
+ expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(), pos);
34166
34161
  }
34167
34162
  if (saveDecoratorContext) {
34168
34163
  setDecoratorContext(/*val*/ true);
@@ -34170,9 +34165,9 @@ var ts;
34170
34165
  return expr;
34171
34166
  }
34172
34167
  function parseInitializer() {
34173
- return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false) : undefined;
34168
+ return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
34174
34169
  }
34175
- function parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction) {
34170
+ function parseAssignmentExpressionOrHigher() {
34176
34171
  // AssignmentExpression[in,yield]:
34177
34172
  // 1) ConditionalExpression[?in,?yield]
34178
34173
  // 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
@@ -34198,7 +34193,7 @@ var ts;
34198
34193
  // If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
34199
34194
  // not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
34200
34195
  // with AssignmentExpression if we see one.
34201
- var arrowExpression = tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) || tryParseAsyncSimpleArrowFunctionExpression(disallowReturnTypeInArrowFunction);
34196
+ var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
34202
34197
  if (arrowExpression) {
34203
34198
  return arrowExpression;
34204
34199
  }
@@ -34217,7 +34212,7 @@ var ts;
34217
34212
  // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
34218
34213
  // identifier and the current token is an arrow.
34219
34214
  if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
34220
- return parseSimpleArrowFunctionExpression(pos, expr, disallowReturnTypeInArrowFunction, /*asyncModifier*/ undefined);
34215
+ return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
34221
34216
  }
34222
34217
  // Now see if we might be in cases '2' or '3'.
34223
34218
  // If the expression was a LHS expression, and we have an assignment operator, then
@@ -34226,7 +34221,7 @@ var ts;
34226
34221
  // Note: we call reScanGreaterToken so that we get an appropriately merged token
34227
34222
  // for cases like `> > =` becoming `>>=`
34228
34223
  if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
34229
- return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction), pos);
34224
+ return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
34230
34225
  }
34231
34226
  // It wasn't an assignment or a lambda. This is a conditional expression:
34232
34227
  return parseConditionalExpressionRest(expr, pos);
@@ -34269,7 +34264,7 @@ var ts;
34269
34264
  nextToken();
34270
34265
  if (!scanner.hasPrecedingLineBreak() &&
34271
34266
  (token() === 41 /* AsteriskToken */ || isStartOfExpression())) {
34272
- return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false)), pos);
34267
+ return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher()), pos);
34273
34268
  }
34274
34269
  else {
34275
34270
  // if the next token is not on the same line as yield. or we don't have an '*' or
@@ -34277,7 +34272,7 @@ var ts;
34277
34272
  return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
34278
34273
  }
34279
34274
  }
34280
- function parseSimpleArrowFunctionExpression(pos, identifier, disallowReturnTypeInArrowFunction, asyncModifier) {
34275
+ function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
34281
34276
  ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
34282
34277
  var parameter = factory.createParameterDeclaration(
34283
34278
  /*decorators*/ undefined,
@@ -34289,11 +34284,11 @@ var ts;
34289
34284
  finishNode(parameter, identifier.pos);
34290
34285
  var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
34291
34286
  var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
34292
- var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier, disallowReturnTypeInArrowFunction);
34287
+ var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
34293
34288
  var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
34294
34289
  return addJSDocComment(finishNode(node, pos));
34295
34290
  }
34296
- function tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
34291
+ function tryParseParenthesizedArrowFunctionExpression() {
34297
34292
  var triState = isParenthesizedArrowFunctionExpression();
34298
34293
  if (triState === 0 /* False */) {
34299
34294
  // It's definitely not a parenthesized arrow function expression.
@@ -34304,8 +34299,8 @@ var ts;
34304
34299
  // it out, but don't allow any ambiguity, and return 'undefined' if this could be an
34305
34300
  // expression instead.
34306
34301
  return triState === 1 /* True */ ?
34307
- parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, /*disallowReturnTypeInArrowFunction*/ false) :
34308
- tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
34302
+ parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
34303
+ tryParse(parsePossibleParenthesizedArrowFunctionExpression);
34309
34304
  }
34310
34305
  // True -> We definitely expect a parenthesized arrow function here.
34311
34306
  // False -> There *cannot* be a parenthesized arrow function here.
@@ -34435,25 +34430,25 @@ var ts;
34435
34430
  return 2 /* Unknown */;
34436
34431
  }
34437
34432
  }
34438
- function parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
34433
+ function parsePossibleParenthesizedArrowFunctionExpression() {
34439
34434
  var tokenPos = scanner.getTokenPos();
34440
34435
  if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
34441
34436
  return undefined;
34442
34437
  }
34443
- var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false, disallowReturnTypeInArrowFunction);
34438
+ var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
34444
34439
  if (!result) {
34445
34440
  (notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
34446
34441
  }
34447
34442
  return result;
34448
34443
  }
34449
- function tryParseAsyncSimpleArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
34444
+ function tryParseAsyncSimpleArrowFunctionExpression() {
34450
34445
  // We do a check here so that we won't be doing unnecessarily call to "lookAhead"
34451
34446
  if (token() === 131 /* AsyncKeyword */) {
34452
34447
  if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
34453
34448
  var pos = getNodePos();
34454
34449
  var asyncModifier = parseModifiersForArrowFunction();
34455
34450
  var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
34456
- return parseSimpleArrowFunctionExpression(pos, expr, disallowReturnTypeInArrowFunction, asyncModifier);
34451
+ return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
34457
34452
  }
34458
34453
  }
34459
34454
  return undefined;
@@ -34477,7 +34472,7 @@ var ts;
34477
34472
  }
34478
34473
  return 0 /* False */;
34479
34474
  }
34480
- function parseParenthesizedArrowFunctionExpression(allowAmbiguity, disallowReturnTypeInArrowFunction) {
34475
+ function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
34481
34476
  var pos = getNodePos();
34482
34477
  var hasJSDoc = hasPrecedingJSDocComment();
34483
34478
  var modifiers = parseModifiersForArrowFunction();
@@ -34512,23 +34507,6 @@ var ts;
34512
34507
  return undefined;
34513
34508
  }
34514
34509
  }
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
34510
  var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
34533
34511
  if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
34534
34512
  return undefined;
@@ -34557,12 +34535,12 @@ var ts;
34557
34535
  var lastToken = token();
34558
34536
  var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
34559
34537
  var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
34560
- ? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), disallowReturnTypeInArrowFunction)
34538
+ ? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier))
34561
34539
  : parseIdentifier();
34562
34540
  var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
34563
34541
  return withJSDoc(finishNode(node, pos), hasJSDoc);
34564
34542
  }
34565
- function parseArrowFunctionExpressionBody(isAsync, disallowReturnTypeInArrowFunction) {
34543
+ function parseArrowFunctionExpressionBody(isAsync) {
34566
34544
  if (token() === 18 /* OpenBraceToken */) {
34567
34545
  return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
34568
34546
  }
@@ -34590,8 +34568,8 @@ var ts;
34590
34568
  var savedTopLevel = topLevel;
34591
34569
  topLevel = false;
34592
34570
  var node = isAsync
34593
- ? doInAwaitContext(function () { return parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction); })
34594
- : doOutsideOfAwaitContext(function () { return parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction); });
34571
+ ? doInAwaitContext(parseAssignmentExpressionOrHigher)
34572
+ : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
34595
34573
  topLevel = savedTopLevel;
34596
34574
  return node;
34597
34575
  }
@@ -34604,8 +34582,8 @@ var ts;
34604
34582
  // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
34605
34583
  // we do not that for the 'whenFalse' part.
34606
34584
  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)
34585
+ return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
34586
+ ? parseAssignmentExpressionOrHigher()
34609
34587
  : createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
34610
34588
  }
34611
34589
  function parseBinaryExpressionOrHigher(precedence) {
@@ -35497,13 +35475,13 @@ var ts;
35497
35475
  function parseSpreadElement() {
35498
35476
  var pos = getNodePos();
35499
35477
  parseExpected(25 /* DotDotDotToken */);
35500
- var expression = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
35478
+ var expression = parseAssignmentExpressionOrHigher();
35501
35479
  return finishNode(factory.createSpreadElement(expression), pos);
35502
35480
  }
35503
35481
  function parseArgumentOrArrayLiteralElement() {
35504
35482
  return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() :
35505
35483
  token() === 27 /* CommaToken */ ? finishNode(factory.createOmittedExpression(), getNodePos()) :
35506
- parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
35484
+ parseAssignmentExpressionOrHigher();
35507
35485
  }
35508
35486
  function parseArgumentExpression() {
35509
35487
  return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
@@ -35521,7 +35499,7 @@ var ts;
35521
35499
  var pos = getNodePos();
35522
35500
  var hasJSDoc = hasPrecedingJSDocComment();
35523
35501
  if (parseOptionalToken(25 /* DotDotDotToken */)) {
35524
- var expression = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
35502
+ var expression = parseAssignmentExpressionOrHigher();
35525
35503
  return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc);
35526
35504
  }
35527
35505
  var decorators = parseDecorators();
@@ -35550,7 +35528,7 @@ var ts;
35550
35528
  var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 58 /* ColonToken */);
35551
35529
  if (isShorthandPropertyAssignment) {
35552
35530
  var equalsToken = parseOptionalToken(63 /* EqualsToken */);
35553
- var objectAssignmentInitializer = equalsToken ? allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false); }) : undefined;
35531
+ var objectAssignmentInitializer = equalsToken ? allowInAnd(parseAssignmentExpressionOrHigher) : undefined;
35554
35532
  node = factory.createShorthandPropertyAssignment(name, objectAssignmentInitializer);
35555
35533
  // Save equals token for error reporting.
35556
35534
  // TODO(rbuckton): Consider manufacturing this when we need to report an error as it is otherwise not useful.
@@ -35558,7 +35536,7 @@ var ts;
35558
35536
  }
35559
35537
  else {
35560
35538
  parseExpected(58 /* ColonToken */);
35561
- var initializer = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false); });
35539
+ var initializer = allowInAnd(parseAssignmentExpressionOrHigher);
35562
35540
  node = factory.createPropertyAssignment(name, initializer);
35563
35541
  }
35564
35542
  // Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker
@@ -35732,7 +35710,7 @@ var ts;
35732
35710
  }
35733
35711
  var node;
35734
35712
  if (awaitToken ? parseExpected(160 /* OfKeyword */) : parseOptional(160 /* OfKeyword */)) {
35735
- var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false); });
35713
+ var expression = allowInAnd(parseAssignmentExpressionOrHigher);
35736
35714
  parseExpected(21 /* CloseParenToken */);
35737
35715
  node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement());
35738
35716
  }
@@ -36900,7 +36878,7 @@ var ts;
36900
36878
  var pos = getNodePos();
36901
36879
  var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
36902
36880
  parseExpected(58 /* ColonToken */);
36903
- var value = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
36881
+ var value = parseAssignmentExpressionOrHigher();
36904
36882
  return finishNode(factory.createAssertEntry(name, value), pos);
36905
36883
  }
36906
36884
  function parseAssertClause(skipAssertKeyword) {
@@ -36960,7 +36938,7 @@ var ts;
36960
36938
  function parseModuleReference() {
36961
36939
  return isExternalModuleReference()
36962
36940
  ? parseExternalModuleReference()
36963
- : parseEntityName(/*allowReservedWords*/ false, /*allowPrivateIdentifiers*/ false);
36941
+ : parseEntityName(/*allowReservedWords*/ false);
36964
36942
  }
36965
36943
  function parseExternalModuleReference() {
36966
36944
  var pos = getNodePos();
@@ -37139,7 +37117,7 @@ var ts;
37139
37117
  else {
37140
37118
  parseExpected(88 /* DefaultKeyword */);
37141
37119
  }
37142
- var expression = parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ false);
37120
+ var expression = parseAssignmentExpressionOrHigher();
37143
37121
  parseSemicolon();
37144
37122
  setAwaitContext(savedAwaitContext);
37145
37123
  var node = factory.createExportAssignment(decorators, modifiers, isExportEquals, expression);
@@ -37213,7 +37191,7 @@ var ts;
37213
37191
  var pos = getNodePos();
37214
37192
  var hasBrace = parseOptional(18 /* OpenBraceToken */);
37215
37193
  var p2 = getNodePos();
37216
- var entityName = parseEntityName(/* allowReservedWords*/ false, /*allowPrivateIdentifiers*/ false);
37194
+ var entityName = parseEntityName(/* allowReservedWords*/ false);
37217
37195
  while (token() === 80 /* PrivateIdentifier */) {
37218
37196
  reScanHashToken(); // rescan #id as # id
37219
37197
  nextTokenJSDoc(); // then skip the #
@@ -37656,7 +37634,7 @@ var ts;
37656
37634
  // parseEntityName logs an error for non-identifier, so create a MissingNode ourselves to avoid the error
37657
37635
  var p2 = getNodePos();
37658
37636
  var name = ts.tokenIsIdentifierOrKeyword(token())
37659
- ? parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ false)
37637
+ ? parseEntityName(/*allowReservedWords*/ true)
37660
37638
  : undefined;
37661
37639
  if (name) {
37662
37640
  while (token() === 80 /* PrivateIdentifier */) {
@@ -38978,6 +38956,7 @@ var ts;
38978
38956
  ["es2021.intl", "lib.es2021.intl.d.ts"],
38979
38957
  ["es2022.array", "lib.es2022.array.d.ts"],
38980
38958
  ["es2022.error", "lib.es2022.error.d.ts"],
38959
+ ["es2022.intl", "lib.es2022.intl.d.ts"],
38981
38960
  ["es2022.object", "lib.es2022.object.d.ts"],
38982
38961
  ["es2022.string", "lib.es2022.string.d.ts"],
38983
38962
  ["esnext.array", "lib.es2022.array.d.ts"],
@@ -39192,7 +39171,6 @@ var ts;
39192
39171
  type: "boolean",
39193
39172
  affectsSemanticDiagnostics: true,
39194
39173
  affectsEmit: true,
39195
- affectsMultiFileEmitBuildInfo: true,
39196
39174
  category: ts.Diagnostics.Watch_and_Build_Modes,
39197
39175
  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
39176
  defaultValueDescription: false,
@@ -39227,40 +39205,12 @@ var ts;
39227
39205
  affectsSourceFile: true,
39228
39206
  affectsModuleResolution: true,
39229
39207
  affectsEmit: true,
39230
- affectsMultiFileEmitBuildInfo: true,
39231
39208
  paramType: ts.Diagnostics.VERSION,
39232
39209
  showInSimplifiedHelpView: true,
39233
39210
  category: ts.Diagnostics.Language_and_Environment,
39234
39211
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
39235
39212
  defaultValueDescription: 0 /* ES3 */,
39236
39213
  };
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
39214
  var commandOptionsWithoutBuild = [
39265
39215
  // CommandLine only options
39266
39216
  {
@@ -39322,14 +39272,37 @@ var ts;
39322
39272
  category: ts.Diagnostics.Command_line_Options,
39323
39273
  affectsSemanticDiagnostics: true,
39324
39274
  affectsEmit: true,
39325
- affectsMultiFileEmitBuildInfo: true,
39326
39275
  isCommandLineOnly: true,
39327
39276
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
39328
39277
  defaultValueDescription: false,
39329
39278
  },
39330
39279
  // Basic
39331
39280
  ts.targetOptionDeclaration,
39332
- ts.moduleOptionDeclaration,
39281
+ {
39282
+ name: "module",
39283
+ shortName: "m",
39284
+ type: new ts.Map(ts.getEntries({
39285
+ none: ts.ModuleKind.None,
39286
+ commonjs: ts.ModuleKind.CommonJS,
39287
+ amd: ts.ModuleKind.AMD,
39288
+ system: ts.ModuleKind.System,
39289
+ umd: ts.ModuleKind.UMD,
39290
+ es6: ts.ModuleKind.ES2015,
39291
+ es2015: ts.ModuleKind.ES2015,
39292
+ es2020: ts.ModuleKind.ES2020,
39293
+ es2022: ts.ModuleKind.ES2022,
39294
+ esnext: ts.ModuleKind.ESNext,
39295
+ node16: ts.ModuleKind.Node16,
39296
+ nodenext: ts.ModuleKind.NodeNext,
39297
+ })),
39298
+ affectsModuleResolution: true,
39299
+ affectsEmit: true,
39300
+ paramType: ts.Diagnostics.KIND,
39301
+ showInSimplifiedHelpView: true,
39302
+ category: ts.Diagnostics.Modules,
39303
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
39304
+ defaultValueDescription: undefined,
39305
+ },
39333
39306
  {
39334
39307
  name: "lib",
39335
39308
  type: "list",
@@ -39366,7 +39339,6 @@ var ts;
39366
39339
  type: jsxOptionMap,
39367
39340
  affectsSourceFile: true,
39368
39341
  affectsEmit: true,
39369
- affectsMultiFileEmitBuildInfo: true,
39370
39342
  affectsModuleResolution: true,
39371
39343
  paramType: ts.Diagnostics.KIND,
39372
39344
  showInSimplifiedHelpView: true,
@@ -39379,7 +39351,6 @@ var ts;
39379
39351
  shortName: "d",
39380
39352
  type: "boolean",
39381
39353
  affectsEmit: true,
39382
- affectsMultiFileEmitBuildInfo: true,
39383
39354
  showInSimplifiedHelpView: true,
39384
39355
  category: ts.Diagnostics.Emit,
39385
39356
  transpileOptionValue: undefined,
@@ -39390,7 +39361,6 @@ var ts;
39390
39361
  name: "declarationMap",
39391
39362
  type: "boolean",
39392
39363
  affectsEmit: true,
39393
- affectsMultiFileEmitBuildInfo: true,
39394
39364
  showInSimplifiedHelpView: true,
39395
39365
  category: ts.Diagnostics.Emit,
39396
39366
  transpileOptionValue: undefined,
@@ -39401,7 +39371,6 @@ var ts;
39401
39371
  name: "emitDeclarationOnly",
39402
39372
  type: "boolean",
39403
39373
  affectsEmit: true,
39404
- affectsMultiFileEmitBuildInfo: true,
39405
39374
  showInSimplifiedHelpView: true,
39406
39375
  category: ts.Diagnostics.Emit,
39407
39376
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -39412,7 +39381,6 @@ var ts;
39412
39381
  name: "sourceMap",
39413
39382
  type: "boolean",
39414
39383
  affectsEmit: true,
39415
- affectsMultiFileEmitBuildInfo: true,
39416
39384
  showInSimplifiedHelpView: true,
39417
39385
  category: ts.Diagnostics.Emit,
39418
39386
  defaultValueDescription: false,
@@ -39422,9 +39390,6 @@ var ts;
39422
39390
  name: "outFile",
39423
39391
  type: "string",
39424
39392
  affectsEmit: true,
39425
- affectsMultiFileEmitBuildInfo: true,
39426
- affectsDeclarationPath: true,
39427
- affectsBundleEmitBuildInfo: true,
39428
39393
  isFilePath: true,
39429
39394
  paramType: ts.Diagnostics.FILE,
39430
39395
  showInSimplifiedHelpView: true,
@@ -39436,8 +39401,6 @@ var ts;
39436
39401
  name: "outDir",
39437
39402
  type: "string",
39438
39403
  affectsEmit: true,
39439
- affectsMultiFileEmitBuildInfo: true,
39440
- affectsDeclarationPath: true,
39441
39404
  isFilePath: true,
39442
39405
  paramType: ts.Diagnostics.DIRECTORY,
39443
39406
  showInSimplifiedHelpView: true,
@@ -39448,8 +39411,6 @@ var ts;
39448
39411
  name: "rootDir",
39449
39412
  type: "string",
39450
39413
  affectsEmit: true,
39451
- affectsMultiFileEmitBuildInfo: true,
39452
- affectsDeclarationPath: true,
39453
39414
  isFilePath: true,
39454
39415
  paramType: ts.Diagnostics.LOCATION,
39455
39416
  category: ts.Diagnostics.Modules,
@@ -39460,8 +39421,6 @@ var ts;
39460
39421
  name: "composite",
39461
39422
  type: "boolean",
39462
39423
  affectsEmit: true,
39463
- affectsMultiFileEmitBuildInfo: true,
39464
- affectsBundleEmitBuildInfo: true,
39465
39424
  isTSConfigOnly: true,
39466
39425
  category: ts.Diagnostics.Projects,
39467
39426
  transpileOptionValue: undefined,
@@ -39472,8 +39431,6 @@ var ts;
39472
39431
  name: "tsBuildInfoFile",
39473
39432
  type: "string",
39474
39433
  affectsEmit: true,
39475
- affectsMultiFileEmitBuildInfo: true,
39476
- affectsBundleEmitBuildInfo: true,
39477
39434
  isFilePath: true,
39478
39435
  paramType: ts.Diagnostics.FILE,
39479
39436
  category: ts.Diagnostics.Projects,
@@ -39485,7 +39442,6 @@ var ts;
39485
39442
  name: "removeComments",
39486
39443
  type: "boolean",
39487
39444
  affectsEmit: true,
39488
- affectsMultiFileEmitBuildInfo: true,
39489
39445
  showInSimplifiedHelpView: true,
39490
39446
  category: ts.Diagnostics.Emit,
39491
39447
  defaultValueDescription: false,
@@ -39504,7 +39460,6 @@ var ts;
39504
39460
  name: "importHelpers",
39505
39461
  type: "boolean",
39506
39462
  affectsEmit: true,
39507
- affectsMultiFileEmitBuildInfo: true,
39508
39463
  category: ts.Diagnostics.Emit,
39509
39464
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
39510
39465
  defaultValueDescription: false,
@@ -39518,7 +39473,6 @@ var ts;
39518
39473
  })),
39519
39474
  affectsEmit: true,
39520
39475
  affectsSemanticDiagnostics: true,
39521
- affectsMultiFileEmitBuildInfo: true,
39522
39476
  category: ts.Diagnostics.Emit,
39523
39477
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
39524
39478
  defaultValueDescription: 0 /* Remove */,
@@ -39527,7 +39481,6 @@ var ts;
39527
39481
  name: "downlevelIteration",
39528
39482
  type: "boolean",
39529
39483
  affectsEmit: true,
39530
- affectsMultiFileEmitBuildInfo: true,
39531
39484
  category: ts.Diagnostics.Emit,
39532
39485
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
39533
39486
  defaultValueDescription: false,
@@ -39546,9 +39499,6 @@ var ts;
39546
39499
  type: "boolean",
39547
39500
  // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
39548
39501
  // 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
39502
  showInSimplifiedHelpView: true,
39553
39503
  category: ts.Diagnostics.Type_Checking,
39554
39504
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -39558,7 +39508,6 @@ var ts;
39558
39508
  name: "noImplicitAny",
39559
39509
  type: "boolean",
39560
39510
  affectsSemanticDiagnostics: true,
39561
- affectsMultiFileEmitBuildInfo: true,
39562
39511
  strictFlag: true,
39563
39512
  category: ts.Diagnostics.Type_Checking,
39564
39513
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -39568,7 +39517,6 @@ var ts;
39568
39517
  name: "strictNullChecks",
39569
39518
  type: "boolean",
39570
39519
  affectsSemanticDiagnostics: true,
39571
- affectsMultiFileEmitBuildInfo: true,
39572
39520
  strictFlag: true,
39573
39521
  category: ts.Diagnostics.Type_Checking,
39574
39522
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -39577,8 +39525,6 @@ var ts;
39577
39525
  {
39578
39526
  name: "strictFunctionTypes",
39579
39527
  type: "boolean",
39580
- affectsSemanticDiagnostics: true,
39581
- affectsMultiFileEmitBuildInfo: true,
39582
39528
  strictFlag: true,
39583
39529
  category: ts.Diagnostics.Type_Checking,
39584
39530
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -39587,8 +39533,6 @@ var ts;
39587
39533
  {
39588
39534
  name: "strictBindCallApply",
39589
39535
  type: "boolean",
39590
- affectsSemanticDiagnostics: true,
39591
- affectsMultiFileEmitBuildInfo: true,
39592
39536
  strictFlag: true,
39593
39537
  category: ts.Diagnostics.Type_Checking,
39594
39538
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -39598,7 +39542,6 @@ var ts;
39598
39542
  name: "strictPropertyInitialization",
39599
39543
  type: "boolean",
39600
39544
  affectsSemanticDiagnostics: true,
39601
- affectsMultiFileEmitBuildInfo: true,
39602
39545
  strictFlag: true,
39603
39546
  category: ts.Diagnostics.Type_Checking,
39604
39547
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -39608,7 +39551,6 @@ var ts;
39608
39551
  name: "noImplicitThis",
39609
39552
  type: "boolean",
39610
39553
  affectsSemanticDiagnostics: true,
39611
- affectsMultiFileEmitBuildInfo: true,
39612
39554
  strictFlag: true,
39613
39555
  category: ts.Diagnostics.Type_Checking,
39614
39556
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -39618,7 +39560,6 @@ var ts;
39618
39560
  name: "useUnknownInCatchVariables",
39619
39561
  type: "boolean",
39620
39562
  affectsSemanticDiagnostics: true,
39621
- affectsMultiFileEmitBuildInfo: true,
39622
39563
  strictFlag: true,
39623
39564
  category: ts.Diagnostics.Type_Checking,
39624
39565
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -39628,8 +39569,6 @@ var ts;
39628
39569
  name: "alwaysStrict",
39629
39570
  type: "boolean",
39630
39571
  affectsSourceFile: true,
39631
- affectsEmit: true,
39632
- affectsMultiFileEmitBuildInfo: true,
39633
39572
  strictFlag: true,
39634
39573
  category: ts.Diagnostics.Type_Checking,
39635
39574
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -39640,7 +39579,6 @@ var ts;
39640
39579
  name: "noUnusedLocals",
39641
39580
  type: "boolean",
39642
39581
  affectsSemanticDiagnostics: true,
39643
- affectsMultiFileEmitBuildInfo: true,
39644
39582
  category: ts.Diagnostics.Type_Checking,
39645
39583
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
39646
39584
  defaultValueDescription: false,
@@ -39649,7 +39587,6 @@ var ts;
39649
39587
  name: "noUnusedParameters",
39650
39588
  type: "boolean",
39651
39589
  affectsSemanticDiagnostics: true,
39652
- affectsMultiFileEmitBuildInfo: true,
39653
39590
  category: ts.Diagnostics.Type_Checking,
39654
39591
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
39655
39592
  defaultValueDescription: false,
@@ -39658,7 +39595,6 @@ var ts;
39658
39595
  name: "exactOptionalPropertyTypes",
39659
39596
  type: "boolean",
39660
39597
  affectsSemanticDiagnostics: true,
39661
- affectsMultiFileEmitBuildInfo: true,
39662
39598
  category: ts.Diagnostics.Type_Checking,
39663
39599
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
39664
39600
  defaultValueDescription: false,
@@ -39667,7 +39603,6 @@ var ts;
39667
39603
  name: "noImplicitReturns",
39668
39604
  type: "boolean",
39669
39605
  affectsSemanticDiagnostics: true,
39670
- affectsMultiFileEmitBuildInfo: true,
39671
39606
  category: ts.Diagnostics.Type_Checking,
39672
39607
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
39673
39608
  defaultValueDescription: false,
@@ -39677,7 +39612,6 @@ var ts;
39677
39612
  type: "boolean",
39678
39613
  affectsBindDiagnostics: true,
39679
39614
  affectsSemanticDiagnostics: true,
39680
- affectsMultiFileEmitBuildInfo: true,
39681
39615
  category: ts.Diagnostics.Type_Checking,
39682
39616
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
39683
39617
  defaultValueDescription: false,
@@ -39686,7 +39620,6 @@ var ts;
39686
39620
  name: "noUncheckedIndexedAccess",
39687
39621
  type: "boolean",
39688
39622
  affectsSemanticDiagnostics: true,
39689
- affectsMultiFileEmitBuildInfo: true,
39690
39623
  category: ts.Diagnostics.Type_Checking,
39691
39624
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
39692
39625
  defaultValueDescription: false,
@@ -39695,7 +39628,6 @@ var ts;
39695
39628
  name: "noImplicitOverride",
39696
39629
  type: "boolean",
39697
39630
  affectsSemanticDiagnostics: true,
39698
- affectsMultiFileEmitBuildInfo: true,
39699
39631
  category: ts.Diagnostics.Type_Checking,
39700
39632
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
39701
39633
  defaultValueDescription: false,
@@ -39703,8 +39635,6 @@ var ts;
39703
39635
  {
39704
39636
  name: "noPropertyAccessFromIndexSignature",
39705
39637
  type: "boolean",
39706
- affectsSemanticDiagnostics: true,
39707
- affectsMultiFileEmitBuildInfo: true,
39708
39638
  showInSimplifiedHelpView: false,
39709
39639
  category: ts.Diagnostics.Type_Checking,
39710
39640
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -39716,7 +39646,7 @@ var ts;
39716
39646
  type: new ts.Map(ts.getEntries({
39717
39647
  node: ts.ModuleResolutionKind.NodeJs,
39718
39648
  classic: ts.ModuleResolutionKind.Classic,
39719
- node12: ts.ModuleResolutionKind.Node12,
39649
+ node16: ts.ModuleResolutionKind.Node16,
39720
39650
  nodenext: ts.ModuleResolutionKind.NodeNext,
39721
39651
  })),
39722
39652
  affectsModuleResolution: true,
@@ -39790,7 +39720,6 @@ var ts;
39790
39720
  name: "allowSyntheticDefaultImports",
39791
39721
  type: "boolean",
39792
39722
  affectsSemanticDiagnostics: true,
39793
- affectsMultiFileEmitBuildInfo: true,
39794
39723
  category: ts.Diagnostics.Interop_Constraints,
39795
39724
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
39796
39725
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -39800,7 +39729,6 @@ var ts;
39800
39729
  type: "boolean",
39801
39730
  affectsSemanticDiagnostics: true,
39802
39731
  affectsEmit: true,
39803
- affectsMultiFileEmitBuildInfo: true,
39804
39732
  showInSimplifiedHelpView: true,
39805
39733
  category: ts.Diagnostics.Interop_Constraints,
39806
39734
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -39817,7 +39745,6 @@ var ts;
39817
39745
  name: "allowUmdGlobalAccess",
39818
39746
  type: "boolean",
39819
39747
  affectsSemanticDiagnostics: true,
39820
- affectsMultiFileEmitBuildInfo: true,
39821
39748
  category: ts.Diagnostics.Modules,
39822
39749
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
39823
39750
  defaultValueDescription: false,
@@ -39839,7 +39766,6 @@ var ts;
39839
39766
  name: "sourceRoot",
39840
39767
  type: "string",
39841
39768
  affectsEmit: true,
39842
- affectsMultiFileEmitBuildInfo: true,
39843
39769
  paramType: ts.Diagnostics.LOCATION,
39844
39770
  category: ts.Diagnostics.Emit,
39845
39771
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -39848,7 +39774,6 @@ var ts;
39848
39774
  name: "mapRoot",
39849
39775
  type: "string",
39850
39776
  affectsEmit: true,
39851
- affectsMultiFileEmitBuildInfo: true,
39852
39777
  paramType: ts.Diagnostics.LOCATION,
39853
39778
  category: ts.Diagnostics.Emit,
39854
39779
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -39857,7 +39782,6 @@ var ts;
39857
39782
  name: "inlineSourceMap",
39858
39783
  type: "boolean",
39859
39784
  affectsEmit: true,
39860
- affectsMultiFileEmitBuildInfo: true,
39861
39785
  category: ts.Diagnostics.Emit,
39862
39786
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
39863
39787
  defaultValueDescription: false,
@@ -39866,7 +39790,6 @@ var ts;
39866
39790
  name: "inlineSources",
39867
39791
  type: "boolean",
39868
39792
  affectsEmit: true,
39869
- affectsMultiFileEmitBuildInfo: true,
39870
39793
  category: ts.Diagnostics.Emit,
39871
39794
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
39872
39795
  defaultValueDescription: false,
@@ -39876,7 +39799,6 @@ var ts;
39876
39799
  name: "experimentalDecorators",
39877
39800
  type: "boolean",
39878
39801
  affectsSemanticDiagnostics: true,
39879
- affectsMultiFileEmitBuildInfo: true,
39880
39802
  category: ts.Diagnostics.Language_and_Environment,
39881
39803
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
39882
39804
  defaultValueDescription: false,
@@ -39886,7 +39808,6 @@ var ts;
39886
39808
  type: "boolean",
39887
39809
  affectsSemanticDiagnostics: true,
39888
39810
  affectsEmit: true,
39889
- affectsMultiFileEmitBuildInfo: true,
39890
39811
  category: ts.Diagnostics.Language_and_Environment,
39891
39812
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
39892
39813
  defaultValueDescription: false,
@@ -39911,7 +39832,6 @@ var ts;
39911
39832
  type: "string",
39912
39833
  affectsSemanticDiagnostics: true,
39913
39834
  affectsEmit: true,
39914
- affectsMultiFileEmitBuildInfo: true,
39915
39835
  affectsModuleResolution: true,
39916
39836
  category: ts.Diagnostics.Language_and_Environment,
39917
39837
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -39929,9 +39849,6 @@ var ts;
39929
39849
  name: "out",
39930
39850
  type: "string",
39931
39851
  affectsEmit: true,
39932
- affectsMultiFileEmitBuildInfo: true,
39933
- affectsDeclarationPath: true,
39934
- affectsBundleEmitBuildInfo: true,
39935
39852
  isFilePath: false,
39936
39853
  // for correct behaviour, please use outFile
39937
39854
  category: ts.Diagnostics.Backwards_Compatibility,
@@ -39943,7 +39860,6 @@ var ts;
39943
39860
  name: "reactNamespace",
39944
39861
  type: "string",
39945
39862
  affectsEmit: true,
39946
- affectsMultiFileEmitBuildInfo: true,
39947
39863
  category: ts.Diagnostics.Language_and_Environment,
39948
39864
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
39949
39865
  defaultValueDescription: "`React`",
@@ -39951,8 +39867,6 @@ var ts;
39951
39867
  {
39952
39868
  name: "skipDefaultLibCheck",
39953
39869
  type: "boolean",
39954
- // We need to store these to determine whether `lib` files need to be rechecked
39955
- affectsMultiFileEmitBuildInfo: true,
39956
39870
  category: ts.Diagnostics.Completeness,
39957
39871
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
39958
39872
  defaultValueDescription: false,
@@ -39968,7 +39882,6 @@ var ts;
39968
39882
  name: "emitBOM",
39969
39883
  type: "boolean",
39970
39884
  affectsEmit: true,
39971
- affectsMultiFileEmitBuildInfo: true,
39972
39885
  category: ts.Diagnostics.Emit,
39973
39886
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
39974
39887
  defaultValueDescription: false,
@@ -39980,7 +39893,6 @@ var ts;
39980
39893
  lf: 1 /* LineFeed */
39981
39894
  })),
39982
39895
  affectsEmit: true,
39983
- affectsMultiFileEmitBuildInfo: true,
39984
39896
  paramType: ts.Diagnostics.NEWLINE,
39985
39897
  category: ts.Diagnostics.Emit,
39986
39898
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -39990,7 +39902,6 @@ var ts;
39990
39902
  name: "noErrorTruncation",
39991
39903
  type: "boolean",
39992
39904
  affectsSemanticDiagnostics: true,
39993
- affectsMultiFileEmitBuildInfo: true,
39994
39905
  category: ts.Diagnostics.Output_Formatting,
39995
39906
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
39996
39907
  defaultValueDescription: false,
@@ -40021,7 +39932,6 @@ var ts;
40021
39932
  name: "stripInternal",
40022
39933
  type: "boolean",
40023
39934
  affectsEmit: true,
40024
- affectsMultiFileEmitBuildInfo: true,
40025
39935
  category: ts.Diagnostics.Emit,
40026
39936
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
40027
39937
  defaultValueDescription: false,
@@ -40062,7 +39972,6 @@ var ts;
40062
39972
  name: "noImplicitUseStrict",
40063
39973
  type: "boolean",
40064
39974
  affectsSemanticDiagnostics: true,
40065
- affectsMultiFileEmitBuildInfo: true,
40066
39975
  category: ts.Diagnostics.Backwards_Compatibility,
40067
39976
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
40068
39977
  defaultValueDescription: false,
@@ -40071,7 +39980,6 @@ var ts;
40071
39980
  name: "noEmitHelpers",
40072
39981
  type: "boolean",
40073
39982
  affectsEmit: true,
40074
- affectsMultiFileEmitBuildInfo: true,
40075
39983
  category: ts.Diagnostics.Emit,
40076
39984
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
40077
39985
  defaultValueDescription: false,
@@ -40080,7 +39988,6 @@ var ts;
40080
39988
  name: "noEmitOnError",
40081
39989
  type: "boolean",
40082
39990
  affectsEmit: true,
40083
- affectsMultiFileEmitBuildInfo: true,
40084
39991
  category: ts.Diagnostics.Emit,
40085
39992
  transpileOptionValue: undefined,
40086
39993
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -40090,7 +39997,6 @@ var ts;
40090
39997
  name: "preserveConstEnums",
40091
39998
  type: "boolean",
40092
39999
  affectsEmit: true,
40093
- affectsMultiFileEmitBuildInfo: true,
40094
40000
  category: ts.Diagnostics.Emit,
40095
40001
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
40096
40002
  defaultValueDescription: false,
@@ -40099,8 +40005,6 @@ var ts;
40099
40005
  name: "declarationDir",
40100
40006
  type: "string",
40101
40007
  affectsEmit: true,
40102
- affectsMultiFileEmitBuildInfo: true,
40103
- affectsDeclarationPath: true,
40104
40008
  isFilePath: true,
40105
40009
  paramType: ts.Diagnostics.DIRECTORY,
40106
40010
  category: ts.Diagnostics.Emit,
@@ -40110,8 +40014,6 @@ var ts;
40110
40014
  {
40111
40015
  name: "skipLibCheck",
40112
40016
  type: "boolean",
40113
- // We need to store these to determine whether `lib` files need to be rechecked
40114
- affectsMultiFileEmitBuildInfo: true,
40115
40017
  category: ts.Diagnostics.Completeness,
40116
40018
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
40117
40019
  defaultValueDescription: false,
@@ -40121,7 +40023,6 @@ var ts;
40121
40023
  type: "boolean",
40122
40024
  affectsBindDiagnostics: true,
40123
40025
  affectsSemanticDiagnostics: true,
40124
- affectsMultiFileEmitBuildInfo: true,
40125
40026
  category: ts.Diagnostics.Type_Checking,
40126
40027
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
40127
40028
  defaultValueDescription: undefined,
@@ -40131,7 +40032,6 @@ var ts;
40131
40032
  type: "boolean",
40132
40033
  affectsBindDiagnostics: true,
40133
40034
  affectsSemanticDiagnostics: true,
40134
- affectsMultiFileEmitBuildInfo: true,
40135
40035
  category: ts.Diagnostics.Type_Checking,
40136
40036
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
40137
40037
  defaultValueDescription: undefined,
@@ -40140,7 +40040,6 @@ var ts;
40140
40040
  name: "suppressExcessPropertyErrors",
40141
40041
  type: "boolean",
40142
40042
  affectsSemanticDiagnostics: true,
40143
- affectsMultiFileEmitBuildInfo: true,
40144
40043
  category: ts.Diagnostics.Backwards_Compatibility,
40145
40044
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
40146
40045
  defaultValueDescription: false,
@@ -40149,7 +40048,6 @@ var ts;
40149
40048
  name: "suppressImplicitAnyIndexErrors",
40150
40049
  type: "boolean",
40151
40050
  affectsSemanticDiagnostics: true,
40152
- affectsMultiFileEmitBuildInfo: true,
40153
40051
  category: ts.Diagnostics.Backwards_Compatibility,
40154
40052
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
40155
40053
  defaultValueDescription: false,
@@ -40174,7 +40072,6 @@ var ts;
40174
40072
  name: "noStrictGenericChecks",
40175
40073
  type: "boolean",
40176
40074
  affectsSemanticDiagnostics: true,
40177
- affectsMultiFileEmitBuildInfo: true,
40178
40075
  category: ts.Diagnostics.Backwards_Compatibility,
40179
40076
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
40180
40077
  defaultValueDescription: false,
@@ -40184,7 +40081,6 @@ var ts;
40184
40081
  type: "boolean",
40185
40082
  affectsSemanticDiagnostics: true,
40186
40083
  affectsEmit: true,
40187
- affectsMultiFileEmitBuildInfo: true,
40188
40084
  category: ts.Diagnostics.Language_and_Environment,
40189
40085
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
40190
40086
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -40193,7 +40089,6 @@ var ts;
40193
40089
  name: "preserveValueImports",
40194
40090
  type: "boolean",
40195
40091
  affectsEmit: true,
40196
- affectsMultiFileEmitBuildInfo: true,
40197
40092
  category: ts.Diagnostics.Emit,
40198
40093
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
40199
40094
  defaultValueDescription: false,
@@ -40227,7 +40122,7 @@ var ts;
40227
40122
  affectsModuleResolution: true,
40228
40123
  description: ts.Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
40229
40124
  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,
40125
+ 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
40126
  }
40232
40127
  ];
40233
40128
  /* @internal */
@@ -40237,8 +40132,6 @@ var ts;
40237
40132
  /* @internal */
40238
40133
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
40239
40134
  /* @internal */
40240
- ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
40241
- /* @internal */
40242
40135
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
40243
40136
  /* @internal */
40244
40137
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -41094,7 +40987,6 @@ var ts;
41094
40987
  return optionDefinition.type;
41095
40988
  }
41096
40989
  }
41097
- /* @internal */
41098
40990
  function getNameOfCompilerOptionValue(value, customTypeMap) {
41099
40991
  // There is a typeMap associated with this command-line option so use it to map value back to its name
41100
40992
  return ts.forEachEntry(customTypeMap, function (mapValue, key) {
@@ -41103,7 +40995,6 @@ var ts;
41103
40995
  }
41104
40996
  });
41105
40997
  }
41106
- ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
41107
40998
  function serializeCompilerOptions(options, pathOptions) {
41108
40999
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
41109
41000
  }
@@ -42264,7 +42155,7 @@ var ts;
42264
42155
  ts.Debug.assert(ts.extensionIsTS(resolved.extension));
42265
42156
  return { fileName: resolved.path, packageId: resolved.packageId };
42266
42157
  }
42267
- function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, resultFromCache) {
42158
+ function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, diagnostics, resultFromCache) {
42268
42159
  var _a;
42269
42160
  if (resultFromCache) {
42270
42161
  (_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
@@ -42272,7 +42163,8 @@ var ts;
42272
42163
  }
42273
42164
  return {
42274
42165
  resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
42275
- failedLookupLocations: failedLookupLocations
42166
+ failedLookupLocations: failedLookupLocations,
42167
+ resolutionDiagnostics: diagnostics
42276
42168
  };
42277
42169
  }
42278
42170
  function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
@@ -42467,13 +42359,24 @@ var ts;
42467
42359
  // 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
42360
  // 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
42361
  // 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
42362
+ // resolution" should be (`node16`? `nodenext`?). As such, witnessing a mode-overriding triple-slash reference in a non-modal module resolution
42471
42363
  // 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)) {
42364
+ if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext)) {
42473
42365
  features |= NodeResolutionFeatures.EsmMode;
42474
42366
  }
42475
42367
  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 };
42368
+ var diagnostics = [];
42369
+ var moduleResolutionState = {
42370
+ compilerOptions: options,
42371
+ host: host,
42372
+ traceEnabled: traceEnabled,
42373
+ failedLookupLocations: failedLookupLocations,
42374
+ packageJsonInfoCache: cache,
42375
+ features: features,
42376
+ conditions: conditions,
42377
+ requestContainingDirectory: containingDirectory,
42378
+ reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
42379
+ };
42477
42380
  var resolved = primaryLookup();
42478
42381
  var primary = true;
42479
42382
  if (!resolved) {
@@ -42492,7 +42395,7 @@ var ts;
42492
42395
  isExternalLibraryImport: pathContainsNodeModules(fileName),
42493
42396
  };
42494
42397
  }
42495
- result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
42398
+ result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, resolutionDiagnostics: diagnostics };
42496
42399
  perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, /*mode*/ resolutionMode, result);
42497
42400
  if (traceEnabled)
42498
42401
  traceResult(result);
@@ -42558,7 +42461,7 @@ var ts;
42558
42461
  }
42559
42462
  ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
42560
42463
  function getDefaultNodeResolutionFeatures(options) {
42561
- return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 ? NodeResolutionFeatures.Node12Default :
42464
+ return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 ? NodeResolutionFeatures.Node16Default :
42562
42465
  ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault :
42563
42466
  NodeResolutionFeatures.None;
42564
42467
  }
@@ -42575,6 +42478,8 @@ var ts;
42575
42478
  packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
42576
42479
  conditions: ts.emptyArray,
42577
42480
  features: NodeResolutionFeatures.None,
42481
+ requestContainingDirectory: containingDirectory,
42482
+ reportDiagnostic: ts.noop
42578
42483
  };
42579
42484
  return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
42580
42485
  if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
@@ -42916,8 +42821,8 @@ var ts;
42916
42821
  case ts.ModuleKind.CommonJS:
42917
42822
  moduleResolution = ts.ModuleResolutionKind.NodeJs;
42918
42823
  break;
42919
- case ts.ModuleKind.Node12:
42920
- moduleResolution = ts.ModuleResolutionKind.Node12;
42824
+ case ts.ModuleKind.Node16:
42825
+ moduleResolution = ts.ModuleResolutionKind.Node16;
42921
42826
  break;
42922
42827
  case ts.ModuleKind.NodeNext:
42923
42828
  moduleResolution = ts.ModuleResolutionKind.NodeNext;
@@ -42937,8 +42842,8 @@ var ts;
42937
42842
  }
42938
42843
  ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
42939
42844
  switch (moduleResolution) {
42940
- case ts.ModuleResolutionKind.Node12:
42941
- result = node12ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
42845
+ case ts.ModuleResolutionKind.Node16:
42846
+ result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
42942
42847
  break;
42943
42848
  case ts.ModuleResolutionKind.NodeNext:
42944
42849
  result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
@@ -43172,15 +43077,15 @@ var ts;
43172
43077
  // respecting the `.exports` member of packages' package.json files and its (conditional) mappings of export names
43173
43078
  NodeResolutionFeatures[NodeResolutionFeatures["Exports"] = 8] = "Exports";
43174
43079
  // 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
43080
+ // not supported in node 12 - https://github.com/nodejs/Release/issues/690
43176
43081
  NodeResolutionFeatures[NodeResolutionFeatures["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
43177
43082
  NodeResolutionFeatures[NodeResolutionFeatures["AllFeatures"] = 30] = "AllFeatures";
43178
- NodeResolutionFeatures[NodeResolutionFeatures["Node12Default"] = 14] = "Node12Default";
43083
+ NodeResolutionFeatures[NodeResolutionFeatures["Node16Default"] = 30] = "Node16Default";
43179
43084
  NodeResolutionFeatures[NodeResolutionFeatures["NodeNextDefault"] = 30] = "NodeNextDefault";
43180
43085
  NodeResolutionFeatures[NodeResolutionFeatures["EsmMode"] = 32] = "EsmMode";
43181
43086
  })(NodeResolutionFeatures || (NodeResolutionFeatures = {}));
43182
- function node12ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
43183
- return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Node12Default, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
43087
+ function node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
43088
+ return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Node16Default, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
43184
43089
  }
43185
43090
  function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
43186
43091
  return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
@@ -43220,12 +43125,13 @@ var ts;
43220
43125
  var _a, _b;
43221
43126
  var traceEnabled = isTraceEnabled(compilerOptions, host);
43222
43127
  var failedLookupLocations = [];
43223
- // conditions are only used by the node12/nodenext resolver - there's no priority order in the list,
43128
+ // conditions are only used by the node16/nodenext resolver - there's no priority order in the list,
43224
43129
  //it's essentially a set (priority is determined by object insertion order in the object we look at).
43225
43130
  var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
43226
43131
  if (compilerOptions.noDtsResolution) {
43227
43132
  conditions.pop();
43228
43133
  }
43134
+ var diagnostics = [];
43229
43135
  var state = {
43230
43136
  compilerOptions: compilerOptions,
43231
43137
  host: host,
@@ -43234,9 +43140,11 @@ var ts;
43234
43140
  packageJsonInfoCache: cache,
43235
43141
  features: features,
43236
43142
  conditions: conditions,
43143
+ requestContainingDirectory: containingDirectory,
43144
+ reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
43237
43145
  };
43238
43146
  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);
43147
+ 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
43148
  function tryResolve(extensions) {
43241
43149
  var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, /*considerPackageJson*/ true); };
43242
43150
  var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
@@ -43409,9 +43317,9 @@ var ts;
43409
43317
  }
43410
43318
  }
43411
43319
  function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
43412
- if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.isDeclarationFileName(candidate)) {
43320
+ if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.fileExtensionIsOneOf(candidate, ts.supportedTSExtensionsFlat)) {
43413
43321
  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;
43322
+ return result !== undefined ? { path: candidate, ext: ts.tryExtractTSExtension(candidate) } : undefined;
43415
43323
  }
43416
43324
  return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
43417
43325
  }
@@ -43534,6 +43442,8 @@ var ts;
43534
43442
  packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
43535
43443
  conditions: ["node", "require", "types"],
43536
43444
  features: features,
43445
+ requestContainingDirectory: packageJsonInfo.packageDirectory,
43446
+ reportDiagnostic: ts.noop
43537
43447
  };
43538
43448
  var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory,
43539
43449
  /*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
@@ -43620,6 +43530,8 @@ var ts;
43620
43530
  packageJsonInfoCache: packageJsonInfoCache,
43621
43531
  features: 0,
43622
43532
  conditions: [],
43533
+ requestContainingDirectory: undefined,
43534
+ reportDiagnostic: ts.noop
43623
43535
  };
43624
43536
  var parts = ts.getPathComponents(fileName);
43625
43537
  parts.pop();
@@ -43911,7 +43823,6 @@ var ts;
43911
43823
  function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
43912
43824
  return loadModuleFromTargetImportOrExport;
43913
43825
  function loadModuleFromTargetImportOrExport(target, subpath, pattern) {
43914
- var _a, _b;
43915
43826
  if (typeof target === "string") {
43916
43827
  if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) {
43917
43828
  if (state.traceEnabled) {
@@ -43948,13 +43859,16 @@ var ts;
43948
43859
  }
43949
43860
  return toSearchResult(/*value*/ undefined);
43950
43861
  }
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));
43862
+ var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath);
43863
+ var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports);
43864
+ if (inputLink)
43865
+ return inputLink;
43952
43866
  return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, finalPath, /*onlyRecordFailures*/ false, state)));
43953
43867
  }
43954
43868
  else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null
43955
43869
  if (!Array.isArray(target)) {
43956
- for (var _i = 0, _c = ts.getOwnKeys(target); _i < _c.length; _i++) {
43957
- var key = _c[_i];
43870
+ for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) {
43871
+ var key = _a[_i];
43958
43872
  if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) {
43959
43873
  var subTarget = target[key];
43960
43874
  var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern);
@@ -43972,8 +43886,8 @@ var ts;
43972
43886
  }
43973
43887
  return toSearchResult(/*value*/ undefined);
43974
43888
  }
43975
- for (var _d = 0, target_2 = target; _d < target_2.length; _d++) {
43976
- var elem = target_2[_d];
43889
+ for (var _b = 0, target_2 = target; _b < target_2.length; _b++) {
43890
+ var elem = target_2[_b];
43977
43891
  var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
43978
43892
  if (result) {
43979
43893
  return result;
@@ -43991,6 +43905,128 @@ var ts;
43991
43905
  trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
43992
43906
  }
43993
43907
  return toSearchResult(/*value*/ undefined);
43908
+ function toAbsolutePath(path) {
43909
+ var _a, _b;
43910
+ if (path === undefined)
43911
+ return path;
43912
+ return ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames })(ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)));
43913
+ }
43914
+ function combineDirectoryPath(root, dir) {
43915
+ return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
43916
+ }
43917
+ function useCaseSensitiveFileNames() {
43918
+ return !state.host.useCaseSensitiveFileNames ? true :
43919
+ typeof state.host.useCaseSensitiveFileNames === "boolean" ? state.host.useCaseSensitiveFileNames :
43920
+ state.host.useCaseSensitiveFileNames();
43921
+ }
43922
+ function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports) {
43923
+ var _a, _b, _c, _d;
43924
+ // Replace any references to outputs for files in the program with the input files to support package self-names used with outDir
43925
+ // 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
43926
+ // 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!
43927
+ // _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!).
43928
+ // 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.
43929
+ if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
43930
+ && (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
43931
+ && finalPath.indexOf("/node_modules/") === -1
43932
+ && (state.compilerOptions.configFile ? ts.startsWith(toAbsolutePath(state.compilerOptions.configFile.fileName), scope.packageDirectory) : true)) {
43933
+ // 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.
43934
+ // Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
43935
+ // `.`, `./src` or any other deeper directory structure. (If project references are used, it's definitely `.` by fiat, so that should be pretty common.)
43936
+ var getCanonicalFileName = ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames });
43937
+ var commonSourceDirGuesses = [];
43938
+ // A `rootDir` compiler option strongly indicates the root location
43939
+ // 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
43940
+ if (state.compilerOptions.rootDir || (state.compilerOptions.composite && state.compilerOptions.configFilePath)) {
43941
+ var commonDir = toAbsolutePath(ts.getCommonSourceDirectory(state.compilerOptions, function () { return []; }, ((_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)) || "", getCanonicalFileName));
43942
+ commonSourceDirGuesses.push(commonDir);
43943
+ }
43944
+ else if (state.requestContainingDirectory) {
43945
+ // However without either of those set we're in the dark. Let's say you have
43946
+ //
43947
+ // ./tools/index.ts
43948
+ // ./src/index.ts
43949
+ // ./dist/index.js
43950
+ // ./package.json <-- references ./dist/index.js
43951
+ // ./tsconfig.json <-- loads ./src/index.ts
43952
+ //
43953
+ // How do we know `./src` is the common src dir, and not `./tools`, given only the `./dist` out dir and `./dist/index.js` filename?
43954
+ // 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
43955
+ // without more context.
43956
+ // 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
43957
+ // must be inside the common source directory! So we propagate that tidbit of info all the way to here via state.requestContainingDirectory
43958
+ var requestingFile_1 = toAbsolutePath(ts.combinePaths(state.requestContainingDirectory, "index.ts"));
43959
+ // And we can try every folder above the common folder for the request folder and the config/package base directory
43960
+ // This technically can be wrong - we may load ./src/index.ts when ./src/sub/index.ts was right because we don't
43961
+ // know if only `./src/sub` files were loaded by the program; but this has the best chance to be right of just about anything
43962
+ // else we have. And, given that we're about to load `./src/index.ts` because we choose it as likely correct, there will then
43963
+ // be a file outside of `./src/sub` in the program (the file we resolved to), making us de-facto right. So this fallback lookup
43964
+ // logic may influence what files are pulled in by self-names, which in turn influences the output path shape, but it's all
43965
+ // internally consistent so the paths should be stable so long as we prefer the "most general" (meaning: top-most-level directory) possible results first.
43966
+ 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));
43967
+ commonSourceDirGuesses.push(commonDir);
43968
+ var fragment = ts.ensureTrailingDirectorySeparator(commonDir);
43969
+ while (fragment && fragment.length > 1) {
43970
+ var parts = ts.getPathComponents(fragment);
43971
+ parts.pop(); // remove a directory
43972
+ var commonDir_1 = ts.getPathFromPathComponents(parts);
43973
+ commonSourceDirGuesses.unshift(commonDir_1);
43974
+ fragment = ts.ensureTrailingDirectorySeparator(commonDir_1);
43975
+ }
43976
+ }
43977
+ if (commonSourceDirGuesses.length > 1) {
43978
+ state.reportDiagnostic(ts.createCompilerDiagnostic(isImports
43979
+ ? 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
43980
+ : 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
43981
+ packagePath));
43982
+ }
43983
+ for (var _i = 0, commonSourceDirGuesses_1 = commonSourceDirGuesses; _i < commonSourceDirGuesses_1.length; _i++) {
43984
+ var commonSourceDirGuess = commonSourceDirGuesses_1[_i];
43985
+ var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
43986
+ for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
43987
+ var candidateDir = candidateDirectories_1[_e];
43988
+ if (ts.startsWith(finalPath, candidateDir)) {
43989
+ // 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
43990
+ var pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
43991
+ var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
43992
+ var jsAndDtsExtensions = [".mjs" /* Mjs */, ".cjs" /* Cjs */, ".js" /* Js */, ".json" /* Json */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */, ".d.ts" /* Dts */];
43993
+ for (var _f = 0, jsAndDtsExtensions_1 = jsAndDtsExtensions; _f < jsAndDtsExtensions_1.length; _f++) {
43994
+ var ext = jsAndDtsExtensions_1[_f];
43995
+ if (ts.fileExtensionIs(possibleInputBase, ext)) {
43996
+ var inputExts = ts.getPossibleOriginalInputExtensionForExtension(possibleInputBase);
43997
+ for (var _g = 0, inputExts_1 = inputExts; _g < inputExts_1.length; _g++) {
43998
+ var possibleExt = inputExts_1[_g];
43999
+ var possibleInputWithInputExtension = ts.changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
44000
+ if ((extensions === Extensions.TypeScript && ts.hasJSFileExtension(possibleInputWithInputExtension)) ||
44001
+ (extensions === Extensions.JavaScript && ts.hasTSFileExtension(possibleInputWithInputExtension))) {
44002
+ continue;
44003
+ }
44004
+ if (state.host.fileExists(possibleInputWithInputExtension)) {
44005
+ return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, possibleInputWithInputExtension, /*onlyRecordFailures*/ false, state)));
44006
+ }
44007
+ }
44008
+ }
44009
+ }
44010
+ }
44011
+ }
44012
+ }
44013
+ }
44014
+ return undefined;
44015
+ function getOutputDirectoriesForBaseDirectory(commonSourceDirGuess) {
44016
+ var _a, _b;
44017
+ // Config file ouput paths are processed to be relative to the host's current directory, while
44018
+ // otherwise the paths are resolved relative to the common source dir the compiler puts together
44019
+ var currentDir = state.compilerOptions.configFile ? ((_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)) || "" : commonSourceDirGuess;
44020
+ var candidateDirectories = [];
44021
+ if (state.compilerOptions.declarationDir) {
44022
+ candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.declarationDir)));
44023
+ }
44024
+ if (state.compilerOptions.outDir && state.compilerOptions.outDir !== state.compilerOptions.declarationDir) {
44025
+ candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.outDir)));
44026
+ }
44027
+ return candidateDirectories;
44028
+ }
44029
+ }
43994
44030
  }
43995
44031
  }
43996
44032
  /* @internal */
@@ -44181,11 +44217,12 @@ var ts;
44181
44217
  function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
44182
44218
  var traceEnabled = isTraceEnabled(compilerOptions, host);
44183
44219
  var failedLookupLocations = [];
44184
- var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.None, conditions: [] };
44185
44220
  var containingDirectory = ts.getDirectoryPath(containingFile);
44221
+ var diagnostics = [];
44222
+ 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
44223
  var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
44187
44224
  // No originalPath because classic resolution doesn't resolve realPath
44188
- return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations, state.resultFromCache);
44225
+ return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations, diagnostics, state.resultFromCache);
44189
44226
  function tryResolve(extensions) {
44190
44227
  var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
44191
44228
  if (resolvedUsingSettings) {
@@ -44228,9 +44265,10 @@ var ts;
44228
44265
  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
44266
  }
44230
44267
  var failedLookupLocations = [];
44231
- var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: packageJsonInfoCache, features: NodeResolutionFeatures.None, conditions: [] };
44268
+ var diagnostics = [];
44269
+ 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
44270
  var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, /*typesScopeOnly*/ false, /*cache*/ undefined, /*redirectedReference*/ undefined);
44233
- return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations, state.resultFromCache);
44271
+ return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations, diagnostics, state.resultFromCache);
44234
44272
  }
44235
44273
  ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
44236
44274
  /**
@@ -48607,7 +48645,7 @@ var ts;
48607
48645
  var enumRelation = new ts.Map();
48608
48646
  var builtinGlobals = ts.createSymbolTable();
48609
48647
  builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
48610
- // Extensions suggested for path imports when module resolution is node12 or higher.
48648
+ // Extensions suggested for path imports when module resolution is node16 or higher.
48611
48649
  // The first element of each tuple is the extension a file has.
48612
48650
  // The second element of each tuple is the extension that should be used in a path import.
48613
48651
  // e.g. if we want to import file `foo.mts`, we should write `import {} from "./foo.mjs".
@@ -50896,7 +50934,7 @@ var ts;
50896
50934
  if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
50897
50935
  errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
50898
50936
  }
50899
- if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
50937
+ if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
50900
50938
  var isSyncImport = (currentSourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS && !ts.findAncestor(location, ts.isImportCall)) || !!ts.findAncestor(location, ts.isImportEqualsDeclaration);
50901
50939
  var overrideClauseHost = ts.findAncestor(location, function (l) { return ts.isImportTypeNode(l) || ts.isExportDeclaration(l) || ts.isImportDeclaration(l); });
50902
50940
  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 +50943,6 @@ var ts;
50905
50943
  if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
50906
50944
  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
50945
  }
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
50946
  }
50912
50947
  // merged symbol is module declaration symbol combined with all augmentations
50913
50948
  return getMergedSymbol(sourceFile.symbol);
@@ -50960,7 +50995,7 @@ var ts;
50960
50995
  var tsExtension = ts.tryExtractTSExtension(moduleReference);
50961
50996
  var isExtensionlessRelativePathImport = ts.pathIsRelative(moduleReference) && !ts.hasExtension(moduleReference);
50962
50997
  var moduleResolutionKind = ts.getEmitModuleResolutionKind(compilerOptions);
50963
- var resolutionIsNode12OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node12 ||
50998
+ var resolutionIsNode16OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node16 ||
50964
50999
  moduleResolutionKind === ts.ModuleResolutionKind.NodeNext;
50965
51000
  if (tsExtension) {
50966
51001
  var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
@@ -50981,17 +51016,17 @@ var ts;
50981
51016
  ts.hasJsonModuleEmitEnabled(compilerOptions)) {
50982
51017
  error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
50983
51018
  }
50984
- else if (mode === ts.ModuleKind.ESNext && resolutionIsNode12OrNext && isExtensionlessRelativePathImport) {
51019
+ else if (mode === ts.ModuleKind.ESNext && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
50985
51020
  var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
50986
51021
  var suggestedExt = (_h = suggestedExtensions.find(function (_a) {
50987
51022
  var actualExt = _a[0], _importExt = _a[1];
50988
51023
  return host.fileExists(absoluteRef_1 + actualExt);
50989
51024
  })) === null || _h === void 0 ? void 0 : _h[1];
50990
51025
  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);
51026
+ 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
51027
  }
50993
51028
  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);
51029
+ 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
51030
  }
50996
51031
  }
50997
51032
  else {
@@ -53313,7 +53348,7 @@ var ts;
53313
53348
  var targetFile = ts.getSourceFileOfModule(chain[0]);
53314
53349
  var specifier = void 0;
53315
53350
  var assertion = void 0;
53316
- if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
53351
+ if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
53317
53352
  // An `import` type directed at an esm format file is only going to resolve in esm mode - set the esm mode assertion
53318
53353
  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
53354
  specifier = getSpecifierForModuleSymbol(chain[0], context, ts.ModuleKind.ESNext);
@@ -53327,7 +53362,7 @@ var ts;
53327
53362
  }
53328
53363
  if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Classic && specifier.indexOf("/node_modules/") >= 0) {
53329
53364
  var oldSpecifier = specifier;
53330
- if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
53365
+ if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
53331
53366
  // 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
53367
  var swappedMode = (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat) === ts.ModuleKind.ESNext ? ts.ModuleKind.CommonJS : ts.ModuleKind.ESNext;
53333
53368
  specifier = getSpecifierForModuleSymbol(chain[0], context, swappedMode);
@@ -58097,7 +58132,8 @@ var ts;
58097
58132
  if (symbol === globalThisSymbol) {
58098
58133
  var varsOnly_1 = new ts.Map();
58099
58134
  members.forEach(function (p) {
58100
- if (!(p.flags & 418 /* BlockScoped */)) {
58135
+ var _a;
58136
+ 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
58137
  varsOnly_1.set(p.escapedName, p);
58102
58138
  }
58103
58139
  });
@@ -64804,7 +64840,6 @@ var ts;
64804
64840
  return 0 /* False */;
64805
64841
  }
64806
64842
  function reportErrorResults(originalSource, originalTarget, source, target, headMessage) {
64807
- var _a, _b;
64808
64843
  var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
64809
64844
  var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
64810
64845
  source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
@@ -64845,9 +64880,6 @@ var ts;
64845
64880
  return;
64846
64881
  }
64847
64882
  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
64883
  }
64852
64884
  function traceUnionsOrIntersectionsTooLarge(source, target) {
64853
64885
  if (!ts.tracing) {
@@ -65620,7 +65652,7 @@ var ts;
65620
65652
  // IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
65621
65653
  if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
65622
65654
  var constraint = getConstraintOfType(source);
65623
- if (!strictNullChecks && (!constraint || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */))) {
65655
+ if (!constraint || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
65624
65656
  // A type variable with no constraint is not related to the non-primitive object type.
65625
65657
  if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
65626
65658
  resetErrorInfo(saveErrorInfo);
@@ -65628,12 +65660,12 @@ var ts;
65628
65660
  }
65629
65661
  }
65630
65662
  // 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))) {
65663
+ else if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
65632
65664
  resetErrorInfo(saveErrorInfo);
65633
65665
  return result;
65634
65666
  }
65635
65667
  // 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))) {
65668
+ else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
65637
65669
  resetErrorInfo(saveErrorInfo);
65638
65670
  return result;
65639
65671
  }
@@ -71296,7 +71328,7 @@ var ts;
71296
71328
  if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
71297
71329
  var parent = declaration.parent.parent;
71298
71330
  if (parent.kind === 254 /* VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || parent.kind === 164 /* Parameter */) {
71299
- var links = getNodeLinks(location);
71331
+ var links = getNodeLinks(parent);
71300
71332
  if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
71301
71333
  links.flags |= 268435456 /* InCheckIdentifier */;
71302
71334
  var parentType = getTypeForBindingElementParent(parent, 0 /* Normal */);
@@ -77159,13 +77191,13 @@ var ts;
77159
77191
  }
77160
77192
  }
77161
77193
  function checkImportMetaProperty(node) {
77162
- if (moduleKind === ts.ModuleKind.Node12 || moduleKind === ts.ModuleKind.NodeNext) {
77194
+ if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
77163
77195
  if (ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.ESNext) {
77164
77196
  error(node, ts.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
77165
77197
  }
77166
77198
  }
77167
77199
  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);
77200
+ 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
77201
  }
77170
77202
  var file = ts.getSourceFileOfNode(node);
77171
77203
  ts.Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
@@ -78116,15 +78148,30 @@ var ts;
78116
78148
  if (!hasParseDiagnostics(sourceFile)) {
78117
78149
  var span = void 0;
78118
78150
  if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
78119
- if (!span)
78120
- span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
78151
+ span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
78121
78152
  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
78153
  diagnostics.add(diagnostic);
78123
78154
  }
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);
78155
+ switch (moduleKind) {
78156
+ case ts.ModuleKind.Node16:
78157
+ case ts.ModuleKind.NodeNext:
78158
+ if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
78159
+ span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
78160
+ 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));
78161
+ break;
78162
+ }
78163
+ // fallthrough
78164
+ case ts.ModuleKind.ES2022:
78165
+ case ts.ModuleKind.ESNext:
78166
+ case ts.ModuleKind.System:
78167
+ if (languageVersion >= 4 /* ES2017 */) {
78168
+ break;
78169
+ }
78170
+ // fallthrough
78171
+ default:
78172
+ span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
78173
+ 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));
78174
+ break;
78128
78175
  }
78129
78176
  }
78130
78177
  }
@@ -80566,8 +80613,8 @@ var ts;
80566
80613
  if (node.assertions) {
80567
80614
  var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
80568
80615
  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);
80616
+ if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
80617
+ grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
80571
80618
  }
80572
80619
  }
80573
80620
  }
@@ -82017,7 +82064,7 @@ var ts;
82017
82064
  }
82018
82065
  function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
82019
82066
  // 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)) {
82067
+ if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.Node16 && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
82021
82068
  return;
82022
82069
  }
82023
82070
  if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
@@ -82746,7 +82793,7 @@ var ts;
82746
82793
  }
82747
82794
  var yieldType = getIterationTypeOfIterable(use, 0 /* Yield */, inputType, /*errorNode*/ undefined);
82748
82795
  if (yieldType) {
82749
- return [ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators, false];
82796
+ return [ts.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, false];
82750
82797
  }
82751
82798
  if (isES2015OrLaterIterable((_a = inputType.symbol) === null || _a === void 0 ? void 0 : _a.escapedName)) {
82752
82799
  return [ts.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, true];
@@ -84937,8 +84984,8 @@ var ts;
84937
84984
  var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
84938
84985
  var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
84939
84986
  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);
84987
+ if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
84988
+ return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
84942
84989
  }
84943
84990
  return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
84944
84991
  }
@@ -86023,7 +86070,7 @@ var ts;
86023
86070
  var symbol = getIntrinsicTagSymbol(name.parent);
86024
86071
  return symbol === unknownSymbol ? undefined : symbol;
86025
86072
  }
86026
- var result = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ !isJSDoc_1, ts.getHostSignatureFromJSDoc(name));
86073
+ var result = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /* dontResolveAlias */ true, ts.getHostSignatureFromJSDoc(name));
86027
86074
  if (!result && isJSDoc_1) {
86028
86075
  var container = ts.findAncestor(name, ts.or(ts.isClassLike, ts.isInterfaceDeclaration));
86029
86076
  if (container) {
@@ -86277,7 +86324,7 @@ var ts;
86277
86324
  if (ts.isDeclaration(node)) {
86278
86325
  // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration
86279
86326
  var symbol = getSymbolOfNode(node);
86280
- return getTypeOfSymbol(symbol);
86327
+ return symbol ? getTypeOfSymbol(symbol) : errorType;
86281
86328
  }
86282
86329
  if (isDeclarationNameOrImportPropertyName(node)) {
86283
86330
  var symbol = getSymbolAtLocation(node);
@@ -87880,6 +87927,9 @@ var ts;
87880
87927
  return ts.some(types, checkGrammarExpressionWithTypeArguments);
87881
87928
  }
87882
87929
  function checkGrammarExpressionWithTypeArguments(node) {
87930
+ if (ts.isExpressionWithTypeArguments(node) && ts.isImportKeyword(node.expression) && node.typeArguments) {
87931
+ 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);
87932
+ }
87883
87933
  return checkGrammarTypeArguments(node, node.typeArguments);
87884
87934
  }
87885
87935
  function checkGrammarClassDeclarationHeritageClauses(node) {
@@ -88122,8 +88172,24 @@ var ts;
88122
88172
  if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
88123
88173
  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));
88124
88174
  }
88125
- 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 */) {
88126
- 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));
88175
+ switch (moduleKind) {
88176
+ case ts.ModuleKind.Node16:
88177
+ case ts.ModuleKind.NodeNext:
88178
+ if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
88179
+ diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level));
88180
+ break;
88181
+ }
88182
+ // fallthrough
88183
+ case ts.ModuleKind.ES2022:
88184
+ case ts.ModuleKind.ESNext:
88185
+ case ts.ModuleKind.System:
88186
+ if (languageVersion >= 4 /* ES2017 */) {
88187
+ break;
88188
+ }
88189
+ // fallthrough
88190
+ default:
88191
+ 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));
88192
+ break;
88127
88193
  }
88128
88194
  }
88129
88195
  }
@@ -88818,10 +88884,10 @@ var ts;
88818
88884
  }
88819
88885
  function checkGrammarImportCallExpression(node) {
88820
88886
  if (moduleKind === ts.ModuleKind.ES2015) {
88821
- 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);
88887
+ 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);
88822
88888
  }
88823
88889
  if (node.typeArguments) {
88824
- return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_import_cannot_have_type_arguments);
88890
+ 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);
88825
88891
  }
88826
88892
  var nodeArguments = node.arguments;
88827
88893
  if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) {
@@ -88829,7 +88895,7 @@ var ts;
88829
88895
  checkGrammarForDisallowedTrailingComma(nodeArguments);
88830
88896
  if (nodeArguments.length > 1) {
88831
88897
  var assertionArgument = nodeArguments[1];
88832
- return grammarErrorOnNode(assertionArgument, ts.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext);
88898
+ return grammarErrorOnNode(assertionArgument, ts.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);
88833
88899
  }
88834
88900
  }
88835
88901
  if (nodeArguments.length === 0 || nodeArguments.length > 2) {
@@ -108617,6 +108683,8 @@ var ts;
108617
108683
  var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
108618
108684
  errorFallbackNode = undefined;
108619
108685
  var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* Const */));
108686
+ preserveJsDoc(statement, input);
108687
+ ts.removeAllComments(input);
108620
108688
  return [statement, factory.updateExportAssignment(input, input.decorators, input.modifiers, newId)];
108621
108689
  }
108622
108690
  }
@@ -109093,7 +109161,7 @@ var ts;
109093
109161
  return ts.transformECMAScriptModule;
109094
109162
  case ts.ModuleKind.System:
109095
109163
  return ts.transformSystemModule;
109096
- case ts.ModuleKind.Node12:
109164
+ case ts.ModuleKind.Node16:
109097
109165
  case ts.ModuleKind.NodeNext:
109098
109166
  return ts.transformNodeModule;
109099
109167
  default:
@@ -109952,8 +110020,7 @@ var ts;
109952
110020
  return;
109953
110021
  }
109954
110022
  var version = ts.version; // Extracted into a const so the form is stable between namespace and module
109955
- var buildInfo = { bundle: bundle, program: program, version: version };
109956
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
110023
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), /*writeByteOrderMark*/ false);
109957
110024
  }
109958
110025
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
109959
110026
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -110107,18 +110174,13 @@ var ts;
110107
110174
  if (sourceMapFilePath) {
110108
110175
  var sourceMap = sourceMapGenerator.toString();
110109
110176
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110110
- if (printer.bundleFileInfo)
110111
- printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
110112
110177
  }
110113
110178
  }
110114
110179
  else {
110115
110180
  writer.writeLine();
110116
110181
  }
110117
110182
  // Write the output file
110118
- var text = writer.getText();
110119
- ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110120
- if (printer.bundleFileInfo)
110121
- printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
110183
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110122
110184
  // Reset state
110123
110185
  writer.clear();
110124
110186
  }
@@ -110261,54 +110323,34 @@ var ts;
110261
110323
  }
110262
110324
  /*@internal*/
110263
110325
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
110264
- var createHash = ts.maybeBind(host, host.createHash);
110265
110326
  var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
110266
- var buildInfo;
110267
- if (host.getBuildInfo) {
110268
- var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
110269
- if (!hostBuildInfo)
110270
- return buildInfoPath;
110271
- buildInfo = hostBuildInfo;
110272
- }
110273
- else {
110274
- var buildInfoText = host.readFile(buildInfoPath);
110275
- if (!buildInfoText)
110276
- return buildInfoPath;
110277
- buildInfo = getBuildInfo(buildInfoText);
110278
- }
110279
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
110327
+ var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
110328
+ if (!buildInfoText)
110280
110329
  return buildInfoPath;
110281
110330
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
110282
110331
  if (!jsFileText)
110283
110332
  return jsFilePath;
110284
- if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
110285
- return jsFilePath;
110286
110333
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
110287
110334
  // error if no source map or for now if inline sourcemap
110288
110335
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
110289
110336
  return sourceMapFilePath || "inline sourcemap decoding";
110290
- if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
110291
- return sourceMapFilePath;
110292
110337
  // read declaration text
110293
110338
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
110294
110339
  if (declarationFilePath && !declarationText)
110295
110340
  return declarationFilePath;
110296
- if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
110297
- return declarationFilePath;
110298
110341
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
110299
110342
  // error if no source map or for now if inline sourcemap
110300
110343
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
110301
110344
  return declarationMapPath || "inline sourcemap decoding";
110302
- if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
110303
- return declarationMapPath;
110345
+ var buildInfo = getBuildInfo(buildInfoText);
110346
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
110347
+ return buildInfoPath;
110304
110348
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110305
110349
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
110306
110350
  /*onlyOwnText*/ true);
110307
110351
  var outputFiles = [];
110308
110352
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
110309
110353
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
110310
- var changedDtsText;
110311
- var changedDtsData;
110312
110354
  var emitHost = {
110313
110355
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
110314
110356
  getCanonicalFileName: host.getCanonicalFileName,
@@ -110324,7 +110366,7 @@ var ts;
110324
110366
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
110325
110367
  getProjectReferenceRedirect: ts.returnUndefined,
110326
110368
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
110327
- writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
110369
+ writeFile: function (name, text, writeByteOrderMark) {
110328
110370
  switch (name) {
110329
110371
  case jsFilePath:
110330
110372
  if (jsFileText === text)
@@ -110335,13 +110377,8 @@ var ts;
110335
110377
  return;
110336
110378
  break;
110337
110379
  case buildInfoPath:
110338
- var newBuildInfo = data.buildInfo;
110380
+ var newBuildInfo = getBuildInfo(text);
110339
110381
  newBuildInfo.program = buildInfo.program;
110340
- if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
110341
- // Update the output signature
110342
- newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
110343
- newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
110344
- }
110345
110382
  // Update sourceFileInfo
110346
110383
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
110347
110384
  newBuildInfo.bundle.js.sources = js.sources;
@@ -110349,13 +110386,11 @@ var ts;
110349
110386
  newBuildInfo.bundle.dts.sources = dts.sources;
110350
110387
  }
110351
110388
  newBuildInfo.bundle.sourceFiles = sourceFiles;
110352
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
110389
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
110353
110390
  return;
110354
110391
  case declarationFilePath:
110355
110392
  if (declarationText === text)
110356
110393
  return;
110357
- changedDtsText = text;
110358
- changedDtsData = data;
110359
110394
  break;
110360
110395
  case declarationMapPath:
110361
110396
  if (declarationMapText === text)
@@ -110374,7 +110409,6 @@ var ts;
110374
110409
  getSourceFileFromReference: ts.returnUndefined,
110375
110410
  redirectTargetsMap: ts.createMultiMap(),
110376
110411
  getFileIncludeReasons: ts.notImplemented,
110377
- createHash: createHash,
110378
110412
  };
110379
110413
  emitFiles(ts.notImplementedResolver, emitHost,
110380
110414
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
@@ -115459,10 +115493,12 @@ var ts;
115459
115493
  }
115460
115494
  ts.createCompilerHost = createCompilerHost;
115461
115495
  /*@internal*/
115496
+ // TODO(shkamat): update this after reworking ts build API
115462
115497
  function createCompilerHostWorker(options, setParentNodes, system) {
115463
115498
  if (system === void 0) { system = ts.sys; }
115464
115499
  var existingDirectories = new ts.Map();
115465
115500
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
115501
+ var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
115466
115502
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
115467
115503
  var text;
115468
115504
  try {
@@ -115495,7 +115531,7 @@ var ts;
115495
115531
  // NOTE: If patchWriteFileEnsuringDirectory has been called,
115496
115532
  // the system.writeFile will do its own directory creation and
115497
115533
  // the ensureDirectoriesExist call will always be redundant.
115498
- 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); });
115534
+ 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); });
115499
115535
  ts.performance.mark("afterIOWrite");
115500
115536
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
115501
115537
  }
@@ -115505,6 +115541,35 @@ var ts;
115505
115541
  }
115506
115542
  }
115507
115543
  }
115544
+ var outputFingerprints;
115545
+ function writeFileWorker(fileName, data, writeByteOrderMark) {
115546
+ if (!ts.isWatchSet(options) || !system.getModifiedTime) {
115547
+ system.writeFile(fileName, data, writeByteOrderMark);
115548
+ return;
115549
+ }
115550
+ if (!outputFingerprints) {
115551
+ outputFingerprints = new ts.Map();
115552
+ }
115553
+ var hash = computeHash(data);
115554
+ var mtimeBefore = system.getModifiedTime(fileName);
115555
+ if (mtimeBefore) {
115556
+ var fingerprint = outputFingerprints.get(fileName);
115557
+ // If output has not been changed, and the file has no external modification
115558
+ if (fingerprint &&
115559
+ fingerprint.byteOrderMark === writeByteOrderMark &&
115560
+ fingerprint.hash === hash &&
115561
+ fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
115562
+ return;
115563
+ }
115564
+ }
115565
+ system.writeFile(fileName, data, writeByteOrderMark);
115566
+ var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
115567
+ outputFingerprints.set(fileName, {
115568
+ hash: hash,
115569
+ byteOrderMark: writeByteOrderMark,
115570
+ mtime: mtimeAfter
115571
+ });
115572
+ }
115508
115573
  function getDefaultLibLocation() {
115509
115574
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
115510
115575
  }
@@ -116119,7 +116184,7 @@ var ts;
116119
116184
  */
116120
116185
  function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
116121
116186
  switch (ts.getEmitModuleResolutionKind(options)) {
116122
- case ts.ModuleResolutionKind.Node12:
116187
+ case ts.ModuleResolutionKind.Node16:
116123
116188
  case ts.ModuleResolutionKind.NodeNext:
116124
116189
  return ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? ts.ModuleKind.ESNext :
116125
116190
  ts.fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? ts.ModuleKind.CommonJS :
@@ -116173,7 +116238,6 @@ var ts;
116173
116238
  ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
116174
116239
  ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
116175
116240
  ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
116176
- ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body.code,
116177
116241
  ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
116178
116242
  ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
116179
116243
  ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
@@ -116418,7 +116482,7 @@ var ts;
116418
116482
  var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
116419
116483
  var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
116420
116484
  for (var i = 0; i < typeReferences.length; i++) {
116421
- // under node12/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
116485
+ // under node16/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
116422
116486
  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 });
116423
116487
  }
116424
116488
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
@@ -116560,6 +116624,40 @@ var ts;
116560
116624
  ts.performance.measure("Program", "beforeProgram", "afterProgram");
116561
116625
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
116562
116626
  return program;
116627
+ function addResolutionDiagnostics(list) {
116628
+ if (!list)
116629
+ return;
116630
+ for (var _i = 0, list_3 = list; _i < list_3.length; _i++) {
116631
+ var elem = list_3[_i];
116632
+ programDiagnostics.add(elem);
116633
+ }
116634
+ }
116635
+ function pullDiagnosticsFromCache(names, containingFile) {
116636
+ var _a;
116637
+ if (!moduleResolutionCache)
116638
+ return;
116639
+ var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
116640
+ var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
116641
+ var containingDir = ts.getDirectoryPath(containingFileName);
116642
+ var redirectedReference = getRedirectReferenceForResolution(containingFile);
116643
+ var i = 0;
116644
+ for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
116645
+ var n = names_4[_i];
116646
+ // 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
116647
+ var mode = typeof n === "string" ? getModeForResolutionAtIndex(containingFile, i) : getModeForFileReference(n, containingFileMode);
116648
+ var name = typeof n === "string" ? n : n.fileName;
116649
+ i++;
116650
+ // only nonrelative names hit the cache, and, at least as of right now, only nonrelative names can issue diagnostics
116651
+ // (Since diagnostics are only issued via import or export map lookup)
116652
+ // This may totally change if/when the issue of output paths not mapping to input files is fixed in a broader context
116653
+ // When it is, how we extract diagnostics from the module name resolver will have the be refined - the current cache
116654
+ // APIs wrapping the underlying resolver make it almost impossible to smuggle the diagnostics out in a generalized way
116655
+ if (ts.isExternalModuleNameRelative(name))
116656
+ continue;
116657
+ var diags = (_a = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) === null || _a === void 0 ? void 0 : _a.resolutionDiagnostics;
116658
+ addResolutionDiagnostics(diags);
116659
+ }
116660
+ }
116563
116661
  function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
116564
116662
  if (!moduleNames.length)
116565
116663
  return ts.emptyArray;
@@ -116571,6 +116669,7 @@ var ts;
116571
116669
  ts.performance.mark("afterResolveModule");
116572
116670
  ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
116573
116671
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
116672
+ pullDiagnosticsFromCache(moduleNames, containingFile);
116574
116673
  return result;
116575
116674
  }
116576
116675
  function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) {
@@ -117056,7 +117155,6 @@ var ts;
117056
117155
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
117057
117156
  redirectTargetsMap: redirectTargetsMap,
117058
117157
  getFileIncludeReasons: program.getFileIncludeReasons,
117059
- createHash: ts.maybeBind(host, host.createHash),
117060
117158
  };
117061
117159
  }
117062
117160
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -118072,8 +118170,8 @@ var ts;
118072
118170
  var fileName = ts.toFileNameLowerCase(ref.fileName);
118073
118171
  ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
118074
118172
  var mode = ref.resolutionMode || file.impliedNodeFormat;
118075
- if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node12 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
118076
- programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node12_or_nodenext));
118173
+ if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
118174
+ programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
118077
118175
  }
118078
118176
  processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
118079
118177
  }
@@ -118435,7 +118533,7 @@ var ts;
118435
118533
  }
118436
118534
  if (options.resolveJsonModule) {
118437
118535
  if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs &&
118438
- ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node12 &&
118536
+ ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 &&
118439
118537
  ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
118440
118538
  createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
118441
118539
  }
@@ -119170,9 +119268,13 @@ var ts;
119170
119268
  function createManyToManyPathMap() {
119171
119269
  function create(forward, reverse, deleted) {
119172
119270
  var map = {
119271
+ clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119272
+ forEach: function (fn) { return forward.forEach(fn); },
119173
119273
  getKeys: function (v) { return reverse.get(v); },
119174
119274
  getValues: function (k) { return forward.get(k); },
119275
+ hasKey: function (k) { return forward.has(k); },
119175
119276
  keys: function () { return forward.keys(); },
119277
+ deletedKeys: function () { return deleted; },
119176
119278
  deleteKey: function (k) {
119177
119279
  (deleted || (deleted = new ts.Set())).add(k);
119178
119280
  var set = forward.get(k);
@@ -119199,6 +119301,11 @@ var ts;
119199
119301
  });
119200
119302
  return map;
119201
119303
  },
119304
+ clear: function () {
119305
+ forward.clear();
119306
+ reverse.clear();
119307
+ deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119308
+ }
119202
119309
  };
119203
119310
  return map;
119204
119311
  }
@@ -119326,21 +119433,18 @@ var ts;
119326
119433
  * Creates the state of file references and signature for the new program from oldState if it is safe
119327
119434
  */
119328
119435
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119329
- var _a, _b, _c;
119330
119436
  var fileInfos = new ts.Map();
119331
119437
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
119332
119438
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
119439
+ var hasCalledUpdateShapeSignature = new ts.Set();
119333
119440
  var useOldState = canReuseOldState(referencedMap, oldState);
119334
119441
  // Ensure source files have parent pointers set
119335
119442
  newProgram.getTypeChecker();
119336
119443
  // Create the reference map, and set the file infos
119337
- for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
119338
- var sourceFile = _d[_i];
119444
+ for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
119445
+ var sourceFile = _a[_i];
119339
119446
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
119340
- var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
119341
- var signature = oldUncommitedSignature === undefined ?
119342
- useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
119343
- oldUncommitedSignature || undefined;
119447
+ var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
119344
119448
  if (referencedMap) {
119345
119449
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
119346
119450
  if (newReferences) {
@@ -119348,26 +119452,19 @@ var ts;
119348
119452
  }
119349
119453
  // Copy old visible to outside files map
119350
119454
  if (useOldState) {
119351
- var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
119352
- var exportedModules = oldUncommitedExportedModules === undefined ?
119353
- oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
119354
- oldUncommitedExportedModules || undefined;
119455
+ var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
119355
119456
  if (exportedModules) {
119356
119457
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119357
119458
  }
119358
119459
  }
119359
119460
  }
119360
- fileInfos.set(sourceFile.resolvedPath, {
119361
- version: version_2,
119362
- signature: signature,
119363
- affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
119364
- impliedFormat: sourceFile.impliedNodeFormat
119365
- });
119461
+ fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
119366
119462
  }
119367
119463
  return {
119368
119464
  fileInfos: fileInfos,
119369
119465
  referencedMap: referencedMap,
119370
119466
  exportedModulesMap: exportedModulesMap,
119467
+ hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
119371
119468
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
119372
119469
  };
119373
119470
  }
@@ -119381,42 +119478,71 @@ var ts;
119381
119478
  }
119382
119479
  BuilderState.releaseCache = releaseCache;
119383
119480
  /**
119384
- * Gets the files affected by the path from the program
119481
+ * Creates a clone of the state
119385
119482
  */
119386
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
119483
+ function clone(state) {
119387
119484
  var _a, _b;
119388
- var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
119389
- (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119390
- (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119391
- return result;
119485
+ // Dont need to backup allFiles info since its cache anyway
119486
+ return {
119487
+ fileInfos: new ts.Map(state.fileInfos),
119488
+ referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
119489
+ exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
119490
+ hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
119491
+ useFileVersionAsSignature: state.useFileVersionAsSignature,
119492
+ };
119392
119493
  }
119393
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119394
- function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
119494
+ BuilderState.clone = clone;
119495
+ /**
119496
+ * Gets the files affected by the path from the program
119497
+ */
119498
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
119499
+ // Since the operation could be cancelled, the signatures are always stored in the cache
119500
+ // They will be committed once it is safe to use them
119501
+ // eg when calling this api from tsserver, if there is no cancellation of the operation
119502
+ // In the other cases the affected files signatures are committed only after the iteration through the result is complete
119503
+ var signatureCache = cacheToUpdateSignature || new ts.Map();
119395
119504
  var sourceFile = programOfThisState.getSourceFileByPath(path);
119396
119505
  if (!sourceFile) {
119397
119506
  return ts.emptyArray;
119398
119507
  }
119399
- if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
119508
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
119400
119509
  return [sourceFile];
119401
119510
  }
119402
- return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
119511
+ var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
119512
+ if (!cacheToUpdateSignature) {
119513
+ // Commit all the signatures in the signature cache
119514
+ updateSignaturesFromCache(state, signatureCache);
119515
+ }
119516
+ return result;
119403
119517
  }
119404
- BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
119518
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119519
+ /**
119520
+ * Updates the signatures from the cache into state's fileinfo signatures
119521
+ * This should be called whenever it is safe to commit the state of the builder
119522
+ */
119523
+ function updateSignaturesFromCache(state, signatureCache) {
119524
+ signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
119525
+ }
119526
+ BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
119405
119527
  function updateSignatureOfFile(state, signature, path) {
119406
119528
  state.fileInfos.get(path).signature = signature;
119407
- (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
119529
+ state.hasCalledUpdateShapeSignature.add(path);
119408
119530
  }
119409
119531
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
119410
119532
  /**
119411
119533
  * Returns if the shape of the signature has changed since last emit
119412
119534
  */
119413
- function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
119414
- var _a;
119535
+ function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
119415
119536
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
119537
+ ts.Debug.assert(!!sourceFile);
119538
+ ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
119416
119539
  // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
119417
- if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
119540
+ if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
119418
119541
  return false;
119542
+ }
119419
119543
  var info = state.fileInfos.get(sourceFile.resolvedPath);
119544
+ if (!info)
119545
+ return ts.Debug.fail();
119420
119546
  var prevSignature = info.signature;
119421
119547
  var latestSignature;
119422
119548
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -119427,55 +119553,45 @@ var ts;
119427
119553
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119428
119554
  if (firstDts_1) {
119429
119555
  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; })); });
119430
- latestSignature = computeSignature(firstDts_1.text, computeHash);
119431
- if (latestSignature !== prevSignature) {
119432
- updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
119556
+ latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119557
+ if (exportedModulesMapCache && latestSignature !== prevSignature) {
119558
+ updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
119433
119559
  }
119434
119560
  }
119435
119561
  }
119436
119562
  // Default is to use file version as signature
119437
119563
  if (latestSignature === undefined) {
119438
119564
  latestSignature = sourceFile.version;
119439
- if (state.exportedModulesMap && latestSignature !== prevSignature) {
119440
- (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119565
+ if (exportedModulesMapCache && latestSignature !== prevSignature) {
119441
119566
  // All the references in this file are exported
119442
119567
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
119443
119568
  if (references) {
119444
- state.exportedModulesMap.set(sourceFile.resolvedPath, references);
119569
+ exportedModulesMapCache.set(sourceFile.resolvedPath, references);
119445
119570
  }
119446
119571
  else {
119447
- state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119572
+ exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119448
119573
  }
119449
119574
  }
119450
119575
  }
119451
- (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
119452
- (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
119453
- info.signature = latestSignature;
119576
+ cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
119454
119577
  return latestSignature !== prevSignature;
119455
119578
  }
119456
119579
  BuilderState.updateShapeSignature = updateShapeSignature;
119457
- function computeSignature(text, computeHash) {
119458
- return (computeHash || ts.generateDjb2Hash)(text);
119459
- }
119460
- BuilderState.computeSignature = computeSignature;
119461
119580
  /**
119462
119581
  * Coverts the declaration emit result into exported modules map
119463
119582
  */
119464
- function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
119465
- if (!state.exportedModulesMap)
119466
- return;
119467
- (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119583
+ function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
119468
119584
  if (!exportedModulesFromDeclarationEmit) {
119469
- state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119585
+ exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119470
119586
  return;
119471
119587
  }
119472
119588
  var exportedModules;
119473
119589
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
119474
119590
  if (exportedModules) {
119475
- state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119591
+ exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
119476
119592
  }
119477
119593
  else {
119478
- state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119594
+ exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119479
119595
  }
119480
119596
  function addExportedModule(exportedModulePaths) {
119481
119597
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -119487,6 +119603,19 @@ var ts;
119487
119603
  }
119488
119604
  }
119489
119605
  BuilderState.updateExportedModules = updateExportedModules;
119606
+ /**
119607
+ * Updates the exported modules from cache into state's exported modules map
119608
+ * This should be called whenever it is safe to commit the state of the builder
119609
+ */
119610
+ function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
119611
+ var _a;
119612
+ if (exportedModulesMapCache) {
119613
+ ts.Debug.assert(!!state.exportedModulesMap);
119614
+ (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
119615
+ exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
119616
+ }
119617
+ }
119618
+ BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
119490
119619
  /**
119491
119620
  * Get all the dependencies of the sourceFile
119492
119621
  */
@@ -119607,7 +119736,7 @@ var ts;
119607
119736
  /**
119608
119737
  * When program emits modular code, gets the files affected by the sourceFile whose shape has changed
119609
119738
  */
119610
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
119739
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
119611
119740
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
119612
119741
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
119613
119742
  }
@@ -119627,7 +119756,7 @@ var ts;
119627
119756
  if (!seenFileNamesMap.has(currentPath)) {
119628
119757
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
119629
119758
  seenFileNamesMap.set(currentPath, currentSourceFile);
119630
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
119759
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
119631
119760
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
119632
119761
  }
119633
119762
  }
@@ -119653,33 +119782,32 @@ var ts;
119653
119782
  * Create the state so that we can iterate on changedFiles/affected files
119654
119783
  */
119655
119784
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119656
- var _a, _b;
119657
119785
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
119658
119786
  state.program = newProgram;
119659
119787
  var compilerOptions = newProgram.getCompilerOptions();
119660
119788
  state.compilerOptions = compilerOptions;
119661
- var outFilePath = ts.outFile(compilerOptions);
119662
119789
  // With --out or --outFile, any change affects all semantic diagnostics so no need to cache them
119663
- if (!outFilePath) {
119790
+ if (!ts.outFile(compilerOptions)) {
119664
119791
  state.semanticDiagnosticsPerFile = new ts.Map();
119665
119792
  }
119666
- 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)) {
119667
- state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
119668
- }
119669
119793
  state.changedFilesSet = new ts.Set();
119670
- state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
119671
119794
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
119672
119795
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
119673
119796
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
119674
119797
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
119675
- var canCopyEmitSignatures = compilerOptions.composite &&
119676
- (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
119677
- !outFilePath &&
119678
- !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
119679
119798
  if (useOldState) {
119799
+ // Verify the sanity of old state
119800
+ if (!oldState.currentChangedFilePath) {
119801
+ var affectedSignatures = oldState.currentAffectedFilesSignatures;
119802
+ ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
119803
+ }
119804
+ var changedFilesSet = oldState.changedFilesSet;
119805
+ if (canCopySemanticDiagnostics) {
119806
+ ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
119807
+ }
119680
119808
  // Copy old state's changed files set
119681
- (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
119682
- if (!outFilePath && oldState.affectedFilesPendingEmit) {
119809
+ changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
119810
+ if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
119683
119811
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
119684
119812
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
119685
119813
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -119700,8 +119828,6 @@ var ts;
119700
119828
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
119701
119829
  // versions dont match
119702
119830
  oldInfo.version !== info.version ||
119703
- // Implied formats dont match
119704
- oldInfo.impliedFormat !== info.impliedFormat ||
119705
119831
  // Referenced files changed
119706
119832
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
119707
119833
  // Referenced file was deleted in the new program
@@ -119725,25 +119851,27 @@ var ts;
119725
119851
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
119726
119852
  }
119727
119853
  }
119728
- if (canCopyEmitSignatures) {
119729
- var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
119730
- if (oldEmitSignature)
119731
- (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
119732
- }
119733
119854
  });
119734
119855
  // If the global file is removed, add all files as changed
119735
119856
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
119736
119857
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, /*firstSourceFile*/ undefined)
119737
119858
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
119738
119859
  }
119739
- else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
119860
+ else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
119740
119861
  // Add all files to affectedFilesPendingEmit since emit changed
119741
119862
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1 /* Full */); });
119742
119863
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
119743
119864
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
119744
119865
  }
119745
- // Since old states change files set is copied, any additional change means we would need to emit build info
119746
- state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
119866
+ if (useOldState) {
119867
+ // Any time the interpretation of a source file changes, mark it as changed
119868
+ ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
119869
+ if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
119870
+ state.changedFilesSet.add(sourceFilePath);
119871
+ }
119872
+ });
119873
+ }
119874
+ state.buildInfoEmitPending = !!state.changedFilesSet.size;
119747
119875
  return state;
119748
119876
  }
119749
119877
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -119779,35 +119907,30 @@ var ts;
119779
119907
  ts.BuilderState.releaseCache(state);
119780
119908
  state.program = undefined;
119781
119909
  }
119782
- function backupEmitBuilderProgramState(state) {
119783
- var outFilePath = ts.outFile(state.compilerOptions);
119784
- // Only in --out changeFileSet is kept around till emit
119785
- ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
119786
- return {
119787
- affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
119788
- affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
119789
- affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
119790
- seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
119791
- programEmitComplete: state.programEmitComplete,
119792
- emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
119793
- outSignature: state.outSignature,
119794
- dtsChangeTime: state.dtsChangeTime,
119795
- hasChangedEmitSignature: state.hasChangedEmitSignature,
119796
- changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
119797
- };
119798
- }
119799
- function restoreEmitBuilderProgramState(state, backupEmitState) {
119800
- state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
119801
- state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
119802
- state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
119803
- state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
119804
- state.programEmitComplete = backupEmitState.programEmitComplete;
119805
- state.emitSignatures = backupEmitState.emitSignatures;
119806
- state.outSignature = backupEmitState.outSignature;
119807
- state.dtsChangeTime = backupEmitState.dtsChangeTime;
119808
- state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
119809
- if (backupEmitState.changedFilesSet)
119810
- state.changedFilesSet = backupEmitState.changedFilesSet;
119910
+ /**
119911
+ * Creates a clone of the state
119912
+ */
119913
+ function cloneBuilderProgramState(state) {
119914
+ var _a;
119915
+ var newState = ts.BuilderState.clone(state);
119916
+ newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
119917
+ newState.changedFilesSet = new ts.Set(state.changedFilesSet);
119918
+ newState.affectedFiles = state.affectedFiles;
119919
+ newState.affectedFilesIndex = state.affectedFilesIndex;
119920
+ newState.currentChangedFilePath = state.currentChangedFilePath;
119921
+ newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
119922
+ newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
119923
+ newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
119924
+ newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
119925
+ newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
119926
+ newState.program = state.program;
119927
+ newState.compilerOptions = state.compilerOptions;
119928
+ newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
119929
+ newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
119930
+ newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
119931
+ newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
119932
+ newState.programEmitComplete = state.programEmitComplete;
119933
+ return newState;
119811
119934
  }
119812
119935
  /**
119813
119936
  * Verifies that source file is ok to be used in calls that arent handled by next
@@ -119822,7 +119945,7 @@ var ts;
119822
119945
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
119823
119946
  */
119824
119947
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
119825
- var _a, _b;
119948
+ var _a;
119826
119949
  while (true) {
119827
119950
  var affectedFiles = state.affectedFiles;
119828
119951
  if (affectedFiles) {
@@ -119842,8 +119965,10 @@ var ts;
119842
119965
  state.changedFilesSet.delete(state.currentChangedFilePath);
119843
119966
  state.currentChangedFilePath = undefined;
119844
119967
  // Commit the changes in file signature
119845
- (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119846
- (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119968
+ ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
119969
+ state.currentAffectedFilesSignatures.clear();
119970
+ ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
119971
+ (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
119847
119972
  state.affectedFiles = undefined;
119848
119973
  }
119849
119974
  // Get next changed file
@@ -119861,7 +119986,12 @@ var ts;
119861
119986
  return program;
119862
119987
  }
119863
119988
  // Get next batch of affected files
119864
- state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
119989
+ if (!state.currentAffectedFilesSignatures)
119990
+ state.currentAffectedFilesSignatures = new ts.Map();
119991
+ if (state.exportedModulesMap) {
119992
+ state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
119993
+ }
119994
+ state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
119865
119995
  state.currentChangedFilePath = nextKey.value;
119866
119996
  state.affectedFilesIndex = 0;
119867
119997
  if (!state.seenAffectedFiles)
@@ -119913,6 +120043,7 @@ var ts;
119913
120043
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
119914
120044
  */
119915
120045
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120046
+ var _a;
119916
120047
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
119917
120048
  // If affected files is everything except default library, then nothing more to do
119918
120049
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -119920,9 +120051,10 @@ var ts;
119920
120051
  // When a change affects the global scope, all files are considered to be affected without updating their signature
119921
120052
  // That means when affected file is handled, its signature can be out of date
119922
120053
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
119923
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
120054
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
119924
120055
  return;
119925
120056
  }
120057
+ 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);
119926
120058
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
119927
120059
  return;
119928
120060
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -119942,7 +120074,7 @@ var ts;
119942
120074
  // This ensures that we dont later during incremental builds considering wrong signature.
119943
120075
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
119944
120076
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
119945
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
120077
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
119946
120078
  // If not dts emit, nothing more to do
119947
120079
  if (ts.getEmitDeclarations(state.compilerOptions)) {
119948
120080
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -119963,10 +120095,27 @@ var ts;
119963
120095
  return !state.semanticDiagnosticsFromOldState.size;
119964
120096
  }
119965
120097
  function isChangedSignature(state, path) {
119966
- var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
119967
- var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120098
+ var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
120099
+ var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
119968
120100
  return newSignature !== oldSignature;
119969
120101
  }
120102
+ function forEachKeyOfExportedModulesMap(state, filePath, fn) {
120103
+ // Go through exported modules from cache first
120104
+ var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
120105
+ var result = keys && ts.forEachKey(keys, fn);
120106
+ if (result)
120107
+ return result;
120108
+ // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
120109
+ keys = state.exportedModulesMap.getKeys(filePath);
120110
+ return keys && ts.forEachKey(keys, function (exportedFromPath) {
120111
+ var _a;
120112
+ // If the cache had an updated value, skip
120113
+ return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
120114
+ !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
120115
+ fn(exportedFromPath) :
120116
+ undefined;
120117
+ });
120118
+ }
119970
120119
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
119971
120120
  var _a;
119972
120121
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -119981,7 +120130,6 @@ var ts;
119981
120130
  * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
119982
120131
  */
119983
120132
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
119984
- var _a;
119985
120133
  // If there was change in signature (dts output) for the changed file,
119986
120134
  // then only we need to handle pending file emit
119987
120135
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
@@ -120008,10 +120156,11 @@ var ts;
120008
120156
  }
120009
120157
  }
120010
120158
  }
120159
+ ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120011
120160
  var seenFileAndExportsOfFile = new ts.Set();
120012
120161
  // Go through exported modules from cache first
120013
120162
  // If exported modules has path, all files referencing file exported from are affected
120014
- (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120163
+ forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
120015
120164
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
120016
120165
  return true;
120017
120166
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -120025,18 +120174,19 @@ var ts;
120025
120174
  * return true when all work is done and we can exit handling dts emit and semantic diagnostics
120026
120175
  */
120027
120176
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
120028
- var _a, _b;
120177
+ var _a;
120029
120178
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
120030
120179
  return undefined;
120031
120180
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
120032
120181
  return true;
120033
120182
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
120183
+ ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120034
120184
  // If exported modules has path, all files referencing file exported from are affected
120035
- (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120185
+ forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
120036
120186
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
120037
120187
  });
120038
120188
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
120039
- (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
120189
+ (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
120040
120190
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
120041
120191
  handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
120042
120192
  state, referencingFilePath, cancellationToken, computeHash, host);
@@ -120057,13 +120207,12 @@ var ts;
120057
120207
  }
120058
120208
  else {
120059
120209
  state.seenAffectedFiles.add(affected.resolvedPath);
120060
- // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted
120061
- state.buildInfoEmitPending = true;
120062
120210
  if (emitKind !== undefined) {
120063
120211
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
120064
120212
  }
120065
120213
  if (isPendingEmit) {
120066
120214
  state.affectedFilesPendingEmitIndex++;
120215
+ state.buildInfoEmitPending = true;
120067
120216
  }
120068
120217
  else {
120069
120218
  state.affectedFilesIndex++;
@@ -120114,43 +120263,22 @@ var ts;
120114
120263
  /**
120115
120264
  * Gets the program information to be emitted in buildInfo so that we can use it to create new program
120116
120265
  */
120117
- function getProgramBuildInfo(state, getCanonicalFileName, host) {
120118
- var outFilePath = ts.outFile(state.compilerOptions);
120119
- if (outFilePath && !state.compilerOptions.composite)
120120
- return;
120266
+ function getProgramBuildInfo(state, getCanonicalFileName) {
120267
+ if (ts.outFile(state.compilerOptions))
120268
+ return undefined;
120121
120269
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
120122
120270
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
120123
- state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
120124
- if (outFilePath) {
120125
- var result_15 = {
120126
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
120127
- outSignature: state.outSignature,
120128
- dtsChangeTime: state.dtsChangeTime,
120129
- };
120130
- return result_15;
120131
- }
120132
120271
  var fileNames = [];
120133
120272
  var fileNameToFileId = new ts.Map();
120134
120273
  var fileIdsList;
120135
120274
  var fileNamesToFileIdListId;
120136
- var emitSignatures;
120137
120275
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
120138
- var _b, _c;
120139
120276
  var key = _a[0], value = _a[1];
120140
120277
  // Ensure fileId
120141
120278
  var fileId = toFileId(key);
120142
120279
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
120143
- var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
120144
- var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
120145
- if (state.compilerOptions.composite) {
120146
- var file = state.program.getSourceFileByPath(key);
120147
- if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
120148
- var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
120149
- if (emitSignature !== actualSignature) {
120150
- (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
120151
- }
120152
- }
120153
- }
120280
+ var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120281
+ var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120154
120282
  return value.version === actualSignature ?
120155
120283
  value.affectsGlobalScope || value.impliedFormat ?
120156
120284
  // If file version is same as signature, dont serialize signature
@@ -120158,11 +120286,11 @@ var ts;
120158
120286
  // If file info only contains version and signature and both are same we can just write string
120159
120287
  value.version :
120160
120288
  actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120161
- oldSignature === undefined ?
120289
+ signature === undefined ?
120162
120290
  // If we havent computed signature, use fileInfo as is
120163
120291
  value :
120164
120292
  // Serialize fileInfo with new updated signature
120165
- { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120293
+ { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120166
120294
  // Signature of the FileInfo is undefined, serialize it as false
120167
120295
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120168
120296
  });
@@ -120177,13 +120305,17 @@ var ts;
120177
120305
  if (state.exportedModulesMap) {
120178
120306
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
120179
120307
  var _a;
120180
- var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
120308
+ if (state.currentAffectedFilesExportedModulesMap) {
120309
+ if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
120310
+ return undefined;
120311
+ }
120312
+ var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
120313
+ if (newValue) {
120314
+ return [toFileId(key), toFileIdListId(newValue)];
120315
+ }
120316
+ }
120181
120317
  // Not in temporary cache, use existing value
120182
- if (oldValue === undefined)
120183
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120184
- if (oldValue)
120185
- return [toFileId(key), toFileIdListId(oldValue)];
120186
- return undefined;
120318
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120187
120319
  });
120188
120320
  }
120189
120321
  var semanticDiagnosticsPerFile;
@@ -120194,7 +120326,9 @@ var ts;
120194
120326
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
120195
120327
  [
120196
120328
  toFileId(key),
120197
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120329
+ state.hasReusableDiagnostic ?
120330
+ value :
120331
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
120198
120332
  ] :
120199
120333
  toFileId(key));
120200
120334
  }
@@ -120209,27 +120343,16 @@ var ts;
120209
120343
  }
120210
120344
  }
120211
120345
  }
120212
- var changeFileSet;
120213
- if (state.changedFilesSet.size) {
120214
- for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
120215
- var path = _e[_d];
120216
- (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120217
- }
120218
- }
120219
- var result = {
120346
+ return {
120220
120347
  fileNames: fileNames,
120221
120348
  fileInfos: fileInfos,
120222
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
120349
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
120223
120350
  fileIdsList: fileIdsList,
120224
120351
  referencedMap: referencedMap,
120225
120352
  exportedModulesMap: exportedModulesMap,
120226
120353
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
120227
120354
  affectedFilesPendingEmit: affectedFilesPendingEmit,
120228
- changeFileSet: changeFileSet,
120229
- emitSignatures: emitSignatures,
120230
- dtsChangeTime: state.dtsChangeTime,
120231
120355
  };
120232
- return result;
120233
120356
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
120234
120357
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
120235
120358
  }
@@ -120254,18 +120377,24 @@ var ts;
120254
120377
  }
120255
120378
  return fileIdListId;
120256
120379
  }
120257
- function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
120258
- var result;
120259
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120260
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120261
- var name = _a[_i];
120262
- var optionInfo = optionsNameMap.get(name.toLowerCase());
120263
- if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
120264
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
120265
- }
120380
+ }
120381
+ function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
120382
+ var result;
120383
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120384
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120385
+ var name = _a[_i];
120386
+ var optionKey = name.toLowerCase();
120387
+ var optionInfo = optionsNameMap.get(optionKey);
120388
+ if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
120389
+ // We need to store `strict`, even though it won't be examined directly, so that the
120390
+ // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
120391
+ optionKey === "strict" ||
120392
+ // We need to store these to determine whether `lib` files need to be rechecked.
120393
+ optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
120394
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
120266
120395
  }
120267
- return result;
120268
120396
  }
120397
+ return result;
120269
120398
  }
120270
120399
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120271
120400
  if (option) {
@@ -120339,10 +120468,6 @@ var ts;
120339
120468
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
120340
120469
  }
120341
120470
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
120342
- function computeSignature(text, data, computeHash) {
120343
- return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
120344
- }
120345
- ts.computeSignature = computeSignature;
120346
120471
  function createBuilderProgram(kind, _a) {
120347
120472
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
120348
120473
  // Return same program if underlying program doesnt change
@@ -120361,8 +120486,8 @@ var ts;
120361
120486
  */
120362
120487
  var computeHash = ts.maybeBind(host, host.createHash);
120363
120488
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
120364
- var backupEmitState;
120365
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
120489
+ var backupState;
120490
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
120366
120491
  // To ensure that we arent storing any references to old program or new program without state
120367
120492
  newProgram = undefined; // TODO: GH#18217
120368
120493
  oldProgram = undefined;
@@ -120370,20 +120495,20 @@ var ts;
120370
120495
  var getState = function () { return state; };
120371
120496
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
120372
120497
  builderProgram.getState = getState;
120373
- builderProgram.backupEmitState = function () {
120374
- ts.Debug.assert(backupEmitState === undefined);
120375
- backupEmitState = backupEmitBuilderProgramState(state);
120498
+ builderProgram.backupState = function () {
120499
+ ts.Debug.assert(backupState === undefined);
120500
+ backupState = cloneBuilderProgramState(state);
120376
120501
  };
120377
- builderProgram.restoreEmitState = function () {
120378
- restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
120379
- backupEmitState = undefined;
120502
+ builderProgram.restoreState = function () {
120503
+ state = ts.Debug.checkDefined(backupState);
120504
+ backupState = undefined;
120380
120505
  };
120381
120506
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
120382
120507
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
120383
120508
  builderProgram.emit = emit;
120384
120509
  builderProgram.releaseProgram = function () {
120385
120510
  releaseCache(state);
120386
- backupEmitState = undefined;
120511
+ backupState = undefined;
120387
120512
  };
120388
120513
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
120389
120514
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -120442,59 +120567,35 @@ var ts;
120442
120567
  return toAffectedFileEmitResult(state,
120443
120568
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
120444
120569
  // Otherwise just affected file
120445
- ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
120446
- getWriteFileCallback(writeFile, customTransformers) :
120570
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120571
+ getWriteFileUpdatingSignatureCallback(writeFile) :
120447
120572
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
120448
120573
  }
120449
- function getWriteFileCallback(writeFile, customTransformers) {
120574
+ function getWriteFileUpdatingSignatureCallback(writeFile) {
120450
120575
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
120451
- var _a, _b, _c;
120576
+ var _a;
120452
120577
  if (ts.isDeclarationFileName(fileName)) {
120453
- if (!ts.outFile(state.compilerOptions)) {
120454
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120455
- var newSignature = void 0;
120456
- if (!customTransformers) {
120457
- var file = sourceFiles[0];
120458
- var info = state.fileInfos.get(file.resolvedPath);
120459
- if (info.signature === file.version) {
120460
- newSignature = computeSignature(text, data, computeHash);
120461
- if (newSignature !== file.version) { // Update it
120462
- if (host.storeFilesChangingSignatureDuringEmit)
120463
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120464
- if (state.exportedModulesMap)
120465
- ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
120466
- if (state.affectedFiles) {
120467
- // Keep old signature so we know what to undo if cancellation happens
120468
- var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
120469
- if (existing === undefined)
120470
- (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
120471
- info.signature = newSignature;
120472
- }
120473
- else {
120474
- // These are directly commited
120475
- info.signature = newSignature;
120476
- (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120477
- }
120478
- }
120578
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120579
+ var file = sourceFiles[0];
120580
+ var info = state.fileInfos.get(file.resolvedPath);
120581
+ var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120582
+ if (signature === file.version) {
120583
+ var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120584
+ if (newSignature !== file.version) { // Update it
120585
+ if (host.storeFilesChangingSignatureDuringEmit)
120586
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120587
+ if (state.exportedModulesMap)
120588
+ ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
120589
+ if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
120590
+ state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
120479
120591
  }
120480
- }
120481
- if (state.compilerOptions.composite) {
120482
- var filePath = sourceFiles[0].resolvedPath;
120483
- var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
120484
- newSignature || (newSignature = computeSignature(text, data, computeHash));
120485
- if (newSignature !== oldSignature) {
120486
- (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
120487
- state.hasChangedEmitSignature = true;
120592
+ else {
120593
+ info.signature = newSignature;
120594
+ if (state.exportedModulesMap)
120595
+ ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120488
120596
  }
120489
120597
  }
120490
120598
  }
120491
- else if (state.compilerOptions.composite) {
120492
- var newSignature = computeSignature(text, data, computeHash);
120493
- if (newSignature !== state.outSignature) {
120494
- state.outSignature = newSignature;
120495
- state.hasChangedEmitSignature = true;
120496
- }
120497
- }
120498
120599
  }
120499
120600
  if (writeFile)
120500
120601
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -120559,8 +120660,8 @@ var ts;
120559
120660
  }
120560
120661
  }
120561
120662
  }
120562
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
120563
- getWriteFileCallback(writeFile, customTransformers) :
120663
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120664
+ getWriteFileUpdatingSignatureCallback(writeFile) :
120564
120665
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120565
120666
  }
120566
120667
  /**
@@ -120649,28 +120750,14 @@ var ts;
120649
120750
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
120650
120751
  }
120651
120752
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
120652
- function createBuilderProgramUsingProgramBuildInfo(programFromBuildInfo, buildInfoPath, host) {
120653
- var _a, _b, _c, _d, _e;
120753
+ function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
120754
+ var _a;
120654
120755
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
120655
120756
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
120656
- var program = programFromBuildInfo;
120657
- var filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
120658
- var filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
120757
+ var filePaths = program.fileNames.map(toPath);
120758
+ var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
120659
120759
  var fileInfos = new ts.Map();
120660
- var emitSignatures = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
120661
- (_d = program.fileInfos) === null || _d === void 0 ? void 0 : _d.forEach(function (fileInfo, index) {
120662
- var path = toFilePath(index + 1);
120663
- var stateFileInfo = toBuilderStateFileInfo(fileInfo);
120664
- fileInfos.set(path, stateFileInfo);
120665
- if (emitSignatures && stateFileInfo.signature)
120666
- emitSignatures.set(path, stateFileInfo.signature);
120667
- });
120668
- (_e = program.emitSignatures) === null || _e === void 0 ? void 0 : _e.forEach(function (value) {
120669
- if (ts.isNumber(value))
120670
- emitSignatures.delete(toFilePath(value));
120671
- else
120672
- emitSignatures.set(toFilePath(value[0]), value[1]);
120673
- });
120760
+ program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
120674
120761
  var state = {
120675
120762
  fileInfos: fileInfos,
120676
120763
  compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
@@ -120681,15 +120768,11 @@ var ts;
120681
120768
  affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
120682
120769
  affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
120683
120770
  affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
120684
- changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
120685
- dtsChangeTime: program.dtsChangeTime,
120686
- emitSignatures: (emitSignatures === null || emitSignatures === void 0 ? void 0 : emitSignatures.size) ? emitSignatures : undefined,
120687
- outSignature: program.outSignature,
120688
120771
  };
120689
120772
  return {
120690
120773
  getState: function () { return state; },
120691
- backupEmitState: ts.noop,
120692
- restoreEmitState: ts.noop,
120774
+ backupState: ts.noop,
120775
+ restoreState: ts.noop,
120693
120776
  getProgram: ts.notImplemented,
120694
120777
  getProgramOrUndefined: ts.returnUndefined,
120695
120778
  releaseProgram: ts.noop,
@@ -120734,12 +120817,12 @@ var ts;
120734
120817
  return map;
120735
120818
  }
120736
120819
  }
120737
- ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
120820
+ ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
120738
120821
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
120739
120822
  return {
120740
120823
  getState: ts.notImplemented,
120741
- backupEmitState: ts.noop,
120742
- restoreEmitState: ts.noop,
120824
+ backupState: ts.noop,
120825
+ restoreState: ts.noop,
120743
120826
  getProgram: getProgram,
120744
120827
  getProgramOrUndefined: function () { return getState().program; },
120745
120828
  releaseProgram: function () { return getState().program = undefined; },
@@ -121023,8 +121106,8 @@ var ts;
121023
121106
  !!redirectedReference;
121024
121107
  var seenNamesInFile = ts.createModeAwareCache();
121025
121108
  var i = 0;
121026
- for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
121027
- var entry = names_4[_i];
121109
+ for (var _i = 0, names_5 = names; _i < names_5.length; _i++) {
121110
+ var entry = names_5[_i];
121028
121111
  var name = ts.isString(entry) ? entry : entry.fileName.toLowerCase();
121029
121112
  // Imports supply a `containingSourceFile` but no `containingSourceFileMode` - it would be redundant
121030
121113
  // they require calculating the mode for a given import from it's position in the resolution table, since a given
@@ -121590,7 +121673,7 @@ var ts;
121590
121673
  }
121591
121674
  function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
121592
121675
  var _a;
121593
- if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node12
121676
+ if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16
121594
121677
  && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
121595
121678
  return false;
121596
121679
  }
@@ -121634,14 +121717,14 @@ var ts;
121634
121717
  if (options === void 0) { options = {}; }
121635
121718
  var info = getInfo(importingSourceFile.path, host);
121636
121719
  var modulePaths = getAllModulePaths(importingSourceFile.path, nodeModulesFileName, host, preferences, options);
121637
- return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ true, options.overrideImportMode); });
121720
+ return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, preferences, /*packageNameOnly*/ true, options.overrideImportMode); });
121638
121721
  }
121639
121722
  moduleSpecifiers_1.getNodeModulesPackageName = getNodeModulesPackageName;
121640
121723
  function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, preferences, userPreferences, options) {
121641
121724
  if (options === void 0) { options = {}; }
121642
121725
  var info = getInfo(importingSourceFileName, host);
121643
121726
  var modulePaths = getAllModulePaths(importingSourceFileName, toFileName, host, userPreferences, options);
121644
- return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
121727
+ return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
121645
121728
  getLocalModuleSpecifier(toFileName, info, compilerOptions, host, preferences);
121646
121729
  }
121647
121730
  function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options) {
@@ -121717,7 +121800,7 @@ var ts;
121717
121800
  var relativeSpecifiers;
121718
121801
  for (var _i = 0, modulePaths_1 = modulePaths; _i < modulePaths_1.length; _i++) {
121719
121802
  var modulePath = modulePaths_1[_i];
121720
- var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ undefined, options.overrideImportMode);
121803
+ var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode);
121721
121804
  nodeModulesSpecifiers = ts.append(nodeModulesSpecifiers, specifier);
121722
121805
  if (specifier && modulePath.isRedirect) {
121723
121806
  // If we got a specifier for a redirect, it was a bare package specifier (e.g. "@foo/bar",
@@ -121855,9 +121938,9 @@ var ts;
121855
121938
  if (!preferSymlinks) {
121856
121939
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
121857
121940
  // so we only need to remove them from the realpath filenames.
121858
- var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
121859
- if (result_16)
121860
- return result_16;
121941
+ var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
121942
+ if (result_15)
121943
+ return result_15;
121861
121944
  }
121862
121945
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
121863
121946
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -121877,10 +121960,10 @@ var ts;
121877
121960
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
121878
121961
  var symlinkDirectory = symlinkDirectories_1[_i];
121879
121962
  var option = ts.resolvePath(symlinkDirectory, relative);
121880
- var result_17 = cb(option, target === referenceRedirect);
121963
+ var result_16 = cb(option, target === referenceRedirect);
121881
121964
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
121882
- if (result_17)
121883
- return result_17;
121965
+ if (result_16)
121966
+ return result_16;
121884
121967
  }
121885
121968
  });
121886
121969
  });
@@ -122110,7 +122193,7 @@ var ts;
122110
122193
  ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
122111
122194
  : ts.removeFileExtension(relativePath);
122112
122195
  }
122113
- function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, packageNameOnly, overrideMode) {
122196
+ function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
122114
122197
  var path = _a.path, isRedirect = _a.isRedirect;
122115
122198
  var getCanonicalFileName = _b.getCanonicalFileName, sourceDirectory = _b.sourceDirectory;
122116
122199
  if (!host.fileExists || !host.readFile) {
@@ -122124,8 +122207,9 @@ var ts;
122124
122207
  var moduleSpecifier = path;
122125
122208
  var isPackageRootPath = false;
122126
122209
  if (!packageNameOnly) {
122210
+ var preferences = getPreferences(host, userPreferences, options, importingSourceFile);
122127
122211
  var packageRootIndex = parts.packageRootIndex;
122128
- var moduleFileNameForExtensionless = void 0;
122212
+ var moduleFileName = void 0;
122129
122213
  while (true) {
122130
122214
  // If the module could be imported by a directory name, use that directory's name
122131
122215
  var _c = tryDirectoryWithPackageJson(packageRootIndex), moduleFileToTry = _c.moduleFileToTry, packageRootPath = _c.packageRootPath, blockedByExports = _c.blockedByExports, verbatimFromExports = _c.verbatimFromExports;
@@ -122142,12 +122226,12 @@ var ts;
122142
122226
  isPackageRootPath = true;
122143
122227
  break;
122144
122228
  }
122145
- if (!moduleFileNameForExtensionless)
122146
- moduleFileNameForExtensionless = moduleFileToTry;
122229
+ if (!moduleFileName)
122230
+ moduleFileName = moduleFileToTry;
122147
122231
  // try with next level of directory
122148
122232
  packageRootIndex = path.indexOf(ts.directorySeparator, packageRootIndex + 1);
122149
122233
  if (packageRootIndex === -1) {
122150
- moduleSpecifier = getExtensionlessFileName(moduleFileNameForExtensionless);
122234
+ moduleSpecifier = removeExtensionAndIndexPostFix(moduleFileName, preferences.ending, options, host);
122151
122235
  break;
122152
122236
  }
122153
122237
  }
@@ -122175,7 +122259,7 @@ var ts;
122175
122259
  var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
122176
122260
  if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
122177
122261
  var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
122178
- if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
122262
+ if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
122179
122263
  // `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
122180
122264
  // an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
122181
122265
  // usually called to conjure an import out of thin air, we don't have an existing usage to call `getModeForUsageAtIndex`
@@ -122205,7 +122289,7 @@ var ts;
122205
122289
  }
122206
122290
  }
122207
122291
  // If the file is the main module, it can be imported by the package name
122208
- var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main;
122292
+ var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
122209
122293
  if (ts.isString(mainFileRelative)) {
122210
122294
  var mainExportFile = ts.toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
122211
122295
  if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(getCanonicalFileName(moduleFileToTry))) {
@@ -122213,17 +122297,14 @@ var ts;
122213
122297
  }
122214
122298
  }
122215
122299
  }
122216
- return { moduleFileToTry: moduleFileToTry };
122217
- }
122218
- function getExtensionlessFileName(path) {
122219
- // We still have a file name - remove the extension
122220
- var fullModulePathWithoutExtension = ts.removeFileExtension(path);
122221
- // If the file is /index, it can be imported by its directory name
122222
- // IFF there is not _also_ a file by the same name
122223
- if (getCanonicalFileName(fullModulePathWithoutExtension.substring(parts.fileNameIndex)) === "/index" && !tryGetAnyFileFromPath(host, fullModulePathWithoutExtension.substring(0, parts.fileNameIndex))) {
122224
- return fullModulePathWithoutExtension.substring(0, parts.fileNameIndex);
122300
+ else {
122301
+ // No package.json exists; an index.js will still resolve as the package name
122302
+ var fileName = getCanonicalFileName(moduleFileToTry.substring(parts.packageRootIndex + 1));
122303
+ if (fileName === "index.d.ts" || fileName === "index.js" || fileName === "index.ts" || fileName === "index.tsx") {
122304
+ return { moduleFileToTry: moduleFileToTry, packageRootPath: packageRootPath };
122305
+ }
122225
122306
  }
122226
- return fullModulePathWithoutExtension;
122307
+ return { moduleFileToTry: moduleFileToTry };
122227
122308
  }
122228
122309
  }
122229
122310
  function tryGetAnyFileFromPath(host, path) {
@@ -122245,7 +122326,7 @@ var ts;
122245
122326
  return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
122246
122327
  });
122247
122328
  }
122248
- function removeExtensionAndIndexPostFix(fileName, ending, options) {
122329
+ function removeExtensionAndIndexPostFix(fileName, ending, options, host) {
122249
122330
  if (ts.fileExtensionIsOneOf(fileName, [".json" /* Json */, ".mjs" /* Mjs */, ".cjs" /* Cjs */]))
122250
122331
  return fileName;
122251
122332
  var noExtension = ts.removeFileExtension(fileName);
@@ -122253,7 +122334,13 @@ var ts;
122253
122334
  return noExtension + getJSExtensionForFile(fileName, options);
122254
122335
  switch (ending) {
122255
122336
  case 0 /* Minimal */:
122256
- return ts.removeSuffix(noExtension, "/index");
122337
+ var withoutIndex = ts.removeSuffix(noExtension, "/index");
122338
+ if (host && withoutIndex !== noExtension && tryGetAnyFileFromPath(host, withoutIndex)) {
122339
+ // Can't remove index if there's a file by the same name as the directory.
122340
+ // Probably more callers should pass `host` so we can determine this?
122341
+ return noExtension;
122342
+ }
122343
+ return withoutIndex;
122257
122344
  case 1 /* Index */:
122258
122345
  return noExtension;
122259
122346
  case 2 /* JsExtension */:
@@ -122772,7 +122859,6 @@ var ts;
122772
122859
  readDirectory: ts.maybeBind(host, host.readDirectory),
122773
122860
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
122774
122861
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
122775
- now: ts.maybeBind(host, host.now),
122776
122862
  };
122777
122863
  function writeFile(fileName, text, writeByteOrderMark, onError) {
122778
122864
  try {
@@ -122833,7 +122919,6 @@ var ts;
122833
122919
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
122834
122920
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
122835
122921
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
122836
- now: ts.maybeBind(system, system.now),
122837
122922
  };
122838
122923
  }
122839
122924
  ts.createProgramHost = createProgramHost;
@@ -122901,26 +122986,20 @@ var ts;
122901
122986
  var ts;
122902
122987
  (function (ts) {
122903
122988
  function readBuilderProgram(compilerOptions, host) {
122989
+ if (ts.outFile(compilerOptions))
122990
+ return undefined;
122904
122991
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
122905
122992
  if (!buildInfoPath)
122906
122993
  return undefined;
122907
- var buildInfo;
122908
- if (host.getBuildInfo) {
122909
- buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
122910
- if (!buildInfo)
122911
- return undefined;
122912
- }
122913
- else {
122914
- var content = host.readFile(buildInfoPath);
122915
- if (!content)
122916
- return undefined;
122917
- buildInfo = ts.getBuildInfo(content);
122918
- }
122994
+ var content = host.readFile(buildInfoPath);
122995
+ if (!content)
122996
+ return undefined;
122997
+ var buildInfo = ts.getBuildInfo(content);
122919
122998
  if (buildInfo.version !== ts.version)
122920
122999
  return undefined;
122921
123000
  if (!buildInfo.program)
122922
123001
  return undefined;
122923
- return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123002
+ return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
122924
123003
  }
122925
123004
  ts.readBuilderProgram = readBuilderProgram;
122926
123005
  function createIncrementalCompilerHost(options, system) {
@@ -122929,7 +123008,6 @@ var ts;
122929
123008
  host.createHash = ts.maybeBind(system, system.createHash);
122930
123009
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
122931
123010
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
122932
- host.now = ts.maybeBind(system, system.now);
122933
123011
  ts.setGetSourceFileAsHashVersioned(host, system);
122934
123012
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
122935
123013
  return host;
@@ -123664,16 +123742,14 @@ var ts;
123664
123742
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
123665
123743
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
123666
123744
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
123667
- UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
123668
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
123669
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
123670
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
123671
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
123745
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
123746
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
123747
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
123748
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
123672
123749
  /**
123673
123750
  * Projects with no outputs (i.e. "solution" files)
123674
123751
  */
123675
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 12] = "ContainerOnly";
123676
- UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 13] = "ForceBuild";
123752
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
123677
123753
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
123678
123754
  function resolveConfigFileProjectName(project) {
123679
123755
  if (ts.fileExtensionIs(project, ".json" /* Json */)) {
@@ -123718,11 +123794,9 @@ var ts;
123718
123794
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
123719
123795
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
123720
123796
  }
123721
- /*@internal*/
123722
- function getCurrentTime(host) {
123723
- return host.now ? host.now() : new Date();
123797
+ function newer(date1, date2) {
123798
+ return date2 > date1 ? date2 : date1;
123724
123799
  }
123725
- ts.getCurrentTime = getCurrentTime;
123726
123800
  /*@internal*/
123727
123801
  function isCircularBuildOrder(buildOrder) {
123728
123802
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -123812,7 +123886,6 @@ var ts;
123812
123886
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
123813
123887
  };
123814
123888
  }
123815
- compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
123816
123889
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
123817
123890
  var state = {
123818
123891
  host: host,
@@ -123829,9 +123902,8 @@ var ts;
123829
123902
  resolvedConfigFilePaths: new ts.Map(),
123830
123903
  configFileCache: new ts.Map(),
123831
123904
  projectStatus: new ts.Map(),
123905
+ buildInfoChecked: new ts.Map(),
123832
123906
  extendedConfigCache: new ts.Map(),
123833
- buildInfoCache: new ts.Map(),
123834
- outputTimeStamps: new ts.Map(),
123835
123907
  builderPrograms: new ts.Map(),
123836
123908
  diagnostics: new ts.Map(),
123837
123909
  projectPendingBuild: new ts.Map(),
@@ -123855,7 +123927,6 @@ var ts;
123855
123927
  allWatchedConfigFiles: new ts.Map(),
123856
123928
  allWatchedExtendedConfigFiles: new ts.Map(),
123857
123929
  allWatchedPackageJsonFiles: new ts.Map(),
123858
- filesWatched: new ts.Map(),
123859
123930
  lastCachedPackageJsonLookups: new ts.Map(),
123860
123931
  timerToBuildInvalidatedProject: undefined,
123861
123932
  reportFileChangeDetected: false,
@@ -123962,12 +124033,11 @@ var ts;
123962
124033
  // Config file cache
123963
124034
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
123964
124035
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
124036
+ ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
123965
124037
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
123966
124038
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
123967
124039
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
123968
124040
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
123969
- ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
123970
- ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
123971
124041
  // Remove watches for the program no longer in the solution
123972
124042
  if (state.watch) {
123973
124043
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
@@ -124258,21 +124328,21 @@ var ts;
124258
124328
  }
124259
124329
  function emit(writeFileCallback, cancellationToken, customTransformers) {
124260
124330
  var _a;
124261
- var _b, _c, _d;
124331
+ var _b, _c;
124262
124332
  ts.Debug.assertIsDefined(program);
124263
124333
  ts.Debug.assert(step === BuildStep.Emit);
124264
124334
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
124265
- program.backupEmitState();
124335
+ program.backupState();
124266
124336
  var declDiagnostics;
124267
124337
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
124268
124338
  var outputFiles = [];
124269
124339
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
124270
124340
  /*write*/ undefined,
124271
- /*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,
124341
+ /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
124272
124342
  /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
124273
124343
  // Don't emit .d.ts if there are decl file errors
124274
124344
  if (declDiagnostics) {
124275
- program.restoreEmitState();
124345
+ program.restoreState();
124276
124346
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
124277
124347
  return {
124278
124348
  emitSkipped: true,
@@ -124282,43 +124352,37 @@ var ts;
124282
124352
  // Actual Emit
124283
124353
  var host = state.host, compilerHost = state.compilerHost;
124284
124354
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124285
- var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
124355
+ var newestDeclarationFileContentChangedTime = minimumDate;
124356
+ var anyDtsChanged = false;
124286
124357
  var emitterDiagnostics = ts.createDiagnosticCollection();
124287
124358
  var emittedOutputs = new ts.Map();
124288
- var options = program.getCompilerOptions();
124289
- var isIncremental = ts.isIncrementalCompilation(options);
124290
- var outputTimeStampMap;
124291
- var now;
124292
124359
  outputFiles.forEach(function (_a) {
124293
- var _b, _c;
124294
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124295
- var path = toPath(state, name);
124296
- emittedOutputs.set(toPath(state, name), name);
124297
- if (buildInfo) {
124298
- setBuildInfo(state, buildInfo, projectPath, options);
124299
- 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)) {
124360
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124361
+ var priorChangeTime;
124362
+ if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124363
+ // Check for unchanged .d.ts files
124364
+ if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124365
+ priorChangeTime = host.getModifiedTime(name);
124366
+ }
124367
+ else {
124300
124368
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124369
+ anyDtsChanged = true;
124301
124370
  }
124302
124371
  }
124372
+ emittedOutputs.set(toPath(state, name), name);
124303
124373
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124304
- if (!isIncremental && state.watch) {
124305
- (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
124374
+ if (priorChangeTime !== undefined) {
124375
+ newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
124306
124376
  }
124307
124377
  });
124308
- finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124378
+ finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime,
124379
+ /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124309
124380
  return emitResult;
124310
124381
  }
124311
124382
  function emitBuildInfo(writeFileCallback, cancellationToken) {
124312
124383
  ts.Debug.assertIsDefined(program);
124313
124384
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
124314
- var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
124315
- if (data === null || data === void 0 ? void 0 : data.buildInfo)
124316
- setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
124317
- if (writeFileCallback)
124318
- writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
124319
- else
124320
- state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
124321
- }, cancellationToken);
124385
+ var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
124322
124386
  if (emitResult.diagnostics.length) {
124323
124387
  reportErrors(state, emitResult.diagnostics);
124324
124388
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -124331,7 +124395,7 @@ var ts;
124331
124395
  step = BuildStep.QueueReferencingProjects;
124332
124396
  return emitResult;
124333
124397
  }
124334
- function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
124398
+ function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
124335
124399
  var _a;
124336
124400
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
124337
124401
  if (emitDiagnostics.length) {
@@ -124342,11 +124406,13 @@ var ts;
124342
124406
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
124343
124407
  }
124344
124408
  // Update time stamps for rest of the outputs
124345
- updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124409
+ var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124346
124410
  state.diagnostics.delete(projectPath);
124347
124411
  state.projectStatus.set(projectPath, {
124348
124412
  type: ts.UpToDateStatusType.UpToDate,
124349
- newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
124413
+ newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
124414
+ maximumDate :
124415
+ newestDeclarationFileContentChangedTime,
124350
124416
  oldestOutputFileName: oldestOutputFileName
124351
124417
  });
124352
124418
  afterProgramDone(state, program, config);
@@ -124381,21 +124447,13 @@ var ts;
124381
124447
  ts.Debug.assert(!!outputFiles.length);
124382
124448
  var emitterDiagnostics = ts.createDiagnosticCollection();
124383
124449
  var emittedOutputs = new ts.Map();
124384
- var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124385
- var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
124386
124450
  outputFiles.forEach(function (_a) {
124387
- var _b, _c;
124388
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124451
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124389
124452
  emittedOutputs.set(toPath(state, name), name);
124390
- if (buildInfo) {
124391
- setBuildInfo(state, buildInfo, projectPath, config.options);
124392
- if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
124393
- resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124394
- }
124395
- }
124396
124453
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124397
124454
  });
124398
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
124455
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate,
124456
+ /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
124399
124457
  return { emitSkipped: false, diagnostics: emitDiagnostics };
124400
124458
  }
124401
124459
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -124557,7 +124615,7 @@ var ts;
124557
124615
  state.projectCompilerOptions = state.baseCompilerOptions;
124558
124616
  }
124559
124617
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
124560
- var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
124618
+ var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
124561
124619
  reportAndStoreErrors(state, resolvedPath, diagnostics);
124562
124620
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
124563
124621
  if (canEmitBuildInfo)
@@ -124565,95 +124623,9 @@ var ts;
124565
124623
  afterProgramDone(state, program, config);
124566
124624
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
124567
124625
  }
124568
- function isFileWatcherWithModifiedTime(value) {
124569
- return !!value.watcher;
124570
- }
124571
- function getModifiedTime(state, fileName) {
124572
- var path = toPath(state, fileName);
124573
- var existing = state.filesWatched.get(path);
124574
- if (state.watch && !!existing) {
124575
- if (!isFileWatcherWithModifiedTime(existing))
124576
- return existing;
124577
- if (existing.modifiedTime)
124578
- return existing.modifiedTime;
124579
- }
124580
- var result = ts.getModifiedTime(state.host, fileName);
124581
- if (state.watch) {
124582
- if (existing)
124583
- existing.modifiedTime = result;
124584
- else
124585
- state.filesWatched.set(path, result);
124586
- }
124587
- return result;
124588
- }
124589
- function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
124590
- var path = toPath(state, file);
124591
- var existing = state.filesWatched.get(path);
124592
- if (existing && isFileWatcherWithModifiedTime(existing)) {
124593
- existing.callbacks.push(callback);
124594
- }
124595
- else {
124596
- var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
124597
- var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
124598
- ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
124599
- existing.modifiedTime = modifiedTime;
124600
- existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
124601
- }, pollingInterval, options, watchType, project);
124602
- state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
124603
- }
124604
- return {
124605
- close: function () {
124606
- var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
124607
- ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
124608
- if (existing.callbacks.length === 1) {
124609
- state.filesWatched.delete(path);
124610
- ts.closeFileWatcherOf(existing);
124611
- }
124612
- else {
124613
- ts.unorderedRemoveItem(existing.callbacks, callback);
124614
- }
124615
- }
124616
- };
124617
- }
124618
- function getOutputTimeStampMap(state, resolvedConfigFilePath) {
124619
- if (!state.watch)
124620
- return undefined;
124621
- var result = state.outputTimeStamps.get(resolvedConfigFilePath);
124622
- if (!result)
124623
- state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
124624
- return result;
124625
- }
124626
- function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
124627
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
124628
- var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
124629
- if (existing) {
124630
- existing.buildInfo = buildInfo;
124631
- existing.modifiedTime = getCurrentTime(state.host);
124632
- }
124633
- else {
124634
- state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
124635
- }
124636
- }
124637
- function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
124638
- var path = toPath(state, buildInfoPath);
124639
- var existing = state.buildInfoCache.get(resolvedConfigPath);
124640
- return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
124641
- }
124642
- function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
124643
- var path = toPath(state, buildInfoPath);
124644
- var existing = state.buildInfoCache.get(resolvedConfigPath);
124645
- if (existing !== undefined && existing.path === path) {
124646
- return existing.buildInfo || undefined;
124647
- }
124648
- var value = state.readFileWithCache(buildInfoPath);
124649
- var buildInfo = value ? ts.getBuildInfo(value) : undefined;
124650
- ts.Debug.assert(modifiedTime || !buildInfo);
124651
- state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
124652
- return buildInfo;
124653
- }
124654
124626
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
124655
124627
  // Check tsconfig time
124656
- var tsconfigTime = getModifiedTime(state, configFile);
124628
+ var tsconfigTime = ts.getModifiedTime(state.host, configFile);
124657
124629
  if (oldestOutputFileTime < tsconfigTime) {
124658
124630
  return {
124659
124631
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -124663,24 +124635,88 @@ var ts;
124663
124635
  }
124664
124636
  }
124665
124637
  function getUpToDateStatusWorker(state, project, resolvedPath) {
124666
- var _a, _b, _c;
124638
+ var force = !!state.options.force;
124639
+ var newestInputFileName = undefined;
124640
+ var newestInputFileTime = minimumDate;
124641
+ var host = state.host;
124642
+ // Get timestamps of input files
124643
+ for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
124644
+ var inputFile = _a[_i];
124645
+ if (!host.fileExists(inputFile)) {
124646
+ return {
124647
+ type: ts.UpToDateStatusType.Unbuildable,
124648
+ reason: inputFile + " does not exist"
124649
+ };
124650
+ }
124651
+ if (!force) {
124652
+ var inputTime = ts.getModifiedTime(host, inputFile);
124653
+ if (inputTime > newestInputFileTime) {
124654
+ newestInputFileName = inputFile;
124655
+ newestInputFileTime = inputTime;
124656
+ }
124657
+ }
124658
+ }
124667
124659
  // Container if no files are specified in the project
124668
124660
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
124669
124661
  return {
124670
124662
  type: ts.UpToDateStatusType.ContainerOnly
124671
124663
  };
124672
124664
  }
124673
- // Fast check to see if reference projects are buildable
124674
- var referenceStatuses;
124675
- var force = !!state.options.force;
124665
+ // Collect the expected outputs of this project
124666
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
124667
+ // Now see if all outputs are newer than the newest input
124668
+ var oldestOutputFileName = "(none)";
124669
+ var oldestOutputFileTime = maximumDate;
124670
+ var newestOutputFileName = "(none)";
124671
+ var newestOutputFileTime = minimumDate;
124672
+ var missingOutputFileName;
124673
+ var newestDeclarationFileContentChangedTime = minimumDate;
124674
+ var isOutOfDateWithInputs = false;
124675
+ if (!force) {
124676
+ for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
124677
+ var output = outputs_1[_b];
124678
+ // Output is missing; can stop checking
124679
+ // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124680
+ if (!host.fileExists(output)) {
124681
+ missingOutputFileName = output;
124682
+ break;
124683
+ }
124684
+ var outputTime = ts.getModifiedTime(host, output);
124685
+ if (outputTime < oldestOutputFileTime) {
124686
+ oldestOutputFileTime = outputTime;
124687
+ oldestOutputFileName = output;
124688
+ }
124689
+ // If an output is older than the newest input, we can stop checking
124690
+ // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124691
+ if (outputTime < newestInputFileTime) {
124692
+ isOutOfDateWithInputs = true;
124693
+ break;
124694
+ }
124695
+ if (outputTime > newestOutputFileTime) {
124696
+ newestOutputFileTime = outputTime;
124697
+ newestOutputFileName = output;
124698
+ }
124699
+ // Keep track of when the most recent time a .d.ts file was changed.
124700
+ // In addition to file timestamps, we also keep track of when a .d.ts file
124701
+ // had its file touched but not had its contents changed - this allows us
124702
+ // to skip a downstream typecheck
124703
+ if (ts.isDeclarationFileName(output)) {
124704
+ var outputModifiedTime = ts.getModifiedTime(host, output);
124705
+ newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
124706
+ }
124707
+ }
124708
+ }
124709
+ var pseudoUpToDate = false;
124710
+ var usesPrepend = false;
124711
+ var upstreamChangedProject;
124676
124712
  if (project.projectReferences) {
124677
124713
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
124678
- for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
124679
- var ref = _d[_i];
124714
+ for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
124715
+ var ref = _d[_c];
124716
+ usesPrepend = usesPrepend || !!(ref.prepend);
124680
124717
  var resolvedRef = ts.resolveProjectReferencePath(ref);
124681
124718
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
124682
- var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
124683
- var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
124719
+ var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
124684
124720
  // Its a circular reference ignore the status of this project
124685
124721
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
124686
124722
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) { // Container only ignore this project
@@ -124702,170 +124738,75 @@ var ts;
124702
124738
  upstreamProjectName: ref.path
124703
124739
  };
124704
124740
  }
124705
- if (!force)
124706
- (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
124707
- }
124708
- }
124709
- if (force)
124710
- return { type: ts.UpToDateStatusType.ForceBuild };
124711
- // Check buildinfo first
124712
- var host = state.host;
124713
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
124714
- var oldestOutputFileName = "(none)";
124715
- var oldestOutputFileTime = maximumDate;
124716
- var buildInfoTime;
124717
- var newestDeclarationFileContentChangedTime;
124718
- if (buildInfoPath) {
124719
- var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
124720
- buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
124721
- if (buildInfoTime === ts.missingFileModifiedTime) {
124722
- if (!buildInfoCacheEntry_1) {
124723
- state.buildInfoCache.set(resolvedPath, {
124724
- path: toPath(state, buildInfoPath),
124725
- buildInfo: false,
124726
- modifiedTime: buildInfoTime
124727
- });
124728
- }
124729
- return {
124730
- type: ts.UpToDateStatusType.OutputMissing,
124731
- missingOutputFileName: buildInfoPath
124732
- };
124733
- }
124734
- var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
124735
- if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
124736
- return {
124737
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
124738
- version: buildInfo.version
124739
- };
124740
- }
124741
- if (buildInfo.program) {
124742
- if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
124743
- (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
124741
+ // Check oldest output file name only if there is no missing output file name
124742
+ // (a check we will have skipped if this is a forced build)
124743
+ if (!force && !missingOutputFileName) {
124744
+ // If the upstream project's newest file is older than our oldest output, we
124745
+ // can't be out of date because of it
124746
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
124747
+ continue;
124748
+ }
124749
+ // If the upstream project has only change .d.ts files, and we've built
124750
+ // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
124751
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
124752
+ pseudoUpToDate = true;
124753
+ upstreamChangedProject = ref.path;
124754
+ continue;
124755
+ }
124756
+ // We have an output older than an upstream output - we are out of date
124757
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
124744
124758
  return {
124745
- type: ts.UpToDateStatusType.OutOfDateBuildInfo,
124746
- buildInfoFile: buildInfoPath
124759
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124760
+ outOfDateOutputFileName: oldestOutputFileName,
124761
+ newerProjectName: ref.path
124747
124762
  };
124748
124763
  }
124749
124764
  }
124750
- oldestOutputFileTime = buildInfoTime;
124751
- oldestOutputFileName = buildInfoPath;
124752
- newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
124753
124765
  }
124754
- // Check input files
124755
- var newestInputFileName = undefined;
124756
- var newestInputFileTime = minimumDate;
124757
- // Get timestamps of input files
124758
- for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
124759
- var inputFile = _f[_e];
124760
- var inputTime = getModifiedTime(state, inputFile);
124761
- if (inputTime === ts.missingFileModifiedTime) {
124762
- return {
124763
- type: ts.UpToDateStatusType.Unbuildable,
124764
- reason: inputFile + " does not exist"
124765
- };
124766
- }
124767
- // If an buildInfo is older than the newest input, we can stop checking
124768
- if (buildInfoTime && buildInfoTime < inputTime) {
124769
- return {
124770
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
124771
- outOfDateOutputFileName: buildInfoPath,
124772
- newerInputFileName: inputFile
124773
- };
124774
- }
124775
- if (inputTime > newestInputFileTime) {
124776
- newestInputFileName = inputFile;
124777
- newestInputFileTime = inputTime;
124778
- }
124766
+ if (missingOutputFileName !== undefined) {
124767
+ return {
124768
+ type: ts.UpToDateStatusType.OutputMissing,
124769
+ missingOutputFileName: missingOutputFileName
124770
+ };
124779
124771
  }
124780
- // Now see if all outputs are newer than the newest input
124781
- // Dont check output timestamps if we have buildinfo telling us output is uptodate
124782
- if (!buildInfoPath) {
124783
- // Collect the expected outputs of this project
124784
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
124785
- var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
124786
- for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
124787
- var output = outputs_1[_g];
124788
- var path = toPath(state, output);
124789
- // Output is missing; can stop checking
124790
- var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
124791
- if (!outputTime) {
124792
- outputTime = ts.getModifiedTime(state.host, output);
124793
- outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
124794
- }
124795
- if (outputTime === ts.missingFileModifiedTime) {
124796
- return {
124797
- type: ts.UpToDateStatusType.OutputMissing,
124798
- missingOutputFileName: output
124799
- };
124800
- }
124801
- if (outputTime < oldestOutputFileTime) {
124802
- oldestOutputFileTime = outputTime;
124803
- oldestOutputFileName = output;
124804
- }
124805
- // If an output is older than the newest input, we can stop checking
124806
- if (outputTime < newestInputFileTime) {
124807
- return {
124808
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
124809
- outOfDateOutputFileName: oldestOutputFileName,
124810
- newerInputFileName: newestInputFileName
124811
- };
124812
- }
124813
- }
124772
+ if (isOutOfDateWithInputs) {
124773
+ return {
124774
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
124775
+ outOfDateOutputFileName: oldestOutputFileName,
124776
+ newerInputFileName: newestInputFileName
124777
+ };
124814
124778
  }
124815
- var seenRefs = buildInfoPath ? new ts.Set() : undefined;
124816
- var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
124817
- seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
124818
- var pseudoUpToDate = false;
124819
- var usesPrepend = false;
124820
- var upstreamChangedProject;
124821
- if (referenceStatuses) {
124822
- for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
124823
- var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
124824
- usesPrepend = usesPrepend || !!(ref.prepend);
124825
- // If the upstream project's newest file is older than our oldest output, we
124826
- // can't be out of date because of it
124827
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
124828
- continue;
124829
- }
124830
- // Check if tsbuildinfo path is shared, then we need to rebuild
124831
- if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
124779
+ else {
124780
+ // Check tsconfig time
124781
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
124782
+ if (configStatus)
124783
+ return configStatus;
124784
+ // Check extended config time
124785
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
124786
+ if (extendedConfigStatus)
124787
+ return extendedConfigStatus;
124788
+ // Check package file time
124789
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
124790
+ var path = _a[0];
124791
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
124792
+ });
124793
+ if (dependentPackageFileStatus)
124794
+ return dependentPackageFileStatus;
124795
+ }
124796
+ if (!force && !state.buildInfoChecked.has(resolvedPath)) {
124797
+ state.buildInfoChecked.set(resolvedPath, true);
124798
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
124799
+ if (buildInfoPath) {
124800
+ var value = state.readFileWithCache(buildInfoPath);
124801
+ var buildInfo = value && ts.getBuildInfo(value);
124802
+ if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
124832
124803
  return {
124833
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124834
- outOfDateOutputFileName: buildInfoPath,
124835
- newerProjectName: ref.path
124804
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
124805
+ version: buildInfo.version
124836
124806
  };
124837
124807
  }
124838
- // If the upstream project has only change .d.ts files, and we've built
124839
- // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
124840
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
124841
- pseudoUpToDate = true;
124842
- upstreamChangedProject = ref.path;
124843
- continue;
124844
- }
124845
- // We have an output older than an upstream output - we are out of date
124846
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
124847
- return {
124848
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124849
- outOfDateOutputFileName: oldestOutputFileName,
124850
- newerProjectName: ref.path
124851
- };
124852
124808
  }
124853
124809
  }
124854
- // Check tsconfig time
124855
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
124856
- if (configStatus)
124857
- return configStatus;
124858
- // Check extended config time
124859
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
124860
- if (extendedConfigStatus)
124861
- return extendedConfigStatus;
124862
- // Check package file time
124863
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
124864
- var path = _a[0];
124865
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
124866
- });
124867
- if (dependentPackageFileStatus)
124868
- return dependentPackageFileStatus;
124869
124810
  if (usesPrepend && pseudoUpToDate) {
124870
124811
  return {
124871
124812
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -124878,30 +124819,12 @@ var ts;
124878
124819
  type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
124879
124820
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
124880
124821
  newestInputFileTime: newestInputFileTime,
124822
+ newestOutputFileTime: newestOutputFileTime,
124881
124823
  newestInputFileName: newestInputFileName,
124824
+ newestOutputFileName: newestOutputFileName,
124882
124825
  oldestOutputFileName: oldestOutputFileName
124883
124826
  };
124884
124827
  }
124885
- function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
124886
- if (seenRefs.has(resolvedRefPath))
124887
- return false;
124888
- seenRefs.add(resolvedRefPath);
124889
- var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
124890
- if (refBuildInfo.path === buildInfoCacheEntry.path)
124891
- return true;
124892
- if (resolvedConfig.projectReferences) {
124893
- // Check references
124894
- for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
124895
- var ref = _a[_i];
124896
- var resolvedRef = ts.resolveProjectReferencePath(ref);
124897
- var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
124898
- var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
124899
- if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
124900
- return true;
124901
- }
124902
- }
124903
- return false;
124904
- }
124905
124828
  function getUpToDateStatus(state, project, resolvedPath) {
124906
124829
  if (project === undefined) {
124907
124830
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -124914,65 +124837,39 @@ var ts;
124914
124837
  state.projectStatus.set(resolvedPath, actual);
124915
124838
  return actual;
124916
124839
  }
124917
- function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
124840
+ function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
124918
124841
  if (proj.options.noEmit)
124919
- return;
124920
- var now;
124921
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
124922
- if (buildInfoPath) {
124923
- if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
124924
- if (!!state.options.verbose)
124925
- reportStatus(state, verboseMessage, proj.options.configFilePath);
124926
- state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
124927
- getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
124928
- }
124929
- state.outputTimeStamps.delete(projectPath);
124930
- return;
124931
- }
124842
+ return priorNewestUpdateTime;
124932
124843
  var host = state.host;
124933
124844
  var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
124934
- var outputTimeStampMap = getOutputTimeStampMap(state, projectPath);
124935
- var modifiedOutputs = outputTimeStampMap ? new ts.Set() : undefined;
124936
124845
  if (!skipOutputs || outputs.length !== skipOutputs.size) {
124937
124846
  var reportVerbose = !!state.options.verbose;
124847
+ var now = host.now ? host.now() : new Date();
124938
124848
  for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
124939
124849
  var file = outputs_2[_i];
124940
- var path = toPath(state, file);
124941
- if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
124850
+ if (skipOutputs && skipOutputs.has(toPath(state, file))) {
124942
124851
  continue;
124852
+ }
124943
124853
  if (reportVerbose) {
124944
124854
  reportVerbose = false;
124945
124855
  reportStatus(state, verboseMessage, proj.options.configFilePath);
124946
124856
  }
124947
- host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
124948
- if (outputTimeStampMap) {
124949
- outputTimeStampMap.set(path, now);
124950
- modifiedOutputs.add(path);
124857
+ if (ts.isDeclarationFileName(file)) {
124858
+ priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
124951
124859
  }
124860
+ host.setModifiedTime(file, now);
124952
124861
  }
124953
124862
  }
124954
- // Clear out timestamps not in output list any more
124955
- outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.forEach(function (_value, key) {
124956
- if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs.has(key))
124957
- outputTimeStampMap.delete(key);
124958
- });
124959
- }
124960
- function getDtsChangeTime(state, options, resolvedConfigPath) {
124961
- var _a;
124962
- if (!options.composite)
124963
- return undefined;
124964
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
124965
- var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, /*modifiedTime*/ undefined);
124966
- 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;
124863
+ return priorNewestUpdateTime;
124967
124864
  }
124968
124865
  function updateOutputTimestamps(state, proj, resolvedPath) {
124969
124866
  if (state.options.dry) {
124970
124867
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
124971
124868
  }
124972
- updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
124869
+ var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
124973
124870
  state.projectStatus.set(resolvedPath, {
124974
124871
  type: ts.UpToDateStatusType.UpToDate,
124975
- newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
124872
+ newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
124976
124873
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
124977
124874
  });
124978
124875
  }
@@ -125165,10 +125062,12 @@ var ts;
125165
125062
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
125166
125063
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
125167
125064
  return;
125168
- 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));
125065
+ state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
125066
+ invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
125067
+ }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
125169
125068
  }
125170
125069
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
125171
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
125070
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
125172
125071
  var _a;
125173
125072
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
125174
125073
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -125200,7 +125099,7 @@ var ts;
125200
125099
  if (!state.watch)
125201
125100
  return;
125202
125101
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
125203
- 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); },
125102
+ 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); },
125204
125103
  onDeleteValue: ts.closeFileWatcher,
125205
125104
  });
125206
125105
  }
@@ -125208,7 +125107,7 @@ var ts;
125208
125107
  if (!state.watch || !state.lastCachedPackageJsonLookups)
125209
125108
  return;
125210
125109
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
125211
- createNewValue: function (path, _input) { return watchFile(state, path, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full); }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.PackageJson, resolved); },
125110
+ 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); },
125212
125111
  onDeleteValue: ts.closeFileWatcher,
125213
125112
  });
125214
125113
  }
@@ -125340,18 +125239,19 @@ var ts;
125340
125239
  }
125341
125240
  }
125342
125241
  function reportUpToDateStatus(state, configFileName, status) {
125242
+ if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
125243
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125244
+ }
125343
125245
  switch (status.type) {
125344
125246
  case ts.UpToDateStatusType.OutOfDateWithSelf:
125345
- 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));
125247
+ 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));
125346
125248
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
125347
- 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));
125249
+ 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));
125348
125250
  case ts.UpToDateStatusType.OutputMissing:
125349
125251
  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));
125350
- case ts.UpToDateStatusType.OutOfDateBuildInfo:
125351
- 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));
125352
125252
  case ts.UpToDateStatusType.UpToDate:
125353
125253
  if (status.newestInputFileTime !== undefined) {
125354
- 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 || ""));
125254
+ 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 || ""));
125355
125255
  }
125356
125256
  // Don't report anything for "up to date because it was already built" -- too verbose
125357
125257
  break;
@@ -125369,8 +125269,6 @@ var ts;
125369
125269
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
125370
125270
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
125371
125271
  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);
125372
- case ts.UpToDateStatusType.ForceBuild:
125373
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125374
125272
  case ts.UpToDateStatusType.ContainerOnly:
125375
125273
  // Don't report status on "solution" projects
125376
125274
  // falls through