@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.
package/lib/typescript.js CHANGED
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-insiders.20220427";
297
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220429";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -6384,7 +6384,7 @@ var ts;
6384
6384
  };
6385
6385
  }
6386
6386
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
6387
- var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName) {
6387
+ var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName, modifiedTime) {
6388
6388
  // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
6389
6389
  if (!ts.isString(relativeFileName))
6390
6390
  return;
@@ -6394,7 +6394,7 @@ var ts;
6394
6394
  if (callbacks) {
6395
6395
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
6396
6396
  var fileCallback = callbacks_1[_i];
6397
- fileCallback(fileName, FileWatcherEventKind.Changed);
6397
+ fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6398
6398
  }
6399
6399
  }
6400
6400
  },
@@ -6448,7 +6448,7 @@ var ts;
6448
6448
  }
6449
6449
  else {
6450
6450
  cache.set(path, {
6451
- watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
6451
+ watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6452
6452
  refCount: 1
6453
6453
  });
6454
6454
  }
@@ -6476,7 +6476,7 @@ var ts;
6476
6476
  var newTime = modifiedTime.getTime();
6477
6477
  if (oldTime !== newTime) {
6478
6478
  watchedFile.mtime = modifiedTime;
6479
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
6479
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
6480
6480
  return true;
6481
6481
  }
6482
6482
  return false;
@@ -6727,17 +6727,18 @@ var ts;
6727
6727
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6728
6728
  /*@internal*/
6729
6729
  function createFileWatcherCallback(callback) {
6730
- return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
6730
+ return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6731
6731
  }
6732
6732
  ts.createFileWatcherCallback = createFileWatcherCallback;
6733
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists) {
6734
- return function (eventName) {
6733
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6734
+ return function (eventName, _relativeFileName, modifiedTime) {
6735
6735
  if (eventName === "rename") {
6736
- callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6736
+ modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
6737
+ callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
6737
6738
  }
6738
6739
  else {
6739
6740
  // Change
6740
- callback(fileName, FileWatcherEventKind.Changed);
6741
+ callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6741
6742
  }
6742
6743
  };
6743
6744
  }
@@ -6761,7 +6762,7 @@ var ts;
6761
6762
  }
6762
6763
  /*@internal*/
6763
6764
  function createSystemWatchFunctions(_a) {
6764
- 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;
6765
+ 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;
6765
6766
  var dynamicPollingWatchFile;
6766
6767
  var fixedChunkSizePollingWatchFile;
6767
6768
  var nonPollingWatchFile;
@@ -6783,7 +6784,7 @@ var ts;
6783
6784
  case ts.WatchFileKind.FixedChunkSizePolling:
6784
6785
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, /* pollingInterval */ undefined, /*options*/ undefined);
6785
6786
  case ts.WatchFileKind.UseFsEvents:
6786
- return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists),
6787
+ return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime),
6787
6788
  /*recursive*/ false, pollingInterval, ts.getFallbackOptions(options));
6788
6789
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
6789
6790
  if (!nonPollingWatchFile) {
@@ -6965,7 +6966,6 @@ var ts;
6965
6966
  fsWatch: fsWatch,
6966
6967
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6967
6968
  getCurrentDirectory: getCurrentDirectory,
6968
- fileExists: fileExists,
6969
6969
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
6970
6970
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
6971
6971
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
@@ -7225,7 +7225,7 @@ var ts;
7225
7225
  // File changed
7226
7226
  eventKind = FileWatcherEventKind.Changed;
7227
7227
  }
7228
- callback(fileName, eventKind);
7228
+ callback(fileName, eventKind, curr.mtime);
7229
7229
  }
7230
7230
  }
7231
7231
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
@@ -7251,10 +7251,10 @@ var ts;
7251
7251
  * Invoke the callback with rename and update the watcher if not closed
7252
7252
  * @param createWatcher
7253
7253
  */
7254
- function invokeCallbackAndUpdateWatcher(createWatcher) {
7254
+ function invokeCallbackAndUpdateWatcher(createWatcher, modifiedTime) {
7255
7255
  sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
7256
7256
  // Call the callback for current directory
7257
- callback("rename", "");
7257
+ callback("rename", "", modifiedTime);
7258
7258
  // If watcher is not closed, update it
7259
7259
  if (watcher) {
7260
7260
  watcher.close();
@@ -7300,13 +7300,14 @@ var ts;
7300
7300
  function callbackChangingToMissingFileSystemEntry(event, relativeName) {
7301
7301
  // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
7302
7302
  // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
7303
+ var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
7303
7304
  return event === "rename" &&
7304
7305
  (!relativeName ||
7305
7306
  relativeName === lastDirectoryPart ||
7306
7307
  (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
7307
- !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7308
- invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
7309
- callback(event, relativeName);
7308
+ modifiedTime === ts.missingFileModifiedTime ?
7309
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry, modifiedTime) :
7310
+ callback(event, relativeName, modifiedTime);
7310
7311
  }
7311
7312
  /**
7312
7313
  * Watch the file or directory using fs.watchFile since fs.watch threw exception
@@ -7320,12 +7321,15 @@ var ts;
7320
7321
  * and switch to existing file or directory when the missing filesystem entry is created
7321
7322
  */
7322
7323
  function watchMissingFileSystemEntry() {
7323
- return watchFile(fileOrDirectory, function (_fileName, eventKind) {
7324
- if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
7325
- // Call the callback for current file or directory
7326
- // For now it could be callback for the inner directory creation,
7327
- // but just return current directory, better than current no-op
7328
- invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
7324
+ return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
7325
+ if (eventKind === FileWatcherEventKind.Created) {
7326
+ modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
7327
+ if (modifiedTime !== ts.missingFileModifiedTime) {
7328
+ // Call the callback for current file or directory
7329
+ // For now it could be callback for the inner directory creation,
7330
+ // but just return current directory, better than current no-op
7331
+ invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry, modifiedTime);
7332
+ }
7329
7333
  }
7330
7334
  }, fallbackPollingInterval, fallbackOptions);
7331
7335
  }
@@ -7475,12 +7479,19 @@ var ts;
7475
7479
  }
7476
7480
  function getModifiedTime(path) {
7477
7481
  var _a;
7482
+ // Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
7483
+ // the CPU time performance.
7484
+ var originalStackTraceLimit = Error.stackTraceLimit;
7485
+ Error.stackTraceLimit = 0;
7478
7486
  try {
7479
7487
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
7480
7488
  }
7481
7489
  catch (e) {
7482
7490
  return undefined;
7483
7491
  }
7492
+ finally {
7493
+ Error.stackTraceLimit = originalStackTraceLimit;
7494
+ }
7484
7495
  }
7485
7496
  function setModifiedTime(path, time) {
7486
7497
  try {
@@ -8465,7 +8476,7 @@ var ts;
8465
8476
  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'."),
8466
8477
  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'."),
8467
8478
  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."),
8468
- Dynamic_import_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "Dynamic_import_cannot_have_type_arguments_1326", "Dynamic import cannot have type arguments."),
8479
+ 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."),
8469
8480
  String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
8470
8481
  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."),
8471
8482
  _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}()'?"),
@@ -8852,7 +8863,6 @@ var ts;
8852
8863
  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."),
8853
8864
  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."),
8854
8865
  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}'?"),
8855
- 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."),
8856
8866
  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}'?"),
8857
8867
  Object_is_of_type_unknown: diag(2571, ts.DiagnosticCategory.Error, "Object_is_of_type_unknown_2571", "Object is of type 'unknown'."),
8858
8868
  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."),
@@ -9066,6 +9076,7 @@ var ts;
9066
9076
  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}'."),
9067
9077
  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"),
9068
9078
  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."),
9079
+ 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."),
9069
9080
  Initializer_for_property_0: diag(2811, ts.DiagnosticCategory.Error, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
9070
9081
  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'."),
9071
9082
  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}'."),
@@ -9493,8 +9504,8 @@ var ts;
9493
9504
  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"),
9494
9505
  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"),
9495
9506
  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."),
9496
- 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}'"),
9497
- 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}'"),
9507
+ 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}'"),
9508
+ 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}'"),
9498
9509
  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"),
9499
9510
  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"),
9500
9511
  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"),
@@ -9538,6 +9549,8 @@ var ts;
9538
9549
  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}'."),
9539
9550
  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}'."),
9540
9551
  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."),
9552
+ 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"),
9553
+ 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"),
9541
9554
  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}'"),
9542
9555
  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."),
9543
9556
  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."),
@@ -20342,6 +20355,10 @@ var ts;
20342
20355
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
20343
20356
  }
20344
20357
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
20358
+ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
20359
+ return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
20360
+ }
20361
+ ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
20345
20362
  function getCompilerOptionValue(options, option) {
20346
20363
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
20347
20364
  }
@@ -38156,7 +38173,8 @@ var ts;
38156
38173
  if (!comment) {
38157
38174
  comment = parseTrailingTagComments(start, getNodePos(), indent, indentText);
38158
38175
  }
38159
- return finishNode(factory.createJSDocCallbackTag(tagName, typeExpression, fullName, comment), start);
38176
+ var end = comment !== undefined ? getNodePos() : typeExpression.end;
38177
+ return finishNode(factory.createJSDocCallbackTag(tagName, typeExpression, fullName, comment), start, end);
38160
38178
  }
38161
38179
  function escapedTextsEqual(a, b) {
38162
38180
  while (!ts.isIdentifier(a) || !ts.isIdentifier(b)) {
@@ -39379,6 +39397,7 @@ var ts;
39379
39397
  type: "boolean",
39380
39398
  affectsSemanticDiagnostics: true,
39381
39399
  affectsEmit: true,
39400
+ affectsMultiFileEmitBuildInfo: true,
39382
39401
  category: ts.Diagnostics.Watch_and_Build_Modes,
39383
39402
  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,
39384
39403
  defaultValueDescription: false,
@@ -39413,12 +39432,40 @@ var ts;
39413
39432
  affectsSourceFile: true,
39414
39433
  affectsModuleResolution: true,
39415
39434
  affectsEmit: true,
39435
+ affectsMultiFileEmitBuildInfo: true,
39416
39436
  paramType: ts.Diagnostics.VERSION,
39417
39437
  showInSimplifiedHelpView: true,
39418
39438
  category: ts.Diagnostics.Language_and_Environment,
39419
39439
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
39420
39440
  defaultValueDescription: 0 /* ES3 */,
39421
39441
  };
39442
+ /*@internal*/
39443
+ ts.moduleOptionDeclaration = {
39444
+ name: "module",
39445
+ shortName: "m",
39446
+ type: new ts.Map(ts.getEntries({
39447
+ none: ts.ModuleKind.None,
39448
+ commonjs: ts.ModuleKind.CommonJS,
39449
+ amd: ts.ModuleKind.AMD,
39450
+ system: ts.ModuleKind.System,
39451
+ umd: ts.ModuleKind.UMD,
39452
+ es6: ts.ModuleKind.ES2015,
39453
+ es2015: ts.ModuleKind.ES2015,
39454
+ es2020: ts.ModuleKind.ES2020,
39455
+ es2022: ts.ModuleKind.ES2022,
39456
+ esnext: ts.ModuleKind.ESNext,
39457
+ node12: ts.ModuleKind.Node12,
39458
+ nodenext: ts.ModuleKind.NodeNext,
39459
+ })),
39460
+ affectsModuleResolution: true,
39461
+ affectsEmit: true,
39462
+ affectsMultiFileEmitBuildInfo: true,
39463
+ paramType: ts.Diagnostics.KIND,
39464
+ showInSimplifiedHelpView: true,
39465
+ category: ts.Diagnostics.Modules,
39466
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
39467
+ defaultValueDescription: undefined,
39468
+ };
39422
39469
  var commandOptionsWithoutBuild = [
39423
39470
  // CommandLine only options
39424
39471
  {
@@ -39480,37 +39527,14 @@ var ts;
39480
39527
  category: ts.Diagnostics.Command_line_Options,
39481
39528
  affectsSemanticDiagnostics: true,
39482
39529
  affectsEmit: true,
39530
+ affectsMultiFileEmitBuildInfo: true,
39483
39531
  isCommandLineOnly: true,
39484
39532
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
39485
39533
  defaultValueDescription: false,
39486
39534
  },
39487
39535
  // Basic
39488
39536
  ts.targetOptionDeclaration,
39489
- {
39490
- name: "module",
39491
- shortName: "m",
39492
- type: new ts.Map(ts.getEntries({
39493
- none: ts.ModuleKind.None,
39494
- commonjs: ts.ModuleKind.CommonJS,
39495
- amd: ts.ModuleKind.AMD,
39496
- system: ts.ModuleKind.System,
39497
- umd: ts.ModuleKind.UMD,
39498
- es6: ts.ModuleKind.ES2015,
39499
- es2015: ts.ModuleKind.ES2015,
39500
- es2020: ts.ModuleKind.ES2020,
39501
- es2022: ts.ModuleKind.ES2022,
39502
- esnext: ts.ModuleKind.ESNext,
39503
- node12: ts.ModuleKind.Node12,
39504
- nodenext: ts.ModuleKind.NodeNext,
39505
- })),
39506
- affectsModuleResolution: true,
39507
- affectsEmit: true,
39508
- paramType: ts.Diagnostics.KIND,
39509
- showInSimplifiedHelpView: true,
39510
- category: ts.Diagnostics.Modules,
39511
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
39512
- defaultValueDescription: undefined,
39513
- },
39537
+ ts.moduleOptionDeclaration,
39514
39538
  {
39515
39539
  name: "lib",
39516
39540
  type: "list",
@@ -39547,6 +39571,7 @@ var ts;
39547
39571
  type: jsxOptionMap,
39548
39572
  affectsSourceFile: true,
39549
39573
  affectsEmit: true,
39574
+ affectsMultiFileEmitBuildInfo: true,
39550
39575
  affectsModuleResolution: true,
39551
39576
  paramType: ts.Diagnostics.KIND,
39552
39577
  showInSimplifiedHelpView: true,
@@ -39559,6 +39584,7 @@ var ts;
39559
39584
  shortName: "d",
39560
39585
  type: "boolean",
39561
39586
  affectsEmit: true,
39587
+ affectsMultiFileEmitBuildInfo: true,
39562
39588
  showInSimplifiedHelpView: true,
39563
39589
  category: ts.Diagnostics.Emit,
39564
39590
  transpileOptionValue: undefined,
@@ -39569,6 +39595,7 @@ var ts;
39569
39595
  name: "declarationMap",
39570
39596
  type: "boolean",
39571
39597
  affectsEmit: true,
39598
+ affectsMultiFileEmitBuildInfo: true,
39572
39599
  showInSimplifiedHelpView: true,
39573
39600
  category: ts.Diagnostics.Emit,
39574
39601
  transpileOptionValue: undefined,
@@ -39579,6 +39606,7 @@ var ts;
39579
39606
  name: "emitDeclarationOnly",
39580
39607
  type: "boolean",
39581
39608
  affectsEmit: true,
39609
+ affectsMultiFileEmitBuildInfo: true,
39582
39610
  showInSimplifiedHelpView: true,
39583
39611
  category: ts.Diagnostics.Emit,
39584
39612
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -39589,6 +39617,7 @@ var ts;
39589
39617
  name: "sourceMap",
39590
39618
  type: "boolean",
39591
39619
  affectsEmit: true,
39620
+ affectsMultiFileEmitBuildInfo: true,
39592
39621
  showInSimplifiedHelpView: true,
39593
39622
  category: ts.Diagnostics.Emit,
39594
39623
  defaultValueDescription: false,
@@ -39598,6 +39627,9 @@ var ts;
39598
39627
  name: "outFile",
39599
39628
  type: "string",
39600
39629
  affectsEmit: true,
39630
+ affectsMultiFileEmitBuildInfo: true,
39631
+ affectsDeclarationPath: true,
39632
+ affectsBundleEmitBuildInfo: true,
39601
39633
  isFilePath: true,
39602
39634
  paramType: ts.Diagnostics.FILE,
39603
39635
  showInSimplifiedHelpView: true,
@@ -39609,6 +39641,8 @@ var ts;
39609
39641
  name: "outDir",
39610
39642
  type: "string",
39611
39643
  affectsEmit: true,
39644
+ affectsMultiFileEmitBuildInfo: true,
39645
+ affectsDeclarationPath: true,
39612
39646
  isFilePath: true,
39613
39647
  paramType: ts.Diagnostics.DIRECTORY,
39614
39648
  showInSimplifiedHelpView: true,
@@ -39619,6 +39653,8 @@ var ts;
39619
39653
  name: "rootDir",
39620
39654
  type: "string",
39621
39655
  affectsEmit: true,
39656
+ affectsMultiFileEmitBuildInfo: true,
39657
+ affectsDeclarationPath: true,
39622
39658
  isFilePath: true,
39623
39659
  paramType: ts.Diagnostics.LOCATION,
39624
39660
  category: ts.Diagnostics.Modules,
@@ -39629,6 +39665,8 @@ var ts;
39629
39665
  name: "composite",
39630
39666
  type: "boolean",
39631
39667
  affectsEmit: true,
39668
+ affectsMultiFileEmitBuildInfo: true,
39669
+ affectsBundleEmitBuildInfo: true,
39632
39670
  isTSConfigOnly: true,
39633
39671
  category: ts.Diagnostics.Projects,
39634
39672
  transpileOptionValue: undefined,
@@ -39639,6 +39677,8 @@ var ts;
39639
39677
  name: "tsBuildInfoFile",
39640
39678
  type: "string",
39641
39679
  affectsEmit: true,
39680
+ affectsMultiFileEmitBuildInfo: true,
39681
+ affectsBundleEmitBuildInfo: true,
39642
39682
  isFilePath: true,
39643
39683
  paramType: ts.Diagnostics.FILE,
39644
39684
  category: ts.Diagnostics.Projects,
@@ -39650,6 +39690,7 @@ var ts;
39650
39690
  name: "removeComments",
39651
39691
  type: "boolean",
39652
39692
  affectsEmit: true,
39693
+ affectsMultiFileEmitBuildInfo: true,
39653
39694
  showInSimplifiedHelpView: true,
39654
39695
  category: ts.Diagnostics.Emit,
39655
39696
  defaultValueDescription: false,
@@ -39668,6 +39709,7 @@ var ts;
39668
39709
  name: "importHelpers",
39669
39710
  type: "boolean",
39670
39711
  affectsEmit: true,
39712
+ affectsMultiFileEmitBuildInfo: true,
39671
39713
  category: ts.Diagnostics.Emit,
39672
39714
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
39673
39715
  defaultValueDescription: false,
@@ -39681,6 +39723,7 @@ var ts;
39681
39723
  })),
39682
39724
  affectsEmit: true,
39683
39725
  affectsSemanticDiagnostics: true,
39726
+ affectsMultiFileEmitBuildInfo: true,
39684
39727
  category: ts.Diagnostics.Emit,
39685
39728
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
39686
39729
  defaultValueDescription: 0 /* Remove */,
@@ -39689,6 +39732,7 @@ var ts;
39689
39732
  name: "downlevelIteration",
39690
39733
  type: "boolean",
39691
39734
  affectsEmit: true,
39735
+ affectsMultiFileEmitBuildInfo: true,
39692
39736
  category: ts.Diagnostics.Emit,
39693
39737
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
39694
39738
  defaultValueDescription: false,
@@ -39707,6 +39751,9 @@ var ts;
39707
39751
  type: "boolean",
39708
39752
  // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
39709
39753
  // The value of each strictFlag depends on own strictFlag value or this and never accessed directly.
39754
+ // But we need to store `strict` in builf info, even though it won't be examined directly, so that the
39755
+ // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly
39756
+ affectsMultiFileEmitBuildInfo: true,
39710
39757
  showInSimplifiedHelpView: true,
39711
39758
  category: ts.Diagnostics.Type_Checking,
39712
39759
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -39716,6 +39763,7 @@ var ts;
39716
39763
  name: "noImplicitAny",
39717
39764
  type: "boolean",
39718
39765
  affectsSemanticDiagnostics: true,
39766
+ affectsMultiFileEmitBuildInfo: true,
39719
39767
  strictFlag: true,
39720
39768
  category: ts.Diagnostics.Type_Checking,
39721
39769
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -39725,6 +39773,7 @@ var ts;
39725
39773
  name: "strictNullChecks",
39726
39774
  type: "boolean",
39727
39775
  affectsSemanticDiagnostics: true,
39776
+ affectsMultiFileEmitBuildInfo: true,
39728
39777
  strictFlag: true,
39729
39778
  category: ts.Diagnostics.Type_Checking,
39730
39779
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -39733,6 +39782,8 @@ var ts;
39733
39782
  {
39734
39783
  name: "strictFunctionTypes",
39735
39784
  type: "boolean",
39785
+ affectsSemanticDiagnostics: true,
39786
+ affectsMultiFileEmitBuildInfo: true,
39736
39787
  strictFlag: true,
39737
39788
  category: ts.Diagnostics.Type_Checking,
39738
39789
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -39741,6 +39792,8 @@ var ts;
39741
39792
  {
39742
39793
  name: "strictBindCallApply",
39743
39794
  type: "boolean",
39795
+ affectsSemanticDiagnostics: true,
39796
+ affectsMultiFileEmitBuildInfo: true,
39744
39797
  strictFlag: true,
39745
39798
  category: ts.Diagnostics.Type_Checking,
39746
39799
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -39750,6 +39803,7 @@ var ts;
39750
39803
  name: "strictPropertyInitialization",
39751
39804
  type: "boolean",
39752
39805
  affectsSemanticDiagnostics: true,
39806
+ affectsMultiFileEmitBuildInfo: true,
39753
39807
  strictFlag: true,
39754
39808
  category: ts.Diagnostics.Type_Checking,
39755
39809
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -39759,6 +39813,7 @@ var ts;
39759
39813
  name: "noImplicitThis",
39760
39814
  type: "boolean",
39761
39815
  affectsSemanticDiagnostics: true,
39816
+ affectsMultiFileEmitBuildInfo: true,
39762
39817
  strictFlag: true,
39763
39818
  category: ts.Diagnostics.Type_Checking,
39764
39819
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -39768,6 +39823,7 @@ var ts;
39768
39823
  name: "useUnknownInCatchVariables",
39769
39824
  type: "boolean",
39770
39825
  affectsSemanticDiagnostics: true,
39826
+ affectsMultiFileEmitBuildInfo: true,
39771
39827
  strictFlag: true,
39772
39828
  category: ts.Diagnostics.Type_Checking,
39773
39829
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -39777,6 +39833,8 @@ var ts;
39777
39833
  name: "alwaysStrict",
39778
39834
  type: "boolean",
39779
39835
  affectsSourceFile: true,
39836
+ affectsEmit: true,
39837
+ affectsMultiFileEmitBuildInfo: true,
39780
39838
  strictFlag: true,
39781
39839
  category: ts.Diagnostics.Type_Checking,
39782
39840
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -39787,6 +39845,7 @@ var ts;
39787
39845
  name: "noUnusedLocals",
39788
39846
  type: "boolean",
39789
39847
  affectsSemanticDiagnostics: true,
39848
+ affectsMultiFileEmitBuildInfo: true,
39790
39849
  category: ts.Diagnostics.Type_Checking,
39791
39850
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
39792
39851
  defaultValueDescription: false,
@@ -39795,6 +39854,7 @@ var ts;
39795
39854
  name: "noUnusedParameters",
39796
39855
  type: "boolean",
39797
39856
  affectsSemanticDiagnostics: true,
39857
+ affectsMultiFileEmitBuildInfo: true,
39798
39858
  category: ts.Diagnostics.Type_Checking,
39799
39859
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
39800
39860
  defaultValueDescription: false,
@@ -39803,6 +39863,7 @@ var ts;
39803
39863
  name: "exactOptionalPropertyTypes",
39804
39864
  type: "boolean",
39805
39865
  affectsSemanticDiagnostics: true,
39866
+ affectsMultiFileEmitBuildInfo: true,
39806
39867
  category: ts.Diagnostics.Type_Checking,
39807
39868
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
39808
39869
  defaultValueDescription: false,
@@ -39811,6 +39872,7 @@ var ts;
39811
39872
  name: "noImplicitReturns",
39812
39873
  type: "boolean",
39813
39874
  affectsSemanticDiagnostics: true,
39875
+ affectsMultiFileEmitBuildInfo: true,
39814
39876
  category: ts.Diagnostics.Type_Checking,
39815
39877
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
39816
39878
  defaultValueDescription: false,
@@ -39820,6 +39882,7 @@ var ts;
39820
39882
  type: "boolean",
39821
39883
  affectsBindDiagnostics: true,
39822
39884
  affectsSemanticDiagnostics: true,
39885
+ affectsMultiFileEmitBuildInfo: true,
39823
39886
  category: ts.Diagnostics.Type_Checking,
39824
39887
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
39825
39888
  defaultValueDescription: false,
@@ -39828,6 +39891,7 @@ var ts;
39828
39891
  name: "noUncheckedIndexedAccess",
39829
39892
  type: "boolean",
39830
39893
  affectsSemanticDiagnostics: true,
39894
+ affectsMultiFileEmitBuildInfo: true,
39831
39895
  category: ts.Diagnostics.Type_Checking,
39832
39896
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
39833
39897
  defaultValueDescription: false,
@@ -39836,6 +39900,7 @@ var ts;
39836
39900
  name: "noImplicitOverride",
39837
39901
  type: "boolean",
39838
39902
  affectsSemanticDiagnostics: true,
39903
+ affectsMultiFileEmitBuildInfo: true,
39839
39904
  category: ts.Diagnostics.Type_Checking,
39840
39905
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
39841
39906
  defaultValueDescription: false,
@@ -39843,6 +39908,8 @@ var ts;
39843
39908
  {
39844
39909
  name: "noPropertyAccessFromIndexSignature",
39845
39910
  type: "boolean",
39911
+ affectsSemanticDiagnostics: true,
39912
+ affectsMultiFileEmitBuildInfo: true,
39846
39913
  showInSimplifiedHelpView: false,
39847
39914
  category: ts.Diagnostics.Type_Checking,
39848
39915
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -39928,6 +39995,7 @@ var ts;
39928
39995
  name: "allowSyntheticDefaultImports",
39929
39996
  type: "boolean",
39930
39997
  affectsSemanticDiagnostics: true,
39998
+ affectsMultiFileEmitBuildInfo: true,
39931
39999
  category: ts.Diagnostics.Interop_Constraints,
39932
40000
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
39933
40001
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -39937,6 +40005,7 @@ var ts;
39937
40005
  type: "boolean",
39938
40006
  affectsSemanticDiagnostics: true,
39939
40007
  affectsEmit: true,
40008
+ affectsMultiFileEmitBuildInfo: true,
39940
40009
  showInSimplifiedHelpView: true,
39941
40010
  category: ts.Diagnostics.Interop_Constraints,
39942
40011
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -39953,6 +40022,7 @@ var ts;
39953
40022
  name: "allowUmdGlobalAccess",
39954
40023
  type: "boolean",
39955
40024
  affectsSemanticDiagnostics: true,
40025
+ affectsMultiFileEmitBuildInfo: true,
39956
40026
  category: ts.Diagnostics.Modules,
39957
40027
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
39958
40028
  defaultValueDescription: false,
@@ -39974,6 +40044,7 @@ var ts;
39974
40044
  name: "sourceRoot",
39975
40045
  type: "string",
39976
40046
  affectsEmit: true,
40047
+ affectsMultiFileEmitBuildInfo: true,
39977
40048
  paramType: ts.Diagnostics.LOCATION,
39978
40049
  category: ts.Diagnostics.Emit,
39979
40050
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -39982,6 +40053,7 @@ var ts;
39982
40053
  name: "mapRoot",
39983
40054
  type: "string",
39984
40055
  affectsEmit: true,
40056
+ affectsMultiFileEmitBuildInfo: true,
39985
40057
  paramType: ts.Diagnostics.LOCATION,
39986
40058
  category: ts.Diagnostics.Emit,
39987
40059
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -39990,6 +40062,7 @@ var ts;
39990
40062
  name: "inlineSourceMap",
39991
40063
  type: "boolean",
39992
40064
  affectsEmit: true,
40065
+ affectsMultiFileEmitBuildInfo: true,
39993
40066
  category: ts.Diagnostics.Emit,
39994
40067
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
39995
40068
  defaultValueDescription: false,
@@ -39998,6 +40071,7 @@ var ts;
39998
40071
  name: "inlineSources",
39999
40072
  type: "boolean",
40000
40073
  affectsEmit: true,
40074
+ affectsMultiFileEmitBuildInfo: true,
40001
40075
  category: ts.Diagnostics.Emit,
40002
40076
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
40003
40077
  defaultValueDescription: false,
@@ -40007,6 +40081,7 @@ var ts;
40007
40081
  name: "experimentalDecorators",
40008
40082
  type: "boolean",
40009
40083
  affectsSemanticDiagnostics: true,
40084
+ affectsMultiFileEmitBuildInfo: true,
40010
40085
  category: ts.Diagnostics.Language_and_Environment,
40011
40086
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
40012
40087
  defaultValueDescription: false,
@@ -40016,6 +40091,7 @@ var ts;
40016
40091
  type: "boolean",
40017
40092
  affectsSemanticDiagnostics: true,
40018
40093
  affectsEmit: true,
40094
+ affectsMultiFileEmitBuildInfo: true,
40019
40095
  category: ts.Diagnostics.Language_and_Environment,
40020
40096
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
40021
40097
  defaultValueDescription: false,
@@ -40040,6 +40116,7 @@ var ts;
40040
40116
  type: "string",
40041
40117
  affectsSemanticDiagnostics: true,
40042
40118
  affectsEmit: true,
40119
+ affectsMultiFileEmitBuildInfo: true,
40043
40120
  affectsModuleResolution: true,
40044
40121
  category: ts.Diagnostics.Language_and_Environment,
40045
40122
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -40057,6 +40134,9 @@ var ts;
40057
40134
  name: "out",
40058
40135
  type: "string",
40059
40136
  affectsEmit: true,
40137
+ affectsMultiFileEmitBuildInfo: true,
40138
+ affectsDeclarationPath: true,
40139
+ affectsBundleEmitBuildInfo: true,
40060
40140
  isFilePath: false,
40061
40141
  // for correct behaviour, please use outFile
40062
40142
  category: ts.Diagnostics.Backwards_Compatibility,
@@ -40068,6 +40148,7 @@ var ts;
40068
40148
  name: "reactNamespace",
40069
40149
  type: "string",
40070
40150
  affectsEmit: true,
40151
+ affectsMultiFileEmitBuildInfo: true,
40071
40152
  category: ts.Diagnostics.Language_and_Environment,
40072
40153
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
40073
40154
  defaultValueDescription: "`React`",
@@ -40075,6 +40156,8 @@ var ts;
40075
40156
  {
40076
40157
  name: "skipDefaultLibCheck",
40077
40158
  type: "boolean",
40159
+ // We need to store these to determine whether `lib` files need to be rechecked
40160
+ affectsMultiFileEmitBuildInfo: true,
40078
40161
  category: ts.Diagnostics.Completeness,
40079
40162
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
40080
40163
  defaultValueDescription: false,
@@ -40090,6 +40173,7 @@ var ts;
40090
40173
  name: "emitBOM",
40091
40174
  type: "boolean",
40092
40175
  affectsEmit: true,
40176
+ affectsMultiFileEmitBuildInfo: true,
40093
40177
  category: ts.Diagnostics.Emit,
40094
40178
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
40095
40179
  defaultValueDescription: false,
@@ -40101,6 +40185,7 @@ var ts;
40101
40185
  lf: 1 /* LineFeed */
40102
40186
  })),
40103
40187
  affectsEmit: true,
40188
+ affectsMultiFileEmitBuildInfo: true,
40104
40189
  paramType: ts.Diagnostics.NEWLINE,
40105
40190
  category: ts.Diagnostics.Emit,
40106
40191
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -40110,6 +40195,7 @@ var ts;
40110
40195
  name: "noErrorTruncation",
40111
40196
  type: "boolean",
40112
40197
  affectsSemanticDiagnostics: true,
40198
+ affectsMultiFileEmitBuildInfo: true,
40113
40199
  category: ts.Diagnostics.Output_Formatting,
40114
40200
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
40115
40201
  defaultValueDescription: false,
@@ -40140,6 +40226,7 @@ var ts;
40140
40226
  name: "stripInternal",
40141
40227
  type: "boolean",
40142
40228
  affectsEmit: true,
40229
+ affectsMultiFileEmitBuildInfo: true,
40143
40230
  category: ts.Diagnostics.Emit,
40144
40231
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
40145
40232
  defaultValueDescription: false,
@@ -40180,6 +40267,7 @@ var ts;
40180
40267
  name: "noImplicitUseStrict",
40181
40268
  type: "boolean",
40182
40269
  affectsSemanticDiagnostics: true,
40270
+ affectsMultiFileEmitBuildInfo: true,
40183
40271
  category: ts.Diagnostics.Backwards_Compatibility,
40184
40272
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
40185
40273
  defaultValueDescription: false,
@@ -40188,6 +40276,7 @@ var ts;
40188
40276
  name: "noEmitHelpers",
40189
40277
  type: "boolean",
40190
40278
  affectsEmit: true,
40279
+ affectsMultiFileEmitBuildInfo: true,
40191
40280
  category: ts.Diagnostics.Emit,
40192
40281
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
40193
40282
  defaultValueDescription: false,
@@ -40196,6 +40285,7 @@ var ts;
40196
40285
  name: "noEmitOnError",
40197
40286
  type: "boolean",
40198
40287
  affectsEmit: true,
40288
+ affectsMultiFileEmitBuildInfo: true,
40199
40289
  category: ts.Diagnostics.Emit,
40200
40290
  transpileOptionValue: undefined,
40201
40291
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -40205,6 +40295,7 @@ var ts;
40205
40295
  name: "preserveConstEnums",
40206
40296
  type: "boolean",
40207
40297
  affectsEmit: true,
40298
+ affectsMultiFileEmitBuildInfo: true,
40208
40299
  category: ts.Diagnostics.Emit,
40209
40300
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
40210
40301
  defaultValueDescription: false,
@@ -40213,6 +40304,8 @@ var ts;
40213
40304
  name: "declarationDir",
40214
40305
  type: "string",
40215
40306
  affectsEmit: true,
40307
+ affectsMultiFileEmitBuildInfo: true,
40308
+ affectsDeclarationPath: true,
40216
40309
  isFilePath: true,
40217
40310
  paramType: ts.Diagnostics.DIRECTORY,
40218
40311
  category: ts.Diagnostics.Emit,
@@ -40222,6 +40315,8 @@ var ts;
40222
40315
  {
40223
40316
  name: "skipLibCheck",
40224
40317
  type: "boolean",
40318
+ // We need to store these to determine whether `lib` files need to be rechecked
40319
+ affectsMultiFileEmitBuildInfo: true,
40225
40320
  category: ts.Diagnostics.Completeness,
40226
40321
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
40227
40322
  defaultValueDescription: false,
@@ -40231,6 +40326,7 @@ var ts;
40231
40326
  type: "boolean",
40232
40327
  affectsBindDiagnostics: true,
40233
40328
  affectsSemanticDiagnostics: true,
40329
+ affectsMultiFileEmitBuildInfo: true,
40234
40330
  category: ts.Diagnostics.Type_Checking,
40235
40331
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
40236
40332
  defaultValueDescription: undefined,
@@ -40240,6 +40336,7 @@ var ts;
40240
40336
  type: "boolean",
40241
40337
  affectsBindDiagnostics: true,
40242
40338
  affectsSemanticDiagnostics: true,
40339
+ affectsMultiFileEmitBuildInfo: true,
40243
40340
  category: ts.Diagnostics.Type_Checking,
40244
40341
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
40245
40342
  defaultValueDescription: undefined,
@@ -40248,6 +40345,7 @@ var ts;
40248
40345
  name: "suppressExcessPropertyErrors",
40249
40346
  type: "boolean",
40250
40347
  affectsSemanticDiagnostics: true,
40348
+ affectsMultiFileEmitBuildInfo: true,
40251
40349
  category: ts.Diagnostics.Backwards_Compatibility,
40252
40350
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
40253
40351
  defaultValueDescription: false,
@@ -40256,6 +40354,7 @@ var ts;
40256
40354
  name: "suppressImplicitAnyIndexErrors",
40257
40355
  type: "boolean",
40258
40356
  affectsSemanticDiagnostics: true,
40357
+ affectsMultiFileEmitBuildInfo: true,
40259
40358
  category: ts.Diagnostics.Backwards_Compatibility,
40260
40359
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
40261
40360
  defaultValueDescription: false,
@@ -40280,6 +40379,7 @@ var ts;
40280
40379
  name: "noStrictGenericChecks",
40281
40380
  type: "boolean",
40282
40381
  affectsSemanticDiagnostics: true,
40382
+ affectsMultiFileEmitBuildInfo: true,
40283
40383
  category: ts.Diagnostics.Backwards_Compatibility,
40284
40384
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
40285
40385
  defaultValueDescription: false,
@@ -40289,6 +40389,7 @@ var ts;
40289
40389
  type: "boolean",
40290
40390
  affectsSemanticDiagnostics: true,
40291
40391
  affectsEmit: true,
40392
+ affectsMultiFileEmitBuildInfo: true,
40292
40393
  category: ts.Diagnostics.Language_and_Environment,
40293
40394
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
40294
40395
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -40297,6 +40398,7 @@ var ts;
40297
40398
  name: "preserveValueImports",
40298
40399
  type: "boolean",
40299
40400
  affectsEmit: true,
40401
+ affectsMultiFileEmitBuildInfo: true,
40300
40402
  category: ts.Diagnostics.Emit,
40301
40403
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
40302
40404
  defaultValueDescription: false,
@@ -40340,6 +40442,8 @@ var ts;
40340
40442
  /* @internal */
40341
40443
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
40342
40444
  /* @internal */
40445
+ ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
40446
+ /* @internal */
40343
40447
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
40344
40448
  /* @internal */
40345
40449
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -41195,6 +41299,7 @@ var ts;
41195
41299
  return optionDefinition.type;
41196
41300
  }
41197
41301
  }
41302
+ /* @internal */
41198
41303
  function getNameOfCompilerOptionValue(value, customTypeMap) {
41199
41304
  // There is a typeMap associated with this command-line option so use it to map value back to its name
41200
41305
  return ts.forEachEntry(customTypeMap, function (mapValue, key) {
@@ -41203,6 +41308,7 @@ var ts;
41203
41308
  }
41204
41309
  });
41205
41310
  }
41311
+ ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
41206
41312
  function serializeCompilerOptions(options, pathOptions) {
41207
41313
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
41208
41314
  }
@@ -65515,20 +65621,6 @@ var ts;
65515
65621
  }
65516
65622
  }
65517
65623
  }
65518
- if (relation === comparableRelation && sourceFlags & 262144 /* TypeParameter */) {
65519
- // This is a carve-out in comparability to essentially forbid comparing a type parameter
65520
- // with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!)
65521
- var constraint = getConstraintOfTypeParameter(source);
65522
- if (constraint && hasNonCircularBaseConstraint(source)) {
65523
- while (constraint && constraint.flags & 262144 /* TypeParameter */) {
65524
- if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false)) {
65525
- return result;
65526
- }
65527
- constraint = getConstraintOfTypeParameter(constraint);
65528
- }
65529
- }
65530
- return 0 /* False */;
65531
- }
65532
65624
  }
65533
65625
  else if (targetFlags & 4194304 /* Index */) {
65534
65626
  var targetType_1 = target.type;
@@ -65732,7 +65824,7 @@ var ts;
65732
65824
  if (sourceFlags & 8650752 /* TypeVariable */) {
65733
65825
  // IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
65734
65826
  if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
65735
- var constraint = getConstraintOfType(source) || unknownType;
65827
+ var constraint = getConstraintOfType(source);
65736
65828
  if (!strictNullChecks && (!constraint || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */))) {
65737
65829
  // A type variable with no constraint is not related to the non-primitive object type.
65738
65830
  if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
@@ -65741,12 +65833,12 @@ var ts;
65741
65833
  }
65742
65834
  }
65743
65835
  // 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
65744
- else if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
65836
+ else if (constraint && (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState))) {
65745
65837
  resetErrorInfo(saveErrorInfo);
65746
65838
  return result;
65747
65839
  }
65748
65840
  // slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
65749
- else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
65841
+ else if (constraint && (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState))) {
65750
65842
  resetErrorInfo(saveErrorInfo);
65751
65843
  return result;
65752
65844
  }
@@ -75800,8 +75892,14 @@ var ts;
75800
75892
  var parameterRange = hasRestParameter ? min
75801
75893
  : min < max ? min + "-" + max
75802
75894
  : min;
75803
- var error = hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1
75804
- : 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
75895
+ var isVoidPromiseError = !hasRestParameter && parameterRange === 1 && args.length === 0 && isPromiseResolveArityError(node);
75896
+ if (isVoidPromiseError && ts.isInJSFile(node)) {
75897
+ 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);
75898
+ }
75899
+ var error = hasRestParameter
75900
+ ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1
75901
+ : isVoidPromiseError
75902
+ ? ts.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise
75805
75903
  : ts.Diagnostics.Expected_0_arguments_but_got_1;
75806
75904
  if (min < args.length && args.length < max) {
75807
75905
  // between min and max, but with no matching overload
@@ -82853,7 +82951,7 @@ var ts;
82853
82951
  }
82854
82952
  var yieldType = getIterationTypeOfIterable(use, 0 /* Yield */, inputType, /*errorNode*/ undefined);
82855
82953
  if (yieldType) {
82856
- return [ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators, false];
82954
+ return [ts.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, false];
82857
82955
  }
82858
82956
  if (isES2015OrLaterIterable((_a = inputType.symbol) === null || _a === void 0 ? void 0 : _a.escapedName)) {
82859
82957
  return [ts.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, true];
@@ -86130,7 +86228,7 @@ var ts;
86130
86228
  var symbol = getIntrinsicTagSymbol(name.parent);
86131
86229
  return symbol === unknownSymbol ? undefined : symbol;
86132
86230
  }
86133
- var result = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ !isJSDoc_1, ts.getHostSignatureFromJSDoc(name));
86231
+ var result = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /* dontResolveAlias */ true, ts.getHostSignatureFromJSDoc(name));
86134
86232
  if (!result && isJSDoc_1) {
86135
86233
  var container = ts.findAncestor(name, ts.or(ts.isClassLike, ts.isInterfaceDeclaration));
86136
86234
  if (container) {
@@ -87987,6 +88085,9 @@ var ts;
87987
88085
  return ts.some(types, checkGrammarExpressionWithTypeArguments);
87988
88086
  }
87989
88087
  function checkGrammarExpressionWithTypeArguments(node) {
88088
+ if (ts.isExpressionWithTypeArguments(node) && ts.isImportKeyword(node.expression) && node.typeArguments) {
88089
+ 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);
88090
+ }
87990
88091
  return checkGrammarTypeArguments(node, node.typeArguments);
87991
88092
  }
87992
88093
  function checkGrammarClassDeclarationHeritageClauses(node) {
@@ -88928,7 +89029,7 @@ var ts;
88928
89029
  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);
88929
89030
  }
88930
89031
  if (node.typeArguments) {
88931
- return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_import_cannot_have_type_arguments);
89032
+ 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);
88932
89033
  }
88933
89034
  var nodeArguments = node.arguments;
88934
89035
  if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) {
@@ -108724,6 +108825,8 @@ var ts;
108724
108825
  var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
108725
108826
  errorFallbackNode = undefined;
108726
108827
  var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* Const */));
108828
+ preserveJsDoc(statement, input);
108829
+ ts.removeAllComments(input);
108727
108830
  return [statement, factory.updateExportAssignment(input, input.decorators, input.modifiers, newId)];
108728
108831
  }
108729
108832
  }
@@ -110059,7 +110162,8 @@ var ts;
110059
110162
  return;
110060
110163
  }
110061
110164
  var version = ts.version; // Extracted into a const so the form is stable between namespace and module
110062
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), /*writeByteOrderMark*/ false);
110165
+ var buildInfo = { bundle: bundle, program: program, version: version };
110166
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
110063
110167
  }
110064
110168
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
110065
110169
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -110213,13 +110317,18 @@ var ts;
110213
110317
  if (sourceMapFilePath) {
110214
110318
  var sourceMap = sourceMapGenerator.toString();
110215
110319
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110320
+ if (printer.bundleFileInfo)
110321
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
110216
110322
  }
110217
110323
  }
110218
110324
  else {
110219
110325
  writer.writeLine();
110220
110326
  }
110221
110327
  // Write the output file
110222
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110328
+ var text = writer.getText();
110329
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110330
+ if (printer.bundleFileInfo)
110331
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
110223
110332
  // Reset state
110224
110333
  writer.clear();
110225
110334
  }
@@ -110362,34 +110471,54 @@ var ts;
110362
110471
  }
110363
110472
  /*@internal*/
110364
110473
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
110474
+ var createHash = ts.maybeBind(host, host.createHash);
110365
110475
  var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
110366
- var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
110367
- if (!buildInfoText)
110476
+ var buildInfo;
110477
+ if (host.getBuildInfo) {
110478
+ var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
110479
+ if (!hostBuildInfo)
110480
+ return buildInfoPath;
110481
+ buildInfo = hostBuildInfo;
110482
+ }
110483
+ else {
110484
+ var buildInfoText = host.readFile(buildInfoPath);
110485
+ if (!buildInfoText)
110486
+ return buildInfoPath;
110487
+ buildInfo = getBuildInfo(buildInfoText);
110488
+ }
110489
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
110368
110490
  return buildInfoPath;
110369
110491
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
110370
110492
  if (!jsFileText)
110371
110493
  return jsFilePath;
110494
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
110495
+ return jsFilePath;
110372
110496
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
110373
110497
  // error if no source map or for now if inline sourcemap
110374
110498
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
110375
110499
  return sourceMapFilePath || "inline sourcemap decoding";
110500
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
110501
+ return sourceMapFilePath;
110376
110502
  // read declaration text
110377
110503
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
110378
110504
  if (declarationFilePath && !declarationText)
110379
110505
  return declarationFilePath;
110506
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
110507
+ return declarationFilePath;
110380
110508
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
110381
110509
  // error if no source map or for now if inline sourcemap
110382
110510
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
110383
110511
  return declarationMapPath || "inline sourcemap decoding";
110384
- var buildInfo = getBuildInfo(buildInfoText);
110385
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
110386
- return buildInfoPath;
110512
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
110513
+ return declarationMapPath;
110387
110514
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110388
110515
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
110389
110516
  /*onlyOwnText*/ true);
110390
110517
  var outputFiles = [];
110391
110518
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
110392
110519
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
110520
+ var changedDtsText;
110521
+ var changedDtsData;
110393
110522
  var emitHost = {
110394
110523
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
110395
110524
  getCanonicalFileName: host.getCanonicalFileName,
@@ -110405,7 +110534,7 @@ var ts;
110405
110534
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
110406
110535
  getProjectReferenceRedirect: ts.returnUndefined,
110407
110536
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
110408
- writeFile: function (name, text, writeByteOrderMark) {
110537
+ writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
110409
110538
  switch (name) {
110410
110539
  case jsFilePath:
110411
110540
  if (jsFileText === text)
@@ -110416,8 +110545,13 @@ var ts;
110416
110545
  return;
110417
110546
  break;
110418
110547
  case buildInfoPath:
110419
- var newBuildInfo = getBuildInfo(text);
110548
+ var newBuildInfo = data.buildInfo;
110420
110549
  newBuildInfo.program = buildInfo.program;
110550
+ if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
110551
+ // Update the output signature
110552
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
110553
+ newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
110554
+ }
110421
110555
  // Update sourceFileInfo
110422
110556
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
110423
110557
  newBuildInfo.bundle.js.sources = js.sources;
@@ -110425,11 +110559,13 @@ var ts;
110425
110559
  newBuildInfo.bundle.dts.sources = dts.sources;
110426
110560
  }
110427
110561
  newBuildInfo.bundle.sourceFiles = sourceFiles;
110428
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
110562
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
110429
110563
  return;
110430
110564
  case declarationFilePath:
110431
110565
  if (declarationText === text)
110432
110566
  return;
110567
+ changedDtsText = text;
110568
+ changedDtsData = data;
110433
110569
  break;
110434
110570
  case declarationMapPath:
110435
110571
  if (declarationMapText === text)
@@ -110448,6 +110584,7 @@ var ts;
110448
110584
  getSourceFileFromReference: ts.returnUndefined,
110449
110585
  redirectTargetsMap: ts.createMultiMap(),
110450
110586
  getFileIncludeReasons: ts.notImplemented,
110587
+ createHash: createHash,
110451
110588
  };
110452
110589
  emitFiles(ts.notImplementedResolver, emitHost,
110453
110590
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
@@ -115532,12 +115669,10 @@ var ts;
115532
115669
  }
115533
115670
  ts.createCompilerHost = createCompilerHost;
115534
115671
  /*@internal*/
115535
- // TODO(shkamat): update this after reworking ts build API
115536
115672
  function createCompilerHostWorker(options, setParentNodes, system) {
115537
115673
  if (system === void 0) { system = ts.sys; }
115538
115674
  var existingDirectories = new ts.Map();
115539
115675
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
115540
- var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
115541
115676
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
115542
115677
  var text;
115543
115678
  try {
@@ -115570,7 +115705,7 @@ var ts;
115570
115705
  // NOTE: If patchWriteFileEnsuringDirectory has been called,
115571
115706
  // the system.writeFile will do its own directory creation and
115572
115707
  // the ensureDirectoriesExist call will always be redundant.
115573
- 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); });
115708
+ 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); });
115574
115709
  ts.performance.mark("afterIOWrite");
115575
115710
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
115576
115711
  }
@@ -115580,35 +115715,6 @@ var ts;
115580
115715
  }
115581
115716
  }
115582
115717
  }
115583
- var outputFingerprints;
115584
- function writeFileWorker(fileName, data, writeByteOrderMark) {
115585
- if (!ts.isWatchSet(options) || !system.getModifiedTime) {
115586
- system.writeFile(fileName, data, writeByteOrderMark);
115587
- return;
115588
- }
115589
- if (!outputFingerprints) {
115590
- outputFingerprints = new ts.Map();
115591
- }
115592
- var hash = computeHash(data);
115593
- var mtimeBefore = system.getModifiedTime(fileName);
115594
- if (mtimeBefore) {
115595
- var fingerprint = outputFingerprints.get(fileName);
115596
- // If output has not been changed, and the file has no external modification
115597
- if (fingerprint &&
115598
- fingerprint.byteOrderMark === writeByteOrderMark &&
115599
- fingerprint.hash === hash &&
115600
- fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
115601
- return;
115602
- }
115603
- }
115604
- system.writeFile(fileName, data, writeByteOrderMark);
115605
- var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
115606
- outputFingerprints.set(fileName, {
115607
- hash: hash,
115608
- byteOrderMark: writeByteOrderMark,
115609
- mtime: mtimeAfter
115610
- });
115611
- }
115612
115718
  function getDefaultLibLocation() {
115613
115719
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
115614
115720
  }
@@ -117160,6 +117266,7 @@ var ts;
117160
117266
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
117161
117267
  redirectTargetsMap: redirectTargetsMap,
117162
117268
  getFileIncludeReasons: program.getFileIncludeReasons,
117269
+ createHash: ts.maybeBind(host, host.createHash),
117163
117270
  };
117164
117271
  }
117165
117272
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -119273,13 +119380,9 @@ var ts;
119273
119380
  function createManyToManyPathMap() {
119274
119381
  function create(forward, reverse, deleted) {
119275
119382
  var map = {
119276
- clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119277
- forEach: function (fn) { return forward.forEach(fn); },
119278
119383
  getKeys: function (v) { return reverse.get(v); },
119279
119384
  getValues: function (k) { return forward.get(k); },
119280
- hasKey: function (k) { return forward.has(k); },
119281
119385
  keys: function () { return forward.keys(); },
119282
- deletedKeys: function () { return deleted; },
119283
119386
  deleteKey: function (k) {
119284
119387
  (deleted || (deleted = new ts.Set())).add(k);
119285
119388
  var set = forward.get(k);
@@ -119306,11 +119409,6 @@ var ts;
119306
119409
  });
119307
119410
  return map;
119308
119411
  },
119309
- clear: function () {
119310
- forward.clear();
119311
- reverse.clear();
119312
- deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119313
- }
119314
119412
  };
119315
119413
  return map;
119316
119414
  }
@@ -119438,18 +119536,21 @@ var ts;
119438
119536
  * Creates the state of file references and signature for the new program from oldState if it is safe
119439
119537
  */
119440
119538
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119539
+ var _a, _b, _c;
119441
119540
  var fileInfos = new ts.Map();
119442
119541
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
119443
119542
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
119444
- var hasCalledUpdateShapeSignature = new ts.Set();
119445
119543
  var useOldState = canReuseOldState(referencedMap, oldState);
119446
119544
  // Ensure source files have parent pointers set
119447
119545
  newProgram.getTypeChecker();
119448
119546
  // Create the reference map, and set the file infos
119449
- for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
119450
- var sourceFile = _a[_i];
119547
+ for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
119548
+ var sourceFile = _d[_i];
119451
119549
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
119452
- var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
119550
+ var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
119551
+ var signature = oldUncommitedSignature === undefined ?
119552
+ useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
119553
+ oldUncommitedSignature || undefined;
119453
119554
  if (referencedMap) {
119454
119555
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
119455
119556
  if (newReferences) {
@@ -119457,19 +119558,26 @@ var ts;
119457
119558
  }
119458
119559
  // Copy old visible to outside files map
119459
119560
  if (useOldState) {
119460
- var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
119561
+ var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
119562
+ var exportedModules = oldUncommitedExportedModules === undefined ?
119563
+ oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
119564
+ oldUncommitedExportedModules || undefined;
119461
119565
  if (exportedModules) {
119462
119566
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119463
119567
  }
119464
119568
  }
119465
119569
  }
119466
- fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
119570
+ fileInfos.set(sourceFile.resolvedPath, {
119571
+ version: version_2,
119572
+ signature: signature,
119573
+ affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
119574
+ impliedFormat: sourceFile.impliedNodeFormat
119575
+ });
119467
119576
  }
119468
119577
  return {
119469
119578
  fileInfos: fileInfos,
119470
119579
  referencedMap: referencedMap,
119471
119580
  exportedModulesMap: exportedModulesMap,
119472
- hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
119473
119581
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
119474
119582
  };
119475
119583
  }
@@ -119483,71 +119591,42 @@ var ts;
119483
119591
  }
119484
119592
  BuilderState.releaseCache = releaseCache;
119485
119593
  /**
119486
- * Creates a clone of the state
119594
+ * Gets the files affected by the path from the program
119487
119595
  */
119488
- function clone(state) {
119596
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
119489
119597
  var _a, _b;
119490
- // Dont need to backup allFiles info since its cache anyway
119491
- return {
119492
- fileInfos: new ts.Map(state.fileInfos),
119493
- referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
119494
- exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
119495
- hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
119496
- useFileVersionAsSignature: state.useFileVersionAsSignature,
119497
- };
119598
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
119599
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119600
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119601
+ return result;
119498
119602
  }
119499
- BuilderState.clone = clone;
119500
- /**
119501
- * Gets the files affected by the path from the program
119502
- */
119503
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
119504
- // Since the operation could be cancelled, the signatures are always stored in the cache
119505
- // They will be committed once it is safe to use them
119506
- // eg when calling this api from tsserver, if there is no cancellation of the operation
119507
- // In the other cases the affected files signatures are committed only after the iteration through the result is complete
119508
- var signatureCache = cacheToUpdateSignature || new ts.Map();
119603
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119604
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
119509
119605
  var sourceFile = programOfThisState.getSourceFileByPath(path);
119510
119606
  if (!sourceFile) {
119511
119607
  return ts.emptyArray;
119512
119608
  }
119513
- if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
119609
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
119514
119610
  return [sourceFile];
119515
119611
  }
119516
- var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
119517
- if (!cacheToUpdateSignature) {
119518
- // Commit all the signatures in the signature cache
119519
- updateSignaturesFromCache(state, signatureCache);
119520
- }
119521
- return result;
119612
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
119522
119613
  }
119523
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119524
- /**
119525
- * Updates the signatures from the cache into state's fileinfo signatures
119526
- * This should be called whenever it is safe to commit the state of the builder
119527
- */
119528
- function updateSignaturesFromCache(state, signatureCache) {
119529
- signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
119530
- }
119531
- BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
119614
+ BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
119532
119615
  function updateSignatureOfFile(state, signature, path) {
119533
119616
  state.fileInfos.get(path).signature = signature;
119534
- state.hasCalledUpdateShapeSignature.add(path);
119617
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
119535
119618
  }
119536
119619
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
119537
119620
  /**
119538
119621
  * Returns if the shape of the signature has changed since last emit
119539
119622
  */
119540
- function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
119623
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
119624
+ var _a;
119541
119625
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
119542
- ts.Debug.assert(!!sourceFile);
119543
- ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
119544
119626
  // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
119545
- if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
119627
+ if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
119546
119628
  return false;
119547
- }
119548
119629
  var info = state.fileInfos.get(sourceFile.resolvedPath);
119549
- if (!info)
119550
- return ts.Debug.fail();
119551
119630
  var prevSignature = info.signature;
119552
119631
  var latestSignature;
119553
119632
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -119558,45 +119637,55 @@ var ts;
119558
119637
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119559
119638
  if (firstDts_1) {
119560
119639
  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; })); });
119561
- latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119562
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119563
- updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
119640
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
119641
+ if (latestSignature !== prevSignature) {
119642
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
119564
119643
  }
119565
119644
  }
119566
119645
  }
119567
119646
  // Default is to use file version as signature
119568
119647
  if (latestSignature === undefined) {
119569
119648
  latestSignature = sourceFile.version;
119570
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119649
+ if (state.exportedModulesMap && latestSignature !== prevSignature) {
119650
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119571
119651
  // All the references in this file are exported
119572
119652
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
119573
119653
  if (references) {
119574
- exportedModulesMapCache.set(sourceFile.resolvedPath, references);
119654
+ state.exportedModulesMap.set(sourceFile.resolvedPath, references);
119575
119655
  }
119576
119656
  else {
119577
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119657
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119578
119658
  }
119579
119659
  }
119580
119660
  }
119581
- cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
119661
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
119662
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
119663
+ info.signature = latestSignature;
119582
119664
  return latestSignature !== prevSignature;
119583
119665
  }
119584
119666
  BuilderState.updateShapeSignature = updateShapeSignature;
119667
+ function computeSignature(text, computeHash) {
119668
+ return (computeHash || ts.generateDjb2Hash)(text);
119669
+ }
119670
+ BuilderState.computeSignature = computeSignature;
119585
119671
  /**
119586
119672
  * Coverts the declaration emit result into exported modules map
119587
119673
  */
119588
- function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
119674
+ function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
119675
+ if (!state.exportedModulesMap)
119676
+ return;
119677
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119589
119678
  if (!exportedModulesFromDeclarationEmit) {
119590
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119679
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119591
119680
  return;
119592
119681
  }
119593
119682
  var exportedModules;
119594
119683
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
119595
119684
  if (exportedModules) {
119596
- exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
119685
+ state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119597
119686
  }
119598
119687
  else {
119599
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119688
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119600
119689
  }
119601
119690
  function addExportedModule(exportedModulePaths) {
119602
119691
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -119608,19 +119697,6 @@ var ts;
119608
119697
  }
119609
119698
  }
119610
119699
  BuilderState.updateExportedModules = updateExportedModules;
119611
- /**
119612
- * Updates the exported modules from cache into state's exported modules map
119613
- * This should be called whenever it is safe to commit the state of the builder
119614
- */
119615
- function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
119616
- var _a;
119617
- if (exportedModulesMapCache) {
119618
- ts.Debug.assert(!!state.exportedModulesMap);
119619
- (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
119620
- exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
119621
- }
119622
- }
119623
- BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
119624
119700
  /**
119625
119701
  * Get all the dependencies of the sourceFile
119626
119702
  */
@@ -119741,7 +119817,7 @@ var ts;
119741
119817
  /**
119742
119818
  * When program emits modular code, gets the files affected by the sourceFile whose shape has changed
119743
119819
  */
119744
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
119820
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
119745
119821
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
119746
119822
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
119747
119823
  }
@@ -119761,7 +119837,7 @@ var ts;
119761
119837
  if (!seenFileNamesMap.has(currentPath)) {
119762
119838
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
119763
119839
  seenFileNamesMap.set(currentPath, currentSourceFile);
119764
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
119840
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
119765
119841
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
119766
119842
  }
119767
119843
  }
@@ -119787,32 +119863,33 @@ var ts;
119787
119863
  * Create the state so that we can iterate on changedFiles/affected files
119788
119864
  */
119789
119865
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119866
+ var _a, _b;
119790
119867
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
119791
119868
  state.program = newProgram;
119792
119869
  var compilerOptions = newProgram.getCompilerOptions();
119793
119870
  state.compilerOptions = compilerOptions;
119871
+ var outFilePath = ts.outFile(compilerOptions);
119794
119872
  // With --out or --outFile, any change affects all semantic diagnostics so no need to cache them
119795
- if (!ts.outFile(compilerOptions)) {
119873
+ if (!outFilePath) {
119796
119874
  state.semanticDiagnosticsPerFile = new ts.Map();
119797
119875
  }
119876
+ 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)) {
119877
+ state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
119878
+ }
119798
119879
  state.changedFilesSet = new ts.Set();
119880
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
119799
119881
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
119800
119882
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
119801
119883
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
119802
119884
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
119885
+ var canCopyEmitSignatures = compilerOptions.composite &&
119886
+ (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
119887
+ !outFilePath &&
119888
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
119803
119889
  if (useOldState) {
119804
- // Verify the sanity of old state
119805
- if (!oldState.currentChangedFilePath) {
119806
- var affectedSignatures = oldState.currentAffectedFilesSignatures;
119807
- ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
119808
- }
119809
- var changedFilesSet = oldState.changedFilesSet;
119810
- if (canCopySemanticDiagnostics) {
119811
- ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
119812
- }
119813
119890
  // Copy old state's changed files set
119814
- changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
119815
- if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
119891
+ (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
119892
+ if (!outFilePath && oldState.affectedFilesPendingEmit) {
119816
119893
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
119817
119894
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
119818
119895
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -119833,6 +119910,8 @@ var ts;
119833
119910
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
119834
119911
  // versions dont match
119835
119912
  oldInfo.version !== info.version ||
119913
+ // Implied formats dont match
119914
+ oldInfo.impliedFormat !== info.impliedFormat ||
119836
119915
  // Referenced files changed
119837
119916
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
119838
119917
  // Referenced file was deleted in the new program
@@ -119856,27 +119935,25 @@ var ts;
119856
119935
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
119857
119936
  }
119858
119937
  }
119938
+ if (canCopyEmitSignatures) {
119939
+ var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
119940
+ if (oldEmitSignature)
119941
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
119942
+ }
119859
119943
  });
119860
119944
  // If the global file is removed, add all files as changed
119861
119945
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
119862
119946
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, /*firstSourceFile*/ undefined)
119863
119947
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
119864
119948
  }
119865
- else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
119949
+ else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
119866
119950
  // Add all files to affectedFilesPendingEmit since emit changed
119867
119951
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1 /* Full */); });
119868
119952
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
119869
119953
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
119870
119954
  }
119871
- if (useOldState) {
119872
- // Any time the interpretation of a source file changes, mark it as changed
119873
- ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
119874
- if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
119875
- state.changedFilesSet.add(sourceFilePath);
119876
- }
119877
- });
119878
- }
119879
- state.buildInfoEmitPending = !!state.changedFilesSet.size;
119955
+ // Since old states change files set is copied, any additional change means we would need to emit build info
119956
+ state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
119880
119957
  return state;
119881
119958
  }
119882
119959
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -119912,30 +119989,35 @@ var ts;
119912
119989
  ts.BuilderState.releaseCache(state);
119913
119990
  state.program = undefined;
119914
119991
  }
119915
- /**
119916
- * Creates a clone of the state
119917
- */
119918
- function cloneBuilderProgramState(state) {
119919
- var _a;
119920
- var newState = ts.BuilderState.clone(state);
119921
- newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
119922
- newState.changedFilesSet = new ts.Set(state.changedFilesSet);
119923
- newState.affectedFiles = state.affectedFiles;
119924
- newState.affectedFilesIndex = state.affectedFilesIndex;
119925
- newState.currentChangedFilePath = state.currentChangedFilePath;
119926
- newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
119927
- newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
119928
- newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
119929
- newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
119930
- newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
119931
- newState.program = state.program;
119932
- newState.compilerOptions = state.compilerOptions;
119933
- newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
119934
- newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
119935
- newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
119936
- newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
119937
- newState.programEmitComplete = state.programEmitComplete;
119938
- return newState;
119992
+ function backupEmitBuilderProgramState(state) {
119993
+ var outFilePath = ts.outFile(state.compilerOptions);
119994
+ // Only in --out changeFileSet is kept around till emit
119995
+ ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
119996
+ return {
119997
+ affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
119998
+ affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
119999
+ affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
120000
+ seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
120001
+ programEmitComplete: state.programEmitComplete,
120002
+ emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
120003
+ outSignature: state.outSignature,
120004
+ dtsChangeTime: state.dtsChangeTime,
120005
+ hasChangedEmitSignature: state.hasChangedEmitSignature,
120006
+ changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
120007
+ };
120008
+ }
120009
+ function restoreEmitBuilderProgramState(state, backupEmitState) {
120010
+ state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
120011
+ state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
120012
+ state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
120013
+ state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
120014
+ state.programEmitComplete = backupEmitState.programEmitComplete;
120015
+ state.emitSignatures = backupEmitState.emitSignatures;
120016
+ state.outSignature = backupEmitState.outSignature;
120017
+ state.dtsChangeTime = backupEmitState.dtsChangeTime;
120018
+ state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
120019
+ if (backupEmitState.changedFilesSet)
120020
+ state.changedFilesSet = backupEmitState.changedFilesSet;
119939
120021
  }
119940
120022
  /**
119941
120023
  * Verifies that source file is ok to be used in calls that arent handled by next
@@ -119950,7 +120032,7 @@ var ts;
119950
120032
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
119951
120033
  */
119952
120034
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
119953
- var _a;
120035
+ var _a, _b;
119954
120036
  while (true) {
119955
120037
  var affectedFiles = state.affectedFiles;
119956
120038
  if (affectedFiles) {
@@ -119970,10 +120052,8 @@ var ts;
119970
120052
  state.changedFilesSet.delete(state.currentChangedFilePath);
119971
120053
  state.currentChangedFilePath = undefined;
119972
120054
  // Commit the changes in file signature
119973
- ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
119974
- state.currentAffectedFilesSignatures.clear();
119975
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
119976
- (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
120055
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
120056
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119977
120057
  state.affectedFiles = undefined;
119978
120058
  }
119979
120059
  // Get next changed file
@@ -119991,12 +120071,7 @@ var ts;
119991
120071
  return program;
119992
120072
  }
119993
120073
  // Get next batch of affected files
119994
- if (!state.currentAffectedFilesSignatures)
119995
- state.currentAffectedFilesSignatures = new ts.Map();
119996
- if (state.exportedModulesMap) {
119997
- state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
119998
- }
119999
- state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
120074
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
120000
120075
  state.currentChangedFilePath = nextKey.value;
120001
120076
  state.affectedFilesIndex = 0;
120002
120077
  if (!state.seenAffectedFiles)
@@ -120048,7 +120123,6 @@ var ts;
120048
120123
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
120049
120124
  */
120050
120125
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120051
- var _a;
120052
120126
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
120053
120127
  // If affected files is everything except default library, then nothing more to do
120054
120128
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -120056,10 +120130,9 @@ var ts;
120056
120130
  // When a change affects the global scope, all files are considered to be affected without updating their signature
120057
120131
  // That means when affected file is handled, its signature can be out of date
120058
120132
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
120059
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
120133
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
120060
120134
  return;
120061
120135
  }
120062
- 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);
120063
120136
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
120064
120137
  return;
120065
120138
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -120079,7 +120152,7 @@ var ts;
120079
120152
  // This ensures that we dont later during incremental builds considering wrong signature.
120080
120153
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
120081
120154
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
120082
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
120155
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
120083
120156
  // If not dts emit, nothing more to do
120084
120157
  if (ts.getEmitDeclarations(state.compilerOptions)) {
120085
120158
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -120100,27 +120173,10 @@ var ts;
120100
120173
  return !state.semanticDiagnosticsFromOldState.size;
120101
120174
  }
120102
120175
  function isChangedSignature(state, path) {
120103
- var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
120104
- var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120176
+ var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
120177
+ var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120105
120178
  return newSignature !== oldSignature;
120106
120179
  }
120107
- function forEachKeyOfExportedModulesMap(state, filePath, fn) {
120108
- // Go through exported modules from cache first
120109
- var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
120110
- var result = keys && ts.forEachKey(keys, fn);
120111
- if (result)
120112
- return result;
120113
- // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
120114
- keys = state.exportedModulesMap.getKeys(filePath);
120115
- return keys && ts.forEachKey(keys, function (exportedFromPath) {
120116
- var _a;
120117
- // If the cache had an updated value, skip
120118
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
120119
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
120120
- fn(exportedFromPath) :
120121
- undefined;
120122
- });
120123
- }
120124
120180
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
120125
120181
  var _a;
120126
120182
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -120135,6 +120191,7 @@ var ts;
120135
120191
  * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
120136
120192
  */
120137
120193
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120194
+ var _a;
120138
120195
  // If there was change in signature (dts output) for the changed file,
120139
120196
  // then only we need to handle pending file emit
120140
120197
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
@@ -120161,11 +120218,10 @@ var ts;
120161
120218
  }
120162
120219
  }
120163
120220
  }
120164
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120165
120221
  var seenFileAndExportsOfFile = new ts.Set();
120166
120222
  // Go through exported modules from cache first
120167
120223
  // If exported modules has path, all files referencing file exported from are affected
120168
- forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
120224
+ (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120169
120225
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
120170
120226
  return true;
120171
120227
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -120179,19 +120235,18 @@ var ts;
120179
120235
  * return true when all work is done and we can exit handling dts emit and semantic diagnostics
120180
120236
  */
120181
120237
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
120182
- var _a;
120238
+ var _a, _b;
120183
120239
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
120184
120240
  return undefined;
120185
120241
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
120186
120242
  return true;
120187
120243
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
120188
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120189
120244
  // If exported modules has path, all files referencing file exported from are affected
120190
- forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
120245
+ (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120191
120246
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
120192
120247
  });
120193
120248
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
120194
- (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
120249
+ (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
120195
120250
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
120196
120251
  handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
120197
120252
  state, referencingFilePath, cancellationToken, computeHash, host);
@@ -120212,12 +120267,13 @@ var ts;
120212
120267
  }
120213
120268
  else {
120214
120269
  state.seenAffectedFiles.add(affected.resolvedPath);
120270
+ // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted
120271
+ state.buildInfoEmitPending = true;
120215
120272
  if (emitKind !== undefined) {
120216
120273
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
120217
120274
  }
120218
120275
  if (isPendingEmit) {
120219
120276
  state.affectedFilesPendingEmitIndex++;
120220
- state.buildInfoEmitPending = true;
120221
120277
  }
120222
120278
  else {
120223
120279
  state.affectedFilesIndex++;
@@ -120265,25 +120321,61 @@ var ts;
120265
120321
  }
120266
120322
  return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
120267
120323
  }
120324
+ function isProgramBundleEmitBuildInfo(info) {
120325
+ return !!ts.outFile(info.options || {});
120326
+ }
120327
+ ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
120268
120328
  /**
120269
120329
  * Gets the program information to be emitted in buildInfo so that we can use it to create new program
120270
120330
  */
120271
- function getProgramBuildInfo(state, getCanonicalFileName) {
120272
- if (ts.outFile(state.compilerOptions))
120273
- return undefined;
120331
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
120332
+ var outFilePath = ts.outFile(state.compilerOptions);
120333
+ if (outFilePath && !state.compilerOptions.composite)
120334
+ return;
120274
120335
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
120275
120336
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
120337
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
120338
+ if (outFilePath) {
120339
+ var fileNames_1 = [];
120340
+ var fileInfos_1 = [];
120341
+ state.program.getRootFileNames().forEach(function (f) {
120342
+ var sourceFile = state.program.getSourceFile(f);
120343
+ if (!sourceFile)
120344
+ return;
120345
+ fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
120346
+ fileInfos_1.push(sourceFile.version);
120347
+ });
120348
+ var result_15 = {
120349
+ fileNames: fileNames_1,
120350
+ fileInfos: fileInfos_1,
120351
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
120352
+ outSignature: state.outSignature,
120353
+ dtsChangeTime: state.dtsChangeTime,
120354
+ };
120355
+ return result_15;
120356
+ }
120276
120357
  var fileNames = [];
120277
120358
  var fileNameToFileId = new ts.Map();
120278
120359
  var fileIdsList;
120279
120360
  var fileNamesToFileIdListId;
120361
+ var emitSignatures;
120280
120362
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
120363
+ var _b, _c;
120281
120364
  var key = _a[0], value = _a[1];
120282
120365
  // Ensure fileId
120283
120366
  var fileId = toFileId(key);
120284
120367
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
120285
- var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120286
- var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120368
+ var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
120369
+ var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
120370
+ if (state.compilerOptions.composite) {
120371
+ var file = state.program.getSourceFileByPath(key);
120372
+ if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
120373
+ var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
120374
+ if (emitSignature !== actualSignature) {
120375
+ (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
120376
+ }
120377
+ }
120378
+ }
120287
120379
  return value.version === actualSignature ?
120288
120380
  value.affectsGlobalScope || value.impliedFormat ?
120289
120381
  // If file version is same as signature, dont serialize signature
@@ -120291,11 +120383,11 @@ var ts;
120291
120383
  // If file info only contains version and signature and both are same we can just write string
120292
120384
  value.version :
120293
120385
  actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120294
- signature === undefined ?
120386
+ oldSignature === undefined ?
120295
120387
  // If we havent computed signature, use fileInfo as is
120296
120388
  value :
120297
120389
  // Serialize fileInfo with new updated signature
120298
- { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120390
+ { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120299
120391
  // Signature of the FileInfo is undefined, serialize it as false
120300
120392
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120301
120393
  });
@@ -120310,17 +120402,13 @@ var ts;
120310
120402
  if (state.exportedModulesMap) {
120311
120403
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
120312
120404
  var _a;
120313
- if (state.currentAffectedFilesExportedModulesMap) {
120314
- if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
120315
- return undefined;
120316
- }
120317
- var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
120318
- if (newValue) {
120319
- return [toFileId(key), toFileIdListId(newValue)];
120320
- }
120321
- }
120405
+ var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
120322
120406
  // Not in temporary cache, use existing value
120323
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120407
+ if (oldValue === undefined)
120408
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120409
+ if (oldValue)
120410
+ return [toFileId(key), toFileIdListId(oldValue)];
120411
+ return undefined;
120324
120412
  });
120325
120413
  }
120326
120414
  var semanticDiagnosticsPerFile;
@@ -120331,9 +120419,7 @@ var ts;
120331
120419
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
120332
120420
  [
120333
120421
  toFileId(key),
120334
- state.hasReusableDiagnostic ?
120335
- value :
120336
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120422
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
120337
120423
  ] :
120338
120424
  toFileId(key));
120339
120425
  }
@@ -120348,16 +120434,27 @@ var ts;
120348
120434
  }
120349
120435
  }
120350
120436
  }
120351
- return {
120437
+ var changeFileSet;
120438
+ if (state.changedFilesSet.size) {
120439
+ for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
120440
+ var path = _e[_d];
120441
+ (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120442
+ }
120443
+ }
120444
+ var result = {
120352
120445
  fileNames: fileNames,
120353
120446
  fileInfos: fileInfos,
120354
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
120447
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
120355
120448
  fileIdsList: fileIdsList,
120356
120449
  referencedMap: referencedMap,
120357
120450
  exportedModulesMap: exportedModulesMap,
120358
120451
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
120359
120452
  affectedFilesPendingEmit: affectedFilesPendingEmit,
120453
+ changeFileSet: changeFileSet,
120454
+ emitSignatures: emitSignatures,
120455
+ dtsChangeTime: state.dtsChangeTime,
120360
120456
  };
120457
+ return result;
120361
120458
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
120362
120459
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
120363
120460
  }
@@ -120382,24 +120479,18 @@ var ts;
120382
120479
  }
120383
120480
  return fileIdListId;
120384
120481
  }
120385
- }
120386
- function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
120387
- var result;
120388
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120389
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120390
- var name = _a[_i];
120391
- var optionKey = name.toLowerCase();
120392
- var optionInfo = optionsNameMap.get(optionKey);
120393
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
120394
- // We need to store `strict`, even though it won't be examined directly, so that the
120395
- // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
120396
- optionKey === "strict" ||
120397
- // We need to store these to determine whether `lib` files need to be rechecked.
120398
- optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
120399
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
120482
+ function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
120483
+ var result;
120484
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120485
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120486
+ var name = _a[_i];
120487
+ var optionInfo = optionsNameMap.get(name.toLowerCase());
120488
+ if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
120489
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
120490
+ }
120400
120491
  }
120492
+ return result;
120401
120493
  }
120402
- return result;
120403
120494
  }
120404
120495
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120405
120496
  if (option) {
@@ -120473,6 +120564,10 @@ var ts;
120473
120564
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
120474
120565
  }
120475
120566
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
120567
+ function computeSignature(text, data, computeHash) {
120568
+ return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
120569
+ }
120570
+ ts.computeSignature = computeSignature;
120476
120571
  function createBuilderProgram(kind, _a) {
120477
120572
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
120478
120573
  // Return same program if underlying program doesnt change
@@ -120491,8 +120586,8 @@ var ts;
120491
120586
  */
120492
120587
  var computeHash = ts.maybeBind(host, host.createHash);
120493
120588
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
120494
- var backupState;
120495
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
120589
+ var backupEmitState;
120590
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
120496
120591
  // To ensure that we arent storing any references to old program or new program without state
120497
120592
  newProgram = undefined; // TODO: GH#18217
120498
120593
  oldProgram = undefined;
@@ -120500,20 +120595,20 @@ var ts;
120500
120595
  var getState = function () { return state; };
120501
120596
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
120502
120597
  builderProgram.getState = getState;
120503
- builderProgram.backupState = function () {
120504
- ts.Debug.assert(backupState === undefined);
120505
- backupState = cloneBuilderProgramState(state);
120598
+ builderProgram.backupEmitState = function () {
120599
+ ts.Debug.assert(backupEmitState === undefined);
120600
+ backupEmitState = backupEmitBuilderProgramState(state);
120506
120601
  };
120507
- builderProgram.restoreState = function () {
120508
- state = ts.Debug.checkDefined(backupState);
120509
- backupState = undefined;
120602
+ builderProgram.restoreEmitState = function () {
120603
+ restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
120604
+ backupEmitState = undefined;
120510
120605
  };
120511
120606
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
120512
120607
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
120513
120608
  builderProgram.emit = emit;
120514
120609
  builderProgram.releaseProgram = function () {
120515
120610
  releaseCache(state);
120516
- backupState = undefined;
120611
+ backupEmitState = undefined;
120517
120612
  };
120518
120613
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
120519
120614
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -120572,35 +120667,59 @@ var ts;
120572
120667
  return toAffectedFileEmitResult(state,
120573
120668
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
120574
120669
  // Otherwise just affected file
120575
- ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120576
- getWriteFileUpdatingSignatureCallback(writeFile) :
120670
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
120671
+ getWriteFileCallback(writeFile, customTransformers) :
120577
120672
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
120578
120673
  }
120579
- function getWriteFileUpdatingSignatureCallback(writeFile) {
120674
+ function getWriteFileCallback(writeFile, customTransformers) {
120580
120675
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
120581
- var _a;
120676
+ var _a, _b, _c;
120582
120677
  if (ts.isDeclarationFileName(fileName)) {
120583
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120584
- var file = sourceFiles[0];
120585
- var info = state.fileInfos.get(file.resolvedPath);
120586
- var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120587
- if (signature === file.version) {
120588
- var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120589
- if (newSignature !== file.version) { // Update it
120590
- if (host.storeFilesChangingSignatureDuringEmit)
120591
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120592
- if (state.exportedModulesMap)
120593
- ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
120594
- if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
120595
- state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
120678
+ if (!ts.outFile(state.compilerOptions)) {
120679
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120680
+ var newSignature = void 0;
120681
+ if (!customTransformers) {
120682
+ var file = sourceFiles[0];
120683
+ var info = state.fileInfos.get(file.resolvedPath);
120684
+ if (info.signature === file.version) {
120685
+ newSignature = computeSignature(text, data, computeHash);
120686
+ if (newSignature !== file.version) { // Update it
120687
+ if (host.storeFilesChangingSignatureDuringEmit)
120688
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120689
+ if (state.exportedModulesMap)
120690
+ ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
120691
+ if (state.affectedFiles) {
120692
+ // Keep old signature so we know what to undo if cancellation happens
120693
+ var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
120694
+ if (existing === undefined)
120695
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
120696
+ info.signature = newSignature;
120697
+ }
120698
+ else {
120699
+ // These are directly commited
120700
+ info.signature = newSignature;
120701
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120702
+ }
120703
+ }
120596
120704
  }
120597
- else {
120598
- info.signature = newSignature;
120599
- if (state.exportedModulesMap)
120600
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120705
+ }
120706
+ if (state.compilerOptions.composite) {
120707
+ var filePath = sourceFiles[0].resolvedPath;
120708
+ var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
120709
+ newSignature || (newSignature = computeSignature(text, data, computeHash));
120710
+ if (newSignature !== oldSignature) {
120711
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
120712
+ state.hasChangedEmitSignature = true;
120601
120713
  }
120602
120714
  }
120603
120715
  }
120716
+ else if (state.compilerOptions.composite) {
120717
+ var newSignature = computeSignature(text, data, computeHash);
120718
+ if (newSignature !== state.outSignature) {
120719
+ state.outSignature = newSignature;
120720
+ state.hasChangedEmitSignature = true;
120721
+ }
120722
+ }
120604
120723
  }
120605
120724
  if (writeFile)
120606
120725
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -120665,8 +120784,8 @@ var ts;
120665
120784
  }
120666
120785
  }
120667
120786
  }
120668
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120669
- getWriteFileUpdatingSignatureCallback(writeFile) :
120787
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
120788
+ getWriteFileCallback(writeFile, customTransformers) :
120670
120789
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120671
120790
  }
120672
120791
  /**
@@ -120755,29 +120874,58 @@ var ts;
120755
120874
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
120756
120875
  }
120757
120876
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
120758
- function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
120759
- var _a;
120877
+ function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
120878
+ var _a, _b, _c, _d;
120760
120879
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
120761
120880
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
120762
- var filePaths = program.fileNames.map(toPath);
120763
- var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
120764
- var fileInfos = new ts.Map();
120765
- program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
120766
- var state = {
120767
- fileInfos: fileInfos,
120768
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
120769
- referencedMap: toManyToManyPathMap(program.referencedMap),
120770
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
120771
- 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]; }),
120772
- hasReusableDiagnostic: true,
120773
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
120774
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
120775
- affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
120776
- };
120881
+ var state;
120882
+ var filePaths;
120883
+ var filePathsSetList;
120884
+ if (isProgramBundleEmitBuildInfo(program)) {
120885
+ state = {
120886
+ fileInfos: new ts.Map(),
120887
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
120888
+ dtsChangeTime: program.dtsChangeTime,
120889
+ outSignature: program.outSignature,
120890
+ };
120891
+ }
120892
+ else {
120893
+ filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
120894
+ filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
120895
+ var fileInfos_2 = new ts.Map();
120896
+ var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
120897
+ program.fileInfos.forEach(function (fileInfo, index) {
120898
+ var path = toFilePath(index + 1);
120899
+ var stateFileInfo = toBuilderStateFileInfo(fileInfo);
120900
+ fileInfos_2.set(path, stateFileInfo);
120901
+ if (emitSignatures_1 && stateFileInfo.signature)
120902
+ emitSignatures_1.set(path, stateFileInfo.signature);
120903
+ });
120904
+ (_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
120905
+ if (ts.isNumber(value))
120906
+ emitSignatures_1.delete(toFilePath(value));
120907
+ else
120908
+ emitSignatures_1.set(toFilePath(value[0]), value[1]);
120909
+ });
120910
+ state = {
120911
+ fileInfos: fileInfos_2,
120912
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
120913
+ referencedMap: toManyToManyPathMap(program.referencedMap),
120914
+ exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
120915
+ 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]; }),
120916
+ hasReusableDiagnostic: true,
120917
+ affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
120918
+ affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
120919
+ affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
120920
+ changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
120921
+ dtsChangeTime: program.dtsChangeTime,
120922
+ emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
120923
+ };
120924
+ }
120777
120925
  return {
120778
120926
  getState: function () { return state; },
120779
- backupState: ts.noop,
120780
- restoreState: ts.noop,
120927
+ backupEmitState: ts.noop,
120928
+ restoreEmitState: ts.noop,
120781
120929
  getProgram: ts.notImplemented,
120782
120930
  getProgramOrUndefined: ts.returnUndefined,
120783
120931
  releaseProgram: ts.noop,
@@ -120822,12 +120970,24 @@ var ts;
120822
120970
  return map;
120823
120971
  }
120824
120972
  }
120825
- ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
120973
+ ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
120974
+ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
120975
+ var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
120976
+ var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
120977
+ var fileInfos = new ts.Map();
120978
+ program.fileInfos.forEach(function (fileInfo, index) {
120979
+ var path = ts.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
120980
+ var version = ts.isString(fileInfo) ? fileInfo : fileInfo.version; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
120981
+ fileInfos.set(path, version);
120982
+ });
120983
+ return fileInfos;
120984
+ }
120985
+ ts.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap;
120826
120986
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
120827
120987
  return {
120828
120988
  getState: ts.notImplemented,
120829
- backupState: ts.noop,
120830
- restoreState: ts.noop,
120989
+ backupEmitState: ts.noop,
120990
+ restoreEmitState: ts.noop,
120831
120991
  getProgram: getProgram,
120832
120992
  getProgramOrUndefined: function () { return getState().program; },
120833
120993
  releaseProgram: function () { return getState().program = undefined; },
@@ -121943,9 +122103,9 @@ var ts;
121943
122103
  if (!preferSymlinks) {
121944
122104
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
121945
122105
  // so we only need to remove them from the realpath filenames.
121946
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
121947
- if (result_15)
121948
- return result_15;
122106
+ var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122107
+ if (result_16)
122108
+ return result_16;
121949
122109
  }
121950
122110
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
121951
122111
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -121965,10 +122125,10 @@ var ts;
121965
122125
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
121966
122126
  var symlinkDirectory = symlinkDirectories_1[_i];
121967
122127
  var option = ts.resolvePath(symlinkDirectory, relative);
121968
- var result_16 = cb(option, target === referenceRedirect);
122128
+ var result_17 = cb(option, target === referenceRedirect);
121969
122129
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
121970
- if (result_16)
121971
- return result_16;
122130
+ if (result_17)
122131
+ return result_17;
121972
122132
  }
121973
122133
  });
121974
122134
  });
@@ -122860,6 +123020,7 @@ var ts;
122860
123020
  readDirectory: ts.maybeBind(host, host.readDirectory),
122861
123021
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
122862
123022
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
123023
+ now: ts.maybeBind(host, host.now),
122863
123024
  };
122864
123025
  function writeFile(fileName, text, writeByteOrderMark, onError) {
122865
123026
  try {
@@ -122920,6 +123081,7 @@ var ts;
122920
123081
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
122921
123082
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
122922
123083
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
123084
+ now: ts.maybeBind(system, system.now),
122923
123085
  };
122924
123086
  }
122925
123087
  ts.createProgramHost = createProgramHost;
@@ -122987,20 +123149,26 @@ var ts;
122987
123149
  var ts;
122988
123150
  (function (ts) {
122989
123151
  function readBuilderProgram(compilerOptions, host) {
122990
- if (ts.outFile(compilerOptions))
122991
- return undefined;
122992
123152
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
122993
123153
  if (!buildInfoPath)
122994
123154
  return undefined;
122995
- var content = host.readFile(buildInfoPath);
122996
- if (!content)
122997
- return undefined;
122998
- var buildInfo = ts.getBuildInfo(content);
123155
+ var buildInfo;
123156
+ if (host.getBuildInfo) {
123157
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
123158
+ if (!buildInfo)
123159
+ return undefined;
123160
+ }
123161
+ else {
123162
+ var content = host.readFile(buildInfoPath);
123163
+ if (!content)
123164
+ return undefined;
123165
+ buildInfo = ts.getBuildInfo(content);
123166
+ }
122999
123167
  if (buildInfo.version !== ts.version)
123000
123168
  return undefined;
123001
123169
  if (!buildInfo.program)
123002
123170
  return undefined;
123003
- return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123171
+ return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123004
123172
  }
123005
123173
  ts.readBuilderProgram = readBuilderProgram;
123006
123174
  function createIncrementalCompilerHost(options, system) {
@@ -123009,6 +123177,7 @@ var ts;
123009
123177
  host.createHash = ts.maybeBind(system, system.createHash);
123010
123178
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
123011
123179
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
123180
+ host.now = ts.maybeBind(system, system.now);
123012
123181
  ts.setGetSourceFileAsHashVersioned(host, system);
123013
123182
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
123014
123183
  return host;
@@ -123743,14 +123912,17 @@ var ts;
123743
123912
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
123744
123913
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
123745
123914
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
123746
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
123747
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
123748
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
123749
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
123915
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
123916
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
123917
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
123918
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
123919
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
123920
+ UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
123750
123921
  /**
123751
123922
  * Projects with no outputs (i.e. "solution" files)
123752
123923
  */
123753
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
123924
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
123925
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
123754
123926
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
123755
123927
  function resolveConfigFileProjectName(project) {
123756
123928
  if (ts.fileExtensionIs(project, ".json" /* Json */)) {
@@ -123795,9 +123967,11 @@ var ts;
123795
123967
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
123796
123968
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
123797
123969
  }
123798
- function newer(date1, date2) {
123799
- return date2 > date1 ? date2 : date1;
123970
+ /*@internal*/
123971
+ function getCurrentTime(host) {
123972
+ return host.now ? host.now() : new Date();
123800
123973
  }
123974
+ ts.getCurrentTime = getCurrentTime;
123801
123975
  /*@internal*/
123802
123976
  function isCircularBuildOrder(buildOrder) {
123803
123977
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -123887,6 +124061,7 @@ var ts;
123887
124061
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
123888
124062
  };
123889
124063
  }
124064
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
123890
124065
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
123891
124066
  var state = {
123892
124067
  host: host,
@@ -123903,8 +124078,9 @@ var ts;
123903
124078
  resolvedConfigFilePaths: new ts.Map(),
123904
124079
  configFileCache: new ts.Map(),
123905
124080
  projectStatus: new ts.Map(),
123906
- buildInfoChecked: new ts.Map(),
123907
124081
  extendedConfigCache: new ts.Map(),
124082
+ buildInfoCache: new ts.Map(),
124083
+ outputTimeStamps: new ts.Map(),
123908
124084
  builderPrograms: new ts.Map(),
123909
124085
  diagnostics: new ts.Map(),
123910
124086
  projectPendingBuild: new ts.Map(),
@@ -123928,6 +124104,7 @@ var ts;
123928
124104
  allWatchedConfigFiles: new ts.Map(),
123929
124105
  allWatchedExtendedConfigFiles: new ts.Map(),
123930
124106
  allWatchedPackageJsonFiles: new ts.Map(),
124107
+ filesWatched: new ts.Map(),
123931
124108
  lastCachedPackageJsonLookups: new ts.Map(),
123932
124109
  timerToBuildInvalidatedProject: undefined,
123933
124110
  reportFileChangeDetected: false,
@@ -124034,11 +124211,12 @@ var ts;
124034
124211
  // Config file cache
124035
124212
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
124036
124213
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
124037
- ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
124038
124214
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
124039
124215
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
124040
124216
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
124041
124217
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
124218
+ ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
124219
+ ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
124042
124220
  // Remove watches for the program no longer in the solution
124043
124221
  if (state.watch) {
124044
124222
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
@@ -124329,21 +124507,21 @@ var ts;
124329
124507
  }
124330
124508
  function emit(writeFileCallback, cancellationToken, customTransformers) {
124331
124509
  var _a;
124332
- var _b, _c;
124510
+ var _b, _c, _d;
124333
124511
  ts.Debug.assertIsDefined(program);
124334
124512
  ts.Debug.assert(step === BuildStep.Emit);
124335
124513
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
124336
- program.backupState();
124514
+ program.backupEmitState();
124337
124515
  var declDiagnostics;
124338
124516
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
124339
124517
  var outputFiles = [];
124340
124518
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
124341
124519
  /*write*/ undefined,
124342
- /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
124520
+ /*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,
124343
124521
  /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
124344
124522
  // Don't emit .d.ts if there are decl file errors
124345
124523
  if (declDiagnostics) {
124346
- program.restoreState();
124524
+ program.restoreEmitState();
124347
124525
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
124348
124526
  return {
124349
124527
  emitSkipped: true,
@@ -124353,37 +124531,43 @@ var ts;
124353
124531
  // Actual Emit
124354
124532
  var host = state.host, compilerHost = state.compilerHost;
124355
124533
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124356
- var newestDeclarationFileContentChangedTime = minimumDate;
124357
- var anyDtsChanged = false;
124534
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
124358
124535
  var emitterDiagnostics = ts.createDiagnosticCollection();
124359
124536
  var emittedOutputs = new ts.Map();
124537
+ var options = program.getCompilerOptions();
124538
+ var isIncremental = ts.isIncrementalCompilation(options);
124539
+ var outputTimeStampMap;
124540
+ var now;
124360
124541
  outputFiles.forEach(function (_a) {
124361
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124362
- var priorChangeTime;
124363
- if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124364
- // Check for unchanged .d.ts files
124365
- if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124366
- priorChangeTime = host.getModifiedTime(name);
124367
- }
124368
- else {
124542
+ var _b, _c;
124543
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124544
+ var path = toPath(state, name);
124545
+ emittedOutputs.set(toPath(state, name), name);
124546
+ if (buildInfo) {
124547
+ setBuildInfo(state, buildInfo, projectPath, options);
124548
+ 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)) {
124369
124549
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124370
- anyDtsChanged = true;
124371
124550
  }
124372
124551
  }
124373
- emittedOutputs.set(toPath(state, name), name);
124374
124552
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124375
- if (priorChangeTime !== undefined) {
124376
- newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
124553
+ if (!isIncremental && state.watch) {
124554
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
124377
124555
  }
124378
124556
  });
124379
- finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime,
124380
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124557
+ finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124381
124558
  return emitResult;
124382
124559
  }
124383
124560
  function emitBuildInfo(writeFileCallback, cancellationToken) {
124384
124561
  ts.Debug.assertIsDefined(program);
124385
124562
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
124386
- var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
124563
+ var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
124564
+ if (data === null || data === void 0 ? void 0 : data.buildInfo)
124565
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
124566
+ if (writeFileCallback)
124567
+ writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
124568
+ else
124569
+ state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
124570
+ }, cancellationToken);
124387
124571
  if (emitResult.diagnostics.length) {
124388
124572
  reportErrors(state, emitResult.diagnostics);
124389
124573
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -124396,7 +124580,7 @@ var ts;
124396
124580
  step = BuildStep.QueueReferencingProjects;
124397
124581
  return emitResult;
124398
124582
  }
124399
- function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
124583
+ function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
124400
124584
  var _a;
124401
124585
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
124402
124586
  if (emitDiagnostics.length) {
@@ -124407,13 +124591,11 @@ var ts;
124407
124591
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
124408
124592
  }
124409
124593
  // Update time stamps for rest of the outputs
124410
- var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124594
+ updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124411
124595
  state.diagnostics.delete(projectPath);
124412
124596
  state.projectStatus.set(projectPath, {
124413
124597
  type: ts.UpToDateStatusType.UpToDate,
124414
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
124415
- maximumDate :
124416
- newestDeclarationFileContentChangedTime,
124598
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
124417
124599
  oldestOutputFileName: oldestOutputFileName
124418
124600
  });
124419
124601
  afterProgramDone(state, program, config);
@@ -124448,13 +124630,21 @@ var ts;
124448
124630
  ts.Debug.assert(!!outputFiles.length);
124449
124631
  var emitterDiagnostics = ts.createDiagnosticCollection();
124450
124632
  var emittedOutputs = new ts.Map();
124633
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124634
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
124451
124635
  outputFiles.forEach(function (_a) {
124452
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124636
+ var _b, _c;
124637
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124453
124638
  emittedOutputs.set(toPath(state, name), name);
124639
+ if (buildInfo) {
124640
+ setBuildInfo(state, buildInfo, projectPath, config.options);
124641
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
124642
+ resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124643
+ }
124644
+ }
124454
124645
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124455
124646
  });
124456
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate,
124457
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
124647
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
124458
124648
  return { emitSkipped: false, diagnostics: emitDiagnostics };
124459
124649
  }
124460
124650
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -124559,7 +124749,7 @@ var ts;
124559
124749
  }
124560
124750
  continue;
124561
124751
  }
124562
- if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
124752
+ if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
124563
124753
  reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
124564
124754
  return createUpdateOutputFileStampsProject(state, project, projectPath, config, buildOrder);
124565
124755
  }
@@ -124616,7 +124806,7 @@ var ts;
124616
124806
  state.projectCompilerOptions = state.baseCompilerOptions;
124617
124807
  }
124618
124808
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
124619
- var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
124809
+ var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
124620
124810
  reportAndStoreErrors(state, resolvedPath, diagnostics);
124621
124811
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
124622
124812
  if (canEmitBuildInfo)
@@ -124624,9 +124814,95 @@ var ts;
124624
124814
  afterProgramDone(state, program, config);
124625
124815
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
124626
124816
  }
124817
+ function isFileWatcherWithModifiedTime(value) {
124818
+ return !!value.watcher;
124819
+ }
124820
+ function getModifiedTime(state, fileName) {
124821
+ var path = toPath(state, fileName);
124822
+ var existing = state.filesWatched.get(path);
124823
+ if (state.watch && !!existing) {
124824
+ if (!isFileWatcherWithModifiedTime(existing))
124825
+ return existing;
124826
+ if (existing.modifiedTime)
124827
+ return existing.modifiedTime;
124828
+ }
124829
+ var result = ts.getModifiedTime(state.host, fileName);
124830
+ if (state.watch) {
124831
+ if (existing)
124832
+ existing.modifiedTime = result;
124833
+ else
124834
+ state.filesWatched.set(path, result);
124835
+ }
124836
+ return result;
124837
+ }
124838
+ function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
124839
+ var path = toPath(state, file);
124840
+ var existing = state.filesWatched.get(path);
124841
+ if (existing && isFileWatcherWithModifiedTime(existing)) {
124842
+ existing.callbacks.push(callback);
124843
+ }
124844
+ else {
124845
+ var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
124846
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
124847
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
124848
+ existing.modifiedTime = modifiedTime;
124849
+ existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
124850
+ }, pollingInterval, options, watchType, project);
124851
+ state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
124852
+ }
124853
+ return {
124854
+ close: function () {
124855
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
124856
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
124857
+ if (existing.callbacks.length === 1) {
124858
+ state.filesWatched.delete(path);
124859
+ ts.closeFileWatcherOf(existing);
124860
+ }
124861
+ else {
124862
+ ts.unorderedRemoveItem(existing.callbacks, callback);
124863
+ }
124864
+ }
124865
+ };
124866
+ }
124867
+ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
124868
+ if (!state.watch)
124869
+ return undefined;
124870
+ var result = state.outputTimeStamps.get(resolvedConfigFilePath);
124871
+ if (!result)
124872
+ state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
124873
+ return result;
124874
+ }
124875
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
124876
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
124877
+ var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
124878
+ if (existing) {
124879
+ existing.buildInfo = buildInfo;
124880
+ existing.modifiedTime = getCurrentTime(state.host);
124881
+ }
124882
+ else {
124883
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
124884
+ }
124885
+ }
124886
+ function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
124887
+ var path = toPath(state, buildInfoPath);
124888
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
124889
+ return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
124890
+ }
124891
+ function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
124892
+ var path = toPath(state, buildInfoPath);
124893
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
124894
+ if (existing !== undefined && existing.path === path) {
124895
+ return existing.buildInfo || undefined;
124896
+ }
124897
+ var value = state.readFileWithCache(buildInfoPath);
124898
+ var buildInfo = value ? ts.getBuildInfo(value) : undefined;
124899
+ ts.Debug.assert(modifiedTime || !buildInfo);
124900
+ state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
124901
+ return buildInfo;
124902
+ }
124627
124903
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
124628
124904
  // Check tsconfig time
124629
- var tsconfigTime = ts.getModifiedTime(state.host, configFile);
124905
+ var tsconfigTime = getModifiedTime(state, configFile);
124630
124906
  if (oldestOutputFileTime < tsconfigTime) {
124631
124907
  return {
124632
124908
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -124636,88 +124912,24 @@ var ts;
124636
124912
  }
124637
124913
  }
124638
124914
  function getUpToDateStatusWorker(state, project, resolvedPath) {
124639
- var force = !!state.options.force;
124640
- var newestInputFileName = undefined;
124641
- var newestInputFileTime = minimumDate;
124642
- var host = state.host;
124643
- // Get timestamps of input files
124644
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
124645
- var inputFile = _a[_i];
124646
- if (!host.fileExists(inputFile)) {
124647
- return {
124648
- type: ts.UpToDateStatusType.Unbuildable,
124649
- reason: inputFile + " does not exist"
124650
- };
124651
- }
124652
- if (!force) {
124653
- var inputTime = ts.getModifiedTime(host, inputFile);
124654
- if (inputTime > newestInputFileTime) {
124655
- newestInputFileName = inputFile;
124656
- newestInputFileTime = inputTime;
124657
- }
124658
- }
124659
- }
124915
+ var _a, _b, _c;
124660
124916
  // Container if no files are specified in the project
124661
124917
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
124662
124918
  return {
124663
124919
  type: ts.UpToDateStatusType.ContainerOnly
124664
124920
  };
124665
124921
  }
124666
- // Collect the expected outputs of this project
124667
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
124668
- // Now see if all outputs are newer than the newest input
124669
- var oldestOutputFileName = "(none)";
124670
- var oldestOutputFileTime = maximumDate;
124671
- var newestOutputFileName = "(none)";
124672
- var newestOutputFileTime = minimumDate;
124673
- var missingOutputFileName;
124674
- var newestDeclarationFileContentChangedTime = minimumDate;
124675
- var isOutOfDateWithInputs = false;
124676
- if (!force) {
124677
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
124678
- var output = outputs_1[_b];
124679
- // Output is missing; can stop checking
124680
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124681
- if (!host.fileExists(output)) {
124682
- missingOutputFileName = output;
124683
- break;
124684
- }
124685
- var outputTime = ts.getModifiedTime(host, output);
124686
- if (outputTime < oldestOutputFileTime) {
124687
- oldestOutputFileTime = outputTime;
124688
- oldestOutputFileName = output;
124689
- }
124690
- // If an output is older than the newest input, we can stop checking
124691
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124692
- if (outputTime < newestInputFileTime) {
124693
- isOutOfDateWithInputs = true;
124694
- break;
124695
- }
124696
- if (outputTime > newestOutputFileTime) {
124697
- newestOutputFileTime = outputTime;
124698
- newestOutputFileName = output;
124699
- }
124700
- // Keep track of when the most recent time a .d.ts file was changed.
124701
- // In addition to file timestamps, we also keep track of when a .d.ts file
124702
- // had its file touched but not had its contents changed - this allows us
124703
- // to skip a downstream typecheck
124704
- if (ts.isDeclarationFileName(output)) {
124705
- var outputModifiedTime = ts.getModifiedTime(host, output);
124706
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
124707
- }
124708
- }
124709
- }
124710
- var pseudoUpToDate = false;
124711
- var usesPrepend = false;
124712
- var upstreamChangedProject;
124922
+ // Fast check to see if reference projects are buildable
124923
+ var referenceStatuses;
124924
+ var force = !!state.options.force;
124713
124925
  if (project.projectReferences) {
124714
124926
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
124715
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
124716
- var ref = _d[_c];
124717
- usesPrepend = usesPrepend || !!(ref.prepend);
124927
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
124928
+ var ref = _d[_i];
124718
124929
  var resolvedRef = ts.resolveProjectReferencePath(ref);
124719
124930
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
124720
- var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
124931
+ var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
124932
+ var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
124721
124933
  // Its a circular reference ignore the status of this project
124722
124934
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
124723
124935
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) { // Container only ignore this project
@@ -124739,75 +124951,188 @@ var ts;
124739
124951
  upstreamProjectName: ref.path
124740
124952
  };
124741
124953
  }
124742
- // Check oldest output file name only if there is no missing output file name
124743
- // (a check we will have skipped if this is a forced build)
124744
- if (!force && !missingOutputFileName) {
124745
- // If the upstream project's newest file is older than our oldest output, we
124746
- // can't be out of date because of it
124747
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
124748
- continue;
124749
- }
124750
- // If the upstream project has only change .d.ts files, and we've built
124751
- // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
124752
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
124753
- pseudoUpToDate = true;
124754
- upstreamChangedProject = ref.path;
124755
- continue;
124756
- }
124757
- // We have an output older than an upstream output - we are out of date
124758
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
124954
+ if (!force)
124955
+ (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
124956
+ }
124957
+ }
124958
+ if (force)
124959
+ return { type: ts.UpToDateStatusType.ForceBuild };
124960
+ // Check buildinfo first
124961
+ var host = state.host;
124962
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
124963
+ var oldestOutputFileName = "(none)";
124964
+ var oldestOutputFileTime = maximumDate;
124965
+ var buildInfoTime;
124966
+ var buildInfoProgram;
124967
+ var buildInfoVersionMap;
124968
+ var newestDeclarationFileContentChangedTime;
124969
+ if (buildInfoPath) {
124970
+ var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
124971
+ buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
124972
+ if (buildInfoTime === ts.missingFileModifiedTime) {
124973
+ if (!buildInfoCacheEntry_1) {
124974
+ state.buildInfoCache.set(resolvedPath, {
124975
+ path: toPath(state, buildInfoPath),
124976
+ buildInfo: false,
124977
+ modifiedTime: buildInfoTime
124978
+ });
124979
+ }
124980
+ return {
124981
+ type: ts.UpToDateStatusType.OutputMissing,
124982
+ missingOutputFileName: buildInfoPath
124983
+ };
124984
+ }
124985
+ var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
124986
+ if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
124987
+ return {
124988
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
124989
+ version: buildInfo.version
124990
+ };
124991
+ }
124992
+ if (buildInfo.program) {
124993
+ if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
124994
+ (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
124759
124995
  return {
124760
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124761
- outOfDateOutputFileName: oldestOutputFileName,
124762
- newerProjectName: ref.path
124996
+ type: ts.UpToDateStatusType.OutOfDateBuildInfo,
124997
+ buildInfoFile: buildInfoPath
124763
124998
  };
124764
124999
  }
125000
+ buildInfoProgram = buildInfo.program;
124765
125001
  }
125002
+ oldestOutputFileTime = buildInfoTime;
125003
+ oldestOutputFileName = buildInfoPath;
125004
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
124766
125005
  }
124767
- if (missingOutputFileName !== undefined) {
124768
- return {
124769
- type: ts.UpToDateStatusType.OutputMissing,
124770
- missingOutputFileName: missingOutputFileName
124771
- };
125006
+ // Check input files
125007
+ var newestInputFileName = undefined;
125008
+ var newestInputFileTime = minimumDate;
125009
+ var pseudoInputUptodate = false;
125010
+ // Get timestamps of input files
125011
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
125012
+ var inputFile = _f[_e];
125013
+ var inputTime = getModifiedTime(state, inputFile);
125014
+ if (inputTime === ts.missingFileModifiedTime) {
125015
+ return {
125016
+ type: ts.UpToDateStatusType.Unbuildable,
125017
+ reason: inputFile + " does not exist"
125018
+ };
125019
+ }
125020
+ // If an buildInfo is older than the newest input, we can stop checking
125021
+ if (buildInfoTime && buildInfoTime < inputTime) {
125022
+ var version_3 = void 0;
125023
+ var currentVersion = void 0;
125024
+ if (buildInfoProgram) {
125025
+ // Read files and see if they are same, read is anyways cached
125026
+ if (!buildInfoVersionMap)
125027
+ buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
125028
+ version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
125029
+ var text = version_3 ? state.readFileWithCache(inputFile) : undefined;
125030
+ currentVersion = text && (host.createHash || ts.generateDjb2Hash)(text);
125031
+ if (version_3 && version_3 === currentVersion)
125032
+ pseudoInputUptodate = true;
125033
+ }
125034
+ if (!version_3 || version_3 !== currentVersion) {
125035
+ return {
125036
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125037
+ outOfDateOutputFileName: buildInfoPath,
125038
+ newerInputFileName: inputFile
125039
+ };
125040
+ }
125041
+ }
125042
+ if (inputTime > newestInputFileTime) {
125043
+ newestInputFileName = inputFile;
125044
+ newestInputFileTime = inputTime;
125045
+ }
124772
125046
  }
124773
- if (isOutOfDateWithInputs) {
124774
- return {
124775
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
124776
- outOfDateOutputFileName: oldestOutputFileName,
124777
- newerInputFileName: newestInputFileName
124778
- };
125047
+ // Now see if all outputs are newer than the newest input
125048
+ // Dont check output timestamps if we have buildinfo telling us output is uptodate
125049
+ if (!buildInfoPath) {
125050
+ // Collect the expected outputs of this project
125051
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
125052
+ var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
125053
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
125054
+ var output = outputs_1[_g];
125055
+ var path = toPath(state, output);
125056
+ // Output is missing; can stop checking
125057
+ var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
125058
+ if (!outputTime) {
125059
+ outputTime = ts.getModifiedTime(state.host, output);
125060
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
125061
+ }
125062
+ if (outputTime === ts.missingFileModifiedTime) {
125063
+ return {
125064
+ type: ts.UpToDateStatusType.OutputMissing,
125065
+ missingOutputFileName: output
125066
+ };
125067
+ }
125068
+ if (outputTime < oldestOutputFileTime) {
125069
+ oldestOutputFileTime = outputTime;
125070
+ oldestOutputFileName = output;
125071
+ }
125072
+ // If an output is older than the newest input, we can stop checking
125073
+ if (outputTime < newestInputFileTime) {
125074
+ return {
125075
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125076
+ outOfDateOutputFileName: oldestOutputFileName,
125077
+ newerInputFileName: newestInputFileName
125078
+ };
125079
+ }
125080
+ }
124779
125081
  }
124780
- else {
124781
- // Check tsconfig time
124782
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
124783
- if (configStatus)
124784
- return configStatus;
124785
- // Check extended config time
124786
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
124787
- if (extendedConfigStatus)
124788
- return extendedConfigStatus;
124789
- // Check package file time
124790
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
124791
- var path = _a[0];
124792
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
124793
- });
124794
- if (dependentPackageFileStatus)
124795
- return dependentPackageFileStatus;
124796
- }
124797
- if (!force && !state.buildInfoChecked.has(resolvedPath)) {
124798
- state.buildInfoChecked.set(resolvedPath, true);
124799
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
124800
- if (buildInfoPath) {
124801
- var value = state.readFileWithCache(buildInfoPath);
124802
- var buildInfo = value && ts.getBuildInfo(value);
124803
- if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125082
+ var seenRefs = buildInfoPath ? new ts.Set() : undefined;
125083
+ var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
125084
+ seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
125085
+ var pseudoUpToDate = false;
125086
+ var usesPrepend = false;
125087
+ var upstreamChangedProject;
125088
+ if (referenceStatuses) {
125089
+ for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
125090
+ var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
125091
+ usesPrepend = usesPrepend || !!(ref.prepend);
125092
+ // If the upstream project's newest file is older than our oldest output, we
125093
+ // can't be out of date because of it
125094
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
125095
+ continue;
125096
+ }
125097
+ // Check if tsbuildinfo path is shared, then we need to rebuild
125098
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
124804
125099
  return {
124805
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
124806
- version: buildInfo.version
125100
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125101
+ outOfDateOutputFileName: buildInfoPath,
125102
+ newerProjectName: ref.path
124807
125103
  };
124808
125104
  }
125105
+ // If the upstream project has only change .d.ts files, and we've built
125106
+ // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
125107
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
125108
+ pseudoUpToDate = true;
125109
+ upstreamChangedProject = ref.path;
125110
+ continue;
125111
+ }
125112
+ // We have an output older than an upstream output - we are out of date
125113
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125114
+ return {
125115
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125116
+ outOfDateOutputFileName: oldestOutputFileName,
125117
+ newerProjectName: ref.path
125118
+ };
124809
125119
  }
124810
125120
  }
125121
+ // Check tsconfig time
125122
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125123
+ if (configStatus)
125124
+ return configStatus;
125125
+ // Check extended config time
125126
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125127
+ if (extendedConfigStatus)
125128
+ return extendedConfigStatus;
125129
+ // Check package file time
125130
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125131
+ var path = _a[0];
125132
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125133
+ });
125134
+ if (dependentPackageFileStatus)
125135
+ return dependentPackageFileStatus;
124811
125136
  if (usesPrepend && pseudoUpToDate) {
124812
125137
  return {
124813
125138
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -124817,15 +125142,37 @@ var ts;
124817
125142
  }
124818
125143
  // Up to date
124819
125144
  return {
124820
- type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
125145
+ type: pseudoUpToDate ?
125146
+ ts.UpToDateStatusType.UpToDateWithUpstreamTypes :
125147
+ pseudoInputUptodate ?
125148
+ ts.UpToDateStatusType.UpToDateWithInputFileText :
125149
+ ts.UpToDateStatusType.UpToDate,
124821
125150
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
124822
125151
  newestInputFileTime: newestInputFileTime,
124823
- newestOutputFileTime: newestOutputFileTime,
124824
125152
  newestInputFileName: newestInputFileName,
124825
- newestOutputFileName: newestOutputFileName,
124826
125153
  oldestOutputFileName: oldestOutputFileName
124827
125154
  };
124828
125155
  }
125156
+ function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
125157
+ if (seenRefs.has(resolvedRefPath))
125158
+ return false;
125159
+ seenRefs.add(resolvedRefPath);
125160
+ var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
125161
+ if (refBuildInfo.path === buildInfoCacheEntry.path)
125162
+ return true;
125163
+ if (resolvedConfig.projectReferences) {
125164
+ // Check references
125165
+ for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
125166
+ var ref = _a[_i];
125167
+ var resolvedRef = ts.resolveProjectReferencePath(ref);
125168
+ var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
125169
+ var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
125170
+ if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
125171
+ return true;
125172
+ }
125173
+ }
125174
+ return false;
125175
+ }
124829
125176
  function getUpToDateStatus(state, project, resolvedPath) {
124830
125177
  if (project === undefined) {
124831
125178
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -124838,39 +125185,65 @@ var ts;
124838
125185
  state.projectStatus.set(resolvedPath, actual);
124839
125186
  return actual;
124840
125187
  }
124841
- function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
125188
+ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
124842
125189
  if (proj.options.noEmit)
124843
- return priorNewestUpdateTime;
125190
+ return;
125191
+ var now;
125192
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
125193
+ if (buildInfoPath) {
125194
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
125195
+ if (!!state.options.verbose)
125196
+ reportStatus(state, verboseMessage, proj.options.configFilePath);
125197
+ state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
125198
+ getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
125199
+ }
125200
+ state.outputTimeStamps.delete(projectPath);
125201
+ return;
125202
+ }
124844
125203
  var host = state.host;
124845
125204
  var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125205
+ var outputTimeStampMap = getOutputTimeStampMap(state, projectPath);
125206
+ var modifiedOutputs = outputTimeStampMap ? new ts.Set() : undefined;
124846
125207
  if (!skipOutputs || outputs.length !== skipOutputs.size) {
124847
125208
  var reportVerbose = !!state.options.verbose;
124848
- var now = host.now ? host.now() : new Date();
124849
125209
  for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
124850
125210
  var file = outputs_2[_i];
124851
- if (skipOutputs && skipOutputs.has(toPath(state, file))) {
125211
+ var path = toPath(state, file);
125212
+ if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
124852
125213
  continue;
124853
- }
124854
125214
  if (reportVerbose) {
124855
125215
  reportVerbose = false;
124856
125216
  reportStatus(state, verboseMessage, proj.options.configFilePath);
124857
125217
  }
124858
- if (ts.isDeclarationFileName(file)) {
124859
- priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
125218
+ host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
125219
+ if (outputTimeStampMap) {
125220
+ outputTimeStampMap.set(path, now);
125221
+ modifiedOutputs.add(path);
124860
125222
  }
124861
- host.setModifiedTime(file, now);
124862
125223
  }
124863
125224
  }
124864
- return priorNewestUpdateTime;
125225
+ // Clear out timestamps not in output list any more
125226
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.forEach(function (_value, key) {
125227
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs.has(key))
125228
+ outputTimeStampMap.delete(key);
125229
+ });
125230
+ }
125231
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
125232
+ var _a;
125233
+ if (!options.composite)
125234
+ return undefined;
125235
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125236
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, /*modifiedTime*/ undefined);
125237
+ 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;
124865
125238
  }
124866
125239
  function updateOutputTimestamps(state, proj, resolvedPath) {
124867
125240
  if (state.options.dry) {
124868
125241
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
124869
125242
  }
124870
- var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125243
+ updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
124871
125244
  state.projectStatus.set(resolvedPath, {
124872
125245
  type: ts.UpToDateStatusType.UpToDate,
124873
- newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
125246
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
124874
125247
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
124875
125248
  });
124876
125249
  }
@@ -124916,6 +125289,7 @@ var ts;
124916
125289
  break;
124917
125290
  }
124918
125291
  // falls through
125292
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
124919
125293
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
124920
125294
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
124921
125295
  if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
@@ -125063,12 +125437,10 @@ var ts;
125063
125437
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
125064
125438
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
125065
125439
  return;
125066
- state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
125067
- invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
125068
- }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
125440
+ 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));
125069
125441
  }
125070
125442
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
125071
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
125443
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
125072
125444
  var _a;
125073
125445
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
125074
125446
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -125100,7 +125472,7 @@ var ts;
125100
125472
  if (!state.watch)
125101
125473
  return;
125102
125474
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
125103
- 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); },
125475
+ 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); },
125104
125476
  onDeleteValue: ts.closeFileWatcher,
125105
125477
  });
125106
125478
  }
@@ -125108,7 +125480,7 @@ var ts;
125108
125480
  if (!state.watch || !state.lastCachedPackageJsonLookups)
125109
125481
  return;
125110
125482
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
125111
- 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); },
125483
+ 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); },
125112
125484
  onDeleteValue: ts.closeFileWatcher,
125113
125485
  });
125114
125486
  }
@@ -125240,19 +125612,18 @@ var ts;
125240
125612
  }
125241
125613
  }
125242
125614
  function reportUpToDateStatus(state, configFileName, status) {
125243
- if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
125244
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125245
- }
125246
125615
  switch (status.type) {
125247
125616
  case ts.UpToDateStatusType.OutOfDateWithSelf:
125248
- 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));
125617
+ 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));
125249
125618
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
125250
- 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));
125619
+ 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));
125251
125620
  case ts.UpToDateStatusType.OutputMissing:
125252
125621
  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));
125622
+ case ts.UpToDateStatusType.OutOfDateBuildInfo:
125623
+ 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));
125253
125624
  case ts.UpToDateStatusType.UpToDate:
125254
125625
  if (status.newestInputFileTime !== undefined) {
125255
- 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 || ""));
125626
+ 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 || ""));
125256
125627
  }
125257
125628
  // Don't report anything for "up to date because it was already built" -- too verbose
125258
125629
  break;
@@ -125260,6 +125631,8 @@ var ts;
125260
125631
  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));
125261
125632
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125262
125633
  return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
125634
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
125635
+ 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));
125263
125636
  case ts.UpToDateStatusType.UpstreamOutOfDate:
125264
125637
  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));
125265
125638
  case ts.UpToDateStatusType.UpstreamBlocked:
@@ -125270,6 +125643,8 @@ var ts;
125270
125643
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
125271
125644
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
125272
125645
  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);
125646
+ case ts.UpToDateStatusType.ForceBuild:
125647
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125273
125648
  case ts.UpToDateStatusType.ContainerOnly:
125274
125649
  // Don't report status on "solution" projects
125275
125650
  // falls through
@@ -125853,6 +126228,17 @@ var ts;
125853
126228
  SymbolDisplayPartKind[SymbolDisplayPartKind["linkName"] = 23] = "linkName";
125854
126229
  SymbolDisplayPartKind[SymbolDisplayPartKind["linkText"] = 24] = "linkText";
125855
126230
  })(SymbolDisplayPartKind = ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {}));
126231
+ // Do not change existing values, as they exist in telemetry.
126232
+ var CompletionInfoFlags;
126233
+ (function (CompletionInfoFlags) {
126234
+ CompletionInfoFlags[CompletionInfoFlags["None"] = 0] = "None";
126235
+ CompletionInfoFlags[CompletionInfoFlags["MayIncludeAutoImports"] = 1] = "MayIncludeAutoImports";
126236
+ CompletionInfoFlags[CompletionInfoFlags["IsImportStatementCompletion"] = 2] = "IsImportStatementCompletion";
126237
+ CompletionInfoFlags[CompletionInfoFlags["IsContinuation"] = 4] = "IsContinuation";
126238
+ CompletionInfoFlags[CompletionInfoFlags["ResolvedModuleSpecifiers"] = 8] = "ResolvedModuleSpecifiers";
126239
+ CompletionInfoFlags[CompletionInfoFlags["ResolvedModuleSpecifiersBeyondLimit"] = 16] = "ResolvedModuleSpecifiersBeyondLimit";
126240
+ CompletionInfoFlags[CompletionInfoFlags["MayIncludeMethodSnippets"] = 32] = "MayIncludeMethodSnippets";
126241
+ })(CompletionInfoFlags = ts.CompletionInfoFlags || (ts.CompletionInfoFlags = {}));
125856
126242
  var OutliningSpanKind;
125857
126243
  (function (OutliningSpanKind) {
125858
126244
  /** Single or multi-line comments */
@@ -127865,6 +128251,14 @@ var ts;
127865
128251
  return __assign(__assign({}, createModuleSpecifierResolutionHost(program, host)), { getCommonSourceDirectory: function () { return program.getCommonSourceDirectory(); } });
127866
128252
  }
127867
128253
  ts.getModuleSpecifierResolverHost = getModuleSpecifierResolverHost;
128254
+ function moduleResolutionRespectsExports(moduleResolution) {
128255
+ return moduleResolution >= ts.ModuleResolutionKind.Node12 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
128256
+ }
128257
+ ts.moduleResolutionRespectsExports = moduleResolutionRespectsExports;
128258
+ function moduleResolutionUsesNodeModules(moduleResolution) {
128259
+ return moduleResolution === ts.ModuleResolutionKind.NodeJs || moduleResolution >= ts.ModuleResolutionKind.Node12 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
128260
+ }
128261
+ ts.moduleResolutionUsesNodeModules = moduleResolutionUsesNodeModules;
127868
128262
  function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) {
127869
128263
  return defaultImport || namedImports && namedImports.length ? makeImport(defaultImport, namedImports, moduleSpecifier, quotePreference) : undefined;
127870
128264
  }
@@ -129468,8 +129862,8 @@ var ts;
129468
129862
  if (from === to)
129469
129863
  return false;
129470
129864
  var cachedResult = moduleSpecifierCache === null || moduleSpecifierCache === void 0 ? void 0 : moduleSpecifierCache.get(from.path, to.path, preferences, {});
129471
- if ((cachedResult === null || cachedResult === void 0 ? void 0 : cachedResult.isAutoImportable) !== undefined) {
129472
- return cachedResult.isAutoImportable;
129865
+ if ((cachedResult === null || cachedResult === void 0 ? void 0 : cachedResult.isBlockedByPackageJsonDependencies) !== undefined) {
129866
+ return !cachedResult.isBlockedByPackageJsonDependencies;
129473
129867
  }
129474
129868
  var getCanonicalFileName = ts.hostGetCanonicalFileName(moduleSpecifierResolutionHost);
129475
129869
  var globalTypingsCache = (_a = moduleSpecifierResolutionHost.getGlobalTypingsCacheLocation) === null || _a === void 0 ? void 0 : _a.call(moduleSpecifierResolutionHost);
@@ -129483,7 +129877,7 @@ var ts;
129483
129877
  });
129484
129878
  if (packageJsonFilter) {
129485
129879
  var isAutoImportable = hasImportablePath && packageJsonFilter.allowsImportingSourceFile(to, moduleSpecifierResolutionHost);
129486
- moduleSpecifierCache === null || moduleSpecifierCache === void 0 ? void 0 : moduleSpecifierCache.setIsAutoImportable(from.path, to.path, preferences, {}, isAutoImportable);
129880
+ moduleSpecifierCache === null || moduleSpecifierCache === void 0 ? void 0 : moduleSpecifierCache.setBlockedByPackageJsonDependencies(from.path, to.path, preferences, {}, !isAutoImportable);
129487
129881
  return isAutoImportable;
129488
129882
  }
129489
129883
  return hasImportablePath;
@@ -131762,15 +132156,26 @@ var ts;
131762
132156
  var _a, _b, _c;
131763
132157
  var start = ts.timestamp();
131764
132158
  var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
131765
- var resolutionLimitExceeded = false;
132159
+ // Under `--moduleResolution nodenext`, we have to resolve module specifiers up front, because
132160
+ // package.json exports can mean we *can't* resolve a module specifier (that doesn't include a
132161
+ // relative path into node_modules), and we want to filter those completions out entirely.
132162
+ // Import statement completions always need specifier resolution because the module specifier is
132163
+ // part of their `insertText`, not the `codeActions` creating edits away from the cursor.
132164
+ var needsFullResolution = isForImportStatementCompletion || ts.moduleResolutionRespectsExports(ts.getEmitModuleResolutionKind(program.getCompilerOptions()));
132165
+ var skippedAny = false;
131766
132166
  var ambientCount = 0;
131767
132167
  var resolvedCount = 0;
131768
132168
  var resolvedFromCacheCount = 0;
131769
132169
  var cacheAttemptCount = 0;
131770
- var result = cb({ tryResolve: tryResolve, resolutionLimitExceeded: function () { return resolutionLimitExceeded; } });
132170
+ var result = cb({
132171
+ tryResolve: tryResolve,
132172
+ skippedAny: function () { return skippedAny; },
132173
+ resolvedAny: function () { return resolvedCount > 0; },
132174
+ resolvedBeyondLimit: function () { return resolvedCount > Completions.moduleSpecifierResolutionLimit; },
132175
+ });
131771
132176
  var hitRateMessage = cacheAttemptCount ? " (" + (resolvedFromCacheCount / cacheAttemptCount * 100).toFixed(1) + "% hit rate)" : "";
131772
132177
  (_a = host.log) === null || _a === void 0 ? void 0 : _a.call(host, logPrefix + ": resolved " + resolvedCount + " module specifiers, plus " + ambientCount + " ambient and " + resolvedFromCacheCount + " from cache" + hitRateMessage);
131773
- (_b = host.log) === null || _b === void 0 ? void 0 : _b.call(host, logPrefix + ": response is " + (resolutionLimitExceeded ? "incomplete" : "complete"));
132178
+ (_b = host.log) === null || _b === void 0 ? void 0 : _b.call(host, logPrefix + ": response is " + (skippedAny ? "incomplete" : "complete"));
131774
132179
  (_c = host.log) === null || _c === void 0 ? void 0 : _c.call(host, logPrefix + ": " + (ts.timestamp() - start));
131775
132180
  return result;
131776
132181
  function tryResolve(exportInfo, symbolName, isFromAmbientModule) {
@@ -131779,22 +132184,22 @@ var ts;
131779
132184
  if (result_1) {
131780
132185
  ambientCount++;
131781
132186
  }
131782
- return result_1;
132187
+ return result_1 || "failed";
131783
132188
  }
131784
- var shouldResolveModuleSpecifier = isForImportStatementCompletion || preferences.allowIncompleteCompletions && resolvedCount < Completions.moduleSpecifierResolutionLimit;
132189
+ var shouldResolveModuleSpecifier = needsFullResolution || preferences.allowIncompleteCompletions && resolvedCount < Completions.moduleSpecifierResolutionLimit;
131785
132190
  var shouldGetModuleSpecifierFromCache = !shouldResolveModuleSpecifier && preferences.allowIncompleteCompletions && cacheAttemptCount < Completions.moduleSpecifierResolutionCacheAttemptLimit;
131786
132191
  var result = (shouldResolveModuleSpecifier || shouldGetModuleSpecifierFromCache)
131787
132192
  ? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite, sourceFile, program, host, preferences, packageJsonImportFilter, shouldGetModuleSpecifierFromCache)
131788
132193
  : undefined;
131789
132194
  if (!shouldResolveModuleSpecifier && !shouldGetModuleSpecifierFromCache || shouldGetModuleSpecifierFromCache && !result) {
131790
- resolutionLimitExceeded = true;
132195
+ skippedAny = true;
131791
132196
  }
131792
132197
  resolvedCount += (result === null || result === void 0 ? void 0 : result.computedWithoutCacheCount) || 0;
131793
- resolvedFromCacheCount += exportInfo.length - resolvedCount;
132198
+ resolvedFromCacheCount += exportInfo.length - ((result === null || result === void 0 ? void 0 : result.computedWithoutCacheCount) || 0);
131794
132199
  if (shouldGetModuleSpecifierFromCache) {
131795
132200
  cacheAttemptCount++;
131796
132201
  }
131797
- return result;
132202
+ return result || (needsFullResolution ? "failed" : "skipped");
131798
132203
  }
131799
132204
  }
131800
132205
  function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext) {
@@ -131892,6 +132297,7 @@ var ts;
131892
132297
  var newEntries = resolvingModuleSpecifiers("continuePreviousIncompleteResponse", host, program, file, location.getStart(), preferences,
131893
132298
  /*isForImportStatementCompletion*/ false, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
131894
132299
  var entries = ts.mapDefined(previousResponse.entries, function (entry) {
132300
+ var _a;
131895
132301
  if (!entry.hasAction || !entry.source || !entry.data || completionEntryDataIsResolved(entry.data)) {
131896
132302
  // Not an auto import or already resolved; keep as is
131897
132303
  return entry;
@@ -131903,8 +132309,12 @@ var ts;
131903
132309
  var origin = ts.Debug.checkDefined(getAutoImportSymbolFromCompletionEntryData(entry.name, entry.data, program, host)).origin;
131904
132310
  var info = exportMap.get(file.path, entry.data.exportMapKey);
131905
132311
  var result = info && context.tryResolve(info, entry.name, !ts.isExternalModuleNameRelative(ts.stripQuotes(origin.moduleSymbol.name)));
131906
- if (!result)
132312
+ if (result === "skipped")
131907
132313
  return entry;
132314
+ if (!result || result === "failed") {
132315
+ (_a = host.log) === null || _a === void 0 ? void 0 : _a.call(host, "Unexpected failure resolving auto import for '" + entry.name + "' from '" + entry.source + "'");
132316
+ return undefined;
132317
+ }
131908
132318
  var newOrigin = __assign(__assign({}, origin), { kind: 32 /* ResolvedExport */, moduleSpecifier: result.moduleSpecifier });
131909
132319
  // Mutating for performance... feels sketchy but nobody else uses the cache,
131910
132320
  // so why bother allocating a bunch of new objects?
@@ -131913,12 +132323,13 @@ var ts;
131913
132323
  entry.sourceDisplay = [ts.textPart(newOrigin.moduleSpecifier)];
131914
132324
  return entry;
131915
132325
  });
131916
- if (!context.resolutionLimitExceeded()) {
132326
+ if (!context.skippedAny()) {
131917
132327
  previousResponse.isIncomplete = undefined;
131918
132328
  }
131919
132329
  return entries;
131920
132330
  });
131921
132331
  previousResponse.entries = newEntries;
132332
+ previousResponse.flags = (previousResponse.flags || 0) | 4 /* IsContinuation */;
131922
132333
  return previousResponse;
131923
132334
  }
131924
132335
  function jsdocCompletionInfo(entries) {
@@ -132000,12 +132411,13 @@ var ts;
132000
132411
  ts.insertSorted(entries, createCompletionEntryForLiteral(sourceFile, preferences, literal), compareCompletionEntries, /*allowDuplicates*/ true);
132001
132412
  }
132002
132413
  return {
132414
+ flags: completionData.flags,
132003
132415
  isGlobalCompletion: isInSnippetScope,
132004
132416
  isIncomplete: preferences.allowIncompleteCompletions && hasUnresolvedAutoImports ? true : undefined,
132005
132417
  isMemberCompletion: isMemberCompletionKind(completionKind),
132006
132418
  isNewIdentifierLocation: isNewIdentifierLocation,
132007
132419
  optionalReplacementSpan: getOptionalReplacementSpan(location),
132008
- entries: entries
132420
+ entries: entries,
132009
132421
  };
132010
132422
  }
132011
132423
  function isUncheckedFile(sourceFile, compilerOptions) {
@@ -133062,6 +133474,7 @@ var ts;
133062
133474
  var location = ts.getTouchingPropertyName(sourceFile, position);
133063
133475
  var keywordFilters = 0 /* None */;
133064
133476
  var isNewIdentifierLocation = false;
133477
+ var flags = 0 /* None */;
133065
133478
  if (contextToken) {
133066
133479
  var importStatementCompletion = getImportStatementCompletionInfo(contextToken);
133067
133480
  isNewIdentifierLocation = importStatementCompletion.isNewIdentifierLocation;
@@ -133081,6 +133494,7 @@ var ts;
133081
133494
  // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients
133082
133495
  // to opt in with the `includeCompletionsForImportStatements` user preference.
133083
133496
  importCompletionNode = importStatementCompletion.replacementNode;
133497
+ flags |= 2 /* IsImportStatementCompletion */;
133084
133498
  }
133085
133499
  // Bail out if this is a known invalid completion location
133086
133500
  if (!importCompletionNode && isCompletionListBlocker(contextToken)) {
@@ -133273,6 +133687,7 @@ var ts;
133273
133687
  isRightOfOpenTag: isRightOfOpenTag,
133274
133688
  importCompletionNode: importCompletionNode,
133275
133689
  hasUnresolvedAutoImports: hasUnresolvedAutoImports,
133690
+ flags: flags,
133276
133691
  };
133277
133692
  function isTagWithTypeExpression(tag) {
133278
133693
  switch (tag.kind) {
@@ -133682,6 +134097,7 @@ var ts;
133682
134097
  // Asking for completion details for an item that is not an auto-import
133683
134098
  return;
133684
134099
  }
134100
+ flags |= 1 /* MayIncludeAutoImports */;
133685
134101
  // import { type | -> token text should be blank
133686
134102
  var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken
133687
134103
  && importCompletionNode
@@ -133712,16 +134128,36 @@ var ts;
133712
134128
  return true;
133713
134129
  return charactersFuzzyMatchInString(symbolName, lowerCaseTokenText);
133714
134130
  }, function (info, symbolName, isFromAmbientModule, exportMapKey) {
134131
+ var _a;
133715
134132
  if (detailsEntryId && !ts.some(info, function (i) { return detailsEntryId.source === ts.stripQuotes(i.moduleSymbol.name); })) {
133716
134133
  return;
133717
134134
  }
133718
- var defaultExportInfo = ts.find(info, isImportableExportInfo);
133719
- if (!defaultExportInfo) {
134135
+ // Do a relatively cheap check to bail early if all re-exports are non-importable
134136
+ // due to file location or package.json dependency filtering. For non-node12+
134137
+ // module resolution modes, getting past this point guarantees that we'll be
134138
+ // able to generate a suitable module specifier, so we can safely show a completion,
134139
+ // even if we defer computing the module specifier.
134140
+ var firstImportableExportInfo = ts.find(info, isImportableExportInfo);
134141
+ if (!firstImportableExportInfo) {
134142
+ return;
134143
+ }
134144
+ // In node12+, module specifier resolution can fail due to modules being blocked
134145
+ // by package.json `exports`. If that happens, don't show a completion item.
134146
+ // N.B. in this resolution mode we always try to resolve module specifiers here,
134147
+ // because we have to know now if it's going to fail so we can omit the completion
134148
+ // from the list.
134149
+ var result = context.tryResolve(info, symbolName, isFromAmbientModule) || {};
134150
+ if (result === "failed")
133720
134151
  return;
134152
+ // If we skipped resolving module specifiers, our selection of which ExportInfo
134153
+ // to use here is arbitrary, since the info shown in the completion list derived from
134154
+ // it should be identical regardless of which one is used. During the subsequent
134155
+ // `CompletionEntryDetails` request, we'll get all the ExportInfos again and pick
134156
+ // the best one based on the module specifier it produces.
134157
+ var exportInfo = firstImportableExportInfo, moduleSpecifier;
134158
+ if (result !== "skipped") {
134159
+ (_a = result.exportInfo, exportInfo = _a === void 0 ? firstImportableExportInfo : _a, moduleSpecifier = result.moduleSpecifier);
133721
134160
  }
133722
- // If we don't need to resolve module specifiers, we can use any re-export that is importable at all
133723
- // (We need to ensure that at least one is importable to show a completion.)
133724
- var _a = context.tryResolve(info, symbolName, isFromAmbientModule) || {}, _b = _a.exportInfo, exportInfo = _b === void 0 ? defaultExportInfo : _b, moduleSpecifier = _a.moduleSpecifier;
133725
134161
  var isDefaultExport = exportInfo.exportKind === 1 /* Default */;
133726
134162
  var symbol = isDefaultExport && ts.getLocalSymbolForExportDefault(exportInfo.symbol) || exportInfo.symbol;
133727
134163
  pushAutoImportSymbol(symbol, {
@@ -133736,7 +134172,9 @@ var ts;
133736
134172
  isFromPackageJson: exportInfo.isFromPackageJson,
133737
134173
  });
133738
134174
  });
133739
- hasUnresolvedAutoImports = context.resolutionLimitExceeded();
134175
+ hasUnresolvedAutoImports = context.skippedAny();
134176
+ flags |= context.resolvedAny() ? 8 /* ResolvedModuleSpecifiers */ : 0;
134177
+ flags |= context.resolvedBeyondLimit() ? 16 /* ResolvedModuleSpecifiersBeyondLimit */ : 0;
133740
134178
  });
133741
134179
  function isImportableExportInfo(info) {
133742
134180
  var moduleFile = ts.tryCast(info.moduleSymbol.valueDeclaration, ts.isSourceFile);
@@ -133784,6 +134222,7 @@ var ts;
133784
134222
  return;
133785
134223
  }
133786
134224
  var origin = __assign({ kind: 128 /* ObjectLiteralMethod */ }, entryProps);
134225
+ flags |= 32 /* MayIncludeMethodSnippets */;
133787
134226
  symbolToOriginInfoMap[symbols.length] = origin;
133788
134227
  symbols.push(member);
133789
134228
  });
@@ -133980,7 +134419,7 @@ var ts;
133980
134419
  // through type declaration or inference.
133981
134420
  // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed -
133982
134421
  // type of parameter will flow in from the contextual type of the function
133983
- var canGetType = ts.hasInitializer(rootDeclaration) || ts.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 244 /* ForOfStatement */;
134422
+ var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 244 /* ForOfStatement */;
133984
134423
  if (!canGetType && rootDeclaration.kind === 164 /* Parameter */) {
133985
134424
  if (ts.isExpression(rootDeclaration.parent)) {
133986
134425
  canGetType = !!typeChecker.getContextualType(rootDeclaration.parent);
@@ -135255,6 +135694,8 @@ var ts;
135255
135694
  return highlightSpans(getAsyncAndAwaitOccurrences(node));
135256
135695
  case 125 /* YieldKeyword */:
135257
135696
  return highlightSpans(getYieldOccurrences(node));
135697
+ case 101 /* InKeyword */:
135698
+ return undefined;
135258
135699
  default:
135259
135700
  return ts.isModifierKind(node.kind) && (ts.isDeclaration(node.parent) || ts.isVariableStatement(node.parent))
135260
135701
  ? highlightSpans(getModifierOccurrences(node.kind, node.parent))
@@ -150023,7 +150464,7 @@ var ts;
150023
150464
  ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined.code,
150024
150465
  ts.Diagnostics.Type_0_is_not_an_array_type.code,
150025
150466
  ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type.code,
150026
- ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators.code,
150467
+ ts.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher.code,
150027
150468
  ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator.code,
150028
150469
  ts.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator.code,
150029
150470
  ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator.code,
@@ -152977,6 +153418,7 @@ var ts;
152977
153418
  var compilerOptions = program.getCompilerOptions();
152978
153419
  var moduleSpecifierResolutionHost = ts.createModuleSpecifierResolutionHost(program, host);
152979
153420
  var getChecker = ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); });
153421
+ var rejectNodeModulesRelativePaths = ts.moduleResolutionUsesNodeModules(ts.getEmitModuleResolutionKind(compilerOptions));
152980
153422
  var getModuleSpecifiers = fromCacheOnly
152981
153423
  ? function (moduleSymbol) { return ({ moduleSpecifiers: ts.moduleSpecifiers.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }); }
152982
153424
  : function (moduleSymbol, checker) { return ts.moduleSpecifiers.getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, sourceFile, moduleSpecifierResolutionHost, preferences); };
@@ -152987,19 +153429,19 @@ var ts;
152987
153429
  var importedSymbolHasValueMeaning = !!(exportInfo.targetFlags & 111551 /* Value */);
152988
153430
  var addAsTypeOnly = getAddAsTypeOnly(isValidTypeOnlyUseSite, /*isForNewImportDeclaration*/ true, exportInfo.symbol, exportInfo.targetFlags, checker, compilerOptions);
152989
153431
  computedWithoutCacheCount += computedWithoutCache ? 1 : 0;
152990
- return moduleSpecifiers === null || moduleSpecifiers === void 0 ? void 0 : moduleSpecifiers.map(function (moduleSpecifier) {
152991
- // `position` should only be undefined at a missing jsx namespace, in which case we shouldn't be looking for pure types.
152992
- return !importedSymbolHasValueMeaning && isJs && position !== undefined
152993
- ? { kind: 1 /* JsdocTypeImport */, moduleSpecifier: moduleSpecifier, position: position, exportInfo: exportInfo, isReExport: i > 0 }
152994
- : {
152995
- kind: 3 /* AddNew */,
152996
- moduleSpecifier: moduleSpecifier,
152997
- importKind: getImportKind(sourceFile, exportInfo.exportKind, compilerOptions),
152998
- useRequire: useRequire,
152999
- addAsTypeOnly: addAsTypeOnly,
153000
- exportInfo: exportInfo,
153001
- isReExport: i > 0,
153002
- };
153432
+ return ts.mapDefined(moduleSpecifiers, function (moduleSpecifier) {
153433
+ return rejectNodeModulesRelativePaths && ts.pathContainsNodeModules(moduleSpecifier) ? undefined :
153434
+ // `position` should only be undefined at a missing jsx namespace, in which case we shouldn't be looking for pure types.
153435
+ !importedSymbolHasValueMeaning && isJs && position !== undefined ? { kind: 1 /* JsdocTypeImport */, moduleSpecifier: moduleSpecifier, position: position, exportInfo: exportInfo, isReExport: i > 0 } :
153436
+ {
153437
+ kind: 3 /* AddNew */,
153438
+ moduleSpecifier: moduleSpecifier,
153439
+ importKind: getImportKind(sourceFile, exportInfo.exportKind, compilerOptions),
153440
+ useRequire: useRequire,
153441
+ addAsTypeOnly: addAsTypeOnly,
153442
+ exportInfo: exportInfo,
153443
+ isReExport: i > 0,
153444
+ };
153003
153445
  });
153004
153446
  });
153005
153447
  return { computedWithoutCacheCount: computedWithoutCacheCount, fixes: fixes };
@@ -158572,6 +159014,7 @@ var ts;
158572
159014
  var fixName = "addVoidToPromise";
158573
159015
  var fixId = "addVoidToPromise";
158574
159016
  var errorCodes = [
159017
+ ts.Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments.code,
158575
159018
  ts.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code
158576
159019
  ];
158577
159020
  codefix.registerCodeFix({