@typescript-deploys/pr-build 4.7.0-pr-48861-7 → 4.7.0-pr-48784-10

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.
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-insiders.20220427";
92
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220429";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -6179,7 +6179,7 @@ var ts;
6179
6179
  };
6180
6180
  }
6181
6181
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
6182
- var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName) {
6182
+ var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName, modifiedTime) {
6183
6183
  // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
6184
6184
  if (!ts.isString(relativeFileName))
6185
6185
  return;
@@ -6189,7 +6189,7 @@ var ts;
6189
6189
  if (callbacks) {
6190
6190
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
6191
6191
  var fileCallback = callbacks_1[_i];
6192
- fileCallback(fileName, FileWatcherEventKind.Changed);
6192
+ fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6193
6193
  }
6194
6194
  }
6195
6195
  },
@@ -6243,7 +6243,7 @@ var ts;
6243
6243
  }
6244
6244
  else {
6245
6245
  cache.set(path, {
6246
- watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
6246
+ watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6247
6247
  refCount: 1
6248
6248
  });
6249
6249
  }
@@ -6271,7 +6271,7 @@ var ts;
6271
6271
  var newTime = modifiedTime.getTime();
6272
6272
  if (oldTime !== newTime) {
6273
6273
  watchedFile.mtime = modifiedTime;
6274
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
6274
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
6275
6275
  return true;
6276
6276
  }
6277
6277
  return false;
@@ -6522,17 +6522,18 @@ var ts;
6522
6522
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6523
6523
  /*@internal*/
6524
6524
  function createFileWatcherCallback(callback) {
6525
- return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
6525
+ return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6526
6526
  }
6527
6527
  ts.createFileWatcherCallback = createFileWatcherCallback;
6528
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists) {
6529
- return function (eventName) {
6528
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6529
+ return function (eventName, _relativeFileName, modifiedTime) {
6530
6530
  if (eventName === "rename") {
6531
- callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6531
+ modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
6532
+ callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
6532
6533
  }
6533
6534
  else {
6534
6535
  // Change
6535
- callback(fileName, FileWatcherEventKind.Changed);
6536
+ callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6536
6537
  }
6537
6538
  };
6538
6539
  }
@@ -6556,7 +6557,7 @@ var ts;
6556
6557
  }
6557
6558
  /*@internal*/
6558
6559
  function createSystemWatchFunctions(_a) {
6559
- 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;
6560
+ 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;
6560
6561
  var dynamicPollingWatchFile;
6561
6562
  var fixedChunkSizePollingWatchFile;
6562
6563
  var nonPollingWatchFile;
@@ -6578,7 +6579,7 @@ var ts;
6578
6579
  case ts.WatchFileKind.FixedChunkSizePolling:
6579
6580
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, /* pollingInterval */ undefined, /*options*/ undefined);
6580
6581
  case ts.WatchFileKind.UseFsEvents:
6581
- return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists),
6582
+ return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime),
6582
6583
  /*recursive*/ false, pollingInterval, ts.getFallbackOptions(options));
6583
6584
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
6584
6585
  if (!nonPollingWatchFile) {
@@ -6760,7 +6761,6 @@ var ts;
6760
6761
  fsWatch: fsWatch,
6761
6762
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6762
6763
  getCurrentDirectory: getCurrentDirectory,
6763
- fileExists: fileExists,
6764
6764
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
6765
6765
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
6766
6766
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
@@ -7020,7 +7020,7 @@ var ts;
7020
7020
  // File changed
7021
7021
  eventKind = FileWatcherEventKind.Changed;
7022
7022
  }
7023
- callback(fileName, eventKind);
7023
+ callback(fileName, eventKind, curr.mtime);
7024
7024
  }
7025
7025
  }
7026
7026
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
@@ -7046,10 +7046,10 @@ var ts;
7046
7046
  * Invoke the callback with rename and update the watcher if not closed
7047
7047
  * @param createWatcher
7048
7048
  */
7049
- function invokeCallbackAndUpdateWatcher(createWatcher) {
7049
+ function invokeCallbackAndUpdateWatcher(createWatcher, modifiedTime) {
7050
7050
  sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
7051
7051
  // Call the callback for current directory
7052
- callback("rename", "");
7052
+ callback("rename", "", modifiedTime);
7053
7053
  // If watcher is not closed, update it
7054
7054
  if (watcher) {
7055
7055
  watcher.close();
@@ -7095,13 +7095,14 @@ var ts;
7095
7095
  function callbackChangingToMissingFileSystemEntry(event, relativeName) {
7096
7096
  // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
7097
7097
  // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
7098
+ var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
7098
7099
  return event === "rename" &&
7099
7100
  (!relativeName ||
7100
7101
  relativeName === lastDirectoryPart ||
7101
7102
  (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
7102
- !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7103
- invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
7104
- callback(event, relativeName);
7103
+ modifiedTime === ts.missingFileModifiedTime ?
7104
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry, modifiedTime) :
7105
+ callback(event, relativeName, modifiedTime);
7105
7106
  }
7106
7107
  /**
7107
7108
  * Watch the file or directory using fs.watchFile since fs.watch threw exception
@@ -7115,12 +7116,15 @@ var ts;
7115
7116
  * and switch to existing file or directory when the missing filesystem entry is created
7116
7117
  */
7117
7118
  function watchMissingFileSystemEntry() {
7118
- return watchFile(fileOrDirectory, function (_fileName, eventKind) {
7119
- if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
7120
- // Call the callback for current file or directory
7121
- // For now it could be callback for the inner directory creation,
7122
- // but just return current directory, better than current no-op
7123
- invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
7119
+ return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
7120
+ if (eventKind === FileWatcherEventKind.Created) {
7121
+ modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
7122
+ if (modifiedTime !== ts.missingFileModifiedTime) {
7123
+ // Call the callback for current file or directory
7124
+ // For now it could be callback for the inner directory creation,
7125
+ // but just return current directory, better than current no-op
7126
+ invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry, modifiedTime);
7127
+ }
7124
7128
  }
7125
7129
  }, fallbackPollingInterval, fallbackOptions);
7126
7130
  }
@@ -7270,12 +7274,19 @@ var ts;
7270
7274
  }
7271
7275
  function getModifiedTime(path) {
7272
7276
  var _a;
7277
+ // Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
7278
+ // the CPU time performance.
7279
+ var originalStackTraceLimit = Error.stackTraceLimit;
7280
+ Error.stackTraceLimit = 0;
7273
7281
  try {
7274
7282
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
7275
7283
  }
7276
7284
  catch (e) {
7277
7285
  return undefined;
7278
7286
  }
7287
+ finally {
7288
+ Error.stackTraceLimit = originalStackTraceLimit;
7289
+ }
7279
7290
  }
7280
7291
  function setModifiedTime(path, time) {
7281
7292
  try {
@@ -8260,7 +8271,7 @@ var ts;
8260
8271
  Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node12_or_nodenext: diag(1323, ts.DiagnosticCategory.Error, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'."),
8261
8272
  Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'."),
8262
8273
  Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, ts.DiagnosticCategory.Error, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
8263
- Dynamic_import_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "Dynamic_import_cannot_have_type_arguments_1326", "Dynamic import cannot have type arguments."),
8274
+ This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326", "This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments."),
8264
8275
  String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
8265
8276
  Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal: diag(1328, ts.DiagnosticCategory.Error, "Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_li_1328", "Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal."),
8266
8277
  _0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0: diag(1329, ts.DiagnosticCategory.Error, "_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329", "'{0}' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@{0}()'?"),
@@ -8647,7 +8658,6 @@ var ts;
8647
8658
  A_rest_element_cannot_have_a_property_name: diag(2566, ts.DiagnosticCategory.Error, "A_rest_element_cannot_have_a_property_name_2566", "A rest element cannot have a property name."),
8648
8659
  Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations: diag(2567, ts.DiagnosticCategory.Error, "Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567", "Enum declarations can only merge with namespace or other enum declarations."),
8649
8660
  Property_0_may_not_exist_on_type_1_Did_you_mean_2: diag(2568, ts.DiagnosticCategory.Error, "Property_0_may_not_exist_on_type_1_Did_you_mean_2_2568", "Property '{0}' may not exist on type '{1}'. Did you mean '{2}'?"),
8650
- Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: diag(2569, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569", "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators."),
8651
8661
  Could_not_find_name_0_Did_you_mean_1: diag(2570, ts.DiagnosticCategory.Error, "Could_not_find_name_0_Did_you_mean_1_2570", "Could not find name '{0}'. Did you mean '{1}'?"),
8652
8662
  Object_is_of_type_unknown: diag(2571, ts.DiagnosticCategory.Error, "Object_is_of_type_unknown_2571", "Object is of type 'unknown'."),
8653
8663
  A_rest_element_type_must_be_an_array_type: diag(2574, ts.DiagnosticCategory.Error, "A_rest_element_type_must_be_an_array_type_2574", "A rest element type must be an array type."),
@@ -8861,6 +8871,7 @@ var ts;
8861
8871
  This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0: diag(2807, ts.DiagnosticCategory.Error, "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807", "This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."),
8862
8872
  A_get_accessor_must_be_at_least_as_accessible_as_the_setter: diag(2808, ts.DiagnosticCategory.Error, "A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808", "A get accessor must be at least as accessible as the setter"),
8863
8873
  Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses: diag(2809, ts.DiagnosticCategory.Error, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses."),
8874
+ Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments: diag(2810, ts.DiagnosticCategory.Error, "Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810", "Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments."),
8864
8875
  Initializer_for_property_0: diag(2811, ts.DiagnosticCategory.Error, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
8865
8876
  Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, ts.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),
8866
8877
  Class_declaration_cannot_implement_overload_list_for_0: diag(2813, ts.DiagnosticCategory.Error, "Class_declaration_cannot_implement_overload_list_for_0_2813", "Class declaration cannot implement overload list for '{0}'."),
@@ -9288,8 +9299,8 @@ var ts;
9288
9299
  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"),
9289
9300
  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"),
9290
9301
  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."),
9291
- 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}'"),
9292
- 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}'"),
9302
+ 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}'"),
9303
+ 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}'"),
9293
9304
  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"),
9294
9305
  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"),
9295
9306
  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"),
@@ -9333,6 +9344,8 @@ var ts;
9333
9344
  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}'."),
9334
9345
  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}'."),
9335
9346
  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."),
9347
+ 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"),
9348
+ 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"),
9336
9349
  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}'"),
9337
9350
  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."),
9338
9351
  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."),
@@ -20137,6 +20150,10 @@ var ts;
20137
20150
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
20138
20151
  }
20139
20152
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
20153
+ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
20154
+ return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
20155
+ }
20156
+ ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
20140
20157
  function getCompilerOptionValue(options, option) {
20141
20158
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
20142
20159
  }
@@ -37951,7 +37968,8 @@ var ts;
37951
37968
  if (!comment) {
37952
37969
  comment = parseTrailingTagComments(start, getNodePos(), indent, indentText);
37953
37970
  }
37954
- return finishNode(factory.createJSDocCallbackTag(tagName, typeExpression, fullName, comment), start);
37971
+ var end = comment !== undefined ? getNodePos() : typeExpression.end;
37972
+ return finishNode(factory.createJSDocCallbackTag(tagName, typeExpression, fullName, comment), start, end);
37955
37973
  }
37956
37974
  function escapedTextsEqual(a, b) {
37957
37975
  while (!ts.isIdentifier(a) || !ts.isIdentifier(b)) {
@@ -39174,6 +39192,7 @@ var ts;
39174
39192
  type: "boolean",
39175
39193
  affectsSemanticDiagnostics: true,
39176
39194
  affectsEmit: true,
39195
+ affectsMultiFileEmitBuildInfo: true,
39177
39196
  category: ts.Diagnostics.Watch_and_Build_Modes,
39178
39197
  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,
39179
39198
  defaultValueDescription: false,
@@ -39208,12 +39227,40 @@ var ts;
39208
39227
  affectsSourceFile: true,
39209
39228
  affectsModuleResolution: true,
39210
39229
  affectsEmit: true,
39230
+ affectsMultiFileEmitBuildInfo: true,
39211
39231
  paramType: ts.Diagnostics.VERSION,
39212
39232
  showInSimplifiedHelpView: true,
39213
39233
  category: ts.Diagnostics.Language_and_Environment,
39214
39234
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
39215
39235
  defaultValueDescription: 0 /* ES3 */,
39216
39236
  };
39237
+ /*@internal*/
39238
+ ts.moduleOptionDeclaration = {
39239
+ name: "module",
39240
+ shortName: "m",
39241
+ type: new ts.Map(ts.getEntries({
39242
+ none: ts.ModuleKind.None,
39243
+ commonjs: ts.ModuleKind.CommonJS,
39244
+ amd: ts.ModuleKind.AMD,
39245
+ system: ts.ModuleKind.System,
39246
+ umd: ts.ModuleKind.UMD,
39247
+ es6: ts.ModuleKind.ES2015,
39248
+ es2015: ts.ModuleKind.ES2015,
39249
+ es2020: ts.ModuleKind.ES2020,
39250
+ es2022: ts.ModuleKind.ES2022,
39251
+ esnext: ts.ModuleKind.ESNext,
39252
+ node12: ts.ModuleKind.Node12,
39253
+ nodenext: ts.ModuleKind.NodeNext,
39254
+ })),
39255
+ affectsModuleResolution: true,
39256
+ affectsEmit: true,
39257
+ affectsMultiFileEmitBuildInfo: true,
39258
+ paramType: ts.Diagnostics.KIND,
39259
+ showInSimplifiedHelpView: true,
39260
+ category: ts.Diagnostics.Modules,
39261
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
39262
+ defaultValueDescription: undefined,
39263
+ };
39217
39264
  var commandOptionsWithoutBuild = [
39218
39265
  // CommandLine only options
39219
39266
  {
@@ -39275,37 +39322,14 @@ var ts;
39275
39322
  category: ts.Diagnostics.Command_line_Options,
39276
39323
  affectsSemanticDiagnostics: true,
39277
39324
  affectsEmit: true,
39325
+ affectsMultiFileEmitBuildInfo: true,
39278
39326
  isCommandLineOnly: true,
39279
39327
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
39280
39328
  defaultValueDescription: false,
39281
39329
  },
39282
39330
  // Basic
39283
39331
  ts.targetOptionDeclaration,
39284
- {
39285
- name: "module",
39286
- shortName: "m",
39287
- type: new ts.Map(ts.getEntries({
39288
- none: ts.ModuleKind.None,
39289
- commonjs: ts.ModuleKind.CommonJS,
39290
- amd: ts.ModuleKind.AMD,
39291
- system: ts.ModuleKind.System,
39292
- umd: ts.ModuleKind.UMD,
39293
- es6: ts.ModuleKind.ES2015,
39294
- es2015: ts.ModuleKind.ES2015,
39295
- es2020: ts.ModuleKind.ES2020,
39296
- es2022: ts.ModuleKind.ES2022,
39297
- esnext: ts.ModuleKind.ESNext,
39298
- node12: ts.ModuleKind.Node12,
39299
- nodenext: ts.ModuleKind.NodeNext,
39300
- })),
39301
- affectsModuleResolution: true,
39302
- affectsEmit: true,
39303
- paramType: ts.Diagnostics.KIND,
39304
- showInSimplifiedHelpView: true,
39305
- category: ts.Diagnostics.Modules,
39306
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
39307
- defaultValueDescription: undefined,
39308
- },
39332
+ ts.moduleOptionDeclaration,
39309
39333
  {
39310
39334
  name: "lib",
39311
39335
  type: "list",
@@ -39342,6 +39366,7 @@ var ts;
39342
39366
  type: jsxOptionMap,
39343
39367
  affectsSourceFile: true,
39344
39368
  affectsEmit: true,
39369
+ affectsMultiFileEmitBuildInfo: true,
39345
39370
  affectsModuleResolution: true,
39346
39371
  paramType: ts.Diagnostics.KIND,
39347
39372
  showInSimplifiedHelpView: true,
@@ -39354,6 +39379,7 @@ var ts;
39354
39379
  shortName: "d",
39355
39380
  type: "boolean",
39356
39381
  affectsEmit: true,
39382
+ affectsMultiFileEmitBuildInfo: true,
39357
39383
  showInSimplifiedHelpView: true,
39358
39384
  category: ts.Diagnostics.Emit,
39359
39385
  transpileOptionValue: undefined,
@@ -39364,6 +39390,7 @@ var ts;
39364
39390
  name: "declarationMap",
39365
39391
  type: "boolean",
39366
39392
  affectsEmit: true,
39393
+ affectsMultiFileEmitBuildInfo: true,
39367
39394
  showInSimplifiedHelpView: true,
39368
39395
  category: ts.Diagnostics.Emit,
39369
39396
  transpileOptionValue: undefined,
@@ -39374,6 +39401,7 @@ var ts;
39374
39401
  name: "emitDeclarationOnly",
39375
39402
  type: "boolean",
39376
39403
  affectsEmit: true,
39404
+ affectsMultiFileEmitBuildInfo: true,
39377
39405
  showInSimplifiedHelpView: true,
39378
39406
  category: ts.Diagnostics.Emit,
39379
39407
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -39384,6 +39412,7 @@ var ts;
39384
39412
  name: "sourceMap",
39385
39413
  type: "boolean",
39386
39414
  affectsEmit: true,
39415
+ affectsMultiFileEmitBuildInfo: true,
39387
39416
  showInSimplifiedHelpView: true,
39388
39417
  category: ts.Diagnostics.Emit,
39389
39418
  defaultValueDescription: false,
@@ -39393,6 +39422,9 @@ var ts;
39393
39422
  name: "outFile",
39394
39423
  type: "string",
39395
39424
  affectsEmit: true,
39425
+ affectsMultiFileEmitBuildInfo: true,
39426
+ affectsDeclarationPath: true,
39427
+ affectsBundleEmitBuildInfo: true,
39396
39428
  isFilePath: true,
39397
39429
  paramType: ts.Diagnostics.FILE,
39398
39430
  showInSimplifiedHelpView: true,
@@ -39404,6 +39436,8 @@ var ts;
39404
39436
  name: "outDir",
39405
39437
  type: "string",
39406
39438
  affectsEmit: true,
39439
+ affectsMultiFileEmitBuildInfo: true,
39440
+ affectsDeclarationPath: true,
39407
39441
  isFilePath: true,
39408
39442
  paramType: ts.Diagnostics.DIRECTORY,
39409
39443
  showInSimplifiedHelpView: true,
@@ -39414,6 +39448,8 @@ var ts;
39414
39448
  name: "rootDir",
39415
39449
  type: "string",
39416
39450
  affectsEmit: true,
39451
+ affectsMultiFileEmitBuildInfo: true,
39452
+ affectsDeclarationPath: true,
39417
39453
  isFilePath: true,
39418
39454
  paramType: ts.Diagnostics.LOCATION,
39419
39455
  category: ts.Diagnostics.Modules,
@@ -39424,6 +39460,8 @@ var ts;
39424
39460
  name: "composite",
39425
39461
  type: "boolean",
39426
39462
  affectsEmit: true,
39463
+ affectsMultiFileEmitBuildInfo: true,
39464
+ affectsBundleEmitBuildInfo: true,
39427
39465
  isTSConfigOnly: true,
39428
39466
  category: ts.Diagnostics.Projects,
39429
39467
  transpileOptionValue: undefined,
@@ -39434,6 +39472,8 @@ var ts;
39434
39472
  name: "tsBuildInfoFile",
39435
39473
  type: "string",
39436
39474
  affectsEmit: true,
39475
+ affectsMultiFileEmitBuildInfo: true,
39476
+ affectsBundleEmitBuildInfo: true,
39437
39477
  isFilePath: true,
39438
39478
  paramType: ts.Diagnostics.FILE,
39439
39479
  category: ts.Diagnostics.Projects,
@@ -39445,6 +39485,7 @@ var ts;
39445
39485
  name: "removeComments",
39446
39486
  type: "boolean",
39447
39487
  affectsEmit: true,
39488
+ affectsMultiFileEmitBuildInfo: true,
39448
39489
  showInSimplifiedHelpView: true,
39449
39490
  category: ts.Diagnostics.Emit,
39450
39491
  defaultValueDescription: false,
@@ -39463,6 +39504,7 @@ var ts;
39463
39504
  name: "importHelpers",
39464
39505
  type: "boolean",
39465
39506
  affectsEmit: true,
39507
+ affectsMultiFileEmitBuildInfo: true,
39466
39508
  category: ts.Diagnostics.Emit,
39467
39509
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
39468
39510
  defaultValueDescription: false,
@@ -39476,6 +39518,7 @@ var ts;
39476
39518
  })),
39477
39519
  affectsEmit: true,
39478
39520
  affectsSemanticDiagnostics: true,
39521
+ affectsMultiFileEmitBuildInfo: true,
39479
39522
  category: ts.Diagnostics.Emit,
39480
39523
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
39481
39524
  defaultValueDescription: 0 /* Remove */,
@@ -39484,6 +39527,7 @@ var ts;
39484
39527
  name: "downlevelIteration",
39485
39528
  type: "boolean",
39486
39529
  affectsEmit: true,
39530
+ affectsMultiFileEmitBuildInfo: true,
39487
39531
  category: ts.Diagnostics.Emit,
39488
39532
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
39489
39533
  defaultValueDescription: false,
@@ -39502,6 +39546,9 @@ var ts;
39502
39546
  type: "boolean",
39503
39547
  // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
39504
39548
  // The value of each strictFlag depends on own strictFlag value or this and never accessed directly.
39549
+ // But we need to store `strict` in builf info, even though it won't be examined directly, so that the
39550
+ // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly
39551
+ affectsMultiFileEmitBuildInfo: true,
39505
39552
  showInSimplifiedHelpView: true,
39506
39553
  category: ts.Diagnostics.Type_Checking,
39507
39554
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -39511,6 +39558,7 @@ var ts;
39511
39558
  name: "noImplicitAny",
39512
39559
  type: "boolean",
39513
39560
  affectsSemanticDiagnostics: true,
39561
+ affectsMultiFileEmitBuildInfo: true,
39514
39562
  strictFlag: true,
39515
39563
  category: ts.Diagnostics.Type_Checking,
39516
39564
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -39520,6 +39568,7 @@ var ts;
39520
39568
  name: "strictNullChecks",
39521
39569
  type: "boolean",
39522
39570
  affectsSemanticDiagnostics: true,
39571
+ affectsMultiFileEmitBuildInfo: true,
39523
39572
  strictFlag: true,
39524
39573
  category: ts.Diagnostics.Type_Checking,
39525
39574
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -39528,6 +39577,8 @@ var ts;
39528
39577
  {
39529
39578
  name: "strictFunctionTypes",
39530
39579
  type: "boolean",
39580
+ affectsSemanticDiagnostics: true,
39581
+ affectsMultiFileEmitBuildInfo: true,
39531
39582
  strictFlag: true,
39532
39583
  category: ts.Diagnostics.Type_Checking,
39533
39584
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -39536,6 +39587,8 @@ var ts;
39536
39587
  {
39537
39588
  name: "strictBindCallApply",
39538
39589
  type: "boolean",
39590
+ affectsSemanticDiagnostics: true,
39591
+ affectsMultiFileEmitBuildInfo: true,
39539
39592
  strictFlag: true,
39540
39593
  category: ts.Diagnostics.Type_Checking,
39541
39594
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -39545,6 +39598,7 @@ var ts;
39545
39598
  name: "strictPropertyInitialization",
39546
39599
  type: "boolean",
39547
39600
  affectsSemanticDiagnostics: true,
39601
+ affectsMultiFileEmitBuildInfo: true,
39548
39602
  strictFlag: true,
39549
39603
  category: ts.Diagnostics.Type_Checking,
39550
39604
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -39554,6 +39608,7 @@ var ts;
39554
39608
  name: "noImplicitThis",
39555
39609
  type: "boolean",
39556
39610
  affectsSemanticDiagnostics: true,
39611
+ affectsMultiFileEmitBuildInfo: true,
39557
39612
  strictFlag: true,
39558
39613
  category: ts.Diagnostics.Type_Checking,
39559
39614
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -39563,6 +39618,7 @@ var ts;
39563
39618
  name: "useUnknownInCatchVariables",
39564
39619
  type: "boolean",
39565
39620
  affectsSemanticDiagnostics: true,
39621
+ affectsMultiFileEmitBuildInfo: true,
39566
39622
  strictFlag: true,
39567
39623
  category: ts.Diagnostics.Type_Checking,
39568
39624
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -39572,6 +39628,8 @@ var ts;
39572
39628
  name: "alwaysStrict",
39573
39629
  type: "boolean",
39574
39630
  affectsSourceFile: true,
39631
+ affectsEmit: true,
39632
+ affectsMultiFileEmitBuildInfo: true,
39575
39633
  strictFlag: true,
39576
39634
  category: ts.Diagnostics.Type_Checking,
39577
39635
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -39582,6 +39640,7 @@ var ts;
39582
39640
  name: "noUnusedLocals",
39583
39641
  type: "boolean",
39584
39642
  affectsSemanticDiagnostics: true,
39643
+ affectsMultiFileEmitBuildInfo: true,
39585
39644
  category: ts.Diagnostics.Type_Checking,
39586
39645
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
39587
39646
  defaultValueDescription: false,
@@ -39590,6 +39649,7 @@ var ts;
39590
39649
  name: "noUnusedParameters",
39591
39650
  type: "boolean",
39592
39651
  affectsSemanticDiagnostics: true,
39652
+ affectsMultiFileEmitBuildInfo: true,
39593
39653
  category: ts.Diagnostics.Type_Checking,
39594
39654
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
39595
39655
  defaultValueDescription: false,
@@ -39598,6 +39658,7 @@ var ts;
39598
39658
  name: "exactOptionalPropertyTypes",
39599
39659
  type: "boolean",
39600
39660
  affectsSemanticDiagnostics: true,
39661
+ affectsMultiFileEmitBuildInfo: true,
39601
39662
  category: ts.Diagnostics.Type_Checking,
39602
39663
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
39603
39664
  defaultValueDescription: false,
@@ -39606,6 +39667,7 @@ var ts;
39606
39667
  name: "noImplicitReturns",
39607
39668
  type: "boolean",
39608
39669
  affectsSemanticDiagnostics: true,
39670
+ affectsMultiFileEmitBuildInfo: true,
39609
39671
  category: ts.Diagnostics.Type_Checking,
39610
39672
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
39611
39673
  defaultValueDescription: false,
@@ -39615,6 +39677,7 @@ var ts;
39615
39677
  type: "boolean",
39616
39678
  affectsBindDiagnostics: true,
39617
39679
  affectsSemanticDiagnostics: true,
39680
+ affectsMultiFileEmitBuildInfo: true,
39618
39681
  category: ts.Diagnostics.Type_Checking,
39619
39682
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
39620
39683
  defaultValueDescription: false,
@@ -39623,6 +39686,7 @@ var ts;
39623
39686
  name: "noUncheckedIndexedAccess",
39624
39687
  type: "boolean",
39625
39688
  affectsSemanticDiagnostics: true,
39689
+ affectsMultiFileEmitBuildInfo: true,
39626
39690
  category: ts.Diagnostics.Type_Checking,
39627
39691
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
39628
39692
  defaultValueDescription: false,
@@ -39631,6 +39695,7 @@ var ts;
39631
39695
  name: "noImplicitOverride",
39632
39696
  type: "boolean",
39633
39697
  affectsSemanticDiagnostics: true,
39698
+ affectsMultiFileEmitBuildInfo: true,
39634
39699
  category: ts.Diagnostics.Type_Checking,
39635
39700
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
39636
39701
  defaultValueDescription: false,
@@ -39638,6 +39703,8 @@ var ts;
39638
39703
  {
39639
39704
  name: "noPropertyAccessFromIndexSignature",
39640
39705
  type: "boolean",
39706
+ affectsSemanticDiagnostics: true,
39707
+ affectsMultiFileEmitBuildInfo: true,
39641
39708
  showInSimplifiedHelpView: false,
39642
39709
  category: ts.Diagnostics.Type_Checking,
39643
39710
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -39723,6 +39790,7 @@ var ts;
39723
39790
  name: "allowSyntheticDefaultImports",
39724
39791
  type: "boolean",
39725
39792
  affectsSemanticDiagnostics: true,
39793
+ affectsMultiFileEmitBuildInfo: true,
39726
39794
  category: ts.Diagnostics.Interop_Constraints,
39727
39795
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
39728
39796
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -39732,6 +39800,7 @@ var ts;
39732
39800
  type: "boolean",
39733
39801
  affectsSemanticDiagnostics: true,
39734
39802
  affectsEmit: true,
39803
+ affectsMultiFileEmitBuildInfo: true,
39735
39804
  showInSimplifiedHelpView: true,
39736
39805
  category: ts.Diagnostics.Interop_Constraints,
39737
39806
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -39748,6 +39817,7 @@ var ts;
39748
39817
  name: "allowUmdGlobalAccess",
39749
39818
  type: "boolean",
39750
39819
  affectsSemanticDiagnostics: true,
39820
+ affectsMultiFileEmitBuildInfo: true,
39751
39821
  category: ts.Diagnostics.Modules,
39752
39822
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
39753
39823
  defaultValueDescription: false,
@@ -39769,6 +39839,7 @@ var ts;
39769
39839
  name: "sourceRoot",
39770
39840
  type: "string",
39771
39841
  affectsEmit: true,
39842
+ affectsMultiFileEmitBuildInfo: true,
39772
39843
  paramType: ts.Diagnostics.LOCATION,
39773
39844
  category: ts.Diagnostics.Emit,
39774
39845
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -39777,6 +39848,7 @@ var ts;
39777
39848
  name: "mapRoot",
39778
39849
  type: "string",
39779
39850
  affectsEmit: true,
39851
+ affectsMultiFileEmitBuildInfo: true,
39780
39852
  paramType: ts.Diagnostics.LOCATION,
39781
39853
  category: ts.Diagnostics.Emit,
39782
39854
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -39785,6 +39857,7 @@ var ts;
39785
39857
  name: "inlineSourceMap",
39786
39858
  type: "boolean",
39787
39859
  affectsEmit: true,
39860
+ affectsMultiFileEmitBuildInfo: true,
39788
39861
  category: ts.Diagnostics.Emit,
39789
39862
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
39790
39863
  defaultValueDescription: false,
@@ -39793,6 +39866,7 @@ var ts;
39793
39866
  name: "inlineSources",
39794
39867
  type: "boolean",
39795
39868
  affectsEmit: true,
39869
+ affectsMultiFileEmitBuildInfo: true,
39796
39870
  category: ts.Diagnostics.Emit,
39797
39871
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
39798
39872
  defaultValueDescription: false,
@@ -39802,6 +39876,7 @@ var ts;
39802
39876
  name: "experimentalDecorators",
39803
39877
  type: "boolean",
39804
39878
  affectsSemanticDiagnostics: true,
39879
+ affectsMultiFileEmitBuildInfo: true,
39805
39880
  category: ts.Diagnostics.Language_and_Environment,
39806
39881
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
39807
39882
  defaultValueDescription: false,
@@ -39811,6 +39886,7 @@ var ts;
39811
39886
  type: "boolean",
39812
39887
  affectsSemanticDiagnostics: true,
39813
39888
  affectsEmit: true,
39889
+ affectsMultiFileEmitBuildInfo: true,
39814
39890
  category: ts.Diagnostics.Language_and_Environment,
39815
39891
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
39816
39892
  defaultValueDescription: false,
@@ -39835,6 +39911,7 @@ var ts;
39835
39911
  type: "string",
39836
39912
  affectsSemanticDiagnostics: true,
39837
39913
  affectsEmit: true,
39914
+ affectsMultiFileEmitBuildInfo: true,
39838
39915
  affectsModuleResolution: true,
39839
39916
  category: ts.Diagnostics.Language_and_Environment,
39840
39917
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -39852,6 +39929,9 @@ var ts;
39852
39929
  name: "out",
39853
39930
  type: "string",
39854
39931
  affectsEmit: true,
39932
+ affectsMultiFileEmitBuildInfo: true,
39933
+ affectsDeclarationPath: true,
39934
+ affectsBundleEmitBuildInfo: true,
39855
39935
  isFilePath: false,
39856
39936
  // for correct behaviour, please use outFile
39857
39937
  category: ts.Diagnostics.Backwards_Compatibility,
@@ -39863,6 +39943,7 @@ var ts;
39863
39943
  name: "reactNamespace",
39864
39944
  type: "string",
39865
39945
  affectsEmit: true,
39946
+ affectsMultiFileEmitBuildInfo: true,
39866
39947
  category: ts.Diagnostics.Language_and_Environment,
39867
39948
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
39868
39949
  defaultValueDescription: "`React`",
@@ -39870,6 +39951,8 @@ var ts;
39870
39951
  {
39871
39952
  name: "skipDefaultLibCheck",
39872
39953
  type: "boolean",
39954
+ // We need to store these to determine whether `lib` files need to be rechecked
39955
+ affectsMultiFileEmitBuildInfo: true,
39873
39956
  category: ts.Diagnostics.Completeness,
39874
39957
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
39875
39958
  defaultValueDescription: false,
@@ -39885,6 +39968,7 @@ var ts;
39885
39968
  name: "emitBOM",
39886
39969
  type: "boolean",
39887
39970
  affectsEmit: true,
39971
+ affectsMultiFileEmitBuildInfo: true,
39888
39972
  category: ts.Diagnostics.Emit,
39889
39973
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
39890
39974
  defaultValueDescription: false,
@@ -39896,6 +39980,7 @@ var ts;
39896
39980
  lf: 1 /* LineFeed */
39897
39981
  })),
39898
39982
  affectsEmit: true,
39983
+ affectsMultiFileEmitBuildInfo: true,
39899
39984
  paramType: ts.Diagnostics.NEWLINE,
39900
39985
  category: ts.Diagnostics.Emit,
39901
39986
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -39905,6 +39990,7 @@ var ts;
39905
39990
  name: "noErrorTruncation",
39906
39991
  type: "boolean",
39907
39992
  affectsSemanticDiagnostics: true,
39993
+ affectsMultiFileEmitBuildInfo: true,
39908
39994
  category: ts.Diagnostics.Output_Formatting,
39909
39995
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
39910
39996
  defaultValueDescription: false,
@@ -39935,6 +40021,7 @@ var ts;
39935
40021
  name: "stripInternal",
39936
40022
  type: "boolean",
39937
40023
  affectsEmit: true,
40024
+ affectsMultiFileEmitBuildInfo: true,
39938
40025
  category: ts.Diagnostics.Emit,
39939
40026
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
39940
40027
  defaultValueDescription: false,
@@ -39975,6 +40062,7 @@ var ts;
39975
40062
  name: "noImplicitUseStrict",
39976
40063
  type: "boolean",
39977
40064
  affectsSemanticDiagnostics: true,
40065
+ affectsMultiFileEmitBuildInfo: true,
39978
40066
  category: ts.Diagnostics.Backwards_Compatibility,
39979
40067
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
39980
40068
  defaultValueDescription: false,
@@ -39983,6 +40071,7 @@ var ts;
39983
40071
  name: "noEmitHelpers",
39984
40072
  type: "boolean",
39985
40073
  affectsEmit: true,
40074
+ affectsMultiFileEmitBuildInfo: true,
39986
40075
  category: ts.Diagnostics.Emit,
39987
40076
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
39988
40077
  defaultValueDescription: false,
@@ -39991,6 +40080,7 @@ var ts;
39991
40080
  name: "noEmitOnError",
39992
40081
  type: "boolean",
39993
40082
  affectsEmit: true,
40083
+ affectsMultiFileEmitBuildInfo: true,
39994
40084
  category: ts.Diagnostics.Emit,
39995
40085
  transpileOptionValue: undefined,
39996
40086
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -40000,6 +40090,7 @@ var ts;
40000
40090
  name: "preserveConstEnums",
40001
40091
  type: "boolean",
40002
40092
  affectsEmit: true,
40093
+ affectsMultiFileEmitBuildInfo: true,
40003
40094
  category: ts.Diagnostics.Emit,
40004
40095
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
40005
40096
  defaultValueDescription: false,
@@ -40008,6 +40099,8 @@ var ts;
40008
40099
  name: "declarationDir",
40009
40100
  type: "string",
40010
40101
  affectsEmit: true,
40102
+ affectsMultiFileEmitBuildInfo: true,
40103
+ affectsDeclarationPath: true,
40011
40104
  isFilePath: true,
40012
40105
  paramType: ts.Diagnostics.DIRECTORY,
40013
40106
  category: ts.Diagnostics.Emit,
@@ -40017,6 +40110,8 @@ var ts;
40017
40110
  {
40018
40111
  name: "skipLibCheck",
40019
40112
  type: "boolean",
40113
+ // We need to store these to determine whether `lib` files need to be rechecked
40114
+ affectsMultiFileEmitBuildInfo: true,
40020
40115
  category: ts.Diagnostics.Completeness,
40021
40116
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
40022
40117
  defaultValueDescription: false,
@@ -40026,6 +40121,7 @@ var ts;
40026
40121
  type: "boolean",
40027
40122
  affectsBindDiagnostics: true,
40028
40123
  affectsSemanticDiagnostics: true,
40124
+ affectsMultiFileEmitBuildInfo: true,
40029
40125
  category: ts.Diagnostics.Type_Checking,
40030
40126
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
40031
40127
  defaultValueDescription: undefined,
@@ -40035,6 +40131,7 @@ var ts;
40035
40131
  type: "boolean",
40036
40132
  affectsBindDiagnostics: true,
40037
40133
  affectsSemanticDiagnostics: true,
40134
+ affectsMultiFileEmitBuildInfo: true,
40038
40135
  category: ts.Diagnostics.Type_Checking,
40039
40136
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
40040
40137
  defaultValueDescription: undefined,
@@ -40043,6 +40140,7 @@ var ts;
40043
40140
  name: "suppressExcessPropertyErrors",
40044
40141
  type: "boolean",
40045
40142
  affectsSemanticDiagnostics: true,
40143
+ affectsMultiFileEmitBuildInfo: true,
40046
40144
  category: ts.Diagnostics.Backwards_Compatibility,
40047
40145
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
40048
40146
  defaultValueDescription: false,
@@ -40051,6 +40149,7 @@ var ts;
40051
40149
  name: "suppressImplicitAnyIndexErrors",
40052
40150
  type: "boolean",
40053
40151
  affectsSemanticDiagnostics: true,
40152
+ affectsMultiFileEmitBuildInfo: true,
40054
40153
  category: ts.Diagnostics.Backwards_Compatibility,
40055
40154
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
40056
40155
  defaultValueDescription: false,
@@ -40075,6 +40174,7 @@ var ts;
40075
40174
  name: "noStrictGenericChecks",
40076
40175
  type: "boolean",
40077
40176
  affectsSemanticDiagnostics: true,
40177
+ affectsMultiFileEmitBuildInfo: true,
40078
40178
  category: ts.Diagnostics.Backwards_Compatibility,
40079
40179
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
40080
40180
  defaultValueDescription: false,
@@ -40084,6 +40184,7 @@ var ts;
40084
40184
  type: "boolean",
40085
40185
  affectsSemanticDiagnostics: true,
40086
40186
  affectsEmit: true,
40187
+ affectsMultiFileEmitBuildInfo: true,
40087
40188
  category: ts.Diagnostics.Language_and_Environment,
40088
40189
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
40089
40190
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -40092,6 +40193,7 @@ var ts;
40092
40193
  name: "preserveValueImports",
40093
40194
  type: "boolean",
40094
40195
  affectsEmit: true,
40196
+ affectsMultiFileEmitBuildInfo: true,
40095
40197
  category: ts.Diagnostics.Emit,
40096
40198
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
40097
40199
  defaultValueDescription: false,
@@ -40135,6 +40237,8 @@ var ts;
40135
40237
  /* @internal */
40136
40238
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
40137
40239
  /* @internal */
40240
+ ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
40241
+ /* @internal */
40138
40242
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
40139
40243
  /* @internal */
40140
40244
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -40990,6 +41094,7 @@ var ts;
40990
41094
  return optionDefinition.type;
40991
41095
  }
40992
41096
  }
41097
+ /* @internal */
40993
41098
  function getNameOfCompilerOptionValue(value, customTypeMap) {
40994
41099
  // There is a typeMap associated with this command-line option so use it to map value back to its name
40995
41100
  return ts.forEachEntry(customTypeMap, function (mapValue, key) {
@@ -40998,6 +41103,7 @@ var ts;
40998
41103
  }
40999
41104
  });
41000
41105
  }
41106
+ ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
41001
41107
  function serializeCompilerOptions(options, pathOptions) {
41002
41108
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
41003
41109
  }
@@ -65310,20 +65416,6 @@ var ts;
65310
65416
  }
65311
65417
  }
65312
65418
  }
65313
- if (relation === comparableRelation && sourceFlags & 262144 /* TypeParameter */) {
65314
- // This is a carve-out in comparability to essentially forbid comparing a type parameter
65315
- // with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!)
65316
- var constraint = getConstraintOfTypeParameter(source);
65317
- if (constraint && hasNonCircularBaseConstraint(source)) {
65318
- while (constraint && constraint.flags & 262144 /* TypeParameter */) {
65319
- if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false)) {
65320
- return result;
65321
- }
65322
- constraint = getConstraintOfTypeParameter(constraint);
65323
- }
65324
- }
65325
- return 0 /* False */;
65326
- }
65327
65419
  }
65328
65420
  else if (targetFlags & 4194304 /* Index */) {
65329
65421
  var targetType_1 = target.type;
@@ -65527,7 +65619,7 @@ var ts;
65527
65619
  if (sourceFlags & 8650752 /* TypeVariable */) {
65528
65620
  // IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
65529
65621
  if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
65530
- var constraint = getConstraintOfType(source) || unknownType;
65622
+ var constraint = getConstraintOfType(source);
65531
65623
  if (!strictNullChecks && (!constraint || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */))) {
65532
65624
  // A type variable with no constraint is not related to the non-primitive object type.
65533
65625
  if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
@@ -65536,12 +65628,12 @@ var ts;
65536
65628
  }
65537
65629
  }
65538
65630
  // hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed
65539
- else if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
65631
+ else if (constraint && (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState))) {
65540
65632
  resetErrorInfo(saveErrorInfo);
65541
65633
  return result;
65542
65634
  }
65543
65635
  // slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
65544
- else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
65636
+ else if (constraint && (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState))) {
65545
65637
  resetErrorInfo(saveErrorInfo);
65546
65638
  return result;
65547
65639
  }
@@ -75595,8 +75687,14 @@ var ts;
75595
75687
  var parameterRange = hasRestParameter ? min
75596
75688
  : min < max ? min + "-" + max
75597
75689
  : min;
75598
- var error = hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1
75599
- : parameterRange === 1 && args.length === 0 && isPromiseResolveArityError(node) ? ts.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise
75690
+ var isVoidPromiseError = !hasRestParameter && parameterRange === 1 && args.length === 0 && isPromiseResolveArityError(node);
75691
+ if (isVoidPromiseError && ts.isInJSFile(node)) {
75692
+ return getDiagnosticForCallNode(node, ts.Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments);
75693
+ }
75694
+ var error = hasRestParameter
75695
+ ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1
75696
+ : isVoidPromiseError
75697
+ ? ts.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise
75600
75698
  : ts.Diagnostics.Expected_0_arguments_but_got_1;
75601
75699
  if (min < args.length && args.length < max) {
75602
75700
  // between min and max, but with no matching overload
@@ -82648,7 +82746,7 @@ var ts;
82648
82746
  }
82649
82747
  var yieldType = getIterationTypeOfIterable(use, 0 /* Yield */, inputType, /*errorNode*/ undefined);
82650
82748
  if (yieldType) {
82651
- return [ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators, false];
82749
+ return [ts.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, false];
82652
82750
  }
82653
82751
  if (isES2015OrLaterIterable((_a = inputType.symbol) === null || _a === void 0 ? void 0 : _a.escapedName)) {
82654
82752
  return [ts.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, true];
@@ -85925,7 +86023,7 @@ var ts;
85925
86023
  var symbol = getIntrinsicTagSymbol(name.parent);
85926
86024
  return symbol === unknownSymbol ? undefined : symbol;
85927
86025
  }
85928
- var result = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ !isJSDoc_1, ts.getHostSignatureFromJSDoc(name));
86026
+ var result = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /* dontResolveAlias */ true, ts.getHostSignatureFromJSDoc(name));
85929
86027
  if (!result && isJSDoc_1) {
85930
86028
  var container = ts.findAncestor(name, ts.or(ts.isClassLike, ts.isInterfaceDeclaration));
85931
86029
  if (container) {
@@ -87782,6 +87880,9 @@ var ts;
87782
87880
  return ts.some(types, checkGrammarExpressionWithTypeArguments);
87783
87881
  }
87784
87882
  function checkGrammarExpressionWithTypeArguments(node) {
87883
+ if (ts.isExpressionWithTypeArguments(node) && ts.isImportKeyword(node.expression) && node.typeArguments) {
87884
+ return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
87885
+ }
87785
87886
  return checkGrammarTypeArguments(node, node.typeArguments);
87786
87887
  }
87787
87888
  function checkGrammarClassDeclarationHeritageClauses(node) {
@@ -88723,7 +88824,7 @@ var ts;
88723
88824
  return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node12_or_nodenext);
88724
88825
  }
88725
88826
  if (node.typeArguments) {
88726
- return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_import_cannot_have_type_arguments);
88827
+ return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
88727
88828
  }
88728
88829
  var nodeArguments = node.arguments;
88729
88830
  if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) {
@@ -108519,6 +108620,8 @@ var ts;
108519
108620
  var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
108520
108621
  errorFallbackNode = undefined;
108521
108622
  var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* Const */));
108623
+ preserveJsDoc(statement, input);
108624
+ ts.removeAllComments(input);
108522
108625
  return [statement, factory.updateExportAssignment(input, input.decorators, input.modifiers, newId)];
108523
108626
  }
108524
108627
  }
@@ -109854,7 +109957,8 @@ var ts;
109854
109957
  return;
109855
109958
  }
109856
109959
  var version = ts.version; // Extracted into a const so the form is stable between namespace and module
109857
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), /*writeByteOrderMark*/ false);
109960
+ var buildInfo = { bundle: bundle, program: program, version: version };
109961
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
109858
109962
  }
109859
109963
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
109860
109964
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -110008,13 +110112,18 @@ var ts;
110008
110112
  if (sourceMapFilePath) {
110009
110113
  var sourceMap = sourceMapGenerator.toString();
110010
110114
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110115
+ if (printer.bundleFileInfo)
110116
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
110011
110117
  }
110012
110118
  }
110013
110119
  else {
110014
110120
  writer.writeLine();
110015
110121
  }
110016
110122
  // Write the output file
110017
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110123
+ var text = writer.getText();
110124
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110125
+ if (printer.bundleFileInfo)
110126
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
110018
110127
  // Reset state
110019
110128
  writer.clear();
110020
110129
  }
@@ -110157,34 +110266,54 @@ var ts;
110157
110266
  }
110158
110267
  /*@internal*/
110159
110268
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
110269
+ var createHash = ts.maybeBind(host, host.createHash);
110160
110270
  var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
110161
- var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
110162
- if (!buildInfoText)
110271
+ var buildInfo;
110272
+ if (host.getBuildInfo) {
110273
+ var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
110274
+ if (!hostBuildInfo)
110275
+ return buildInfoPath;
110276
+ buildInfo = hostBuildInfo;
110277
+ }
110278
+ else {
110279
+ var buildInfoText = host.readFile(buildInfoPath);
110280
+ if (!buildInfoText)
110281
+ return buildInfoPath;
110282
+ buildInfo = getBuildInfo(buildInfoText);
110283
+ }
110284
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
110163
110285
  return buildInfoPath;
110164
110286
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
110165
110287
  if (!jsFileText)
110166
110288
  return jsFilePath;
110289
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
110290
+ return jsFilePath;
110167
110291
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
110168
110292
  // error if no source map or for now if inline sourcemap
110169
110293
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
110170
110294
  return sourceMapFilePath || "inline sourcemap decoding";
110295
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
110296
+ return sourceMapFilePath;
110171
110297
  // read declaration text
110172
110298
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
110173
110299
  if (declarationFilePath && !declarationText)
110174
110300
  return declarationFilePath;
110301
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
110302
+ return declarationFilePath;
110175
110303
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
110176
110304
  // error if no source map or for now if inline sourcemap
110177
110305
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
110178
110306
  return declarationMapPath || "inline sourcemap decoding";
110179
- var buildInfo = getBuildInfo(buildInfoText);
110180
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
110181
- return buildInfoPath;
110307
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
110308
+ return declarationMapPath;
110182
110309
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110183
110310
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
110184
110311
  /*onlyOwnText*/ true);
110185
110312
  var outputFiles = [];
110186
110313
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
110187
110314
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
110315
+ var changedDtsText;
110316
+ var changedDtsData;
110188
110317
  var emitHost = {
110189
110318
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
110190
110319
  getCanonicalFileName: host.getCanonicalFileName,
@@ -110200,7 +110329,7 @@ var ts;
110200
110329
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
110201
110330
  getProjectReferenceRedirect: ts.returnUndefined,
110202
110331
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
110203
- writeFile: function (name, text, writeByteOrderMark) {
110332
+ writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
110204
110333
  switch (name) {
110205
110334
  case jsFilePath:
110206
110335
  if (jsFileText === text)
@@ -110211,8 +110340,13 @@ var ts;
110211
110340
  return;
110212
110341
  break;
110213
110342
  case buildInfoPath:
110214
- var newBuildInfo = getBuildInfo(text);
110343
+ var newBuildInfo = data.buildInfo;
110215
110344
  newBuildInfo.program = buildInfo.program;
110345
+ if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
110346
+ // Update the output signature
110347
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
110348
+ newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
110349
+ }
110216
110350
  // Update sourceFileInfo
110217
110351
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
110218
110352
  newBuildInfo.bundle.js.sources = js.sources;
@@ -110220,11 +110354,13 @@ var ts;
110220
110354
  newBuildInfo.bundle.dts.sources = dts.sources;
110221
110355
  }
110222
110356
  newBuildInfo.bundle.sourceFiles = sourceFiles;
110223
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
110357
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
110224
110358
  return;
110225
110359
  case declarationFilePath:
110226
110360
  if (declarationText === text)
110227
110361
  return;
110362
+ changedDtsText = text;
110363
+ changedDtsData = data;
110228
110364
  break;
110229
110365
  case declarationMapPath:
110230
110366
  if (declarationMapText === text)
@@ -110243,6 +110379,7 @@ var ts;
110243
110379
  getSourceFileFromReference: ts.returnUndefined,
110244
110380
  redirectTargetsMap: ts.createMultiMap(),
110245
110381
  getFileIncludeReasons: ts.notImplemented,
110382
+ createHash: createHash,
110246
110383
  };
110247
110384
  emitFiles(ts.notImplementedResolver, emitHost,
110248
110385
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
@@ -115327,12 +115464,10 @@ var ts;
115327
115464
  }
115328
115465
  ts.createCompilerHost = createCompilerHost;
115329
115466
  /*@internal*/
115330
- // TODO(shkamat): update this after reworking ts build API
115331
115467
  function createCompilerHostWorker(options, setParentNodes, system) {
115332
115468
  if (system === void 0) { system = ts.sys; }
115333
115469
  var existingDirectories = new ts.Map();
115334
115470
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
115335
- var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
115336
115471
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
115337
115472
  var text;
115338
115473
  try {
@@ -115365,7 +115500,7 @@ var ts;
115365
115500
  // NOTE: If patchWriteFileEnsuringDirectory has been called,
115366
115501
  // the system.writeFile will do its own directory creation and
115367
115502
  // the ensureDirectoriesExist call will always be redundant.
115368
- 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); });
115503
+ 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); });
115369
115504
  ts.performance.mark("afterIOWrite");
115370
115505
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
115371
115506
  }
@@ -115375,35 +115510,6 @@ var ts;
115375
115510
  }
115376
115511
  }
115377
115512
  }
115378
- var outputFingerprints;
115379
- function writeFileWorker(fileName, data, writeByteOrderMark) {
115380
- if (!ts.isWatchSet(options) || !system.getModifiedTime) {
115381
- system.writeFile(fileName, data, writeByteOrderMark);
115382
- return;
115383
- }
115384
- if (!outputFingerprints) {
115385
- outputFingerprints = new ts.Map();
115386
- }
115387
- var hash = computeHash(data);
115388
- var mtimeBefore = system.getModifiedTime(fileName);
115389
- if (mtimeBefore) {
115390
- var fingerprint = outputFingerprints.get(fileName);
115391
- // If output has not been changed, and the file has no external modification
115392
- if (fingerprint &&
115393
- fingerprint.byteOrderMark === writeByteOrderMark &&
115394
- fingerprint.hash === hash &&
115395
- fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
115396
- return;
115397
- }
115398
- }
115399
- system.writeFile(fileName, data, writeByteOrderMark);
115400
- var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
115401
- outputFingerprints.set(fileName, {
115402
- hash: hash,
115403
- byteOrderMark: writeByteOrderMark,
115404
- mtime: mtimeAfter
115405
- });
115406
- }
115407
115513
  function getDefaultLibLocation() {
115408
115514
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
115409
115515
  }
@@ -116955,6 +117061,7 @@ var ts;
116955
117061
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
116956
117062
  redirectTargetsMap: redirectTargetsMap,
116957
117063
  getFileIncludeReasons: program.getFileIncludeReasons,
117064
+ createHash: ts.maybeBind(host, host.createHash),
116958
117065
  };
116959
117066
  }
116960
117067
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -119068,13 +119175,9 @@ var ts;
119068
119175
  function createManyToManyPathMap() {
119069
119176
  function create(forward, reverse, deleted) {
119070
119177
  var map = {
119071
- clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119072
- forEach: function (fn) { return forward.forEach(fn); },
119073
119178
  getKeys: function (v) { return reverse.get(v); },
119074
119179
  getValues: function (k) { return forward.get(k); },
119075
- hasKey: function (k) { return forward.has(k); },
119076
119180
  keys: function () { return forward.keys(); },
119077
- deletedKeys: function () { return deleted; },
119078
119181
  deleteKey: function (k) {
119079
119182
  (deleted || (deleted = new ts.Set())).add(k);
119080
119183
  var set = forward.get(k);
@@ -119101,11 +119204,6 @@ var ts;
119101
119204
  });
119102
119205
  return map;
119103
119206
  },
119104
- clear: function () {
119105
- forward.clear();
119106
- reverse.clear();
119107
- deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119108
- }
119109
119207
  };
119110
119208
  return map;
119111
119209
  }
@@ -119233,18 +119331,21 @@ var ts;
119233
119331
  * Creates the state of file references and signature for the new program from oldState if it is safe
119234
119332
  */
119235
119333
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119334
+ var _a, _b, _c;
119236
119335
  var fileInfos = new ts.Map();
119237
119336
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
119238
119337
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
119239
- var hasCalledUpdateShapeSignature = new ts.Set();
119240
119338
  var useOldState = canReuseOldState(referencedMap, oldState);
119241
119339
  // Ensure source files have parent pointers set
119242
119340
  newProgram.getTypeChecker();
119243
119341
  // Create the reference map, and set the file infos
119244
- for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
119245
- var sourceFile = _a[_i];
119342
+ for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
119343
+ var sourceFile = _d[_i];
119246
119344
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
119247
- var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
119345
+ var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
119346
+ var signature = oldUncommitedSignature === undefined ?
119347
+ useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
119348
+ oldUncommitedSignature || undefined;
119248
119349
  if (referencedMap) {
119249
119350
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
119250
119351
  if (newReferences) {
@@ -119252,19 +119353,26 @@ var ts;
119252
119353
  }
119253
119354
  // Copy old visible to outside files map
119254
119355
  if (useOldState) {
119255
- var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
119356
+ var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
119357
+ var exportedModules = oldUncommitedExportedModules === undefined ?
119358
+ oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
119359
+ oldUncommitedExportedModules || undefined;
119256
119360
  if (exportedModules) {
119257
119361
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119258
119362
  }
119259
119363
  }
119260
119364
  }
119261
- fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
119365
+ fileInfos.set(sourceFile.resolvedPath, {
119366
+ version: version_2,
119367
+ signature: signature,
119368
+ affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
119369
+ impliedFormat: sourceFile.impliedNodeFormat
119370
+ });
119262
119371
  }
119263
119372
  return {
119264
119373
  fileInfos: fileInfos,
119265
119374
  referencedMap: referencedMap,
119266
119375
  exportedModulesMap: exportedModulesMap,
119267
- hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
119268
119376
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
119269
119377
  };
119270
119378
  }
@@ -119278,71 +119386,42 @@ var ts;
119278
119386
  }
119279
119387
  BuilderState.releaseCache = releaseCache;
119280
119388
  /**
119281
- * Creates a clone of the state
119389
+ * Gets the files affected by the path from the program
119282
119390
  */
119283
- function clone(state) {
119391
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
119284
119392
  var _a, _b;
119285
- // Dont need to backup allFiles info since its cache anyway
119286
- return {
119287
- fileInfos: new ts.Map(state.fileInfos),
119288
- referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
119289
- exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
119290
- hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
119291
- useFileVersionAsSignature: state.useFileVersionAsSignature,
119292
- };
119393
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
119394
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119395
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119396
+ return result;
119293
119397
  }
119294
- BuilderState.clone = clone;
119295
- /**
119296
- * Gets the files affected by the path from the program
119297
- */
119298
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
119299
- // Since the operation could be cancelled, the signatures are always stored in the cache
119300
- // They will be committed once it is safe to use them
119301
- // eg when calling this api from tsserver, if there is no cancellation of the operation
119302
- // In the other cases the affected files signatures are committed only after the iteration through the result is complete
119303
- var signatureCache = cacheToUpdateSignature || new ts.Map();
119398
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119399
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
119304
119400
  var sourceFile = programOfThisState.getSourceFileByPath(path);
119305
119401
  if (!sourceFile) {
119306
119402
  return ts.emptyArray;
119307
119403
  }
119308
- if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
119404
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
119309
119405
  return [sourceFile];
119310
119406
  }
119311
- var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
119312
- if (!cacheToUpdateSignature) {
119313
- // Commit all the signatures in the signature cache
119314
- updateSignaturesFromCache(state, signatureCache);
119315
- }
119316
- return result;
119407
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
119317
119408
  }
119318
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119319
- /**
119320
- * Updates the signatures from the cache into state's fileinfo signatures
119321
- * This should be called whenever it is safe to commit the state of the builder
119322
- */
119323
- function updateSignaturesFromCache(state, signatureCache) {
119324
- signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
119325
- }
119326
- BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
119409
+ BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
119327
119410
  function updateSignatureOfFile(state, signature, path) {
119328
119411
  state.fileInfos.get(path).signature = signature;
119329
- state.hasCalledUpdateShapeSignature.add(path);
119412
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
119330
119413
  }
119331
119414
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
119332
119415
  /**
119333
119416
  * Returns if the shape of the signature has changed since last emit
119334
119417
  */
119335
- function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
119418
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
119419
+ var _a;
119336
119420
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
119337
- ts.Debug.assert(!!sourceFile);
119338
- ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
119339
119421
  // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
119340
- if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
119422
+ if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
119341
119423
  return false;
119342
- }
119343
119424
  var info = state.fileInfos.get(sourceFile.resolvedPath);
119344
- if (!info)
119345
- return ts.Debug.fail();
119346
119425
  var prevSignature = info.signature;
119347
119426
  var latestSignature;
119348
119427
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -119353,45 +119432,55 @@ var ts;
119353
119432
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119354
119433
  if (firstDts_1) {
119355
119434
  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; })); });
119356
- latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119357
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119358
- updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
119435
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
119436
+ if (latestSignature !== prevSignature) {
119437
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
119359
119438
  }
119360
119439
  }
119361
119440
  }
119362
119441
  // Default is to use file version as signature
119363
119442
  if (latestSignature === undefined) {
119364
119443
  latestSignature = sourceFile.version;
119365
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119444
+ if (state.exportedModulesMap && latestSignature !== prevSignature) {
119445
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119366
119446
  // All the references in this file are exported
119367
119447
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
119368
119448
  if (references) {
119369
- exportedModulesMapCache.set(sourceFile.resolvedPath, references);
119449
+ state.exportedModulesMap.set(sourceFile.resolvedPath, references);
119370
119450
  }
119371
119451
  else {
119372
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119452
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119373
119453
  }
119374
119454
  }
119375
119455
  }
119376
- cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
119456
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
119457
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
119458
+ info.signature = latestSignature;
119377
119459
  return latestSignature !== prevSignature;
119378
119460
  }
119379
119461
  BuilderState.updateShapeSignature = updateShapeSignature;
119462
+ function computeSignature(text, computeHash) {
119463
+ return (computeHash || ts.generateDjb2Hash)(text);
119464
+ }
119465
+ BuilderState.computeSignature = computeSignature;
119380
119466
  /**
119381
119467
  * Coverts the declaration emit result into exported modules map
119382
119468
  */
119383
- function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
119469
+ function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
119470
+ if (!state.exportedModulesMap)
119471
+ return;
119472
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119384
119473
  if (!exportedModulesFromDeclarationEmit) {
119385
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119474
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119386
119475
  return;
119387
119476
  }
119388
119477
  var exportedModules;
119389
119478
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
119390
119479
  if (exportedModules) {
119391
- exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
119480
+ state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119392
119481
  }
119393
119482
  else {
119394
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119483
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119395
119484
  }
119396
119485
  function addExportedModule(exportedModulePaths) {
119397
119486
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -119403,19 +119492,6 @@ var ts;
119403
119492
  }
119404
119493
  }
119405
119494
  BuilderState.updateExportedModules = updateExportedModules;
119406
- /**
119407
- * Updates the exported modules from cache into state's exported modules map
119408
- * This should be called whenever it is safe to commit the state of the builder
119409
- */
119410
- function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
119411
- var _a;
119412
- if (exportedModulesMapCache) {
119413
- ts.Debug.assert(!!state.exportedModulesMap);
119414
- (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
119415
- exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
119416
- }
119417
- }
119418
- BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
119419
119495
  /**
119420
119496
  * Get all the dependencies of the sourceFile
119421
119497
  */
@@ -119536,7 +119612,7 @@ var ts;
119536
119612
  /**
119537
119613
  * When program emits modular code, gets the files affected by the sourceFile whose shape has changed
119538
119614
  */
119539
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
119615
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
119540
119616
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
119541
119617
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
119542
119618
  }
@@ -119556,7 +119632,7 @@ var ts;
119556
119632
  if (!seenFileNamesMap.has(currentPath)) {
119557
119633
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
119558
119634
  seenFileNamesMap.set(currentPath, currentSourceFile);
119559
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
119635
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
119560
119636
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
119561
119637
  }
119562
119638
  }
@@ -119582,32 +119658,33 @@ var ts;
119582
119658
  * Create the state so that we can iterate on changedFiles/affected files
119583
119659
  */
119584
119660
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119661
+ var _a, _b;
119585
119662
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
119586
119663
  state.program = newProgram;
119587
119664
  var compilerOptions = newProgram.getCompilerOptions();
119588
119665
  state.compilerOptions = compilerOptions;
119666
+ var outFilePath = ts.outFile(compilerOptions);
119589
119667
  // With --out or --outFile, any change affects all semantic diagnostics so no need to cache them
119590
- if (!ts.outFile(compilerOptions)) {
119668
+ if (!outFilePath) {
119591
119669
  state.semanticDiagnosticsPerFile = new ts.Map();
119592
119670
  }
119671
+ 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)) {
119672
+ state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
119673
+ }
119593
119674
  state.changedFilesSet = new ts.Set();
119675
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
119594
119676
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
119595
119677
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
119596
119678
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
119597
119679
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
119680
+ var canCopyEmitSignatures = compilerOptions.composite &&
119681
+ (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
119682
+ !outFilePath &&
119683
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
119598
119684
  if (useOldState) {
119599
- // Verify the sanity of old state
119600
- if (!oldState.currentChangedFilePath) {
119601
- var affectedSignatures = oldState.currentAffectedFilesSignatures;
119602
- ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
119603
- }
119604
- var changedFilesSet = oldState.changedFilesSet;
119605
- if (canCopySemanticDiagnostics) {
119606
- ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
119607
- }
119608
119685
  // Copy old state's changed files set
119609
- changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
119610
- if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
119686
+ (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
119687
+ if (!outFilePath && oldState.affectedFilesPendingEmit) {
119611
119688
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
119612
119689
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
119613
119690
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -119628,6 +119705,8 @@ var ts;
119628
119705
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
119629
119706
  // versions dont match
119630
119707
  oldInfo.version !== info.version ||
119708
+ // Implied formats dont match
119709
+ oldInfo.impliedFormat !== info.impliedFormat ||
119631
119710
  // Referenced files changed
119632
119711
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
119633
119712
  // Referenced file was deleted in the new program
@@ -119651,27 +119730,25 @@ var ts;
119651
119730
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
119652
119731
  }
119653
119732
  }
119733
+ if (canCopyEmitSignatures) {
119734
+ var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
119735
+ if (oldEmitSignature)
119736
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
119737
+ }
119654
119738
  });
119655
119739
  // If the global file is removed, add all files as changed
119656
119740
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
119657
119741
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, /*firstSourceFile*/ undefined)
119658
119742
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
119659
119743
  }
119660
- else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
119744
+ else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
119661
119745
  // Add all files to affectedFilesPendingEmit since emit changed
119662
119746
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1 /* Full */); });
119663
119747
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
119664
119748
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
119665
119749
  }
119666
- if (useOldState) {
119667
- // Any time the interpretation of a source file changes, mark it as changed
119668
- ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
119669
- if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
119670
- state.changedFilesSet.add(sourceFilePath);
119671
- }
119672
- });
119673
- }
119674
- state.buildInfoEmitPending = !!state.changedFilesSet.size;
119750
+ // Since old states change files set is copied, any additional change means we would need to emit build info
119751
+ state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
119675
119752
  return state;
119676
119753
  }
119677
119754
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -119707,30 +119784,35 @@ var ts;
119707
119784
  ts.BuilderState.releaseCache(state);
119708
119785
  state.program = undefined;
119709
119786
  }
119710
- /**
119711
- * Creates a clone of the state
119712
- */
119713
- function cloneBuilderProgramState(state) {
119714
- var _a;
119715
- var newState = ts.BuilderState.clone(state);
119716
- newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
119717
- newState.changedFilesSet = new ts.Set(state.changedFilesSet);
119718
- newState.affectedFiles = state.affectedFiles;
119719
- newState.affectedFilesIndex = state.affectedFilesIndex;
119720
- newState.currentChangedFilePath = state.currentChangedFilePath;
119721
- newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
119722
- newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
119723
- newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
119724
- newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
119725
- newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
119726
- newState.program = state.program;
119727
- newState.compilerOptions = state.compilerOptions;
119728
- newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
119729
- newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
119730
- newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
119731
- newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
119732
- newState.programEmitComplete = state.programEmitComplete;
119733
- return newState;
119787
+ function backupEmitBuilderProgramState(state) {
119788
+ var outFilePath = ts.outFile(state.compilerOptions);
119789
+ // Only in --out changeFileSet is kept around till emit
119790
+ ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
119791
+ return {
119792
+ affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
119793
+ affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
119794
+ affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
119795
+ seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
119796
+ programEmitComplete: state.programEmitComplete,
119797
+ emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
119798
+ outSignature: state.outSignature,
119799
+ dtsChangeTime: state.dtsChangeTime,
119800
+ hasChangedEmitSignature: state.hasChangedEmitSignature,
119801
+ changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
119802
+ };
119803
+ }
119804
+ function restoreEmitBuilderProgramState(state, backupEmitState) {
119805
+ state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
119806
+ state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
119807
+ state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
119808
+ state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
119809
+ state.programEmitComplete = backupEmitState.programEmitComplete;
119810
+ state.emitSignatures = backupEmitState.emitSignatures;
119811
+ state.outSignature = backupEmitState.outSignature;
119812
+ state.dtsChangeTime = backupEmitState.dtsChangeTime;
119813
+ state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
119814
+ if (backupEmitState.changedFilesSet)
119815
+ state.changedFilesSet = backupEmitState.changedFilesSet;
119734
119816
  }
119735
119817
  /**
119736
119818
  * Verifies that source file is ok to be used in calls that arent handled by next
@@ -119745,7 +119827,7 @@ var ts;
119745
119827
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
119746
119828
  */
119747
119829
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
119748
- var _a;
119830
+ var _a, _b;
119749
119831
  while (true) {
119750
119832
  var affectedFiles = state.affectedFiles;
119751
119833
  if (affectedFiles) {
@@ -119765,10 +119847,8 @@ var ts;
119765
119847
  state.changedFilesSet.delete(state.currentChangedFilePath);
119766
119848
  state.currentChangedFilePath = undefined;
119767
119849
  // Commit the changes in file signature
119768
- ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
119769
- state.currentAffectedFilesSignatures.clear();
119770
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
119771
- (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
119850
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119851
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119772
119852
  state.affectedFiles = undefined;
119773
119853
  }
119774
119854
  // Get next changed file
@@ -119786,12 +119866,7 @@ var ts;
119786
119866
  return program;
119787
119867
  }
119788
119868
  // Get next batch of affected files
119789
- if (!state.currentAffectedFilesSignatures)
119790
- state.currentAffectedFilesSignatures = new ts.Map();
119791
- if (state.exportedModulesMap) {
119792
- state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
119793
- }
119794
- state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
119869
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
119795
119870
  state.currentChangedFilePath = nextKey.value;
119796
119871
  state.affectedFilesIndex = 0;
119797
119872
  if (!state.seenAffectedFiles)
@@ -119843,7 +119918,6 @@ var ts;
119843
119918
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
119844
119919
  */
119845
119920
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
119846
- var _a;
119847
119921
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
119848
119922
  // If affected files is everything except default library, then nothing more to do
119849
119923
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -119851,10 +119925,9 @@ var ts;
119851
119925
  // When a change affects the global scope, all files are considered to be affected without updating their signature
119852
119926
  // That means when affected file is handled, its signature can be out of date
119853
119927
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
119854
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
119928
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
119855
119929
  return;
119856
119930
  }
119857
- 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);
119858
119931
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
119859
119932
  return;
119860
119933
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -119874,7 +119947,7 @@ var ts;
119874
119947
  // This ensures that we dont later during incremental builds considering wrong signature.
119875
119948
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
119876
119949
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
119877
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
119950
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
119878
119951
  // If not dts emit, nothing more to do
119879
119952
  if (ts.getEmitDeclarations(state.compilerOptions)) {
119880
119953
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -119895,27 +119968,10 @@ var ts;
119895
119968
  return !state.semanticDiagnosticsFromOldState.size;
119896
119969
  }
119897
119970
  function isChangedSignature(state, path) {
119898
- var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
119899
- var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
119971
+ var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
119972
+ var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
119900
119973
  return newSignature !== oldSignature;
119901
119974
  }
119902
- function forEachKeyOfExportedModulesMap(state, filePath, fn) {
119903
- // Go through exported modules from cache first
119904
- var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
119905
- var result = keys && ts.forEachKey(keys, fn);
119906
- if (result)
119907
- return result;
119908
- // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
119909
- keys = state.exportedModulesMap.getKeys(filePath);
119910
- return keys && ts.forEachKey(keys, function (exportedFromPath) {
119911
- var _a;
119912
- // If the cache had an updated value, skip
119913
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
119914
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
119915
- fn(exportedFromPath) :
119916
- undefined;
119917
- });
119918
- }
119919
119975
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
119920
119976
  var _a;
119921
119977
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -119930,6 +119986,7 @@ var ts;
119930
119986
  * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
119931
119987
  */
119932
119988
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
119989
+ var _a;
119933
119990
  // If there was change in signature (dts output) for the changed file,
119934
119991
  // then only we need to handle pending file emit
119935
119992
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
@@ -119956,11 +120013,10 @@ var ts;
119956
120013
  }
119957
120014
  }
119958
120015
  }
119959
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
119960
120016
  var seenFileAndExportsOfFile = new ts.Set();
119961
120017
  // Go through exported modules from cache first
119962
120018
  // If exported modules has path, all files referencing file exported from are affected
119963
- forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
120019
+ (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
119964
120020
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
119965
120021
  return true;
119966
120022
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -119974,19 +120030,18 @@ var ts;
119974
120030
  * return true when all work is done and we can exit handling dts emit and semantic diagnostics
119975
120031
  */
119976
120032
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
119977
- var _a;
120033
+ var _a, _b;
119978
120034
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
119979
120035
  return undefined;
119980
120036
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
119981
120037
  return true;
119982
120038
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
119983
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
119984
120039
  // If exported modules has path, all files referencing file exported from are affected
119985
- forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
120040
+ (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
119986
120041
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
119987
120042
  });
119988
120043
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
119989
- (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
120044
+ (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
119990
120045
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
119991
120046
  handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
119992
120047
  state, referencingFilePath, cancellationToken, computeHash, host);
@@ -120007,12 +120062,13 @@ var ts;
120007
120062
  }
120008
120063
  else {
120009
120064
  state.seenAffectedFiles.add(affected.resolvedPath);
120065
+ // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted
120066
+ state.buildInfoEmitPending = true;
120010
120067
  if (emitKind !== undefined) {
120011
120068
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
120012
120069
  }
120013
120070
  if (isPendingEmit) {
120014
120071
  state.affectedFilesPendingEmitIndex++;
120015
- state.buildInfoEmitPending = true;
120016
120072
  }
120017
120073
  else {
120018
120074
  state.affectedFilesIndex++;
@@ -120060,25 +120116,61 @@ var ts;
120060
120116
  }
120061
120117
  return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
120062
120118
  }
120119
+ function isProgramBundleEmitBuildInfo(info) {
120120
+ return !!ts.outFile(info.options || {});
120121
+ }
120122
+ ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
120063
120123
  /**
120064
120124
  * Gets the program information to be emitted in buildInfo so that we can use it to create new program
120065
120125
  */
120066
- function getProgramBuildInfo(state, getCanonicalFileName) {
120067
- if (ts.outFile(state.compilerOptions))
120068
- return undefined;
120126
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
120127
+ var outFilePath = ts.outFile(state.compilerOptions);
120128
+ if (outFilePath && !state.compilerOptions.composite)
120129
+ return;
120069
120130
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
120070
120131
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
120132
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
120133
+ if (outFilePath) {
120134
+ var fileNames_1 = [];
120135
+ var fileInfos_1 = [];
120136
+ state.program.getRootFileNames().forEach(function (f) {
120137
+ var sourceFile = state.program.getSourceFile(f);
120138
+ if (!sourceFile)
120139
+ return;
120140
+ fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
120141
+ fileInfos_1.push(sourceFile.version);
120142
+ });
120143
+ var result_15 = {
120144
+ fileNames: fileNames_1,
120145
+ fileInfos: fileInfos_1,
120146
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
120147
+ outSignature: state.outSignature,
120148
+ dtsChangeTime: state.dtsChangeTime,
120149
+ };
120150
+ return result_15;
120151
+ }
120071
120152
  var fileNames = [];
120072
120153
  var fileNameToFileId = new ts.Map();
120073
120154
  var fileIdsList;
120074
120155
  var fileNamesToFileIdListId;
120156
+ var emitSignatures;
120075
120157
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
120158
+ var _b, _c;
120076
120159
  var key = _a[0], value = _a[1];
120077
120160
  // Ensure fileId
120078
120161
  var fileId = toFileId(key);
120079
120162
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
120080
- var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120081
- var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120163
+ var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
120164
+ var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
120165
+ if (state.compilerOptions.composite) {
120166
+ var file = state.program.getSourceFileByPath(key);
120167
+ if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
120168
+ var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
120169
+ if (emitSignature !== actualSignature) {
120170
+ (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
120171
+ }
120172
+ }
120173
+ }
120082
120174
  return value.version === actualSignature ?
120083
120175
  value.affectsGlobalScope || value.impliedFormat ?
120084
120176
  // If file version is same as signature, dont serialize signature
@@ -120086,11 +120178,11 @@ var ts;
120086
120178
  // If file info only contains version and signature and both are same we can just write string
120087
120179
  value.version :
120088
120180
  actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120089
- signature === undefined ?
120181
+ oldSignature === undefined ?
120090
120182
  // If we havent computed signature, use fileInfo as is
120091
120183
  value :
120092
120184
  // Serialize fileInfo with new updated signature
120093
- { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120185
+ { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120094
120186
  // Signature of the FileInfo is undefined, serialize it as false
120095
120187
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120096
120188
  });
@@ -120105,17 +120197,13 @@ var ts;
120105
120197
  if (state.exportedModulesMap) {
120106
120198
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
120107
120199
  var _a;
120108
- if (state.currentAffectedFilesExportedModulesMap) {
120109
- if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
120110
- return undefined;
120111
- }
120112
- var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
120113
- if (newValue) {
120114
- return [toFileId(key), toFileIdListId(newValue)];
120115
- }
120116
- }
120200
+ var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
120117
120201
  // Not in temporary cache, use existing value
120118
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120202
+ if (oldValue === undefined)
120203
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120204
+ if (oldValue)
120205
+ return [toFileId(key), toFileIdListId(oldValue)];
120206
+ return undefined;
120119
120207
  });
120120
120208
  }
120121
120209
  var semanticDiagnosticsPerFile;
@@ -120126,9 +120214,7 @@ var ts;
120126
120214
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
120127
120215
  [
120128
120216
  toFileId(key),
120129
- state.hasReusableDiagnostic ?
120130
- value :
120131
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120217
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
120132
120218
  ] :
120133
120219
  toFileId(key));
120134
120220
  }
@@ -120143,16 +120229,27 @@ var ts;
120143
120229
  }
120144
120230
  }
120145
120231
  }
120146
- return {
120232
+ var changeFileSet;
120233
+ if (state.changedFilesSet.size) {
120234
+ for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
120235
+ var path = _e[_d];
120236
+ (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120237
+ }
120238
+ }
120239
+ var result = {
120147
120240
  fileNames: fileNames,
120148
120241
  fileInfos: fileInfos,
120149
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
120242
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
120150
120243
  fileIdsList: fileIdsList,
120151
120244
  referencedMap: referencedMap,
120152
120245
  exportedModulesMap: exportedModulesMap,
120153
120246
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
120154
120247
  affectedFilesPendingEmit: affectedFilesPendingEmit,
120248
+ changeFileSet: changeFileSet,
120249
+ emitSignatures: emitSignatures,
120250
+ dtsChangeTime: state.dtsChangeTime,
120155
120251
  };
120252
+ return result;
120156
120253
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
120157
120254
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
120158
120255
  }
@@ -120177,24 +120274,18 @@ var ts;
120177
120274
  }
120178
120275
  return fileIdListId;
120179
120276
  }
120180
- }
120181
- function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
120182
- var result;
120183
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120184
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120185
- var name = _a[_i];
120186
- var optionKey = name.toLowerCase();
120187
- var optionInfo = optionsNameMap.get(optionKey);
120188
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
120189
- // We need to store `strict`, even though it won't be examined directly, so that the
120190
- // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
120191
- optionKey === "strict" ||
120192
- // We need to store these to determine whether `lib` files need to be rechecked.
120193
- optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
120194
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
120277
+ function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
120278
+ var result;
120279
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120280
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120281
+ var name = _a[_i];
120282
+ var optionInfo = optionsNameMap.get(name.toLowerCase());
120283
+ if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
120284
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
120285
+ }
120195
120286
  }
120287
+ return result;
120196
120288
  }
120197
- return result;
120198
120289
  }
120199
120290
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120200
120291
  if (option) {
@@ -120268,6 +120359,10 @@ var ts;
120268
120359
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
120269
120360
  }
120270
120361
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
120362
+ function computeSignature(text, data, computeHash) {
120363
+ return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
120364
+ }
120365
+ ts.computeSignature = computeSignature;
120271
120366
  function createBuilderProgram(kind, _a) {
120272
120367
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
120273
120368
  // Return same program if underlying program doesnt change
@@ -120286,8 +120381,8 @@ var ts;
120286
120381
  */
120287
120382
  var computeHash = ts.maybeBind(host, host.createHash);
120288
120383
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
120289
- var backupState;
120290
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
120384
+ var backupEmitState;
120385
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
120291
120386
  // To ensure that we arent storing any references to old program or new program without state
120292
120387
  newProgram = undefined; // TODO: GH#18217
120293
120388
  oldProgram = undefined;
@@ -120295,20 +120390,20 @@ var ts;
120295
120390
  var getState = function () { return state; };
120296
120391
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
120297
120392
  builderProgram.getState = getState;
120298
- builderProgram.backupState = function () {
120299
- ts.Debug.assert(backupState === undefined);
120300
- backupState = cloneBuilderProgramState(state);
120393
+ builderProgram.backupEmitState = function () {
120394
+ ts.Debug.assert(backupEmitState === undefined);
120395
+ backupEmitState = backupEmitBuilderProgramState(state);
120301
120396
  };
120302
- builderProgram.restoreState = function () {
120303
- state = ts.Debug.checkDefined(backupState);
120304
- backupState = undefined;
120397
+ builderProgram.restoreEmitState = function () {
120398
+ restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
120399
+ backupEmitState = undefined;
120305
120400
  };
120306
120401
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
120307
120402
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
120308
120403
  builderProgram.emit = emit;
120309
120404
  builderProgram.releaseProgram = function () {
120310
120405
  releaseCache(state);
120311
- backupState = undefined;
120406
+ backupEmitState = undefined;
120312
120407
  };
120313
120408
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
120314
120409
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -120367,35 +120462,59 @@ var ts;
120367
120462
  return toAffectedFileEmitResult(state,
120368
120463
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
120369
120464
  // Otherwise just affected file
120370
- ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120371
- getWriteFileUpdatingSignatureCallback(writeFile) :
120465
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
120466
+ getWriteFileCallback(writeFile, customTransformers) :
120372
120467
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
120373
120468
  }
120374
- function getWriteFileUpdatingSignatureCallback(writeFile) {
120469
+ function getWriteFileCallback(writeFile, customTransformers) {
120375
120470
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
120376
- var _a;
120471
+ var _a, _b, _c;
120377
120472
  if (ts.isDeclarationFileName(fileName)) {
120378
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120379
- var file = sourceFiles[0];
120380
- var info = state.fileInfos.get(file.resolvedPath);
120381
- var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120382
- if (signature === file.version) {
120383
- var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120384
- if (newSignature !== file.version) { // Update it
120385
- if (host.storeFilesChangingSignatureDuringEmit)
120386
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120387
- if (state.exportedModulesMap)
120388
- ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
120389
- if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
120390
- state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
120473
+ if (!ts.outFile(state.compilerOptions)) {
120474
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120475
+ var newSignature = void 0;
120476
+ if (!customTransformers) {
120477
+ var file = sourceFiles[0];
120478
+ var info = state.fileInfos.get(file.resolvedPath);
120479
+ if (info.signature === file.version) {
120480
+ newSignature = computeSignature(text, data, computeHash);
120481
+ if (newSignature !== file.version) { // Update it
120482
+ if (host.storeFilesChangingSignatureDuringEmit)
120483
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120484
+ if (state.exportedModulesMap)
120485
+ ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
120486
+ if (state.affectedFiles) {
120487
+ // Keep old signature so we know what to undo if cancellation happens
120488
+ var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
120489
+ if (existing === undefined)
120490
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
120491
+ info.signature = newSignature;
120492
+ }
120493
+ else {
120494
+ // These are directly commited
120495
+ info.signature = newSignature;
120496
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120497
+ }
120498
+ }
120391
120499
  }
120392
- else {
120393
- info.signature = newSignature;
120394
- if (state.exportedModulesMap)
120395
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120500
+ }
120501
+ if (state.compilerOptions.composite) {
120502
+ var filePath = sourceFiles[0].resolvedPath;
120503
+ var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
120504
+ newSignature || (newSignature = computeSignature(text, data, computeHash));
120505
+ if (newSignature !== oldSignature) {
120506
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
120507
+ state.hasChangedEmitSignature = true;
120396
120508
  }
120397
120509
  }
120398
120510
  }
120511
+ else if (state.compilerOptions.composite) {
120512
+ var newSignature = computeSignature(text, data, computeHash);
120513
+ if (newSignature !== state.outSignature) {
120514
+ state.outSignature = newSignature;
120515
+ state.hasChangedEmitSignature = true;
120516
+ }
120517
+ }
120399
120518
  }
120400
120519
  if (writeFile)
120401
120520
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -120460,8 +120579,8 @@ var ts;
120460
120579
  }
120461
120580
  }
120462
120581
  }
120463
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120464
- getWriteFileUpdatingSignatureCallback(writeFile) :
120582
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
120583
+ getWriteFileCallback(writeFile, customTransformers) :
120465
120584
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120466
120585
  }
120467
120586
  /**
@@ -120550,29 +120669,58 @@ var ts;
120550
120669
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
120551
120670
  }
120552
120671
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
120553
- function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
120554
- var _a;
120672
+ function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
120673
+ var _a, _b, _c, _d;
120555
120674
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
120556
120675
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
120557
- var filePaths = program.fileNames.map(toPath);
120558
- var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
120559
- var fileInfos = new ts.Map();
120560
- program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
120561
- var state = {
120562
- fileInfos: fileInfos,
120563
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
120564
- referencedMap: toManyToManyPathMap(program.referencedMap),
120565
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
120566
- 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]; }),
120567
- hasReusableDiagnostic: true,
120568
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
120569
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
120570
- affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
120571
- };
120676
+ var state;
120677
+ var filePaths;
120678
+ var filePathsSetList;
120679
+ if (isProgramBundleEmitBuildInfo(program)) {
120680
+ state = {
120681
+ fileInfos: new ts.Map(),
120682
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
120683
+ dtsChangeTime: program.dtsChangeTime,
120684
+ outSignature: program.outSignature,
120685
+ };
120686
+ }
120687
+ else {
120688
+ filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
120689
+ filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
120690
+ var fileInfos_2 = new ts.Map();
120691
+ var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
120692
+ program.fileInfos.forEach(function (fileInfo, index) {
120693
+ var path = toFilePath(index + 1);
120694
+ var stateFileInfo = toBuilderStateFileInfo(fileInfo);
120695
+ fileInfos_2.set(path, stateFileInfo);
120696
+ if (emitSignatures_1 && stateFileInfo.signature)
120697
+ emitSignatures_1.set(path, stateFileInfo.signature);
120698
+ });
120699
+ (_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
120700
+ if (ts.isNumber(value))
120701
+ emitSignatures_1.delete(toFilePath(value));
120702
+ else
120703
+ emitSignatures_1.set(toFilePath(value[0]), value[1]);
120704
+ });
120705
+ state = {
120706
+ fileInfos: fileInfos_2,
120707
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
120708
+ referencedMap: toManyToManyPathMap(program.referencedMap),
120709
+ exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
120710
+ 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]; }),
120711
+ hasReusableDiagnostic: true,
120712
+ affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
120713
+ affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
120714
+ affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
120715
+ changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
120716
+ dtsChangeTime: program.dtsChangeTime,
120717
+ emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
120718
+ };
120719
+ }
120572
120720
  return {
120573
120721
  getState: function () { return state; },
120574
- backupState: ts.noop,
120575
- restoreState: ts.noop,
120722
+ backupEmitState: ts.noop,
120723
+ restoreEmitState: ts.noop,
120576
120724
  getProgram: ts.notImplemented,
120577
120725
  getProgramOrUndefined: ts.returnUndefined,
120578
120726
  releaseProgram: ts.noop,
@@ -120617,12 +120765,24 @@ var ts;
120617
120765
  return map;
120618
120766
  }
120619
120767
  }
120620
- ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
120768
+ ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
120769
+ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
120770
+ var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
120771
+ var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
120772
+ var fileInfos = new ts.Map();
120773
+ program.fileInfos.forEach(function (fileInfo, index) {
120774
+ var path = ts.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
120775
+ var version = ts.isString(fileInfo) ? fileInfo : fileInfo.version; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
120776
+ fileInfos.set(path, version);
120777
+ });
120778
+ return fileInfos;
120779
+ }
120780
+ ts.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap;
120621
120781
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
120622
120782
  return {
120623
120783
  getState: ts.notImplemented,
120624
- backupState: ts.noop,
120625
- restoreState: ts.noop,
120784
+ backupEmitState: ts.noop,
120785
+ restoreEmitState: ts.noop,
120626
120786
  getProgram: getProgram,
120627
120787
  getProgramOrUndefined: function () { return getState().program; },
120628
120788
  releaseProgram: function () { return getState().program = undefined; },
@@ -121738,9 +121898,9 @@ var ts;
121738
121898
  if (!preferSymlinks) {
121739
121899
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
121740
121900
  // so we only need to remove them from the realpath filenames.
121741
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
121742
- if (result_15)
121743
- return result_15;
121901
+ var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
121902
+ if (result_16)
121903
+ return result_16;
121744
121904
  }
121745
121905
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
121746
121906
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -121760,10 +121920,10 @@ var ts;
121760
121920
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
121761
121921
  var symlinkDirectory = symlinkDirectories_1[_i];
121762
121922
  var option = ts.resolvePath(symlinkDirectory, relative);
121763
- var result_16 = cb(option, target === referenceRedirect);
121923
+ var result_17 = cb(option, target === referenceRedirect);
121764
121924
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
121765
- if (result_16)
121766
- return result_16;
121925
+ if (result_17)
121926
+ return result_17;
121767
121927
  }
121768
121928
  });
121769
121929
  });
@@ -122655,6 +122815,7 @@ var ts;
122655
122815
  readDirectory: ts.maybeBind(host, host.readDirectory),
122656
122816
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
122657
122817
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
122818
+ now: ts.maybeBind(host, host.now),
122658
122819
  };
122659
122820
  function writeFile(fileName, text, writeByteOrderMark, onError) {
122660
122821
  try {
@@ -122715,6 +122876,7 @@ var ts;
122715
122876
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
122716
122877
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
122717
122878
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
122879
+ now: ts.maybeBind(system, system.now),
122718
122880
  };
122719
122881
  }
122720
122882
  ts.createProgramHost = createProgramHost;
@@ -122782,20 +122944,26 @@ var ts;
122782
122944
  var ts;
122783
122945
  (function (ts) {
122784
122946
  function readBuilderProgram(compilerOptions, host) {
122785
- if (ts.outFile(compilerOptions))
122786
- return undefined;
122787
122947
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
122788
122948
  if (!buildInfoPath)
122789
122949
  return undefined;
122790
- var content = host.readFile(buildInfoPath);
122791
- if (!content)
122792
- return undefined;
122793
- var buildInfo = ts.getBuildInfo(content);
122950
+ var buildInfo;
122951
+ if (host.getBuildInfo) {
122952
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
122953
+ if (!buildInfo)
122954
+ return undefined;
122955
+ }
122956
+ else {
122957
+ var content = host.readFile(buildInfoPath);
122958
+ if (!content)
122959
+ return undefined;
122960
+ buildInfo = ts.getBuildInfo(content);
122961
+ }
122794
122962
  if (buildInfo.version !== ts.version)
122795
122963
  return undefined;
122796
122964
  if (!buildInfo.program)
122797
122965
  return undefined;
122798
- return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
122966
+ return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
122799
122967
  }
122800
122968
  ts.readBuilderProgram = readBuilderProgram;
122801
122969
  function createIncrementalCompilerHost(options, system) {
@@ -122804,6 +122972,7 @@ var ts;
122804
122972
  host.createHash = ts.maybeBind(system, system.createHash);
122805
122973
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
122806
122974
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
122975
+ host.now = ts.maybeBind(system, system.now);
122807
122976
  ts.setGetSourceFileAsHashVersioned(host, system);
122808
122977
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
122809
122978
  return host;
@@ -123538,14 +123707,17 @@ var ts;
123538
123707
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
123539
123708
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
123540
123709
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
123541
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
123542
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
123543
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
123544
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
123710
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
123711
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
123712
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
123713
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
123714
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
123715
+ UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
123545
123716
  /**
123546
123717
  * Projects with no outputs (i.e. "solution" files)
123547
123718
  */
123548
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
123719
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
123720
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
123549
123721
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
123550
123722
  function resolveConfigFileProjectName(project) {
123551
123723
  if (ts.fileExtensionIs(project, ".json" /* Json */)) {
@@ -123590,9 +123762,11 @@ var ts;
123590
123762
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
123591
123763
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
123592
123764
  }
123593
- function newer(date1, date2) {
123594
- return date2 > date1 ? date2 : date1;
123765
+ /*@internal*/
123766
+ function getCurrentTime(host) {
123767
+ return host.now ? host.now() : new Date();
123595
123768
  }
123769
+ ts.getCurrentTime = getCurrentTime;
123596
123770
  /*@internal*/
123597
123771
  function isCircularBuildOrder(buildOrder) {
123598
123772
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -123682,6 +123856,7 @@ var ts;
123682
123856
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
123683
123857
  };
123684
123858
  }
123859
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
123685
123860
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
123686
123861
  var state = {
123687
123862
  host: host,
@@ -123698,8 +123873,9 @@ var ts;
123698
123873
  resolvedConfigFilePaths: new ts.Map(),
123699
123874
  configFileCache: new ts.Map(),
123700
123875
  projectStatus: new ts.Map(),
123701
- buildInfoChecked: new ts.Map(),
123702
123876
  extendedConfigCache: new ts.Map(),
123877
+ buildInfoCache: new ts.Map(),
123878
+ outputTimeStamps: new ts.Map(),
123703
123879
  builderPrograms: new ts.Map(),
123704
123880
  diagnostics: new ts.Map(),
123705
123881
  projectPendingBuild: new ts.Map(),
@@ -123723,6 +123899,7 @@ var ts;
123723
123899
  allWatchedConfigFiles: new ts.Map(),
123724
123900
  allWatchedExtendedConfigFiles: new ts.Map(),
123725
123901
  allWatchedPackageJsonFiles: new ts.Map(),
123902
+ filesWatched: new ts.Map(),
123726
123903
  lastCachedPackageJsonLookups: new ts.Map(),
123727
123904
  timerToBuildInvalidatedProject: undefined,
123728
123905
  reportFileChangeDetected: false,
@@ -123829,11 +124006,12 @@ var ts;
123829
124006
  // Config file cache
123830
124007
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
123831
124008
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
123832
- ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
123833
124009
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
123834
124010
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
123835
124011
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
123836
124012
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
124013
+ ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
124014
+ ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
123837
124015
  // Remove watches for the program no longer in the solution
123838
124016
  if (state.watch) {
123839
124017
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
@@ -124124,21 +124302,21 @@ var ts;
124124
124302
  }
124125
124303
  function emit(writeFileCallback, cancellationToken, customTransformers) {
124126
124304
  var _a;
124127
- var _b, _c;
124305
+ var _b, _c, _d;
124128
124306
  ts.Debug.assertIsDefined(program);
124129
124307
  ts.Debug.assert(step === BuildStep.Emit);
124130
124308
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
124131
- program.backupState();
124309
+ program.backupEmitState();
124132
124310
  var declDiagnostics;
124133
124311
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
124134
124312
  var outputFiles = [];
124135
124313
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
124136
124314
  /*write*/ undefined,
124137
- /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
124315
+ /*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,
124138
124316
  /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
124139
124317
  // Don't emit .d.ts if there are decl file errors
124140
124318
  if (declDiagnostics) {
124141
- program.restoreState();
124319
+ program.restoreEmitState();
124142
124320
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
124143
124321
  return {
124144
124322
  emitSkipped: true,
@@ -124148,37 +124326,43 @@ var ts;
124148
124326
  // Actual Emit
124149
124327
  var host = state.host, compilerHost = state.compilerHost;
124150
124328
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124151
- var newestDeclarationFileContentChangedTime = minimumDate;
124152
- var anyDtsChanged = false;
124329
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
124153
124330
  var emitterDiagnostics = ts.createDiagnosticCollection();
124154
124331
  var emittedOutputs = new ts.Map();
124332
+ var options = program.getCompilerOptions();
124333
+ var isIncremental = ts.isIncrementalCompilation(options);
124334
+ var outputTimeStampMap;
124335
+ var now;
124155
124336
  outputFiles.forEach(function (_a) {
124156
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124157
- var priorChangeTime;
124158
- if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124159
- // Check for unchanged .d.ts files
124160
- if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124161
- priorChangeTime = host.getModifiedTime(name);
124162
- }
124163
- else {
124337
+ var _b, _c;
124338
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124339
+ var path = toPath(state, name);
124340
+ emittedOutputs.set(toPath(state, name), name);
124341
+ if (buildInfo) {
124342
+ setBuildInfo(state, buildInfo, projectPath, options);
124343
+ 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)) {
124164
124344
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124165
- anyDtsChanged = true;
124166
124345
  }
124167
124346
  }
124168
- emittedOutputs.set(toPath(state, name), name);
124169
124347
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124170
- if (priorChangeTime !== undefined) {
124171
- newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
124348
+ if (!isIncremental && state.watch) {
124349
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
124172
124350
  }
124173
124351
  });
124174
- finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime,
124175
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124352
+ finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124176
124353
  return emitResult;
124177
124354
  }
124178
124355
  function emitBuildInfo(writeFileCallback, cancellationToken) {
124179
124356
  ts.Debug.assertIsDefined(program);
124180
124357
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
124181
- var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
124358
+ var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
124359
+ if (data === null || data === void 0 ? void 0 : data.buildInfo)
124360
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
124361
+ if (writeFileCallback)
124362
+ writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
124363
+ else
124364
+ state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
124365
+ }, cancellationToken);
124182
124366
  if (emitResult.diagnostics.length) {
124183
124367
  reportErrors(state, emitResult.diagnostics);
124184
124368
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -124191,7 +124375,7 @@ var ts;
124191
124375
  step = BuildStep.QueueReferencingProjects;
124192
124376
  return emitResult;
124193
124377
  }
124194
- function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
124378
+ function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
124195
124379
  var _a;
124196
124380
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
124197
124381
  if (emitDiagnostics.length) {
@@ -124202,13 +124386,11 @@ var ts;
124202
124386
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
124203
124387
  }
124204
124388
  // Update time stamps for rest of the outputs
124205
- var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124389
+ updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124206
124390
  state.diagnostics.delete(projectPath);
124207
124391
  state.projectStatus.set(projectPath, {
124208
124392
  type: ts.UpToDateStatusType.UpToDate,
124209
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
124210
- maximumDate :
124211
- newestDeclarationFileContentChangedTime,
124393
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
124212
124394
  oldestOutputFileName: oldestOutputFileName
124213
124395
  });
124214
124396
  afterProgramDone(state, program, config);
@@ -124243,13 +124425,21 @@ var ts;
124243
124425
  ts.Debug.assert(!!outputFiles.length);
124244
124426
  var emitterDiagnostics = ts.createDiagnosticCollection();
124245
124427
  var emittedOutputs = new ts.Map();
124428
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124429
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
124246
124430
  outputFiles.forEach(function (_a) {
124247
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124431
+ var _b, _c;
124432
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124248
124433
  emittedOutputs.set(toPath(state, name), name);
124434
+ if (buildInfo) {
124435
+ setBuildInfo(state, buildInfo, projectPath, config.options);
124436
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
124437
+ resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124438
+ }
124439
+ }
124249
124440
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124250
124441
  });
124251
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate,
124252
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
124442
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
124253
124443
  return { emitSkipped: false, diagnostics: emitDiagnostics };
124254
124444
  }
124255
124445
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -124354,7 +124544,7 @@ var ts;
124354
124544
  }
124355
124545
  continue;
124356
124546
  }
124357
- if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
124547
+ if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
124358
124548
  reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
124359
124549
  return createUpdateOutputFileStampsProject(state, project, projectPath, config, buildOrder);
124360
124550
  }
@@ -124411,7 +124601,7 @@ var ts;
124411
124601
  state.projectCompilerOptions = state.baseCompilerOptions;
124412
124602
  }
124413
124603
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
124414
- var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
124604
+ var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
124415
124605
  reportAndStoreErrors(state, resolvedPath, diagnostics);
124416
124606
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
124417
124607
  if (canEmitBuildInfo)
@@ -124419,9 +124609,95 @@ var ts;
124419
124609
  afterProgramDone(state, program, config);
124420
124610
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
124421
124611
  }
124612
+ function isFileWatcherWithModifiedTime(value) {
124613
+ return !!value.watcher;
124614
+ }
124615
+ function getModifiedTime(state, fileName) {
124616
+ var path = toPath(state, fileName);
124617
+ var existing = state.filesWatched.get(path);
124618
+ if (state.watch && !!existing) {
124619
+ if (!isFileWatcherWithModifiedTime(existing))
124620
+ return existing;
124621
+ if (existing.modifiedTime)
124622
+ return existing.modifiedTime;
124623
+ }
124624
+ var result = ts.getModifiedTime(state.host, fileName);
124625
+ if (state.watch) {
124626
+ if (existing)
124627
+ existing.modifiedTime = result;
124628
+ else
124629
+ state.filesWatched.set(path, result);
124630
+ }
124631
+ return result;
124632
+ }
124633
+ function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
124634
+ var path = toPath(state, file);
124635
+ var existing = state.filesWatched.get(path);
124636
+ if (existing && isFileWatcherWithModifiedTime(existing)) {
124637
+ existing.callbacks.push(callback);
124638
+ }
124639
+ else {
124640
+ var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
124641
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
124642
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
124643
+ existing.modifiedTime = modifiedTime;
124644
+ existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
124645
+ }, pollingInterval, options, watchType, project);
124646
+ state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
124647
+ }
124648
+ return {
124649
+ close: function () {
124650
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
124651
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
124652
+ if (existing.callbacks.length === 1) {
124653
+ state.filesWatched.delete(path);
124654
+ ts.closeFileWatcherOf(existing);
124655
+ }
124656
+ else {
124657
+ ts.unorderedRemoveItem(existing.callbacks, callback);
124658
+ }
124659
+ }
124660
+ };
124661
+ }
124662
+ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
124663
+ if (!state.watch)
124664
+ return undefined;
124665
+ var result = state.outputTimeStamps.get(resolvedConfigFilePath);
124666
+ if (!result)
124667
+ state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
124668
+ return result;
124669
+ }
124670
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
124671
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
124672
+ var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
124673
+ if (existing) {
124674
+ existing.buildInfo = buildInfo;
124675
+ existing.modifiedTime = getCurrentTime(state.host);
124676
+ }
124677
+ else {
124678
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
124679
+ }
124680
+ }
124681
+ function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
124682
+ var path = toPath(state, buildInfoPath);
124683
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
124684
+ return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
124685
+ }
124686
+ function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
124687
+ var path = toPath(state, buildInfoPath);
124688
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
124689
+ if (existing !== undefined && existing.path === path) {
124690
+ return existing.buildInfo || undefined;
124691
+ }
124692
+ var value = state.readFileWithCache(buildInfoPath);
124693
+ var buildInfo = value ? ts.getBuildInfo(value) : undefined;
124694
+ ts.Debug.assert(modifiedTime || !buildInfo);
124695
+ state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
124696
+ return buildInfo;
124697
+ }
124422
124698
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
124423
124699
  // Check tsconfig time
124424
- var tsconfigTime = ts.getModifiedTime(state.host, configFile);
124700
+ var tsconfigTime = getModifiedTime(state, configFile);
124425
124701
  if (oldestOutputFileTime < tsconfigTime) {
124426
124702
  return {
124427
124703
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -124431,88 +124707,24 @@ var ts;
124431
124707
  }
124432
124708
  }
124433
124709
  function getUpToDateStatusWorker(state, project, resolvedPath) {
124434
- var force = !!state.options.force;
124435
- var newestInputFileName = undefined;
124436
- var newestInputFileTime = minimumDate;
124437
- var host = state.host;
124438
- // Get timestamps of input files
124439
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
124440
- var inputFile = _a[_i];
124441
- if (!host.fileExists(inputFile)) {
124442
- return {
124443
- type: ts.UpToDateStatusType.Unbuildable,
124444
- reason: inputFile + " does not exist"
124445
- };
124446
- }
124447
- if (!force) {
124448
- var inputTime = ts.getModifiedTime(host, inputFile);
124449
- if (inputTime > newestInputFileTime) {
124450
- newestInputFileName = inputFile;
124451
- newestInputFileTime = inputTime;
124452
- }
124453
- }
124454
- }
124710
+ var _a, _b, _c;
124455
124711
  // Container if no files are specified in the project
124456
124712
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
124457
124713
  return {
124458
124714
  type: ts.UpToDateStatusType.ContainerOnly
124459
124715
  };
124460
124716
  }
124461
- // Collect the expected outputs of this project
124462
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
124463
- // Now see if all outputs are newer than the newest input
124464
- var oldestOutputFileName = "(none)";
124465
- var oldestOutputFileTime = maximumDate;
124466
- var newestOutputFileName = "(none)";
124467
- var newestOutputFileTime = minimumDate;
124468
- var missingOutputFileName;
124469
- var newestDeclarationFileContentChangedTime = minimumDate;
124470
- var isOutOfDateWithInputs = false;
124471
- if (!force) {
124472
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
124473
- var output = outputs_1[_b];
124474
- // Output is missing; can stop checking
124475
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124476
- if (!host.fileExists(output)) {
124477
- missingOutputFileName = output;
124478
- break;
124479
- }
124480
- var outputTime = ts.getModifiedTime(host, output);
124481
- if (outputTime < oldestOutputFileTime) {
124482
- oldestOutputFileTime = outputTime;
124483
- oldestOutputFileName = output;
124484
- }
124485
- // If an output is older than the newest input, we can stop checking
124486
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124487
- if (outputTime < newestInputFileTime) {
124488
- isOutOfDateWithInputs = true;
124489
- break;
124490
- }
124491
- if (outputTime > newestOutputFileTime) {
124492
- newestOutputFileTime = outputTime;
124493
- newestOutputFileName = output;
124494
- }
124495
- // Keep track of when the most recent time a .d.ts file was changed.
124496
- // In addition to file timestamps, we also keep track of when a .d.ts file
124497
- // had its file touched but not had its contents changed - this allows us
124498
- // to skip a downstream typecheck
124499
- if (ts.isDeclarationFileName(output)) {
124500
- var outputModifiedTime = ts.getModifiedTime(host, output);
124501
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
124502
- }
124503
- }
124504
- }
124505
- var pseudoUpToDate = false;
124506
- var usesPrepend = false;
124507
- var upstreamChangedProject;
124717
+ // Fast check to see if reference projects are buildable
124718
+ var referenceStatuses;
124719
+ var force = !!state.options.force;
124508
124720
  if (project.projectReferences) {
124509
124721
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
124510
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
124511
- var ref = _d[_c];
124512
- usesPrepend = usesPrepend || !!(ref.prepend);
124722
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
124723
+ var ref = _d[_i];
124513
124724
  var resolvedRef = ts.resolveProjectReferencePath(ref);
124514
124725
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
124515
- var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
124726
+ var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
124727
+ var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
124516
124728
  // Its a circular reference ignore the status of this project
124517
124729
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
124518
124730
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) { // Container only ignore this project
@@ -124534,75 +124746,188 @@ var ts;
124534
124746
  upstreamProjectName: ref.path
124535
124747
  };
124536
124748
  }
124537
- // Check oldest output file name only if there is no missing output file name
124538
- // (a check we will have skipped if this is a forced build)
124539
- if (!force && !missingOutputFileName) {
124540
- // If the upstream project's newest file is older than our oldest output, we
124541
- // can't be out of date because of it
124542
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
124543
- continue;
124544
- }
124545
- // If the upstream project has only change .d.ts files, and we've built
124546
- // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
124547
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
124548
- pseudoUpToDate = true;
124549
- upstreamChangedProject = ref.path;
124550
- continue;
124551
- }
124552
- // We have an output older than an upstream output - we are out of date
124553
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
124749
+ if (!force)
124750
+ (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
124751
+ }
124752
+ }
124753
+ if (force)
124754
+ return { type: ts.UpToDateStatusType.ForceBuild };
124755
+ // Check buildinfo first
124756
+ var host = state.host;
124757
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
124758
+ var oldestOutputFileName = "(none)";
124759
+ var oldestOutputFileTime = maximumDate;
124760
+ var buildInfoTime;
124761
+ var buildInfoProgram;
124762
+ var buildInfoVersionMap;
124763
+ var newestDeclarationFileContentChangedTime;
124764
+ if (buildInfoPath) {
124765
+ var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
124766
+ buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
124767
+ if (buildInfoTime === ts.missingFileModifiedTime) {
124768
+ if (!buildInfoCacheEntry_1) {
124769
+ state.buildInfoCache.set(resolvedPath, {
124770
+ path: toPath(state, buildInfoPath),
124771
+ buildInfo: false,
124772
+ modifiedTime: buildInfoTime
124773
+ });
124774
+ }
124775
+ return {
124776
+ type: ts.UpToDateStatusType.OutputMissing,
124777
+ missingOutputFileName: buildInfoPath
124778
+ };
124779
+ }
124780
+ var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
124781
+ if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
124782
+ return {
124783
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
124784
+ version: buildInfo.version
124785
+ };
124786
+ }
124787
+ if (buildInfo.program) {
124788
+ if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
124789
+ (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
124554
124790
  return {
124555
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124556
- outOfDateOutputFileName: oldestOutputFileName,
124557
- newerProjectName: ref.path
124791
+ type: ts.UpToDateStatusType.OutOfDateBuildInfo,
124792
+ buildInfoFile: buildInfoPath
124558
124793
  };
124559
124794
  }
124795
+ buildInfoProgram = buildInfo.program;
124560
124796
  }
124797
+ oldestOutputFileTime = buildInfoTime;
124798
+ oldestOutputFileName = buildInfoPath;
124799
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
124561
124800
  }
124562
- if (missingOutputFileName !== undefined) {
124563
- return {
124564
- type: ts.UpToDateStatusType.OutputMissing,
124565
- missingOutputFileName: missingOutputFileName
124566
- };
124801
+ // Check input files
124802
+ var newestInputFileName = undefined;
124803
+ var newestInputFileTime = minimumDate;
124804
+ var pseudoInputUptodate = false;
124805
+ // Get timestamps of input files
124806
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
124807
+ var inputFile = _f[_e];
124808
+ var inputTime = getModifiedTime(state, inputFile);
124809
+ if (inputTime === ts.missingFileModifiedTime) {
124810
+ return {
124811
+ type: ts.UpToDateStatusType.Unbuildable,
124812
+ reason: inputFile + " does not exist"
124813
+ };
124814
+ }
124815
+ // If an buildInfo is older than the newest input, we can stop checking
124816
+ if (buildInfoTime && buildInfoTime < inputTime) {
124817
+ var version_3 = void 0;
124818
+ var currentVersion = void 0;
124819
+ if (buildInfoProgram) {
124820
+ // Read files and see if they are same, read is anyways cached
124821
+ if (!buildInfoVersionMap)
124822
+ buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
124823
+ version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
124824
+ var text = version_3 ? state.readFileWithCache(inputFile) : undefined;
124825
+ currentVersion = text && (host.createHash || ts.generateDjb2Hash)(text);
124826
+ if (version_3 && version_3 === currentVersion)
124827
+ pseudoInputUptodate = true;
124828
+ }
124829
+ if (!version_3 || version_3 !== currentVersion) {
124830
+ return {
124831
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
124832
+ outOfDateOutputFileName: buildInfoPath,
124833
+ newerInputFileName: inputFile
124834
+ };
124835
+ }
124836
+ }
124837
+ if (inputTime > newestInputFileTime) {
124838
+ newestInputFileName = inputFile;
124839
+ newestInputFileTime = inputTime;
124840
+ }
124567
124841
  }
124568
- if (isOutOfDateWithInputs) {
124569
- return {
124570
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
124571
- outOfDateOutputFileName: oldestOutputFileName,
124572
- newerInputFileName: newestInputFileName
124573
- };
124842
+ // Now see if all outputs are newer than the newest input
124843
+ // Dont check output timestamps if we have buildinfo telling us output is uptodate
124844
+ if (!buildInfoPath) {
124845
+ // Collect the expected outputs of this project
124846
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
124847
+ var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
124848
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
124849
+ var output = outputs_1[_g];
124850
+ var path = toPath(state, output);
124851
+ // Output is missing; can stop checking
124852
+ var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
124853
+ if (!outputTime) {
124854
+ outputTime = ts.getModifiedTime(state.host, output);
124855
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
124856
+ }
124857
+ if (outputTime === ts.missingFileModifiedTime) {
124858
+ return {
124859
+ type: ts.UpToDateStatusType.OutputMissing,
124860
+ missingOutputFileName: output
124861
+ };
124862
+ }
124863
+ if (outputTime < oldestOutputFileTime) {
124864
+ oldestOutputFileTime = outputTime;
124865
+ oldestOutputFileName = output;
124866
+ }
124867
+ // If an output is older than the newest input, we can stop checking
124868
+ if (outputTime < newestInputFileTime) {
124869
+ return {
124870
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
124871
+ outOfDateOutputFileName: oldestOutputFileName,
124872
+ newerInputFileName: newestInputFileName
124873
+ };
124874
+ }
124875
+ }
124574
124876
  }
124575
- else {
124576
- // Check tsconfig time
124577
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
124578
- if (configStatus)
124579
- return configStatus;
124580
- // Check extended config time
124581
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
124582
- if (extendedConfigStatus)
124583
- return extendedConfigStatus;
124584
- // Check package file time
124585
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
124586
- var path = _a[0];
124587
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
124588
- });
124589
- if (dependentPackageFileStatus)
124590
- return dependentPackageFileStatus;
124591
- }
124592
- if (!force && !state.buildInfoChecked.has(resolvedPath)) {
124593
- state.buildInfoChecked.set(resolvedPath, true);
124594
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
124595
- if (buildInfoPath) {
124596
- var value = state.readFileWithCache(buildInfoPath);
124597
- var buildInfo = value && ts.getBuildInfo(value);
124598
- if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
124877
+ var seenRefs = buildInfoPath ? new ts.Set() : undefined;
124878
+ var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
124879
+ seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
124880
+ var pseudoUpToDate = false;
124881
+ var usesPrepend = false;
124882
+ var upstreamChangedProject;
124883
+ if (referenceStatuses) {
124884
+ for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
124885
+ var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
124886
+ usesPrepend = usesPrepend || !!(ref.prepend);
124887
+ // If the upstream project's newest file is older than our oldest output, we
124888
+ // can't be out of date because of it
124889
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
124890
+ continue;
124891
+ }
124892
+ // Check if tsbuildinfo path is shared, then we need to rebuild
124893
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
124599
124894
  return {
124600
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
124601
- version: buildInfo.version
124895
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124896
+ outOfDateOutputFileName: buildInfoPath,
124897
+ newerProjectName: ref.path
124602
124898
  };
124603
124899
  }
124900
+ // If the upstream project has only change .d.ts files, and we've built
124901
+ // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
124902
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
124903
+ pseudoUpToDate = true;
124904
+ upstreamChangedProject = ref.path;
124905
+ continue;
124906
+ }
124907
+ // We have an output older than an upstream output - we are out of date
124908
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
124909
+ return {
124910
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124911
+ outOfDateOutputFileName: oldestOutputFileName,
124912
+ newerProjectName: ref.path
124913
+ };
124604
124914
  }
124605
124915
  }
124916
+ // Check tsconfig time
124917
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
124918
+ if (configStatus)
124919
+ return configStatus;
124920
+ // Check extended config time
124921
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
124922
+ if (extendedConfigStatus)
124923
+ return extendedConfigStatus;
124924
+ // Check package file time
124925
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
124926
+ var path = _a[0];
124927
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
124928
+ });
124929
+ if (dependentPackageFileStatus)
124930
+ return dependentPackageFileStatus;
124606
124931
  if (usesPrepend && pseudoUpToDate) {
124607
124932
  return {
124608
124933
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -124612,15 +124937,37 @@ var ts;
124612
124937
  }
124613
124938
  // Up to date
124614
124939
  return {
124615
- type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
124940
+ type: pseudoUpToDate ?
124941
+ ts.UpToDateStatusType.UpToDateWithUpstreamTypes :
124942
+ pseudoInputUptodate ?
124943
+ ts.UpToDateStatusType.UpToDateWithInputFileText :
124944
+ ts.UpToDateStatusType.UpToDate,
124616
124945
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
124617
124946
  newestInputFileTime: newestInputFileTime,
124618
- newestOutputFileTime: newestOutputFileTime,
124619
124947
  newestInputFileName: newestInputFileName,
124620
- newestOutputFileName: newestOutputFileName,
124621
124948
  oldestOutputFileName: oldestOutputFileName
124622
124949
  };
124623
124950
  }
124951
+ function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
124952
+ if (seenRefs.has(resolvedRefPath))
124953
+ return false;
124954
+ seenRefs.add(resolvedRefPath);
124955
+ var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
124956
+ if (refBuildInfo.path === buildInfoCacheEntry.path)
124957
+ return true;
124958
+ if (resolvedConfig.projectReferences) {
124959
+ // Check references
124960
+ for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
124961
+ var ref = _a[_i];
124962
+ var resolvedRef = ts.resolveProjectReferencePath(ref);
124963
+ var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
124964
+ var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
124965
+ if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
124966
+ return true;
124967
+ }
124968
+ }
124969
+ return false;
124970
+ }
124624
124971
  function getUpToDateStatus(state, project, resolvedPath) {
124625
124972
  if (project === undefined) {
124626
124973
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -124633,39 +124980,65 @@ var ts;
124633
124980
  state.projectStatus.set(resolvedPath, actual);
124634
124981
  return actual;
124635
124982
  }
124636
- function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
124983
+ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
124637
124984
  if (proj.options.noEmit)
124638
- return priorNewestUpdateTime;
124985
+ return;
124986
+ var now;
124987
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
124988
+ if (buildInfoPath) {
124989
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
124990
+ if (!!state.options.verbose)
124991
+ reportStatus(state, verboseMessage, proj.options.configFilePath);
124992
+ state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
124993
+ getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
124994
+ }
124995
+ state.outputTimeStamps.delete(projectPath);
124996
+ return;
124997
+ }
124639
124998
  var host = state.host;
124640
124999
  var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125000
+ var outputTimeStampMap = getOutputTimeStampMap(state, projectPath);
125001
+ var modifiedOutputs = outputTimeStampMap ? new ts.Set() : undefined;
124641
125002
  if (!skipOutputs || outputs.length !== skipOutputs.size) {
124642
125003
  var reportVerbose = !!state.options.verbose;
124643
- var now = host.now ? host.now() : new Date();
124644
125004
  for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
124645
125005
  var file = outputs_2[_i];
124646
- if (skipOutputs && skipOutputs.has(toPath(state, file))) {
125006
+ var path = toPath(state, file);
125007
+ if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
124647
125008
  continue;
124648
- }
124649
125009
  if (reportVerbose) {
124650
125010
  reportVerbose = false;
124651
125011
  reportStatus(state, verboseMessage, proj.options.configFilePath);
124652
125012
  }
124653
- if (ts.isDeclarationFileName(file)) {
124654
- priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
125013
+ host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
125014
+ if (outputTimeStampMap) {
125015
+ outputTimeStampMap.set(path, now);
125016
+ modifiedOutputs.add(path);
124655
125017
  }
124656
- host.setModifiedTime(file, now);
124657
125018
  }
124658
125019
  }
124659
- return priorNewestUpdateTime;
125020
+ // Clear out timestamps not in output list any more
125021
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.forEach(function (_value, key) {
125022
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs.has(key))
125023
+ outputTimeStampMap.delete(key);
125024
+ });
125025
+ }
125026
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
125027
+ var _a;
125028
+ if (!options.composite)
125029
+ return undefined;
125030
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125031
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, /*modifiedTime*/ undefined);
125032
+ 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;
124660
125033
  }
124661
125034
  function updateOutputTimestamps(state, proj, resolvedPath) {
124662
125035
  if (state.options.dry) {
124663
125036
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
124664
125037
  }
124665
- var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125038
+ updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
124666
125039
  state.projectStatus.set(resolvedPath, {
124667
125040
  type: ts.UpToDateStatusType.UpToDate,
124668
- newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
125041
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
124669
125042
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
124670
125043
  });
124671
125044
  }
@@ -124711,6 +125084,7 @@ var ts;
124711
125084
  break;
124712
125085
  }
124713
125086
  // falls through
125087
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
124714
125088
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
124715
125089
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
124716
125090
  if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
@@ -124858,12 +125232,10 @@ var ts;
124858
125232
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
124859
125233
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
124860
125234
  return;
124861
- state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
124862
- invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
124863
- }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
125235
+ 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));
124864
125236
  }
124865
125237
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
124866
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
125238
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
124867
125239
  var _a;
124868
125240
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
124869
125241
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -124895,7 +125267,7 @@ var ts;
124895
125267
  if (!state.watch)
124896
125268
  return;
124897
125269
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
124898
- 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); },
125270
+ 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); },
124899
125271
  onDeleteValue: ts.closeFileWatcher,
124900
125272
  });
124901
125273
  }
@@ -124903,7 +125275,7 @@ var ts;
124903
125275
  if (!state.watch || !state.lastCachedPackageJsonLookups)
124904
125276
  return;
124905
125277
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
124906
- createNewValue: function (path, _input) { return state.watchFile(path, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full); }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.PackageJson, resolved); },
125278
+ 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); },
124907
125279
  onDeleteValue: ts.closeFileWatcher,
124908
125280
  });
124909
125281
  }
@@ -125035,19 +125407,18 @@ var ts;
125035
125407
  }
125036
125408
  }
125037
125409
  function reportUpToDateStatus(state, configFileName, status) {
125038
- if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
125039
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125040
- }
125041
125410
  switch (status.type) {
125042
125411
  case ts.UpToDateStatusType.OutOfDateWithSelf:
125043
- 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));
125412
+ 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));
125044
125413
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
125045
- 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));
125414
+ 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));
125046
125415
  case ts.UpToDateStatusType.OutputMissing:
125047
125416
  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));
125417
+ case ts.UpToDateStatusType.OutOfDateBuildInfo:
125418
+ 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));
125048
125419
  case ts.UpToDateStatusType.UpToDate:
125049
125420
  if (status.newestInputFileTime !== undefined) {
125050
- 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 || ""));
125421
+ 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 || ""));
125051
125422
  }
125052
125423
  // Don't report anything for "up to date because it was already built" -- too verbose
125053
125424
  break;
@@ -125055,6 +125426,8 @@ var ts;
125055
125426
  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));
125056
125427
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125057
125428
  return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
125429
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
125430
+ 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));
125058
125431
  case ts.UpToDateStatusType.UpstreamOutOfDate:
125059
125432
  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));
125060
125433
  case ts.UpToDateStatusType.UpstreamBlocked:
@@ -125065,6 +125438,8 @@ var ts;
125065
125438
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
125066
125439
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
125067
125440
  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);
125441
+ case ts.UpToDateStatusType.ForceBuild:
125442
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125068
125443
  case ts.UpToDateStatusType.ContainerOnly:
125069
125444
  // Don't report status on "solution" projects
125070
125445
  // falls through