@typescript-deploys/pr-build 4.8.0-pr-49233-9 → 4.8.0-pr-48784-14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.8";
72
- ts.version = ts.versionMajorMinor + ".0-insiders.20220525";
72
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220527";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -2970,14 +2970,32 @@ var ts;
2970
2970
  })(ts || (ts = {}));
2971
2971
  var ts;
2972
2972
  (function (ts) {
2973
- var performance;
2974
- (function (performance) {
2973
+ var nullTimer = { enter: ts.noop, exit: ts.noop };
2974
+ ts.performance = createPerformanceTracker();
2975
+ ts.solutionPerformance = createPerformanceTracker();
2976
+ function createPerformanceTracker() {
2975
2977
  var perfHooks;
2976
2978
  var performanceImpl;
2979
+ var enabled = false;
2980
+ var timeorigin = ts.timestamp();
2981
+ var marks = new ts.Map();
2982
+ var counts = new ts.Map();
2983
+ var durations = new ts.Map();
2984
+ return {
2985
+ createTimerIf: createTimerIf,
2986
+ createTimer: createTimer,
2987
+ mark: mark,
2988
+ measure: measure,
2989
+ getCount: getCount,
2990
+ getDuration: getDuration,
2991
+ forEachMeasure: forEachMeasure,
2992
+ isEnabled: isEnabled,
2993
+ enable: enable,
2994
+ disable: disable,
2995
+ };
2977
2996
  function createTimerIf(condition, measureName, startMarkName, endMarkName) {
2978
- return condition ? createTimer(measureName, startMarkName, endMarkName) : performance.nullTimer;
2997
+ return condition ? createTimer(measureName, startMarkName, endMarkName) : nullTimer;
2979
2998
  }
2980
- performance.createTimerIf = createTimerIf;
2981
2999
  function createTimer(measureName, startMarkName, endMarkName) {
2982
3000
  var enterCount = 0;
2983
3001
  return {
@@ -2999,13 +3017,6 @@ var ts;
2999
3017
  }
3000
3018
  }
3001
3019
  }
3002
- performance.createTimer = createTimer;
3003
- performance.nullTimer = { enter: ts.noop, exit: ts.noop };
3004
- var enabled = false;
3005
- var timeorigin = ts.timestamp();
3006
- var marks = new ts.Map();
3007
- var counts = new ts.Map();
3008
- var durations = new ts.Map();
3009
3020
  function mark(markName) {
3010
3021
  var _a;
3011
3022
  if (enabled) {
@@ -3015,34 +3026,28 @@ var ts;
3015
3026
  performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.mark(markName);
3016
3027
  }
3017
3028
  }
3018
- performance.mark = mark;
3019
3029
  function measure(measureName, startMarkName, endMarkName) {
3020
3030
  var _a, _b;
3021
3031
  if (enabled) {
3022
- var end = (_a = (endMarkName !== undefined ? marks.get(endMarkName) : undefined)) !== null && _a !== void 0 ? _a : ts.timestamp();
3023
- var start = (_b = (startMarkName !== undefined ? marks.get(startMarkName) : undefined)) !== null && _b !== void 0 ? _b : timeorigin;
3032
+ var end = (_a = marks.get(endMarkName)) !== null && _a !== void 0 ? _a : ts.timestamp();
3033
+ var start = (_b = marks.get(startMarkName)) !== null && _b !== void 0 ? _b : timeorigin;
3024
3034
  var previousDuration = durations.get(measureName) || 0;
3025
3035
  durations.set(measureName, previousDuration + (end - start));
3026
3036
  performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.measure(measureName, startMarkName, endMarkName);
3027
3037
  }
3028
3038
  }
3029
- performance.measure = measure;
3030
3039
  function getCount(markName) {
3031
3040
  return counts.get(markName) || 0;
3032
3041
  }
3033
- performance.getCount = getCount;
3034
3042
  function getDuration(measureName) {
3035
3043
  return durations.get(measureName) || 0;
3036
3044
  }
3037
- performance.getDuration = getDuration;
3038
3045
  function forEachMeasure(cb) {
3039
3046
  durations.forEach(function (duration, measureName) { return cb(measureName, duration); });
3040
3047
  }
3041
- performance.forEachMeasure = forEachMeasure;
3042
3048
  function isEnabled() {
3043
3049
  return enabled;
3044
3050
  }
3045
- performance.isEnabled = isEnabled;
3046
3051
  function enable(system) {
3047
3052
  var _a;
3048
3053
  if (system === void 0) { system = ts.sys; }
@@ -3058,7 +3063,6 @@ var ts;
3058
3063
  }
3059
3064
  return true;
3060
3065
  }
3061
- performance.enable = enable;
3062
3066
  function disable() {
3063
3067
  if (enabled) {
3064
3068
  marks.clear();
@@ -3068,8 +3072,7 @@ var ts;
3068
3072
  enabled = false;
3069
3073
  }
3070
3074
  }
3071
- performance.disable = disable;
3072
- })(performance = ts.performance || (ts.performance = {}));
3075
+ }
3073
3076
  })(ts || (ts = {}));
3074
3077
  var ts;
3075
3078
  (function (ts) {
@@ -3746,7 +3749,7 @@ var ts;
3746
3749
  };
3747
3750
  }
3748
3751
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
3749
- var watcher = fsWatch(dirName, 1, function (_eventName, relativeFileName) {
3752
+ var watcher = fsWatch(dirName, 1, function (_eventName, relativeFileName, modifiedTime) {
3750
3753
  if (!ts.isString(relativeFileName))
3751
3754
  return;
3752
3755
  var fileName = ts.getNormalizedAbsolutePath(relativeFileName, dirName);
@@ -3754,7 +3757,7 @@ var ts;
3754
3757
  if (callbacks) {
3755
3758
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
3756
3759
  var fileCallback = callbacks_1[_i];
3757
- fileCallback(fileName, FileWatcherEventKind.Changed);
3760
+ fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
3758
3761
  }
3759
3762
  }
3760
3763
  }, false, PollingInterval.Medium, fallbackOptions);
@@ -3806,7 +3809,7 @@ var ts;
3806
3809
  }
3807
3810
  else {
3808
3811
  cache.set(path, {
3809
- watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
3812
+ watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
3810
3813
  refCount: 1
3811
3814
  });
3812
3815
  }
@@ -3830,7 +3833,7 @@ var ts;
3830
3833
  var newTime = modifiedTime.getTime();
3831
3834
  if (oldTime !== newTime) {
3832
3835
  watchedFile.mtime = modifiedTime;
3833
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
3836
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
3834
3837
  return true;
3835
3838
  }
3836
3839
  return false;
@@ -4044,16 +4047,17 @@ var ts;
4044
4047
  }
4045
4048
  ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive;
4046
4049
  function createFileWatcherCallback(callback) {
4047
- return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
4050
+ return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
4048
4051
  }
4049
4052
  ts.createFileWatcherCallback = createFileWatcherCallback;
4050
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists) {
4051
- return function (eventName) {
4053
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
4054
+ return function (eventName, _relativeFileName, modifiedTime) {
4052
4055
  if (eventName === "rename") {
4053
- callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
4056
+ modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
4057
+ callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
4054
4058
  }
4055
4059
  else {
4056
- callback(fileName, FileWatcherEventKind.Changed);
4060
+ callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
4057
4061
  }
4058
4062
  };
4059
4063
  }
@@ -4072,7 +4076,7 @@ var ts;
4072
4076
  };
4073
4077
  }
4074
4078
  function createSystemWatchFunctions(_a) {
4075
- var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, 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;
4079
+ var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatch = _a.fsWatch, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, directoryExists = _a.directoryExists, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind;
4076
4080
  var dynamicPollingWatchFile;
4077
4081
  var fixedChunkSizePollingWatchFile;
4078
4082
  var nonPollingWatchFile;
@@ -4094,7 +4098,7 @@ var ts;
4094
4098
  case ts.WatchFileKind.FixedChunkSizePolling:
4095
4099
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, undefined, undefined);
4096
4100
  case ts.WatchFileKind.UseFsEvents:
4097
- return fsWatch(fileName, 0, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists), false, pollingInterval, ts.getFallbackOptions(options));
4101
+ return fsWatch(fileName, 0, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime), false, pollingInterval, ts.getFallbackOptions(options));
4098
4102
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
4099
4103
  if (!nonPollingWatchFile) {
4100
4104
  nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames);
@@ -4251,7 +4255,6 @@ var ts;
4251
4255
  fsWatch: fsWatch,
4252
4256
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
4253
4257
  getCurrentDirectory: getCurrentDirectory,
4254
- fileExists: fileExists,
4255
4258
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
4256
4259
  directoryExists: directoryExists,
4257
4260
  getAccessibleSortedChildDirectories: function (path) { return getAccessibleFileSystemEntries(path).directories; },
@@ -4479,7 +4482,7 @@ var ts;
4479
4482
  else {
4480
4483
  eventKind = FileWatcherEventKind.Changed;
4481
4484
  }
4482
- callback(fileName, eventKind);
4485
+ callback(fileName, eventKind, curr.mtime);
4483
4486
  }
4484
4487
  }
4485
4488
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
@@ -4499,9 +4502,9 @@ var ts;
4499
4502
  watcher = undefined;
4500
4503
  }
4501
4504
  };
4502
- function invokeCallbackAndUpdateWatcher(createWatcher) {
4505
+ function invokeCallbackAndUpdateWatcher(createWatcher, modifiedTime) {
4503
4506
  sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
4504
- callback("rename", "");
4507
+ callback("rename", "", modifiedTime);
4505
4508
  if (watcher) {
4506
4509
  watcher.close();
4507
4510
  watcher = createWatcher();
@@ -4534,21 +4537,25 @@ var ts;
4534
4537
  }
4535
4538
  }
4536
4539
  function callbackChangingToMissingFileSystemEntry(event, relativeName) {
4540
+ var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
4537
4541
  return event === "rename" &&
4538
4542
  (!relativeName ||
4539
4543
  relativeName === lastDirectoryPart ||
4540
4544
  (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
4541
- !fileSystemEntryExists(fileOrDirectory, entryKind) ?
4542
- invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
4543
- callback(event, relativeName);
4545
+ modifiedTime === ts.missingFileModifiedTime ?
4546
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry, modifiedTime) :
4547
+ callback(event, relativeName, modifiedTime);
4544
4548
  }
4545
4549
  function watchPresentFileSystemEntryWithFsWatchFile() {
4546
4550
  return watchFile(fileOrDirectory, createFileWatcherCallback(callback), fallbackPollingInterval, fallbackOptions);
4547
4551
  }
4548
4552
  function watchMissingFileSystemEntry() {
4549
- return watchFile(fileOrDirectory, function (_fileName, eventKind) {
4550
- if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
4551
- invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
4553
+ return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
4554
+ if (eventKind === FileWatcherEventKind.Created) {
4555
+ modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
4556
+ if (modifiedTime !== ts.missingFileModifiedTime) {
4557
+ invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry, modifiedTime);
4558
+ }
4552
4559
  }
4553
4560
  }, fallbackPollingInterval, fallbackOptions);
4554
4561
  }
@@ -4687,12 +4694,17 @@ var ts;
4687
4694
  }
4688
4695
  function getModifiedTime(path) {
4689
4696
  var _a;
4697
+ var originalStackTraceLimit = Error.stackTraceLimit;
4698
+ Error.stackTraceLimit = 0;
4690
4699
  try {
4691
4700
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
4692
4701
  }
4693
4702
  catch (e) {
4694
4703
  return undefined;
4695
4704
  }
4705
+ finally {
4706
+ Error.stackTraceLimit = originalStackTraceLimit;
4707
+ }
4696
4708
  }
4697
4709
  function setModifiedTime(path, time) {
4698
4710
  try {
@@ -6493,8 +6505,8 @@ var ts;
6493
6505
  Cannot_prepend_project_0_because_it_does_not_have_outFile_set: diag(6308, ts.DiagnosticCategory.Error, "Cannot_prepend_project_0_because_it_does_not_have_outFile_set_6308", "Cannot prepend project '{0}' because it does not have 'outFile' set"),
6494
6506
  Output_file_0_from_project_1_does_not_exist: diag(6309, ts.DiagnosticCategory.Error, "Output_file_0_from_project_1_does_not_exist_6309", "Output file '{0}' from project '{1}' does not exist"),
6495
6507
  Referenced_project_0_may_not_disable_emit: diag(6310, ts.DiagnosticCategory.Error, "Referenced_project_0_may_not_disable_emit_6310", "Referenced project '{0}' may not disable emit."),
6496
- 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}'"),
6497
- Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2: diag(6351, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351", "Project '{0}' is up to date because newest input '{1}' is older than oldest output '{2}'"),
6508
+ Project_0_is_out_of_date_because_output_1_is_older_than_input_2: diag(6350, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_output_1_is_older_than_input_2_6350", "Project '{0}' is out of date because output '{1}' is older than input '{2}'"),
6509
+ Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2: diag(6351, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351", "Project '{0}' is up to date because newest input '{1}' is older than output '{2}'"),
6498
6510
  Project_0_is_out_of_date_because_output_file_1_does_not_exist: diag(6352, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352", "Project '{0}' is out of date because output file '{1}' does not exist"),
6499
6511
  Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date: diag(6353, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353", "Project '{0}' is out of date because its dependency '{1}' is out of date"),
6500
6512
  Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies: diag(6354, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354", "Project '{0}' is up to date with .d.ts files from its dependencies"),
@@ -6538,6 +6550,8 @@ var ts;
6538
6550
  Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3: diag(6396, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6396", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}'."),
6539
6551
  Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4: diag(6397, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6397", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}' with Package ID '{4}'."),
6540
6552
  Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."),
6553
+ Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_are_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_are_not_emitted_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes are not emitted"),
6554
+ Project_0_is_up_to_date_but_needs_update_to_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_update_to_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs update to timestamps of output files that are older than input files"),
6541
6555
  The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
6542
6556
  The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
6543
6557
  The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -12599,9 +12613,6 @@ var ts;
12599
12613
  }
12600
12614
  ts.isVariableDeclarationInitializedToBareOrAccessedRequire = isVariableDeclarationInitializedToBareOrAccessedRequire;
12601
12615
  function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) {
12602
- if (node.kind === 203) {
12603
- node = node.parent.parent;
12604
- }
12605
12616
  return ts.isVariableDeclaration(node) &&
12606
12617
  !!node.initializer &&
12607
12618
  isRequireCall(allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, true);
@@ -15861,13 +15872,13 @@ var ts;
15861
15872
  return !file.isDeclarationFile ? walkTreeForJSXTags(file) : undefined;
15862
15873
  }
15863
15874
  function isFileForcedToBeModuleByFormat(file) {
15864
- return file.impliedNodeFormat === ts.ModuleKind.ESNext && !file.isDeclarationFile ? true : undefined;
15875
+ return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs", ".cts"]))) && !file.isDeclarationFile ? true : undefined;
15865
15876
  }
15866
15877
  function getSetExternalModuleIndicator(options) {
15867
15878
  switch (getEmitModuleDetectionKind(options)) {
15868
15879
  case ts.ModuleDetectionKind.Force:
15869
15880
  return function (file) {
15870
- file.externalModuleIndicator = !file.isDeclarationFile || ts.isFileProbablyExternalModule(file);
15881
+ file.externalModuleIndicator = ts.isFileProbablyExternalModule(file) || !file.isDeclarationFile || undefined;
15871
15882
  };
15872
15883
  case ts.ModuleDetectionKind.Legacy:
15873
15884
  return function (file) {
@@ -15923,7 +15934,8 @@ var ts;
15923
15934
  }
15924
15935
  ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
15925
15936
  function getEmitModuleDetectionKind(options) {
15926
- return options.moduleDetection || ts.ModuleDetectionKind.Auto;
15937
+ return options.moduleDetection ||
15938
+ (getEmitModuleKind(options) === ts.ModuleKind.Node16 || getEmitModuleKind(options) === ts.ModuleKind.NodeNext ? ts.ModuleDetectionKind.Force : ts.ModuleDetectionKind.Auto);
15927
15939
  }
15928
15940
  ts.getEmitModuleDetectionKind = getEmitModuleDetectionKind;
15929
15941
  function hasJsonModuleEmitEnabled(options) {
@@ -16006,6 +16018,10 @@ var ts;
16006
16018
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
16007
16019
  }
16008
16020
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
16021
+ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
16022
+ return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
16023
+ }
16024
+ ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
16009
16025
  function getCompilerOptionValue(options, option) {
16010
16026
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
16011
16027
  }
@@ -31715,6 +31731,7 @@ var ts;
31715
31731
  type: "boolean",
31716
31732
  affectsSemanticDiagnostics: true,
31717
31733
  affectsEmit: true,
31734
+ affectsMultiFileEmitBuildInfo: true,
31718
31735
  category: ts.Diagnostics.Watch_and_Build_Modes,
31719
31736
  description: ts.Diagnostics.Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it,
31720
31737
  defaultValueDescription: false,
@@ -31748,12 +31765,39 @@ var ts;
31748
31765
  affectsSourceFile: true,
31749
31766
  affectsModuleResolution: true,
31750
31767
  affectsEmit: true,
31768
+ affectsMultiFileEmitBuildInfo: true,
31751
31769
  paramType: ts.Diagnostics.VERSION,
31752
31770
  showInSimplifiedHelpView: true,
31753
31771
  category: ts.Diagnostics.Language_and_Environment,
31754
31772
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
31755
31773
  defaultValueDescription: 0,
31756
31774
  };
31775
+ ts.moduleOptionDeclaration = {
31776
+ name: "module",
31777
+ shortName: "m",
31778
+ type: new ts.Map(ts.getEntries({
31779
+ none: ts.ModuleKind.None,
31780
+ commonjs: ts.ModuleKind.CommonJS,
31781
+ amd: ts.ModuleKind.AMD,
31782
+ system: ts.ModuleKind.System,
31783
+ umd: ts.ModuleKind.UMD,
31784
+ es6: ts.ModuleKind.ES2015,
31785
+ es2015: ts.ModuleKind.ES2015,
31786
+ es2020: ts.ModuleKind.ES2020,
31787
+ es2022: ts.ModuleKind.ES2022,
31788
+ esnext: ts.ModuleKind.ESNext,
31789
+ node16: ts.ModuleKind.Node16,
31790
+ nodenext: ts.ModuleKind.NodeNext,
31791
+ })),
31792
+ affectsModuleResolution: true,
31793
+ affectsEmit: true,
31794
+ affectsMultiFileEmitBuildInfo: true,
31795
+ paramType: ts.Diagnostics.KIND,
31796
+ showInSimplifiedHelpView: true,
31797
+ category: ts.Diagnostics.Modules,
31798
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
31799
+ defaultValueDescription: undefined,
31800
+ };
31757
31801
  var commandOptionsWithoutBuild = [
31758
31802
  {
31759
31803
  name: "all",
@@ -31814,36 +31858,13 @@ var ts;
31814
31858
  category: ts.Diagnostics.Command_line_Options,
31815
31859
  affectsSemanticDiagnostics: true,
31816
31860
  affectsEmit: true,
31861
+ affectsMultiFileEmitBuildInfo: true,
31817
31862
  isCommandLineOnly: true,
31818
31863
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
31819
31864
  defaultValueDescription: false,
31820
31865
  },
31821
31866
  ts.targetOptionDeclaration,
31822
- {
31823
- name: "module",
31824
- shortName: "m",
31825
- type: new ts.Map(ts.getEntries({
31826
- none: ts.ModuleKind.None,
31827
- commonjs: ts.ModuleKind.CommonJS,
31828
- amd: ts.ModuleKind.AMD,
31829
- system: ts.ModuleKind.System,
31830
- umd: ts.ModuleKind.UMD,
31831
- es6: ts.ModuleKind.ES2015,
31832
- es2015: ts.ModuleKind.ES2015,
31833
- es2020: ts.ModuleKind.ES2020,
31834
- es2022: ts.ModuleKind.ES2022,
31835
- esnext: ts.ModuleKind.ESNext,
31836
- node16: ts.ModuleKind.Node16,
31837
- nodenext: ts.ModuleKind.NodeNext,
31838
- })),
31839
- affectsModuleResolution: true,
31840
- affectsEmit: true,
31841
- paramType: ts.Diagnostics.KIND,
31842
- showInSimplifiedHelpView: true,
31843
- category: ts.Diagnostics.Modules,
31844
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
31845
- defaultValueDescription: undefined,
31846
- },
31867
+ ts.moduleOptionDeclaration,
31847
31868
  {
31848
31869
  name: "lib",
31849
31870
  type: "list",
@@ -31880,6 +31901,7 @@ var ts;
31880
31901
  type: jsxOptionMap,
31881
31902
  affectsSourceFile: true,
31882
31903
  affectsEmit: true,
31904
+ affectsMultiFileEmitBuildInfo: true,
31883
31905
  affectsModuleResolution: true,
31884
31906
  paramType: ts.Diagnostics.KIND,
31885
31907
  showInSimplifiedHelpView: true,
@@ -31892,6 +31914,7 @@ var ts;
31892
31914
  shortName: "d",
31893
31915
  type: "boolean",
31894
31916
  affectsEmit: true,
31917
+ affectsMultiFileEmitBuildInfo: true,
31895
31918
  showInSimplifiedHelpView: true,
31896
31919
  category: ts.Diagnostics.Emit,
31897
31920
  transpileOptionValue: undefined,
@@ -31902,6 +31925,7 @@ var ts;
31902
31925
  name: "declarationMap",
31903
31926
  type: "boolean",
31904
31927
  affectsEmit: true,
31928
+ affectsMultiFileEmitBuildInfo: true,
31905
31929
  showInSimplifiedHelpView: true,
31906
31930
  category: ts.Diagnostics.Emit,
31907
31931
  transpileOptionValue: undefined,
@@ -31912,6 +31936,7 @@ var ts;
31912
31936
  name: "emitDeclarationOnly",
31913
31937
  type: "boolean",
31914
31938
  affectsEmit: true,
31939
+ affectsMultiFileEmitBuildInfo: true,
31915
31940
  showInSimplifiedHelpView: true,
31916
31941
  category: ts.Diagnostics.Emit,
31917
31942
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -31922,6 +31947,7 @@ var ts;
31922
31947
  name: "sourceMap",
31923
31948
  type: "boolean",
31924
31949
  affectsEmit: true,
31950
+ affectsMultiFileEmitBuildInfo: true,
31925
31951
  showInSimplifiedHelpView: true,
31926
31952
  category: ts.Diagnostics.Emit,
31927
31953
  defaultValueDescription: false,
@@ -31931,6 +31957,9 @@ var ts;
31931
31957
  name: "outFile",
31932
31958
  type: "string",
31933
31959
  affectsEmit: true,
31960
+ affectsMultiFileEmitBuildInfo: true,
31961
+ affectsDeclarationPath: true,
31962
+ affectsBundleEmitBuildInfo: true,
31934
31963
  isFilePath: true,
31935
31964
  paramType: ts.Diagnostics.FILE,
31936
31965
  showInSimplifiedHelpView: true,
@@ -31942,6 +31971,8 @@ var ts;
31942
31971
  name: "outDir",
31943
31972
  type: "string",
31944
31973
  affectsEmit: true,
31974
+ affectsMultiFileEmitBuildInfo: true,
31975
+ affectsDeclarationPath: true,
31945
31976
  isFilePath: true,
31946
31977
  paramType: ts.Diagnostics.DIRECTORY,
31947
31978
  showInSimplifiedHelpView: true,
@@ -31952,6 +31983,8 @@ var ts;
31952
31983
  name: "rootDir",
31953
31984
  type: "string",
31954
31985
  affectsEmit: true,
31986
+ affectsMultiFileEmitBuildInfo: true,
31987
+ affectsDeclarationPath: true,
31955
31988
  isFilePath: true,
31956
31989
  paramType: ts.Diagnostics.LOCATION,
31957
31990
  category: ts.Diagnostics.Modules,
@@ -31962,6 +31995,8 @@ var ts;
31962
31995
  name: "composite",
31963
31996
  type: "boolean",
31964
31997
  affectsEmit: true,
31998
+ affectsMultiFileEmitBuildInfo: true,
31999
+ affectsBundleEmitBuildInfo: true,
31965
32000
  isTSConfigOnly: true,
31966
32001
  category: ts.Diagnostics.Projects,
31967
32002
  transpileOptionValue: undefined,
@@ -31972,6 +32007,8 @@ var ts;
31972
32007
  name: "tsBuildInfoFile",
31973
32008
  type: "string",
31974
32009
  affectsEmit: true,
32010
+ affectsMultiFileEmitBuildInfo: true,
32011
+ affectsBundleEmitBuildInfo: true,
31975
32012
  isFilePath: true,
31976
32013
  paramType: ts.Diagnostics.FILE,
31977
32014
  category: ts.Diagnostics.Projects,
@@ -31983,6 +32020,7 @@ var ts;
31983
32020
  name: "removeComments",
31984
32021
  type: "boolean",
31985
32022
  affectsEmit: true,
32023
+ affectsMultiFileEmitBuildInfo: true,
31986
32024
  showInSimplifiedHelpView: true,
31987
32025
  category: ts.Diagnostics.Emit,
31988
32026
  defaultValueDescription: false,
@@ -32001,6 +32039,7 @@ var ts;
32001
32039
  name: "importHelpers",
32002
32040
  type: "boolean",
32003
32041
  affectsEmit: true,
32042
+ affectsMultiFileEmitBuildInfo: true,
32004
32043
  category: ts.Diagnostics.Emit,
32005
32044
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
32006
32045
  defaultValueDescription: false,
@@ -32014,6 +32053,7 @@ var ts;
32014
32053
  })),
32015
32054
  affectsEmit: true,
32016
32055
  affectsSemanticDiagnostics: true,
32056
+ affectsMultiFileEmitBuildInfo: true,
32017
32057
  category: ts.Diagnostics.Emit,
32018
32058
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
32019
32059
  defaultValueDescription: 0,
@@ -32022,6 +32062,7 @@ var ts;
32022
32062
  name: "downlevelIteration",
32023
32063
  type: "boolean",
32024
32064
  affectsEmit: true,
32065
+ affectsMultiFileEmitBuildInfo: true,
32025
32066
  category: ts.Diagnostics.Emit,
32026
32067
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
32027
32068
  defaultValueDescription: false,
@@ -32037,6 +32078,7 @@ var ts;
32037
32078
  {
32038
32079
  name: "strict",
32039
32080
  type: "boolean",
32081
+ affectsMultiFileEmitBuildInfo: true,
32040
32082
  showInSimplifiedHelpView: true,
32041
32083
  category: ts.Diagnostics.Type_Checking,
32042
32084
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -32046,6 +32088,7 @@ var ts;
32046
32088
  name: "noImplicitAny",
32047
32089
  type: "boolean",
32048
32090
  affectsSemanticDiagnostics: true,
32091
+ affectsMultiFileEmitBuildInfo: true,
32049
32092
  strictFlag: true,
32050
32093
  category: ts.Diagnostics.Type_Checking,
32051
32094
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -32055,6 +32098,7 @@ var ts;
32055
32098
  name: "strictNullChecks",
32056
32099
  type: "boolean",
32057
32100
  affectsSemanticDiagnostics: true,
32101
+ affectsMultiFileEmitBuildInfo: true,
32058
32102
  strictFlag: true,
32059
32103
  category: ts.Diagnostics.Type_Checking,
32060
32104
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -32063,6 +32107,8 @@ var ts;
32063
32107
  {
32064
32108
  name: "strictFunctionTypes",
32065
32109
  type: "boolean",
32110
+ affectsSemanticDiagnostics: true,
32111
+ affectsMultiFileEmitBuildInfo: true,
32066
32112
  strictFlag: true,
32067
32113
  category: ts.Diagnostics.Type_Checking,
32068
32114
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -32071,6 +32117,8 @@ var ts;
32071
32117
  {
32072
32118
  name: "strictBindCallApply",
32073
32119
  type: "boolean",
32120
+ affectsSemanticDiagnostics: true,
32121
+ affectsMultiFileEmitBuildInfo: true,
32074
32122
  strictFlag: true,
32075
32123
  category: ts.Diagnostics.Type_Checking,
32076
32124
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -32080,6 +32128,7 @@ var ts;
32080
32128
  name: "strictPropertyInitialization",
32081
32129
  type: "boolean",
32082
32130
  affectsSemanticDiagnostics: true,
32131
+ affectsMultiFileEmitBuildInfo: true,
32083
32132
  strictFlag: true,
32084
32133
  category: ts.Diagnostics.Type_Checking,
32085
32134
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -32089,6 +32138,7 @@ var ts;
32089
32138
  name: "noImplicitThis",
32090
32139
  type: "boolean",
32091
32140
  affectsSemanticDiagnostics: true,
32141
+ affectsMultiFileEmitBuildInfo: true,
32092
32142
  strictFlag: true,
32093
32143
  category: ts.Diagnostics.Type_Checking,
32094
32144
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -32098,6 +32148,7 @@ var ts;
32098
32148
  name: "useUnknownInCatchVariables",
32099
32149
  type: "boolean",
32100
32150
  affectsSemanticDiagnostics: true,
32151
+ affectsMultiFileEmitBuildInfo: true,
32101
32152
  strictFlag: true,
32102
32153
  category: ts.Diagnostics.Type_Checking,
32103
32154
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -32107,6 +32158,8 @@ var ts;
32107
32158
  name: "alwaysStrict",
32108
32159
  type: "boolean",
32109
32160
  affectsSourceFile: true,
32161
+ affectsEmit: true,
32162
+ affectsMultiFileEmitBuildInfo: true,
32110
32163
  strictFlag: true,
32111
32164
  category: ts.Diagnostics.Type_Checking,
32112
32165
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -32116,6 +32169,7 @@ var ts;
32116
32169
  name: "noUnusedLocals",
32117
32170
  type: "boolean",
32118
32171
  affectsSemanticDiagnostics: true,
32172
+ affectsMultiFileEmitBuildInfo: true,
32119
32173
  category: ts.Diagnostics.Type_Checking,
32120
32174
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
32121
32175
  defaultValueDescription: false,
@@ -32124,6 +32178,7 @@ var ts;
32124
32178
  name: "noUnusedParameters",
32125
32179
  type: "boolean",
32126
32180
  affectsSemanticDiagnostics: true,
32181
+ affectsMultiFileEmitBuildInfo: true,
32127
32182
  category: ts.Diagnostics.Type_Checking,
32128
32183
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
32129
32184
  defaultValueDescription: false,
@@ -32132,6 +32187,7 @@ var ts;
32132
32187
  name: "exactOptionalPropertyTypes",
32133
32188
  type: "boolean",
32134
32189
  affectsSemanticDiagnostics: true,
32190
+ affectsMultiFileEmitBuildInfo: true,
32135
32191
  category: ts.Diagnostics.Type_Checking,
32136
32192
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
32137
32193
  defaultValueDescription: false,
@@ -32140,6 +32196,7 @@ var ts;
32140
32196
  name: "noImplicitReturns",
32141
32197
  type: "boolean",
32142
32198
  affectsSemanticDiagnostics: true,
32199
+ affectsMultiFileEmitBuildInfo: true,
32143
32200
  category: ts.Diagnostics.Type_Checking,
32144
32201
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
32145
32202
  defaultValueDescription: false,
@@ -32149,6 +32206,7 @@ var ts;
32149
32206
  type: "boolean",
32150
32207
  affectsBindDiagnostics: true,
32151
32208
  affectsSemanticDiagnostics: true,
32209
+ affectsMultiFileEmitBuildInfo: true,
32152
32210
  category: ts.Diagnostics.Type_Checking,
32153
32211
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
32154
32212
  defaultValueDescription: false,
@@ -32157,6 +32215,7 @@ var ts;
32157
32215
  name: "noUncheckedIndexedAccess",
32158
32216
  type: "boolean",
32159
32217
  affectsSemanticDiagnostics: true,
32218
+ affectsMultiFileEmitBuildInfo: true,
32160
32219
  category: ts.Diagnostics.Type_Checking,
32161
32220
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
32162
32221
  defaultValueDescription: false,
@@ -32165,6 +32224,7 @@ var ts;
32165
32224
  name: "noImplicitOverride",
32166
32225
  type: "boolean",
32167
32226
  affectsSemanticDiagnostics: true,
32227
+ affectsMultiFileEmitBuildInfo: true,
32168
32228
  category: ts.Diagnostics.Type_Checking,
32169
32229
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
32170
32230
  defaultValueDescription: false,
@@ -32172,6 +32232,8 @@ var ts;
32172
32232
  {
32173
32233
  name: "noPropertyAccessFromIndexSignature",
32174
32234
  type: "boolean",
32235
+ affectsSemanticDiagnostics: true,
32236
+ affectsMultiFileEmitBuildInfo: true,
32175
32237
  showInSimplifiedHelpView: false,
32176
32238
  category: ts.Diagnostics.Type_Checking,
32177
32239
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -32252,6 +32314,7 @@ var ts;
32252
32314
  name: "allowSyntheticDefaultImports",
32253
32315
  type: "boolean",
32254
32316
  affectsSemanticDiagnostics: true,
32317
+ affectsMultiFileEmitBuildInfo: true,
32255
32318
  category: ts.Diagnostics.Interop_Constraints,
32256
32319
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
32257
32320
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -32261,6 +32324,7 @@ var ts;
32261
32324
  type: "boolean",
32262
32325
  affectsSemanticDiagnostics: true,
32263
32326
  affectsEmit: true,
32327
+ affectsMultiFileEmitBuildInfo: true,
32264
32328
  showInSimplifiedHelpView: true,
32265
32329
  category: ts.Diagnostics.Interop_Constraints,
32266
32330
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -32277,6 +32341,7 @@ var ts;
32277
32341
  name: "allowUmdGlobalAccess",
32278
32342
  type: "boolean",
32279
32343
  affectsSemanticDiagnostics: true,
32344
+ affectsMultiFileEmitBuildInfo: true,
32280
32345
  category: ts.Diagnostics.Modules,
32281
32346
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
32282
32347
  defaultValueDescription: false,
@@ -32297,6 +32362,7 @@ var ts;
32297
32362
  name: "sourceRoot",
32298
32363
  type: "string",
32299
32364
  affectsEmit: true,
32365
+ affectsMultiFileEmitBuildInfo: true,
32300
32366
  paramType: ts.Diagnostics.LOCATION,
32301
32367
  category: ts.Diagnostics.Emit,
32302
32368
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -32305,6 +32371,7 @@ var ts;
32305
32371
  name: "mapRoot",
32306
32372
  type: "string",
32307
32373
  affectsEmit: true,
32374
+ affectsMultiFileEmitBuildInfo: true,
32308
32375
  paramType: ts.Diagnostics.LOCATION,
32309
32376
  category: ts.Diagnostics.Emit,
32310
32377
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -32313,6 +32380,7 @@ var ts;
32313
32380
  name: "inlineSourceMap",
32314
32381
  type: "boolean",
32315
32382
  affectsEmit: true,
32383
+ affectsMultiFileEmitBuildInfo: true,
32316
32384
  category: ts.Diagnostics.Emit,
32317
32385
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
32318
32386
  defaultValueDescription: false,
@@ -32321,6 +32389,7 @@ var ts;
32321
32389
  name: "inlineSources",
32322
32390
  type: "boolean",
32323
32391
  affectsEmit: true,
32392
+ affectsMultiFileEmitBuildInfo: true,
32324
32393
  category: ts.Diagnostics.Emit,
32325
32394
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
32326
32395
  defaultValueDescription: false,
@@ -32329,6 +32398,7 @@ var ts;
32329
32398
  name: "experimentalDecorators",
32330
32399
  type: "boolean",
32331
32400
  affectsSemanticDiagnostics: true,
32401
+ affectsMultiFileEmitBuildInfo: true,
32332
32402
  category: ts.Diagnostics.Language_and_Environment,
32333
32403
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
32334
32404
  defaultValueDescription: false,
@@ -32338,6 +32408,7 @@ var ts;
32338
32408
  type: "boolean",
32339
32409
  affectsSemanticDiagnostics: true,
32340
32410
  affectsEmit: true,
32411
+ affectsMultiFileEmitBuildInfo: true,
32341
32412
  category: ts.Diagnostics.Language_and_Environment,
32342
32413
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
32343
32414
  defaultValueDescription: false,
@@ -32361,6 +32432,7 @@ var ts;
32361
32432
  type: "string",
32362
32433
  affectsSemanticDiagnostics: true,
32363
32434
  affectsEmit: true,
32435
+ affectsMultiFileEmitBuildInfo: true,
32364
32436
  affectsModuleResolution: true,
32365
32437
  category: ts.Diagnostics.Language_and_Environment,
32366
32438
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -32378,6 +32450,9 @@ var ts;
32378
32450
  name: "out",
32379
32451
  type: "string",
32380
32452
  affectsEmit: true,
32453
+ affectsMultiFileEmitBuildInfo: true,
32454
+ affectsDeclarationPath: true,
32455
+ affectsBundleEmitBuildInfo: true,
32381
32456
  isFilePath: false,
32382
32457
  category: ts.Diagnostics.Backwards_Compatibility,
32383
32458
  paramType: ts.Diagnostics.FILE,
@@ -32388,6 +32463,7 @@ var ts;
32388
32463
  name: "reactNamespace",
32389
32464
  type: "string",
32390
32465
  affectsEmit: true,
32466
+ affectsMultiFileEmitBuildInfo: true,
32391
32467
  category: ts.Diagnostics.Language_and_Environment,
32392
32468
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
32393
32469
  defaultValueDescription: "`React`",
@@ -32395,6 +32471,7 @@ var ts;
32395
32471
  {
32396
32472
  name: "skipDefaultLibCheck",
32397
32473
  type: "boolean",
32474
+ affectsMultiFileEmitBuildInfo: true,
32398
32475
  category: ts.Diagnostics.Completeness,
32399
32476
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
32400
32477
  defaultValueDescription: false,
@@ -32410,6 +32487,7 @@ var ts;
32410
32487
  name: "emitBOM",
32411
32488
  type: "boolean",
32412
32489
  affectsEmit: true,
32490
+ affectsMultiFileEmitBuildInfo: true,
32413
32491
  category: ts.Diagnostics.Emit,
32414
32492
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
32415
32493
  defaultValueDescription: false,
@@ -32421,6 +32499,7 @@ var ts;
32421
32499
  lf: 1
32422
32500
  })),
32423
32501
  affectsEmit: true,
32502
+ affectsMultiFileEmitBuildInfo: true,
32424
32503
  paramType: ts.Diagnostics.NEWLINE,
32425
32504
  category: ts.Diagnostics.Emit,
32426
32505
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -32430,6 +32509,7 @@ var ts;
32430
32509
  name: "noErrorTruncation",
32431
32510
  type: "boolean",
32432
32511
  affectsSemanticDiagnostics: true,
32512
+ affectsMultiFileEmitBuildInfo: true,
32433
32513
  category: ts.Diagnostics.Output_Formatting,
32434
32514
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
32435
32515
  defaultValueDescription: false,
@@ -32456,6 +32536,7 @@ var ts;
32456
32536
  name: "stripInternal",
32457
32537
  type: "boolean",
32458
32538
  affectsEmit: true,
32539
+ affectsMultiFileEmitBuildInfo: true,
32459
32540
  category: ts.Diagnostics.Emit,
32460
32541
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
32461
32542
  defaultValueDescription: false,
@@ -32496,6 +32577,7 @@ var ts;
32496
32577
  name: "noImplicitUseStrict",
32497
32578
  type: "boolean",
32498
32579
  affectsSemanticDiagnostics: true,
32580
+ affectsMultiFileEmitBuildInfo: true,
32499
32581
  category: ts.Diagnostics.Backwards_Compatibility,
32500
32582
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
32501
32583
  defaultValueDescription: false,
@@ -32504,6 +32586,7 @@ var ts;
32504
32586
  name: "noEmitHelpers",
32505
32587
  type: "boolean",
32506
32588
  affectsEmit: true,
32589
+ affectsMultiFileEmitBuildInfo: true,
32507
32590
  category: ts.Diagnostics.Emit,
32508
32591
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
32509
32592
  defaultValueDescription: false,
@@ -32512,6 +32595,7 @@ var ts;
32512
32595
  name: "noEmitOnError",
32513
32596
  type: "boolean",
32514
32597
  affectsEmit: true,
32598
+ affectsMultiFileEmitBuildInfo: true,
32515
32599
  category: ts.Diagnostics.Emit,
32516
32600
  transpileOptionValue: undefined,
32517
32601
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -32521,6 +32605,7 @@ var ts;
32521
32605
  name: "preserveConstEnums",
32522
32606
  type: "boolean",
32523
32607
  affectsEmit: true,
32608
+ affectsMultiFileEmitBuildInfo: true,
32524
32609
  category: ts.Diagnostics.Emit,
32525
32610
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
32526
32611
  defaultValueDescription: false,
@@ -32529,6 +32614,8 @@ var ts;
32529
32614
  name: "declarationDir",
32530
32615
  type: "string",
32531
32616
  affectsEmit: true,
32617
+ affectsMultiFileEmitBuildInfo: true,
32618
+ affectsDeclarationPath: true,
32532
32619
  isFilePath: true,
32533
32620
  paramType: ts.Diagnostics.DIRECTORY,
32534
32621
  category: ts.Diagnostics.Emit,
@@ -32538,6 +32625,7 @@ var ts;
32538
32625
  {
32539
32626
  name: "skipLibCheck",
32540
32627
  type: "boolean",
32628
+ affectsMultiFileEmitBuildInfo: true,
32541
32629
  category: ts.Diagnostics.Completeness,
32542
32630
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
32543
32631
  defaultValueDescription: false,
@@ -32547,6 +32635,7 @@ var ts;
32547
32635
  type: "boolean",
32548
32636
  affectsBindDiagnostics: true,
32549
32637
  affectsSemanticDiagnostics: true,
32638
+ affectsMultiFileEmitBuildInfo: true,
32550
32639
  category: ts.Diagnostics.Type_Checking,
32551
32640
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
32552
32641
  defaultValueDescription: undefined,
@@ -32556,6 +32645,7 @@ var ts;
32556
32645
  type: "boolean",
32557
32646
  affectsBindDiagnostics: true,
32558
32647
  affectsSemanticDiagnostics: true,
32648
+ affectsMultiFileEmitBuildInfo: true,
32559
32649
  category: ts.Diagnostics.Type_Checking,
32560
32650
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
32561
32651
  defaultValueDescription: undefined,
@@ -32564,6 +32654,7 @@ var ts;
32564
32654
  name: "suppressExcessPropertyErrors",
32565
32655
  type: "boolean",
32566
32656
  affectsSemanticDiagnostics: true,
32657
+ affectsMultiFileEmitBuildInfo: true,
32567
32658
  category: ts.Diagnostics.Backwards_Compatibility,
32568
32659
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
32569
32660
  defaultValueDescription: false,
@@ -32572,6 +32663,7 @@ var ts;
32572
32663
  name: "suppressImplicitAnyIndexErrors",
32573
32664
  type: "boolean",
32574
32665
  affectsSemanticDiagnostics: true,
32666
+ affectsMultiFileEmitBuildInfo: true,
32575
32667
  category: ts.Diagnostics.Backwards_Compatibility,
32576
32668
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
32577
32669
  defaultValueDescription: false,
@@ -32596,6 +32688,7 @@ var ts;
32596
32688
  name: "noStrictGenericChecks",
32597
32689
  type: "boolean",
32598
32690
  affectsSemanticDiagnostics: true,
32691
+ affectsMultiFileEmitBuildInfo: true,
32599
32692
  category: ts.Diagnostics.Backwards_Compatibility,
32600
32693
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
32601
32694
  defaultValueDescription: false,
@@ -32605,6 +32698,7 @@ var ts;
32605
32698
  type: "boolean",
32606
32699
  affectsSemanticDiagnostics: true,
32607
32700
  affectsEmit: true,
32701
+ affectsMultiFileEmitBuildInfo: true,
32608
32702
  category: ts.Diagnostics.Language_and_Environment,
32609
32703
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
32610
32704
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -32613,6 +32707,7 @@ var ts;
32613
32707
  name: "preserveValueImports",
32614
32708
  type: "boolean",
32615
32709
  affectsEmit: true,
32710
+ affectsMultiFileEmitBuildInfo: true,
32616
32711
  category: ts.Diagnostics.Emit,
32617
32712
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
32618
32713
  defaultValueDescription: false,
@@ -32651,6 +32746,7 @@ var ts;
32651
32746
  ts.optionDeclarations = __spreadArray(__spreadArray([], ts.commonOptionsWithBuild, true), commandOptionsWithoutBuild, true);
32652
32747
  ts.semanticDiagnosticsOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsSemanticDiagnostics; });
32653
32748
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
32749
+ ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
32654
32750
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
32655
32751
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
32656
32752
  return !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics;
@@ -33430,6 +33526,7 @@ var ts;
33430
33526
  }
33431
33527
  });
33432
33528
  }
33529
+ ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
33433
33530
  function serializeCompilerOptions(options, pathOptions) {
33434
33531
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
33435
33532
  }
@@ -34266,7 +34363,7 @@ var ts;
34266
34363
  }
34267
34364
  if (ts.isImplicitGlob(spec.substring(spec.lastIndexOf(ts.directorySeparator) + 1))) {
34268
34365
  return {
34269
- key: useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec),
34366
+ key: ts.removeTrailingDirectorySeparator(useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec)),
34270
34367
  flags: 1
34271
34368
  };
34272
34369
  }
@@ -38491,12 +38588,14 @@ var ts;
38491
38588
  }
38492
38589
  }
38493
38590
  function setCommonJsModuleIndicator(node) {
38494
- if (file.externalModuleIndicator) {
38591
+ if (file.externalModuleIndicator && file.externalModuleIndicator !== true) {
38495
38592
  return false;
38496
38593
  }
38497
38594
  if (!file.commonJsModuleIndicator) {
38498
38595
  file.commonJsModuleIndicator = node;
38499
- bindSourceFileAsExternalModule();
38596
+ if (!file.externalModuleIndicator) {
38597
+ bindSourceFileAsExternalModule();
38598
+ }
38500
38599
  }
38501
38600
  return true;
38502
38601
  }
@@ -38849,7 +38948,11 @@ var ts;
38849
38948
  checkStrictModeEvalOrArguments(node, node.name);
38850
38949
  }
38851
38950
  if (!ts.isBindingPattern(node.name)) {
38852
- if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) && !ts.getJSDocTypeTag(node) && !(ts.getCombinedModifierFlags(node) & 1)) {
38951
+ var possibleVariableDecl = node.kind === 254 ? node : node.parent.parent;
38952
+ if (ts.isInJSFile(node) &&
38953
+ ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) &&
38954
+ !ts.getJSDocTypeTag(node) &&
38955
+ !(ts.getCombinedModifierFlags(node) & 1)) {
38853
38956
  declareSymbolAndAddToSymbolTable(node, 2097152, 2097152);
38854
38957
  }
38855
38958
  else if (ts.isBlockOrCatchScoped(node)) {
@@ -41162,7 +41265,8 @@ var ts;
41162
41265
  && isAliasableOrJsExpression(node.parent.right)
41163
41266
  || node.kind === 297
41164
41267
  || node.kind === 296 && isAliasableOrJsExpression(node.initializer)
41165
- || ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node);
41268
+ || node.kind === 254 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)
41269
+ || node.kind === 203 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent);
41166
41270
  }
41167
41271
  function isAliasableOrJsExpression(e) {
41168
41272
  return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e);
@@ -41243,7 +41347,7 @@ var ts;
41243
41347
  if (!ts.isSourceFileJS(file)) {
41244
41348
  return hasExportAssignmentSymbol(moduleSymbol);
41245
41349
  }
41246
- return !file.externalModuleIndicator && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), undefined, dontResolveAlias);
41350
+ return typeof file.externalModuleIndicator !== "object" && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), undefined, dontResolveAlias);
41247
41351
  }
41248
41352
  function getTargetOfImportClause(node, dontResolveAlias) {
41249
41353
  var _a;
@@ -56807,17 +56911,32 @@ var ts;
56807
56911
  return sourceStart.slice(0, startLen) !== targetStart.slice(0, startLen) ||
56808
56912
  sourceEnd.slice(sourceEnd.length - endLen) !== targetEnd.slice(targetEnd.length - endLen);
56809
56913
  }
56810
- function isValidBigIntString(s) {
56914
+ function isValidNumberString(s, roundTripOnly) {
56915
+ if (s === "")
56916
+ return false;
56917
+ var n = +s;
56918
+ return isFinite(n) && (!roundTripOnly || "" + n === s);
56919
+ }
56920
+ function parseBigIntLiteralType(text) {
56921
+ var negative = text.startsWith("-");
56922
+ var base10Value = ts.parsePseudoBigInt((negative ? text.slice(1) : text) + "n");
56923
+ return getBigIntLiteralType({ negative: negative, base10Value: base10Value });
56924
+ }
56925
+ function isValidBigIntString(s, roundTripOnly) {
56926
+ if (s === "")
56927
+ return false;
56811
56928
  var scanner = ts.createScanner(99, false);
56812
56929
  var success = true;
56813
56930
  scanner.setOnError(function () { return success = false; });
56814
56931
  scanner.setText(s + "n");
56815
56932
  var result = scanner.scan();
56816
- if (result === 40) {
56933
+ var negative = result === 40;
56934
+ if (negative) {
56817
56935
  result = scanner.scan();
56818
56936
  }
56819
56937
  var flags = scanner.getTokenFlags();
56820
- return success && result === 9 && scanner.getTextPos() === (s.length + 1) && !(flags & 512);
56938
+ return success && result === 9 && scanner.getTextPos() === (s.length + 1) && !(flags & 512)
56939
+ && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
56821
56940
  }
56822
56941
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
56823
56942
  if (source === target || target.flags & (1 | 4)) {
@@ -56825,8 +56944,8 @@ var ts;
56825
56944
  }
56826
56945
  if (source.flags & 128) {
56827
56946
  var value = source.value;
56828
- return !!(target.flags & 8 && value !== "" && isFinite(+value) ||
56829
- target.flags & 64 && value !== "" && isValidBigIntString(value) ||
56947
+ return !!(target.flags & 8 && isValidNumberString(value, false) ||
56948
+ target.flags & 64 && isValidBigIntString(value, false) ||
56830
56949
  target.flags & (512 | 98304) && value === target.intrinsicName);
56831
56950
  }
56832
56951
  if (source.flags & 134217728) {
@@ -57291,8 +57410,51 @@ var ts;
57291
57410
  var matches = inferTypesFromTemplateLiteralType(source, target);
57292
57411
  var types = target.types;
57293
57412
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
57413
+ var _loop_23 = function (i) {
57414
+ var source_1 = matches ? matches[i] : neverType;
57415
+ var target_3 = types[i];
57416
+ if (source_1.flags & 128 && target_3.flags & 8650752) {
57417
+ var inferenceContext = getInferenceInfoForType(target_3);
57418
+ var constraint = inferenceContext ? getBaseConstraintOfType(inferenceContext.typeParameter) : undefined;
57419
+ if (constraint && !isTypeAny(constraint)) {
57420
+ var constraintTypes = constraint.flags & 1048576 ? constraint.types : [constraint];
57421
+ var allTypeFlags_1 = ts.reduceLeft(constraintTypes, function (flags, t) { return flags | t.flags; }, 0);
57422
+ if (!(allTypeFlags_1 & 4)) {
57423
+ var str_1 = source_1.value;
57424
+ if (allTypeFlags_1 & 296 && !isValidNumberString(str_1, true)) {
57425
+ allTypeFlags_1 &= ~296;
57426
+ }
57427
+ if (allTypeFlags_1 & 2112 && !isValidBigIntString(str_1, true)) {
57428
+ allTypeFlags_1 &= ~2112;
57429
+ }
57430
+ var matchingType = ts.reduceLeft(constraintTypes, function (left, right) {
57431
+ return !(right.flags & allTypeFlags_1) ? left :
57432
+ left.flags & 4 ? left : right.flags & 4 ? source_1 :
57433
+ left.flags & 134217728 ? left : right.flags & 134217728 && isTypeMatchedByTemplateLiteralType(source_1, right) ? source_1 :
57434
+ left.flags & 268435456 ? left : right.flags & 268435456 && str_1 === applyStringMapping(right.symbol, str_1) ? source_1 :
57435
+ left.flags & 128 ? left : right.flags & 128 && right.value === str_1 ? right :
57436
+ left.flags & 8 ? left : right.flags & 8 ? getNumberLiteralType(+str_1) :
57437
+ left.flags & 32 ? left : right.flags & 32 ? getNumberLiteralType(+str_1) :
57438
+ left.flags & 256 ? left : right.flags & 256 && right.value === +str_1 ? right :
57439
+ left.flags & 64 ? left : right.flags & 64 ? parseBigIntLiteralType(str_1) :
57440
+ left.flags & 2048 ? left : right.flags & 2048 && ts.pseudoBigIntToString(right.value) === str_1 ? right :
57441
+ left.flags & 16 ? left : right.flags & 16 ? str_1 === "true" ? trueType : str_1 === "false" ? falseType : booleanType :
57442
+ left.flags & 512 ? left : right.flags & 512 && right.intrinsicName === str_1 ? right :
57443
+ left.flags & 32768 ? left : right.flags & 32768 && right.intrinsicName === str_1 ? right :
57444
+ left.flags & 65536 ? left : right.flags & 65536 && right.intrinsicName === str_1 ? right :
57445
+ left;
57446
+ }, neverType);
57447
+ if (!(matchingType.flags & 131072)) {
57448
+ inferFromTypes(matchingType, target_3);
57449
+ return "continue";
57450
+ }
57451
+ }
57452
+ }
57453
+ }
57454
+ inferFromTypes(source_1, target_3);
57455
+ };
57294
57456
  for (var i = 0; i < types.length; i++) {
57295
- inferFromTypes(matches ? matches[i] : neverType, types[i]);
57457
+ _loop_23(i);
57296
57458
  }
57297
57459
  }
57298
57460
  }
@@ -57762,7 +57924,7 @@ var ts;
57762
57924
  function mapTypesByKeyProperty(types, name) {
57763
57925
  var map = new ts.Map();
57764
57926
  var count = 0;
57765
- var _loop_23 = function (type) {
57927
+ var _loop_24 = function (type) {
57766
57928
  if (type.flags & (524288 | 2097152 | 58982400)) {
57767
57929
  var discriminant = getTypeOfPropertyOfType(type, name);
57768
57930
  if (discriminant) {
@@ -57788,7 +57950,7 @@ var ts;
57788
57950
  };
57789
57951
  for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
57790
57952
  var type = types_16[_i];
57791
- var state_9 = _loop_23(type);
57953
+ var state_9 = _loop_24(type);
57792
57954
  if (typeof state_9 === "object")
57793
57955
  return state_9.value;
57794
57956
  }
@@ -63211,7 +63373,7 @@ var ts;
63211
63373
  var spreadIndex = getSpreadArgumentIndex(args);
63212
63374
  if (spreadIndex >= 0) {
63213
63375
  var effectiveArgs_1 = args.slice(0, spreadIndex);
63214
- var _loop_24 = function (i) {
63376
+ var _loop_25 = function (i) {
63215
63377
  var arg = args[i];
63216
63378
  var spreadType = arg.kind === 225 && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
63217
63379
  if (spreadType && isTupleType(spreadType)) {
@@ -63227,7 +63389,7 @@ var ts;
63227
63389
  }
63228
63390
  };
63229
63391
  for (var i = spreadIndex; i < args.length; i++) {
63230
- _loop_24(i);
63392
+ _loop_25(i);
63231
63393
  }
63232
63394
  return effectiveArgs_1;
63233
63395
  }
@@ -63475,7 +63637,7 @@ var ts;
63475
63637
  var min_3 = Number.MAX_VALUE;
63476
63638
  var minIndex = 0;
63477
63639
  var i_1 = 0;
63478
- var _loop_25 = function (c) {
63640
+ var _loop_26 = function (c) {
63479
63641
  var chain_2 = function () { return ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
63480
63642
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0, true, chain_2);
63481
63643
  if (diags_2) {
@@ -63493,7 +63655,7 @@ var ts;
63493
63655
  };
63494
63656
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
63495
63657
  var c = candidatesForArgumentError_1[_a];
63496
- _loop_25(c);
63658
+ _loop_26(c);
63497
63659
  }
63498
63660
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
63499
63661
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -63636,7 +63798,7 @@ var ts;
63636
63798
  }
63637
63799
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
63638
63800
  var parameters = [];
63639
- var _loop_26 = function (i) {
63801
+ var _loop_27 = function (i) {
63640
63802
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
63641
63803
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
63642
63804
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -63644,7 +63806,7 @@ var ts;
63644
63806
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
63645
63807
  };
63646
63808
  for (var i = 0; i < maxNonRestParam; i++) {
63647
- _loop_26(i);
63809
+ _loop_27(i);
63648
63810
  }
63649
63811
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
63650
63812
  var flags = 0;
@@ -67240,7 +67402,7 @@ var ts;
67240
67402
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
67241
67403
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
67242
67404
  var indexSignatureMap_1 = new ts.Map();
67243
- var _loop_27 = function (declaration) {
67405
+ var _loop_28 = function (declaration) {
67244
67406
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
67245
67407
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
67246
67408
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -67255,7 +67417,7 @@ var ts;
67255
67417
  };
67256
67418
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
67257
67419
  var declaration = _a[_i];
67258
- _loop_27(declaration);
67420
+ _loop_28(declaration);
67259
67421
  }
67260
67422
  indexSignatureMap_1.forEach(function (entry) {
67261
67423
  if (entry.declarations.length > 1) {
@@ -69081,7 +69243,7 @@ var ts;
69081
69243
  return;
69082
69244
  }
69083
69245
  var symbol = getSymbolOfNode(node);
69084
- if (symbol.flags & 2097152 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)) {
69246
+ if (symbol.flags & 2097152 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 ? node.parent.parent : node)) {
69085
69247
  checkAliasSymbol(node);
69086
69248
  return;
69087
69249
  }
@@ -70075,7 +70237,7 @@ var ts;
70075
70237
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 258) : undefined;
70076
70238
  var localPropDeclaration = declaration && declaration.kind === 221 ||
70077
70239
  name && name.kind === 162 || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
70078
- var _loop_28 = function (info) {
70240
+ var _loop_29 = function (info) {
70079
70241
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
70080
70242
  var errorNode = localPropDeclaration || localIndexDeclaration ||
70081
70243
  (interfaceDeclaration && !ts.some(getBaseTypes(type), function (base) { return !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info.keyType); }) ? interfaceDeclaration : undefined);
@@ -70085,7 +70247,7 @@ var ts;
70085
70247
  };
70086
70248
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
70087
70249
  var info = indexInfos_9[_i];
70088
- _loop_28(info);
70250
+ _loop_29(info);
70089
70251
  }
70090
70252
  }
70091
70253
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -70093,7 +70255,7 @@ var ts;
70093
70255
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
70094
70256
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 258) : undefined;
70095
70257
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
70096
- var _loop_29 = function (info) {
70258
+ var _loop_30 = function (info) {
70097
70259
  if (info === checkInfo)
70098
70260
  return "continue";
70099
70261
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -70105,7 +70267,7 @@ var ts;
70105
70267
  };
70106
70268
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
70107
70269
  var info = indexInfos_10[_i];
70108
- _loop_29(info);
70270
+ _loop_30(info);
70109
70271
  }
70110
70272
  }
70111
70273
  function checkTypeNameIsReserved(name, message) {
@@ -70399,7 +70561,7 @@ var ts;
70399
70561
  var baseTypes = baseTypeNode && getBaseTypes(type);
70400
70562
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
70401
70563
  var baseStaticType = getBaseConstructorTypeOfClass(type);
70402
- var _loop_30 = function (member) {
70564
+ var _loop_31 = function (member) {
70403
70565
  if (ts.hasAmbientModifier(member)) {
70404
70566
  return "continue";
70405
70567
  }
@@ -70414,7 +70576,7 @@ var ts;
70414
70576
  };
70415
70577
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
70416
70578
  var member = _a[_i];
70417
- _loop_30(member);
70579
+ _loop_31(member);
70418
70580
  }
70419
70581
  }
70420
70582
  function checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member, memberIsParameterProperty, reportErrors) {
@@ -70489,7 +70651,7 @@ var ts;
70489
70651
  }
70490
70652
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
70491
70653
  var issuedMemberError = false;
70492
- var _loop_31 = function (member) {
70654
+ var _loop_32 = function (member) {
70493
70655
  if (ts.isStatic(member)) {
70494
70656
  return "continue";
70495
70657
  }
@@ -70507,7 +70669,7 @@ var ts;
70507
70669
  };
70508
70670
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
70509
70671
  var member = _a[_i];
70510
- _loop_31(member);
70672
+ _loop_32(member);
70511
70673
  }
70512
70674
  if (!issuedMemberError) {
70513
70675
  checkTypeAssignableTo(typeWithThis, baseWithThis, node.name || node, broadDiag);
@@ -75637,9 +75799,7 @@ var ts;
75637
75799
  var ts;
75638
75800
  (function (ts) {
75639
75801
  function createSourceMapGenerator(host, file, sourceRoot, sourcesDirectoryPath, generatorOptions) {
75640
- var _a = generatorOptions.extendedDiagnostics
75641
- ? ts.performance.createTimer("Source Map", "beforeSourcemap", "afterSourcemap")
75642
- : ts.performance.nullTimer, enter = _a.enter, exit = _a.exit;
75802
+ var _a = ts.performance.createTimerIf(!!generatorOptions.extendedDiagnostics, "Source Map", "beforeSourcemap", "afterSourcemap"), enter = _a.enter, exit = _a.exit;
75643
75803
  var rawSources = [];
75644
75804
  var sources = [];
75645
75805
  var sourceToSourceIndexMap = new ts.Map();
@@ -90405,7 +90565,8 @@ var ts;
90405
90565
  return;
90406
90566
  }
90407
90567
  var version = ts.version;
90408
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), false);
90568
+ var buildInfo = { bundle: bundle, program: program, version: version };
90569
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), false, undefined, { buildInfo: buildInfo });
90409
90570
  }
90410
90571
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
90411
90572
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -90546,12 +90707,17 @@ var ts;
90546
90707
  if (sourceMapFilePath) {
90547
90708
  var sourceMap = sourceMapGenerator.toString();
90548
90709
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, false, sourceFiles);
90710
+ if (printer.bundleFileInfo)
90711
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
90549
90712
  }
90550
90713
  }
90551
90714
  else {
90552
90715
  writer.writeLine();
90553
90716
  }
90554
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
90717
+ var text = writer.getText();
90718
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
90719
+ if (printer.bundleFileInfo)
90720
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
90555
90721
  writer.clear();
90556
90722
  }
90557
90723
  function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
@@ -90676,30 +90842,50 @@ var ts;
90676
90842
  });
90677
90843
  }
90678
90844
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
90845
+ var createHash = ts.maybeBind(host, host.createHash);
90679
90846
  var _a = getOutputPathsForBundle(config.options, false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
90680
- var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
90681
- if (!buildInfoText)
90847
+ var buildInfo;
90848
+ if (host.getBuildInfo) {
90849
+ var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
90850
+ if (!hostBuildInfo)
90851
+ return buildInfoPath;
90852
+ buildInfo = hostBuildInfo;
90853
+ }
90854
+ else {
90855
+ var buildInfoText = host.readFile(buildInfoPath);
90856
+ if (!buildInfoText)
90857
+ return buildInfoPath;
90858
+ buildInfo = getBuildInfo(buildInfoText);
90859
+ }
90860
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
90682
90861
  return buildInfoPath;
90683
90862
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
90684
90863
  if (!jsFileText)
90685
90864
  return jsFilePath;
90865
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
90866
+ return jsFilePath;
90686
90867
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
90687
90868
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
90688
90869
  return sourceMapFilePath || "inline sourcemap decoding";
90870
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
90871
+ return sourceMapFilePath;
90689
90872
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
90690
90873
  if (declarationFilePath && !declarationText)
90691
90874
  return declarationFilePath;
90875
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
90876
+ return declarationFilePath;
90692
90877
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
90693
90878
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
90694
90879
  return declarationMapPath || "inline sourcemap decoding";
90695
- var buildInfo = getBuildInfo(buildInfoText);
90696
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
90697
- return buildInfoPath;
90880
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
90881
+ return declarationMapPath;
90698
90882
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
90699
90883
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo, true);
90700
90884
  var outputFiles = [];
90701
90885
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
90702
90886
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
90887
+ var changedDtsText;
90888
+ var changedDtsData;
90703
90889
  var emitHost = {
90704
90890
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
90705
90891
  getCanonicalFileName: host.getCanonicalFileName,
@@ -90715,7 +90901,7 @@ var ts;
90715
90901
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
90716
90902
  getProjectReferenceRedirect: ts.returnUndefined,
90717
90903
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
90718
- writeFile: function (name, text, writeByteOrderMark) {
90904
+ writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
90719
90905
  switch (name) {
90720
90906
  case jsFilePath:
90721
90907
  if (jsFileText === text)
@@ -90726,19 +90912,25 @@ var ts;
90726
90912
  return;
90727
90913
  break;
90728
90914
  case buildInfoPath:
90729
- var newBuildInfo = getBuildInfo(text);
90915
+ var newBuildInfo = data.buildInfo;
90730
90916
  newBuildInfo.program = buildInfo.program;
90917
+ if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
90918
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
90919
+ newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
90920
+ }
90731
90921
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
90732
90922
  newBuildInfo.bundle.js.sources = js.sources;
90733
90923
  if (dts) {
90734
90924
  newBuildInfo.bundle.dts.sources = dts.sources;
90735
90925
  }
90736
90926
  newBuildInfo.bundle.sourceFiles = sourceFiles;
90737
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
90927
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
90738
90928
  return;
90739
90929
  case declarationFilePath:
90740
90930
  if (declarationText === text)
90741
90931
  return;
90932
+ changedDtsText = text;
90933
+ changedDtsData = data;
90742
90934
  break;
90743
90935
  case declarationMapPath:
90744
90936
  if (declarationMapText === text)
@@ -90757,6 +90949,7 @@ var ts;
90757
90949
  getSourceFileFromReference: ts.returnUndefined,
90758
90950
  redirectTargetsMap: ts.createMultiMap(),
90759
90951
  getFileIncludeReasons: ts.notImplemented,
90952
+ createHash: createHash,
90760
90953
  };
90761
90954
  emitFiles(ts.notImplementedResolver, emitHost, undefined, ts.getTransformers(config.options, customTransformers));
90762
90955
  return outputFiles;
@@ -95381,7 +95574,6 @@ var ts;
95381
95574
  if (system === void 0) { system = ts.sys; }
95382
95575
  var existingDirectories = new ts.Map();
95383
95576
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
95384
- var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
95385
95577
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
95386
95578
  var text;
95387
95579
  try {
@@ -95411,7 +95603,7 @@ var ts;
95411
95603
  function writeFile(fileName, data, writeByteOrderMark, onError) {
95412
95604
  try {
95413
95605
  ts.performance.mark("beforeIOWrite");
95414
- ts.writeFileEnsuringDirectories(fileName, data, writeByteOrderMark, function (path, data, writeByteOrderMark) { return writeFileWorker(path, data, writeByteOrderMark); }, function (path) { return (compilerHost.createDirectory || system.createDirectory)(path); }, function (path) { return directoryExists(path); });
95606
+ ts.writeFileEnsuringDirectories(fileName, data, writeByteOrderMark, function (path, data, writeByteOrderMark) { return system.writeFile(path, data, writeByteOrderMark); }, function (path) { return (compilerHost.createDirectory || system.createDirectory)(path); }, function (path) { return directoryExists(path); });
95415
95607
  ts.performance.mark("afterIOWrite");
95416
95608
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
95417
95609
  }
@@ -95421,34 +95613,6 @@ var ts;
95421
95613
  }
95422
95614
  }
95423
95615
  }
95424
- var outputFingerprints;
95425
- function writeFileWorker(fileName, data, writeByteOrderMark) {
95426
- if (!ts.isWatchSet(options) || !system.getModifiedTime) {
95427
- system.writeFile(fileName, data, writeByteOrderMark);
95428
- return;
95429
- }
95430
- if (!outputFingerprints) {
95431
- outputFingerprints = new ts.Map();
95432
- }
95433
- var hash = computeHash(data);
95434
- var mtimeBefore = system.getModifiedTime(fileName);
95435
- if (mtimeBefore) {
95436
- var fingerprint = outputFingerprints.get(fileName);
95437
- if (fingerprint &&
95438
- fingerprint.byteOrderMark === writeByteOrderMark &&
95439
- fingerprint.hash === hash &&
95440
- fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
95441
- return;
95442
- }
95443
- }
95444
- system.writeFile(fileName, data, writeByteOrderMark);
95445
- var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
95446
- outputFingerprints.set(fileName, {
95447
- hash: hash,
95448
- byteOrderMark: writeByteOrderMark,
95449
- mtime: mtimeAfter
95450
- });
95451
- }
95452
95616
  function getDefaultLibLocation() {
95453
95617
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
95454
95618
  }
@@ -96822,6 +96986,7 @@ var ts;
96822
96986
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
96823
96987
  redirectTargetsMap: redirectTargetsMap,
96824
96988
  getFileIncludeReasons: program.getFileIncludeReasons,
96989
+ createHash: ts.maybeBind(host, host.createHash),
96825
96990
  };
96826
96991
  }
96827
96992
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -98728,13 +98893,9 @@ var ts;
98728
98893
  function createManyToManyPathMap() {
98729
98894
  function create(forward, reverse, deleted) {
98730
98895
  var map = {
98731
- clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
98732
- forEach: function (fn) { return forward.forEach(fn); },
98733
98896
  getKeys: function (v) { return reverse.get(v); },
98734
98897
  getValues: function (k) { return forward.get(k); },
98735
- hasKey: function (k) { return forward.has(k); },
98736
98898
  keys: function () { return forward.keys(); },
98737
- deletedKeys: function () { return deleted; },
98738
98899
  deleteKey: function (k) {
98739
98900
  (deleted || (deleted = new ts.Set())).add(k);
98740
98901
  var set = forward.get(k);
@@ -98761,11 +98922,6 @@ var ts;
98761
98922
  });
98762
98923
  return map;
98763
98924
  },
98764
- clear: function () {
98765
- forward.clear();
98766
- reverse.clear();
98767
- deleted === null || deleted === void 0 ? void 0 : deleted.clear();
98768
- }
98769
98925
  };
98770
98926
  return map;
98771
98927
  }
@@ -98869,35 +99025,45 @@ var ts;
98869
99025
  }
98870
99026
  BuilderState.canReuseOldState = canReuseOldState;
98871
99027
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
99028
+ var _a, _b, _c;
98872
99029
  var fileInfos = new ts.Map();
98873
99030
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
98874
99031
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
98875
- var hasCalledUpdateShapeSignature = new ts.Set();
98876
99032
  var useOldState = canReuseOldState(referencedMap, oldState);
98877
99033
  newProgram.getTypeChecker();
98878
- for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
98879
- var sourceFile = _a[_i];
99034
+ for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
99035
+ var sourceFile = _d[_i];
98880
99036
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
98881
- var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
99037
+ var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
99038
+ var signature = oldUncommitedSignature === undefined ?
99039
+ useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
99040
+ oldUncommitedSignature || undefined;
98882
99041
  if (referencedMap) {
98883
99042
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
98884
99043
  if (newReferences) {
98885
99044
  referencedMap.set(sourceFile.resolvedPath, newReferences);
98886
99045
  }
98887
99046
  if (useOldState) {
98888
- var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
99047
+ var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
99048
+ var exportedModules = oldUncommitedExportedModules === undefined ?
99049
+ oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
99050
+ oldUncommitedExportedModules || undefined;
98889
99051
  if (exportedModules) {
98890
99052
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
98891
99053
  }
98892
99054
  }
98893
99055
  }
98894
- fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
99056
+ fileInfos.set(sourceFile.resolvedPath, {
99057
+ version: version_2,
99058
+ signature: signature,
99059
+ affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
99060
+ impliedFormat: sourceFile.impliedNodeFormat
99061
+ });
98895
99062
  }
98896
99063
  return {
98897
99064
  fileInfos: fileInfos,
98898
99065
  referencedMap: referencedMap,
98899
99066
  exportedModulesMap: exportedModulesMap,
98900
- hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
98901
99067
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
98902
99068
  };
98903
99069
  }
@@ -98907,52 +99073,36 @@ var ts;
98907
99073
  state.allFileNames = undefined;
98908
99074
  }
98909
99075
  BuilderState.releaseCache = releaseCache;
98910
- function clone(state) {
99076
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
98911
99077
  var _a, _b;
98912
- return {
98913
- fileInfos: new ts.Map(state.fileInfos),
98914
- referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
98915
- exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
98916
- hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
98917
- useFileVersionAsSignature: state.useFileVersionAsSignature,
98918
- };
99078
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
99079
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
99080
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
99081
+ return result;
98919
99082
  }
98920
- BuilderState.clone = clone;
98921
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
98922
- var signatureCache = cacheToUpdateSignature || new ts.Map();
99083
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
99084
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
98923
99085
  var sourceFile = programOfThisState.getSourceFileByPath(path);
98924
99086
  if (!sourceFile) {
98925
99087
  return ts.emptyArray;
98926
99088
  }
98927
- if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
99089
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
98928
99090
  return [sourceFile];
98929
99091
  }
98930
- var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
98931
- if (!cacheToUpdateSignature) {
98932
- updateSignaturesFromCache(state, signatureCache);
98933
- }
98934
- return result;
98935
- }
98936
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
98937
- function updateSignaturesFromCache(state, signatureCache) {
98938
- signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
99092
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
98939
99093
  }
98940
- BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
99094
+ BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
98941
99095
  function updateSignatureOfFile(state, signature, path) {
98942
99096
  state.fileInfos.get(path).signature = signature;
98943
- state.hasCalledUpdateShapeSignature.add(path);
99097
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
98944
99098
  }
98945
99099
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
98946
- function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
99100
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
99101
+ var _a;
98947
99102
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
98948
- ts.Debug.assert(!!sourceFile);
98949
- ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
98950
- if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
99103
+ if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
98951
99104
  return false;
98952
- }
98953
99105
  var info = state.fileInfos.get(sourceFile.resolvedPath);
98954
- if (!info)
98955
- return ts.Debug.fail();
98956
99106
  var prevSignature = info.signature;
98957
99107
  var latestSignature;
98958
99108
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -98960,40 +99110,50 @@ var ts;
98960
99110
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
98961
99111
  if (firstDts_1) {
98962
99112
  ts.Debug.assert(ts.isDeclarationFileName(firstDts_1.name), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
98963
- latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
98964
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
98965
- updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
99113
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
99114
+ if (latestSignature !== prevSignature) {
99115
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
98966
99116
  }
98967
99117
  }
98968
99118
  }
98969
99119
  if (latestSignature === undefined) {
98970
99120
  latestSignature = sourceFile.version;
98971
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
99121
+ if (state.exportedModulesMap && latestSignature !== prevSignature) {
99122
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
98972
99123
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
98973
99124
  if (references) {
98974
- exportedModulesMapCache.set(sourceFile.resolvedPath, references);
99125
+ state.exportedModulesMap.set(sourceFile.resolvedPath, references);
98975
99126
  }
98976
99127
  else {
98977
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
99128
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
98978
99129
  }
98979
99130
  }
98980
99131
  }
98981
- cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
99132
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
99133
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
99134
+ info.signature = latestSignature;
98982
99135
  return latestSignature !== prevSignature;
98983
99136
  }
98984
99137
  BuilderState.updateShapeSignature = updateShapeSignature;
98985
- function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
99138
+ function computeSignature(text, computeHash) {
99139
+ return (computeHash || ts.generateDjb2Hash)(text);
99140
+ }
99141
+ BuilderState.computeSignature = computeSignature;
99142
+ function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
99143
+ if (!state.exportedModulesMap)
99144
+ return;
99145
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
98986
99146
  if (!exportedModulesFromDeclarationEmit) {
98987
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
99147
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
98988
99148
  return;
98989
99149
  }
98990
99150
  var exportedModules;
98991
99151
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
98992
99152
  if (exportedModules) {
98993
- exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
99153
+ state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
98994
99154
  }
98995
99155
  else {
98996
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
99156
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
98997
99157
  }
98998
99158
  function addExportedModule(exportedModulePaths) {
98999
99159
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -99005,15 +99165,6 @@ var ts;
99005
99165
  }
99006
99166
  }
99007
99167
  BuilderState.updateExportedModules = updateExportedModules;
99008
- function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
99009
- var _a;
99010
- if (exportedModulesMapCache) {
99011
- ts.Debug.assert(!!state.exportedModulesMap);
99012
- (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
99013
- exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
99014
- }
99015
- }
99016
- BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
99017
99168
  function getAllDependencies(state, programOfThisState, sourceFile) {
99018
99169
  var compilerOptions = programOfThisState.getCompilerOptions();
99019
99170
  if (ts.outFile(compilerOptions)) {
@@ -99097,7 +99248,7 @@ var ts;
99097
99248
  }
99098
99249
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
99099
99250
  }
99100
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
99251
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
99101
99252
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
99102
99253
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
99103
99254
  }
@@ -99113,7 +99264,7 @@ var ts;
99113
99264
  if (!seenFileNamesMap.has(currentPath)) {
99114
99265
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
99115
99266
  seenFileNamesMap.set(currentPath, currentSourceFile);
99116
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
99267
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
99117
99268
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
99118
99269
  }
99119
99270
  }
@@ -99128,29 +99279,31 @@ var ts;
99128
99279
  return map1 === map2 || map1 !== undefined && map2 !== undefined && map1.size === map2.size && !ts.forEachKey(map1, function (key) { return !map2.has(key); });
99129
99280
  }
99130
99281
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
99282
+ var _a, _b;
99131
99283
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
99132
99284
  state.program = newProgram;
99133
99285
  var compilerOptions = newProgram.getCompilerOptions();
99134
99286
  state.compilerOptions = compilerOptions;
99135
- if (!ts.outFile(compilerOptions)) {
99287
+ var outFilePath = ts.outFile(compilerOptions);
99288
+ if (!outFilePath) {
99136
99289
  state.semanticDiagnosticsPerFile = new ts.Map();
99137
99290
  }
99291
+ else if (compilerOptions.composite && (oldState === null || oldState === void 0 ? void 0 : oldState.outSignature) && outFilePath === ts.outFile(oldState === null || oldState === void 0 ? void 0 : oldState.compilerOptions)) {
99292
+ state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
99293
+ }
99138
99294
  state.changedFilesSet = new ts.Set();
99295
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
99139
99296
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
99140
99297
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
99141
99298
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
99142
99299
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
99300
+ var canCopyEmitSignatures = compilerOptions.composite &&
99301
+ (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
99302
+ !outFilePath &&
99303
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
99143
99304
  if (useOldState) {
99144
- if (!oldState.currentChangedFilePath) {
99145
- var affectedSignatures = oldState.currentAffectedFilesSignatures;
99146
- ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
99147
- }
99148
- var changedFilesSet = oldState.changedFilesSet;
99149
- if (canCopySemanticDiagnostics) {
99150
- ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
99151
- }
99152
- changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
99153
- if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
99305
+ (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
99306
+ if (!outFilePath && oldState.affectedFilesPendingEmit) {
99154
99307
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
99155
99308
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
99156
99309
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -99167,6 +99320,7 @@ var ts;
99167
99320
  if (!useOldState ||
99168
99321
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
99169
99322
  oldInfo.version !== info.version ||
99323
+ oldInfo.impliedFormat !== info.impliedFormat ||
99170
99324
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
99171
99325
  newReferences && ts.forEachKey(newReferences, function (path) { return !state.fileInfos.has(path) && oldState.fileInfos.has(path); })) {
99172
99326
  state.changedFilesSet.add(sourceFilePath);
@@ -99186,24 +99340,22 @@ var ts;
99186
99340
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
99187
99341
  }
99188
99342
  }
99343
+ if (canCopyEmitSignatures) {
99344
+ var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
99345
+ if (oldEmitSignature)
99346
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
99347
+ }
99189
99348
  });
99190
99349
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
99191
99350
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, undefined)
99192
99351
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
99193
99352
  }
99194
- else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
99353
+ else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
99195
99354
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1); });
99196
99355
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
99197
99356
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
99198
99357
  }
99199
- if (useOldState) {
99200
- ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
99201
- if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
99202
- state.changedFilesSet.add(sourceFilePath);
99203
- }
99204
- });
99205
- }
99206
- state.buildInfoEmitPending = !!state.changedFilesSet.size;
99358
+ state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
99207
99359
  return state;
99208
99360
  }
99209
99361
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -99236,33 +99388,40 @@ var ts;
99236
99388
  ts.BuilderState.releaseCache(state);
99237
99389
  state.program = undefined;
99238
99390
  }
99239
- function cloneBuilderProgramState(state) {
99240
- var _a;
99241
- var newState = ts.BuilderState.clone(state);
99242
- newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
99243
- newState.changedFilesSet = new ts.Set(state.changedFilesSet);
99244
- newState.affectedFiles = state.affectedFiles;
99245
- newState.affectedFilesIndex = state.affectedFilesIndex;
99246
- newState.currentChangedFilePath = state.currentChangedFilePath;
99247
- newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
99248
- newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
99249
- newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
99250
- newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
99251
- newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
99252
- newState.program = state.program;
99253
- newState.compilerOptions = state.compilerOptions;
99254
- newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
99255
- newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
99256
- newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
99257
- newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
99258
- newState.programEmitComplete = state.programEmitComplete;
99259
- return newState;
99391
+ function backupEmitBuilderProgramState(state) {
99392
+ var outFilePath = ts.outFile(state.compilerOptions);
99393
+ ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
99394
+ return {
99395
+ affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
99396
+ affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
99397
+ affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
99398
+ seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
99399
+ programEmitComplete: state.programEmitComplete,
99400
+ emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
99401
+ outSignature: state.outSignature,
99402
+ dtsChangeTime: state.dtsChangeTime,
99403
+ hasChangedEmitSignature: state.hasChangedEmitSignature,
99404
+ changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
99405
+ };
99406
+ }
99407
+ function restoreEmitBuilderProgramState(state, backupEmitState) {
99408
+ state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
99409
+ state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
99410
+ state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
99411
+ state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
99412
+ state.programEmitComplete = backupEmitState.programEmitComplete;
99413
+ state.emitSignatures = backupEmitState.emitSignatures;
99414
+ state.outSignature = backupEmitState.outSignature;
99415
+ state.dtsChangeTime = backupEmitState.dtsChangeTime;
99416
+ state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
99417
+ if (backupEmitState.changedFilesSet)
99418
+ state.changedFilesSet = backupEmitState.changedFilesSet;
99260
99419
  }
99261
99420
  function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
99262
99421
  ts.Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
99263
99422
  }
99264
99423
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
99265
- var _a;
99424
+ var _a, _b;
99266
99425
  while (true) {
99267
99426
  var affectedFiles = state.affectedFiles;
99268
99427
  if (affectedFiles) {
@@ -99279,10 +99438,8 @@ var ts;
99279
99438
  }
99280
99439
  state.changedFilesSet.delete(state.currentChangedFilePath);
99281
99440
  state.currentChangedFilePath = undefined;
99282
- ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
99283
- state.currentAffectedFilesSignatures.clear();
99284
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
99285
- (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
99441
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
99442
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
99286
99443
  state.affectedFiles = undefined;
99287
99444
  }
99288
99445
  var nextKey = state.changedFilesSet.keys().next();
@@ -99295,12 +99452,7 @@ var ts;
99295
99452
  ts.Debug.assert(!state.semanticDiagnosticsPerFile);
99296
99453
  return program;
99297
99454
  }
99298
- if (!state.currentAffectedFilesSignatures)
99299
- state.currentAffectedFilesSignatures = new ts.Map();
99300
- if (state.exportedModulesMap) {
99301
- state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
99302
- }
99303
- state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
99455
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
99304
99456
  state.currentChangedFilePath = nextKey.value;
99305
99457
  state.affectedFilesIndex = 0;
99306
99458
  if (!state.seenAffectedFiles)
@@ -99344,14 +99496,12 @@ var ts;
99344
99496
  }
99345
99497
  }
99346
99498
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
99347
- var _a;
99348
99499
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
99349
99500
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
99350
99501
  removeDiagnosticsOfLibraryFiles(state);
99351
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
99502
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
99352
99503
  return;
99353
99504
  }
99354
- 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);
99355
99505
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
99356
99506
  return;
99357
99507
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -99362,7 +99512,7 @@ var ts;
99362
99512
  var program = ts.Debug.checkDefined(state.program);
99363
99513
  var sourceFile = program.getSourceFileByPath(path);
99364
99514
  if (sourceFile) {
99365
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
99515
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
99366
99516
  if (ts.getEmitDeclarations(state.compilerOptions)) {
99367
99517
  addToAffectedFilesPendingEmit(state, path, 0);
99368
99518
  }
@@ -99378,24 +99528,10 @@ var ts;
99378
99528
  return !state.semanticDiagnosticsFromOldState.size;
99379
99529
  }
99380
99530
  function isChangedSignature(state, path) {
99381
- var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
99382
- var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
99531
+ var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
99532
+ var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
99383
99533
  return newSignature !== oldSignature;
99384
99534
  }
99385
- function forEachKeyOfExportedModulesMap(state, filePath, fn) {
99386
- var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
99387
- var result = keys && ts.forEachKey(keys, fn);
99388
- if (result)
99389
- return result;
99390
- keys = state.exportedModulesMap.getKeys(filePath);
99391
- return keys && ts.forEachKey(keys, function (exportedFromPath) {
99392
- var _a;
99393
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
99394
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
99395
- fn(exportedFromPath) :
99396
- undefined;
99397
- });
99398
- }
99399
99535
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
99400
99536
  var _a;
99401
99537
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -99406,6 +99542,7 @@ var ts;
99406
99542
  return true;
99407
99543
  }
99408
99544
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
99545
+ var _a;
99409
99546
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
99410
99547
  return;
99411
99548
  if (!isChangedSignature(state, affectedFile.resolvedPath))
@@ -99428,9 +99565,8 @@ var ts;
99428
99565
  }
99429
99566
  }
99430
99567
  }
99431
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
99432
99568
  var seenFileAndExportsOfFile = new ts.Set();
99433
- forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
99569
+ (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
99434
99570
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
99435
99571
  return true;
99436
99572
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -99440,17 +99576,16 @@ var ts;
99440
99576
  });
99441
99577
  }
99442
99578
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
99443
- var _a;
99579
+ var _a, _b;
99444
99580
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
99445
99581
  return undefined;
99446
99582
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
99447
99583
  return true;
99448
99584
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
99449
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
99450
- forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
99585
+ (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
99451
99586
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
99452
99587
  });
99453
- (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
99588
+ (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
99454
99589
  return !seenFileAndExportsOfFile.has(referencingFilePath) &&
99455
99590
  handleDtsMayChangeOf(state, referencingFilePath, cancellationToken, computeHash, host);
99456
99591
  });
@@ -99466,12 +99601,12 @@ var ts;
99466
99601
  }
99467
99602
  else {
99468
99603
  state.seenAffectedFiles.add(affected.resolvedPath);
99604
+ state.buildInfoEmitPending = true;
99469
99605
  if (emitKind !== undefined) {
99470
99606
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
99471
99607
  }
99472
99608
  if (isPendingEmit) {
99473
99609
  state.affectedFilesPendingEmitIndex++;
99474
- state.buildInfoEmitPending = true;
99475
99610
  }
99476
99611
  else {
99477
99612
  state.affectedFilesIndex++;
@@ -99503,29 +99638,65 @@ var ts;
99503
99638
  }
99504
99639
  return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
99505
99640
  }
99506
- function getProgramBuildInfo(state, getCanonicalFileName) {
99507
- if (ts.outFile(state.compilerOptions))
99508
- return undefined;
99641
+ function isProgramBundleEmitBuildInfo(info) {
99642
+ return !!ts.outFile(info.options || {});
99643
+ }
99644
+ ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
99645
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
99646
+ var outFilePath = ts.outFile(state.compilerOptions);
99647
+ if (outFilePath && !state.compilerOptions.composite)
99648
+ return;
99509
99649
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
99510
99650
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
99651
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
99652
+ if (outFilePath) {
99653
+ var fileNames_1 = [];
99654
+ var fileInfos_1 = [];
99655
+ state.program.getRootFileNames().forEach(function (f) {
99656
+ var sourceFile = state.program.getSourceFile(f);
99657
+ if (!sourceFile)
99658
+ return;
99659
+ fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
99660
+ fileInfos_1.push(sourceFile.version);
99661
+ });
99662
+ var result_15 = {
99663
+ fileNames: fileNames_1,
99664
+ fileInfos: fileInfos_1,
99665
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
99666
+ outSignature: state.outSignature,
99667
+ dtsChangeTime: state.dtsChangeTime,
99668
+ };
99669
+ return result_15;
99670
+ }
99511
99671
  var fileNames = [];
99512
99672
  var fileNameToFileId = new ts.Map();
99513
99673
  var fileIdsList;
99514
99674
  var fileNamesToFileIdListId;
99675
+ var emitSignatures;
99515
99676
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
99677
+ var _b, _c;
99516
99678
  var key = _a[0], value = _a[1];
99517
99679
  var fileId = toFileId(key);
99518
99680
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
99519
- var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
99520
- var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
99681
+ var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
99682
+ var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
99683
+ if (state.compilerOptions.composite) {
99684
+ var file = state.program.getSourceFileByPath(key);
99685
+ if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
99686
+ var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
99687
+ if (emitSignature !== actualSignature) {
99688
+ (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
99689
+ }
99690
+ }
99691
+ }
99521
99692
  return value.version === actualSignature ?
99522
99693
  value.affectsGlobalScope || value.impliedFormat ?
99523
99694
  { version: value.version, signature: undefined, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
99524
99695
  value.version :
99525
99696
  actualSignature !== undefined ?
99526
- signature === undefined ?
99697
+ oldSignature === undefined ?
99527
99698
  value :
99528
- { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
99699
+ { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
99529
99700
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
99530
99701
  });
99531
99702
  var referencedMap;
@@ -99539,16 +99710,12 @@ var ts;
99539
99710
  if (state.exportedModulesMap) {
99540
99711
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
99541
99712
  var _a;
99542
- if (state.currentAffectedFilesExportedModulesMap) {
99543
- if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
99544
- return undefined;
99545
- }
99546
- var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
99547
- if (newValue) {
99548
- return [toFileId(key), toFileIdListId(newValue)];
99549
- }
99550
- }
99551
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
99713
+ var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
99714
+ if (oldValue === undefined)
99715
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
99716
+ if (oldValue)
99717
+ return [toFileId(key), toFileIdListId(oldValue)];
99718
+ return undefined;
99552
99719
  });
99553
99720
  }
99554
99721
  var semanticDiagnosticsPerFile;
@@ -99559,9 +99726,7 @@ var ts;
99559
99726
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
99560
99727
  [
99561
99728
  toFileId(key),
99562
- state.hasReusableDiagnostic ?
99563
- value :
99564
- convertToReusableDiagnostics(value, relativeToBuildInfo)
99729
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
99565
99730
  ] :
99566
99731
  toFileId(key));
99567
99732
  }
@@ -99576,16 +99741,27 @@ var ts;
99576
99741
  }
99577
99742
  }
99578
99743
  }
99579
- return {
99744
+ var changeFileSet;
99745
+ if (state.changedFilesSet.size) {
99746
+ for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
99747
+ var path = _e[_d];
99748
+ (changeFileSet || (changeFileSet = [])).push(toFileId(path));
99749
+ }
99750
+ }
99751
+ var result = {
99580
99752
  fileNames: fileNames,
99581
99753
  fileInfos: fileInfos,
99582
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
99754
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
99583
99755
  fileIdsList: fileIdsList,
99584
99756
  referencedMap: referencedMap,
99585
99757
  exportedModulesMap: exportedModulesMap,
99586
99758
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
99587
99759
  affectedFilesPendingEmit: affectedFilesPendingEmit,
99760
+ changeFileSet: changeFileSet,
99761
+ emitSignatures: emitSignatures,
99762
+ dtsChangeTime: state.dtsChangeTime,
99588
99763
  };
99764
+ return result;
99589
99765
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
99590
99766
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
99591
99767
  }
@@ -99610,21 +99786,18 @@ var ts;
99610
99786
  }
99611
99787
  return fileIdListId;
99612
99788
  }
99613
- }
99614
- function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
99615
- var result;
99616
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
99617
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
99618
- var name = _a[_i];
99619
- var optionKey = name.toLowerCase();
99620
- var optionInfo = optionsNameMap.get(optionKey);
99621
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
99622
- optionKey === "strict" ||
99623
- optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
99624
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
99789
+ function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
99790
+ var result;
99791
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
99792
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
99793
+ var name = _a[_i];
99794
+ var optionInfo = optionsNameMap.get(name.toLowerCase());
99795
+ if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
99796
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
99797
+ }
99625
99798
  }
99799
+ return result;
99626
99800
  }
99627
- return result;
99628
99801
  }
99629
99802
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
99630
99803
  if (option) {
@@ -99698,6 +99871,10 @@ var ts;
99698
99871
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
99699
99872
  }
99700
99873
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
99874
+ function computeSignature(text, data, computeHash) {
99875
+ return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
99876
+ }
99877
+ ts.computeSignature = computeSignature;
99701
99878
  function createBuilderProgram(kind, _a) {
99702
99879
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
99703
99880
  var oldState = oldProgram && oldProgram.getState();
@@ -99709,28 +99886,28 @@ var ts;
99709
99886
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
99710
99887
  var computeHash = ts.maybeBind(host, host.createHash);
99711
99888
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
99712
- var backupState;
99713
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
99889
+ var backupEmitState;
99890
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
99714
99891
  newProgram = undefined;
99715
99892
  oldProgram = undefined;
99716
99893
  oldState = undefined;
99717
99894
  var getState = function () { return state; };
99718
99895
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
99719
99896
  builderProgram.getState = getState;
99720
- builderProgram.backupState = function () {
99721
- ts.Debug.assert(backupState === undefined);
99722
- backupState = cloneBuilderProgramState(state);
99897
+ builderProgram.backupEmitState = function () {
99898
+ ts.Debug.assert(backupEmitState === undefined);
99899
+ backupEmitState = backupEmitBuilderProgramState(state);
99723
99900
  };
99724
- builderProgram.restoreState = function () {
99725
- state = ts.Debug.checkDefined(backupState);
99726
- backupState = undefined;
99901
+ builderProgram.restoreEmitState = function () {
99902
+ restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
99903
+ backupEmitState = undefined;
99727
99904
  };
99728
99905
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
99729
99906
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
99730
99907
  builderProgram.emit = emit;
99731
99908
  builderProgram.releaseProgram = function () {
99732
99909
  releaseCache(state);
99733
- backupState = undefined;
99910
+ backupEmitState = undefined;
99734
99911
  };
99735
99912
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
99736
99913
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -99776,35 +99953,57 @@ var ts;
99776
99953
  affected = program;
99777
99954
  }
99778
99955
  }
99779
- return toAffectedFileEmitResult(state, ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
99780
- getWriteFileUpdatingSignatureCallback(writeFile) :
99956
+ return toAffectedFileEmitResult(state, ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
99957
+ getWriteFileCallback(writeFile, customTransformers) :
99781
99958
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0, customTransformers), affected, emitKind, isPendingEmitFile);
99782
99959
  }
99783
- function getWriteFileUpdatingSignatureCallback(writeFile) {
99960
+ function getWriteFileCallback(writeFile, customTransformers) {
99784
99961
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
99785
- var _a;
99962
+ var _a, _b, _c;
99786
99963
  if (ts.isDeclarationFileName(fileName)) {
99787
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
99788
- var file = sourceFiles[0];
99789
- var info = state.fileInfos.get(file.resolvedPath);
99790
- var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
99791
- if (signature === file.version) {
99792
- var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
99793
- if (newSignature !== file.version) {
99794
- if (host.storeFilesChangingSignatureDuringEmit)
99795
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
99796
- if (state.exportedModulesMap)
99797
- ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
99798
- if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
99799
- state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
99964
+ if (!ts.outFile(state.compilerOptions)) {
99965
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
99966
+ var newSignature = void 0;
99967
+ if (!customTransformers) {
99968
+ var file = sourceFiles[0];
99969
+ var info = state.fileInfos.get(file.resolvedPath);
99970
+ if (info.signature === file.version) {
99971
+ newSignature = computeSignature(text, data, computeHash);
99972
+ if (newSignature !== file.version) {
99973
+ if (host.storeFilesChangingSignatureDuringEmit)
99974
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
99975
+ if (state.exportedModulesMap)
99976
+ ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
99977
+ if (state.affectedFiles) {
99978
+ var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
99979
+ if (existing === undefined)
99980
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
99981
+ info.signature = newSignature;
99982
+ }
99983
+ else {
99984
+ info.signature = newSignature;
99985
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
99986
+ }
99987
+ }
99800
99988
  }
99801
- else {
99802
- info.signature = newSignature;
99803
- if (state.exportedModulesMap)
99804
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
99989
+ }
99990
+ if (state.compilerOptions.composite) {
99991
+ var filePath = sourceFiles[0].resolvedPath;
99992
+ var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
99993
+ newSignature || (newSignature = computeSignature(text, data, computeHash));
99994
+ if (newSignature !== oldSignature) {
99995
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
99996
+ state.hasChangedEmitSignature = true;
99805
99997
  }
99806
99998
  }
99807
99999
  }
100000
+ else if (state.compilerOptions.composite) {
100001
+ var newSignature = computeSignature(text, data, computeHash);
100002
+ if (newSignature !== state.outSignature) {
100003
+ state.outSignature = newSignature;
100004
+ state.hasChangedEmitSignature = true;
100005
+ }
100006
+ }
99808
100007
  }
99809
100008
  if (writeFile)
99810
100009
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -99853,8 +100052,8 @@ var ts;
99853
100052
  }
99854
100053
  }
99855
100054
  }
99856
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
99857
- getWriteFileUpdatingSignatureCallback(writeFile) :
100055
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
100056
+ getWriteFileCallback(writeFile, customTransformers) :
99858
100057
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
99859
100058
  }
99860
100059
  function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
@@ -99917,29 +100116,58 @@ var ts;
99917
100116
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
99918
100117
  }
99919
100118
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
99920
- function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
99921
- var _a;
100119
+ function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
100120
+ var _a, _b, _c, _d;
99922
100121
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
99923
100122
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
99924
- var filePaths = program.fileNames.map(toPath);
99925
- var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
99926
- var fileInfos = new ts.Map();
99927
- program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
99928
- var state = {
99929
- fileInfos: fileInfos,
99930
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
99931
- referencedMap: toManyToManyPathMap(program.referencedMap),
99932
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
99933
- 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]; }),
99934
- hasReusableDiagnostic: true,
99935
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
99936
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
99937
- affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
99938
- };
100123
+ var state;
100124
+ var filePaths;
100125
+ var filePathsSetList;
100126
+ if (isProgramBundleEmitBuildInfo(program)) {
100127
+ state = {
100128
+ fileInfos: new ts.Map(),
100129
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
100130
+ dtsChangeTime: program.dtsChangeTime,
100131
+ outSignature: program.outSignature,
100132
+ };
100133
+ }
100134
+ else {
100135
+ filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
100136
+ filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
100137
+ var fileInfos_2 = new ts.Map();
100138
+ var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
100139
+ program.fileInfos.forEach(function (fileInfo, index) {
100140
+ var path = toFilePath(index + 1);
100141
+ var stateFileInfo = toBuilderStateFileInfo(fileInfo);
100142
+ fileInfos_2.set(path, stateFileInfo);
100143
+ if (emitSignatures_1 && stateFileInfo.signature)
100144
+ emitSignatures_1.set(path, stateFileInfo.signature);
100145
+ });
100146
+ (_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
100147
+ if (ts.isNumber(value))
100148
+ emitSignatures_1.delete(toFilePath(value));
100149
+ else
100150
+ emitSignatures_1.set(toFilePath(value[0]), value[1]);
100151
+ });
100152
+ state = {
100153
+ fileInfos: fileInfos_2,
100154
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
100155
+ referencedMap: toManyToManyPathMap(program.referencedMap),
100156
+ exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
100157
+ semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return toFilePath(ts.isNumber(value) ? value : value[0]); }, function (value) { return ts.isNumber(value) ? ts.emptyArray : value[1]; }),
100158
+ hasReusableDiagnostic: true,
100159
+ affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
100160
+ affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
100161
+ affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
100162
+ changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
100163
+ dtsChangeTime: program.dtsChangeTime,
100164
+ emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
100165
+ };
100166
+ }
99939
100167
  return {
99940
100168
  getState: function () { return state; },
99941
- backupState: ts.noop,
99942
- restoreState: ts.noop,
100169
+ backupEmitState: ts.noop,
100170
+ restoreEmitState: ts.noop,
99943
100171
  getProgram: ts.notImplemented,
99944
100172
  getProgramOrUndefined: ts.returnUndefined,
99945
100173
  releaseProgram: ts.noop,
@@ -99984,12 +100212,24 @@ var ts;
99984
100212
  return map;
99985
100213
  }
99986
100214
  }
99987
- ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
100215
+ ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
100216
+ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
100217
+ var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
100218
+ var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
100219
+ var fileInfos = new ts.Map();
100220
+ program.fileInfos.forEach(function (fileInfo, index) {
100221
+ var path = ts.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
100222
+ var version = ts.isString(fileInfo) ? fileInfo : fileInfo.version;
100223
+ fileInfos.set(path, version);
100224
+ });
100225
+ return fileInfos;
100226
+ }
100227
+ ts.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap;
99988
100228
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
99989
100229
  return {
99990
100230
  getState: ts.notImplemented,
99991
- backupState: ts.noop,
99992
- restoreState: ts.noop,
100231
+ backupEmitState: ts.noop,
100232
+ restoreEmitState: ts.noop,
99993
100233
  getProgram: getProgram,
99994
100234
  getProgramOrUndefined: function () { return getState().program; },
99995
100235
  releaseProgram: function () { return getState().program = undefined; },
@@ -100940,9 +101180,9 @@ var ts;
100940
101180
  var targets = importedFileNames.map(function (f) { return ts.getNormalizedAbsolutePath(f, cwd); });
100941
101181
  var shouldFilterIgnoredPaths = !ts.every(targets, ts.containsIgnoredPath);
100942
101182
  if (!preferSymlinks) {
100943
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
100944
- if (result_15)
100945
- return result_15;
101183
+ var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
101184
+ if (result_16)
101185
+ return result_16;
100946
101186
  }
100947
101187
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
100948
101188
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -100961,10 +101201,10 @@ var ts;
100961
101201
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
100962
101202
  var symlinkDirectory = symlinkDirectories_1[_i];
100963
101203
  var option = ts.resolvePath(symlinkDirectory, relative);
100964
- var result_16 = cb(option, target === referenceRedirect);
101204
+ var result_17 = cb(option, target === referenceRedirect);
100965
101205
  shouldFilterIgnoredPaths = true;
100966
- if (result_16)
100967
- return result_16;
101206
+ if (result_17)
101207
+ return result_17;
100968
101208
  }
100969
101209
  });
100970
101210
  });
@@ -100999,7 +101239,7 @@ var ts;
100999
101239
  importedFileFromNodeModules = importedFileFromNodeModules || isInNodeModules;
101000
101240
  });
101001
101241
  var sortedPaths = [];
101002
- var _loop_32 = function (directory) {
101242
+ var _loop_33 = function (directory) {
101003
101243
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
101004
101244
  var pathsInDirectory;
101005
101245
  allFileNames.forEach(function (_a, fileName) {
@@ -101023,7 +101263,7 @@ var ts;
101023
101263
  };
101024
101264
  var out_directory_1;
101025
101265
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
101026
- var state_10 = _loop_32(directory);
101266
+ var state_10 = _loop_33(directory);
101027
101267
  directory = out_directory_1;
101028
101268
  if (state_10 === "break")
101029
101269
  break;
@@ -101796,6 +102036,7 @@ var ts;
101796
102036
  readDirectory: ts.maybeBind(host, host.readDirectory),
101797
102037
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
101798
102038
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
102039
+ now: ts.maybeBind(host, host.now),
101799
102040
  };
101800
102041
  function writeFile(fileName, text, writeByteOrderMark, onError) {
101801
102042
  try {
@@ -101850,6 +102091,7 @@ var ts;
101850
102091
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
101851
102092
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
101852
102093
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
102094
+ now: ts.maybeBind(system, system.now),
101853
102095
  };
101854
102096
  }
101855
102097
  ts.createProgramHost = createProgramHost;
@@ -101905,20 +102147,26 @@ var ts;
101905
102147
  var ts;
101906
102148
  (function (ts) {
101907
102149
  function readBuilderProgram(compilerOptions, host) {
101908
- if (ts.outFile(compilerOptions))
101909
- return undefined;
101910
102150
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
101911
102151
  if (!buildInfoPath)
101912
102152
  return undefined;
101913
- var content = host.readFile(buildInfoPath);
101914
- if (!content)
101915
- return undefined;
101916
- var buildInfo = ts.getBuildInfo(content);
102153
+ var buildInfo;
102154
+ if (host.getBuildInfo) {
102155
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
102156
+ if (!buildInfo)
102157
+ return undefined;
102158
+ }
102159
+ else {
102160
+ var content = host.readFile(buildInfoPath);
102161
+ if (!content)
102162
+ return undefined;
102163
+ buildInfo = ts.getBuildInfo(content);
102164
+ }
101917
102165
  if (buildInfo.version !== ts.version)
101918
102166
  return undefined;
101919
102167
  if (!buildInfo.program)
101920
102168
  return undefined;
101921
- return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
102169
+ return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
101922
102170
  }
101923
102171
  ts.readBuilderProgram = readBuilderProgram;
101924
102172
  function createIncrementalCompilerHost(options, system) {
@@ -101927,6 +102175,7 @@ var ts;
101927
102175
  host.createHash = ts.maybeBind(system, system.createHash);
101928
102176
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
101929
102177
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
102178
+ host.now = ts.maybeBind(system, system.now);
101930
102179
  ts.setGetSourceFileAsHashVersioned(host, system);
101931
102180
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
101932
102181
  return host;
@@ -102349,6 +102598,7 @@ var ts;
102349
102598
  }
102350
102599
  function reloadFileNamesFromConfigFile() {
102351
102600
  writeLog("Reloading new file names and options");
102601
+ reloadLevel = ts.ConfigFileProgramReloadLevel.None;
102352
102602
  rootFileNames = ts.getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
102353
102603
  if (ts.updateErrorForNoInputFiles(rootFileNames, ts.getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
102354
102604
  hasChangedConfigFileParsingErrors = true;
@@ -102589,11 +102839,14 @@ var ts;
102589
102839
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
102590
102840
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
102591
102841
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
102592
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
102593
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
102594
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
102595
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
102596
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
102842
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
102843
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
102844
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
102845
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
102846
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
102847
+ UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
102848
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
102849
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
102597
102850
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
102598
102851
  function resolveConfigFileProjectName(project) {
102599
102852
  if (ts.fileExtensionIs(project, ".json")) {
@@ -102631,9 +102884,10 @@ var ts;
102631
102884
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
102632
102885
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
102633
102886
  }
102634
- function newer(date1, date2) {
102635
- return date2 > date1 ? date2 : date1;
102887
+ function getCurrentTime(host) {
102888
+ return host.now ? host.now() : new Date();
102636
102889
  }
102890
+ ts.getCurrentTime = getCurrentTime;
102637
102891
  function isCircularBuildOrder(buildOrder) {
102638
102892
  return !!buildOrder && !!buildOrder.buildOrder;
102639
102893
  }
@@ -102717,6 +102971,7 @@ var ts;
102717
102971
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
102718
102972
  };
102719
102973
  }
102974
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), undefined); };
102720
102975
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
102721
102976
  var state = {
102722
102977
  host: host,
@@ -102732,8 +102987,9 @@ var ts;
102732
102987
  resolvedConfigFilePaths: new ts.Map(),
102733
102988
  configFileCache: new ts.Map(),
102734
102989
  projectStatus: new ts.Map(),
102735
- buildInfoChecked: new ts.Map(),
102736
102990
  extendedConfigCache: new ts.Map(),
102991
+ buildInfoCache: new ts.Map(),
102992
+ outputTimeStamps: new ts.Map(),
102737
102993
  builderPrograms: new ts.Map(),
102738
102994
  diagnostics: new ts.Map(),
102739
102995
  projectPendingBuild: new ts.Map(),
@@ -102754,6 +103010,7 @@ var ts;
102754
103010
  allWatchedConfigFiles: new ts.Map(),
102755
103011
  allWatchedExtendedConfigFiles: new ts.Map(),
102756
103012
  allWatchedPackageJsonFiles: new ts.Map(),
103013
+ filesWatched: new ts.Map(),
102757
103014
  lastCachedPackageJsonLookups: new ts.Map(),
102758
103015
  timerToBuildInvalidatedProject: undefined,
102759
103016
  reportFileChangeDetected: false,
@@ -102788,6 +103045,7 @@ var ts;
102788
103045
  if (value) {
102789
103046
  return isParsedCommandLine(value) ? value : undefined;
102790
103047
  }
103048
+ ts.solutionPerformance.mark("beforeParseConfigFile");
102791
103049
  var diagnostic;
102792
103050
  var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host;
102793
103051
  var parsed;
@@ -102802,6 +103060,8 @@ var ts;
102802
103060
  parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
102803
103061
  }
102804
103062
  configFileCache.set(configFilePath, parsed || diagnostic);
103063
+ ts.solutionPerformance.mark("afterParseConfigFile");
103064
+ ts.solutionPerformance.measure("ParseConfigFile", "beforeParseConfigFile", "afterParseConfigFile");
102805
103065
  return parsed;
102806
103066
  }
102807
103067
  function resolveProjectName(state, name) {
@@ -102849,17 +103109,19 @@ var ts;
102849
103109
  return state.buildOrder || createStateBuildOrder(state);
102850
103110
  }
102851
103111
  function createStateBuildOrder(state) {
103112
+ ts.solutionPerformance.mark("beforeCreateBuildOrder");
102852
103113
  var buildOrder = createBuildOrder(state, state.rootNames.map(function (f) { return resolveProjectName(state, f); }));
102853
103114
  state.resolvedConfigFilePaths.clear();
102854
103115
  var currentProjects = new ts.Map(getBuildOrderFromAnyBuildOrder(buildOrder).map(function (resolved) { return [toResolvedConfigFilePath(state, resolved), true]; }));
102855
103116
  var noopOnDelete = { onDeleteValue: ts.noop };
102856
103117
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
102857
103118
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
102858
- ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
102859
103119
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
102860
103120
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
102861
103121
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
102862
103122
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
103123
+ ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
103124
+ ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
102863
103125
  if (state.watch) {
102864
103126
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
102865
103127
  state.allWatchedExtendedConfigFiles.forEach(function (watcher) {
@@ -102874,6 +103136,8 @@ var ts;
102874
103136
  ts.mutateMapSkippingNewValues(state.allWatchedInputFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
102875
103137
  ts.mutateMapSkippingNewValues(state.allWatchedPackageJsonFiles, currentProjects, { onDeleteValue: function (existingMap) { return existingMap.forEach(ts.closeFileWatcher); } });
102876
103138
  }
103139
+ ts.solutionPerformance.mark("afterCreateBuildOrder");
103140
+ ts.solutionPerformance.measure("CreateBuildOrder", "beforeCreateBuildOrder", "afterCreateBuildOrder");
102877
103141
  return state.buildOrder = buildOrder;
102878
103142
  }
102879
103143
  function getBuildOrderFor(state, project, onlyReferences) {
@@ -102993,6 +103257,7 @@ var ts;
102993
103257
  if (updateOutputFileStampsPending) {
102994
103258
  updateOutputTimestamps(state, config, projectPath);
102995
103259
  }
103260
+ ts.solutionPerformance.mark("timestampUpdated");
102996
103261
  return doneInvalidatedProject(state, projectPath);
102997
103262
  }
102998
103263
  };
@@ -103086,6 +103351,10 @@ var ts;
103086
103351
  };
103087
103352
  function done(cancellationToken, writeFile, customTransformers) {
103088
103353
  executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers);
103354
+ if (kind === InvalidatedProjectKind.Build)
103355
+ ts.solutionPerformance.mark("projectsBuilt");
103356
+ else
103357
+ ts.solutionPerformance.mark("bundlesUpdated");
103089
103358
  return doneInvalidatedProject(state, projectPath);
103090
103359
  }
103091
103360
  function withProgramOrUndefined(action) {
@@ -103144,16 +103413,16 @@ var ts;
103144
103413
  }
103145
103414
  function emit(writeFileCallback, cancellationToken, customTransformers) {
103146
103415
  var _a;
103147
- var _b, _c;
103416
+ var _b, _c, _d;
103148
103417
  ts.Debug.assertIsDefined(program);
103149
103418
  ts.Debug.assert(step === BuildStep.Emit);
103150
- program.backupState();
103419
+ program.backupEmitState();
103151
103420
  var declDiagnostics;
103152
103421
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
103153
103422
  var outputFiles = [];
103154
- var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, undefined, undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken, false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
103423
+ var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, undefined, undefined, function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark, buildInfo: data === null || data === void 0 ? void 0 : data.buildInfo }); }, cancellationToken, false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
103155
103424
  if (declDiagnostics) {
103156
- program.restoreState();
103425
+ program.restoreEmitState();
103157
103426
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
103158
103427
  return {
103159
103428
  emitSkipped: true,
@@ -103162,35 +103431,46 @@ var ts;
103162
103431
  }
103163
103432
  var host = state.host, compilerHost = state.compilerHost;
103164
103433
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
103165
- var newestDeclarationFileContentChangedTime = minimumDate;
103166
- var anyDtsChanged = false;
103434
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
103167
103435
  var emitterDiagnostics = ts.createDiagnosticCollection();
103168
103436
  var emittedOutputs = new ts.Map();
103437
+ var options = program.getCompilerOptions();
103438
+ var isIncremental = ts.isIncrementalCompilation(options);
103439
+ var outputTimeStampMap;
103440
+ var now;
103441
+ ts.solutionPerformance.mark("beforeOutputFilesWrite");
103169
103442
  outputFiles.forEach(function (_a) {
103170
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
103171
- var priorChangeTime;
103172
- if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
103173
- if (host.fileExists(name) && state.readFileWithCache(name) === text) {
103174
- priorChangeTime = host.getModifiedTime(name);
103175
- }
103176
- else {
103443
+ var _b, _c;
103444
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
103445
+ var path = toPath(state, name);
103446
+ emittedOutputs.set(toPath(state, name), name);
103447
+ if (buildInfo) {
103448
+ setBuildInfo(state, buildInfo, projectPath, options);
103449
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
103177
103450
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
103178
- anyDtsChanged = true;
103179
103451
  }
103180
103452
  }
103181
- emittedOutputs.set(toPath(state, name), name);
103182
103453
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
103183
- if (priorChangeTime !== undefined) {
103184
- newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
103454
+ if (!isIncremental && state.watch) {
103455
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
103185
103456
  }
103186
103457
  });
103187
- finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime, anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
103458
+ ts.solutionPerformance.mark("afterOutputFilesWrite");
103459
+ ts.solutionPerformance.measure("OutputFilesWrite", "beforeOutputFilesWrite", "afterOutputFilesWrite");
103460
+ finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
103188
103461
  return emitResult;
103189
103462
  }
103190
103463
  function emitBuildInfo(writeFileCallback, cancellationToken) {
103191
103464
  ts.Debug.assertIsDefined(program);
103192
103465
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
103193
- var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
103466
+ var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
103467
+ if (data === null || data === void 0 ? void 0 : data.buildInfo)
103468
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
103469
+ if (writeFileCallback)
103470
+ writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
103471
+ else
103472
+ state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
103473
+ }, cancellationToken);
103194
103474
  if (emitResult.diagnostics.length) {
103195
103475
  reportErrors(state, emitResult.diagnostics);
103196
103476
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -103203,7 +103483,7 @@ var ts;
103203
103483
  step = BuildStep.QueueReferencingProjects;
103204
103484
  return emitResult;
103205
103485
  }
103206
- function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
103486
+ function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
103207
103487
  var _a;
103208
103488
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
103209
103489
  if (emitDiagnostics.length) {
@@ -103213,13 +103493,11 @@ var ts;
103213
103493
  if (state.write) {
103214
103494
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
103215
103495
  }
103216
- var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
103496
+ updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
103217
103497
  state.diagnostics.delete(projectPath);
103218
103498
  state.projectStatus.set(projectPath, {
103219
103499
  type: ts.UpToDateStatusType.UpToDate,
103220
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
103221
- maximumDate :
103222
- newestDeclarationFileContentChangedTime,
103500
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
103223
103501
  oldestOutputFileName: oldestOutputFileName
103224
103502
  });
103225
103503
  afterProgramDone(state, program, config);
@@ -103252,12 +103530,21 @@ var ts;
103252
103530
  ts.Debug.assert(!!outputFiles.length);
103253
103531
  var emitterDiagnostics = ts.createDiagnosticCollection();
103254
103532
  var emittedOutputs = new ts.Map();
103533
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
103534
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
103255
103535
  outputFiles.forEach(function (_a) {
103256
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
103536
+ var _b, _c;
103537
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
103257
103538
  emittedOutputs.set(toPath(state, name), name);
103539
+ if (buildInfo) {
103540
+ setBuildInfo(state, buildInfo, projectPath, config.options);
103541
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
103542
+ resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
103543
+ }
103544
+ }
103258
103545
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
103259
103546
  });
103260
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate, false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
103547
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
103261
103548
  return { emitSkipped: false, diagnostics: emitDiagnostics };
103262
103549
  }
103263
103550
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -103307,6 +103594,13 @@ var ts;
103307
103594
  !ts.isIncrementalCompilation(config.options);
103308
103595
  }
103309
103596
  function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
103597
+ ts.solutionPerformance.mark("beforeGetNextInvalidatedProjectCreateInfo");
103598
+ var result = getNextInvalidatedProjectCreateInfoWorker(state, buildOrder, reportQueue);
103599
+ ts.solutionPerformance.mark("afterGetNextInvalidatedProjectCreateInfo");
103600
+ ts.solutionPerformance.measure("GetNextInvalidatedProjectCreateInfo", "beforeGetNextInvalidatedProjectCreateInfo", "afterGetNextInvalidatedProjectCreateInfo");
103601
+ return result;
103602
+ }
103603
+ function getNextInvalidatedProjectCreateInfoWorker(state, buildOrder, reportQueue) {
103310
103604
  if (!state.projectPendingBuild.size)
103311
103605
  return undefined;
103312
103606
  if (isCircularBuildOrder(buildOrder))
@@ -103352,7 +103646,7 @@ var ts;
103352
103646
  }
103353
103647
  continue;
103354
103648
  }
103355
- if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
103649
+ if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
103356
103650
  reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
103357
103651
  return {
103358
103652
  kind: InvalidatedProjectKind.UpdateOutputFileStamps,
@@ -103402,9 +103696,7 @@ var ts;
103402
103696
  }
103403
103697
  function getNextInvalidatedProject(state, buildOrder, reportQueue) {
103404
103698
  var info = getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue);
103405
- if (!info)
103406
- return info;
103407
- return createInvalidatedProjectWithInfo(state, info, buildOrder);
103699
+ return info && createInvalidatedProjectWithInfo(state, info, buildOrder);
103408
103700
  }
103409
103701
  function listEmittedFile(_a, proj, file) {
103410
103702
  var write = _a.write;
@@ -103412,14 +103704,17 @@ var ts;
103412
103704
  write("TSFILE: " + file);
103413
103705
  }
103414
103706
  }
103415
- function getOldProgram(_a, proj, parsed) {
103416
- var options = _a.options, builderPrograms = _a.builderPrograms, compilerHost = _a.compilerHost;
103417
- if (options.force)
103707
+ function getOldProgram(state, proj, parsed) {
103708
+ if (state.options.force)
103418
103709
  return undefined;
103419
- var value = builderPrograms.get(proj);
103710
+ var value = state.builderPrograms.get(proj);
103420
103711
  if (value)
103421
103712
  return value;
103422
- return ts.readBuilderProgram(parsed.options, compilerHost);
103713
+ ts.solutionPerformance.mark("beforeReadBuilderProgram");
103714
+ var program = ts.readBuilderProgram(parsed.options, state.compilerHost);
103715
+ ts.solutionPerformance.mark("afterReadBuilderProgram");
103716
+ ts.solutionPerformance.measure("ReadBuilderProgram", "beforeReadBuilderProgram", "afterReadBuilderProgram");
103717
+ return program;
103423
103718
  }
103424
103719
  function afterProgramDone(state, program, config) {
103425
103720
  if (program) {
@@ -103436,7 +103731,7 @@ var ts;
103436
103731
  state.projectCompilerOptions = state.baseCompilerOptions;
103437
103732
  }
103438
103733
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
103439
- var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
103734
+ var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
103440
103735
  reportAndStoreErrors(state, resolvedPath, diagnostics);
103441
103736
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
103442
103737
  if (canEmitBuildInfo)
@@ -103444,8 +103739,100 @@ var ts;
103444
103739
  afterProgramDone(state, program, config);
103445
103740
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
103446
103741
  }
103742
+ function isFileWatcherWithModifiedTime(value) {
103743
+ return !!value.watcher;
103744
+ }
103745
+ function getModifiedTime(state, fileName) {
103746
+ var path = toPath(state, fileName);
103747
+ var existing = state.filesWatched.get(path);
103748
+ if (state.watch && !!existing) {
103749
+ if (!isFileWatcherWithModifiedTime(existing))
103750
+ return existing;
103751
+ if (existing.modifiedTime)
103752
+ return existing.modifiedTime;
103753
+ }
103754
+ var result = ts.getModifiedTime(state.host, fileName);
103755
+ if (state.watch) {
103756
+ if (existing)
103757
+ existing.modifiedTime = result;
103758
+ else
103759
+ state.filesWatched.set(path, result);
103760
+ }
103761
+ return result;
103762
+ }
103763
+ function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
103764
+ var path = toPath(state, file);
103765
+ var existing = state.filesWatched.get(path);
103766
+ if (existing && isFileWatcherWithModifiedTime(existing)) {
103767
+ existing.callbacks.push(callback);
103768
+ }
103769
+ else {
103770
+ var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
103771
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
103772
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
103773
+ existing.modifiedTime = modifiedTime;
103774
+ existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
103775
+ }, pollingInterval, options, watchType, project);
103776
+ state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
103777
+ }
103778
+ return {
103779
+ close: function () {
103780
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
103781
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
103782
+ if (existing.callbacks.length === 1) {
103783
+ state.filesWatched.delete(path);
103784
+ ts.closeFileWatcherOf(existing);
103785
+ }
103786
+ else {
103787
+ ts.unorderedRemoveItem(existing.callbacks, callback);
103788
+ }
103789
+ }
103790
+ };
103791
+ }
103792
+ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
103793
+ if (!state.watch)
103794
+ return undefined;
103795
+ var result = state.outputTimeStamps.get(resolvedConfigFilePath);
103796
+ if (!result)
103797
+ state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
103798
+ return result;
103799
+ }
103800
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
103801
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
103802
+ var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
103803
+ if (existing) {
103804
+ existing.buildInfo = buildInfo;
103805
+ existing.modifiedTime = getCurrentTime(state.host);
103806
+ }
103807
+ else {
103808
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
103809
+ }
103810
+ }
103811
+ function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
103812
+ var path = toPath(state, buildInfoPath);
103813
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
103814
+ return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
103815
+ }
103816
+ function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
103817
+ var path = toPath(state, buildInfoPath);
103818
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
103819
+ if (existing !== undefined && existing.path === path) {
103820
+ return existing.buildInfo || undefined;
103821
+ }
103822
+ ts.solutionPerformance.mark("beforeGetBuildInfo");
103823
+ ts.solutionPerformance.mark("beforeBuildInfoRead");
103824
+ var value = state.readFileWithCache(buildInfoPath);
103825
+ ts.solutionPerformance.mark("afterBuildInfoRead");
103826
+ ts.solutionPerformance.measure("BuildInfoRead", "beforeBuildInfoRead", "afterBuildInfoRead");
103827
+ var buildInfo = value ? ts.getBuildInfo(value) : undefined;
103828
+ ts.Debug.assert(modifiedTime || !buildInfo);
103829
+ state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
103830
+ ts.solutionPerformance.mark("afterGetBuildInfo");
103831
+ ts.solutionPerformance.measure("GetBuildInfo", "beforeGetBuildInfo", "afterGetBuildInfo");
103832
+ return buildInfo;
103833
+ }
103447
103834
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
103448
- var tsconfigTime = ts.getModifiedTime(state.host, configFile);
103835
+ var tsconfigTime = getModifiedTime(state, configFile);
103449
103836
  if (oldestOutputFileTime < tsconfigTime) {
103450
103837
  return {
103451
103838
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -103455,76 +103842,22 @@ var ts;
103455
103842
  }
103456
103843
  }
103457
103844
  function getUpToDateStatusWorker(state, project, resolvedPath) {
103458
- var force = !!state.options.force;
103459
- var newestInputFileName = undefined;
103460
- var newestInputFileTime = minimumDate;
103461
- var host = state.host;
103462
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
103463
- var inputFile = _a[_i];
103464
- if (!host.fileExists(inputFile)) {
103465
- return {
103466
- type: ts.UpToDateStatusType.Unbuildable,
103467
- reason: inputFile + " does not exist"
103468
- };
103469
- }
103470
- if (!force) {
103471
- var inputTime = ts.getModifiedTime(host, inputFile);
103472
- if (inputTime > newestInputFileTime) {
103473
- newestInputFileName = inputFile;
103474
- newestInputFileTime = inputTime;
103475
- }
103476
- }
103477
- }
103845
+ var _a, _b, _c;
103478
103846
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
103479
103847
  return {
103480
103848
  type: ts.UpToDateStatusType.ContainerOnly
103481
103849
  };
103482
103850
  }
103483
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
103484
- var oldestOutputFileName = "(none)";
103485
- var oldestOutputFileTime = maximumDate;
103486
- var newestOutputFileName = "(none)";
103487
- var newestOutputFileTime = minimumDate;
103488
- var missingOutputFileName;
103489
- var newestDeclarationFileContentChangedTime = minimumDate;
103490
- var isOutOfDateWithInputs = false;
103491
- if (!force) {
103492
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
103493
- var output = outputs_1[_b];
103494
- if (!host.fileExists(output)) {
103495
- missingOutputFileName = output;
103496
- break;
103497
- }
103498
- var outputTime = ts.getModifiedTime(host, output);
103499
- if (outputTime < oldestOutputFileTime) {
103500
- oldestOutputFileTime = outputTime;
103501
- oldestOutputFileName = output;
103502
- }
103503
- if (outputTime < newestInputFileTime) {
103504
- isOutOfDateWithInputs = true;
103505
- break;
103506
- }
103507
- if (outputTime > newestOutputFileTime) {
103508
- newestOutputFileTime = outputTime;
103509
- newestOutputFileName = output;
103510
- }
103511
- if (ts.isDeclarationFileName(output)) {
103512
- var outputModifiedTime = ts.getModifiedTime(host, output);
103513
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
103514
- }
103515
- }
103516
- }
103517
- var pseudoUpToDate = false;
103518
- var usesPrepend = false;
103519
- var upstreamChangedProject;
103851
+ var referenceStatuses;
103852
+ var force = !!state.options.force;
103520
103853
  if (project.projectReferences) {
103521
103854
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
103522
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
103523
- var ref = _d[_c];
103524
- usesPrepend = usesPrepend || !!(ref.prepend);
103855
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
103856
+ var ref = _d[_i];
103525
103857
  var resolvedRef = ts.resolveProjectReferencePath(ref);
103526
103858
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
103527
- var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
103859
+ var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
103860
+ var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
103528
103861
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
103529
103862
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) {
103530
103863
  continue;
@@ -103543,65 +103876,169 @@ var ts;
103543
103876
  upstreamProjectName: ref.path
103544
103877
  };
103545
103878
  }
103546
- if (!force && !missingOutputFileName) {
103547
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
103548
- continue;
103549
- }
103550
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
103551
- pseudoUpToDate = true;
103552
- upstreamChangedProject = ref.path;
103553
- continue;
103554
- }
103555
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
103879
+ if (!force)
103880
+ (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
103881
+ }
103882
+ }
103883
+ if (force)
103884
+ return { type: ts.UpToDateStatusType.ForceBuild };
103885
+ var host = state.host;
103886
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
103887
+ var oldestOutputFileName = "(none)";
103888
+ var oldestOutputFileTime = maximumDate;
103889
+ var buildInfoTime;
103890
+ var buildInfoProgram;
103891
+ var buildInfoVersionMap;
103892
+ var newestDeclarationFileContentChangedTime;
103893
+ if (buildInfoPath) {
103894
+ var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
103895
+ buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
103896
+ if (buildInfoTime === ts.missingFileModifiedTime) {
103897
+ if (!buildInfoCacheEntry_1) {
103898
+ state.buildInfoCache.set(resolvedPath, {
103899
+ path: toPath(state, buildInfoPath),
103900
+ buildInfo: false,
103901
+ modifiedTime: buildInfoTime
103902
+ });
103903
+ }
103904
+ return {
103905
+ type: ts.UpToDateStatusType.OutputMissing,
103906
+ missingOutputFileName: buildInfoPath
103907
+ };
103908
+ }
103909
+ var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
103910
+ if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
103911
+ return {
103912
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
103913
+ version: buildInfo.version
103914
+ };
103915
+ }
103916
+ if (buildInfo.program) {
103917
+ if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
103918
+ (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
103556
103919
  return {
103557
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
103558
- outOfDateOutputFileName: oldestOutputFileName,
103559
- newerProjectName: ref.path
103920
+ type: ts.UpToDateStatusType.OutOfDateBuildInfo,
103921
+ buildInfoFile: buildInfoPath
103560
103922
  };
103561
103923
  }
103924
+ buildInfoProgram = buildInfo.program;
103562
103925
  }
103926
+ oldestOutputFileTime = buildInfoTime;
103927
+ oldestOutputFileName = buildInfoPath;
103928
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
103563
103929
  }
103564
- if (missingOutputFileName !== undefined) {
103565
- return {
103566
- type: ts.UpToDateStatusType.OutputMissing,
103567
- missingOutputFileName: missingOutputFileName
103568
- };
103930
+ var newestInputFileName = undefined;
103931
+ var newestInputFileTime = minimumDate;
103932
+ var pseudoInputUptodate = false;
103933
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
103934
+ var inputFile = _f[_e];
103935
+ var inputTime = getModifiedTime(state, inputFile);
103936
+ if (inputTime === ts.missingFileModifiedTime) {
103937
+ return {
103938
+ type: ts.UpToDateStatusType.Unbuildable,
103939
+ reason: inputFile + " does not exist"
103940
+ };
103941
+ }
103942
+ if (buildInfoTime && buildInfoTime < inputTime) {
103943
+ var version_3 = void 0;
103944
+ var currentVersion = void 0;
103945
+ if (buildInfoProgram) {
103946
+ if (!buildInfoVersionMap)
103947
+ buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
103948
+ version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
103949
+ var text = version_3 ? state.readFileWithCache(inputFile) : undefined;
103950
+ currentVersion = text && (host.createHash || ts.generateDjb2Hash)(text);
103951
+ if (version_3 && version_3 === currentVersion)
103952
+ pseudoInputUptodate = true;
103953
+ }
103954
+ if (!version_3 || version_3 !== currentVersion) {
103955
+ return {
103956
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
103957
+ outOfDateOutputFileName: buildInfoPath,
103958
+ newerInputFileName: inputFile
103959
+ };
103960
+ }
103961
+ }
103962
+ if (inputTime > newestInputFileTime) {
103963
+ newestInputFileName = inputFile;
103964
+ newestInputFileTime = inputTime;
103965
+ }
103569
103966
  }
103570
- if (isOutOfDateWithInputs) {
103571
- return {
103572
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
103573
- outOfDateOutputFileName: oldestOutputFileName,
103574
- newerInputFileName: newestInputFileName
103575
- };
103967
+ if (!buildInfoPath) {
103968
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
103969
+ var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
103970
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
103971
+ var output = outputs_1[_g];
103972
+ var path = toPath(state, output);
103973
+ var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
103974
+ if (!outputTime) {
103975
+ outputTime = ts.getModifiedTime(state.host, output);
103976
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
103977
+ }
103978
+ if (outputTime === ts.missingFileModifiedTime) {
103979
+ return {
103980
+ type: ts.UpToDateStatusType.OutputMissing,
103981
+ missingOutputFileName: output
103982
+ };
103983
+ }
103984
+ if (outputTime < oldestOutputFileTime) {
103985
+ oldestOutputFileTime = outputTime;
103986
+ oldestOutputFileName = output;
103987
+ }
103988
+ if (outputTime < newestInputFileTime) {
103989
+ return {
103990
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
103991
+ outOfDateOutputFileName: oldestOutputFileName,
103992
+ newerInputFileName: newestInputFileName
103993
+ };
103994
+ }
103995
+ }
103576
103996
  }
103577
- else {
103578
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
103579
- if (configStatus)
103580
- return configStatus;
103581
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
103582
- if (extendedConfigStatus)
103583
- return extendedConfigStatus;
103584
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
103585
- var path = _a[0];
103586
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
103587
- });
103588
- if (dependentPackageFileStatus)
103589
- return dependentPackageFileStatus;
103590
- }
103591
- if (!force && !state.buildInfoChecked.has(resolvedPath)) {
103592
- state.buildInfoChecked.set(resolvedPath, true);
103593
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
103594
- if (buildInfoPath) {
103595
- var value = state.readFileWithCache(buildInfoPath);
103596
- var buildInfo = value && ts.getBuildInfo(value);
103597
- if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
103997
+ var seenRefs = buildInfoPath ? new ts.Set() : undefined;
103998
+ var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
103999
+ seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
104000
+ var pseudoUpToDate = false;
104001
+ var usesPrepend = false;
104002
+ var upstreamChangedProject;
104003
+ if (referenceStatuses) {
104004
+ for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
104005
+ var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
104006
+ usesPrepend = usesPrepend || !!(ref.prepend);
104007
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
104008
+ continue;
104009
+ }
104010
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
103598
104011
  return {
103599
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
103600
- version: buildInfo.version
104012
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
104013
+ outOfDateOutputFileName: buildInfoPath,
104014
+ newerProjectName: ref.path
103601
104015
  };
103602
104016
  }
104017
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
104018
+ pseudoUpToDate = true;
104019
+ upstreamChangedProject = ref.path;
104020
+ continue;
104021
+ }
104022
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
104023
+ return {
104024
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
104025
+ outOfDateOutputFileName: oldestOutputFileName,
104026
+ newerProjectName: ref.path
104027
+ };
103603
104028
  }
103604
104029
  }
104030
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
104031
+ if (configStatus)
104032
+ return configStatus;
104033
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
104034
+ if (extendedConfigStatus)
104035
+ return extendedConfigStatus;
104036
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
104037
+ var path = _a[0];
104038
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
104039
+ });
104040
+ if (dependentPackageFileStatus)
104041
+ return dependentPackageFileStatus;
103605
104042
  if (usesPrepend && pseudoUpToDate) {
103606
104043
  return {
103607
104044
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -103610,15 +104047,36 @@ var ts;
103610
104047
  };
103611
104048
  }
103612
104049
  return {
103613
- type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
104050
+ type: pseudoUpToDate ?
104051
+ ts.UpToDateStatusType.UpToDateWithUpstreamTypes :
104052
+ pseudoInputUptodate ?
104053
+ ts.UpToDateStatusType.UpToDateWithInputFileText :
104054
+ ts.UpToDateStatusType.UpToDate,
103614
104055
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
103615
104056
  newestInputFileTime: newestInputFileTime,
103616
- newestOutputFileTime: newestOutputFileTime,
103617
104057
  newestInputFileName: newestInputFileName,
103618
- newestOutputFileName: newestOutputFileName,
103619
104058
  oldestOutputFileName: oldestOutputFileName
103620
104059
  };
103621
104060
  }
104061
+ function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
104062
+ if (seenRefs.has(resolvedRefPath))
104063
+ return false;
104064
+ seenRefs.add(resolvedRefPath);
104065
+ var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
104066
+ if (refBuildInfo.path === buildInfoCacheEntry.path)
104067
+ return true;
104068
+ if (resolvedConfig.projectReferences) {
104069
+ for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
104070
+ var ref = _a[_i];
104071
+ var resolvedRef = ts.resolveProjectReferencePath(ref);
104072
+ var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
104073
+ var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
104074
+ if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
104075
+ return true;
104076
+ }
104077
+ }
104078
+ return false;
104079
+ }
103622
104080
  function getUpToDateStatus(state, project, resolvedPath) {
103623
104081
  if (project === undefined) {
103624
104082
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -103627,43 +104085,75 @@ var ts;
103627
104085
  if (prior !== undefined) {
103628
104086
  return prior;
103629
104087
  }
104088
+ ts.solutionPerformance.mark("beforeGetUpToDateStatus");
103630
104089
  var actual = getUpToDateStatusWorker(state, project, resolvedPath);
104090
+ ts.solutionPerformance.mark("afterGetUpToDateStatus");
104091
+ ts.solutionPerformance.measure("GetUpToDateStatus", "beforeGetUpToDateStatus", "afterGetUpToDateStatus");
103631
104092
  state.projectStatus.set(resolvedPath, actual);
103632
104093
  return actual;
103633
104094
  }
103634
- function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
104095
+ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
103635
104096
  if (proj.options.noEmit)
103636
- return priorNewestUpdateTime;
103637
- var host = state.host;
103638
- var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
103639
- if (!skipOutputs || outputs.length !== skipOutputs.size) {
103640
- var reportVerbose = !!state.options.verbose;
103641
- var now = host.now ? host.now() : new Date();
103642
- for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
103643
- var file = outputs_2[_i];
103644
- if (skipOutputs && skipOutputs.has(toPath(state, file))) {
103645
- continue;
103646
- }
103647
- if (reportVerbose) {
103648
- reportVerbose = false;
104097
+ return;
104098
+ var now;
104099
+ ts.solutionPerformance.mark("beforeUpdateOutputTimestamps");
104100
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
104101
+ if (buildInfoPath) {
104102
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
104103
+ if (!!state.options.verbose)
103649
104104
  reportStatus(state, verboseMessage, proj.options.configFilePath);
104105
+ state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
104106
+ getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
104107
+ }
104108
+ state.outputTimeStamps.delete(projectPath);
104109
+ }
104110
+ else {
104111
+ var host = state.host;
104112
+ var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
104113
+ var outputTimeStampMap_1 = getOutputTimeStampMap(state, projectPath);
104114
+ var modifiedOutputs_1 = outputTimeStampMap_1 ? new ts.Set() : undefined;
104115
+ if (!skipOutputs || outputs.length !== skipOutputs.size) {
104116
+ var reportVerbose = !!state.options.verbose;
104117
+ for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
104118
+ var file = outputs_2[_i];
104119
+ var path = toPath(state, file);
104120
+ if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
104121
+ continue;
104122
+ if (reportVerbose) {
104123
+ reportVerbose = false;
104124
+ reportStatus(state, verboseMessage, proj.options.configFilePath);
104125
+ }
104126
+ host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
104127
+ if (outputTimeStampMap_1) {
104128
+ outputTimeStampMap_1.set(path, now);
104129
+ modifiedOutputs_1.add(path);
104130
+ }
103650
104131
  }
103651
- if (ts.isDeclarationFileName(file)) {
103652
- priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
103653
- }
103654
- host.setModifiedTime(file, now);
103655
104132
  }
104133
+ outputTimeStampMap_1 === null || outputTimeStampMap_1 === void 0 ? void 0 : outputTimeStampMap_1.forEach(function (_value, key) {
104134
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs_1.has(key))
104135
+ outputTimeStampMap_1.delete(key);
104136
+ });
103656
104137
  }
103657
- return priorNewestUpdateTime;
104138
+ ts.solutionPerformance.mark("afterUpdateOutputTimestamps");
104139
+ ts.solutionPerformance.measure("UpdateOutputTimestamps", "beforeUpdateOutputTimestamps", "afterUpdateOutputTimestamps");
104140
+ }
104141
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
104142
+ var _a;
104143
+ if (!options.composite)
104144
+ return undefined;
104145
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
104146
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, undefined);
104147
+ return ((_a = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.program) === null || _a === void 0 ? void 0 : _a.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
103658
104148
  }
103659
104149
  function updateOutputTimestamps(state, proj, resolvedPath) {
103660
104150
  if (state.options.dry) {
103661
104151
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
103662
104152
  }
103663
- var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
104153
+ updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
103664
104154
  state.projectStatus.set(resolvedPath, {
103665
104155
  type: ts.UpToDateStatusType.UpToDate,
103666
- newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
104156
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
103667
104157
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
103668
104158
  });
103669
104159
  }
@@ -103702,6 +104192,7 @@ var ts;
103702
104192
  }
103703
104193
  break;
103704
104194
  }
104195
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
103705
104196
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
103706
104197
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
103707
104198
  if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
@@ -103725,6 +104216,13 @@ var ts;
103725
104216
  }
103726
104217
  }
103727
104218
  function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
104219
+ ts.solutionPerformance.mark("beforeBuild");
104220
+ var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences);
104221
+ ts.solutionPerformance.mark("afterBuild");
104222
+ ts.solutionPerformance.measure("Build", "beforeBuild", "afterBuild");
104223
+ return result;
104224
+ }
104225
+ function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
103728
104226
  var buildOrder = getBuildOrderFor(state, project, onlyReferences);
103729
104227
  if (!buildOrder)
103730
104228
  return ts.ExitStatus.InvalidProject_OutputsSkipped;
@@ -103736,7 +104234,10 @@ var ts;
103736
104234
  if (!invalidatedProject)
103737
104235
  break;
103738
104236
  reportQueue = false;
104237
+ ts.solutionPerformance.mark("beforeInvalidatedProjectBuild");
103739
104238
  invalidatedProject.done(cancellationToken, writeFile, getCustomTransformers === null || getCustomTransformers === void 0 ? void 0 : getCustomTransformers(invalidatedProject.project));
104239
+ ts.solutionPerformance.mark("afterInvalidatedProjectBuild");
104240
+ ts.solutionPerformance.measure("InvalidatedProjectBuild", "beforeInvalidatedProjectBuild", "afterInvalidatedProjectBuild");
103740
104241
  if (!state.diagnostics.has(invalidatedProject.projectPath))
103741
104242
  successfulProjects++;
103742
104243
  }
@@ -103822,6 +104323,14 @@ var ts;
103822
104323
  state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
103823
104324
  }
103824
104325
  function buildNextInvalidatedProject(state, changeDetected) {
104326
+ ts.solutionPerformance.mark("beforeBuild");
104327
+ var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
104328
+ ts.solutionPerformance.mark("afterBuild");
104329
+ ts.solutionPerformance.measure("Build", "beforeBuild", "afterBuild");
104330
+ if (buildOrder)
104331
+ reportErrorSummary(state, buildOrder);
104332
+ }
104333
+ function buildNextInvalidatedProjectWorker(state, changeDetected) {
103825
104334
  state.timerToBuildInvalidatedProject = undefined;
103826
104335
  if (state.reportFileChangeDetected) {
103827
104336
  state.reportFileChangeDetected = false;
@@ -103832,7 +104341,10 @@ var ts;
103832
104341
  var buildOrder = getBuildOrder(state);
103833
104342
  var invalidatedProject = getNextInvalidatedProject(state, buildOrder, false);
103834
104343
  if (invalidatedProject) {
104344
+ ts.solutionPerformance.mark("beforeInvalidatedProjectBuild");
103835
104345
  invalidatedProject.done();
104346
+ ts.solutionPerformance.mark("afterInvalidatedProjectBuild");
104347
+ ts.solutionPerformance.measure("InvalidatedProjectBuild", "beforeInvalidatedProjectBuild", "afterInvalidatedProjectBuild");
103836
104348
  projectsBuilt++;
103837
104349
  while (state.projectPendingBuild.size) {
103838
104350
  if (state.timerToBuildInvalidatedProject)
@@ -103845,23 +104357,24 @@ var ts;
103845
104357
  return;
103846
104358
  }
103847
104359
  var project = createInvalidatedProjectWithInfo(state, info, buildOrder);
104360
+ ts.solutionPerformance.mark("beforeInvalidatedProjectBuild");
103848
104361
  project.done();
104362
+ ts.solutionPerformance.mark("afterInvalidatedProjectBuild");
104363
+ ts.solutionPerformance.measure("InvalidatedProjectBuild", "beforeInvalidatedProjectBuild", "afterInvalidatedProjectBuild");
103849
104364
  if (info.kind !== InvalidatedProjectKind.UpdateOutputFileStamps)
103850
104365
  projectsBuilt++;
103851
104366
  }
103852
104367
  }
103853
104368
  disableCache(state);
103854
- reportErrorSummary(state, buildOrder);
104369
+ return buildOrder;
103855
104370
  }
103856
104371
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
103857
104372
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
103858
104373
  return;
103859
- state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
103860
- invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
103861
- }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
104374
+ state.allWatchedConfigFiles.set(resolvedPath, watchFile(state, resolved, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full); }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
103862
104375
  }
103863
104376
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
103864
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
104377
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
103865
104378
  var _a;
103866
104379
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
103867
104380
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -103893,7 +104406,7 @@ var ts;
103893
104406
  if (!state.watch)
103894
104407
  return;
103895
104408
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
103896
- createNewValue: function (_path, input) { return state.watchFile(input, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.None); }, ts.PollingInterval.Low, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.SourceFile, resolved); },
104409
+ createNewValue: function (_path, input) { return watchFile(state, input, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.None); }, ts.PollingInterval.Low, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.SourceFile, resolved); },
103897
104410
  onDeleteValue: ts.closeFileWatcher,
103898
104411
  });
103899
104412
  }
@@ -103901,13 +104414,14 @@ var ts;
103901
104414
  if (!state.watch || !state.lastCachedPackageJsonLookups)
103902
104415
  return;
103903
104416
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
103904
- createNewValue: function (path, _input) { return state.watchFile(path, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.None); }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.PackageJson, resolved); },
104417
+ createNewValue: function (path, _input) { return watchFile(state, path, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.None); }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.PackageJson, resolved); },
103905
104418
  onDeleteValue: ts.closeFileWatcher,
103906
104419
  });
103907
104420
  }
103908
104421
  function startWatching(state, buildOrder) {
103909
104422
  if (!state.watchAllProjectsPending)
103910
104423
  return;
104424
+ ts.solutionPerformance.mark("beforeStartWatching");
103911
104425
  state.watchAllProjectsPending = false;
103912
104426
  for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) {
103913
104427
  var resolved = _a[_i];
@@ -103921,6 +104435,8 @@ var ts;
103921
104435
  watchPackageJsonFiles(state, resolved, resolvedPath, cfg);
103922
104436
  }
103923
104437
  }
104438
+ ts.solutionPerformance.mark("afterStartWatching");
104439
+ ts.solutionPerformance.measure("StartWatching", "beforeStartWatching", "afterStartWatching");
103924
104440
  }
103925
104441
  function stopWatching(state) {
103926
104442
  ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher);
@@ -104023,25 +104539,26 @@ var ts;
104023
104539
  }
104024
104540
  }
104025
104541
  function reportUpToDateStatus(state, configFileName, status) {
104026
- if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
104027
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
104028
- }
104029
104542
  switch (status.type) {
104030
104543
  case ts.UpToDateStatusType.OutOfDateWithSelf:
104031
- return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerInputFileName));
104544
+ return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerInputFileName));
104032
104545
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
104033
- return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName));
104546
+ return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName));
104034
104547
  case ts.UpToDateStatusType.OutputMissing:
104035
104548
  return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName));
104549
+ case ts.UpToDateStatusType.OutOfDateBuildInfo:
104550
+ return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_are_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile));
104036
104551
  case ts.UpToDateStatusType.UpToDate:
104037
104552
  if (status.newestInputFileTime !== undefined) {
104038
- return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, relName(state, configFileName), relName(state, status.newestInputFileName || ""), relName(state, status.oldestOutputFileName || ""));
104553
+ return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2, relName(state, configFileName), relName(state, status.newestInputFileName || ""), relName(state, status.oldestOutputFileName || ""));
104039
104554
  }
104040
104555
  break;
104041
104556
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
104042
104557
  return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed, relName(state, configFileName), relName(state, status.newerProjectName));
104043
104558
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
104044
104559
  return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
104560
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
104561
+ return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_but_needs_update_to_timestamps_of_output_files_that_are_older_than_input_files, relName(state, configFileName));
104045
104562
  case ts.UpToDateStatusType.UpstreamOutOfDate:
104046
104563
  return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date, relName(state, configFileName), relName(state, status.upstreamProjectName));
104047
104564
  case ts.UpToDateStatusType.UpstreamBlocked:
@@ -104052,6 +104569,8 @@ var ts;
104052
104569
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
104053
104570
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
104054
104571
  return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2, relName(state, configFileName), status.version, ts.version);
104572
+ case ts.UpToDateStatusType.ForceBuild:
104573
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
104055
104574
  case ts.UpToDateStatusType.ContainerOnly:
104056
104575
  case ts.UpToDateStatusType.ComputingUpstream:
104057
104576
  break;
@@ -104067,6 +104586,12 @@ var ts;
104067
104586
  })(ts || (ts = {}));
104068
104587
  var ts;
104069
104588
  (function (ts) {
104589
+ var StatisticType;
104590
+ (function (StatisticType) {
104591
+ StatisticType[StatisticType["time"] = 0] = "time";
104592
+ StatisticType[StatisticType["count"] = 1] = "count";
104593
+ StatisticType[StatisticType["memory"] = 2] = "memory";
104594
+ })(StatisticType = ts.StatisticType || (ts.StatisticType = {}));
104070
104595
  function countLines(program) {
104071
104596
  var counts = getCountsMap();
104072
104597
  ts.forEach(program.getSourceFiles(), function (file) {
@@ -104627,18 +105152,73 @@ var ts;
104627
105152
  if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic))
104628
105153
  return;
104629
105154
  var buildHost_1 = ts.createSolutionBuilderWithWatchHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createWatchStatusReporter(sys, buildOptions));
105155
+ var onWatchStatusChange_1 = buildHost_1.onWatchStatusChange;
105156
+ var reportWatchStatistics_1 = false;
105157
+ buildHost_1.onWatchStatusChange = function (d, newLine, options, errorCount) {
105158
+ onWatchStatusChange_1 === null || onWatchStatusChange_1 === void 0 ? void 0 : onWatchStatusChange_1(d, newLine, options, errorCount);
105159
+ if (!reportWatchStatistics_1)
105160
+ return;
105161
+ if (d.code === ts.Diagnostics.Found_0_errors_Watching_for_file_changes.code ||
105162
+ d.code === ts.Diagnostics.Found_1_error_Watching_for_file_changes.code) {
105163
+ reportSolutionBuilderTimes(sys, builder_1, buildHost_1);
105164
+ }
105165
+ };
104630
105166
  updateSolutionBuilderHost(sys, cb, buildHost_1);
105167
+ enableSolutionPerformance(sys, buildOptions);
104631
105168
  var builder_1 = ts.createSolutionBuilderWithWatch(buildHost_1, projects, buildOptions, watchOptions);
104632
105169
  builder_1.build();
105170
+ reportSolutionBuilderTimes(sys, builder_1, buildHost_1);
105171
+ reportWatchStatistics_1 = true;
104633
105172
  return builder_1;
104634
105173
  }
104635
105174
  var buildHost = ts.createSolutionBuilderHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createReportErrorSummary(sys, buildOptions));
104636
105175
  updateSolutionBuilderHost(sys, cb, buildHost);
105176
+ enableSolutionPerformance(sys, buildOptions);
104637
105177
  var builder = ts.createSolutionBuilder(buildHost, projects, buildOptions);
104638
105178
  var exitStatus = buildOptions.clean ? builder.clean() : builder.build();
105179
+ reportSolutionBuilderTimes(sys, builder, buildHost);
104639
105180
  ts.dumpTracingLegend();
104640
105181
  return sys.exit(exitStatus);
104641
105182
  }
105183
+ function enableSolutionPerformance(system, options) {
105184
+ if (system === ts.sys && (options.diagnostics || options.extendedDiagnostics))
105185
+ ts.solutionPerformance.enable();
105186
+ }
105187
+ function reportSolutionBuilderTimes(system, builder, buildHost) {
105188
+ if (system !== ts.sys)
105189
+ return;
105190
+ if (ts.solutionPerformance.isEnabled()) {
105191
+ var solutionStatistics_1 = [];
105192
+ ts.solutionPerformance.forEachMeasure(function (name, duration) { return solutionStatistics_1.push({ name: name + " time", value: duration, type: StatisticType.time }); });
105193
+ solutionStatistics_1.push({ name: "projectsBuilt", value: ts.solutionPerformance.getCount("projectsBuilt"), type: StatisticType.count }, { name: "timestampUpdated", value: ts.solutionPerformance.getCount("timestampUpdated"), type: StatisticType.count }, { name: "bundlesUpdated", value: ts.solutionPerformance.getCount("bundlesUpdated"), type: StatisticType.count }, { name: "projects", value: ts.getBuildOrderFromAnyBuildOrder(builder.getBuildOrder()).length, type: StatisticType.count });
105194
+ buildHost.statistics = ts.append(buildHost.statistics, solutionStatistics_1);
105195
+ ts.solutionPerformance.disable();
105196
+ ts.solutionPerformance.enable();
105197
+ }
105198
+ if (!buildHost.statistics)
105199
+ return;
105200
+ var statistics = [];
105201
+ var map = new ts.Map();
105202
+ for (var _i = 0, _a = buildHost.statistics; _i < _a.length; _i++) {
105203
+ var statistic = _a[_i];
105204
+ for (var _b = 0, statistic_1 = statistic; _b < statistic_1.length; _b++) {
105205
+ var s = statistic_1[_b];
105206
+ var existing = map.get(s.name);
105207
+ if (existing) {
105208
+ if (existing.type === StatisticType.memory)
105209
+ existing.value = Math.max(existing.value, s.value);
105210
+ else
105211
+ existing.value += s.value;
105212
+ }
105213
+ else {
105214
+ map.set(s.name, s);
105215
+ statistics.push(s);
105216
+ }
105217
+ }
105218
+ }
105219
+ buildHost.statistics = undefined;
105220
+ reportAllStatistics(system, statistics);
105221
+ }
104642
105222
  function createReportErrorSummary(sys, options) {
104643
105223
  return shouldBePretty(sys, options) ?
104644
105224
  function (errorCount, filesInError) { return sys.write(ts.getErrorSummaryText(errorCount, filesInError, sys.newLine, sys)); } :
@@ -104687,10 +105267,13 @@ var ts;
104687
105267
  function updateSolutionBuilderHost(sys, cb, buildHost) {
104688
105268
  updateCreateProgram(sys, buildHost);
104689
105269
  buildHost.afterProgramEmitAndDiagnostics = function (program) {
104690
- reportStatistics(sys, program.getProgram());
105270
+ buildHost.statistics = ts.append(buildHost.statistics, reportStatistics(sys, program.getProgram()));
104691
105271
  cb(program);
104692
105272
  };
104693
- buildHost.afterEmitBundle = cb;
105273
+ buildHost.afterEmitBundle = function (config) {
105274
+ buildHost.statistics = ts.append(buildHost.statistics, reportStatistics(sys, config));
105275
+ cb(config);
105276
+ };
104694
105277
  }
104695
105278
  function updateCreateProgram(sys, host) {
104696
105279
  var compileUsingBuilder = host.createProgram;
@@ -104754,8 +105337,13 @@ var ts;
104754
105337
  ts.startTracing(isBuildMode ? "build" : "project", compilerOptions.generateTrace, compilerOptions.configFilePath);
104755
105338
  }
104756
105339
  }
104757
- function reportStatistics(sys, program) {
104758
- var compilerOptions = program.getCompilerOptions();
105340
+ function isProgram(programOrConfig) {
105341
+ return !!programOrConfig.getCompilerOptions;
105342
+ }
105343
+ function reportStatistics(sys, programOrConfig) {
105344
+ var program = isProgram(programOrConfig) ? programOrConfig : undefined;
105345
+ var config = !isProgram(programOrConfig) ? programOrConfig : undefined;
105346
+ var compilerOptions = (program === null || program === void 0 ? void 0 : program.getCompilerOptions()) || (config === null || config === void 0 ? void 0 : config.options);
104759
105347
  if (canTrace(sys, compilerOptions)) {
104760
105348
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.stopTracing();
104761
105349
  }
@@ -104763,29 +105351,31 @@ var ts;
104763
105351
  if (canReportDiagnostics(sys, compilerOptions)) {
104764
105352
  statistics = [];
104765
105353
  var memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1;
104766
- reportCountStatistic("Files", program.getSourceFiles().length);
104767
- var lineCounts = countLines(program);
104768
- var nodeCounts = countNodes(program);
104769
- if (compilerOptions.extendedDiagnostics) {
104770
- for (var _i = 0, _a = ts.arrayFrom(lineCounts.keys()); _i < _a.length; _i++) {
104771
- var key = _a[_i];
104772
- reportCountStatistic("Lines of " + key, lineCounts.get(key));
105354
+ if (program) {
105355
+ reportCountStatistic("Files", program.getSourceFiles().length);
105356
+ var lineCounts = countLines(program);
105357
+ var nodeCounts = countNodes(program);
105358
+ if (compilerOptions.extendedDiagnostics) {
105359
+ for (var _i = 0, _a = ts.arrayFrom(lineCounts.keys()); _i < _a.length; _i++) {
105360
+ var key = _a[_i];
105361
+ reportCountStatistic("Lines of " + key, lineCounts.get(key));
105362
+ }
105363
+ for (var _b = 0, _c = ts.arrayFrom(nodeCounts.keys()); _b < _c.length; _b++) {
105364
+ var key = _c[_b];
105365
+ reportCountStatistic("Nodes of " + key, nodeCounts.get(key));
105366
+ }
104773
105367
  }
104774
- for (var _b = 0, _c = ts.arrayFrom(nodeCounts.keys()); _b < _c.length; _b++) {
104775
- var key = _c[_b];
104776
- reportCountStatistic("Nodes of " + key, nodeCounts.get(key));
105368
+ else {
105369
+ reportCountStatistic("Lines", ts.reduceLeftIterator(lineCounts.values(), function (sum, count) { return sum + count; }, 0));
105370
+ reportCountStatistic("Nodes", ts.reduceLeftIterator(nodeCounts.values(), function (sum, count) { return sum + count; }, 0));
104777
105371
  }
105372
+ reportCountStatistic("Identifiers", program.getIdentifierCount());
105373
+ reportCountStatistic("Symbols", program.getSymbolCount());
105374
+ reportCountStatistic("Types", program.getTypeCount());
105375
+ reportCountStatistic("Instantiations", program.getInstantiationCount());
104778
105376
  }
104779
- else {
104780
- reportCountStatistic("Lines", ts.reduceLeftIterator(lineCounts.values(), function (sum, count) { return sum + count; }, 0));
104781
- reportCountStatistic("Nodes", ts.reduceLeftIterator(nodeCounts.values(), function (sum, count) { return sum + count; }, 0));
104782
- }
104783
- reportCountStatistic("Identifiers", program.getIdentifierCount());
104784
- reportCountStatistic("Symbols", program.getSymbolCount());
104785
- reportCountStatistic("Types", program.getTypeCount());
104786
- reportCountStatistic("Instantiations", program.getInstantiationCount());
104787
105377
  if (memoryUsed >= 0) {
104788
- reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K");
105378
+ reportMemoryStatistic("Memory used", memoryUsed);
104789
105379
  }
104790
105380
  var isPerformanceEnabled = ts.performance.isEnabled();
104791
105381
  var programTime = isPerformanceEnabled ? ts.performance.getDuration("Program") : 0;
@@ -104793,11 +105383,13 @@ var ts;
104793
105383
  var checkTime = isPerformanceEnabled ? ts.performance.getDuration("Check") : 0;
104794
105384
  var emitTime = isPerformanceEnabled ? ts.performance.getDuration("Emit") : 0;
104795
105385
  if (compilerOptions.extendedDiagnostics) {
104796
- var caches = program.getRelationCacheSizes();
104797
- reportCountStatistic("Assignability cache size", caches.assignable);
104798
- reportCountStatistic("Identity cache size", caches.identity);
104799
- reportCountStatistic("Subtype cache size", caches.subtype);
104800
- reportCountStatistic("Strict subtype cache size", caches.strictSubtype);
105386
+ if (program) {
105387
+ var caches = program.getRelationCacheSizes();
105388
+ reportCountStatistic("Assignability cache size", caches.assignable);
105389
+ reportCountStatistic("Identity cache size", caches.identity);
105390
+ reportCountStatistic("Subtype cache size", caches.subtype);
105391
+ reportCountStatistic("Strict subtype cache size", caches.strictSubtype);
105392
+ }
104801
105393
  if (isPerformanceEnabled) {
104802
105394
  ts.performance.forEachMeasure(function (name, duration) { return reportTimeStatistic(name + " time", duration); });
104803
105395
  }
@@ -104813,39 +105405,54 @@ var ts;
104813
105405
  if (isPerformanceEnabled) {
104814
105406
  reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime);
104815
105407
  }
104816
- reportStatistics();
105408
+ reportAllStatistics(sys, statistics);
104817
105409
  if (!isPerformanceEnabled) {
104818
105410
  sys.write(ts.Diagnostics.Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found.message + "\n");
104819
105411
  }
104820
105412
  else {
104821
105413
  ts.performance.disable();
104822
105414
  }
105415
+ return statistics;
104823
105416
  }
104824
- function reportStatistics() {
104825
- var nameSize = 0;
104826
- var valueSize = 0;
104827
- for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) {
104828
- var _a = statistics_1[_i], name = _a.name, value = _a.value;
104829
- if (name.length > nameSize) {
104830
- nameSize = name.length;
104831
- }
104832
- if (value.length > valueSize) {
104833
- valueSize = value.length;
104834
- }
104835
- }
104836
- for (var _b = 0, statistics_2 = statistics; _b < statistics_2.length; _b++) {
104837
- var _c = statistics_2[_b], name = _c.name, value = _c.value;
104838
- sys.write(ts.padRight(name + ":", nameSize + 2) + ts.padLeft(value.toString(), valueSize) + sys.newLine);
104839
- }
104840
- }
104841
- function reportStatisticalValue(name, value) {
104842
- statistics.push({ name: name, value: value });
105417
+ function reportMemoryStatistic(name, memoryUsed) {
105418
+ statistics.push({ name: name, value: memoryUsed, type: StatisticType.memory });
104843
105419
  }
104844
105420
  function reportCountStatistic(name, count) {
104845
- reportStatisticalValue(name, "" + count);
105421
+ statistics.push({ name: name, value: count, type: StatisticType.count });
104846
105422
  }
104847
105423
  function reportTimeStatistic(name, time) {
104848
- reportStatisticalValue(name, (time / 1000).toFixed(2) + "s");
105424
+ statistics.push({ name: name, value: time, type: StatisticType.time });
105425
+ }
105426
+ }
105427
+ function reportAllStatistics(sys, statistics) {
105428
+ var nameSize = 0;
105429
+ var valueSize = 0;
105430
+ for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) {
105431
+ var s = statistics_1[_i];
105432
+ if (s.name.length > nameSize) {
105433
+ nameSize = s.name.length;
105434
+ }
105435
+ var valueString = statisticValue(s);
105436
+ if (valueString.length > valueSize) {
105437
+ valueSize = valueString.length;
105438
+ }
105439
+ }
105440
+ for (var _a = 0, statistics_2 = statistics; _a < statistics_2.length; _a++) {
105441
+ var s = statistics_2[_a];
105442
+ sys.write(ts.padRight(s.name + ":", nameSize + 2) + ts.padLeft(statisticValue(s).toString(), valueSize) + sys.newLine);
105443
+ }
105444
+ }
105445
+ function statisticValue(s) {
105446
+ switch (s.type) {
105447
+ case StatisticType.count:
105448
+ return "" + s.value;
105449
+ case StatisticType.time:
105450
+ return (s.value / 1000).toFixed(2) + "s";
105451
+ case StatisticType.memory:
105452
+ return Math.round(s.value / 1000) + "K";
105453
+ break;
105454
+ default:
105455
+ ts.Debug.assertNever(s.type);
104849
105456
  }
104850
105457
  }
104851
105458
  function writeConfigFile(sys, reportDiagnostic, options, fileNames) {