@typescript-deploys/pr-build 4.8.0-pr-49422-8 → 4.8.0-pr-49285-33

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.20220607";
72
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220609";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -2970,14 +2970,43 @@ var ts;
2970
2970
  })(ts || (ts = {}));
2971
2971
  var ts;
2972
2972
  (function (ts) {
2973
- var performance;
2974
- (function (performance) {
2973
+ var StatisticType;
2974
+ (function (StatisticType) {
2975
+ StatisticType[StatisticType["time"] = 0] = "time";
2976
+ StatisticType[StatisticType["count"] = 1] = "count";
2977
+ StatisticType[StatisticType["memory"] = 2] = "memory";
2978
+ })(StatisticType = ts.StatisticType || (ts.StatisticType = {}));
2979
+ var nullTimer = { enter: ts.noop, exit: ts.noop };
2980
+ ts.performance = createPerformanceTracker();
2981
+ ts.buildPerformance = createPerformanceTracker();
2982
+ function createPerformanceTracker() {
2975
2983
  var perfHooks;
2976
2984
  var performanceImpl;
2985
+ var enabled = false;
2986
+ var timeorigin = ts.timestamp();
2987
+ var marks = new ts.Map();
2988
+ var counts = new ts.Map();
2989
+ var durations = new ts.Map();
2990
+ var durationMarks = new ts.Set();
2991
+ var statistics;
2992
+ return {
2993
+ createTimerIf: createTimerIf,
2994
+ createTimer: createTimer,
2995
+ mark: mark,
2996
+ measure: measure,
2997
+ addStatistics: addStatistics,
2998
+ getCount: getCount,
2999
+ getDuration: getDuration,
3000
+ forEachMeasure: forEachMeasure,
3001
+ forEachCount: forEachCount,
3002
+ forEachStatistics: forEachStatistics,
3003
+ isEnabled: isEnabled,
3004
+ enable: enable,
3005
+ disable: disable,
3006
+ };
2977
3007
  function createTimerIf(condition, measureName, startMarkName, endMarkName) {
2978
- return condition ? createTimer(measureName, startMarkName, endMarkName) : performance.nullTimer;
3008
+ return condition ? createTimer(measureName, startMarkName, endMarkName) : nullTimer;
2979
3009
  }
2980
- performance.createTimerIf = createTimerIf;
2981
3010
  function createTimer(measureName, startMarkName, endMarkName) {
2982
3011
  var enterCount = 0;
2983
3012
  return {
@@ -2999,13 +3028,6 @@ var ts;
2999
3028
  }
3000
3029
  }
3001
3030
  }
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
3031
  function mark(markName) {
3010
3032
  var _a;
3011
3033
  if (enabled) {
@@ -3015,34 +3037,49 @@ var ts;
3015
3037
  performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.mark(markName);
3016
3038
  }
3017
3039
  }
3018
- performance.mark = mark;
3019
3040
  function measure(measureName, startMarkName, endMarkName) {
3020
3041
  var _a, _b;
3021
3042
  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;
3043
+ durationMarks.add(startMarkName).add(endMarkName);
3044
+ var end = (_a = marks.get(endMarkName)) !== null && _a !== void 0 ? _a : ts.timestamp();
3045
+ var start = (_b = marks.get(startMarkName)) !== null && _b !== void 0 ? _b : timeorigin;
3024
3046
  var previousDuration = durations.get(measureName) || 0;
3025
3047
  durations.set(measureName, previousDuration + (end - start));
3026
3048
  performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.measure(measureName, startMarkName, endMarkName);
3027
3049
  }
3028
3050
  }
3029
- performance.measure = measure;
3051
+ function addStatistics(s) {
3052
+ if (enabled) {
3053
+ var existing = statistics === null || statistics === void 0 ? void 0 : statistics.get(s.name);
3054
+ if (existing) {
3055
+ if (existing.type === StatisticType.memory)
3056
+ existing.value = Math.max(existing.value, s.value);
3057
+ else
3058
+ existing.value += s.value;
3059
+ }
3060
+ else {
3061
+ (statistics !== null && statistics !== void 0 ? statistics : (statistics = new ts.Map())).set(s.name, s);
3062
+ }
3063
+ }
3064
+ }
3030
3065
  function getCount(markName) {
3031
3066
  return counts.get(markName) || 0;
3032
3067
  }
3033
- performance.getCount = getCount;
3034
3068
  function getDuration(measureName) {
3035
3069
  return durations.get(measureName) || 0;
3036
3070
  }
3037
- performance.getDuration = getDuration;
3038
3071
  function forEachMeasure(cb) {
3039
- durations.forEach(function (duration, measureName) { return cb(measureName, duration); });
3072
+ durations.forEach(cb);
3073
+ }
3074
+ function forEachCount(cb) {
3075
+ counts.forEach(function (count, countName) { return !durationMarks.has(countName) && cb(count, countName); });
3076
+ }
3077
+ function forEachStatistics(cb) {
3078
+ statistics === null || statistics === void 0 ? void 0 : statistics.forEach(cb);
3040
3079
  }
3041
- performance.forEachMeasure = forEachMeasure;
3042
3080
  function isEnabled() {
3043
3081
  return enabled;
3044
3082
  }
3045
- performance.isEnabled = isEnabled;
3046
3083
  function enable(system) {
3047
3084
  var _a;
3048
3085
  if (system === void 0) { system = ts.sys; }
@@ -3058,18 +3095,18 @@ var ts;
3058
3095
  }
3059
3096
  return true;
3060
3097
  }
3061
- performance.enable = enable;
3062
3098
  function disable() {
3063
3099
  if (enabled) {
3064
3100
  marks.clear();
3065
3101
  counts.clear();
3066
3102
  durations.clear();
3103
+ durationMarks.clear();
3104
+ statistics === null || statistics === void 0 ? void 0 : statistics.clear();
3067
3105
  performanceImpl = undefined;
3068
3106
  enabled = false;
3069
3107
  }
3070
3108
  }
3071
- performance.disable = disable;
3072
- })(performance = ts.performance || (ts.performance = {}));
3109
+ }
3073
3110
  })(ts || (ts = {}));
3074
3111
  var ts;
3075
3112
  (function (ts) {
@@ -3746,7 +3783,7 @@ var ts;
3746
3783
  };
3747
3784
  }
3748
3785
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
3749
- var watcher = fsWatch(dirName, 1, function (_eventName, relativeFileName) {
3786
+ var watcher = fsWatch(dirName, 1, function (_eventName, relativeFileName, modifiedTime) {
3750
3787
  if (!ts.isString(relativeFileName))
3751
3788
  return;
3752
3789
  var fileName = ts.getNormalizedAbsolutePath(relativeFileName, dirName);
@@ -3754,7 +3791,7 @@ var ts;
3754
3791
  if (callbacks) {
3755
3792
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
3756
3793
  var fileCallback = callbacks_1[_i];
3757
- fileCallback(fileName, FileWatcherEventKind.Changed);
3794
+ fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
3758
3795
  }
3759
3796
  }
3760
3797
  }, false, PollingInterval.Medium, fallbackOptions);
@@ -3806,7 +3843,7 @@ var ts;
3806
3843
  }
3807
3844
  else {
3808
3845
  cache.set(path, {
3809
- watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
3846
+ watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
3810
3847
  refCount: 1
3811
3848
  });
3812
3849
  }
@@ -3830,7 +3867,7 @@ var ts;
3830
3867
  var newTime = modifiedTime.getTime();
3831
3868
  if (oldTime !== newTime) {
3832
3869
  watchedFile.mtime = modifiedTime;
3833
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
3870
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
3834
3871
  return true;
3835
3872
  }
3836
3873
  return false;
@@ -3855,7 +3892,7 @@ var ts;
3855
3892
  }
3856
3893
  ts.setSysLog = setSysLog;
3857
3894
  function createDirectoryWatcherSupportingRecursive(_a) {
3858
- var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, directoryExists = _a.directoryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout;
3895
+ var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout;
3859
3896
  var cache = new ts.Map();
3860
3897
  var callbackCache = ts.createMultiMap();
3861
3898
  var cacheToUpdateChildWatches = new ts.Map();
@@ -3948,7 +3985,7 @@ var ts;
3948
3985
  }
3949
3986
  function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
3950
3987
  var parentWatcher = cache.get(dirPath);
3951
- if (parentWatcher && directoryExists(dirName)) {
3988
+ if (parentWatcher && fileSystemEntryExists(dirName, 1)) {
3952
3989
  scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
3953
3990
  return;
3954
3991
  }
@@ -4016,7 +4053,7 @@ var ts;
4016
4053
  if (!parentWatcher)
4017
4054
  return false;
4018
4055
  var newChildWatches;
4019
- var hasChanges = ts.enumerateInsertsAndDeletes(directoryExists(parentDir) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
4056
+ var hasChanges = ts.enumerateInsertsAndDeletes(fileSystemEntryExists(parentDir, 1) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
4020
4057
  var childFullName = ts.getNormalizedAbsolutePath(child, parentDir);
4021
4058
  return !isIgnoredPath(childFullName, options) && filePathComparer(childFullName, ts.normalizePath(realpath(childFullName))) === 0 ? childFullName : undefined;
4022
4059
  }) : ts.emptyArray, parentWatcher.childWatches, function (child, childWatcher) { return filePathComparer(child, childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher);
@@ -4044,16 +4081,17 @@ var ts;
4044
4081
  }
4045
4082
  ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive;
4046
4083
  function createFileWatcherCallback(callback) {
4047
- return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
4084
+ return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
4048
4085
  }
4049
4086
  ts.createFileWatcherCallback = createFileWatcherCallback;
4050
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists) {
4051
- return function (eventName) {
4087
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
4088
+ return function (eventName, _relativeFileName, modifiedTime) {
4052
4089
  if (eventName === "rename") {
4053
- callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
4090
+ modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
4091
+ callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
4054
4092
  }
4055
4093
  else {
4056
- callback(fileName, FileWatcherEventKind.Changed);
4094
+ callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
4057
4095
  }
4058
4096
  };
4059
4097
  }
@@ -4072,11 +4110,12 @@ var ts;
4072
4110
  };
4073
4111
  }
4074
4112
  function createSystemWatchFunctions(_a) {
4075
- var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatch = _a.fsWatch, fileExists = _a.fileExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, directoryExists = _a.directoryExists, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind;
4113
+ var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog;
4076
4114
  var dynamicPollingWatchFile;
4077
4115
  var fixedChunkSizePollingWatchFile;
4078
4116
  var nonPollingWatchFile;
4079
4117
  var hostRecursiveDirectoryWatcher;
4118
+ var hitSystemWatcherLimit = false;
4080
4119
  return {
4081
4120
  watchFile: watchFile,
4082
4121
  watchDirectory: watchDirectory
@@ -4094,7 +4133,7 @@ var ts;
4094
4133
  case ts.WatchFileKind.FixedChunkSizePolling:
4095
4134
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, undefined, undefined);
4096
4135
  case ts.WatchFileKind.UseFsEvents:
4097
- return fsWatch(fileName, 0, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists), false, pollingInterval, ts.getFallbackOptions(options));
4136
+ return fsWatch(fileName, 0, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime), false, pollingInterval, ts.getFallbackOptions(options));
4098
4137
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
4099
4138
  if (!nonPollingWatchFile) {
4100
4139
  nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames);
@@ -4147,7 +4186,7 @@ var ts;
4147
4186
  hostRecursiveDirectoryWatcher = createDirectoryWatcherSupportingRecursive({
4148
4187
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
4149
4188
  getCurrentDirectory: getCurrentDirectory,
4150
- directoryExists: directoryExists,
4189
+ fileSystemEntryExists: fileSystemEntryExists,
4151
4190
  getAccessibleSortedChildDirectories: getAccessibleSortedChildDirectories,
4152
4191
  watchDirectory: nonRecursiveWatchDirectory,
4153
4192
  realpath: realpath,
@@ -4192,6 +4231,92 @@ var ts;
4192
4231
  };
4193
4232
  }
4194
4233
  }
4234
+ function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
4235
+ var lastDirectoryPartWithDirectorySeparator;
4236
+ var lastDirectoryPart;
4237
+ if (inodeWatching) {
4238
+ lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substring(fileOrDirectory.lastIndexOf(ts.directorySeparator));
4239
+ lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
4240
+ }
4241
+ var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
4242
+ watchMissingFileSystemEntry() :
4243
+ watchPresentFileSystemEntry();
4244
+ return {
4245
+ close: function () {
4246
+ watcher.close();
4247
+ watcher = undefined;
4248
+ }
4249
+ };
4250
+ function updateWatcher(createWatcher) {
4251
+ if (watcher) {
4252
+ sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
4253
+ watcher.close();
4254
+ watcher = createWatcher();
4255
+ }
4256
+ }
4257
+ function watchPresentFileSystemEntry() {
4258
+ if (hitSystemWatcherLimit) {
4259
+ sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to watchFile");
4260
+ return watchPresentFileSystemEntryWithFsWatchFile();
4261
+ }
4262
+ try {
4263
+ var presentWatcher = fsWatchWorker(fileOrDirectory, recursive, inodeWatching ?
4264
+ callbackChangingToMissingFileSystemEntry :
4265
+ callback);
4266
+ presentWatcher.on("error", function () {
4267
+ callback("rename", "");
4268
+ updateWatcher(watchMissingFileSystemEntry);
4269
+ });
4270
+ return presentWatcher;
4271
+ }
4272
+ catch (e) {
4273
+ hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
4274
+ sysLog("sysLog:: " + fileOrDirectory + ":: Changing to watchFile");
4275
+ return watchPresentFileSystemEntryWithFsWatchFile();
4276
+ }
4277
+ }
4278
+ function callbackChangingToMissingFileSystemEntry(event, relativeName) {
4279
+ var originalRelativeName;
4280
+ if (relativeName && ts.endsWith(relativeName, "~")) {
4281
+ originalRelativeName = relativeName;
4282
+ relativeName = relativeName.slice(0, relativeName.length - 1);
4283
+ }
4284
+ if (event === "rename" &&
4285
+ (!relativeName ||
4286
+ relativeName === lastDirectoryPart ||
4287
+ ts.endsWith(relativeName, lastDirectoryPartWithDirectorySeparator))) {
4288
+ var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
4289
+ if (originalRelativeName)
4290
+ callback(event, originalRelativeName, modifiedTime);
4291
+ callback(event, relativeName, modifiedTime);
4292
+ if (inodeWatching) {
4293
+ updateWatcher(modifiedTime === ts.missingFileModifiedTime ? watchMissingFileSystemEntry : watchPresentFileSystemEntry);
4294
+ }
4295
+ else if (modifiedTime === ts.missingFileModifiedTime) {
4296
+ updateWatcher(watchMissingFileSystemEntry);
4297
+ }
4298
+ }
4299
+ else {
4300
+ if (originalRelativeName)
4301
+ callback(event, originalRelativeName);
4302
+ callback(event, relativeName);
4303
+ }
4304
+ }
4305
+ function watchPresentFileSystemEntryWithFsWatchFile() {
4306
+ return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions);
4307
+ }
4308
+ function watchMissingFileSystemEntry() {
4309
+ return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
4310
+ if (eventKind === FileWatcherEventKind.Created) {
4311
+ modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
4312
+ if (modifiedTime !== ts.missingFileModifiedTime) {
4313
+ callback("rename", "", modifiedTime);
4314
+ updateWatcher(watchPresentFileSystemEntry);
4315
+ }
4316
+ }
4317
+ }, fallbackPollingInterval, fallbackOptions);
4318
+ }
4319
+ }
4195
4320
  }
4196
4321
  ts.createSystemWatchFunctions = createSystemWatchFunctions;
4197
4322
  function patchWriteFileEnsuringDirectory(sys) {
@@ -4233,7 +4358,6 @@ var ts;
4233
4358
  }
4234
4359
  var activeSession;
4235
4360
  var profilePath = "./profile.cpuprofile";
4236
- var hitSystemWatcherLimit = false;
4237
4361
  var Buffer = require("buffer").Buffer;
4238
4362
  var nodeVersion = getNodeMajorVersion();
4239
4363
  var isNode4OrLater = nodeVersion >= 4;
@@ -4248,18 +4372,19 @@ var ts;
4248
4372
  getModifiedTime: getModifiedTime,
4249
4373
  setTimeout: setTimeout,
4250
4374
  clearTimeout: clearTimeout,
4251
- fsWatch: fsWatch,
4375
+ fsWatchWorker: fsWatchWorker,
4252
4376
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
4253
4377
  getCurrentDirectory: getCurrentDirectory,
4254
- fileExists: fileExists,
4378
+ fileSystemEntryExists: fileSystemEntryExists,
4255
4379
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
4256
- directoryExists: directoryExists,
4257
4380
  getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; },
4258
4381
  realpath: realpath,
4259
4382
  tscWatchFile: process.env.TSC_WATCHFILE,
4260
4383
  useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
4261
4384
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
4262
4385
  defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
4386
+ inodeWatching: isLinuxOrMacOs,
4387
+ sysLog: sysLog,
4263
4388
  }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
4264
4389
  var nodeSystem = {
4265
4390
  args: process.argv.slice(2),
@@ -4479,79 +4604,12 @@ var ts;
4479
4604
  else {
4480
4605
  eventKind = FileWatcherEventKind.Changed;
4481
4606
  }
4482
- callback(fileName, eventKind);
4607
+ callback(fileName, eventKind, curr.mtime);
4483
4608
  }
4484
4609
  }
4485
- function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
4486
- var options;
4487
- var lastDirectoryPartWithDirectorySeparator;
4488
- var lastDirectoryPart;
4489
- if (isLinuxOrMacOs) {
4490
- lastDirectoryPartWithDirectorySeparator = fileOrDirectory.substr(fileOrDirectory.lastIndexOf(ts.directorySeparator));
4491
- lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(ts.directorySeparator.length);
4492
- }
4493
- var watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
4494
- watchMissingFileSystemEntry() :
4495
- watchPresentFileSystemEntry();
4496
- return {
4497
- close: function () {
4498
- watcher.close();
4499
- watcher = undefined;
4500
- }
4501
- };
4502
- function invokeCallbackAndUpdateWatcher(createWatcher) {
4503
- sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
4504
- callback("rename", "");
4505
- if (watcher) {
4506
- watcher.close();
4507
- watcher = createWatcher();
4508
- }
4509
- }
4510
- function watchPresentFileSystemEntry() {
4511
- if (options === undefined) {
4512
- if (fsSupportsRecursiveFsWatch) {
4513
- options = { persistent: true, recursive: !!recursive };
4514
- }
4515
- else {
4516
- options = { persistent: true };
4517
- }
4518
- }
4519
- if (hitSystemWatcherLimit) {
4520
- sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to fsWatchFile");
4521
- return watchPresentFileSystemEntryWithFsWatchFile();
4522
- }
4523
- try {
4524
- var presentWatcher = _fs.watch(fileOrDirectory, options, isLinuxOrMacOs ?
4525
- callbackChangingToMissingFileSystemEntry :
4526
- callback);
4527
- presentWatcher.on("error", function () { return invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry); });
4528
- return presentWatcher;
4529
- }
4530
- catch (e) {
4531
- hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
4532
- sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
4533
- return watchPresentFileSystemEntryWithFsWatchFile();
4534
- }
4535
- }
4536
- function callbackChangingToMissingFileSystemEntry(event, relativeName) {
4537
- return event === "rename" &&
4538
- (!relativeName ||
4539
- relativeName === lastDirectoryPart ||
4540
- (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
4541
- !fileSystemEntryExists(fileOrDirectory, entryKind) ?
4542
- invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
4543
- callback(event, relativeName);
4544
- }
4545
- function watchPresentFileSystemEntryWithFsWatchFile() {
4546
- return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions);
4547
- }
4548
- function watchMissingFileSystemEntry() {
4549
- return watchFile(fileOrDirectory, function (_fileName, eventKind) {
4550
- if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
4551
- invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
4552
- }
4553
- }, fallbackPollingInterval, fallbackOptions);
4554
- }
4610
+ function fsWatchWorker(fileOrDirectory, recursive, callback) {
4611
+ return _fs.watch(fileOrDirectory, fsSupportsRecursiveFsWatch ?
4612
+ { persistent: true, recursive: !!recursive } : { persistent: true }, callback);
4555
4613
  }
4556
4614
  function readFileWorker(fileName, _encoding) {
4557
4615
  var buffer;
@@ -4687,12 +4745,17 @@ var ts;
4687
4745
  }
4688
4746
  function getModifiedTime(path) {
4689
4747
  var _a;
4748
+ var originalStackTraceLimit = Error.stackTraceLimit;
4749
+ Error.stackTraceLimit = 0;
4690
4750
  try {
4691
4751
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
4692
4752
  }
4693
4753
  catch (e) {
4694
4754
  return undefined;
4695
4755
  }
4756
+ finally {
4757
+ Error.stackTraceLimit = originalStackTraceLimit;
4758
+ }
4696
4759
  }
4697
4760
  function setModifiedTime(path, time) {
4698
4761
  try {
@@ -6497,8 +6560,8 @@ var ts;
6497
6560
  Cannot_prepend_project_0_because_it_does_not_have_outFile_set: diag(6308, ts.DiagnosticCategory.Error, "Cannot_prepend_project_0_because_it_does_not_have_outFile_set_6308", "Cannot prepend project '{0}' because it does not have 'outFile' set"),
6498
6561
  Output_file_0_from_project_1_does_not_exist: diag(6309, ts.DiagnosticCategory.Error, "Output_file_0_from_project_1_does_not_exist_6309", "Output file '{0}' from project '{1}' does not exist"),
6499
6562
  Referenced_project_0_may_not_disable_emit: diag(6310, ts.DiagnosticCategory.Error, "Referenced_project_0_may_not_disable_emit_6310", "Referenced project '{0}' may not disable emit."),
6500
- Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2: diag(6350, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350", "Project '{0}' is out of date because oldest output '{1}' is older than newest input '{2}'"),
6501
- Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2: diag(6351, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351", "Project '{0}' is up to date because newest input '{1}' is older than oldest output '{2}'"),
6563
+ 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}'"),
6564
+ Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2: diag(6351, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351", "Project '{0}' is up to date because newest input '{1}' is older than output '{2}'"),
6502
6565
  Project_0_is_out_of_date_because_output_file_1_does_not_exist: diag(6352, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352", "Project '{0}' is out of date because output file '{1}' does not exist"),
6503
6566
  Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date: diag(6353, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353", "Project '{0}' is out of date because its dependency '{1}' is out of date"),
6504
6567
  Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies: diag(6354, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354", "Project '{0}' is up to date with .d.ts files from its dependencies"),
@@ -6542,6 +6605,8 @@ var ts;
6542
6605
  Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3: diag(6396, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6396", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}'."),
6543
6606
  Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4: diag(6397, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6397", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}' with Package ID '{4}'."),
6544
6607
  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."),
6608
+ Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"),
6609
+ Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"),
6545
6610
  The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
6546
6611
  The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
6547
6612
  The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -16016,6 +16081,10 @@ var ts;
16016
16081
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
16017
16082
  }
16018
16083
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
16084
+ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
16085
+ return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
16086
+ }
16087
+ ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
16019
16088
  function getCompilerOptionValue(options, option) {
16020
16089
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
16021
16090
  }
@@ -31742,6 +31811,7 @@ var ts;
31742
31811
  type: "boolean",
31743
31812
  affectsSemanticDiagnostics: true,
31744
31813
  affectsEmit: true,
31814
+ affectsMultiFileEmitBuildInfo: true,
31745
31815
  category: ts.Diagnostics.Watch_and_Build_Modes,
31746
31816
  description: ts.Diagnostics.Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it,
31747
31817
  defaultValueDescription: false,
@@ -31775,12 +31845,39 @@ var ts;
31775
31845
  affectsSourceFile: true,
31776
31846
  affectsModuleResolution: true,
31777
31847
  affectsEmit: true,
31848
+ affectsMultiFileEmitBuildInfo: true,
31778
31849
  paramType: ts.Diagnostics.VERSION,
31779
31850
  showInSimplifiedHelpView: true,
31780
31851
  category: ts.Diagnostics.Language_and_Environment,
31781
31852
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
31782
31853
  defaultValueDescription: 0,
31783
31854
  };
31855
+ ts.moduleOptionDeclaration = {
31856
+ name: "module",
31857
+ shortName: "m",
31858
+ type: new ts.Map(ts.getEntries({
31859
+ none: ts.ModuleKind.None,
31860
+ commonjs: ts.ModuleKind.CommonJS,
31861
+ amd: ts.ModuleKind.AMD,
31862
+ system: ts.ModuleKind.System,
31863
+ umd: ts.ModuleKind.UMD,
31864
+ es6: ts.ModuleKind.ES2015,
31865
+ es2015: ts.ModuleKind.ES2015,
31866
+ es2020: ts.ModuleKind.ES2020,
31867
+ es2022: ts.ModuleKind.ES2022,
31868
+ esnext: ts.ModuleKind.ESNext,
31869
+ node16: ts.ModuleKind.Node16,
31870
+ nodenext: ts.ModuleKind.NodeNext,
31871
+ })),
31872
+ affectsModuleResolution: true,
31873
+ affectsEmit: true,
31874
+ affectsMultiFileEmitBuildInfo: true,
31875
+ paramType: ts.Diagnostics.KIND,
31876
+ showInSimplifiedHelpView: true,
31877
+ category: ts.Diagnostics.Modules,
31878
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
31879
+ defaultValueDescription: undefined,
31880
+ };
31784
31881
  var commandOptionsWithoutBuild = [
31785
31882
  {
31786
31883
  name: "all",
@@ -31841,36 +31938,13 @@ var ts;
31841
31938
  category: ts.Diagnostics.Command_line_Options,
31842
31939
  affectsSemanticDiagnostics: true,
31843
31940
  affectsEmit: true,
31941
+ affectsMultiFileEmitBuildInfo: true,
31844
31942
  isCommandLineOnly: true,
31845
31943
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
31846
31944
  defaultValueDescription: false,
31847
31945
  },
31848
31946
  ts.targetOptionDeclaration,
31849
- {
31850
- name: "module",
31851
- shortName: "m",
31852
- type: new ts.Map(ts.getEntries({
31853
- none: ts.ModuleKind.None,
31854
- commonjs: ts.ModuleKind.CommonJS,
31855
- amd: ts.ModuleKind.AMD,
31856
- system: ts.ModuleKind.System,
31857
- umd: ts.ModuleKind.UMD,
31858
- es6: ts.ModuleKind.ES2015,
31859
- es2015: ts.ModuleKind.ES2015,
31860
- es2020: ts.ModuleKind.ES2020,
31861
- es2022: ts.ModuleKind.ES2022,
31862
- esnext: ts.ModuleKind.ESNext,
31863
- node16: ts.ModuleKind.Node16,
31864
- nodenext: ts.ModuleKind.NodeNext,
31865
- })),
31866
- affectsModuleResolution: true,
31867
- affectsEmit: true,
31868
- paramType: ts.Diagnostics.KIND,
31869
- showInSimplifiedHelpView: true,
31870
- category: ts.Diagnostics.Modules,
31871
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
31872
- defaultValueDescription: undefined,
31873
- },
31947
+ ts.moduleOptionDeclaration,
31874
31948
  {
31875
31949
  name: "lib",
31876
31950
  type: "list",
@@ -31907,6 +31981,7 @@ var ts;
31907
31981
  type: jsxOptionMap,
31908
31982
  affectsSourceFile: true,
31909
31983
  affectsEmit: true,
31984
+ affectsMultiFileEmitBuildInfo: true,
31910
31985
  affectsModuleResolution: true,
31911
31986
  paramType: ts.Diagnostics.KIND,
31912
31987
  showInSimplifiedHelpView: true,
@@ -31919,6 +31994,7 @@ var ts;
31919
31994
  shortName: "d",
31920
31995
  type: "boolean",
31921
31996
  affectsEmit: true,
31997
+ affectsMultiFileEmitBuildInfo: true,
31922
31998
  showInSimplifiedHelpView: true,
31923
31999
  category: ts.Diagnostics.Emit,
31924
32000
  transpileOptionValue: undefined,
@@ -31929,6 +32005,7 @@ var ts;
31929
32005
  name: "declarationMap",
31930
32006
  type: "boolean",
31931
32007
  affectsEmit: true,
32008
+ affectsMultiFileEmitBuildInfo: true,
31932
32009
  showInSimplifiedHelpView: true,
31933
32010
  category: ts.Diagnostics.Emit,
31934
32011
  transpileOptionValue: undefined,
@@ -31939,6 +32016,7 @@ var ts;
31939
32016
  name: "emitDeclarationOnly",
31940
32017
  type: "boolean",
31941
32018
  affectsEmit: true,
32019
+ affectsMultiFileEmitBuildInfo: true,
31942
32020
  showInSimplifiedHelpView: true,
31943
32021
  category: ts.Diagnostics.Emit,
31944
32022
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -31949,6 +32027,7 @@ var ts;
31949
32027
  name: "sourceMap",
31950
32028
  type: "boolean",
31951
32029
  affectsEmit: true,
32030
+ affectsMultiFileEmitBuildInfo: true,
31952
32031
  showInSimplifiedHelpView: true,
31953
32032
  category: ts.Diagnostics.Emit,
31954
32033
  defaultValueDescription: false,
@@ -31958,6 +32037,9 @@ var ts;
31958
32037
  name: "outFile",
31959
32038
  type: "string",
31960
32039
  affectsEmit: true,
32040
+ affectsMultiFileEmitBuildInfo: true,
32041
+ affectsDeclarationPath: true,
32042
+ affectsBundleEmitBuildInfo: true,
31961
32043
  isFilePath: true,
31962
32044
  paramType: ts.Diagnostics.FILE,
31963
32045
  showInSimplifiedHelpView: true,
@@ -31969,6 +32051,8 @@ var ts;
31969
32051
  name: "outDir",
31970
32052
  type: "string",
31971
32053
  affectsEmit: true,
32054
+ affectsMultiFileEmitBuildInfo: true,
32055
+ affectsDeclarationPath: true,
31972
32056
  isFilePath: true,
31973
32057
  paramType: ts.Diagnostics.DIRECTORY,
31974
32058
  showInSimplifiedHelpView: true,
@@ -31979,6 +32063,8 @@ var ts;
31979
32063
  name: "rootDir",
31980
32064
  type: "string",
31981
32065
  affectsEmit: true,
32066
+ affectsMultiFileEmitBuildInfo: true,
32067
+ affectsDeclarationPath: true,
31982
32068
  isFilePath: true,
31983
32069
  paramType: ts.Diagnostics.LOCATION,
31984
32070
  category: ts.Diagnostics.Modules,
@@ -31989,6 +32075,8 @@ var ts;
31989
32075
  name: "composite",
31990
32076
  type: "boolean",
31991
32077
  affectsEmit: true,
32078
+ affectsMultiFileEmitBuildInfo: true,
32079
+ affectsBundleEmitBuildInfo: true,
31992
32080
  isTSConfigOnly: true,
31993
32081
  category: ts.Diagnostics.Projects,
31994
32082
  transpileOptionValue: undefined,
@@ -31999,6 +32087,8 @@ var ts;
31999
32087
  name: "tsBuildInfoFile",
32000
32088
  type: "string",
32001
32089
  affectsEmit: true,
32090
+ affectsMultiFileEmitBuildInfo: true,
32091
+ affectsBundleEmitBuildInfo: true,
32002
32092
  isFilePath: true,
32003
32093
  paramType: ts.Diagnostics.FILE,
32004
32094
  category: ts.Diagnostics.Projects,
@@ -32010,6 +32100,7 @@ var ts;
32010
32100
  name: "removeComments",
32011
32101
  type: "boolean",
32012
32102
  affectsEmit: true,
32103
+ affectsMultiFileEmitBuildInfo: true,
32013
32104
  showInSimplifiedHelpView: true,
32014
32105
  category: ts.Diagnostics.Emit,
32015
32106
  defaultValueDescription: false,
@@ -32028,6 +32119,7 @@ var ts;
32028
32119
  name: "importHelpers",
32029
32120
  type: "boolean",
32030
32121
  affectsEmit: true,
32122
+ affectsMultiFileEmitBuildInfo: true,
32031
32123
  category: ts.Diagnostics.Emit,
32032
32124
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
32033
32125
  defaultValueDescription: false,
@@ -32041,6 +32133,7 @@ var ts;
32041
32133
  })),
32042
32134
  affectsEmit: true,
32043
32135
  affectsSemanticDiagnostics: true,
32136
+ affectsMultiFileEmitBuildInfo: true,
32044
32137
  category: ts.Diagnostics.Emit,
32045
32138
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
32046
32139
  defaultValueDescription: 0,
@@ -32049,6 +32142,7 @@ var ts;
32049
32142
  name: "downlevelIteration",
32050
32143
  type: "boolean",
32051
32144
  affectsEmit: true,
32145
+ affectsMultiFileEmitBuildInfo: true,
32052
32146
  category: ts.Diagnostics.Emit,
32053
32147
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
32054
32148
  defaultValueDescription: false,
@@ -32064,6 +32158,7 @@ var ts;
32064
32158
  {
32065
32159
  name: "strict",
32066
32160
  type: "boolean",
32161
+ affectsMultiFileEmitBuildInfo: true,
32067
32162
  showInSimplifiedHelpView: true,
32068
32163
  category: ts.Diagnostics.Type_Checking,
32069
32164
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -32073,6 +32168,7 @@ var ts;
32073
32168
  name: "noImplicitAny",
32074
32169
  type: "boolean",
32075
32170
  affectsSemanticDiagnostics: true,
32171
+ affectsMultiFileEmitBuildInfo: true,
32076
32172
  strictFlag: true,
32077
32173
  category: ts.Diagnostics.Type_Checking,
32078
32174
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -32082,6 +32178,7 @@ var ts;
32082
32178
  name: "strictNullChecks",
32083
32179
  type: "boolean",
32084
32180
  affectsSemanticDiagnostics: true,
32181
+ affectsMultiFileEmitBuildInfo: true,
32085
32182
  strictFlag: true,
32086
32183
  category: ts.Diagnostics.Type_Checking,
32087
32184
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -32090,6 +32187,8 @@ var ts;
32090
32187
  {
32091
32188
  name: "strictFunctionTypes",
32092
32189
  type: "boolean",
32190
+ affectsSemanticDiagnostics: true,
32191
+ affectsMultiFileEmitBuildInfo: true,
32093
32192
  strictFlag: true,
32094
32193
  category: ts.Diagnostics.Type_Checking,
32095
32194
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -32098,6 +32197,8 @@ var ts;
32098
32197
  {
32099
32198
  name: "strictBindCallApply",
32100
32199
  type: "boolean",
32200
+ affectsSemanticDiagnostics: true,
32201
+ affectsMultiFileEmitBuildInfo: true,
32101
32202
  strictFlag: true,
32102
32203
  category: ts.Diagnostics.Type_Checking,
32103
32204
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -32107,6 +32208,7 @@ var ts;
32107
32208
  name: "strictPropertyInitialization",
32108
32209
  type: "boolean",
32109
32210
  affectsSemanticDiagnostics: true,
32211
+ affectsMultiFileEmitBuildInfo: true,
32110
32212
  strictFlag: true,
32111
32213
  category: ts.Diagnostics.Type_Checking,
32112
32214
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -32116,6 +32218,7 @@ var ts;
32116
32218
  name: "noImplicitThis",
32117
32219
  type: "boolean",
32118
32220
  affectsSemanticDiagnostics: true,
32221
+ affectsMultiFileEmitBuildInfo: true,
32119
32222
  strictFlag: true,
32120
32223
  category: ts.Diagnostics.Type_Checking,
32121
32224
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -32125,6 +32228,7 @@ var ts;
32125
32228
  name: "useUnknownInCatchVariables",
32126
32229
  type: "boolean",
32127
32230
  affectsSemanticDiagnostics: true,
32231
+ affectsMultiFileEmitBuildInfo: true,
32128
32232
  strictFlag: true,
32129
32233
  category: ts.Diagnostics.Type_Checking,
32130
32234
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -32134,6 +32238,8 @@ var ts;
32134
32238
  name: "alwaysStrict",
32135
32239
  type: "boolean",
32136
32240
  affectsSourceFile: true,
32241
+ affectsEmit: true,
32242
+ affectsMultiFileEmitBuildInfo: true,
32137
32243
  strictFlag: true,
32138
32244
  category: ts.Diagnostics.Type_Checking,
32139
32245
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -32143,6 +32249,7 @@ var ts;
32143
32249
  name: "noUnusedLocals",
32144
32250
  type: "boolean",
32145
32251
  affectsSemanticDiagnostics: true,
32252
+ affectsMultiFileEmitBuildInfo: true,
32146
32253
  category: ts.Diagnostics.Type_Checking,
32147
32254
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
32148
32255
  defaultValueDescription: false,
@@ -32151,6 +32258,7 @@ var ts;
32151
32258
  name: "noUnusedParameters",
32152
32259
  type: "boolean",
32153
32260
  affectsSemanticDiagnostics: true,
32261
+ affectsMultiFileEmitBuildInfo: true,
32154
32262
  category: ts.Diagnostics.Type_Checking,
32155
32263
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
32156
32264
  defaultValueDescription: false,
@@ -32159,6 +32267,7 @@ var ts;
32159
32267
  name: "exactOptionalPropertyTypes",
32160
32268
  type: "boolean",
32161
32269
  affectsSemanticDiagnostics: true,
32270
+ affectsMultiFileEmitBuildInfo: true,
32162
32271
  category: ts.Diagnostics.Type_Checking,
32163
32272
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
32164
32273
  defaultValueDescription: false,
@@ -32167,6 +32276,7 @@ var ts;
32167
32276
  name: "noImplicitReturns",
32168
32277
  type: "boolean",
32169
32278
  affectsSemanticDiagnostics: true,
32279
+ affectsMultiFileEmitBuildInfo: true,
32170
32280
  category: ts.Diagnostics.Type_Checking,
32171
32281
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
32172
32282
  defaultValueDescription: false,
@@ -32176,6 +32286,7 @@ var ts;
32176
32286
  type: "boolean",
32177
32287
  affectsBindDiagnostics: true,
32178
32288
  affectsSemanticDiagnostics: true,
32289
+ affectsMultiFileEmitBuildInfo: true,
32179
32290
  category: ts.Diagnostics.Type_Checking,
32180
32291
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
32181
32292
  defaultValueDescription: false,
@@ -32184,6 +32295,7 @@ var ts;
32184
32295
  name: "noUncheckedIndexedAccess",
32185
32296
  type: "boolean",
32186
32297
  affectsSemanticDiagnostics: true,
32298
+ affectsMultiFileEmitBuildInfo: true,
32187
32299
  category: ts.Diagnostics.Type_Checking,
32188
32300
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
32189
32301
  defaultValueDescription: false,
@@ -32192,6 +32304,7 @@ var ts;
32192
32304
  name: "noImplicitOverride",
32193
32305
  type: "boolean",
32194
32306
  affectsSemanticDiagnostics: true,
32307
+ affectsMultiFileEmitBuildInfo: true,
32195
32308
  category: ts.Diagnostics.Type_Checking,
32196
32309
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
32197
32310
  defaultValueDescription: false,
@@ -32199,6 +32312,8 @@ var ts;
32199
32312
  {
32200
32313
  name: "noPropertyAccessFromIndexSignature",
32201
32314
  type: "boolean",
32315
+ affectsSemanticDiagnostics: true,
32316
+ affectsMultiFileEmitBuildInfo: true,
32202
32317
  showInSimplifiedHelpView: false,
32203
32318
  category: ts.Diagnostics.Type_Checking,
32204
32319
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -32279,6 +32394,7 @@ var ts;
32279
32394
  name: "allowSyntheticDefaultImports",
32280
32395
  type: "boolean",
32281
32396
  affectsSemanticDiagnostics: true,
32397
+ affectsMultiFileEmitBuildInfo: true,
32282
32398
  category: ts.Diagnostics.Interop_Constraints,
32283
32399
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
32284
32400
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -32288,6 +32404,7 @@ var ts;
32288
32404
  type: "boolean",
32289
32405
  affectsSemanticDiagnostics: true,
32290
32406
  affectsEmit: true,
32407
+ affectsMultiFileEmitBuildInfo: true,
32291
32408
  showInSimplifiedHelpView: true,
32292
32409
  category: ts.Diagnostics.Interop_Constraints,
32293
32410
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -32304,6 +32421,7 @@ var ts;
32304
32421
  name: "allowUmdGlobalAccess",
32305
32422
  type: "boolean",
32306
32423
  affectsSemanticDiagnostics: true,
32424
+ affectsMultiFileEmitBuildInfo: true,
32307
32425
  category: ts.Diagnostics.Modules,
32308
32426
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
32309
32427
  defaultValueDescription: false,
@@ -32324,6 +32442,7 @@ var ts;
32324
32442
  name: "sourceRoot",
32325
32443
  type: "string",
32326
32444
  affectsEmit: true,
32445
+ affectsMultiFileEmitBuildInfo: true,
32327
32446
  paramType: ts.Diagnostics.LOCATION,
32328
32447
  category: ts.Diagnostics.Emit,
32329
32448
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -32332,6 +32451,7 @@ var ts;
32332
32451
  name: "mapRoot",
32333
32452
  type: "string",
32334
32453
  affectsEmit: true,
32454
+ affectsMultiFileEmitBuildInfo: true,
32335
32455
  paramType: ts.Diagnostics.LOCATION,
32336
32456
  category: ts.Diagnostics.Emit,
32337
32457
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -32340,6 +32460,7 @@ var ts;
32340
32460
  name: "inlineSourceMap",
32341
32461
  type: "boolean",
32342
32462
  affectsEmit: true,
32463
+ affectsMultiFileEmitBuildInfo: true,
32343
32464
  category: ts.Diagnostics.Emit,
32344
32465
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
32345
32466
  defaultValueDescription: false,
@@ -32348,6 +32469,7 @@ var ts;
32348
32469
  name: "inlineSources",
32349
32470
  type: "boolean",
32350
32471
  affectsEmit: true,
32472
+ affectsMultiFileEmitBuildInfo: true,
32351
32473
  category: ts.Diagnostics.Emit,
32352
32474
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
32353
32475
  defaultValueDescription: false,
@@ -32356,6 +32478,7 @@ var ts;
32356
32478
  name: "experimentalDecorators",
32357
32479
  type: "boolean",
32358
32480
  affectsSemanticDiagnostics: true,
32481
+ affectsMultiFileEmitBuildInfo: true,
32359
32482
  category: ts.Diagnostics.Language_and_Environment,
32360
32483
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
32361
32484
  defaultValueDescription: false,
@@ -32365,6 +32488,7 @@ var ts;
32365
32488
  type: "boolean",
32366
32489
  affectsSemanticDiagnostics: true,
32367
32490
  affectsEmit: true,
32491
+ affectsMultiFileEmitBuildInfo: true,
32368
32492
  category: ts.Diagnostics.Language_and_Environment,
32369
32493
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
32370
32494
  defaultValueDescription: false,
@@ -32388,6 +32512,7 @@ var ts;
32388
32512
  type: "string",
32389
32513
  affectsSemanticDiagnostics: true,
32390
32514
  affectsEmit: true,
32515
+ affectsMultiFileEmitBuildInfo: true,
32391
32516
  affectsModuleResolution: true,
32392
32517
  category: ts.Diagnostics.Language_and_Environment,
32393
32518
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -32405,6 +32530,9 @@ var ts;
32405
32530
  name: "out",
32406
32531
  type: "string",
32407
32532
  affectsEmit: true,
32533
+ affectsMultiFileEmitBuildInfo: true,
32534
+ affectsDeclarationPath: true,
32535
+ affectsBundleEmitBuildInfo: true,
32408
32536
  isFilePath: false,
32409
32537
  category: ts.Diagnostics.Backwards_Compatibility,
32410
32538
  paramType: ts.Diagnostics.FILE,
@@ -32415,6 +32543,7 @@ var ts;
32415
32543
  name: "reactNamespace",
32416
32544
  type: "string",
32417
32545
  affectsEmit: true,
32546
+ affectsMultiFileEmitBuildInfo: true,
32418
32547
  category: ts.Diagnostics.Language_and_Environment,
32419
32548
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
32420
32549
  defaultValueDescription: "`React`",
@@ -32422,6 +32551,7 @@ var ts;
32422
32551
  {
32423
32552
  name: "skipDefaultLibCheck",
32424
32553
  type: "boolean",
32554
+ affectsMultiFileEmitBuildInfo: true,
32425
32555
  category: ts.Diagnostics.Completeness,
32426
32556
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
32427
32557
  defaultValueDescription: false,
@@ -32437,6 +32567,7 @@ var ts;
32437
32567
  name: "emitBOM",
32438
32568
  type: "boolean",
32439
32569
  affectsEmit: true,
32570
+ affectsMultiFileEmitBuildInfo: true,
32440
32571
  category: ts.Diagnostics.Emit,
32441
32572
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
32442
32573
  defaultValueDescription: false,
@@ -32448,6 +32579,7 @@ var ts;
32448
32579
  lf: 1
32449
32580
  })),
32450
32581
  affectsEmit: true,
32582
+ affectsMultiFileEmitBuildInfo: true,
32451
32583
  paramType: ts.Diagnostics.NEWLINE,
32452
32584
  category: ts.Diagnostics.Emit,
32453
32585
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -32457,6 +32589,7 @@ var ts;
32457
32589
  name: "noErrorTruncation",
32458
32590
  type: "boolean",
32459
32591
  affectsSemanticDiagnostics: true,
32592
+ affectsMultiFileEmitBuildInfo: true,
32460
32593
  category: ts.Diagnostics.Output_Formatting,
32461
32594
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
32462
32595
  defaultValueDescription: false,
@@ -32483,6 +32616,7 @@ var ts;
32483
32616
  name: "stripInternal",
32484
32617
  type: "boolean",
32485
32618
  affectsEmit: true,
32619
+ affectsMultiFileEmitBuildInfo: true,
32486
32620
  category: ts.Diagnostics.Emit,
32487
32621
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
32488
32622
  defaultValueDescription: false,
@@ -32523,6 +32657,7 @@ var ts;
32523
32657
  name: "noImplicitUseStrict",
32524
32658
  type: "boolean",
32525
32659
  affectsSemanticDiagnostics: true,
32660
+ affectsMultiFileEmitBuildInfo: true,
32526
32661
  category: ts.Diagnostics.Backwards_Compatibility,
32527
32662
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
32528
32663
  defaultValueDescription: false,
@@ -32531,6 +32666,7 @@ var ts;
32531
32666
  name: "noEmitHelpers",
32532
32667
  type: "boolean",
32533
32668
  affectsEmit: true,
32669
+ affectsMultiFileEmitBuildInfo: true,
32534
32670
  category: ts.Diagnostics.Emit,
32535
32671
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
32536
32672
  defaultValueDescription: false,
@@ -32539,6 +32675,7 @@ var ts;
32539
32675
  name: "noEmitOnError",
32540
32676
  type: "boolean",
32541
32677
  affectsEmit: true,
32678
+ affectsMultiFileEmitBuildInfo: true,
32542
32679
  category: ts.Diagnostics.Emit,
32543
32680
  transpileOptionValue: undefined,
32544
32681
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -32548,6 +32685,7 @@ var ts;
32548
32685
  name: "preserveConstEnums",
32549
32686
  type: "boolean",
32550
32687
  affectsEmit: true,
32688
+ affectsMultiFileEmitBuildInfo: true,
32551
32689
  category: ts.Diagnostics.Emit,
32552
32690
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
32553
32691
  defaultValueDescription: false,
@@ -32556,6 +32694,8 @@ var ts;
32556
32694
  name: "declarationDir",
32557
32695
  type: "string",
32558
32696
  affectsEmit: true,
32697
+ affectsMultiFileEmitBuildInfo: true,
32698
+ affectsDeclarationPath: true,
32559
32699
  isFilePath: true,
32560
32700
  paramType: ts.Diagnostics.DIRECTORY,
32561
32701
  category: ts.Diagnostics.Emit,
@@ -32565,6 +32705,7 @@ var ts;
32565
32705
  {
32566
32706
  name: "skipLibCheck",
32567
32707
  type: "boolean",
32708
+ affectsMultiFileEmitBuildInfo: true,
32568
32709
  category: ts.Diagnostics.Completeness,
32569
32710
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
32570
32711
  defaultValueDescription: false,
@@ -32574,6 +32715,7 @@ var ts;
32574
32715
  type: "boolean",
32575
32716
  affectsBindDiagnostics: true,
32576
32717
  affectsSemanticDiagnostics: true,
32718
+ affectsMultiFileEmitBuildInfo: true,
32577
32719
  category: ts.Diagnostics.Type_Checking,
32578
32720
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
32579
32721
  defaultValueDescription: undefined,
@@ -32583,6 +32725,7 @@ var ts;
32583
32725
  type: "boolean",
32584
32726
  affectsBindDiagnostics: true,
32585
32727
  affectsSemanticDiagnostics: true,
32728
+ affectsMultiFileEmitBuildInfo: true,
32586
32729
  category: ts.Diagnostics.Type_Checking,
32587
32730
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
32588
32731
  defaultValueDescription: undefined,
@@ -32591,6 +32734,7 @@ var ts;
32591
32734
  name: "suppressExcessPropertyErrors",
32592
32735
  type: "boolean",
32593
32736
  affectsSemanticDiagnostics: true,
32737
+ affectsMultiFileEmitBuildInfo: true,
32594
32738
  category: ts.Diagnostics.Backwards_Compatibility,
32595
32739
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
32596
32740
  defaultValueDescription: false,
@@ -32599,6 +32743,7 @@ var ts;
32599
32743
  name: "suppressImplicitAnyIndexErrors",
32600
32744
  type: "boolean",
32601
32745
  affectsSemanticDiagnostics: true,
32746
+ affectsMultiFileEmitBuildInfo: true,
32602
32747
  category: ts.Diagnostics.Backwards_Compatibility,
32603
32748
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
32604
32749
  defaultValueDescription: false,
@@ -32623,6 +32768,7 @@ var ts;
32623
32768
  name: "noStrictGenericChecks",
32624
32769
  type: "boolean",
32625
32770
  affectsSemanticDiagnostics: true,
32771
+ affectsMultiFileEmitBuildInfo: true,
32626
32772
  category: ts.Diagnostics.Backwards_Compatibility,
32627
32773
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
32628
32774
  defaultValueDescription: false,
@@ -32632,6 +32778,7 @@ var ts;
32632
32778
  type: "boolean",
32633
32779
  affectsSemanticDiagnostics: true,
32634
32780
  affectsEmit: true,
32781
+ affectsMultiFileEmitBuildInfo: true,
32635
32782
  category: ts.Diagnostics.Language_and_Environment,
32636
32783
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
32637
32784
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -32640,6 +32787,7 @@ var ts;
32640
32787
  name: "preserveValueImports",
32641
32788
  type: "boolean",
32642
32789
  affectsEmit: true,
32790
+ affectsMultiFileEmitBuildInfo: true,
32643
32791
  category: ts.Diagnostics.Emit,
32644
32792
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
32645
32793
  defaultValueDescription: false,
@@ -32678,6 +32826,7 @@ var ts;
32678
32826
  ts.optionDeclarations = __spreadArray(__spreadArray([], ts.commonOptionsWithBuild, true), commandOptionsWithoutBuild, true);
32679
32827
  ts.semanticDiagnosticsOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsSemanticDiagnostics; });
32680
32828
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
32829
+ ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
32681
32830
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
32682
32831
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
32683
32832
  return !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics;
@@ -33457,6 +33606,7 @@ var ts;
33457
33606
  }
33458
33607
  });
33459
33608
  }
33609
+ ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
33460
33610
  function serializeCompilerOptions(options, pathOptions) {
33461
33611
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
33462
33612
  }
@@ -34437,16 +34587,18 @@ var ts;
34437
34587
  ts.Debug.assert(ts.extensionIsTS(resolved.extension));
34438
34588
  return { fileName: resolved.path, packageId: resolved.packageId };
34439
34589
  }
34440
- function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, diagnostics, resultFromCache) {
34441
- var _a;
34590
+ function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
34591
+ var _a, _b;
34442
34592
  if (resultFromCache) {
34443
34593
  (_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
34594
+ (_b = resultFromCache.affectingLocations).push.apply(_b, affectingLocations);
34444
34595
  return resultFromCache;
34445
34596
  }
34446
34597
  return {
34447
34598
  resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
34448
34599
  failedLookupLocations: failedLookupLocations,
34449
- resolutionDiagnostics: diagnostics
34600
+ affectingLocations: affectingLocations,
34601
+ resolutionDiagnostics: diagnostics,
34450
34602
  };
34451
34603
  }
34452
34604
  function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
@@ -34622,6 +34774,7 @@ var ts;
34622
34774
  }
34623
34775
  }
34624
34776
  var failedLookupLocations = [];
34777
+ var affectingLocations = [];
34625
34778
  var features = getDefaultNodeResolutionFeatures(options);
34626
34779
  if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext)) {
34627
34780
  features |= NodeResolutionFeatures.EsmMode;
@@ -34633,6 +34786,7 @@ var ts;
34633
34786
  host: host,
34634
34787
  traceEnabled: traceEnabled,
34635
34788
  failedLookupLocations: failedLookupLocations,
34789
+ affectingLocations: affectingLocations,
34636
34790
  packageJsonInfoCache: cache,
34637
34791
  features: features,
34638
34792
  conditions: conditions,
@@ -34657,7 +34811,7 @@ var ts;
34657
34811
  isExternalLibraryImport: pathContainsNodeModules(fileName),
34658
34812
  };
34659
34813
  }
34660
- result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, resolutionDiagnostics: diagnostics };
34814
+ result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, affectingLocations: affectingLocations, resolutionDiagnostics: diagnostics };
34661
34815
  perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, resolutionMode, result);
34662
34816
  if (traceEnabled)
34663
34817
  traceResult(result);
@@ -34731,6 +34885,7 @@ var ts;
34731
34885
  host: host,
34732
34886
  traceEnabled: isTraceEnabled(options, host),
34733
34887
  failedLookupLocations: [],
34888
+ affectingLocations: [],
34734
34889
  packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
34735
34890
  conditions: ts.emptyArray,
34736
34891
  features: NodeResolutionFeatures.None,
@@ -35264,6 +35419,7 @@ var ts;
35264
35419
  var _a, _b;
35265
35420
  var traceEnabled = isTraceEnabled(compilerOptions, host);
35266
35421
  var failedLookupLocations = [];
35422
+ var affectingLocations = [];
35267
35423
  var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
35268
35424
  if (compilerOptions.noDtsResolution) {
35269
35425
  conditions.pop();
@@ -35274,6 +35430,7 @@ var ts;
35274
35430
  host: host,
35275
35431
  traceEnabled: traceEnabled,
35276
35432
  failedLookupLocations: failedLookupLocations,
35433
+ affectingLocations: affectingLocations,
35277
35434
  packageJsonInfoCache: cache,
35278
35435
  features: features,
35279
35436
  conditions: conditions,
@@ -35281,7 +35438,7 @@ var ts;
35281
35438
  reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
35282
35439
  };
35283
35440
  var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
35284
- return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, diagnostics, state.resultFromCache);
35441
+ return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
35285
35442
  function tryResolve(extensions) {
35286
35443
  var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, true); };
35287
35444
  var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
@@ -35539,6 +35696,7 @@ var ts;
35539
35696
  host: host,
35540
35697
  traceEnabled: isTraceEnabled(options, host),
35541
35698
  failedLookupLocations: [],
35699
+ affectingLocations: [],
35542
35700
  packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
35543
35701
  conditions: ["node", "require", "types"],
35544
35702
  features: features,
@@ -35620,6 +35778,7 @@ var ts;
35620
35778
  compilerOptions: options,
35621
35779
  traceEnabled: isTraceEnabled(options, host),
35622
35780
  failedLookupLocations: [],
35781
+ affectingLocations: [],
35623
35782
  packageJsonInfoCache: packageJsonInfoCache,
35624
35783
  features: 0,
35625
35784
  conditions: [],
@@ -35651,6 +35810,7 @@ var ts;
35651
35810
  if (typeof existing !== "boolean") {
35652
35811
  if (traceEnabled)
35653
35812
  trace(host, ts.Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath);
35813
+ state.affectingLocations.push(packageJsonPath);
35654
35814
  return existing;
35655
35815
  }
35656
35816
  else {
@@ -35669,6 +35829,7 @@ var ts;
35669
35829
  var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
35670
35830
  var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined };
35671
35831
  (_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
35832
+ state.affectingLocations.push(packageJsonPath);
35672
35833
  return result;
35673
35834
  }
35674
35835
  else {
@@ -36259,11 +36420,23 @@ var ts;
36259
36420
  function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
36260
36421
  var traceEnabled = isTraceEnabled(compilerOptions, host);
36261
36422
  var failedLookupLocations = [];
36423
+ var affectingLocations = [];
36262
36424
  var containingDirectory = ts.getDirectoryPath(containingFile);
36263
36425
  var diagnostics = [];
36264
- var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.None, conditions: [], requestContainingDirectory: containingDirectory, reportDiagnostic: function (diag) { return void diagnostics.push(diag); } };
36426
+ var state = {
36427
+ compilerOptions: compilerOptions,
36428
+ host: host,
36429
+ traceEnabled: traceEnabled,
36430
+ failedLookupLocations: failedLookupLocations,
36431
+ affectingLocations: affectingLocations,
36432
+ packageJsonInfoCache: cache,
36433
+ features: NodeResolutionFeatures.None,
36434
+ conditions: [],
36435
+ requestContainingDirectory: containingDirectory,
36436
+ reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
36437
+ };
36265
36438
  var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
36266
- return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations, diagnostics, state.resultFromCache);
36439
+ return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
36267
36440
  function tryResolve(extensions) {
36268
36441
  var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
36269
36442
  if (resolvedUsingSettings) {
@@ -36299,10 +36472,22 @@ var ts;
36299
36472
  trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, projectName, moduleName, globalCache);
36300
36473
  }
36301
36474
  var failedLookupLocations = [];
36475
+ var affectingLocations = [];
36302
36476
  var diagnostics = [];
36303
- var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: packageJsonInfoCache, features: NodeResolutionFeatures.None, conditions: [], requestContainingDirectory: undefined, reportDiagnostic: function (diag) { return void diagnostics.push(diag); } };
36477
+ var state = {
36478
+ compilerOptions: compilerOptions,
36479
+ host: host,
36480
+ traceEnabled: traceEnabled,
36481
+ failedLookupLocations: failedLookupLocations,
36482
+ affectingLocations: affectingLocations,
36483
+ packageJsonInfoCache: packageJsonInfoCache,
36484
+ features: NodeResolutionFeatures.None,
36485
+ conditions: [],
36486
+ requestContainingDirectory: undefined,
36487
+ reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
36488
+ };
36304
36489
  var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, false, undefined, undefined);
36305
- return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations, diagnostics, state.resultFromCache);
36490
+ return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
36306
36491
  }
36307
36492
  ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
36308
36493
  function toSearchResult(value) {
@@ -43119,6 +43304,9 @@ var ts;
43119
43304
  var typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
43120
43305
  if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32))
43121
43306
  return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""), typeArgumentNodes);
43307
+ if (ts.length(typeArgumentNodes) === 1 && type.aliasSymbol === globalArrayType.symbol) {
43308
+ return ts.factory.createArrayTypeNode(typeArgumentNodes[0]);
43309
+ }
43122
43310
  return symbolToTypeNode(type.aliasSymbol, context, 788968, typeArgumentNodes);
43123
43311
  }
43124
43312
  var objectFlags = ts.getObjectFlags(type);
@@ -43286,7 +43474,7 @@ var ts;
43286
43474
  }
43287
43475
  else if (symbol.flags & 32
43288
43476
  && !getBaseTypeVariableOfClass(symbol)
43289
- && !(symbol.valueDeclaration && symbol.valueDeclaration.kind === 226 && context.flags & 2048) ||
43477
+ && !(symbol.valueDeclaration && ts.isClassLike(symbol.valueDeclaration) && context.flags & 2048 && (!ts.isClassDeclaration(symbol.valueDeclaration) || isSymbolAccessible(symbol, context.enclosingDeclaration, isInstanceType, false).accessibility !== 0)) ||
43290
43478
  symbol.flags & (384 | 512) ||
43291
43479
  shouldWriteTypeOfFunctionSymbol()) {
43292
43480
  return symbolToTypeNode(symbol, context, isInstanceType);
@@ -46386,6 +46574,17 @@ var ts;
46386
46574
  }
46387
46575
  });
46388
46576
  var result = createAnonymousType(initialSize !== members_4.size ? undefined : exportedType.symbol, members_4, exportedType.callSignatures, exportedType.constructSignatures, exportedType.indexInfos);
46577
+ if (initialSize === members_4.size) {
46578
+ if (type.aliasSymbol) {
46579
+ result.aliasSymbol = type.aliasSymbol;
46580
+ result.aliasTypeArguments = type.aliasTypeArguments;
46581
+ }
46582
+ if (ts.getObjectFlags(type) & 4) {
46583
+ result.aliasSymbol = type.symbol;
46584
+ var args = getTypeArguments(type);
46585
+ result.aliasTypeArguments = ts.length(args) ? args : undefined;
46586
+ }
46587
+ }
46389
46588
  result.objectFlags |= (ts.getObjectFlags(type) & 4096);
46390
46589
  if (result.symbol && result.symbol.flags & 32 && type === getDeclaredTypeOfClassOrInterface(result.symbol)) {
46391
46590
  result.objectFlags |= 16777216;
@@ -59400,10 +59599,10 @@ var ts;
59400
59599
  }
59401
59600
  function narrowTypeByTypeFacts(type, impliedType, facts) {
59402
59601
  return mapType(type, function (t) {
59403
- return isTypeSubtypeOf(impliedType, t) ? impliedType :
59404
- !(getTypeFacts(t) & facts) ? neverType :
59405
- isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? t :
59406
- getIntersectionType([t, impliedType]);
59602
+ return isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? getTypeFacts(t) & facts ? t : neverType :
59603
+ isTypeSubtypeOf(impliedType, t) ? impliedType :
59604
+ getTypeFacts(t) & facts ? getIntersectionType([t, impliedType]) :
59605
+ neverType;
59407
59606
  });
59408
59607
  }
59409
59608
  function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
@@ -75781,9 +75980,7 @@ var ts;
75781
75980
  var ts;
75782
75981
  (function (ts) {
75783
75982
  function createSourceMapGenerator(host, file, sourceRoot, sourcesDirectoryPath, generatorOptions) {
75784
- var _a = generatorOptions.extendedDiagnostics
75785
- ? ts.performance.createTimer("Source Map", "beforeSourcemap", "afterSourcemap")
75786
- : ts.performance.nullTimer, enter = _a.enter, exit = _a.exit;
75983
+ var _a = ts.performance.createTimerIf(!!generatorOptions.extendedDiagnostics, "Source Map", "beforeSourcemap", "afterSourcemap"), enter = _a.enter, exit = _a.exit;
75787
75984
  var rawSources = [];
75788
75985
  var sources = [];
75789
75986
  var sourceToSourceIndexMap = new ts.Map();
@@ -90877,7 +91074,8 @@ var ts;
90877
91074
  return;
90878
91075
  }
90879
91076
  var version = ts.version;
90880
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), false);
91077
+ var buildInfo = { bundle: bundle, program: program, version: version };
91078
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), false, undefined, { buildInfo: buildInfo });
90881
91079
  }
90882
91080
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
90883
91081
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -91018,12 +91216,17 @@ var ts;
91018
91216
  if (sourceMapFilePath) {
91019
91217
  var sourceMap = sourceMapGenerator.toString();
91020
91218
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, false, sourceFiles);
91219
+ if (printer.bundleFileInfo)
91220
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
91021
91221
  }
91022
91222
  }
91023
91223
  else {
91024
91224
  writer.writeLine();
91025
91225
  }
91026
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
91226
+ var text = writer.getText();
91227
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
91228
+ if (printer.bundleFileInfo)
91229
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
91027
91230
  writer.clear();
91028
91231
  }
91029
91232
  function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
@@ -91148,30 +91351,50 @@ var ts;
91148
91351
  });
91149
91352
  }
91150
91353
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
91354
+ var createHash = ts.maybeBind(host, host.createHash);
91151
91355
  var _a = getOutputPathsForBundle(config.options, false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
91152
- var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
91153
- if (!buildInfoText)
91356
+ var buildInfo;
91357
+ if (host.getBuildInfo) {
91358
+ var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
91359
+ if (!hostBuildInfo)
91360
+ return buildInfoPath;
91361
+ buildInfo = hostBuildInfo;
91362
+ }
91363
+ else {
91364
+ var buildInfoText = host.readFile(buildInfoPath);
91365
+ if (!buildInfoText)
91366
+ return buildInfoPath;
91367
+ buildInfo = getBuildInfo(buildInfoText);
91368
+ }
91369
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
91154
91370
  return buildInfoPath;
91155
91371
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
91156
91372
  if (!jsFileText)
91157
91373
  return jsFilePath;
91374
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
91375
+ return jsFilePath;
91158
91376
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
91159
91377
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
91160
91378
  return sourceMapFilePath || "inline sourcemap decoding";
91379
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
91380
+ return sourceMapFilePath;
91161
91381
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
91162
91382
  if (declarationFilePath && !declarationText)
91163
91383
  return declarationFilePath;
91384
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
91385
+ return declarationFilePath;
91164
91386
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
91165
91387
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
91166
91388
  return declarationMapPath || "inline sourcemap decoding";
91167
- var buildInfo = getBuildInfo(buildInfoText);
91168
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
91169
- return buildInfoPath;
91389
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
91390
+ return declarationMapPath;
91170
91391
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
91171
91392
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo, true);
91172
91393
  var outputFiles = [];
91173
91394
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
91174
91395
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
91396
+ var changedDtsText;
91397
+ var changedDtsData;
91175
91398
  var emitHost = {
91176
91399
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
91177
91400
  getCanonicalFileName: host.getCanonicalFileName,
@@ -91187,7 +91410,7 @@ var ts;
91187
91410
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
91188
91411
  getProjectReferenceRedirect: ts.returnUndefined,
91189
91412
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
91190
- writeFile: function (name, text, writeByteOrderMark) {
91413
+ writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
91191
91414
  switch (name) {
91192
91415
  case jsFilePath:
91193
91416
  if (jsFileText === text)
@@ -91198,19 +91421,25 @@ var ts;
91198
91421
  return;
91199
91422
  break;
91200
91423
  case buildInfoPath:
91201
- var newBuildInfo = getBuildInfo(text);
91424
+ var newBuildInfo = data.buildInfo;
91202
91425
  newBuildInfo.program = buildInfo.program;
91426
+ if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
91427
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
91428
+ newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
91429
+ }
91203
91430
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
91204
91431
  newBuildInfo.bundle.js.sources = js.sources;
91205
91432
  if (dts) {
91206
91433
  newBuildInfo.bundle.dts.sources = dts.sources;
91207
91434
  }
91208
91435
  newBuildInfo.bundle.sourceFiles = sourceFiles;
91209
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
91436
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
91210
91437
  return;
91211
91438
  case declarationFilePath:
91212
91439
  if (declarationText === text)
91213
91440
  return;
91441
+ changedDtsText = text;
91442
+ changedDtsData = data;
91214
91443
  break;
91215
91444
  case declarationMapPath:
91216
91445
  if (declarationMapText === text)
@@ -91229,6 +91458,7 @@ var ts;
91229
91458
  getSourceFileFromReference: ts.returnUndefined,
91230
91459
  redirectTargetsMap: ts.createMultiMap(),
91231
91460
  getFileIncludeReasons: ts.notImplemented,
91461
+ createHash: createHash,
91232
91462
  };
91233
91463
  emitFiles(ts.notImplementedResolver, emitHost, undefined, ts.getTransformers(config.options, customTransformers));
91234
91464
  return outputFiles;
@@ -95853,7 +96083,6 @@ var ts;
95853
96083
  if (system === void 0) { system = ts.sys; }
95854
96084
  var existingDirectories = new ts.Map();
95855
96085
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
95856
- var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
95857
96086
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
95858
96087
  var text;
95859
96088
  try {
@@ -95883,7 +96112,7 @@ var ts;
95883
96112
  function writeFile(fileName, data, writeByteOrderMark, onError) {
95884
96113
  try {
95885
96114
  ts.performance.mark("beforeIOWrite");
95886
- 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); });
96115
+ 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); });
95887
96116
  ts.performance.mark("afterIOWrite");
95888
96117
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
95889
96118
  }
@@ -95893,34 +96122,6 @@ var ts;
95893
96122
  }
95894
96123
  }
95895
96124
  }
95896
- var outputFingerprints;
95897
- function writeFileWorker(fileName, data, writeByteOrderMark) {
95898
- if (!ts.isWatchSet(options) || !system.getModifiedTime) {
95899
- system.writeFile(fileName, data, writeByteOrderMark);
95900
- return;
95901
- }
95902
- if (!outputFingerprints) {
95903
- outputFingerprints = new ts.Map();
95904
- }
95905
- var hash = computeHash(data);
95906
- var mtimeBefore = system.getModifiedTime(fileName);
95907
- if (mtimeBefore) {
95908
- var fingerprint = outputFingerprints.get(fileName);
95909
- if (fingerprint &&
95910
- fingerprint.byteOrderMark === writeByteOrderMark &&
95911
- fingerprint.hash === hash &&
95912
- fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
95913
- return;
95914
- }
95915
- }
95916
- system.writeFile(fileName, data, writeByteOrderMark);
95917
- var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
95918
- outputFingerprints.set(fileName, {
95919
- hash: hash,
95920
- byteOrderMark: writeByteOrderMark,
95921
- mtime: mtimeAfter
95922
- });
95923
- }
95924
96125
  function getDefaultLibLocation() {
95925
96126
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
95926
96127
  }
@@ -97294,6 +97495,7 @@ var ts;
97294
97495
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
97295
97496
  redirectTargetsMap: redirectTargetsMap,
97296
97497
  getFileIncludeReasons: program.getFileIncludeReasons,
97498
+ createHash: ts.maybeBind(host, host.createHash),
97297
97499
  };
97298
97500
  }
97299
97501
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -99200,13 +99402,9 @@ var ts;
99200
99402
  function createManyToManyPathMap() {
99201
99403
  function create(forward, reverse, deleted) {
99202
99404
  var map = {
99203
- clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
99204
- forEach: function (fn) { return forward.forEach(fn); },
99205
99405
  getKeys: function (v) { return reverse.get(v); },
99206
99406
  getValues: function (k) { return forward.get(k); },
99207
- hasKey: function (k) { return forward.has(k); },
99208
99407
  keys: function () { return forward.keys(); },
99209
- deletedKeys: function () { return deleted; },
99210
99408
  deleteKey: function (k) {
99211
99409
  (deleted || (deleted = new ts.Set())).add(k);
99212
99410
  var set = forward.get(k);
@@ -99233,11 +99431,6 @@ var ts;
99233
99431
  });
99234
99432
  return map;
99235
99433
  },
99236
- clear: function () {
99237
- forward.clear();
99238
- reverse.clear();
99239
- deleted === null || deleted === void 0 ? void 0 : deleted.clear();
99240
- }
99241
99434
  };
99242
99435
  return map;
99243
99436
  }
@@ -99341,35 +99534,45 @@ var ts;
99341
99534
  }
99342
99535
  BuilderState.canReuseOldState = canReuseOldState;
99343
99536
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
99537
+ var _a, _b, _c;
99344
99538
  var fileInfos = new ts.Map();
99345
99539
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
99346
99540
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
99347
- var hasCalledUpdateShapeSignature = new ts.Set();
99348
99541
  var useOldState = canReuseOldState(referencedMap, oldState);
99349
99542
  newProgram.getTypeChecker();
99350
- for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
99351
- var sourceFile = _a[_i];
99543
+ for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
99544
+ var sourceFile = _d[_i];
99352
99545
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
99353
- var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
99546
+ var oldUncommittedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
99547
+ var signature = oldUncommittedSignature === undefined ?
99548
+ useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
99549
+ oldUncommittedSignature || undefined;
99354
99550
  if (referencedMap) {
99355
99551
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
99356
99552
  if (newReferences) {
99357
99553
  referencedMap.set(sourceFile.resolvedPath, newReferences);
99358
99554
  }
99359
99555
  if (useOldState) {
99360
- var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
99556
+ var oldUncommittedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
99557
+ var exportedModules = oldUncommittedExportedModules === undefined ?
99558
+ oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
99559
+ oldUncommittedExportedModules || undefined;
99361
99560
  if (exportedModules) {
99362
99561
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
99363
99562
  }
99364
99563
  }
99365
99564
  }
99366
- fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
99565
+ fileInfos.set(sourceFile.resolvedPath, {
99566
+ version: version_2,
99567
+ signature: signature,
99568
+ affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
99569
+ impliedFormat: sourceFile.impliedNodeFormat
99570
+ });
99367
99571
  }
99368
99572
  return {
99369
99573
  fileInfos: fileInfos,
99370
99574
  referencedMap: referencedMap,
99371
99575
  exportedModulesMap: exportedModulesMap,
99372
- hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
99373
99576
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
99374
99577
  };
99375
99578
  }
@@ -99379,52 +99582,36 @@ var ts;
99379
99582
  state.allFileNames = undefined;
99380
99583
  }
99381
99584
  BuilderState.releaseCache = releaseCache;
99382
- function clone(state) {
99585
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
99383
99586
  var _a, _b;
99384
- return {
99385
- fileInfos: new ts.Map(state.fileInfos),
99386
- referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
99387
- exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
99388
- hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
99389
- useFileVersionAsSignature: state.useFileVersionAsSignature,
99390
- };
99587
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
99588
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
99589
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
99590
+ return result;
99391
99591
  }
99392
- BuilderState.clone = clone;
99393
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
99394
- var signatureCache = cacheToUpdateSignature || new ts.Map();
99592
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
99593
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
99395
99594
  var sourceFile = programOfThisState.getSourceFileByPath(path);
99396
99595
  if (!sourceFile) {
99397
99596
  return ts.emptyArray;
99398
99597
  }
99399
- if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
99598
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
99400
99599
  return [sourceFile];
99401
99600
  }
99402
- var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
99403
- if (!cacheToUpdateSignature) {
99404
- updateSignaturesFromCache(state, signatureCache);
99405
- }
99406
- return result;
99407
- }
99408
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
99409
- function updateSignaturesFromCache(state, signatureCache) {
99410
- signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
99601
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
99411
99602
  }
99412
- BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
99603
+ BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
99413
99604
  function updateSignatureOfFile(state, signature, path) {
99414
99605
  state.fileInfos.get(path).signature = signature;
99415
- state.hasCalledUpdateShapeSignature.add(path);
99606
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
99416
99607
  }
99417
99608
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
99418
- function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
99609
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
99610
+ var _a;
99419
99611
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
99420
- ts.Debug.assert(!!sourceFile);
99421
- ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
99422
- if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
99612
+ if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
99423
99613
  return false;
99424
- }
99425
99614
  var info = state.fileInfos.get(sourceFile.resolvedPath);
99426
- if (!info)
99427
- return ts.Debug.fail();
99428
99615
  var prevSignature = info.signature;
99429
99616
  var latestSignature;
99430
99617
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -99432,40 +99619,50 @@ var ts;
99432
99619
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
99433
99620
  if (firstDts_1) {
99434
99621
  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; })); });
99435
- latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
99436
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
99437
- updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
99622
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
99623
+ if (latestSignature !== prevSignature) {
99624
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
99438
99625
  }
99439
99626
  }
99440
99627
  }
99441
99628
  if (latestSignature === undefined) {
99442
99629
  latestSignature = sourceFile.version;
99443
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
99630
+ if (state.exportedModulesMap && latestSignature !== prevSignature) {
99631
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
99444
99632
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
99445
99633
  if (references) {
99446
- exportedModulesMapCache.set(sourceFile.resolvedPath, references);
99634
+ state.exportedModulesMap.set(sourceFile.resolvedPath, references);
99447
99635
  }
99448
99636
  else {
99449
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
99637
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
99450
99638
  }
99451
99639
  }
99452
99640
  }
99453
- cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
99641
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
99642
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
99643
+ info.signature = latestSignature;
99454
99644
  return latestSignature !== prevSignature;
99455
99645
  }
99456
99646
  BuilderState.updateShapeSignature = updateShapeSignature;
99457
- function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
99647
+ function computeSignature(text, computeHash) {
99648
+ return (computeHash || ts.generateDjb2Hash)(text);
99649
+ }
99650
+ BuilderState.computeSignature = computeSignature;
99651
+ function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
99652
+ if (!state.exportedModulesMap)
99653
+ return;
99654
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
99458
99655
  if (!exportedModulesFromDeclarationEmit) {
99459
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
99656
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
99460
99657
  return;
99461
99658
  }
99462
99659
  var exportedModules;
99463
99660
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
99464
99661
  if (exportedModules) {
99465
- exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
99662
+ state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
99466
99663
  }
99467
99664
  else {
99468
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
99665
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
99469
99666
  }
99470
99667
  function addExportedModule(exportedModulePaths) {
99471
99668
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -99477,15 +99674,6 @@ var ts;
99477
99674
  }
99478
99675
  }
99479
99676
  BuilderState.updateExportedModules = updateExportedModules;
99480
- function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
99481
- var _a;
99482
- if (exportedModulesMapCache) {
99483
- ts.Debug.assert(!!state.exportedModulesMap);
99484
- (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
99485
- exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
99486
- }
99487
- }
99488
- BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
99489
99677
  function getAllDependencies(state, programOfThisState, sourceFile) {
99490
99678
  var compilerOptions = programOfThisState.getCompilerOptions();
99491
99679
  if (ts.outFile(compilerOptions)) {
@@ -99569,7 +99757,7 @@ var ts;
99569
99757
  }
99570
99758
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
99571
99759
  }
99572
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
99760
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
99573
99761
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
99574
99762
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
99575
99763
  }
@@ -99585,7 +99773,7 @@ var ts;
99585
99773
  if (!seenFileNamesMap.has(currentPath)) {
99586
99774
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
99587
99775
  seenFileNamesMap.set(currentPath, currentSourceFile);
99588
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
99776
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
99589
99777
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
99590
99778
  }
99591
99779
  }
@@ -99600,29 +99788,31 @@ var ts;
99600
99788
  return map1 === map2 || map1 !== undefined && map2 !== undefined && map1.size === map2.size && !ts.forEachKey(map1, function (key) { return !map2.has(key); });
99601
99789
  }
99602
99790
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
99791
+ var _a, _b;
99603
99792
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
99604
99793
  state.program = newProgram;
99605
99794
  var compilerOptions = newProgram.getCompilerOptions();
99606
99795
  state.compilerOptions = compilerOptions;
99607
- if (!ts.outFile(compilerOptions)) {
99796
+ var outFilePath = ts.outFile(compilerOptions);
99797
+ if (!outFilePath) {
99608
99798
  state.semanticDiagnosticsPerFile = new ts.Map();
99609
99799
  }
99800
+ 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)) {
99801
+ state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
99802
+ }
99610
99803
  state.changedFilesSet = new ts.Set();
99804
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
99611
99805
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
99612
99806
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
99613
99807
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
99614
99808
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
99809
+ var canCopyEmitSignatures = compilerOptions.composite &&
99810
+ (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
99811
+ !outFilePath &&
99812
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
99615
99813
  if (useOldState) {
99616
- if (!oldState.currentChangedFilePath) {
99617
- var affectedSignatures = oldState.currentAffectedFilesSignatures;
99618
- ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
99619
- }
99620
- var changedFilesSet = oldState.changedFilesSet;
99621
- if (canCopySemanticDiagnostics) {
99622
- ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
99623
- }
99624
- changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
99625
- if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
99814
+ (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
99815
+ if (!outFilePath && oldState.affectedFilesPendingEmit) {
99626
99816
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
99627
99817
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
99628
99818
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -99639,6 +99829,7 @@ var ts;
99639
99829
  if (!useOldState ||
99640
99830
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
99641
99831
  oldInfo.version !== info.version ||
99832
+ oldInfo.impliedFormat !== info.impliedFormat ||
99642
99833
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
99643
99834
  newReferences && ts.forEachKey(newReferences, function (path) { return !state.fileInfos.has(path) && oldState.fileInfos.has(path); })) {
99644
99835
  state.changedFilesSet.add(sourceFilePath);
@@ -99658,24 +99849,22 @@ var ts;
99658
99849
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
99659
99850
  }
99660
99851
  }
99852
+ if (canCopyEmitSignatures) {
99853
+ var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
99854
+ if (oldEmitSignature)
99855
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
99856
+ }
99661
99857
  });
99662
99858
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
99663
99859
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, undefined)
99664
99860
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
99665
99861
  }
99666
- else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
99862
+ else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
99667
99863
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1); });
99668
99864
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
99669
99865
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
99670
99866
  }
99671
- if (useOldState) {
99672
- ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
99673
- if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
99674
- state.changedFilesSet.add(sourceFilePath);
99675
- }
99676
- });
99677
- }
99678
- state.buildInfoEmitPending = !!state.changedFilesSet.size;
99867
+ state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
99679
99868
  return state;
99680
99869
  }
99681
99870
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -99708,33 +99897,40 @@ var ts;
99708
99897
  ts.BuilderState.releaseCache(state);
99709
99898
  state.program = undefined;
99710
99899
  }
99711
- function cloneBuilderProgramState(state) {
99712
- var _a;
99713
- var newState = ts.BuilderState.clone(state);
99714
- newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
99715
- newState.changedFilesSet = new ts.Set(state.changedFilesSet);
99716
- newState.affectedFiles = state.affectedFiles;
99717
- newState.affectedFilesIndex = state.affectedFilesIndex;
99718
- newState.currentChangedFilePath = state.currentChangedFilePath;
99719
- newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
99720
- newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
99721
- newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
99722
- newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
99723
- newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
99724
- newState.program = state.program;
99725
- newState.compilerOptions = state.compilerOptions;
99726
- newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
99727
- newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
99728
- newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
99729
- newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
99730
- newState.programEmitComplete = state.programEmitComplete;
99731
- return newState;
99900
+ function backupBuilderProgramEmitState(state) {
99901
+ var outFilePath = ts.outFile(state.compilerOptions);
99902
+ ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
99903
+ return {
99904
+ affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
99905
+ affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
99906
+ affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
99907
+ seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
99908
+ programEmitComplete: state.programEmitComplete,
99909
+ emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
99910
+ outSignature: state.outSignature,
99911
+ dtsChangeTime: state.dtsChangeTime,
99912
+ hasChangedEmitSignature: state.hasChangedEmitSignature,
99913
+ changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
99914
+ };
99915
+ }
99916
+ function restoreBuilderProgramEmitState(state, savedEmitState) {
99917
+ state.affectedFilesPendingEmit = savedEmitState.affectedFilesPendingEmit;
99918
+ state.affectedFilesPendingEmitKind = savedEmitState.affectedFilesPendingEmitKind;
99919
+ state.affectedFilesPendingEmitIndex = savedEmitState.affectedFilesPendingEmitIndex;
99920
+ state.seenEmittedFiles = savedEmitState.seenEmittedFiles;
99921
+ state.programEmitComplete = savedEmitState.programEmitComplete;
99922
+ state.emitSignatures = savedEmitState.emitSignatures;
99923
+ state.outSignature = savedEmitState.outSignature;
99924
+ state.dtsChangeTime = savedEmitState.dtsChangeTime;
99925
+ state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
99926
+ if (savedEmitState.changedFilesSet)
99927
+ state.changedFilesSet = savedEmitState.changedFilesSet;
99732
99928
  }
99733
99929
  function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
99734
99930
  ts.Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
99735
99931
  }
99736
99932
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
99737
- var _a;
99933
+ var _a, _b;
99738
99934
  while (true) {
99739
99935
  var affectedFiles = state.affectedFiles;
99740
99936
  if (affectedFiles) {
@@ -99751,10 +99947,8 @@ var ts;
99751
99947
  }
99752
99948
  state.changedFilesSet.delete(state.currentChangedFilePath);
99753
99949
  state.currentChangedFilePath = undefined;
99754
- ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
99755
- state.currentAffectedFilesSignatures.clear();
99756
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
99757
- (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
99950
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
99951
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
99758
99952
  state.affectedFiles = undefined;
99759
99953
  }
99760
99954
  var nextKey = state.changedFilesSet.keys().next();
@@ -99767,12 +99961,7 @@ var ts;
99767
99961
  ts.Debug.assert(!state.semanticDiagnosticsPerFile);
99768
99962
  return program;
99769
99963
  }
99770
- if (!state.currentAffectedFilesSignatures)
99771
- state.currentAffectedFilesSignatures = new ts.Map();
99772
- if (state.exportedModulesMap) {
99773
- state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
99774
- }
99775
- state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
99964
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
99776
99965
  state.currentChangedFilePath = nextKey.value;
99777
99966
  state.affectedFilesIndex = 0;
99778
99967
  if (!state.seenAffectedFiles)
@@ -99816,14 +100005,12 @@ var ts;
99816
100005
  }
99817
100006
  }
99818
100007
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
99819
- var _a;
99820
100008
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
99821
100009
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
99822
100010
  removeDiagnosticsOfLibraryFiles(state);
99823
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
100011
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
99824
100012
  return;
99825
100013
  }
99826
- 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);
99827
100014
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
99828
100015
  return;
99829
100016
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -99834,7 +100021,7 @@ var ts;
99834
100021
  var program = ts.Debug.checkDefined(state.program);
99835
100022
  var sourceFile = program.getSourceFileByPath(path);
99836
100023
  if (sourceFile) {
99837
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
100024
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
99838
100025
  if (ts.getEmitDeclarations(state.compilerOptions)) {
99839
100026
  addToAffectedFilesPendingEmit(state, path, 0);
99840
100027
  }
@@ -99850,24 +100037,10 @@ var ts;
99850
100037
  return !state.semanticDiagnosticsFromOldState.size;
99851
100038
  }
99852
100039
  function isChangedSignature(state, path) {
99853
- var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
99854
- var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
100040
+ var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
100041
+ var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
99855
100042
  return newSignature !== oldSignature;
99856
100043
  }
99857
- function forEachKeyOfExportedModulesMap(state, filePath, fn) {
99858
- var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
99859
- var result = keys && ts.forEachKey(keys, fn);
99860
- if (result)
99861
- return result;
99862
- keys = state.exportedModulesMap.getKeys(filePath);
99863
- return keys && ts.forEachKey(keys, function (exportedFromPath) {
99864
- var _a;
99865
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
99866
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
99867
- fn(exportedFromPath) :
99868
- undefined;
99869
- });
99870
- }
99871
100044
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
99872
100045
  var _a;
99873
100046
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -99878,6 +100051,7 @@ var ts;
99878
100051
  return true;
99879
100052
  }
99880
100053
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
100054
+ var _a;
99881
100055
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
99882
100056
  return;
99883
100057
  if (!isChangedSignature(state, affectedFile.resolvedPath))
@@ -99900,9 +100074,8 @@ var ts;
99900
100074
  }
99901
100075
  }
99902
100076
  }
99903
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
99904
100077
  var seenFileAndExportsOfFile = new ts.Set();
99905
- forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
100078
+ (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
99906
100079
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
99907
100080
  return true;
99908
100081
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -99912,17 +100085,16 @@ var ts;
99912
100085
  });
99913
100086
  }
99914
100087
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
99915
- var _a;
100088
+ var _a, _b;
99916
100089
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
99917
100090
  return undefined;
99918
100091
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
99919
100092
  return true;
99920
100093
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
99921
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
99922
- forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
100094
+ (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
99923
100095
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
99924
100096
  });
99925
- (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
100097
+ (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
99926
100098
  return !seenFileAndExportsOfFile.has(referencingFilePath) &&
99927
100099
  handleDtsMayChangeOf(state, referencingFilePath, cancellationToken, computeHash, host);
99928
100100
  });
@@ -99938,12 +100110,12 @@ var ts;
99938
100110
  }
99939
100111
  else {
99940
100112
  state.seenAffectedFiles.add(affected.resolvedPath);
100113
+ state.buildInfoEmitPending = true;
99941
100114
  if (emitKind !== undefined) {
99942
100115
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
99943
100116
  }
99944
100117
  if (isPendingEmit) {
99945
100118
  state.affectedFilesPendingEmitIndex++;
99946
- state.buildInfoEmitPending = true;
99947
100119
  }
99948
100120
  else {
99949
100121
  state.affectedFilesIndex++;
@@ -99975,29 +100147,65 @@ var ts;
99975
100147
  }
99976
100148
  return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
99977
100149
  }
99978
- function getProgramBuildInfo(state, getCanonicalFileName) {
99979
- if (ts.outFile(state.compilerOptions))
99980
- return undefined;
100150
+ function isProgramBundleEmitBuildInfo(info) {
100151
+ return !!ts.outFile(info.options || {});
100152
+ }
100153
+ ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
100154
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
100155
+ var outFilePath = ts.outFile(state.compilerOptions);
100156
+ if (outFilePath && !state.compilerOptions.composite)
100157
+ return;
99981
100158
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
99982
100159
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
100160
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
100161
+ if (outFilePath) {
100162
+ var fileNames_1 = [];
100163
+ var fileInfos_1 = [];
100164
+ state.program.getRootFileNames().forEach(function (f) {
100165
+ var sourceFile = state.program.getSourceFile(f);
100166
+ if (!sourceFile)
100167
+ return;
100168
+ fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
100169
+ fileInfos_1.push(sourceFile.version);
100170
+ });
100171
+ var result_15 = {
100172
+ fileNames: fileNames_1,
100173
+ fileInfos: fileInfos_1,
100174
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
100175
+ outSignature: state.outSignature,
100176
+ dtsChangeTime: state.dtsChangeTime,
100177
+ };
100178
+ return result_15;
100179
+ }
99983
100180
  var fileNames = [];
99984
100181
  var fileNameToFileId = new ts.Map();
99985
100182
  var fileIdsList;
99986
100183
  var fileNamesToFileIdListId;
100184
+ var emitSignatures;
99987
100185
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
100186
+ var _b, _c;
99988
100187
  var key = _a[0], value = _a[1];
99989
100188
  var fileId = toFileId(key);
99990
100189
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
99991
- var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
99992
- var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
100190
+ var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
100191
+ var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
100192
+ if (state.compilerOptions.composite) {
100193
+ var file = state.program.getSourceFileByPath(key);
100194
+ if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
100195
+ var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
100196
+ if (emitSignature !== actualSignature) {
100197
+ (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
100198
+ }
100199
+ }
100200
+ }
99993
100201
  return value.version === actualSignature ?
99994
100202
  value.affectsGlobalScope || value.impliedFormat ?
99995
100203
  { version: value.version, signature: undefined, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
99996
100204
  value.version :
99997
100205
  actualSignature !== undefined ?
99998
- signature === undefined ?
100206
+ oldSignature === undefined ?
99999
100207
  value :
100000
- { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
100208
+ { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
100001
100209
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
100002
100210
  });
100003
100211
  var referencedMap;
@@ -100011,16 +100219,12 @@ var ts;
100011
100219
  if (state.exportedModulesMap) {
100012
100220
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
100013
100221
  var _a;
100014
- if (state.currentAffectedFilesExportedModulesMap) {
100015
- if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
100016
- return undefined;
100017
- }
100018
- var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
100019
- if (newValue) {
100020
- return [toFileId(key), toFileIdListId(newValue)];
100021
- }
100022
- }
100023
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
100222
+ var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
100223
+ if (oldValue === undefined)
100224
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
100225
+ if (oldValue)
100226
+ return [toFileId(key), toFileIdListId(oldValue)];
100227
+ return undefined;
100024
100228
  });
100025
100229
  }
100026
100230
  var semanticDiagnosticsPerFile;
@@ -100031,9 +100235,7 @@ var ts;
100031
100235
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
100032
100236
  [
100033
100237
  toFileId(key),
100034
- state.hasReusableDiagnostic ?
100035
- value :
100036
- convertToReusableDiagnostics(value, relativeToBuildInfo)
100238
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
100037
100239
  ] :
100038
100240
  toFileId(key));
100039
100241
  }
@@ -100048,16 +100250,27 @@ var ts;
100048
100250
  }
100049
100251
  }
100050
100252
  }
100051
- return {
100253
+ var changeFileSet;
100254
+ if (state.changedFilesSet.size) {
100255
+ for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
100256
+ var path = _e[_d];
100257
+ (changeFileSet || (changeFileSet = [])).push(toFileId(path));
100258
+ }
100259
+ }
100260
+ var result = {
100052
100261
  fileNames: fileNames,
100053
100262
  fileInfos: fileInfos,
100054
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
100263
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
100055
100264
  fileIdsList: fileIdsList,
100056
100265
  referencedMap: referencedMap,
100057
100266
  exportedModulesMap: exportedModulesMap,
100058
100267
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
100059
100268
  affectedFilesPendingEmit: affectedFilesPendingEmit,
100269
+ changeFileSet: changeFileSet,
100270
+ emitSignatures: emitSignatures,
100271
+ dtsChangeTime: state.dtsChangeTime,
100060
100272
  };
100273
+ return result;
100061
100274
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
100062
100275
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
100063
100276
  }
@@ -100082,21 +100295,18 @@ var ts;
100082
100295
  }
100083
100296
  return fileIdListId;
100084
100297
  }
100085
- }
100086
- function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
100087
- var result;
100088
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
100089
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
100090
- var name = _a[_i];
100091
- var optionKey = name.toLowerCase();
100092
- var optionInfo = optionsNameMap.get(optionKey);
100093
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
100094
- optionKey === "strict" ||
100095
- optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
100096
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
100298
+ function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
100299
+ var result;
100300
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
100301
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
100302
+ var name = _a[_i];
100303
+ var optionInfo = optionsNameMap.get(name.toLowerCase());
100304
+ if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
100305
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
100306
+ }
100097
100307
  }
100308
+ return result;
100098
100309
  }
100099
- return result;
100100
100310
  }
100101
100311
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
100102
100312
  if (option) {
@@ -100170,6 +100380,10 @@ var ts;
100170
100380
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
100171
100381
  }
100172
100382
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
100383
+ function computeSignature(text, data, computeHash) {
100384
+ return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
100385
+ }
100386
+ ts.computeSignature = computeSignature;
100173
100387
  function createBuilderProgram(kind, _a) {
100174
100388
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
100175
100389
  var oldState = oldProgram && oldProgram.getState();
@@ -100181,29 +100395,19 @@ var ts;
100181
100395
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
100182
100396
  var computeHash = ts.maybeBind(host, host.createHash);
100183
100397
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
100184
- var backupState;
100185
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
100398
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
100186
100399
  newProgram = undefined;
100187
100400
  oldProgram = undefined;
100188
100401
  oldState = undefined;
100189
100402
  var getState = function () { return state; };
100190
100403
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
100191
100404
  builderProgram.getState = getState;
100192
- builderProgram.backupState = function () {
100193
- ts.Debug.assert(backupState === undefined);
100194
- backupState = cloneBuilderProgramState(state);
100195
- };
100196
- builderProgram.restoreState = function () {
100197
- state = ts.Debug.checkDefined(backupState);
100198
- backupState = undefined;
100199
- };
100405
+ builderProgram.saveEmitState = function () { return backupBuilderProgramEmitState(state); };
100406
+ builderProgram.restoreEmitState = function (saved) { return restoreBuilderProgramEmitState(state, saved); };
100200
100407
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
100201
100408
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
100202
100409
  builderProgram.emit = emit;
100203
- builderProgram.releaseProgram = function () {
100204
- releaseCache(state);
100205
- backupState = undefined;
100206
- };
100410
+ builderProgram.releaseProgram = function () { return releaseCache(state); };
100207
100411
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
100208
100412
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
100209
100413
  }
@@ -100248,35 +100452,57 @@ var ts;
100248
100452
  affected = program;
100249
100453
  }
100250
100454
  }
100251
- return toAffectedFileEmitResult(state, ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
100252
- getWriteFileUpdatingSignatureCallback(writeFile) :
100455
+ return toAffectedFileEmitResult(state, ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
100456
+ getWriteFileCallback(writeFile, customTransformers) :
100253
100457
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0, customTransformers), affected, emitKind, isPendingEmitFile);
100254
100458
  }
100255
- function getWriteFileUpdatingSignatureCallback(writeFile) {
100459
+ function getWriteFileCallback(writeFile, customTransformers) {
100256
100460
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
100257
- var _a;
100461
+ var _a, _b, _c;
100258
100462
  if (ts.isDeclarationFileName(fileName)) {
100259
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
100260
- var file = sourceFiles[0];
100261
- var info = state.fileInfos.get(file.resolvedPath);
100262
- var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
100263
- if (signature === file.version) {
100264
- var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
100265
- if (newSignature !== file.version) {
100266
- if (host.storeFilesChangingSignatureDuringEmit)
100267
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
100268
- if (state.exportedModulesMap)
100269
- ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
100270
- if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
100271
- state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
100463
+ if (!ts.outFile(state.compilerOptions)) {
100464
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
100465
+ var newSignature = void 0;
100466
+ if (!customTransformers) {
100467
+ var file = sourceFiles[0];
100468
+ var info = state.fileInfos.get(file.resolvedPath);
100469
+ if (info.signature === file.version) {
100470
+ newSignature = computeSignature(text, data, computeHash);
100471
+ if (newSignature !== file.version) {
100472
+ if (host.storeFilesChangingSignatureDuringEmit)
100473
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
100474
+ if (state.exportedModulesMap)
100475
+ ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
100476
+ if (state.affectedFiles) {
100477
+ var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
100478
+ if (existing === undefined)
100479
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
100480
+ info.signature = newSignature;
100481
+ }
100482
+ else {
100483
+ info.signature = newSignature;
100484
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
100485
+ }
100486
+ }
100272
100487
  }
100273
- else {
100274
- info.signature = newSignature;
100275
- if (state.exportedModulesMap)
100276
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
100488
+ }
100489
+ if (state.compilerOptions.composite) {
100490
+ var filePath = sourceFiles[0].resolvedPath;
100491
+ var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
100492
+ newSignature || (newSignature = computeSignature(text, data, computeHash));
100493
+ if (newSignature !== oldSignature) {
100494
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
100495
+ state.hasChangedEmitSignature = true;
100277
100496
  }
100278
100497
  }
100279
100498
  }
100499
+ else if (state.compilerOptions.composite) {
100500
+ var newSignature = computeSignature(text, data, computeHash);
100501
+ if (newSignature !== state.outSignature) {
100502
+ state.outSignature = newSignature;
100503
+ state.hasChangedEmitSignature = true;
100504
+ }
100505
+ }
100280
100506
  }
100281
100507
  if (writeFile)
100282
100508
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -100325,8 +100551,8 @@ var ts;
100325
100551
  }
100326
100552
  }
100327
100553
  }
100328
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
100329
- getWriteFileUpdatingSignatureCallback(writeFile) :
100554
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
100555
+ getWriteFileCallback(writeFile, customTransformers) :
100330
100556
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
100331
100557
  }
100332
100558
  function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
@@ -100389,29 +100615,58 @@ var ts;
100389
100615
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
100390
100616
  }
100391
100617
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
100392
- function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
100393
- var _a;
100618
+ function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
100619
+ var _a, _b, _c, _d;
100394
100620
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
100395
100621
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
100396
- var filePaths = program.fileNames.map(toPath);
100397
- var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
100398
- var fileInfos = new ts.Map();
100399
- program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
100400
- var state = {
100401
- fileInfos: fileInfos,
100402
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
100403
- referencedMap: toManyToManyPathMap(program.referencedMap),
100404
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
100405
- 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]; }),
100406
- hasReusableDiagnostic: true,
100407
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
100408
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
100409
- affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
100410
- };
100622
+ var state;
100623
+ var filePaths;
100624
+ var filePathsSetList;
100625
+ if (isProgramBundleEmitBuildInfo(program)) {
100626
+ state = {
100627
+ fileInfos: new ts.Map(),
100628
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
100629
+ dtsChangeTime: program.dtsChangeTime,
100630
+ outSignature: program.outSignature,
100631
+ };
100632
+ }
100633
+ else {
100634
+ filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
100635
+ filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
100636
+ var fileInfos_2 = new ts.Map();
100637
+ var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
100638
+ program.fileInfos.forEach(function (fileInfo, index) {
100639
+ var path = toFilePath(index + 1);
100640
+ var stateFileInfo = toBuilderStateFileInfo(fileInfo);
100641
+ fileInfos_2.set(path, stateFileInfo);
100642
+ if (emitSignatures_1 && stateFileInfo.signature)
100643
+ emitSignatures_1.set(path, stateFileInfo.signature);
100644
+ });
100645
+ (_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
100646
+ if (ts.isNumber(value))
100647
+ emitSignatures_1.delete(toFilePath(value));
100648
+ else
100649
+ emitSignatures_1.set(toFilePath(value[0]), value[1]);
100650
+ });
100651
+ state = {
100652
+ fileInfos: fileInfos_2,
100653
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
100654
+ referencedMap: toManyToManyPathMap(program.referencedMap),
100655
+ exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
100656
+ 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]; }),
100657
+ hasReusableDiagnostic: true,
100658
+ affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
100659
+ affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
100660
+ affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
100661
+ changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
100662
+ dtsChangeTime: program.dtsChangeTime,
100663
+ emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
100664
+ };
100665
+ }
100411
100666
  return {
100412
100667
  getState: function () { return state; },
100413
- backupState: ts.noop,
100414
- restoreState: ts.noop,
100668
+ saveEmitState: ts.noop,
100669
+ restoreEmitState: ts.noop,
100415
100670
  getProgram: ts.notImplemented,
100416
100671
  getProgramOrUndefined: ts.returnUndefined,
100417
100672
  releaseProgram: ts.noop,
@@ -100456,12 +100711,24 @@ var ts;
100456
100711
  return map;
100457
100712
  }
100458
100713
  }
100459
- ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
100714
+ ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
100715
+ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
100716
+ var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
100717
+ var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
100718
+ var fileInfos = new ts.Map();
100719
+ program.fileInfos.forEach(function (fileInfo, index) {
100720
+ var path = ts.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
100721
+ var version = ts.isString(fileInfo) ? fileInfo : fileInfo.version;
100722
+ fileInfos.set(path, version);
100723
+ });
100724
+ return fileInfos;
100725
+ }
100726
+ ts.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap;
100460
100727
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
100461
100728
  return {
100462
100729
  getState: ts.notImplemented,
100463
- backupState: ts.noop,
100464
- restoreState: ts.noop,
100730
+ saveEmitState: ts.noop,
100731
+ restoreEmitState: ts.noop,
100465
100732
  getProgram: getProgram,
100466
100733
  getProgramOrUndefined: function () { return getState().program; },
100467
100734
  releaseProgram: function () { return getState().program = undefined; },
@@ -100552,8 +100819,10 @@ var ts;
100552
100819
  var filesWithInvalidatedNonRelativeUnresolvedImports;
100553
100820
  var nonRelativeExternalModuleResolutions = ts.createMultiMap();
100554
100821
  var resolutionsWithFailedLookups = [];
100822
+ var resolutionsWithOnlyAffectingLocations = [];
100555
100823
  var resolvedFileToResolution = ts.createMultiMap();
100556
100824
  var hasChangedAutomaticTypeDirectiveNames = false;
100825
+ var affectingPathChecks;
100557
100826
  var failedLookupChecks;
100558
100827
  var startsWithPathChecks;
100559
100828
  var isInDirectoryChecks;
@@ -100569,6 +100838,7 @@ var ts;
100569
100838
  var failedLookupDefaultExtensions = [".ts", ".tsx", ".js", ".jsx", ".json"];
100570
100839
  var customFailedLookupPaths = new ts.Map();
100571
100840
  var directoryWatchesOfFailedLookups = new ts.Map();
100841
+ var fileWatchesOfAffectingLocations = new ts.Map();
100572
100842
  var rootDir = rootDirForResolution && ts.removeTrailingDirectorySeparator(ts.getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()));
100573
100843
  var rootPath = (rootDir && resolutionHost.toPath(rootDir));
100574
100844
  var rootSplitLength = rootPath !== undefined ? rootPath.split(ts.directorySeparator).length : 0;
@@ -100608,6 +100878,7 @@ var ts;
100608
100878
  }
100609
100879
  function clear() {
100610
100880
  ts.clearMap(directoryWatchesOfFailedLookups, ts.closeFileWatcherOf);
100881
+ ts.clearMap(fileWatchesOfAffectingLocations, ts.closeFileWatcherOf);
100611
100882
  customFailedLookupPaths.clear();
100612
100883
  nonRelativeExternalModuleResolutions.clear();
100613
100884
  closeTypeRootsWatch();
@@ -100615,9 +100886,11 @@ var ts;
100615
100886
  resolvedTypeReferenceDirectives.clear();
100616
100887
  resolvedFileToResolution.clear();
100617
100888
  resolutionsWithFailedLookups.length = 0;
100889
+ resolutionsWithOnlyAffectingLocations.length = 0;
100618
100890
  failedLookupChecks = undefined;
100619
100891
  startsWithPathChecks = undefined;
100620
100892
  isInDirectoryChecks = undefined;
100893
+ affectingPathChecks = undefined;
100621
100894
  clearPerDirectoryResolutions();
100622
100895
  hasChangedAutomaticTypeDirectiveNames = false;
100623
100896
  }
@@ -100662,20 +100935,28 @@ var ts;
100662
100935
  watcher.watcher.close();
100663
100936
  }
100664
100937
  });
100938
+ fileWatchesOfAffectingLocations.forEach(function (watcher, path) {
100939
+ if (watcher.refCount === 0) {
100940
+ fileWatchesOfAffectingLocations.delete(path);
100941
+ watcher.watcher.close();
100942
+ watcher.watcher = ts.noopFileWatcher;
100943
+ }
100944
+ });
100665
100945
  hasChangedAutomaticTypeDirectiveNames = false;
100666
100946
  }
100667
100947
  function resolveModuleName(moduleName, containingFile, compilerOptions, host, redirectedReference, _containingSourceFile, mode) {
100668
- var _a;
100948
+ var _a, _b;
100669
100949
  var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
100670
100950
  if (!resolutionHost.getGlobalCache) {
100671
100951
  return primaryResult;
100672
100952
  }
100673
100953
  var globalCache = resolutionHost.getGlobalCache();
100674
100954
  if (globalCache !== undefined && !ts.isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && ts.extensionIsTS(primaryResult.resolvedModule.extension))) {
100675
- var _b = ts.loadModuleFromGlobalCache(ts.Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName), resolutionHost.projectName, compilerOptions, host, globalCache, moduleResolutionCache), resolvedModule = _b.resolvedModule, failedLookupLocations = _b.failedLookupLocations;
100955
+ var _c = ts.loadModuleFromGlobalCache(ts.Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName), resolutionHost.projectName, compilerOptions, host, globalCache, moduleResolutionCache), resolvedModule = _c.resolvedModule, failedLookupLocations = _c.failedLookupLocations, affectingLocations = _c.affectingLocations;
100676
100956
  if (resolvedModule) {
100677
100957
  primaryResult.resolvedModule = resolvedModule;
100678
100958
  (_a = primaryResult.failedLookupLocations).push.apply(_a, failedLookupLocations);
100959
+ (_b = primaryResult.affectingLocations).push.apply(_b, affectingLocations);
100679
100960
  return primaryResult;
100680
100961
  }
100681
100962
  }
@@ -100909,10 +101190,11 @@ var ts;
100909
101190
  }
100910
101191
  function watchFailedLookupLocationOfResolution(resolution) {
100911
101192
  ts.Debug.assert(!!resolution.refCount);
100912
- var failedLookupLocations = resolution.failedLookupLocations;
100913
- if (!failedLookupLocations.length)
101193
+ var failedLookupLocations = resolution.failedLookupLocations, affectingLocations = resolution.affectingLocations;
101194
+ if (!failedLookupLocations.length && !affectingLocations.length)
100914
101195
  return;
100915
- resolutionsWithFailedLookups.push(resolution);
101196
+ if (failedLookupLocations.length)
101197
+ resolutionsWithFailedLookups.push(resolution);
100916
101198
  var setAtRoot = false;
100917
101199
  for (var _i = 0, failedLookupLocations_1 = failedLookupLocations; _i < failedLookupLocations_1.length; _i++) {
100918
101200
  var failedLookupLocation = failedLookupLocations_1[_i];
@@ -100936,12 +101218,65 @@ var ts;
100936
101218
  if (setAtRoot) {
100937
101219
  setDirectoryWatcher(rootDir, rootPath, true);
100938
101220
  }
101221
+ watchAffectingLocationsOfResolution(resolution, !failedLookupLocations.length);
101222
+ }
101223
+ function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
101224
+ ts.Debug.assert(!!resolution.refCount);
101225
+ if (addToResolutionsWithOnlyAffectingLocations)
101226
+ resolutionsWithOnlyAffectingLocations.push(resolution);
101227
+ var affectingLocations = resolution.affectingLocations;
101228
+ for (var _i = 0, affectingLocations_1 = affectingLocations; _i < affectingLocations_1.length; _i++) {
101229
+ var affectingLocation = affectingLocations_1[_i];
101230
+ createFileWatcherOfAffectingLocation(affectingLocation);
101231
+ }
101232
+ }
101233
+ function createFileWatcherOfAffectingLocation(affectingLocation) {
101234
+ var path = resolutionHost.toPath(affectingLocation);
101235
+ var fileWatcher = fileWatchesOfAffectingLocations.get(path);
101236
+ if (fileWatcher) {
101237
+ fileWatcher.refCount++;
101238
+ return;
101239
+ }
101240
+ var locationToWatch = affectingLocation;
101241
+ var locationToWatchPath = path;
101242
+ if (resolutionHost.realpath) {
101243
+ locationToWatch = resolutionHost.realpath(affectingLocation);
101244
+ locationToWatchPath = resolutionHost.toPath(locationToWatch);
101245
+ if (path !== locationToWatchPath) {
101246
+ var fileWatcher_1 = fileWatchesOfAffectingLocations.get(locationToWatchPath);
101247
+ if (fileWatcher_1) {
101248
+ fileWatcher_1.refCount++;
101249
+ fileWatcher_1.paths.add(path);
101250
+ fileWatchesOfAffectingLocations.set(path, fileWatcher_1);
101251
+ return;
101252
+ }
101253
+ }
101254
+ }
101255
+ var paths = new ts.Set();
101256
+ paths.add(locationToWatchPath);
101257
+ var watcher = {
101258
+ watcher: resolutionHost.watchAffectingFileLocation(locationToWatch, function (fileName, eventKind) {
101259
+ cachedDirectoryStructureHost === null || cachedDirectoryStructureHost === void 0 ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, path, eventKind);
101260
+ paths.forEach(function (path) { return (affectingPathChecks || (affectingPathChecks = new ts.Set())).add(path); });
101261
+ resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
101262
+ }),
101263
+ refCount: 1,
101264
+ paths: paths,
101265
+ };
101266
+ fileWatchesOfAffectingLocations.set(locationToWatchPath, watcher);
101267
+ if (path !== locationToWatchPath) {
101268
+ fileWatchesOfAffectingLocations.set(path, watcher);
101269
+ paths.add(path);
101270
+ }
100939
101271
  }
100940
101272
  function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
100941
101273
  var program = resolutionHost.getCurrentProgram();
100942
101274
  if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
100943
101275
  resolutions.forEach(watchFailedLookupLocationOfResolution);
100944
101276
  }
101277
+ else {
101278
+ resolutions.forEach(function (resolution) { return watchAffectingLocationsOfResolution(resolution, true); });
101279
+ }
100945
101280
  }
100946
101281
  function setDirectoryWatcher(dir, dirPath, nonRecursive) {
100947
101282
  var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
@@ -100963,37 +101298,44 @@ var ts;
100963
101298
  if (resolved && resolved.resolvedFileName) {
100964
101299
  resolvedFileToResolution.remove(resolutionHost.toPath(resolved.resolvedFileName), resolution);
100965
101300
  }
100966
- if (!ts.unorderedRemoveItem(resolutionsWithFailedLookups, resolution)) {
100967
- return;
100968
- }
100969
- var failedLookupLocations = resolution.failedLookupLocations;
100970
- var removeAtRoot = false;
100971
- for (var _i = 0, failedLookupLocations_2 = failedLookupLocations; _i < failedLookupLocations_2.length; _i++) {
100972
- var failedLookupLocation = failedLookupLocations_2[_i];
100973
- var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
100974
- var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
100975
- if (toWatch) {
100976
- var dirPath = toWatch.dirPath;
100977
- var refCount = customFailedLookupPaths.get(failedLookupLocationPath);
100978
- if (refCount) {
100979
- if (refCount === 1) {
100980
- customFailedLookupPaths.delete(failedLookupLocationPath);
101301
+ var failedLookupLocations = resolution.failedLookupLocations, affectingLocations = resolution.affectingLocations;
101302
+ if (ts.unorderedRemoveItem(resolutionsWithFailedLookups, resolution)) {
101303
+ var removeAtRoot = false;
101304
+ for (var _i = 0, failedLookupLocations_2 = failedLookupLocations; _i < failedLookupLocations_2.length; _i++) {
101305
+ var failedLookupLocation = failedLookupLocations_2[_i];
101306
+ var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
101307
+ var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
101308
+ if (toWatch) {
101309
+ var dirPath = toWatch.dirPath;
101310
+ var refCount = customFailedLookupPaths.get(failedLookupLocationPath);
101311
+ if (refCount) {
101312
+ if (refCount === 1) {
101313
+ customFailedLookupPaths.delete(failedLookupLocationPath);
101314
+ }
101315
+ else {
101316
+ ts.Debug.assert(refCount > 1);
101317
+ customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1);
101318
+ }
101319
+ }
101320
+ if (dirPath === rootPath) {
101321
+ removeAtRoot = true;
100981
101322
  }
100982
101323
  else {
100983
- ts.Debug.assert(refCount > 1);
100984
- customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1);
101324
+ removeDirectoryWatcher(dirPath);
100985
101325
  }
100986
101326
  }
100987
- if (dirPath === rootPath) {
100988
- removeAtRoot = true;
100989
- }
100990
- else {
100991
- removeDirectoryWatcher(dirPath);
100992
- }
100993
101327
  }
101328
+ if (removeAtRoot) {
101329
+ removeDirectoryWatcher(rootPath);
101330
+ }
101331
+ }
101332
+ else if (affectingLocations.length) {
101333
+ ts.unorderedRemoveItem(resolutionsWithOnlyAffectingLocations, resolution);
100994
101334
  }
100995
- if (removeAtRoot) {
100996
- removeDirectoryWatcher(rootPath);
101335
+ for (var _a = 0, affectingLocations_2 = affectingLocations; _a < affectingLocations_2.length; _a++) {
101336
+ var affectingLocation = affectingLocations_2[_a];
101337
+ var watcher = fileWatchesOfAffectingLocations.get(resolutionHost.toPath(affectingLocation));
101338
+ watcher.refCount--;
100997
101339
  }
100998
101340
  }
100999
101341
  function removeDirectoryWatcher(dirPath) {
@@ -101063,7 +101405,7 @@ var ts;
101063
101405
  }
101064
101406
  function scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, isCreatingWatchedDirectory) {
101065
101407
  if (isCreatingWatchedDirectory) {
101066
- (isInDirectoryChecks || (isInDirectoryChecks = [])).push(fileOrDirectoryPath);
101408
+ (isInDirectoryChecks || (isInDirectoryChecks = new ts.Set())).add(fileOrDirectoryPath);
101067
101409
  }
101068
101410
  else {
101069
101411
  var updatedPath = removeIgnoredPath(fileOrDirectoryPath);
@@ -101076,7 +101418,7 @@ var ts;
101076
101418
  var dirOfFileOrDirectory = ts.getDirectoryPath(fileOrDirectoryPath);
101077
101419
  if (isNodeModulesAtTypesDirectory(fileOrDirectoryPath) || ts.isNodeModulesDirectory(fileOrDirectoryPath) ||
101078
101420
  isNodeModulesAtTypesDirectory(dirOfFileOrDirectory) || ts.isNodeModulesDirectory(dirOfFileOrDirectory)) {
101079
- (failedLookupChecks || (failedLookupChecks = [])).push(fileOrDirectoryPath);
101421
+ (failedLookupChecks || (failedLookupChecks = new ts.Set())).add(fileOrDirectoryPath);
101080
101422
  (startsWithPathChecks || (startsWithPathChecks = new ts.Set())).add(fileOrDirectoryPath);
101081
101423
  }
101082
101424
  else {
@@ -101086,7 +101428,7 @@ var ts;
101086
101428
  if (ts.isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
101087
101429
  return false;
101088
101430
  }
101089
- (failedLookupChecks || (failedLookupChecks = [])).push(fileOrDirectoryPath);
101431
+ (failedLookupChecks || (failedLookupChecks = new ts.Set())).add(fileOrDirectoryPath);
101090
101432
  var packagePath = ts.parseNodeModuleFromPath(fileOrDirectoryPath);
101091
101433
  if (packagePath)
101092
101434
  (startsWithPathChecks || (startsWithPathChecks = new ts.Set())).add(packagePath);
@@ -101095,21 +101437,32 @@ var ts;
101095
101437
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
101096
101438
  }
101097
101439
  function invalidateResolutionsOfFailedLookupLocations() {
101098
- if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks) {
101440
+ if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks && !affectingPathChecks) {
101099
101441
  return false;
101100
101442
  }
101101
101443
  var invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution);
101102
101444
  failedLookupChecks = undefined;
101103
101445
  startsWithPathChecks = undefined;
101104
101446
  isInDirectoryChecks = undefined;
101447
+ invalidated = invalidateResolutions(resolutionsWithOnlyAffectingLocations, canInvalidatedFailedLookupResolutionWithAffectingLocation) || invalidated;
101448
+ affectingPathChecks = undefined;
101105
101449
  return invalidated;
101106
101450
  }
101107
101451
  function canInvalidateFailedLookupResolution(resolution) {
101452
+ if (canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution))
101453
+ return true;
101454
+ if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
101455
+ return false;
101108
101456
  return resolution.failedLookupLocations.some(function (location) {
101109
101457
  var locationPath = resolutionHost.toPath(location);
101110
- return ts.contains(failedLookupChecks, locationPath) ||
101458
+ return (failedLookupChecks === null || failedLookupChecks === void 0 ? void 0 : failedLookupChecks.has(locationPath)) ||
101111
101459
  ts.firstDefinedIterator((startsWithPathChecks === null || startsWithPathChecks === void 0 ? void 0 : startsWithPathChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return ts.startsWith(locationPath, fileOrDirectoryPath) ? true : undefined; }) ||
101112
- (isInDirectoryChecks === null || isInDirectoryChecks === void 0 ? void 0 : isInDirectoryChecks.some(function (fileOrDirectoryPath) { return isInDirectoryPath(fileOrDirectoryPath, locationPath); }));
101460
+ ts.firstDefinedIterator((isInDirectoryChecks === null || isInDirectoryChecks === void 0 ? void 0 : isInDirectoryChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : undefined; });
101461
+ });
101462
+ }
101463
+ function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
101464
+ return !!affectingPathChecks && resolution.affectingLocations.some(function (location) {
101465
+ return affectingPathChecks.has(resolutionHost.toPath(location));
101113
101466
  });
101114
101467
  }
101115
101468
  function closeTypeRootsWatch() {
@@ -101412,9 +101765,9 @@ var ts;
101412
101765
  var targets = importedFileNames.map(function (f) { return ts.getNormalizedAbsolutePath(f, cwd); });
101413
101766
  var shouldFilterIgnoredPaths = !ts.every(targets, ts.containsIgnoredPath);
101414
101767
  if (!preferSymlinks) {
101415
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
101416
- if (result_15)
101417
- return result_15;
101768
+ var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
101769
+ if (result_16)
101770
+ return result_16;
101418
101771
  }
101419
101772
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
101420
101773
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -101433,10 +101786,10 @@ var ts;
101433
101786
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
101434
101787
  var symlinkDirectory = symlinkDirectories_1[_i];
101435
101788
  var option = ts.resolvePath(symlinkDirectory, relative);
101436
- var result_16 = cb(option, target === referenceRedirect);
101789
+ var result_17 = cb(option, target === referenceRedirect);
101437
101790
  shouldFilterIgnoredPaths = true;
101438
- if (result_16)
101439
- return result_16;
101791
+ if (result_17)
101792
+ return result_17;
101440
101793
  }
101441
101794
  });
101442
101795
  });
@@ -102268,6 +102621,7 @@ var ts;
102268
102621
  readDirectory: ts.maybeBind(host, host.readDirectory),
102269
102622
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
102270
102623
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
102624
+ now: ts.maybeBind(host, host.now),
102271
102625
  };
102272
102626
  function writeFile(fileName, text, writeByteOrderMark, onError) {
102273
102627
  try {
@@ -102322,6 +102676,7 @@ var ts;
102322
102676
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
102323
102677
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
102324
102678
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
102679
+ now: ts.maybeBind(system, system.now),
102325
102680
  };
102326
102681
  }
102327
102682
  ts.createProgramHost = createProgramHost;
@@ -102377,20 +102732,26 @@ var ts;
102377
102732
  var ts;
102378
102733
  (function (ts) {
102379
102734
  function readBuilderProgram(compilerOptions, host) {
102380
- if (ts.outFile(compilerOptions))
102381
- return undefined;
102382
102735
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
102383
102736
  if (!buildInfoPath)
102384
102737
  return undefined;
102385
- var content = host.readFile(buildInfoPath);
102386
- if (!content)
102387
- return undefined;
102388
- var buildInfo = ts.getBuildInfo(content);
102738
+ var buildInfo;
102739
+ if (host.getBuildInfo) {
102740
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
102741
+ if (!buildInfo)
102742
+ return undefined;
102743
+ }
102744
+ else {
102745
+ var content = host.readFile(buildInfoPath);
102746
+ if (!content)
102747
+ return undefined;
102748
+ buildInfo = ts.getBuildInfo(content);
102749
+ }
102389
102750
  if (buildInfo.version !== ts.version)
102390
102751
  return undefined;
102391
102752
  if (!buildInfo.program)
102392
102753
  return undefined;
102393
- return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
102754
+ return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
102394
102755
  }
102395
102756
  ts.readBuilderProgram = readBuilderProgram;
102396
102757
  function createIncrementalCompilerHost(options, system) {
@@ -102399,6 +102760,7 @@ var ts;
102399
102760
  host.createHash = ts.maybeBind(system, system.createHash);
102400
102761
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
102401
102762
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
102763
+ host.now = ts.maybeBind(system, system.now);
102402
102764
  ts.setGetSourceFileAsHashVersioned(host, system);
102403
102765
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
102404
102766
  return host;
@@ -102443,7 +102805,6 @@ var ts;
102443
102805
  var builderProgram;
102444
102806
  var reloadLevel;
102445
102807
  var missingFilesMap;
102446
- var packageJsonMap;
102447
102808
  var watchedWildcardDirectories;
102448
102809
  var timerToUpdateProgram;
102449
102810
  var timerToInvalidateFailedLookupResolutions;
@@ -102504,6 +102865,7 @@ var ts;
102504
102865
  compilerHost.getCompilationSettings = function () { return compilerOptions; };
102505
102866
  compilerHost.useSourceOfProjectReferenceRedirect = ts.maybeBind(host, host.useSourceOfProjectReferenceRedirect);
102506
102867
  compilerHost.watchDirectoryOfFailedLookupLocation = function (dir, cb, flags) { return watchDirectory(dir, cb, flags, watchOptions, ts.WatchType.FailedLookupLocations); };
102868
+ compilerHost.watchAffectingFileLocation = function (file, cb) { return watchFile(file, cb, ts.PollingInterval.High, watchOptions, ts.WatchType.PackageJson); };
102507
102869
  compilerHost.watchTypeRootsDirectory = function (dir, cb, flags) { return watchDirectory(dir, cb, flags, watchOptions, ts.WatchType.TypeRoots); };
102508
102870
  compilerHost.getCachedDirectoryStructureHost = function () { return cachedDirectoryStructureHost; };
102509
102871
  compilerHost.scheduleInvalidateResolutionsOfFailedLookupLocations = scheduleInvalidateResolutionsOfFailedLookupLocations;
@@ -102581,10 +102943,6 @@ var ts;
102581
102943
  });
102582
102944
  parsedConfigs = undefined;
102583
102945
  }
102584
- if (packageJsonMap) {
102585
- ts.clearMap(packageJsonMap, ts.closeFileWatcher);
102586
- packageJsonMap = undefined;
102587
- }
102588
102946
  }
102589
102947
  function getCurrentBuilderProgram() {
102590
102948
  return builderProgram;
@@ -102638,13 +102996,8 @@ var ts;
102638
102996
  compilerHost.hasInvalidatedResolution = hasInvalidatedResolution;
102639
102997
  compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
102640
102998
  builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
102641
- var packageCacheEntries = ts.map(resolutionCache.getModuleResolutionCache().getPackageJsonInfoCache().entries(), function (_a) {
102642
- var path = _a[0], data = _a[1];
102643
- return [compilerHost.realpath ? toPath(compilerHost.realpath(path)) : path, data];
102644
- });
102645
102999
  resolutionCache.finishCachingPerDirectoryResolution();
102646
103000
  ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = new ts.Map()), watchMissingFilePath);
102647
- ts.updatePackageJsonWatch(packageCacheEntries, packageJsonMap || (packageJsonMap = new ts.Map()), watchPackageJsonLookupPath);
102648
103001
  if (needsUpdateInTypeRootWatch) {
102649
103002
  resolutionCache.updateTypeRootsWatch();
102650
103003
  }
@@ -102921,17 +103274,6 @@ var ts;
102921
103274
  ts.noopFileWatcher :
102922
103275
  watchFilePath(missingFilePath, missingFilePath, onMissingFileChange, ts.PollingInterval.Medium, watchOptions, ts.WatchType.MissingFile);
102923
103276
  }
102924
- function watchPackageJsonLookupPath(packageJsonPath) {
102925
- return sourceFilesCache.has(packageJsonPath) ?
102926
- ts.noopFileWatcher :
102927
- watchFilePath(packageJsonPath, packageJsonPath, onPackageJsonChange, ts.PollingInterval.High, watchOptions, ts.WatchType.PackageJson);
102928
- }
102929
- function onPackageJsonChange(fileName, eventKind, path) {
102930
- updateCachedSystemWithFile(fileName, path, eventKind);
102931
- reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
102932
- changesAffectResolution = true;
102933
- scheduleProgramUpdate();
102934
- }
102935
103277
  function onMissingFileChange(fileName, eventKind, missingFilePath) {
102936
103278
  updateCachedSystemWithFile(fileName, missingFilePath, eventKind);
102937
103279
  if (eventKind === ts.FileWatcherEventKind.Created && missingFilesMap.has(missingFilePath)) {
@@ -103062,11 +103404,14 @@ var ts;
103062
103404
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
103063
103405
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
103064
103406
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
103065
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
103066
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
103067
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
103068
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
103069
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
103407
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
103408
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
103409
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
103410
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
103411
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
103412
+ UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
103413
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
103414
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
103070
103415
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
103071
103416
  function resolveConfigFileProjectName(project) {
103072
103417
  if (ts.fileExtensionIs(project, ".json")) {
@@ -103104,9 +103449,10 @@ var ts;
103104
103449
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
103105
103450
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
103106
103451
  }
103107
- function newer(date1, date2) {
103108
- return date2 > date1 ? date2 : date1;
103452
+ function getCurrentTime(host) {
103453
+ return host.now ? host.now() : new Date();
103109
103454
  }
103455
+ ts.getCurrentTime = getCurrentTime;
103110
103456
  function isCircularBuildOrder(buildOrder) {
103111
103457
  return !!buildOrder && !!buildOrder.buildOrder;
103112
103458
  }
@@ -103190,6 +103536,7 @@ var ts;
103190
103536
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
103191
103537
  };
103192
103538
  }
103539
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), undefined); };
103193
103540
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
103194
103541
  var state = {
103195
103542
  host: host,
@@ -103205,8 +103552,9 @@ var ts;
103205
103552
  resolvedConfigFilePaths: new ts.Map(),
103206
103553
  configFileCache: new ts.Map(),
103207
103554
  projectStatus: new ts.Map(),
103208
- buildInfoChecked: new ts.Map(),
103209
103555
  extendedConfigCache: new ts.Map(),
103556
+ buildInfoCache: new ts.Map(),
103557
+ outputTimeStamps: new ts.Map(),
103210
103558
  builderPrograms: new ts.Map(),
103211
103559
  diagnostics: new ts.Map(),
103212
103560
  projectPendingBuild: new ts.Map(),
@@ -103227,6 +103575,7 @@ var ts;
103227
103575
  allWatchedConfigFiles: new ts.Map(),
103228
103576
  allWatchedExtendedConfigFiles: new ts.Map(),
103229
103577
  allWatchedPackageJsonFiles: new ts.Map(),
103578
+ filesWatched: new ts.Map(),
103230
103579
  lastCachedPackageJsonLookups: new ts.Map(),
103231
103580
  timerToBuildInvalidatedProject: undefined,
103232
103581
  reportFileChangeDetected: false,
@@ -103261,6 +103610,7 @@ var ts;
103261
103610
  if (value) {
103262
103611
  return isParsedCommandLine(value) ? value : undefined;
103263
103612
  }
103613
+ ts.buildPerformance.mark("beforeConfigFileParsing");
103264
103614
  var diagnostic;
103265
103615
  var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host;
103266
103616
  var parsed;
@@ -103275,6 +103625,8 @@ var ts;
103275
103625
  parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
103276
103626
  }
103277
103627
  configFileCache.set(configFilePath, parsed || diagnostic);
103628
+ ts.buildPerformance.mark("afterConfigFileParsing");
103629
+ ts.buildPerformance.measure("Config file parsing", "beforeConfigFileParsing", "afterConfigFileParsing");
103278
103630
  return parsed;
103279
103631
  }
103280
103632
  function resolveProjectName(state, name) {
@@ -103328,11 +103680,12 @@ var ts;
103328
103680
  var noopOnDelete = { onDeleteValue: ts.noop };
103329
103681
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
103330
103682
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
103331
- ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
103332
103683
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
103333
103684
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
103334
103685
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
103335
103686
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
103687
+ ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
103688
+ ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
103336
103689
  if (state.watch) {
103337
103690
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
103338
103691
  state.allWatchedExtendedConfigFiles.forEach(function (watcher) {
@@ -103466,6 +103819,7 @@ var ts;
103466
103819
  if (updateOutputFileStampsPending) {
103467
103820
  updateOutputTimestamps(state, config, projectPath);
103468
103821
  }
103822
+ ts.buildPerformance.mark("Timestamps only updates");
103469
103823
  return doneInvalidatedProject(state, projectPath);
103470
103824
  }
103471
103825
  };
@@ -103559,6 +103913,10 @@ var ts;
103559
103913
  };
103560
103914
  function done(cancellationToken, writeFile, customTransformers) {
103561
103915
  executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers);
103916
+ if (kind === InvalidatedProjectKind.Build)
103917
+ ts.buildPerformance.mark("Projects built");
103918
+ else
103919
+ ts.buildPerformance.mark("Bundles updated");
103562
103920
  return doneInvalidatedProject(state, projectPath);
103563
103921
  }
103564
103922
  function withProgramOrUndefined(action) {
@@ -103617,16 +103975,16 @@ var ts;
103617
103975
  }
103618
103976
  function emit(writeFileCallback, cancellationToken, customTransformers) {
103619
103977
  var _a;
103620
- var _b, _c;
103978
+ var _b, _c, _d;
103621
103979
  ts.Debug.assertIsDefined(program);
103622
103980
  ts.Debug.assert(step === BuildStep.Emit);
103623
- program.backupState();
103981
+ var saved = program.saveEmitState();
103624
103982
  var declDiagnostics;
103625
103983
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
103626
103984
  var outputFiles = [];
103627
- 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;
103985
+ 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;
103628
103986
  if (declDiagnostics) {
103629
- program.restoreState();
103987
+ program.restoreEmitState(saved);
103630
103988
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
103631
103989
  return {
103632
103990
  emitSkipped: true,
@@ -103635,35 +103993,43 @@ var ts;
103635
103993
  }
103636
103994
  var host = state.host, compilerHost = state.compilerHost;
103637
103995
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
103638
- var newestDeclarationFileContentChangedTime = minimumDate;
103639
- var anyDtsChanged = false;
103996
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
103640
103997
  var emitterDiagnostics = ts.createDiagnosticCollection();
103641
103998
  var emittedOutputs = new ts.Map();
103999
+ var options = program.getCompilerOptions();
104000
+ var isIncremental = ts.isIncrementalCompilation(options);
104001
+ var outputTimeStampMap;
104002
+ var now;
103642
104003
  outputFiles.forEach(function (_a) {
103643
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
103644
- var priorChangeTime;
103645
- if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
103646
- if (host.fileExists(name) && state.readFileWithCache(name) === text) {
103647
- priorChangeTime = host.getModifiedTime(name);
103648
- }
103649
- else {
104004
+ var _b, _c;
104005
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
104006
+ var path = toPath(state, name);
104007
+ emittedOutputs.set(toPath(state, name), name);
104008
+ if (buildInfo) {
104009
+ setBuildInfo(state, buildInfo, projectPath, options);
104010
+ 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)) {
103650
104011
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
103651
- anyDtsChanged = true;
103652
104012
  }
103653
104013
  }
103654
- emittedOutputs.set(toPath(state, name), name);
103655
104014
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
103656
- if (priorChangeTime !== undefined) {
103657
- newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
104015
+ if (!isIncremental && state.watch) {
104016
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
103658
104017
  }
103659
104018
  });
103660
- finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime, anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
104019
+ finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
103661
104020
  return emitResult;
103662
104021
  }
103663
104022
  function emitBuildInfo(writeFileCallback, cancellationToken) {
103664
104023
  ts.Debug.assertIsDefined(program);
103665
104024
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
103666
- var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
104025
+ var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
104026
+ if (data === null || data === void 0 ? void 0 : data.buildInfo)
104027
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
104028
+ if (writeFileCallback)
104029
+ writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
104030
+ else
104031
+ state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
104032
+ }, cancellationToken);
103667
104033
  if (emitResult.diagnostics.length) {
103668
104034
  reportErrors(state, emitResult.diagnostics);
103669
104035
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -103676,7 +104042,7 @@ var ts;
103676
104042
  step = BuildStep.QueueReferencingProjects;
103677
104043
  return emitResult;
103678
104044
  }
103679
- function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
104045
+ function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
103680
104046
  var _a;
103681
104047
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
103682
104048
  if (emitDiagnostics.length) {
@@ -103686,13 +104052,11 @@ var ts;
103686
104052
  if (state.write) {
103687
104053
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
103688
104054
  }
103689
- var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
104055
+ updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
103690
104056
  state.diagnostics.delete(projectPath);
103691
104057
  state.projectStatus.set(projectPath, {
103692
104058
  type: ts.UpToDateStatusType.UpToDate,
103693
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
103694
- maximumDate :
103695
- newestDeclarationFileContentChangedTime,
104059
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
103696
104060
  oldestOutputFileName: oldestOutputFileName
103697
104061
  });
103698
104062
  afterProgramDone(state, program, config);
@@ -103725,12 +104089,21 @@ var ts;
103725
104089
  ts.Debug.assert(!!outputFiles.length);
103726
104090
  var emitterDiagnostics = ts.createDiagnosticCollection();
103727
104091
  var emittedOutputs = new ts.Map();
104092
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
104093
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
103728
104094
  outputFiles.forEach(function (_a) {
103729
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
104095
+ var _b, _c;
104096
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
103730
104097
  emittedOutputs.set(toPath(state, name), name);
104098
+ if (buildInfo) {
104099
+ setBuildInfo(state, buildInfo, projectPath, config.options);
104100
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
104101
+ resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
104102
+ }
104103
+ }
103731
104104
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
103732
104105
  });
103733
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate, false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
104106
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
103734
104107
  return { emitSkipped: false, diagnostics: emitDiagnostics };
103735
104108
  }
103736
104109
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -103825,7 +104198,7 @@ var ts;
103825
104198
  }
103826
104199
  continue;
103827
104200
  }
103828
- if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
104201
+ if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
103829
104202
  reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
103830
104203
  return {
103831
104204
  kind: InvalidatedProjectKind.UpdateOutputFileStamps,
@@ -103875,9 +104248,7 @@ var ts;
103875
104248
  }
103876
104249
  function getNextInvalidatedProject(state, buildOrder, reportQueue) {
103877
104250
  var info = getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue);
103878
- if (!info)
103879
- return info;
103880
- return createInvalidatedProjectWithInfo(state, info, buildOrder);
104251
+ return info && createInvalidatedProjectWithInfo(state, info, buildOrder);
103881
104252
  }
103882
104253
  function listEmittedFile(_a, proj, file) {
103883
104254
  var write = _a.write;
@@ -103909,7 +104280,7 @@ var ts;
103909
104280
  state.projectCompilerOptions = state.baseCompilerOptions;
103910
104281
  }
103911
104282
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
103912
- var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
104283
+ var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
103913
104284
  reportAndStoreErrors(state, resolvedPath, diagnostics);
103914
104285
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
103915
104286
  if (canEmitBuildInfo)
@@ -103917,8 +104288,94 @@ var ts;
103917
104288
  afterProgramDone(state, program, config);
103918
104289
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
103919
104290
  }
104291
+ function isFileWatcherWithModifiedTime(value) {
104292
+ return !!value.watcher;
104293
+ }
104294
+ function getModifiedTime(state, fileName) {
104295
+ var path = toPath(state, fileName);
104296
+ var existing = state.filesWatched.get(path);
104297
+ if (state.watch && !!existing) {
104298
+ if (!isFileWatcherWithModifiedTime(existing))
104299
+ return existing;
104300
+ if (existing.modifiedTime)
104301
+ return existing.modifiedTime;
104302
+ }
104303
+ var result = ts.getModifiedTime(state.host, fileName);
104304
+ if (state.watch) {
104305
+ if (existing)
104306
+ existing.modifiedTime = result;
104307
+ else
104308
+ state.filesWatched.set(path, result);
104309
+ }
104310
+ return result;
104311
+ }
104312
+ function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
104313
+ var path = toPath(state, file);
104314
+ var existing = state.filesWatched.get(path);
104315
+ if (existing && isFileWatcherWithModifiedTime(existing)) {
104316
+ existing.callbacks.push(callback);
104317
+ }
104318
+ else {
104319
+ var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
104320
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
104321
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
104322
+ existing.modifiedTime = modifiedTime;
104323
+ existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
104324
+ }, pollingInterval, options, watchType, project);
104325
+ state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
104326
+ }
104327
+ return {
104328
+ close: function () {
104329
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
104330
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
104331
+ if (existing.callbacks.length === 1) {
104332
+ state.filesWatched.delete(path);
104333
+ ts.closeFileWatcherOf(existing);
104334
+ }
104335
+ else {
104336
+ ts.unorderedRemoveItem(existing.callbacks, callback);
104337
+ }
104338
+ }
104339
+ };
104340
+ }
104341
+ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
104342
+ if (!state.watch)
104343
+ return undefined;
104344
+ var result = state.outputTimeStamps.get(resolvedConfigFilePath);
104345
+ if (!result)
104346
+ state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
104347
+ return result;
104348
+ }
104349
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
104350
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
104351
+ var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
104352
+ if (existing) {
104353
+ existing.buildInfo = buildInfo;
104354
+ existing.modifiedTime = getCurrentTime(state.host);
104355
+ }
104356
+ else {
104357
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
104358
+ }
104359
+ }
104360
+ function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
104361
+ var path = toPath(state, buildInfoPath);
104362
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
104363
+ return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
104364
+ }
104365
+ function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
104366
+ var path = toPath(state, buildInfoPath);
104367
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
104368
+ if (existing !== undefined && existing.path === path) {
104369
+ return existing.buildInfo || undefined;
104370
+ }
104371
+ var value = state.readFileWithCache(buildInfoPath);
104372
+ var buildInfo = value ? ts.getBuildInfo(value) : undefined;
104373
+ ts.Debug.assert(modifiedTime || !buildInfo);
104374
+ state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
104375
+ return buildInfo;
104376
+ }
103920
104377
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
103921
- var tsconfigTime = ts.getModifiedTime(state.host, configFile);
104378
+ var tsconfigTime = getModifiedTime(state, configFile);
103922
104379
  if (oldestOutputFileTime < tsconfigTime) {
103923
104380
  return {
103924
104381
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -103928,76 +104385,22 @@ var ts;
103928
104385
  }
103929
104386
  }
103930
104387
  function getUpToDateStatusWorker(state, project, resolvedPath) {
103931
- var force = !!state.options.force;
103932
- var newestInputFileName = undefined;
103933
- var newestInputFileTime = minimumDate;
103934
- var host = state.host;
103935
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
103936
- var inputFile = _a[_i];
103937
- if (!host.fileExists(inputFile)) {
103938
- return {
103939
- type: ts.UpToDateStatusType.Unbuildable,
103940
- reason: inputFile + " does not exist"
103941
- };
103942
- }
103943
- if (!force) {
103944
- var inputTime = ts.getModifiedTime(host, inputFile);
103945
- if (inputTime > newestInputFileTime) {
103946
- newestInputFileName = inputFile;
103947
- newestInputFileTime = inputTime;
103948
- }
103949
- }
103950
- }
104388
+ var _a, _b, _c;
103951
104389
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
103952
104390
  return {
103953
104391
  type: ts.UpToDateStatusType.ContainerOnly
103954
104392
  };
103955
104393
  }
103956
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
103957
- var oldestOutputFileName = "(none)";
103958
- var oldestOutputFileTime = maximumDate;
103959
- var newestOutputFileName = "(none)";
103960
- var newestOutputFileTime = minimumDate;
103961
- var missingOutputFileName;
103962
- var newestDeclarationFileContentChangedTime = minimumDate;
103963
- var isOutOfDateWithInputs = false;
103964
- if (!force) {
103965
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
103966
- var output = outputs_1[_b];
103967
- if (!host.fileExists(output)) {
103968
- missingOutputFileName = output;
103969
- break;
103970
- }
103971
- var outputTime = ts.getModifiedTime(host, output);
103972
- if (outputTime < oldestOutputFileTime) {
103973
- oldestOutputFileTime = outputTime;
103974
- oldestOutputFileName = output;
103975
- }
103976
- if (outputTime < newestInputFileTime) {
103977
- isOutOfDateWithInputs = true;
103978
- break;
103979
- }
103980
- if (outputTime > newestOutputFileTime) {
103981
- newestOutputFileTime = outputTime;
103982
- newestOutputFileName = output;
103983
- }
103984
- if (ts.isDeclarationFileName(output)) {
103985
- var outputModifiedTime = ts.getModifiedTime(host, output);
103986
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
103987
- }
103988
- }
103989
- }
103990
- var pseudoUpToDate = false;
103991
- var usesPrepend = false;
103992
- var upstreamChangedProject;
104394
+ var referenceStatuses;
104395
+ var force = !!state.options.force;
103993
104396
  if (project.projectReferences) {
103994
104397
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
103995
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
103996
- var ref = _d[_c];
103997
- usesPrepend = usesPrepend || !!(ref.prepend);
104398
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
104399
+ var ref = _d[_i];
103998
104400
  var resolvedRef = ts.resolveProjectReferencePath(ref);
103999
104401
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
104000
- var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
104402
+ var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
104403
+ var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
104001
104404
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
104002
104405
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) {
104003
104406
  continue;
@@ -104016,65 +104419,169 @@ var ts;
104016
104419
  upstreamProjectName: ref.path
104017
104420
  };
104018
104421
  }
104019
- if (!force && !missingOutputFileName) {
104020
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
104021
- continue;
104022
- }
104023
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
104024
- pseudoUpToDate = true;
104025
- upstreamChangedProject = ref.path;
104026
- continue;
104027
- }
104028
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
104422
+ if (!force)
104423
+ (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
104424
+ }
104425
+ }
104426
+ if (force)
104427
+ return { type: ts.UpToDateStatusType.ForceBuild };
104428
+ var host = state.host;
104429
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
104430
+ var oldestOutputFileName;
104431
+ var oldestOutputFileTime = maximumDate;
104432
+ var buildInfoTime;
104433
+ var buildInfoProgram;
104434
+ var buildInfoVersionMap;
104435
+ var newestDeclarationFileContentChangedTime;
104436
+ if (buildInfoPath) {
104437
+ var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
104438
+ buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
104439
+ if (buildInfoTime === ts.missingFileModifiedTime) {
104440
+ if (!buildInfoCacheEntry_1) {
104441
+ state.buildInfoCache.set(resolvedPath, {
104442
+ path: toPath(state, buildInfoPath),
104443
+ buildInfo: false,
104444
+ modifiedTime: buildInfoTime
104445
+ });
104446
+ }
104447
+ return {
104448
+ type: ts.UpToDateStatusType.OutputMissing,
104449
+ missingOutputFileName: buildInfoPath
104450
+ };
104451
+ }
104452
+ var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
104453
+ if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
104454
+ return {
104455
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
104456
+ version: buildInfo.version
104457
+ };
104458
+ }
104459
+ if (buildInfo.program) {
104460
+ if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
104461
+ (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
104029
104462
  return {
104030
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
104031
- outOfDateOutputFileName: oldestOutputFileName,
104032
- newerProjectName: ref.path
104463
+ type: ts.UpToDateStatusType.OutOfDateBuildInfo,
104464
+ buildInfoFile: buildInfoPath
104033
104465
  };
104034
104466
  }
104467
+ buildInfoProgram = buildInfo.program;
104035
104468
  }
104469
+ oldestOutputFileTime = buildInfoTime;
104470
+ oldestOutputFileName = buildInfoPath;
104471
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
104036
104472
  }
104037
- if (missingOutputFileName !== undefined) {
104038
- return {
104039
- type: ts.UpToDateStatusType.OutputMissing,
104040
- missingOutputFileName: missingOutputFileName
104041
- };
104473
+ var newestInputFileName = undefined;
104474
+ var newestInputFileTime = minimumDate;
104475
+ var pseudoInputUpToDate = false;
104476
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
104477
+ var inputFile = _f[_e];
104478
+ var inputTime = getModifiedTime(state, inputFile);
104479
+ if (inputTime === ts.missingFileModifiedTime) {
104480
+ return {
104481
+ type: ts.UpToDateStatusType.Unbuildable,
104482
+ reason: inputFile + " does not exist"
104483
+ };
104484
+ }
104485
+ if (buildInfoTime && buildInfoTime < inputTime) {
104486
+ var version_3 = void 0;
104487
+ var currentVersion = void 0;
104488
+ if (buildInfoProgram) {
104489
+ if (!buildInfoVersionMap)
104490
+ buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
104491
+ version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
104492
+ var text = version_3 ? state.readFileWithCache(inputFile) : undefined;
104493
+ currentVersion = text && (host.createHash || ts.generateDjb2Hash)(text);
104494
+ if (version_3 && version_3 === currentVersion)
104495
+ pseudoInputUpToDate = true;
104496
+ }
104497
+ if (!version_3 || version_3 !== currentVersion) {
104498
+ return {
104499
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
104500
+ outOfDateOutputFileName: buildInfoPath,
104501
+ newerInputFileName: inputFile
104502
+ };
104503
+ }
104504
+ }
104505
+ if (inputTime > newestInputFileTime) {
104506
+ newestInputFileName = inputFile;
104507
+ newestInputFileTime = inputTime;
104508
+ }
104042
104509
  }
104043
- if (isOutOfDateWithInputs) {
104044
- return {
104045
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
104046
- outOfDateOutputFileName: oldestOutputFileName,
104047
- newerInputFileName: newestInputFileName
104048
- };
104510
+ if (!buildInfoPath) {
104511
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
104512
+ var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
104513
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
104514
+ var output = outputs_1[_g];
104515
+ var path = toPath(state, output);
104516
+ var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
104517
+ if (!outputTime) {
104518
+ outputTime = ts.getModifiedTime(state.host, output);
104519
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
104520
+ }
104521
+ if (outputTime === ts.missingFileModifiedTime) {
104522
+ return {
104523
+ type: ts.UpToDateStatusType.OutputMissing,
104524
+ missingOutputFileName: output
104525
+ };
104526
+ }
104527
+ if (outputTime < newestInputFileTime) {
104528
+ return {
104529
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
104530
+ outOfDateOutputFileName: output,
104531
+ newerInputFileName: newestInputFileName
104532
+ };
104533
+ }
104534
+ if (outputTime < oldestOutputFileTime) {
104535
+ oldestOutputFileTime = outputTime;
104536
+ oldestOutputFileName = output;
104537
+ }
104538
+ }
104049
104539
  }
104050
- else {
104051
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
104052
- if (configStatus)
104053
- return configStatus;
104054
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
104055
- if (extendedConfigStatus)
104056
- return extendedConfigStatus;
104057
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
104058
- var path = _a[0];
104059
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
104060
- });
104061
- if (dependentPackageFileStatus)
104062
- return dependentPackageFileStatus;
104063
- }
104064
- if (!force && !state.buildInfoChecked.has(resolvedPath)) {
104065
- state.buildInfoChecked.set(resolvedPath, true);
104066
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
104067
- if (buildInfoPath) {
104068
- var value = state.readFileWithCache(buildInfoPath);
104069
- var buildInfo = value && ts.getBuildInfo(value);
104070
- if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
104540
+ var seenRefs = buildInfoPath ? new ts.Set() : undefined;
104541
+ var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
104542
+ seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
104543
+ var pseudoUpToDate = false;
104544
+ var usesPrepend = false;
104545
+ var upstreamChangedProject;
104546
+ if (referenceStatuses) {
104547
+ for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
104548
+ var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
104549
+ usesPrepend = usesPrepend || !!(ref.prepend);
104550
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
104551
+ continue;
104552
+ }
104553
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
104071
104554
  return {
104072
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
104073
- version: buildInfo.version
104555
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
104556
+ outOfDateOutputFileName: buildInfoPath,
104557
+ newerProjectName: ref.path
104074
104558
  };
104075
104559
  }
104560
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
104561
+ pseudoUpToDate = true;
104562
+ upstreamChangedProject = ref.path;
104563
+ continue;
104564
+ }
104565
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
104566
+ return {
104567
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
104568
+ outOfDateOutputFileName: oldestOutputFileName,
104569
+ newerProjectName: ref.path
104570
+ };
104076
104571
  }
104077
104572
  }
104573
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
104574
+ if (configStatus)
104575
+ return configStatus;
104576
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
104577
+ if (extendedConfigStatus)
104578
+ return extendedConfigStatus;
104579
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
104580
+ var path = _a[0];
104581
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
104582
+ });
104583
+ if (dependentPackageFileStatus)
104584
+ return dependentPackageFileStatus;
104078
104585
  if (usesPrepend && pseudoUpToDate) {
104079
104586
  return {
104080
104587
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -104083,15 +104590,36 @@ var ts;
104083
104590
  };
104084
104591
  }
104085
104592
  return {
104086
- type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
104593
+ type: pseudoUpToDate ?
104594
+ ts.UpToDateStatusType.UpToDateWithUpstreamTypes :
104595
+ pseudoInputUpToDate ?
104596
+ ts.UpToDateStatusType.UpToDateWithInputFileText :
104597
+ ts.UpToDateStatusType.UpToDate,
104087
104598
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
104088
104599
  newestInputFileTime: newestInputFileTime,
104089
- newestOutputFileTime: newestOutputFileTime,
104090
104600
  newestInputFileName: newestInputFileName,
104091
- newestOutputFileName: newestOutputFileName,
104092
104601
  oldestOutputFileName: oldestOutputFileName
104093
104602
  };
104094
104603
  }
104604
+ function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
104605
+ if (seenRefs.has(resolvedRefPath))
104606
+ return false;
104607
+ seenRefs.add(resolvedRefPath);
104608
+ var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
104609
+ if (refBuildInfo.path === buildInfoCacheEntry.path)
104610
+ return true;
104611
+ if (resolvedConfig.projectReferences) {
104612
+ for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
104613
+ var ref = _a[_i];
104614
+ var resolvedRef = ts.resolveProjectReferencePath(ref);
104615
+ var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
104616
+ var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
104617
+ if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
104618
+ return true;
104619
+ }
104620
+ }
104621
+ return false;
104622
+ }
104095
104623
  function getUpToDateStatus(state, project, resolvedPath) {
104096
104624
  if (project === undefined) {
104097
104625
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -104100,43 +104628,71 @@ var ts;
104100
104628
  if (prior !== undefined) {
104101
104629
  return prior;
104102
104630
  }
104631
+ ts.buildPerformance.mark("beforeUpToDateCheckTime");
104103
104632
  var actual = getUpToDateStatusWorker(state, project, resolvedPath);
104633
+ ts.buildPerformance.mark("afterUpToDateCheckTime");
104634
+ ts.buildPerformance.measure("Up-to-date check time", "beforeUpToDateCheckTime", "afterUpToDateCheckTime");
104104
104635
  state.projectStatus.set(resolvedPath, actual);
104105
104636
  return actual;
104106
104637
  }
104107
- function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
104638
+ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
104108
104639
  if (proj.options.noEmit)
104109
- return priorNewestUpdateTime;
104640
+ return;
104641
+ var now;
104642
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
104643
+ if (buildInfoPath) {
104644
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
104645
+ if (!!state.options.verbose)
104646
+ reportStatus(state, verboseMessage, proj.options.configFilePath);
104647
+ state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
104648
+ getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
104649
+ }
104650
+ state.outputTimeStamps.delete(projectPath);
104651
+ return;
104652
+ }
104110
104653
  var host = state.host;
104111
104654
  var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
104655
+ var outputTimeStampMap = getOutputTimeStampMap(state, projectPath);
104656
+ var modifiedOutputs = outputTimeStampMap ? new ts.Set() : undefined;
104112
104657
  if (!skipOutputs || outputs.length !== skipOutputs.size) {
104113
104658
  var reportVerbose = !!state.options.verbose;
104114
- var now = host.now ? host.now() : new Date();
104115
104659
  for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
104116
104660
  var file = outputs_2[_i];
104117
- if (skipOutputs && skipOutputs.has(toPath(state, file))) {
104661
+ var path = toPath(state, file);
104662
+ if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
104118
104663
  continue;
104119
- }
104120
104664
  if (reportVerbose) {
104121
104665
  reportVerbose = false;
104122
104666
  reportStatus(state, verboseMessage, proj.options.configFilePath);
104123
104667
  }
104124
- if (ts.isDeclarationFileName(file)) {
104125
- priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
104668
+ host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
104669
+ if (outputTimeStampMap) {
104670
+ outputTimeStampMap.set(path, now);
104671
+ modifiedOutputs.add(path);
104126
104672
  }
104127
- host.setModifiedTime(file, now);
104128
104673
  }
104129
104674
  }
104130
- return priorNewestUpdateTime;
104675
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.forEach(function (_value, key) {
104676
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs.has(key))
104677
+ outputTimeStampMap.delete(key);
104678
+ });
104679
+ }
104680
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
104681
+ var _a;
104682
+ if (!options.composite)
104683
+ return undefined;
104684
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
104685
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, undefined);
104686
+ 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;
104131
104687
  }
104132
104688
  function updateOutputTimestamps(state, proj, resolvedPath) {
104133
104689
  if (state.options.dry) {
104134
104690
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
104135
104691
  }
104136
- var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
104692
+ updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
104137
104693
  state.projectStatus.set(resolvedPath, {
104138
104694
  type: ts.UpToDateStatusType.UpToDate,
104139
- newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
104695
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
104140
104696
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
104141
104697
  });
104142
104698
  }
@@ -104175,6 +104731,7 @@ var ts;
104175
104731
  }
104176
104732
  break;
104177
104733
  }
104734
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
104178
104735
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
104179
104736
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
104180
104737
  if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
@@ -104198,6 +104755,13 @@ var ts;
104198
104755
  }
104199
104756
  }
104200
104757
  function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
104758
+ ts.buildPerformance.mark("beforeBuild");
104759
+ var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences);
104760
+ ts.buildPerformance.mark("afterBuild");
104761
+ ts.buildPerformance.measure("Build", "beforeBuild", "afterBuild");
104762
+ return result;
104763
+ }
104764
+ function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
104201
104765
  var buildOrder = getBuildOrderFor(state, project, onlyReferences);
104202
104766
  if (!buildOrder)
104203
104767
  return ts.ExitStatus.InvalidProject_OutputsSkipped;
@@ -104225,6 +104789,13 @@ var ts;
104225
104789
  : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped;
104226
104790
  }
104227
104791
  function clean(state, project, onlyReferences) {
104792
+ ts.buildPerformance.mark("beforeClean");
104793
+ var result = cleanWorker(state, project, onlyReferences);
104794
+ ts.buildPerformance.mark("afterClean");
104795
+ ts.buildPerformance.measure("Clean", "beforeClean", "afterClean");
104796
+ return result;
104797
+ }
104798
+ function cleanWorker(state, project, onlyReferences) {
104228
104799
  var buildOrder = getBuildOrderFor(state, project, onlyReferences);
104229
104800
  if (!buildOrder)
104230
104801
  return ts.ExitStatus.InvalidProject_OutputsSkipped;
@@ -104295,6 +104866,14 @@ var ts;
104295
104866
  state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
104296
104867
  }
104297
104868
  function buildNextInvalidatedProject(state, changeDetected) {
104869
+ ts.buildPerformance.mark("beforeBuild");
104870
+ var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
104871
+ ts.buildPerformance.mark("afterBuild");
104872
+ ts.buildPerformance.measure("Build", "beforeBuild", "afterBuild");
104873
+ if (buildOrder)
104874
+ reportErrorSummary(state, buildOrder);
104875
+ }
104876
+ function buildNextInvalidatedProjectWorker(state, changeDetected) {
104298
104877
  state.timerToBuildInvalidatedProject = undefined;
104299
104878
  if (state.reportFileChangeDetected) {
104300
104879
  state.reportFileChangeDetected = false;
@@ -104324,17 +104903,15 @@ var ts;
104324
104903
  }
104325
104904
  }
104326
104905
  disableCache(state);
104327
- reportErrorSummary(state, buildOrder);
104906
+ return buildOrder;
104328
104907
  }
104329
104908
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
104330
104909
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
104331
104910
  return;
104332
- state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
104333
- invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
104334
- }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
104911
+ 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));
104335
104912
  }
104336
104913
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
104337
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
104914
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
104338
104915
  var _a;
104339
104916
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
104340
104917
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -104366,7 +104943,7 @@ var ts;
104366
104943
  if (!state.watch)
104367
104944
  return;
104368
104945
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
104369
- 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); },
104946
+ 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); },
104370
104947
  onDeleteValue: ts.closeFileWatcher,
104371
104948
  });
104372
104949
  }
@@ -104374,13 +104951,14 @@ var ts;
104374
104951
  if (!state.watch || !state.lastCachedPackageJsonLookups)
104375
104952
  return;
104376
104953
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
104377
- 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); },
104954
+ 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); },
104378
104955
  onDeleteValue: ts.closeFileWatcher,
104379
104956
  });
104380
104957
  }
104381
104958
  function startWatching(state, buildOrder) {
104382
104959
  if (!state.watchAllProjectsPending)
104383
104960
  return;
104961
+ ts.buildPerformance.mark("beforeWatcherCreation");
104384
104962
  state.watchAllProjectsPending = false;
104385
104963
  for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) {
104386
104964
  var resolved = _a[_i];
@@ -104394,6 +104972,8 @@ var ts;
104394
104972
  watchPackageJsonFiles(state, resolved, resolvedPath, cfg);
104395
104973
  }
104396
104974
  }
104975
+ ts.buildPerformance.mark("afterWatcherCreation");
104976
+ ts.buildPerformance.measure("Watcher creation", "beforeWatcherCreation", "afterWatcherCreation");
104397
104977
  }
104398
104978
  function stopWatching(state) {
104399
104979
  ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher);
@@ -104496,25 +105076,26 @@ var ts;
104496
105076
  }
104497
105077
  }
104498
105078
  function reportUpToDateStatus(state, configFileName, status) {
104499
- if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
104500
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
104501
- }
104502
105079
  switch (status.type) {
104503
105080
  case ts.UpToDateStatusType.OutOfDateWithSelf:
104504
- 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));
105081
+ 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));
104505
105082
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
104506
- 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));
105083
+ 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));
104507
105084
  case ts.UpToDateStatusType.OutputMissing:
104508
105085
  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));
105086
+ case ts.UpToDateStatusType.OutOfDateBuildInfo:
105087
+ return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile));
104509
105088
  case ts.UpToDateStatusType.UpToDate:
104510
105089
  if (status.newestInputFileTime !== undefined) {
104511
- 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 || ""));
105090
+ 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 || ""));
104512
105091
  }
104513
105092
  break;
104514
105093
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
104515
105094
  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));
104516
105095
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
104517
105096
  return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
105097
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
105098
+ return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files, relName(state, configFileName));
104518
105099
  case ts.UpToDateStatusType.UpstreamOutOfDate:
104519
105100
  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));
104520
105101
  case ts.UpToDateStatusType.UpstreamBlocked:
@@ -104525,6 +105106,8 @@ var ts;
104525
105106
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
104526
105107
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
104527
105108
  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);
105109
+ case ts.UpToDateStatusType.ForceBuild:
105110
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
104528
105111
  case ts.UpToDateStatusType.ContainerOnly:
104529
105112
  case ts.UpToDateStatusType.ComputingUpstream:
104530
105113
  break;
@@ -104549,14 +105132,6 @@ var ts;
104549
105132
  });
104550
105133
  return counts;
104551
105134
  }
104552
- function countNodes(program) {
104553
- var counts = getCountsMap();
104554
- ts.forEach(program.getSourceFiles(), function (file) {
104555
- var key = getCountKey(program, file);
104556
- counts.set(key, counts.get(key) + file.nodeCount);
104557
- });
104558
- return counts;
104559
- }
104560
105135
  function getCountsMap() {
104561
105136
  var counts = new ts.Map();
104562
105137
  counts.set("Library", 0);
@@ -105100,18 +105675,54 @@ var ts;
105100
105675
  if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic))
105101
105676
  return;
105102
105677
  var buildHost_1 = ts.createSolutionBuilderWithWatchHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createWatchStatusReporter(sys, buildOptions));
105678
+ var onWatchStatusChange_1 = buildHost_1.onWatchStatusChange;
105679
+ var reportWatchStatistics_1 = false;
105680
+ buildHost_1.onWatchStatusChange = function (d, newLine, options, errorCount) {
105681
+ onWatchStatusChange_1 === null || onWatchStatusChange_1 === void 0 ? void 0 : onWatchStatusChange_1(d, newLine, options, errorCount);
105682
+ if (!reportWatchStatistics_1)
105683
+ return;
105684
+ if (d.code === ts.Diagnostics.Found_0_errors_Watching_for_file_changes.code ||
105685
+ d.code === ts.Diagnostics.Found_1_error_Watching_for_file_changes.code) {
105686
+ reportSolutionBuilderTimes(sys, buildOptions, builder_1);
105687
+ }
105688
+ };
105103
105689
  updateSolutionBuilderHost(sys, cb, buildHost_1);
105690
+ enableSolutionPerformance(sys, buildOptions);
105104
105691
  var builder_1 = ts.createSolutionBuilderWithWatch(buildHost_1, projects, buildOptions, watchOptions);
105105
105692
  builder_1.build();
105693
+ reportSolutionBuilderTimes(sys, buildOptions, builder_1);
105694
+ reportWatchStatistics_1 = true;
105106
105695
  return builder_1;
105107
105696
  }
105108
105697
  var buildHost = ts.createSolutionBuilderHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createReportErrorSummary(sys, buildOptions));
105109
105698
  updateSolutionBuilderHost(sys, cb, buildHost);
105699
+ enableSolutionPerformance(sys, buildOptions);
105110
105700
  var builder = ts.createSolutionBuilder(buildHost, projects, buildOptions);
105111
105701
  var exitStatus = buildOptions.clean ? builder.clean() : builder.build();
105702
+ reportSolutionBuilderTimes(sys, buildOptions, builder);
105112
105703
  ts.dumpTracingLegend();
105113
105704
  return sys.exit(exitStatus);
105114
105705
  }
105706
+ function enableSolutionPerformance(system, options) {
105707
+ if (system === ts.sys && options.extendedDiagnostics)
105708
+ ts.buildPerformance.enable();
105709
+ }
105710
+ function reportSolutionBuilderTimes(system, buildOptions, builder) {
105711
+ if (system !== ts.sys || !buildOptions.extendedDiagnostics)
105712
+ return;
105713
+ if (!ts.buildPerformance.isEnabled()) {
105714
+ ts.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");
105715
+ return;
105716
+ }
105717
+ var statistics = [];
105718
+ statistics.push({ name: "Projects in scope", value: ts.getBuildOrderFromAnyBuildOrder(builder.getBuildOrder()).length, type: ts.StatisticType.count });
105719
+ ts.buildPerformance.forEachCount(function (count, name) { return statistics.push({ name: name, value: count, type: ts.StatisticType.count }); });
105720
+ ts.buildPerformance.forEachStatistics(function (s) { return statistics.push(s); });
105721
+ ts.buildPerformance.forEachMeasure(function (duration, name) { return statistics.push({ name: name + " time", value: duration, type: ts.StatisticType.time }); });
105722
+ ts.buildPerformance.disable();
105723
+ ts.buildPerformance.enable();
105724
+ reportAllStatistics(system, statistics);
105725
+ }
105115
105726
  function createReportErrorSummary(sys, options) {
105116
105727
  return shouldBePretty(sys, options) ?
105117
105728
  function (errorCount, filesInError) { return sys.write(ts.getErrorSummaryText(errorCount, filesInError, sys.newLine, sys)); } :
@@ -105158,25 +105769,25 @@ var ts;
105158
105769
  return sys.exit(exitStatus);
105159
105770
  }
105160
105771
  function updateSolutionBuilderHost(sys, cb, buildHost) {
105161
- updateCreateProgram(sys, buildHost);
105772
+ updateCreateProgram(sys, buildHost, true);
105162
105773
  buildHost.afterProgramEmitAndDiagnostics = function (program) {
105163
105774
  reportStatistics(sys, program.getProgram());
105164
105775
  cb(program);
105165
105776
  };
105166
105777
  buildHost.afterEmitBundle = cb;
105167
105778
  }
105168
- function updateCreateProgram(sys, host) {
105779
+ function updateCreateProgram(sys, host, isBuildMode) {
105169
105780
  var compileUsingBuilder = host.createProgram;
105170
105781
  host.createProgram = function (rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences) {
105171
105782
  ts.Debug.assert(rootNames !== undefined || (options === undefined && !!oldProgram));
105172
105783
  if (options !== undefined) {
105173
- enableStatisticsAndTracing(sys, options, true);
105784
+ enableStatisticsAndTracing(sys, options, isBuildMode);
105174
105785
  }
105175
105786
  return compileUsingBuilder(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences);
105176
105787
  };
105177
105788
  }
105178
105789
  function updateWatchCompilationHost(sys, cb, watchCompilerHost) {
105179
- updateCreateProgram(sys, watchCompilerHost);
105790
+ updateCreateProgram(sys, watchCompilerHost, false);
105180
105791
  var emitFilesUsingBuilder = watchCompilerHost.afterProgramCreate;
105181
105792
  watchCompilerHost.afterProgramCreate = function (builderProgram) {
105182
105793
  emitFilesUsingBuilder(builderProgram);
@@ -105238,27 +105849,21 @@ var ts;
105238
105849
  var memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1;
105239
105850
  reportCountStatistic("Files", program.getSourceFiles().length);
105240
105851
  var lineCounts = countLines(program);
105241
- var nodeCounts = countNodes(program);
105242
105852
  if (compilerOptions.extendedDiagnostics) {
105243
105853
  for (var _i = 0, _a = ts.arrayFrom(lineCounts.keys()); _i < _a.length; _i++) {
105244
105854
  var key = _a[_i];
105245
105855
  reportCountStatistic("Lines of " + key, lineCounts.get(key));
105246
105856
  }
105247
- for (var _b = 0, _c = ts.arrayFrom(nodeCounts.keys()); _b < _c.length; _b++) {
105248
- var key = _c[_b];
105249
- reportCountStatistic("Nodes of " + key, nodeCounts.get(key));
105250
- }
105251
105857
  }
105252
105858
  else {
105253
105859
  reportCountStatistic("Lines", ts.reduceLeftIterator(lineCounts.values(), function (sum, count) { return sum + count; }, 0));
105254
- reportCountStatistic("Nodes", ts.reduceLeftIterator(nodeCounts.values(), function (sum, count) { return sum + count; }, 0));
105255
105860
  }
105256
105861
  reportCountStatistic("Identifiers", program.getIdentifierCount());
105257
105862
  reportCountStatistic("Symbols", program.getSymbolCount());
105258
105863
  reportCountStatistic("Types", program.getTypeCount());
105259
105864
  reportCountStatistic("Instantiations", program.getInstantiationCount());
105260
105865
  if (memoryUsed >= 0) {
105261
- reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K");
105866
+ reportMemoryStatistic("Memory used", memoryUsed);
105262
105867
  }
105263
105868
  var isPerformanceEnabled = ts.performance.isEnabled();
105264
105869
  var programTime = isPerformanceEnabled ? ts.performance.getDuration("Program") : 0;
@@ -105272,21 +105877,21 @@ var ts;
105272
105877
  reportCountStatistic("Subtype cache size", caches.subtype);
105273
105878
  reportCountStatistic("Strict subtype cache size", caches.strictSubtype);
105274
105879
  if (isPerformanceEnabled) {
105275
- ts.performance.forEachMeasure(function (name, duration) { return reportTimeStatistic(name + " time", duration); });
105880
+ ts.performance.forEachMeasure(function (duration, name) { return reportTimeStatistic(name + " time", duration, true); });
105276
105881
  }
105277
105882
  }
105278
105883
  else if (isPerformanceEnabled) {
105279
- reportTimeStatistic("I/O read", ts.performance.getDuration("I/O Read"));
105280
- reportTimeStatistic("I/O write", ts.performance.getDuration("I/O Write"));
105281
- reportTimeStatistic("Parse time", programTime);
105282
- reportTimeStatistic("Bind time", bindTime);
105283
- reportTimeStatistic("Check time", checkTime);
105284
- reportTimeStatistic("Emit time", emitTime);
105884
+ reportTimeStatistic("I/O read", ts.performance.getDuration("I/O Read"), true);
105885
+ reportTimeStatistic("I/O write", ts.performance.getDuration("I/O Write"), true);
105886
+ reportTimeStatistic("Parse time", programTime, true);
105887
+ reportTimeStatistic("Bind time", bindTime, true);
105888
+ reportTimeStatistic("Check time", checkTime, true);
105889
+ reportTimeStatistic("Emit time", emitTime, true);
105285
105890
  }
105286
105891
  if (isPerformanceEnabled) {
105287
- reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime);
105892
+ reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime, false);
105288
105893
  }
105289
- reportStatistics();
105894
+ reportAllStatistics(sys, statistics);
105290
105895
  if (!isPerformanceEnabled) {
105291
105896
  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");
105292
105897
  }
@@ -105294,31 +105899,49 @@ var ts;
105294
105899
  ts.performance.disable();
105295
105900
  }
105296
105901
  }
105297
- function reportStatistics() {
105298
- var nameSize = 0;
105299
- var valueSize = 0;
105300
- for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) {
105301
- var _a = statistics_1[_i], name = _a.name, value = _a.value;
105302
- if (name.length > nameSize) {
105303
- nameSize = name.length;
105304
- }
105305
- if (value.length > valueSize) {
105306
- valueSize = value.length;
105307
- }
105308
- }
105309
- for (var _b = 0, statistics_2 = statistics; _b < statistics_2.length; _b++) {
105310
- var _c = statistics_2[_b], name = _c.name, value = _c.value;
105311
- sys.write(ts.padRight(name + ":", nameSize + 2) + ts.padLeft(value.toString(), valueSize) + sys.newLine);
105312
- }
105902
+ function reportStatisticalValue(s, aggregate) {
105903
+ statistics.push(s);
105904
+ if (aggregate)
105905
+ ts.buildPerformance.addStatistics(__assign(__assign({}, s), { name: "Aggregate " + s.name }));
105313
105906
  }
105314
- function reportStatisticalValue(name, value) {
105315
- statistics.push({ name: name, value: value });
105907
+ function reportMemoryStatistic(name, memoryUsed) {
105908
+ reportStatisticalValue({ name: name, value: memoryUsed, type: ts.StatisticType.memory }, true);
105316
105909
  }
105317
105910
  function reportCountStatistic(name, count) {
105318
- reportStatisticalValue(name, "" + count);
105911
+ reportStatisticalValue({ name: name, value: count, type: ts.StatisticType.count }, true);
105912
+ }
105913
+ function reportTimeStatistic(name, time, aggregate) {
105914
+ reportStatisticalValue({ name: name, value: time, type: ts.StatisticType.time }, aggregate);
105319
105915
  }
105320
- function reportTimeStatistic(name, time) {
105321
- reportStatisticalValue(name, (time / 1000).toFixed(2) + "s");
105916
+ }
105917
+ function reportAllStatistics(sys, statistics) {
105918
+ var nameSize = 0;
105919
+ var valueSize = 0;
105920
+ for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) {
105921
+ var s = statistics_1[_i];
105922
+ if (s.name.length > nameSize) {
105923
+ nameSize = s.name.length;
105924
+ }
105925
+ var valueString = statisticValue(s);
105926
+ if (valueString.length > valueSize) {
105927
+ valueSize = valueString.length;
105928
+ }
105929
+ }
105930
+ for (var _a = 0, statistics_2 = statistics; _a < statistics_2.length; _a++) {
105931
+ var s = statistics_2[_a];
105932
+ sys.write(ts.padRight(s.name + ":", nameSize + 2) + ts.padLeft(statisticValue(s).toString(), valueSize) + sys.newLine);
105933
+ }
105934
+ }
105935
+ function statisticValue(s) {
105936
+ switch (s.type) {
105937
+ case ts.StatisticType.count:
105938
+ return "" + s.value;
105939
+ case ts.StatisticType.time:
105940
+ return (s.value / 1000).toFixed(2) + "s";
105941
+ case ts.StatisticType.memory:
105942
+ return Math.round(s.value / 1000) + "K";
105943
+ default:
105944
+ ts.Debug.assertNever(s.type);
105322
105945
  }
105323
105946
  }
105324
105947
  function writeConfigFile(sys, reportDiagnostic, options, fileNames) {