typescript 4.8.0-dev.20220608 → 4.8.0-dev.20220609

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.8";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20220608";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220609";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -3746,7 +3746,7 @@ var ts;
3746
3746
  };
3747
3747
  }
3748
3748
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
3749
- var watcher = fsWatch(dirName, 1, function (_eventName, relativeFileName) {
3749
+ var watcher = fsWatch(dirName, 1, function (_eventName, relativeFileName, modifiedTime) {
3750
3750
  if (!ts.isString(relativeFileName))
3751
3751
  return;
3752
3752
  var fileName = ts.getNormalizedAbsolutePath(relativeFileName, dirName);
@@ -3754,7 +3754,7 @@ var ts;
3754
3754
  if (callbacks) {
3755
3755
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
3756
3756
  var fileCallback = callbacks_1[_i];
3757
- fileCallback(fileName, FileWatcherEventKind.Changed);
3757
+ fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
3758
3758
  }
3759
3759
  }
3760
3760
  }, false, PollingInterval.Medium, fallbackOptions);
@@ -3806,7 +3806,7 @@ var ts;
3806
3806
  }
3807
3807
  else {
3808
3808
  cache.set(path, {
3809
- watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
3809
+ watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
3810
3810
  refCount: 1
3811
3811
  });
3812
3812
  }
@@ -3830,7 +3830,7 @@ var ts;
3830
3830
  var newTime = modifiedTime.getTime();
3831
3831
  if (oldTime !== newTime) {
3832
3832
  watchedFile.mtime = modifiedTime;
3833
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
3833
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
3834
3834
  return true;
3835
3835
  }
3836
3836
  return false;
@@ -3855,7 +3855,7 @@ var ts;
3855
3855
  }
3856
3856
  ts.setSysLog = setSysLog;
3857
3857
  function createDirectoryWatcherSupportingRecursive(_a) {
3858
- 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;
3858
+ 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;
3859
3859
  var cache = new ts.Map();
3860
3860
  var callbackCache = ts.createMultiMap();
3861
3861
  var cacheToUpdateChildWatches = new ts.Map();
@@ -3948,7 +3948,7 @@ var ts;
3948
3948
  }
3949
3949
  function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
3950
3950
  var parentWatcher = cache.get(dirPath);
3951
- if (parentWatcher && directoryExists(dirName)) {
3951
+ if (parentWatcher && fileSystemEntryExists(dirName, 1)) {
3952
3952
  scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
3953
3953
  return;
3954
3954
  }
@@ -4016,7 +4016,7 @@ var ts;
4016
4016
  if (!parentWatcher)
4017
4017
  return false;
4018
4018
  var newChildWatches;
4019
- var hasChanges = ts.enumerateInsertsAndDeletes(directoryExists(parentDir) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
4019
+ var hasChanges = ts.enumerateInsertsAndDeletes(fileSystemEntryExists(parentDir, 1) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
4020
4020
  var childFullName = ts.getNormalizedAbsolutePath(child, parentDir);
4021
4021
  return !isIgnoredPath(childFullName, options) && filePathComparer(childFullName, ts.normalizePath(realpath(childFullName))) === 0 ? childFullName : undefined;
4022
4022
  }) : ts.emptyArray, parentWatcher.childWatches, function (child, childWatcher) { return filePathComparer(child, childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher);
@@ -4044,16 +4044,17 @@ var ts;
4044
4044
  }
4045
4045
  ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive;
4046
4046
  function createFileWatcherCallback(callback) {
4047
- return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
4047
+ return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
4048
4048
  }
4049
4049
  ts.createFileWatcherCallback = createFileWatcherCallback;
4050
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists) {
4051
- return function (eventName) {
4050
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
4051
+ return function (eventName, _relativeFileName, modifiedTime) {
4052
4052
  if (eventName === "rename") {
4053
- callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
4053
+ modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
4054
+ callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
4054
4055
  }
4055
4056
  else {
4056
- callback(fileName, FileWatcherEventKind.Changed);
4057
+ callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
4057
4058
  }
4058
4059
  };
4059
4060
  }
@@ -4072,11 +4073,12 @@ var ts;
4072
4073
  };
4073
4074
  }
4074
4075
  function createSystemWatchFunctions(_a) {
4075
- var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatch = _a.fsWatch, fileExists = _a.fileExists, 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;
4076
+ 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;
4076
4077
  var dynamicPollingWatchFile;
4077
4078
  var fixedChunkSizePollingWatchFile;
4078
4079
  var nonPollingWatchFile;
4079
4080
  var hostRecursiveDirectoryWatcher;
4081
+ var hitSystemWatcherLimit = false;
4080
4082
  return {
4081
4083
  watchFile: watchFile,
4082
4084
  watchDirectory: watchDirectory
@@ -4094,7 +4096,7 @@ var ts;
4094
4096
  case ts.WatchFileKind.FixedChunkSizePolling:
4095
4097
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, undefined, undefined);
4096
4098
  case ts.WatchFileKind.UseFsEvents:
4097
- return fsWatch(fileName, 0, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists), false, pollingInterval, ts.getFallbackOptions(options));
4099
+ return fsWatch(fileName, 0, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime), false, pollingInterval, ts.getFallbackOptions(options));
4098
4100
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
4099
4101
  if (!nonPollingWatchFile) {
4100
4102
  nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames);
@@ -4147,7 +4149,7 @@ var ts;
4147
4149
  hostRecursiveDirectoryWatcher = createDirectoryWatcherSupportingRecursive({
4148
4150
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
4149
4151
  getCurrentDirectory: getCurrentDirectory,
4150
- directoryExists: directoryExists,
4152
+ fileSystemEntryExists: fileSystemEntryExists,
4151
4153
  getAccessibleSortedChildDirectories: getAccessibleSortedChildDirectories,
4152
4154
  watchDirectory: nonRecursiveWatchDirectory,
4153
4155
  realpath: realpath,
@@ -4192,6 +4194,92 @@ var ts;
4192
4194
  };
4193
4195
  }
4194
4196
  }
4197
+ function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
4198
+ var lastDirectoryPartWithDirectorySeparator;
4199
+ var lastDirectoryPart;
4200
+ if (inodeWatching) {
4201
+ lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substring(fileOrDirectory.lastIndexOf(ts.directorySeparator));
4202
+ lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
4203
+ }
4204
+ var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
4205
+ watchMissingFileSystemEntry() :
4206
+ watchPresentFileSystemEntry();
4207
+ return {
4208
+ close: function () {
4209
+ watcher.close();
4210
+ watcher = undefined;
4211
+ }
4212
+ };
4213
+ function updateWatcher(createWatcher) {
4214
+ if (watcher) {
4215
+ sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
4216
+ watcher.close();
4217
+ watcher = createWatcher();
4218
+ }
4219
+ }
4220
+ function watchPresentFileSystemEntry() {
4221
+ if (hitSystemWatcherLimit) {
4222
+ sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to watchFile");
4223
+ return watchPresentFileSystemEntryWithFsWatchFile();
4224
+ }
4225
+ try {
4226
+ var presentWatcher = fsWatchWorker(fileOrDirectory, recursive, inodeWatching ?
4227
+ callbackChangingToMissingFileSystemEntry :
4228
+ callback);
4229
+ presentWatcher.on("error", function () {
4230
+ callback("rename", "");
4231
+ updateWatcher(watchMissingFileSystemEntry);
4232
+ });
4233
+ return presentWatcher;
4234
+ }
4235
+ catch (e) {
4236
+ hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
4237
+ sysLog("sysLog:: " + fileOrDirectory + ":: Changing to watchFile");
4238
+ return watchPresentFileSystemEntryWithFsWatchFile();
4239
+ }
4240
+ }
4241
+ function callbackChangingToMissingFileSystemEntry(event, relativeName) {
4242
+ var originalRelativeName;
4243
+ if (relativeName && ts.endsWith(relativeName, "~")) {
4244
+ originalRelativeName = relativeName;
4245
+ relativeName = relativeName.slice(0, relativeName.length - 1);
4246
+ }
4247
+ if (event === "rename" &&
4248
+ (!relativeName ||
4249
+ relativeName === lastDirectoryPart ||
4250
+ ts.endsWith(relativeName, lastDirectoryPartWithDirectorySeparator))) {
4251
+ var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
4252
+ if (originalRelativeName)
4253
+ callback(event, originalRelativeName, modifiedTime);
4254
+ callback(event, relativeName, modifiedTime);
4255
+ if (inodeWatching) {
4256
+ updateWatcher(modifiedTime === ts.missingFileModifiedTime ? watchMissingFileSystemEntry : watchPresentFileSystemEntry);
4257
+ }
4258
+ else if (modifiedTime === ts.missingFileModifiedTime) {
4259
+ updateWatcher(watchMissingFileSystemEntry);
4260
+ }
4261
+ }
4262
+ else {
4263
+ if (originalRelativeName)
4264
+ callback(event, originalRelativeName);
4265
+ callback(event, relativeName);
4266
+ }
4267
+ }
4268
+ function watchPresentFileSystemEntryWithFsWatchFile() {
4269
+ return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions);
4270
+ }
4271
+ function watchMissingFileSystemEntry() {
4272
+ return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
4273
+ if (eventKind === FileWatcherEventKind.Created) {
4274
+ modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
4275
+ if (modifiedTime !== ts.missingFileModifiedTime) {
4276
+ callback("rename", "", modifiedTime);
4277
+ updateWatcher(watchPresentFileSystemEntry);
4278
+ }
4279
+ }
4280
+ }, fallbackPollingInterval, fallbackOptions);
4281
+ }
4282
+ }
4195
4283
  }
4196
4284
  ts.createSystemWatchFunctions = createSystemWatchFunctions;
4197
4285
  function patchWriteFileEnsuringDirectory(sys) {
@@ -4233,7 +4321,6 @@ var ts;
4233
4321
  }
4234
4322
  var activeSession;
4235
4323
  var profilePath = "./profile.cpuprofile";
4236
- var hitSystemWatcherLimit = false;
4237
4324
  var Buffer = require("buffer").Buffer;
4238
4325
  var nodeVersion = getNodeMajorVersion();
4239
4326
  var isNode4OrLater = nodeVersion >= 4;
@@ -4248,18 +4335,19 @@ var ts;
4248
4335
  getModifiedTime: getModifiedTime,
4249
4336
  setTimeout: setTimeout,
4250
4337
  clearTimeout: clearTimeout,
4251
- fsWatch: fsWatch,
4338
+ fsWatchWorker: fsWatchWorker,
4252
4339
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
4253
4340
  getCurrentDirectory: getCurrentDirectory,
4254
- fileExists: fileExists,
4341
+ fileSystemEntryExists: fileSystemEntryExists,
4255
4342
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
4256
- directoryExists: directoryExists,
4257
4343
  getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; },
4258
4344
  realpath: realpath,
4259
4345
  tscWatchFile: process.env.TSC_WATCHFILE,
4260
4346
  useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
4261
4347
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
4262
4348
  defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
4349
+ inodeWatching: isLinuxOrMacOs,
4350
+ sysLog: sysLog,
4263
4351
  }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
4264
4352
  var nodeSystem = {
4265
4353
  args: process.argv.slice(2),
@@ -4479,79 +4567,12 @@ var ts;
4479
4567
  else {
4480
4568
  eventKind = FileWatcherEventKind.Changed;
4481
4569
  }
4482
- callback(fileName, eventKind);
4570
+ callback(fileName, eventKind, curr.mtime);
4483
4571
  }
4484
4572
  }
4485
- function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
4486
- var options;
4487
- var lastDirectoryPartWithDirectorySeparator;
4488
- var lastDirectoryPart;
4489
- if (isLinuxOrMacOs) {
4490
- lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
4491
- lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
4492
- }
4493
- var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
4494
- watchMissingFileSystemEntry() :
4495
- watchPresentFileSystemEntry();
4496
- return {
4497
- close: function () {
4498
- watcher.close();
4499
- watcher = undefined;
4500
- }
4501
- };
4502
- function invokeCallbackAndUpdateWatcher(createWatcher) {
4503
- sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
4504
- callback("rename", "");
4505
- if (watcher) {
4506
- watcher.close();
4507
- watcher = createWatcher();
4508
- }
4509
- }
4510
- function watchPresentFileSystemEntry() {
4511
- if (options === undefined) {
4512
- if (fsSupportsRecursiveFsWatch) {
4513
- options = { persistent: true, recursive: !!recursive };
4514
- }
4515
- else {
4516
- options = { persistent: true };
4517
- }
4518
- }
4519
- if (hitSystemWatcherLimit) {
4520
- sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to fsWatchFile");
4521
- return watchPresentFileSystemEntryWithFsWatchFile();
4522
- }
4523
- try {
4524
- var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
4525
- callbackChangingToMissingFileSystemEntry :
4526
- callback);
4527
- presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
4528
- return presentWatcher;
4529
- }
4530
- catch (e) {
4531
- hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
4532
- sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
4533
- return watchPresentFileSystemEntryWithFsWatchFile();
4534
- }
4535
- }
4536
- function callbackChangingToMissingFileSystemEntry(event, relativeName) {
4537
- return event === "rename" &&
4538
- (!relativeName ||
4539
- relativeName === lastDirectoryPart ||
4540
- (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
4541
- !fileSystemEntryExists(fileOrDirectory, entryKind) ?
4542
- invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
4543
- callback(event, relativeName);
4544
- }
4545
- function watchPresentFileSystemEntryWithFsWatchFile() {
4546
- return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions);
4547
- }
4548
- function watchMissingFileSystemEntry() {
4549
- return watchFile(fileOrDirectory, function (_fileName, eventKind) {
4550
- if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
4551
- invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
4552
- }
4553
- }, fallbackPollingInterval, fallbackOptions);
4554
- }
4573
+ function fsWatchWorker(fileOrDirectory, recursive, callback) {
4574
+ return _fs.watch(fileOrDirectory, fsSupportsRecursiveFsWatch ?
4575
+ { persistent: true, recursive: !!recursive } : { persistent: true }, callback);
4555
4576
  }
4556
4577
  function readFileWorker(fileName, _encoding) {
4557
4578
  var buffer;
@@ -4687,12 +4708,17 @@ var ts;
4687
4708
  }
4688
4709
  function getModifiedTime(path) {
4689
4710
  var _a;
4711
+ var originalStackTraceLimit = Error.stackTraceLimit;
4712
+ Error.stackTraceLimit = 0;
4690
4713
  try {
4691
4714
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
4692
4715
  }
4693
4716
  catch (e) {
4694
4717
  return undefined;
4695
4718
  }
4719
+ finally {
4720
+ Error.stackTraceLimit = originalStackTraceLimit;
4721
+ }
4696
4722
  }
4697
4723
  function setModifiedTime(path, time) {
4698
4724
  try {
@@ -6497,8 +6523,8 @@ var ts;
6497
6523
  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"),
6498
6524
  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"),
6499
6525
  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."),
6500
- 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}'"),
6501
- 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}'"),
6526
+ 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}'"),
6527
+ 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}'"),
6502
6528
  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"),
6503
6529
  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"),
6504
6530
  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"),
@@ -6542,6 +6568,8 @@ var ts;
6542
6568
  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}'."),
6543
6569
  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}'."),
6544
6570
  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."),
6571
+ Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"),
6572
+ Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"),
6545
6573
  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}'"),
6546
6574
  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."),
6547
6575
  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."),
@@ -16016,6 +16044,10 @@ var ts;
16016
16044
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
16017
16045
  }
16018
16046
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
16047
+ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
16048
+ return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
16049
+ }
16050
+ ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
16019
16051
  function getCompilerOptionValue(options, option) {
16020
16052
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
16021
16053
  }
@@ -31742,6 +31774,7 @@ var ts;
31742
31774
  type: "boolean",
31743
31775
  affectsSemanticDiagnostics: true,
31744
31776
  affectsEmit: true,
31777
+ affectsMultiFileEmitBuildInfo: true,
31745
31778
  category: ts.Diagnostics.Watch_and_Build_Modes,
31746
31779
  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,
31747
31780
  defaultValueDescription: false,
@@ -31775,12 +31808,39 @@ var ts;
31775
31808
  affectsSourceFile: true,
31776
31809
  affectsModuleResolution: true,
31777
31810
  affectsEmit: true,
31811
+ affectsMultiFileEmitBuildInfo: true,
31778
31812
  paramType: ts.Diagnostics.VERSION,
31779
31813
  showInSimplifiedHelpView: true,
31780
31814
  category: ts.Diagnostics.Language_and_Environment,
31781
31815
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
31782
31816
  defaultValueDescription: 0,
31783
31817
  };
31818
+ ts.moduleOptionDeclaration = {
31819
+ name: "module",
31820
+ shortName: "m",
31821
+ type: new ts.Map(ts.getEntries({
31822
+ none: ts.ModuleKind.None,
31823
+ commonjs: ts.ModuleKind.CommonJS,
31824
+ amd: ts.ModuleKind.AMD,
31825
+ system: ts.ModuleKind.System,
31826
+ umd: ts.ModuleKind.UMD,
31827
+ es6: ts.ModuleKind.ES2015,
31828
+ es2015: ts.ModuleKind.ES2015,
31829
+ es2020: ts.ModuleKind.ES2020,
31830
+ es2022: ts.ModuleKind.ES2022,
31831
+ esnext: ts.ModuleKind.ESNext,
31832
+ node16: ts.ModuleKind.Node16,
31833
+ nodenext: ts.ModuleKind.NodeNext,
31834
+ })),
31835
+ affectsModuleResolution: true,
31836
+ affectsEmit: true,
31837
+ affectsMultiFileEmitBuildInfo: true,
31838
+ paramType: ts.Diagnostics.KIND,
31839
+ showInSimplifiedHelpView: true,
31840
+ category: ts.Diagnostics.Modules,
31841
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
31842
+ defaultValueDescription: undefined,
31843
+ };
31784
31844
  var commandOptionsWithoutBuild = [
31785
31845
  {
31786
31846
  name: "all",
@@ -31841,36 +31901,13 @@ var ts;
31841
31901
  category: ts.Diagnostics.Command_line_Options,
31842
31902
  affectsSemanticDiagnostics: true,
31843
31903
  affectsEmit: true,
31904
+ affectsMultiFileEmitBuildInfo: true,
31844
31905
  isCommandLineOnly: true,
31845
31906
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
31846
31907
  defaultValueDescription: false,
31847
31908
  },
31848
31909
  ts.targetOptionDeclaration,
31849
- {
31850
- name: "module",
31851
- shortName: "m",
31852
- type: new ts.Map(ts.getEntries({
31853
- none: ts.ModuleKind.None,
31854
- commonjs: ts.ModuleKind.CommonJS,
31855
- amd: ts.ModuleKind.AMD,
31856
- system: ts.ModuleKind.System,
31857
- umd: ts.ModuleKind.UMD,
31858
- es6: ts.ModuleKind.ES2015,
31859
- es2015: ts.ModuleKind.ES2015,
31860
- es2020: ts.ModuleKind.ES2020,
31861
- es2022: ts.ModuleKind.ES2022,
31862
- esnext: ts.ModuleKind.ESNext,
31863
- node16: ts.ModuleKind.Node16,
31864
- nodenext: ts.ModuleKind.NodeNext,
31865
- })),
31866
- affectsModuleResolution: true,
31867
- affectsEmit: true,
31868
- paramType: ts.Diagnostics.KIND,
31869
- showInSimplifiedHelpView: true,
31870
- category: ts.Diagnostics.Modules,
31871
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
31872
- defaultValueDescription: undefined,
31873
- },
31910
+ ts.moduleOptionDeclaration,
31874
31911
  {
31875
31912
  name: "lib",
31876
31913
  type: "list",
@@ -31907,6 +31944,7 @@ var ts;
31907
31944
  type: jsxOptionMap,
31908
31945
  affectsSourceFile: true,
31909
31946
  affectsEmit: true,
31947
+ affectsMultiFileEmitBuildInfo: true,
31910
31948
  affectsModuleResolution: true,
31911
31949
  paramType: ts.Diagnostics.KIND,
31912
31950
  showInSimplifiedHelpView: true,
@@ -31919,6 +31957,7 @@ var ts;
31919
31957
  shortName: "d",
31920
31958
  type: "boolean",
31921
31959
  affectsEmit: true,
31960
+ affectsMultiFileEmitBuildInfo: true,
31922
31961
  showInSimplifiedHelpView: true,
31923
31962
  category: ts.Diagnostics.Emit,
31924
31963
  transpileOptionValue: undefined,
@@ -31929,6 +31968,7 @@ var ts;
31929
31968
  name: "declarationMap",
31930
31969
  type: "boolean",
31931
31970
  affectsEmit: true,
31971
+ affectsMultiFileEmitBuildInfo: true,
31932
31972
  showInSimplifiedHelpView: true,
31933
31973
  category: ts.Diagnostics.Emit,
31934
31974
  transpileOptionValue: undefined,
@@ -31939,6 +31979,7 @@ var ts;
31939
31979
  name: "emitDeclarationOnly",
31940
31980
  type: "boolean",
31941
31981
  affectsEmit: true,
31982
+ affectsMultiFileEmitBuildInfo: true,
31942
31983
  showInSimplifiedHelpView: true,
31943
31984
  category: ts.Diagnostics.Emit,
31944
31985
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -31949,6 +31990,7 @@ var ts;
31949
31990
  name: "sourceMap",
31950
31991
  type: "boolean",
31951
31992
  affectsEmit: true,
31993
+ affectsMultiFileEmitBuildInfo: true,
31952
31994
  showInSimplifiedHelpView: true,
31953
31995
  category: ts.Diagnostics.Emit,
31954
31996
  defaultValueDescription: false,
@@ -31958,6 +32000,9 @@ var ts;
31958
32000
  name: "outFile",
31959
32001
  type: "string",
31960
32002
  affectsEmit: true,
32003
+ affectsMultiFileEmitBuildInfo: true,
32004
+ affectsDeclarationPath: true,
32005
+ affectsBundleEmitBuildInfo: true,
31961
32006
  isFilePath: true,
31962
32007
  paramType: ts.Diagnostics.FILE,
31963
32008
  showInSimplifiedHelpView: true,
@@ -31969,6 +32014,8 @@ var ts;
31969
32014
  name: "outDir",
31970
32015
  type: "string",
31971
32016
  affectsEmit: true,
32017
+ affectsMultiFileEmitBuildInfo: true,
32018
+ affectsDeclarationPath: true,
31972
32019
  isFilePath: true,
31973
32020
  paramType: ts.Diagnostics.DIRECTORY,
31974
32021
  showInSimplifiedHelpView: true,
@@ -31979,6 +32026,8 @@ var ts;
31979
32026
  name: "rootDir",
31980
32027
  type: "string",
31981
32028
  affectsEmit: true,
32029
+ affectsMultiFileEmitBuildInfo: true,
32030
+ affectsDeclarationPath: true,
31982
32031
  isFilePath: true,
31983
32032
  paramType: ts.Diagnostics.LOCATION,
31984
32033
  category: ts.Diagnostics.Modules,
@@ -31989,6 +32038,8 @@ var ts;
31989
32038
  name: "composite",
31990
32039
  type: "boolean",
31991
32040
  affectsEmit: true,
32041
+ affectsMultiFileEmitBuildInfo: true,
32042
+ affectsBundleEmitBuildInfo: true,
31992
32043
  isTSConfigOnly: true,
31993
32044
  category: ts.Diagnostics.Projects,
31994
32045
  transpileOptionValue: undefined,
@@ -31999,6 +32050,8 @@ var ts;
31999
32050
  name: "tsBuildInfoFile",
32000
32051
  type: "string",
32001
32052
  affectsEmit: true,
32053
+ affectsMultiFileEmitBuildInfo: true,
32054
+ affectsBundleEmitBuildInfo: true,
32002
32055
  isFilePath: true,
32003
32056
  paramType: ts.Diagnostics.FILE,
32004
32057
  category: ts.Diagnostics.Projects,
@@ -32010,6 +32063,7 @@ var ts;
32010
32063
  name: "removeComments",
32011
32064
  type: "boolean",
32012
32065
  affectsEmit: true,
32066
+ affectsMultiFileEmitBuildInfo: true,
32013
32067
  showInSimplifiedHelpView: true,
32014
32068
  category: ts.Diagnostics.Emit,
32015
32069
  defaultValueDescription: false,
@@ -32028,6 +32082,7 @@ var ts;
32028
32082
  name: "importHelpers",
32029
32083
  type: "boolean",
32030
32084
  affectsEmit: true,
32085
+ affectsMultiFileEmitBuildInfo: true,
32031
32086
  category: ts.Diagnostics.Emit,
32032
32087
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
32033
32088
  defaultValueDescription: false,
@@ -32041,6 +32096,7 @@ var ts;
32041
32096
  })),
32042
32097
  affectsEmit: true,
32043
32098
  affectsSemanticDiagnostics: true,
32099
+ affectsMultiFileEmitBuildInfo: true,
32044
32100
  category: ts.Diagnostics.Emit,
32045
32101
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
32046
32102
  defaultValueDescription: 0,
@@ -32049,6 +32105,7 @@ var ts;
32049
32105
  name: "downlevelIteration",
32050
32106
  type: "boolean",
32051
32107
  affectsEmit: true,
32108
+ affectsMultiFileEmitBuildInfo: true,
32052
32109
  category: ts.Diagnostics.Emit,
32053
32110
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
32054
32111
  defaultValueDescription: false,
@@ -32064,6 +32121,7 @@ var ts;
32064
32121
  {
32065
32122
  name: "strict",
32066
32123
  type: "boolean",
32124
+ affectsMultiFileEmitBuildInfo: true,
32067
32125
  showInSimplifiedHelpView: true,
32068
32126
  category: ts.Diagnostics.Type_Checking,
32069
32127
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -32073,6 +32131,7 @@ var ts;
32073
32131
  name: "noImplicitAny",
32074
32132
  type: "boolean",
32075
32133
  affectsSemanticDiagnostics: true,
32134
+ affectsMultiFileEmitBuildInfo: true,
32076
32135
  strictFlag: true,
32077
32136
  category: ts.Diagnostics.Type_Checking,
32078
32137
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -32082,6 +32141,7 @@ var ts;
32082
32141
  name: "strictNullChecks",
32083
32142
  type: "boolean",
32084
32143
  affectsSemanticDiagnostics: true,
32144
+ affectsMultiFileEmitBuildInfo: true,
32085
32145
  strictFlag: true,
32086
32146
  category: ts.Diagnostics.Type_Checking,
32087
32147
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -32090,6 +32150,8 @@ var ts;
32090
32150
  {
32091
32151
  name: "strictFunctionTypes",
32092
32152
  type: "boolean",
32153
+ affectsSemanticDiagnostics: true,
32154
+ affectsMultiFileEmitBuildInfo: true,
32093
32155
  strictFlag: true,
32094
32156
  category: ts.Diagnostics.Type_Checking,
32095
32157
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -32098,6 +32160,8 @@ var ts;
32098
32160
  {
32099
32161
  name: "strictBindCallApply",
32100
32162
  type: "boolean",
32163
+ affectsSemanticDiagnostics: true,
32164
+ affectsMultiFileEmitBuildInfo: true,
32101
32165
  strictFlag: true,
32102
32166
  category: ts.Diagnostics.Type_Checking,
32103
32167
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -32107,6 +32171,7 @@ var ts;
32107
32171
  name: "strictPropertyInitialization",
32108
32172
  type: "boolean",
32109
32173
  affectsSemanticDiagnostics: true,
32174
+ affectsMultiFileEmitBuildInfo: true,
32110
32175
  strictFlag: true,
32111
32176
  category: ts.Diagnostics.Type_Checking,
32112
32177
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -32116,6 +32181,7 @@ var ts;
32116
32181
  name: "noImplicitThis",
32117
32182
  type: "boolean",
32118
32183
  affectsSemanticDiagnostics: true,
32184
+ affectsMultiFileEmitBuildInfo: true,
32119
32185
  strictFlag: true,
32120
32186
  category: ts.Diagnostics.Type_Checking,
32121
32187
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -32125,6 +32191,7 @@ var ts;
32125
32191
  name: "useUnknownInCatchVariables",
32126
32192
  type: "boolean",
32127
32193
  affectsSemanticDiagnostics: true,
32194
+ affectsMultiFileEmitBuildInfo: true,
32128
32195
  strictFlag: true,
32129
32196
  category: ts.Diagnostics.Type_Checking,
32130
32197
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -32134,6 +32201,8 @@ var ts;
32134
32201
  name: "alwaysStrict",
32135
32202
  type: "boolean",
32136
32203
  affectsSourceFile: true,
32204
+ affectsEmit: true,
32205
+ affectsMultiFileEmitBuildInfo: true,
32137
32206
  strictFlag: true,
32138
32207
  category: ts.Diagnostics.Type_Checking,
32139
32208
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -32143,6 +32212,7 @@ var ts;
32143
32212
  name: "noUnusedLocals",
32144
32213
  type: "boolean",
32145
32214
  affectsSemanticDiagnostics: true,
32215
+ affectsMultiFileEmitBuildInfo: true,
32146
32216
  category: ts.Diagnostics.Type_Checking,
32147
32217
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
32148
32218
  defaultValueDescription: false,
@@ -32151,6 +32221,7 @@ var ts;
32151
32221
  name: "noUnusedParameters",
32152
32222
  type: "boolean",
32153
32223
  affectsSemanticDiagnostics: true,
32224
+ affectsMultiFileEmitBuildInfo: true,
32154
32225
  category: ts.Diagnostics.Type_Checking,
32155
32226
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
32156
32227
  defaultValueDescription: false,
@@ -32159,6 +32230,7 @@ var ts;
32159
32230
  name: "exactOptionalPropertyTypes",
32160
32231
  type: "boolean",
32161
32232
  affectsSemanticDiagnostics: true,
32233
+ affectsMultiFileEmitBuildInfo: true,
32162
32234
  category: ts.Diagnostics.Type_Checking,
32163
32235
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
32164
32236
  defaultValueDescription: false,
@@ -32167,6 +32239,7 @@ var ts;
32167
32239
  name: "noImplicitReturns",
32168
32240
  type: "boolean",
32169
32241
  affectsSemanticDiagnostics: true,
32242
+ affectsMultiFileEmitBuildInfo: true,
32170
32243
  category: ts.Diagnostics.Type_Checking,
32171
32244
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
32172
32245
  defaultValueDescription: false,
@@ -32176,6 +32249,7 @@ var ts;
32176
32249
  type: "boolean",
32177
32250
  affectsBindDiagnostics: true,
32178
32251
  affectsSemanticDiagnostics: true,
32252
+ affectsMultiFileEmitBuildInfo: true,
32179
32253
  category: ts.Diagnostics.Type_Checking,
32180
32254
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
32181
32255
  defaultValueDescription: false,
@@ -32184,6 +32258,7 @@ var ts;
32184
32258
  name: "noUncheckedIndexedAccess",
32185
32259
  type: "boolean",
32186
32260
  affectsSemanticDiagnostics: true,
32261
+ affectsMultiFileEmitBuildInfo: true,
32187
32262
  category: ts.Diagnostics.Type_Checking,
32188
32263
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
32189
32264
  defaultValueDescription: false,
@@ -32192,6 +32267,7 @@ var ts;
32192
32267
  name: "noImplicitOverride",
32193
32268
  type: "boolean",
32194
32269
  affectsSemanticDiagnostics: true,
32270
+ affectsMultiFileEmitBuildInfo: true,
32195
32271
  category: ts.Diagnostics.Type_Checking,
32196
32272
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
32197
32273
  defaultValueDescription: false,
@@ -32199,6 +32275,8 @@ var ts;
32199
32275
  {
32200
32276
  name: "noPropertyAccessFromIndexSignature",
32201
32277
  type: "boolean",
32278
+ affectsSemanticDiagnostics: true,
32279
+ affectsMultiFileEmitBuildInfo: true,
32202
32280
  showInSimplifiedHelpView: false,
32203
32281
  category: ts.Diagnostics.Type_Checking,
32204
32282
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -32279,6 +32357,7 @@ var ts;
32279
32357
  name: "allowSyntheticDefaultImports",
32280
32358
  type: "boolean",
32281
32359
  affectsSemanticDiagnostics: true,
32360
+ affectsMultiFileEmitBuildInfo: true,
32282
32361
  category: ts.Diagnostics.Interop_Constraints,
32283
32362
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
32284
32363
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -32288,6 +32367,7 @@ var ts;
32288
32367
  type: "boolean",
32289
32368
  affectsSemanticDiagnostics: true,
32290
32369
  affectsEmit: true,
32370
+ affectsMultiFileEmitBuildInfo: true,
32291
32371
  showInSimplifiedHelpView: true,
32292
32372
  category: ts.Diagnostics.Interop_Constraints,
32293
32373
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -32304,6 +32384,7 @@ var ts;
32304
32384
  name: "allowUmdGlobalAccess",
32305
32385
  type: "boolean",
32306
32386
  affectsSemanticDiagnostics: true,
32387
+ affectsMultiFileEmitBuildInfo: true,
32307
32388
  category: ts.Diagnostics.Modules,
32308
32389
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
32309
32390
  defaultValueDescription: false,
@@ -32324,6 +32405,7 @@ var ts;
32324
32405
  name: "sourceRoot",
32325
32406
  type: "string",
32326
32407
  affectsEmit: true,
32408
+ affectsMultiFileEmitBuildInfo: true,
32327
32409
  paramType: ts.Diagnostics.LOCATION,
32328
32410
  category: ts.Diagnostics.Emit,
32329
32411
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -32332,6 +32414,7 @@ var ts;
32332
32414
  name: "mapRoot",
32333
32415
  type: "string",
32334
32416
  affectsEmit: true,
32417
+ affectsMultiFileEmitBuildInfo: true,
32335
32418
  paramType: ts.Diagnostics.LOCATION,
32336
32419
  category: ts.Diagnostics.Emit,
32337
32420
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -32340,6 +32423,7 @@ var ts;
32340
32423
  name: "inlineSourceMap",
32341
32424
  type: "boolean",
32342
32425
  affectsEmit: true,
32426
+ affectsMultiFileEmitBuildInfo: true,
32343
32427
  category: ts.Diagnostics.Emit,
32344
32428
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
32345
32429
  defaultValueDescription: false,
@@ -32348,6 +32432,7 @@ var ts;
32348
32432
  name: "inlineSources",
32349
32433
  type: "boolean",
32350
32434
  affectsEmit: true,
32435
+ affectsMultiFileEmitBuildInfo: true,
32351
32436
  category: ts.Diagnostics.Emit,
32352
32437
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
32353
32438
  defaultValueDescription: false,
@@ -32356,6 +32441,7 @@ var ts;
32356
32441
  name: "experimentalDecorators",
32357
32442
  type: "boolean",
32358
32443
  affectsSemanticDiagnostics: true,
32444
+ affectsMultiFileEmitBuildInfo: true,
32359
32445
  category: ts.Diagnostics.Language_and_Environment,
32360
32446
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
32361
32447
  defaultValueDescription: false,
@@ -32365,6 +32451,7 @@ var ts;
32365
32451
  type: "boolean",
32366
32452
  affectsSemanticDiagnostics: true,
32367
32453
  affectsEmit: true,
32454
+ affectsMultiFileEmitBuildInfo: true,
32368
32455
  category: ts.Diagnostics.Language_and_Environment,
32369
32456
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
32370
32457
  defaultValueDescription: false,
@@ -32388,6 +32475,7 @@ var ts;
32388
32475
  type: "string",
32389
32476
  affectsSemanticDiagnostics: true,
32390
32477
  affectsEmit: true,
32478
+ affectsMultiFileEmitBuildInfo: true,
32391
32479
  affectsModuleResolution: true,
32392
32480
  category: ts.Diagnostics.Language_and_Environment,
32393
32481
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -32405,6 +32493,9 @@ var ts;
32405
32493
  name: "out",
32406
32494
  type: "string",
32407
32495
  affectsEmit: true,
32496
+ affectsMultiFileEmitBuildInfo: true,
32497
+ affectsDeclarationPath: true,
32498
+ affectsBundleEmitBuildInfo: true,
32408
32499
  isFilePath: false,
32409
32500
  category: ts.Diagnostics.Backwards_Compatibility,
32410
32501
  paramType: ts.Diagnostics.FILE,
@@ -32415,6 +32506,7 @@ var ts;
32415
32506
  name: "reactNamespace",
32416
32507
  type: "string",
32417
32508
  affectsEmit: true,
32509
+ affectsMultiFileEmitBuildInfo: true,
32418
32510
  category: ts.Diagnostics.Language_and_Environment,
32419
32511
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
32420
32512
  defaultValueDescription: "`React`",
@@ -32422,6 +32514,7 @@ var ts;
32422
32514
  {
32423
32515
  name: "skipDefaultLibCheck",
32424
32516
  type: "boolean",
32517
+ affectsMultiFileEmitBuildInfo: true,
32425
32518
  category: ts.Diagnostics.Completeness,
32426
32519
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
32427
32520
  defaultValueDescription: false,
@@ -32437,6 +32530,7 @@ var ts;
32437
32530
  name: "emitBOM",
32438
32531
  type: "boolean",
32439
32532
  affectsEmit: true,
32533
+ affectsMultiFileEmitBuildInfo: true,
32440
32534
  category: ts.Diagnostics.Emit,
32441
32535
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
32442
32536
  defaultValueDescription: false,
@@ -32448,6 +32542,7 @@ var ts;
32448
32542
  lf: 1
32449
32543
  })),
32450
32544
  affectsEmit: true,
32545
+ affectsMultiFileEmitBuildInfo: true,
32451
32546
  paramType: ts.Diagnostics.NEWLINE,
32452
32547
  category: ts.Diagnostics.Emit,
32453
32548
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -32457,6 +32552,7 @@ var ts;
32457
32552
  name: "noErrorTruncation",
32458
32553
  type: "boolean",
32459
32554
  affectsSemanticDiagnostics: true,
32555
+ affectsMultiFileEmitBuildInfo: true,
32460
32556
  category: ts.Diagnostics.Output_Formatting,
32461
32557
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
32462
32558
  defaultValueDescription: false,
@@ -32483,6 +32579,7 @@ var ts;
32483
32579
  name: "stripInternal",
32484
32580
  type: "boolean",
32485
32581
  affectsEmit: true,
32582
+ affectsMultiFileEmitBuildInfo: true,
32486
32583
  category: ts.Diagnostics.Emit,
32487
32584
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
32488
32585
  defaultValueDescription: false,
@@ -32523,6 +32620,7 @@ var ts;
32523
32620
  name: "noImplicitUseStrict",
32524
32621
  type: "boolean",
32525
32622
  affectsSemanticDiagnostics: true,
32623
+ affectsMultiFileEmitBuildInfo: true,
32526
32624
  category: ts.Diagnostics.Backwards_Compatibility,
32527
32625
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
32528
32626
  defaultValueDescription: false,
@@ -32531,6 +32629,7 @@ var ts;
32531
32629
  name: "noEmitHelpers",
32532
32630
  type: "boolean",
32533
32631
  affectsEmit: true,
32632
+ affectsMultiFileEmitBuildInfo: true,
32534
32633
  category: ts.Diagnostics.Emit,
32535
32634
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
32536
32635
  defaultValueDescription: false,
@@ -32539,6 +32638,7 @@ var ts;
32539
32638
  name: "noEmitOnError",
32540
32639
  type: "boolean",
32541
32640
  affectsEmit: true,
32641
+ affectsMultiFileEmitBuildInfo: true,
32542
32642
  category: ts.Diagnostics.Emit,
32543
32643
  transpileOptionValue: undefined,
32544
32644
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -32548,6 +32648,7 @@ var ts;
32548
32648
  name: "preserveConstEnums",
32549
32649
  type: "boolean",
32550
32650
  affectsEmit: true,
32651
+ affectsMultiFileEmitBuildInfo: true,
32551
32652
  category: ts.Diagnostics.Emit,
32552
32653
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
32553
32654
  defaultValueDescription: false,
@@ -32556,6 +32657,8 @@ var ts;
32556
32657
  name: "declarationDir",
32557
32658
  type: "string",
32558
32659
  affectsEmit: true,
32660
+ affectsMultiFileEmitBuildInfo: true,
32661
+ affectsDeclarationPath: true,
32559
32662
  isFilePath: true,
32560
32663
  paramType: ts.Diagnostics.DIRECTORY,
32561
32664
  category: ts.Diagnostics.Emit,
@@ -32565,6 +32668,7 @@ var ts;
32565
32668
  {
32566
32669
  name: "skipLibCheck",
32567
32670
  type: "boolean",
32671
+ affectsMultiFileEmitBuildInfo: true,
32568
32672
  category: ts.Diagnostics.Completeness,
32569
32673
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
32570
32674
  defaultValueDescription: false,
@@ -32574,6 +32678,7 @@ var ts;
32574
32678
  type: "boolean",
32575
32679
  affectsBindDiagnostics: true,
32576
32680
  affectsSemanticDiagnostics: true,
32681
+ affectsMultiFileEmitBuildInfo: true,
32577
32682
  category: ts.Diagnostics.Type_Checking,
32578
32683
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
32579
32684
  defaultValueDescription: undefined,
@@ -32583,6 +32688,7 @@ var ts;
32583
32688
  type: "boolean",
32584
32689
  affectsBindDiagnostics: true,
32585
32690
  affectsSemanticDiagnostics: true,
32691
+ affectsMultiFileEmitBuildInfo: true,
32586
32692
  category: ts.Diagnostics.Type_Checking,
32587
32693
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
32588
32694
  defaultValueDescription: undefined,
@@ -32591,6 +32697,7 @@ var ts;
32591
32697
  name: "suppressExcessPropertyErrors",
32592
32698
  type: "boolean",
32593
32699
  affectsSemanticDiagnostics: true,
32700
+ affectsMultiFileEmitBuildInfo: true,
32594
32701
  category: ts.Diagnostics.Backwards_Compatibility,
32595
32702
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
32596
32703
  defaultValueDescription: false,
@@ -32599,6 +32706,7 @@ var ts;
32599
32706
  name: "suppressImplicitAnyIndexErrors",
32600
32707
  type: "boolean",
32601
32708
  affectsSemanticDiagnostics: true,
32709
+ affectsMultiFileEmitBuildInfo: true,
32602
32710
  category: ts.Diagnostics.Backwards_Compatibility,
32603
32711
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
32604
32712
  defaultValueDescription: false,
@@ -32623,6 +32731,7 @@ var ts;
32623
32731
  name: "noStrictGenericChecks",
32624
32732
  type: "boolean",
32625
32733
  affectsSemanticDiagnostics: true,
32734
+ affectsMultiFileEmitBuildInfo: true,
32626
32735
  category: ts.Diagnostics.Backwards_Compatibility,
32627
32736
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
32628
32737
  defaultValueDescription: false,
@@ -32632,6 +32741,7 @@ var ts;
32632
32741
  type: "boolean",
32633
32742
  affectsSemanticDiagnostics: true,
32634
32743
  affectsEmit: true,
32744
+ affectsMultiFileEmitBuildInfo: true,
32635
32745
  category: ts.Diagnostics.Language_and_Environment,
32636
32746
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
32637
32747
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -32640,6 +32750,7 @@ var ts;
32640
32750
  name: "preserveValueImports",
32641
32751
  type: "boolean",
32642
32752
  affectsEmit: true,
32753
+ affectsMultiFileEmitBuildInfo: true,
32643
32754
  category: ts.Diagnostics.Emit,
32644
32755
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
32645
32756
  defaultValueDescription: false,
@@ -32678,6 +32789,7 @@ var ts;
32678
32789
  ts.optionDeclarations = __spreadArray(__spreadArray([], ts.commonOptionsWithBuild, true), commandOptionsWithoutBuild, true);
32679
32790
  ts.semanticDiagnosticsOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsSemanticDiagnostics; });
32680
32791
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
32792
+ ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
32681
32793
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
32682
32794
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
32683
32795
  return !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics;
@@ -33457,6 +33569,7 @@ var ts;
33457
33569
  }
33458
33570
  });
33459
33571
  }
33572
+ ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
33460
33573
  function serializeCompilerOptions(options, pathOptions) {
33461
33574
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
33462
33575
  }
@@ -34437,16 +34550,18 @@ var ts;
34437
34550
  ts.Debug.assert(ts.extensionIsTS(resolved.extension));
34438
34551
  return { fileName: resolved.path, packageId: resolved.packageId };
34439
34552
  }
34440
- function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, diagnostics, resultFromCache) {
34441
- var _a;
34553
+ function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
34554
+ var _a, _b;
34442
34555
  if (resultFromCache) {
34443
34556
  (_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
34557
+ (_b = resultFromCache.affectingLocations).push.apply(_b, affectingLocations);
34444
34558
  return resultFromCache;
34445
34559
  }
34446
34560
  return {
34447
34561
  resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
34448
34562
  failedLookupLocations: failedLookupLocations,
34449
- resolutionDiagnostics: diagnostics
34563
+ affectingLocations: affectingLocations,
34564
+ resolutionDiagnostics: diagnostics,
34450
34565
  };
34451
34566
  }
34452
34567
  function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
@@ -34622,6 +34737,7 @@ var ts;
34622
34737
  }
34623
34738
  }
34624
34739
  var failedLookupLocations = [];
34740
+ var affectingLocations = [];
34625
34741
  var features = getDefaultNodeResolutionFeatures(options);
34626
34742
  if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext)) {
34627
34743
  features |= NodeResolutionFeatures.EsmMode;
@@ -34633,6 +34749,7 @@ var ts;
34633
34749
  host: host,
34634
34750
  traceEnabled: traceEnabled,
34635
34751
  failedLookupLocations: failedLookupLocations,
34752
+ affectingLocations: affectingLocations,
34636
34753
  packageJsonInfoCache: cache,
34637
34754
  features: features,
34638
34755
  conditions: conditions,
@@ -34657,7 +34774,7 @@ var ts;
34657
34774
  isExternalLibraryImport: pathContainsNodeModules(fileName),
34658
34775
  };
34659
34776
  }
34660
- result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, resolutionDiagnostics: diagnostics };
34777
+ result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, affectingLocations: affectingLocations, resolutionDiagnostics: diagnostics };
34661
34778
  perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, resolutionMode, result);
34662
34779
  if (traceEnabled)
34663
34780
  traceResult(result);
@@ -34731,6 +34848,7 @@ var ts;
34731
34848
  host: host,
34732
34849
  traceEnabled: isTraceEnabled(options, host),
34733
34850
  failedLookupLocations: [],
34851
+ affectingLocations: [],
34734
34852
  packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
34735
34853
  conditions: ts.emptyArray,
34736
34854
  features: NodeResolutionFeatures.None,
@@ -35264,6 +35382,7 @@ var ts;
35264
35382
  var _a, _b;
35265
35383
  var traceEnabled = isTraceEnabled(compilerOptions, host);
35266
35384
  var failedLookupLocations = [];
35385
+ var affectingLocations = [];
35267
35386
  var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
35268
35387
  if (compilerOptions.noDtsResolution) {
35269
35388
  conditions.pop();
@@ -35274,6 +35393,7 @@ var ts;
35274
35393
  host: host,
35275
35394
  traceEnabled: traceEnabled,
35276
35395
  failedLookupLocations: failedLookupLocations,
35396
+ affectingLocations: affectingLocations,
35277
35397
  packageJsonInfoCache: cache,
35278
35398
  features: features,
35279
35399
  conditions: conditions,
@@ -35281,7 +35401,7 @@ var ts;
35281
35401
  reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
35282
35402
  };
35283
35403
  var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
35284
- 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);
35404
+ 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, affectingLocations, diagnostics, state.resultFromCache);
35285
35405
  function tryResolve(extensions) {
35286
35406
  var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, true); };
35287
35407
  var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
@@ -35539,6 +35659,7 @@ var ts;
35539
35659
  host: host,
35540
35660
  traceEnabled: isTraceEnabled(options, host),
35541
35661
  failedLookupLocations: [],
35662
+ affectingLocations: [],
35542
35663
  packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
35543
35664
  conditions: ["node", "require", "types"],
35544
35665
  features: features,
@@ -35620,6 +35741,7 @@ var ts;
35620
35741
  compilerOptions: options,
35621
35742
  traceEnabled: isTraceEnabled(options, host),
35622
35743
  failedLookupLocations: [],
35744
+ affectingLocations: [],
35623
35745
  packageJsonInfoCache: packageJsonInfoCache,
35624
35746
  features: 0,
35625
35747
  conditions: [],
@@ -35651,6 +35773,7 @@ var ts;
35651
35773
  if (typeof existing !== "boolean") {
35652
35774
  if (traceEnabled)
35653
35775
  trace(host, ts.Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath);
35776
+ state.affectingLocations.push(packageJsonPath);
35654
35777
  return existing;
35655
35778
  }
35656
35779
  else {
@@ -35669,6 +35792,7 @@ var ts;
35669
35792
  var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
35670
35793
  var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined };
35671
35794
  (_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
35795
+ state.affectingLocations.push(packageJsonPath);
35672
35796
  return result;
35673
35797
  }
35674
35798
  else {
@@ -36259,11 +36383,23 @@ var ts;
36259
36383
  function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
36260
36384
  var traceEnabled = isTraceEnabled(compilerOptions, host);
36261
36385
  var failedLookupLocations = [];
36386
+ var affectingLocations = [];
36262
36387
  var containingDirectory = ts.getDirectoryPath(containingFile);
36263
36388
  var diagnostics = [];
36264
- 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); } };
36389
+ var state = {
36390
+ compilerOptions: compilerOptions,
36391
+ host: host,
36392
+ traceEnabled: traceEnabled,
36393
+ failedLookupLocations: failedLookupLocations,
36394
+ affectingLocations: affectingLocations,
36395
+ packageJsonInfoCache: cache,
36396
+ features: NodeResolutionFeatures.None,
36397
+ conditions: [],
36398
+ requestContainingDirectory: containingDirectory,
36399
+ reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
36400
+ };
36265
36401
  var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
36266
- return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations, diagnostics, state.resultFromCache);
36402
+ return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
36267
36403
  function tryResolve(extensions) {
36268
36404
  var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
36269
36405
  if (resolvedUsingSettings) {
@@ -36299,10 +36435,22 @@ var ts;
36299
36435
  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);
36300
36436
  }
36301
36437
  var failedLookupLocations = [];
36438
+ var affectingLocations = [];
36302
36439
  var diagnostics = [];
36303
- 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); } };
36440
+ var state = {
36441
+ compilerOptions: compilerOptions,
36442
+ host: host,
36443
+ traceEnabled: traceEnabled,
36444
+ failedLookupLocations: failedLookupLocations,
36445
+ affectingLocations: affectingLocations,
36446
+ packageJsonInfoCache: packageJsonInfoCache,
36447
+ features: NodeResolutionFeatures.None,
36448
+ conditions: [],
36449
+ requestContainingDirectory: undefined,
36450
+ reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
36451
+ };
36304
36452
  var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, false, undefined, undefined);
36305
- return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations, diagnostics, state.resultFromCache);
36453
+ return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
36306
36454
  }
36307
36455
  ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
36308
36456
  function toSearchResult(value) {
@@ -39264,16 +39412,6 @@ var ts;
39264
39412
  var nextNodeId = 1;
39265
39413
  var nextMergeId = 1;
39266
39414
  var nextFlowId = 1;
39267
- var typeofEQFacts = new ts.Map(ts.getEntries({
39268
- string: 1,
39269
- number: 2,
39270
- bigint: 4,
39271
- boolean: 8,
39272
- symbol: 16,
39273
- undefined: 65536,
39274
- object: 32,
39275
- function: 64
39276
- }));
39277
39415
  var typeofNEFacts = new ts.Map(ts.getEntries({
39278
39416
  string: 256,
39279
39417
  number: 512,
@@ -39933,14 +40071,6 @@ var ts;
39933
40071
  var awaitedTypeStack = [];
39934
40072
  var diagnostics = ts.createDiagnosticCollection();
39935
40073
  var suggestionDiagnostics = ts.createDiagnosticCollection();
39936
- var typeofTypesByName = new ts.Map(ts.getEntries({
39937
- string: stringType,
39938
- number: numberType,
39939
- bigint: bigintType,
39940
- boolean: booleanType,
39941
- symbol: esSymbolType,
39942
- undefined: undefinedType
39943
- }));
39944
40074
  var typeofType = createTypeofType();
39945
40075
  var _jsxNamespace;
39946
40076
  var _jsxFactoryEntity;
@@ -42440,7 +42570,7 @@ var ts;
42440
42570
  return type;
42441
42571
  }
42442
42572
  function createTypeofType() {
42443
- return getUnionType(ts.arrayFrom(typeofEQFacts.keys(), getStringLiteralType));
42573
+ return getUnionType(ts.arrayFrom(typeofNEFacts.keys(), getStringLiteralType));
42444
42574
  }
42445
42575
  function createTypeParameter(symbol) {
42446
42576
  var type = createType(262144);
@@ -43137,6 +43267,9 @@ var ts;
43137
43267
  var typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
43138
43268
  if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32))
43139
43269
  return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""), typeArgumentNodes);
43270
+ if (ts.length(typeArgumentNodes) === 1 && type.aliasSymbol === globalArrayType.symbol) {
43271
+ return ts.factory.createArrayTypeNode(typeArgumentNodes[0]);
43272
+ }
43140
43273
  return symbolToTypeNode(type.aliasSymbol, context, 788968, typeArgumentNodes);
43141
43274
  }
43142
43275
  var objectFlags = ts.getObjectFlags(type);
@@ -43304,7 +43437,7 @@ var ts;
43304
43437
  }
43305
43438
  else if (symbol.flags & 32
43306
43439
  && !getBaseTypeVariableOfClass(symbol)
43307
- && !(symbol.valueDeclaration && symbol.valueDeclaration.kind === 226 && context.flags & 2048) ||
43440
+ && !(symbol.valueDeclaration && ts.isClassLike(symbol.valueDeclaration) && context.flags & 2048 && (!ts.isClassDeclaration(symbol.valueDeclaration) || isSymbolAccessible(symbol, context.enclosingDeclaration, isInstanceType, false).accessibility !== 0)) ||
43308
43441
  symbol.flags & (384 | 512) ||
43309
43442
  shouldWriteTypeOfFunctionSymbol()) {
43310
43443
  return symbolToTypeNode(symbol, context, isInstanceType);
@@ -46404,6 +46537,17 @@ var ts;
46404
46537
  }
46405
46538
  });
46406
46539
  var result = createAnonymousType(initialSize !== members_4.size ? undefined : exportedType.symbol, members_4, exportedType.callSignatures, exportedType.constructSignatures, exportedType.indexInfos);
46540
+ if (initialSize === members_4.size) {
46541
+ if (type.aliasSymbol) {
46542
+ result.aliasSymbol = type.aliasSymbol;
46543
+ result.aliasTypeArguments = type.aliasTypeArguments;
46544
+ }
46545
+ if (ts.getObjectFlags(type) & 4) {
46546
+ result.aliasSymbol = type.symbol;
46547
+ var args = getTypeArguments(type);
46548
+ result.aliasTypeArguments = ts.length(args) ? args : undefined;
46549
+ }
46550
+ }
46407
46551
  result.objectFlags |= (ts.getObjectFlags(type) & 4096);
46408
46552
  if (result.symbol && result.symbol.flags & 32 && type === getDeclaredTypeOfClassOrInterface(result.symbol)) {
46409
46553
  result.objectFlags |= 16777216;
@@ -58294,19 +58438,15 @@ var ts;
58294
58438
  }
58295
58439
  return links.switchTypes;
58296
58440
  }
58297
- function getSwitchClauseTypeOfWitnesses(switchStatement, retainDefault) {
58441
+ function getSwitchClauseTypeOfWitnesses(switchStatement) {
58442
+ if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 289 && !ts.isStringLiteralLike(clause.expression); })) {
58443
+ return undefined;
58444
+ }
58298
58445
  var witnesses = [];
58299
58446
  for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) {
58300
58447
  var clause = _a[_i];
58301
- if (clause.kind === 289) {
58302
- if (ts.isStringLiteralLike(clause.expression)) {
58303
- witnesses.push(clause.expression.text);
58304
- continue;
58305
- }
58306
- return ts.emptyArray;
58307
- }
58308
- if (retainDefault)
58309
- witnesses.push(undefined);
58448
+ var text = clause.kind === 289 ? clause.expression.text : undefined;
58449
+ witnesses.push(text && !ts.contains(witnesses, text) ? text : undefined);
58310
58450
  }
58311
58451
  return witnesses;
58312
58452
  }
@@ -59362,14 +59502,9 @@ var ts;
59362
59502
  }
59363
59503
  return type;
59364
59504
  }
59365
- if (type.flags & 1 && literal.text === "function") {
59366
- return type;
59367
- }
59368
- var facts = assumeTrue ?
59369
- typeofEQFacts.get(literal.text) || 128 :
59370
- typeofNEFacts.get(literal.text) || 32768;
59371
- var impliedType = getImpliedTypeFromTypeofGuard(type, literal.text);
59372
- return getTypeWithFacts(assumeTrue && impliedType ? narrowTypeByImpliedType(type, impliedType) : type, facts);
59505
+ return assumeTrue ?
59506
+ narrowTypeByTypeName(type, literal.text) :
59507
+ getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768);
59373
59508
  }
59374
59509
  function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) {
59375
59510
  var everyClauseChecks = clauseStart !== clauseEnd && ts.every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck);
@@ -59412,63 +59547,40 @@ var ts;
59412
59547
  var defaultType = filterType(type, function (t) { return !(isUnitLikeType(t) && ts.contains(switchTypes, getRegularTypeOfLiteralType(extractUnitType(t)))); });
59413
59548
  return caseType.flags & 131072 ? defaultType : getUnionType([caseType, defaultType]);
59414
59549
  }
59415
- function getImpliedTypeFromTypeofGuard(type, text) {
59416
- switch (text) {
59417
- case "object":
59418
- return type.flags & 1 ? type : getUnionType([nullType, nonPrimitiveType]);
59419
- case "function":
59420
- return type.flags & 1 ? type : globalFunctionType;
59421
- default:
59422
- return typeofTypesByName.get(text);
59550
+ function narrowTypeByTypeName(type, typeName) {
59551
+ switch (typeName) {
59552
+ case "string": return narrowTypeByTypeFacts(type, stringType, 1);
59553
+ case "number": return narrowTypeByTypeFacts(type, numberType, 2);
59554
+ case "bigint": return narrowTypeByTypeFacts(type, bigintType, 4);
59555
+ case "boolean": return narrowTypeByTypeFacts(type, booleanType, 8);
59556
+ case "symbol": return narrowTypeByTypeFacts(type, esSymbolType, 16);
59557
+ case "object": return type.flags & 1 ? type : getUnionType([narrowTypeByTypeFacts(type, nonPrimitiveType, 32), narrowTypeByTypeFacts(type, nullType, 131072)]);
59558
+ case "function": return type.flags & 1 ? type : narrowTypeByTypeFacts(type, globalFunctionType, 64);
59559
+ case "undefined": return narrowTypeByTypeFacts(type, undefinedType, 65536);
59423
59560
  }
59561
+ return narrowTypeByTypeFacts(type, nonPrimitiveType, 128);
59424
59562
  }
59425
- function narrowTypeByImpliedType(type, candidate) {
59426
- if (type.flags & 3) {
59427
- return candidate;
59428
- }
59563
+ function narrowTypeByTypeFacts(type, impliedType, facts) {
59429
59564
  return mapType(type, function (t) {
59430
- if (isTypeRelatedTo(t, candidate, strictSubtypeRelation)) {
59431
- return t;
59432
- }
59433
- return mapType(candidate, function (c) {
59434
- if (!areTypesComparable(t, c)) {
59435
- return neverType;
59436
- }
59437
- if (c.flags & 131068 && t.flags & 524288 && !isEmptyAnonymousObjectType(t)) {
59438
- return isTypeSubtypeOf(c, t) ? c : neverType;
59439
- }
59440
- if (c === globalFunctionType && isTypeSubtypeOf(c, t)) {
59441
- return c;
59442
- }
59443
- return getIntersectionType([t, c]);
59444
- });
59565
+ return isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? getTypeFacts(t) & facts ? t : neverType :
59566
+ isTypeSubtypeOf(impliedType, t) ? impliedType :
59567
+ getTypeFacts(t) & facts ? getIntersectionType([t, impliedType]) :
59568
+ neverType;
59445
59569
  });
59446
59570
  }
59447
59571
  function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
59448
- var switchWitnesses = getSwitchClauseTypeOfWitnesses(switchStatement, true);
59449
- if (!switchWitnesses.length) {
59572
+ var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement);
59573
+ if (!witnesses) {
59450
59574
  return type;
59451
59575
  }
59452
- var defaultCaseLocation = ts.findIndex(switchWitnesses, function (elem) { return elem === undefined; });
59453
- var hasDefaultClause = clauseStart === clauseEnd || (defaultCaseLocation >= clauseStart && defaultCaseLocation < clauseEnd);
59454
- var clauseWitnesses;
59455
- var switchFacts;
59456
- if (defaultCaseLocation > -1) {
59457
- var witnesses = switchWitnesses.filter(function (witness) { return witness !== undefined; });
59458
- var fixedClauseStart = defaultCaseLocation < clauseStart ? clauseStart - 1 : clauseStart;
59459
- var fixedClauseEnd = defaultCaseLocation < clauseEnd ? clauseEnd - 1 : clauseEnd;
59460
- clauseWitnesses = witnesses.slice(fixedClauseStart, fixedClauseEnd);
59461
- switchFacts = getFactsFromTypeofSwitch(fixedClauseStart, fixedClauseEnd, witnesses, hasDefaultClause);
59462
- }
59463
- else {
59464
- clauseWitnesses = switchWitnesses.slice(clauseStart, clauseEnd);
59465
- switchFacts = getFactsFromTypeofSwitch(clauseStart, clauseEnd, switchWitnesses, hasDefaultClause);
59466
- }
59576
+ var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 290; });
59577
+ var hasDefaultClause = clauseStart === clauseEnd || (defaultIndex >= clauseStart && defaultIndex < clauseEnd);
59467
59578
  if (hasDefaultClause) {
59468
- return filterType(type, function (t) { return (getTypeFacts(t) & switchFacts) === switchFacts; });
59579
+ var notEqualFacts_1 = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses);
59580
+ return filterType(type, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; });
59469
59581
  }
59470
- var impliedType = getTypeWithFacts(getUnionType(clauseWitnesses.map(function (text) { return getImpliedTypeFromTypeofGuard(type, text) || type; })), switchFacts);
59471
- return getTypeWithFacts(narrowTypeByImpliedType(type, impliedType), switchFacts);
59582
+ var clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
59583
+ return getUnionType(ts.map(clauseWitnesses, function (text) { return text ? narrowTypeByTypeName(type, text) : neverType; }));
59472
59584
  }
59473
59585
  function isMatchingConstructorReference(expr) {
59474
59586
  return (ts.isPropertyAccessExpression(expr) && ts.idText(expr.name) === "constructor" ||
@@ -65256,26 +65368,11 @@ var ts;
65256
65368
  ? ts.Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
65257
65369
  : ts.Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
65258
65370
  }
65259
- function getFactsFromTypeofSwitch(start, end, witnesses, hasDefault) {
65371
+ function getNotEqualFactsFromTypeofSwitch(start, end, witnesses) {
65260
65372
  var facts = 0;
65261
- if (hasDefault) {
65262
- for (var i = end; i < witnesses.length; i++) {
65263
- facts |= typeofNEFacts.get(witnesses[i]) || 32768;
65264
- }
65265
- for (var i = start; i < end; i++) {
65266
- facts &= ~(typeofNEFacts.get(witnesses[i]) || 0);
65267
- }
65268
- for (var i = 0; i < start; i++) {
65269
- facts |= typeofNEFacts.get(witnesses[i]) || 32768;
65270
- }
65271
- }
65272
- else {
65273
- for (var i = start; i < end; i++) {
65274
- facts |= typeofEQFacts.get(witnesses[i]) || 128;
65275
- }
65276
- for (var i = 0; i < start; i++) {
65277
- facts &= ~(typeofEQFacts.get(witnesses[i]) || 0);
65278
- }
65373
+ for (var i = 0; i < witnesses.length; i++) {
65374
+ var witness = i < start || i >= end ? witnesses[i] : undefined;
65375
+ facts |= witness !== undefined ? typeofNEFacts.get(witness) || 32768 : 0;
65279
65376
  }
65280
65377
  return facts;
65281
65378
  }
@@ -65285,14 +65382,16 @@ var ts;
65285
65382
  }
65286
65383
  function computeExhaustiveSwitchStatement(node) {
65287
65384
  if (node.expression.kind === 216) {
65288
- var operandType = getTypeOfExpression(node.expression.expression);
65289
- var witnesses = getSwitchClauseTypeOfWitnesses(node, false);
65290
- var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, true);
65291
- var type_6 = getBaseConstraintOfType(operandType) || operandType;
65292
- if (type_6.flags & 3) {
65293
- return (556800 & notEqualFacts_1) === 556800;
65385
+ var witnesses = getSwitchClauseTypeOfWitnesses(node);
65386
+ if (!witnesses) {
65387
+ return false;
65294
65388
  }
65295
- return !!(filterType(type_6, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072);
65389
+ var operandConstraint = getBaseConstraintOrType(getTypeOfExpression(node.expression.expression));
65390
+ var notEqualFacts_2 = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses);
65391
+ if (operandConstraint.flags & 3) {
65392
+ return (556800 & notEqualFacts_2) === 556800;
65393
+ }
65394
+ return !someType(operandConstraint, function (t) { return (getTypeFacts(t) & notEqualFacts_2) === notEqualFacts_2; });
65296
65395
  }
65297
65396
  var type = getTypeOfExpression(node.expression);
65298
65397
  if (!isLiteralType(type)) {
@@ -90940,7 +91039,8 @@ var ts;
90940
91039
  return;
90941
91040
  }
90942
91041
  var version = ts.version;
90943
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), false);
91042
+ var buildInfo = { bundle: bundle, program: program, version: version };
91043
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), false, undefined, { buildInfo: buildInfo });
90944
91044
  }
90945
91045
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
90946
91046
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -91081,12 +91181,17 @@ var ts;
91081
91181
  if (sourceMapFilePath) {
91082
91182
  var sourceMap = sourceMapGenerator.toString();
91083
91183
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, false, sourceFiles);
91184
+ if (printer.bundleFileInfo)
91185
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
91084
91186
  }
91085
91187
  }
91086
91188
  else {
91087
91189
  writer.writeLine();
91088
91190
  }
91089
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
91191
+ var text = writer.getText();
91192
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
91193
+ if (printer.bundleFileInfo)
91194
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
91090
91195
  writer.clear();
91091
91196
  }
91092
91197
  function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
@@ -91211,30 +91316,50 @@ var ts;
91211
91316
  });
91212
91317
  }
91213
91318
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
91319
+ var createHash = ts.maybeBind(host, host.createHash);
91214
91320
  var _a = getOutputPathsForBundle(config.options, false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
91215
- var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
91216
- if (!buildInfoText)
91321
+ var buildInfo;
91322
+ if (host.getBuildInfo) {
91323
+ var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
91324
+ if (!hostBuildInfo)
91325
+ return buildInfoPath;
91326
+ buildInfo = hostBuildInfo;
91327
+ }
91328
+ else {
91329
+ var buildInfoText = host.readFile(buildInfoPath);
91330
+ if (!buildInfoText)
91331
+ return buildInfoPath;
91332
+ buildInfo = getBuildInfo(buildInfoText);
91333
+ }
91334
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
91217
91335
  return buildInfoPath;
91218
91336
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
91219
91337
  if (!jsFileText)
91220
91338
  return jsFilePath;
91339
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
91340
+ return jsFilePath;
91221
91341
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
91222
91342
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
91223
91343
  return sourceMapFilePath || "inline sourcemap decoding";
91344
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
91345
+ return sourceMapFilePath;
91224
91346
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
91225
91347
  if (declarationFilePath && !declarationText)
91226
91348
  return declarationFilePath;
91349
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
91350
+ return declarationFilePath;
91227
91351
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
91228
91352
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
91229
91353
  return declarationMapPath || "inline sourcemap decoding";
91230
- var buildInfo = getBuildInfo(buildInfoText);
91231
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
91232
- return buildInfoPath;
91354
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
91355
+ return declarationMapPath;
91233
91356
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
91234
91357
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo, true);
91235
91358
  var outputFiles = [];
91236
91359
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
91237
91360
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
91361
+ var changedDtsText;
91362
+ var changedDtsData;
91238
91363
  var emitHost = {
91239
91364
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
91240
91365
  getCanonicalFileName: host.getCanonicalFileName,
@@ -91250,7 +91375,7 @@ var ts;
91250
91375
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
91251
91376
  getProjectReferenceRedirect: ts.returnUndefined,
91252
91377
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
91253
- writeFile: function (name, text, writeByteOrderMark) {
91378
+ writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
91254
91379
  switch (name) {
91255
91380
  case jsFilePath:
91256
91381
  if (jsFileText === text)
@@ -91261,19 +91386,25 @@ var ts;
91261
91386
  return;
91262
91387
  break;
91263
91388
  case buildInfoPath:
91264
- var newBuildInfo = getBuildInfo(text);
91389
+ var newBuildInfo = data.buildInfo;
91265
91390
  newBuildInfo.program = buildInfo.program;
91391
+ if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
91392
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
91393
+ newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
91394
+ }
91266
91395
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
91267
91396
  newBuildInfo.bundle.js.sources = js.sources;
91268
91397
  if (dts) {
91269
91398
  newBuildInfo.bundle.dts.sources = dts.sources;
91270
91399
  }
91271
91400
  newBuildInfo.bundle.sourceFiles = sourceFiles;
91272
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
91401
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
91273
91402
  return;
91274
91403
  case declarationFilePath:
91275
91404
  if (declarationText === text)
91276
91405
  return;
91406
+ changedDtsText = text;
91407
+ changedDtsData = data;
91277
91408
  break;
91278
91409
  case declarationMapPath:
91279
91410
  if (declarationMapText === text)
@@ -91292,6 +91423,7 @@ var ts;
91292
91423
  getSourceFileFromReference: ts.returnUndefined,
91293
91424
  redirectTargetsMap: ts.createMultiMap(),
91294
91425
  getFileIncludeReasons: ts.notImplemented,
91426
+ createHash: createHash,
91295
91427
  };
91296
91428
  emitFiles(ts.notImplementedResolver, emitHost, undefined, ts.getTransformers(config.options, customTransformers));
91297
91429
  return outputFiles;
@@ -95916,7 +96048,6 @@ var ts;
95916
96048
  if (system === void 0) { system = ts.sys; }
95917
96049
  var existingDirectories = new ts.Map();
95918
96050
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
95919
- var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
95920
96051
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
95921
96052
  var text;
95922
96053
  try {
@@ -95946,7 +96077,7 @@ var ts;
95946
96077
  function writeFile(fileName, data, writeByteOrderMark, onError) {
95947
96078
  try {
95948
96079
  ts.performance.mark("beforeIOWrite");
95949
- 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); });
96080
+ 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); });
95950
96081
  ts.performance.mark("afterIOWrite");
95951
96082
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
95952
96083
  }
@@ -95956,34 +96087,6 @@ var ts;
95956
96087
  }
95957
96088
  }
95958
96089
  }
95959
- var outputFingerprints;
95960
- function writeFileWorker(fileName, data, writeByteOrderMark) {
95961
- if (!ts.isWatchSet(options) || !system.getModifiedTime) {
95962
- system.writeFile(fileName, data, writeByteOrderMark);
95963
- return;
95964
- }
95965
- if (!outputFingerprints) {
95966
- outputFingerprints = new ts.Map();
95967
- }
95968
- var hash = computeHash(data);
95969
- var mtimeBefore = system.getModifiedTime(fileName);
95970
- if (mtimeBefore) {
95971
- var fingerprint = outputFingerprints.get(fileName);
95972
- if (fingerprint &&
95973
- fingerprint.byteOrderMark === writeByteOrderMark &&
95974
- fingerprint.hash === hash &&
95975
- fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
95976
- return;
95977
- }
95978
- }
95979
- system.writeFile(fileName, data, writeByteOrderMark);
95980
- var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
95981
- outputFingerprints.set(fileName, {
95982
- hash: hash,
95983
- byteOrderMark: writeByteOrderMark,
95984
- mtime: mtimeAfter
95985
- });
95986
- }
95987
96090
  function getDefaultLibLocation() {
95988
96091
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
95989
96092
  }
@@ -97357,6 +97460,7 @@ var ts;
97357
97460
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
97358
97461
  redirectTargetsMap: redirectTargetsMap,
97359
97462
  getFileIncludeReasons: program.getFileIncludeReasons,
97463
+ createHash: ts.maybeBind(host, host.createHash),
97360
97464
  };
97361
97465
  }
97362
97466
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -99263,13 +99367,9 @@ var ts;
99263
99367
  function createManyToManyPathMap() {
99264
99368
  function create(forward, reverse, deleted) {
99265
99369
  var map = {
99266
- clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
99267
- forEach: function (fn) { return forward.forEach(fn); },
99268
99370
  getKeys: function (v) { return reverse.get(v); },
99269
99371
  getValues: function (k) { return forward.get(k); },
99270
- hasKey: function (k) { return forward.has(k); },
99271
99372
  keys: function () { return forward.keys(); },
99272
- deletedKeys: function () { return deleted; },
99273
99373
  deleteKey: function (k) {
99274
99374
  (deleted || (deleted = new ts.Set())).add(k);
99275
99375
  var set = forward.get(k);
@@ -99296,11 +99396,6 @@ var ts;
99296
99396
  });
99297
99397
  return map;
99298
99398
  },
99299
- clear: function () {
99300
- forward.clear();
99301
- reverse.clear();
99302
- deleted === null || deleted === void 0 ? void 0 : deleted.clear();
99303
- }
99304
99399
  };
99305
99400
  return map;
99306
99401
  }
@@ -99404,35 +99499,45 @@ var ts;
99404
99499
  }
99405
99500
  BuilderState.canReuseOldState = canReuseOldState;
99406
99501
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
99502
+ var _a, _b, _c;
99407
99503
  var fileInfos = new ts.Map();
99408
99504
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
99409
99505
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
99410
- var hasCalledUpdateShapeSignature = new ts.Set();
99411
99506
  var useOldState = canReuseOldState(referencedMap, oldState);
99412
99507
  newProgram.getTypeChecker();
99413
- for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
99414
- var sourceFile = _a[_i];
99508
+ for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
99509
+ var sourceFile = _d[_i];
99415
99510
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
99416
- var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
99511
+ var oldUncommittedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
99512
+ var signature = oldUncommittedSignature === undefined ?
99513
+ useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
99514
+ oldUncommittedSignature || undefined;
99417
99515
  if (referencedMap) {
99418
99516
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
99419
99517
  if (newReferences) {
99420
99518
  referencedMap.set(sourceFile.resolvedPath, newReferences);
99421
99519
  }
99422
99520
  if (useOldState) {
99423
- var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
99521
+ var oldUncommittedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
99522
+ var exportedModules = oldUncommittedExportedModules === undefined ?
99523
+ oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
99524
+ oldUncommittedExportedModules || undefined;
99424
99525
  if (exportedModules) {
99425
99526
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
99426
99527
  }
99427
99528
  }
99428
99529
  }
99429
- fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
99530
+ fileInfos.set(sourceFile.resolvedPath, {
99531
+ version: version_2,
99532
+ signature: signature,
99533
+ affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
99534
+ impliedFormat: sourceFile.impliedNodeFormat
99535
+ });
99430
99536
  }
99431
99537
  return {
99432
99538
  fileInfos: fileInfos,
99433
99539
  referencedMap: referencedMap,
99434
99540
  exportedModulesMap: exportedModulesMap,
99435
- hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
99436
99541
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
99437
99542
  };
99438
99543
  }
@@ -99442,52 +99547,36 @@ var ts;
99442
99547
  state.allFileNames = undefined;
99443
99548
  }
99444
99549
  BuilderState.releaseCache = releaseCache;
99445
- function clone(state) {
99550
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
99446
99551
  var _a, _b;
99447
- return {
99448
- fileInfos: new ts.Map(state.fileInfos),
99449
- referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
99450
- exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
99451
- hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
99452
- useFileVersionAsSignature: state.useFileVersionAsSignature,
99453
- };
99552
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
99553
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
99554
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
99555
+ return result;
99454
99556
  }
99455
- BuilderState.clone = clone;
99456
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
99457
- var signatureCache = cacheToUpdateSignature || new ts.Map();
99557
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
99558
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
99458
99559
  var sourceFile = programOfThisState.getSourceFileByPath(path);
99459
99560
  if (!sourceFile) {
99460
99561
  return ts.emptyArray;
99461
99562
  }
99462
- if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
99563
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
99463
99564
  return [sourceFile];
99464
99565
  }
99465
- var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
99466
- if (!cacheToUpdateSignature) {
99467
- updateSignaturesFromCache(state, signatureCache);
99468
- }
99469
- return result;
99566
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
99470
99567
  }
99471
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
99472
- function updateSignaturesFromCache(state, signatureCache) {
99473
- signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
99474
- }
99475
- BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
99568
+ BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
99476
99569
  function updateSignatureOfFile(state, signature, path) {
99477
99570
  state.fileInfos.get(path).signature = signature;
99478
- state.hasCalledUpdateShapeSignature.add(path);
99571
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
99479
99572
  }
99480
99573
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
99481
- function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
99574
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
99575
+ var _a;
99482
99576
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
99483
- ts.Debug.assert(!!sourceFile);
99484
- ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
99485
- if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
99577
+ if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
99486
99578
  return false;
99487
- }
99488
99579
  var info = state.fileInfos.get(sourceFile.resolvedPath);
99489
- if (!info)
99490
- return ts.Debug.fail();
99491
99580
  var prevSignature = info.signature;
99492
99581
  var latestSignature;
99493
99582
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -99495,40 +99584,50 @@ var ts;
99495
99584
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
99496
99585
  if (firstDts_1) {
99497
99586
  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; })); });
99498
- latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
99499
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
99500
- updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
99587
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
99588
+ if (latestSignature !== prevSignature) {
99589
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
99501
99590
  }
99502
99591
  }
99503
99592
  }
99504
99593
  if (latestSignature === undefined) {
99505
99594
  latestSignature = sourceFile.version;
99506
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
99595
+ if (state.exportedModulesMap && latestSignature !== prevSignature) {
99596
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
99507
99597
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
99508
99598
  if (references) {
99509
- exportedModulesMapCache.set(sourceFile.resolvedPath, references);
99599
+ state.exportedModulesMap.set(sourceFile.resolvedPath, references);
99510
99600
  }
99511
99601
  else {
99512
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
99602
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
99513
99603
  }
99514
99604
  }
99515
99605
  }
99516
- cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
99606
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
99607
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
99608
+ info.signature = latestSignature;
99517
99609
  return latestSignature !== prevSignature;
99518
99610
  }
99519
99611
  BuilderState.updateShapeSignature = updateShapeSignature;
99520
- function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
99612
+ function computeSignature(text, computeHash) {
99613
+ return (computeHash || ts.generateDjb2Hash)(text);
99614
+ }
99615
+ BuilderState.computeSignature = computeSignature;
99616
+ function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
99617
+ if (!state.exportedModulesMap)
99618
+ return;
99619
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
99521
99620
  if (!exportedModulesFromDeclarationEmit) {
99522
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
99621
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
99523
99622
  return;
99524
99623
  }
99525
99624
  var exportedModules;
99526
99625
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
99527
99626
  if (exportedModules) {
99528
- exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
99627
+ state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
99529
99628
  }
99530
99629
  else {
99531
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
99630
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
99532
99631
  }
99533
99632
  function addExportedModule(exportedModulePaths) {
99534
99633
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -99540,15 +99639,6 @@ var ts;
99540
99639
  }
99541
99640
  }
99542
99641
  BuilderState.updateExportedModules = updateExportedModules;
99543
- function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
99544
- var _a;
99545
- if (exportedModulesMapCache) {
99546
- ts.Debug.assert(!!state.exportedModulesMap);
99547
- (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
99548
- exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
99549
- }
99550
- }
99551
- BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
99552
99642
  function getAllDependencies(state, programOfThisState, sourceFile) {
99553
99643
  var compilerOptions = programOfThisState.getCompilerOptions();
99554
99644
  if (ts.outFile(compilerOptions)) {
@@ -99632,7 +99722,7 @@ var ts;
99632
99722
  }
99633
99723
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
99634
99724
  }
99635
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
99725
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
99636
99726
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
99637
99727
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
99638
99728
  }
@@ -99648,7 +99738,7 @@ var ts;
99648
99738
  if (!seenFileNamesMap.has(currentPath)) {
99649
99739
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
99650
99740
  seenFileNamesMap.set(currentPath, currentSourceFile);
99651
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
99741
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
99652
99742
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
99653
99743
  }
99654
99744
  }
@@ -99663,29 +99753,31 @@ var ts;
99663
99753
  return map1 === map2 || map1 !== undefined && map2 !== undefined && map1.size === map2.size && !ts.forEachKey(map1, function (key) { return !map2.has(key); });
99664
99754
  }
99665
99755
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
99756
+ var _a, _b;
99666
99757
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
99667
99758
  state.program = newProgram;
99668
99759
  var compilerOptions = newProgram.getCompilerOptions();
99669
99760
  state.compilerOptions = compilerOptions;
99670
- if (!ts.outFile(compilerOptions)) {
99761
+ var outFilePath = ts.outFile(compilerOptions);
99762
+ if (!outFilePath) {
99671
99763
  state.semanticDiagnosticsPerFile = new ts.Map();
99672
99764
  }
99765
+ 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)) {
99766
+ state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
99767
+ }
99673
99768
  state.changedFilesSet = new ts.Set();
99769
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
99674
99770
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
99675
99771
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
99676
99772
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
99677
99773
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
99774
+ var canCopyEmitSignatures = compilerOptions.composite &&
99775
+ (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
99776
+ !outFilePath &&
99777
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
99678
99778
  if (useOldState) {
99679
- if (!oldState.currentChangedFilePath) {
99680
- var affectedSignatures = oldState.currentAffectedFilesSignatures;
99681
- ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
99682
- }
99683
- var changedFilesSet = oldState.changedFilesSet;
99684
- if (canCopySemanticDiagnostics) {
99685
- ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
99686
- }
99687
- changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
99688
- if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
99779
+ (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
99780
+ if (!outFilePath && oldState.affectedFilesPendingEmit) {
99689
99781
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
99690
99782
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
99691
99783
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -99702,6 +99794,7 @@ var ts;
99702
99794
  if (!useOldState ||
99703
99795
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
99704
99796
  oldInfo.version !== info.version ||
99797
+ oldInfo.impliedFormat !== info.impliedFormat ||
99705
99798
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
99706
99799
  newReferences && ts.forEachKey(newReferences, function (path) { return !state.fileInfos.has(path) && oldState.fileInfos.has(path); })) {
99707
99800
  state.changedFilesSet.add(sourceFilePath);
@@ -99721,24 +99814,22 @@ var ts;
99721
99814
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
99722
99815
  }
99723
99816
  }
99817
+ if (canCopyEmitSignatures) {
99818
+ var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
99819
+ if (oldEmitSignature)
99820
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
99821
+ }
99724
99822
  });
99725
99823
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
99726
99824
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, undefined)
99727
99825
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
99728
99826
  }
99729
- else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
99827
+ else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
99730
99828
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1); });
99731
99829
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
99732
99830
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
99733
99831
  }
99734
- if (useOldState) {
99735
- ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
99736
- if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
99737
- state.changedFilesSet.add(sourceFilePath);
99738
- }
99739
- });
99740
- }
99741
- state.buildInfoEmitPending = !!state.changedFilesSet.size;
99832
+ state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
99742
99833
  return state;
99743
99834
  }
99744
99835
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -99771,33 +99862,40 @@ var ts;
99771
99862
  ts.BuilderState.releaseCache(state);
99772
99863
  state.program = undefined;
99773
99864
  }
99774
- function cloneBuilderProgramState(state) {
99775
- var _a;
99776
- var newState = ts.BuilderState.clone(state);
99777
- newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
99778
- newState.changedFilesSet = new ts.Set(state.changedFilesSet);
99779
- newState.affectedFiles = state.affectedFiles;
99780
- newState.affectedFilesIndex = state.affectedFilesIndex;
99781
- newState.currentChangedFilePath = state.currentChangedFilePath;
99782
- newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
99783
- newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
99784
- newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
99785
- newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
99786
- newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
99787
- newState.program = state.program;
99788
- newState.compilerOptions = state.compilerOptions;
99789
- newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
99790
- newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
99791
- newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
99792
- newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
99793
- newState.programEmitComplete = state.programEmitComplete;
99794
- return newState;
99865
+ function backupBuilderProgramEmitState(state) {
99866
+ var outFilePath = ts.outFile(state.compilerOptions);
99867
+ ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
99868
+ return {
99869
+ affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
99870
+ affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
99871
+ affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
99872
+ seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
99873
+ programEmitComplete: state.programEmitComplete,
99874
+ emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
99875
+ outSignature: state.outSignature,
99876
+ dtsChangeTime: state.dtsChangeTime,
99877
+ hasChangedEmitSignature: state.hasChangedEmitSignature,
99878
+ changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
99879
+ };
99880
+ }
99881
+ function restoreBuilderProgramEmitState(state, savedEmitState) {
99882
+ state.affectedFilesPendingEmit = savedEmitState.affectedFilesPendingEmit;
99883
+ state.affectedFilesPendingEmitKind = savedEmitState.affectedFilesPendingEmitKind;
99884
+ state.affectedFilesPendingEmitIndex = savedEmitState.affectedFilesPendingEmitIndex;
99885
+ state.seenEmittedFiles = savedEmitState.seenEmittedFiles;
99886
+ state.programEmitComplete = savedEmitState.programEmitComplete;
99887
+ state.emitSignatures = savedEmitState.emitSignatures;
99888
+ state.outSignature = savedEmitState.outSignature;
99889
+ state.dtsChangeTime = savedEmitState.dtsChangeTime;
99890
+ state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
99891
+ if (savedEmitState.changedFilesSet)
99892
+ state.changedFilesSet = savedEmitState.changedFilesSet;
99795
99893
  }
99796
99894
  function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
99797
99895
  ts.Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
99798
99896
  }
99799
99897
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
99800
- var _a;
99898
+ var _a, _b;
99801
99899
  while (true) {
99802
99900
  var affectedFiles = state.affectedFiles;
99803
99901
  if (affectedFiles) {
@@ -99814,10 +99912,8 @@ var ts;
99814
99912
  }
99815
99913
  state.changedFilesSet.delete(state.currentChangedFilePath);
99816
99914
  state.currentChangedFilePath = undefined;
99817
- ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
99818
- state.currentAffectedFilesSignatures.clear();
99819
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
99820
- (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
99915
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
99916
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
99821
99917
  state.affectedFiles = undefined;
99822
99918
  }
99823
99919
  var nextKey = state.changedFilesSet.keys().next();
@@ -99830,12 +99926,7 @@ var ts;
99830
99926
  ts.Debug.assert(!state.semanticDiagnosticsPerFile);
99831
99927
  return program;
99832
99928
  }
99833
- if (!state.currentAffectedFilesSignatures)
99834
- state.currentAffectedFilesSignatures = new ts.Map();
99835
- if (state.exportedModulesMap) {
99836
- state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
99837
- }
99838
- state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
99929
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
99839
99930
  state.currentChangedFilePath = nextKey.value;
99840
99931
  state.affectedFilesIndex = 0;
99841
99932
  if (!state.seenAffectedFiles)
@@ -99879,14 +99970,12 @@ var ts;
99879
99970
  }
99880
99971
  }
99881
99972
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
99882
- var _a;
99883
99973
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
99884
99974
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
99885
99975
  removeDiagnosticsOfLibraryFiles(state);
99886
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
99976
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
99887
99977
  return;
99888
99978
  }
99889
- 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);
99890
99979
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
99891
99980
  return;
99892
99981
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -99897,7 +99986,7 @@ var ts;
99897
99986
  var program = ts.Debug.checkDefined(state.program);
99898
99987
  var sourceFile = program.getSourceFileByPath(path);
99899
99988
  if (sourceFile) {
99900
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
99989
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
99901
99990
  if (ts.getEmitDeclarations(state.compilerOptions)) {
99902
99991
  addToAffectedFilesPendingEmit(state, path, 0);
99903
99992
  }
@@ -99913,24 +100002,10 @@ var ts;
99913
100002
  return !state.semanticDiagnosticsFromOldState.size;
99914
100003
  }
99915
100004
  function isChangedSignature(state, path) {
99916
- var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
99917
- var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
100005
+ var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
100006
+ var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
99918
100007
  return newSignature !== oldSignature;
99919
100008
  }
99920
- function forEachKeyOfExportedModulesMap(state, filePath, fn) {
99921
- var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
99922
- var result = keys && ts.forEachKey(keys, fn);
99923
- if (result)
99924
- return result;
99925
- keys = state.exportedModulesMap.getKeys(filePath);
99926
- return keys && ts.forEachKey(keys, function (exportedFromPath) {
99927
- var _a;
99928
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
99929
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
99930
- fn(exportedFromPath) :
99931
- undefined;
99932
- });
99933
- }
99934
100009
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
99935
100010
  var _a;
99936
100011
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -99941,6 +100016,7 @@ var ts;
99941
100016
  return true;
99942
100017
  }
99943
100018
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
100019
+ var _a;
99944
100020
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
99945
100021
  return;
99946
100022
  if (!isChangedSignature(state, affectedFile.resolvedPath))
@@ -99963,9 +100039,8 @@ var ts;
99963
100039
  }
99964
100040
  }
99965
100041
  }
99966
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
99967
100042
  var seenFileAndExportsOfFile = new ts.Set();
99968
- forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
100043
+ (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
99969
100044
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
99970
100045
  return true;
99971
100046
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -99975,17 +100050,16 @@ var ts;
99975
100050
  });
99976
100051
  }
99977
100052
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
99978
- var _a;
100053
+ var _a, _b;
99979
100054
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
99980
100055
  return undefined;
99981
100056
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
99982
100057
  return true;
99983
100058
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
99984
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
99985
- forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
100059
+ (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
99986
100060
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
99987
100061
  });
99988
- (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
100062
+ (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
99989
100063
  return !seenFileAndExportsOfFile.has(referencingFilePath) &&
99990
100064
  handleDtsMayChangeOf(state, referencingFilePath, cancellationToken, computeHash, host);
99991
100065
  });
@@ -100001,12 +100075,12 @@ var ts;
100001
100075
  }
100002
100076
  else {
100003
100077
  state.seenAffectedFiles.add(affected.resolvedPath);
100078
+ state.buildInfoEmitPending = true;
100004
100079
  if (emitKind !== undefined) {
100005
100080
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
100006
100081
  }
100007
100082
  if (isPendingEmit) {
100008
100083
  state.affectedFilesPendingEmitIndex++;
100009
- state.buildInfoEmitPending = true;
100010
100084
  }
100011
100085
  else {
100012
100086
  state.affectedFilesIndex++;
@@ -100038,29 +100112,65 @@ var ts;
100038
100112
  }
100039
100113
  return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
100040
100114
  }
100041
- function getProgramBuildInfo(state, getCanonicalFileName) {
100042
- if (ts.outFile(state.compilerOptions))
100043
- return undefined;
100115
+ function isProgramBundleEmitBuildInfo(info) {
100116
+ return !!ts.outFile(info.options || {});
100117
+ }
100118
+ ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
100119
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
100120
+ var outFilePath = ts.outFile(state.compilerOptions);
100121
+ if (outFilePath && !state.compilerOptions.composite)
100122
+ return;
100044
100123
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
100045
100124
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
100125
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
100126
+ if (outFilePath) {
100127
+ var fileNames_1 = [];
100128
+ var fileInfos_1 = [];
100129
+ state.program.getRootFileNames().forEach(function (f) {
100130
+ var sourceFile = state.program.getSourceFile(f);
100131
+ if (!sourceFile)
100132
+ return;
100133
+ fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
100134
+ fileInfos_1.push(sourceFile.version);
100135
+ });
100136
+ var result_15 = {
100137
+ fileNames: fileNames_1,
100138
+ fileInfos: fileInfos_1,
100139
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
100140
+ outSignature: state.outSignature,
100141
+ dtsChangeTime: state.dtsChangeTime,
100142
+ };
100143
+ return result_15;
100144
+ }
100046
100145
  var fileNames = [];
100047
100146
  var fileNameToFileId = new ts.Map();
100048
100147
  var fileIdsList;
100049
100148
  var fileNamesToFileIdListId;
100149
+ var emitSignatures;
100050
100150
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
100151
+ var _b, _c;
100051
100152
  var key = _a[0], value = _a[1];
100052
100153
  var fileId = toFileId(key);
100053
100154
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
100054
- var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
100055
- var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
100155
+ var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
100156
+ var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
100157
+ if (state.compilerOptions.composite) {
100158
+ var file = state.program.getSourceFileByPath(key);
100159
+ if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
100160
+ var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
100161
+ if (emitSignature !== actualSignature) {
100162
+ (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
100163
+ }
100164
+ }
100165
+ }
100056
100166
  return value.version === actualSignature ?
100057
100167
  value.affectsGlobalScope || value.impliedFormat ?
100058
100168
  { version: value.version, signature: undefined, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
100059
100169
  value.version :
100060
100170
  actualSignature !== undefined ?
100061
- signature === undefined ?
100171
+ oldSignature === undefined ?
100062
100172
  value :
100063
- { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
100173
+ { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
100064
100174
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
100065
100175
  });
100066
100176
  var referencedMap;
@@ -100074,16 +100184,12 @@ var ts;
100074
100184
  if (state.exportedModulesMap) {
100075
100185
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
100076
100186
  var _a;
100077
- if (state.currentAffectedFilesExportedModulesMap) {
100078
- if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
100079
- return undefined;
100080
- }
100081
- var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
100082
- if (newValue) {
100083
- return [toFileId(key), toFileIdListId(newValue)];
100084
- }
100085
- }
100086
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
100187
+ var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
100188
+ if (oldValue === undefined)
100189
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
100190
+ if (oldValue)
100191
+ return [toFileId(key), toFileIdListId(oldValue)];
100192
+ return undefined;
100087
100193
  });
100088
100194
  }
100089
100195
  var semanticDiagnosticsPerFile;
@@ -100094,9 +100200,7 @@ var ts;
100094
100200
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
100095
100201
  [
100096
100202
  toFileId(key),
100097
- state.hasReusableDiagnostic ?
100098
- value :
100099
- convertToReusableDiagnostics(value, relativeToBuildInfo)
100203
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
100100
100204
  ] :
100101
100205
  toFileId(key));
100102
100206
  }
@@ -100111,16 +100215,27 @@ var ts;
100111
100215
  }
100112
100216
  }
100113
100217
  }
100114
- return {
100218
+ var changeFileSet;
100219
+ if (state.changedFilesSet.size) {
100220
+ for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
100221
+ var path = _e[_d];
100222
+ (changeFileSet || (changeFileSet = [])).push(toFileId(path));
100223
+ }
100224
+ }
100225
+ var result = {
100115
100226
  fileNames: fileNames,
100116
100227
  fileInfos: fileInfos,
100117
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
100228
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
100118
100229
  fileIdsList: fileIdsList,
100119
100230
  referencedMap: referencedMap,
100120
100231
  exportedModulesMap: exportedModulesMap,
100121
100232
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
100122
100233
  affectedFilesPendingEmit: affectedFilesPendingEmit,
100234
+ changeFileSet: changeFileSet,
100235
+ emitSignatures: emitSignatures,
100236
+ dtsChangeTime: state.dtsChangeTime,
100123
100237
  };
100238
+ return result;
100124
100239
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
100125
100240
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
100126
100241
  }
@@ -100145,21 +100260,18 @@ var ts;
100145
100260
  }
100146
100261
  return fileIdListId;
100147
100262
  }
100148
- }
100149
- function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
100150
- var result;
100151
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
100152
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
100153
- var name = _a[_i];
100154
- var optionKey = name.toLowerCase();
100155
- var optionInfo = optionsNameMap.get(optionKey);
100156
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
100157
- optionKey === "strict" ||
100158
- optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
100159
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
100263
+ function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
100264
+ var result;
100265
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
100266
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
100267
+ var name = _a[_i];
100268
+ var optionInfo = optionsNameMap.get(name.toLowerCase());
100269
+ if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
100270
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
100271
+ }
100160
100272
  }
100273
+ return result;
100161
100274
  }
100162
- return result;
100163
100275
  }
100164
100276
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
100165
100277
  if (option) {
@@ -100233,6 +100345,10 @@ var ts;
100233
100345
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
100234
100346
  }
100235
100347
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
100348
+ function computeSignature(text, data, computeHash) {
100349
+ return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
100350
+ }
100351
+ ts.computeSignature = computeSignature;
100236
100352
  function createBuilderProgram(kind, _a) {
100237
100353
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
100238
100354
  var oldState = oldProgram && oldProgram.getState();
@@ -100244,29 +100360,19 @@ var ts;
100244
100360
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
100245
100361
  var computeHash = ts.maybeBind(host, host.createHash);
100246
100362
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
100247
- var backupState;
100248
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
100363
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
100249
100364
  newProgram = undefined;
100250
100365
  oldProgram = undefined;
100251
100366
  oldState = undefined;
100252
100367
  var getState = function () { return state; };
100253
100368
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
100254
100369
  builderProgram.getState = getState;
100255
- builderProgram.backupState = function () {
100256
- ts.Debug.assert(backupState === undefined);
100257
- backupState = cloneBuilderProgramState(state);
100258
- };
100259
- builderProgram.restoreState = function () {
100260
- state = ts.Debug.checkDefined(backupState);
100261
- backupState = undefined;
100262
- };
100370
+ builderProgram.saveEmitState = function () { return backupBuilderProgramEmitState(state); };
100371
+ builderProgram.restoreEmitState = function (saved) { return restoreBuilderProgramEmitState(state, saved); };
100263
100372
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
100264
100373
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
100265
100374
  builderProgram.emit = emit;
100266
- builderProgram.releaseProgram = function () {
100267
- releaseCache(state);
100268
- backupState = undefined;
100269
- };
100375
+ builderProgram.releaseProgram = function () { return releaseCache(state); };
100270
100376
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
100271
100377
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
100272
100378
  }
@@ -100311,35 +100417,57 @@ var ts;
100311
100417
  affected = program;
100312
100418
  }
100313
100419
  }
100314
- return toAffectedFileEmitResult(state, ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
100315
- getWriteFileUpdatingSignatureCallback(writeFile) :
100420
+ return toAffectedFileEmitResult(state, ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
100421
+ getWriteFileCallback(writeFile, customTransformers) :
100316
100422
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0, customTransformers), affected, emitKind, isPendingEmitFile);
100317
100423
  }
100318
- function getWriteFileUpdatingSignatureCallback(writeFile) {
100424
+ function getWriteFileCallback(writeFile, customTransformers) {
100319
100425
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
100320
- var _a;
100426
+ var _a, _b, _c;
100321
100427
  if (ts.isDeclarationFileName(fileName)) {
100322
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
100323
- var file = sourceFiles[0];
100324
- var info = state.fileInfos.get(file.resolvedPath);
100325
- var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
100326
- if (signature === file.version) {
100327
- var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
100328
- if (newSignature !== file.version) {
100329
- if (host.storeFilesChangingSignatureDuringEmit)
100330
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
100331
- if (state.exportedModulesMap)
100332
- ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
100333
- if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
100334
- state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
100428
+ if (!ts.outFile(state.compilerOptions)) {
100429
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
100430
+ var newSignature = void 0;
100431
+ if (!customTransformers) {
100432
+ var file = sourceFiles[0];
100433
+ var info = state.fileInfos.get(file.resolvedPath);
100434
+ if (info.signature === file.version) {
100435
+ newSignature = computeSignature(text, data, computeHash);
100436
+ if (newSignature !== file.version) {
100437
+ if (host.storeFilesChangingSignatureDuringEmit)
100438
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
100439
+ if (state.exportedModulesMap)
100440
+ ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
100441
+ if (state.affectedFiles) {
100442
+ var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
100443
+ if (existing === undefined)
100444
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
100445
+ info.signature = newSignature;
100446
+ }
100447
+ else {
100448
+ info.signature = newSignature;
100449
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
100450
+ }
100451
+ }
100335
100452
  }
100336
- else {
100337
- info.signature = newSignature;
100338
- if (state.exportedModulesMap)
100339
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
100453
+ }
100454
+ if (state.compilerOptions.composite) {
100455
+ var filePath = sourceFiles[0].resolvedPath;
100456
+ var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
100457
+ newSignature || (newSignature = computeSignature(text, data, computeHash));
100458
+ if (newSignature !== oldSignature) {
100459
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
100460
+ state.hasChangedEmitSignature = true;
100340
100461
  }
100341
100462
  }
100342
100463
  }
100464
+ else if (state.compilerOptions.composite) {
100465
+ var newSignature = computeSignature(text, data, computeHash);
100466
+ if (newSignature !== state.outSignature) {
100467
+ state.outSignature = newSignature;
100468
+ state.hasChangedEmitSignature = true;
100469
+ }
100470
+ }
100343
100471
  }
100344
100472
  if (writeFile)
100345
100473
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -100388,8 +100516,8 @@ var ts;
100388
100516
  }
100389
100517
  }
100390
100518
  }
100391
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
100392
- getWriteFileUpdatingSignatureCallback(writeFile) :
100519
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
100520
+ getWriteFileCallback(writeFile, customTransformers) :
100393
100521
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
100394
100522
  }
100395
100523
  function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
@@ -100452,29 +100580,58 @@ var ts;
100452
100580
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
100453
100581
  }
100454
100582
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
100455
- function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
100456
- var _a;
100583
+ function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
100584
+ var _a, _b, _c, _d;
100457
100585
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
100458
100586
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
100459
- var filePaths = program.fileNames.map(toPath);
100460
- var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
100461
- var fileInfos = new ts.Map();
100462
- program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
100463
- var state = {
100464
- fileInfos: fileInfos,
100465
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
100466
- referencedMap: toManyToManyPathMap(program.referencedMap),
100467
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
100468
- semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return toFilePath(ts.isNumber(value) ? value : value[0]); }, function (value) { return ts.isNumber(value) ? ts.emptyArray : value[1]; }),
100469
- hasReusableDiagnostic: true,
100470
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
100471
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
100472
- affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
100473
- };
100587
+ var state;
100588
+ var filePaths;
100589
+ var filePathsSetList;
100590
+ if (isProgramBundleEmitBuildInfo(program)) {
100591
+ state = {
100592
+ fileInfos: new ts.Map(),
100593
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
100594
+ dtsChangeTime: program.dtsChangeTime,
100595
+ outSignature: program.outSignature,
100596
+ };
100597
+ }
100598
+ else {
100599
+ filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
100600
+ filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
100601
+ var fileInfos_2 = new ts.Map();
100602
+ var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
100603
+ program.fileInfos.forEach(function (fileInfo, index) {
100604
+ var path = toFilePath(index + 1);
100605
+ var stateFileInfo = toBuilderStateFileInfo(fileInfo);
100606
+ fileInfos_2.set(path, stateFileInfo);
100607
+ if (emitSignatures_1 && stateFileInfo.signature)
100608
+ emitSignatures_1.set(path, stateFileInfo.signature);
100609
+ });
100610
+ (_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
100611
+ if (ts.isNumber(value))
100612
+ emitSignatures_1.delete(toFilePath(value));
100613
+ else
100614
+ emitSignatures_1.set(toFilePath(value[0]), value[1]);
100615
+ });
100616
+ state = {
100617
+ fileInfos: fileInfos_2,
100618
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
100619
+ referencedMap: toManyToManyPathMap(program.referencedMap),
100620
+ exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
100621
+ semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return toFilePath(ts.isNumber(value) ? value : value[0]); }, function (value) { return ts.isNumber(value) ? ts.emptyArray : value[1]; }),
100622
+ hasReusableDiagnostic: true,
100623
+ affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
100624
+ affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
100625
+ affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
100626
+ changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
100627
+ dtsChangeTime: program.dtsChangeTime,
100628
+ emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
100629
+ };
100630
+ }
100474
100631
  return {
100475
100632
  getState: function () { return state; },
100476
- backupState: ts.noop,
100477
- restoreState: ts.noop,
100633
+ saveEmitState: ts.noop,
100634
+ restoreEmitState: ts.noop,
100478
100635
  getProgram: ts.notImplemented,
100479
100636
  getProgramOrUndefined: ts.returnUndefined,
100480
100637
  releaseProgram: ts.noop,
@@ -100519,12 +100676,24 @@ var ts;
100519
100676
  return map;
100520
100677
  }
100521
100678
  }
100522
- ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
100679
+ ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
100680
+ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
100681
+ var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
100682
+ var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
100683
+ var fileInfos = new ts.Map();
100684
+ program.fileInfos.forEach(function (fileInfo, index) {
100685
+ var path = ts.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
100686
+ var version = ts.isString(fileInfo) ? fileInfo : fileInfo.version;
100687
+ fileInfos.set(path, version);
100688
+ });
100689
+ return fileInfos;
100690
+ }
100691
+ ts.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap;
100523
100692
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
100524
100693
  return {
100525
100694
  getState: ts.notImplemented,
100526
- backupState: ts.noop,
100527
- restoreState: ts.noop,
100695
+ saveEmitState: ts.noop,
100696
+ restoreEmitState: ts.noop,
100528
100697
  getProgram: getProgram,
100529
100698
  getProgramOrUndefined: function () { return getState().program; },
100530
100699
  releaseProgram: function () { return getState().program = undefined; },
@@ -100615,8 +100784,10 @@ var ts;
100615
100784
  var filesWithInvalidatedNonRelativeUnresolvedImports;
100616
100785
  var nonRelativeExternalModuleResolutions = ts.createMultiMap();
100617
100786
  var resolutionsWithFailedLookups = [];
100787
+ var resolutionsWithOnlyAffectingLocations = [];
100618
100788
  var resolvedFileToResolution = ts.createMultiMap();
100619
100789
  var hasChangedAutomaticTypeDirectiveNames = false;
100790
+ var affectingPathChecks;
100620
100791
  var failedLookupChecks;
100621
100792
  var startsWithPathChecks;
100622
100793
  var isInDirectoryChecks;
@@ -100632,6 +100803,7 @@ var ts;
100632
100803
  var failedLookupDefaultExtensions = [".ts", ".tsx", ".js", ".jsx", ".json"];
100633
100804
  var customFailedLookupPaths = new ts.Map();
100634
100805
  var directoryWatchesOfFailedLookups = new ts.Map();
100806
+ var fileWatchesOfAffectingLocations = new ts.Map();
100635
100807
  var rootDir = rootDirForResolution && ts.removeTrailingDirectorySeparator(ts.getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()));
100636
100808
  var rootPath = (rootDir && resolutionHost.toPath(rootDir));
100637
100809
  var rootSplitLength = rootPath !== undefined ? rootPath.split(ts.directorySeparator).length : 0;
@@ -100671,6 +100843,7 @@ var ts;
100671
100843
  }
100672
100844
  function clear() {
100673
100845
  ts.clearMap(directoryWatchesOfFailedLookups, ts.closeFileWatcherOf);
100846
+ ts.clearMap(fileWatchesOfAffectingLocations, ts.closeFileWatcherOf);
100674
100847
  customFailedLookupPaths.clear();
100675
100848
  nonRelativeExternalModuleResolutions.clear();
100676
100849
  closeTypeRootsWatch();
@@ -100678,9 +100851,11 @@ var ts;
100678
100851
  resolvedTypeReferenceDirectives.clear();
100679
100852
  resolvedFileToResolution.clear();
100680
100853
  resolutionsWithFailedLookups.length = 0;
100854
+ resolutionsWithOnlyAffectingLocations.length = 0;
100681
100855
  failedLookupChecks = undefined;
100682
100856
  startsWithPathChecks = undefined;
100683
100857
  isInDirectoryChecks = undefined;
100858
+ affectingPathChecks = undefined;
100684
100859
  clearPerDirectoryResolutions();
100685
100860
  hasChangedAutomaticTypeDirectiveNames = false;
100686
100861
  }
@@ -100725,20 +100900,28 @@ var ts;
100725
100900
  watcher.watcher.close();
100726
100901
  }
100727
100902
  });
100903
+ fileWatchesOfAffectingLocations.forEach(function (watcher, path) {
100904
+ if (watcher.refCount === 0) {
100905
+ fileWatchesOfAffectingLocations.delete(path);
100906
+ watcher.watcher.close();
100907
+ watcher.watcher = ts.noopFileWatcher;
100908
+ }
100909
+ });
100728
100910
  hasChangedAutomaticTypeDirectiveNames = false;
100729
100911
  }
100730
100912
  function resolveModuleName(moduleName, containingFile, compilerOptions, host, redirectedReference, _containingSourceFile, mode) {
100731
- var _a;
100913
+ var _a, _b;
100732
100914
  var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
100733
100915
  if (!resolutionHost.getGlobalCache) {
100734
100916
  return primaryResult;
100735
100917
  }
100736
100918
  var globalCache = resolutionHost.getGlobalCache();
100737
100919
  if (globalCache !== undefined && !ts.isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && ts.extensionIsTS(primaryResult.resolvedModule.extension))) {
100738
- var _b = ts.loadModuleFromGlobalCache(ts.Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName), resolutionHost.projectName, compilerOptions, host, globalCache, moduleResolutionCache), resolvedModule = _b.resolvedModule, failedLookupLocations = _b.failedLookupLocations;
100920
+ var _c = ts.loadModuleFromGlobalCache(ts.Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName), resolutionHost.projectName, compilerOptions, host, globalCache, moduleResolutionCache), resolvedModule = _c.resolvedModule, failedLookupLocations = _c.failedLookupLocations, affectingLocations = _c.affectingLocations;
100739
100921
  if (resolvedModule) {
100740
100922
  primaryResult.resolvedModule = resolvedModule;
100741
100923
  (_a = primaryResult.failedLookupLocations).push.apply(_a, failedLookupLocations);
100924
+ (_b = primaryResult.affectingLocations).push.apply(_b, affectingLocations);
100742
100925
  return primaryResult;
100743
100926
  }
100744
100927
  }
@@ -100972,10 +101155,11 @@ var ts;
100972
101155
  }
100973
101156
  function watchFailedLookupLocationOfResolution(resolution) {
100974
101157
  ts.Debug.assert(!!resolution.refCount);
100975
- var failedLookupLocations = resolution.failedLookupLocations;
100976
- if (!failedLookupLocations.length)
101158
+ var failedLookupLocations = resolution.failedLookupLocations, affectingLocations = resolution.affectingLocations;
101159
+ if (!failedLookupLocations.length && !affectingLocations.length)
100977
101160
  return;
100978
- resolutionsWithFailedLookups.push(resolution);
101161
+ if (failedLookupLocations.length)
101162
+ resolutionsWithFailedLookups.push(resolution);
100979
101163
  var setAtRoot = false;
100980
101164
  for (var _i = 0, failedLookupLocations_1 = failedLookupLocations; _i < failedLookupLocations_1.length; _i++) {
100981
101165
  var failedLookupLocation = failedLookupLocations_1[_i];
@@ -100999,12 +101183,65 @@ var ts;
100999
101183
  if (setAtRoot) {
101000
101184
  setDirectoryWatcher(rootDir, rootPath, true);
101001
101185
  }
101186
+ watchAffectingLocationsOfResolution(resolution, !failedLookupLocations.length);
101187
+ }
101188
+ function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
101189
+ ts.Debug.assert(!!resolution.refCount);
101190
+ if (addToResolutionsWithOnlyAffectingLocations)
101191
+ resolutionsWithOnlyAffectingLocations.push(resolution);
101192
+ var affectingLocations = resolution.affectingLocations;
101193
+ for (var _i = 0, affectingLocations_1 = affectingLocations; _i < affectingLocations_1.length; _i++) {
101194
+ var affectingLocation = affectingLocations_1[_i];
101195
+ createFileWatcherOfAffectingLocation(affectingLocation);
101196
+ }
101197
+ }
101198
+ function createFileWatcherOfAffectingLocation(affectingLocation) {
101199
+ var path = resolutionHost.toPath(affectingLocation);
101200
+ var fileWatcher = fileWatchesOfAffectingLocations.get(path);
101201
+ if (fileWatcher) {
101202
+ fileWatcher.refCount++;
101203
+ return;
101204
+ }
101205
+ var locationToWatch = affectingLocation;
101206
+ var locationToWatchPath = path;
101207
+ if (resolutionHost.realpath) {
101208
+ locationToWatch = resolutionHost.realpath(affectingLocation);
101209
+ locationToWatchPath = resolutionHost.toPath(locationToWatch);
101210
+ if (path !== locationToWatchPath) {
101211
+ var fileWatcher_1 = fileWatchesOfAffectingLocations.get(locationToWatchPath);
101212
+ if (fileWatcher_1) {
101213
+ fileWatcher_1.refCount++;
101214
+ fileWatcher_1.paths.add(path);
101215
+ fileWatchesOfAffectingLocations.set(path, fileWatcher_1);
101216
+ return;
101217
+ }
101218
+ }
101219
+ }
101220
+ var paths = new ts.Set();
101221
+ paths.add(locationToWatchPath);
101222
+ var watcher = {
101223
+ watcher: resolutionHost.watchAffectingFileLocation(locationToWatch, function (fileName, eventKind) {
101224
+ cachedDirectoryStructureHost === null || cachedDirectoryStructureHost === void 0 ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, path, eventKind);
101225
+ paths.forEach(function (path) { return (affectingPathChecks || (affectingPathChecks = new ts.Set())).add(path); });
101226
+ resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
101227
+ }),
101228
+ refCount: 1,
101229
+ paths: paths,
101230
+ };
101231
+ fileWatchesOfAffectingLocations.set(locationToWatchPath, watcher);
101232
+ if (path !== locationToWatchPath) {
101233
+ fileWatchesOfAffectingLocations.set(path, watcher);
101234
+ paths.add(path);
101235
+ }
101002
101236
  }
101003
101237
  function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
101004
101238
  var program = resolutionHost.getCurrentProgram();
101005
101239
  if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
101006
101240
  resolutions.forEach(watchFailedLookupLocationOfResolution);
101007
101241
  }
101242
+ else {
101243
+ resolutions.forEach(function (resolution) { return watchAffectingLocationsOfResolution(resolution, true); });
101244
+ }
101008
101245
  }
101009
101246
  function setDirectoryWatcher(dir, dirPath, nonRecursive) {
101010
101247
  var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
@@ -101026,37 +101263,44 @@ var ts;
101026
101263
  if (resolved && resolved.resolvedFileName) {
101027
101264
  resolvedFileToResolution.remove(resolutionHost.toPath(resolved.resolvedFileName), resolution);
101028
101265
  }
101029
- if (!ts.unorderedRemoveItem(resolutionsWithFailedLookups, resolution)) {
101030
- return;
101031
- }
101032
- var failedLookupLocations = resolution.failedLookupLocations;
101033
- var removeAtRoot = false;
101034
- for (var _i = 0, failedLookupLocations_2 = failedLookupLocations; _i < failedLookupLocations_2.length; _i++) {
101035
- var failedLookupLocation = failedLookupLocations_2[_i];
101036
- var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
101037
- var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
101038
- if (toWatch) {
101039
- var dirPath = toWatch.dirPath;
101040
- var refCount = customFailedLookupPaths.get(failedLookupLocationPath);
101041
- if (refCount) {
101042
- if (refCount === 1) {
101043
- customFailedLookupPaths.delete(failedLookupLocationPath);
101266
+ var failedLookupLocations = resolution.failedLookupLocations, affectingLocations = resolution.affectingLocations;
101267
+ if (ts.unorderedRemoveItem(resolutionsWithFailedLookups, resolution)) {
101268
+ var removeAtRoot = false;
101269
+ for (var _i = 0, failedLookupLocations_2 = failedLookupLocations; _i < failedLookupLocations_2.length; _i++) {
101270
+ var failedLookupLocation = failedLookupLocations_2[_i];
101271
+ var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
101272
+ var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
101273
+ if (toWatch) {
101274
+ var dirPath = toWatch.dirPath;
101275
+ var refCount = customFailedLookupPaths.get(failedLookupLocationPath);
101276
+ if (refCount) {
101277
+ if (refCount === 1) {
101278
+ customFailedLookupPaths.delete(failedLookupLocationPath);
101279
+ }
101280
+ else {
101281
+ ts.Debug.assert(refCount > 1);
101282
+ customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1);
101283
+ }
101284
+ }
101285
+ if (dirPath === rootPath) {
101286
+ removeAtRoot = true;
101044
101287
  }
101045
101288
  else {
101046
- ts.Debug.assert(refCount > 1);
101047
- customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1);
101289
+ removeDirectoryWatcher(dirPath);
101048
101290
  }
101049
101291
  }
101050
- if (dirPath === rootPath) {
101051
- removeAtRoot = true;
101052
- }
101053
- else {
101054
- removeDirectoryWatcher(dirPath);
101055
- }
101056
101292
  }
101293
+ if (removeAtRoot) {
101294
+ removeDirectoryWatcher(rootPath);
101295
+ }
101296
+ }
101297
+ else if (affectingLocations.length) {
101298
+ ts.unorderedRemoveItem(resolutionsWithOnlyAffectingLocations, resolution);
101057
101299
  }
101058
- if (removeAtRoot) {
101059
- removeDirectoryWatcher(rootPath);
101300
+ for (var _a = 0, affectingLocations_2 = affectingLocations; _a < affectingLocations_2.length; _a++) {
101301
+ var affectingLocation = affectingLocations_2[_a];
101302
+ var watcher = fileWatchesOfAffectingLocations.get(resolutionHost.toPath(affectingLocation));
101303
+ watcher.refCount--;
101060
101304
  }
101061
101305
  }
101062
101306
  function removeDirectoryWatcher(dirPath) {
@@ -101126,7 +101370,7 @@ var ts;
101126
101370
  }
101127
101371
  function scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, isCreatingWatchedDirectory) {
101128
101372
  if (isCreatingWatchedDirectory) {
101129
- (isInDirectoryChecks || (isInDirectoryChecks = [])).push(fileOrDirectoryPath);
101373
+ (isInDirectoryChecks || (isInDirectoryChecks = new ts.Set())).add(fileOrDirectoryPath);
101130
101374
  }
101131
101375
  else {
101132
101376
  var updatedPath = removeIgnoredPath(fileOrDirectoryPath);
@@ -101139,7 +101383,7 @@ var ts;
101139
101383
  var dirOfFileOrDirectory = ts.getDirectoryPath(fileOrDirectoryPath);
101140
101384
  if (isNodeModulesAtTypesDirectory(fileOrDirectoryPath) || ts.isNodeModulesDirectory(fileOrDirectoryPath) ||
101141
101385
  isNodeModulesAtTypesDirectory(dirOfFileOrDirectory) || ts.isNodeModulesDirectory(dirOfFileOrDirectory)) {
101142
- (failedLookupChecks || (failedLookupChecks = [])).push(fileOrDirectoryPath);
101386
+ (failedLookupChecks || (failedLookupChecks = new ts.Set())).add(fileOrDirectoryPath);
101143
101387
  (startsWithPathChecks || (startsWithPathChecks = new ts.Set())).add(fileOrDirectoryPath);
101144
101388
  }
101145
101389
  else {
@@ -101149,7 +101393,7 @@ var ts;
101149
101393
  if (ts.isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
101150
101394
  return false;
101151
101395
  }
101152
- (failedLookupChecks || (failedLookupChecks = [])).push(fileOrDirectoryPath);
101396
+ (failedLookupChecks || (failedLookupChecks = new ts.Set())).add(fileOrDirectoryPath);
101153
101397
  var packagePath = ts.parseNodeModuleFromPath(fileOrDirectoryPath);
101154
101398
  if (packagePath)
101155
101399
  (startsWithPathChecks || (startsWithPathChecks = new ts.Set())).add(packagePath);
@@ -101158,21 +101402,32 @@ var ts;
101158
101402
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
101159
101403
  }
101160
101404
  function invalidateResolutionsOfFailedLookupLocations() {
101161
- if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks) {
101405
+ if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks && !affectingPathChecks) {
101162
101406
  return false;
101163
101407
  }
101164
101408
  var invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution);
101165
101409
  failedLookupChecks = undefined;
101166
101410
  startsWithPathChecks = undefined;
101167
101411
  isInDirectoryChecks = undefined;
101412
+ invalidated = invalidateResolutions(resolutionsWithOnlyAffectingLocations, canInvalidatedFailedLookupResolutionWithAffectingLocation) || invalidated;
101413
+ affectingPathChecks = undefined;
101168
101414
  return invalidated;
101169
101415
  }
101170
101416
  function canInvalidateFailedLookupResolution(resolution) {
101417
+ if (canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution))
101418
+ return true;
101419
+ if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
101420
+ return false;
101171
101421
  return resolution.failedLookupLocations.some(function (location) {
101172
101422
  var locationPath = resolutionHost.toPath(location);
101173
- return ts.contains(failedLookupChecks, locationPath) ||
101423
+ return (failedLookupChecks === null || failedLookupChecks === void 0 ? void 0 : failedLookupChecks.has(locationPath)) ||
101174
101424
  ts.firstDefinedIterator((startsWithPathChecks === null || startsWithPathChecks === void 0 ? void 0 : startsWithPathChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return ts.startsWith(locationPath, fileOrDirectoryPath) ? true : undefined; }) ||
101175
- (isInDirectoryChecks === null || isInDirectoryChecks === void 0 ? void 0 : isInDirectoryChecks.some(function (fileOrDirectoryPath) { return isInDirectoryPath(fileOrDirectoryPath, locationPath); }));
101425
+ ts.firstDefinedIterator((isInDirectoryChecks === null || isInDirectoryChecks === void 0 ? void 0 : isInDirectoryChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : undefined; });
101426
+ });
101427
+ }
101428
+ function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
101429
+ return !!affectingPathChecks && resolution.affectingLocations.some(function (location) {
101430
+ return affectingPathChecks.has(resolutionHost.toPath(location));
101176
101431
  });
101177
101432
  }
101178
101433
  function closeTypeRootsWatch() {
@@ -101475,9 +101730,9 @@ var ts;
101475
101730
  var targets = importedFileNames.map(function (f) { return ts.getNormalizedAbsolutePath(f, cwd); });
101476
101731
  var shouldFilterIgnoredPaths = !ts.every(targets, ts.containsIgnoredPath);
101477
101732
  if (!preferSymlinks) {
101478
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
101479
- if (result_15)
101480
- return result_15;
101733
+ var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
101734
+ if (result_16)
101735
+ return result_16;
101481
101736
  }
101482
101737
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
101483
101738
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -101496,10 +101751,10 @@ var ts;
101496
101751
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
101497
101752
  var symlinkDirectory = symlinkDirectories_1[_i];
101498
101753
  var option = ts.resolvePath(symlinkDirectory, relative);
101499
- var result_16 = cb(option, target === referenceRedirect);
101754
+ var result_17 = cb(option, target === referenceRedirect);
101500
101755
  shouldFilterIgnoredPaths = true;
101501
- if (result_16)
101502
- return result_16;
101756
+ if (result_17)
101757
+ return result_17;
101503
101758
  }
101504
101759
  });
101505
101760
  });
@@ -102331,6 +102586,7 @@ var ts;
102331
102586
  readDirectory: ts.maybeBind(host, host.readDirectory),
102332
102587
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
102333
102588
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
102589
+ now: ts.maybeBind(host, host.now),
102334
102590
  };
102335
102591
  function writeFile(fileName, text, writeByteOrderMark, onError) {
102336
102592
  try {
@@ -102385,6 +102641,7 @@ var ts;
102385
102641
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
102386
102642
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
102387
102643
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
102644
+ now: ts.maybeBind(system, system.now),
102388
102645
  };
102389
102646
  }
102390
102647
  ts.createProgramHost = createProgramHost;
@@ -102440,20 +102697,26 @@ var ts;
102440
102697
  var ts;
102441
102698
  (function (ts) {
102442
102699
  function readBuilderProgram(compilerOptions, host) {
102443
- if (ts.outFile(compilerOptions))
102444
- return undefined;
102445
102700
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
102446
102701
  if (!buildInfoPath)
102447
102702
  return undefined;
102448
- var content = host.readFile(buildInfoPath);
102449
- if (!content)
102450
- return undefined;
102451
- var buildInfo = ts.getBuildInfo(content);
102703
+ var buildInfo;
102704
+ if (host.getBuildInfo) {
102705
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
102706
+ if (!buildInfo)
102707
+ return undefined;
102708
+ }
102709
+ else {
102710
+ var content = host.readFile(buildInfoPath);
102711
+ if (!content)
102712
+ return undefined;
102713
+ buildInfo = ts.getBuildInfo(content);
102714
+ }
102452
102715
  if (buildInfo.version !== ts.version)
102453
102716
  return undefined;
102454
102717
  if (!buildInfo.program)
102455
102718
  return undefined;
102456
- return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
102719
+ return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
102457
102720
  }
102458
102721
  ts.readBuilderProgram = readBuilderProgram;
102459
102722
  function createIncrementalCompilerHost(options, system) {
@@ -102462,6 +102725,7 @@ var ts;
102462
102725
  host.createHash = ts.maybeBind(system, system.createHash);
102463
102726
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
102464
102727
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
102728
+ host.now = ts.maybeBind(system, system.now);
102465
102729
  ts.setGetSourceFileAsHashVersioned(host, system);
102466
102730
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
102467
102731
  return host;
@@ -102506,7 +102770,6 @@ var ts;
102506
102770
  var builderProgram;
102507
102771
  var reloadLevel;
102508
102772
  var missingFilesMap;
102509
- var packageJsonMap;
102510
102773
  var watchedWildcardDirectories;
102511
102774
  var timerToUpdateProgram;
102512
102775
  var timerToInvalidateFailedLookupResolutions;
@@ -102567,6 +102830,7 @@ var ts;
102567
102830
  compilerHost.getCompilationSettings = function () { return compilerOptions; };
102568
102831
  compilerHost.useSourceOfProjectReferenceRedirect = ts.maybeBind(host, host.useSourceOfProjectReferenceRedirect);
102569
102832
  compilerHost.watchDirectoryOfFailedLookupLocation = function (dir, cb, flags) { return watchDirectory(dir, cb, flags, watchOptions, ts.WatchType.FailedLookupLocations); };
102833
+ compilerHost.watchAffectingFileLocation = function (file, cb) { return watchFile(file, cb, ts.PollingInterval.High, watchOptions, ts.WatchType.PackageJson); };
102570
102834
  compilerHost.watchTypeRootsDirectory = function (dir, cb, flags) { return watchDirectory(dir, cb, flags, watchOptions, ts.WatchType.TypeRoots); };
102571
102835
  compilerHost.getCachedDirectoryStructureHost = function () { return cachedDirectoryStructureHost; };
102572
102836
  compilerHost.scheduleInvalidateResolutionsOfFailedLookupLocations = scheduleInvalidateResolutionsOfFailedLookupLocations;
@@ -102644,10 +102908,6 @@ var ts;
102644
102908
  });
102645
102909
  parsedConfigs = undefined;
102646
102910
  }
102647
- if (packageJsonMap) {
102648
- ts.clearMap(packageJsonMap, ts.closeFileWatcher);
102649
- packageJsonMap = undefined;
102650
- }
102651
102911
  }
102652
102912
  function getCurrentBuilderProgram() {
102653
102913
  return builderProgram;
@@ -102701,13 +102961,8 @@ var ts;
102701
102961
  compilerHost.hasInvalidatedResolution = hasInvalidatedResolution;
102702
102962
  compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
102703
102963
  builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
102704
- var packageCacheEntries = ts.map(resolutionCache.getModuleResolutionCache().getPackageJsonInfoCache().entries(), function (_a) {
102705
- var path = _a[0], data = _a[1];
102706
- return [compilerHost.realpath ? toPath(compilerHost.realpath(path)) : path, data];
102707
- });
102708
102964
  resolutionCache.finishCachingPerDirectoryResolution();
102709
102965
  ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = new ts.Map()), watchMissingFilePath);
102710
- ts.updatePackageJsonWatch(packageCacheEntries, packageJsonMap || (packageJsonMap = new ts.Map()), watchPackageJsonLookupPath);
102711
102966
  if (needsUpdateInTypeRootWatch) {
102712
102967
  resolutionCache.updateTypeRootsWatch();
102713
102968
  }
@@ -102984,17 +103239,6 @@ var ts;
102984
103239
  ts.noopFileWatcher :
102985
103240
  watchFilePath(missingFilePath, missingFilePath, onMissingFileChange, ts.PollingInterval.Medium, watchOptions, ts.WatchType.MissingFile);
102986
103241
  }
102987
- function watchPackageJsonLookupPath(packageJsonPath) {
102988
- return sourceFilesCache.has(packageJsonPath) ?
102989
- ts.noopFileWatcher :
102990
- watchFilePath(packageJsonPath, packageJsonPath, onPackageJsonChange, ts.PollingInterval.High, watchOptions, ts.WatchType.PackageJson);
102991
- }
102992
- function onPackageJsonChange(fileName, eventKind, path) {
102993
- updateCachedSystemWithFile(fileName, path, eventKind);
102994
- reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
102995
- changesAffectResolution = true;
102996
- scheduleProgramUpdate();
102997
- }
102998
103242
  function onMissingFileChange(fileName, eventKind, missingFilePath) {
102999
103243
  updateCachedSystemWithFile(fileName, missingFilePath, eventKind);
103000
103244
  if (eventKind === ts.FileWatcherEventKind.Created && missingFilesMap.has(missingFilePath)) {
@@ -103125,11 +103369,14 @@ var ts;
103125
103369
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
103126
103370
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
103127
103371
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
103128
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
103129
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
103130
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
103131
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
103132
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
103372
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
103373
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
103374
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
103375
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
103376
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
103377
+ UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
103378
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
103379
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
103133
103380
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
103134
103381
  function resolveConfigFileProjectName(project) {
103135
103382
  if (ts.fileExtensionIs(project, ".json")) {
@@ -103167,9 +103414,10 @@ var ts;
103167
103414
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
103168
103415
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
103169
103416
  }
103170
- function newer(date1, date2) {
103171
- return date2 > date1 ? date2 : date1;
103417
+ function getCurrentTime(host) {
103418
+ return host.now ? host.now() : new Date();
103172
103419
  }
103420
+ ts.getCurrentTime = getCurrentTime;
103173
103421
  function isCircularBuildOrder(buildOrder) {
103174
103422
  return !!buildOrder && !!buildOrder.buildOrder;
103175
103423
  }
@@ -103253,6 +103501,7 @@ var ts;
103253
103501
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
103254
103502
  };
103255
103503
  }
103504
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), undefined); };
103256
103505
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
103257
103506
  var state = {
103258
103507
  host: host,
@@ -103268,8 +103517,9 @@ var ts;
103268
103517
  resolvedConfigFilePaths: new ts.Map(),
103269
103518
  configFileCache: new ts.Map(),
103270
103519
  projectStatus: new ts.Map(),
103271
- buildInfoChecked: new ts.Map(),
103272
103520
  extendedConfigCache: new ts.Map(),
103521
+ buildInfoCache: new ts.Map(),
103522
+ outputTimeStamps: new ts.Map(),
103273
103523
  builderPrograms: new ts.Map(),
103274
103524
  diagnostics: new ts.Map(),
103275
103525
  projectPendingBuild: new ts.Map(),
@@ -103290,6 +103540,7 @@ var ts;
103290
103540
  allWatchedConfigFiles: new ts.Map(),
103291
103541
  allWatchedExtendedConfigFiles: new ts.Map(),
103292
103542
  allWatchedPackageJsonFiles: new ts.Map(),
103543
+ filesWatched: new ts.Map(),
103293
103544
  lastCachedPackageJsonLookups: new ts.Map(),
103294
103545
  timerToBuildInvalidatedProject: undefined,
103295
103546
  reportFileChangeDetected: false,
@@ -103391,11 +103642,12 @@ var ts;
103391
103642
  var noopOnDelete = { onDeleteValue: ts.noop };
103392
103643
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
103393
103644
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
103394
- ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
103395
103645
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
103396
103646
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
103397
103647
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
103398
103648
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
103649
+ ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
103650
+ ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
103399
103651
  if (state.watch) {
103400
103652
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
103401
103653
  state.allWatchedExtendedConfigFiles.forEach(function (watcher) {
@@ -103680,16 +103932,16 @@ var ts;
103680
103932
  }
103681
103933
  function emit(writeFileCallback, cancellationToken, customTransformers) {
103682
103934
  var _a;
103683
- var _b, _c;
103935
+ var _b, _c, _d;
103684
103936
  ts.Debug.assertIsDefined(program);
103685
103937
  ts.Debug.assert(step === BuildStep.Emit);
103686
- program.backupState();
103938
+ var saved = program.saveEmitState();
103687
103939
  var declDiagnostics;
103688
103940
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
103689
103941
  var outputFiles = [];
103690
- var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, undefined, undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken, false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
103942
+ var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, undefined, 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, false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
103691
103943
  if (declDiagnostics) {
103692
- program.restoreState();
103944
+ program.restoreEmitState(saved);
103693
103945
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
103694
103946
  return {
103695
103947
  emitSkipped: true,
@@ -103698,35 +103950,43 @@ var ts;
103698
103950
  }
103699
103951
  var host = state.host, compilerHost = state.compilerHost;
103700
103952
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
103701
- var newestDeclarationFileContentChangedTime = minimumDate;
103702
- var anyDtsChanged = false;
103953
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
103703
103954
  var emitterDiagnostics = ts.createDiagnosticCollection();
103704
103955
  var emittedOutputs = new ts.Map();
103956
+ var options = program.getCompilerOptions();
103957
+ var isIncremental = ts.isIncrementalCompilation(options);
103958
+ var outputTimeStampMap;
103959
+ var now;
103705
103960
  outputFiles.forEach(function (_a) {
103706
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
103707
- var priorChangeTime;
103708
- if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
103709
- if (host.fileExists(name) && state.readFileWithCache(name) === text) {
103710
- priorChangeTime = host.getModifiedTime(name);
103711
- }
103712
- else {
103961
+ var _b, _c;
103962
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
103963
+ var path = toPath(state, name);
103964
+ emittedOutputs.set(toPath(state, name), name);
103965
+ if (buildInfo) {
103966
+ setBuildInfo(state, buildInfo, projectPath, options);
103967
+ 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)) {
103713
103968
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
103714
- anyDtsChanged = true;
103715
103969
  }
103716
103970
  }
103717
- emittedOutputs.set(toPath(state, name), name);
103718
103971
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
103719
- if (priorChangeTime !== undefined) {
103720
- newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
103972
+ if (!isIncremental && state.watch) {
103973
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
103721
103974
  }
103722
103975
  });
103723
- finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime, anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
103976
+ finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
103724
103977
  return emitResult;
103725
103978
  }
103726
103979
  function emitBuildInfo(writeFileCallback, cancellationToken) {
103727
103980
  ts.Debug.assertIsDefined(program);
103728
103981
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
103729
- var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
103982
+ var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
103983
+ if (data === null || data === void 0 ? void 0 : data.buildInfo)
103984
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
103985
+ if (writeFileCallback)
103986
+ writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
103987
+ else
103988
+ state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
103989
+ }, cancellationToken);
103730
103990
  if (emitResult.diagnostics.length) {
103731
103991
  reportErrors(state, emitResult.diagnostics);
103732
103992
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -103739,7 +103999,7 @@ var ts;
103739
103999
  step = BuildStep.QueueReferencingProjects;
103740
104000
  return emitResult;
103741
104001
  }
103742
- function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
104002
+ function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
103743
104003
  var _a;
103744
104004
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
103745
104005
  if (emitDiagnostics.length) {
@@ -103749,13 +104009,11 @@ var ts;
103749
104009
  if (state.write) {
103750
104010
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
103751
104011
  }
103752
- var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
104012
+ updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
103753
104013
  state.diagnostics.delete(projectPath);
103754
104014
  state.projectStatus.set(projectPath, {
103755
104015
  type: ts.UpToDateStatusType.UpToDate,
103756
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
103757
- maximumDate :
103758
- newestDeclarationFileContentChangedTime,
104016
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
103759
104017
  oldestOutputFileName: oldestOutputFileName
103760
104018
  });
103761
104019
  afterProgramDone(state, program, config);
@@ -103788,12 +104046,21 @@ var ts;
103788
104046
  ts.Debug.assert(!!outputFiles.length);
103789
104047
  var emitterDiagnostics = ts.createDiagnosticCollection();
103790
104048
  var emittedOutputs = new ts.Map();
104049
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
104050
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
103791
104051
  outputFiles.forEach(function (_a) {
103792
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
104052
+ var _b, _c;
104053
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
103793
104054
  emittedOutputs.set(toPath(state, name), name);
104055
+ if (buildInfo) {
104056
+ setBuildInfo(state, buildInfo, projectPath, config.options);
104057
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
104058
+ resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
104059
+ }
104060
+ }
103794
104061
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
103795
104062
  });
103796
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate, false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
104063
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
103797
104064
  return { emitSkipped: false, diagnostics: emitDiagnostics };
103798
104065
  }
103799
104066
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -103888,7 +104155,7 @@ var ts;
103888
104155
  }
103889
104156
  continue;
103890
104157
  }
103891
- if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
104158
+ if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
103892
104159
  reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
103893
104160
  return {
103894
104161
  kind: InvalidatedProjectKind.UpdateOutputFileStamps,
@@ -103972,7 +104239,7 @@ var ts;
103972
104239
  state.projectCompilerOptions = state.baseCompilerOptions;
103973
104240
  }
103974
104241
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
103975
- var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
104242
+ var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
103976
104243
  reportAndStoreErrors(state, resolvedPath, diagnostics);
103977
104244
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
103978
104245
  if (canEmitBuildInfo)
@@ -103980,8 +104247,94 @@ var ts;
103980
104247
  afterProgramDone(state, program, config);
103981
104248
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
103982
104249
  }
104250
+ function isFileWatcherWithModifiedTime(value) {
104251
+ return !!value.watcher;
104252
+ }
104253
+ function getModifiedTime(state, fileName) {
104254
+ var path = toPath(state, fileName);
104255
+ var existing = state.filesWatched.get(path);
104256
+ if (state.watch && !!existing) {
104257
+ if (!isFileWatcherWithModifiedTime(existing))
104258
+ return existing;
104259
+ if (existing.modifiedTime)
104260
+ return existing.modifiedTime;
104261
+ }
104262
+ var result = ts.getModifiedTime(state.host, fileName);
104263
+ if (state.watch) {
104264
+ if (existing)
104265
+ existing.modifiedTime = result;
104266
+ else
104267
+ state.filesWatched.set(path, result);
104268
+ }
104269
+ return result;
104270
+ }
104271
+ function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
104272
+ var path = toPath(state, file);
104273
+ var existing = state.filesWatched.get(path);
104274
+ if (existing && isFileWatcherWithModifiedTime(existing)) {
104275
+ existing.callbacks.push(callback);
104276
+ }
104277
+ else {
104278
+ var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
104279
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
104280
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
104281
+ existing.modifiedTime = modifiedTime;
104282
+ existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
104283
+ }, pollingInterval, options, watchType, project);
104284
+ state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
104285
+ }
104286
+ return {
104287
+ close: function () {
104288
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
104289
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
104290
+ if (existing.callbacks.length === 1) {
104291
+ state.filesWatched.delete(path);
104292
+ ts.closeFileWatcherOf(existing);
104293
+ }
104294
+ else {
104295
+ ts.unorderedRemoveItem(existing.callbacks, callback);
104296
+ }
104297
+ }
104298
+ };
104299
+ }
104300
+ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
104301
+ if (!state.watch)
104302
+ return undefined;
104303
+ var result = state.outputTimeStamps.get(resolvedConfigFilePath);
104304
+ if (!result)
104305
+ state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
104306
+ return result;
104307
+ }
104308
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
104309
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
104310
+ var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
104311
+ if (existing) {
104312
+ existing.buildInfo = buildInfo;
104313
+ existing.modifiedTime = getCurrentTime(state.host);
104314
+ }
104315
+ else {
104316
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
104317
+ }
104318
+ }
104319
+ function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
104320
+ var path = toPath(state, buildInfoPath);
104321
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
104322
+ return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
104323
+ }
104324
+ function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
104325
+ var path = toPath(state, buildInfoPath);
104326
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
104327
+ if (existing !== undefined && existing.path === path) {
104328
+ return existing.buildInfo || undefined;
104329
+ }
104330
+ var value = state.readFileWithCache(buildInfoPath);
104331
+ var buildInfo = value ? ts.getBuildInfo(value) : undefined;
104332
+ ts.Debug.assert(modifiedTime || !buildInfo);
104333
+ state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
104334
+ return buildInfo;
104335
+ }
103983
104336
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
103984
- var tsconfigTime = ts.getModifiedTime(state.host, configFile);
104337
+ var tsconfigTime = getModifiedTime(state, configFile);
103985
104338
  if (oldestOutputFileTime < tsconfigTime) {
103986
104339
  return {
103987
104340
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -103991,76 +104344,22 @@ var ts;
103991
104344
  }
103992
104345
  }
103993
104346
  function getUpToDateStatusWorker(state, project, resolvedPath) {
103994
- var force = !!state.options.force;
103995
- var newestInputFileName = undefined;
103996
- var newestInputFileTime = minimumDate;
103997
- var host = state.host;
103998
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
103999
- var inputFile = _a[_i];
104000
- if (!host.fileExists(inputFile)) {
104001
- return {
104002
- type: ts.UpToDateStatusType.Unbuildable,
104003
- reason: inputFile + " does not exist"
104004
- };
104005
- }
104006
- if (!force) {
104007
- var inputTime = ts.getModifiedTime(host, inputFile);
104008
- if (inputTime > newestInputFileTime) {
104009
- newestInputFileName = inputFile;
104010
- newestInputFileTime = inputTime;
104011
- }
104012
- }
104013
- }
104347
+ var _a, _b, _c;
104014
104348
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
104015
104349
  return {
104016
104350
  type: ts.UpToDateStatusType.ContainerOnly
104017
104351
  };
104018
104352
  }
104019
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
104020
- var oldestOutputFileName = "(none)";
104021
- var oldestOutputFileTime = maximumDate;
104022
- var newestOutputFileName = "(none)";
104023
- var newestOutputFileTime = minimumDate;
104024
- var missingOutputFileName;
104025
- var newestDeclarationFileContentChangedTime = minimumDate;
104026
- var isOutOfDateWithInputs = false;
104027
- if (!force) {
104028
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
104029
- var output = outputs_1[_b];
104030
- if (!host.fileExists(output)) {
104031
- missingOutputFileName = output;
104032
- break;
104033
- }
104034
- var outputTime = ts.getModifiedTime(host, output);
104035
- if (outputTime < oldestOutputFileTime) {
104036
- oldestOutputFileTime = outputTime;
104037
- oldestOutputFileName = output;
104038
- }
104039
- if (outputTime < newestInputFileTime) {
104040
- isOutOfDateWithInputs = true;
104041
- break;
104042
- }
104043
- if (outputTime > newestOutputFileTime) {
104044
- newestOutputFileTime = outputTime;
104045
- newestOutputFileName = output;
104046
- }
104047
- if (ts.isDeclarationFileName(output)) {
104048
- var outputModifiedTime = ts.getModifiedTime(host, output);
104049
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
104050
- }
104051
- }
104052
- }
104053
- var pseudoUpToDate = false;
104054
- var usesPrepend = false;
104055
- var upstreamChangedProject;
104353
+ var referenceStatuses;
104354
+ var force = !!state.options.force;
104056
104355
  if (project.projectReferences) {
104057
104356
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
104058
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
104059
- var ref = _d[_c];
104060
- usesPrepend = usesPrepend || !!(ref.prepend);
104357
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
104358
+ var ref = _d[_i];
104061
104359
  var resolvedRef = ts.resolveProjectReferencePath(ref);
104062
104360
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
104063
- var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
104361
+ var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
104362
+ var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
104064
104363
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
104065
104364
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) {
104066
104365
  continue;
@@ -104079,65 +104378,169 @@ var ts;
104079
104378
  upstreamProjectName: ref.path
104080
104379
  };
104081
104380
  }
104082
- if (!force && !missingOutputFileName) {
104083
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
104084
- continue;
104085
- }
104086
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
104087
- pseudoUpToDate = true;
104088
- upstreamChangedProject = ref.path;
104089
- continue;
104090
- }
104091
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
104381
+ if (!force)
104382
+ (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
104383
+ }
104384
+ }
104385
+ if (force)
104386
+ return { type: ts.UpToDateStatusType.ForceBuild };
104387
+ var host = state.host;
104388
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
104389
+ var oldestOutputFileName;
104390
+ var oldestOutputFileTime = maximumDate;
104391
+ var buildInfoTime;
104392
+ var buildInfoProgram;
104393
+ var buildInfoVersionMap;
104394
+ var newestDeclarationFileContentChangedTime;
104395
+ if (buildInfoPath) {
104396
+ var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
104397
+ buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
104398
+ if (buildInfoTime === ts.missingFileModifiedTime) {
104399
+ if (!buildInfoCacheEntry_1) {
104400
+ state.buildInfoCache.set(resolvedPath, {
104401
+ path: toPath(state, buildInfoPath),
104402
+ buildInfo: false,
104403
+ modifiedTime: buildInfoTime
104404
+ });
104405
+ }
104406
+ return {
104407
+ type: ts.UpToDateStatusType.OutputMissing,
104408
+ missingOutputFileName: buildInfoPath
104409
+ };
104410
+ }
104411
+ var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
104412
+ if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
104413
+ return {
104414
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
104415
+ version: buildInfo.version
104416
+ };
104417
+ }
104418
+ if (buildInfo.program) {
104419
+ if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
104420
+ (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
104092
104421
  return {
104093
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
104094
- outOfDateOutputFileName: oldestOutputFileName,
104095
- newerProjectName: ref.path
104422
+ type: ts.UpToDateStatusType.OutOfDateBuildInfo,
104423
+ buildInfoFile: buildInfoPath
104096
104424
  };
104097
104425
  }
104426
+ buildInfoProgram = buildInfo.program;
104098
104427
  }
104428
+ oldestOutputFileTime = buildInfoTime;
104429
+ oldestOutputFileName = buildInfoPath;
104430
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
104099
104431
  }
104100
- if (missingOutputFileName !== undefined) {
104101
- return {
104102
- type: ts.UpToDateStatusType.OutputMissing,
104103
- missingOutputFileName: missingOutputFileName
104104
- };
104432
+ var newestInputFileName = undefined;
104433
+ var newestInputFileTime = minimumDate;
104434
+ var pseudoInputUpToDate = false;
104435
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
104436
+ var inputFile = _f[_e];
104437
+ var inputTime = getModifiedTime(state, inputFile);
104438
+ if (inputTime === ts.missingFileModifiedTime) {
104439
+ return {
104440
+ type: ts.UpToDateStatusType.Unbuildable,
104441
+ reason: inputFile + " does not exist"
104442
+ };
104443
+ }
104444
+ if (buildInfoTime && buildInfoTime < inputTime) {
104445
+ var version_3 = void 0;
104446
+ var currentVersion = void 0;
104447
+ if (buildInfoProgram) {
104448
+ if (!buildInfoVersionMap)
104449
+ buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
104450
+ version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
104451
+ var text = version_3 ? state.readFileWithCache(inputFile) : undefined;
104452
+ currentVersion = text && (host.createHash || ts.generateDjb2Hash)(text);
104453
+ if (version_3 && version_3 === currentVersion)
104454
+ pseudoInputUpToDate = true;
104455
+ }
104456
+ if (!version_3 || version_3 !== currentVersion) {
104457
+ return {
104458
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
104459
+ outOfDateOutputFileName: buildInfoPath,
104460
+ newerInputFileName: inputFile
104461
+ };
104462
+ }
104463
+ }
104464
+ if (inputTime > newestInputFileTime) {
104465
+ newestInputFileName = inputFile;
104466
+ newestInputFileTime = inputTime;
104467
+ }
104105
104468
  }
104106
- if (isOutOfDateWithInputs) {
104107
- return {
104108
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
104109
- outOfDateOutputFileName: oldestOutputFileName,
104110
- newerInputFileName: newestInputFileName
104111
- };
104469
+ if (!buildInfoPath) {
104470
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
104471
+ var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
104472
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
104473
+ var output = outputs_1[_g];
104474
+ var path = toPath(state, output);
104475
+ var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
104476
+ if (!outputTime) {
104477
+ outputTime = ts.getModifiedTime(state.host, output);
104478
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
104479
+ }
104480
+ if (outputTime === ts.missingFileModifiedTime) {
104481
+ return {
104482
+ type: ts.UpToDateStatusType.OutputMissing,
104483
+ missingOutputFileName: output
104484
+ };
104485
+ }
104486
+ if (outputTime < newestInputFileTime) {
104487
+ return {
104488
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
104489
+ outOfDateOutputFileName: output,
104490
+ newerInputFileName: newestInputFileName
104491
+ };
104492
+ }
104493
+ if (outputTime < oldestOutputFileTime) {
104494
+ oldestOutputFileTime = outputTime;
104495
+ oldestOutputFileName = output;
104496
+ }
104497
+ }
104112
104498
  }
104113
- else {
104114
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
104115
- if (configStatus)
104116
- return configStatus;
104117
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
104118
- if (extendedConfigStatus)
104119
- return extendedConfigStatus;
104120
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
104121
- var path = _a[0];
104122
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
104123
- });
104124
- if (dependentPackageFileStatus)
104125
- return dependentPackageFileStatus;
104126
- }
104127
- if (!force && !state.buildInfoChecked.has(resolvedPath)) {
104128
- state.buildInfoChecked.set(resolvedPath, true);
104129
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
104130
- if (buildInfoPath) {
104131
- var value = state.readFileWithCache(buildInfoPath);
104132
- var buildInfo = value && ts.getBuildInfo(value);
104133
- if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
104499
+ var seenRefs = buildInfoPath ? new ts.Set() : undefined;
104500
+ var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
104501
+ seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
104502
+ var pseudoUpToDate = false;
104503
+ var usesPrepend = false;
104504
+ var upstreamChangedProject;
104505
+ if (referenceStatuses) {
104506
+ for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
104507
+ var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
104508
+ usesPrepend = usesPrepend || !!(ref.prepend);
104509
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
104510
+ continue;
104511
+ }
104512
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
104134
104513
  return {
104135
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
104136
- version: buildInfo.version
104514
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
104515
+ outOfDateOutputFileName: buildInfoPath,
104516
+ newerProjectName: ref.path
104137
104517
  };
104138
104518
  }
104519
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
104520
+ pseudoUpToDate = true;
104521
+ upstreamChangedProject = ref.path;
104522
+ continue;
104523
+ }
104524
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
104525
+ return {
104526
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
104527
+ outOfDateOutputFileName: oldestOutputFileName,
104528
+ newerProjectName: ref.path
104529
+ };
104139
104530
  }
104140
104531
  }
104532
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
104533
+ if (configStatus)
104534
+ return configStatus;
104535
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
104536
+ if (extendedConfigStatus)
104537
+ return extendedConfigStatus;
104538
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
104539
+ var path = _a[0];
104540
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
104541
+ });
104542
+ if (dependentPackageFileStatus)
104543
+ return dependentPackageFileStatus;
104141
104544
  if (usesPrepend && pseudoUpToDate) {
104142
104545
  return {
104143
104546
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -104146,15 +104549,36 @@ var ts;
104146
104549
  };
104147
104550
  }
104148
104551
  return {
104149
- type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
104552
+ type: pseudoUpToDate ?
104553
+ ts.UpToDateStatusType.UpToDateWithUpstreamTypes :
104554
+ pseudoInputUpToDate ?
104555
+ ts.UpToDateStatusType.UpToDateWithInputFileText :
104556
+ ts.UpToDateStatusType.UpToDate,
104150
104557
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
104151
104558
  newestInputFileTime: newestInputFileTime,
104152
- newestOutputFileTime: newestOutputFileTime,
104153
104559
  newestInputFileName: newestInputFileName,
104154
- newestOutputFileName: newestOutputFileName,
104155
104560
  oldestOutputFileName: oldestOutputFileName
104156
104561
  };
104157
104562
  }
104563
+ function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
104564
+ if (seenRefs.has(resolvedRefPath))
104565
+ return false;
104566
+ seenRefs.add(resolvedRefPath);
104567
+ var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
104568
+ if (refBuildInfo.path === buildInfoCacheEntry.path)
104569
+ return true;
104570
+ if (resolvedConfig.projectReferences) {
104571
+ for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
104572
+ var ref = _a[_i];
104573
+ var resolvedRef = ts.resolveProjectReferencePath(ref);
104574
+ var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
104575
+ var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
104576
+ if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
104577
+ return true;
104578
+ }
104579
+ }
104580
+ return false;
104581
+ }
104158
104582
  function getUpToDateStatus(state, project, resolvedPath) {
104159
104583
  if (project === undefined) {
104160
104584
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -104167,39 +104591,64 @@ var ts;
104167
104591
  state.projectStatus.set(resolvedPath, actual);
104168
104592
  return actual;
104169
104593
  }
104170
- function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
104594
+ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
104171
104595
  if (proj.options.noEmit)
104172
- return priorNewestUpdateTime;
104596
+ return;
104597
+ var now;
104598
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
104599
+ if (buildInfoPath) {
104600
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
104601
+ if (!!state.options.verbose)
104602
+ reportStatus(state, verboseMessage, proj.options.configFilePath);
104603
+ state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
104604
+ getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
104605
+ }
104606
+ state.outputTimeStamps.delete(projectPath);
104607
+ return;
104608
+ }
104173
104609
  var host = state.host;
104174
104610
  var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
104611
+ var outputTimeStampMap = getOutputTimeStampMap(state, projectPath);
104612
+ var modifiedOutputs = outputTimeStampMap ? new ts.Set() : undefined;
104175
104613
  if (!skipOutputs || outputs.length !== skipOutputs.size) {
104176
104614
  var reportVerbose = !!state.options.verbose;
104177
- var now = host.now ? host.now() : new Date();
104178
104615
  for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
104179
104616
  var file = outputs_2[_i];
104180
- if (skipOutputs && skipOutputs.has(toPath(state, file))) {
104617
+ var path = toPath(state, file);
104618
+ if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
104181
104619
  continue;
104182
- }
104183
104620
  if (reportVerbose) {
104184
104621
  reportVerbose = false;
104185
104622
  reportStatus(state, verboseMessage, proj.options.configFilePath);
104186
104623
  }
104187
- if (ts.isDeclarationFileName(file)) {
104188
- priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
104624
+ host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
104625
+ if (outputTimeStampMap) {
104626
+ outputTimeStampMap.set(path, now);
104627
+ modifiedOutputs.add(path);
104189
104628
  }
104190
- host.setModifiedTime(file, now);
104191
104629
  }
104192
104630
  }
104193
- return priorNewestUpdateTime;
104631
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.forEach(function (_value, key) {
104632
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs.has(key))
104633
+ outputTimeStampMap.delete(key);
104634
+ });
104635
+ }
104636
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
104637
+ var _a;
104638
+ if (!options.composite)
104639
+ return undefined;
104640
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
104641
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, undefined);
104642
+ 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;
104194
104643
  }
104195
104644
  function updateOutputTimestamps(state, proj, resolvedPath) {
104196
104645
  if (state.options.dry) {
104197
104646
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
104198
104647
  }
104199
- var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
104648
+ updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
104200
104649
  state.projectStatus.set(resolvedPath, {
104201
104650
  type: ts.UpToDateStatusType.UpToDate,
104202
- newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
104651
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
104203
104652
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
104204
104653
  });
104205
104654
  }
@@ -104238,6 +104687,7 @@ var ts;
104238
104687
  }
104239
104688
  break;
104240
104689
  }
104690
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
104241
104691
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
104242
104692
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
104243
104693
  if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
@@ -104392,12 +104842,10 @@ var ts;
104392
104842
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
104393
104843
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
104394
104844
  return;
104395
- state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
104396
- invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
104397
- }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
104845
+ 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));
104398
104846
  }
104399
104847
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
104400
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
104848
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
104401
104849
  var _a;
104402
104850
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
104403
104851
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -104429,7 +104877,7 @@ var ts;
104429
104877
  if (!state.watch)
104430
104878
  return;
104431
104879
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
104432
- 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); },
104880
+ 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); },
104433
104881
  onDeleteValue: ts.closeFileWatcher,
104434
104882
  });
104435
104883
  }
@@ -104437,7 +104885,7 @@ var ts;
104437
104885
  if (!state.watch || !state.lastCachedPackageJsonLookups)
104438
104886
  return;
104439
104887
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
104440
- 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); },
104888
+ createNewValue: function (path, _input) { return watchFile(state, path, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.None); }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.PackageJson, resolved); },
104441
104889
  onDeleteValue: ts.closeFileWatcher,
104442
104890
  });
104443
104891
  }
@@ -104559,25 +105007,26 @@ var ts;
104559
105007
  }
104560
105008
  }
104561
105009
  function reportUpToDateStatus(state, configFileName, status) {
104562
- if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
104563
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
104564
- }
104565
105010
  switch (status.type) {
104566
105011
  case ts.UpToDateStatusType.OutOfDateWithSelf:
104567
- 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));
105012
+ 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));
104568
105013
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
104569
- 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));
105014
+ 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));
104570
105015
  case ts.UpToDateStatusType.OutputMissing:
104571
105016
  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));
105017
+ case ts.UpToDateStatusType.OutOfDateBuildInfo:
105018
+ return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile));
104572
105019
  case ts.UpToDateStatusType.UpToDate:
104573
105020
  if (status.newestInputFileTime !== undefined) {
104574
- 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 || ""));
105021
+ 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 || ""));
104575
105022
  }
104576
105023
  break;
104577
105024
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
104578
105025
  return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed, relName(state, configFileName), relName(state, status.newerProjectName));
104579
105026
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
104580
105027
  return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
105028
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
105029
+ return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files, relName(state, configFileName));
104581
105030
  case ts.UpToDateStatusType.UpstreamOutOfDate:
104582
105031
  return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date, relName(state, configFileName), relName(state, status.upstreamProjectName));
104583
105032
  case ts.UpToDateStatusType.UpstreamBlocked:
@@ -104588,6 +105037,8 @@ var ts;
104588
105037
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
104589
105038
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
104590
105039
  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);
105040
+ case ts.UpToDateStatusType.ForceBuild:
105041
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
104591
105042
  case ts.UpToDateStatusType.ContainerOnly:
104592
105043
  case ts.UpToDateStatusType.ComputingUpstream:
104593
105044
  break;