typescript 4.8.0-dev.20220605 → 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.20220605";
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
  }
@@ -31542,6 +31574,7 @@ var ts;
31542
31574
  ["es2022.error", "lib.es2022.error.d.ts"],
31543
31575
  ["es2022.intl", "lib.es2022.intl.d.ts"],
31544
31576
  ["es2022.object", "lib.es2022.object.d.ts"],
31577
+ ["es2022.sharedmemory", "lib.es2022.sharedmemory.d.ts"],
31545
31578
  ["es2022.string", "lib.es2022.string.d.ts"],
31546
31579
  ["esnext.array", "lib.es2022.array.d.ts"],
31547
31580
  ["esnext.symbol", "lib.es2019.symbol.d.ts"],
@@ -31741,6 +31774,7 @@ var ts;
31741
31774
  type: "boolean",
31742
31775
  affectsSemanticDiagnostics: true,
31743
31776
  affectsEmit: true,
31777
+ affectsMultiFileEmitBuildInfo: true,
31744
31778
  category: ts.Diagnostics.Watch_and_Build_Modes,
31745
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,
31746
31780
  defaultValueDescription: false,
@@ -31774,12 +31808,39 @@ var ts;
31774
31808
  affectsSourceFile: true,
31775
31809
  affectsModuleResolution: true,
31776
31810
  affectsEmit: true,
31811
+ affectsMultiFileEmitBuildInfo: true,
31777
31812
  paramType: ts.Diagnostics.VERSION,
31778
31813
  showInSimplifiedHelpView: true,
31779
31814
  category: ts.Diagnostics.Language_and_Environment,
31780
31815
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
31781
31816
  defaultValueDescription: 0,
31782
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
+ };
31783
31844
  var commandOptionsWithoutBuild = [
31784
31845
  {
31785
31846
  name: "all",
@@ -31840,36 +31901,13 @@ var ts;
31840
31901
  category: ts.Diagnostics.Command_line_Options,
31841
31902
  affectsSemanticDiagnostics: true,
31842
31903
  affectsEmit: true,
31904
+ affectsMultiFileEmitBuildInfo: true,
31843
31905
  isCommandLineOnly: true,
31844
31906
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
31845
31907
  defaultValueDescription: false,
31846
31908
  },
31847
31909
  ts.targetOptionDeclaration,
31848
- {
31849
- name: "module",
31850
- shortName: "m",
31851
- type: new ts.Map(ts.getEntries({
31852
- none: ts.ModuleKind.None,
31853
- commonjs: ts.ModuleKind.CommonJS,
31854
- amd: ts.ModuleKind.AMD,
31855
- system: ts.ModuleKind.System,
31856
- umd: ts.ModuleKind.UMD,
31857
- es6: ts.ModuleKind.ES2015,
31858
- es2015: ts.ModuleKind.ES2015,
31859
- es2020: ts.ModuleKind.ES2020,
31860
- es2022: ts.ModuleKind.ES2022,
31861
- esnext: ts.ModuleKind.ESNext,
31862
- node16: ts.ModuleKind.Node16,
31863
- nodenext: ts.ModuleKind.NodeNext,
31864
- })),
31865
- affectsModuleResolution: true,
31866
- affectsEmit: true,
31867
- paramType: ts.Diagnostics.KIND,
31868
- showInSimplifiedHelpView: true,
31869
- category: ts.Diagnostics.Modules,
31870
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
31871
- defaultValueDescription: undefined,
31872
- },
31910
+ ts.moduleOptionDeclaration,
31873
31911
  {
31874
31912
  name: "lib",
31875
31913
  type: "list",
@@ -31906,6 +31944,7 @@ var ts;
31906
31944
  type: jsxOptionMap,
31907
31945
  affectsSourceFile: true,
31908
31946
  affectsEmit: true,
31947
+ affectsMultiFileEmitBuildInfo: true,
31909
31948
  affectsModuleResolution: true,
31910
31949
  paramType: ts.Diagnostics.KIND,
31911
31950
  showInSimplifiedHelpView: true,
@@ -31918,6 +31957,7 @@ var ts;
31918
31957
  shortName: "d",
31919
31958
  type: "boolean",
31920
31959
  affectsEmit: true,
31960
+ affectsMultiFileEmitBuildInfo: true,
31921
31961
  showInSimplifiedHelpView: true,
31922
31962
  category: ts.Diagnostics.Emit,
31923
31963
  transpileOptionValue: undefined,
@@ -31928,6 +31968,7 @@ var ts;
31928
31968
  name: "declarationMap",
31929
31969
  type: "boolean",
31930
31970
  affectsEmit: true,
31971
+ affectsMultiFileEmitBuildInfo: true,
31931
31972
  showInSimplifiedHelpView: true,
31932
31973
  category: ts.Diagnostics.Emit,
31933
31974
  transpileOptionValue: undefined,
@@ -31938,6 +31979,7 @@ var ts;
31938
31979
  name: "emitDeclarationOnly",
31939
31980
  type: "boolean",
31940
31981
  affectsEmit: true,
31982
+ affectsMultiFileEmitBuildInfo: true,
31941
31983
  showInSimplifiedHelpView: true,
31942
31984
  category: ts.Diagnostics.Emit,
31943
31985
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -31948,6 +31990,7 @@ var ts;
31948
31990
  name: "sourceMap",
31949
31991
  type: "boolean",
31950
31992
  affectsEmit: true,
31993
+ affectsMultiFileEmitBuildInfo: true,
31951
31994
  showInSimplifiedHelpView: true,
31952
31995
  category: ts.Diagnostics.Emit,
31953
31996
  defaultValueDescription: false,
@@ -31957,6 +32000,9 @@ var ts;
31957
32000
  name: "outFile",
31958
32001
  type: "string",
31959
32002
  affectsEmit: true,
32003
+ affectsMultiFileEmitBuildInfo: true,
32004
+ affectsDeclarationPath: true,
32005
+ affectsBundleEmitBuildInfo: true,
31960
32006
  isFilePath: true,
31961
32007
  paramType: ts.Diagnostics.FILE,
31962
32008
  showInSimplifiedHelpView: true,
@@ -31968,6 +32014,8 @@ var ts;
31968
32014
  name: "outDir",
31969
32015
  type: "string",
31970
32016
  affectsEmit: true,
32017
+ affectsMultiFileEmitBuildInfo: true,
32018
+ affectsDeclarationPath: true,
31971
32019
  isFilePath: true,
31972
32020
  paramType: ts.Diagnostics.DIRECTORY,
31973
32021
  showInSimplifiedHelpView: true,
@@ -31978,6 +32026,8 @@ var ts;
31978
32026
  name: "rootDir",
31979
32027
  type: "string",
31980
32028
  affectsEmit: true,
32029
+ affectsMultiFileEmitBuildInfo: true,
32030
+ affectsDeclarationPath: true,
31981
32031
  isFilePath: true,
31982
32032
  paramType: ts.Diagnostics.LOCATION,
31983
32033
  category: ts.Diagnostics.Modules,
@@ -31988,6 +32038,8 @@ var ts;
31988
32038
  name: "composite",
31989
32039
  type: "boolean",
31990
32040
  affectsEmit: true,
32041
+ affectsMultiFileEmitBuildInfo: true,
32042
+ affectsBundleEmitBuildInfo: true,
31991
32043
  isTSConfigOnly: true,
31992
32044
  category: ts.Diagnostics.Projects,
31993
32045
  transpileOptionValue: undefined,
@@ -31998,6 +32050,8 @@ var ts;
31998
32050
  name: "tsBuildInfoFile",
31999
32051
  type: "string",
32000
32052
  affectsEmit: true,
32053
+ affectsMultiFileEmitBuildInfo: true,
32054
+ affectsBundleEmitBuildInfo: true,
32001
32055
  isFilePath: true,
32002
32056
  paramType: ts.Diagnostics.FILE,
32003
32057
  category: ts.Diagnostics.Projects,
@@ -32009,6 +32063,7 @@ var ts;
32009
32063
  name: "removeComments",
32010
32064
  type: "boolean",
32011
32065
  affectsEmit: true,
32066
+ affectsMultiFileEmitBuildInfo: true,
32012
32067
  showInSimplifiedHelpView: true,
32013
32068
  category: ts.Diagnostics.Emit,
32014
32069
  defaultValueDescription: false,
@@ -32027,6 +32082,7 @@ var ts;
32027
32082
  name: "importHelpers",
32028
32083
  type: "boolean",
32029
32084
  affectsEmit: true,
32085
+ affectsMultiFileEmitBuildInfo: true,
32030
32086
  category: ts.Diagnostics.Emit,
32031
32087
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
32032
32088
  defaultValueDescription: false,
@@ -32040,6 +32096,7 @@ var ts;
32040
32096
  })),
32041
32097
  affectsEmit: true,
32042
32098
  affectsSemanticDiagnostics: true,
32099
+ affectsMultiFileEmitBuildInfo: true,
32043
32100
  category: ts.Diagnostics.Emit,
32044
32101
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
32045
32102
  defaultValueDescription: 0,
@@ -32048,6 +32105,7 @@ var ts;
32048
32105
  name: "downlevelIteration",
32049
32106
  type: "boolean",
32050
32107
  affectsEmit: true,
32108
+ affectsMultiFileEmitBuildInfo: true,
32051
32109
  category: ts.Diagnostics.Emit,
32052
32110
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
32053
32111
  defaultValueDescription: false,
@@ -32063,6 +32121,7 @@ var ts;
32063
32121
  {
32064
32122
  name: "strict",
32065
32123
  type: "boolean",
32124
+ affectsMultiFileEmitBuildInfo: true,
32066
32125
  showInSimplifiedHelpView: true,
32067
32126
  category: ts.Diagnostics.Type_Checking,
32068
32127
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -32072,6 +32131,7 @@ var ts;
32072
32131
  name: "noImplicitAny",
32073
32132
  type: "boolean",
32074
32133
  affectsSemanticDiagnostics: true,
32134
+ affectsMultiFileEmitBuildInfo: true,
32075
32135
  strictFlag: true,
32076
32136
  category: ts.Diagnostics.Type_Checking,
32077
32137
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -32081,6 +32141,7 @@ var ts;
32081
32141
  name: "strictNullChecks",
32082
32142
  type: "boolean",
32083
32143
  affectsSemanticDiagnostics: true,
32144
+ affectsMultiFileEmitBuildInfo: true,
32084
32145
  strictFlag: true,
32085
32146
  category: ts.Diagnostics.Type_Checking,
32086
32147
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -32089,6 +32150,8 @@ var ts;
32089
32150
  {
32090
32151
  name: "strictFunctionTypes",
32091
32152
  type: "boolean",
32153
+ affectsSemanticDiagnostics: true,
32154
+ affectsMultiFileEmitBuildInfo: true,
32092
32155
  strictFlag: true,
32093
32156
  category: ts.Diagnostics.Type_Checking,
32094
32157
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -32097,6 +32160,8 @@ var ts;
32097
32160
  {
32098
32161
  name: "strictBindCallApply",
32099
32162
  type: "boolean",
32163
+ affectsSemanticDiagnostics: true,
32164
+ affectsMultiFileEmitBuildInfo: true,
32100
32165
  strictFlag: true,
32101
32166
  category: ts.Diagnostics.Type_Checking,
32102
32167
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -32106,6 +32171,7 @@ var ts;
32106
32171
  name: "strictPropertyInitialization",
32107
32172
  type: "boolean",
32108
32173
  affectsSemanticDiagnostics: true,
32174
+ affectsMultiFileEmitBuildInfo: true,
32109
32175
  strictFlag: true,
32110
32176
  category: ts.Diagnostics.Type_Checking,
32111
32177
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -32115,6 +32181,7 @@ var ts;
32115
32181
  name: "noImplicitThis",
32116
32182
  type: "boolean",
32117
32183
  affectsSemanticDiagnostics: true,
32184
+ affectsMultiFileEmitBuildInfo: true,
32118
32185
  strictFlag: true,
32119
32186
  category: ts.Diagnostics.Type_Checking,
32120
32187
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -32124,6 +32191,7 @@ var ts;
32124
32191
  name: "useUnknownInCatchVariables",
32125
32192
  type: "boolean",
32126
32193
  affectsSemanticDiagnostics: true,
32194
+ affectsMultiFileEmitBuildInfo: true,
32127
32195
  strictFlag: true,
32128
32196
  category: ts.Diagnostics.Type_Checking,
32129
32197
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -32133,6 +32201,8 @@ var ts;
32133
32201
  name: "alwaysStrict",
32134
32202
  type: "boolean",
32135
32203
  affectsSourceFile: true,
32204
+ affectsEmit: true,
32205
+ affectsMultiFileEmitBuildInfo: true,
32136
32206
  strictFlag: true,
32137
32207
  category: ts.Diagnostics.Type_Checking,
32138
32208
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -32142,6 +32212,7 @@ var ts;
32142
32212
  name: "noUnusedLocals",
32143
32213
  type: "boolean",
32144
32214
  affectsSemanticDiagnostics: true,
32215
+ affectsMultiFileEmitBuildInfo: true,
32145
32216
  category: ts.Diagnostics.Type_Checking,
32146
32217
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
32147
32218
  defaultValueDescription: false,
@@ -32150,6 +32221,7 @@ var ts;
32150
32221
  name: "noUnusedParameters",
32151
32222
  type: "boolean",
32152
32223
  affectsSemanticDiagnostics: true,
32224
+ affectsMultiFileEmitBuildInfo: true,
32153
32225
  category: ts.Diagnostics.Type_Checking,
32154
32226
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
32155
32227
  defaultValueDescription: false,
@@ -32158,6 +32230,7 @@ var ts;
32158
32230
  name: "exactOptionalPropertyTypes",
32159
32231
  type: "boolean",
32160
32232
  affectsSemanticDiagnostics: true,
32233
+ affectsMultiFileEmitBuildInfo: true,
32161
32234
  category: ts.Diagnostics.Type_Checking,
32162
32235
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
32163
32236
  defaultValueDescription: false,
@@ -32166,6 +32239,7 @@ var ts;
32166
32239
  name: "noImplicitReturns",
32167
32240
  type: "boolean",
32168
32241
  affectsSemanticDiagnostics: true,
32242
+ affectsMultiFileEmitBuildInfo: true,
32169
32243
  category: ts.Diagnostics.Type_Checking,
32170
32244
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
32171
32245
  defaultValueDescription: false,
@@ -32175,6 +32249,7 @@ var ts;
32175
32249
  type: "boolean",
32176
32250
  affectsBindDiagnostics: true,
32177
32251
  affectsSemanticDiagnostics: true,
32252
+ affectsMultiFileEmitBuildInfo: true,
32178
32253
  category: ts.Diagnostics.Type_Checking,
32179
32254
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
32180
32255
  defaultValueDescription: false,
@@ -32183,6 +32258,7 @@ var ts;
32183
32258
  name: "noUncheckedIndexedAccess",
32184
32259
  type: "boolean",
32185
32260
  affectsSemanticDiagnostics: true,
32261
+ affectsMultiFileEmitBuildInfo: true,
32186
32262
  category: ts.Diagnostics.Type_Checking,
32187
32263
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
32188
32264
  defaultValueDescription: false,
@@ -32191,6 +32267,7 @@ var ts;
32191
32267
  name: "noImplicitOverride",
32192
32268
  type: "boolean",
32193
32269
  affectsSemanticDiagnostics: true,
32270
+ affectsMultiFileEmitBuildInfo: true,
32194
32271
  category: ts.Diagnostics.Type_Checking,
32195
32272
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
32196
32273
  defaultValueDescription: false,
@@ -32198,6 +32275,8 @@ var ts;
32198
32275
  {
32199
32276
  name: "noPropertyAccessFromIndexSignature",
32200
32277
  type: "boolean",
32278
+ affectsSemanticDiagnostics: true,
32279
+ affectsMultiFileEmitBuildInfo: true,
32201
32280
  showInSimplifiedHelpView: false,
32202
32281
  category: ts.Diagnostics.Type_Checking,
32203
32282
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -32278,6 +32357,7 @@ var ts;
32278
32357
  name: "allowSyntheticDefaultImports",
32279
32358
  type: "boolean",
32280
32359
  affectsSemanticDiagnostics: true,
32360
+ affectsMultiFileEmitBuildInfo: true,
32281
32361
  category: ts.Diagnostics.Interop_Constraints,
32282
32362
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
32283
32363
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -32287,6 +32367,7 @@ var ts;
32287
32367
  type: "boolean",
32288
32368
  affectsSemanticDiagnostics: true,
32289
32369
  affectsEmit: true,
32370
+ affectsMultiFileEmitBuildInfo: true,
32290
32371
  showInSimplifiedHelpView: true,
32291
32372
  category: ts.Diagnostics.Interop_Constraints,
32292
32373
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -32303,6 +32384,7 @@ var ts;
32303
32384
  name: "allowUmdGlobalAccess",
32304
32385
  type: "boolean",
32305
32386
  affectsSemanticDiagnostics: true,
32387
+ affectsMultiFileEmitBuildInfo: true,
32306
32388
  category: ts.Diagnostics.Modules,
32307
32389
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
32308
32390
  defaultValueDescription: false,
@@ -32323,6 +32405,7 @@ var ts;
32323
32405
  name: "sourceRoot",
32324
32406
  type: "string",
32325
32407
  affectsEmit: true,
32408
+ affectsMultiFileEmitBuildInfo: true,
32326
32409
  paramType: ts.Diagnostics.LOCATION,
32327
32410
  category: ts.Diagnostics.Emit,
32328
32411
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -32331,6 +32414,7 @@ var ts;
32331
32414
  name: "mapRoot",
32332
32415
  type: "string",
32333
32416
  affectsEmit: true,
32417
+ affectsMultiFileEmitBuildInfo: true,
32334
32418
  paramType: ts.Diagnostics.LOCATION,
32335
32419
  category: ts.Diagnostics.Emit,
32336
32420
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -32339,6 +32423,7 @@ var ts;
32339
32423
  name: "inlineSourceMap",
32340
32424
  type: "boolean",
32341
32425
  affectsEmit: true,
32426
+ affectsMultiFileEmitBuildInfo: true,
32342
32427
  category: ts.Diagnostics.Emit,
32343
32428
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
32344
32429
  defaultValueDescription: false,
@@ -32347,6 +32432,7 @@ var ts;
32347
32432
  name: "inlineSources",
32348
32433
  type: "boolean",
32349
32434
  affectsEmit: true,
32435
+ affectsMultiFileEmitBuildInfo: true,
32350
32436
  category: ts.Diagnostics.Emit,
32351
32437
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
32352
32438
  defaultValueDescription: false,
@@ -32355,6 +32441,7 @@ var ts;
32355
32441
  name: "experimentalDecorators",
32356
32442
  type: "boolean",
32357
32443
  affectsSemanticDiagnostics: true,
32444
+ affectsMultiFileEmitBuildInfo: true,
32358
32445
  category: ts.Diagnostics.Language_and_Environment,
32359
32446
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
32360
32447
  defaultValueDescription: false,
@@ -32364,6 +32451,7 @@ var ts;
32364
32451
  type: "boolean",
32365
32452
  affectsSemanticDiagnostics: true,
32366
32453
  affectsEmit: true,
32454
+ affectsMultiFileEmitBuildInfo: true,
32367
32455
  category: ts.Diagnostics.Language_and_Environment,
32368
32456
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
32369
32457
  defaultValueDescription: false,
@@ -32387,6 +32475,7 @@ var ts;
32387
32475
  type: "string",
32388
32476
  affectsSemanticDiagnostics: true,
32389
32477
  affectsEmit: true,
32478
+ affectsMultiFileEmitBuildInfo: true,
32390
32479
  affectsModuleResolution: true,
32391
32480
  category: ts.Diagnostics.Language_and_Environment,
32392
32481
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -32404,6 +32493,9 @@ var ts;
32404
32493
  name: "out",
32405
32494
  type: "string",
32406
32495
  affectsEmit: true,
32496
+ affectsMultiFileEmitBuildInfo: true,
32497
+ affectsDeclarationPath: true,
32498
+ affectsBundleEmitBuildInfo: true,
32407
32499
  isFilePath: false,
32408
32500
  category: ts.Diagnostics.Backwards_Compatibility,
32409
32501
  paramType: ts.Diagnostics.FILE,
@@ -32414,6 +32506,7 @@ var ts;
32414
32506
  name: "reactNamespace",
32415
32507
  type: "string",
32416
32508
  affectsEmit: true,
32509
+ affectsMultiFileEmitBuildInfo: true,
32417
32510
  category: ts.Diagnostics.Language_and_Environment,
32418
32511
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
32419
32512
  defaultValueDescription: "`React`",
@@ -32421,6 +32514,7 @@ var ts;
32421
32514
  {
32422
32515
  name: "skipDefaultLibCheck",
32423
32516
  type: "boolean",
32517
+ affectsMultiFileEmitBuildInfo: true,
32424
32518
  category: ts.Diagnostics.Completeness,
32425
32519
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
32426
32520
  defaultValueDescription: false,
@@ -32436,6 +32530,7 @@ var ts;
32436
32530
  name: "emitBOM",
32437
32531
  type: "boolean",
32438
32532
  affectsEmit: true,
32533
+ affectsMultiFileEmitBuildInfo: true,
32439
32534
  category: ts.Diagnostics.Emit,
32440
32535
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
32441
32536
  defaultValueDescription: false,
@@ -32447,6 +32542,7 @@ var ts;
32447
32542
  lf: 1
32448
32543
  })),
32449
32544
  affectsEmit: true,
32545
+ affectsMultiFileEmitBuildInfo: true,
32450
32546
  paramType: ts.Diagnostics.NEWLINE,
32451
32547
  category: ts.Diagnostics.Emit,
32452
32548
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -32456,6 +32552,7 @@ var ts;
32456
32552
  name: "noErrorTruncation",
32457
32553
  type: "boolean",
32458
32554
  affectsSemanticDiagnostics: true,
32555
+ affectsMultiFileEmitBuildInfo: true,
32459
32556
  category: ts.Diagnostics.Output_Formatting,
32460
32557
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
32461
32558
  defaultValueDescription: false,
@@ -32482,6 +32579,7 @@ var ts;
32482
32579
  name: "stripInternal",
32483
32580
  type: "boolean",
32484
32581
  affectsEmit: true,
32582
+ affectsMultiFileEmitBuildInfo: true,
32485
32583
  category: ts.Diagnostics.Emit,
32486
32584
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
32487
32585
  defaultValueDescription: false,
@@ -32522,6 +32620,7 @@ var ts;
32522
32620
  name: "noImplicitUseStrict",
32523
32621
  type: "boolean",
32524
32622
  affectsSemanticDiagnostics: true,
32623
+ affectsMultiFileEmitBuildInfo: true,
32525
32624
  category: ts.Diagnostics.Backwards_Compatibility,
32526
32625
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
32527
32626
  defaultValueDescription: false,
@@ -32530,6 +32629,7 @@ var ts;
32530
32629
  name: "noEmitHelpers",
32531
32630
  type: "boolean",
32532
32631
  affectsEmit: true,
32632
+ affectsMultiFileEmitBuildInfo: true,
32533
32633
  category: ts.Diagnostics.Emit,
32534
32634
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
32535
32635
  defaultValueDescription: false,
@@ -32538,6 +32638,7 @@ var ts;
32538
32638
  name: "noEmitOnError",
32539
32639
  type: "boolean",
32540
32640
  affectsEmit: true,
32641
+ affectsMultiFileEmitBuildInfo: true,
32541
32642
  category: ts.Diagnostics.Emit,
32542
32643
  transpileOptionValue: undefined,
32543
32644
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -32547,6 +32648,7 @@ var ts;
32547
32648
  name: "preserveConstEnums",
32548
32649
  type: "boolean",
32549
32650
  affectsEmit: true,
32651
+ affectsMultiFileEmitBuildInfo: true,
32550
32652
  category: ts.Diagnostics.Emit,
32551
32653
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
32552
32654
  defaultValueDescription: false,
@@ -32555,6 +32657,8 @@ var ts;
32555
32657
  name: "declarationDir",
32556
32658
  type: "string",
32557
32659
  affectsEmit: true,
32660
+ affectsMultiFileEmitBuildInfo: true,
32661
+ affectsDeclarationPath: true,
32558
32662
  isFilePath: true,
32559
32663
  paramType: ts.Diagnostics.DIRECTORY,
32560
32664
  category: ts.Diagnostics.Emit,
@@ -32564,6 +32668,7 @@ var ts;
32564
32668
  {
32565
32669
  name: "skipLibCheck",
32566
32670
  type: "boolean",
32671
+ affectsMultiFileEmitBuildInfo: true,
32567
32672
  category: ts.Diagnostics.Completeness,
32568
32673
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
32569
32674
  defaultValueDescription: false,
@@ -32573,6 +32678,7 @@ var ts;
32573
32678
  type: "boolean",
32574
32679
  affectsBindDiagnostics: true,
32575
32680
  affectsSemanticDiagnostics: true,
32681
+ affectsMultiFileEmitBuildInfo: true,
32576
32682
  category: ts.Diagnostics.Type_Checking,
32577
32683
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
32578
32684
  defaultValueDescription: undefined,
@@ -32582,6 +32688,7 @@ var ts;
32582
32688
  type: "boolean",
32583
32689
  affectsBindDiagnostics: true,
32584
32690
  affectsSemanticDiagnostics: true,
32691
+ affectsMultiFileEmitBuildInfo: true,
32585
32692
  category: ts.Diagnostics.Type_Checking,
32586
32693
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
32587
32694
  defaultValueDescription: undefined,
@@ -32590,6 +32697,7 @@ var ts;
32590
32697
  name: "suppressExcessPropertyErrors",
32591
32698
  type: "boolean",
32592
32699
  affectsSemanticDiagnostics: true,
32700
+ affectsMultiFileEmitBuildInfo: true,
32593
32701
  category: ts.Diagnostics.Backwards_Compatibility,
32594
32702
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
32595
32703
  defaultValueDescription: false,
@@ -32598,6 +32706,7 @@ var ts;
32598
32706
  name: "suppressImplicitAnyIndexErrors",
32599
32707
  type: "boolean",
32600
32708
  affectsSemanticDiagnostics: true,
32709
+ affectsMultiFileEmitBuildInfo: true,
32601
32710
  category: ts.Diagnostics.Backwards_Compatibility,
32602
32711
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
32603
32712
  defaultValueDescription: false,
@@ -32622,6 +32731,7 @@ var ts;
32622
32731
  name: "noStrictGenericChecks",
32623
32732
  type: "boolean",
32624
32733
  affectsSemanticDiagnostics: true,
32734
+ affectsMultiFileEmitBuildInfo: true,
32625
32735
  category: ts.Diagnostics.Backwards_Compatibility,
32626
32736
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
32627
32737
  defaultValueDescription: false,
@@ -32631,6 +32741,7 @@ var ts;
32631
32741
  type: "boolean",
32632
32742
  affectsSemanticDiagnostics: true,
32633
32743
  affectsEmit: true,
32744
+ affectsMultiFileEmitBuildInfo: true,
32634
32745
  category: ts.Diagnostics.Language_and_Environment,
32635
32746
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
32636
32747
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -32639,6 +32750,7 @@ var ts;
32639
32750
  name: "preserveValueImports",
32640
32751
  type: "boolean",
32641
32752
  affectsEmit: true,
32753
+ affectsMultiFileEmitBuildInfo: true,
32642
32754
  category: ts.Diagnostics.Emit,
32643
32755
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
32644
32756
  defaultValueDescription: false,
@@ -32677,6 +32789,7 @@ var ts;
32677
32789
  ts.optionDeclarations = __spreadArray(__spreadArray([], ts.commonOptionsWithBuild, true), commandOptionsWithoutBuild, true);
32678
32790
  ts.semanticDiagnosticsOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsSemanticDiagnostics; });
32679
32791
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
32792
+ ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
32680
32793
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
32681
32794
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
32682
32795
  return !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics;
@@ -33456,6 +33569,7 @@ var ts;
33456
33569
  }
33457
33570
  });
33458
33571
  }
33572
+ ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
33459
33573
  function serializeCompilerOptions(options, pathOptions) {
33460
33574
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
33461
33575
  }
@@ -34436,16 +34550,18 @@ var ts;
34436
34550
  ts.Debug.assert(ts.extensionIsTS(resolved.extension));
34437
34551
  return { fileName: resolved.path, packageId: resolved.packageId };
34438
34552
  }
34439
- function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, diagnostics, resultFromCache) {
34440
- var _a;
34553
+ function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
34554
+ var _a, _b;
34441
34555
  if (resultFromCache) {
34442
34556
  (_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
34557
+ (_b = resultFromCache.affectingLocations).push.apply(_b, affectingLocations);
34443
34558
  return resultFromCache;
34444
34559
  }
34445
34560
  return {
34446
34561
  resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
34447
34562
  failedLookupLocations: failedLookupLocations,
34448
- resolutionDiagnostics: diagnostics
34563
+ affectingLocations: affectingLocations,
34564
+ resolutionDiagnostics: diagnostics,
34449
34565
  };
34450
34566
  }
34451
34567
  function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
@@ -34621,6 +34737,7 @@ var ts;
34621
34737
  }
34622
34738
  }
34623
34739
  var failedLookupLocations = [];
34740
+ var affectingLocations = [];
34624
34741
  var features = getDefaultNodeResolutionFeatures(options);
34625
34742
  if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext)) {
34626
34743
  features |= NodeResolutionFeatures.EsmMode;
@@ -34632,6 +34749,7 @@ var ts;
34632
34749
  host: host,
34633
34750
  traceEnabled: traceEnabled,
34634
34751
  failedLookupLocations: failedLookupLocations,
34752
+ affectingLocations: affectingLocations,
34635
34753
  packageJsonInfoCache: cache,
34636
34754
  features: features,
34637
34755
  conditions: conditions,
@@ -34656,7 +34774,7 @@ var ts;
34656
34774
  isExternalLibraryImport: pathContainsNodeModules(fileName),
34657
34775
  };
34658
34776
  }
34659
- result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, resolutionDiagnostics: diagnostics };
34777
+ result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, affectingLocations: affectingLocations, resolutionDiagnostics: diagnostics };
34660
34778
  perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, resolutionMode, result);
34661
34779
  if (traceEnabled)
34662
34780
  traceResult(result);
@@ -34730,6 +34848,7 @@ var ts;
34730
34848
  host: host,
34731
34849
  traceEnabled: isTraceEnabled(options, host),
34732
34850
  failedLookupLocations: [],
34851
+ affectingLocations: [],
34733
34852
  packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
34734
34853
  conditions: ts.emptyArray,
34735
34854
  features: NodeResolutionFeatures.None,
@@ -35263,6 +35382,7 @@ var ts;
35263
35382
  var _a, _b;
35264
35383
  var traceEnabled = isTraceEnabled(compilerOptions, host);
35265
35384
  var failedLookupLocations = [];
35385
+ var affectingLocations = [];
35266
35386
  var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
35267
35387
  if (compilerOptions.noDtsResolution) {
35268
35388
  conditions.pop();
@@ -35273,6 +35393,7 @@ var ts;
35273
35393
  host: host,
35274
35394
  traceEnabled: traceEnabled,
35275
35395
  failedLookupLocations: failedLookupLocations,
35396
+ affectingLocations: affectingLocations,
35276
35397
  packageJsonInfoCache: cache,
35277
35398
  features: features,
35278
35399
  conditions: conditions,
@@ -35280,7 +35401,7 @@ var ts;
35280
35401
  reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
35281
35402
  };
35282
35403
  var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
35283
- 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);
35284
35405
  function tryResolve(extensions) {
35285
35406
  var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, true); };
35286
35407
  var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
@@ -35538,6 +35659,7 @@ var ts;
35538
35659
  host: host,
35539
35660
  traceEnabled: isTraceEnabled(options, host),
35540
35661
  failedLookupLocations: [],
35662
+ affectingLocations: [],
35541
35663
  packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
35542
35664
  conditions: ["node", "require", "types"],
35543
35665
  features: features,
@@ -35619,6 +35741,7 @@ var ts;
35619
35741
  compilerOptions: options,
35620
35742
  traceEnabled: isTraceEnabled(options, host),
35621
35743
  failedLookupLocations: [],
35744
+ affectingLocations: [],
35622
35745
  packageJsonInfoCache: packageJsonInfoCache,
35623
35746
  features: 0,
35624
35747
  conditions: [],
@@ -35650,6 +35773,7 @@ var ts;
35650
35773
  if (typeof existing !== "boolean") {
35651
35774
  if (traceEnabled)
35652
35775
  trace(host, ts.Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath);
35776
+ state.affectingLocations.push(packageJsonPath);
35653
35777
  return existing;
35654
35778
  }
35655
35779
  else {
@@ -35668,6 +35792,7 @@ var ts;
35668
35792
  var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
35669
35793
  var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined };
35670
35794
  (_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
35795
+ state.affectingLocations.push(packageJsonPath);
35671
35796
  return result;
35672
35797
  }
35673
35798
  else {
@@ -36258,11 +36383,23 @@ var ts;
36258
36383
  function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
36259
36384
  var traceEnabled = isTraceEnabled(compilerOptions, host);
36260
36385
  var failedLookupLocations = [];
36386
+ var affectingLocations = [];
36261
36387
  var containingDirectory = ts.getDirectoryPath(containingFile);
36262
36388
  var diagnostics = [];
36263
- 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
+ };
36264
36401
  var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
36265
- return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations, diagnostics, state.resultFromCache);
36402
+ return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
36266
36403
  function tryResolve(extensions) {
36267
36404
  var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
36268
36405
  if (resolvedUsingSettings) {
@@ -36298,10 +36435,22 @@ var ts;
36298
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);
36299
36436
  }
36300
36437
  var failedLookupLocations = [];
36438
+ var affectingLocations = [];
36301
36439
  var diagnostics = [];
36302
- 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
+ };
36303
36452
  var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, false, undefined, undefined);
36304
- return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations, diagnostics, state.resultFromCache);
36453
+ return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
36305
36454
  }
36306
36455
  ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
36307
36456
  function toSearchResult(value) {
@@ -39263,16 +39412,6 @@ var ts;
39263
39412
  var nextNodeId = 1;
39264
39413
  var nextMergeId = 1;
39265
39414
  var nextFlowId = 1;
39266
- var typeofEQFacts = new ts.Map(ts.getEntries({
39267
- string: 1,
39268
- number: 2,
39269
- bigint: 4,
39270
- boolean: 8,
39271
- symbol: 16,
39272
- undefined: 65536,
39273
- object: 32,
39274
- function: 64
39275
- }));
39276
39415
  var typeofNEFacts = new ts.Map(ts.getEntries({
39277
39416
  string: 256,
39278
39417
  number: 512,
@@ -39932,14 +40071,6 @@ var ts;
39932
40071
  var awaitedTypeStack = [];
39933
40072
  var diagnostics = ts.createDiagnosticCollection();
39934
40073
  var suggestionDiagnostics = ts.createDiagnosticCollection();
39935
- var typeofTypesByName = new ts.Map(ts.getEntries({
39936
- string: stringType,
39937
- number: numberType,
39938
- bigint: bigintType,
39939
- boolean: booleanType,
39940
- symbol: esSymbolType,
39941
- undefined: undefinedType
39942
- }));
39943
40074
  var typeofType = createTypeofType();
39944
40075
  var _jsxNamespace;
39945
40076
  var _jsxFactoryEntity;
@@ -42439,7 +42570,7 @@ var ts;
42439
42570
  return type;
42440
42571
  }
42441
42572
  function createTypeofType() {
42442
- return getUnionType(ts.arrayFrom(typeofEQFacts.keys(), getStringLiteralType));
42573
+ return getUnionType(ts.arrayFrom(typeofNEFacts.keys(), getStringLiteralType));
42443
42574
  }
42444
42575
  function createTypeParameter(symbol) {
42445
42576
  var type = createType(262144);
@@ -43136,6 +43267,9 @@ var ts;
43136
43267
  var typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
43137
43268
  if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32))
43138
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
+ }
43139
43273
  return symbolToTypeNode(type.aliasSymbol, context, 788968, typeArgumentNodes);
43140
43274
  }
43141
43275
  var objectFlags = ts.getObjectFlags(type);
@@ -43303,7 +43437,7 @@ var ts;
43303
43437
  }
43304
43438
  else if (symbol.flags & 32
43305
43439
  && !getBaseTypeVariableOfClass(symbol)
43306
- && !(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)) ||
43307
43441
  symbol.flags & (384 | 512) ||
43308
43442
  shouldWriteTypeOfFunctionSymbol()) {
43309
43443
  return symbolToTypeNode(symbol, context, isInstanceType);
@@ -46403,6 +46537,17 @@ var ts;
46403
46537
  }
46404
46538
  });
46405
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
+ }
46406
46551
  result.objectFlags |= (ts.getObjectFlags(type) & 4096);
46407
46552
  if (result.symbol && result.symbol.flags & 32 && type === getDeclaredTypeOfClassOrInterface(result.symbol)) {
46408
46553
  result.objectFlags |= 16777216;
@@ -53619,6 +53764,9 @@ var ts;
53619
53764
  }
53620
53765
  return false;
53621
53766
  }
53767
+ function containsUndefinedType(type) {
53768
+ return !!((type.flags & 1048576 ? type.types[0] : type).flags & 32768);
53769
+ }
53622
53770
  function isStringIndexSignatureOnlyType(type) {
53623
53771
  return type.flags & 524288 && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) ||
53624
53772
  type.flags & 3145728 && ts.every(type.types, isStringIndexSignatureOnlyType) ||
@@ -58290,19 +58438,15 @@ var ts;
58290
58438
  }
58291
58439
  return links.switchTypes;
58292
58440
  }
58293
- 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
+ }
58294
58445
  var witnesses = [];
58295
58446
  for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) {
58296
58447
  var clause = _a[_i];
58297
- if (clause.kind === 289) {
58298
- if (ts.isStringLiteralLike(clause.expression)) {
58299
- witnesses.push(clause.expression.text);
58300
- continue;
58301
- }
58302
- return ts.emptyArray;
58303
- }
58304
- if (retainDefault)
58305
- witnesses.push(undefined);
58448
+ var text = clause.kind === 289 ? clause.expression.text : undefined;
58449
+ witnesses.push(text && !ts.contains(witnesses, text) ? text : undefined);
58306
58450
  }
58307
58451
  return witnesses;
58308
58452
  }
@@ -59358,14 +59502,9 @@ var ts;
59358
59502
  }
59359
59503
  return type;
59360
59504
  }
59361
- if (type.flags & 1 && literal.text === "function") {
59362
- return type;
59363
- }
59364
- var facts = assumeTrue ?
59365
- typeofEQFacts.get(literal.text) || 128 :
59366
- typeofNEFacts.get(literal.text) || 32768;
59367
- var impliedType = getImpliedTypeFromTypeofGuard(type, literal.text);
59368
- 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);
59369
59508
  }
59370
59509
  function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) {
59371
59510
  var everyClauseChecks = clauseStart !== clauseEnd && ts.every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck);
@@ -59408,63 +59547,40 @@ var ts;
59408
59547
  var defaultType = filterType(type, function (t) { return !(isUnitLikeType(t) && ts.contains(switchTypes, getRegularTypeOfLiteralType(extractUnitType(t)))); });
59409
59548
  return caseType.flags & 131072 ? defaultType : getUnionType([caseType, defaultType]);
59410
59549
  }
59411
- function getImpliedTypeFromTypeofGuard(type, text) {
59412
- switch (text) {
59413
- case "object":
59414
- return type.flags & 1 ? type : getUnionType([nullType, nonPrimitiveType]);
59415
- case "function":
59416
- return type.flags & 1 ? type : globalFunctionType;
59417
- default:
59418
- 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);
59419
59560
  }
59561
+ return narrowTypeByTypeFacts(type, nonPrimitiveType, 128);
59420
59562
  }
59421
- function narrowTypeByImpliedType(type, candidate) {
59422
- if (type.flags & 3) {
59423
- return candidate;
59424
- }
59563
+ function narrowTypeByTypeFacts(type, impliedType, facts) {
59425
59564
  return mapType(type, function (t) {
59426
- if (isTypeRelatedTo(t, candidate, strictSubtypeRelation)) {
59427
- return t;
59428
- }
59429
- return mapType(candidate, function (c) {
59430
- if (!areTypesComparable(t, c)) {
59431
- return neverType;
59432
- }
59433
- if (c.flags & 131068 && t.flags & 524288 && !isEmptyAnonymousObjectType(t)) {
59434
- return isTypeSubtypeOf(c, t) ? c : neverType;
59435
- }
59436
- if (c === globalFunctionType && isTypeSubtypeOf(c, t)) {
59437
- return c;
59438
- }
59439
- return getIntersectionType([t, c]);
59440
- });
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;
59441
59569
  });
59442
59570
  }
59443
59571
  function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
59444
- var switchWitnesses = getSwitchClauseTypeOfWitnesses(switchStatement, true);
59445
- if (!switchWitnesses.length) {
59572
+ var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement);
59573
+ if (!witnesses) {
59446
59574
  return type;
59447
59575
  }
59448
- var defaultCaseLocation = ts.findIndex(switchWitnesses, function (elem) { return elem === undefined; });
59449
- var hasDefaultClause = clauseStart === clauseEnd || (defaultCaseLocation >= clauseStart && defaultCaseLocation < clauseEnd);
59450
- var clauseWitnesses;
59451
- var switchFacts;
59452
- if (defaultCaseLocation > -1) {
59453
- var witnesses = switchWitnesses.filter(function (witness) { return witness !== undefined; });
59454
- var fixedClauseStart = defaultCaseLocation < clauseStart ? clauseStart - 1 : clauseStart;
59455
- var fixedClauseEnd = defaultCaseLocation < clauseEnd ? clauseEnd - 1 : clauseEnd;
59456
- clauseWitnesses = witnesses.slice(fixedClauseStart, fixedClauseEnd);
59457
- switchFacts = getFactsFromTypeofSwitch(fixedClauseStart, fixedClauseEnd, witnesses, hasDefaultClause);
59458
- }
59459
- else {
59460
- clauseWitnesses = switchWitnesses.slice(clauseStart, clauseEnd);
59461
- switchFacts = getFactsFromTypeofSwitch(clauseStart, clauseEnd, switchWitnesses, hasDefaultClause);
59462
- }
59576
+ var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 290; });
59577
+ var hasDefaultClause = clauseStart === clauseEnd || (defaultIndex >= clauseStart && defaultIndex < clauseEnd);
59463
59578
  if (hasDefaultClause) {
59464
- 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; });
59465
59581
  }
59466
- var impliedType = getTypeWithFacts(getUnionType(clauseWitnesses.map(function (text) { return getImpliedTypeFromTypeofGuard(type, text) || type; })), switchFacts);
59467
- 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; }));
59468
59584
  }
59469
59585
  function isMatchingConstructorReference(expr) {
59470
59586
  return (ts.isPropertyAccessExpression(expr) && ts.idText(expr.name) === "constructor" ||
@@ -59947,7 +60063,7 @@ var ts;
59947
60063
  return convertAutoToAny(flowType);
59948
60064
  }
59949
60065
  }
59950
- else if (!assumeInitialized && !(getTypeFacts(type) & 16777216) && getTypeFacts(flowType) & 16777216) {
60066
+ else if (!assumeInitialized && !containsUndefinedType(type) && containsUndefinedType(flowType)) {
59951
60067
  error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
59952
60068
  return type;
59953
60069
  }
@@ -62479,7 +62595,7 @@ var ts;
62479
62595
  assumeUninitialized = true;
62480
62596
  }
62481
62597
  var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
62482
- if (assumeUninitialized && !(getTypeFacts(propType) & 16777216) && getTypeFacts(flowType) & 16777216) {
62598
+ if (assumeUninitialized && !containsUndefinedType(propType) && containsUndefinedType(flowType)) {
62483
62599
  error(errorNode, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop));
62484
62600
  return propType;
62485
62601
  }
@@ -65252,26 +65368,11 @@ var ts;
65252
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
65253
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);
65254
65370
  }
65255
- function getFactsFromTypeofSwitch(start, end, witnesses, hasDefault) {
65371
+ function getNotEqualFactsFromTypeofSwitch(start, end, witnesses) {
65256
65372
  var facts = 0;
65257
- if (hasDefault) {
65258
- for (var i = end; i < witnesses.length; i++) {
65259
- facts |= typeofNEFacts.get(witnesses[i]) || 32768;
65260
- }
65261
- for (var i = start; i < end; i++) {
65262
- facts &= ~(typeofNEFacts.get(witnesses[i]) || 0);
65263
- }
65264
- for (var i = 0; i < start; i++) {
65265
- facts |= typeofNEFacts.get(witnesses[i]) || 32768;
65266
- }
65267
- }
65268
- else {
65269
- for (var i = start; i < end; i++) {
65270
- facts |= typeofEQFacts.get(witnesses[i]) || 128;
65271
- }
65272
- for (var i = 0; i < start; i++) {
65273
- facts &= ~(typeofEQFacts.get(witnesses[i]) || 0);
65274
- }
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;
65275
65376
  }
65276
65377
  return facts;
65277
65378
  }
@@ -65281,14 +65382,16 @@ var ts;
65281
65382
  }
65282
65383
  function computeExhaustiveSwitchStatement(node) {
65283
65384
  if (node.expression.kind === 216) {
65284
- var operandType = getTypeOfExpression(node.expression.expression);
65285
- var witnesses = getSwitchClauseTypeOfWitnesses(node, false);
65286
- var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, true);
65287
- var type_6 = getBaseConstraintOfType(operandType) || operandType;
65288
- if (type_6.flags & 3) {
65289
- return (556800 & notEqualFacts_1) === 556800;
65385
+ var witnesses = getSwitchClauseTypeOfWitnesses(node);
65386
+ if (!witnesses) {
65387
+ return false;
65388
+ }
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;
65290
65393
  }
65291
- return !!(filterType(type_6, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072);
65394
+ return !someType(operandConstraint, function (t) { return (getTypeFacts(t) & notEqualFacts_2) === notEqualFacts_2; });
65292
65395
  }
65293
65396
  var type = getTypeOfExpression(node.expression);
65294
65397
  if (!isLiteralType(type)) {
@@ -68590,6 +68693,11 @@ var ts;
68590
68693
  function checkJSDocTypeTag(node) {
68591
68694
  checkSourceElement(node.typeExpression);
68592
68695
  }
68696
+ function checkJSDocLinkLikeTag(node) {
68697
+ if (node.name) {
68698
+ resolveJSDocMemberName(node.name, true);
68699
+ }
68700
+ }
68593
68701
  function checkJSDocParameterTag(node) {
68594
68702
  checkSourceElement(node.typeExpression);
68595
68703
  }
@@ -70900,7 +71008,7 @@ var ts;
70900
71008
  var propName = member.name;
70901
71009
  if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
70902
71010
  var type = getTypeOfSymbol(getSymbolOfNode(member));
70903
- if (!(type.flags & 3 || getTypeFacts(type) & 16777216)) {
71011
+ if (!(type.flags & 3 || containsUndefinedType(type))) {
70904
71012
  if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
70905
71013
  error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName));
70906
71014
  }
@@ -70924,7 +71032,7 @@ var ts;
70924
71032
  ts.setParent(reference, staticBlock);
70925
71033
  reference.flowNode = staticBlock.returnFlowNode;
70926
71034
  var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
70927
- if (!(getTypeFacts(flowType) & 16777216)) {
71035
+ if (!containsUndefinedType(flowType)) {
70928
71036
  return true;
70929
71037
  }
70930
71038
  }
@@ -70939,7 +71047,7 @@ var ts;
70939
71047
  ts.setParent(reference, constructor);
70940
71048
  reference.flowNode = constructor.returnFlowNode;
70941
71049
  var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
70942
- return !(getTypeFacts(flowType) & 16777216);
71050
+ return !containsUndefinedType(flowType);
70943
71051
  }
70944
71052
  function checkInterfaceDeclaration(node) {
70945
71053
  if (!checkGrammarDecoratorsAndModifiers(node))
@@ -71839,12 +71947,16 @@ var ts;
71839
71947
  }
71840
71948
  }
71841
71949
  function checkSourceElementWorker(node) {
71842
- if (ts.isInJSFile(node)) {
71843
- ts.forEach(node.jsDoc, function (_a) {
71844
- var tags = _a.tags;
71845
- return ts.forEach(tags, checkSourceElement);
71950
+ ts.forEach(node.jsDoc, function (_a) {
71951
+ var comment = _a.comment, tags = _a.tags;
71952
+ checkJSDocCommentWorker(comment);
71953
+ ts.forEach(tags, function (tag) {
71954
+ checkJSDocCommentWorker(tag.comment);
71955
+ if (ts.isInJSFile(node)) {
71956
+ checkSourceElement(tag);
71957
+ }
71846
71958
  });
71847
- }
71959
+ });
71848
71960
  var kind = node.kind;
71849
71961
  if (cancellationToken) {
71850
71962
  switch (kind) {
@@ -71928,6 +72040,10 @@ var ts;
71928
72040
  return checkJSDocTemplateTag(node);
71929
72041
  case 343:
71930
72042
  return checkJSDocTypeTag(node);
72043
+ case 324:
72044
+ case 325:
72045
+ case 326:
72046
+ return checkJSDocLinkLikeTag(node);
71931
72047
  case 340:
71932
72048
  return checkJSDocParameterTag(node);
71933
72049
  case 347:
@@ -72021,6 +72137,15 @@ var ts;
72021
72137
  return checkMissingDeclaration(node);
72022
72138
  }
72023
72139
  }
72140
+ function checkJSDocCommentWorker(node) {
72141
+ if (ts.isArray(node)) {
72142
+ ts.forEach(node, function (tag) {
72143
+ if (ts.isJSDocLinkLike(tag)) {
72144
+ checkSourceElement(tag);
72145
+ }
72146
+ });
72147
+ }
72148
+ }
72024
72149
  function checkJSDocTypeIsInJsFile(node) {
72025
72150
  if (!ts.isInJSFile(node)) {
72026
72151
  grammarErrorOnNode(node, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
@@ -72504,7 +72629,7 @@ var ts;
72504
72629
  if (!result && isJSDoc_1) {
72505
72630
  var container = ts.findAncestor(name, ts.or(ts.isClassLike, ts.isInterfaceDeclaration));
72506
72631
  if (container) {
72507
- return resolveJSDocMemberName(name, getSymbolOfNode(container));
72632
+ return resolveJSDocMemberName(name, false, getSymbolOfNode(container));
72508
72633
  }
72509
72634
  }
72510
72635
  return result;
@@ -72542,10 +72667,10 @@ var ts;
72542
72667
  }
72543
72668
  return undefined;
72544
72669
  }
72545
- function resolveJSDocMemberName(name, container) {
72670
+ function resolveJSDocMemberName(name, ignoreErrors, container) {
72546
72671
  if (ts.isEntityName(name)) {
72547
72672
  var meaning = 788968 | 1920 | 111551;
72548
- var symbol = resolveEntityName(name, meaning, false, true, ts.getHostSignatureFromJSDoc(name));
72673
+ var symbol = resolveEntityName(name, meaning, ignoreErrors, true, ts.getHostSignatureFromJSDoc(name));
72549
72674
  if (!symbol && ts.isIdentifier(name) && container) {
72550
72675
  symbol = getMergedSymbol(getSymbol(getExportsOfSymbol(container), name.escapedText, meaning));
72551
72676
  }
@@ -72553,7 +72678,7 @@ var ts;
72553
72678
  return symbol;
72554
72679
  }
72555
72680
  }
72556
- var left = ts.isIdentifier(name) ? container : resolveJSDocMemberName(name.left);
72681
+ var left = ts.isIdentifier(name) ? container : resolveJSDocMemberName(name.left, ignoreErrors, container);
72557
72682
  var right = ts.isIdentifier(name) ? name.escapedText : name.right.escapedText;
72558
72683
  if (left) {
72559
72684
  var proto = left.flags & 111551 && getPropertyOfType(getTypeOfSymbol(left), "prototype");
@@ -90914,7 +91039,8 @@ var ts;
90914
91039
  return;
90915
91040
  }
90916
91041
  var version = ts.version;
90917
- 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 });
90918
91044
  }
90919
91045
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
90920
91046
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -91055,12 +91181,17 @@ var ts;
91055
91181
  if (sourceMapFilePath) {
91056
91182
  var sourceMap = sourceMapGenerator.toString();
91057
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));
91058
91186
  }
91059
91187
  }
91060
91188
  else {
91061
91189
  writer.writeLine();
91062
91190
  }
91063
- 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));
91064
91195
  writer.clear();
91065
91196
  }
91066
91197
  function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
@@ -91185,30 +91316,50 @@ var ts;
91185
91316
  });
91186
91317
  }
91187
91318
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
91319
+ var createHash = ts.maybeBind(host, host.createHash);
91188
91320
  var _a = getOutputPathsForBundle(config.options, false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
91189
- var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
91190
- 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))
91191
91335
  return buildInfoPath;
91192
91336
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
91193
91337
  if (!jsFileText)
91194
91338
  return jsFilePath;
91339
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
91340
+ return jsFilePath;
91195
91341
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
91196
91342
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
91197
91343
  return sourceMapFilePath || "inline sourcemap decoding";
91344
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
91345
+ return sourceMapFilePath;
91198
91346
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
91199
91347
  if (declarationFilePath && !declarationText)
91200
91348
  return declarationFilePath;
91349
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
91350
+ return declarationFilePath;
91201
91351
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
91202
91352
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
91203
91353
  return declarationMapPath || "inline sourcemap decoding";
91204
- var buildInfo = getBuildInfo(buildInfoText);
91205
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
91206
- return buildInfoPath;
91354
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
91355
+ return declarationMapPath;
91207
91356
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
91208
91357
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo, true);
91209
91358
  var outputFiles = [];
91210
91359
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
91211
91360
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
91361
+ var changedDtsText;
91362
+ var changedDtsData;
91212
91363
  var emitHost = {
91213
91364
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
91214
91365
  getCanonicalFileName: host.getCanonicalFileName,
@@ -91224,7 +91375,7 @@ var ts;
91224
91375
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
91225
91376
  getProjectReferenceRedirect: ts.returnUndefined,
91226
91377
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
91227
- writeFile: function (name, text, writeByteOrderMark) {
91378
+ writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
91228
91379
  switch (name) {
91229
91380
  case jsFilePath:
91230
91381
  if (jsFileText === text)
@@ -91235,19 +91386,25 @@ var ts;
91235
91386
  return;
91236
91387
  break;
91237
91388
  case buildInfoPath:
91238
- var newBuildInfo = getBuildInfo(text);
91389
+ var newBuildInfo = data.buildInfo;
91239
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
+ }
91240
91395
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
91241
91396
  newBuildInfo.bundle.js.sources = js.sources;
91242
91397
  if (dts) {
91243
91398
  newBuildInfo.bundle.dts.sources = dts.sources;
91244
91399
  }
91245
91400
  newBuildInfo.bundle.sourceFiles = sourceFiles;
91246
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
91401
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
91247
91402
  return;
91248
91403
  case declarationFilePath:
91249
91404
  if (declarationText === text)
91250
91405
  return;
91406
+ changedDtsText = text;
91407
+ changedDtsData = data;
91251
91408
  break;
91252
91409
  case declarationMapPath:
91253
91410
  if (declarationMapText === text)
@@ -91266,6 +91423,7 @@ var ts;
91266
91423
  getSourceFileFromReference: ts.returnUndefined,
91267
91424
  redirectTargetsMap: ts.createMultiMap(),
91268
91425
  getFileIncludeReasons: ts.notImplemented,
91426
+ createHash: createHash,
91269
91427
  };
91270
91428
  emitFiles(ts.notImplementedResolver, emitHost, undefined, ts.getTransformers(config.options, customTransformers));
91271
91429
  return outputFiles;
@@ -95890,7 +96048,6 @@ var ts;
95890
96048
  if (system === void 0) { system = ts.sys; }
95891
96049
  var existingDirectories = new ts.Map();
95892
96050
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
95893
- var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
95894
96051
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
95895
96052
  var text;
95896
96053
  try {
@@ -95920,7 +96077,7 @@ var ts;
95920
96077
  function writeFile(fileName, data, writeByteOrderMark, onError) {
95921
96078
  try {
95922
96079
  ts.performance.mark("beforeIOWrite");
95923
- 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); });
95924
96081
  ts.performance.mark("afterIOWrite");
95925
96082
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
95926
96083
  }
@@ -95930,34 +96087,6 @@ var ts;
95930
96087
  }
95931
96088
  }
95932
96089
  }
95933
- var outputFingerprints;
95934
- function writeFileWorker(fileName, data, writeByteOrderMark) {
95935
- if (!ts.isWatchSet(options) || !system.getModifiedTime) {
95936
- system.writeFile(fileName, data, writeByteOrderMark);
95937
- return;
95938
- }
95939
- if (!outputFingerprints) {
95940
- outputFingerprints = new ts.Map();
95941
- }
95942
- var hash = computeHash(data);
95943
- var mtimeBefore = system.getModifiedTime(fileName);
95944
- if (mtimeBefore) {
95945
- var fingerprint = outputFingerprints.get(fileName);
95946
- if (fingerprint &&
95947
- fingerprint.byteOrderMark === writeByteOrderMark &&
95948
- fingerprint.hash === hash &&
95949
- fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
95950
- return;
95951
- }
95952
- }
95953
- system.writeFile(fileName, data, writeByteOrderMark);
95954
- var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
95955
- outputFingerprints.set(fileName, {
95956
- hash: hash,
95957
- byteOrderMark: writeByteOrderMark,
95958
- mtime: mtimeAfter
95959
- });
95960
- }
95961
96090
  function getDefaultLibLocation() {
95962
96091
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
95963
96092
  }
@@ -97331,6 +97460,7 @@ var ts;
97331
97460
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
97332
97461
  redirectTargetsMap: redirectTargetsMap,
97333
97462
  getFileIncludeReasons: program.getFileIncludeReasons,
97463
+ createHash: ts.maybeBind(host, host.createHash),
97334
97464
  };
97335
97465
  }
97336
97466
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -99237,13 +99367,9 @@ var ts;
99237
99367
  function createManyToManyPathMap() {
99238
99368
  function create(forward, reverse, deleted) {
99239
99369
  var map = {
99240
- clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
99241
- forEach: function (fn) { return forward.forEach(fn); },
99242
99370
  getKeys: function (v) { return reverse.get(v); },
99243
99371
  getValues: function (k) { return forward.get(k); },
99244
- hasKey: function (k) { return forward.has(k); },
99245
99372
  keys: function () { return forward.keys(); },
99246
- deletedKeys: function () { return deleted; },
99247
99373
  deleteKey: function (k) {
99248
99374
  (deleted || (deleted = new ts.Set())).add(k);
99249
99375
  var set = forward.get(k);
@@ -99270,11 +99396,6 @@ var ts;
99270
99396
  });
99271
99397
  return map;
99272
99398
  },
99273
- clear: function () {
99274
- forward.clear();
99275
- reverse.clear();
99276
- deleted === null || deleted === void 0 ? void 0 : deleted.clear();
99277
- }
99278
99399
  };
99279
99400
  return map;
99280
99401
  }
@@ -99378,35 +99499,45 @@ var ts;
99378
99499
  }
99379
99500
  BuilderState.canReuseOldState = canReuseOldState;
99380
99501
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
99502
+ var _a, _b, _c;
99381
99503
  var fileInfos = new ts.Map();
99382
99504
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
99383
99505
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
99384
- var hasCalledUpdateShapeSignature = new ts.Set();
99385
99506
  var useOldState = canReuseOldState(referencedMap, oldState);
99386
99507
  newProgram.getTypeChecker();
99387
- for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
99388
- var sourceFile = _a[_i];
99508
+ for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
99509
+ var sourceFile = _d[_i];
99389
99510
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
99390
- 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;
99391
99515
  if (referencedMap) {
99392
99516
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
99393
99517
  if (newReferences) {
99394
99518
  referencedMap.set(sourceFile.resolvedPath, newReferences);
99395
99519
  }
99396
99520
  if (useOldState) {
99397
- 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;
99398
99525
  if (exportedModules) {
99399
99526
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
99400
99527
  }
99401
99528
  }
99402
99529
  }
99403
- 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
+ });
99404
99536
  }
99405
99537
  return {
99406
99538
  fileInfos: fileInfos,
99407
99539
  referencedMap: referencedMap,
99408
99540
  exportedModulesMap: exportedModulesMap,
99409
- hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
99410
99541
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
99411
99542
  };
99412
99543
  }
@@ -99416,52 +99547,36 @@ var ts;
99416
99547
  state.allFileNames = undefined;
99417
99548
  }
99418
99549
  BuilderState.releaseCache = releaseCache;
99419
- function clone(state) {
99550
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
99420
99551
  var _a, _b;
99421
- return {
99422
- fileInfos: new ts.Map(state.fileInfos),
99423
- referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
99424
- exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
99425
- hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
99426
- useFileVersionAsSignature: state.useFileVersionAsSignature,
99427
- };
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;
99428
99556
  }
99429
- BuilderState.clone = clone;
99430
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
99431
- var signatureCache = cacheToUpdateSignature || new ts.Map();
99557
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
99558
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
99432
99559
  var sourceFile = programOfThisState.getSourceFileByPath(path);
99433
99560
  if (!sourceFile) {
99434
99561
  return ts.emptyArray;
99435
99562
  }
99436
- if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
99563
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
99437
99564
  return [sourceFile];
99438
99565
  }
99439
- var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
99440
- if (!cacheToUpdateSignature) {
99441
- updateSignaturesFromCache(state, signatureCache);
99442
- }
99443
- return result;
99566
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
99444
99567
  }
99445
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
99446
- function updateSignaturesFromCache(state, signatureCache) {
99447
- signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
99448
- }
99449
- BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
99568
+ BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
99450
99569
  function updateSignatureOfFile(state, signature, path) {
99451
99570
  state.fileInfos.get(path).signature = signature;
99452
- state.hasCalledUpdateShapeSignature.add(path);
99571
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
99453
99572
  }
99454
99573
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
99455
- function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
99574
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
99575
+ var _a;
99456
99576
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
99457
- ts.Debug.assert(!!sourceFile);
99458
- ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
99459
- 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))
99460
99578
  return false;
99461
- }
99462
99579
  var info = state.fileInfos.get(sourceFile.resolvedPath);
99463
- if (!info)
99464
- return ts.Debug.fail();
99465
99580
  var prevSignature = info.signature;
99466
99581
  var latestSignature;
99467
99582
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -99469,40 +99584,50 @@ var ts;
99469
99584
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
99470
99585
  if (firstDts_1) {
99471
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; })); });
99472
- latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
99473
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
99474
- updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
99587
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
99588
+ if (latestSignature !== prevSignature) {
99589
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
99475
99590
  }
99476
99591
  }
99477
99592
  }
99478
99593
  if (latestSignature === undefined) {
99479
99594
  latestSignature = sourceFile.version;
99480
- 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);
99481
99597
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
99482
99598
  if (references) {
99483
- exportedModulesMapCache.set(sourceFile.resolvedPath, references);
99599
+ state.exportedModulesMap.set(sourceFile.resolvedPath, references);
99484
99600
  }
99485
99601
  else {
99486
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
99602
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
99487
99603
  }
99488
99604
  }
99489
99605
  }
99490
- 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;
99491
99609
  return latestSignature !== prevSignature;
99492
99610
  }
99493
99611
  BuilderState.updateShapeSignature = updateShapeSignature;
99494
- 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);
99495
99620
  if (!exportedModulesFromDeclarationEmit) {
99496
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
99621
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
99497
99622
  return;
99498
99623
  }
99499
99624
  var exportedModules;
99500
99625
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
99501
99626
  if (exportedModules) {
99502
- exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
99627
+ state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
99503
99628
  }
99504
99629
  else {
99505
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
99630
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
99506
99631
  }
99507
99632
  function addExportedModule(exportedModulePaths) {
99508
99633
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -99514,15 +99639,6 @@ var ts;
99514
99639
  }
99515
99640
  }
99516
99641
  BuilderState.updateExportedModules = updateExportedModules;
99517
- function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
99518
- var _a;
99519
- if (exportedModulesMapCache) {
99520
- ts.Debug.assert(!!state.exportedModulesMap);
99521
- (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
99522
- exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
99523
- }
99524
- }
99525
- BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
99526
99642
  function getAllDependencies(state, programOfThisState, sourceFile) {
99527
99643
  var compilerOptions = programOfThisState.getCompilerOptions();
99528
99644
  if (ts.outFile(compilerOptions)) {
@@ -99606,7 +99722,7 @@ var ts;
99606
99722
  }
99607
99723
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
99608
99724
  }
99609
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
99725
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
99610
99726
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
99611
99727
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
99612
99728
  }
@@ -99622,7 +99738,7 @@ var ts;
99622
99738
  if (!seenFileNamesMap.has(currentPath)) {
99623
99739
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
99624
99740
  seenFileNamesMap.set(currentPath, currentSourceFile);
99625
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
99741
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
99626
99742
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
99627
99743
  }
99628
99744
  }
@@ -99637,29 +99753,31 @@ var ts;
99637
99753
  return map1 === map2 || map1 !== undefined && map2 !== undefined && map1.size === map2.size && !ts.forEachKey(map1, function (key) { return !map2.has(key); });
99638
99754
  }
99639
99755
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
99756
+ var _a, _b;
99640
99757
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
99641
99758
  state.program = newProgram;
99642
99759
  var compilerOptions = newProgram.getCompilerOptions();
99643
99760
  state.compilerOptions = compilerOptions;
99644
- if (!ts.outFile(compilerOptions)) {
99761
+ var outFilePath = ts.outFile(compilerOptions);
99762
+ if (!outFilePath) {
99645
99763
  state.semanticDiagnosticsPerFile = new ts.Map();
99646
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
+ }
99647
99768
  state.changedFilesSet = new ts.Set();
99769
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
99648
99770
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
99649
99771
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
99650
99772
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
99651
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);
99652
99778
  if (useOldState) {
99653
- if (!oldState.currentChangedFilePath) {
99654
- var affectedSignatures = oldState.currentAffectedFilesSignatures;
99655
- ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
99656
- }
99657
- var changedFilesSet = oldState.changedFilesSet;
99658
- if (canCopySemanticDiagnostics) {
99659
- ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
99660
- }
99661
- changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
99662
- 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) {
99663
99781
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
99664
99782
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
99665
99783
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -99676,6 +99794,7 @@ var ts;
99676
99794
  if (!useOldState ||
99677
99795
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
99678
99796
  oldInfo.version !== info.version ||
99797
+ oldInfo.impliedFormat !== info.impliedFormat ||
99679
99798
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
99680
99799
  newReferences && ts.forEachKey(newReferences, function (path) { return !state.fileInfos.has(path) && oldState.fileInfos.has(path); })) {
99681
99800
  state.changedFilesSet.add(sourceFilePath);
@@ -99695,24 +99814,22 @@ var ts;
99695
99814
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
99696
99815
  }
99697
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
+ }
99698
99822
  });
99699
99823
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
99700
99824
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, undefined)
99701
99825
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
99702
99826
  }
99703
- else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
99827
+ else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
99704
99828
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1); });
99705
99829
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
99706
99830
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
99707
99831
  }
99708
- if (useOldState) {
99709
- ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
99710
- if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
99711
- state.changedFilesSet.add(sourceFilePath);
99712
- }
99713
- });
99714
- }
99715
- state.buildInfoEmitPending = !!state.changedFilesSet.size;
99832
+ state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
99716
99833
  return state;
99717
99834
  }
99718
99835
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -99745,33 +99862,40 @@ var ts;
99745
99862
  ts.BuilderState.releaseCache(state);
99746
99863
  state.program = undefined;
99747
99864
  }
99748
- function cloneBuilderProgramState(state) {
99749
- var _a;
99750
- var newState = ts.BuilderState.clone(state);
99751
- newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
99752
- newState.changedFilesSet = new ts.Set(state.changedFilesSet);
99753
- newState.affectedFiles = state.affectedFiles;
99754
- newState.affectedFilesIndex = state.affectedFilesIndex;
99755
- newState.currentChangedFilePath = state.currentChangedFilePath;
99756
- newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
99757
- newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
99758
- newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
99759
- newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
99760
- newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
99761
- newState.program = state.program;
99762
- newState.compilerOptions = state.compilerOptions;
99763
- newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
99764
- newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
99765
- newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
99766
- newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
99767
- newState.programEmitComplete = state.programEmitComplete;
99768
- 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;
99769
99893
  }
99770
99894
  function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
99771
99895
  ts.Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
99772
99896
  }
99773
99897
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
99774
- var _a;
99898
+ var _a, _b;
99775
99899
  while (true) {
99776
99900
  var affectedFiles = state.affectedFiles;
99777
99901
  if (affectedFiles) {
@@ -99788,10 +99912,8 @@ var ts;
99788
99912
  }
99789
99913
  state.changedFilesSet.delete(state.currentChangedFilePath);
99790
99914
  state.currentChangedFilePath = undefined;
99791
- ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
99792
- state.currentAffectedFilesSignatures.clear();
99793
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
99794
- (_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();
99795
99917
  state.affectedFiles = undefined;
99796
99918
  }
99797
99919
  var nextKey = state.changedFilesSet.keys().next();
@@ -99804,12 +99926,7 @@ var ts;
99804
99926
  ts.Debug.assert(!state.semanticDiagnosticsPerFile);
99805
99927
  return program;
99806
99928
  }
99807
- if (!state.currentAffectedFilesSignatures)
99808
- state.currentAffectedFilesSignatures = new ts.Map();
99809
- if (state.exportedModulesMap) {
99810
- state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
99811
- }
99812
- 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);
99813
99930
  state.currentChangedFilePath = nextKey.value;
99814
99931
  state.affectedFilesIndex = 0;
99815
99932
  if (!state.seenAffectedFiles)
@@ -99853,14 +99970,12 @@ var ts;
99853
99970
  }
99854
99971
  }
99855
99972
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
99856
- var _a;
99857
99973
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
99858
99974
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
99859
99975
  removeDiagnosticsOfLibraryFiles(state);
99860
- 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);
99861
99977
  return;
99862
99978
  }
99863
- 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);
99864
99979
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
99865
99980
  return;
99866
99981
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -99871,7 +99986,7 @@ var ts;
99871
99986
  var program = ts.Debug.checkDefined(state.program);
99872
99987
  var sourceFile = program.getSourceFileByPath(path);
99873
99988
  if (sourceFile) {
99874
- 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);
99875
99990
  if (ts.getEmitDeclarations(state.compilerOptions)) {
99876
99991
  addToAffectedFilesPendingEmit(state, path, 0);
99877
99992
  }
@@ -99887,24 +100002,10 @@ var ts;
99887
100002
  return !state.semanticDiagnosticsFromOldState.size;
99888
100003
  }
99889
100004
  function isChangedSignature(state, path) {
99890
- var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
99891
- 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;
99892
100007
  return newSignature !== oldSignature;
99893
100008
  }
99894
- function forEachKeyOfExportedModulesMap(state, filePath, fn) {
99895
- var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
99896
- var result = keys && ts.forEachKey(keys, fn);
99897
- if (result)
99898
- return result;
99899
- keys = state.exportedModulesMap.getKeys(filePath);
99900
- return keys && ts.forEachKey(keys, function (exportedFromPath) {
99901
- var _a;
99902
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
99903
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
99904
- fn(exportedFromPath) :
99905
- undefined;
99906
- });
99907
- }
99908
100009
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
99909
100010
  var _a;
99910
100011
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -99915,6 +100016,7 @@ var ts;
99915
100016
  return true;
99916
100017
  }
99917
100018
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
100019
+ var _a;
99918
100020
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
99919
100021
  return;
99920
100022
  if (!isChangedSignature(state, affectedFile.resolvedPath))
@@ -99937,9 +100039,8 @@ var ts;
99937
100039
  }
99938
100040
  }
99939
100041
  }
99940
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
99941
100042
  var seenFileAndExportsOfFile = new ts.Set();
99942
- forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
100043
+ (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
99943
100044
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
99944
100045
  return true;
99945
100046
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -99949,17 +100050,16 @@ var ts;
99949
100050
  });
99950
100051
  }
99951
100052
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
99952
- var _a;
100053
+ var _a, _b;
99953
100054
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
99954
100055
  return undefined;
99955
100056
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
99956
100057
  return true;
99957
100058
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
99958
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
99959
- forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
100059
+ (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
99960
100060
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
99961
100061
  });
99962
- (_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) {
99963
100063
  return !seenFileAndExportsOfFile.has(referencingFilePath) &&
99964
100064
  handleDtsMayChangeOf(state, referencingFilePath, cancellationToken, computeHash, host);
99965
100065
  });
@@ -99975,12 +100075,12 @@ var ts;
99975
100075
  }
99976
100076
  else {
99977
100077
  state.seenAffectedFiles.add(affected.resolvedPath);
100078
+ state.buildInfoEmitPending = true;
99978
100079
  if (emitKind !== undefined) {
99979
100080
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
99980
100081
  }
99981
100082
  if (isPendingEmit) {
99982
100083
  state.affectedFilesPendingEmitIndex++;
99983
- state.buildInfoEmitPending = true;
99984
100084
  }
99985
100085
  else {
99986
100086
  state.affectedFilesIndex++;
@@ -100012,29 +100112,65 @@ var ts;
100012
100112
  }
100013
100113
  return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
100014
100114
  }
100015
- function getProgramBuildInfo(state, getCanonicalFileName) {
100016
- if (ts.outFile(state.compilerOptions))
100017
- 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;
100018
100123
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
100019
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
+ }
100020
100145
  var fileNames = [];
100021
100146
  var fileNameToFileId = new ts.Map();
100022
100147
  var fileIdsList;
100023
100148
  var fileNamesToFileIdListId;
100149
+ var emitSignatures;
100024
100150
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
100151
+ var _b, _c;
100025
100152
  var key = _a[0], value = _a[1];
100026
100153
  var fileId = toFileId(key);
100027
100154
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
100028
- var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
100029
- 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
+ }
100030
100166
  return value.version === actualSignature ?
100031
100167
  value.affectsGlobalScope || value.impliedFormat ?
100032
100168
  { version: value.version, signature: undefined, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
100033
100169
  value.version :
100034
100170
  actualSignature !== undefined ?
100035
- signature === undefined ?
100171
+ oldSignature === undefined ?
100036
100172
  value :
100037
- { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
100173
+ { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
100038
100174
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
100039
100175
  });
100040
100176
  var referencedMap;
@@ -100048,16 +100184,12 @@ var ts;
100048
100184
  if (state.exportedModulesMap) {
100049
100185
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
100050
100186
  var _a;
100051
- if (state.currentAffectedFilesExportedModulesMap) {
100052
- if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
100053
- return undefined;
100054
- }
100055
- var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
100056
- if (newValue) {
100057
- return [toFileId(key), toFileIdListId(newValue)];
100058
- }
100059
- }
100060
- 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;
100061
100193
  });
100062
100194
  }
100063
100195
  var semanticDiagnosticsPerFile;
@@ -100068,9 +100200,7 @@ var ts;
100068
100200
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
100069
100201
  [
100070
100202
  toFileId(key),
100071
- state.hasReusableDiagnostic ?
100072
- value :
100073
- convertToReusableDiagnostics(value, relativeToBuildInfo)
100203
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
100074
100204
  ] :
100075
100205
  toFileId(key));
100076
100206
  }
@@ -100085,16 +100215,27 @@ var ts;
100085
100215
  }
100086
100216
  }
100087
100217
  }
100088
- 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 = {
100089
100226
  fileNames: fileNames,
100090
100227
  fileInfos: fileInfos,
100091
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
100228
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
100092
100229
  fileIdsList: fileIdsList,
100093
100230
  referencedMap: referencedMap,
100094
100231
  exportedModulesMap: exportedModulesMap,
100095
100232
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
100096
100233
  affectedFilesPendingEmit: affectedFilesPendingEmit,
100234
+ changeFileSet: changeFileSet,
100235
+ emitSignatures: emitSignatures,
100236
+ dtsChangeTime: state.dtsChangeTime,
100097
100237
  };
100238
+ return result;
100098
100239
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
100099
100240
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
100100
100241
  }
@@ -100119,21 +100260,18 @@ var ts;
100119
100260
  }
100120
100261
  return fileIdListId;
100121
100262
  }
100122
- }
100123
- function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
100124
- var result;
100125
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
100126
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
100127
- var name = _a[_i];
100128
- var optionKey = name.toLowerCase();
100129
- var optionInfo = optionsNameMap.get(optionKey);
100130
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
100131
- optionKey === "strict" ||
100132
- optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
100133
- (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
+ }
100134
100272
  }
100273
+ return result;
100135
100274
  }
100136
- return result;
100137
100275
  }
100138
100276
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
100139
100277
  if (option) {
@@ -100207,6 +100345,10 @@ var ts;
100207
100345
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
100208
100346
  }
100209
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;
100210
100352
  function createBuilderProgram(kind, _a) {
100211
100353
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
100212
100354
  var oldState = oldProgram && oldProgram.getState();
@@ -100218,29 +100360,19 @@ var ts;
100218
100360
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
100219
100361
  var computeHash = ts.maybeBind(host, host.createHash);
100220
100362
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
100221
- var backupState;
100222
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
100363
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
100223
100364
  newProgram = undefined;
100224
100365
  oldProgram = undefined;
100225
100366
  oldState = undefined;
100226
100367
  var getState = function () { return state; };
100227
100368
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
100228
100369
  builderProgram.getState = getState;
100229
- builderProgram.backupState = function () {
100230
- ts.Debug.assert(backupState === undefined);
100231
- backupState = cloneBuilderProgramState(state);
100232
- };
100233
- builderProgram.restoreState = function () {
100234
- state = ts.Debug.checkDefined(backupState);
100235
- backupState = undefined;
100236
- };
100370
+ builderProgram.saveEmitState = function () { return backupBuilderProgramEmitState(state); };
100371
+ builderProgram.restoreEmitState = function (saved) { return restoreBuilderProgramEmitState(state, saved); };
100237
100372
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
100238
100373
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
100239
100374
  builderProgram.emit = emit;
100240
- builderProgram.releaseProgram = function () {
100241
- releaseCache(state);
100242
- backupState = undefined;
100243
- };
100375
+ builderProgram.releaseProgram = function () { return releaseCache(state); };
100244
100376
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
100245
100377
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
100246
100378
  }
@@ -100285,35 +100417,57 @@ var ts;
100285
100417
  affected = program;
100286
100418
  }
100287
100419
  }
100288
- return toAffectedFileEmitResult(state, ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
100289
- 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) :
100290
100422
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0, customTransformers), affected, emitKind, isPendingEmitFile);
100291
100423
  }
100292
- function getWriteFileUpdatingSignatureCallback(writeFile) {
100424
+ function getWriteFileCallback(writeFile, customTransformers) {
100293
100425
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
100294
- var _a;
100426
+ var _a, _b, _c;
100295
100427
  if (ts.isDeclarationFileName(fileName)) {
100296
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
100297
- var file = sourceFiles[0];
100298
- var info = state.fileInfos.get(file.resolvedPath);
100299
- var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
100300
- if (signature === file.version) {
100301
- var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
100302
- if (newSignature !== file.version) {
100303
- if (host.storeFilesChangingSignatureDuringEmit)
100304
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
100305
- if (state.exportedModulesMap)
100306
- ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
100307
- if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
100308
- 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
+ }
100309
100452
  }
100310
- else {
100311
- info.signature = newSignature;
100312
- if (state.exportedModulesMap)
100313
- 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;
100314
100461
  }
100315
100462
  }
100316
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
+ }
100317
100471
  }
100318
100472
  if (writeFile)
100319
100473
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -100362,8 +100516,8 @@ var ts;
100362
100516
  }
100363
100517
  }
100364
100518
  }
100365
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
100366
- getWriteFileUpdatingSignatureCallback(writeFile) :
100519
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
100520
+ getWriteFileCallback(writeFile, customTransformers) :
100367
100521
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
100368
100522
  }
100369
100523
  function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
@@ -100426,29 +100580,58 @@ var ts;
100426
100580
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
100427
100581
  }
100428
100582
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
100429
- function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
100430
- var _a;
100583
+ function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
100584
+ var _a, _b, _c, _d;
100431
100585
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
100432
100586
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
100433
- var filePaths = program.fileNames.map(toPath);
100434
- var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
100435
- var fileInfos = new ts.Map();
100436
- program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
100437
- var state = {
100438
- fileInfos: fileInfos,
100439
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
100440
- referencedMap: toManyToManyPathMap(program.referencedMap),
100441
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
100442
- 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]; }),
100443
- hasReusableDiagnostic: true,
100444
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
100445
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
100446
- affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
100447
- };
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
+ }
100448
100631
  return {
100449
100632
  getState: function () { return state; },
100450
- backupState: ts.noop,
100451
- restoreState: ts.noop,
100633
+ saveEmitState: ts.noop,
100634
+ restoreEmitState: ts.noop,
100452
100635
  getProgram: ts.notImplemented,
100453
100636
  getProgramOrUndefined: ts.returnUndefined,
100454
100637
  releaseProgram: ts.noop,
@@ -100493,12 +100676,24 @@ var ts;
100493
100676
  return map;
100494
100677
  }
100495
100678
  }
100496
- 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;
100497
100692
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
100498
100693
  return {
100499
100694
  getState: ts.notImplemented,
100500
- backupState: ts.noop,
100501
- restoreState: ts.noop,
100695
+ saveEmitState: ts.noop,
100696
+ restoreEmitState: ts.noop,
100502
100697
  getProgram: getProgram,
100503
100698
  getProgramOrUndefined: function () { return getState().program; },
100504
100699
  releaseProgram: function () { return getState().program = undefined; },
@@ -100589,8 +100784,10 @@ var ts;
100589
100784
  var filesWithInvalidatedNonRelativeUnresolvedImports;
100590
100785
  var nonRelativeExternalModuleResolutions = ts.createMultiMap();
100591
100786
  var resolutionsWithFailedLookups = [];
100787
+ var resolutionsWithOnlyAffectingLocations = [];
100592
100788
  var resolvedFileToResolution = ts.createMultiMap();
100593
100789
  var hasChangedAutomaticTypeDirectiveNames = false;
100790
+ var affectingPathChecks;
100594
100791
  var failedLookupChecks;
100595
100792
  var startsWithPathChecks;
100596
100793
  var isInDirectoryChecks;
@@ -100606,6 +100803,7 @@ var ts;
100606
100803
  var failedLookupDefaultExtensions = [".ts", ".tsx", ".js", ".jsx", ".json"];
100607
100804
  var customFailedLookupPaths = new ts.Map();
100608
100805
  var directoryWatchesOfFailedLookups = new ts.Map();
100806
+ var fileWatchesOfAffectingLocations = new ts.Map();
100609
100807
  var rootDir = rootDirForResolution && ts.removeTrailingDirectorySeparator(ts.getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()));
100610
100808
  var rootPath = (rootDir && resolutionHost.toPath(rootDir));
100611
100809
  var rootSplitLength = rootPath !== undefined ? rootPath.split(ts.directorySeparator).length : 0;
@@ -100645,6 +100843,7 @@ var ts;
100645
100843
  }
100646
100844
  function clear() {
100647
100845
  ts.clearMap(directoryWatchesOfFailedLookups, ts.closeFileWatcherOf);
100846
+ ts.clearMap(fileWatchesOfAffectingLocations, ts.closeFileWatcherOf);
100648
100847
  customFailedLookupPaths.clear();
100649
100848
  nonRelativeExternalModuleResolutions.clear();
100650
100849
  closeTypeRootsWatch();
@@ -100652,9 +100851,11 @@ var ts;
100652
100851
  resolvedTypeReferenceDirectives.clear();
100653
100852
  resolvedFileToResolution.clear();
100654
100853
  resolutionsWithFailedLookups.length = 0;
100854
+ resolutionsWithOnlyAffectingLocations.length = 0;
100655
100855
  failedLookupChecks = undefined;
100656
100856
  startsWithPathChecks = undefined;
100657
100857
  isInDirectoryChecks = undefined;
100858
+ affectingPathChecks = undefined;
100658
100859
  clearPerDirectoryResolutions();
100659
100860
  hasChangedAutomaticTypeDirectiveNames = false;
100660
100861
  }
@@ -100699,20 +100900,28 @@ var ts;
100699
100900
  watcher.watcher.close();
100700
100901
  }
100701
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
+ });
100702
100910
  hasChangedAutomaticTypeDirectiveNames = false;
100703
100911
  }
100704
100912
  function resolveModuleName(moduleName, containingFile, compilerOptions, host, redirectedReference, _containingSourceFile, mode) {
100705
- var _a;
100913
+ var _a, _b;
100706
100914
  var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
100707
100915
  if (!resolutionHost.getGlobalCache) {
100708
100916
  return primaryResult;
100709
100917
  }
100710
100918
  var globalCache = resolutionHost.getGlobalCache();
100711
100919
  if (globalCache !== undefined && !ts.isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && ts.extensionIsTS(primaryResult.resolvedModule.extension))) {
100712
- 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;
100713
100921
  if (resolvedModule) {
100714
100922
  primaryResult.resolvedModule = resolvedModule;
100715
100923
  (_a = primaryResult.failedLookupLocations).push.apply(_a, failedLookupLocations);
100924
+ (_b = primaryResult.affectingLocations).push.apply(_b, affectingLocations);
100716
100925
  return primaryResult;
100717
100926
  }
100718
100927
  }
@@ -100946,10 +101155,11 @@ var ts;
100946
101155
  }
100947
101156
  function watchFailedLookupLocationOfResolution(resolution) {
100948
101157
  ts.Debug.assert(!!resolution.refCount);
100949
- var failedLookupLocations = resolution.failedLookupLocations;
100950
- if (!failedLookupLocations.length)
101158
+ var failedLookupLocations = resolution.failedLookupLocations, affectingLocations = resolution.affectingLocations;
101159
+ if (!failedLookupLocations.length && !affectingLocations.length)
100951
101160
  return;
100952
- resolutionsWithFailedLookups.push(resolution);
101161
+ if (failedLookupLocations.length)
101162
+ resolutionsWithFailedLookups.push(resolution);
100953
101163
  var setAtRoot = false;
100954
101164
  for (var _i = 0, failedLookupLocations_1 = failedLookupLocations; _i < failedLookupLocations_1.length; _i++) {
100955
101165
  var failedLookupLocation = failedLookupLocations_1[_i];
@@ -100973,12 +101183,65 @@ var ts;
100973
101183
  if (setAtRoot) {
100974
101184
  setDirectoryWatcher(rootDir, rootPath, true);
100975
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
+ }
100976
101236
  }
100977
101237
  function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
100978
101238
  var program = resolutionHost.getCurrentProgram();
100979
101239
  if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
100980
101240
  resolutions.forEach(watchFailedLookupLocationOfResolution);
100981
101241
  }
101242
+ else {
101243
+ resolutions.forEach(function (resolution) { return watchAffectingLocationsOfResolution(resolution, true); });
101244
+ }
100982
101245
  }
100983
101246
  function setDirectoryWatcher(dir, dirPath, nonRecursive) {
100984
101247
  var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
@@ -101000,37 +101263,44 @@ var ts;
101000
101263
  if (resolved && resolved.resolvedFileName) {
101001
101264
  resolvedFileToResolution.remove(resolutionHost.toPath(resolved.resolvedFileName), resolution);
101002
101265
  }
101003
- if (!ts.unorderedRemoveItem(resolutionsWithFailedLookups, resolution)) {
101004
- return;
101005
- }
101006
- var failedLookupLocations = resolution.failedLookupLocations;
101007
- var removeAtRoot = false;
101008
- for (var _i = 0, failedLookupLocations_2 = failedLookupLocations; _i < failedLookupLocations_2.length; _i++) {
101009
- var failedLookupLocation = failedLookupLocations_2[_i];
101010
- var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
101011
- var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
101012
- if (toWatch) {
101013
- var dirPath = toWatch.dirPath;
101014
- var refCount = customFailedLookupPaths.get(failedLookupLocationPath);
101015
- if (refCount) {
101016
- if (refCount === 1) {
101017
- 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;
101018
101287
  }
101019
101288
  else {
101020
- ts.Debug.assert(refCount > 1);
101021
- customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1);
101289
+ removeDirectoryWatcher(dirPath);
101022
101290
  }
101023
101291
  }
101024
- if (dirPath === rootPath) {
101025
- removeAtRoot = true;
101026
- }
101027
- else {
101028
- removeDirectoryWatcher(dirPath);
101029
- }
101292
+ }
101293
+ if (removeAtRoot) {
101294
+ removeDirectoryWatcher(rootPath);
101030
101295
  }
101031
101296
  }
101032
- if (removeAtRoot) {
101033
- removeDirectoryWatcher(rootPath);
101297
+ else if (affectingLocations.length) {
101298
+ ts.unorderedRemoveItem(resolutionsWithOnlyAffectingLocations, resolution);
101299
+ }
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--;
101034
101304
  }
101035
101305
  }
101036
101306
  function removeDirectoryWatcher(dirPath) {
@@ -101100,7 +101370,7 @@ var ts;
101100
101370
  }
101101
101371
  function scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, isCreatingWatchedDirectory) {
101102
101372
  if (isCreatingWatchedDirectory) {
101103
- (isInDirectoryChecks || (isInDirectoryChecks = [])).push(fileOrDirectoryPath);
101373
+ (isInDirectoryChecks || (isInDirectoryChecks = new ts.Set())).add(fileOrDirectoryPath);
101104
101374
  }
101105
101375
  else {
101106
101376
  var updatedPath = removeIgnoredPath(fileOrDirectoryPath);
@@ -101113,7 +101383,7 @@ var ts;
101113
101383
  var dirOfFileOrDirectory = ts.getDirectoryPath(fileOrDirectoryPath);
101114
101384
  if (isNodeModulesAtTypesDirectory(fileOrDirectoryPath) || ts.isNodeModulesDirectory(fileOrDirectoryPath) ||
101115
101385
  isNodeModulesAtTypesDirectory(dirOfFileOrDirectory) || ts.isNodeModulesDirectory(dirOfFileOrDirectory)) {
101116
- (failedLookupChecks || (failedLookupChecks = [])).push(fileOrDirectoryPath);
101386
+ (failedLookupChecks || (failedLookupChecks = new ts.Set())).add(fileOrDirectoryPath);
101117
101387
  (startsWithPathChecks || (startsWithPathChecks = new ts.Set())).add(fileOrDirectoryPath);
101118
101388
  }
101119
101389
  else {
@@ -101123,7 +101393,7 @@ var ts;
101123
101393
  if (ts.isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
101124
101394
  return false;
101125
101395
  }
101126
- (failedLookupChecks || (failedLookupChecks = [])).push(fileOrDirectoryPath);
101396
+ (failedLookupChecks || (failedLookupChecks = new ts.Set())).add(fileOrDirectoryPath);
101127
101397
  var packagePath = ts.parseNodeModuleFromPath(fileOrDirectoryPath);
101128
101398
  if (packagePath)
101129
101399
  (startsWithPathChecks || (startsWithPathChecks = new ts.Set())).add(packagePath);
@@ -101132,21 +101402,32 @@ var ts;
101132
101402
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
101133
101403
  }
101134
101404
  function invalidateResolutionsOfFailedLookupLocations() {
101135
- if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks) {
101405
+ if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks && !affectingPathChecks) {
101136
101406
  return false;
101137
101407
  }
101138
101408
  var invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution);
101139
101409
  failedLookupChecks = undefined;
101140
101410
  startsWithPathChecks = undefined;
101141
101411
  isInDirectoryChecks = undefined;
101412
+ invalidated = invalidateResolutions(resolutionsWithOnlyAffectingLocations, canInvalidatedFailedLookupResolutionWithAffectingLocation) || invalidated;
101413
+ affectingPathChecks = undefined;
101142
101414
  return invalidated;
101143
101415
  }
101144
101416
  function canInvalidateFailedLookupResolution(resolution) {
101417
+ if (canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution))
101418
+ return true;
101419
+ if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
101420
+ return false;
101145
101421
  return resolution.failedLookupLocations.some(function (location) {
101146
101422
  var locationPath = resolutionHost.toPath(location);
101147
- return ts.contains(failedLookupChecks, locationPath) ||
101423
+ return (failedLookupChecks === null || failedLookupChecks === void 0 ? void 0 : failedLookupChecks.has(locationPath)) ||
101148
101424
  ts.firstDefinedIterator((startsWithPathChecks === null || startsWithPathChecks === void 0 ? void 0 : startsWithPathChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return ts.startsWith(locationPath, fileOrDirectoryPath) ? true : undefined; }) ||
101149
- (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));
101150
101431
  });
101151
101432
  }
101152
101433
  function closeTypeRootsWatch() {
@@ -101449,9 +101730,9 @@ var ts;
101449
101730
  var targets = importedFileNames.map(function (f) { return ts.getNormalizedAbsolutePath(f, cwd); });
101450
101731
  var shouldFilterIgnoredPaths = !ts.every(targets, ts.containsIgnoredPath);
101451
101732
  if (!preferSymlinks) {
101452
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
101453
- if (result_15)
101454
- 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;
101455
101736
  }
101456
101737
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
101457
101738
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -101470,10 +101751,10 @@ var ts;
101470
101751
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
101471
101752
  var symlinkDirectory = symlinkDirectories_1[_i];
101472
101753
  var option = ts.resolvePath(symlinkDirectory, relative);
101473
- var result_16 = cb(option, target === referenceRedirect);
101754
+ var result_17 = cb(option, target === referenceRedirect);
101474
101755
  shouldFilterIgnoredPaths = true;
101475
- if (result_16)
101476
- return result_16;
101756
+ if (result_17)
101757
+ return result_17;
101477
101758
  }
101478
101759
  });
101479
101760
  });
@@ -102305,6 +102586,7 @@ var ts;
102305
102586
  readDirectory: ts.maybeBind(host, host.readDirectory),
102306
102587
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
102307
102588
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
102589
+ now: ts.maybeBind(host, host.now),
102308
102590
  };
102309
102591
  function writeFile(fileName, text, writeByteOrderMark, onError) {
102310
102592
  try {
@@ -102359,6 +102641,7 @@ var ts;
102359
102641
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
102360
102642
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
102361
102643
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
102644
+ now: ts.maybeBind(system, system.now),
102362
102645
  };
102363
102646
  }
102364
102647
  ts.createProgramHost = createProgramHost;
@@ -102414,20 +102697,26 @@ var ts;
102414
102697
  var ts;
102415
102698
  (function (ts) {
102416
102699
  function readBuilderProgram(compilerOptions, host) {
102417
- if (ts.outFile(compilerOptions))
102418
- return undefined;
102419
102700
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
102420
102701
  if (!buildInfoPath)
102421
102702
  return undefined;
102422
- var content = host.readFile(buildInfoPath);
102423
- if (!content)
102424
- return undefined;
102425
- 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
+ }
102426
102715
  if (buildInfo.version !== ts.version)
102427
102716
  return undefined;
102428
102717
  if (!buildInfo.program)
102429
102718
  return undefined;
102430
- return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
102719
+ return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
102431
102720
  }
102432
102721
  ts.readBuilderProgram = readBuilderProgram;
102433
102722
  function createIncrementalCompilerHost(options, system) {
@@ -102436,6 +102725,7 @@ var ts;
102436
102725
  host.createHash = ts.maybeBind(system, system.createHash);
102437
102726
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
102438
102727
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
102728
+ host.now = ts.maybeBind(system, system.now);
102439
102729
  ts.setGetSourceFileAsHashVersioned(host, system);
102440
102730
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
102441
102731
  return host;
@@ -102480,7 +102770,6 @@ var ts;
102480
102770
  var builderProgram;
102481
102771
  var reloadLevel;
102482
102772
  var missingFilesMap;
102483
- var packageJsonMap;
102484
102773
  var watchedWildcardDirectories;
102485
102774
  var timerToUpdateProgram;
102486
102775
  var timerToInvalidateFailedLookupResolutions;
@@ -102541,6 +102830,7 @@ var ts;
102541
102830
  compilerHost.getCompilationSettings = function () { return compilerOptions; };
102542
102831
  compilerHost.useSourceOfProjectReferenceRedirect = ts.maybeBind(host, host.useSourceOfProjectReferenceRedirect);
102543
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); };
102544
102834
  compilerHost.watchTypeRootsDirectory = function (dir, cb, flags) { return watchDirectory(dir, cb, flags, watchOptions, ts.WatchType.TypeRoots); };
102545
102835
  compilerHost.getCachedDirectoryStructureHost = function () { return cachedDirectoryStructureHost; };
102546
102836
  compilerHost.scheduleInvalidateResolutionsOfFailedLookupLocations = scheduleInvalidateResolutionsOfFailedLookupLocations;
@@ -102618,10 +102908,6 @@ var ts;
102618
102908
  });
102619
102909
  parsedConfigs = undefined;
102620
102910
  }
102621
- if (packageJsonMap) {
102622
- ts.clearMap(packageJsonMap, ts.closeFileWatcher);
102623
- packageJsonMap = undefined;
102624
- }
102625
102911
  }
102626
102912
  function getCurrentBuilderProgram() {
102627
102913
  return builderProgram;
@@ -102675,13 +102961,8 @@ var ts;
102675
102961
  compilerHost.hasInvalidatedResolution = hasInvalidatedResolution;
102676
102962
  compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
102677
102963
  builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
102678
- var packageCacheEntries = ts.map(resolutionCache.getModuleResolutionCache().getPackageJsonInfoCache().entries(), function (_a) {
102679
- var path = _a[0], data = _a[1];
102680
- return [compilerHost.realpath ? toPath(compilerHost.realpath(path)) : path, data];
102681
- });
102682
102964
  resolutionCache.finishCachingPerDirectoryResolution();
102683
102965
  ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = new ts.Map()), watchMissingFilePath);
102684
- ts.updatePackageJsonWatch(packageCacheEntries, packageJsonMap || (packageJsonMap = new ts.Map()), watchPackageJsonLookupPath);
102685
102966
  if (needsUpdateInTypeRootWatch) {
102686
102967
  resolutionCache.updateTypeRootsWatch();
102687
102968
  }
@@ -102958,17 +103239,6 @@ var ts;
102958
103239
  ts.noopFileWatcher :
102959
103240
  watchFilePath(missingFilePath, missingFilePath, onMissingFileChange, ts.PollingInterval.Medium, watchOptions, ts.WatchType.MissingFile);
102960
103241
  }
102961
- function watchPackageJsonLookupPath(packageJsonPath) {
102962
- return sourceFilesCache.has(packageJsonPath) ?
102963
- ts.noopFileWatcher :
102964
- watchFilePath(packageJsonPath, packageJsonPath, onPackageJsonChange, ts.PollingInterval.High, watchOptions, ts.WatchType.PackageJson);
102965
- }
102966
- function onPackageJsonChange(fileName, eventKind, path) {
102967
- updateCachedSystemWithFile(fileName, path, eventKind);
102968
- reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
102969
- changesAffectResolution = true;
102970
- scheduleProgramUpdate();
102971
- }
102972
103242
  function onMissingFileChange(fileName, eventKind, missingFilePath) {
102973
103243
  updateCachedSystemWithFile(fileName, missingFilePath, eventKind);
102974
103244
  if (eventKind === ts.FileWatcherEventKind.Created && missingFilesMap.has(missingFilePath)) {
@@ -103099,11 +103369,14 @@ var ts;
103099
103369
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
103100
103370
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
103101
103371
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
103102
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
103103
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
103104
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
103105
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
103106
- 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";
103107
103380
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
103108
103381
  function resolveConfigFileProjectName(project) {
103109
103382
  if (ts.fileExtensionIs(project, ".json")) {
@@ -103141,9 +103414,10 @@ var ts;
103141
103414
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
103142
103415
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
103143
103416
  }
103144
- function newer(date1, date2) {
103145
- return date2 > date1 ? date2 : date1;
103417
+ function getCurrentTime(host) {
103418
+ return host.now ? host.now() : new Date();
103146
103419
  }
103420
+ ts.getCurrentTime = getCurrentTime;
103147
103421
  function isCircularBuildOrder(buildOrder) {
103148
103422
  return !!buildOrder && !!buildOrder.buildOrder;
103149
103423
  }
@@ -103227,6 +103501,7 @@ var ts;
103227
103501
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
103228
103502
  };
103229
103503
  }
103504
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), undefined); };
103230
103505
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
103231
103506
  var state = {
103232
103507
  host: host,
@@ -103242,8 +103517,9 @@ var ts;
103242
103517
  resolvedConfigFilePaths: new ts.Map(),
103243
103518
  configFileCache: new ts.Map(),
103244
103519
  projectStatus: new ts.Map(),
103245
- buildInfoChecked: new ts.Map(),
103246
103520
  extendedConfigCache: new ts.Map(),
103521
+ buildInfoCache: new ts.Map(),
103522
+ outputTimeStamps: new ts.Map(),
103247
103523
  builderPrograms: new ts.Map(),
103248
103524
  diagnostics: new ts.Map(),
103249
103525
  projectPendingBuild: new ts.Map(),
@@ -103264,6 +103540,7 @@ var ts;
103264
103540
  allWatchedConfigFiles: new ts.Map(),
103265
103541
  allWatchedExtendedConfigFiles: new ts.Map(),
103266
103542
  allWatchedPackageJsonFiles: new ts.Map(),
103543
+ filesWatched: new ts.Map(),
103267
103544
  lastCachedPackageJsonLookups: new ts.Map(),
103268
103545
  timerToBuildInvalidatedProject: undefined,
103269
103546
  reportFileChangeDetected: false,
@@ -103365,11 +103642,12 @@ var ts;
103365
103642
  var noopOnDelete = { onDeleteValue: ts.noop };
103366
103643
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
103367
103644
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
103368
- ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
103369
103645
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
103370
103646
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
103371
103647
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
103372
103648
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
103649
+ ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
103650
+ ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
103373
103651
  if (state.watch) {
103374
103652
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
103375
103653
  state.allWatchedExtendedConfigFiles.forEach(function (watcher) {
@@ -103654,16 +103932,16 @@ var ts;
103654
103932
  }
103655
103933
  function emit(writeFileCallback, cancellationToken, customTransformers) {
103656
103934
  var _a;
103657
- var _b, _c;
103935
+ var _b, _c, _d;
103658
103936
  ts.Debug.assertIsDefined(program);
103659
103937
  ts.Debug.assert(step === BuildStep.Emit);
103660
- program.backupState();
103938
+ var saved = program.saveEmitState();
103661
103939
  var declDiagnostics;
103662
103940
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
103663
103941
  var outputFiles = [];
103664
- 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;
103665
103943
  if (declDiagnostics) {
103666
- program.restoreState();
103944
+ program.restoreEmitState(saved);
103667
103945
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
103668
103946
  return {
103669
103947
  emitSkipped: true,
@@ -103672,35 +103950,43 @@ var ts;
103672
103950
  }
103673
103951
  var host = state.host, compilerHost = state.compilerHost;
103674
103952
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
103675
- var newestDeclarationFileContentChangedTime = minimumDate;
103676
- var anyDtsChanged = false;
103953
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
103677
103954
  var emitterDiagnostics = ts.createDiagnosticCollection();
103678
103955
  var emittedOutputs = new ts.Map();
103956
+ var options = program.getCompilerOptions();
103957
+ var isIncremental = ts.isIncrementalCompilation(options);
103958
+ var outputTimeStampMap;
103959
+ var now;
103679
103960
  outputFiles.forEach(function (_a) {
103680
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
103681
- var priorChangeTime;
103682
- if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
103683
- if (host.fileExists(name) && state.readFileWithCache(name) === text) {
103684
- priorChangeTime = host.getModifiedTime(name);
103685
- }
103686
- 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)) {
103687
103968
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
103688
- anyDtsChanged = true;
103689
103969
  }
103690
103970
  }
103691
- emittedOutputs.set(toPath(state, name), name);
103692
103971
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
103693
- if (priorChangeTime !== undefined) {
103694
- newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
103972
+ if (!isIncremental && state.watch) {
103973
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
103695
103974
  }
103696
103975
  });
103697
- 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);
103698
103977
  return emitResult;
103699
103978
  }
103700
103979
  function emitBuildInfo(writeFileCallback, cancellationToken) {
103701
103980
  ts.Debug.assertIsDefined(program);
103702
103981
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
103703
- 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);
103704
103990
  if (emitResult.diagnostics.length) {
103705
103991
  reportErrors(state, emitResult.diagnostics);
103706
103992
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -103713,7 +103999,7 @@ var ts;
103713
103999
  step = BuildStep.QueueReferencingProjects;
103714
104000
  return emitResult;
103715
104001
  }
103716
- function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
104002
+ function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
103717
104003
  var _a;
103718
104004
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
103719
104005
  if (emitDiagnostics.length) {
@@ -103723,13 +104009,11 @@ var ts;
103723
104009
  if (state.write) {
103724
104010
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
103725
104011
  }
103726
- 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);
103727
104013
  state.diagnostics.delete(projectPath);
103728
104014
  state.projectStatus.set(projectPath, {
103729
104015
  type: ts.UpToDateStatusType.UpToDate,
103730
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
103731
- maximumDate :
103732
- newestDeclarationFileContentChangedTime,
104016
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
103733
104017
  oldestOutputFileName: oldestOutputFileName
103734
104018
  });
103735
104019
  afterProgramDone(state, program, config);
@@ -103762,12 +104046,21 @@ var ts;
103762
104046
  ts.Debug.assert(!!outputFiles.length);
103763
104047
  var emitterDiagnostics = ts.createDiagnosticCollection();
103764
104048
  var emittedOutputs = new ts.Map();
104049
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
104050
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
103765
104051
  outputFiles.forEach(function (_a) {
103766
- 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;
103767
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
+ }
103768
104061
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
103769
104062
  });
103770
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate, false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
104063
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
103771
104064
  return { emitSkipped: false, diagnostics: emitDiagnostics };
103772
104065
  }
103773
104066
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -103862,7 +104155,7 @@ var ts;
103862
104155
  }
103863
104156
  continue;
103864
104157
  }
103865
- if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
104158
+ if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
103866
104159
  reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
103867
104160
  return {
103868
104161
  kind: InvalidatedProjectKind.UpdateOutputFileStamps,
@@ -103946,7 +104239,7 @@ var ts;
103946
104239
  state.projectCompilerOptions = state.baseCompilerOptions;
103947
104240
  }
103948
104241
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
103949
- var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
104242
+ var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
103950
104243
  reportAndStoreErrors(state, resolvedPath, diagnostics);
103951
104244
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
103952
104245
  if (canEmitBuildInfo)
@@ -103954,8 +104247,94 @@ var ts;
103954
104247
  afterProgramDone(state, program, config);
103955
104248
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
103956
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
+ }
103957
104336
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
103958
- var tsconfigTime = ts.getModifiedTime(state.host, configFile);
104337
+ var tsconfigTime = getModifiedTime(state, configFile);
103959
104338
  if (oldestOutputFileTime < tsconfigTime) {
103960
104339
  return {
103961
104340
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -103965,76 +104344,22 @@ var ts;
103965
104344
  }
103966
104345
  }
103967
104346
  function getUpToDateStatusWorker(state, project, resolvedPath) {
103968
- var force = !!state.options.force;
103969
- var newestInputFileName = undefined;
103970
- var newestInputFileTime = minimumDate;
103971
- var host = state.host;
103972
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
103973
- var inputFile = _a[_i];
103974
- if (!host.fileExists(inputFile)) {
103975
- return {
103976
- type: ts.UpToDateStatusType.Unbuildable,
103977
- reason: inputFile + " does not exist"
103978
- };
103979
- }
103980
- if (!force) {
103981
- var inputTime = ts.getModifiedTime(host, inputFile);
103982
- if (inputTime > newestInputFileTime) {
103983
- newestInputFileName = inputFile;
103984
- newestInputFileTime = inputTime;
103985
- }
103986
- }
103987
- }
104347
+ var _a, _b, _c;
103988
104348
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
103989
104349
  return {
103990
104350
  type: ts.UpToDateStatusType.ContainerOnly
103991
104351
  };
103992
104352
  }
103993
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
103994
- var oldestOutputFileName = "(none)";
103995
- var oldestOutputFileTime = maximumDate;
103996
- var newestOutputFileName = "(none)";
103997
- var newestOutputFileTime = minimumDate;
103998
- var missingOutputFileName;
103999
- var newestDeclarationFileContentChangedTime = minimumDate;
104000
- var isOutOfDateWithInputs = false;
104001
- if (!force) {
104002
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
104003
- var output = outputs_1[_b];
104004
- if (!host.fileExists(output)) {
104005
- missingOutputFileName = output;
104006
- break;
104007
- }
104008
- var outputTime = ts.getModifiedTime(host, output);
104009
- if (outputTime < oldestOutputFileTime) {
104010
- oldestOutputFileTime = outputTime;
104011
- oldestOutputFileName = output;
104012
- }
104013
- if (outputTime < newestInputFileTime) {
104014
- isOutOfDateWithInputs = true;
104015
- break;
104016
- }
104017
- if (outputTime > newestOutputFileTime) {
104018
- newestOutputFileTime = outputTime;
104019
- newestOutputFileName = output;
104020
- }
104021
- if (ts.isDeclarationFileName(output)) {
104022
- var outputModifiedTime = ts.getModifiedTime(host, output);
104023
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
104024
- }
104025
- }
104026
- }
104027
- var pseudoUpToDate = false;
104028
- var usesPrepend = false;
104029
- var upstreamChangedProject;
104353
+ var referenceStatuses;
104354
+ var force = !!state.options.force;
104030
104355
  if (project.projectReferences) {
104031
104356
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
104032
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
104033
- var ref = _d[_c];
104034
- usesPrepend = usesPrepend || !!(ref.prepend);
104357
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
104358
+ var ref = _d[_i];
104035
104359
  var resolvedRef = ts.resolveProjectReferencePath(ref);
104036
104360
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
104037
- var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
104361
+ var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
104362
+ var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
104038
104363
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
104039
104364
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) {
104040
104365
  continue;
@@ -104053,65 +104378,169 @@ var ts;
104053
104378
  upstreamProjectName: ref.path
104054
104379
  };
104055
104380
  }
104056
- if (!force && !missingOutputFileName) {
104057
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
104058
- continue;
104059
- }
104060
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
104061
- pseudoUpToDate = true;
104062
- upstreamChangedProject = ref.path;
104063
- continue;
104064
- }
104065
- 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))) {
104066
104421
  return {
104067
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
104068
- outOfDateOutputFileName: oldestOutputFileName,
104069
- newerProjectName: ref.path
104422
+ type: ts.UpToDateStatusType.OutOfDateBuildInfo,
104423
+ buildInfoFile: buildInfoPath
104070
104424
  };
104071
104425
  }
104426
+ buildInfoProgram = buildInfo.program;
104072
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;
104073
104431
  }
104074
- if (missingOutputFileName !== undefined) {
104075
- return {
104076
- type: ts.UpToDateStatusType.OutputMissing,
104077
- missingOutputFileName: missingOutputFileName
104078
- };
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
+ }
104079
104468
  }
104080
- if (isOutOfDateWithInputs) {
104081
- return {
104082
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
104083
- outOfDateOutputFileName: oldestOutputFileName,
104084
- newerInputFileName: newestInputFileName
104085
- };
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
+ }
104086
104498
  }
104087
- else {
104088
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
104089
- if (configStatus)
104090
- return configStatus;
104091
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
104092
- if (extendedConfigStatus)
104093
- return extendedConfigStatus;
104094
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
104095
- var path = _a[0];
104096
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
104097
- });
104098
- if (dependentPackageFileStatus)
104099
- return dependentPackageFileStatus;
104100
- }
104101
- if (!force && !state.buildInfoChecked.has(resolvedPath)) {
104102
- state.buildInfoChecked.set(resolvedPath, true);
104103
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
104104
- if (buildInfoPath) {
104105
- var value = state.readFileWithCache(buildInfoPath);
104106
- var buildInfo = value && ts.getBuildInfo(value);
104107
- 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)) {
104108
104513
  return {
104109
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
104110
- version: buildInfo.version
104514
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
104515
+ outOfDateOutputFileName: buildInfoPath,
104516
+ newerProjectName: ref.path
104111
104517
  };
104112
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
+ };
104113
104530
  }
104114
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;
104115
104544
  if (usesPrepend && pseudoUpToDate) {
104116
104545
  return {
104117
104546
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -104120,15 +104549,36 @@ var ts;
104120
104549
  };
104121
104550
  }
104122
104551
  return {
104123
- 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,
104124
104557
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
104125
104558
  newestInputFileTime: newestInputFileTime,
104126
- newestOutputFileTime: newestOutputFileTime,
104127
104559
  newestInputFileName: newestInputFileName,
104128
- newestOutputFileName: newestOutputFileName,
104129
104560
  oldestOutputFileName: oldestOutputFileName
104130
104561
  };
104131
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
+ }
104132
104582
  function getUpToDateStatus(state, project, resolvedPath) {
104133
104583
  if (project === undefined) {
104134
104584
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -104141,39 +104591,64 @@ var ts;
104141
104591
  state.projectStatus.set(resolvedPath, actual);
104142
104592
  return actual;
104143
104593
  }
104144
- function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
104594
+ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
104145
104595
  if (proj.options.noEmit)
104146
- 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
+ }
104147
104609
  var host = state.host;
104148
104610
  var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
104611
+ var outputTimeStampMap = getOutputTimeStampMap(state, projectPath);
104612
+ var modifiedOutputs = outputTimeStampMap ? new ts.Set() : undefined;
104149
104613
  if (!skipOutputs || outputs.length !== skipOutputs.size) {
104150
104614
  var reportVerbose = !!state.options.verbose;
104151
- var now = host.now ? host.now() : new Date();
104152
104615
  for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
104153
104616
  var file = outputs_2[_i];
104154
- 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))
104155
104619
  continue;
104156
- }
104157
104620
  if (reportVerbose) {
104158
104621
  reportVerbose = false;
104159
104622
  reportStatus(state, verboseMessage, proj.options.configFilePath);
104160
104623
  }
104161
- if (ts.isDeclarationFileName(file)) {
104162
- 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);
104163
104628
  }
104164
- host.setModifiedTime(file, now);
104165
104629
  }
104166
104630
  }
104167
- 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;
104168
104643
  }
104169
104644
  function updateOutputTimestamps(state, proj, resolvedPath) {
104170
104645
  if (state.options.dry) {
104171
104646
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
104172
104647
  }
104173
- 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);
104174
104649
  state.projectStatus.set(resolvedPath, {
104175
104650
  type: ts.UpToDateStatusType.UpToDate,
104176
- newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
104651
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
104177
104652
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
104178
104653
  });
104179
104654
  }
@@ -104212,6 +104687,7 @@ var ts;
104212
104687
  }
104213
104688
  break;
104214
104689
  }
104690
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
104215
104691
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
104216
104692
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
104217
104693
  if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
@@ -104366,12 +104842,10 @@ var ts;
104366
104842
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
104367
104843
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
104368
104844
  return;
104369
- state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
104370
- invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
104371
- }, 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));
104372
104846
  }
104373
104847
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
104374
- 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 () {
104375
104849
  var _a;
104376
104850
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
104377
104851
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -104403,7 +104877,7 @@ var ts;
104403
104877
  if (!state.watch)
104404
104878
  return;
104405
104879
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
104406
- 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); },
104407
104881
  onDeleteValue: ts.closeFileWatcher,
104408
104882
  });
104409
104883
  }
@@ -104411,7 +104885,7 @@ var ts;
104411
104885
  if (!state.watch || !state.lastCachedPackageJsonLookups)
104412
104886
  return;
104413
104887
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
104414
- 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); },
104415
104889
  onDeleteValue: ts.closeFileWatcher,
104416
104890
  });
104417
104891
  }
@@ -104533,25 +105007,26 @@ var ts;
104533
105007
  }
104534
105008
  }
104535
105009
  function reportUpToDateStatus(state, configFileName, status) {
104536
- if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
104537
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
104538
- }
104539
105010
  switch (status.type) {
104540
105011
  case ts.UpToDateStatusType.OutOfDateWithSelf:
104541
- 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));
104542
105013
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
104543
- 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));
104544
105015
  case ts.UpToDateStatusType.OutputMissing:
104545
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));
104546
105019
  case ts.UpToDateStatusType.UpToDate:
104547
105020
  if (status.newestInputFileTime !== undefined) {
104548
- 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 || ""));
104549
105022
  }
104550
105023
  break;
104551
105024
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
104552
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));
104553
105026
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
104554
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));
104555
105030
  case ts.UpToDateStatusType.UpstreamOutOfDate:
104556
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));
104557
105032
  case ts.UpToDateStatusType.UpstreamBlocked:
@@ -104562,6 +105037,8 @@ var ts;
104562
105037
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
104563
105038
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
104564
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));
104565
105042
  case ts.UpToDateStatusType.ContainerOnly:
104566
105043
  case ts.UpToDateStatusType.ComputingUpstream:
104567
105044
  break;