@typescript-deploys/pr-build 4.8.0-pr-49285-2 → 4.8.0-pr-48784-20

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/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-insiders.20220531";
103
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220601";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -3523,6 +3523,7 @@ var ts;
3523
3523
  var marks = new ts.Map();
3524
3524
  var counts = new ts.Map();
3525
3525
  var durations = new ts.Map();
3526
+ var durationMarks = new ts.Set();
3526
3527
  return {
3527
3528
  createTimerIf: createTimerIf,
3528
3529
  createTimer: createTimer,
@@ -3531,6 +3532,7 @@ var ts;
3531
3532
  getCount: getCount,
3532
3533
  getDuration: getDuration,
3533
3534
  forEachMeasure: forEachMeasure,
3535
+ forEachCount: forEachCount,
3534
3536
  isEnabled: isEnabled,
3535
3537
  enable: enable,
3536
3538
  disable: disable,
@@ -3585,6 +3587,7 @@ var ts;
3585
3587
  function measure(measureName, startMarkName, endMarkName) {
3586
3588
  var _a, _b;
3587
3589
  if (enabled) {
3590
+ durationMarks.add(startMarkName).add(endMarkName);
3588
3591
  var end = (_a = marks.get(endMarkName)) !== null && _a !== void 0 ? _a : ts.timestamp();
3589
3592
  var start = (_b = marks.get(startMarkName)) !== null && _b !== void 0 ? _b : timeorigin;
3590
3593
  var previousDuration = durations.get(measureName) || 0;
@@ -3616,6 +3619,14 @@ var ts;
3616
3619
  function forEachMeasure(cb) {
3617
3620
  durations.forEach(function (duration, measureName) { return cb(measureName, duration); });
3618
3621
  }
3622
+ /**
3623
+ * Iterate over each count which is not duration mark, performing some action
3624
+ *
3625
+ * @param cb The action to perform for each measure
3626
+ */
3627
+ function forEachCount(cb) {
3628
+ counts.forEach(function (count, countName) { return !durationMarks.has(countName) && cb(countName, count); });
3629
+ }
3619
3630
  /**
3620
3631
  * Indicates whether the performance API is enabled.
3621
3632
  */
@@ -6200,7 +6211,7 @@ var ts;
6200
6211
  };
6201
6212
  }
6202
6213
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
6203
- var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName) {
6214
+ var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName, modifiedTime) {
6204
6215
  // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
6205
6216
  if (!ts.isString(relativeFileName))
6206
6217
  return;
@@ -6210,7 +6221,7 @@ var ts;
6210
6221
  if (callbacks) {
6211
6222
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
6212
6223
  var fileCallback = callbacks_1[_i];
6213
- fileCallback(fileName, FileWatcherEventKind.Changed);
6224
+ fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6214
6225
  }
6215
6226
  }
6216
6227
  },
@@ -6264,7 +6275,7 @@ var ts;
6264
6275
  }
6265
6276
  else {
6266
6277
  cache.set(path, {
6267
- watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
6278
+ watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6268
6279
  refCount: 1
6269
6280
  });
6270
6281
  }
@@ -6292,7 +6303,7 @@ var ts;
6292
6303
  var newTime = modifiedTime.getTime();
6293
6304
  if (oldTime !== newTime) {
6294
6305
  watchedFile.mtime = modifiedTime;
6295
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
6306
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
6296
6307
  return true;
6297
6308
  }
6298
6309
  return false;
@@ -6543,17 +6554,18 @@ var ts;
6543
6554
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6544
6555
  /*@internal*/
6545
6556
  function createFileWatcherCallback(callback) {
6546
- return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
6557
+ return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6547
6558
  }
6548
6559
  ts.createFileWatcherCallback = createFileWatcherCallback;
6549
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists) {
6550
- return function (eventName) {
6560
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6561
+ return function (eventName, _relativeFileName, modifiedTime) {
6551
6562
  if (eventName === "rename") {
6552
- callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6563
+ modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
6564
+ callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
6553
6565
  }
6554
6566
  else {
6555
6567
  // Change
6556
- callback(fileName, FileWatcherEventKind.Changed);
6568
+ callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6557
6569
  }
6558
6570
  };
6559
6571
  }
@@ -6577,7 +6589,7 @@ var ts;
6577
6589
  }
6578
6590
  /*@internal*/
6579
6591
  function createSystemWatchFunctions(_a) {
6580
- 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;
6592
+ 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;
6581
6593
  var dynamicPollingWatchFile;
6582
6594
  var fixedChunkSizePollingWatchFile;
6583
6595
  var nonPollingWatchFile;
@@ -6599,7 +6611,7 @@ var ts;
6599
6611
  case ts.WatchFileKind.FixedChunkSizePolling:
6600
6612
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, /* pollingInterval */ undefined, /*options*/ undefined);
6601
6613
  case ts.WatchFileKind.UseFsEvents:
6602
- return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists),
6614
+ return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime),
6603
6615
  /*recursive*/ false, pollingInterval, ts.getFallbackOptions(options));
6604
6616
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
6605
6617
  if (!nonPollingWatchFile) {
@@ -6781,7 +6793,6 @@ var ts;
6781
6793
  fsWatch: fsWatch,
6782
6794
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6783
6795
  getCurrentDirectory: getCurrentDirectory,
6784
- fileExists: fileExists,
6785
6796
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
6786
6797
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
6787
6798
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
@@ -7041,7 +7052,7 @@ var ts;
7041
7052
  // File changed
7042
7053
  eventKind = FileWatcherEventKind.Changed;
7043
7054
  }
7044
- callback(fileName, eventKind);
7055
+ callback(fileName, eventKind, curr.mtime);
7045
7056
  }
7046
7057
  }
7047
7058
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
@@ -7067,10 +7078,10 @@ var ts;
7067
7078
  * Invoke the callback with rename and update the watcher if not closed
7068
7079
  * @param createWatcher
7069
7080
  */
7070
- function invokeCallbackAndUpdateWatcher(createWatcher) {
7081
+ function invokeCallbackAndUpdateWatcher(createWatcher, modifiedTime) {
7071
7082
  sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
7072
7083
  // Call the callback for current directory
7073
- callback("rename", "");
7084
+ callback("rename", "", modifiedTime);
7074
7085
  // If watcher is not closed, update it
7075
7086
  if (watcher) {
7076
7087
  watcher.close();
@@ -7116,13 +7127,14 @@ var ts;
7116
7127
  function callbackChangingToMissingFileSystemEntry(event, relativeName) {
7117
7128
  // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
7118
7129
  // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
7130
+ var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
7119
7131
  return event === "rename" &&
7120
7132
  (!relativeName ||
7121
7133
  relativeName === lastDirectoryPart ||
7122
7134
  (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
7123
- !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7124
- invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
7125
- callback(event, relativeName);
7135
+ modifiedTime === ts.missingFileModifiedTime ?
7136
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry, modifiedTime) :
7137
+ callback(event, relativeName, modifiedTime);
7126
7138
  }
7127
7139
  /**
7128
7140
  * Watch the file or directory using fs.watchFile since fs.watch threw exception
@@ -7136,12 +7148,15 @@ var ts;
7136
7148
  * and switch to existing file or directory when the missing filesystem entry is created
7137
7149
  */
7138
7150
  function watchMissingFileSystemEntry() {
7139
- return watchFile(fileOrDirectory, function (_fileName, eventKind) {
7140
- if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
7141
- // Call the callback for current file or directory
7142
- // For now it could be callback for the inner directory creation,
7143
- // but just return current directory, better than current no-op
7144
- invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
7151
+ return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
7152
+ if (eventKind === FileWatcherEventKind.Created) {
7153
+ modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
7154
+ if (modifiedTime !== ts.missingFileModifiedTime) {
7155
+ // Call the callback for current file or directory
7156
+ // For now it could be callback for the inner directory creation,
7157
+ // but just return current directory, better than current no-op
7158
+ invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry, modifiedTime);
7159
+ }
7145
7160
  }
7146
7161
  }, fallbackPollingInterval, fallbackOptions);
7147
7162
  }
@@ -7291,12 +7306,19 @@ var ts;
7291
7306
  }
7292
7307
  function getModifiedTime(path) {
7293
7308
  var _a;
7309
+ // Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
7310
+ // the CPU time performance.
7311
+ var originalStackTraceLimit = Error.stackTraceLimit;
7312
+ Error.stackTraceLimit = 0;
7294
7313
  try {
7295
7314
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
7296
7315
  }
7297
7316
  catch (e) {
7298
7317
  return undefined;
7299
7318
  }
7319
+ finally {
7320
+ Error.stackTraceLimit = originalStackTraceLimit;
7321
+ }
7300
7322
  }
7301
7323
  function setModifiedTime(path, time) {
7302
7324
  try {
@@ -8908,6 +8930,7 @@ var ts;
8908
8930
  Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
8909
8931
  All_declarations_of_0_must_have_identical_constraints: diag(2838, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
8910
8932
  This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value: diag(2839, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839", "This condition will always return '{0}' since JavaScript compares objects by reference, not value."),
8933
+ An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes: diag(2840, ts.DiagnosticCategory.Error, "An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_clas_2840", "An interface cannot extend a primitive type like '{0}'; an interface can only extend named types and classes"),
8911
8934
  Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
8912
8935
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
8913
8936
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -9318,8 +9341,8 @@ var ts;
9318
9341
  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"),
9319
9342
  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"),
9320
9343
  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."),
9321
- 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}'"),
9322
- 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}'"),
9344
+ 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}'"),
9345
+ 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}'"),
9323
9346
  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"),
9324
9347
  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"),
9325
9348
  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"),
@@ -9350,7 +9373,7 @@ var ts;
9350
9373
  Project_0_can_t_be_built_because_its_dependency_1_was_not_built: diag(6383, ts.DiagnosticCategory.Message, "Project_0_can_t_be_built_because_its_dependency_1_was_not_built_6383", "Project '{0}' can't be built because its dependency '{1}' was not built"),
9351
9374
  Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it: diag(6384, ts.DiagnosticCategory.Message, "Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_di_6384", "Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it."),
9352
9375
  _0_is_deprecated: diag(6385, ts.DiagnosticCategory.Suggestion, "_0_is_deprecated_6385", "'{0}' is deprecated.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ undefined, /*reportsDeprecated*/ true),
9353
- Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found: diag(6386, ts.DiagnosticCategory.Message, "Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_nativ_6386", "Performance timings for '--diagnostics' or '--extendedDiagnostics' are not available in this session. A native implementation of the Web Performance API could not be found."),
9376
+ Performance_timings_for_diagnostics_or_extendedDiagnostics_or_solutionDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found: diag(6386, ts.DiagnosticCategory.Message, "Performance_timings_for_diagnostics_or_extendedDiagnostics_or_solutionDiagnostics_are_not_available__6386", "Performance timings for '--diagnostics' or '--extendedDiagnostics' or '--solutionDiagnostics' are not available in this session. A native implementation of the Web Performance API could not be found."),
9354
9377
  The_signature_0_of_1_is_deprecated: diag(6387, ts.DiagnosticCategory.Suggestion, "The_signature_0_of_1_is_deprecated_6387", "The signature '{0}' of '{1}' is deprecated.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ undefined, /*reportsDeprecated*/ true),
9355
9378
  Project_0_is_being_forcibly_rebuilt: diag(6388, ts.DiagnosticCategory.Message, "Project_0_is_being_forcibly_rebuilt_6388", "Project '{0}' is being forcibly rebuilt"),
9356
9379
  Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved: diag(6389, ts.DiagnosticCategory.Message, "Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved_6389", "Reusing resolution of module '{0}' from '{1}' of old program, it was not resolved."),
@@ -9363,6 +9386,8 @@ var ts;
9363
9386
  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}'."),
9364
9387
  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}'."),
9365
9388
  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."),
9389
+ 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"),
9390
+ 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"),
9366
9391
  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}'"),
9367
9392
  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."),
9368
9393
  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."),
@@ -9484,6 +9509,7 @@ var ts;
9484
9509
  Specify_how_the_TypeScript_watch_mode_works: diag(6715, ts.DiagnosticCategory.Message, "Specify_how_the_TypeScript_watch_mode_works_6715", "Specify how the TypeScript watch mode works."),
9485
9510
  Require_undeclared_properties_from_index_signatures_to_use_element_accesses: diag(6717, ts.DiagnosticCategory.Message, "Require_undeclared_properties_from_index_signatures_to_use_element_accesses_6717", "Require undeclared properties from index signatures to use element accesses."),
9486
9511
  Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, ts.DiagnosticCategory.Message, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
9512
+ Output_more_detailed_solution_performance_information_after_building: diag(6719, ts.DiagnosticCategory.Message, "Output_more_detailed_solution_performance_information_after_building_6719", "Output more detailed solution performance information after building."),
9487
9513
  Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, ts.DiagnosticCategory.Message, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
9488
9514
  one_of_Colon: diag(6900, ts.DiagnosticCategory.Message, "one_of_Colon_6900", "one of:"),
9489
9515
  one_or_more_Colon: diag(6901, ts.DiagnosticCategory.Message, "one_or_more_Colon_6901", "one or more:"),
@@ -20192,6 +20218,10 @@ var ts;
20192
20218
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
20193
20219
  }
20194
20220
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
20221
+ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
20222
+ return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
20223
+ }
20224
+ ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
20195
20225
  function getCompilerOptionValue(options, option) {
20196
20226
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
20197
20227
  }
@@ -39232,6 +39262,7 @@ var ts;
39232
39262
  type: "boolean",
39233
39263
  affectsSemanticDiagnostics: true,
39234
39264
  affectsEmit: true,
39265
+ affectsMultiFileEmitBuildInfo: true,
39235
39266
  category: ts.Diagnostics.Watch_and_Build_Modes,
39236
39267
  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,
39237
39268
  defaultValueDescription: false,
@@ -39266,12 +39297,40 @@ var ts;
39266
39297
  affectsSourceFile: true,
39267
39298
  affectsModuleResolution: true,
39268
39299
  affectsEmit: true,
39300
+ affectsMultiFileEmitBuildInfo: true,
39269
39301
  paramType: ts.Diagnostics.VERSION,
39270
39302
  showInSimplifiedHelpView: true,
39271
39303
  category: ts.Diagnostics.Language_and_Environment,
39272
39304
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
39273
39305
  defaultValueDescription: 0 /* ES3 */,
39274
39306
  };
39307
+ /*@internal*/
39308
+ ts.moduleOptionDeclaration = {
39309
+ name: "module",
39310
+ shortName: "m",
39311
+ type: new ts.Map(ts.getEntries({
39312
+ none: ts.ModuleKind.None,
39313
+ commonjs: ts.ModuleKind.CommonJS,
39314
+ amd: ts.ModuleKind.AMD,
39315
+ system: ts.ModuleKind.System,
39316
+ umd: ts.ModuleKind.UMD,
39317
+ es6: ts.ModuleKind.ES2015,
39318
+ es2015: ts.ModuleKind.ES2015,
39319
+ es2020: ts.ModuleKind.ES2020,
39320
+ es2022: ts.ModuleKind.ES2022,
39321
+ esnext: ts.ModuleKind.ESNext,
39322
+ node16: ts.ModuleKind.Node16,
39323
+ nodenext: ts.ModuleKind.NodeNext,
39324
+ })),
39325
+ affectsModuleResolution: true,
39326
+ affectsEmit: true,
39327
+ affectsMultiFileEmitBuildInfo: true,
39328
+ paramType: ts.Diagnostics.KIND,
39329
+ showInSimplifiedHelpView: true,
39330
+ category: ts.Diagnostics.Modules,
39331
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
39332
+ defaultValueDescription: undefined,
39333
+ };
39275
39334
  var commandOptionsWithoutBuild = [
39276
39335
  // CommandLine only options
39277
39336
  {
@@ -39333,37 +39392,14 @@ var ts;
39333
39392
  category: ts.Diagnostics.Command_line_Options,
39334
39393
  affectsSemanticDiagnostics: true,
39335
39394
  affectsEmit: true,
39395
+ affectsMultiFileEmitBuildInfo: true,
39336
39396
  isCommandLineOnly: true,
39337
39397
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
39338
39398
  defaultValueDescription: false,
39339
39399
  },
39340
39400
  // Basic
39341
39401
  ts.targetOptionDeclaration,
39342
- {
39343
- name: "module",
39344
- shortName: "m",
39345
- type: new ts.Map(ts.getEntries({
39346
- none: ts.ModuleKind.None,
39347
- commonjs: ts.ModuleKind.CommonJS,
39348
- amd: ts.ModuleKind.AMD,
39349
- system: ts.ModuleKind.System,
39350
- umd: ts.ModuleKind.UMD,
39351
- es6: ts.ModuleKind.ES2015,
39352
- es2015: ts.ModuleKind.ES2015,
39353
- es2020: ts.ModuleKind.ES2020,
39354
- es2022: ts.ModuleKind.ES2022,
39355
- esnext: ts.ModuleKind.ESNext,
39356
- node16: ts.ModuleKind.Node16,
39357
- nodenext: ts.ModuleKind.NodeNext,
39358
- })),
39359
- affectsModuleResolution: true,
39360
- affectsEmit: true,
39361
- paramType: ts.Diagnostics.KIND,
39362
- showInSimplifiedHelpView: true,
39363
- category: ts.Diagnostics.Modules,
39364
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
39365
- defaultValueDescription: undefined,
39366
- },
39402
+ ts.moduleOptionDeclaration,
39367
39403
  {
39368
39404
  name: "lib",
39369
39405
  type: "list",
@@ -39400,6 +39436,7 @@ var ts;
39400
39436
  type: jsxOptionMap,
39401
39437
  affectsSourceFile: true,
39402
39438
  affectsEmit: true,
39439
+ affectsMultiFileEmitBuildInfo: true,
39403
39440
  affectsModuleResolution: true,
39404
39441
  paramType: ts.Diagnostics.KIND,
39405
39442
  showInSimplifiedHelpView: true,
@@ -39412,6 +39449,7 @@ var ts;
39412
39449
  shortName: "d",
39413
39450
  type: "boolean",
39414
39451
  affectsEmit: true,
39452
+ affectsMultiFileEmitBuildInfo: true,
39415
39453
  showInSimplifiedHelpView: true,
39416
39454
  category: ts.Diagnostics.Emit,
39417
39455
  transpileOptionValue: undefined,
@@ -39422,6 +39460,7 @@ var ts;
39422
39460
  name: "declarationMap",
39423
39461
  type: "boolean",
39424
39462
  affectsEmit: true,
39463
+ affectsMultiFileEmitBuildInfo: true,
39425
39464
  showInSimplifiedHelpView: true,
39426
39465
  category: ts.Diagnostics.Emit,
39427
39466
  transpileOptionValue: undefined,
@@ -39432,6 +39471,7 @@ var ts;
39432
39471
  name: "emitDeclarationOnly",
39433
39472
  type: "boolean",
39434
39473
  affectsEmit: true,
39474
+ affectsMultiFileEmitBuildInfo: true,
39435
39475
  showInSimplifiedHelpView: true,
39436
39476
  category: ts.Diagnostics.Emit,
39437
39477
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -39442,6 +39482,7 @@ var ts;
39442
39482
  name: "sourceMap",
39443
39483
  type: "boolean",
39444
39484
  affectsEmit: true,
39485
+ affectsMultiFileEmitBuildInfo: true,
39445
39486
  showInSimplifiedHelpView: true,
39446
39487
  category: ts.Diagnostics.Emit,
39447
39488
  defaultValueDescription: false,
@@ -39451,6 +39492,9 @@ var ts;
39451
39492
  name: "outFile",
39452
39493
  type: "string",
39453
39494
  affectsEmit: true,
39495
+ affectsMultiFileEmitBuildInfo: true,
39496
+ affectsDeclarationPath: true,
39497
+ affectsBundleEmitBuildInfo: true,
39454
39498
  isFilePath: true,
39455
39499
  paramType: ts.Diagnostics.FILE,
39456
39500
  showInSimplifiedHelpView: true,
@@ -39462,6 +39506,8 @@ var ts;
39462
39506
  name: "outDir",
39463
39507
  type: "string",
39464
39508
  affectsEmit: true,
39509
+ affectsMultiFileEmitBuildInfo: true,
39510
+ affectsDeclarationPath: true,
39465
39511
  isFilePath: true,
39466
39512
  paramType: ts.Diagnostics.DIRECTORY,
39467
39513
  showInSimplifiedHelpView: true,
@@ -39472,6 +39518,8 @@ var ts;
39472
39518
  name: "rootDir",
39473
39519
  type: "string",
39474
39520
  affectsEmit: true,
39521
+ affectsMultiFileEmitBuildInfo: true,
39522
+ affectsDeclarationPath: true,
39475
39523
  isFilePath: true,
39476
39524
  paramType: ts.Diagnostics.LOCATION,
39477
39525
  category: ts.Diagnostics.Modules,
@@ -39482,6 +39530,8 @@ var ts;
39482
39530
  name: "composite",
39483
39531
  type: "boolean",
39484
39532
  affectsEmit: true,
39533
+ affectsMultiFileEmitBuildInfo: true,
39534
+ affectsBundleEmitBuildInfo: true,
39485
39535
  isTSConfigOnly: true,
39486
39536
  category: ts.Diagnostics.Projects,
39487
39537
  transpileOptionValue: undefined,
@@ -39492,6 +39542,8 @@ var ts;
39492
39542
  name: "tsBuildInfoFile",
39493
39543
  type: "string",
39494
39544
  affectsEmit: true,
39545
+ affectsMultiFileEmitBuildInfo: true,
39546
+ affectsBundleEmitBuildInfo: true,
39495
39547
  isFilePath: true,
39496
39548
  paramType: ts.Diagnostics.FILE,
39497
39549
  category: ts.Diagnostics.Projects,
@@ -39503,6 +39555,7 @@ var ts;
39503
39555
  name: "removeComments",
39504
39556
  type: "boolean",
39505
39557
  affectsEmit: true,
39558
+ affectsMultiFileEmitBuildInfo: true,
39506
39559
  showInSimplifiedHelpView: true,
39507
39560
  category: ts.Diagnostics.Emit,
39508
39561
  defaultValueDescription: false,
@@ -39521,6 +39574,7 @@ var ts;
39521
39574
  name: "importHelpers",
39522
39575
  type: "boolean",
39523
39576
  affectsEmit: true,
39577
+ affectsMultiFileEmitBuildInfo: true,
39524
39578
  category: ts.Diagnostics.Emit,
39525
39579
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
39526
39580
  defaultValueDescription: false,
@@ -39534,6 +39588,7 @@ var ts;
39534
39588
  })),
39535
39589
  affectsEmit: true,
39536
39590
  affectsSemanticDiagnostics: true,
39591
+ affectsMultiFileEmitBuildInfo: true,
39537
39592
  category: ts.Diagnostics.Emit,
39538
39593
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
39539
39594
  defaultValueDescription: 0 /* Remove */,
@@ -39542,6 +39597,7 @@ var ts;
39542
39597
  name: "downlevelIteration",
39543
39598
  type: "boolean",
39544
39599
  affectsEmit: true,
39600
+ affectsMultiFileEmitBuildInfo: true,
39545
39601
  category: ts.Diagnostics.Emit,
39546
39602
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
39547
39603
  defaultValueDescription: false,
@@ -39560,6 +39616,9 @@ var ts;
39560
39616
  type: "boolean",
39561
39617
  // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
39562
39618
  // The value of each strictFlag depends on own strictFlag value or this and never accessed directly.
39619
+ // But we need to store `strict` in builf info, even though it won't be examined directly, so that the
39620
+ // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly
39621
+ affectsMultiFileEmitBuildInfo: true,
39563
39622
  showInSimplifiedHelpView: true,
39564
39623
  category: ts.Diagnostics.Type_Checking,
39565
39624
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -39569,6 +39628,7 @@ var ts;
39569
39628
  name: "noImplicitAny",
39570
39629
  type: "boolean",
39571
39630
  affectsSemanticDiagnostics: true,
39631
+ affectsMultiFileEmitBuildInfo: true,
39572
39632
  strictFlag: true,
39573
39633
  category: ts.Diagnostics.Type_Checking,
39574
39634
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -39578,6 +39638,7 @@ var ts;
39578
39638
  name: "strictNullChecks",
39579
39639
  type: "boolean",
39580
39640
  affectsSemanticDiagnostics: true,
39641
+ affectsMultiFileEmitBuildInfo: true,
39581
39642
  strictFlag: true,
39582
39643
  category: ts.Diagnostics.Type_Checking,
39583
39644
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -39586,6 +39647,8 @@ var ts;
39586
39647
  {
39587
39648
  name: "strictFunctionTypes",
39588
39649
  type: "boolean",
39650
+ affectsSemanticDiagnostics: true,
39651
+ affectsMultiFileEmitBuildInfo: true,
39589
39652
  strictFlag: true,
39590
39653
  category: ts.Diagnostics.Type_Checking,
39591
39654
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -39594,6 +39657,8 @@ var ts;
39594
39657
  {
39595
39658
  name: "strictBindCallApply",
39596
39659
  type: "boolean",
39660
+ affectsSemanticDiagnostics: true,
39661
+ affectsMultiFileEmitBuildInfo: true,
39597
39662
  strictFlag: true,
39598
39663
  category: ts.Diagnostics.Type_Checking,
39599
39664
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -39603,6 +39668,7 @@ var ts;
39603
39668
  name: "strictPropertyInitialization",
39604
39669
  type: "boolean",
39605
39670
  affectsSemanticDiagnostics: true,
39671
+ affectsMultiFileEmitBuildInfo: true,
39606
39672
  strictFlag: true,
39607
39673
  category: ts.Diagnostics.Type_Checking,
39608
39674
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -39612,6 +39678,7 @@ var ts;
39612
39678
  name: "noImplicitThis",
39613
39679
  type: "boolean",
39614
39680
  affectsSemanticDiagnostics: true,
39681
+ affectsMultiFileEmitBuildInfo: true,
39615
39682
  strictFlag: true,
39616
39683
  category: ts.Diagnostics.Type_Checking,
39617
39684
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -39621,6 +39688,7 @@ var ts;
39621
39688
  name: "useUnknownInCatchVariables",
39622
39689
  type: "boolean",
39623
39690
  affectsSemanticDiagnostics: true,
39691
+ affectsMultiFileEmitBuildInfo: true,
39624
39692
  strictFlag: true,
39625
39693
  category: ts.Diagnostics.Type_Checking,
39626
39694
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -39630,6 +39698,8 @@ var ts;
39630
39698
  name: "alwaysStrict",
39631
39699
  type: "boolean",
39632
39700
  affectsSourceFile: true,
39701
+ affectsEmit: true,
39702
+ affectsMultiFileEmitBuildInfo: true,
39633
39703
  strictFlag: true,
39634
39704
  category: ts.Diagnostics.Type_Checking,
39635
39705
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -39640,6 +39710,7 @@ var ts;
39640
39710
  name: "noUnusedLocals",
39641
39711
  type: "boolean",
39642
39712
  affectsSemanticDiagnostics: true,
39713
+ affectsMultiFileEmitBuildInfo: true,
39643
39714
  category: ts.Diagnostics.Type_Checking,
39644
39715
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
39645
39716
  defaultValueDescription: false,
@@ -39648,6 +39719,7 @@ var ts;
39648
39719
  name: "noUnusedParameters",
39649
39720
  type: "boolean",
39650
39721
  affectsSemanticDiagnostics: true,
39722
+ affectsMultiFileEmitBuildInfo: true,
39651
39723
  category: ts.Diagnostics.Type_Checking,
39652
39724
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
39653
39725
  defaultValueDescription: false,
@@ -39656,6 +39728,7 @@ var ts;
39656
39728
  name: "exactOptionalPropertyTypes",
39657
39729
  type: "boolean",
39658
39730
  affectsSemanticDiagnostics: true,
39731
+ affectsMultiFileEmitBuildInfo: true,
39659
39732
  category: ts.Diagnostics.Type_Checking,
39660
39733
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
39661
39734
  defaultValueDescription: false,
@@ -39664,6 +39737,7 @@ var ts;
39664
39737
  name: "noImplicitReturns",
39665
39738
  type: "boolean",
39666
39739
  affectsSemanticDiagnostics: true,
39740
+ affectsMultiFileEmitBuildInfo: true,
39667
39741
  category: ts.Diagnostics.Type_Checking,
39668
39742
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
39669
39743
  defaultValueDescription: false,
@@ -39673,6 +39747,7 @@ var ts;
39673
39747
  type: "boolean",
39674
39748
  affectsBindDiagnostics: true,
39675
39749
  affectsSemanticDiagnostics: true,
39750
+ affectsMultiFileEmitBuildInfo: true,
39676
39751
  category: ts.Diagnostics.Type_Checking,
39677
39752
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
39678
39753
  defaultValueDescription: false,
@@ -39681,6 +39756,7 @@ var ts;
39681
39756
  name: "noUncheckedIndexedAccess",
39682
39757
  type: "boolean",
39683
39758
  affectsSemanticDiagnostics: true,
39759
+ affectsMultiFileEmitBuildInfo: true,
39684
39760
  category: ts.Diagnostics.Type_Checking,
39685
39761
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
39686
39762
  defaultValueDescription: false,
@@ -39689,6 +39765,7 @@ var ts;
39689
39765
  name: "noImplicitOverride",
39690
39766
  type: "boolean",
39691
39767
  affectsSemanticDiagnostics: true,
39768
+ affectsMultiFileEmitBuildInfo: true,
39692
39769
  category: ts.Diagnostics.Type_Checking,
39693
39770
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
39694
39771
  defaultValueDescription: false,
@@ -39696,6 +39773,8 @@ var ts;
39696
39773
  {
39697
39774
  name: "noPropertyAccessFromIndexSignature",
39698
39775
  type: "boolean",
39776
+ affectsSemanticDiagnostics: true,
39777
+ affectsMultiFileEmitBuildInfo: true,
39699
39778
  showInSimplifiedHelpView: false,
39700
39779
  category: ts.Diagnostics.Type_Checking,
39701
39780
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -39781,6 +39860,7 @@ var ts;
39781
39860
  name: "allowSyntheticDefaultImports",
39782
39861
  type: "boolean",
39783
39862
  affectsSemanticDiagnostics: true,
39863
+ affectsMultiFileEmitBuildInfo: true,
39784
39864
  category: ts.Diagnostics.Interop_Constraints,
39785
39865
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
39786
39866
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -39790,6 +39870,7 @@ var ts;
39790
39870
  type: "boolean",
39791
39871
  affectsSemanticDiagnostics: true,
39792
39872
  affectsEmit: true,
39873
+ affectsMultiFileEmitBuildInfo: true,
39793
39874
  showInSimplifiedHelpView: true,
39794
39875
  category: ts.Diagnostics.Interop_Constraints,
39795
39876
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -39806,6 +39887,7 @@ var ts;
39806
39887
  name: "allowUmdGlobalAccess",
39807
39888
  type: "boolean",
39808
39889
  affectsSemanticDiagnostics: true,
39890
+ affectsMultiFileEmitBuildInfo: true,
39809
39891
  category: ts.Diagnostics.Modules,
39810
39892
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
39811
39893
  defaultValueDescription: false,
@@ -39827,6 +39909,7 @@ var ts;
39827
39909
  name: "sourceRoot",
39828
39910
  type: "string",
39829
39911
  affectsEmit: true,
39912
+ affectsMultiFileEmitBuildInfo: true,
39830
39913
  paramType: ts.Diagnostics.LOCATION,
39831
39914
  category: ts.Diagnostics.Emit,
39832
39915
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -39835,6 +39918,7 @@ var ts;
39835
39918
  name: "mapRoot",
39836
39919
  type: "string",
39837
39920
  affectsEmit: true,
39921
+ affectsMultiFileEmitBuildInfo: true,
39838
39922
  paramType: ts.Diagnostics.LOCATION,
39839
39923
  category: ts.Diagnostics.Emit,
39840
39924
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -39843,6 +39927,7 @@ var ts;
39843
39927
  name: "inlineSourceMap",
39844
39928
  type: "boolean",
39845
39929
  affectsEmit: true,
39930
+ affectsMultiFileEmitBuildInfo: true,
39846
39931
  category: ts.Diagnostics.Emit,
39847
39932
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
39848
39933
  defaultValueDescription: false,
@@ -39851,6 +39936,7 @@ var ts;
39851
39936
  name: "inlineSources",
39852
39937
  type: "boolean",
39853
39938
  affectsEmit: true,
39939
+ affectsMultiFileEmitBuildInfo: true,
39854
39940
  category: ts.Diagnostics.Emit,
39855
39941
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
39856
39942
  defaultValueDescription: false,
@@ -39860,6 +39946,7 @@ var ts;
39860
39946
  name: "experimentalDecorators",
39861
39947
  type: "boolean",
39862
39948
  affectsSemanticDiagnostics: true,
39949
+ affectsMultiFileEmitBuildInfo: true,
39863
39950
  category: ts.Diagnostics.Language_and_Environment,
39864
39951
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
39865
39952
  defaultValueDescription: false,
@@ -39869,6 +39956,7 @@ var ts;
39869
39956
  type: "boolean",
39870
39957
  affectsSemanticDiagnostics: true,
39871
39958
  affectsEmit: true,
39959
+ affectsMultiFileEmitBuildInfo: true,
39872
39960
  category: ts.Diagnostics.Language_and_Environment,
39873
39961
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
39874
39962
  defaultValueDescription: false,
@@ -39893,6 +39981,7 @@ var ts;
39893
39981
  type: "string",
39894
39982
  affectsSemanticDiagnostics: true,
39895
39983
  affectsEmit: true,
39984
+ affectsMultiFileEmitBuildInfo: true,
39896
39985
  affectsModuleResolution: true,
39897
39986
  category: ts.Diagnostics.Language_and_Environment,
39898
39987
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -39910,6 +39999,9 @@ var ts;
39910
39999
  name: "out",
39911
40000
  type: "string",
39912
40001
  affectsEmit: true,
40002
+ affectsMultiFileEmitBuildInfo: true,
40003
+ affectsDeclarationPath: true,
40004
+ affectsBundleEmitBuildInfo: true,
39913
40005
  isFilePath: false,
39914
40006
  // for correct behaviour, please use outFile
39915
40007
  category: ts.Diagnostics.Backwards_Compatibility,
@@ -39921,6 +40013,7 @@ var ts;
39921
40013
  name: "reactNamespace",
39922
40014
  type: "string",
39923
40015
  affectsEmit: true,
40016
+ affectsMultiFileEmitBuildInfo: true,
39924
40017
  category: ts.Diagnostics.Language_and_Environment,
39925
40018
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
39926
40019
  defaultValueDescription: "`React`",
@@ -39928,6 +40021,8 @@ var ts;
39928
40021
  {
39929
40022
  name: "skipDefaultLibCheck",
39930
40023
  type: "boolean",
40024
+ // We need to store these to determine whether `lib` files need to be rechecked
40025
+ affectsMultiFileEmitBuildInfo: true,
39931
40026
  category: ts.Diagnostics.Completeness,
39932
40027
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
39933
40028
  defaultValueDescription: false,
@@ -39943,6 +40038,7 @@ var ts;
39943
40038
  name: "emitBOM",
39944
40039
  type: "boolean",
39945
40040
  affectsEmit: true,
40041
+ affectsMultiFileEmitBuildInfo: true,
39946
40042
  category: ts.Diagnostics.Emit,
39947
40043
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
39948
40044
  defaultValueDescription: false,
@@ -39954,6 +40050,7 @@ var ts;
39954
40050
  lf: 1 /* LineFeed */
39955
40051
  })),
39956
40052
  affectsEmit: true,
40053
+ affectsMultiFileEmitBuildInfo: true,
39957
40054
  paramType: ts.Diagnostics.NEWLINE,
39958
40055
  category: ts.Diagnostics.Emit,
39959
40056
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -39963,6 +40060,7 @@ var ts;
39963
40060
  name: "noErrorTruncation",
39964
40061
  type: "boolean",
39965
40062
  affectsSemanticDiagnostics: true,
40063
+ affectsMultiFileEmitBuildInfo: true,
39966
40064
  category: ts.Diagnostics.Output_Formatting,
39967
40065
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
39968
40066
  defaultValueDescription: false,
@@ -39993,6 +40091,7 @@ var ts;
39993
40091
  name: "stripInternal",
39994
40092
  type: "boolean",
39995
40093
  affectsEmit: true,
40094
+ affectsMultiFileEmitBuildInfo: true,
39996
40095
  category: ts.Diagnostics.Emit,
39997
40096
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
39998
40097
  defaultValueDescription: false,
@@ -40033,6 +40132,7 @@ var ts;
40033
40132
  name: "noImplicitUseStrict",
40034
40133
  type: "boolean",
40035
40134
  affectsSemanticDiagnostics: true,
40135
+ affectsMultiFileEmitBuildInfo: true,
40036
40136
  category: ts.Diagnostics.Backwards_Compatibility,
40037
40137
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
40038
40138
  defaultValueDescription: false,
@@ -40041,6 +40141,7 @@ var ts;
40041
40141
  name: "noEmitHelpers",
40042
40142
  type: "boolean",
40043
40143
  affectsEmit: true,
40144
+ affectsMultiFileEmitBuildInfo: true,
40044
40145
  category: ts.Diagnostics.Emit,
40045
40146
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
40046
40147
  defaultValueDescription: false,
@@ -40049,6 +40150,7 @@ var ts;
40049
40150
  name: "noEmitOnError",
40050
40151
  type: "boolean",
40051
40152
  affectsEmit: true,
40153
+ affectsMultiFileEmitBuildInfo: true,
40052
40154
  category: ts.Diagnostics.Emit,
40053
40155
  transpileOptionValue: undefined,
40054
40156
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -40058,6 +40160,7 @@ var ts;
40058
40160
  name: "preserveConstEnums",
40059
40161
  type: "boolean",
40060
40162
  affectsEmit: true,
40163
+ affectsMultiFileEmitBuildInfo: true,
40061
40164
  category: ts.Diagnostics.Emit,
40062
40165
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
40063
40166
  defaultValueDescription: false,
@@ -40066,6 +40169,8 @@ var ts;
40066
40169
  name: "declarationDir",
40067
40170
  type: "string",
40068
40171
  affectsEmit: true,
40172
+ affectsMultiFileEmitBuildInfo: true,
40173
+ affectsDeclarationPath: true,
40069
40174
  isFilePath: true,
40070
40175
  paramType: ts.Diagnostics.DIRECTORY,
40071
40176
  category: ts.Diagnostics.Emit,
@@ -40075,6 +40180,8 @@ var ts;
40075
40180
  {
40076
40181
  name: "skipLibCheck",
40077
40182
  type: "boolean",
40183
+ // We need to store these to determine whether `lib` files need to be rechecked
40184
+ affectsMultiFileEmitBuildInfo: true,
40078
40185
  category: ts.Diagnostics.Completeness,
40079
40186
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
40080
40187
  defaultValueDescription: false,
@@ -40084,6 +40191,7 @@ var ts;
40084
40191
  type: "boolean",
40085
40192
  affectsBindDiagnostics: true,
40086
40193
  affectsSemanticDiagnostics: true,
40194
+ affectsMultiFileEmitBuildInfo: true,
40087
40195
  category: ts.Diagnostics.Type_Checking,
40088
40196
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
40089
40197
  defaultValueDescription: undefined,
@@ -40093,6 +40201,7 @@ var ts;
40093
40201
  type: "boolean",
40094
40202
  affectsBindDiagnostics: true,
40095
40203
  affectsSemanticDiagnostics: true,
40204
+ affectsMultiFileEmitBuildInfo: true,
40096
40205
  category: ts.Diagnostics.Type_Checking,
40097
40206
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
40098
40207
  defaultValueDescription: undefined,
@@ -40101,6 +40210,7 @@ var ts;
40101
40210
  name: "suppressExcessPropertyErrors",
40102
40211
  type: "boolean",
40103
40212
  affectsSemanticDiagnostics: true,
40213
+ affectsMultiFileEmitBuildInfo: true,
40104
40214
  category: ts.Diagnostics.Backwards_Compatibility,
40105
40215
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
40106
40216
  defaultValueDescription: false,
@@ -40109,6 +40219,7 @@ var ts;
40109
40219
  name: "suppressImplicitAnyIndexErrors",
40110
40220
  type: "boolean",
40111
40221
  affectsSemanticDiagnostics: true,
40222
+ affectsMultiFileEmitBuildInfo: true,
40112
40223
  category: ts.Diagnostics.Backwards_Compatibility,
40113
40224
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
40114
40225
  defaultValueDescription: false,
@@ -40133,6 +40244,7 @@ var ts;
40133
40244
  name: "noStrictGenericChecks",
40134
40245
  type: "boolean",
40135
40246
  affectsSemanticDiagnostics: true,
40247
+ affectsMultiFileEmitBuildInfo: true,
40136
40248
  category: ts.Diagnostics.Backwards_Compatibility,
40137
40249
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
40138
40250
  defaultValueDescription: false,
@@ -40142,6 +40254,7 @@ var ts;
40142
40254
  type: "boolean",
40143
40255
  affectsSemanticDiagnostics: true,
40144
40256
  affectsEmit: true,
40257
+ affectsMultiFileEmitBuildInfo: true,
40145
40258
  category: ts.Diagnostics.Language_and_Environment,
40146
40259
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
40147
40260
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -40150,6 +40263,7 @@ var ts;
40150
40263
  name: "preserveValueImports",
40151
40264
  type: "boolean",
40152
40265
  affectsEmit: true,
40266
+ affectsMultiFileEmitBuildInfo: true,
40153
40267
  category: ts.Diagnostics.Emit,
40154
40268
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
40155
40269
  defaultValueDescription: false,
@@ -40193,6 +40307,8 @@ var ts;
40193
40307
  /* @internal */
40194
40308
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
40195
40309
  /* @internal */
40310
+ ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
40311
+ /* @internal */
40196
40312
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
40197
40313
  /* @internal */
40198
40314
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -40237,7 +40353,14 @@ var ts;
40237
40353
  description: ts.Diagnostics.Delete_the_outputs_of_all_projects,
40238
40354
  type: "boolean",
40239
40355
  defaultValueDescription: false,
40240
- }
40356
+ },
40357
+ {
40358
+ name: "solutionDiagnostics",
40359
+ type: "boolean",
40360
+ category: ts.Diagnostics.Compiler_Diagnostics,
40361
+ description: ts.Diagnostics.Output_more_detailed_solution_performance_information_after_building,
40362
+ defaultValueDescription: false,
40363
+ },
40241
40364
  ];
40242
40365
  /* @internal */
40243
40366
  ts.buildOpts = __spreadArray(__spreadArray([], ts.commonOptionsWithBuild, true), ts.optionsForBuild, true);
@@ -41048,6 +41171,7 @@ var ts;
41048
41171
  return optionDefinition.type;
41049
41172
  }
41050
41173
  }
41174
+ /* @internal */
41051
41175
  function getNameOfCompilerOptionValue(value, customTypeMap) {
41052
41176
  // There is a typeMap associated with this command-line option so use it to map value back to its name
41053
41177
  return ts.forEachEntry(customTypeMap, function (mapValue, key) {
@@ -41056,6 +41180,7 @@ var ts;
41056
41180
  }
41057
41181
  });
41058
41182
  }
41183
+ ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
41059
41184
  function serializeCompilerOptions(options, pathOptions) {
41060
41185
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
41061
41186
  }
@@ -44177,8 +44302,8 @@ var ts;
44177
44302
  var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
44178
44303
  loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
44179
44304
  if (!pathAndExtension && packageInfo
44180
- && packageInfo.packageJsonContent.exports === undefined
44181
- && packageInfo.packageJsonContent.main === undefined
44305
+ // eslint-disable-next-line no-null/no-null
44306
+ && (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null)
44182
44307
  && state.features & NodeResolutionFeatures.EsmMode) {
44183
44308
  // EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
44184
44309
  // a default `index.js` entrypoint if no `main` or `exports` are present
@@ -47843,7 +47968,10 @@ var ts;
47843
47968
  TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
47844
47969
  TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
47845
47970
  TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
47846
- TypeFacts[TypeFacts["All"] = 16777215] = "All";
47971
+ TypeFacts[TypeFacts["IsUndefined"] = 16777216] = "IsUndefined";
47972
+ TypeFacts[TypeFacts["IsNull"] = 33554432] = "IsNull";
47973
+ TypeFacts[TypeFacts["IsUndefinedOrNull"] = 50331648] = "IsUndefinedOrNull";
47974
+ TypeFacts[TypeFacts["All"] = 134217727] = "All";
47847
47975
  // The following members encode facts about particular kinds of types for use in the getTypeFacts function.
47848
47976
  // The presence of a particular fact means that the given test is true for some (and possibly all) values
47849
47977
  // of that kind of type.
@@ -47885,14 +48013,16 @@ var ts;
47885
48013
  TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
47886
48014
  TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
47887
48015
  TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
47888
- TypeFacts[TypeFacts["UndefinedFacts"] = 9830144] = "UndefinedFacts";
47889
- TypeFacts[TypeFacts["NullFacts"] = 9363232] = "NullFacts";
47890
- TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
48016
+ TypeFacts[TypeFacts["VoidFacts"] = 9830144] = "VoidFacts";
48017
+ TypeFacts[TypeFacts["UndefinedFacts"] = 26607360] = "UndefinedFacts";
48018
+ TypeFacts[TypeFacts["NullFacts"] = 42917664] = "NullFacts";
48019
+ TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 83427327] = "EmptyObjectStrictFacts";
48020
+ TypeFacts[TypeFacts["EmptyObjectFacts"] = 83886079] = "EmptyObjectFacts";
48021
+ TypeFacts[TypeFacts["UnknownFacts"] = 83886079] = "UnknownFacts";
47891
48022
  TypeFacts[TypeFacts["AllTypeofNE"] = 556800] = "AllTypeofNE";
47892
- TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
47893
48023
  // Masks
47894
48024
  TypeFacts[TypeFacts["OrFactsMask"] = 8256] = "OrFactsMask";
47895
- TypeFacts[TypeFacts["AndFactsMask"] = 16768959] = "AndFactsMask";
48025
+ TypeFacts[TypeFacts["AndFactsMask"] = 134209471] = "AndFactsMask";
47896
48026
  })(TypeFacts || (TypeFacts = {}));
47897
48027
  var typeofEQFacts = new ts.Map(ts.getEntries({
47898
48028
  string: 1 /* TypeofEQString */,
@@ -50056,7 +50186,12 @@ var ts;
50056
50186
  function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
50057
50187
  if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */)) {
50058
50188
  if (isPrimitiveTypeName(name)) {
50059
- error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
50189
+ if (isExtendedByInterface(errorLocation)) {
50190
+ error(errorLocation, ts.Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, ts.unescapeLeadingUnderscores(name));
50191
+ }
50192
+ else {
50193
+ error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
50194
+ }
50060
50195
  return true;
50061
50196
  }
50062
50197
  var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
@@ -50076,6 +50211,16 @@ var ts;
50076
50211
  }
50077
50212
  return false;
50078
50213
  }
50214
+ function isExtendedByInterface(node) {
50215
+ var grandparent = node.parent.parent;
50216
+ var parentOfGrandparent = grandparent.parent;
50217
+ if (grandparent && parentOfGrandparent) {
50218
+ var isExtending = ts.isHeritageClause(grandparent) && grandparent.token === 94 /* ExtendsKeyword */;
50219
+ var isInterface = ts.isInterfaceDeclaration(parentOfGrandparent);
50220
+ return isExtending && isInterface;
50221
+ }
50222
+ return false;
50223
+ }
50079
50224
  function maybeMappedType(node, symbol) {
50080
50225
  var container = ts.findAncestor(node.parent, function (n) {
50081
50226
  return ts.isComputedPropertyName(n) || ts.isPropertySignature(n) ? false : ts.isTypeLiteralNode(n) || "quit";
@@ -52916,7 +53061,7 @@ var ts;
52916
53061
  anyType : getNonMissingTypeOfSymbol(propertySymbol);
52917
53062
  var saveEnclosingDeclaration = context.enclosingDeclaration;
52918
53063
  context.enclosingDeclaration = undefined;
52919
- if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 4096 /* Late */ && isLateBoundName(propertySymbol.escapedName)) {
53064
+ if (context.tracker.trackSymbol && isLateBoundName(propertySymbol.escapedName)) {
52920
53065
  if (propertySymbol.declarations) {
52921
53066
  var decl = ts.first(propertySymbol.declarations);
52922
53067
  if (hasLateBindableName(decl)) {
@@ -54600,7 +54745,7 @@ var ts;
54600
54745
  ? getBaseConstructorTypeOfClass(staticType)
54601
54746
  : anyType;
54602
54747
  var heritageClauses = __spreadArray(__spreadArray([], !ts.length(baseTypes) ? [] : [ts.factory.createHeritageClause(94 /* ExtendsKeyword */, ts.map(baseTypes, function (b) { return serializeBaseType(b, staticBaseType, localName); }))], true), !ts.length(implementsExpressions) ? [] : [ts.factory.createHeritageClause(117 /* ImplementsKeyword */, implementsExpressions)], true);
54603
- var symbolProps = getNonInterhitedProperties(classType, baseTypes, getPropertiesOfType(classType));
54748
+ var symbolProps = getNonInheritedProperties(classType, baseTypes, getPropertiesOfType(classType));
54604
54749
  var publicSymbolProps = ts.filter(symbolProps, function (s) {
54605
54750
  // `valueDeclaration` could be undefined if inherited from
54606
54751
  // a union/intersection base type, but inherited properties
@@ -55738,7 +55883,7 @@ var ts;
55738
55883
  if (ts.getEffectiveTypeAnnotationNode(ts.walkUpBindingElementsAndPatterns(declaration))) {
55739
55884
  // In strict null checking mode, if a default value of a non-undefined type is specified, remove
55740
55885
  // undefined from the final type.
55741
- return strictNullChecks && !(getFalsyFlags(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 32768 /* Undefined */) ? getNonUndefinedType(type) : type;
55886
+ return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
55742
55887
  }
55743
55888
  return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
55744
55889
  }
@@ -58941,7 +59086,7 @@ var ts;
58941
59086
  var objectType;
58942
59087
  return !!(type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ &&
58943
59088
  !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) &&
58944
- !objectType.declaration.questionToken && !objectType.declaration.nameType);
59089
+ !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
58945
59090
  }
58946
59091
  /**
58947
59092
  * For a type parameter, return the base constraint of the type parameter. For the string, number,
@@ -64233,7 +64378,7 @@ var ts;
64233
64378
  var sourceSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(sourceType));
64234
64379
  var targetSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(targetType));
64235
64380
  var callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) &&
64236
- (getFalsyFlags(sourceType) & 98304 /* Nullable */) === (getFalsyFlags(targetType) & 98304 /* Nullable */);
64381
+ (getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
64237
64382
  var related = callbacks ?
64238
64383
  compareSignaturesRelated(targetSig, sourceSig, (checkMode & 8 /* StrictArity */) | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) :
64239
64384
  !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(sourceType, targetType, /*reportErrors*/ false) || compareTypes(targetType, sourceType, reportErrors);
@@ -67451,30 +67596,8 @@ var ts;
67451
67596
  var value = _a.value;
67452
67597
  return value.base10Value === "0";
67453
67598
  }
67454
- function getFalsyFlagsOfTypes(types) {
67455
- var result = 0;
67456
- for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
67457
- var t = types_14[_i];
67458
- result |= getFalsyFlags(t);
67459
- }
67460
- return result;
67461
- }
67462
- // Returns the String, Number, Boolean, StringLiteral, NumberLiteral, BooleanLiteral, Void, Undefined, or Null
67463
- // flags for the string, number, boolean, "", 0, false, void, undefined, or null types respectively. Returns
67464
- // no flags for all other types (including non-falsy literal types).
67465
- function getFalsyFlags(type) {
67466
- var t = type.flags & 2097152 /* Intersection */ ? getBaseConstraintOrType(type) : type;
67467
- return t.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(t.types) :
67468
- t.flags & 128 /* StringLiteral */ ? t.value === "" ? 128 /* StringLiteral */ : 0 :
67469
- t.flags & 256 /* NumberLiteral */ ? t.value === 0 ? 256 /* NumberLiteral */ : 0 :
67470
- t.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(t) ? 2048 /* BigIntLiteral */ : 0 :
67471
- t.flags & 512 /* BooleanLiteral */ ? (t === falseType || t === regularFalseType) ? 512 /* BooleanLiteral */ : 0 :
67472
- t.flags & 117724 /* PossiblyFalsy */;
67473
- }
67474
67599
  function removeDefinitelyFalsyTypes(type) {
67475
- return getFalsyFlags(type) & 117632 /* DefinitelyFalsy */ ?
67476
- filterType(type, function (t) { return !(getFalsyFlags(t) & 117632 /* DefinitelyFalsy */); }) :
67477
- type;
67600
+ return filterType(type, function (t) { return !!(getTypeFacts(t) & 4194304 /* Truthy */); });
67478
67601
  }
67479
67602
  function extractDefinitelyFalsyTypes(type) {
67480
67603
  return mapType(type, getDefinitelyFalsyPartOfType);
@@ -67517,14 +67640,7 @@ var ts;
67517
67640
  getIntersectionType([type, emptyObjectType]);
67518
67641
  }
67519
67642
  function getNonNullableType(type) {
67520
- if (strictNullChecks) {
67521
- // First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
67522
- // 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
67523
- // that isn't eliminated by a NonNullable<T> instantiation.
67524
- var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
67525
- return maybeTypeOfKind(reducedType, 465829888 /* Instantiable */) ? getGlobalNonNullableTypeInstantiation(reducedType) : reducedType;
67526
- }
67527
- return type;
67643
+ return strictNullChecks ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
67528
67644
  }
67529
67645
  function addOptionalTypeMarker(type) {
67530
67646
  return strictNullChecks ? getUnionType([type, optionalType]) : type;
@@ -68668,8 +68784,8 @@ var ts;
68668
68784
  }
68669
68785
  function getSingleTypeVariableFromIntersectionTypes(types) {
68670
68786
  var typeVariable;
68671
- for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
68672
- var type = types_15[_i];
68787
+ for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
68788
+ var type = types_14[_i];
68673
68789
  var t = type.flags & 2097152 /* Intersection */ && ts.find(type.types, function (t) { return !!getInferenceInfoForType(t); });
68674
68790
  if (!t || typeVariable && t !== typeVariable) {
68675
68791
  return undefined;
@@ -69422,8 +69538,8 @@ var ts;
69422
69538
  }
69423
69539
  }
69424
69540
  };
69425
- for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
69426
- var type = types_16[_i];
69541
+ for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
69542
+ var type = types_15[_i];
69427
69543
  var state_9 = _loop_24(type);
69428
69544
  if (typeof state_9 === "object")
69429
69545
  return state_9.value;
@@ -69538,14 +69654,16 @@ var ts;
69538
69654
  return !!(resolved.callSignatures.length || resolved.constructSignatures.length ||
69539
69655
  resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
69540
69656
  }
69541
- function getTypeFacts(type, ignoreObjects) {
69542
- if (ignoreObjects === void 0) { ignoreObjects = false; }
69657
+ function getTypeFacts(type) {
69658
+ if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
69659
+ type = getBaseConstraintOfType(type) || unknownType;
69660
+ }
69543
69661
  var flags = type.flags;
69544
- if (flags & 4 /* String */) {
69662
+ if (flags & (4 /* String */ | 268435456 /* StringMapping */)) {
69545
69663
  return strictNullChecks ? 16317953 /* StringStrictFacts */ : 16776705 /* StringFacts */;
69546
69664
  }
69547
- if (flags & 128 /* StringLiteral */) {
69548
- var isEmpty = type.value === "";
69665
+ if (flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */)) {
69666
+ var isEmpty = flags & 128 /* StringLiteral */ && type.value === "";
69549
69667
  return strictNullChecks ?
69550
69668
  isEmpty ? 12123649 /* EmptyStringStrictFacts */ : 7929345 /* NonEmptyStringStrictFacts */ :
69551
69669
  isEmpty ? 12582401 /* EmptyStringFacts */ : 16776705 /* NonEmptyStringFacts */;
@@ -69577,20 +69695,20 @@ var ts;
69577
69695
  (type === falseType || type === regularFalseType) ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
69578
69696
  }
69579
69697
  if (flags & 524288 /* Object */) {
69580
- if (ignoreObjects) {
69581
- return 16768959 /* AndFactsMask */; // This is the identity element for computing type facts of intersection.
69582
- }
69583
69698
  return ts.getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ?
69584
- strictNullChecks ? 16318463 /* EmptyObjectStrictFacts */ : 16777215 /* EmptyObjectFacts */ :
69699
+ strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ :
69585
69700
  isFunctionObjectType(type) ?
69586
69701
  strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728000 /* FunctionFacts */ :
69587
69702
  strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
69588
69703
  }
69589
- if (flags & (16384 /* Void */ | 32768 /* Undefined */)) {
69590
- return 9830144 /* UndefinedFacts */;
69704
+ if (flags & 16384 /* Void */) {
69705
+ return 9830144 /* VoidFacts */;
69706
+ }
69707
+ if (flags & 32768 /* Undefined */) {
69708
+ return 26607360 /* UndefinedFacts */;
69591
69709
  }
69592
69710
  if (flags & 65536 /* Null */) {
69593
- return 9363232 /* NullFacts */;
69711
+ return 42917664 /* NullFacts */;
69594
69712
  }
69595
69713
  if (flags & 12288 /* ESSymbolLike */) {
69596
69714
  return strictNullChecks ? 7925520 /* SymbolStrictFacts */ : 16772880 /* SymbolFacts */;
@@ -69601,38 +69719,39 @@ var ts;
69601
69719
  if (flags & 131072 /* Never */) {
69602
69720
  return 0 /* None */;
69603
69721
  }
69604
- if (flags & 465829888 /* Instantiable */) {
69605
- return !isPatternLiteralType(type) ? getTypeFacts(getBaseConstraintOfType(type) || unknownType, ignoreObjects) :
69606
- strictNullChecks ? 7929345 /* NonEmptyStringStrictFacts */ : 16776705 /* NonEmptyStringFacts */;
69607
- }
69608
69722
  if (flags & 1048576 /* Union */) {
69609
- return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t, ignoreObjects); }, 0 /* None */);
69723
+ return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t); }, 0 /* None */);
69610
69724
  }
69611
69725
  if (flags & 2097152 /* Intersection */) {
69612
- // When an intersection contains a primitive type we ignore object type constituents as they are
69613
- // presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
69614
- ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */));
69615
- return getIntersectionTypeFacts(type, ignoreObjects);
69726
+ return getIntersectionTypeFacts(type);
69616
69727
  }
69617
- return 16777215 /* All */;
69728
+ return 83886079 /* UnknownFacts */;
69618
69729
  }
69619
- function getIntersectionTypeFacts(type, ignoreObjects) {
69730
+ function getIntersectionTypeFacts(type) {
69731
+ // When an intersection contains a primitive type we ignore object type constituents as they are
69732
+ // presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
69733
+ var ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */);
69620
69734
  // When computing the type facts of an intersection type, certain type facts are computed as `and`
69621
69735
  // and others are computed as `or`.
69622
69736
  var oredFacts = 0 /* None */;
69623
- var andedFacts = 16777215 /* All */;
69737
+ var andedFacts = 134217727 /* All */;
69624
69738
  for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
69625
69739
  var t = _a[_i];
69626
- var f = getTypeFacts(t, ignoreObjects);
69627
- oredFacts |= f;
69628
- andedFacts &= f;
69740
+ if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
69741
+ var f = getTypeFacts(t);
69742
+ oredFacts |= f;
69743
+ andedFacts &= f;
69744
+ }
69629
69745
  }
69630
- return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 16768959 /* AndFactsMask */;
69746
+ return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
69631
69747
  }
69632
69748
  function getTypeWithFacts(type, include) {
69633
69749
  return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
69634
69750
  }
69635
- function getIntersectionWithFacts(type, facts) {
69751
+ // This function is similar to getTypeWithFacts, except that in strictNullChecks mode it replaces type
69752
+ // unknown with the union {} | null | undefined (and reduces that accordingly), and it intersects remaining
69753
+ // instantiable types with {}, {} | null, or {} | undefined in order to remove null and/or undefined.
69754
+ function getAdjustedTypeWithFacts(type, facts) {
69636
69755
  var reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
69637
69756
  if (strictNullChecks) {
69638
69757
  switch (facts) {
@@ -69898,8 +70017,8 @@ var ts;
69898
70017
  var types = origin && origin.flags & 1048576 /* Union */ ? origin.types : type.types;
69899
70018
  var mappedTypes;
69900
70019
  var changed = false;
69901
- for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
69902
- var t = types_17[_i];
70020
+ for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
70021
+ var t = types_16[_i];
69903
70022
  var mapped = t.flags & 1048576 /* Union */ ? mapType(t, mapper, noReductions) : mapper(t);
69904
70023
  changed || (changed = t !== mapped);
69905
70024
  if (mapped) {
@@ -69985,8 +70104,8 @@ var ts;
69985
70104
  }
69986
70105
  function isEvolvingArrayTypeList(types) {
69987
70106
  var hasEvolvingArrayType = false;
69988
- for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
69989
- var t = types_18[_i];
70107
+ for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
70108
+ var t = types_17[_i];
69990
70109
  if (!(t.flags & 131072 /* Never */)) {
69991
70110
  if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
69992
70111
  return false;
@@ -70809,10 +70928,10 @@ var ts;
70809
70928
  }
70810
70929
  function narrowTypeByTruthiness(type, expr, assumeTrue) {
70811
70930
  if (isMatchingReference(reference, expr)) {
70812
- return getIntersectionWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
70931
+ return getAdjustedTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
70813
70932
  }
70814
70933
  if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
70815
- type = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
70934
+ type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
70816
70935
  }
70817
70936
  var access = getDiscriminantPropertyAccess(expr, type);
70818
70937
  if (access) {
@@ -70952,7 +71071,7 @@ var ts;
70952
71071
  // Note that we include any and unknown in the exclusion test because their domain includes null and undefined.
70953
71072
  var removeNullable = equalsOperator !== assumeTrue && everyType(valueType, function (t) { return !!(t.flags & nullableFlags); }) ||
70954
71073
  equalsOperator === assumeTrue && everyType(valueType, function (t) { return !(t.flags & (3 /* AnyOrUnknown */ | nullableFlags)); });
70955
- return removeNullable ? getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
71074
+ return removeNullable ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
70956
71075
  }
70957
71076
  function narrowTypeByEquality(type, operator, value, assumeTrue) {
70958
71077
  if (type.flags & 1 /* Any */) {
@@ -70981,7 +71100,7 @@ var ts;
70981
71100
  valueType.flags & 65536 /* Null */ ?
70982
71101
  assumeTrue ? 131072 /* EQNull */ : 1048576 /* NENull */ :
70983
71102
  assumeTrue ? 65536 /* EQUndefined */ : 524288 /* NEUndefined */;
70984
- return getIntersectionWithFacts(type, facts);
71103
+ return getAdjustedTypeWithFacts(type, facts);
70985
71104
  }
70986
71105
  if (assumeTrue) {
70987
71106
  var filterFn = operator === 34 /* EqualsEqualsToken */ ?
@@ -71002,7 +71121,7 @@ var ts;
71002
71121
  var target = getReferenceCandidate(typeOfExpr.expression);
71003
71122
  if (!isMatchingReference(reference, target)) {
71004
71123
  if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
71005
- return getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71124
+ return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71006
71125
  }
71007
71126
  return type;
71008
71127
  }
@@ -71206,7 +71325,7 @@ var ts;
71206
71325
  var left = getReferenceCandidate(expr.left);
71207
71326
  if (!isMatchingReference(reference, left)) {
71208
71327
  if (assumeTrue && strictNullChecks && optionalChainContainsReference(left, reference)) {
71209
- return getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71328
+ return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71210
71329
  }
71211
71330
  return type;
71212
71331
  }
@@ -71294,7 +71413,7 @@ var ts;
71294
71413
  }
71295
71414
  if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) &&
71296
71415
  !(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
71297
- type = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71416
+ type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71298
71417
  }
71299
71418
  var access = getDiscriminantPropertyAccess(predicateArgument, type);
71300
71419
  if (access) {
@@ -71351,7 +71470,7 @@ var ts;
71351
71470
  }
71352
71471
  function narrowTypeByOptionality(type, expr, assumePresent) {
71353
71472
  if (isMatchingReference(reference, expr)) {
71354
- return getTypeWithFacts(type, assumePresent ? 2097152 /* NEUndefinedOrNull */ : 262144 /* EQUndefinedOrNull */);
71473
+ return getAdjustedTypeWithFacts(type, assumePresent ? 2097152 /* NEUndefinedOrNull */ : 262144 /* EQUndefinedOrNull */);
71355
71474
  }
71356
71475
  var access = getDiscriminantPropertyAccess(expr, type);
71357
71476
  if (access) {
@@ -71437,8 +71556,8 @@ var ts;
71437
71556
  var annotationIncludesUndefined = strictNullChecks &&
71438
71557
  declaration.kind === 164 /* Parameter */ &&
71439
71558
  declaration.initializer &&
71440
- getFalsyFlags(declaredType) & 32768 /* Undefined */ &&
71441
- !(getFalsyFlags(checkExpression(declaration.initializer)) & 32768 /* Undefined */);
71559
+ getTypeFacts(declaredType) & 16777216 /* IsUndefined */ &&
71560
+ !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* IsUndefined */);
71442
71561
  popTypeResolution();
71443
71562
  return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
71444
71563
  }
@@ -71766,7 +71885,7 @@ var ts;
71766
71885
  return convertAutoToAny(flowType);
71767
71886
  }
71768
71887
  }
71769
- else if (!assumeInitialized && !(getFalsyFlags(type) & 32768 /* Undefined */) && getFalsyFlags(flowType) & 32768 /* Undefined */) {
71888
+ else if (!assumeInitialized && !(getTypeFacts(type) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
71770
71889
  error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
71771
71890
  // Return the declared type to reduce follow-on errors
71772
71891
  return type;
@@ -73295,8 +73414,8 @@ var ts;
73295
73414
  }
73296
73415
  var signatureList;
73297
73416
  var types = type.types;
73298
- for (var _i = 0, types_19 = types; _i < types_19.length; _i++) {
73299
- var current = types_19[_i];
73417
+ for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
73418
+ var current = types_18[_i];
73300
73419
  var signature = getContextualCallSignature(current, node);
73301
73420
  if (signature) {
73302
73421
  if (!signatureList) {
@@ -74458,19 +74577,19 @@ var ts;
74458
74577
  return checkNonNullType(checkExpression(node), node);
74459
74578
  }
74460
74579
  function isNullableType(type) {
74461
- return !!((strictNullChecks ? getFalsyFlags(type) : type.flags) & 98304 /* Nullable */);
74580
+ return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
74462
74581
  }
74463
74582
  function getNonNullableTypeIfNeeded(type) {
74464
74583
  return isNullableType(type) ? getNonNullableType(type) : type;
74465
74584
  }
74466
- function reportObjectPossiblyNullOrUndefinedError(node, flags) {
74467
- error(node, flags & 32768 /* Undefined */ ? flags & 65536 /* Null */ ?
74585
+ function reportObjectPossiblyNullOrUndefinedError(node, facts) {
74586
+ error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
74468
74587
  ts.Diagnostics.Object_is_possibly_null_or_undefined :
74469
74588
  ts.Diagnostics.Object_is_possibly_undefined :
74470
74589
  ts.Diagnostics.Object_is_possibly_null);
74471
74590
  }
74472
- function reportCannotInvokePossiblyNullOrUndefinedError(node, flags) {
74473
- error(node, flags & 32768 /* Undefined */ ? flags & 65536 /* Null */ ?
74591
+ function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
74592
+ error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
74474
74593
  ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null_or_undefined :
74475
74594
  ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_undefined :
74476
74595
  ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null);
@@ -74480,9 +74599,9 @@ var ts;
74480
74599
  error(node, ts.Diagnostics.Object_is_of_type_unknown);
74481
74600
  return errorType;
74482
74601
  }
74483
- var kind = (strictNullChecks ? getFalsyFlags(type) : type.flags) & 98304 /* Nullable */;
74484
- if (kind) {
74485
- reportError(node, kind);
74602
+ var facts = getTypeFacts(type);
74603
+ if (facts & 50331648 /* IsUndefinedOrNull */) {
74604
+ reportError(node, facts);
74486
74605
  var t = getNonNullableType(type);
74487
74606
  return t.flags & (98304 /* Nullable */ | 131072 /* Never */) ? errorType : t;
74488
74607
  }
@@ -74777,7 +74896,7 @@ var ts;
74777
74896
  assumeUninitialized = true;
74778
74897
  }
74779
74898
  var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
74780
- if (assumeUninitialized && !(getFalsyFlags(propType) & 32768 /* Undefined */) && getFalsyFlags(flowType) & 32768 /* Undefined */) {
74899
+ if (assumeUninitialized && !(getTypeFacts(propType) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
74781
74900
  error(errorNode, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)); // TODO: GH#18217
74782
74901
  // Return the declared type to reduce follow-on errors
74783
74902
  return propType;
@@ -76693,8 +76812,8 @@ var ts;
76693
76812
  if (apparentType.flags & 1048576 /* Union */) {
76694
76813
  var types = apparentType.types;
76695
76814
  var hasSignatures = false;
76696
- for (var _i = 0, types_20 = types; _i < types_20.length; _i++) {
76697
- var constituent = types_20[_i];
76815
+ for (var _i = 0, types_19 = types; _i < types_19.length; _i++) {
76816
+ var constituent = types_19[_i];
76698
76817
  var signatures = getSignaturesOfType(constituent, kind);
76699
76818
  if (signatures.length !== 0) {
76700
76819
  hasSignatures = true;
@@ -78385,7 +78504,7 @@ var ts;
78385
78504
  var type = getTypeOfSymbol(symbol);
78386
78505
  if (strictNullChecks &&
78387
78506
  !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) &&
78388
- !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getFalsyFlags(type) & 32768 /* Undefined */)) {
78507
+ !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
78389
78508
  error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
78390
78509
  }
78391
78510
  }
@@ -78553,8 +78672,8 @@ var ts;
78553
78672
  }
78554
78673
  if (type.flags & 3145728 /* UnionOrIntersection */) {
78555
78674
  var types = type.types;
78556
- for (var _i = 0, types_21 = types; _i < types_21.length; _i++) {
78557
- var t = types_21[_i];
78675
+ for (var _i = 0, types_20 = types; _i < types_20.length; _i++) {
78676
+ var t = types_20[_i];
78558
78677
  if (maybeTypeOfKind(t, kind)) {
78559
78678
  return true;
78560
78679
  }
@@ -78781,7 +78900,7 @@ var ts;
78781
78900
  // In strict null checking mode, if a default value of a non-undefined type is specified, remove
78782
78901
  // undefined from the final type.
78783
78902
  if (strictNullChecks &&
78784
- !(getFalsyFlags(checkExpression(prop.objectAssignmentInitializer)) & 32768 /* Undefined */)) {
78903
+ !(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
78785
78904
  sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
78786
78905
  }
78787
78906
  checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
@@ -79181,7 +79300,7 @@ var ts;
79181
79300
  case 56 /* BarBarToken */:
79182
79301
  case 75 /* BarBarEqualsToken */: {
79183
79302
  var resultType_3 = getTypeFacts(leftType) & 8388608 /* Falsy */ ?
79184
- getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2 /* Subtype */) :
79303
+ getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) :
79185
79304
  leftType;
79186
79305
  if (operator === 75 /* BarBarEqualsToken */) {
79187
79306
  checkAssignmentOperator(rightType);
@@ -81722,8 +81841,8 @@ var ts;
81722
81841
  }
81723
81842
  function getEntityNameForDecoratorMetadataFromTypeList(types) {
81724
81843
  var commonEntityName;
81725
- for (var _i = 0, types_22 = types; _i < types_22.length; _i++) {
81726
- var typeNode = types_22[_i];
81844
+ for (var _i = 0, types_21 = types; _i < types_21.length; _i++) {
81845
+ var typeNode = types_21[_i];
81727
81846
  while (typeNode.kind === 191 /* ParenthesizedType */ || typeNode.kind === 197 /* NamedTupleMember */) {
81728
81847
  typeNode = typeNode.type; // Skip parens if need be
81729
81848
  }
@@ -82742,7 +82861,7 @@ var ts;
82742
82861
  return;
82743
82862
  var type = checkTruthinessExpression(location);
82744
82863
  var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
82745
- if (getFalsyFlags(type) || isPropertyExpressionCast)
82864
+ if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
82746
82865
  return;
82747
82866
  // While it technically should be invalid for any known-truthy value
82748
82867
  // to be tested, we de-scope to functions and Promises unreferenced in
@@ -84428,18 +84547,17 @@ var ts;
84428
84547
  // but not by other kinds of members.
84429
84548
  // Base class instance member variables and accessors can be overridden by
84430
84549
  // derived class instance member variables and accessors, but not by other kinds of members.
84431
- var _a, _b;
84550
+ var _a, _b, _c, _d;
84432
84551
  // NOTE: assignability is checked in checkClassDeclaration
84433
84552
  var baseProperties = getPropertiesOfType(baseType);
84434
- basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
84435
- var baseProperty = baseProperties_1[_i];
84553
+ var _loop_33 = function (baseProperty) {
84436
84554
  var base = getTargetSymbol(baseProperty);
84437
84555
  if (base.flags & 4194304 /* Prototype */) {
84438
- continue;
84556
+ return "continue";
84439
84557
  }
84440
84558
  var baseSymbol = getPropertyOfObjectType(type, base.escapedName);
84441
84559
  if (!baseSymbol) {
84442
- continue;
84560
+ return "continue";
84443
84561
  }
84444
84562
  var derived = getTargetSymbol(baseSymbol);
84445
84563
  var baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base);
@@ -84457,14 +84575,14 @@ var ts;
84457
84575
  // Searches other base types for a declaration that would satisfy the inherited abstract member.
84458
84576
  // (The class may have more than one base type via declaration merging with an interface with the
84459
84577
  // same name.)
84460
- for (var _c = 0, _d = getBaseTypes(type); _c < _d.length; _c++) {
84461
- var otherBaseType = _d[_c];
84578
+ for (var _e = 0, _f = getBaseTypes(type); _e < _f.length; _e++) {
84579
+ var otherBaseType = _f[_e];
84462
84580
  if (otherBaseType === baseType)
84463
84581
  continue;
84464
84582
  var baseSymbol_1 = getPropertyOfObjectType(otherBaseType, base.escapedName);
84465
84583
  var derivedElsewhere = baseSymbol_1 && getTargetSymbol(baseSymbol_1);
84466
84584
  if (derivedElsewhere && derivedElsewhere !== base) {
84467
- continue basePropertyCheck;
84585
+ return "continue-basePropertyCheck";
84468
84586
  }
84469
84587
  }
84470
84588
  if (derivedClassDecl.kind === 226 /* ClassExpression */) {
@@ -84479,20 +84597,19 @@ var ts;
84479
84597
  // derived overrides base.
84480
84598
  var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
84481
84599
  if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
84482
- // either base or derived property is private - not override, skip it
84483
- continue;
84600
+ return "continue";
84484
84601
  }
84485
84602
  var errorMessage = void 0;
84486
84603
  var basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */;
84487
84604
  var derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */;
84488
84605
  if (basePropertyFlags && derivedPropertyFlags) {
84489
84606
  // property/accessor is overridden with property/accessor
84490
- if (baseDeclarationFlags & 128 /* Abstract */ && !(base.valueDeclaration && ts.isPropertyDeclaration(base.valueDeclaration) && base.valueDeclaration.initializer)
84491
- || base.valueDeclaration && base.valueDeclaration.parent.kind === 258 /* InterfaceDeclaration */
84607
+ if ((ts.getCheckFlags(base) & 6 /* Synthetic */
84608
+ ? (_a = base.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); })
84609
+ : (_b = base.declarations) === null || _b === void 0 ? void 0 : _b.every(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); }))
84610
+ || ts.getCheckFlags(base) & 262144 /* Mapped */
84492
84611
  || derived.valueDeclaration && ts.isBinaryExpression(derived.valueDeclaration)) {
84493
- // when the base property is abstract or from an interface, base/derived flags don't need to match
84494
- // same when the derived property is from an assignment
84495
- continue;
84612
+ return "continue";
84496
84613
  }
84497
84614
  var overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */;
84498
84615
  var overriddenInstanceAccessor = basePropertyFlags === 4 /* Property */ && derivedPropertyFlags !== 4 /* Property */;
@@ -84503,12 +84620,12 @@ var ts;
84503
84620
  error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type));
84504
84621
  }
84505
84622
  else if (useDefineForClassFields) {
84506
- var uninitialized = (_a = derived.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 167 /* PropertyDeclaration */ && !d.initializer; });
84623
+ var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* PropertyDeclaration */ && !d.initializer; });
84507
84624
  if (uninitialized
84508
84625
  && !(derived.flags & 33554432 /* Transient */)
84509
84626
  && !(baseDeclarationFlags & 128 /* Abstract */)
84510
84627
  && !(derivedDeclarationFlags & 128 /* Abstract */)
84511
- && !((_b = derived.declarations) === null || _b === void 0 ? void 0 : _b.some(function (d) { return !!(d.flags & 16777216 /* Ambient */); }))) {
84628
+ && !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* Ambient */); }))) {
84512
84629
  var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol));
84513
84630
  var propName = uninitialized.name;
84514
84631
  if (uninitialized.exclamationToken
@@ -84521,13 +84638,11 @@ var ts;
84521
84638
  }
84522
84639
  }
84523
84640
  }
84524
- // correct case
84525
- continue;
84641
+ return "continue";
84526
84642
  }
84527
84643
  else if (isPrototypeProperty(base)) {
84528
84644
  if (isPrototypeProperty(derived) || derived.flags & 4 /* Property */) {
84529
- // method is overridden with method or property -- correct case
84530
- continue;
84645
+ return "continue";
84531
84646
  }
84532
84647
  else {
84533
84648
  ts.Debug.assert(!!(derived.flags & 98304 /* Accessor */));
@@ -84542,9 +84657,20 @@ var ts;
84542
84657
  }
84543
84658
  error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
84544
84659
  }
84660
+ };
84661
+ basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
84662
+ var baseProperty = baseProperties_1[_i];
84663
+ var state_10 = _loop_33(baseProperty);
84664
+ switch (state_10) {
84665
+ case "continue-basePropertyCheck": continue basePropertyCheck;
84666
+ }
84545
84667
  }
84546
84668
  }
84547
- function getNonInterhitedProperties(type, baseTypes, properties) {
84669
+ function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) {
84670
+ return baseDeclarationFlags & 128 /* Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer)
84671
+ || ts.isInterfaceDeclaration(declaration.parent);
84672
+ }
84673
+ function getNonInheritedProperties(type, baseTypes, properties) {
84548
84674
  if (!ts.length(baseTypes)) {
84549
84675
  return properties;
84550
84676
  }
@@ -84613,7 +84739,7 @@ var ts;
84613
84739
  var propName = member.name;
84614
84740
  if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
84615
84741
  var type = getTypeOfSymbol(getSymbolOfNode(member));
84616
- if (!(type.flags & 3 /* AnyOrUnknown */ || getFalsyFlags(type) & 32768 /* Undefined */)) {
84742
+ if (!(type.flags & 3 /* AnyOrUnknown */ || getTypeFacts(type) & 16777216 /* IsUndefined */)) {
84617
84743
  if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
84618
84744
  error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName));
84619
84745
  }
@@ -84638,7 +84764,7 @@ var ts;
84638
84764
  ts.setParent(reference, staticBlock);
84639
84765
  reference.flowNode = staticBlock.returnFlowNode;
84640
84766
  var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
84641
- if (!(getFalsyFlags(flowType) & 32768 /* Undefined */)) {
84767
+ if (!(getTypeFacts(flowType) & 16777216 /* IsUndefined */)) {
84642
84768
  return true;
84643
84769
  }
84644
84770
  }
@@ -84653,7 +84779,7 @@ var ts;
84653
84779
  ts.setParent(reference, constructor);
84654
84780
  reference.flowNode = constructor.returnFlowNode;
84655
84781
  var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
84656
- return !(getFalsyFlags(flowType) & 32768 /* Undefined */);
84782
+ return !(getTypeFacts(flowType) & 16777216 /* IsUndefined */);
84657
84783
  }
84658
84784
  function checkInterfaceDeclaration(node) {
84659
84785
  // Grammar checking
@@ -92941,8 +93067,8 @@ var ts;
92941
93067
  // Note when updating logic here also update getEntityNameForDecoratorMetadata
92942
93068
  // so that aliases can be marked as referenced
92943
93069
  var serializedUnion;
92944
- for (var _i = 0, types_23 = types; _i < types_23.length; _i++) {
92945
- var typeNode = types_23[_i];
93070
+ for (var _i = 0, types_22 = types; _i < types_22.length; _i++) {
93071
+ var typeNode = types_22[_i];
92946
93072
  while (typeNode.kind === 191 /* ParenthesizedType */) {
92947
93073
  typeNode = typeNode.type; // Skip parens if need be
92948
93074
  }
@@ -110337,7 +110463,8 @@ var ts;
110337
110463
  return;
110338
110464
  }
110339
110465
  var version = ts.version; // Extracted into a const so the form is stable between namespace and module
110340
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), /*writeByteOrderMark*/ false);
110466
+ var buildInfo = { bundle: bundle, program: program, version: version };
110467
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
110341
110468
  }
110342
110469
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
110343
110470
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -110359,7 +110486,7 @@ var ts;
110359
110486
  sourceMap: compilerOptions.sourceMap,
110360
110487
  inlineSourceMap: compilerOptions.inlineSourceMap,
110361
110488
  inlineSources: compilerOptions.inlineSources,
110362
- extendedDiagnostics: compilerOptions.extendedDiagnostics,
110489
+ extendedDiagnostics: compilerOptions.extendedDiagnostics || compilerOptions.solutionDiagnostics,
110363
110490
  writeBundleFileInfo: !!bundleBuildInfo,
110364
110491
  relativeToBuildInfo: relativeToBuildInfo
110365
110492
  };
@@ -110411,7 +110538,7 @@ var ts;
110411
110538
  target: compilerOptions.target,
110412
110539
  sourceMap: compilerOptions.sourceMap,
110413
110540
  inlineSourceMap: compilerOptions.inlineSourceMap,
110414
- extendedDiagnostics: compilerOptions.extendedDiagnostics,
110541
+ extendedDiagnostics: compilerOptions.extendedDiagnostics || compilerOptions.solutionDiagnostics,
110415
110542
  onlyPrintJsDocStyle: true,
110416
110543
  writeBundleFileInfo: !!bundleBuildInfo,
110417
110544
  recordInternalSection: !!bundleBuildInfo,
@@ -110433,7 +110560,7 @@ var ts;
110433
110560
  sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
110434
110561
  sourceRoot: compilerOptions.sourceRoot,
110435
110562
  mapRoot: compilerOptions.mapRoot,
110436
- extendedDiagnostics: compilerOptions.extendedDiagnostics,
110563
+ extendedDiagnostics: compilerOptions.extendedDiagnostics || compilerOptions.solutionDiagnostics,
110437
110564
  // Explicitly do not passthru either `inline` option
110438
110565
  });
110439
110566
  if (forceDtsEmit && declarationTransform.transformed[0].kind === 305 /* SourceFile */) {
@@ -110491,13 +110618,18 @@ var ts;
110491
110618
  if (sourceMapFilePath) {
110492
110619
  var sourceMap = sourceMapGenerator.toString();
110493
110620
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110621
+ if (printer.bundleFileInfo)
110622
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
110494
110623
  }
110495
110624
  }
110496
110625
  else {
110497
110626
  writer.writeLine();
110498
110627
  }
110499
110628
  // Write the output file
110500
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110629
+ var text = writer.getText();
110630
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110631
+ if (printer.bundleFileInfo)
110632
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
110501
110633
  // Reset state
110502
110634
  writer.clear();
110503
110635
  }
@@ -110640,34 +110772,54 @@ var ts;
110640
110772
  }
110641
110773
  /*@internal*/
110642
110774
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
110775
+ var createHash = ts.maybeBind(host, host.createHash);
110643
110776
  var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
110644
- var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
110645
- if (!buildInfoText)
110777
+ var buildInfo;
110778
+ if (host.getBuildInfo) {
110779
+ var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
110780
+ if (!hostBuildInfo)
110781
+ return buildInfoPath;
110782
+ buildInfo = hostBuildInfo;
110783
+ }
110784
+ else {
110785
+ var buildInfoText = host.readFile(buildInfoPath);
110786
+ if (!buildInfoText)
110787
+ return buildInfoPath;
110788
+ buildInfo = getBuildInfo(buildInfoText);
110789
+ }
110790
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
110646
110791
  return buildInfoPath;
110647
110792
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
110648
110793
  if (!jsFileText)
110649
110794
  return jsFilePath;
110795
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
110796
+ return jsFilePath;
110650
110797
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
110651
110798
  // error if no source map or for now if inline sourcemap
110652
110799
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
110653
110800
  return sourceMapFilePath || "inline sourcemap decoding";
110801
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
110802
+ return sourceMapFilePath;
110654
110803
  // read declaration text
110655
110804
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
110656
110805
  if (declarationFilePath && !declarationText)
110657
110806
  return declarationFilePath;
110807
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
110808
+ return declarationFilePath;
110658
110809
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
110659
110810
  // error if no source map or for now if inline sourcemap
110660
110811
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
110661
110812
  return declarationMapPath || "inline sourcemap decoding";
110662
- var buildInfo = getBuildInfo(buildInfoText);
110663
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
110664
- return buildInfoPath;
110813
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
110814
+ return declarationMapPath;
110665
110815
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110666
110816
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
110667
110817
  /*onlyOwnText*/ true);
110668
110818
  var outputFiles = [];
110669
110819
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
110670
110820
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
110821
+ var changedDtsText;
110822
+ var changedDtsData;
110671
110823
  var emitHost = {
110672
110824
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
110673
110825
  getCanonicalFileName: host.getCanonicalFileName,
@@ -110683,7 +110835,7 @@ var ts;
110683
110835
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
110684
110836
  getProjectReferenceRedirect: ts.returnUndefined,
110685
110837
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
110686
- writeFile: function (name, text, writeByteOrderMark) {
110838
+ writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
110687
110839
  switch (name) {
110688
110840
  case jsFilePath:
110689
110841
  if (jsFileText === text)
@@ -110694,8 +110846,13 @@ var ts;
110694
110846
  return;
110695
110847
  break;
110696
110848
  case buildInfoPath:
110697
- var newBuildInfo = getBuildInfo(text);
110849
+ var newBuildInfo = data.buildInfo;
110698
110850
  newBuildInfo.program = buildInfo.program;
110851
+ if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
110852
+ // Update the output signature
110853
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
110854
+ newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
110855
+ }
110699
110856
  // Update sourceFileInfo
110700
110857
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
110701
110858
  newBuildInfo.bundle.js.sources = js.sources;
@@ -110703,11 +110860,13 @@ var ts;
110703
110860
  newBuildInfo.bundle.dts.sources = dts.sources;
110704
110861
  }
110705
110862
  newBuildInfo.bundle.sourceFiles = sourceFiles;
110706
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
110863
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
110707
110864
  return;
110708
110865
  case declarationFilePath:
110709
110866
  if (declarationText === text)
110710
110867
  return;
110868
+ changedDtsText = text;
110869
+ changedDtsData = data;
110711
110870
  break;
110712
110871
  case declarationMapPath:
110713
110872
  if (declarationMapText === text)
@@ -110726,6 +110885,7 @@ var ts;
110726
110885
  getSourceFileFromReference: ts.returnUndefined,
110727
110886
  redirectTargetsMap: ts.createMultiMap(),
110728
110887
  getFileIncludeReasons: ts.notImplemented,
110888
+ createHash: createHash,
110729
110889
  };
110730
110890
  emitFiles(ts.notImplementedResolver, emitHost,
110731
110891
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
@@ -113557,8 +113717,8 @@ var ts;
113557
113717
  bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
113558
113718
  writeLine();
113559
113719
  }
113560
- for (var _d = 0, types_24 = types; _d < types_24.length; _d++) {
113561
- var directive = types_24[_d];
113720
+ for (var _d = 0, types_23 = types; _d < types_23.length; _d++) {
113721
+ var directive = types_23[_d];
113562
113722
  var pos = writer.getTextPos();
113563
113723
  var resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.impliedNodeFormat)
113564
113724
  ? "resolution-mode=\"" + (directive.resolutionMode === ts.ModuleKind.ESNext ? "import" : "require") + "\""
@@ -115810,12 +115970,10 @@ var ts;
115810
115970
  }
115811
115971
  ts.createCompilerHost = createCompilerHost;
115812
115972
  /*@internal*/
115813
- // TODO(shkamat): update this after reworking ts build API
115814
115973
  function createCompilerHostWorker(options, setParentNodes, system) {
115815
115974
  if (system === void 0) { system = ts.sys; }
115816
115975
  var existingDirectories = new ts.Map();
115817
115976
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
115818
- var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
115819
115977
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
115820
115978
  var text;
115821
115979
  try {
@@ -115848,7 +116006,7 @@ var ts;
115848
116006
  // NOTE: If patchWriteFileEnsuringDirectory has been called,
115849
116007
  // the system.writeFile will do its own directory creation and
115850
116008
  // the ensureDirectoriesExist call will always be redundant.
115851
- 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); });
116009
+ 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); });
115852
116010
  ts.performance.mark("afterIOWrite");
115853
116011
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
115854
116012
  }
@@ -115858,35 +116016,6 @@ var ts;
115858
116016
  }
115859
116017
  }
115860
116018
  }
115861
- var outputFingerprints;
115862
- function writeFileWorker(fileName, data, writeByteOrderMark) {
115863
- if (!ts.isWatchSet(options) || !system.getModifiedTime) {
115864
- system.writeFile(fileName, data, writeByteOrderMark);
115865
- return;
115866
- }
115867
- if (!outputFingerprints) {
115868
- outputFingerprints = new ts.Map();
115869
- }
115870
- var hash = computeHash(data);
115871
- var mtimeBefore = system.getModifiedTime(fileName);
115872
- if (mtimeBefore) {
115873
- var fingerprint = outputFingerprints.get(fileName);
115874
- // If output has not been changed, and the file has no external modification
115875
- if (fingerprint &&
115876
- fingerprint.byteOrderMark === writeByteOrderMark &&
115877
- fingerprint.hash === hash &&
115878
- fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
115879
- return;
115880
- }
115881
- }
115882
- system.writeFile(fileName, data, writeByteOrderMark);
115883
- var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
115884
- outputFingerprints.set(fileName, {
115885
- hash: hash,
115886
- byteOrderMark: writeByteOrderMark,
115887
- mtime: mtimeAfter
115888
- });
115889
- }
115890
116019
  function getDefaultLibLocation() {
115891
116020
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
115892
116021
  }
@@ -117476,6 +117605,7 @@ var ts;
117476
117605
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
117477
117606
  redirectTargetsMap: redirectTargetsMap,
117478
117607
  getFileIncludeReasons: program.getFileIncludeReasons,
117608
+ createHash: ts.maybeBind(host, host.createHash),
117479
117609
  };
117480
117610
  }
117481
117611
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -119589,13 +119719,9 @@ var ts;
119589
119719
  function createManyToManyPathMap() {
119590
119720
  function create(forward, reverse, deleted) {
119591
119721
  var map = {
119592
- clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119593
- forEach: function (fn) { return forward.forEach(fn); },
119594
119722
  getKeys: function (v) { return reverse.get(v); },
119595
119723
  getValues: function (k) { return forward.get(k); },
119596
- hasKey: function (k) { return forward.has(k); },
119597
119724
  keys: function () { return forward.keys(); },
119598
- deletedKeys: function () { return deleted; },
119599
119725
  deleteKey: function (k) {
119600
119726
  (deleted || (deleted = new ts.Set())).add(k);
119601
119727
  var set = forward.get(k);
@@ -119622,11 +119748,6 @@ var ts;
119622
119748
  });
119623
119749
  return map;
119624
119750
  },
119625
- clear: function () {
119626
- forward.clear();
119627
- reverse.clear();
119628
- deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119629
- }
119630
119751
  };
119631
119752
  return map;
119632
119753
  }
@@ -119754,18 +119875,21 @@ var ts;
119754
119875
  * Creates the state of file references and signature for the new program from oldState if it is safe
119755
119876
  */
119756
119877
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119878
+ var _a, _b, _c;
119757
119879
  var fileInfos = new ts.Map();
119758
119880
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
119759
119881
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
119760
- var hasCalledUpdateShapeSignature = new ts.Set();
119761
119882
  var useOldState = canReuseOldState(referencedMap, oldState);
119762
119883
  // Ensure source files have parent pointers set
119763
119884
  newProgram.getTypeChecker();
119764
119885
  // Create the reference map, and set the file infos
119765
- for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
119766
- var sourceFile = _a[_i];
119886
+ for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
119887
+ var sourceFile = _d[_i];
119767
119888
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
119768
- var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
119889
+ var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
119890
+ var signature = oldUncommitedSignature === undefined ?
119891
+ useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
119892
+ oldUncommitedSignature || undefined;
119769
119893
  if (referencedMap) {
119770
119894
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
119771
119895
  if (newReferences) {
@@ -119773,19 +119897,26 @@ var ts;
119773
119897
  }
119774
119898
  // Copy old visible to outside files map
119775
119899
  if (useOldState) {
119776
- var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
119900
+ var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
119901
+ var exportedModules = oldUncommitedExportedModules === undefined ?
119902
+ oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
119903
+ oldUncommitedExportedModules || undefined;
119777
119904
  if (exportedModules) {
119778
119905
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119779
119906
  }
119780
119907
  }
119781
119908
  }
119782
- fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
119909
+ fileInfos.set(sourceFile.resolvedPath, {
119910
+ version: version_2,
119911
+ signature: signature,
119912
+ affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
119913
+ impliedFormat: sourceFile.impliedNodeFormat
119914
+ });
119783
119915
  }
119784
119916
  return {
119785
119917
  fileInfos: fileInfos,
119786
119918
  referencedMap: referencedMap,
119787
119919
  exportedModulesMap: exportedModulesMap,
119788
- hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
119789
119920
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
119790
119921
  };
119791
119922
  }
@@ -119799,71 +119930,42 @@ var ts;
119799
119930
  }
119800
119931
  BuilderState.releaseCache = releaseCache;
119801
119932
  /**
119802
- * Creates a clone of the state
119933
+ * Gets the files affected by the path from the program
119803
119934
  */
119804
- function clone(state) {
119935
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
119805
119936
  var _a, _b;
119806
- // Dont need to backup allFiles info since its cache anyway
119807
- return {
119808
- fileInfos: new ts.Map(state.fileInfos),
119809
- referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
119810
- exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
119811
- hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
119812
- useFileVersionAsSignature: state.useFileVersionAsSignature,
119813
- };
119937
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
119938
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119939
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119940
+ return result;
119814
119941
  }
119815
- BuilderState.clone = clone;
119816
- /**
119817
- * Gets the files affected by the path from the program
119818
- */
119819
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
119820
- // Since the operation could be cancelled, the signatures are always stored in the cache
119821
- // They will be committed once it is safe to use them
119822
- // eg when calling this api from tsserver, if there is no cancellation of the operation
119823
- // In the other cases the affected files signatures are committed only after the iteration through the result is complete
119824
- var signatureCache = cacheToUpdateSignature || new ts.Map();
119942
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119943
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
119825
119944
  var sourceFile = programOfThisState.getSourceFileByPath(path);
119826
119945
  if (!sourceFile) {
119827
119946
  return ts.emptyArray;
119828
119947
  }
119829
- if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
119948
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
119830
119949
  return [sourceFile];
119831
119950
  }
119832
- var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
119833
- if (!cacheToUpdateSignature) {
119834
- // Commit all the signatures in the signature cache
119835
- updateSignaturesFromCache(state, signatureCache);
119836
- }
119837
- return result;
119951
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
119838
119952
  }
119839
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119840
- /**
119841
- * Updates the signatures from the cache into state's fileinfo signatures
119842
- * This should be called whenever it is safe to commit the state of the builder
119843
- */
119844
- function updateSignaturesFromCache(state, signatureCache) {
119845
- signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
119846
- }
119847
- BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
119953
+ BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
119848
119954
  function updateSignatureOfFile(state, signature, path) {
119849
119955
  state.fileInfos.get(path).signature = signature;
119850
- state.hasCalledUpdateShapeSignature.add(path);
119956
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
119851
119957
  }
119852
119958
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
119853
119959
  /**
119854
119960
  * Returns if the shape of the signature has changed since last emit
119855
119961
  */
119856
- function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
119962
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
119963
+ var _a;
119857
119964
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
119858
- ts.Debug.assert(!!sourceFile);
119859
- ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
119860
119965
  // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
119861
- if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
119966
+ if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
119862
119967
  return false;
119863
- }
119864
119968
  var info = state.fileInfos.get(sourceFile.resolvedPath);
119865
- if (!info)
119866
- return ts.Debug.fail();
119867
119969
  var prevSignature = info.signature;
119868
119970
  var latestSignature;
119869
119971
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -119874,45 +119976,55 @@ var ts;
119874
119976
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119875
119977
  if (firstDts_1) {
119876
119978
  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; })); });
119877
- latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119878
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119879
- updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
119979
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
119980
+ if (latestSignature !== prevSignature) {
119981
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
119880
119982
  }
119881
119983
  }
119882
119984
  }
119883
119985
  // Default is to use file version as signature
119884
119986
  if (latestSignature === undefined) {
119885
119987
  latestSignature = sourceFile.version;
119886
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119988
+ if (state.exportedModulesMap && latestSignature !== prevSignature) {
119989
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119887
119990
  // All the references in this file are exported
119888
119991
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
119889
119992
  if (references) {
119890
- exportedModulesMapCache.set(sourceFile.resolvedPath, references);
119993
+ state.exportedModulesMap.set(sourceFile.resolvedPath, references);
119891
119994
  }
119892
119995
  else {
119893
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119996
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119894
119997
  }
119895
119998
  }
119896
119999
  }
119897
- cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
120000
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
120001
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
120002
+ info.signature = latestSignature;
119898
120003
  return latestSignature !== prevSignature;
119899
120004
  }
119900
120005
  BuilderState.updateShapeSignature = updateShapeSignature;
120006
+ function computeSignature(text, computeHash) {
120007
+ return (computeHash || ts.generateDjb2Hash)(text);
120008
+ }
120009
+ BuilderState.computeSignature = computeSignature;
119901
120010
  /**
119902
120011
  * Coverts the declaration emit result into exported modules map
119903
120012
  */
119904
- function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
120013
+ function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
120014
+ if (!state.exportedModulesMap)
120015
+ return;
120016
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119905
120017
  if (!exportedModulesFromDeclarationEmit) {
119906
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
120018
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119907
120019
  return;
119908
120020
  }
119909
120021
  var exportedModules;
119910
120022
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
119911
120023
  if (exportedModules) {
119912
- exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
120024
+ state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119913
120025
  }
119914
120026
  else {
119915
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
120027
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119916
120028
  }
119917
120029
  function addExportedModule(exportedModulePaths) {
119918
120030
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -119924,19 +120036,6 @@ var ts;
119924
120036
  }
119925
120037
  }
119926
120038
  BuilderState.updateExportedModules = updateExportedModules;
119927
- /**
119928
- * Updates the exported modules from cache into state's exported modules map
119929
- * This should be called whenever it is safe to commit the state of the builder
119930
- */
119931
- function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
119932
- var _a;
119933
- if (exportedModulesMapCache) {
119934
- ts.Debug.assert(!!state.exportedModulesMap);
119935
- (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
119936
- exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
119937
- }
119938
- }
119939
- BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
119940
120039
  /**
119941
120040
  * Get all the dependencies of the sourceFile
119942
120041
  */
@@ -120057,7 +120156,7 @@ var ts;
120057
120156
  /**
120058
120157
  * When program emits modular code, gets the files affected by the sourceFile whose shape has changed
120059
120158
  */
120060
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
120159
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
120061
120160
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
120062
120161
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
120063
120162
  }
@@ -120077,7 +120176,7 @@ var ts;
120077
120176
  if (!seenFileNamesMap.has(currentPath)) {
120078
120177
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
120079
120178
  seenFileNamesMap.set(currentPath, currentSourceFile);
120080
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
120179
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
120081
120180
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
120082
120181
  }
120083
120182
  }
@@ -120103,32 +120202,33 @@ var ts;
120103
120202
  * Create the state so that we can iterate on changedFiles/affected files
120104
120203
  */
120105
120204
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
120205
+ var _a, _b;
120106
120206
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
120107
120207
  state.program = newProgram;
120108
120208
  var compilerOptions = newProgram.getCompilerOptions();
120109
120209
  state.compilerOptions = compilerOptions;
120210
+ var outFilePath = ts.outFile(compilerOptions);
120110
120211
  // With --out or --outFile, any change affects all semantic diagnostics so no need to cache them
120111
- if (!ts.outFile(compilerOptions)) {
120212
+ if (!outFilePath) {
120112
120213
  state.semanticDiagnosticsPerFile = new ts.Map();
120113
120214
  }
120215
+ 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)) {
120216
+ state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
120217
+ }
120114
120218
  state.changedFilesSet = new ts.Set();
120219
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
120115
120220
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
120116
120221
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
120117
120222
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
120118
120223
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
120224
+ var canCopyEmitSignatures = compilerOptions.composite &&
120225
+ (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
120226
+ !outFilePath &&
120227
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
120119
120228
  if (useOldState) {
120120
- // Verify the sanity of old state
120121
- if (!oldState.currentChangedFilePath) {
120122
- var affectedSignatures = oldState.currentAffectedFilesSignatures;
120123
- ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
120124
- }
120125
- var changedFilesSet = oldState.changedFilesSet;
120126
- if (canCopySemanticDiagnostics) {
120127
- ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
120128
- }
120129
120229
  // Copy old state's changed files set
120130
- changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
120131
- if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
120230
+ (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
120231
+ if (!outFilePath && oldState.affectedFilesPendingEmit) {
120132
120232
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
120133
120233
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
120134
120234
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -120149,6 +120249,8 @@ var ts;
120149
120249
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
120150
120250
  // versions dont match
120151
120251
  oldInfo.version !== info.version ||
120252
+ // Implied formats dont match
120253
+ oldInfo.impliedFormat !== info.impliedFormat ||
120152
120254
  // Referenced files changed
120153
120255
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
120154
120256
  // Referenced file was deleted in the new program
@@ -120172,27 +120274,25 @@ var ts;
120172
120274
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
120173
120275
  }
120174
120276
  }
120277
+ if (canCopyEmitSignatures) {
120278
+ var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
120279
+ if (oldEmitSignature)
120280
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
120281
+ }
120175
120282
  });
120176
120283
  // If the global file is removed, add all files as changed
120177
120284
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
120178
120285
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, /*firstSourceFile*/ undefined)
120179
120286
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
120180
120287
  }
120181
- else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
120288
+ else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
120182
120289
  // Add all files to affectedFilesPendingEmit since emit changed
120183
120290
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1 /* Full */); });
120184
120291
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
120185
120292
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
120186
120293
  }
120187
- if (useOldState) {
120188
- // Any time the interpretation of a source file changes, mark it as changed
120189
- ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
120190
- if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
120191
- state.changedFilesSet.add(sourceFilePath);
120192
- }
120193
- });
120194
- }
120195
- state.buildInfoEmitPending = !!state.changedFilesSet.size;
120294
+ // Since old states change files set is copied, any additional change means we would need to emit build info
120295
+ state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
120196
120296
  return state;
120197
120297
  }
120198
120298
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -120228,30 +120328,35 @@ var ts;
120228
120328
  ts.BuilderState.releaseCache(state);
120229
120329
  state.program = undefined;
120230
120330
  }
120231
- /**
120232
- * Creates a clone of the state
120233
- */
120234
- function cloneBuilderProgramState(state) {
120235
- var _a;
120236
- var newState = ts.BuilderState.clone(state);
120237
- newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
120238
- newState.changedFilesSet = new ts.Set(state.changedFilesSet);
120239
- newState.affectedFiles = state.affectedFiles;
120240
- newState.affectedFilesIndex = state.affectedFilesIndex;
120241
- newState.currentChangedFilePath = state.currentChangedFilePath;
120242
- newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
120243
- newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
120244
- newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
120245
- newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
120246
- newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
120247
- newState.program = state.program;
120248
- newState.compilerOptions = state.compilerOptions;
120249
- newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
120250
- newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
120251
- newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
120252
- newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
120253
- newState.programEmitComplete = state.programEmitComplete;
120254
- return newState;
120331
+ function backupEmitBuilderProgramState(state) {
120332
+ var outFilePath = ts.outFile(state.compilerOptions);
120333
+ // Only in --out changeFileSet is kept around till emit
120334
+ ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
120335
+ return {
120336
+ affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
120337
+ affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
120338
+ affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
120339
+ seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
120340
+ programEmitComplete: state.programEmitComplete,
120341
+ emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
120342
+ outSignature: state.outSignature,
120343
+ dtsChangeTime: state.dtsChangeTime,
120344
+ hasChangedEmitSignature: state.hasChangedEmitSignature,
120345
+ changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
120346
+ };
120347
+ }
120348
+ function restoreEmitBuilderProgramState(state, backupEmitState) {
120349
+ state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
120350
+ state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
120351
+ state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
120352
+ state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
120353
+ state.programEmitComplete = backupEmitState.programEmitComplete;
120354
+ state.emitSignatures = backupEmitState.emitSignatures;
120355
+ state.outSignature = backupEmitState.outSignature;
120356
+ state.dtsChangeTime = backupEmitState.dtsChangeTime;
120357
+ state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
120358
+ if (backupEmitState.changedFilesSet)
120359
+ state.changedFilesSet = backupEmitState.changedFilesSet;
120255
120360
  }
120256
120361
  /**
120257
120362
  * Verifies that source file is ok to be used in calls that arent handled by next
@@ -120266,7 +120371,7 @@ var ts;
120266
120371
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
120267
120372
  */
120268
120373
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
120269
- var _a;
120374
+ var _a, _b;
120270
120375
  while (true) {
120271
120376
  var affectedFiles = state.affectedFiles;
120272
120377
  if (affectedFiles) {
@@ -120286,10 +120391,8 @@ var ts;
120286
120391
  state.changedFilesSet.delete(state.currentChangedFilePath);
120287
120392
  state.currentChangedFilePath = undefined;
120288
120393
  // Commit the changes in file signature
120289
- ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
120290
- state.currentAffectedFilesSignatures.clear();
120291
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120292
- (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
120394
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
120395
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120293
120396
  state.affectedFiles = undefined;
120294
120397
  }
120295
120398
  // Get next changed file
@@ -120307,12 +120410,7 @@ var ts;
120307
120410
  return program;
120308
120411
  }
120309
120412
  // Get next batch of affected files
120310
- if (!state.currentAffectedFilesSignatures)
120311
- state.currentAffectedFilesSignatures = new ts.Map();
120312
- if (state.exportedModulesMap) {
120313
- state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
120314
- }
120315
- state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
120413
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
120316
120414
  state.currentChangedFilePath = nextKey.value;
120317
120415
  state.affectedFilesIndex = 0;
120318
120416
  if (!state.seenAffectedFiles)
@@ -120364,7 +120462,6 @@ var ts;
120364
120462
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
120365
120463
  */
120366
120464
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120367
- var _a;
120368
120465
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
120369
120466
  // If affected files is everything except default library, then nothing more to do
120370
120467
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -120372,10 +120469,9 @@ var ts;
120372
120469
  // When a change affects the global scope, all files are considered to be affected without updating their signature
120373
120470
  // That means when affected file is handled, its signature can be out of date
120374
120471
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
120375
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
120472
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
120376
120473
  return;
120377
120474
  }
120378
- 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);
120379
120475
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
120380
120476
  return;
120381
120477
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -120395,7 +120491,7 @@ var ts;
120395
120491
  // This ensures that we dont later during incremental builds considering wrong signature.
120396
120492
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
120397
120493
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
120398
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
120494
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
120399
120495
  // If not dts emit, nothing more to do
120400
120496
  if (ts.getEmitDeclarations(state.compilerOptions)) {
120401
120497
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -120416,27 +120512,10 @@ var ts;
120416
120512
  return !state.semanticDiagnosticsFromOldState.size;
120417
120513
  }
120418
120514
  function isChangedSignature(state, path) {
120419
- var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
120420
- var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120515
+ var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
120516
+ var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120421
120517
  return newSignature !== oldSignature;
120422
120518
  }
120423
- function forEachKeyOfExportedModulesMap(state, filePath, fn) {
120424
- // Go through exported modules from cache first
120425
- var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
120426
- var result = keys && ts.forEachKey(keys, fn);
120427
- if (result)
120428
- return result;
120429
- // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
120430
- keys = state.exportedModulesMap.getKeys(filePath);
120431
- return keys && ts.forEachKey(keys, function (exportedFromPath) {
120432
- var _a;
120433
- // If the cache had an updated value, skip
120434
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
120435
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
120436
- fn(exportedFromPath) :
120437
- undefined;
120438
- });
120439
- }
120440
120519
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
120441
120520
  var _a;
120442
120521
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -120451,6 +120530,7 @@ var ts;
120451
120530
  * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
120452
120531
  */
120453
120532
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120533
+ var _a;
120454
120534
  // If there was change in signature (dts output) for the changed file,
120455
120535
  // then only we need to handle pending file emit
120456
120536
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
@@ -120477,11 +120557,10 @@ var ts;
120477
120557
  }
120478
120558
  }
120479
120559
  }
120480
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120481
120560
  var seenFileAndExportsOfFile = new ts.Set();
120482
120561
  // Go through exported modules from cache first
120483
120562
  // If exported modules has path, all files referencing file exported from are affected
120484
- forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
120563
+ (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120485
120564
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
120486
120565
  return true;
120487
120566
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -120495,19 +120574,18 @@ var ts;
120495
120574
  * return true when all work is done and we can exit handling dts emit and semantic diagnostics
120496
120575
  */
120497
120576
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
120498
- var _a;
120577
+ var _a, _b;
120499
120578
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
120500
120579
  return undefined;
120501
120580
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
120502
120581
  return true;
120503
120582
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
120504
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120505
120583
  // If exported modules has path, all files referencing file exported from are affected
120506
- forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
120584
+ (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120507
120585
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
120508
120586
  });
120509
120587
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
120510
- (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
120588
+ (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
120511
120589
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
120512
120590
  handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
120513
120591
  state, referencingFilePath, cancellationToken, computeHash, host);
@@ -120528,12 +120606,13 @@ var ts;
120528
120606
  }
120529
120607
  else {
120530
120608
  state.seenAffectedFiles.add(affected.resolvedPath);
120609
+ // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted
120610
+ state.buildInfoEmitPending = true;
120531
120611
  if (emitKind !== undefined) {
120532
120612
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
120533
120613
  }
120534
120614
  if (isPendingEmit) {
120535
120615
  state.affectedFilesPendingEmitIndex++;
120536
- state.buildInfoEmitPending = true;
120537
120616
  }
120538
120617
  else {
120539
120618
  state.affectedFilesIndex++;
@@ -120581,25 +120660,61 @@ var ts;
120581
120660
  }
120582
120661
  return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
120583
120662
  }
120663
+ function isProgramBundleEmitBuildInfo(info) {
120664
+ return !!ts.outFile(info.options || {});
120665
+ }
120666
+ ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
120584
120667
  /**
120585
120668
  * Gets the program information to be emitted in buildInfo so that we can use it to create new program
120586
120669
  */
120587
- function getProgramBuildInfo(state, getCanonicalFileName) {
120588
- if (ts.outFile(state.compilerOptions))
120589
- return undefined;
120670
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
120671
+ var outFilePath = ts.outFile(state.compilerOptions);
120672
+ if (outFilePath && !state.compilerOptions.composite)
120673
+ return;
120590
120674
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
120591
120675
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
120676
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
120677
+ if (outFilePath) {
120678
+ var fileNames_1 = [];
120679
+ var fileInfos_1 = [];
120680
+ state.program.getRootFileNames().forEach(function (f) {
120681
+ var sourceFile = state.program.getSourceFile(f);
120682
+ if (!sourceFile)
120683
+ return;
120684
+ fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
120685
+ fileInfos_1.push(sourceFile.version);
120686
+ });
120687
+ var result_15 = {
120688
+ fileNames: fileNames_1,
120689
+ fileInfos: fileInfos_1,
120690
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
120691
+ outSignature: state.outSignature,
120692
+ dtsChangeTime: state.dtsChangeTime,
120693
+ };
120694
+ return result_15;
120695
+ }
120592
120696
  var fileNames = [];
120593
120697
  var fileNameToFileId = new ts.Map();
120594
120698
  var fileIdsList;
120595
120699
  var fileNamesToFileIdListId;
120700
+ var emitSignatures;
120596
120701
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
120702
+ var _b, _c;
120597
120703
  var key = _a[0], value = _a[1];
120598
120704
  // Ensure fileId
120599
120705
  var fileId = toFileId(key);
120600
120706
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
120601
- var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120602
- var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120707
+ var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
120708
+ var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
120709
+ if (state.compilerOptions.composite) {
120710
+ var file = state.program.getSourceFileByPath(key);
120711
+ if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
120712
+ var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
120713
+ if (emitSignature !== actualSignature) {
120714
+ (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
120715
+ }
120716
+ }
120717
+ }
120603
120718
  return value.version === actualSignature ?
120604
120719
  value.affectsGlobalScope || value.impliedFormat ?
120605
120720
  // If file version is same as signature, dont serialize signature
@@ -120607,11 +120722,11 @@ var ts;
120607
120722
  // If file info only contains version and signature and both are same we can just write string
120608
120723
  value.version :
120609
120724
  actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120610
- signature === undefined ?
120725
+ oldSignature === undefined ?
120611
120726
  // If we havent computed signature, use fileInfo as is
120612
120727
  value :
120613
120728
  // Serialize fileInfo with new updated signature
120614
- { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120729
+ { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120615
120730
  // Signature of the FileInfo is undefined, serialize it as false
120616
120731
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120617
120732
  });
@@ -120626,17 +120741,13 @@ var ts;
120626
120741
  if (state.exportedModulesMap) {
120627
120742
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
120628
120743
  var _a;
120629
- if (state.currentAffectedFilesExportedModulesMap) {
120630
- if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
120631
- return undefined;
120632
- }
120633
- var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
120634
- if (newValue) {
120635
- return [toFileId(key), toFileIdListId(newValue)];
120636
- }
120637
- }
120744
+ var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
120638
120745
  // Not in temporary cache, use existing value
120639
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120746
+ if (oldValue === undefined)
120747
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120748
+ if (oldValue)
120749
+ return [toFileId(key), toFileIdListId(oldValue)];
120750
+ return undefined;
120640
120751
  });
120641
120752
  }
120642
120753
  var semanticDiagnosticsPerFile;
@@ -120647,9 +120758,7 @@ var ts;
120647
120758
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
120648
120759
  [
120649
120760
  toFileId(key),
120650
- state.hasReusableDiagnostic ?
120651
- value :
120652
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120761
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
120653
120762
  ] :
120654
120763
  toFileId(key));
120655
120764
  }
@@ -120664,16 +120773,27 @@ var ts;
120664
120773
  }
120665
120774
  }
120666
120775
  }
120667
- return {
120776
+ var changeFileSet;
120777
+ if (state.changedFilesSet.size) {
120778
+ for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
120779
+ var path = _e[_d];
120780
+ (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120781
+ }
120782
+ }
120783
+ var result = {
120668
120784
  fileNames: fileNames,
120669
120785
  fileInfos: fileInfos,
120670
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
120786
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
120671
120787
  fileIdsList: fileIdsList,
120672
120788
  referencedMap: referencedMap,
120673
120789
  exportedModulesMap: exportedModulesMap,
120674
120790
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
120675
120791
  affectedFilesPendingEmit: affectedFilesPendingEmit,
120792
+ changeFileSet: changeFileSet,
120793
+ emitSignatures: emitSignatures,
120794
+ dtsChangeTime: state.dtsChangeTime,
120676
120795
  };
120796
+ return result;
120677
120797
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
120678
120798
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
120679
120799
  }
@@ -120698,24 +120818,18 @@ var ts;
120698
120818
  }
120699
120819
  return fileIdListId;
120700
120820
  }
120701
- }
120702
- function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
120703
- var result;
120704
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120705
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120706
- var name = _a[_i];
120707
- var optionKey = name.toLowerCase();
120708
- var optionInfo = optionsNameMap.get(optionKey);
120709
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
120710
- // We need to store `strict`, even though it won't be examined directly, so that the
120711
- // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
120712
- optionKey === "strict" ||
120713
- // We need to store these to determine whether `lib` files need to be rechecked.
120714
- optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
120715
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
120821
+ function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
120822
+ var result;
120823
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120824
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120825
+ var name = _a[_i];
120826
+ var optionInfo = optionsNameMap.get(name.toLowerCase());
120827
+ if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
120828
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
120829
+ }
120716
120830
  }
120831
+ return result;
120717
120832
  }
120718
- return result;
120719
120833
  }
120720
120834
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120721
120835
  if (option) {
@@ -120789,6 +120903,10 @@ var ts;
120789
120903
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
120790
120904
  }
120791
120905
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
120906
+ function computeSignature(text, data, computeHash) {
120907
+ return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
120908
+ }
120909
+ ts.computeSignature = computeSignature;
120792
120910
  function createBuilderProgram(kind, _a) {
120793
120911
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
120794
120912
  // Return same program if underlying program doesnt change
@@ -120807,8 +120925,8 @@ var ts;
120807
120925
  */
120808
120926
  var computeHash = ts.maybeBind(host, host.createHash);
120809
120927
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
120810
- var backupState;
120811
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
120928
+ var backupEmitState;
120929
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
120812
120930
  // To ensure that we arent storing any references to old program or new program without state
120813
120931
  newProgram = undefined; // TODO: GH#18217
120814
120932
  oldProgram = undefined;
@@ -120816,20 +120934,20 @@ var ts;
120816
120934
  var getState = function () { return state; };
120817
120935
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
120818
120936
  builderProgram.getState = getState;
120819
- builderProgram.backupState = function () {
120820
- ts.Debug.assert(backupState === undefined);
120821
- backupState = cloneBuilderProgramState(state);
120937
+ builderProgram.backupEmitState = function () {
120938
+ ts.Debug.assert(backupEmitState === undefined);
120939
+ backupEmitState = backupEmitBuilderProgramState(state);
120822
120940
  };
120823
- builderProgram.restoreState = function () {
120824
- state = ts.Debug.checkDefined(backupState);
120825
- backupState = undefined;
120941
+ builderProgram.restoreEmitState = function () {
120942
+ restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
120943
+ backupEmitState = undefined;
120826
120944
  };
120827
120945
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
120828
120946
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
120829
120947
  builderProgram.emit = emit;
120830
120948
  builderProgram.releaseProgram = function () {
120831
120949
  releaseCache(state);
120832
- backupState = undefined;
120950
+ backupEmitState = undefined;
120833
120951
  };
120834
120952
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
120835
120953
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -120888,35 +121006,59 @@ var ts;
120888
121006
  return toAffectedFileEmitResult(state,
120889
121007
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
120890
121008
  // Otherwise just affected file
120891
- ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120892
- getWriteFileUpdatingSignatureCallback(writeFile) :
121009
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
121010
+ getWriteFileCallback(writeFile, customTransformers) :
120893
121011
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
120894
121012
  }
120895
- function getWriteFileUpdatingSignatureCallback(writeFile) {
121013
+ function getWriteFileCallback(writeFile, customTransformers) {
120896
121014
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
120897
- var _a;
121015
+ var _a, _b, _c;
120898
121016
  if (ts.isDeclarationFileName(fileName)) {
120899
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120900
- var file = sourceFiles[0];
120901
- var info = state.fileInfos.get(file.resolvedPath);
120902
- var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120903
- if (signature === file.version) {
120904
- var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120905
- if (newSignature !== file.version) { // Update it
120906
- if (host.storeFilesChangingSignatureDuringEmit)
120907
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120908
- if (state.exportedModulesMap)
120909
- ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
120910
- if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
120911
- state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
121017
+ if (!ts.outFile(state.compilerOptions)) {
121018
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
121019
+ var newSignature = void 0;
121020
+ if (!customTransformers) {
121021
+ var file = sourceFiles[0];
121022
+ var info = state.fileInfos.get(file.resolvedPath);
121023
+ if (info.signature === file.version) {
121024
+ newSignature = computeSignature(text, data, computeHash);
121025
+ if (newSignature !== file.version) { // Update it
121026
+ if (host.storeFilesChangingSignatureDuringEmit)
121027
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
121028
+ if (state.exportedModulesMap)
121029
+ ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
121030
+ if (state.affectedFiles) {
121031
+ // Keep old signature so we know what to undo if cancellation happens
121032
+ var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
121033
+ if (existing === undefined)
121034
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
121035
+ info.signature = newSignature;
121036
+ }
121037
+ else {
121038
+ // These are directly commited
121039
+ info.signature = newSignature;
121040
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
121041
+ }
121042
+ }
120912
121043
  }
120913
- else {
120914
- info.signature = newSignature;
120915
- if (state.exportedModulesMap)
120916
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
121044
+ }
121045
+ if (state.compilerOptions.composite) {
121046
+ var filePath = sourceFiles[0].resolvedPath;
121047
+ var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
121048
+ newSignature || (newSignature = computeSignature(text, data, computeHash));
121049
+ if (newSignature !== oldSignature) {
121050
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
121051
+ state.hasChangedEmitSignature = true;
120917
121052
  }
120918
121053
  }
120919
121054
  }
121055
+ else if (state.compilerOptions.composite) {
121056
+ var newSignature = computeSignature(text, data, computeHash);
121057
+ if (newSignature !== state.outSignature) {
121058
+ state.outSignature = newSignature;
121059
+ state.hasChangedEmitSignature = true;
121060
+ }
121061
+ }
120920
121062
  }
120921
121063
  if (writeFile)
120922
121064
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -120981,8 +121123,8 @@ var ts;
120981
121123
  }
120982
121124
  }
120983
121125
  }
120984
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120985
- getWriteFileUpdatingSignatureCallback(writeFile) :
121126
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
121127
+ getWriteFileCallback(writeFile, customTransformers) :
120986
121128
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120987
121129
  }
120988
121130
  /**
@@ -121071,29 +121213,58 @@ var ts;
121071
121213
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
121072
121214
  }
121073
121215
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
121074
- function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
121075
- var _a;
121216
+ function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
121217
+ var _a, _b, _c, _d;
121076
121218
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
121077
121219
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
121078
- var filePaths = program.fileNames.map(toPath);
121079
- var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
121080
- var fileInfos = new ts.Map();
121081
- program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
121082
- var state = {
121083
- fileInfos: fileInfos,
121084
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121085
- referencedMap: toManyToManyPathMap(program.referencedMap),
121086
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121087
- 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]; }),
121088
- hasReusableDiagnostic: true,
121089
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
121090
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
121091
- affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
121092
- };
121220
+ var state;
121221
+ var filePaths;
121222
+ var filePathsSetList;
121223
+ if (isProgramBundleEmitBuildInfo(program)) {
121224
+ state = {
121225
+ fileInfos: new ts.Map(),
121226
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121227
+ dtsChangeTime: program.dtsChangeTime,
121228
+ outSignature: program.outSignature,
121229
+ };
121230
+ }
121231
+ else {
121232
+ filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
121233
+ filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
121234
+ var fileInfos_2 = new ts.Map();
121235
+ var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
121236
+ program.fileInfos.forEach(function (fileInfo, index) {
121237
+ var path = toFilePath(index + 1);
121238
+ var stateFileInfo = toBuilderStateFileInfo(fileInfo);
121239
+ fileInfos_2.set(path, stateFileInfo);
121240
+ if (emitSignatures_1 && stateFileInfo.signature)
121241
+ emitSignatures_1.set(path, stateFileInfo.signature);
121242
+ });
121243
+ (_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
121244
+ if (ts.isNumber(value))
121245
+ emitSignatures_1.delete(toFilePath(value));
121246
+ else
121247
+ emitSignatures_1.set(toFilePath(value[0]), value[1]);
121248
+ });
121249
+ state = {
121250
+ fileInfos: fileInfos_2,
121251
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121252
+ referencedMap: toManyToManyPathMap(program.referencedMap),
121253
+ exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121254
+ 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]; }),
121255
+ hasReusableDiagnostic: true,
121256
+ affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
121257
+ affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
121258
+ affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
121259
+ changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
121260
+ dtsChangeTime: program.dtsChangeTime,
121261
+ emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
121262
+ };
121263
+ }
121093
121264
  return {
121094
121265
  getState: function () { return state; },
121095
- backupState: ts.noop,
121096
- restoreState: ts.noop,
121266
+ backupEmitState: ts.noop,
121267
+ restoreEmitState: ts.noop,
121097
121268
  getProgram: ts.notImplemented,
121098
121269
  getProgramOrUndefined: ts.returnUndefined,
121099
121270
  releaseProgram: ts.noop,
@@ -121138,12 +121309,24 @@ var ts;
121138
121309
  return map;
121139
121310
  }
121140
121311
  }
121141
- ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
121312
+ ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
121313
+ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
121314
+ var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
121315
+ var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
121316
+ var fileInfos = new ts.Map();
121317
+ program.fileInfos.forEach(function (fileInfo, index) {
121318
+ var path = ts.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
121319
+ var version = ts.isString(fileInfo) ? fileInfo : fileInfo.version; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
121320
+ fileInfos.set(path, version);
121321
+ });
121322
+ return fileInfos;
121323
+ }
121324
+ ts.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap;
121142
121325
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
121143
121326
  return {
121144
121327
  getState: ts.notImplemented,
121145
- backupState: ts.noop,
121146
- restoreState: ts.noop,
121328
+ backupEmitState: ts.noop,
121329
+ restoreEmitState: ts.noop,
121147
121330
  getProgram: getProgram,
121148
121331
  getProgramOrUndefined: function () { return getState().program; },
121149
121332
  releaseProgram: function () { return getState().program = undefined; },
@@ -122259,9 +122442,9 @@ var ts;
122259
122442
  if (!preferSymlinks) {
122260
122443
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
122261
122444
  // so we only need to remove them from the realpath filenames.
122262
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122263
- if (result_15)
122264
- return result_15;
122445
+ var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122446
+ if (result_16)
122447
+ return result_16;
122265
122448
  }
122266
122449
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
122267
122450
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -122281,10 +122464,10 @@ var ts;
122281
122464
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
122282
122465
  var symlinkDirectory = symlinkDirectories_1[_i];
122283
122466
  var option = ts.resolvePath(symlinkDirectory, relative);
122284
- var result_16 = cb(option, target === referenceRedirect);
122467
+ var result_17 = cb(option, target === referenceRedirect);
122285
122468
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
122286
- if (result_16)
122287
- return result_16;
122469
+ if (result_17)
122470
+ return result_17;
122288
122471
  }
122289
122472
  });
122290
122473
  });
@@ -122326,7 +122509,7 @@ var ts;
122326
122509
  });
122327
122510
  // Sort by paths closest to importing file Name directory
122328
122511
  var sortedPaths = [];
122329
- var _loop_33 = function (directory) {
122512
+ var _loop_34 = function (directory) {
122330
122513
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
122331
122514
  var pathsInDirectory;
122332
122515
  allFileNames.forEach(function (_a, fileName) {
@@ -122350,9 +122533,9 @@ var ts;
122350
122533
  };
122351
122534
  var out_directory_1;
122352
122535
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
122353
- var state_10 = _loop_33(directory);
122536
+ var state_11 = _loop_34(directory);
122354
122537
  directory = out_directory_1;
122355
- if (state_10 === "break")
122538
+ if (state_11 === "break")
122356
122539
  break;
122357
122540
  }
122358
122541
  if (allFileNames.size) {
@@ -122745,6 +122928,7 @@ var ts;
122745
122928
  if (system.clearScreen &&
122746
122929
  !options.preserveWatchOutput &&
122747
122930
  !options.extendedDiagnostics &&
122931
+ !options.solutionDiagnostics &&
122748
122932
  !options.diagnostics &&
122749
122933
  ts.contains(ts.screenStartingMessageCodes, diagnostic.code)) {
122750
122934
  system.clearScreen();
@@ -123194,6 +123378,7 @@ var ts;
123194
123378
  readDirectory: ts.maybeBind(host, host.readDirectory),
123195
123379
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
123196
123380
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
123381
+ now: ts.maybeBind(host, host.now),
123197
123382
  };
123198
123383
  function writeFile(fileName, text, writeByteOrderMark, onError) {
123199
123384
  try {
@@ -123254,6 +123439,7 @@ var ts;
123254
123439
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
123255
123440
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
123256
123441
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
123442
+ now: ts.maybeBind(system, system.now),
123257
123443
  };
123258
123444
  }
123259
123445
  ts.createProgramHost = createProgramHost;
@@ -123321,20 +123507,26 @@ var ts;
123321
123507
  var ts;
123322
123508
  (function (ts) {
123323
123509
  function readBuilderProgram(compilerOptions, host) {
123324
- if (ts.outFile(compilerOptions))
123325
- return undefined;
123326
123510
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
123327
123511
  if (!buildInfoPath)
123328
123512
  return undefined;
123329
- var content = host.readFile(buildInfoPath);
123330
- if (!content)
123331
- return undefined;
123332
- var buildInfo = ts.getBuildInfo(content);
123513
+ var buildInfo;
123514
+ if (host.getBuildInfo) {
123515
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
123516
+ if (!buildInfo)
123517
+ return undefined;
123518
+ }
123519
+ else {
123520
+ var content = host.readFile(buildInfoPath);
123521
+ if (!content)
123522
+ return undefined;
123523
+ buildInfo = ts.getBuildInfo(content);
123524
+ }
123333
123525
  if (buildInfo.version !== ts.version)
123334
123526
  return undefined;
123335
123527
  if (!buildInfo.program)
123336
123528
  return undefined;
123337
- return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123529
+ return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123338
123530
  }
123339
123531
  ts.readBuilderProgram = readBuilderProgram;
123340
123532
  function createIncrementalCompilerHost(options, system) {
@@ -123343,6 +123535,7 @@ var ts;
123343
123535
  host.createHash = ts.maybeBind(system, system.createHash);
123344
123536
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
123345
123537
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
123538
+ host.now = ts.maybeBind(system, system.now);
123346
123539
  ts.setGetSourceFileAsHashVersioned(host, system);
123347
123540
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
123348
123541
  return host;
@@ -124078,14 +124271,17 @@ var ts;
124078
124271
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
124079
124272
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
124080
124273
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
124081
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
124082
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
124083
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
124084
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
124274
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
124275
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
124276
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
124277
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
124278
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
124279
+ UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
124085
124280
  /**
124086
124281
  * Projects with no outputs (i.e. "solution" files)
124087
124282
  */
124088
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
124283
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
124284
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
124089
124285
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
124090
124286
  function resolveConfigFileProjectName(project) {
124091
124287
  if (ts.fileExtensionIs(project, ".json" /* Json */)) {
@@ -124130,9 +124326,11 @@ var ts;
124130
124326
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
124131
124327
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
124132
124328
  }
124133
- function newer(date1, date2) {
124134
- return date2 > date1 ? date2 : date1;
124329
+ /*@internal*/
124330
+ function getCurrentTime(host) {
124331
+ return host.now ? host.now() : new Date();
124135
124332
  }
124333
+ ts.getCurrentTime = getCurrentTime;
124136
124334
  /*@internal*/
124137
124335
  function isCircularBuildOrder(buildOrder) {
124138
124336
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -124185,6 +124383,8 @@ var ts;
124185
124383
  if (ts.hasProperty(buildOptions, option.name))
124186
124384
  result[option.name] = buildOptions[option.name];
124187
124385
  });
124386
+ if (buildOptions.solutionDiagnostics)
124387
+ result.solutionDiagnostics = true;
124188
124388
  return result;
124189
124389
  }
124190
124390
  function createSolutionBuilder(host, rootNames, defaultOptions) {
@@ -124222,6 +124422,7 @@ var ts;
124222
124422
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
124223
124423
  };
124224
124424
  }
124425
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
124225
124426
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
124226
124427
  var state = {
124227
124428
  host: host,
@@ -124238,8 +124439,9 @@ var ts;
124238
124439
  resolvedConfigFilePaths: new ts.Map(),
124239
124440
  configFileCache: new ts.Map(),
124240
124441
  projectStatus: new ts.Map(),
124241
- buildInfoChecked: new ts.Map(),
124242
124442
  extendedConfigCache: new ts.Map(),
124443
+ buildInfoCache: new ts.Map(),
124444
+ outputTimeStamps: new ts.Map(),
124243
124445
  builderPrograms: new ts.Map(),
124244
124446
  diagnostics: new ts.Map(),
124245
124447
  projectPendingBuild: new ts.Map(),
@@ -124262,6 +124464,7 @@ var ts;
124262
124464
  allWatchedConfigFiles: new ts.Map(),
124263
124465
  allWatchedExtendedConfigFiles: new ts.Map(),
124264
124466
  allWatchedPackageJsonFiles: new ts.Map(),
124467
+ filesWatched: new ts.Map(),
124265
124468
  lastCachedPackageJsonLookups: new ts.Map(),
124266
124469
  timerToBuildInvalidatedProject: undefined,
124267
124470
  reportFileChangeDetected: false,
@@ -124372,11 +124575,12 @@ var ts;
124372
124575
  // Config file cache
124373
124576
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
124374
124577
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
124375
- ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
124376
124578
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
124377
124579
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
124378
124580
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
124379
124581
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
124582
+ ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
124583
+ ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
124380
124584
  // Remove watches for the program no longer in the solution
124381
124585
  if (state.watch) {
124382
124586
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
@@ -124673,21 +124877,21 @@ var ts;
124673
124877
  }
124674
124878
  function emit(writeFileCallback, cancellationToken, customTransformers) {
124675
124879
  var _a;
124676
- var _b, _c;
124880
+ var _b, _c, _d;
124677
124881
  ts.Debug.assertIsDefined(program);
124678
124882
  ts.Debug.assert(step === BuildStep.Emit);
124679
124883
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
124680
- program.backupState();
124884
+ program.backupEmitState();
124681
124885
  var declDiagnostics;
124682
124886
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
124683
124887
  var outputFiles = [];
124684
124888
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
124685
124889
  /*write*/ undefined,
124686
- /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
124890
+ /*reportSummary*/ 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,
124687
124891
  /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
124688
124892
  // Don't emit .d.ts if there are decl file errors
124689
124893
  if (declDiagnostics) {
124690
- program.restoreState();
124894
+ program.restoreEmitState();
124691
124895
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
124692
124896
  return {
124693
124897
  emitSkipped: true,
@@ -124697,40 +124901,46 @@ var ts;
124697
124901
  // Actual Emit
124698
124902
  var host = state.host, compilerHost = state.compilerHost;
124699
124903
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124700
- var newestDeclarationFileContentChangedTime = minimumDate;
124701
- var anyDtsChanged = false;
124904
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
124702
124905
  var emitterDiagnostics = ts.createDiagnosticCollection();
124703
124906
  var emittedOutputs = new ts.Map();
124907
+ var options = program.getCompilerOptions();
124908
+ var isIncremental = ts.isIncrementalCompilation(options);
124909
+ var outputTimeStampMap;
124910
+ var now;
124704
124911
  ts.solutionPerformance.mark("beforeOutputFilesWrite");
124705
124912
  outputFiles.forEach(function (_a) {
124706
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124707
- var priorChangeTime;
124708
- if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124709
- // Check for unchanged .d.ts files
124710
- if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124711
- priorChangeTime = host.getModifiedTime(name);
124712
- }
124713
- else {
124913
+ var _b, _c;
124914
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124915
+ var path = toPath(state, name);
124916
+ emittedOutputs.set(toPath(state, name), name);
124917
+ if (buildInfo) {
124918
+ setBuildInfo(state, buildInfo, projectPath, options);
124919
+ 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)) {
124714
124920
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124715
- anyDtsChanged = true;
124716
124921
  }
124717
124922
  }
124718
- emittedOutputs.set(toPath(state, name), name);
124719
124923
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124720
- if (priorChangeTime !== undefined) {
124721
- newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
124924
+ if (!isIncremental && state.watch) {
124925
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
124722
124926
  }
124723
124927
  });
124724
124928
  ts.solutionPerformance.mark("afterOutputFilesWrite");
124725
124929
  ts.solutionPerformance.measure("OutputFilesWrite", "beforeOutputFilesWrite", "afterOutputFilesWrite");
124726
- finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime,
124727
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124930
+ finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124728
124931
  return emitResult;
124729
124932
  }
124730
124933
  function emitBuildInfo(writeFileCallback, cancellationToken) {
124731
124934
  ts.Debug.assertIsDefined(program);
124732
124935
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
124733
- var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
124936
+ var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
124937
+ if (data === null || data === void 0 ? void 0 : data.buildInfo)
124938
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
124939
+ if (writeFileCallback)
124940
+ writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
124941
+ else
124942
+ state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
124943
+ }, cancellationToken);
124734
124944
  if (emitResult.diagnostics.length) {
124735
124945
  reportErrors(state, emitResult.diagnostics);
124736
124946
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -124743,7 +124953,7 @@ var ts;
124743
124953
  step = BuildStep.QueueReferencingProjects;
124744
124954
  return emitResult;
124745
124955
  }
124746
- function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
124956
+ function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
124747
124957
  var _a;
124748
124958
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
124749
124959
  if (emitDiagnostics.length) {
@@ -124754,13 +124964,11 @@ var ts;
124754
124964
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
124755
124965
  }
124756
124966
  // Update time stamps for rest of the outputs
124757
- var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124967
+ updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124758
124968
  state.diagnostics.delete(projectPath);
124759
124969
  state.projectStatus.set(projectPath, {
124760
124970
  type: ts.UpToDateStatusType.UpToDate,
124761
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
124762
- maximumDate :
124763
- newestDeclarationFileContentChangedTime,
124971
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
124764
124972
  oldestOutputFileName: oldestOutputFileName
124765
124973
  });
124766
124974
  afterProgramDone(state, program, config);
@@ -124795,13 +125003,21 @@ var ts;
124795
125003
  ts.Debug.assert(!!outputFiles.length);
124796
125004
  var emitterDiagnostics = ts.createDiagnosticCollection();
124797
125005
  var emittedOutputs = new ts.Map();
125006
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
125007
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
124798
125008
  outputFiles.forEach(function (_a) {
124799
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
125009
+ var _b, _c;
125010
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124800
125011
  emittedOutputs.set(toPath(state, name), name);
125012
+ if (buildInfo) {
125013
+ setBuildInfo(state, buildInfo, projectPath, config.options);
125014
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
125015
+ resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
125016
+ }
125017
+ }
124801
125018
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124802
125019
  });
124803
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate,
124804
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
125020
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
124805
125021
  return { emitSkipped: false, diagnostics: emitDiagnostics };
124806
125022
  }
124807
125023
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -124907,7 +125123,7 @@ var ts;
124907
125123
  }
124908
125124
  continue;
124909
125125
  }
124910
- if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
125126
+ if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
124911
125127
  reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
124912
125128
  return {
124913
125129
  kind: InvalidatedProjectKind.UpdateOutputFileStamps,
@@ -124993,7 +125209,7 @@ var ts;
124993
125209
  state.projectCompilerOptions = state.baseCompilerOptions;
124994
125210
  }
124995
125211
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
124996
- var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
125212
+ var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
124997
125213
  reportAndStoreErrors(state, resolvedPath, diagnostics);
124998
125214
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
124999
125215
  if (canEmitBuildInfo)
@@ -125001,9 +125217,101 @@ var ts;
125001
125217
  afterProgramDone(state, program, config);
125002
125218
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
125003
125219
  }
125220
+ function isFileWatcherWithModifiedTime(value) {
125221
+ return !!value.watcher;
125222
+ }
125223
+ function getModifiedTime(state, fileName) {
125224
+ var path = toPath(state, fileName);
125225
+ var existing = state.filesWatched.get(path);
125226
+ if (state.watch && !!existing) {
125227
+ if (!isFileWatcherWithModifiedTime(existing))
125228
+ return existing;
125229
+ if (existing.modifiedTime)
125230
+ return existing.modifiedTime;
125231
+ }
125232
+ var result = ts.getModifiedTime(state.host, fileName);
125233
+ if (state.watch) {
125234
+ if (existing)
125235
+ existing.modifiedTime = result;
125236
+ else
125237
+ state.filesWatched.set(path, result);
125238
+ }
125239
+ return result;
125240
+ }
125241
+ function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
125242
+ var path = toPath(state, file);
125243
+ var existing = state.filesWatched.get(path);
125244
+ if (existing && isFileWatcherWithModifiedTime(existing)) {
125245
+ existing.callbacks.push(callback);
125246
+ }
125247
+ else {
125248
+ var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
125249
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
125250
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
125251
+ existing.modifiedTime = modifiedTime;
125252
+ existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
125253
+ }, pollingInterval, options, watchType, project);
125254
+ state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
125255
+ }
125256
+ return {
125257
+ close: function () {
125258
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
125259
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
125260
+ if (existing.callbacks.length === 1) {
125261
+ state.filesWatched.delete(path);
125262
+ ts.closeFileWatcherOf(existing);
125263
+ }
125264
+ else {
125265
+ ts.unorderedRemoveItem(existing.callbacks, callback);
125266
+ }
125267
+ }
125268
+ };
125269
+ }
125270
+ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
125271
+ if (!state.watch)
125272
+ return undefined;
125273
+ var result = state.outputTimeStamps.get(resolvedConfigFilePath);
125274
+ if (!result)
125275
+ state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
125276
+ return result;
125277
+ }
125278
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
125279
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125280
+ var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
125281
+ if (existing) {
125282
+ existing.buildInfo = buildInfo;
125283
+ existing.modifiedTime = getCurrentTime(state.host);
125284
+ }
125285
+ else {
125286
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
125287
+ }
125288
+ }
125289
+ function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
125290
+ var path = toPath(state, buildInfoPath);
125291
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
125292
+ return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
125293
+ }
125294
+ function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
125295
+ var path = toPath(state, buildInfoPath);
125296
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
125297
+ if (existing !== undefined && existing.path === path) {
125298
+ return existing.buildInfo || undefined;
125299
+ }
125300
+ ts.solutionPerformance.mark("beforeGetBuildInfo");
125301
+ ts.solutionPerformance.mark("beforeBuildInfoRead");
125302
+ var value = state.readFileWithCache(buildInfoPath);
125303
+ ts.solutionPerformance.mark("afterBuildInfoRead");
125304
+ ts.solutionPerformance.measure("BuildInfoRead", "beforeBuildInfoRead", "afterBuildInfoRead");
125305
+ var buildInfo = value ? ts.getBuildInfo(value) : undefined;
125306
+ ts.Debug.assert(modifiedTime || !buildInfo);
125307
+ state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
125308
+ ts.solutionPerformance.mark("afterGetBuildInfo");
125309
+ ts.solutionPerformance.measure("GetBuildInfo", "beforeGetBuildInfo", "afterGetBuildInfo");
125310
+ return buildInfo;
125311
+ }
125004
125312
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
125005
125313
  // Check tsconfig time
125006
- var tsconfigTime = ts.getModifiedTime(state.host, configFile);
125314
+ var tsconfigTime = getModifiedTime(state, configFile);
125007
125315
  if (oldestOutputFileTime < tsconfigTime) {
125008
125316
  return {
125009
125317
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -125013,88 +125321,24 @@ var ts;
125013
125321
  }
125014
125322
  }
125015
125323
  function getUpToDateStatusWorker(state, project, resolvedPath) {
125016
- var force = !!state.options.force;
125017
- var newestInputFileName = undefined;
125018
- var newestInputFileTime = minimumDate;
125019
- var host = state.host;
125020
- // Get timestamps of input files
125021
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
125022
- var inputFile = _a[_i];
125023
- if (!host.fileExists(inputFile)) {
125024
- return {
125025
- type: ts.UpToDateStatusType.Unbuildable,
125026
- reason: inputFile + " does not exist"
125027
- };
125028
- }
125029
- if (!force) {
125030
- var inputTime = ts.getModifiedTime(host, inputFile);
125031
- if (inputTime > newestInputFileTime) {
125032
- newestInputFileName = inputFile;
125033
- newestInputFileTime = inputTime;
125034
- }
125035
- }
125036
- }
125324
+ var _a, _b, _c;
125037
125325
  // Container if no files are specified in the project
125038
125326
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
125039
125327
  return {
125040
125328
  type: ts.UpToDateStatusType.ContainerOnly
125041
125329
  };
125042
125330
  }
125043
- // Collect the expected outputs of this project
125044
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
125045
- // Now see if all outputs are newer than the newest input
125046
- var oldestOutputFileName = "(none)";
125047
- var oldestOutputFileTime = maximumDate;
125048
- var newestOutputFileName = "(none)";
125049
- var newestOutputFileTime = minimumDate;
125050
- var missingOutputFileName;
125051
- var newestDeclarationFileContentChangedTime = minimumDate;
125052
- var isOutOfDateWithInputs = false;
125053
- if (!force) {
125054
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
125055
- var output = outputs_1[_b];
125056
- // Output is missing; can stop checking
125057
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
125058
- if (!host.fileExists(output)) {
125059
- missingOutputFileName = output;
125060
- break;
125061
- }
125062
- var outputTime = ts.getModifiedTime(host, output);
125063
- if (outputTime < oldestOutputFileTime) {
125064
- oldestOutputFileTime = outputTime;
125065
- oldestOutputFileName = output;
125066
- }
125067
- // If an output is older than the newest input, we can stop checking
125068
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
125069
- if (outputTime < newestInputFileTime) {
125070
- isOutOfDateWithInputs = true;
125071
- break;
125072
- }
125073
- if (outputTime > newestOutputFileTime) {
125074
- newestOutputFileTime = outputTime;
125075
- newestOutputFileName = output;
125076
- }
125077
- // Keep track of when the most recent time a .d.ts file was changed.
125078
- // In addition to file timestamps, we also keep track of when a .d.ts file
125079
- // had its file touched but not had its contents changed - this allows us
125080
- // to skip a downstream typecheck
125081
- if (ts.isDeclarationFileName(output)) {
125082
- var outputModifiedTime = ts.getModifiedTime(host, output);
125083
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
125084
- }
125085
- }
125086
- }
125087
- var pseudoUpToDate = false;
125088
- var usesPrepend = false;
125089
- var upstreamChangedProject;
125331
+ // Fast check to see if reference projects are buildable
125332
+ var referenceStatuses;
125333
+ var force = !!state.options.force;
125090
125334
  if (project.projectReferences) {
125091
125335
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
125092
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
125093
- var ref = _d[_c];
125094
- usesPrepend = usesPrepend || !!(ref.prepend);
125336
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
125337
+ var ref = _d[_i];
125095
125338
  var resolvedRef = ts.resolveProjectReferencePath(ref);
125096
125339
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
125097
- var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
125340
+ var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
125341
+ var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
125098
125342
  // Its a circular reference ignore the status of this project
125099
125343
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
125100
125344
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) { // Container only ignore this project
@@ -125116,78 +125360,188 @@ var ts;
125116
125360
  upstreamProjectName: ref.path
125117
125361
  };
125118
125362
  }
125119
- // Check oldest output file name only if there is no missing output file name
125120
- // (a check we will have skipped if this is a forced build)
125121
- if (!force && !missingOutputFileName) {
125122
- // If the upstream project's newest file is older than our oldest output, we
125123
- // can't be out of date because of it
125124
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
125125
- continue;
125126
- }
125127
- // If the upstream project has only change .d.ts files, and we've built
125128
- // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
125129
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
125130
- pseudoUpToDate = true;
125131
- upstreamChangedProject = ref.path;
125132
- continue;
125133
- }
125134
- // We have an output older than an upstream output - we are out of date
125135
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125363
+ if (!force)
125364
+ (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
125365
+ }
125366
+ }
125367
+ if (force)
125368
+ return { type: ts.UpToDateStatusType.ForceBuild };
125369
+ // Check buildinfo first
125370
+ var host = state.host;
125371
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125372
+ var oldestOutputFileName = "(none)";
125373
+ var oldestOutputFileTime = maximumDate;
125374
+ var buildInfoTime;
125375
+ var buildInfoProgram;
125376
+ var buildInfoVersionMap;
125377
+ var newestDeclarationFileContentChangedTime;
125378
+ if (buildInfoPath) {
125379
+ var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
125380
+ buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
125381
+ if (buildInfoTime === ts.missingFileModifiedTime) {
125382
+ if (!buildInfoCacheEntry_1) {
125383
+ state.buildInfoCache.set(resolvedPath, {
125384
+ path: toPath(state, buildInfoPath),
125385
+ buildInfo: false,
125386
+ modifiedTime: buildInfoTime
125387
+ });
125388
+ }
125389
+ return {
125390
+ type: ts.UpToDateStatusType.OutputMissing,
125391
+ missingOutputFileName: buildInfoPath
125392
+ };
125393
+ }
125394
+ var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
125395
+ if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125396
+ return {
125397
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
125398
+ version: buildInfo.version
125399
+ };
125400
+ }
125401
+ if (buildInfo.program) {
125402
+ if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
125403
+ (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
125136
125404
  return {
125137
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125138
- outOfDateOutputFileName: oldestOutputFileName,
125139
- newerProjectName: ref.path
125405
+ type: ts.UpToDateStatusType.OutOfDateBuildInfo,
125406
+ buildInfoFile: buildInfoPath
125140
125407
  };
125141
125408
  }
125409
+ buildInfoProgram = buildInfo.program;
125142
125410
  }
125411
+ oldestOutputFileTime = buildInfoTime;
125412
+ oldestOutputFileName = buildInfoPath;
125413
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
125143
125414
  }
125144
- if (missingOutputFileName !== undefined) {
125145
- return {
125146
- type: ts.UpToDateStatusType.OutputMissing,
125147
- missingOutputFileName: missingOutputFileName
125148
- };
125415
+ // Check input files
125416
+ var newestInputFileName = undefined;
125417
+ var newestInputFileTime = minimumDate;
125418
+ var pseudoInputUptodate = false;
125419
+ // Get timestamps of input files
125420
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
125421
+ var inputFile = _f[_e];
125422
+ var inputTime = getModifiedTime(state, inputFile);
125423
+ if (inputTime === ts.missingFileModifiedTime) {
125424
+ return {
125425
+ type: ts.UpToDateStatusType.Unbuildable,
125426
+ reason: inputFile + " does not exist"
125427
+ };
125428
+ }
125429
+ // If an buildInfo is older than the newest input, we can stop checking
125430
+ if (buildInfoTime && buildInfoTime < inputTime) {
125431
+ var version_3 = void 0;
125432
+ var currentVersion = void 0;
125433
+ if (buildInfoProgram) {
125434
+ // Read files and see if they are same, read is anyways cached
125435
+ if (!buildInfoVersionMap)
125436
+ buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
125437
+ version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
125438
+ var text = version_3 ? state.readFileWithCache(inputFile) : undefined;
125439
+ currentVersion = text && (host.createHash || ts.generateDjb2Hash)(text);
125440
+ if (version_3 && version_3 === currentVersion)
125441
+ pseudoInputUptodate = true;
125442
+ }
125443
+ if (!version_3 || version_3 !== currentVersion) {
125444
+ return {
125445
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125446
+ outOfDateOutputFileName: buildInfoPath,
125447
+ newerInputFileName: inputFile
125448
+ };
125449
+ }
125450
+ }
125451
+ if (inputTime > newestInputFileTime) {
125452
+ newestInputFileName = inputFile;
125453
+ newestInputFileTime = inputTime;
125454
+ }
125149
125455
  }
125150
- if (isOutOfDateWithInputs) {
125151
- return {
125152
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
125153
- outOfDateOutputFileName: oldestOutputFileName,
125154
- newerInputFileName: newestInputFileName
125155
- };
125456
+ // Now see if all outputs are newer than the newest input
125457
+ // Dont check output timestamps if we have buildinfo telling us output is uptodate
125458
+ if (!buildInfoPath) {
125459
+ // Collect the expected outputs of this project
125460
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
125461
+ var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
125462
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
125463
+ var output = outputs_1[_g];
125464
+ var path = toPath(state, output);
125465
+ // Output is missing; can stop checking
125466
+ var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
125467
+ if (!outputTime) {
125468
+ outputTime = ts.getModifiedTime(state.host, output);
125469
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
125470
+ }
125471
+ if (outputTime === ts.missingFileModifiedTime) {
125472
+ return {
125473
+ type: ts.UpToDateStatusType.OutputMissing,
125474
+ missingOutputFileName: output
125475
+ };
125476
+ }
125477
+ if (outputTime < oldestOutputFileTime) {
125478
+ oldestOutputFileTime = outputTime;
125479
+ oldestOutputFileName = output;
125480
+ }
125481
+ // If an output is older than the newest input, we can stop checking
125482
+ if (outputTime < newestInputFileTime) {
125483
+ return {
125484
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125485
+ outOfDateOutputFileName: oldestOutputFileName,
125486
+ newerInputFileName: newestInputFileName
125487
+ };
125488
+ }
125489
+ }
125156
125490
  }
125157
- else {
125158
- // Check tsconfig time
125159
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125160
- if (configStatus)
125161
- return configStatus;
125162
- // Check extended config time
125163
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125164
- if (extendedConfigStatus)
125165
- return extendedConfigStatus;
125166
- // Check package file time
125167
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125168
- var path = _a[0];
125169
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125170
- });
125171
- if (dependentPackageFileStatus)
125172
- return dependentPackageFileStatus;
125173
- }
125174
- if (!force && !state.buildInfoChecked.has(resolvedPath)) {
125175
- state.buildInfoChecked.set(resolvedPath, true);
125176
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125177
- if (buildInfoPath) {
125178
- ts.solutionPerformance.mark("beforeBuildInfoRead");
125179
- var value = state.readFileWithCache(buildInfoPath);
125180
- ts.solutionPerformance.mark("afterBuildInfoRead");
125181
- ts.solutionPerformance.measure("BuildInfoRead", "beforeBuildInfoRead", "afterBuildInfoRead");
125182
- var buildInfo = value && ts.getBuildInfo(value);
125183
- if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125491
+ var seenRefs = buildInfoPath ? new ts.Set() : undefined;
125492
+ var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
125493
+ seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
125494
+ var pseudoUpToDate = false;
125495
+ var usesPrepend = false;
125496
+ var upstreamChangedProject;
125497
+ if (referenceStatuses) {
125498
+ for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
125499
+ var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
125500
+ usesPrepend = usesPrepend || !!(ref.prepend);
125501
+ // If the upstream project's newest file is older than our oldest output, we
125502
+ // can't be out of date because of it
125503
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
125504
+ continue;
125505
+ }
125506
+ // Check if tsbuildinfo path is shared, then we need to rebuild
125507
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
125184
125508
  return {
125185
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
125186
- version: buildInfo.version
125509
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125510
+ outOfDateOutputFileName: buildInfoPath,
125511
+ newerProjectName: ref.path
125187
125512
  };
125188
125513
  }
125514
+ // If the upstream project has only change .d.ts files, and we've built
125515
+ // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
125516
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
125517
+ pseudoUpToDate = true;
125518
+ upstreamChangedProject = ref.path;
125519
+ continue;
125520
+ }
125521
+ // We have an output older than an upstream output - we are out of date
125522
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125523
+ return {
125524
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125525
+ outOfDateOutputFileName: oldestOutputFileName,
125526
+ newerProjectName: ref.path
125527
+ };
125189
125528
  }
125190
125529
  }
125530
+ // Check tsconfig time
125531
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125532
+ if (configStatus)
125533
+ return configStatus;
125534
+ // Check extended config time
125535
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125536
+ if (extendedConfigStatus)
125537
+ return extendedConfigStatus;
125538
+ // Check package file time
125539
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125540
+ var path = _a[0];
125541
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125542
+ });
125543
+ if (dependentPackageFileStatus)
125544
+ return dependentPackageFileStatus;
125191
125545
  if (usesPrepend && pseudoUpToDate) {
125192
125546
  return {
125193
125547
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -125197,15 +125551,37 @@ var ts;
125197
125551
  }
125198
125552
  // Up to date
125199
125553
  return {
125200
- type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
125554
+ type: pseudoUpToDate ?
125555
+ ts.UpToDateStatusType.UpToDateWithUpstreamTypes :
125556
+ pseudoInputUptodate ?
125557
+ ts.UpToDateStatusType.UpToDateWithInputFileText :
125558
+ ts.UpToDateStatusType.UpToDate,
125201
125559
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
125202
125560
  newestInputFileTime: newestInputFileTime,
125203
- newestOutputFileTime: newestOutputFileTime,
125204
125561
  newestInputFileName: newestInputFileName,
125205
- newestOutputFileName: newestOutputFileName,
125206
125562
  oldestOutputFileName: oldestOutputFileName
125207
125563
  };
125208
125564
  }
125565
+ function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
125566
+ if (seenRefs.has(resolvedRefPath))
125567
+ return false;
125568
+ seenRefs.add(resolvedRefPath);
125569
+ var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
125570
+ if (refBuildInfo.path === buildInfoCacheEntry.path)
125571
+ return true;
125572
+ if (resolvedConfig.projectReferences) {
125573
+ // Check references
125574
+ for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
125575
+ var ref = _a[_i];
125576
+ var resolvedRef = ts.resolveProjectReferencePath(ref);
125577
+ var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
125578
+ var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
125579
+ if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
125580
+ return true;
125581
+ }
125582
+ }
125583
+ return false;
125584
+ }
125209
125585
  function getUpToDateStatus(state, project, resolvedPath) {
125210
125586
  if (project === undefined) {
125211
125587
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -125221,42 +125597,69 @@ var ts;
125221
125597
  state.projectStatus.set(resolvedPath, actual);
125222
125598
  return actual;
125223
125599
  }
125224
- function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
125600
+ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
125225
125601
  if (proj.options.noEmit)
125226
- return priorNewestUpdateTime;
125602
+ return;
125603
+ var now;
125227
125604
  ts.solutionPerformance.mark("beforeUpdateOutputTimestamps");
125228
- var host = state.host;
125229
- var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125230
- if (!skipOutputs || outputs.length !== skipOutputs.size) {
125231
- var reportVerbose = !!state.options.verbose;
125232
- var now = host.now ? host.now() : new Date();
125233
- for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125234
- var file = outputs_2[_i];
125235
- if (skipOutputs && skipOutputs.has(toPath(state, file))) {
125236
- continue;
125237
- }
125238
- if (reportVerbose) {
125239
- reportVerbose = false;
125605
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
125606
+ if (buildInfoPath) {
125607
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
125608
+ if (!!state.options.verbose)
125240
125609
  reportStatus(state, verboseMessage, proj.options.configFilePath);
125610
+ state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
125611
+ getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
125612
+ }
125613
+ state.outputTimeStamps.delete(projectPath);
125614
+ }
125615
+ else {
125616
+ var host = state.host;
125617
+ var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125618
+ var outputTimeStampMap_1 = getOutputTimeStampMap(state, projectPath);
125619
+ var modifiedOutputs_1 = outputTimeStampMap_1 ? new ts.Set() : undefined;
125620
+ if (!skipOutputs || outputs.length !== skipOutputs.size) {
125621
+ var reportVerbose = !!state.options.verbose;
125622
+ for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125623
+ var file = outputs_2[_i];
125624
+ var path = toPath(state, file);
125625
+ if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
125626
+ continue;
125627
+ if (reportVerbose) {
125628
+ reportVerbose = false;
125629
+ reportStatus(state, verboseMessage, proj.options.configFilePath);
125630
+ }
125631
+ host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
125632
+ if (outputTimeStampMap_1) {
125633
+ outputTimeStampMap_1.set(path, now);
125634
+ modifiedOutputs_1.add(path);
125635
+ }
125241
125636
  }
125242
- if (ts.isDeclarationFileName(file)) {
125243
- priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
125244
- }
125245
- host.setModifiedTime(file, now);
125246
125637
  }
125638
+ // Clear out timestamps not in output list any more
125639
+ outputTimeStampMap_1 === null || outputTimeStampMap_1 === void 0 ? void 0 : outputTimeStampMap_1.forEach(function (_value, key) {
125640
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs_1.has(key))
125641
+ outputTimeStampMap_1.delete(key);
125642
+ });
125247
125643
  }
125248
125644
  ts.solutionPerformance.mark("afterUpdateOutputTimestamps");
125249
125645
  ts.solutionPerformance.measure("UpdateOutputTimestamps", "beforeUpdateOutputTimestamps", "afterUpdateOutputTimestamps");
125250
- return priorNewestUpdateTime;
125646
+ }
125647
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
125648
+ var _a;
125649
+ if (!options.composite)
125650
+ return undefined;
125651
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125652
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, /*modifiedTime*/ undefined);
125653
+ 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;
125251
125654
  }
125252
125655
  function updateOutputTimestamps(state, proj, resolvedPath) {
125253
125656
  if (state.options.dry) {
125254
125657
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
125255
125658
  }
125256
- var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125659
+ updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125257
125660
  state.projectStatus.set(resolvedPath, {
125258
125661
  type: ts.UpToDateStatusType.UpToDate,
125259
- newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
125662
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
125260
125663
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
125261
125664
  });
125262
125665
  }
@@ -125302,6 +125705,7 @@ var ts;
125302
125705
  break;
125303
125706
  }
125304
125707
  // falls through
125708
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
125305
125709
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125306
125710
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
125307
125711
  if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
@@ -125362,6 +125766,13 @@ var ts;
125362
125766
  : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped;
125363
125767
  }
125364
125768
  function clean(state, project, onlyReferences) {
125769
+ ts.solutionPerformance.mark("beforeClean");
125770
+ var result = cleanWorker(state, project, onlyReferences);
125771
+ ts.solutionPerformance.mark("afterClean");
125772
+ ts.solutionPerformance.measure("Clean", "beforeClean", "afterClean");
125773
+ return result;
125774
+ }
125775
+ function cleanWorker(state, project, onlyReferences) {
125365
125776
  var buildOrder = getBuildOrderFor(state, project, onlyReferences);
125366
125777
  if (!buildOrder)
125367
125778
  return ts.ExitStatus.InvalidProject_OutputsSkipped;
@@ -125486,12 +125897,10 @@ var ts;
125486
125897
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
125487
125898
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
125488
125899
  return;
125489
- state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
125490
- invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
125491
- }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
125900
+ 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));
125492
125901
  }
125493
125902
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
125494
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
125903
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
125495
125904
  var _a;
125496
125905
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
125497
125906
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -125523,7 +125932,7 @@ var ts;
125523
125932
  if (!state.watch)
125524
125933
  return;
125525
125934
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
125526
- 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); },
125935
+ 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); },
125527
125936
  onDeleteValue: ts.closeFileWatcher,
125528
125937
  });
125529
125938
  }
@@ -125531,7 +125940,7 @@ var ts;
125531
125940
  if (!state.watch || !state.lastCachedPackageJsonLookups)
125532
125941
  return;
125533
125942
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
125534
- 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); },
125943
+ 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); },
125535
125944
  onDeleteValue: ts.closeFileWatcher,
125536
125945
  });
125537
125946
  }
@@ -125664,19 +126073,18 @@ var ts;
125664
126073
  }
125665
126074
  }
125666
126075
  function reportUpToDateStatus(state, configFileName, status) {
125667
- if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
125668
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125669
- }
125670
126076
  switch (status.type) {
125671
126077
  case ts.UpToDateStatusType.OutOfDateWithSelf:
125672
- 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));
126078
+ 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));
125673
126079
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
125674
- 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));
126080
+ 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));
125675
126081
  case ts.UpToDateStatusType.OutputMissing:
125676
126082
  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));
126083
+ case ts.UpToDateStatusType.OutOfDateBuildInfo:
126084
+ 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));
125677
126085
  case ts.UpToDateStatusType.UpToDate:
125678
126086
  if (status.newestInputFileTime !== undefined) {
125679
- 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 || ""));
126087
+ 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 || ""));
125680
126088
  }
125681
126089
  // Don't report anything for "up to date because it was already built" -- too verbose
125682
126090
  break;
@@ -125684,6 +126092,8 @@ var ts;
125684
126092
  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));
125685
126093
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125686
126094
  return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
126095
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
126096
+ 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));
125687
126097
  case ts.UpToDateStatusType.UpstreamOutOfDate:
125688
126098
  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));
125689
126099
  case ts.UpToDateStatusType.UpstreamBlocked:
@@ -125694,6 +126104,8 @@ var ts;
125694
126104
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
125695
126105
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
125696
126106
  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);
126107
+ case ts.UpToDateStatusType.ForceBuild:
126108
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125697
126109
  case ts.UpToDateStatusType.ContainerOnly:
125698
126110
  // Don't report status on "solution" projects
125699
126111
  // falls through
@@ -144096,7 +144508,7 @@ var ts;
144096
144508
  if (!ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) {
144097
144509
  return;
144098
144510
  }
144099
- if (ts.isTypeNode(node)) {
144511
+ if (ts.isTypeNode(node) && !ts.isExpressionWithTypeArguments(node)) {
144100
144512
  return;
144101
144513
  }
144102
144514
  if (preferences.includeInlayVariableTypeHints && ts.isVariableDeclaration(node)) {
@@ -147207,7 +147619,6 @@ var ts;
147207
147619
  case 280 /* JsxOpeningElement */:
147208
147620
  case 281 /* JsxClosingElement */:
147209
147621
  case 279 /* JsxSelfClosingElement */:
147210
- case 228 /* ExpressionWithTypeArguments */:
147211
147622
  return false;
147212
147623
  }
147213
147624
  break;
@@ -147377,7 +147788,7 @@ var ts;
147377
147788
  var listEndToken = getCloseTokenForOpenToken(listStartToken);
147378
147789
  if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
147379
147790
  var tokenInfo = formattingScanner.readTokenInfo(parent);
147380
- if (tokenInfo.token.kind === 27 /* CommaToken */ && ts.isCallLikeExpression(parent)) {
147791
+ if (tokenInfo.token.kind === 27 /* CommaToken */) {
147381
147792
  // consume the comma
147382
147793
  consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent);
147383
147794
  tokenInfo = formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(parent) : undefined;
@@ -147781,6 +148192,12 @@ var ts;
147781
148192
  case 169 /* MethodDeclaration */:
147782
148193
  case 168 /* MethodSignature */:
147783
148194
  case 214 /* ArrowFunction */:
148195
+ case 174 /* CallSignature */:
148196
+ case 175 /* ConstructSignature */:
148197
+ case 179 /* FunctionType */:
148198
+ case 180 /* ConstructorType */:
148199
+ case 172 /* GetAccessor */:
148200
+ case 173 /* SetAccessor */:
147784
148201
  if (node.typeParameters === list) {
147785
148202
  return 29 /* LessThanToken */;
147786
148203
  }
@@ -147797,7 +148214,19 @@ var ts;
147797
148214
  return 20 /* OpenParenToken */;
147798
148215
  }
147799
148216
  break;
148217
+ case 257 /* ClassDeclaration */:
148218
+ case 226 /* ClassExpression */:
148219
+ case 258 /* InterfaceDeclaration */:
148220
+ case 259 /* TypeAliasDeclaration */:
148221
+ if (node.typeParameters === list) {
148222
+ return 29 /* LessThanToken */;
148223
+ }
148224
+ break;
147800
148225
  case 178 /* TypeReference */:
148226
+ case 210 /* TaggedTemplateExpression */:
148227
+ case 181 /* TypeQuery */:
148228
+ case 228 /* ExpressionWithTypeArguments */:
148229
+ case 200 /* ImportType */:
147801
148230
  if (node.typeArguments === list) {
147802
148231
  return 29 /* LessThanToken */;
147803
148232
  }