@typescript-deploys/pr-build 4.8.0-pr-48997-21 → 4.8.0-pr-48784-14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/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-insiders.20220525";
72
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220527";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -2970,14 +2970,32 @@ var ts;
2970
2970
  })(ts || (ts = {}));
2971
2971
  var ts;
2972
2972
  (function (ts) {
2973
- var performance;
2974
- (function (performance) {
2973
+ var nullTimer = { enter: ts.noop, exit: ts.noop };
2974
+ ts.performance = createPerformanceTracker();
2975
+ ts.solutionPerformance = createPerformanceTracker();
2976
+ function createPerformanceTracker() {
2975
2977
  var perfHooks;
2976
2978
  var performanceImpl;
2979
+ var enabled = false;
2980
+ var timeorigin = ts.timestamp();
2981
+ var marks = new ts.Map();
2982
+ var counts = new ts.Map();
2983
+ var durations = new ts.Map();
2984
+ return {
2985
+ createTimerIf: createTimerIf,
2986
+ createTimer: createTimer,
2987
+ mark: mark,
2988
+ measure: measure,
2989
+ getCount: getCount,
2990
+ getDuration: getDuration,
2991
+ forEachMeasure: forEachMeasure,
2992
+ isEnabled: isEnabled,
2993
+ enable: enable,
2994
+ disable: disable,
2995
+ };
2977
2996
  function createTimerIf(condition, measureName, startMarkName, endMarkName) {
2978
- return condition ? createTimer(measureName, startMarkName, endMarkName) : performance.nullTimer;
2997
+ return condition ? createTimer(measureName, startMarkName, endMarkName) : nullTimer;
2979
2998
  }
2980
- performance.createTimerIf = createTimerIf;
2981
2999
  function createTimer(measureName, startMarkName, endMarkName) {
2982
3000
  var enterCount = 0;
2983
3001
  return {
@@ -2999,13 +3017,6 @@ var ts;
2999
3017
  }
3000
3018
  }
3001
3019
  }
3002
- performance.createTimer = createTimer;
3003
- performance.nullTimer = { enter: ts.noop, exit: ts.noop };
3004
- var enabled = false;
3005
- var timeorigin = ts.timestamp();
3006
- var marks = new ts.Map();
3007
- var counts = new ts.Map();
3008
- var durations = new ts.Map();
3009
3020
  function mark(markName) {
3010
3021
  var _a;
3011
3022
  if (enabled) {
@@ -3015,34 +3026,28 @@ var ts;
3015
3026
  performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.mark(markName);
3016
3027
  }
3017
3028
  }
3018
- performance.mark = mark;
3019
3029
  function measure(measureName, startMarkName, endMarkName) {
3020
3030
  var _a, _b;
3021
3031
  if (enabled) {
3022
- var end = (_a = (endMarkName !== undefined ? marks.get(endMarkName) : undefined)) !== null && _a !== void 0 ? _a : ts.timestamp();
3023
- var start = (_b = (startMarkName !== undefined ? marks.get(startMarkName) : undefined)) !== null && _b !== void 0 ? _b : timeorigin;
3032
+ var end = (_a = marks.get(endMarkName)) !== null && _a !== void 0 ? _a : ts.timestamp();
3033
+ var start = (_b = marks.get(startMarkName)) !== null && _b !== void 0 ? _b : timeorigin;
3024
3034
  var previousDuration = durations.get(measureName) || 0;
3025
3035
  durations.set(measureName, previousDuration + (end - start));
3026
3036
  performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.measure(measureName, startMarkName, endMarkName);
3027
3037
  }
3028
3038
  }
3029
- performance.measure = measure;
3030
3039
  function getCount(markName) {
3031
3040
  return counts.get(markName) || 0;
3032
3041
  }
3033
- performance.getCount = getCount;
3034
3042
  function getDuration(measureName) {
3035
3043
  return durations.get(measureName) || 0;
3036
3044
  }
3037
- performance.getDuration = getDuration;
3038
3045
  function forEachMeasure(cb) {
3039
3046
  durations.forEach(function (duration, measureName) { return cb(measureName, duration); });
3040
3047
  }
3041
- performance.forEachMeasure = forEachMeasure;
3042
3048
  function isEnabled() {
3043
3049
  return enabled;
3044
3050
  }
3045
- performance.isEnabled = isEnabled;
3046
3051
  function enable(system) {
3047
3052
  var _a;
3048
3053
  if (system === void 0) { system = ts.sys; }
@@ -3058,7 +3063,6 @@ var ts;
3058
3063
  }
3059
3064
  return true;
3060
3065
  }
3061
- performance.enable = enable;
3062
3066
  function disable() {
3063
3067
  if (enabled) {
3064
3068
  marks.clear();
@@ -3068,8 +3072,7 @@ var ts;
3068
3072
  enabled = false;
3069
3073
  }
3070
3074
  }
3071
- performance.disable = disable;
3072
- })(performance = ts.performance || (ts.performance = {}));
3075
+ }
3073
3076
  })(ts || (ts = {}));
3074
3077
  var ts;
3075
3078
  (function (ts) {
@@ -3746,7 +3749,7 @@ var ts;
3746
3749
  };
3747
3750
  }
3748
3751
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
3749
- var watcher = fsWatch(dirName, 1, function (_eventName, relativeFileName) {
3752
+ var watcher = fsWatch(dirName, 1, function (_eventName, relativeFileName, modifiedTime) {
3750
3753
  if (!ts.isString(relativeFileName))
3751
3754
  return;
3752
3755
  var fileName = ts.getNormalizedAbsolutePath(relativeFileName, dirName);
@@ -3754,7 +3757,7 @@ var ts;
3754
3757
  if (callbacks) {
3755
3758
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
3756
3759
  var fileCallback = callbacks_1[_i];
3757
- fileCallback(fileName, FileWatcherEventKind.Changed);
3760
+ fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
3758
3761
  }
3759
3762
  }
3760
3763
  }, false, PollingInterval.Medium, fallbackOptions);
@@ -3806,7 +3809,7 @@ var ts;
3806
3809
  }
3807
3810
  else {
3808
3811
  cache.set(path, {
3809
- watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
3812
+ watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
3810
3813
  refCount: 1
3811
3814
  });
3812
3815
  }
@@ -3830,7 +3833,7 @@ var ts;
3830
3833
  var newTime = modifiedTime.getTime();
3831
3834
  if (oldTime !== newTime) {
3832
3835
  watchedFile.mtime = modifiedTime;
3833
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
3836
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
3834
3837
  return true;
3835
3838
  }
3836
3839
  return false;
@@ -3855,7 +3858,7 @@ var ts;
3855
3858
  }
3856
3859
  ts.setSysLog = setSysLog;
3857
3860
  function createDirectoryWatcherSupportingRecursive(_a) {
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;
3861
+ 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;
3859
3862
  var cache = new ts.Map();
3860
3863
  var callbackCache = ts.createMultiMap();
3861
3864
  var cacheToUpdateChildWatches = new ts.Map();
@@ -3948,7 +3951,7 @@ var ts;
3948
3951
  }
3949
3952
  function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
3950
3953
  var parentWatcher = cache.get(dirPath);
3951
- if (parentWatcher && fileSystemEntryExists(dirName, 1)) {
3954
+ if (parentWatcher && directoryExists(dirName)) {
3952
3955
  scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
3953
3956
  return;
3954
3957
  }
@@ -4016,7 +4019,7 @@ var ts;
4016
4019
  if (!parentWatcher)
4017
4020
  return false;
4018
4021
  var newChildWatches;
4019
- var hasChanges = ts.enumerateInsertsAndDeletes(fileSystemEntryExists(parentDir, 1) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
4022
+ var hasChanges = ts.enumerateInsertsAndDeletes(directoryExists(parentDir) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
4020
4023
  var childFullName = ts.getNormalizedAbsolutePath(child, parentDir);
4021
4024
  return !isIgnoredPath(childFullName, options) && filePathComparer(childFullName, ts.normalizePath(realpath(childFullName))) === 0 ? childFullName : undefined;
4022
4025
  }) : ts.emptyArray, parentWatcher.childWatches, function (child, childWatcher) { return filePathComparer(child, childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher);
@@ -4044,16 +4047,17 @@ var ts;
4044
4047
  }
4045
4048
  ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive;
4046
4049
  function createFileWatcherCallback(callback) {
4047
- return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
4050
+ return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
4048
4051
  }
4049
4052
  ts.createFileWatcherCallback = createFileWatcherCallback;
4050
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileSystemEntryExists) {
4051
- return function (eventName) {
4053
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
4054
+ return function (eventName, _relativeFileName, modifiedTime) {
4052
4055
  if (eventName === "rename") {
4053
- callback(fileName, fileSystemEntryExists(fileName, 0) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
4056
+ modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
4057
+ callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
4054
4058
  }
4055
4059
  else {
4056
- callback(fileName, FileWatcherEventKind.Changed);
4060
+ callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
4057
4061
  }
4058
4062
  };
4059
4063
  }
@@ -4072,12 +4076,11 @@ var ts;
4072
4076
  };
4073
4077
  }
4074
4078
  function createSystemWatchFunctions(_a) {
4075
- 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;
4079
+ var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatch = _a.fsWatch, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, directoryExists = _a.directoryExists, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind;
4076
4080
  var dynamicPollingWatchFile;
4077
4081
  var fixedChunkSizePollingWatchFile;
4078
4082
  var nonPollingWatchFile;
4079
4083
  var hostRecursiveDirectoryWatcher;
4080
- var hitSystemWatcherLimit = false;
4081
4084
  return {
4082
4085
  watchFile: watchFile,
4083
4086
  watchDirectory: watchDirectory
@@ -4095,7 +4098,7 @@ var ts;
4095
4098
  case ts.WatchFileKind.FixedChunkSizePolling:
4096
4099
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, undefined, undefined);
4097
4100
  case ts.WatchFileKind.UseFsEvents:
4098
- return fsWatch(fileName, 0, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileSystemEntryExists), false, pollingInterval, ts.getFallbackOptions(options));
4101
+ return fsWatch(fileName, 0, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime), false, pollingInterval, ts.getFallbackOptions(options));
4099
4102
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
4100
4103
  if (!nonPollingWatchFile) {
4101
4104
  nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames);
@@ -4148,7 +4151,7 @@ var ts;
4148
4151
  hostRecursiveDirectoryWatcher = createDirectoryWatcherSupportingRecursive({
4149
4152
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
4150
4153
  getCurrentDirectory: getCurrentDirectory,
4151
- fileSystemEntryExists: fileSystemEntryExists,
4154
+ directoryExists: directoryExists,
4152
4155
  getAccessibleSortedChildDirectories: getAccessibleSortedChildDirectories,
4153
4156
  watchDirectory: nonRecursiveWatchDirectory,
4154
4157
  realpath: realpath,
@@ -4193,90 +4196,6 @@ var ts;
4193
4196
  };
4194
4197
  }
4195
4198
  }
4196
- function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
4197
- var lastDirectoryPartWithDirectorySeparator;
4198
- var lastDirectoryPart;
4199
- if (inodeWatching) {
4200
- lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substring(fileOrDirectory.lastIndexOf(ts.directorySeparator));
4201
- lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
4202
- }
4203
- var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
4204
- watchMissingFileSystemEntry() :
4205
- watchPresentFileSystemEntry();
4206
- return {
4207
- close: function () {
4208
- watcher.close();
4209
- watcher = undefined;
4210
- }
4211
- };
4212
- function updateWatcher(createWatcher) {
4213
- if (watcher) {
4214
- sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
4215
- watcher.close();
4216
- watcher = createWatcher();
4217
- }
4218
- }
4219
- function watchPresentFileSystemEntry() {
4220
- if (hitSystemWatcherLimit) {
4221
- sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to watchFile");
4222
- return watchPresentFileSystemEntryWithFsWatchFile();
4223
- }
4224
- try {
4225
- var presentWatcher = fsWatchWorker(fileOrDirectory, recursive, inodeWatching ?
4226
- callbackChangingToMissingFileSystemEntry :
4227
- function (eventName, relativeFileName) {
4228
- sysLog("sysLog:: watchPresentFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + eventName + ":: " + relativeFileName);
4229
- callback(eventName, relativeFileName);
4230
- });
4231
- presentWatcher.on("error", function () {
4232
- sysLog("sysLog:: watchPresentFileSystemEntry:: on Error " + fileOrDirectory + " " + entryKind + " rename, \"\"");
4233
- callback("rename", "");
4234
- updateWatcher(watchMissingFileSystemEntry);
4235
- });
4236
- return presentWatcher;
4237
- }
4238
- catch (e) {
4239
- hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
4240
- sysLog("sysLog:: " + fileOrDirectory + ":: Changing to watchFile");
4241
- return watchPresentFileSystemEntryWithFsWatchFile();
4242
- }
4243
- }
4244
- function callbackChangingToMissingFileSystemEntry(event, relativeName) {
4245
- sysLog("sysLog:: callbackChangingToMissingFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + event + ":: " + relativeName + " " + inodeWatching + " " + lastDirectoryPart + " " + lastDirectoryPartWithDirectorySeparator);
4246
- if (relativeName && ts.endsWith(relativeName, "~")) {
4247
- relativeName = relativeName.slice(0, relativeName.length - 1);
4248
- sysLog("sysLog:: callbackChangingToMissingFileSystemEntry:: changed the relative name to " + relativeName);
4249
- }
4250
- callback(event, relativeName);
4251
- if (event === "rename" &&
4252
- (!relativeName ||
4253
- relativeName === lastDirectoryPart ||
4254
- ts.endsWith(relativeName, lastDirectoryPartWithDirectorySeparator))) {
4255
- if (inodeWatching) {
4256
- updateWatcher(!fileSystemEntryExists(fileOrDirectory, entryKind) ? watchMissingFileSystemEntry : watchPresentFileSystemEntry);
4257
- }
4258
- else if (!fileSystemEntryExists(fileOrDirectory, entryKind)) {
4259
- updateWatcher(watchMissingFileSystemEntry);
4260
- }
4261
- }
4262
- }
4263
- function watchPresentFileSystemEntryWithFsWatchFile() {
4264
- return watchFile(fileOrDirectory, createFileWatcherCallback(function (eventName, relativeFileName) {
4265
- sysLog("sysLog:: watchPresentFileSystemEntryWithFsWatchFile:: " + fileOrDirectory + " " + entryKind + " " + eventName + ":: " + relativeFileName);
4266
- callback(eventName, relativeFileName);
4267
- }), fallbackPollingInterval, fallbackOptions);
4268
- }
4269
- function watchMissingFileSystemEntry() {
4270
- return watchFile(fileOrDirectory, function (_fileName, eventKind) {
4271
- sysLog("sysLog:: watchMissingFileSystemEntry:: " + fileOrDirectory + " " + entryKind + " " + _fileName + ":: " + eventKind);
4272
- if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
4273
- sysLog("sysLog:: watchMissingFileSystemEntry:: Callback :: rename, \"\" and will update the watcher");
4274
- callback("rename", "");
4275
- updateWatcher(watchPresentFileSystemEntry);
4276
- }
4277
- }, fallbackPollingInterval, fallbackOptions);
4278
- }
4279
- }
4280
4199
  }
4281
4200
  ts.createSystemWatchFunctions = createSystemWatchFunctions;
4282
4201
  function patchWriteFileEnsuringDirectory(sys) {
@@ -4318,6 +4237,7 @@ var ts;
4318
4237
  }
4319
4238
  var activeSession;
4320
4239
  var profilePath = "./profile.cpuprofile";
4240
+ var hitSystemWatcherLimit = false;
4321
4241
  var Buffer = require("buffer").Buffer;
4322
4242
  var nodeVersion = getNodeMajorVersion();
4323
4243
  var isNode4OrLater = nodeVersion >= 4;
@@ -4332,19 +4252,17 @@ var ts;
4332
4252
  getModifiedTime: getModifiedTime,
4333
4253
  setTimeout: setTimeout,
4334
4254
  clearTimeout: clearTimeout,
4335
- fsWatchWorker: fsWatchWorker,
4255
+ fsWatch: fsWatch,
4336
4256
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
4337
4257
  getCurrentDirectory: getCurrentDirectory,
4338
- fileSystemEntryExists: fileSystemEntryExists,
4339
4258
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
4259
+ directoryExists: directoryExists,
4340
4260
  getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; },
4341
4261
  realpath: realpath,
4342
4262
  tscWatchFile: process.env.TSC_WATCHFILE,
4343
4263
  useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
4344
4264
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
4345
4265
  defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
4346
- inodeWatching: isLinuxOrMacOs,
4347
- sysLog: sysLog,
4348
4266
  }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
4349
4267
  var nodeSystem = {
4350
4268
  args: process.argv.slice(2),
@@ -4564,12 +4482,83 @@ var ts;
4564
4482
  else {
4565
4483
  eventKind = FileWatcherEventKind.Changed;
4566
4484
  }
4567
- callback(fileName, eventKind);
4485
+ callback(fileName, eventKind, curr.mtime);
4568
4486
  }
4569
4487
  }
4570
- function fsWatchWorker(fileOrDirectory, recursive, callback) {
4571
- return _fs.watch(fileOrDirectory, fsSupportsRecursiveFsWatch ?
4572
- { persistent: true, recursive: !!recursive } : { persistent: true }, callback);
4488
+ function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
4489
+ var options;
4490
+ var lastDirectoryPartWithDirectorySeparator;
4491
+ var lastDirectoryPart;
4492
+ if (isLinuxOrMacOs) {
4493
+ lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
4494
+ lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
4495
+ }
4496
+ var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
4497
+ watchMissingFileSystemEntry() :
4498
+ watchPresentFileSystemEntry();
4499
+ return {
4500
+ close: function () {
4501
+ watcher.close();
4502
+ watcher = undefined;
4503
+ }
4504
+ };
4505
+ function invokeCallbackAndUpdateWatcher(createWatcher, modifiedTime) {
4506
+ sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
4507
+ callback("rename", "", modifiedTime);
4508
+ if (watcher) {
4509
+ watcher.close();
4510
+ watcher = createWatcher();
4511
+ }
4512
+ }
4513
+ function watchPresentFileSystemEntry() {
4514
+ if (options === undefined) {
4515
+ if (fsSupportsRecursiveFsWatch) {
4516
+ options = { persistent: true, recursive: !!recursive };
4517
+ }
4518
+ else {
4519
+ options = { persistent: true };
4520
+ }
4521
+ }
4522
+ if (hitSystemWatcherLimit) {
4523
+ sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to fsWatchFile");
4524
+ return watchPresentFileSystemEntryWithFsWatchFile();
4525
+ }
4526
+ try {
4527
+ var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
4528
+ callbackChangingToMissingFileSystemEntry :
4529
+ callback);
4530
+ presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
4531
+ return presentWatcher;
4532
+ }
4533
+ catch (e) {
4534
+ hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
4535
+ sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
4536
+ return watchPresentFileSystemEntryWithFsWatchFile();
4537
+ }
4538
+ }
4539
+ function callbackChangingToMissingFileSystemEntry(event, relativeName) {
4540
+ var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
4541
+ return event === "rename" &&
4542
+ (!relativeName ||
4543
+ relativeName === lastDirectoryPart ||
4544
+ (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
4545
+ modifiedTime === ts.missingFileModifiedTime ?
4546
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry, modifiedTime) :
4547
+ callback(event, relativeName, modifiedTime);
4548
+ }
4549
+ function watchPresentFileSystemEntryWithFsWatchFile() {
4550
+ return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions);
4551
+ }
4552
+ function watchMissingFileSystemEntry() {
4553
+ return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
4554
+ if (eventKind === FileWatcherEventKind.Created) {
4555
+ modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
4556
+ if (modifiedTime !== ts.missingFileModifiedTime) {
4557
+ invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry, modifiedTime);
4558
+ }
4559
+ }
4560
+ }, fallbackPollingInterval, fallbackOptions);
4561
+ }
4573
4562
  }
4574
4563
  function readFileWorker(fileName, _encoding) {
4575
4564
  var buffer;
@@ -4705,12 +4694,17 @@ var ts;
4705
4694
  }
4706
4695
  function getModifiedTime(path) {
4707
4696
  var _a;
4697
+ var originalStackTraceLimit = Error.stackTraceLimit;
4698
+ Error.stackTraceLimit = 0;
4708
4699
  try {
4709
4700
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
4710
4701
  }
4711
4702
  catch (e) {
4712
4703
  return undefined;
4713
4704
  }
4705
+ finally {
4706
+ Error.stackTraceLimit = originalStackTraceLimit;
4707
+ }
4714
4708
  }
4715
4709
  function setModifiedTime(path, time) {
4716
4710
  try {
@@ -6511,8 +6505,8 @@ var ts;
6511
6505
  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"),
6512
6506
  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"),
6513
6507
  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."),
6514
- 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}'"),
6515
- 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}'"),
6508
+ 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}'"),
6509
+ 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}'"),
6516
6510
  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"),
6517
6511
  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"),
6518
6512
  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"),
@@ -6556,6 +6550,8 @@ var ts;
6556
6550
  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}'."),
6557
6551
  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}'."),
6558
6552
  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."),
6553
+ Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_are_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_are_not_emitted_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes are not emitted"),
6554
+ Project_0_is_up_to_date_but_needs_update_to_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_update_to_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs update to timestamps of output files that are older than input files"),
6559
6555
  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}'"),
6560
6556
  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."),
6561
6557
  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."),
@@ -12617,9 +12613,6 @@ var ts;
12617
12613
  }
12618
12614
  ts.isVariableDeclarationInitializedToBareOrAccessedRequire = isVariableDeclarationInitializedToBareOrAccessedRequire;
12619
12615
  function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) {
12620
- if (node.kind === 203) {
12621
- node = node.parent.parent;
12622
- }
12623
12616
  return ts.isVariableDeclaration(node) &&
12624
12617
  !!node.initializer &&
12625
12618
  isRequireCall(allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, true);
@@ -15879,13 +15872,13 @@ var ts;
15879
15872
  return !file.isDeclarationFile ? walkTreeForJSXTags(file) : undefined;
15880
15873
  }
15881
15874
  function isFileForcedToBeModuleByFormat(file) {
15882
- return file.impliedNodeFormat === ts.ModuleKind.ESNext && !file.isDeclarationFile ? true : undefined;
15875
+ return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs", ".cts"]))) && !file.isDeclarationFile ? true : undefined;
15883
15876
  }
15884
15877
  function getSetExternalModuleIndicator(options) {
15885
15878
  switch (getEmitModuleDetectionKind(options)) {
15886
15879
  case ts.ModuleDetectionKind.Force:
15887
15880
  return function (file) {
15888
- file.externalModuleIndicator = !file.isDeclarationFile || ts.isFileProbablyExternalModule(file);
15881
+ file.externalModuleIndicator = ts.isFileProbablyExternalModule(file) || !file.isDeclarationFile || undefined;
15889
15882
  };
15890
15883
  case ts.ModuleDetectionKind.Legacy:
15891
15884
  return function (file) {
@@ -15941,7 +15934,8 @@ var ts;
15941
15934
  }
15942
15935
  ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
15943
15936
  function getEmitModuleDetectionKind(options) {
15944
- return options.moduleDetection || ts.ModuleDetectionKind.Auto;
15937
+ return options.moduleDetection ||
15938
+ (getEmitModuleKind(options) === ts.ModuleKind.Node16 || getEmitModuleKind(options) === ts.ModuleKind.NodeNext ? ts.ModuleDetectionKind.Force : ts.ModuleDetectionKind.Auto);
15945
15939
  }
15946
15940
  ts.getEmitModuleDetectionKind = getEmitModuleDetectionKind;
15947
15941
  function hasJsonModuleEmitEnabled(options) {
@@ -16024,6 +16018,10 @@ var ts;
16024
16018
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
16025
16019
  }
16026
16020
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
16021
+ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
16022
+ return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
16023
+ }
16024
+ ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
16027
16025
  function getCompilerOptionValue(options, option) {
16028
16026
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
16029
16027
  }
@@ -31733,6 +31731,7 @@ var ts;
31733
31731
  type: "boolean",
31734
31732
  affectsSemanticDiagnostics: true,
31735
31733
  affectsEmit: true,
31734
+ affectsMultiFileEmitBuildInfo: true,
31736
31735
  category: ts.Diagnostics.Watch_and_Build_Modes,
31737
31736
  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,
31738
31737
  defaultValueDescription: false,
@@ -31766,12 +31765,39 @@ var ts;
31766
31765
  affectsSourceFile: true,
31767
31766
  affectsModuleResolution: true,
31768
31767
  affectsEmit: true,
31768
+ affectsMultiFileEmitBuildInfo: true,
31769
31769
  paramType: ts.Diagnostics.VERSION,
31770
31770
  showInSimplifiedHelpView: true,
31771
31771
  category: ts.Diagnostics.Language_and_Environment,
31772
31772
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
31773
31773
  defaultValueDescription: 0,
31774
31774
  };
31775
+ ts.moduleOptionDeclaration = {
31776
+ name: "module",
31777
+ shortName: "m",
31778
+ type: new ts.Map(ts.getEntries({
31779
+ none: ts.ModuleKind.None,
31780
+ commonjs: ts.ModuleKind.CommonJS,
31781
+ amd: ts.ModuleKind.AMD,
31782
+ system: ts.ModuleKind.System,
31783
+ umd: ts.ModuleKind.UMD,
31784
+ es6: ts.ModuleKind.ES2015,
31785
+ es2015: ts.ModuleKind.ES2015,
31786
+ es2020: ts.ModuleKind.ES2020,
31787
+ es2022: ts.ModuleKind.ES2022,
31788
+ esnext: ts.ModuleKind.ESNext,
31789
+ node16: ts.ModuleKind.Node16,
31790
+ nodenext: ts.ModuleKind.NodeNext,
31791
+ })),
31792
+ affectsModuleResolution: true,
31793
+ affectsEmit: true,
31794
+ affectsMultiFileEmitBuildInfo: true,
31795
+ paramType: ts.Diagnostics.KIND,
31796
+ showInSimplifiedHelpView: true,
31797
+ category: ts.Diagnostics.Modules,
31798
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
31799
+ defaultValueDescription: undefined,
31800
+ };
31775
31801
  var commandOptionsWithoutBuild = [
31776
31802
  {
31777
31803
  name: "all",
@@ -31832,36 +31858,13 @@ var ts;
31832
31858
  category: ts.Diagnostics.Command_line_Options,
31833
31859
  affectsSemanticDiagnostics: true,
31834
31860
  affectsEmit: true,
31861
+ affectsMultiFileEmitBuildInfo: true,
31835
31862
  isCommandLineOnly: true,
31836
31863
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
31837
31864
  defaultValueDescription: false,
31838
31865
  },
31839
31866
  ts.targetOptionDeclaration,
31840
- {
31841
- name: "module",
31842
- shortName: "m",
31843
- type: new ts.Map(ts.getEntries({
31844
- none: ts.ModuleKind.None,
31845
- commonjs: ts.ModuleKind.CommonJS,
31846
- amd: ts.ModuleKind.AMD,
31847
- system: ts.ModuleKind.System,
31848
- umd: ts.ModuleKind.UMD,
31849
- es6: ts.ModuleKind.ES2015,
31850
- es2015: ts.ModuleKind.ES2015,
31851
- es2020: ts.ModuleKind.ES2020,
31852
- es2022: ts.ModuleKind.ES2022,
31853
- esnext: ts.ModuleKind.ESNext,
31854
- node16: ts.ModuleKind.Node16,
31855
- nodenext: ts.ModuleKind.NodeNext,
31856
- })),
31857
- affectsModuleResolution: true,
31858
- affectsEmit: true,
31859
- paramType: ts.Diagnostics.KIND,
31860
- showInSimplifiedHelpView: true,
31861
- category: ts.Diagnostics.Modules,
31862
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
31863
- defaultValueDescription: undefined,
31864
- },
31867
+ ts.moduleOptionDeclaration,
31865
31868
  {
31866
31869
  name: "lib",
31867
31870
  type: "list",
@@ -31898,6 +31901,7 @@ var ts;
31898
31901
  type: jsxOptionMap,
31899
31902
  affectsSourceFile: true,
31900
31903
  affectsEmit: true,
31904
+ affectsMultiFileEmitBuildInfo: true,
31901
31905
  affectsModuleResolution: true,
31902
31906
  paramType: ts.Diagnostics.KIND,
31903
31907
  showInSimplifiedHelpView: true,
@@ -31910,6 +31914,7 @@ var ts;
31910
31914
  shortName: "d",
31911
31915
  type: "boolean",
31912
31916
  affectsEmit: true,
31917
+ affectsMultiFileEmitBuildInfo: true,
31913
31918
  showInSimplifiedHelpView: true,
31914
31919
  category: ts.Diagnostics.Emit,
31915
31920
  transpileOptionValue: undefined,
@@ -31920,6 +31925,7 @@ var ts;
31920
31925
  name: "declarationMap",
31921
31926
  type: "boolean",
31922
31927
  affectsEmit: true,
31928
+ affectsMultiFileEmitBuildInfo: true,
31923
31929
  showInSimplifiedHelpView: true,
31924
31930
  category: ts.Diagnostics.Emit,
31925
31931
  transpileOptionValue: undefined,
@@ -31930,6 +31936,7 @@ var ts;
31930
31936
  name: "emitDeclarationOnly",
31931
31937
  type: "boolean",
31932
31938
  affectsEmit: true,
31939
+ affectsMultiFileEmitBuildInfo: true,
31933
31940
  showInSimplifiedHelpView: true,
31934
31941
  category: ts.Diagnostics.Emit,
31935
31942
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -31940,6 +31947,7 @@ var ts;
31940
31947
  name: "sourceMap",
31941
31948
  type: "boolean",
31942
31949
  affectsEmit: true,
31950
+ affectsMultiFileEmitBuildInfo: true,
31943
31951
  showInSimplifiedHelpView: true,
31944
31952
  category: ts.Diagnostics.Emit,
31945
31953
  defaultValueDescription: false,
@@ -31949,6 +31957,9 @@ var ts;
31949
31957
  name: "outFile",
31950
31958
  type: "string",
31951
31959
  affectsEmit: true,
31960
+ affectsMultiFileEmitBuildInfo: true,
31961
+ affectsDeclarationPath: true,
31962
+ affectsBundleEmitBuildInfo: true,
31952
31963
  isFilePath: true,
31953
31964
  paramType: ts.Diagnostics.FILE,
31954
31965
  showInSimplifiedHelpView: true,
@@ -31960,6 +31971,8 @@ var ts;
31960
31971
  name: "outDir",
31961
31972
  type: "string",
31962
31973
  affectsEmit: true,
31974
+ affectsMultiFileEmitBuildInfo: true,
31975
+ affectsDeclarationPath: true,
31963
31976
  isFilePath: true,
31964
31977
  paramType: ts.Diagnostics.DIRECTORY,
31965
31978
  showInSimplifiedHelpView: true,
@@ -31970,6 +31983,8 @@ var ts;
31970
31983
  name: "rootDir",
31971
31984
  type: "string",
31972
31985
  affectsEmit: true,
31986
+ affectsMultiFileEmitBuildInfo: true,
31987
+ affectsDeclarationPath: true,
31973
31988
  isFilePath: true,
31974
31989
  paramType: ts.Diagnostics.LOCATION,
31975
31990
  category: ts.Diagnostics.Modules,
@@ -31980,6 +31995,8 @@ var ts;
31980
31995
  name: "composite",
31981
31996
  type: "boolean",
31982
31997
  affectsEmit: true,
31998
+ affectsMultiFileEmitBuildInfo: true,
31999
+ affectsBundleEmitBuildInfo: true,
31983
32000
  isTSConfigOnly: true,
31984
32001
  category: ts.Diagnostics.Projects,
31985
32002
  transpileOptionValue: undefined,
@@ -31990,6 +32007,8 @@ var ts;
31990
32007
  name: "tsBuildInfoFile",
31991
32008
  type: "string",
31992
32009
  affectsEmit: true,
32010
+ affectsMultiFileEmitBuildInfo: true,
32011
+ affectsBundleEmitBuildInfo: true,
31993
32012
  isFilePath: true,
31994
32013
  paramType: ts.Diagnostics.FILE,
31995
32014
  category: ts.Diagnostics.Projects,
@@ -32001,6 +32020,7 @@ var ts;
32001
32020
  name: "removeComments",
32002
32021
  type: "boolean",
32003
32022
  affectsEmit: true,
32023
+ affectsMultiFileEmitBuildInfo: true,
32004
32024
  showInSimplifiedHelpView: true,
32005
32025
  category: ts.Diagnostics.Emit,
32006
32026
  defaultValueDescription: false,
@@ -32019,6 +32039,7 @@ var ts;
32019
32039
  name: "importHelpers",
32020
32040
  type: "boolean",
32021
32041
  affectsEmit: true,
32042
+ affectsMultiFileEmitBuildInfo: true,
32022
32043
  category: ts.Diagnostics.Emit,
32023
32044
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
32024
32045
  defaultValueDescription: false,
@@ -32032,6 +32053,7 @@ var ts;
32032
32053
  })),
32033
32054
  affectsEmit: true,
32034
32055
  affectsSemanticDiagnostics: true,
32056
+ affectsMultiFileEmitBuildInfo: true,
32035
32057
  category: ts.Diagnostics.Emit,
32036
32058
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
32037
32059
  defaultValueDescription: 0,
@@ -32040,6 +32062,7 @@ var ts;
32040
32062
  name: "downlevelIteration",
32041
32063
  type: "boolean",
32042
32064
  affectsEmit: true,
32065
+ affectsMultiFileEmitBuildInfo: true,
32043
32066
  category: ts.Diagnostics.Emit,
32044
32067
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
32045
32068
  defaultValueDescription: false,
@@ -32055,6 +32078,7 @@ var ts;
32055
32078
  {
32056
32079
  name: "strict",
32057
32080
  type: "boolean",
32081
+ affectsMultiFileEmitBuildInfo: true,
32058
32082
  showInSimplifiedHelpView: true,
32059
32083
  category: ts.Diagnostics.Type_Checking,
32060
32084
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -32064,6 +32088,7 @@ var ts;
32064
32088
  name: "noImplicitAny",
32065
32089
  type: "boolean",
32066
32090
  affectsSemanticDiagnostics: true,
32091
+ affectsMultiFileEmitBuildInfo: true,
32067
32092
  strictFlag: true,
32068
32093
  category: ts.Diagnostics.Type_Checking,
32069
32094
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -32073,6 +32098,7 @@ var ts;
32073
32098
  name: "strictNullChecks",
32074
32099
  type: "boolean",
32075
32100
  affectsSemanticDiagnostics: true,
32101
+ affectsMultiFileEmitBuildInfo: true,
32076
32102
  strictFlag: true,
32077
32103
  category: ts.Diagnostics.Type_Checking,
32078
32104
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -32081,6 +32107,8 @@ var ts;
32081
32107
  {
32082
32108
  name: "strictFunctionTypes",
32083
32109
  type: "boolean",
32110
+ affectsSemanticDiagnostics: true,
32111
+ affectsMultiFileEmitBuildInfo: true,
32084
32112
  strictFlag: true,
32085
32113
  category: ts.Diagnostics.Type_Checking,
32086
32114
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -32089,6 +32117,8 @@ var ts;
32089
32117
  {
32090
32118
  name: "strictBindCallApply",
32091
32119
  type: "boolean",
32120
+ affectsSemanticDiagnostics: true,
32121
+ affectsMultiFileEmitBuildInfo: true,
32092
32122
  strictFlag: true,
32093
32123
  category: ts.Diagnostics.Type_Checking,
32094
32124
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -32098,6 +32128,7 @@ var ts;
32098
32128
  name: "strictPropertyInitialization",
32099
32129
  type: "boolean",
32100
32130
  affectsSemanticDiagnostics: true,
32131
+ affectsMultiFileEmitBuildInfo: true,
32101
32132
  strictFlag: true,
32102
32133
  category: ts.Diagnostics.Type_Checking,
32103
32134
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -32107,6 +32138,7 @@ var ts;
32107
32138
  name: "noImplicitThis",
32108
32139
  type: "boolean",
32109
32140
  affectsSemanticDiagnostics: true,
32141
+ affectsMultiFileEmitBuildInfo: true,
32110
32142
  strictFlag: true,
32111
32143
  category: ts.Diagnostics.Type_Checking,
32112
32144
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -32116,6 +32148,7 @@ var ts;
32116
32148
  name: "useUnknownInCatchVariables",
32117
32149
  type: "boolean",
32118
32150
  affectsSemanticDiagnostics: true,
32151
+ affectsMultiFileEmitBuildInfo: true,
32119
32152
  strictFlag: true,
32120
32153
  category: ts.Diagnostics.Type_Checking,
32121
32154
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -32125,6 +32158,8 @@ var ts;
32125
32158
  name: "alwaysStrict",
32126
32159
  type: "boolean",
32127
32160
  affectsSourceFile: true,
32161
+ affectsEmit: true,
32162
+ affectsMultiFileEmitBuildInfo: true,
32128
32163
  strictFlag: true,
32129
32164
  category: ts.Diagnostics.Type_Checking,
32130
32165
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -32134,6 +32169,7 @@ var ts;
32134
32169
  name: "noUnusedLocals",
32135
32170
  type: "boolean",
32136
32171
  affectsSemanticDiagnostics: true,
32172
+ affectsMultiFileEmitBuildInfo: true,
32137
32173
  category: ts.Diagnostics.Type_Checking,
32138
32174
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
32139
32175
  defaultValueDescription: false,
@@ -32142,6 +32178,7 @@ var ts;
32142
32178
  name: "noUnusedParameters",
32143
32179
  type: "boolean",
32144
32180
  affectsSemanticDiagnostics: true,
32181
+ affectsMultiFileEmitBuildInfo: true,
32145
32182
  category: ts.Diagnostics.Type_Checking,
32146
32183
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
32147
32184
  defaultValueDescription: false,
@@ -32150,6 +32187,7 @@ var ts;
32150
32187
  name: "exactOptionalPropertyTypes",
32151
32188
  type: "boolean",
32152
32189
  affectsSemanticDiagnostics: true,
32190
+ affectsMultiFileEmitBuildInfo: true,
32153
32191
  category: ts.Diagnostics.Type_Checking,
32154
32192
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
32155
32193
  defaultValueDescription: false,
@@ -32158,6 +32196,7 @@ var ts;
32158
32196
  name: "noImplicitReturns",
32159
32197
  type: "boolean",
32160
32198
  affectsSemanticDiagnostics: true,
32199
+ affectsMultiFileEmitBuildInfo: true,
32161
32200
  category: ts.Diagnostics.Type_Checking,
32162
32201
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
32163
32202
  defaultValueDescription: false,
@@ -32167,6 +32206,7 @@ var ts;
32167
32206
  type: "boolean",
32168
32207
  affectsBindDiagnostics: true,
32169
32208
  affectsSemanticDiagnostics: true,
32209
+ affectsMultiFileEmitBuildInfo: true,
32170
32210
  category: ts.Diagnostics.Type_Checking,
32171
32211
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
32172
32212
  defaultValueDescription: false,
@@ -32175,6 +32215,7 @@ var ts;
32175
32215
  name: "noUncheckedIndexedAccess",
32176
32216
  type: "boolean",
32177
32217
  affectsSemanticDiagnostics: true,
32218
+ affectsMultiFileEmitBuildInfo: true,
32178
32219
  category: ts.Diagnostics.Type_Checking,
32179
32220
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
32180
32221
  defaultValueDescription: false,
@@ -32183,6 +32224,7 @@ var ts;
32183
32224
  name: "noImplicitOverride",
32184
32225
  type: "boolean",
32185
32226
  affectsSemanticDiagnostics: true,
32227
+ affectsMultiFileEmitBuildInfo: true,
32186
32228
  category: ts.Diagnostics.Type_Checking,
32187
32229
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
32188
32230
  defaultValueDescription: false,
@@ -32190,6 +32232,8 @@ var ts;
32190
32232
  {
32191
32233
  name: "noPropertyAccessFromIndexSignature",
32192
32234
  type: "boolean",
32235
+ affectsSemanticDiagnostics: true,
32236
+ affectsMultiFileEmitBuildInfo: true,
32193
32237
  showInSimplifiedHelpView: false,
32194
32238
  category: ts.Diagnostics.Type_Checking,
32195
32239
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -32270,6 +32314,7 @@ var ts;
32270
32314
  name: "allowSyntheticDefaultImports",
32271
32315
  type: "boolean",
32272
32316
  affectsSemanticDiagnostics: true,
32317
+ affectsMultiFileEmitBuildInfo: true,
32273
32318
  category: ts.Diagnostics.Interop_Constraints,
32274
32319
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
32275
32320
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -32279,6 +32324,7 @@ var ts;
32279
32324
  type: "boolean",
32280
32325
  affectsSemanticDiagnostics: true,
32281
32326
  affectsEmit: true,
32327
+ affectsMultiFileEmitBuildInfo: true,
32282
32328
  showInSimplifiedHelpView: true,
32283
32329
  category: ts.Diagnostics.Interop_Constraints,
32284
32330
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -32295,6 +32341,7 @@ var ts;
32295
32341
  name: "allowUmdGlobalAccess",
32296
32342
  type: "boolean",
32297
32343
  affectsSemanticDiagnostics: true,
32344
+ affectsMultiFileEmitBuildInfo: true,
32298
32345
  category: ts.Diagnostics.Modules,
32299
32346
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
32300
32347
  defaultValueDescription: false,
@@ -32315,6 +32362,7 @@ var ts;
32315
32362
  name: "sourceRoot",
32316
32363
  type: "string",
32317
32364
  affectsEmit: true,
32365
+ affectsMultiFileEmitBuildInfo: true,
32318
32366
  paramType: ts.Diagnostics.LOCATION,
32319
32367
  category: ts.Diagnostics.Emit,
32320
32368
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -32323,6 +32371,7 @@ var ts;
32323
32371
  name: "mapRoot",
32324
32372
  type: "string",
32325
32373
  affectsEmit: true,
32374
+ affectsMultiFileEmitBuildInfo: true,
32326
32375
  paramType: ts.Diagnostics.LOCATION,
32327
32376
  category: ts.Diagnostics.Emit,
32328
32377
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -32331,6 +32380,7 @@ var ts;
32331
32380
  name: "inlineSourceMap",
32332
32381
  type: "boolean",
32333
32382
  affectsEmit: true,
32383
+ affectsMultiFileEmitBuildInfo: true,
32334
32384
  category: ts.Diagnostics.Emit,
32335
32385
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
32336
32386
  defaultValueDescription: false,
@@ -32339,6 +32389,7 @@ var ts;
32339
32389
  name: "inlineSources",
32340
32390
  type: "boolean",
32341
32391
  affectsEmit: true,
32392
+ affectsMultiFileEmitBuildInfo: true,
32342
32393
  category: ts.Diagnostics.Emit,
32343
32394
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
32344
32395
  defaultValueDescription: false,
@@ -32347,6 +32398,7 @@ var ts;
32347
32398
  name: "experimentalDecorators",
32348
32399
  type: "boolean",
32349
32400
  affectsSemanticDiagnostics: true,
32401
+ affectsMultiFileEmitBuildInfo: true,
32350
32402
  category: ts.Diagnostics.Language_and_Environment,
32351
32403
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
32352
32404
  defaultValueDescription: false,
@@ -32356,6 +32408,7 @@ var ts;
32356
32408
  type: "boolean",
32357
32409
  affectsSemanticDiagnostics: true,
32358
32410
  affectsEmit: true,
32411
+ affectsMultiFileEmitBuildInfo: true,
32359
32412
  category: ts.Diagnostics.Language_and_Environment,
32360
32413
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
32361
32414
  defaultValueDescription: false,
@@ -32379,6 +32432,7 @@ var ts;
32379
32432
  type: "string",
32380
32433
  affectsSemanticDiagnostics: true,
32381
32434
  affectsEmit: true,
32435
+ affectsMultiFileEmitBuildInfo: true,
32382
32436
  affectsModuleResolution: true,
32383
32437
  category: ts.Diagnostics.Language_and_Environment,
32384
32438
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -32396,6 +32450,9 @@ var ts;
32396
32450
  name: "out",
32397
32451
  type: "string",
32398
32452
  affectsEmit: true,
32453
+ affectsMultiFileEmitBuildInfo: true,
32454
+ affectsDeclarationPath: true,
32455
+ affectsBundleEmitBuildInfo: true,
32399
32456
  isFilePath: false,
32400
32457
  category: ts.Diagnostics.Backwards_Compatibility,
32401
32458
  paramType: ts.Diagnostics.FILE,
@@ -32406,6 +32463,7 @@ var ts;
32406
32463
  name: "reactNamespace",
32407
32464
  type: "string",
32408
32465
  affectsEmit: true,
32466
+ affectsMultiFileEmitBuildInfo: true,
32409
32467
  category: ts.Diagnostics.Language_and_Environment,
32410
32468
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
32411
32469
  defaultValueDescription: "`React`",
@@ -32413,6 +32471,7 @@ var ts;
32413
32471
  {
32414
32472
  name: "skipDefaultLibCheck",
32415
32473
  type: "boolean",
32474
+ affectsMultiFileEmitBuildInfo: true,
32416
32475
  category: ts.Diagnostics.Completeness,
32417
32476
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
32418
32477
  defaultValueDescription: false,
@@ -32428,6 +32487,7 @@ var ts;
32428
32487
  name: "emitBOM",
32429
32488
  type: "boolean",
32430
32489
  affectsEmit: true,
32490
+ affectsMultiFileEmitBuildInfo: true,
32431
32491
  category: ts.Diagnostics.Emit,
32432
32492
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
32433
32493
  defaultValueDescription: false,
@@ -32439,6 +32499,7 @@ var ts;
32439
32499
  lf: 1
32440
32500
  })),
32441
32501
  affectsEmit: true,
32502
+ affectsMultiFileEmitBuildInfo: true,
32442
32503
  paramType: ts.Diagnostics.NEWLINE,
32443
32504
  category: ts.Diagnostics.Emit,
32444
32505
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -32448,6 +32509,7 @@ var ts;
32448
32509
  name: "noErrorTruncation",
32449
32510
  type: "boolean",
32450
32511
  affectsSemanticDiagnostics: true,
32512
+ affectsMultiFileEmitBuildInfo: true,
32451
32513
  category: ts.Diagnostics.Output_Formatting,
32452
32514
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
32453
32515
  defaultValueDescription: false,
@@ -32474,6 +32536,7 @@ var ts;
32474
32536
  name: "stripInternal",
32475
32537
  type: "boolean",
32476
32538
  affectsEmit: true,
32539
+ affectsMultiFileEmitBuildInfo: true,
32477
32540
  category: ts.Diagnostics.Emit,
32478
32541
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
32479
32542
  defaultValueDescription: false,
@@ -32514,6 +32577,7 @@ var ts;
32514
32577
  name: "noImplicitUseStrict",
32515
32578
  type: "boolean",
32516
32579
  affectsSemanticDiagnostics: true,
32580
+ affectsMultiFileEmitBuildInfo: true,
32517
32581
  category: ts.Diagnostics.Backwards_Compatibility,
32518
32582
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
32519
32583
  defaultValueDescription: false,
@@ -32522,6 +32586,7 @@ var ts;
32522
32586
  name: "noEmitHelpers",
32523
32587
  type: "boolean",
32524
32588
  affectsEmit: true,
32589
+ affectsMultiFileEmitBuildInfo: true,
32525
32590
  category: ts.Diagnostics.Emit,
32526
32591
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
32527
32592
  defaultValueDescription: false,
@@ -32530,6 +32595,7 @@ var ts;
32530
32595
  name: "noEmitOnError",
32531
32596
  type: "boolean",
32532
32597
  affectsEmit: true,
32598
+ affectsMultiFileEmitBuildInfo: true,
32533
32599
  category: ts.Diagnostics.Emit,
32534
32600
  transpileOptionValue: undefined,
32535
32601
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -32539,6 +32605,7 @@ var ts;
32539
32605
  name: "preserveConstEnums",
32540
32606
  type: "boolean",
32541
32607
  affectsEmit: true,
32608
+ affectsMultiFileEmitBuildInfo: true,
32542
32609
  category: ts.Diagnostics.Emit,
32543
32610
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
32544
32611
  defaultValueDescription: false,
@@ -32547,6 +32614,8 @@ var ts;
32547
32614
  name: "declarationDir",
32548
32615
  type: "string",
32549
32616
  affectsEmit: true,
32617
+ affectsMultiFileEmitBuildInfo: true,
32618
+ affectsDeclarationPath: true,
32550
32619
  isFilePath: true,
32551
32620
  paramType: ts.Diagnostics.DIRECTORY,
32552
32621
  category: ts.Diagnostics.Emit,
@@ -32556,6 +32625,7 @@ var ts;
32556
32625
  {
32557
32626
  name: "skipLibCheck",
32558
32627
  type: "boolean",
32628
+ affectsMultiFileEmitBuildInfo: true,
32559
32629
  category: ts.Diagnostics.Completeness,
32560
32630
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
32561
32631
  defaultValueDescription: false,
@@ -32565,6 +32635,7 @@ var ts;
32565
32635
  type: "boolean",
32566
32636
  affectsBindDiagnostics: true,
32567
32637
  affectsSemanticDiagnostics: true,
32638
+ affectsMultiFileEmitBuildInfo: true,
32568
32639
  category: ts.Diagnostics.Type_Checking,
32569
32640
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
32570
32641
  defaultValueDescription: undefined,
@@ -32574,6 +32645,7 @@ var ts;
32574
32645
  type: "boolean",
32575
32646
  affectsBindDiagnostics: true,
32576
32647
  affectsSemanticDiagnostics: true,
32648
+ affectsMultiFileEmitBuildInfo: true,
32577
32649
  category: ts.Diagnostics.Type_Checking,
32578
32650
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
32579
32651
  defaultValueDescription: undefined,
@@ -32582,6 +32654,7 @@ var ts;
32582
32654
  name: "suppressExcessPropertyErrors",
32583
32655
  type: "boolean",
32584
32656
  affectsSemanticDiagnostics: true,
32657
+ affectsMultiFileEmitBuildInfo: true,
32585
32658
  category: ts.Diagnostics.Backwards_Compatibility,
32586
32659
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
32587
32660
  defaultValueDescription: false,
@@ -32590,6 +32663,7 @@ var ts;
32590
32663
  name: "suppressImplicitAnyIndexErrors",
32591
32664
  type: "boolean",
32592
32665
  affectsSemanticDiagnostics: true,
32666
+ affectsMultiFileEmitBuildInfo: true,
32593
32667
  category: ts.Diagnostics.Backwards_Compatibility,
32594
32668
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
32595
32669
  defaultValueDescription: false,
@@ -32614,6 +32688,7 @@ var ts;
32614
32688
  name: "noStrictGenericChecks",
32615
32689
  type: "boolean",
32616
32690
  affectsSemanticDiagnostics: true,
32691
+ affectsMultiFileEmitBuildInfo: true,
32617
32692
  category: ts.Diagnostics.Backwards_Compatibility,
32618
32693
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
32619
32694
  defaultValueDescription: false,
@@ -32623,6 +32698,7 @@ var ts;
32623
32698
  type: "boolean",
32624
32699
  affectsSemanticDiagnostics: true,
32625
32700
  affectsEmit: true,
32701
+ affectsMultiFileEmitBuildInfo: true,
32626
32702
  category: ts.Diagnostics.Language_and_Environment,
32627
32703
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
32628
32704
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -32631,6 +32707,7 @@ var ts;
32631
32707
  name: "preserveValueImports",
32632
32708
  type: "boolean",
32633
32709
  affectsEmit: true,
32710
+ affectsMultiFileEmitBuildInfo: true,
32634
32711
  category: ts.Diagnostics.Emit,
32635
32712
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
32636
32713
  defaultValueDescription: false,
@@ -32669,6 +32746,7 @@ var ts;
32669
32746
  ts.optionDeclarations = __spreadArray(__spreadArray([], ts.commonOptionsWithBuild, true), commandOptionsWithoutBuild, true);
32670
32747
  ts.semanticDiagnosticsOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsSemanticDiagnostics; });
32671
32748
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
32749
+ ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
32672
32750
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
32673
32751
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
32674
32752
  return !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics;
@@ -33448,6 +33526,7 @@ var ts;
33448
33526
  }
33449
33527
  });
33450
33528
  }
33529
+ ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
33451
33530
  function serializeCompilerOptions(options, pathOptions) {
33452
33531
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
33453
33532
  }
@@ -35217,15 +35296,19 @@ var ts;
35217
35296
  function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
35218
35297
  return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
35219
35298
  }
35220
- function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
35221
- var containingDirectory = ts.getDirectoryPath(containingFile);
35222
- var esmMode = resolutionMode === ts.ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0;
35223
- return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions, redirectedReference);
35224
- }
35225
35299
  var jsOnlyExtensions = [Extensions.JavaScript];
35226
35300
  var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
35227
35301
  var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
35228
35302
  var tsconfigExtensions = [Extensions.TSConfig];
35303
+ function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
35304
+ var containingDirectory = ts.getDirectoryPath(containingFile);
35305
+ var esmMode = resolutionMode === ts.ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0;
35306
+ var extensions = compilerOptions.noDtsResolution ? [Extensions.TsOnly, Extensions.JavaScript] : tsExtensions;
35307
+ if (compilerOptions.resolveJsonModule) {
35308
+ extensions = __spreadArray(__spreadArray([], extensions, true), [Extensions.Json], false);
35309
+ }
35310
+ return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference);
35311
+ }
35229
35312
  function tryResolveJSModuleWorker(moduleName, initialDir, host) {
35230
35313
  return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, undefined, jsOnlyExtensions, undefined);
35231
35314
  }
@@ -38505,12 +38588,14 @@ var ts;
38505
38588
  }
38506
38589
  }
38507
38590
  function setCommonJsModuleIndicator(node) {
38508
- if (file.externalModuleIndicator) {
38591
+ if (file.externalModuleIndicator && file.externalModuleIndicator !== true) {
38509
38592
  return false;
38510
38593
  }
38511
38594
  if (!file.commonJsModuleIndicator) {
38512
38595
  file.commonJsModuleIndicator = node;
38513
- bindSourceFileAsExternalModule();
38596
+ if (!file.externalModuleIndicator) {
38597
+ bindSourceFileAsExternalModule();
38598
+ }
38514
38599
  }
38515
38600
  return true;
38516
38601
  }
@@ -38863,7 +38948,11 @@ var ts;
38863
38948
  checkStrictModeEvalOrArguments(node, node.name);
38864
38949
  }
38865
38950
  if (!ts.isBindingPattern(node.name)) {
38866
- if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) && !ts.getJSDocTypeTag(node) && !(ts.getCombinedModifierFlags(node) & 1)) {
38951
+ var possibleVariableDecl = node.kind === 254 ? node : node.parent.parent;
38952
+ if (ts.isInJSFile(node) &&
38953
+ ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) &&
38954
+ !ts.getJSDocTypeTag(node) &&
38955
+ !(ts.getCombinedModifierFlags(node) & 1)) {
38867
38956
  declareSymbolAndAddToSymbolTable(node, 2097152, 2097152);
38868
38957
  }
38869
38958
  else if (ts.isBlockOrCatchScoped(node)) {
@@ -41176,7 +41265,8 @@ var ts;
41176
41265
  && isAliasableOrJsExpression(node.parent.right)
41177
41266
  || node.kind === 297
41178
41267
  || node.kind === 296 && isAliasableOrJsExpression(node.initializer)
41179
- || ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node);
41268
+ || node.kind === 254 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)
41269
+ || node.kind === 203 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent);
41180
41270
  }
41181
41271
  function isAliasableOrJsExpression(e) {
41182
41272
  return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e);
@@ -41257,7 +41347,7 @@ var ts;
41257
41347
  if (!ts.isSourceFileJS(file)) {
41258
41348
  return hasExportAssignmentSymbol(moduleSymbol);
41259
41349
  }
41260
- return !file.externalModuleIndicator && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), undefined, dontResolveAlias);
41350
+ return typeof file.externalModuleIndicator !== "object" && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), undefined, dontResolveAlias);
41261
41351
  }
41262
41352
  function getTargetOfImportClause(node, dontResolveAlias) {
41263
41353
  var _a;
@@ -56821,17 +56911,32 @@ var ts;
56821
56911
  return sourceStart.slice(0, startLen) !== targetStart.slice(0, startLen) ||
56822
56912
  sourceEnd.slice(sourceEnd.length - endLen) !== targetEnd.slice(targetEnd.length - endLen);
56823
56913
  }
56824
- function isValidBigIntString(s) {
56914
+ function isValidNumberString(s, roundTripOnly) {
56915
+ if (s === "")
56916
+ return false;
56917
+ var n = +s;
56918
+ return isFinite(n) && (!roundTripOnly || "" + n === s);
56919
+ }
56920
+ function parseBigIntLiteralType(text) {
56921
+ var negative = text.startsWith("-");
56922
+ var base10Value = ts.parsePseudoBigInt((negative ? text.slice(1) : text) + "n");
56923
+ return getBigIntLiteralType({ negative: negative, base10Value: base10Value });
56924
+ }
56925
+ function isValidBigIntString(s, roundTripOnly) {
56926
+ if (s === "")
56927
+ return false;
56825
56928
  var scanner = ts.createScanner(99, false);
56826
56929
  var success = true;
56827
56930
  scanner.setOnError(function () { return success = false; });
56828
56931
  scanner.setText(s + "n");
56829
56932
  var result = scanner.scan();
56830
- if (result === 40) {
56933
+ var negative = result === 40;
56934
+ if (negative) {
56831
56935
  result = scanner.scan();
56832
56936
  }
56833
56937
  var flags = scanner.getTokenFlags();
56834
- return success && result === 9 && scanner.getTextPos() === (s.length + 1) && !(flags & 512);
56938
+ return success && result === 9 && scanner.getTextPos() === (s.length + 1) && !(flags & 512)
56939
+ && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
56835
56940
  }
56836
56941
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
56837
56942
  if (source === target || target.flags & (1 | 4)) {
@@ -56839,8 +56944,8 @@ var ts;
56839
56944
  }
56840
56945
  if (source.flags & 128) {
56841
56946
  var value = source.value;
56842
- return !!(target.flags & 8 && value !== "" && isFinite(+value) ||
56843
- target.flags & 64 && value !== "" && isValidBigIntString(value) ||
56947
+ return !!(target.flags & 8 && isValidNumberString(value, false) ||
56948
+ target.flags & 64 && isValidBigIntString(value, false) ||
56844
56949
  target.flags & (512 | 98304) && value === target.intrinsicName);
56845
56950
  }
56846
56951
  if (source.flags & 134217728) {
@@ -57305,8 +57410,51 @@ var ts;
57305
57410
  var matches = inferTypesFromTemplateLiteralType(source, target);
57306
57411
  var types = target.types;
57307
57412
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
57413
+ var _loop_23 = function (i) {
57414
+ var source_1 = matches ? matches[i] : neverType;
57415
+ var target_3 = types[i];
57416
+ if (source_1.flags & 128 && target_3.flags & 8650752) {
57417
+ var inferenceContext = getInferenceInfoForType(target_3);
57418
+ var constraint = inferenceContext ? getBaseConstraintOfType(inferenceContext.typeParameter) : undefined;
57419
+ if (constraint && !isTypeAny(constraint)) {
57420
+ var constraintTypes = constraint.flags & 1048576 ? constraint.types : [constraint];
57421
+ var allTypeFlags_1 = ts.reduceLeft(constraintTypes, function (flags, t) { return flags | t.flags; }, 0);
57422
+ if (!(allTypeFlags_1 & 4)) {
57423
+ var str_1 = source_1.value;
57424
+ if (allTypeFlags_1 & 296 && !isValidNumberString(str_1, true)) {
57425
+ allTypeFlags_1 &= ~296;
57426
+ }
57427
+ if (allTypeFlags_1 & 2112 && !isValidBigIntString(str_1, true)) {
57428
+ allTypeFlags_1 &= ~2112;
57429
+ }
57430
+ var matchingType = ts.reduceLeft(constraintTypes, function (left, right) {
57431
+ return !(right.flags & allTypeFlags_1) ? left :
57432
+ left.flags & 4 ? left : right.flags & 4 ? source_1 :
57433
+ left.flags & 134217728 ? left : right.flags & 134217728 && isTypeMatchedByTemplateLiteralType(source_1, right) ? source_1 :
57434
+ left.flags & 268435456 ? left : right.flags & 268435456 && str_1 === applyStringMapping(right.symbol, str_1) ? source_1 :
57435
+ left.flags & 128 ? left : right.flags & 128 && right.value === str_1 ? right :
57436
+ left.flags & 8 ? left : right.flags & 8 ? getNumberLiteralType(+str_1) :
57437
+ left.flags & 32 ? left : right.flags & 32 ? getNumberLiteralType(+str_1) :
57438
+ left.flags & 256 ? left : right.flags & 256 && right.value === +str_1 ? right :
57439
+ left.flags & 64 ? left : right.flags & 64 ? parseBigIntLiteralType(str_1) :
57440
+ left.flags & 2048 ? left : right.flags & 2048 && ts.pseudoBigIntToString(right.value) === str_1 ? right :
57441
+ left.flags & 16 ? left : right.flags & 16 ? str_1 === "true" ? trueType : str_1 === "false" ? falseType : booleanType :
57442
+ left.flags & 512 ? left : right.flags & 512 && right.intrinsicName === str_1 ? right :
57443
+ left.flags & 32768 ? left : right.flags & 32768 && right.intrinsicName === str_1 ? right :
57444
+ left.flags & 65536 ? left : right.flags & 65536 && right.intrinsicName === str_1 ? right :
57445
+ left;
57446
+ }, neverType);
57447
+ if (!(matchingType.flags & 131072)) {
57448
+ inferFromTypes(matchingType, target_3);
57449
+ return "continue";
57450
+ }
57451
+ }
57452
+ }
57453
+ }
57454
+ inferFromTypes(source_1, target_3);
57455
+ };
57308
57456
  for (var i = 0; i < types.length; i++) {
57309
- inferFromTypes(matches ? matches[i] : neverType, types[i]);
57457
+ _loop_23(i);
57310
57458
  }
57311
57459
  }
57312
57460
  }
@@ -57776,7 +57924,7 @@ var ts;
57776
57924
  function mapTypesByKeyProperty(types, name) {
57777
57925
  var map = new ts.Map();
57778
57926
  var count = 0;
57779
- var _loop_23 = function (type) {
57927
+ var _loop_24 = function (type) {
57780
57928
  if (type.flags & (524288 | 2097152 | 58982400)) {
57781
57929
  var discriminant = getTypeOfPropertyOfType(type, name);
57782
57930
  if (discriminant) {
@@ -57802,7 +57950,7 @@ var ts;
57802
57950
  };
57803
57951
  for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
57804
57952
  var type = types_16[_i];
57805
- var state_9 = _loop_23(type);
57953
+ var state_9 = _loop_24(type);
57806
57954
  if (typeof state_9 === "object")
57807
57955
  return state_9.value;
57808
57956
  }
@@ -63225,7 +63373,7 @@ var ts;
63225
63373
  var spreadIndex = getSpreadArgumentIndex(args);
63226
63374
  if (spreadIndex >= 0) {
63227
63375
  var effectiveArgs_1 = args.slice(0, spreadIndex);
63228
- var _loop_24 = function (i) {
63376
+ var _loop_25 = function (i) {
63229
63377
  var arg = args[i];
63230
63378
  var spreadType = arg.kind === 225 && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
63231
63379
  if (spreadType && isTupleType(spreadType)) {
@@ -63241,7 +63389,7 @@ var ts;
63241
63389
  }
63242
63390
  };
63243
63391
  for (var i = spreadIndex; i < args.length; i++) {
63244
- _loop_24(i);
63392
+ _loop_25(i);
63245
63393
  }
63246
63394
  return effectiveArgs_1;
63247
63395
  }
@@ -63489,7 +63637,7 @@ var ts;
63489
63637
  var min_3 = Number.MAX_VALUE;
63490
63638
  var minIndex = 0;
63491
63639
  var i_1 = 0;
63492
- var _loop_25 = function (c) {
63640
+ var _loop_26 = function (c) {
63493
63641
  var chain_2 = function () { return ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
63494
63642
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0, true, chain_2);
63495
63643
  if (diags_2) {
@@ -63507,7 +63655,7 @@ var ts;
63507
63655
  };
63508
63656
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
63509
63657
  var c = candidatesForArgumentError_1[_a];
63510
- _loop_25(c);
63658
+ _loop_26(c);
63511
63659
  }
63512
63660
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
63513
63661
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -63650,7 +63798,7 @@ var ts;
63650
63798
  }
63651
63799
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
63652
63800
  var parameters = [];
63653
- var _loop_26 = function (i) {
63801
+ var _loop_27 = function (i) {
63654
63802
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
63655
63803
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
63656
63804
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -63658,7 +63806,7 @@ var ts;
63658
63806
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
63659
63807
  };
63660
63808
  for (var i = 0; i < maxNonRestParam; i++) {
63661
- _loop_26(i);
63809
+ _loop_27(i);
63662
63810
  }
63663
63811
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
63664
63812
  var flags = 0;
@@ -67254,7 +67402,7 @@ var ts;
67254
67402
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
67255
67403
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
67256
67404
  var indexSignatureMap_1 = new ts.Map();
67257
- var _loop_27 = function (declaration) {
67405
+ var _loop_28 = function (declaration) {
67258
67406
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
67259
67407
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
67260
67408
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -67269,7 +67417,7 @@ var ts;
67269
67417
  };
67270
67418
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
67271
67419
  var declaration = _a[_i];
67272
- _loop_27(declaration);
67420
+ _loop_28(declaration);
67273
67421
  }
67274
67422
  indexSignatureMap_1.forEach(function (entry) {
67275
67423
  if (entry.declarations.length > 1) {
@@ -69095,7 +69243,7 @@ var ts;
69095
69243
  return;
69096
69244
  }
69097
69245
  var symbol = getSymbolOfNode(node);
69098
- if (symbol.flags & 2097152 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)) {
69246
+ if (symbol.flags & 2097152 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 ? node.parent.parent : node)) {
69099
69247
  checkAliasSymbol(node);
69100
69248
  return;
69101
69249
  }
@@ -70089,7 +70237,7 @@ var ts;
70089
70237
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 258) : undefined;
70090
70238
  var localPropDeclaration = declaration && declaration.kind === 221 ||
70091
70239
  name && name.kind === 162 || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
70092
- var _loop_28 = function (info) {
70240
+ var _loop_29 = function (info) {
70093
70241
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
70094
70242
  var errorNode = localPropDeclaration || localIndexDeclaration ||
70095
70243
  (interfaceDeclaration && !ts.some(getBaseTypes(type), function (base) { return !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info.keyType); }) ? interfaceDeclaration : undefined);
@@ -70099,7 +70247,7 @@ var ts;
70099
70247
  };
70100
70248
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
70101
70249
  var info = indexInfos_9[_i];
70102
- _loop_28(info);
70250
+ _loop_29(info);
70103
70251
  }
70104
70252
  }
70105
70253
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -70107,7 +70255,7 @@ var ts;
70107
70255
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
70108
70256
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 258) : undefined;
70109
70257
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
70110
- var _loop_29 = function (info) {
70258
+ var _loop_30 = function (info) {
70111
70259
  if (info === checkInfo)
70112
70260
  return "continue";
70113
70261
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -70119,7 +70267,7 @@ var ts;
70119
70267
  };
70120
70268
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
70121
70269
  var info = indexInfos_10[_i];
70122
- _loop_29(info);
70270
+ _loop_30(info);
70123
70271
  }
70124
70272
  }
70125
70273
  function checkTypeNameIsReserved(name, message) {
@@ -70413,7 +70561,7 @@ var ts;
70413
70561
  var baseTypes = baseTypeNode && getBaseTypes(type);
70414
70562
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
70415
70563
  var baseStaticType = getBaseConstructorTypeOfClass(type);
70416
- var _loop_30 = function (member) {
70564
+ var _loop_31 = function (member) {
70417
70565
  if (ts.hasAmbientModifier(member)) {
70418
70566
  return "continue";
70419
70567
  }
@@ -70428,7 +70576,7 @@ var ts;
70428
70576
  };
70429
70577
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
70430
70578
  var member = _a[_i];
70431
- _loop_30(member);
70579
+ _loop_31(member);
70432
70580
  }
70433
70581
  }
70434
70582
  function checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member, memberIsParameterProperty, reportErrors) {
@@ -70503,7 +70651,7 @@ var ts;
70503
70651
  }
70504
70652
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
70505
70653
  var issuedMemberError = false;
70506
- var _loop_31 = function (member) {
70654
+ var _loop_32 = function (member) {
70507
70655
  if (ts.isStatic(member)) {
70508
70656
  return "continue";
70509
70657
  }
@@ -70521,7 +70669,7 @@ var ts;
70521
70669
  };
70522
70670
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
70523
70671
  var member = _a[_i];
70524
- _loop_31(member);
70672
+ _loop_32(member);
70525
70673
  }
70526
70674
  if (!issuedMemberError) {
70527
70675
  checkTypeAssignableTo(typeWithThis, baseWithThis, node.name || node, broadDiag);
@@ -75651,9 +75799,7 @@ var ts;
75651
75799
  var ts;
75652
75800
  (function (ts) {
75653
75801
  function createSourceMapGenerator(host, file, sourceRoot, sourcesDirectoryPath, generatorOptions) {
75654
- var _a = generatorOptions.extendedDiagnostics
75655
- ? ts.performance.createTimer("Source Map", "beforeSourcemap", "afterSourcemap")
75656
- : ts.performance.nullTimer, enter = _a.enter, exit = _a.exit;
75802
+ var _a = ts.performance.createTimerIf(!!generatorOptions.extendedDiagnostics, "Source Map", "beforeSourcemap", "afterSourcemap"), enter = _a.enter, exit = _a.exit;
75657
75803
  var rawSources = [];
75658
75804
  var sources = [];
75659
75805
  var sourceToSourceIndexMap = new ts.Map();
@@ -90419,7 +90565,8 @@ var ts;
90419
90565
  return;
90420
90566
  }
90421
90567
  var version = ts.version;
90422
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), false);
90568
+ var buildInfo = { bundle: bundle, program: program, version: version };
90569
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), false, undefined, { buildInfo: buildInfo });
90423
90570
  }
90424
90571
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
90425
90572
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -90560,12 +90707,17 @@ var ts;
90560
90707
  if (sourceMapFilePath) {
90561
90708
  var sourceMap = sourceMapGenerator.toString();
90562
90709
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, false, sourceFiles);
90710
+ if (printer.bundleFileInfo)
90711
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
90563
90712
  }
90564
90713
  }
90565
90714
  else {
90566
90715
  writer.writeLine();
90567
90716
  }
90568
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
90717
+ var text = writer.getText();
90718
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
90719
+ if (printer.bundleFileInfo)
90720
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
90569
90721
  writer.clear();
90570
90722
  }
90571
90723
  function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
@@ -90690,30 +90842,50 @@ var ts;
90690
90842
  });
90691
90843
  }
90692
90844
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
90845
+ var createHash = ts.maybeBind(host, host.createHash);
90693
90846
  var _a = getOutputPathsForBundle(config.options, false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
90694
- var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
90695
- if (!buildInfoText)
90847
+ var buildInfo;
90848
+ if (host.getBuildInfo) {
90849
+ var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
90850
+ if (!hostBuildInfo)
90851
+ return buildInfoPath;
90852
+ buildInfo = hostBuildInfo;
90853
+ }
90854
+ else {
90855
+ var buildInfoText = host.readFile(buildInfoPath);
90856
+ if (!buildInfoText)
90857
+ return buildInfoPath;
90858
+ buildInfo = getBuildInfo(buildInfoText);
90859
+ }
90860
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
90696
90861
  return buildInfoPath;
90697
90862
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
90698
90863
  if (!jsFileText)
90699
90864
  return jsFilePath;
90865
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
90866
+ return jsFilePath;
90700
90867
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
90701
90868
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
90702
90869
  return sourceMapFilePath || "inline sourcemap decoding";
90870
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
90871
+ return sourceMapFilePath;
90703
90872
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
90704
90873
  if (declarationFilePath && !declarationText)
90705
90874
  return declarationFilePath;
90875
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
90876
+ return declarationFilePath;
90706
90877
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
90707
90878
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
90708
90879
  return declarationMapPath || "inline sourcemap decoding";
90709
- var buildInfo = getBuildInfo(buildInfoText);
90710
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
90711
- return buildInfoPath;
90880
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
90881
+ return declarationMapPath;
90712
90882
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
90713
90883
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo, true);
90714
90884
  var outputFiles = [];
90715
90885
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
90716
90886
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
90887
+ var changedDtsText;
90888
+ var changedDtsData;
90717
90889
  var emitHost = {
90718
90890
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
90719
90891
  getCanonicalFileName: host.getCanonicalFileName,
@@ -90729,7 +90901,7 @@ var ts;
90729
90901
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
90730
90902
  getProjectReferenceRedirect: ts.returnUndefined,
90731
90903
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
90732
- writeFile: function (name, text, writeByteOrderMark) {
90904
+ writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
90733
90905
  switch (name) {
90734
90906
  case jsFilePath:
90735
90907
  if (jsFileText === text)
@@ -90740,19 +90912,25 @@ var ts;
90740
90912
  return;
90741
90913
  break;
90742
90914
  case buildInfoPath:
90743
- var newBuildInfo = getBuildInfo(text);
90915
+ var newBuildInfo = data.buildInfo;
90744
90916
  newBuildInfo.program = buildInfo.program;
90917
+ if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
90918
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
90919
+ newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
90920
+ }
90745
90921
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
90746
90922
  newBuildInfo.bundle.js.sources = js.sources;
90747
90923
  if (dts) {
90748
90924
  newBuildInfo.bundle.dts.sources = dts.sources;
90749
90925
  }
90750
90926
  newBuildInfo.bundle.sourceFiles = sourceFiles;
90751
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
90927
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
90752
90928
  return;
90753
90929
  case declarationFilePath:
90754
90930
  if (declarationText === text)
90755
90931
  return;
90932
+ changedDtsText = text;
90933
+ changedDtsData = data;
90756
90934
  break;
90757
90935
  case declarationMapPath:
90758
90936
  if (declarationMapText === text)
@@ -90771,6 +90949,7 @@ var ts;
90771
90949
  getSourceFileFromReference: ts.returnUndefined,
90772
90950
  redirectTargetsMap: ts.createMultiMap(),
90773
90951
  getFileIncludeReasons: ts.notImplemented,
90952
+ createHash: createHash,
90774
90953
  };
90775
90954
  emitFiles(ts.notImplementedResolver, emitHost, undefined, ts.getTransformers(config.options, customTransformers));
90776
90955
  return outputFiles;
@@ -95395,7 +95574,6 @@ var ts;
95395
95574
  if (system === void 0) { system = ts.sys; }
95396
95575
  var existingDirectories = new ts.Map();
95397
95576
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
95398
- var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
95399
95577
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
95400
95578
  var text;
95401
95579
  try {
@@ -95425,7 +95603,7 @@ var ts;
95425
95603
  function writeFile(fileName, data, writeByteOrderMark, onError) {
95426
95604
  try {
95427
95605
  ts.performance.mark("beforeIOWrite");
95428
- 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); });
95606
+ 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); });
95429
95607
  ts.performance.mark("afterIOWrite");
95430
95608
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
95431
95609
  }
@@ -95435,34 +95613,6 @@ var ts;
95435
95613
  }
95436
95614
  }
95437
95615
  }
95438
- var outputFingerprints;
95439
- function writeFileWorker(fileName, data, writeByteOrderMark) {
95440
- if (!ts.isWatchSet(options) || !system.getModifiedTime) {
95441
- system.writeFile(fileName, data, writeByteOrderMark);
95442
- return;
95443
- }
95444
- if (!outputFingerprints) {
95445
- outputFingerprints = new ts.Map();
95446
- }
95447
- var hash = computeHash(data);
95448
- var mtimeBefore = system.getModifiedTime(fileName);
95449
- if (mtimeBefore) {
95450
- var fingerprint = outputFingerprints.get(fileName);
95451
- if (fingerprint &&
95452
- fingerprint.byteOrderMark === writeByteOrderMark &&
95453
- fingerprint.hash === hash &&
95454
- fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
95455
- return;
95456
- }
95457
- }
95458
- system.writeFile(fileName, data, writeByteOrderMark);
95459
- var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
95460
- outputFingerprints.set(fileName, {
95461
- hash: hash,
95462
- byteOrderMark: writeByteOrderMark,
95463
- mtime: mtimeAfter
95464
- });
95465
- }
95466
95616
  function getDefaultLibLocation() {
95467
95617
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
95468
95618
  }
@@ -96836,6 +96986,7 @@ var ts;
96836
96986
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
96837
96987
  redirectTargetsMap: redirectTargetsMap,
96838
96988
  getFileIncludeReasons: program.getFileIncludeReasons,
96989
+ createHash: ts.maybeBind(host, host.createHash),
96839
96990
  };
96840
96991
  }
96841
96992
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -98742,13 +98893,9 @@ var ts;
98742
98893
  function createManyToManyPathMap() {
98743
98894
  function create(forward, reverse, deleted) {
98744
98895
  var map = {
98745
- clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
98746
- forEach: function (fn) { return forward.forEach(fn); },
98747
98896
  getKeys: function (v) { return reverse.get(v); },
98748
98897
  getValues: function (k) { return forward.get(k); },
98749
- hasKey: function (k) { return forward.has(k); },
98750
98898
  keys: function () { return forward.keys(); },
98751
- deletedKeys: function () { return deleted; },
98752
98899
  deleteKey: function (k) {
98753
98900
  (deleted || (deleted = new ts.Set())).add(k);
98754
98901
  var set = forward.get(k);
@@ -98775,11 +98922,6 @@ var ts;
98775
98922
  });
98776
98923
  return map;
98777
98924
  },
98778
- clear: function () {
98779
- forward.clear();
98780
- reverse.clear();
98781
- deleted === null || deleted === void 0 ? void 0 : deleted.clear();
98782
- }
98783
98925
  };
98784
98926
  return map;
98785
98927
  }
@@ -98883,35 +99025,45 @@ var ts;
98883
99025
  }
98884
99026
  BuilderState.canReuseOldState = canReuseOldState;
98885
99027
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
99028
+ var _a, _b, _c;
98886
99029
  var fileInfos = new ts.Map();
98887
99030
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
98888
99031
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
98889
- var hasCalledUpdateShapeSignature = new ts.Set();
98890
99032
  var useOldState = canReuseOldState(referencedMap, oldState);
98891
99033
  newProgram.getTypeChecker();
98892
- for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
98893
- var sourceFile = _a[_i];
99034
+ for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
99035
+ var sourceFile = _d[_i];
98894
99036
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
98895
- var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
99037
+ var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
99038
+ var signature = oldUncommitedSignature === undefined ?
99039
+ useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
99040
+ oldUncommitedSignature || undefined;
98896
99041
  if (referencedMap) {
98897
99042
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
98898
99043
  if (newReferences) {
98899
99044
  referencedMap.set(sourceFile.resolvedPath, newReferences);
98900
99045
  }
98901
99046
  if (useOldState) {
98902
- var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
99047
+ var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
99048
+ var exportedModules = oldUncommitedExportedModules === undefined ?
99049
+ oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
99050
+ oldUncommitedExportedModules || undefined;
98903
99051
  if (exportedModules) {
98904
99052
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
98905
99053
  }
98906
99054
  }
98907
99055
  }
98908
- fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
99056
+ fileInfos.set(sourceFile.resolvedPath, {
99057
+ version: version_2,
99058
+ signature: signature,
99059
+ affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
99060
+ impliedFormat: sourceFile.impliedNodeFormat
99061
+ });
98909
99062
  }
98910
99063
  return {
98911
99064
  fileInfos: fileInfos,
98912
99065
  referencedMap: referencedMap,
98913
99066
  exportedModulesMap: exportedModulesMap,
98914
- hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
98915
99067
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
98916
99068
  };
98917
99069
  }
@@ -98921,52 +99073,36 @@ var ts;
98921
99073
  state.allFileNames = undefined;
98922
99074
  }
98923
99075
  BuilderState.releaseCache = releaseCache;
98924
- function clone(state) {
99076
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
98925
99077
  var _a, _b;
98926
- return {
98927
- fileInfos: new ts.Map(state.fileInfos),
98928
- referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
98929
- exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
98930
- hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
98931
- useFileVersionAsSignature: state.useFileVersionAsSignature,
98932
- };
99078
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
99079
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
99080
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
99081
+ return result;
98933
99082
  }
98934
- BuilderState.clone = clone;
98935
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
98936
- var signatureCache = cacheToUpdateSignature || new ts.Map();
99083
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
99084
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
98937
99085
  var sourceFile = programOfThisState.getSourceFileByPath(path);
98938
99086
  if (!sourceFile) {
98939
99087
  return ts.emptyArray;
98940
99088
  }
98941
- if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
99089
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
98942
99090
  return [sourceFile];
98943
99091
  }
98944
- var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
98945
- if (!cacheToUpdateSignature) {
98946
- updateSignaturesFromCache(state, signatureCache);
98947
- }
98948
- return result;
99092
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
98949
99093
  }
98950
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
98951
- function updateSignaturesFromCache(state, signatureCache) {
98952
- signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
98953
- }
98954
- BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
99094
+ BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
98955
99095
  function updateSignatureOfFile(state, signature, path) {
98956
99096
  state.fileInfos.get(path).signature = signature;
98957
- state.hasCalledUpdateShapeSignature.add(path);
99097
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
98958
99098
  }
98959
99099
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
98960
- function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
99100
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
99101
+ var _a;
98961
99102
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
98962
- ts.Debug.assert(!!sourceFile);
98963
- ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
98964
- if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
99103
+ if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
98965
99104
  return false;
98966
- }
98967
99105
  var info = state.fileInfos.get(sourceFile.resolvedPath);
98968
- if (!info)
98969
- return ts.Debug.fail();
98970
99106
  var prevSignature = info.signature;
98971
99107
  var latestSignature;
98972
99108
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -98974,40 +99110,50 @@ var ts;
98974
99110
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
98975
99111
  if (firstDts_1) {
98976
99112
  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; })); });
98977
- latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
98978
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
98979
- updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
99113
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
99114
+ if (latestSignature !== prevSignature) {
99115
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
98980
99116
  }
98981
99117
  }
98982
99118
  }
98983
99119
  if (latestSignature === undefined) {
98984
99120
  latestSignature = sourceFile.version;
98985
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
99121
+ if (state.exportedModulesMap && latestSignature !== prevSignature) {
99122
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
98986
99123
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
98987
99124
  if (references) {
98988
- exportedModulesMapCache.set(sourceFile.resolvedPath, references);
99125
+ state.exportedModulesMap.set(sourceFile.resolvedPath, references);
98989
99126
  }
98990
99127
  else {
98991
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
99128
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
98992
99129
  }
98993
99130
  }
98994
99131
  }
98995
- cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
99132
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
99133
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
99134
+ info.signature = latestSignature;
98996
99135
  return latestSignature !== prevSignature;
98997
99136
  }
98998
99137
  BuilderState.updateShapeSignature = updateShapeSignature;
98999
- function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
99138
+ function computeSignature(text, computeHash) {
99139
+ return (computeHash || ts.generateDjb2Hash)(text);
99140
+ }
99141
+ BuilderState.computeSignature = computeSignature;
99142
+ function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
99143
+ if (!state.exportedModulesMap)
99144
+ return;
99145
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
99000
99146
  if (!exportedModulesFromDeclarationEmit) {
99001
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
99147
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
99002
99148
  return;
99003
99149
  }
99004
99150
  var exportedModules;
99005
99151
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
99006
99152
  if (exportedModules) {
99007
- exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
99153
+ state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
99008
99154
  }
99009
99155
  else {
99010
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
99156
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
99011
99157
  }
99012
99158
  function addExportedModule(exportedModulePaths) {
99013
99159
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -99019,15 +99165,6 @@ var ts;
99019
99165
  }
99020
99166
  }
99021
99167
  BuilderState.updateExportedModules = updateExportedModules;
99022
- function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
99023
- var _a;
99024
- if (exportedModulesMapCache) {
99025
- ts.Debug.assert(!!state.exportedModulesMap);
99026
- (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
99027
- exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
99028
- }
99029
- }
99030
- BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
99031
99168
  function getAllDependencies(state, programOfThisState, sourceFile) {
99032
99169
  var compilerOptions = programOfThisState.getCompilerOptions();
99033
99170
  if (ts.outFile(compilerOptions)) {
@@ -99111,7 +99248,7 @@ var ts;
99111
99248
  }
99112
99249
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
99113
99250
  }
99114
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
99251
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
99115
99252
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
99116
99253
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
99117
99254
  }
@@ -99127,7 +99264,7 @@ var ts;
99127
99264
  if (!seenFileNamesMap.has(currentPath)) {
99128
99265
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
99129
99266
  seenFileNamesMap.set(currentPath, currentSourceFile);
99130
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
99267
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
99131
99268
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
99132
99269
  }
99133
99270
  }
@@ -99142,29 +99279,31 @@ var ts;
99142
99279
  return map1 === map2 || map1 !== undefined && map2 !== undefined && map1.size === map2.size && !ts.forEachKey(map1, function (key) { return !map2.has(key); });
99143
99280
  }
99144
99281
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
99282
+ var _a, _b;
99145
99283
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
99146
99284
  state.program = newProgram;
99147
99285
  var compilerOptions = newProgram.getCompilerOptions();
99148
99286
  state.compilerOptions = compilerOptions;
99149
- if (!ts.outFile(compilerOptions)) {
99287
+ var outFilePath = ts.outFile(compilerOptions);
99288
+ if (!outFilePath) {
99150
99289
  state.semanticDiagnosticsPerFile = new ts.Map();
99151
99290
  }
99291
+ 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)) {
99292
+ state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
99293
+ }
99152
99294
  state.changedFilesSet = new ts.Set();
99295
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
99153
99296
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
99154
99297
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
99155
99298
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
99156
99299
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
99300
+ var canCopyEmitSignatures = compilerOptions.composite &&
99301
+ (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
99302
+ !outFilePath &&
99303
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
99157
99304
  if (useOldState) {
99158
- if (!oldState.currentChangedFilePath) {
99159
- var affectedSignatures = oldState.currentAffectedFilesSignatures;
99160
- ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
99161
- }
99162
- var changedFilesSet = oldState.changedFilesSet;
99163
- if (canCopySemanticDiagnostics) {
99164
- ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
99165
- }
99166
- changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
99167
- if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
99305
+ (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
99306
+ if (!outFilePath && oldState.affectedFilesPendingEmit) {
99168
99307
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
99169
99308
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
99170
99309
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -99181,6 +99320,7 @@ var ts;
99181
99320
  if (!useOldState ||
99182
99321
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
99183
99322
  oldInfo.version !== info.version ||
99323
+ oldInfo.impliedFormat !== info.impliedFormat ||
99184
99324
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
99185
99325
  newReferences && ts.forEachKey(newReferences, function (path) { return !state.fileInfos.has(path) && oldState.fileInfos.has(path); })) {
99186
99326
  state.changedFilesSet.add(sourceFilePath);
@@ -99200,24 +99340,22 @@ var ts;
99200
99340
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
99201
99341
  }
99202
99342
  }
99343
+ if (canCopyEmitSignatures) {
99344
+ var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
99345
+ if (oldEmitSignature)
99346
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
99347
+ }
99203
99348
  });
99204
99349
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
99205
99350
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, undefined)
99206
99351
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
99207
99352
  }
99208
- else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
99353
+ else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
99209
99354
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1); });
99210
99355
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
99211
99356
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
99212
99357
  }
99213
- if (useOldState) {
99214
- ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
99215
- if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
99216
- state.changedFilesSet.add(sourceFilePath);
99217
- }
99218
- });
99219
- }
99220
- state.buildInfoEmitPending = !!state.changedFilesSet.size;
99358
+ state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
99221
99359
  return state;
99222
99360
  }
99223
99361
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -99250,33 +99388,40 @@ var ts;
99250
99388
  ts.BuilderState.releaseCache(state);
99251
99389
  state.program = undefined;
99252
99390
  }
99253
- function cloneBuilderProgramState(state) {
99254
- var _a;
99255
- var newState = ts.BuilderState.clone(state);
99256
- newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
99257
- newState.changedFilesSet = new ts.Set(state.changedFilesSet);
99258
- newState.affectedFiles = state.affectedFiles;
99259
- newState.affectedFilesIndex = state.affectedFilesIndex;
99260
- newState.currentChangedFilePath = state.currentChangedFilePath;
99261
- newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
99262
- newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
99263
- newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
99264
- newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
99265
- newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
99266
- newState.program = state.program;
99267
- newState.compilerOptions = state.compilerOptions;
99268
- newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
99269
- newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
99270
- newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
99271
- newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
99272
- newState.programEmitComplete = state.programEmitComplete;
99273
- return newState;
99391
+ function backupEmitBuilderProgramState(state) {
99392
+ var outFilePath = ts.outFile(state.compilerOptions);
99393
+ ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
99394
+ return {
99395
+ affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
99396
+ affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
99397
+ affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
99398
+ seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
99399
+ programEmitComplete: state.programEmitComplete,
99400
+ emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
99401
+ outSignature: state.outSignature,
99402
+ dtsChangeTime: state.dtsChangeTime,
99403
+ hasChangedEmitSignature: state.hasChangedEmitSignature,
99404
+ changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
99405
+ };
99406
+ }
99407
+ function restoreEmitBuilderProgramState(state, backupEmitState) {
99408
+ state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
99409
+ state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
99410
+ state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
99411
+ state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
99412
+ state.programEmitComplete = backupEmitState.programEmitComplete;
99413
+ state.emitSignatures = backupEmitState.emitSignatures;
99414
+ state.outSignature = backupEmitState.outSignature;
99415
+ state.dtsChangeTime = backupEmitState.dtsChangeTime;
99416
+ state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
99417
+ if (backupEmitState.changedFilesSet)
99418
+ state.changedFilesSet = backupEmitState.changedFilesSet;
99274
99419
  }
99275
99420
  function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
99276
99421
  ts.Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
99277
99422
  }
99278
99423
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
99279
- var _a;
99424
+ var _a, _b;
99280
99425
  while (true) {
99281
99426
  var affectedFiles = state.affectedFiles;
99282
99427
  if (affectedFiles) {
@@ -99293,10 +99438,8 @@ var ts;
99293
99438
  }
99294
99439
  state.changedFilesSet.delete(state.currentChangedFilePath);
99295
99440
  state.currentChangedFilePath = undefined;
99296
- ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
99297
- state.currentAffectedFilesSignatures.clear();
99298
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
99299
- (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
99441
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
99442
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
99300
99443
  state.affectedFiles = undefined;
99301
99444
  }
99302
99445
  var nextKey = state.changedFilesSet.keys().next();
@@ -99309,12 +99452,7 @@ var ts;
99309
99452
  ts.Debug.assert(!state.semanticDiagnosticsPerFile);
99310
99453
  return program;
99311
99454
  }
99312
- if (!state.currentAffectedFilesSignatures)
99313
- state.currentAffectedFilesSignatures = new ts.Map();
99314
- if (state.exportedModulesMap) {
99315
- state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
99316
- }
99317
- state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
99455
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
99318
99456
  state.currentChangedFilePath = nextKey.value;
99319
99457
  state.affectedFilesIndex = 0;
99320
99458
  if (!state.seenAffectedFiles)
@@ -99358,14 +99496,12 @@ var ts;
99358
99496
  }
99359
99497
  }
99360
99498
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
99361
- var _a;
99362
99499
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
99363
99500
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
99364
99501
  removeDiagnosticsOfLibraryFiles(state);
99365
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
99502
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
99366
99503
  return;
99367
99504
  }
99368
- 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);
99369
99505
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
99370
99506
  return;
99371
99507
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -99376,7 +99512,7 @@ var ts;
99376
99512
  var program = ts.Debug.checkDefined(state.program);
99377
99513
  var sourceFile = program.getSourceFileByPath(path);
99378
99514
  if (sourceFile) {
99379
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
99515
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
99380
99516
  if (ts.getEmitDeclarations(state.compilerOptions)) {
99381
99517
  addToAffectedFilesPendingEmit(state, path, 0);
99382
99518
  }
@@ -99392,24 +99528,10 @@ var ts;
99392
99528
  return !state.semanticDiagnosticsFromOldState.size;
99393
99529
  }
99394
99530
  function isChangedSignature(state, path) {
99395
- var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
99396
- var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
99531
+ var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
99532
+ var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
99397
99533
  return newSignature !== oldSignature;
99398
99534
  }
99399
- function forEachKeyOfExportedModulesMap(state, filePath, fn) {
99400
- var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
99401
- var result = keys && ts.forEachKey(keys, fn);
99402
- if (result)
99403
- return result;
99404
- keys = state.exportedModulesMap.getKeys(filePath);
99405
- return keys && ts.forEachKey(keys, function (exportedFromPath) {
99406
- var _a;
99407
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
99408
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
99409
- fn(exportedFromPath) :
99410
- undefined;
99411
- });
99412
- }
99413
99535
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
99414
99536
  var _a;
99415
99537
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -99420,6 +99542,7 @@ var ts;
99420
99542
  return true;
99421
99543
  }
99422
99544
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
99545
+ var _a;
99423
99546
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
99424
99547
  return;
99425
99548
  if (!isChangedSignature(state, affectedFile.resolvedPath))
@@ -99442,9 +99565,8 @@ var ts;
99442
99565
  }
99443
99566
  }
99444
99567
  }
99445
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
99446
99568
  var seenFileAndExportsOfFile = new ts.Set();
99447
- forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
99569
+ (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
99448
99570
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
99449
99571
  return true;
99450
99572
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -99454,17 +99576,16 @@ var ts;
99454
99576
  });
99455
99577
  }
99456
99578
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
99457
- var _a;
99579
+ var _a, _b;
99458
99580
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
99459
99581
  return undefined;
99460
99582
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
99461
99583
  return true;
99462
99584
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
99463
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
99464
- forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
99585
+ (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
99465
99586
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
99466
99587
  });
99467
- (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
99588
+ (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
99468
99589
  return !seenFileAndExportsOfFile.has(referencingFilePath) &&
99469
99590
  handleDtsMayChangeOf(state, referencingFilePath, cancellationToken, computeHash, host);
99470
99591
  });
@@ -99480,12 +99601,12 @@ var ts;
99480
99601
  }
99481
99602
  else {
99482
99603
  state.seenAffectedFiles.add(affected.resolvedPath);
99604
+ state.buildInfoEmitPending = true;
99483
99605
  if (emitKind !== undefined) {
99484
99606
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
99485
99607
  }
99486
99608
  if (isPendingEmit) {
99487
99609
  state.affectedFilesPendingEmitIndex++;
99488
- state.buildInfoEmitPending = true;
99489
99610
  }
99490
99611
  else {
99491
99612
  state.affectedFilesIndex++;
@@ -99517,29 +99638,65 @@ var ts;
99517
99638
  }
99518
99639
  return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
99519
99640
  }
99520
- function getProgramBuildInfo(state, getCanonicalFileName) {
99521
- if (ts.outFile(state.compilerOptions))
99522
- return undefined;
99641
+ function isProgramBundleEmitBuildInfo(info) {
99642
+ return !!ts.outFile(info.options || {});
99643
+ }
99644
+ ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
99645
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
99646
+ var outFilePath = ts.outFile(state.compilerOptions);
99647
+ if (outFilePath && !state.compilerOptions.composite)
99648
+ return;
99523
99649
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
99524
99650
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
99651
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
99652
+ if (outFilePath) {
99653
+ var fileNames_1 = [];
99654
+ var fileInfos_1 = [];
99655
+ state.program.getRootFileNames().forEach(function (f) {
99656
+ var sourceFile = state.program.getSourceFile(f);
99657
+ if (!sourceFile)
99658
+ return;
99659
+ fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
99660
+ fileInfos_1.push(sourceFile.version);
99661
+ });
99662
+ var result_15 = {
99663
+ fileNames: fileNames_1,
99664
+ fileInfos: fileInfos_1,
99665
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
99666
+ outSignature: state.outSignature,
99667
+ dtsChangeTime: state.dtsChangeTime,
99668
+ };
99669
+ return result_15;
99670
+ }
99525
99671
  var fileNames = [];
99526
99672
  var fileNameToFileId = new ts.Map();
99527
99673
  var fileIdsList;
99528
99674
  var fileNamesToFileIdListId;
99675
+ var emitSignatures;
99529
99676
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
99677
+ var _b, _c;
99530
99678
  var key = _a[0], value = _a[1];
99531
99679
  var fileId = toFileId(key);
99532
99680
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
99533
- var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
99534
- var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
99681
+ var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
99682
+ var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
99683
+ if (state.compilerOptions.composite) {
99684
+ var file = state.program.getSourceFileByPath(key);
99685
+ if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
99686
+ var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
99687
+ if (emitSignature !== actualSignature) {
99688
+ (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
99689
+ }
99690
+ }
99691
+ }
99535
99692
  return value.version === actualSignature ?
99536
99693
  value.affectsGlobalScope || value.impliedFormat ?
99537
99694
  { version: value.version, signature: undefined, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
99538
99695
  value.version :
99539
99696
  actualSignature !== undefined ?
99540
- signature === undefined ?
99697
+ oldSignature === undefined ?
99541
99698
  value :
99542
- { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
99699
+ { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
99543
99700
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
99544
99701
  });
99545
99702
  var referencedMap;
@@ -99553,16 +99710,12 @@ var ts;
99553
99710
  if (state.exportedModulesMap) {
99554
99711
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
99555
99712
  var _a;
99556
- if (state.currentAffectedFilesExportedModulesMap) {
99557
- if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
99558
- return undefined;
99559
- }
99560
- var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
99561
- if (newValue) {
99562
- return [toFileId(key), toFileIdListId(newValue)];
99563
- }
99564
- }
99565
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
99713
+ var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
99714
+ if (oldValue === undefined)
99715
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
99716
+ if (oldValue)
99717
+ return [toFileId(key), toFileIdListId(oldValue)];
99718
+ return undefined;
99566
99719
  });
99567
99720
  }
99568
99721
  var semanticDiagnosticsPerFile;
@@ -99573,9 +99726,7 @@ var ts;
99573
99726
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
99574
99727
  [
99575
99728
  toFileId(key),
99576
- state.hasReusableDiagnostic ?
99577
- value :
99578
- convertToReusableDiagnostics(value, relativeToBuildInfo)
99729
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
99579
99730
  ] :
99580
99731
  toFileId(key));
99581
99732
  }
@@ -99590,16 +99741,27 @@ var ts;
99590
99741
  }
99591
99742
  }
99592
99743
  }
99593
- return {
99744
+ var changeFileSet;
99745
+ if (state.changedFilesSet.size) {
99746
+ for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
99747
+ var path = _e[_d];
99748
+ (changeFileSet || (changeFileSet = [])).push(toFileId(path));
99749
+ }
99750
+ }
99751
+ var result = {
99594
99752
  fileNames: fileNames,
99595
99753
  fileInfos: fileInfos,
99596
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
99754
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
99597
99755
  fileIdsList: fileIdsList,
99598
99756
  referencedMap: referencedMap,
99599
99757
  exportedModulesMap: exportedModulesMap,
99600
99758
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
99601
99759
  affectedFilesPendingEmit: affectedFilesPendingEmit,
99760
+ changeFileSet: changeFileSet,
99761
+ emitSignatures: emitSignatures,
99762
+ dtsChangeTime: state.dtsChangeTime,
99602
99763
  };
99764
+ return result;
99603
99765
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
99604
99766
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
99605
99767
  }
@@ -99624,21 +99786,18 @@ var ts;
99624
99786
  }
99625
99787
  return fileIdListId;
99626
99788
  }
99627
- }
99628
- function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
99629
- var result;
99630
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
99631
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
99632
- var name = _a[_i];
99633
- var optionKey = name.toLowerCase();
99634
- var optionInfo = optionsNameMap.get(optionKey);
99635
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
99636
- optionKey === "strict" ||
99637
- optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
99638
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
99789
+ function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
99790
+ var result;
99791
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
99792
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
99793
+ var name = _a[_i];
99794
+ var optionInfo = optionsNameMap.get(name.toLowerCase());
99795
+ if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
99796
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
99797
+ }
99639
99798
  }
99799
+ return result;
99640
99800
  }
99641
- return result;
99642
99801
  }
99643
99802
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
99644
99803
  if (option) {
@@ -99712,6 +99871,10 @@ var ts;
99712
99871
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
99713
99872
  }
99714
99873
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
99874
+ function computeSignature(text, data, computeHash) {
99875
+ return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
99876
+ }
99877
+ ts.computeSignature = computeSignature;
99715
99878
  function createBuilderProgram(kind, _a) {
99716
99879
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
99717
99880
  var oldState = oldProgram && oldProgram.getState();
@@ -99723,28 +99886,28 @@ var ts;
99723
99886
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
99724
99887
  var computeHash = ts.maybeBind(host, host.createHash);
99725
99888
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
99726
- var backupState;
99727
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
99889
+ var backupEmitState;
99890
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
99728
99891
  newProgram = undefined;
99729
99892
  oldProgram = undefined;
99730
99893
  oldState = undefined;
99731
99894
  var getState = function () { return state; };
99732
99895
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
99733
99896
  builderProgram.getState = getState;
99734
- builderProgram.backupState = function () {
99735
- ts.Debug.assert(backupState === undefined);
99736
- backupState = cloneBuilderProgramState(state);
99897
+ builderProgram.backupEmitState = function () {
99898
+ ts.Debug.assert(backupEmitState === undefined);
99899
+ backupEmitState = backupEmitBuilderProgramState(state);
99737
99900
  };
99738
- builderProgram.restoreState = function () {
99739
- state = ts.Debug.checkDefined(backupState);
99740
- backupState = undefined;
99901
+ builderProgram.restoreEmitState = function () {
99902
+ restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
99903
+ backupEmitState = undefined;
99741
99904
  };
99742
99905
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
99743
99906
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
99744
99907
  builderProgram.emit = emit;
99745
99908
  builderProgram.releaseProgram = function () {
99746
99909
  releaseCache(state);
99747
- backupState = undefined;
99910
+ backupEmitState = undefined;
99748
99911
  };
99749
99912
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
99750
99913
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -99790,35 +99953,57 @@ var ts;
99790
99953
  affected = program;
99791
99954
  }
99792
99955
  }
99793
- return toAffectedFileEmitResult(state, ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
99794
- getWriteFileUpdatingSignatureCallback(writeFile) :
99956
+ return toAffectedFileEmitResult(state, ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
99957
+ getWriteFileCallback(writeFile, customTransformers) :
99795
99958
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0, customTransformers), affected, emitKind, isPendingEmitFile);
99796
99959
  }
99797
- function getWriteFileUpdatingSignatureCallback(writeFile) {
99960
+ function getWriteFileCallback(writeFile, customTransformers) {
99798
99961
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
99799
- var _a;
99962
+ var _a, _b, _c;
99800
99963
  if (ts.isDeclarationFileName(fileName)) {
99801
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
99802
- var file = sourceFiles[0];
99803
- var info = state.fileInfos.get(file.resolvedPath);
99804
- var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
99805
- if (signature === file.version) {
99806
- var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
99807
- if (newSignature !== file.version) {
99808
- if (host.storeFilesChangingSignatureDuringEmit)
99809
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
99810
- if (state.exportedModulesMap)
99811
- ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
99812
- if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
99813
- state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
99964
+ if (!ts.outFile(state.compilerOptions)) {
99965
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
99966
+ var newSignature = void 0;
99967
+ if (!customTransformers) {
99968
+ var file = sourceFiles[0];
99969
+ var info = state.fileInfos.get(file.resolvedPath);
99970
+ if (info.signature === file.version) {
99971
+ newSignature = computeSignature(text, data, computeHash);
99972
+ if (newSignature !== file.version) {
99973
+ if (host.storeFilesChangingSignatureDuringEmit)
99974
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
99975
+ if (state.exportedModulesMap)
99976
+ ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
99977
+ if (state.affectedFiles) {
99978
+ var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
99979
+ if (existing === undefined)
99980
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
99981
+ info.signature = newSignature;
99982
+ }
99983
+ else {
99984
+ info.signature = newSignature;
99985
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
99986
+ }
99987
+ }
99814
99988
  }
99815
- else {
99816
- info.signature = newSignature;
99817
- if (state.exportedModulesMap)
99818
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
99989
+ }
99990
+ if (state.compilerOptions.composite) {
99991
+ var filePath = sourceFiles[0].resolvedPath;
99992
+ var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
99993
+ newSignature || (newSignature = computeSignature(text, data, computeHash));
99994
+ if (newSignature !== oldSignature) {
99995
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
99996
+ state.hasChangedEmitSignature = true;
99819
99997
  }
99820
99998
  }
99821
99999
  }
100000
+ else if (state.compilerOptions.composite) {
100001
+ var newSignature = computeSignature(text, data, computeHash);
100002
+ if (newSignature !== state.outSignature) {
100003
+ state.outSignature = newSignature;
100004
+ state.hasChangedEmitSignature = true;
100005
+ }
100006
+ }
99822
100007
  }
99823
100008
  if (writeFile)
99824
100009
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -99867,8 +100052,8 @@ var ts;
99867
100052
  }
99868
100053
  }
99869
100054
  }
99870
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
99871
- getWriteFileUpdatingSignatureCallback(writeFile) :
100055
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
100056
+ getWriteFileCallback(writeFile, customTransformers) :
99872
100057
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
99873
100058
  }
99874
100059
  function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
@@ -99931,29 +100116,58 @@ var ts;
99931
100116
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
99932
100117
  }
99933
100118
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
99934
- function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
99935
- var _a;
100119
+ function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
100120
+ var _a, _b, _c, _d;
99936
100121
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
99937
100122
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
99938
- var filePaths = program.fileNames.map(toPath);
99939
- var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
99940
- var fileInfos = new ts.Map();
99941
- program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
99942
- var state = {
99943
- fileInfos: fileInfos,
99944
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
99945
- referencedMap: toManyToManyPathMap(program.referencedMap),
99946
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
99947
- 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]; }),
99948
- hasReusableDiagnostic: true,
99949
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
99950
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
99951
- affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
99952
- };
100123
+ var state;
100124
+ var filePaths;
100125
+ var filePathsSetList;
100126
+ if (isProgramBundleEmitBuildInfo(program)) {
100127
+ state = {
100128
+ fileInfos: new ts.Map(),
100129
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
100130
+ dtsChangeTime: program.dtsChangeTime,
100131
+ outSignature: program.outSignature,
100132
+ };
100133
+ }
100134
+ else {
100135
+ filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
100136
+ filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
100137
+ var fileInfos_2 = new ts.Map();
100138
+ var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
100139
+ program.fileInfos.forEach(function (fileInfo, index) {
100140
+ var path = toFilePath(index + 1);
100141
+ var stateFileInfo = toBuilderStateFileInfo(fileInfo);
100142
+ fileInfos_2.set(path, stateFileInfo);
100143
+ if (emitSignatures_1 && stateFileInfo.signature)
100144
+ emitSignatures_1.set(path, stateFileInfo.signature);
100145
+ });
100146
+ (_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
100147
+ if (ts.isNumber(value))
100148
+ emitSignatures_1.delete(toFilePath(value));
100149
+ else
100150
+ emitSignatures_1.set(toFilePath(value[0]), value[1]);
100151
+ });
100152
+ state = {
100153
+ fileInfos: fileInfos_2,
100154
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
100155
+ referencedMap: toManyToManyPathMap(program.referencedMap),
100156
+ exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
100157
+ 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]; }),
100158
+ hasReusableDiagnostic: true,
100159
+ affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
100160
+ affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
100161
+ affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
100162
+ changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
100163
+ dtsChangeTime: program.dtsChangeTime,
100164
+ emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
100165
+ };
100166
+ }
99953
100167
  return {
99954
100168
  getState: function () { return state; },
99955
- backupState: ts.noop,
99956
- restoreState: ts.noop,
100169
+ backupEmitState: ts.noop,
100170
+ restoreEmitState: ts.noop,
99957
100171
  getProgram: ts.notImplemented,
99958
100172
  getProgramOrUndefined: ts.returnUndefined,
99959
100173
  releaseProgram: ts.noop,
@@ -99998,12 +100212,24 @@ var ts;
99998
100212
  return map;
99999
100213
  }
100000
100214
  }
100001
- ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
100215
+ ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
100216
+ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
100217
+ var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
100218
+ var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
100219
+ var fileInfos = new ts.Map();
100220
+ program.fileInfos.forEach(function (fileInfo, index) {
100221
+ var path = ts.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
100222
+ var version = ts.isString(fileInfo) ? fileInfo : fileInfo.version;
100223
+ fileInfos.set(path, version);
100224
+ });
100225
+ return fileInfos;
100226
+ }
100227
+ ts.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap;
100002
100228
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
100003
100229
  return {
100004
100230
  getState: ts.notImplemented,
100005
- backupState: ts.noop,
100006
- restoreState: ts.noop,
100231
+ backupEmitState: ts.noop,
100232
+ restoreEmitState: ts.noop,
100007
100233
  getProgram: getProgram,
100008
100234
  getProgramOrUndefined: function () { return getState().program; },
100009
100235
  releaseProgram: function () { return getState().program = undefined; },
@@ -100954,9 +101180,9 @@ var ts;
100954
101180
  var targets = importedFileNames.map(function (f) { return ts.getNormalizedAbsolutePath(f, cwd); });
100955
101181
  var shouldFilterIgnoredPaths = !ts.every(targets, ts.containsIgnoredPath);
100956
101182
  if (!preferSymlinks) {
100957
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
100958
- if (result_15)
100959
- return result_15;
101183
+ var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
101184
+ if (result_16)
101185
+ return result_16;
100960
101186
  }
100961
101187
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
100962
101188
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -100975,10 +101201,10 @@ var ts;
100975
101201
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
100976
101202
  var symlinkDirectory = symlinkDirectories_1[_i];
100977
101203
  var option = ts.resolvePath(symlinkDirectory, relative);
100978
- var result_16 = cb(option, target === referenceRedirect);
101204
+ var result_17 = cb(option, target === referenceRedirect);
100979
101205
  shouldFilterIgnoredPaths = true;
100980
- if (result_16)
100981
- return result_16;
101206
+ if (result_17)
101207
+ return result_17;
100982
101208
  }
100983
101209
  });
100984
101210
  });
@@ -101013,7 +101239,7 @@ var ts;
101013
101239
  importedFileFromNodeModules = importedFileFromNodeModules || isInNodeModules;
101014
101240
  });
101015
101241
  var sortedPaths = [];
101016
- var _loop_32 = function (directory) {
101242
+ var _loop_33 = function (directory) {
101017
101243
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
101018
101244
  var pathsInDirectory;
101019
101245
  allFileNames.forEach(function (_a, fileName) {
@@ -101037,7 +101263,7 @@ var ts;
101037
101263
  };
101038
101264
  var out_directory_1;
101039
101265
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
101040
- var state_10 = _loop_32(directory);
101266
+ var state_10 = _loop_33(directory);
101041
101267
  directory = out_directory_1;
101042
101268
  if (state_10 === "break")
101043
101269
  break;
@@ -101810,6 +102036,7 @@ var ts;
101810
102036
  readDirectory: ts.maybeBind(host, host.readDirectory),
101811
102037
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
101812
102038
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
102039
+ now: ts.maybeBind(host, host.now),
101813
102040
  };
101814
102041
  function writeFile(fileName, text, writeByteOrderMark, onError) {
101815
102042
  try {
@@ -101864,6 +102091,7 @@ var ts;
101864
102091
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
101865
102092
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
101866
102093
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
102094
+ now: ts.maybeBind(system, system.now),
101867
102095
  };
101868
102096
  }
101869
102097
  ts.createProgramHost = createProgramHost;
@@ -101919,20 +102147,26 @@ var ts;
101919
102147
  var ts;
101920
102148
  (function (ts) {
101921
102149
  function readBuilderProgram(compilerOptions, host) {
101922
- if (ts.outFile(compilerOptions))
101923
- return undefined;
101924
102150
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
101925
102151
  if (!buildInfoPath)
101926
102152
  return undefined;
101927
- var content = host.readFile(buildInfoPath);
101928
- if (!content)
101929
- return undefined;
101930
- var buildInfo = ts.getBuildInfo(content);
102153
+ var buildInfo;
102154
+ if (host.getBuildInfo) {
102155
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
102156
+ if (!buildInfo)
102157
+ return undefined;
102158
+ }
102159
+ else {
102160
+ var content = host.readFile(buildInfoPath);
102161
+ if (!content)
102162
+ return undefined;
102163
+ buildInfo = ts.getBuildInfo(content);
102164
+ }
101931
102165
  if (buildInfo.version !== ts.version)
101932
102166
  return undefined;
101933
102167
  if (!buildInfo.program)
101934
102168
  return undefined;
101935
- return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
102169
+ return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
101936
102170
  }
101937
102171
  ts.readBuilderProgram = readBuilderProgram;
101938
102172
  function createIncrementalCompilerHost(options, system) {
@@ -101941,6 +102175,7 @@ var ts;
101941
102175
  host.createHash = ts.maybeBind(system, system.createHash);
101942
102176
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
101943
102177
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
102178
+ host.now = ts.maybeBind(system, system.now);
101944
102179
  ts.setGetSourceFileAsHashVersioned(host, system);
101945
102180
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
101946
102181
  return host;
@@ -102604,11 +102839,14 @@ var ts;
102604
102839
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
102605
102840
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
102606
102841
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
102607
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
102608
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
102609
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
102610
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
102611
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
102842
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
102843
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
102844
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
102845
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
102846
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
102847
+ UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
102848
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
102849
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
102612
102850
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
102613
102851
  function resolveConfigFileProjectName(project) {
102614
102852
  if (ts.fileExtensionIs(project, ".json")) {
@@ -102646,9 +102884,10 @@ var ts;
102646
102884
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
102647
102885
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
102648
102886
  }
102649
- function newer(date1, date2) {
102650
- return date2 > date1 ? date2 : date1;
102887
+ function getCurrentTime(host) {
102888
+ return host.now ? host.now() : new Date();
102651
102889
  }
102890
+ ts.getCurrentTime = getCurrentTime;
102652
102891
  function isCircularBuildOrder(buildOrder) {
102653
102892
  return !!buildOrder && !!buildOrder.buildOrder;
102654
102893
  }
@@ -102732,6 +102971,7 @@ var ts;
102732
102971
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
102733
102972
  };
102734
102973
  }
102974
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), undefined); };
102735
102975
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
102736
102976
  var state = {
102737
102977
  host: host,
@@ -102747,8 +102987,9 @@ var ts;
102747
102987
  resolvedConfigFilePaths: new ts.Map(),
102748
102988
  configFileCache: new ts.Map(),
102749
102989
  projectStatus: new ts.Map(),
102750
- buildInfoChecked: new ts.Map(),
102751
102990
  extendedConfigCache: new ts.Map(),
102991
+ buildInfoCache: new ts.Map(),
102992
+ outputTimeStamps: new ts.Map(),
102752
102993
  builderPrograms: new ts.Map(),
102753
102994
  diagnostics: new ts.Map(),
102754
102995
  projectPendingBuild: new ts.Map(),
@@ -102769,6 +103010,7 @@ var ts;
102769
103010
  allWatchedConfigFiles: new ts.Map(),
102770
103011
  allWatchedExtendedConfigFiles: new ts.Map(),
102771
103012
  allWatchedPackageJsonFiles: new ts.Map(),
103013
+ filesWatched: new ts.Map(),
102772
103014
  lastCachedPackageJsonLookups: new ts.Map(),
102773
103015
  timerToBuildInvalidatedProject: undefined,
102774
103016
  reportFileChangeDetected: false,
@@ -102803,6 +103045,7 @@ var ts;
102803
103045
  if (value) {
102804
103046
  return isParsedCommandLine(value) ? value : undefined;
102805
103047
  }
103048
+ ts.solutionPerformance.mark("beforeParseConfigFile");
102806
103049
  var diagnostic;
102807
103050
  var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host;
102808
103051
  var parsed;
@@ -102817,6 +103060,8 @@ var ts;
102817
103060
  parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
102818
103061
  }
102819
103062
  configFileCache.set(configFilePath, parsed || diagnostic);
103063
+ ts.solutionPerformance.mark("afterParseConfigFile");
103064
+ ts.solutionPerformance.measure("ParseConfigFile", "beforeParseConfigFile", "afterParseConfigFile");
102820
103065
  return parsed;
102821
103066
  }
102822
103067
  function resolveProjectName(state, name) {
@@ -102864,17 +103109,19 @@ var ts;
102864
103109
  return state.buildOrder || createStateBuildOrder(state);
102865
103110
  }
102866
103111
  function createStateBuildOrder(state) {
103112
+ ts.solutionPerformance.mark("beforeCreateBuildOrder");
102867
103113
  var buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); }));
102868
103114
  state.resolvedConfigFilePaths.clear();
102869
103115
  var currentProjects = new ts.Map(getBuildOrderFromAnyBuildOrder(buildOrder).map(function (resolved) { return [toResolvedConfigFilePath(state, resolved), true]; }));
102870
103116
  var noopOnDelete = { onDeleteValue: ts.noop };
102871
103117
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
102872
103118
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
102873
- ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
102874
103119
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
102875
103120
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
102876
103121
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
102877
103122
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
103123
+ ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
103124
+ ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
102878
103125
  if (state.watch) {
102879
103126
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
102880
103127
  state.allWatchedExtendedConfigFiles.forEach(function (watcher) {
@@ -102889,6 +103136,8 @@ var ts;
102889
103136
  ts.mutateMapSkippingNewValues(state.allWatchedInputFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
102890
103137
  ts.mutateMapSkippingNewValues(state.allWatchedPackageJsonFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
102891
103138
  }
103139
+ ts.solutionPerformance.mark("afterCreateBuildOrder");
103140
+ ts.solutionPerformance.measure("CreateBuildOrder", "beforeCreateBuildOrder", "afterCreateBuildOrder");
102892
103141
  return state.buildOrder = buildOrder;
102893
103142
  }
102894
103143
  function getBuildOrderFor(state, project, onlyReferences) {
@@ -103008,6 +103257,7 @@ var ts;
103008
103257
  if (updateOutputFileStampsPending) {
103009
103258
  updateOutputTimestamps(state, config, projectPath);
103010
103259
  }
103260
+ ts.solutionPerformance.mark("timestampUpdated");
103011
103261
  return doneInvalidatedProject(state, projectPath);
103012
103262
  }
103013
103263
  };
@@ -103101,6 +103351,10 @@ var ts;
103101
103351
  };
103102
103352
  function done(cancellationToken, writeFile, customTransformers) {
103103
103353
  executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers);
103354
+ if (kind === InvalidatedProjectKind.Build)
103355
+ ts.solutionPerformance.mark("projectsBuilt");
103356
+ else
103357
+ ts.solutionPerformance.mark("bundlesUpdated");
103104
103358
  return doneInvalidatedProject(state, projectPath);
103105
103359
  }
103106
103360
  function withProgramOrUndefined(action) {
@@ -103159,16 +103413,16 @@ var ts;
103159
103413
  }
103160
103414
  function emit(writeFileCallback, cancellationToken, customTransformers) {
103161
103415
  var _a;
103162
- var _b, _c;
103416
+ var _b, _c, _d;
103163
103417
  ts.Debug.assertIsDefined(program);
103164
103418
  ts.Debug.assert(step === BuildStep.Emit);
103165
- program.backupState();
103419
+ program.backupEmitState();
103166
103420
  var declDiagnostics;
103167
103421
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
103168
103422
  var outputFiles = [];
103169
- 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;
103423
+ 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;
103170
103424
  if (declDiagnostics) {
103171
- program.restoreState();
103425
+ program.restoreEmitState();
103172
103426
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
103173
103427
  return {
103174
103428
  emitSkipped: true,
@@ -103177,35 +103431,46 @@ var ts;
103177
103431
  }
103178
103432
  var host = state.host, compilerHost = state.compilerHost;
103179
103433
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
103180
- var newestDeclarationFileContentChangedTime = minimumDate;
103181
- var anyDtsChanged = false;
103434
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
103182
103435
  var emitterDiagnostics = ts.createDiagnosticCollection();
103183
103436
  var emittedOutputs = new ts.Map();
103437
+ var options = program.getCompilerOptions();
103438
+ var isIncremental = ts.isIncrementalCompilation(options);
103439
+ var outputTimeStampMap;
103440
+ var now;
103441
+ ts.solutionPerformance.mark("beforeOutputFilesWrite");
103184
103442
  outputFiles.forEach(function (_a) {
103185
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
103186
- var priorChangeTime;
103187
- if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
103188
- if (host.fileExists(name) && state.readFileWithCache(name) === text) {
103189
- priorChangeTime = host.getModifiedTime(name);
103190
- }
103191
- else {
103443
+ var _b, _c;
103444
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
103445
+ var path = toPath(state, name);
103446
+ emittedOutputs.set(toPath(state, name), name);
103447
+ if (buildInfo) {
103448
+ setBuildInfo(state, buildInfo, projectPath, options);
103449
+ 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)) {
103192
103450
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
103193
- anyDtsChanged = true;
103194
103451
  }
103195
103452
  }
103196
- emittedOutputs.set(toPath(state, name), name);
103197
103453
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
103198
- if (priorChangeTime !== undefined) {
103199
- newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
103454
+ if (!isIncremental && state.watch) {
103455
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
103200
103456
  }
103201
103457
  });
103202
- finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime, anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
103458
+ ts.solutionPerformance.mark("afterOutputFilesWrite");
103459
+ ts.solutionPerformance.measure("OutputFilesWrite", "beforeOutputFilesWrite", "afterOutputFilesWrite");
103460
+ finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
103203
103461
  return emitResult;
103204
103462
  }
103205
103463
  function emitBuildInfo(writeFileCallback, cancellationToken) {
103206
103464
  ts.Debug.assertIsDefined(program);
103207
103465
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
103208
- var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
103466
+ var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
103467
+ if (data === null || data === void 0 ? void 0 : data.buildInfo)
103468
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
103469
+ if (writeFileCallback)
103470
+ writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
103471
+ else
103472
+ state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
103473
+ }, cancellationToken);
103209
103474
  if (emitResult.diagnostics.length) {
103210
103475
  reportErrors(state, emitResult.diagnostics);
103211
103476
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -103218,7 +103483,7 @@ var ts;
103218
103483
  step = BuildStep.QueueReferencingProjects;
103219
103484
  return emitResult;
103220
103485
  }
103221
- function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
103486
+ function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
103222
103487
  var _a;
103223
103488
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
103224
103489
  if (emitDiagnostics.length) {
@@ -103228,13 +103493,11 @@ var ts;
103228
103493
  if (state.write) {
103229
103494
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
103230
103495
  }
103231
- var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
103496
+ updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
103232
103497
  state.diagnostics.delete(projectPath);
103233
103498
  state.projectStatus.set(projectPath, {
103234
103499
  type: ts.UpToDateStatusType.UpToDate,
103235
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
103236
- maximumDate :
103237
- newestDeclarationFileContentChangedTime,
103500
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
103238
103501
  oldestOutputFileName: oldestOutputFileName
103239
103502
  });
103240
103503
  afterProgramDone(state, program, config);
@@ -103267,12 +103530,21 @@ var ts;
103267
103530
  ts.Debug.assert(!!outputFiles.length);
103268
103531
  var emitterDiagnostics = ts.createDiagnosticCollection();
103269
103532
  var emittedOutputs = new ts.Map();
103533
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
103534
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
103270
103535
  outputFiles.forEach(function (_a) {
103271
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
103536
+ var _b, _c;
103537
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
103272
103538
  emittedOutputs.set(toPath(state, name), name);
103539
+ if (buildInfo) {
103540
+ setBuildInfo(state, buildInfo, projectPath, config.options);
103541
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
103542
+ resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
103543
+ }
103544
+ }
103273
103545
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
103274
103546
  });
103275
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate, false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
103547
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
103276
103548
  return { emitSkipped: false, diagnostics: emitDiagnostics };
103277
103549
  }
103278
103550
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -103322,6 +103594,13 @@ var ts;
103322
103594
  !ts.isIncrementalCompilation(config.options);
103323
103595
  }
103324
103596
  function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
103597
+ ts.solutionPerformance.mark("beforeGetNextInvalidatedProjectCreateInfo");
103598
+ var result = getNextInvalidatedProjectCreateInfoWorker(state, buildOrder, reportQueue);
103599
+ ts.solutionPerformance.mark("afterGetNextInvalidatedProjectCreateInfo");
103600
+ ts.solutionPerformance.measure("GetNextInvalidatedProjectCreateInfo", "beforeGetNextInvalidatedProjectCreateInfo", "afterGetNextInvalidatedProjectCreateInfo");
103601
+ return result;
103602
+ }
103603
+ function getNextInvalidatedProjectCreateInfoWorker(state, buildOrder, reportQueue) {
103325
103604
  if (!state.projectPendingBuild.size)
103326
103605
  return undefined;
103327
103606
  if (isCircularBuildOrder(buildOrder))
@@ -103367,7 +103646,7 @@ var ts;
103367
103646
  }
103368
103647
  continue;
103369
103648
  }
103370
- if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
103649
+ if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
103371
103650
  reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
103372
103651
  return {
103373
103652
  kind: InvalidatedProjectKind.UpdateOutputFileStamps,
@@ -103417,9 +103696,7 @@ var ts;
103417
103696
  }
103418
103697
  function getNextInvalidatedProject(state, buildOrder, reportQueue) {
103419
103698
  var info = getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue);
103420
- if (!info)
103421
- return info;
103422
- return createInvalidatedProjectWithInfo(state, info, buildOrder);
103699
+ return info && createInvalidatedProjectWithInfo(state, info, buildOrder);
103423
103700
  }
103424
103701
  function listEmittedFile(_a, proj, file) {
103425
103702
  var write = _a.write;
@@ -103427,14 +103704,17 @@ var ts;
103427
103704
  write("TSFILE: " + file);
103428
103705
  }
103429
103706
  }
103430
- function getOldProgram(_a, proj, parsed) {
103431
- var options = _a.options, builderPrograms = _a.builderPrograms, compilerHost = _a.compilerHost;
103432
- if (options.force)
103707
+ function getOldProgram(state, proj, parsed) {
103708
+ if (state.options.force)
103433
103709
  return undefined;
103434
- var value = builderPrograms.get(proj);
103710
+ var value = state.builderPrograms.get(proj);
103435
103711
  if (value)
103436
103712
  return value;
103437
- return ts.readBuilderProgram(parsed.options, compilerHost);
103713
+ ts.solutionPerformance.mark("beforeReadBuilderProgram");
103714
+ var program = ts.readBuilderProgram(parsed.options, state.compilerHost);
103715
+ ts.solutionPerformance.mark("afterReadBuilderProgram");
103716
+ ts.solutionPerformance.measure("ReadBuilderProgram", "beforeReadBuilderProgram", "afterReadBuilderProgram");
103717
+ return program;
103438
103718
  }
103439
103719
  function afterProgramDone(state, program, config) {
103440
103720
  if (program) {
@@ -103451,7 +103731,7 @@ var ts;
103451
103731
  state.projectCompilerOptions = state.baseCompilerOptions;
103452
103732
  }
103453
103733
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
103454
- var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
103734
+ var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
103455
103735
  reportAndStoreErrors(state, resolvedPath, diagnostics);
103456
103736
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
103457
103737
  if (canEmitBuildInfo)
@@ -103459,8 +103739,100 @@ var ts;
103459
103739
  afterProgramDone(state, program, config);
103460
103740
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
103461
103741
  }
103742
+ function isFileWatcherWithModifiedTime(value) {
103743
+ return !!value.watcher;
103744
+ }
103745
+ function getModifiedTime(state, fileName) {
103746
+ var path = toPath(state, fileName);
103747
+ var existing = state.filesWatched.get(path);
103748
+ if (state.watch && !!existing) {
103749
+ if (!isFileWatcherWithModifiedTime(existing))
103750
+ return existing;
103751
+ if (existing.modifiedTime)
103752
+ return existing.modifiedTime;
103753
+ }
103754
+ var result = ts.getModifiedTime(state.host, fileName);
103755
+ if (state.watch) {
103756
+ if (existing)
103757
+ existing.modifiedTime = result;
103758
+ else
103759
+ state.filesWatched.set(path, result);
103760
+ }
103761
+ return result;
103762
+ }
103763
+ function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
103764
+ var path = toPath(state, file);
103765
+ var existing = state.filesWatched.get(path);
103766
+ if (existing && isFileWatcherWithModifiedTime(existing)) {
103767
+ existing.callbacks.push(callback);
103768
+ }
103769
+ else {
103770
+ var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
103771
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
103772
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
103773
+ existing.modifiedTime = modifiedTime;
103774
+ existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
103775
+ }, pollingInterval, options, watchType, project);
103776
+ state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
103777
+ }
103778
+ return {
103779
+ close: function () {
103780
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
103781
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
103782
+ if (existing.callbacks.length === 1) {
103783
+ state.filesWatched.delete(path);
103784
+ ts.closeFileWatcherOf(existing);
103785
+ }
103786
+ else {
103787
+ ts.unorderedRemoveItem(existing.callbacks, callback);
103788
+ }
103789
+ }
103790
+ };
103791
+ }
103792
+ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
103793
+ if (!state.watch)
103794
+ return undefined;
103795
+ var result = state.outputTimeStamps.get(resolvedConfigFilePath);
103796
+ if (!result)
103797
+ state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
103798
+ return result;
103799
+ }
103800
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
103801
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
103802
+ var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
103803
+ if (existing) {
103804
+ existing.buildInfo = buildInfo;
103805
+ existing.modifiedTime = getCurrentTime(state.host);
103806
+ }
103807
+ else {
103808
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
103809
+ }
103810
+ }
103811
+ function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
103812
+ var path = toPath(state, buildInfoPath);
103813
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
103814
+ return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
103815
+ }
103816
+ function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
103817
+ var path = toPath(state, buildInfoPath);
103818
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
103819
+ if (existing !== undefined && existing.path === path) {
103820
+ return existing.buildInfo || undefined;
103821
+ }
103822
+ ts.solutionPerformance.mark("beforeGetBuildInfo");
103823
+ ts.solutionPerformance.mark("beforeBuildInfoRead");
103824
+ var value = state.readFileWithCache(buildInfoPath);
103825
+ ts.solutionPerformance.mark("afterBuildInfoRead");
103826
+ ts.solutionPerformance.measure("BuildInfoRead", "beforeBuildInfoRead", "afterBuildInfoRead");
103827
+ var buildInfo = value ? ts.getBuildInfo(value) : undefined;
103828
+ ts.Debug.assert(modifiedTime || !buildInfo);
103829
+ state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
103830
+ ts.solutionPerformance.mark("afterGetBuildInfo");
103831
+ ts.solutionPerformance.measure("GetBuildInfo", "beforeGetBuildInfo", "afterGetBuildInfo");
103832
+ return buildInfo;
103833
+ }
103462
103834
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
103463
- var tsconfigTime = ts.getModifiedTime(state.host, configFile);
103835
+ var tsconfigTime = getModifiedTime(state, configFile);
103464
103836
  if (oldestOutputFileTime < tsconfigTime) {
103465
103837
  return {
103466
103838
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -103470,76 +103842,22 @@ var ts;
103470
103842
  }
103471
103843
  }
103472
103844
  function getUpToDateStatusWorker(state, project, resolvedPath) {
103473
- var force = !!state.options.force;
103474
- var newestInputFileName = undefined;
103475
- var newestInputFileTime = minimumDate;
103476
- var host = state.host;
103477
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
103478
- var inputFile = _a[_i];
103479
- if (!host.fileExists(inputFile)) {
103480
- return {
103481
- type: ts.UpToDateStatusType.Unbuildable,
103482
- reason: inputFile + " does not exist"
103483
- };
103484
- }
103485
- if (!force) {
103486
- var inputTime = ts.getModifiedTime(host, inputFile);
103487
- if (inputTime > newestInputFileTime) {
103488
- newestInputFileName = inputFile;
103489
- newestInputFileTime = inputTime;
103490
- }
103491
- }
103492
- }
103845
+ var _a, _b, _c;
103493
103846
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
103494
103847
  return {
103495
103848
  type: ts.UpToDateStatusType.ContainerOnly
103496
103849
  };
103497
103850
  }
103498
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
103499
- var oldestOutputFileName = "(none)";
103500
- var oldestOutputFileTime = maximumDate;
103501
- var newestOutputFileName = "(none)";
103502
- var newestOutputFileTime = minimumDate;
103503
- var missingOutputFileName;
103504
- var newestDeclarationFileContentChangedTime = minimumDate;
103505
- var isOutOfDateWithInputs = false;
103506
- if (!force) {
103507
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
103508
- var output = outputs_1[_b];
103509
- if (!host.fileExists(output)) {
103510
- missingOutputFileName = output;
103511
- break;
103512
- }
103513
- var outputTime = ts.getModifiedTime(host, output);
103514
- if (outputTime < oldestOutputFileTime) {
103515
- oldestOutputFileTime = outputTime;
103516
- oldestOutputFileName = output;
103517
- }
103518
- if (outputTime < newestInputFileTime) {
103519
- isOutOfDateWithInputs = true;
103520
- break;
103521
- }
103522
- if (outputTime > newestOutputFileTime) {
103523
- newestOutputFileTime = outputTime;
103524
- newestOutputFileName = output;
103525
- }
103526
- if (ts.isDeclarationFileName(output)) {
103527
- var outputModifiedTime = ts.getModifiedTime(host, output);
103528
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
103529
- }
103530
- }
103531
- }
103532
- var pseudoUpToDate = false;
103533
- var usesPrepend = false;
103534
- var upstreamChangedProject;
103851
+ var referenceStatuses;
103852
+ var force = !!state.options.force;
103535
103853
  if (project.projectReferences) {
103536
103854
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
103537
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
103538
- var ref = _d[_c];
103539
- usesPrepend = usesPrepend || !!(ref.prepend);
103855
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
103856
+ var ref = _d[_i];
103540
103857
  var resolvedRef = ts.resolveProjectReferencePath(ref);
103541
103858
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
103542
- var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
103859
+ var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
103860
+ var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
103543
103861
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
103544
103862
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) {
103545
103863
  continue;
@@ -103558,65 +103876,169 @@ var ts;
103558
103876
  upstreamProjectName: ref.path
103559
103877
  };
103560
103878
  }
103561
- if (!force && !missingOutputFileName) {
103562
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
103563
- continue;
103564
- }
103565
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
103566
- pseudoUpToDate = true;
103567
- upstreamChangedProject = ref.path;
103568
- continue;
103569
- }
103570
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
103879
+ if (!force)
103880
+ (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
103881
+ }
103882
+ }
103883
+ if (force)
103884
+ return { type: ts.UpToDateStatusType.ForceBuild };
103885
+ var host = state.host;
103886
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
103887
+ var oldestOutputFileName = "(none)";
103888
+ var oldestOutputFileTime = maximumDate;
103889
+ var buildInfoTime;
103890
+ var buildInfoProgram;
103891
+ var buildInfoVersionMap;
103892
+ var newestDeclarationFileContentChangedTime;
103893
+ if (buildInfoPath) {
103894
+ var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
103895
+ buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
103896
+ if (buildInfoTime === ts.missingFileModifiedTime) {
103897
+ if (!buildInfoCacheEntry_1) {
103898
+ state.buildInfoCache.set(resolvedPath, {
103899
+ path: toPath(state, buildInfoPath),
103900
+ buildInfo: false,
103901
+ modifiedTime: buildInfoTime
103902
+ });
103903
+ }
103904
+ return {
103905
+ type: ts.UpToDateStatusType.OutputMissing,
103906
+ missingOutputFileName: buildInfoPath
103907
+ };
103908
+ }
103909
+ var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
103910
+ if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
103911
+ return {
103912
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
103913
+ version: buildInfo.version
103914
+ };
103915
+ }
103916
+ if (buildInfo.program) {
103917
+ if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
103918
+ (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
103571
103919
  return {
103572
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
103573
- outOfDateOutputFileName: oldestOutputFileName,
103574
- newerProjectName: ref.path
103920
+ type: ts.UpToDateStatusType.OutOfDateBuildInfo,
103921
+ buildInfoFile: buildInfoPath
103575
103922
  };
103576
103923
  }
103924
+ buildInfoProgram = buildInfo.program;
103577
103925
  }
103926
+ oldestOutputFileTime = buildInfoTime;
103927
+ oldestOutputFileName = buildInfoPath;
103928
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
103578
103929
  }
103579
- if (missingOutputFileName !== undefined) {
103580
- return {
103581
- type: ts.UpToDateStatusType.OutputMissing,
103582
- missingOutputFileName: missingOutputFileName
103583
- };
103930
+ var newestInputFileName = undefined;
103931
+ var newestInputFileTime = minimumDate;
103932
+ var pseudoInputUptodate = false;
103933
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
103934
+ var inputFile = _f[_e];
103935
+ var inputTime = getModifiedTime(state, inputFile);
103936
+ if (inputTime === ts.missingFileModifiedTime) {
103937
+ return {
103938
+ type: ts.UpToDateStatusType.Unbuildable,
103939
+ reason: inputFile + " does not exist"
103940
+ };
103941
+ }
103942
+ if (buildInfoTime && buildInfoTime < inputTime) {
103943
+ var version_3 = void 0;
103944
+ var currentVersion = void 0;
103945
+ if (buildInfoProgram) {
103946
+ if (!buildInfoVersionMap)
103947
+ buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
103948
+ version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
103949
+ var text = version_3 ? state.readFileWithCache(inputFile) : undefined;
103950
+ currentVersion = text && (host.createHash || ts.generateDjb2Hash)(text);
103951
+ if (version_3 && version_3 === currentVersion)
103952
+ pseudoInputUptodate = true;
103953
+ }
103954
+ if (!version_3 || version_3 !== currentVersion) {
103955
+ return {
103956
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
103957
+ outOfDateOutputFileName: buildInfoPath,
103958
+ newerInputFileName: inputFile
103959
+ };
103960
+ }
103961
+ }
103962
+ if (inputTime > newestInputFileTime) {
103963
+ newestInputFileName = inputFile;
103964
+ newestInputFileTime = inputTime;
103965
+ }
103584
103966
  }
103585
- if (isOutOfDateWithInputs) {
103586
- return {
103587
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
103588
- outOfDateOutputFileName: oldestOutputFileName,
103589
- newerInputFileName: newestInputFileName
103590
- };
103967
+ if (!buildInfoPath) {
103968
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
103969
+ var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
103970
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
103971
+ var output = outputs_1[_g];
103972
+ var path = toPath(state, output);
103973
+ var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
103974
+ if (!outputTime) {
103975
+ outputTime = ts.getModifiedTime(state.host, output);
103976
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
103977
+ }
103978
+ if (outputTime === ts.missingFileModifiedTime) {
103979
+ return {
103980
+ type: ts.UpToDateStatusType.OutputMissing,
103981
+ missingOutputFileName: output
103982
+ };
103983
+ }
103984
+ if (outputTime < oldestOutputFileTime) {
103985
+ oldestOutputFileTime = outputTime;
103986
+ oldestOutputFileName = output;
103987
+ }
103988
+ if (outputTime < newestInputFileTime) {
103989
+ return {
103990
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
103991
+ outOfDateOutputFileName: oldestOutputFileName,
103992
+ newerInputFileName: newestInputFileName
103993
+ };
103994
+ }
103995
+ }
103591
103996
  }
103592
- else {
103593
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
103594
- if (configStatus)
103595
- return configStatus;
103596
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
103597
- if (extendedConfigStatus)
103598
- return extendedConfigStatus;
103599
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
103600
- var path = _a[0];
103601
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
103602
- });
103603
- if (dependentPackageFileStatus)
103604
- return dependentPackageFileStatus;
103605
- }
103606
- if (!force && !state.buildInfoChecked.has(resolvedPath)) {
103607
- state.buildInfoChecked.set(resolvedPath, true);
103608
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
103609
- if (buildInfoPath) {
103610
- var value = state.readFileWithCache(buildInfoPath);
103611
- var buildInfo = value && ts.getBuildInfo(value);
103612
- if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
103997
+ var seenRefs = buildInfoPath ? new ts.Set() : undefined;
103998
+ var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
103999
+ seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
104000
+ var pseudoUpToDate = false;
104001
+ var usesPrepend = false;
104002
+ var upstreamChangedProject;
104003
+ if (referenceStatuses) {
104004
+ for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
104005
+ var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
104006
+ usesPrepend = usesPrepend || !!(ref.prepend);
104007
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
104008
+ continue;
104009
+ }
104010
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
103613
104011
  return {
103614
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
103615
- version: buildInfo.version
104012
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
104013
+ outOfDateOutputFileName: buildInfoPath,
104014
+ newerProjectName: ref.path
103616
104015
  };
103617
104016
  }
104017
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
104018
+ pseudoUpToDate = true;
104019
+ upstreamChangedProject = ref.path;
104020
+ continue;
104021
+ }
104022
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
104023
+ return {
104024
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
104025
+ outOfDateOutputFileName: oldestOutputFileName,
104026
+ newerProjectName: ref.path
104027
+ };
103618
104028
  }
103619
104029
  }
104030
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
104031
+ if (configStatus)
104032
+ return configStatus;
104033
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
104034
+ if (extendedConfigStatus)
104035
+ return extendedConfigStatus;
104036
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
104037
+ var path = _a[0];
104038
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
104039
+ });
104040
+ if (dependentPackageFileStatus)
104041
+ return dependentPackageFileStatus;
103620
104042
  if (usesPrepend && pseudoUpToDate) {
103621
104043
  return {
103622
104044
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -103625,15 +104047,36 @@ var ts;
103625
104047
  };
103626
104048
  }
103627
104049
  return {
103628
- type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
104050
+ type: pseudoUpToDate ?
104051
+ ts.UpToDateStatusType.UpToDateWithUpstreamTypes :
104052
+ pseudoInputUptodate ?
104053
+ ts.UpToDateStatusType.UpToDateWithInputFileText :
104054
+ ts.UpToDateStatusType.UpToDate,
103629
104055
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
103630
104056
  newestInputFileTime: newestInputFileTime,
103631
- newestOutputFileTime: newestOutputFileTime,
103632
104057
  newestInputFileName: newestInputFileName,
103633
- newestOutputFileName: newestOutputFileName,
103634
104058
  oldestOutputFileName: oldestOutputFileName
103635
104059
  };
103636
104060
  }
104061
+ function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
104062
+ if (seenRefs.has(resolvedRefPath))
104063
+ return false;
104064
+ seenRefs.add(resolvedRefPath);
104065
+ var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
104066
+ if (refBuildInfo.path === buildInfoCacheEntry.path)
104067
+ return true;
104068
+ if (resolvedConfig.projectReferences) {
104069
+ for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
104070
+ var ref = _a[_i];
104071
+ var resolvedRef = ts.resolveProjectReferencePath(ref);
104072
+ var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
104073
+ var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
104074
+ if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
104075
+ return true;
104076
+ }
104077
+ }
104078
+ return false;
104079
+ }
103637
104080
  function getUpToDateStatus(state, project, resolvedPath) {
103638
104081
  if (project === undefined) {
103639
104082
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -103642,43 +104085,75 @@ var ts;
103642
104085
  if (prior !== undefined) {
103643
104086
  return prior;
103644
104087
  }
104088
+ ts.solutionPerformance.mark("beforeGetUpToDateStatus");
103645
104089
  var actual = getUpToDateStatusWorker(state, project, resolvedPath);
104090
+ ts.solutionPerformance.mark("afterGetUpToDateStatus");
104091
+ ts.solutionPerformance.measure("GetUpToDateStatus", "beforeGetUpToDateStatus", "afterGetUpToDateStatus");
103646
104092
  state.projectStatus.set(resolvedPath, actual);
103647
104093
  return actual;
103648
104094
  }
103649
- function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
104095
+ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
103650
104096
  if (proj.options.noEmit)
103651
- return priorNewestUpdateTime;
103652
- var host = state.host;
103653
- var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
103654
- if (!skipOutputs || outputs.length !== skipOutputs.size) {
103655
- var reportVerbose = !!state.options.verbose;
103656
- var now = host.now ? host.now() : new Date();
103657
- for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
103658
- var file = outputs_2[_i];
103659
- if (skipOutputs && skipOutputs.has(toPath(state, file))) {
103660
- continue;
103661
- }
103662
- if (reportVerbose) {
103663
- reportVerbose = false;
104097
+ return;
104098
+ var now;
104099
+ ts.solutionPerformance.mark("beforeUpdateOutputTimestamps");
104100
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
104101
+ if (buildInfoPath) {
104102
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
104103
+ if (!!state.options.verbose)
103664
104104
  reportStatus(state, verboseMessage, proj.options.configFilePath);
104105
+ state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
104106
+ getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
104107
+ }
104108
+ state.outputTimeStamps.delete(projectPath);
104109
+ }
104110
+ else {
104111
+ var host = state.host;
104112
+ var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
104113
+ var outputTimeStampMap_1 = getOutputTimeStampMap(state, projectPath);
104114
+ var modifiedOutputs_1 = outputTimeStampMap_1 ? new ts.Set() : undefined;
104115
+ if (!skipOutputs || outputs.length !== skipOutputs.size) {
104116
+ var reportVerbose = !!state.options.verbose;
104117
+ for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
104118
+ var file = outputs_2[_i];
104119
+ var path = toPath(state, file);
104120
+ if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
104121
+ continue;
104122
+ if (reportVerbose) {
104123
+ reportVerbose = false;
104124
+ reportStatus(state, verboseMessage, proj.options.configFilePath);
104125
+ }
104126
+ host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
104127
+ if (outputTimeStampMap_1) {
104128
+ outputTimeStampMap_1.set(path, now);
104129
+ modifiedOutputs_1.add(path);
104130
+ }
103665
104131
  }
103666
- if (ts.isDeclarationFileName(file)) {
103667
- priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
103668
- }
103669
- host.setModifiedTime(file, now);
103670
104132
  }
104133
+ outputTimeStampMap_1 === null || outputTimeStampMap_1 === void 0 ? void 0 : outputTimeStampMap_1.forEach(function (_value, key) {
104134
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs_1.has(key))
104135
+ outputTimeStampMap_1.delete(key);
104136
+ });
103671
104137
  }
103672
- return priorNewestUpdateTime;
104138
+ ts.solutionPerformance.mark("afterUpdateOutputTimestamps");
104139
+ ts.solutionPerformance.measure("UpdateOutputTimestamps", "beforeUpdateOutputTimestamps", "afterUpdateOutputTimestamps");
104140
+ }
104141
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
104142
+ var _a;
104143
+ if (!options.composite)
104144
+ return undefined;
104145
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
104146
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, undefined);
104147
+ 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;
103673
104148
  }
103674
104149
  function updateOutputTimestamps(state, proj, resolvedPath) {
103675
104150
  if (state.options.dry) {
103676
104151
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
103677
104152
  }
103678
- var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
104153
+ updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
103679
104154
  state.projectStatus.set(resolvedPath, {
103680
104155
  type: ts.UpToDateStatusType.UpToDate,
103681
- newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
104156
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
103682
104157
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
103683
104158
  });
103684
104159
  }
@@ -103717,6 +104192,7 @@ var ts;
103717
104192
  }
103718
104193
  break;
103719
104194
  }
104195
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
103720
104196
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
103721
104197
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
103722
104198
  if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
@@ -103740,6 +104216,13 @@ var ts;
103740
104216
  }
103741
104217
  }
103742
104218
  function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
104219
+ ts.solutionPerformance.mark("beforeBuild");
104220
+ var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences);
104221
+ ts.solutionPerformance.mark("afterBuild");
104222
+ ts.solutionPerformance.measure("Build", "beforeBuild", "afterBuild");
104223
+ return result;
104224
+ }
104225
+ function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
103743
104226
  var buildOrder = getBuildOrderFor(state, project, onlyReferences);
103744
104227
  if (!buildOrder)
103745
104228
  return ts.ExitStatus.InvalidProject_OutputsSkipped;
@@ -103751,7 +104234,10 @@ var ts;
103751
104234
  if (!invalidatedProject)
103752
104235
  break;
103753
104236
  reportQueue = false;
104237
+ ts.solutionPerformance.mark("beforeInvalidatedProjectBuild");
103754
104238
  invalidatedProject.done(cancellationToken, writeFile, getCustomTransformers === null || getCustomTransformers === void 0 ? void 0 : getCustomTransformers(invalidatedProject.project));
104239
+ ts.solutionPerformance.mark("afterInvalidatedProjectBuild");
104240
+ ts.solutionPerformance.measure("InvalidatedProjectBuild", "beforeInvalidatedProjectBuild", "afterInvalidatedProjectBuild");
103755
104241
  if (!state.diagnostics.has(invalidatedProject.projectPath))
103756
104242
  successfulProjects++;
103757
104243
  }
@@ -103837,6 +104323,14 @@ var ts;
103837
104323
  state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
103838
104324
  }
103839
104325
  function buildNextInvalidatedProject(state, changeDetected) {
104326
+ ts.solutionPerformance.mark("beforeBuild");
104327
+ var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
104328
+ ts.solutionPerformance.mark("afterBuild");
104329
+ ts.solutionPerformance.measure("Build", "beforeBuild", "afterBuild");
104330
+ if (buildOrder)
104331
+ reportErrorSummary(state, buildOrder);
104332
+ }
104333
+ function buildNextInvalidatedProjectWorker(state, changeDetected) {
103840
104334
  state.timerToBuildInvalidatedProject = undefined;
103841
104335
  if (state.reportFileChangeDetected) {
103842
104336
  state.reportFileChangeDetected = false;
@@ -103847,7 +104341,10 @@ var ts;
103847
104341
  var buildOrder = getBuildOrder(state);
103848
104342
  var invalidatedProject = getNextInvalidatedProject(state, buildOrder, false);
103849
104343
  if (invalidatedProject) {
104344
+ ts.solutionPerformance.mark("beforeInvalidatedProjectBuild");
103850
104345
  invalidatedProject.done();
104346
+ ts.solutionPerformance.mark("afterInvalidatedProjectBuild");
104347
+ ts.solutionPerformance.measure("InvalidatedProjectBuild", "beforeInvalidatedProjectBuild", "afterInvalidatedProjectBuild");
103851
104348
  projectsBuilt++;
103852
104349
  while (state.projectPendingBuild.size) {
103853
104350
  if (state.timerToBuildInvalidatedProject)
@@ -103860,23 +104357,24 @@ var ts;
103860
104357
  return;
103861
104358
  }
103862
104359
  var project = createInvalidatedProjectWithInfo(state, info, buildOrder);
104360
+ ts.solutionPerformance.mark("beforeInvalidatedProjectBuild");
103863
104361
  project.done();
104362
+ ts.solutionPerformance.mark("afterInvalidatedProjectBuild");
104363
+ ts.solutionPerformance.measure("InvalidatedProjectBuild", "beforeInvalidatedProjectBuild", "afterInvalidatedProjectBuild");
103864
104364
  if (info.kind !== InvalidatedProjectKind.UpdateOutputFileStamps)
103865
104365
  projectsBuilt++;
103866
104366
  }
103867
104367
  }
103868
104368
  disableCache(state);
103869
- reportErrorSummary(state, buildOrder);
104369
+ return buildOrder;
103870
104370
  }
103871
104371
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
103872
104372
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
103873
104373
  return;
103874
- state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
103875
- invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
103876
- }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
104374
+ 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));
103877
104375
  }
103878
104376
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
103879
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
104377
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
103880
104378
  var _a;
103881
104379
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
103882
104380
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -103908,7 +104406,7 @@ var ts;
103908
104406
  if (!state.watch)
103909
104407
  return;
103910
104408
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
103911
- 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); },
104409
+ 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); },
103912
104410
  onDeleteValue: ts.closeFileWatcher,
103913
104411
  });
103914
104412
  }
@@ -103916,13 +104414,14 @@ var ts;
103916
104414
  if (!state.watch || !state.lastCachedPackageJsonLookups)
103917
104415
  return;
103918
104416
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
103919
- 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); },
104417
+ 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); },
103920
104418
  onDeleteValue: ts.closeFileWatcher,
103921
104419
  });
103922
104420
  }
103923
104421
  function startWatching(state, buildOrder) {
103924
104422
  if (!state.watchAllProjectsPending)
103925
104423
  return;
104424
+ ts.solutionPerformance.mark("beforeStartWatching");
103926
104425
  state.watchAllProjectsPending = false;
103927
104426
  for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) {
103928
104427
  var resolved = _a[_i];
@@ -103936,6 +104435,8 @@ var ts;
103936
104435
  watchPackageJsonFiles(state, resolved, resolvedPath, cfg);
103937
104436
  }
103938
104437
  }
104438
+ ts.solutionPerformance.mark("afterStartWatching");
104439
+ ts.solutionPerformance.measure("StartWatching", "beforeStartWatching", "afterStartWatching");
103939
104440
  }
103940
104441
  function stopWatching(state) {
103941
104442
  ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher);
@@ -104038,25 +104539,26 @@ var ts;
104038
104539
  }
104039
104540
  }
104040
104541
  function reportUpToDateStatus(state, configFileName, status) {
104041
- if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
104042
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
104043
- }
104044
104542
  switch (status.type) {
104045
104543
  case ts.UpToDateStatusType.OutOfDateWithSelf:
104046
- 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));
104544
+ 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));
104047
104545
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
104048
- 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));
104546
+ 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));
104049
104547
  case ts.UpToDateStatusType.OutputMissing:
104050
104548
  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));
104549
+ case ts.UpToDateStatusType.OutOfDateBuildInfo:
104550
+ return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_are_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile));
104051
104551
  case ts.UpToDateStatusType.UpToDate:
104052
104552
  if (status.newestInputFileTime !== undefined) {
104053
- 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 || ""));
104553
+ 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 || ""));
104054
104554
  }
104055
104555
  break;
104056
104556
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
104057
104557
  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));
104058
104558
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
104059
104559
  return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
104560
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
104561
+ return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_but_needs_update_to_timestamps_of_output_files_that_are_older_than_input_files, relName(state, configFileName));
104060
104562
  case ts.UpToDateStatusType.UpstreamOutOfDate:
104061
104563
  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));
104062
104564
  case ts.UpToDateStatusType.UpstreamBlocked:
@@ -104067,6 +104569,8 @@ var ts;
104067
104569
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
104068
104570
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
104069
104571
  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);
104572
+ case ts.UpToDateStatusType.ForceBuild:
104573
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
104070
104574
  case ts.UpToDateStatusType.ContainerOnly:
104071
104575
  case ts.UpToDateStatusType.ComputingUpstream:
104072
104576
  break;
@@ -104082,6 +104586,12 @@ var ts;
104082
104586
  })(ts || (ts = {}));
104083
104587
  var ts;
104084
104588
  (function (ts) {
104589
+ var StatisticType;
104590
+ (function (StatisticType) {
104591
+ StatisticType[StatisticType["time"] = 0] = "time";
104592
+ StatisticType[StatisticType["count"] = 1] = "count";
104593
+ StatisticType[StatisticType["memory"] = 2] = "memory";
104594
+ })(StatisticType = ts.StatisticType || (ts.StatisticType = {}));
104085
104595
  function countLines(program) {
104086
104596
  var counts = getCountsMap();
104087
104597
  ts.forEach(program.getSourceFiles(), function (file) {
@@ -104642,18 +105152,73 @@ var ts;
104642
105152
  if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic))
104643
105153
  return;
104644
105154
  var buildHost_1 = ts.createSolutionBuilderWithWatchHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createWatchStatusReporter(sys, buildOptions));
105155
+ var onWatchStatusChange_1 = buildHost_1.onWatchStatusChange;
105156
+ var reportWatchStatistics_1 = false;
105157
+ buildHost_1.onWatchStatusChange = function (d, newLine, options, errorCount) {
105158
+ onWatchStatusChange_1 === null || onWatchStatusChange_1 === void 0 ? void 0 : onWatchStatusChange_1(d, newLine, options, errorCount);
105159
+ if (!reportWatchStatistics_1)
105160
+ return;
105161
+ if (d.code === ts.Diagnostics.Found_0_errors_Watching_for_file_changes.code ||
105162
+ d.code === ts.Diagnostics.Found_1_error_Watching_for_file_changes.code) {
105163
+ reportSolutionBuilderTimes(sys, builder_1, buildHost_1);
105164
+ }
105165
+ };
104645
105166
  updateSolutionBuilderHost(sys, cb, buildHost_1);
105167
+ enableSolutionPerformance(sys, buildOptions);
104646
105168
  var builder_1 = ts.createSolutionBuilderWithWatch(buildHost_1, projects, buildOptions, watchOptions);
104647
105169
  builder_1.build();
105170
+ reportSolutionBuilderTimes(sys, builder_1, buildHost_1);
105171
+ reportWatchStatistics_1 = true;
104648
105172
  return builder_1;
104649
105173
  }
104650
105174
  var buildHost = ts.createSolutionBuilderHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createReportErrorSummary(sys, buildOptions));
104651
105175
  updateSolutionBuilderHost(sys, cb, buildHost);
105176
+ enableSolutionPerformance(sys, buildOptions);
104652
105177
  var builder = ts.createSolutionBuilder(buildHost, projects, buildOptions);
104653
105178
  var exitStatus = buildOptions.clean ? builder.clean() : builder.build();
105179
+ reportSolutionBuilderTimes(sys, builder, buildHost);
104654
105180
  ts.dumpTracingLegend();
104655
105181
  return sys.exit(exitStatus);
104656
105182
  }
105183
+ function enableSolutionPerformance(system, options) {
105184
+ if (system === ts.sys && (options.diagnostics || options.extendedDiagnostics))
105185
+ ts.solutionPerformance.enable();
105186
+ }
105187
+ function reportSolutionBuilderTimes(system, builder, buildHost) {
105188
+ if (system !== ts.sys)
105189
+ return;
105190
+ if (ts.solutionPerformance.isEnabled()) {
105191
+ var solutionStatistics_1 = [];
105192
+ ts.solutionPerformance.forEachMeasure(function (name, duration) { return solutionStatistics_1.push({ name: name + " time", value: duration, type: StatisticType.time }); });
105193
+ solutionStatistics_1.push({ name: "projectsBuilt", value: ts.solutionPerformance.getCount("projectsBuilt"), type: StatisticType.count }, { name: "timestampUpdated", value: ts.solutionPerformance.getCount("timestampUpdated"), type: StatisticType.count }, { name: "bundlesUpdated", value: ts.solutionPerformance.getCount("bundlesUpdated"), type: StatisticType.count }, { name: "projects", value: ts.getBuildOrderFromAnyBuildOrder(builder.getBuildOrder()).length, type: StatisticType.count });
105194
+ buildHost.statistics = ts.append(buildHost.statistics, solutionStatistics_1);
105195
+ ts.solutionPerformance.disable();
105196
+ ts.solutionPerformance.enable();
105197
+ }
105198
+ if (!buildHost.statistics)
105199
+ return;
105200
+ var statistics = [];
105201
+ var map = new ts.Map();
105202
+ for (var _i = 0, _a = buildHost.statistics; _i < _a.length; _i++) {
105203
+ var statistic = _a[_i];
105204
+ for (var _b = 0, statistic_1 = statistic; _b < statistic_1.length; _b++) {
105205
+ var s = statistic_1[_b];
105206
+ var existing = map.get(s.name);
105207
+ if (existing) {
105208
+ if (existing.type === StatisticType.memory)
105209
+ existing.value = Math.max(existing.value, s.value);
105210
+ else
105211
+ existing.value += s.value;
105212
+ }
105213
+ else {
105214
+ map.set(s.name, s);
105215
+ statistics.push(s);
105216
+ }
105217
+ }
105218
+ }
105219
+ buildHost.statistics = undefined;
105220
+ reportAllStatistics(system, statistics);
105221
+ }
104657
105222
  function createReportErrorSummary(sys, options) {
104658
105223
  return shouldBePretty(sys, options) ?
104659
105224
  function (errorCount, filesInError) { return sys.write(ts.getErrorSummaryText(errorCount, filesInError, sys.newLine, sys)); } :
@@ -104702,10 +105267,13 @@ var ts;
104702
105267
  function updateSolutionBuilderHost(sys, cb, buildHost) {
104703
105268
  updateCreateProgram(sys, buildHost);
104704
105269
  buildHost.afterProgramEmitAndDiagnostics = function (program) {
104705
- reportStatistics(sys, program.getProgram());
105270
+ buildHost.statistics = ts.append(buildHost.statistics, reportStatistics(sys, program.getProgram()));
104706
105271
  cb(program);
104707
105272
  };
104708
- buildHost.afterEmitBundle = cb;
105273
+ buildHost.afterEmitBundle = function (config) {
105274
+ buildHost.statistics = ts.append(buildHost.statistics, reportStatistics(sys, config));
105275
+ cb(config);
105276
+ };
104709
105277
  }
104710
105278
  function updateCreateProgram(sys, host) {
104711
105279
  var compileUsingBuilder = host.createProgram;
@@ -104769,8 +105337,13 @@ var ts;
104769
105337
  ts.startTracing(isBuildMode ? "build" : "project", compilerOptions.generateTrace, compilerOptions.configFilePath);
104770
105338
  }
104771
105339
  }
104772
- function reportStatistics(sys, program) {
104773
- var compilerOptions = program.getCompilerOptions();
105340
+ function isProgram(programOrConfig) {
105341
+ return !!programOrConfig.getCompilerOptions;
105342
+ }
105343
+ function reportStatistics(sys, programOrConfig) {
105344
+ var program = isProgram(programOrConfig) ? programOrConfig : undefined;
105345
+ var config = !isProgram(programOrConfig) ? programOrConfig : undefined;
105346
+ var compilerOptions = (program === null || program === void 0 ? void 0 : program.getCompilerOptions()) || (config === null || config === void 0 ? void 0 : config.options);
104774
105347
  if (canTrace(sys, compilerOptions)) {
104775
105348
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.stopTracing();
104776
105349
  }
@@ -104778,29 +105351,31 @@ var ts;
104778
105351
  if (canReportDiagnostics(sys, compilerOptions)) {
104779
105352
  statistics = [];
104780
105353
  var memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1;
104781
- reportCountStatistic("Files", program.getSourceFiles().length);
104782
- var lineCounts = countLines(program);
104783
- var nodeCounts = countNodes(program);
104784
- if (compilerOptions.extendedDiagnostics) {
104785
- for (var _i = 0, _a = ts.arrayFrom(lineCounts.keys()); _i < _a.length; _i++) {
104786
- var key = _a[_i];
104787
- reportCountStatistic("Lines of " + key, lineCounts.get(key));
105354
+ if (program) {
105355
+ reportCountStatistic("Files", program.getSourceFiles().length);
105356
+ var lineCounts = countLines(program);
105357
+ var nodeCounts = countNodes(program);
105358
+ if (compilerOptions.extendedDiagnostics) {
105359
+ for (var _i = 0, _a = ts.arrayFrom(lineCounts.keys()); _i < _a.length; _i++) {
105360
+ var key = _a[_i];
105361
+ reportCountStatistic("Lines of " + key, lineCounts.get(key));
105362
+ }
105363
+ for (var _b = 0, _c = ts.arrayFrom(nodeCounts.keys()); _b < _c.length; _b++) {
105364
+ var key = _c[_b];
105365
+ reportCountStatistic("Nodes of " + key, nodeCounts.get(key));
105366
+ }
104788
105367
  }
104789
- for (var _b = 0, _c = ts.arrayFrom(nodeCounts.keys()); _b < _c.length; _b++) {
104790
- var key = _c[_b];
104791
- reportCountStatistic("Nodes of " + key, nodeCounts.get(key));
105368
+ else {
105369
+ reportCountStatistic("Lines", ts.reduceLeftIterator(lineCounts.values(), function (sum, count) { return sum + count; }, 0));
105370
+ reportCountStatistic("Nodes", ts.reduceLeftIterator(nodeCounts.values(), function (sum, count) { return sum + count; }, 0));
104792
105371
  }
105372
+ reportCountStatistic("Identifiers", program.getIdentifierCount());
105373
+ reportCountStatistic("Symbols", program.getSymbolCount());
105374
+ reportCountStatistic("Types", program.getTypeCount());
105375
+ reportCountStatistic("Instantiations", program.getInstantiationCount());
104793
105376
  }
104794
- else {
104795
- reportCountStatistic("Lines", ts.reduceLeftIterator(lineCounts.values(), function (sum, count) { return sum + count; }, 0));
104796
- reportCountStatistic("Nodes", ts.reduceLeftIterator(nodeCounts.values(), function (sum, count) { return sum + count; }, 0));
104797
- }
104798
- reportCountStatistic("Identifiers", program.getIdentifierCount());
104799
- reportCountStatistic("Symbols", program.getSymbolCount());
104800
- reportCountStatistic("Types", program.getTypeCount());
104801
- reportCountStatistic("Instantiations", program.getInstantiationCount());
104802
105377
  if (memoryUsed >= 0) {
104803
- reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K");
105378
+ reportMemoryStatistic("Memory used", memoryUsed);
104804
105379
  }
104805
105380
  var isPerformanceEnabled = ts.performance.isEnabled();
104806
105381
  var programTime = isPerformanceEnabled ? ts.performance.getDuration("Program") : 0;
@@ -104808,11 +105383,13 @@ var ts;
104808
105383
  var checkTime = isPerformanceEnabled ? ts.performance.getDuration("Check") : 0;
104809
105384
  var emitTime = isPerformanceEnabled ? ts.performance.getDuration("Emit") : 0;
104810
105385
  if (compilerOptions.extendedDiagnostics) {
104811
- var caches = program.getRelationCacheSizes();
104812
- reportCountStatistic("Assignability cache size", caches.assignable);
104813
- reportCountStatistic("Identity cache size", caches.identity);
104814
- reportCountStatistic("Subtype cache size", caches.subtype);
104815
- reportCountStatistic("Strict subtype cache size", caches.strictSubtype);
105386
+ if (program) {
105387
+ var caches = program.getRelationCacheSizes();
105388
+ reportCountStatistic("Assignability cache size", caches.assignable);
105389
+ reportCountStatistic("Identity cache size", caches.identity);
105390
+ reportCountStatistic("Subtype cache size", caches.subtype);
105391
+ reportCountStatistic("Strict subtype cache size", caches.strictSubtype);
105392
+ }
104816
105393
  if (isPerformanceEnabled) {
104817
105394
  ts.performance.forEachMeasure(function (name, duration) { return reportTimeStatistic(name + " time", duration); });
104818
105395
  }
@@ -104828,39 +105405,54 @@ var ts;
104828
105405
  if (isPerformanceEnabled) {
104829
105406
  reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime);
104830
105407
  }
104831
- reportStatistics();
105408
+ reportAllStatistics(sys, statistics);
104832
105409
  if (!isPerformanceEnabled) {
104833
105410
  sys.write(ts.Diagnostics.Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found.message + "\n");
104834
105411
  }
104835
105412
  else {
104836
105413
  ts.performance.disable();
104837
105414
  }
105415
+ return statistics;
104838
105416
  }
104839
- function reportStatistics() {
104840
- var nameSize = 0;
104841
- var valueSize = 0;
104842
- for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) {
104843
- var _a = statistics_1[_i], name = _a.name, value = _a.value;
104844
- if (name.length > nameSize) {
104845
- nameSize = name.length;
104846
- }
104847
- if (value.length > valueSize) {
104848
- valueSize = value.length;
104849
- }
104850
- }
104851
- for (var _b = 0, statistics_2 = statistics; _b < statistics_2.length; _b++) {
104852
- var _c = statistics_2[_b], name = _c.name, value = _c.value;
104853
- sys.write(ts.padRight(name + ":", nameSize + 2) + ts.padLeft(value.toString(), valueSize) + sys.newLine);
104854
- }
104855
- }
104856
- function reportStatisticalValue(name, value) {
104857
- statistics.push({ name: name, value: value });
105417
+ function reportMemoryStatistic(name, memoryUsed) {
105418
+ statistics.push({ name: name, value: memoryUsed, type: StatisticType.memory });
104858
105419
  }
104859
105420
  function reportCountStatistic(name, count) {
104860
- reportStatisticalValue(name, "" + count);
105421
+ statistics.push({ name: name, value: count, type: StatisticType.count });
104861
105422
  }
104862
105423
  function reportTimeStatistic(name, time) {
104863
- reportStatisticalValue(name, (time / 1000).toFixed(2) + "s");
105424
+ statistics.push({ name: name, value: time, type: StatisticType.time });
105425
+ }
105426
+ }
105427
+ function reportAllStatistics(sys, statistics) {
105428
+ var nameSize = 0;
105429
+ var valueSize = 0;
105430
+ for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) {
105431
+ var s = statistics_1[_i];
105432
+ if (s.name.length > nameSize) {
105433
+ nameSize = s.name.length;
105434
+ }
105435
+ var valueString = statisticValue(s);
105436
+ if (valueString.length > valueSize) {
105437
+ valueSize = valueString.length;
105438
+ }
105439
+ }
105440
+ for (var _a = 0, statistics_2 = statistics; _a < statistics_2.length; _a++) {
105441
+ var s = statistics_2[_a];
105442
+ sys.write(ts.padRight(s.name + ":", nameSize + 2) + ts.padLeft(statisticValue(s).toString(), valueSize) + sys.newLine);
105443
+ }
105444
+ }
105445
+ function statisticValue(s) {
105446
+ switch (s.type) {
105447
+ case StatisticType.count:
105448
+ return "" + s.value;
105449
+ case StatisticType.time:
105450
+ return (s.value / 1000).toFixed(2) + "s";
105451
+ case StatisticType.memory:
105452
+ return Math.round(s.value / 1000) + "K";
105453
+ break;
105454
+ default:
105455
+ ts.Debug.assertNever(s.type);
104864
105456
  }
104865
105457
  }
104866
105458
  function writeConfigFile(sys, reportDiagnostic, options, fileNames) {