@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/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-insiders.20220427";
103
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220429";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -6190,7 +6190,7 @@ var ts;
6190
6190
  };
6191
6191
  }
6192
6192
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
6193
- var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName) {
6193
+ var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName, modifiedTime) {
6194
6194
  // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
6195
6195
  if (!ts.isString(relativeFileName))
6196
6196
  return;
@@ -6200,7 +6200,7 @@ var ts;
6200
6200
  if (callbacks) {
6201
6201
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
6202
6202
  var fileCallback = callbacks_1[_i];
6203
- fileCallback(fileName, FileWatcherEventKind.Changed);
6203
+ fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6204
6204
  }
6205
6205
  }
6206
6206
  },
@@ -6254,7 +6254,7 @@ var ts;
6254
6254
  }
6255
6255
  else {
6256
6256
  cache.set(path, {
6257
- watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
6257
+ watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6258
6258
  refCount: 1
6259
6259
  });
6260
6260
  }
@@ -6282,7 +6282,7 @@ var ts;
6282
6282
  var newTime = modifiedTime.getTime();
6283
6283
  if (oldTime !== newTime) {
6284
6284
  watchedFile.mtime = modifiedTime;
6285
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
6285
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
6286
6286
  return true;
6287
6287
  }
6288
6288
  return false;
@@ -6533,17 +6533,18 @@ var ts;
6533
6533
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6534
6534
  /*@internal*/
6535
6535
  function createFileWatcherCallback(callback) {
6536
- return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
6536
+ return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6537
6537
  }
6538
6538
  ts.createFileWatcherCallback = createFileWatcherCallback;
6539
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists) {
6540
- return function (eventName) {
6539
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6540
+ return function (eventName, _relativeFileName, modifiedTime) {
6541
6541
  if (eventName === "rename") {
6542
- callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6542
+ modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
6543
+ callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
6543
6544
  }
6544
6545
  else {
6545
6546
  // Change
6546
- callback(fileName, FileWatcherEventKind.Changed);
6547
+ callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6547
6548
  }
6548
6549
  };
6549
6550
  }
@@ -6567,7 +6568,7 @@ var ts;
6567
6568
  }
6568
6569
  /*@internal*/
6569
6570
  function createSystemWatchFunctions(_a) {
6570
- 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;
6571
+ 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;
6571
6572
  var dynamicPollingWatchFile;
6572
6573
  var fixedChunkSizePollingWatchFile;
6573
6574
  var nonPollingWatchFile;
@@ -6589,7 +6590,7 @@ var ts;
6589
6590
  case ts.WatchFileKind.FixedChunkSizePolling:
6590
6591
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, /* pollingInterval */ undefined, /*options*/ undefined);
6591
6592
  case ts.WatchFileKind.UseFsEvents:
6592
- return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists),
6593
+ return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime),
6593
6594
  /*recursive*/ false, pollingInterval, ts.getFallbackOptions(options));
6594
6595
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
6595
6596
  if (!nonPollingWatchFile) {
@@ -6771,7 +6772,6 @@ var ts;
6771
6772
  fsWatch: fsWatch,
6772
6773
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6773
6774
  getCurrentDirectory: getCurrentDirectory,
6774
- fileExists: fileExists,
6775
6775
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
6776
6776
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
6777
6777
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
@@ -7031,7 +7031,7 @@ var ts;
7031
7031
  // File changed
7032
7032
  eventKind = FileWatcherEventKind.Changed;
7033
7033
  }
7034
- callback(fileName, eventKind);
7034
+ callback(fileName, eventKind, curr.mtime);
7035
7035
  }
7036
7036
  }
7037
7037
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
@@ -7057,10 +7057,10 @@ var ts;
7057
7057
  * Invoke the callback with rename and update the watcher if not closed
7058
7058
  * @param createWatcher
7059
7059
  */
7060
- function invokeCallbackAndUpdateWatcher(createWatcher) {
7060
+ function invokeCallbackAndUpdateWatcher(createWatcher, modifiedTime) {
7061
7061
  sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
7062
7062
  // Call the callback for current directory
7063
- callback("rename", "");
7063
+ callback("rename", "", modifiedTime);
7064
7064
  // If watcher is not closed, update it
7065
7065
  if (watcher) {
7066
7066
  watcher.close();
@@ -7106,13 +7106,14 @@ var ts;
7106
7106
  function callbackChangingToMissingFileSystemEntry(event, relativeName) {
7107
7107
  // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
7108
7108
  // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
7109
+ var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
7109
7110
  return event === "rename" &&
7110
7111
  (!relativeName ||
7111
7112
  relativeName === lastDirectoryPart ||
7112
7113
  (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
7113
- !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7114
- invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
7115
- callback(event, relativeName);
7114
+ modifiedTime === ts.missingFileModifiedTime ?
7115
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry, modifiedTime) :
7116
+ callback(event, relativeName, modifiedTime);
7116
7117
  }
7117
7118
  /**
7118
7119
  * Watch the file or directory using fs.watchFile since fs.watch threw exception
@@ -7126,12 +7127,15 @@ var ts;
7126
7127
  * and switch to existing file or directory when the missing filesystem entry is created
7127
7128
  */
7128
7129
  function watchMissingFileSystemEntry() {
7129
- return watchFile(fileOrDirectory, function (_fileName, eventKind) {
7130
- if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
7131
- // Call the callback for current file or directory
7132
- // For now it could be callback for the inner directory creation,
7133
- // but just return current directory, better than current no-op
7134
- invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
7130
+ return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
7131
+ if (eventKind === FileWatcherEventKind.Created) {
7132
+ modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
7133
+ if (modifiedTime !== ts.missingFileModifiedTime) {
7134
+ // Call the callback for current file or directory
7135
+ // For now it could be callback for the inner directory creation,
7136
+ // but just return current directory, better than current no-op
7137
+ invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry, modifiedTime);
7138
+ }
7135
7139
  }
7136
7140
  }, fallbackPollingInterval, fallbackOptions);
7137
7141
  }
@@ -7281,12 +7285,19 @@ var ts;
7281
7285
  }
7282
7286
  function getModifiedTime(path) {
7283
7287
  var _a;
7288
+ // Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
7289
+ // the CPU time performance.
7290
+ var originalStackTraceLimit = Error.stackTraceLimit;
7291
+ Error.stackTraceLimit = 0;
7284
7292
  try {
7285
7293
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
7286
7294
  }
7287
7295
  catch (e) {
7288
7296
  return undefined;
7289
7297
  }
7298
+ finally {
7299
+ Error.stackTraceLimit = originalStackTraceLimit;
7300
+ }
7290
7301
  }
7291
7302
  function setModifiedTime(path, time) {
7292
7303
  try {
@@ -8271,7 +8282,7 @@ var ts;
8271
8282
  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'."),
8272
8283
  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'."),
8273
8284
  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."),
8274
- Dynamic_import_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "Dynamic_import_cannot_have_type_arguments_1326", "Dynamic import cannot have type arguments."),
8285
+ 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."),
8275
8286
  String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
8276
8287
  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."),
8277
8288
  _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}()'?"),
@@ -8658,7 +8669,6 @@ var ts;
8658
8669
  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."),
8659
8670
  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."),
8660
8671
  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}'?"),
8661
- 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."),
8662
8672
  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}'?"),
8663
8673
  Object_is_of_type_unknown: diag(2571, ts.DiagnosticCategory.Error, "Object_is_of_type_unknown_2571", "Object is of type 'unknown'."),
8664
8674
  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."),
@@ -8872,6 +8882,7 @@ var ts;
8872
8882
  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}'."),
8873
8883
  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"),
8874
8884
  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."),
8885
+ 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."),
8875
8886
  Initializer_for_property_0: diag(2811, ts.DiagnosticCategory.Error, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
8876
8887
  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'."),
8877
8888
  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}'."),
@@ -9299,8 +9310,8 @@ var ts;
9299
9310
  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"),
9300
9311
  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"),
9301
9312
  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."),
9302
- 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}'"),
9303
- 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}'"),
9313
+ 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}'"),
9314
+ 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}'"),
9304
9315
  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"),
9305
9316
  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"),
9306
9317
  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"),
@@ -9344,6 +9355,8 @@ var ts;
9344
9355
  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}'."),
9345
9356
  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}'."),
9346
9357
  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."),
9358
+ 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"),
9359
+ 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"),
9347
9360
  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}'"),
9348
9361
  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."),
9349
9362
  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."),
@@ -20148,6 +20161,10 @@ var ts;
20148
20161
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
20149
20162
  }
20150
20163
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
20164
+ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
20165
+ return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
20166
+ }
20167
+ ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
20151
20168
  function getCompilerOptionValue(options, option) {
20152
20169
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
20153
20170
  }
@@ -37962,7 +37979,8 @@ var ts;
37962
37979
  if (!comment) {
37963
37980
  comment = parseTrailingTagComments(start, getNodePos(), indent, indentText);
37964
37981
  }
37965
- return finishNode(factory.createJSDocCallbackTag(tagName, typeExpression, fullName, comment), start);
37982
+ var end = comment !== undefined ? getNodePos() : typeExpression.end;
37983
+ return finishNode(factory.createJSDocCallbackTag(tagName, typeExpression, fullName, comment), start, end);
37966
37984
  }
37967
37985
  function escapedTextsEqual(a, b) {
37968
37986
  while (!ts.isIdentifier(a) || !ts.isIdentifier(b)) {
@@ -39185,6 +39203,7 @@ var ts;
39185
39203
  type: "boolean",
39186
39204
  affectsSemanticDiagnostics: true,
39187
39205
  affectsEmit: true,
39206
+ affectsMultiFileEmitBuildInfo: true,
39188
39207
  category: ts.Diagnostics.Watch_and_Build_Modes,
39189
39208
  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,
39190
39209
  defaultValueDescription: false,
@@ -39219,12 +39238,40 @@ var ts;
39219
39238
  affectsSourceFile: true,
39220
39239
  affectsModuleResolution: true,
39221
39240
  affectsEmit: true,
39241
+ affectsMultiFileEmitBuildInfo: true,
39222
39242
  paramType: ts.Diagnostics.VERSION,
39223
39243
  showInSimplifiedHelpView: true,
39224
39244
  category: ts.Diagnostics.Language_and_Environment,
39225
39245
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
39226
39246
  defaultValueDescription: 0 /* ES3 */,
39227
39247
  };
39248
+ /*@internal*/
39249
+ ts.moduleOptionDeclaration = {
39250
+ name: "module",
39251
+ shortName: "m",
39252
+ type: new ts.Map(ts.getEntries({
39253
+ none: ts.ModuleKind.None,
39254
+ commonjs: ts.ModuleKind.CommonJS,
39255
+ amd: ts.ModuleKind.AMD,
39256
+ system: ts.ModuleKind.System,
39257
+ umd: ts.ModuleKind.UMD,
39258
+ es6: ts.ModuleKind.ES2015,
39259
+ es2015: ts.ModuleKind.ES2015,
39260
+ es2020: ts.ModuleKind.ES2020,
39261
+ es2022: ts.ModuleKind.ES2022,
39262
+ esnext: ts.ModuleKind.ESNext,
39263
+ node12: ts.ModuleKind.Node12,
39264
+ nodenext: ts.ModuleKind.NodeNext,
39265
+ })),
39266
+ affectsModuleResolution: true,
39267
+ affectsEmit: true,
39268
+ affectsMultiFileEmitBuildInfo: true,
39269
+ paramType: ts.Diagnostics.KIND,
39270
+ showInSimplifiedHelpView: true,
39271
+ category: ts.Diagnostics.Modules,
39272
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
39273
+ defaultValueDescription: undefined,
39274
+ };
39228
39275
  var commandOptionsWithoutBuild = [
39229
39276
  // CommandLine only options
39230
39277
  {
@@ -39286,37 +39333,14 @@ var ts;
39286
39333
  category: ts.Diagnostics.Command_line_Options,
39287
39334
  affectsSemanticDiagnostics: true,
39288
39335
  affectsEmit: true,
39336
+ affectsMultiFileEmitBuildInfo: true,
39289
39337
  isCommandLineOnly: true,
39290
39338
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
39291
39339
  defaultValueDescription: false,
39292
39340
  },
39293
39341
  // Basic
39294
39342
  ts.targetOptionDeclaration,
39295
- {
39296
- name: "module",
39297
- shortName: "m",
39298
- type: new ts.Map(ts.getEntries({
39299
- none: ts.ModuleKind.None,
39300
- commonjs: ts.ModuleKind.CommonJS,
39301
- amd: ts.ModuleKind.AMD,
39302
- system: ts.ModuleKind.System,
39303
- umd: ts.ModuleKind.UMD,
39304
- es6: ts.ModuleKind.ES2015,
39305
- es2015: ts.ModuleKind.ES2015,
39306
- es2020: ts.ModuleKind.ES2020,
39307
- es2022: ts.ModuleKind.ES2022,
39308
- esnext: ts.ModuleKind.ESNext,
39309
- node12: ts.ModuleKind.Node12,
39310
- nodenext: ts.ModuleKind.NodeNext,
39311
- })),
39312
- affectsModuleResolution: true,
39313
- affectsEmit: true,
39314
- paramType: ts.Diagnostics.KIND,
39315
- showInSimplifiedHelpView: true,
39316
- category: ts.Diagnostics.Modules,
39317
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
39318
- defaultValueDescription: undefined,
39319
- },
39343
+ ts.moduleOptionDeclaration,
39320
39344
  {
39321
39345
  name: "lib",
39322
39346
  type: "list",
@@ -39353,6 +39377,7 @@ var ts;
39353
39377
  type: jsxOptionMap,
39354
39378
  affectsSourceFile: true,
39355
39379
  affectsEmit: true,
39380
+ affectsMultiFileEmitBuildInfo: true,
39356
39381
  affectsModuleResolution: true,
39357
39382
  paramType: ts.Diagnostics.KIND,
39358
39383
  showInSimplifiedHelpView: true,
@@ -39365,6 +39390,7 @@ var ts;
39365
39390
  shortName: "d",
39366
39391
  type: "boolean",
39367
39392
  affectsEmit: true,
39393
+ affectsMultiFileEmitBuildInfo: true,
39368
39394
  showInSimplifiedHelpView: true,
39369
39395
  category: ts.Diagnostics.Emit,
39370
39396
  transpileOptionValue: undefined,
@@ -39375,6 +39401,7 @@ var ts;
39375
39401
  name: "declarationMap",
39376
39402
  type: "boolean",
39377
39403
  affectsEmit: true,
39404
+ affectsMultiFileEmitBuildInfo: true,
39378
39405
  showInSimplifiedHelpView: true,
39379
39406
  category: ts.Diagnostics.Emit,
39380
39407
  transpileOptionValue: undefined,
@@ -39385,6 +39412,7 @@ var ts;
39385
39412
  name: "emitDeclarationOnly",
39386
39413
  type: "boolean",
39387
39414
  affectsEmit: true,
39415
+ affectsMultiFileEmitBuildInfo: true,
39388
39416
  showInSimplifiedHelpView: true,
39389
39417
  category: ts.Diagnostics.Emit,
39390
39418
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -39395,6 +39423,7 @@ var ts;
39395
39423
  name: "sourceMap",
39396
39424
  type: "boolean",
39397
39425
  affectsEmit: true,
39426
+ affectsMultiFileEmitBuildInfo: true,
39398
39427
  showInSimplifiedHelpView: true,
39399
39428
  category: ts.Diagnostics.Emit,
39400
39429
  defaultValueDescription: false,
@@ -39404,6 +39433,9 @@ var ts;
39404
39433
  name: "outFile",
39405
39434
  type: "string",
39406
39435
  affectsEmit: true,
39436
+ affectsMultiFileEmitBuildInfo: true,
39437
+ affectsDeclarationPath: true,
39438
+ affectsBundleEmitBuildInfo: true,
39407
39439
  isFilePath: true,
39408
39440
  paramType: ts.Diagnostics.FILE,
39409
39441
  showInSimplifiedHelpView: true,
@@ -39415,6 +39447,8 @@ var ts;
39415
39447
  name: "outDir",
39416
39448
  type: "string",
39417
39449
  affectsEmit: true,
39450
+ affectsMultiFileEmitBuildInfo: true,
39451
+ affectsDeclarationPath: true,
39418
39452
  isFilePath: true,
39419
39453
  paramType: ts.Diagnostics.DIRECTORY,
39420
39454
  showInSimplifiedHelpView: true,
@@ -39425,6 +39459,8 @@ var ts;
39425
39459
  name: "rootDir",
39426
39460
  type: "string",
39427
39461
  affectsEmit: true,
39462
+ affectsMultiFileEmitBuildInfo: true,
39463
+ affectsDeclarationPath: true,
39428
39464
  isFilePath: true,
39429
39465
  paramType: ts.Diagnostics.LOCATION,
39430
39466
  category: ts.Diagnostics.Modules,
@@ -39435,6 +39471,8 @@ var ts;
39435
39471
  name: "composite",
39436
39472
  type: "boolean",
39437
39473
  affectsEmit: true,
39474
+ affectsMultiFileEmitBuildInfo: true,
39475
+ affectsBundleEmitBuildInfo: true,
39438
39476
  isTSConfigOnly: true,
39439
39477
  category: ts.Diagnostics.Projects,
39440
39478
  transpileOptionValue: undefined,
@@ -39445,6 +39483,8 @@ var ts;
39445
39483
  name: "tsBuildInfoFile",
39446
39484
  type: "string",
39447
39485
  affectsEmit: true,
39486
+ affectsMultiFileEmitBuildInfo: true,
39487
+ affectsBundleEmitBuildInfo: true,
39448
39488
  isFilePath: true,
39449
39489
  paramType: ts.Diagnostics.FILE,
39450
39490
  category: ts.Diagnostics.Projects,
@@ -39456,6 +39496,7 @@ var ts;
39456
39496
  name: "removeComments",
39457
39497
  type: "boolean",
39458
39498
  affectsEmit: true,
39499
+ affectsMultiFileEmitBuildInfo: true,
39459
39500
  showInSimplifiedHelpView: true,
39460
39501
  category: ts.Diagnostics.Emit,
39461
39502
  defaultValueDescription: false,
@@ -39474,6 +39515,7 @@ var ts;
39474
39515
  name: "importHelpers",
39475
39516
  type: "boolean",
39476
39517
  affectsEmit: true,
39518
+ affectsMultiFileEmitBuildInfo: true,
39477
39519
  category: ts.Diagnostics.Emit,
39478
39520
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
39479
39521
  defaultValueDescription: false,
@@ -39487,6 +39529,7 @@ var ts;
39487
39529
  })),
39488
39530
  affectsEmit: true,
39489
39531
  affectsSemanticDiagnostics: true,
39532
+ affectsMultiFileEmitBuildInfo: true,
39490
39533
  category: ts.Diagnostics.Emit,
39491
39534
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
39492
39535
  defaultValueDescription: 0 /* Remove */,
@@ -39495,6 +39538,7 @@ var ts;
39495
39538
  name: "downlevelIteration",
39496
39539
  type: "boolean",
39497
39540
  affectsEmit: true,
39541
+ affectsMultiFileEmitBuildInfo: true,
39498
39542
  category: ts.Diagnostics.Emit,
39499
39543
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
39500
39544
  defaultValueDescription: false,
@@ -39513,6 +39557,9 @@ var ts;
39513
39557
  type: "boolean",
39514
39558
  // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
39515
39559
  // The value of each strictFlag depends on own strictFlag value or this and never accessed directly.
39560
+ // But we need to store `strict` in builf info, even though it won't be examined directly, so that the
39561
+ // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly
39562
+ affectsMultiFileEmitBuildInfo: true,
39516
39563
  showInSimplifiedHelpView: true,
39517
39564
  category: ts.Diagnostics.Type_Checking,
39518
39565
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -39522,6 +39569,7 @@ var ts;
39522
39569
  name: "noImplicitAny",
39523
39570
  type: "boolean",
39524
39571
  affectsSemanticDiagnostics: true,
39572
+ affectsMultiFileEmitBuildInfo: true,
39525
39573
  strictFlag: true,
39526
39574
  category: ts.Diagnostics.Type_Checking,
39527
39575
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -39531,6 +39579,7 @@ var ts;
39531
39579
  name: "strictNullChecks",
39532
39580
  type: "boolean",
39533
39581
  affectsSemanticDiagnostics: true,
39582
+ affectsMultiFileEmitBuildInfo: true,
39534
39583
  strictFlag: true,
39535
39584
  category: ts.Diagnostics.Type_Checking,
39536
39585
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -39539,6 +39588,8 @@ var ts;
39539
39588
  {
39540
39589
  name: "strictFunctionTypes",
39541
39590
  type: "boolean",
39591
+ affectsSemanticDiagnostics: true,
39592
+ affectsMultiFileEmitBuildInfo: true,
39542
39593
  strictFlag: true,
39543
39594
  category: ts.Diagnostics.Type_Checking,
39544
39595
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -39547,6 +39598,8 @@ var ts;
39547
39598
  {
39548
39599
  name: "strictBindCallApply",
39549
39600
  type: "boolean",
39601
+ affectsSemanticDiagnostics: true,
39602
+ affectsMultiFileEmitBuildInfo: true,
39550
39603
  strictFlag: true,
39551
39604
  category: ts.Diagnostics.Type_Checking,
39552
39605
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -39556,6 +39609,7 @@ var ts;
39556
39609
  name: "strictPropertyInitialization",
39557
39610
  type: "boolean",
39558
39611
  affectsSemanticDiagnostics: true,
39612
+ affectsMultiFileEmitBuildInfo: true,
39559
39613
  strictFlag: true,
39560
39614
  category: ts.Diagnostics.Type_Checking,
39561
39615
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -39565,6 +39619,7 @@ var ts;
39565
39619
  name: "noImplicitThis",
39566
39620
  type: "boolean",
39567
39621
  affectsSemanticDiagnostics: true,
39622
+ affectsMultiFileEmitBuildInfo: true,
39568
39623
  strictFlag: true,
39569
39624
  category: ts.Diagnostics.Type_Checking,
39570
39625
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -39574,6 +39629,7 @@ var ts;
39574
39629
  name: "useUnknownInCatchVariables",
39575
39630
  type: "boolean",
39576
39631
  affectsSemanticDiagnostics: true,
39632
+ affectsMultiFileEmitBuildInfo: true,
39577
39633
  strictFlag: true,
39578
39634
  category: ts.Diagnostics.Type_Checking,
39579
39635
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -39583,6 +39639,8 @@ var ts;
39583
39639
  name: "alwaysStrict",
39584
39640
  type: "boolean",
39585
39641
  affectsSourceFile: true,
39642
+ affectsEmit: true,
39643
+ affectsMultiFileEmitBuildInfo: true,
39586
39644
  strictFlag: true,
39587
39645
  category: ts.Diagnostics.Type_Checking,
39588
39646
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -39593,6 +39651,7 @@ var ts;
39593
39651
  name: "noUnusedLocals",
39594
39652
  type: "boolean",
39595
39653
  affectsSemanticDiagnostics: true,
39654
+ affectsMultiFileEmitBuildInfo: true,
39596
39655
  category: ts.Diagnostics.Type_Checking,
39597
39656
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
39598
39657
  defaultValueDescription: false,
@@ -39601,6 +39660,7 @@ var ts;
39601
39660
  name: "noUnusedParameters",
39602
39661
  type: "boolean",
39603
39662
  affectsSemanticDiagnostics: true,
39663
+ affectsMultiFileEmitBuildInfo: true,
39604
39664
  category: ts.Diagnostics.Type_Checking,
39605
39665
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
39606
39666
  defaultValueDescription: false,
@@ -39609,6 +39669,7 @@ var ts;
39609
39669
  name: "exactOptionalPropertyTypes",
39610
39670
  type: "boolean",
39611
39671
  affectsSemanticDiagnostics: true,
39672
+ affectsMultiFileEmitBuildInfo: true,
39612
39673
  category: ts.Diagnostics.Type_Checking,
39613
39674
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
39614
39675
  defaultValueDescription: false,
@@ -39617,6 +39678,7 @@ var ts;
39617
39678
  name: "noImplicitReturns",
39618
39679
  type: "boolean",
39619
39680
  affectsSemanticDiagnostics: true,
39681
+ affectsMultiFileEmitBuildInfo: true,
39620
39682
  category: ts.Diagnostics.Type_Checking,
39621
39683
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
39622
39684
  defaultValueDescription: false,
@@ -39626,6 +39688,7 @@ var ts;
39626
39688
  type: "boolean",
39627
39689
  affectsBindDiagnostics: true,
39628
39690
  affectsSemanticDiagnostics: true,
39691
+ affectsMultiFileEmitBuildInfo: true,
39629
39692
  category: ts.Diagnostics.Type_Checking,
39630
39693
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
39631
39694
  defaultValueDescription: false,
@@ -39634,6 +39697,7 @@ var ts;
39634
39697
  name: "noUncheckedIndexedAccess",
39635
39698
  type: "boolean",
39636
39699
  affectsSemanticDiagnostics: true,
39700
+ affectsMultiFileEmitBuildInfo: true,
39637
39701
  category: ts.Diagnostics.Type_Checking,
39638
39702
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
39639
39703
  defaultValueDescription: false,
@@ -39642,6 +39706,7 @@ var ts;
39642
39706
  name: "noImplicitOverride",
39643
39707
  type: "boolean",
39644
39708
  affectsSemanticDiagnostics: true,
39709
+ affectsMultiFileEmitBuildInfo: true,
39645
39710
  category: ts.Diagnostics.Type_Checking,
39646
39711
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
39647
39712
  defaultValueDescription: false,
@@ -39649,6 +39714,8 @@ var ts;
39649
39714
  {
39650
39715
  name: "noPropertyAccessFromIndexSignature",
39651
39716
  type: "boolean",
39717
+ affectsSemanticDiagnostics: true,
39718
+ affectsMultiFileEmitBuildInfo: true,
39652
39719
  showInSimplifiedHelpView: false,
39653
39720
  category: ts.Diagnostics.Type_Checking,
39654
39721
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -39734,6 +39801,7 @@ var ts;
39734
39801
  name: "allowSyntheticDefaultImports",
39735
39802
  type: "boolean",
39736
39803
  affectsSemanticDiagnostics: true,
39804
+ affectsMultiFileEmitBuildInfo: true,
39737
39805
  category: ts.Diagnostics.Interop_Constraints,
39738
39806
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
39739
39807
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -39743,6 +39811,7 @@ var ts;
39743
39811
  type: "boolean",
39744
39812
  affectsSemanticDiagnostics: true,
39745
39813
  affectsEmit: true,
39814
+ affectsMultiFileEmitBuildInfo: true,
39746
39815
  showInSimplifiedHelpView: true,
39747
39816
  category: ts.Diagnostics.Interop_Constraints,
39748
39817
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -39759,6 +39828,7 @@ var ts;
39759
39828
  name: "allowUmdGlobalAccess",
39760
39829
  type: "boolean",
39761
39830
  affectsSemanticDiagnostics: true,
39831
+ affectsMultiFileEmitBuildInfo: true,
39762
39832
  category: ts.Diagnostics.Modules,
39763
39833
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
39764
39834
  defaultValueDescription: false,
@@ -39780,6 +39850,7 @@ var ts;
39780
39850
  name: "sourceRoot",
39781
39851
  type: "string",
39782
39852
  affectsEmit: true,
39853
+ affectsMultiFileEmitBuildInfo: true,
39783
39854
  paramType: ts.Diagnostics.LOCATION,
39784
39855
  category: ts.Diagnostics.Emit,
39785
39856
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -39788,6 +39859,7 @@ var ts;
39788
39859
  name: "mapRoot",
39789
39860
  type: "string",
39790
39861
  affectsEmit: true,
39862
+ affectsMultiFileEmitBuildInfo: true,
39791
39863
  paramType: ts.Diagnostics.LOCATION,
39792
39864
  category: ts.Diagnostics.Emit,
39793
39865
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -39796,6 +39868,7 @@ var ts;
39796
39868
  name: "inlineSourceMap",
39797
39869
  type: "boolean",
39798
39870
  affectsEmit: true,
39871
+ affectsMultiFileEmitBuildInfo: true,
39799
39872
  category: ts.Diagnostics.Emit,
39800
39873
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
39801
39874
  defaultValueDescription: false,
@@ -39804,6 +39877,7 @@ var ts;
39804
39877
  name: "inlineSources",
39805
39878
  type: "boolean",
39806
39879
  affectsEmit: true,
39880
+ affectsMultiFileEmitBuildInfo: true,
39807
39881
  category: ts.Diagnostics.Emit,
39808
39882
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
39809
39883
  defaultValueDescription: false,
@@ -39813,6 +39887,7 @@ var ts;
39813
39887
  name: "experimentalDecorators",
39814
39888
  type: "boolean",
39815
39889
  affectsSemanticDiagnostics: true,
39890
+ affectsMultiFileEmitBuildInfo: true,
39816
39891
  category: ts.Diagnostics.Language_and_Environment,
39817
39892
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
39818
39893
  defaultValueDescription: false,
@@ -39822,6 +39897,7 @@ var ts;
39822
39897
  type: "boolean",
39823
39898
  affectsSemanticDiagnostics: true,
39824
39899
  affectsEmit: true,
39900
+ affectsMultiFileEmitBuildInfo: true,
39825
39901
  category: ts.Diagnostics.Language_and_Environment,
39826
39902
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
39827
39903
  defaultValueDescription: false,
@@ -39846,6 +39922,7 @@ var ts;
39846
39922
  type: "string",
39847
39923
  affectsSemanticDiagnostics: true,
39848
39924
  affectsEmit: true,
39925
+ affectsMultiFileEmitBuildInfo: true,
39849
39926
  affectsModuleResolution: true,
39850
39927
  category: ts.Diagnostics.Language_and_Environment,
39851
39928
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -39863,6 +39940,9 @@ var ts;
39863
39940
  name: "out",
39864
39941
  type: "string",
39865
39942
  affectsEmit: true,
39943
+ affectsMultiFileEmitBuildInfo: true,
39944
+ affectsDeclarationPath: true,
39945
+ affectsBundleEmitBuildInfo: true,
39866
39946
  isFilePath: false,
39867
39947
  // for correct behaviour, please use outFile
39868
39948
  category: ts.Diagnostics.Backwards_Compatibility,
@@ -39874,6 +39954,7 @@ var ts;
39874
39954
  name: "reactNamespace",
39875
39955
  type: "string",
39876
39956
  affectsEmit: true,
39957
+ affectsMultiFileEmitBuildInfo: true,
39877
39958
  category: ts.Diagnostics.Language_and_Environment,
39878
39959
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
39879
39960
  defaultValueDescription: "`React`",
@@ -39881,6 +39962,8 @@ var ts;
39881
39962
  {
39882
39963
  name: "skipDefaultLibCheck",
39883
39964
  type: "boolean",
39965
+ // We need to store these to determine whether `lib` files need to be rechecked
39966
+ affectsMultiFileEmitBuildInfo: true,
39884
39967
  category: ts.Diagnostics.Completeness,
39885
39968
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
39886
39969
  defaultValueDescription: false,
@@ -39896,6 +39979,7 @@ var ts;
39896
39979
  name: "emitBOM",
39897
39980
  type: "boolean",
39898
39981
  affectsEmit: true,
39982
+ affectsMultiFileEmitBuildInfo: true,
39899
39983
  category: ts.Diagnostics.Emit,
39900
39984
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
39901
39985
  defaultValueDescription: false,
@@ -39907,6 +39991,7 @@ var ts;
39907
39991
  lf: 1 /* LineFeed */
39908
39992
  })),
39909
39993
  affectsEmit: true,
39994
+ affectsMultiFileEmitBuildInfo: true,
39910
39995
  paramType: ts.Diagnostics.NEWLINE,
39911
39996
  category: ts.Diagnostics.Emit,
39912
39997
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -39916,6 +40001,7 @@ var ts;
39916
40001
  name: "noErrorTruncation",
39917
40002
  type: "boolean",
39918
40003
  affectsSemanticDiagnostics: true,
40004
+ affectsMultiFileEmitBuildInfo: true,
39919
40005
  category: ts.Diagnostics.Output_Formatting,
39920
40006
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
39921
40007
  defaultValueDescription: false,
@@ -39946,6 +40032,7 @@ var ts;
39946
40032
  name: "stripInternal",
39947
40033
  type: "boolean",
39948
40034
  affectsEmit: true,
40035
+ affectsMultiFileEmitBuildInfo: true,
39949
40036
  category: ts.Diagnostics.Emit,
39950
40037
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
39951
40038
  defaultValueDescription: false,
@@ -39986,6 +40073,7 @@ var ts;
39986
40073
  name: "noImplicitUseStrict",
39987
40074
  type: "boolean",
39988
40075
  affectsSemanticDiagnostics: true,
40076
+ affectsMultiFileEmitBuildInfo: true,
39989
40077
  category: ts.Diagnostics.Backwards_Compatibility,
39990
40078
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
39991
40079
  defaultValueDescription: false,
@@ -39994,6 +40082,7 @@ var ts;
39994
40082
  name: "noEmitHelpers",
39995
40083
  type: "boolean",
39996
40084
  affectsEmit: true,
40085
+ affectsMultiFileEmitBuildInfo: true,
39997
40086
  category: ts.Diagnostics.Emit,
39998
40087
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
39999
40088
  defaultValueDescription: false,
@@ -40002,6 +40091,7 @@ var ts;
40002
40091
  name: "noEmitOnError",
40003
40092
  type: "boolean",
40004
40093
  affectsEmit: true,
40094
+ affectsMultiFileEmitBuildInfo: true,
40005
40095
  category: ts.Diagnostics.Emit,
40006
40096
  transpileOptionValue: undefined,
40007
40097
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -40011,6 +40101,7 @@ var ts;
40011
40101
  name: "preserveConstEnums",
40012
40102
  type: "boolean",
40013
40103
  affectsEmit: true,
40104
+ affectsMultiFileEmitBuildInfo: true,
40014
40105
  category: ts.Diagnostics.Emit,
40015
40106
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
40016
40107
  defaultValueDescription: false,
@@ -40019,6 +40110,8 @@ var ts;
40019
40110
  name: "declarationDir",
40020
40111
  type: "string",
40021
40112
  affectsEmit: true,
40113
+ affectsMultiFileEmitBuildInfo: true,
40114
+ affectsDeclarationPath: true,
40022
40115
  isFilePath: true,
40023
40116
  paramType: ts.Diagnostics.DIRECTORY,
40024
40117
  category: ts.Diagnostics.Emit,
@@ -40028,6 +40121,8 @@ var ts;
40028
40121
  {
40029
40122
  name: "skipLibCheck",
40030
40123
  type: "boolean",
40124
+ // We need to store these to determine whether `lib` files need to be rechecked
40125
+ affectsMultiFileEmitBuildInfo: true,
40031
40126
  category: ts.Diagnostics.Completeness,
40032
40127
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
40033
40128
  defaultValueDescription: false,
@@ -40037,6 +40132,7 @@ var ts;
40037
40132
  type: "boolean",
40038
40133
  affectsBindDiagnostics: true,
40039
40134
  affectsSemanticDiagnostics: true,
40135
+ affectsMultiFileEmitBuildInfo: true,
40040
40136
  category: ts.Diagnostics.Type_Checking,
40041
40137
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
40042
40138
  defaultValueDescription: undefined,
@@ -40046,6 +40142,7 @@ var ts;
40046
40142
  type: "boolean",
40047
40143
  affectsBindDiagnostics: true,
40048
40144
  affectsSemanticDiagnostics: true,
40145
+ affectsMultiFileEmitBuildInfo: true,
40049
40146
  category: ts.Diagnostics.Type_Checking,
40050
40147
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
40051
40148
  defaultValueDescription: undefined,
@@ -40054,6 +40151,7 @@ var ts;
40054
40151
  name: "suppressExcessPropertyErrors",
40055
40152
  type: "boolean",
40056
40153
  affectsSemanticDiagnostics: true,
40154
+ affectsMultiFileEmitBuildInfo: true,
40057
40155
  category: ts.Diagnostics.Backwards_Compatibility,
40058
40156
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
40059
40157
  defaultValueDescription: false,
@@ -40062,6 +40160,7 @@ var ts;
40062
40160
  name: "suppressImplicitAnyIndexErrors",
40063
40161
  type: "boolean",
40064
40162
  affectsSemanticDiagnostics: true,
40163
+ affectsMultiFileEmitBuildInfo: true,
40065
40164
  category: ts.Diagnostics.Backwards_Compatibility,
40066
40165
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
40067
40166
  defaultValueDescription: false,
@@ -40086,6 +40185,7 @@ var ts;
40086
40185
  name: "noStrictGenericChecks",
40087
40186
  type: "boolean",
40088
40187
  affectsSemanticDiagnostics: true,
40188
+ affectsMultiFileEmitBuildInfo: true,
40089
40189
  category: ts.Diagnostics.Backwards_Compatibility,
40090
40190
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
40091
40191
  defaultValueDescription: false,
@@ -40095,6 +40195,7 @@ var ts;
40095
40195
  type: "boolean",
40096
40196
  affectsSemanticDiagnostics: true,
40097
40197
  affectsEmit: true,
40198
+ affectsMultiFileEmitBuildInfo: true,
40098
40199
  category: ts.Diagnostics.Language_and_Environment,
40099
40200
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
40100
40201
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -40103,6 +40204,7 @@ var ts;
40103
40204
  name: "preserveValueImports",
40104
40205
  type: "boolean",
40105
40206
  affectsEmit: true,
40207
+ affectsMultiFileEmitBuildInfo: true,
40106
40208
  category: ts.Diagnostics.Emit,
40107
40209
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
40108
40210
  defaultValueDescription: false,
@@ -40146,6 +40248,8 @@ var ts;
40146
40248
  /* @internal */
40147
40249
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
40148
40250
  /* @internal */
40251
+ ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
40252
+ /* @internal */
40149
40253
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
40150
40254
  /* @internal */
40151
40255
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -41001,6 +41105,7 @@ var ts;
41001
41105
  return optionDefinition.type;
41002
41106
  }
41003
41107
  }
41108
+ /* @internal */
41004
41109
  function getNameOfCompilerOptionValue(value, customTypeMap) {
41005
41110
  // There is a typeMap associated with this command-line option so use it to map value back to its name
41006
41111
  return ts.forEachEntry(customTypeMap, function (mapValue, key) {
@@ -41009,6 +41114,7 @@ var ts;
41009
41114
  }
41010
41115
  });
41011
41116
  }
41117
+ ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
41012
41118
  function serializeCompilerOptions(options, pathOptions) {
41013
41119
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
41014
41120
  }
@@ -65321,20 +65427,6 @@ var ts;
65321
65427
  }
65322
65428
  }
65323
65429
  }
65324
- if (relation === comparableRelation && sourceFlags & 262144 /* TypeParameter */) {
65325
- // This is a carve-out in comparability to essentially forbid comparing a type parameter
65326
- // with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!)
65327
- var constraint = getConstraintOfTypeParameter(source);
65328
- if (constraint && hasNonCircularBaseConstraint(source)) {
65329
- while (constraint && constraint.flags & 262144 /* TypeParameter */) {
65330
- if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false)) {
65331
- return result;
65332
- }
65333
- constraint = getConstraintOfTypeParameter(constraint);
65334
- }
65335
- }
65336
- return 0 /* False */;
65337
- }
65338
65430
  }
65339
65431
  else if (targetFlags & 4194304 /* Index */) {
65340
65432
  var targetType_1 = target.type;
@@ -65538,7 +65630,7 @@ var ts;
65538
65630
  if (sourceFlags & 8650752 /* TypeVariable */) {
65539
65631
  // IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
65540
65632
  if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
65541
- var constraint = getConstraintOfType(source) || unknownType;
65633
+ var constraint = getConstraintOfType(source);
65542
65634
  if (!strictNullChecks && (!constraint || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */))) {
65543
65635
  // A type variable with no constraint is not related to the non-primitive object type.
65544
65636
  if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
@@ -65547,12 +65639,12 @@ var ts;
65547
65639
  }
65548
65640
  }
65549
65641
  // 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
65550
- else if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
65642
+ else if (constraint && (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState))) {
65551
65643
  resetErrorInfo(saveErrorInfo);
65552
65644
  return result;
65553
65645
  }
65554
65646
  // slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
65555
- else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
65647
+ else if (constraint && (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState))) {
65556
65648
  resetErrorInfo(saveErrorInfo);
65557
65649
  return result;
65558
65650
  }
@@ -75606,8 +75698,14 @@ var ts;
75606
75698
  var parameterRange = hasRestParameter ? min
75607
75699
  : min < max ? min + "-" + max
75608
75700
  : min;
75609
- var error = hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1
75610
- : 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
75701
+ var isVoidPromiseError = !hasRestParameter && parameterRange === 1 && args.length === 0 && isPromiseResolveArityError(node);
75702
+ if (isVoidPromiseError && ts.isInJSFile(node)) {
75703
+ 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);
75704
+ }
75705
+ var error = hasRestParameter
75706
+ ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1
75707
+ : isVoidPromiseError
75708
+ ? ts.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise
75611
75709
  : ts.Diagnostics.Expected_0_arguments_but_got_1;
75612
75710
  if (min < args.length && args.length < max) {
75613
75711
  // between min and max, but with no matching overload
@@ -82659,7 +82757,7 @@ var ts;
82659
82757
  }
82660
82758
  var yieldType = getIterationTypeOfIterable(use, 0 /* Yield */, inputType, /*errorNode*/ undefined);
82661
82759
  if (yieldType) {
82662
- return [ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators, false];
82760
+ return [ts.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, false];
82663
82761
  }
82664
82762
  if (isES2015OrLaterIterable((_a = inputType.symbol) === null || _a === void 0 ? void 0 : _a.escapedName)) {
82665
82763
  return [ts.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, true];
@@ -85936,7 +86034,7 @@ var ts;
85936
86034
  var symbol = getIntrinsicTagSymbol(name.parent);
85937
86035
  return symbol === unknownSymbol ? undefined : symbol;
85938
86036
  }
85939
- var result = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ !isJSDoc_1, ts.getHostSignatureFromJSDoc(name));
86037
+ var result = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /* dontResolveAlias */ true, ts.getHostSignatureFromJSDoc(name));
85940
86038
  if (!result && isJSDoc_1) {
85941
86039
  var container = ts.findAncestor(name, ts.or(ts.isClassLike, ts.isInterfaceDeclaration));
85942
86040
  if (container) {
@@ -87793,6 +87891,9 @@ var ts;
87793
87891
  return ts.some(types, checkGrammarExpressionWithTypeArguments);
87794
87892
  }
87795
87893
  function checkGrammarExpressionWithTypeArguments(node) {
87894
+ if (ts.isExpressionWithTypeArguments(node) && ts.isImportKeyword(node.expression) && node.typeArguments) {
87895
+ 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);
87896
+ }
87796
87897
  return checkGrammarTypeArguments(node, node.typeArguments);
87797
87898
  }
87798
87899
  function checkGrammarClassDeclarationHeritageClauses(node) {
@@ -88734,7 +88835,7 @@ var ts;
88734
88835
  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);
88735
88836
  }
88736
88837
  if (node.typeArguments) {
88737
- return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_import_cannot_have_type_arguments);
88838
+ 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);
88738
88839
  }
88739
88840
  var nodeArguments = node.arguments;
88740
88841
  if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) {
@@ -108530,6 +108631,8 @@ var ts;
108530
108631
  var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
108531
108632
  errorFallbackNode = undefined;
108532
108633
  var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* Const */));
108634
+ preserveJsDoc(statement, input);
108635
+ ts.removeAllComments(input);
108533
108636
  return [statement, factory.updateExportAssignment(input, input.decorators, input.modifiers, newId)];
108534
108637
  }
108535
108638
  }
@@ -109865,7 +109968,8 @@ var ts;
109865
109968
  return;
109866
109969
  }
109867
109970
  var version = ts.version; // Extracted into a const so the form is stable between namespace and module
109868
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), /*writeByteOrderMark*/ false);
109971
+ var buildInfo = { bundle: bundle, program: program, version: version };
109972
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
109869
109973
  }
109870
109974
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
109871
109975
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -110019,13 +110123,18 @@ var ts;
110019
110123
  if (sourceMapFilePath) {
110020
110124
  var sourceMap = sourceMapGenerator.toString();
110021
110125
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110126
+ if (printer.bundleFileInfo)
110127
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
110022
110128
  }
110023
110129
  }
110024
110130
  else {
110025
110131
  writer.writeLine();
110026
110132
  }
110027
110133
  // Write the output file
110028
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110134
+ var text = writer.getText();
110135
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110136
+ if (printer.bundleFileInfo)
110137
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
110029
110138
  // Reset state
110030
110139
  writer.clear();
110031
110140
  }
@@ -110168,34 +110277,54 @@ var ts;
110168
110277
  }
110169
110278
  /*@internal*/
110170
110279
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
110280
+ var createHash = ts.maybeBind(host, host.createHash);
110171
110281
  var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
110172
- var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
110173
- if (!buildInfoText)
110282
+ var buildInfo;
110283
+ if (host.getBuildInfo) {
110284
+ var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
110285
+ if (!hostBuildInfo)
110286
+ return buildInfoPath;
110287
+ buildInfo = hostBuildInfo;
110288
+ }
110289
+ else {
110290
+ var buildInfoText = host.readFile(buildInfoPath);
110291
+ if (!buildInfoText)
110292
+ return buildInfoPath;
110293
+ buildInfo = getBuildInfo(buildInfoText);
110294
+ }
110295
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
110174
110296
  return buildInfoPath;
110175
110297
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
110176
110298
  if (!jsFileText)
110177
110299
  return jsFilePath;
110300
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
110301
+ return jsFilePath;
110178
110302
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
110179
110303
  // error if no source map or for now if inline sourcemap
110180
110304
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
110181
110305
  return sourceMapFilePath || "inline sourcemap decoding";
110306
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
110307
+ return sourceMapFilePath;
110182
110308
  // read declaration text
110183
110309
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
110184
110310
  if (declarationFilePath && !declarationText)
110185
110311
  return declarationFilePath;
110312
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
110313
+ return declarationFilePath;
110186
110314
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
110187
110315
  // error if no source map or for now if inline sourcemap
110188
110316
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
110189
110317
  return declarationMapPath || "inline sourcemap decoding";
110190
- var buildInfo = getBuildInfo(buildInfoText);
110191
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
110192
- return buildInfoPath;
110318
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
110319
+ return declarationMapPath;
110193
110320
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110194
110321
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
110195
110322
  /*onlyOwnText*/ true);
110196
110323
  var outputFiles = [];
110197
110324
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
110198
110325
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
110326
+ var changedDtsText;
110327
+ var changedDtsData;
110199
110328
  var emitHost = {
110200
110329
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
110201
110330
  getCanonicalFileName: host.getCanonicalFileName,
@@ -110211,7 +110340,7 @@ var ts;
110211
110340
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
110212
110341
  getProjectReferenceRedirect: ts.returnUndefined,
110213
110342
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
110214
- writeFile: function (name, text, writeByteOrderMark) {
110343
+ writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
110215
110344
  switch (name) {
110216
110345
  case jsFilePath:
110217
110346
  if (jsFileText === text)
@@ -110222,8 +110351,13 @@ var ts;
110222
110351
  return;
110223
110352
  break;
110224
110353
  case buildInfoPath:
110225
- var newBuildInfo = getBuildInfo(text);
110354
+ var newBuildInfo = data.buildInfo;
110226
110355
  newBuildInfo.program = buildInfo.program;
110356
+ if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
110357
+ // Update the output signature
110358
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
110359
+ newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
110360
+ }
110227
110361
  // Update sourceFileInfo
110228
110362
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
110229
110363
  newBuildInfo.bundle.js.sources = js.sources;
@@ -110231,11 +110365,13 @@ var ts;
110231
110365
  newBuildInfo.bundle.dts.sources = dts.sources;
110232
110366
  }
110233
110367
  newBuildInfo.bundle.sourceFiles = sourceFiles;
110234
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
110368
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
110235
110369
  return;
110236
110370
  case declarationFilePath:
110237
110371
  if (declarationText === text)
110238
110372
  return;
110373
+ changedDtsText = text;
110374
+ changedDtsData = data;
110239
110375
  break;
110240
110376
  case declarationMapPath:
110241
110377
  if (declarationMapText === text)
@@ -110254,6 +110390,7 @@ var ts;
110254
110390
  getSourceFileFromReference: ts.returnUndefined,
110255
110391
  redirectTargetsMap: ts.createMultiMap(),
110256
110392
  getFileIncludeReasons: ts.notImplemented,
110393
+ createHash: createHash,
110257
110394
  };
110258
110395
  emitFiles(ts.notImplementedResolver, emitHost,
110259
110396
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
@@ -115338,12 +115475,10 @@ var ts;
115338
115475
  }
115339
115476
  ts.createCompilerHost = createCompilerHost;
115340
115477
  /*@internal*/
115341
- // TODO(shkamat): update this after reworking ts build API
115342
115478
  function createCompilerHostWorker(options, setParentNodes, system) {
115343
115479
  if (system === void 0) { system = ts.sys; }
115344
115480
  var existingDirectories = new ts.Map();
115345
115481
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
115346
- var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
115347
115482
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
115348
115483
  var text;
115349
115484
  try {
@@ -115376,7 +115511,7 @@ var ts;
115376
115511
  // NOTE: If patchWriteFileEnsuringDirectory has been called,
115377
115512
  // the system.writeFile will do its own directory creation and
115378
115513
  // the ensureDirectoriesExist call will always be redundant.
115379
- 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); });
115514
+ 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); });
115380
115515
  ts.performance.mark("afterIOWrite");
115381
115516
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
115382
115517
  }
@@ -115386,35 +115521,6 @@ var ts;
115386
115521
  }
115387
115522
  }
115388
115523
  }
115389
- var outputFingerprints;
115390
- function writeFileWorker(fileName, data, writeByteOrderMark) {
115391
- if (!ts.isWatchSet(options) || !system.getModifiedTime) {
115392
- system.writeFile(fileName, data, writeByteOrderMark);
115393
- return;
115394
- }
115395
- if (!outputFingerprints) {
115396
- outputFingerprints = new ts.Map();
115397
- }
115398
- var hash = computeHash(data);
115399
- var mtimeBefore = system.getModifiedTime(fileName);
115400
- if (mtimeBefore) {
115401
- var fingerprint = outputFingerprints.get(fileName);
115402
- // If output has not been changed, and the file has no external modification
115403
- if (fingerprint &&
115404
- fingerprint.byteOrderMark === writeByteOrderMark &&
115405
- fingerprint.hash === hash &&
115406
- fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
115407
- return;
115408
- }
115409
- }
115410
- system.writeFile(fileName, data, writeByteOrderMark);
115411
- var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
115412
- outputFingerprints.set(fileName, {
115413
- hash: hash,
115414
- byteOrderMark: writeByteOrderMark,
115415
- mtime: mtimeAfter
115416
- });
115417
- }
115418
115524
  function getDefaultLibLocation() {
115419
115525
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
115420
115526
  }
@@ -116966,6 +117072,7 @@ var ts;
116966
117072
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
116967
117073
  redirectTargetsMap: redirectTargetsMap,
116968
117074
  getFileIncludeReasons: program.getFileIncludeReasons,
117075
+ createHash: ts.maybeBind(host, host.createHash),
116969
117076
  };
116970
117077
  }
116971
117078
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -119079,13 +119186,9 @@ var ts;
119079
119186
  function createManyToManyPathMap() {
119080
119187
  function create(forward, reverse, deleted) {
119081
119188
  var map = {
119082
- clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119083
- forEach: function (fn) { return forward.forEach(fn); },
119084
119189
  getKeys: function (v) { return reverse.get(v); },
119085
119190
  getValues: function (k) { return forward.get(k); },
119086
- hasKey: function (k) { return forward.has(k); },
119087
119191
  keys: function () { return forward.keys(); },
119088
- deletedKeys: function () { return deleted; },
119089
119192
  deleteKey: function (k) {
119090
119193
  (deleted || (deleted = new ts.Set())).add(k);
119091
119194
  var set = forward.get(k);
@@ -119112,11 +119215,6 @@ var ts;
119112
119215
  });
119113
119216
  return map;
119114
119217
  },
119115
- clear: function () {
119116
- forward.clear();
119117
- reverse.clear();
119118
- deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119119
- }
119120
119218
  };
119121
119219
  return map;
119122
119220
  }
@@ -119244,18 +119342,21 @@ var ts;
119244
119342
  * Creates the state of file references and signature for the new program from oldState if it is safe
119245
119343
  */
119246
119344
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119345
+ var _a, _b, _c;
119247
119346
  var fileInfos = new ts.Map();
119248
119347
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
119249
119348
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
119250
- var hasCalledUpdateShapeSignature = new ts.Set();
119251
119349
  var useOldState = canReuseOldState(referencedMap, oldState);
119252
119350
  // Ensure source files have parent pointers set
119253
119351
  newProgram.getTypeChecker();
119254
119352
  // Create the reference map, and set the file infos
119255
- for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
119256
- var sourceFile = _a[_i];
119353
+ for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
119354
+ var sourceFile = _d[_i];
119257
119355
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
119258
- var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
119356
+ var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
119357
+ var signature = oldUncommitedSignature === undefined ?
119358
+ useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
119359
+ oldUncommitedSignature || undefined;
119259
119360
  if (referencedMap) {
119260
119361
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
119261
119362
  if (newReferences) {
@@ -119263,19 +119364,26 @@ var ts;
119263
119364
  }
119264
119365
  // Copy old visible to outside files map
119265
119366
  if (useOldState) {
119266
- var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
119367
+ var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
119368
+ var exportedModules = oldUncommitedExportedModules === undefined ?
119369
+ oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
119370
+ oldUncommitedExportedModules || undefined;
119267
119371
  if (exportedModules) {
119268
119372
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119269
119373
  }
119270
119374
  }
119271
119375
  }
119272
- fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
119376
+ fileInfos.set(sourceFile.resolvedPath, {
119377
+ version: version_2,
119378
+ signature: signature,
119379
+ affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
119380
+ impliedFormat: sourceFile.impliedNodeFormat
119381
+ });
119273
119382
  }
119274
119383
  return {
119275
119384
  fileInfos: fileInfos,
119276
119385
  referencedMap: referencedMap,
119277
119386
  exportedModulesMap: exportedModulesMap,
119278
- hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
119279
119387
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
119280
119388
  };
119281
119389
  }
@@ -119289,71 +119397,42 @@ var ts;
119289
119397
  }
119290
119398
  BuilderState.releaseCache = releaseCache;
119291
119399
  /**
119292
- * Creates a clone of the state
119400
+ * Gets the files affected by the path from the program
119293
119401
  */
119294
- function clone(state) {
119402
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
119295
119403
  var _a, _b;
119296
- // Dont need to backup allFiles info since its cache anyway
119297
- return {
119298
- fileInfos: new ts.Map(state.fileInfos),
119299
- referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
119300
- exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
119301
- hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
119302
- useFileVersionAsSignature: state.useFileVersionAsSignature,
119303
- };
119404
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
119405
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119406
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119407
+ return result;
119304
119408
  }
119305
- BuilderState.clone = clone;
119306
- /**
119307
- * Gets the files affected by the path from the program
119308
- */
119309
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
119310
- // Since the operation could be cancelled, the signatures are always stored in the cache
119311
- // They will be committed once it is safe to use them
119312
- // eg when calling this api from tsserver, if there is no cancellation of the operation
119313
- // In the other cases the affected files signatures are committed only after the iteration through the result is complete
119314
- var signatureCache = cacheToUpdateSignature || new ts.Map();
119409
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119410
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
119315
119411
  var sourceFile = programOfThisState.getSourceFileByPath(path);
119316
119412
  if (!sourceFile) {
119317
119413
  return ts.emptyArray;
119318
119414
  }
119319
- if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
119415
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
119320
119416
  return [sourceFile];
119321
119417
  }
119322
- var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
119323
- if (!cacheToUpdateSignature) {
119324
- // Commit all the signatures in the signature cache
119325
- updateSignaturesFromCache(state, signatureCache);
119326
- }
119327
- return result;
119418
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
119328
119419
  }
119329
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119330
- /**
119331
- * Updates the signatures from the cache into state's fileinfo signatures
119332
- * This should be called whenever it is safe to commit the state of the builder
119333
- */
119334
- function updateSignaturesFromCache(state, signatureCache) {
119335
- signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
119336
- }
119337
- BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
119420
+ BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
119338
119421
  function updateSignatureOfFile(state, signature, path) {
119339
119422
  state.fileInfos.get(path).signature = signature;
119340
- state.hasCalledUpdateShapeSignature.add(path);
119423
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
119341
119424
  }
119342
119425
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
119343
119426
  /**
119344
119427
  * Returns if the shape of the signature has changed since last emit
119345
119428
  */
119346
- function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
119429
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
119430
+ var _a;
119347
119431
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
119348
- ts.Debug.assert(!!sourceFile);
119349
- ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
119350
119432
  // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
119351
- if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
119433
+ if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
119352
119434
  return false;
119353
- }
119354
119435
  var info = state.fileInfos.get(sourceFile.resolvedPath);
119355
- if (!info)
119356
- return ts.Debug.fail();
119357
119436
  var prevSignature = info.signature;
119358
119437
  var latestSignature;
119359
119438
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -119364,45 +119443,55 @@ var ts;
119364
119443
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119365
119444
  if (firstDts_1) {
119366
119445
  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; })); });
119367
- latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119368
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119369
- updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
119446
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
119447
+ if (latestSignature !== prevSignature) {
119448
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
119370
119449
  }
119371
119450
  }
119372
119451
  }
119373
119452
  // Default is to use file version as signature
119374
119453
  if (latestSignature === undefined) {
119375
119454
  latestSignature = sourceFile.version;
119376
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119455
+ if (state.exportedModulesMap && latestSignature !== prevSignature) {
119456
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119377
119457
  // All the references in this file are exported
119378
119458
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
119379
119459
  if (references) {
119380
- exportedModulesMapCache.set(sourceFile.resolvedPath, references);
119460
+ state.exportedModulesMap.set(sourceFile.resolvedPath, references);
119381
119461
  }
119382
119462
  else {
119383
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119463
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119384
119464
  }
119385
119465
  }
119386
119466
  }
119387
- cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
119467
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
119468
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
119469
+ info.signature = latestSignature;
119388
119470
  return latestSignature !== prevSignature;
119389
119471
  }
119390
119472
  BuilderState.updateShapeSignature = updateShapeSignature;
119473
+ function computeSignature(text, computeHash) {
119474
+ return (computeHash || ts.generateDjb2Hash)(text);
119475
+ }
119476
+ BuilderState.computeSignature = computeSignature;
119391
119477
  /**
119392
119478
  * Coverts the declaration emit result into exported modules map
119393
119479
  */
119394
- function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
119480
+ function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
119481
+ if (!state.exportedModulesMap)
119482
+ return;
119483
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119395
119484
  if (!exportedModulesFromDeclarationEmit) {
119396
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119485
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119397
119486
  return;
119398
119487
  }
119399
119488
  var exportedModules;
119400
119489
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
119401
119490
  if (exportedModules) {
119402
- exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
119491
+ state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119403
119492
  }
119404
119493
  else {
119405
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119494
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119406
119495
  }
119407
119496
  function addExportedModule(exportedModulePaths) {
119408
119497
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -119414,19 +119503,6 @@ var ts;
119414
119503
  }
119415
119504
  }
119416
119505
  BuilderState.updateExportedModules = updateExportedModules;
119417
- /**
119418
- * Updates the exported modules from cache into state's exported modules map
119419
- * This should be called whenever it is safe to commit the state of the builder
119420
- */
119421
- function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
119422
- var _a;
119423
- if (exportedModulesMapCache) {
119424
- ts.Debug.assert(!!state.exportedModulesMap);
119425
- (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
119426
- exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
119427
- }
119428
- }
119429
- BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
119430
119506
  /**
119431
119507
  * Get all the dependencies of the sourceFile
119432
119508
  */
@@ -119547,7 +119623,7 @@ var ts;
119547
119623
  /**
119548
119624
  * When program emits modular code, gets the files affected by the sourceFile whose shape has changed
119549
119625
  */
119550
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
119626
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
119551
119627
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
119552
119628
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
119553
119629
  }
@@ -119567,7 +119643,7 @@ var ts;
119567
119643
  if (!seenFileNamesMap.has(currentPath)) {
119568
119644
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
119569
119645
  seenFileNamesMap.set(currentPath, currentSourceFile);
119570
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
119646
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
119571
119647
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
119572
119648
  }
119573
119649
  }
@@ -119593,32 +119669,33 @@ var ts;
119593
119669
  * Create the state so that we can iterate on changedFiles/affected files
119594
119670
  */
119595
119671
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119672
+ var _a, _b;
119596
119673
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
119597
119674
  state.program = newProgram;
119598
119675
  var compilerOptions = newProgram.getCompilerOptions();
119599
119676
  state.compilerOptions = compilerOptions;
119677
+ var outFilePath = ts.outFile(compilerOptions);
119600
119678
  // With --out or --outFile, any change affects all semantic diagnostics so no need to cache them
119601
- if (!ts.outFile(compilerOptions)) {
119679
+ if (!outFilePath) {
119602
119680
  state.semanticDiagnosticsPerFile = new ts.Map();
119603
119681
  }
119682
+ 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)) {
119683
+ state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
119684
+ }
119604
119685
  state.changedFilesSet = new ts.Set();
119686
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
119605
119687
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
119606
119688
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
119607
119689
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
119608
119690
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
119691
+ var canCopyEmitSignatures = compilerOptions.composite &&
119692
+ (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
119693
+ !outFilePath &&
119694
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
119609
119695
  if (useOldState) {
119610
- // Verify the sanity of old state
119611
- if (!oldState.currentChangedFilePath) {
119612
- var affectedSignatures = oldState.currentAffectedFilesSignatures;
119613
- ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
119614
- }
119615
- var changedFilesSet = oldState.changedFilesSet;
119616
- if (canCopySemanticDiagnostics) {
119617
- ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
119618
- }
119619
119696
  // Copy old state's changed files set
119620
- changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
119621
- if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
119697
+ (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
119698
+ if (!outFilePath && oldState.affectedFilesPendingEmit) {
119622
119699
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
119623
119700
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
119624
119701
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -119639,6 +119716,8 @@ var ts;
119639
119716
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
119640
119717
  // versions dont match
119641
119718
  oldInfo.version !== info.version ||
119719
+ // Implied formats dont match
119720
+ oldInfo.impliedFormat !== info.impliedFormat ||
119642
119721
  // Referenced files changed
119643
119722
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
119644
119723
  // Referenced file was deleted in the new program
@@ -119662,27 +119741,25 @@ var ts;
119662
119741
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
119663
119742
  }
119664
119743
  }
119744
+ if (canCopyEmitSignatures) {
119745
+ var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
119746
+ if (oldEmitSignature)
119747
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
119748
+ }
119665
119749
  });
119666
119750
  // If the global file is removed, add all files as changed
119667
119751
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
119668
119752
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, /*firstSourceFile*/ undefined)
119669
119753
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
119670
119754
  }
119671
- else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
119755
+ else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
119672
119756
  // Add all files to affectedFilesPendingEmit since emit changed
119673
119757
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1 /* Full */); });
119674
119758
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
119675
119759
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
119676
119760
  }
119677
- if (useOldState) {
119678
- // Any time the interpretation of a source file changes, mark it as changed
119679
- ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
119680
- if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
119681
- state.changedFilesSet.add(sourceFilePath);
119682
- }
119683
- });
119684
- }
119685
- state.buildInfoEmitPending = !!state.changedFilesSet.size;
119761
+ // Since old states change files set is copied, any additional change means we would need to emit build info
119762
+ state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
119686
119763
  return state;
119687
119764
  }
119688
119765
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -119718,30 +119795,35 @@ var ts;
119718
119795
  ts.BuilderState.releaseCache(state);
119719
119796
  state.program = undefined;
119720
119797
  }
119721
- /**
119722
- * Creates a clone of the state
119723
- */
119724
- function cloneBuilderProgramState(state) {
119725
- var _a;
119726
- var newState = ts.BuilderState.clone(state);
119727
- newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
119728
- newState.changedFilesSet = new ts.Set(state.changedFilesSet);
119729
- newState.affectedFiles = state.affectedFiles;
119730
- newState.affectedFilesIndex = state.affectedFilesIndex;
119731
- newState.currentChangedFilePath = state.currentChangedFilePath;
119732
- newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
119733
- newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
119734
- newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
119735
- newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
119736
- newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
119737
- newState.program = state.program;
119738
- newState.compilerOptions = state.compilerOptions;
119739
- newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
119740
- newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
119741
- newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
119742
- newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
119743
- newState.programEmitComplete = state.programEmitComplete;
119744
- return newState;
119798
+ function backupEmitBuilderProgramState(state) {
119799
+ var outFilePath = ts.outFile(state.compilerOptions);
119800
+ // Only in --out changeFileSet is kept around till emit
119801
+ ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
119802
+ return {
119803
+ affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
119804
+ affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
119805
+ affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
119806
+ seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
119807
+ programEmitComplete: state.programEmitComplete,
119808
+ emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
119809
+ outSignature: state.outSignature,
119810
+ dtsChangeTime: state.dtsChangeTime,
119811
+ hasChangedEmitSignature: state.hasChangedEmitSignature,
119812
+ changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
119813
+ };
119814
+ }
119815
+ function restoreEmitBuilderProgramState(state, backupEmitState) {
119816
+ state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
119817
+ state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
119818
+ state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
119819
+ state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
119820
+ state.programEmitComplete = backupEmitState.programEmitComplete;
119821
+ state.emitSignatures = backupEmitState.emitSignatures;
119822
+ state.outSignature = backupEmitState.outSignature;
119823
+ state.dtsChangeTime = backupEmitState.dtsChangeTime;
119824
+ state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
119825
+ if (backupEmitState.changedFilesSet)
119826
+ state.changedFilesSet = backupEmitState.changedFilesSet;
119745
119827
  }
119746
119828
  /**
119747
119829
  * Verifies that source file is ok to be used in calls that arent handled by next
@@ -119756,7 +119838,7 @@ var ts;
119756
119838
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
119757
119839
  */
119758
119840
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
119759
- var _a;
119841
+ var _a, _b;
119760
119842
  while (true) {
119761
119843
  var affectedFiles = state.affectedFiles;
119762
119844
  if (affectedFiles) {
@@ -119776,10 +119858,8 @@ var ts;
119776
119858
  state.changedFilesSet.delete(state.currentChangedFilePath);
119777
119859
  state.currentChangedFilePath = undefined;
119778
119860
  // Commit the changes in file signature
119779
- ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
119780
- state.currentAffectedFilesSignatures.clear();
119781
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
119782
- (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
119861
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119862
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119783
119863
  state.affectedFiles = undefined;
119784
119864
  }
119785
119865
  // Get next changed file
@@ -119797,12 +119877,7 @@ var ts;
119797
119877
  return program;
119798
119878
  }
119799
119879
  // Get next batch of affected files
119800
- if (!state.currentAffectedFilesSignatures)
119801
- state.currentAffectedFilesSignatures = new ts.Map();
119802
- if (state.exportedModulesMap) {
119803
- state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
119804
- }
119805
- state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
119880
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
119806
119881
  state.currentChangedFilePath = nextKey.value;
119807
119882
  state.affectedFilesIndex = 0;
119808
119883
  if (!state.seenAffectedFiles)
@@ -119854,7 +119929,6 @@ var ts;
119854
119929
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
119855
119930
  */
119856
119931
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
119857
- var _a;
119858
119932
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
119859
119933
  // If affected files is everything except default library, then nothing more to do
119860
119934
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -119862,10 +119936,9 @@ var ts;
119862
119936
  // When a change affects the global scope, all files are considered to be affected without updating their signature
119863
119937
  // That means when affected file is handled, its signature can be out of date
119864
119938
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
119865
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
119939
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
119866
119940
  return;
119867
119941
  }
119868
- 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);
119869
119942
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
119870
119943
  return;
119871
119944
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -119885,7 +119958,7 @@ var ts;
119885
119958
  // This ensures that we dont later during incremental builds considering wrong signature.
119886
119959
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
119887
119960
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
119888
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
119961
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
119889
119962
  // If not dts emit, nothing more to do
119890
119963
  if (ts.getEmitDeclarations(state.compilerOptions)) {
119891
119964
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -119906,27 +119979,10 @@ var ts;
119906
119979
  return !state.semanticDiagnosticsFromOldState.size;
119907
119980
  }
119908
119981
  function isChangedSignature(state, path) {
119909
- var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
119910
- var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
119982
+ var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
119983
+ var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
119911
119984
  return newSignature !== oldSignature;
119912
119985
  }
119913
- function forEachKeyOfExportedModulesMap(state, filePath, fn) {
119914
- // Go through exported modules from cache first
119915
- var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
119916
- var result = keys && ts.forEachKey(keys, fn);
119917
- if (result)
119918
- return result;
119919
- // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
119920
- keys = state.exportedModulesMap.getKeys(filePath);
119921
- return keys && ts.forEachKey(keys, function (exportedFromPath) {
119922
- var _a;
119923
- // If the cache had an updated value, skip
119924
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
119925
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
119926
- fn(exportedFromPath) :
119927
- undefined;
119928
- });
119929
- }
119930
119986
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
119931
119987
  var _a;
119932
119988
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -119941,6 +119997,7 @@ var ts;
119941
119997
  * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
119942
119998
  */
119943
119999
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120000
+ var _a;
119944
120001
  // If there was change in signature (dts output) for the changed file,
119945
120002
  // then only we need to handle pending file emit
119946
120003
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
@@ -119967,11 +120024,10 @@ var ts;
119967
120024
  }
119968
120025
  }
119969
120026
  }
119970
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
119971
120027
  var seenFileAndExportsOfFile = new ts.Set();
119972
120028
  // Go through exported modules from cache first
119973
120029
  // If exported modules has path, all files referencing file exported from are affected
119974
- forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
120030
+ (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
119975
120031
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
119976
120032
  return true;
119977
120033
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -119985,19 +120041,18 @@ var ts;
119985
120041
  * return true when all work is done and we can exit handling dts emit and semantic diagnostics
119986
120042
  */
119987
120043
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
119988
- var _a;
120044
+ var _a, _b;
119989
120045
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
119990
120046
  return undefined;
119991
120047
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
119992
120048
  return true;
119993
120049
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
119994
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
119995
120050
  // If exported modules has path, all files referencing file exported from are affected
119996
- forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
120051
+ (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
119997
120052
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
119998
120053
  });
119999
120054
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
120000
- (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
120055
+ (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
120001
120056
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
120002
120057
  handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
120003
120058
  state, referencingFilePath, cancellationToken, computeHash, host);
@@ -120018,12 +120073,13 @@ var ts;
120018
120073
  }
120019
120074
  else {
120020
120075
  state.seenAffectedFiles.add(affected.resolvedPath);
120076
+ // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted
120077
+ state.buildInfoEmitPending = true;
120021
120078
  if (emitKind !== undefined) {
120022
120079
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
120023
120080
  }
120024
120081
  if (isPendingEmit) {
120025
120082
  state.affectedFilesPendingEmitIndex++;
120026
- state.buildInfoEmitPending = true;
120027
120083
  }
120028
120084
  else {
120029
120085
  state.affectedFilesIndex++;
@@ -120071,25 +120127,61 @@ var ts;
120071
120127
  }
120072
120128
  return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
120073
120129
  }
120130
+ function isProgramBundleEmitBuildInfo(info) {
120131
+ return !!ts.outFile(info.options || {});
120132
+ }
120133
+ ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
120074
120134
  /**
120075
120135
  * Gets the program information to be emitted in buildInfo so that we can use it to create new program
120076
120136
  */
120077
- function getProgramBuildInfo(state, getCanonicalFileName) {
120078
- if (ts.outFile(state.compilerOptions))
120079
- return undefined;
120137
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
120138
+ var outFilePath = ts.outFile(state.compilerOptions);
120139
+ if (outFilePath && !state.compilerOptions.composite)
120140
+ return;
120080
120141
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
120081
120142
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
120143
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
120144
+ if (outFilePath) {
120145
+ var fileNames_1 = [];
120146
+ var fileInfos_1 = [];
120147
+ state.program.getRootFileNames().forEach(function (f) {
120148
+ var sourceFile = state.program.getSourceFile(f);
120149
+ if (!sourceFile)
120150
+ return;
120151
+ fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
120152
+ fileInfos_1.push(sourceFile.version);
120153
+ });
120154
+ var result_15 = {
120155
+ fileNames: fileNames_1,
120156
+ fileInfos: fileInfos_1,
120157
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
120158
+ outSignature: state.outSignature,
120159
+ dtsChangeTime: state.dtsChangeTime,
120160
+ };
120161
+ return result_15;
120162
+ }
120082
120163
  var fileNames = [];
120083
120164
  var fileNameToFileId = new ts.Map();
120084
120165
  var fileIdsList;
120085
120166
  var fileNamesToFileIdListId;
120167
+ var emitSignatures;
120086
120168
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
120169
+ var _b, _c;
120087
120170
  var key = _a[0], value = _a[1];
120088
120171
  // Ensure fileId
120089
120172
  var fileId = toFileId(key);
120090
120173
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
120091
- var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120092
- var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120174
+ var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
120175
+ var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
120176
+ if (state.compilerOptions.composite) {
120177
+ var file = state.program.getSourceFileByPath(key);
120178
+ if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
120179
+ var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
120180
+ if (emitSignature !== actualSignature) {
120181
+ (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
120182
+ }
120183
+ }
120184
+ }
120093
120185
  return value.version === actualSignature ?
120094
120186
  value.affectsGlobalScope || value.impliedFormat ?
120095
120187
  // If file version is same as signature, dont serialize signature
@@ -120097,11 +120189,11 @@ var ts;
120097
120189
  // If file info only contains version and signature and both are same we can just write string
120098
120190
  value.version :
120099
120191
  actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120100
- signature === undefined ?
120192
+ oldSignature === undefined ?
120101
120193
  // If we havent computed signature, use fileInfo as is
120102
120194
  value :
120103
120195
  // Serialize fileInfo with new updated signature
120104
- { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120196
+ { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120105
120197
  // Signature of the FileInfo is undefined, serialize it as false
120106
120198
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120107
120199
  });
@@ -120116,17 +120208,13 @@ var ts;
120116
120208
  if (state.exportedModulesMap) {
120117
120209
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
120118
120210
  var _a;
120119
- if (state.currentAffectedFilesExportedModulesMap) {
120120
- if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
120121
- return undefined;
120122
- }
120123
- var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
120124
- if (newValue) {
120125
- return [toFileId(key), toFileIdListId(newValue)];
120126
- }
120127
- }
120211
+ var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
120128
120212
  // Not in temporary cache, use existing value
120129
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120213
+ if (oldValue === undefined)
120214
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120215
+ if (oldValue)
120216
+ return [toFileId(key), toFileIdListId(oldValue)];
120217
+ return undefined;
120130
120218
  });
120131
120219
  }
120132
120220
  var semanticDiagnosticsPerFile;
@@ -120137,9 +120225,7 @@ var ts;
120137
120225
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
120138
120226
  [
120139
120227
  toFileId(key),
120140
- state.hasReusableDiagnostic ?
120141
- value :
120142
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120228
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
120143
120229
  ] :
120144
120230
  toFileId(key));
120145
120231
  }
@@ -120154,16 +120240,27 @@ var ts;
120154
120240
  }
120155
120241
  }
120156
120242
  }
120157
- return {
120243
+ var changeFileSet;
120244
+ if (state.changedFilesSet.size) {
120245
+ for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
120246
+ var path = _e[_d];
120247
+ (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120248
+ }
120249
+ }
120250
+ var result = {
120158
120251
  fileNames: fileNames,
120159
120252
  fileInfos: fileInfos,
120160
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
120253
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
120161
120254
  fileIdsList: fileIdsList,
120162
120255
  referencedMap: referencedMap,
120163
120256
  exportedModulesMap: exportedModulesMap,
120164
120257
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
120165
120258
  affectedFilesPendingEmit: affectedFilesPendingEmit,
120259
+ changeFileSet: changeFileSet,
120260
+ emitSignatures: emitSignatures,
120261
+ dtsChangeTime: state.dtsChangeTime,
120166
120262
  };
120263
+ return result;
120167
120264
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
120168
120265
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
120169
120266
  }
@@ -120188,24 +120285,18 @@ var ts;
120188
120285
  }
120189
120286
  return fileIdListId;
120190
120287
  }
120191
- }
120192
- function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
120193
- var result;
120194
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120195
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120196
- var name = _a[_i];
120197
- var optionKey = name.toLowerCase();
120198
- var optionInfo = optionsNameMap.get(optionKey);
120199
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
120200
- // We need to store `strict`, even though it won't be examined directly, so that the
120201
- // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
120202
- optionKey === "strict" ||
120203
- // We need to store these to determine whether `lib` files need to be rechecked.
120204
- optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
120205
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
120288
+ function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
120289
+ var result;
120290
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120291
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120292
+ var name = _a[_i];
120293
+ var optionInfo = optionsNameMap.get(name.toLowerCase());
120294
+ if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
120295
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
120296
+ }
120206
120297
  }
120298
+ return result;
120207
120299
  }
120208
- return result;
120209
120300
  }
120210
120301
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120211
120302
  if (option) {
@@ -120279,6 +120370,10 @@ var ts;
120279
120370
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
120280
120371
  }
120281
120372
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
120373
+ function computeSignature(text, data, computeHash) {
120374
+ return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
120375
+ }
120376
+ ts.computeSignature = computeSignature;
120282
120377
  function createBuilderProgram(kind, _a) {
120283
120378
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
120284
120379
  // Return same program if underlying program doesnt change
@@ -120297,8 +120392,8 @@ var ts;
120297
120392
  */
120298
120393
  var computeHash = ts.maybeBind(host, host.createHash);
120299
120394
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
120300
- var backupState;
120301
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
120395
+ var backupEmitState;
120396
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
120302
120397
  // To ensure that we arent storing any references to old program or new program without state
120303
120398
  newProgram = undefined; // TODO: GH#18217
120304
120399
  oldProgram = undefined;
@@ -120306,20 +120401,20 @@ var ts;
120306
120401
  var getState = function () { return state; };
120307
120402
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
120308
120403
  builderProgram.getState = getState;
120309
- builderProgram.backupState = function () {
120310
- ts.Debug.assert(backupState === undefined);
120311
- backupState = cloneBuilderProgramState(state);
120404
+ builderProgram.backupEmitState = function () {
120405
+ ts.Debug.assert(backupEmitState === undefined);
120406
+ backupEmitState = backupEmitBuilderProgramState(state);
120312
120407
  };
120313
- builderProgram.restoreState = function () {
120314
- state = ts.Debug.checkDefined(backupState);
120315
- backupState = undefined;
120408
+ builderProgram.restoreEmitState = function () {
120409
+ restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
120410
+ backupEmitState = undefined;
120316
120411
  };
120317
120412
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
120318
120413
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
120319
120414
  builderProgram.emit = emit;
120320
120415
  builderProgram.releaseProgram = function () {
120321
120416
  releaseCache(state);
120322
- backupState = undefined;
120417
+ backupEmitState = undefined;
120323
120418
  };
120324
120419
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
120325
120420
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -120378,35 +120473,59 @@ var ts;
120378
120473
  return toAffectedFileEmitResult(state,
120379
120474
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
120380
120475
  // Otherwise just affected file
120381
- ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120382
- getWriteFileUpdatingSignatureCallback(writeFile) :
120476
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
120477
+ getWriteFileCallback(writeFile, customTransformers) :
120383
120478
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
120384
120479
  }
120385
- function getWriteFileUpdatingSignatureCallback(writeFile) {
120480
+ function getWriteFileCallback(writeFile, customTransformers) {
120386
120481
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
120387
- var _a;
120482
+ var _a, _b, _c;
120388
120483
  if (ts.isDeclarationFileName(fileName)) {
120389
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120390
- var file = sourceFiles[0];
120391
- var info = state.fileInfos.get(file.resolvedPath);
120392
- var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120393
- if (signature === file.version) {
120394
- var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120395
- if (newSignature !== file.version) { // Update it
120396
- if (host.storeFilesChangingSignatureDuringEmit)
120397
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120398
- if (state.exportedModulesMap)
120399
- ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
120400
- if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
120401
- state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
120484
+ if (!ts.outFile(state.compilerOptions)) {
120485
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120486
+ var newSignature = void 0;
120487
+ if (!customTransformers) {
120488
+ var file = sourceFiles[0];
120489
+ var info = state.fileInfos.get(file.resolvedPath);
120490
+ if (info.signature === file.version) {
120491
+ newSignature = computeSignature(text, data, computeHash);
120492
+ if (newSignature !== file.version) { // Update it
120493
+ if (host.storeFilesChangingSignatureDuringEmit)
120494
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120495
+ if (state.exportedModulesMap)
120496
+ ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
120497
+ if (state.affectedFiles) {
120498
+ // Keep old signature so we know what to undo if cancellation happens
120499
+ var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
120500
+ if (existing === undefined)
120501
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
120502
+ info.signature = newSignature;
120503
+ }
120504
+ else {
120505
+ // These are directly commited
120506
+ info.signature = newSignature;
120507
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120508
+ }
120509
+ }
120402
120510
  }
120403
- else {
120404
- info.signature = newSignature;
120405
- if (state.exportedModulesMap)
120406
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120511
+ }
120512
+ if (state.compilerOptions.composite) {
120513
+ var filePath = sourceFiles[0].resolvedPath;
120514
+ var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
120515
+ newSignature || (newSignature = computeSignature(text, data, computeHash));
120516
+ if (newSignature !== oldSignature) {
120517
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
120518
+ state.hasChangedEmitSignature = true;
120407
120519
  }
120408
120520
  }
120409
120521
  }
120522
+ else if (state.compilerOptions.composite) {
120523
+ var newSignature = computeSignature(text, data, computeHash);
120524
+ if (newSignature !== state.outSignature) {
120525
+ state.outSignature = newSignature;
120526
+ state.hasChangedEmitSignature = true;
120527
+ }
120528
+ }
120410
120529
  }
120411
120530
  if (writeFile)
120412
120531
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -120471,8 +120590,8 @@ var ts;
120471
120590
  }
120472
120591
  }
120473
120592
  }
120474
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120475
- getWriteFileUpdatingSignatureCallback(writeFile) :
120593
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
120594
+ getWriteFileCallback(writeFile, customTransformers) :
120476
120595
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120477
120596
  }
120478
120597
  /**
@@ -120561,29 +120680,58 @@ var ts;
120561
120680
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
120562
120681
  }
120563
120682
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
120564
- function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
120565
- var _a;
120683
+ function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
120684
+ var _a, _b, _c, _d;
120566
120685
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
120567
120686
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
120568
- var filePaths = program.fileNames.map(toPath);
120569
- var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
120570
- var fileInfos = new ts.Map();
120571
- program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
120572
- var state = {
120573
- fileInfos: fileInfos,
120574
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
120575
- referencedMap: toManyToManyPathMap(program.referencedMap),
120576
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
120577
- 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]; }),
120578
- hasReusableDiagnostic: true,
120579
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
120580
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
120581
- affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
120582
- };
120687
+ var state;
120688
+ var filePaths;
120689
+ var filePathsSetList;
120690
+ if (isProgramBundleEmitBuildInfo(program)) {
120691
+ state = {
120692
+ fileInfos: new ts.Map(),
120693
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
120694
+ dtsChangeTime: program.dtsChangeTime,
120695
+ outSignature: program.outSignature,
120696
+ };
120697
+ }
120698
+ else {
120699
+ filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
120700
+ filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
120701
+ var fileInfos_2 = new ts.Map();
120702
+ var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
120703
+ program.fileInfos.forEach(function (fileInfo, index) {
120704
+ var path = toFilePath(index + 1);
120705
+ var stateFileInfo = toBuilderStateFileInfo(fileInfo);
120706
+ fileInfos_2.set(path, stateFileInfo);
120707
+ if (emitSignatures_1 && stateFileInfo.signature)
120708
+ emitSignatures_1.set(path, stateFileInfo.signature);
120709
+ });
120710
+ (_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
120711
+ if (ts.isNumber(value))
120712
+ emitSignatures_1.delete(toFilePath(value));
120713
+ else
120714
+ emitSignatures_1.set(toFilePath(value[0]), value[1]);
120715
+ });
120716
+ state = {
120717
+ fileInfos: fileInfos_2,
120718
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
120719
+ referencedMap: toManyToManyPathMap(program.referencedMap),
120720
+ exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
120721
+ 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]; }),
120722
+ hasReusableDiagnostic: true,
120723
+ affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
120724
+ affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
120725
+ affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
120726
+ changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
120727
+ dtsChangeTime: program.dtsChangeTime,
120728
+ emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
120729
+ };
120730
+ }
120583
120731
  return {
120584
120732
  getState: function () { return state; },
120585
- backupState: ts.noop,
120586
- restoreState: ts.noop,
120733
+ backupEmitState: ts.noop,
120734
+ restoreEmitState: ts.noop,
120587
120735
  getProgram: ts.notImplemented,
120588
120736
  getProgramOrUndefined: ts.returnUndefined,
120589
120737
  releaseProgram: ts.noop,
@@ -120628,12 +120776,24 @@ var ts;
120628
120776
  return map;
120629
120777
  }
120630
120778
  }
120631
- ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
120779
+ ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
120780
+ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
120781
+ var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
120782
+ var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
120783
+ var fileInfos = new ts.Map();
120784
+ program.fileInfos.forEach(function (fileInfo, index) {
120785
+ var path = ts.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
120786
+ var version = ts.isString(fileInfo) ? fileInfo : fileInfo.version; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
120787
+ fileInfos.set(path, version);
120788
+ });
120789
+ return fileInfos;
120790
+ }
120791
+ ts.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap;
120632
120792
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
120633
120793
  return {
120634
120794
  getState: ts.notImplemented,
120635
- backupState: ts.noop,
120636
- restoreState: ts.noop,
120795
+ backupEmitState: ts.noop,
120796
+ restoreEmitState: ts.noop,
120637
120797
  getProgram: getProgram,
120638
120798
  getProgramOrUndefined: function () { return getState().program; },
120639
120799
  releaseProgram: function () { return getState().program = undefined; },
@@ -121749,9 +121909,9 @@ var ts;
121749
121909
  if (!preferSymlinks) {
121750
121910
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
121751
121911
  // so we only need to remove them from the realpath filenames.
121752
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
121753
- if (result_15)
121754
- return result_15;
121912
+ var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
121913
+ if (result_16)
121914
+ return result_16;
121755
121915
  }
121756
121916
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
121757
121917
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -121771,10 +121931,10 @@ var ts;
121771
121931
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
121772
121932
  var symlinkDirectory = symlinkDirectories_1[_i];
121773
121933
  var option = ts.resolvePath(symlinkDirectory, relative);
121774
- var result_16 = cb(option, target === referenceRedirect);
121934
+ var result_17 = cb(option, target === referenceRedirect);
121775
121935
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
121776
- if (result_16)
121777
- return result_16;
121936
+ if (result_17)
121937
+ return result_17;
121778
121938
  }
121779
121939
  });
121780
121940
  });
@@ -122666,6 +122826,7 @@ var ts;
122666
122826
  readDirectory: ts.maybeBind(host, host.readDirectory),
122667
122827
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
122668
122828
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
122829
+ now: ts.maybeBind(host, host.now),
122669
122830
  };
122670
122831
  function writeFile(fileName, text, writeByteOrderMark, onError) {
122671
122832
  try {
@@ -122726,6 +122887,7 @@ var ts;
122726
122887
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
122727
122888
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
122728
122889
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
122890
+ now: ts.maybeBind(system, system.now),
122729
122891
  };
122730
122892
  }
122731
122893
  ts.createProgramHost = createProgramHost;
@@ -122793,20 +122955,26 @@ var ts;
122793
122955
  var ts;
122794
122956
  (function (ts) {
122795
122957
  function readBuilderProgram(compilerOptions, host) {
122796
- if (ts.outFile(compilerOptions))
122797
- return undefined;
122798
122958
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
122799
122959
  if (!buildInfoPath)
122800
122960
  return undefined;
122801
- var content = host.readFile(buildInfoPath);
122802
- if (!content)
122803
- return undefined;
122804
- var buildInfo = ts.getBuildInfo(content);
122961
+ var buildInfo;
122962
+ if (host.getBuildInfo) {
122963
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
122964
+ if (!buildInfo)
122965
+ return undefined;
122966
+ }
122967
+ else {
122968
+ var content = host.readFile(buildInfoPath);
122969
+ if (!content)
122970
+ return undefined;
122971
+ buildInfo = ts.getBuildInfo(content);
122972
+ }
122805
122973
  if (buildInfo.version !== ts.version)
122806
122974
  return undefined;
122807
122975
  if (!buildInfo.program)
122808
122976
  return undefined;
122809
- return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
122977
+ return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
122810
122978
  }
122811
122979
  ts.readBuilderProgram = readBuilderProgram;
122812
122980
  function createIncrementalCompilerHost(options, system) {
@@ -122815,6 +122983,7 @@ var ts;
122815
122983
  host.createHash = ts.maybeBind(system, system.createHash);
122816
122984
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
122817
122985
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
122986
+ host.now = ts.maybeBind(system, system.now);
122818
122987
  ts.setGetSourceFileAsHashVersioned(host, system);
122819
122988
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
122820
122989
  return host;
@@ -123549,14 +123718,17 @@ var ts;
123549
123718
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
123550
123719
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
123551
123720
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
123552
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
123553
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
123554
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
123555
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
123721
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
123722
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
123723
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
123724
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
123725
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
123726
+ UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
123556
123727
  /**
123557
123728
  * Projects with no outputs (i.e. "solution" files)
123558
123729
  */
123559
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
123730
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
123731
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
123560
123732
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
123561
123733
  function resolveConfigFileProjectName(project) {
123562
123734
  if (ts.fileExtensionIs(project, ".json" /* Json */)) {
@@ -123601,9 +123773,11 @@ var ts;
123601
123773
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
123602
123774
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
123603
123775
  }
123604
- function newer(date1, date2) {
123605
- return date2 > date1 ? date2 : date1;
123776
+ /*@internal*/
123777
+ function getCurrentTime(host) {
123778
+ return host.now ? host.now() : new Date();
123606
123779
  }
123780
+ ts.getCurrentTime = getCurrentTime;
123607
123781
  /*@internal*/
123608
123782
  function isCircularBuildOrder(buildOrder) {
123609
123783
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -123693,6 +123867,7 @@ var ts;
123693
123867
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
123694
123868
  };
123695
123869
  }
123870
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
123696
123871
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
123697
123872
  var state = {
123698
123873
  host: host,
@@ -123709,8 +123884,9 @@ var ts;
123709
123884
  resolvedConfigFilePaths: new ts.Map(),
123710
123885
  configFileCache: new ts.Map(),
123711
123886
  projectStatus: new ts.Map(),
123712
- buildInfoChecked: new ts.Map(),
123713
123887
  extendedConfigCache: new ts.Map(),
123888
+ buildInfoCache: new ts.Map(),
123889
+ outputTimeStamps: new ts.Map(),
123714
123890
  builderPrograms: new ts.Map(),
123715
123891
  diagnostics: new ts.Map(),
123716
123892
  projectPendingBuild: new ts.Map(),
@@ -123734,6 +123910,7 @@ var ts;
123734
123910
  allWatchedConfigFiles: new ts.Map(),
123735
123911
  allWatchedExtendedConfigFiles: new ts.Map(),
123736
123912
  allWatchedPackageJsonFiles: new ts.Map(),
123913
+ filesWatched: new ts.Map(),
123737
123914
  lastCachedPackageJsonLookups: new ts.Map(),
123738
123915
  timerToBuildInvalidatedProject: undefined,
123739
123916
  reportFileChangeDetected: false,
@@ -123840,11 +124017,12 @@ var ts;
123840
124017
  // Config file cache
123841
124018
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
123842
124019
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
123843
- ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
123844
124020
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
123845
124021
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
123846
124022
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
123847
124023
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
124024
+ ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
124025
+ ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
123848
124026
  // Remove watches for the program no longer in the solution
123849
124027
  if (state.watch) {
123850
124028
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
@@ -124135,21 +124313,21 @@ var ts;
124135
124313
  }
124136
124314
  function emit(writeFileCallback, cancellationToken, customTransformers) {
124137
124315
  var _a;
124138
- var _b, _c;
124316
+ var _b, _c, _d;
124139
124317
  ts.Debug.assertIsDefined(program);
124140
124318
  ts.Debug.assert(step === BuildStep.Emit);
124141
124319
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
124142
- program.backupState();
124320
+ program.backupEmitState();
124143
124321
  var declDiagnostics;
124144
124322
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
124145
124323
  var outputFiles = [];
124146
124324
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
124147
124325
  /*write*/ undefined,
124148
- /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
124326
+ /*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,
124149
124327
  /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
124150
124328
  // Don't emit .d.ts if there are decl file errors
124151
124329
  if (declDiagnostics) {
124152
- program.restoreState();
124330
+ program.restoreEmitState();
124153
124331
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
124154
124332
  return {
124155
124333
  emitSkipped: true,
@@ -124159,37 +124337,43 @@ var ts;
124159
124337
  // Actual Emit
124160
124338
  var host = state.host, compilerHost = state.compilerHost;
124161
124339
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124162
- var newestDeclarationFileContentChangedTime = minimumDate;
124163
- var anyDtsChanged = false;
124340
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
124164
124341
  var emitterDiagnostics = ts.createDiagnosticCollection();
124165
124342
  var emittedOutputs = new ts.Map();
124343
+ var options = program.getCompilerOptions();
124344
+ var isIncremental = ts.isIncrementalCompilation(options);
124345
+ var outputTimeStampMap;
124346
+ var now;
124166
124347
  outputFiles.forEach(function (_a) {
124167
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124168
- var priorChangeTime;
124169
- if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124170
- // Check for unchanged .d.ts files
124171
- if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124172
- priorChangeTime = host.getModifiedTime(name);
124173
- }
124174
- else {
124348
+ var _b, _c;
124349
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124350
+ var path = toPath(state, name);
124351
+ emittedOutputs.set(toPath(state, name), name);
124352
+ if (buildInfo) {
124353
+ setBuildInfo(state, buildInfo, projectPath, options);
124354
+ 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)) {
124175
124355
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124176
- anyDtsChanged = true;
124177
124356
  }
124178
124357
  }
124179
- emittedOutputs.set(toPath(state, name), name);
124180
124358
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124181
- if (priorChangeTime !== undefined) {
124182
- newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
124359
+ if (!isIncremental && state.watch) {
124360
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
124183
124361
  }
124184
124362
  });
124185
- finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime,
124186
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124363
+ finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124187
124364
  return emitResult;
124188
124365
  }
124189
124366
  function emitBuildInfo(writeFileCallback, cancellationToken) {
124190
124367
  ts.Debug.assertIsDefined(program);
124191
124368
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
124192
- var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
124369
+ var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
124370
+ if (data === null || data === void 0 ? void 0 : data.buildInfo)
124371
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
124372
+ if (writeFileCallback)
124373
+ writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
124374
+ else
124375
+ state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
124376
+ }, cancellationToken);
124193
124377
  if (emitResult.diagnostics.length) {
124194
124378
  reportErrors(state, emitResult.diagnostics);
124195
124379
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -124202,7 +124386,7 @@ var ts;
124202
124386
  step = BuildStep.QueueReferencingProjects;
124203
124387
  return emitResult;
124204
124388
  }
124205
- function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
124389
+ function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
124206
124390
  var _a;
124207
124391
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
124208
124392
  if (emitDiagnostics.length) {
@@ -124213,13 +124397,11 @@ var ts;
124213
124397
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
124214
124398
  }
124215
124399
  // Update time stamps for rest of the outputs
124216
- var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124400
+ updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124217
124401
  state.diagnostics.delete(projectPath);
124218
124402
  state.projectStatus.set(projectPath, {
124219
124403
  type: ts.UpToDateStatusType.UpToDate,
124220
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
124221
- maximumDate :
124222
- newestDeclarationFileContentChangedTime,
124404
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
124223
124405
  oldestOutputFileName: oldestOutputFileName
124224
124406
  });
124225
124407
  afterProgramDone(state, program, config);
@@ -124254,13 +124436,21 @@ var ts;
124254
124436
  ts.Debug.assert(!!outputFiles.length);
124255
124437
  var emitterDiagnostics = ts.createDiagnosticCollection();
124256
124438
  var emittedOutputs = new ts.Map();
124439
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124440
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
124257
124441
  outputFiles.forEach(function (_a) {
124258
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124442
+ var _b, _c;
124443
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124259
124444
  emittedOutputs.set(toPath(state, name), name);
124445
+ if (buildInfo) {
124446
+ setBuildInfo(state, buildInfo, projectPath, config.options);
124447
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
124448
+ resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124449
+ }
124450
+ }
124260
124451
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124261
124452
  });
124262
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate,
124263
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
124453
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
124264
124454
  return { emitSkipped: false, diagnostics: emitDiagnostics };
124265
124455
  }
124266
124456
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -124365,7 +124555,7 @@ var ts;
124365
124555
  }
124366
124556
  continue;
124367
124557
  }
124368
- if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
124558
+ if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
124369
124559
  reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
124370
124560
  return createUpdateOutputFileStampsProject(state, project, projectPath, config, buildOrder);
124371
124561
  }
@@ -124422,7 +124612,7 @@ var ts;
124422
124612
  state.projectCompilerOptions = state.baseCompilerOptions;
124423
124613
  }
124424
124614
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
124425
- var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
124615
+ var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
124426
124616
  reportAndStoreErrors(state, resolvedPath, diagnostics);
124427
124617
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
124428
124618
  if (canEmitBuildInfo)
@@ -124430,9 +124620,95 @@ var ts;
124430
124620
  afterProgramDone(state, program, config);
124431
124621
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
124432
124622
  }
124623
+ function isFileWatcherWithModifiedTime(value) {
124624
+ return !!value.watcher;
124625
+ }
124626
+ function getModifiedTime(state, fileName) {
124627
+ var path = toPath(state, fileName);
124628
+ var existing = state.filesWatched.get(path);
124629
+ if (state.watch && !!existing) {
124630
+ if (!isFileWatcherWithModifiedTime(existing))
124631
+ return existing;
124632
+ if (existing.modifiedTime)
124633
+ return existing.modifiedTime;
124634
+ }
124635
+ var result = ts.getModifiedTime(state.host, fileName);
124636
+ if (state.watch) {
124637
+ if (existing)
124638
+ existing.modifiedTime = result;
124639
+ else
124640
+ state.filesWatched.set(path, result);
124641
+ }
124642
+ return result;
124643
+ }
124644
+ function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
124645
+ var path = toPath(state, file);
124646
+ var existing = state.filesWatched.get(path);
124647
+ if (existing && isFileWatcherWithModifiedTime(existing)) {
124648
+ existing.callbacks.push(callback);
124649
+ }
124650
+ else {
124651
+ var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
124652
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
124653
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
124654
+ existing.modifiedTime = modifiedTime;
124655
+ existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
124656
+ }, pollingInterval, options, watchType, project);
124657
+ state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
124658
+ }
124659
+ return {
124660
+ close: function () {
124661
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
124662
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
124663
+ if (existing.callbacks.length === 1) {
124664
+ state.filesWatched.delete(path);
124665
+ ts.closeFileWatcherOf(existing);
124666
+ }
124667
+ else {
124668
+ ts.unorderedRemoveItem(existing.callbacks, callback);
124669
+ }
124670
+ }
124671
+ };
124672
+ }
124673
+ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
124674
+ if (!state.watch)
124675
+ return undefined;
124676
+ var result = state.outputTimeStamps.get(resolvedConfigFilePath);
124677
+ if (!result)
124678
+ state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
124679
+ return result;
124680
+ }
124681
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
124682
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
124683
+ var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
124684
+ if (existing) {
124685
+ existing.buildInfo = buildInfo;
124686
+ existing.modifiedTime = getCurrentTime(state.host);
124687
+ }
124688
+ else {
124689
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
124690
+ }
124691
+ }
124692
+ function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
124693
+ var path = toPath(state, buildInfoPath);
124694
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
124695
+ return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
124696
+ }
124697
+ function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
124698
+ var path = toPath(state, buildInfoPath);
124699
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
124700
+ if (existing !== undefined && existing.path === path) {
124701
+ return existing.buildInfo || undefined;
124702
+ }
124703
+ var value = state.readFileWithCache(buildInfoPath);
124704
+ var buildInfo = value ? ts.getBuildInfo(value) : undefined;
124705
+ ts.Debug.assert(modifiedTime || !buildInfo);
124706
+ state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
124707
+ return buildInfo;
124708
+ }
124433
124709
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
124434
124710
  // Check tsconfig time
124435
- var tsconfigTime = ts.getModifiedTime(state.host, configFile);
124711
+ var tsconfigTime = getModifiedTime(state, configFile);
124436
124712
  if (oldestOutputFileTime < tsconfigTime) {
124437
124713
  return {
124438
124714
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -124442,88 +124718,24 @@ var ts;
124442
124718
  }
124443
124719
  }
124444
124720
  function getUpToDateStatusWorker(state, project, resolvedPath) {
124445
- var force = !!state.options.force;
124446
- var newestInputFileName = undefined;
124447
- var newestInputFileTime = minimumDate;
124448
- var host = state.host;
124449
- // Get timestamps of input files
124450
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
124451
- var inputFile = _a[_i];
124452
- if (!host.fileExists(inputFile)) {
124453
- return {
124454
- type: ts.UpToDateStatusType.Unbuildable,
124455
- reason: inputFile + " does not exist"
124456
- };
124457
- }
124458
- if (!force) {
124459
- var inputTime = ts.getModifiedTime(host, inputFile);
124460
- if (inputTime > newestInputFileTime) {
124461
- newestInputFileName = inputFile;
124462
- newestInputFileTime = inputTime;
124463
- }
124464
- }
124465
- }
124721
+ var _a, _b, _c;
124466
124722
  // Container if no files are specified in the project
124467
124723
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
124468
124724
  return {
124469
124725
  type: ts.UpToDateStatusType.ContainerOnly
124470
124726
  };
124471
124727
  }
124472
- // Collect the expected outputs of this project
124473
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
124474
- // Now see if all outputs are newer than the newest input
124475
- var oldestOutputFileName = "(none)";
124476
- var oldestOutputFileTime = maximumDate;
124477
- var newestOutputFileName = "(none)";
124478
- var newestOutputFileTime = minimumDate;
124479
- var missingOutputFileName;
124480
- var newestDeclarationFileContentChangedTime = minimumDate;
124481
- var isOutOfDateWithInputs = false;
124482
- if (!force) {
124483
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
124484
- var output = outputs_1[_b];
124485
- // Output is missing; can stop checking
124486
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124487
- if (!host.fileExists(output)) {
124488
- missingOutputFileName = output;
124489
- break;
124490
- }
124491
- var outputTime = ts.getModifiedTime(host, output);
124492
- if (outputTime < oldestOutputFileTime) {
124493
- oldestOutputFileTime = outputTime;
124494
- oldestOutputFileName = output;
124495
- }
124496
- // If an output is older than the newest input, we can stop checking
124497
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124498
- if (outputTime < newestInputFileTime) {
124499
- isOutOfDateWithInputs = true;
124500
- break;
124501
- }
124502
- if (outputTime > newestOutputFileTime) {
124503
- newestOutputFileTime = outputTime;
124504
- newestOutputFileName = output;
124505
- }
124506
- // Keep track of when the most recent time a .d.ts file was changed.
124507
- // In addition to file timestamps, we also keep track of when a .d.ts file
124508
- // had its file touched but not had its contents changed - this allows us
124509
- // to skip a downstream typecheck
124510
- if (ts.isDeclarationFileName(output)) {
124511
- var outputModifiedTime = ts.getModifiedTime(host, output);
124512
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
124513
- }
124514
- }
124515
- }
124516
- var pseudoUpToDate = false;
124517
- var usesPrepend = false;
124518
- var upstreamChangedProject;
124728
+ // Fast check to see if reference projects are buildable
124729
+ var referenceStatuses;
124730
+ var force = !!state.options.force;
124519
124731
  if (project.projectReferences) {
124520
124732
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
124521
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
124522
- var ref = _d[_c];
124523
- usesPrepend = usesPrepend || !!(ref.prepend);
124733
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
124734
+ var ref = _d[_i];
124524
124735
  var resolvedRef = ts.resolveProjectReferencePath(ref);
124525
124736
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
124526
- var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
124737
+ var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
124738
+ var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
124527
124739
  // Its a circular reference ignore the status of this project
124528
124740
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
124529
124741
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) { // Container only ignore this project
@@ -124545,75 +124757,188 @@ var ts;
124545
124757
  upstreamProjectName: ref.path
124546
124758
  };
124547
124759
  }
124548
- // Check oldest output file name only if there is no missing output file name
124549
- // (a check we will have skipped if this is a forced build)
124550
- if (!force && !missingOutputFileName) {
124551
- // If the upstream project's newest file is older than our oldest output, we
124552
- // can't be out of date because of it
124553
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
124554
- continue;
124555
- }
124556
- // If the upstream project has only change .d.ts files, and we've built
124557
- // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
124558
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
124559
- pseudoUpToDate = true;
124560
- upstreamChangedProject = ref.path;
124561
- continue;
124562
- }
124563
- // We have an output older than an upstream output - we are out of date
124564
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
124760
+ if (!force)
124761
+ (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
124762
+ }
124763
+ }
124764
+ if (force)
124765
+ return { type: ts.UpToDateStatusType.ForceBuild };
124766
+ // Check buildinfo first
124767
+ var host = state.host;
124768
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
124769
+ var oldestOutputFileName = "(none)";
124770
+ var oldestOutputFileTime = maximumDate;
124771
+ var buildInfoTime;
124772
+ var buildInfoProgram;
124773
+ var buildInfoVersionMap;
124774
+ var newestDeclarationFileContentChangedTime;
124775
+ if (buildInfoPath) {
124776
+ var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
124777
+ buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
124778
+ if (buildInfoTime === ts.missingFileModifiedTime) {
124779
+ if (!buildInfoCacheEntry_1) {
124780
+ state.buildInfoCache.set(resolvedPath, {
124781
+ path: toPath(state, buildInfoPath),
124782
+ buildInfo: false,
124783
+ modifiedTime: buildInfoTime
124784
+ });
124785
+ }
124786
+ return {
124787
+ type: ts.UpToDateStatusType.OutputMissing,
124788
+ missingOutputFileName: buildInfoPath
124789
+ };
124790
+ }
124791
+ var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
124792
+ if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
124793
+ return {
124794
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
124795
+ version: buildInfo.version
124796
+ };
124797
+ }
124798
+ if (buildInfo.program) {
124799
+ if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
124800
+ (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
124565
124801
  return {
124566
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124567
- outOfDateOutputFileName: oldestOutputFileName,
124568
- newerProjectName: ref.path
124802
+ type: ts.UpToDateStatusType.OutOfDateBuildInfo,
124803
+ buildInfoFile: buildInfoPath
124569
124804
  };
124570
124805
  }
124806
+ buildInfoProgram = buildInfo.program;
124571
124807
  }
124808
+ oldestOutputFileTime = buildInfoTime;
124809
+ oldestOutputFileName = buildInfoPath;
124810
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
124572
124811
  }
124573
- if (missingOutputFileName !== undefined) {
124574
- return {
124575
- type: ts.UpToDateStatusType.OutputMissing,
124576
- missingOutputFileName: missingOutputFileName
124577
- };
124812
+ // Check input files
124813
+ var newestInputFileName = undefined;
124814
+ var newestInputFileTime = minimumDate;
124815
+ var pseudoInputUptodate = false;
124816
+ // Get timestamps of input files
124817
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
124818
+ var inputFile = _f[_e];
124819
+ var inputTime = getModifiedTime(state, inputFile);
124820
+ if (inputTime === ts.missingFileModifiedTime) {
124821
+ return {
124822
+ type: ts.UpToDateStatusType.Unbuildable,
124823
+ reason: inputFile + " does not exist"
124824
+ };
124825
+ }
124826
+ // If an buildInfo is older than the newest input, we can stop checking
124827
+ if (buildInfoTime && buildInfoTime < inputTime) {
124828
+ var version_3 = void 0;
124829
+ var currentVersion = void 0;
124830
+ if (buildInfoProgram) {
124831
+ // Read files and see if they are same, read is anyways cached
124832
+ if (!buildInfoVersionMap)
124833
+ buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
124834
+ version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
124835
+ var text = version_3 ? state.readFileWithCache(inputFile) : undefined;
124836
+ currentVersion = text && (host.createHash || ts.generateDjb2Hash)(text);
124837
+ if (version_3 && version_3 === currentVersion)
124838
+ pseudoInputUptodate = true;
124839
+ }
124840
+ if (!version_3 || version_3 !== currentVersion) {
124841
+ return {
124842
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
124843
+ outOfDateOutputFileName: buildInfoPath,
124844
+ newerInputFileName: inputFile
124845
+ };
124846
+ }
124847
+ }
124848
+ if (inputTime > newestInputFileTime) {
124849
+ newestInputFileName = inputFile;
124850
+ newestInputFileTime = inputTime;
124851
+ }
124578
124852
  }
124579
- if (isOutOfDateWithInputs) {
124580
- return {
124581
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
124582
- outOfDateOutputFileName: oldestOutputFileName,
124583
- newerInputFileName: newestInputFileName
124584
- };
124853
+ // Now see if all outputs are newer than the newest input
124854
+ // Dont check output timestamps if we have buildinfo telling us output is uptodate
124855
+ if (!buildInfoPath) {
124856
+ // Collect the expected outputs of this project
124857
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
124858
+ var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
124859
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
124860
+ var output = outputs_1[_g];
124861
+ var path = toPath(state, output);
124862
+ // Output is missing; can stop checking
124863
+ var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
124864
+ if (!outputTime) {
124865
+ outputTime = ts.getModifiedTime(state.host, output);
124866
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
124867
+ }
124868
+ if (outputTime === ts.missingFileModifiedTime) {
124869
+ return {
124870
+ type: ts.UpToDateStatusType.OutputMissing,
124871
+ missingOutputFileName: output
124872
+ };
124873
+ }
124874
+ if (outputTime < oldestOutputFileTime) {
124875
+ oldestOutputFileTime = outputTime;
124876
+ oldestOutputFileName = output;
124877
+ }
124878
+ // If an output is older than the newest input, we can stop checking
124879
+ if (outputTime < newestInputFileTime) {
124880
+ return {
124881
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
124882
+ outOfDateOutputFileName: oldestOutputFileName,
124883
+ newerInputFileName: newestInputFileName
124884
+ };
124885
+ }
124886
+ }
124585
124887
  }
124586
- else {
124587
- // Check tsconfig time
124588
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
124589
- if (configStatus)
124590
- return configStatus;
124591
- // Check extended config time
124592
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
124593
- if (extendedConfigStatus)
124594
- return extendedConfigStatus;
124595
- // Check package file time
124596
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
124597
- var path = _a[0];
124598
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
124599
- });
124600
- if (dependentPackageFileStatus)
124601
- return dependentPackageFileStatus;
124602
- }
124603
- if (!force && !state.buildInfoChecked.has(resolvedPath)) {
124604
- state.buildInfoChecked.set(resolvedPath, true);
124605
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
124606
- if (buildInfoPath) {
124607
- var value = state.readFileWithCache(buildInfoPath);
124608
- var buildInfo = value && ts.getBuildInfo(value);
124609
- if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
124888
+ var seenRefs = buildInfoPath ? new ts.Set() : undefined;
124889
+ var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
124890
+ seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
124891
+ var pseudoUpToDate = false;
124892
+ var usesPrepend = false;
124893
+ var upstreamChangedProject;
124894
+ if (referenceStatuses) {
124895
+ for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
124896
+ var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
124897
+ usesPrepend = usesPrepend || !!(ref.prepend);
124898
+ // If the upstream project's newest file is older than our oldest output, we
124899
+ // can't be out of date because of it
124900
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
124901
+ continue;
124902
+ }
124903
+ // Check if tsbuildinfo path is shared, then we need to rebuild
124904
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
124610
124905
  return {
124611
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
124612
- version: buildInfo.version
124906
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124907
+ outOfDateOutputFileName: buildInfoPath,
124908
+ newerProjectName: ref.path
124613
124909
  };
124614
124910
  }
124911
+ // If the upstream project has only change .d.ts files, and we've built
124912
+ // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
124913
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
124914
+ pseudoUpToDate = true;
124915
+ upstreamChangedProject = ref.path;
124916
+ continue;
124917
+ }
124918
+ // We have an output older than an upstream output - we are out of date
124919
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
124920
+ return {
124921
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124922
+ outOfDateOutputFileName: oldestOutputFileName,
124923
+ newerProjectName: ref.path
124924
+ };
124615
124925
  }
124616
124926
  }
124927
+ // Check tsconfig time
124928
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
124929
+ if (configStatus)
124930
+ return configStatus;
124931
+ // Check extended config time
124932
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
124933
+ if (extendedConfigStatus)
124934
+ return extendedConfigStatus;
124935
+ // Check package file time
124936
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
124937
+ var path = _a[0];
124938
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
124939
+ });
124940
+ if (dependentPackageFileStatus)
124941
+ return dependentPackageFileStatus;
124617
124942
  if (usesPrepend && pseudoUpToDate) {
124618
124943
  return {
124619
124944
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -124623,15 +124948,37 @@ var ts;
124623
124948
  }
124624
124949
  // Up to date
124625
124950
  return {
124626
- type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
124951
+ type: pseudoUpToDate ?
124952
+ ts.UpToDateStatusType.UpToDateWithUpstreamTypes :
124953
+ pseudoInputUptodate ?
124954
+ ts.UpToDateStatusType.UpToDateWithInputFileText :
124955
+ ts.UpToDateStatusType.UpToDate,
124627
124956
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
124628
124957
  newestInputFileTime: newestInputFileTime,
124629
- newestOutputFileTime: newestOutputFileTime,
124630
124958
  newestInputFileName: newestInputFileName,
124631
- newestOutputFileName: newestOutputFileName,
124632
124959
  oldestOutputFileName: oldestOutputFileName
124633
124960
  };
124634
124961
  }
124962
+ function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
124963
+ if (seenRefs.has(resolvedRefPath))
124964
+ return false;
124965
+ seenRefs.add(resolvedRefPath);
124966
+ var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
124967
+ if (refBuildInfo.path === buildInfoCacheEntry.path)
124968
+ return true;
124969
+ if (resolvedConfig.projectReferences) {
124970
+ // Check references
124971
+ for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
124972
+ var ref = _a[_i];
124973
+ var resolvedRef = ts.resolveProjectReferencePath(ref);
124974
+ var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
124975
+ var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
124976
+ if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
124977
+ return true;
124978
+ }
124979
+ }
124980
+ return false;
124981
+ }
124635
124982
  function getUpToDateStatus(state, project, resolvedPath) {
124636
124983
  if (project === undefined) {
124637
124984
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -124644,39 +124991,65 @@ var ts;
124644
124991
  state.projectStatus.set(resolvedPath, actual);
124645
124992
  return actual;
124646
124993
  }
124647
- function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
124994
+ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
124648
124995
  if (proj.options.noEmit)
124649
- return priorNewestUpdateTime;
124996
+ return;
124997
+ var now;
124998
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
124999
+ if (buildInfoPath) {
125000
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
125001
+ if (!!state.options.verbose)
125002
+ reportStatus(state, verboseMessage, proj.options.configFilePath);
125003
+ state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
125004
+ getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
125005
+ }
125006
+ state.outputTimeStamps.delete(projectPath);
125007
+ return;
125008
+ }
124650
125009
  var host = state.host;
124651
125010
  var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125011
+ var outputTimeStampMap = getOutputTimeStampMap(state, projectPath);
125012
+ var modifiedOutputs = outputTimeStampMap ? new ts.Set() : undefined;
124652
125013
  if (!skipOutputs || outputs.length !== skipOutputs.size) {
124653
125014
  var reportVerbose = !!state.options.verbose;
124654
- var now = host.now ? host.now() : new Date();
124655
125015
  for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
124656
125016
  var file = outputs_2[_i];
124657
- if (skipOutputs && skipOutputs.has(toPath(state, file))) {
125017
+ var path = toPath(state, file);
125018
+ if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
124658
125019
  continue;
124659
- }
124660
125020
  if (reportVerbose) {
124661
125021
  reportVerbose = false;
124662
125022
  reportStatus(state, verboseMessage, proj.options.configFilePath);
124663
125023
  }
124664
- if (ts.isDeclarationFileName(file)) {
124665
- priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
125024
+ host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
125025
+ if (outputTimeStampMap) {
125026
+ outputTimeStampMap.set(path, now);
125027
+ modifiedOutputs.add(path);
124666
125028
  }
124667
- host.setModifiedTime(file, now);
124668
125029
  }
124669
125030
  }
124670
- return priorNewestUpdateTime;
125031
+ // Clear out timestamps not in output list any more
125032
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.forEach(function (_value, key) {
125033
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs.has(key))
125034
+ outputTimeStampMap.delete(key);
125035
+ });
125036
+ }
125037
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
125038
+ var _a;
125039
+ if (!options.composite)
125040
+ return undefined;
125041
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125042
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, /*modifiedTime*/ undefined);
125043
+ 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;
124671
125044
  }
124672
125045
  function updateOutputTimestamps(state, proj, resolvedPath) {
124673
125046
  if (state.options.dry) {
124674
125047
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
124675
125048
  }
124676
- var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125049
+ updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
124677
125050
  state.projectStatus.set(resolvedPath, {
124678
125051
  type: ts.UpToDateStatusType.UpToDate,
124679
- newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
125052
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
124680
125053
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
124681
125054
  });
124682
125055
  }
@@ -124722,6 +125095,7 @@ var ts;
124722
125095
  break;
124723
125096
  }
124724
125097
  // falls through
125098
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
124725
125099
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
124726
125100
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
124727
125101
  if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
@@ -124869,12 +125243,10 @@ var ts;
124869
125243
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
124870
125244
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
124871
125245
  return;
124872
- state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
124873
- invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
124874
- }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
125246
+ 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));
124875
125247
  }
124876
125248
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
124877
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
125249
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
124878
125250
  var _a;
124879
125251
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
124880
125252
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -124906,7 +125278,7 @@ var ts;
124906
125278
  if (!state.watch)
124907
125279
  return;
124908
125280
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
124909
- 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); },
125281
+ 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); },
124910
125282
  onDeleteValue: ts.closeFileWatcher,
124911
125283
  });
124912
125284
  }
@@ -124914,7 +125286,7 @@ var ts;
124914
125286
  if (!state.watch || !state.lastCachedPackageJsonLookups)
124915
125287
  return;
124916
125288
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
124917
- 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); },
125289
+ 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); },
124918
125290
  onDeleteValue: ts.closeFileWatcher,
124919
125291
  });
124920
125292
  }
@@ -125046,19 +125418,18 @@ var ts;
125046
125418
  }
125047
125419
  }
125048
125420
  function reportUpToDateStatus(state, configFileName, status) {
125049
- if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
125050
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125051
- }
125052
125421
  switch (status.type) {
125053
125422
  case ts.UpToDateStatusType.OutOfDateWithSelf:
125054
- 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));
125423
+ 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));
125055
125424
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
125056
- 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));
125425
+ 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));
125057
125426
  case ts.UpToDateStatusType.OutputMissing:
125058
125427
  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));
125428
+ case ts.UpToDateStatusType.OutOfDateBuildInfo:
125429
+ 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));
125059
125430
  case ts.UpToDateStatusType.UpToDate:
125060
125431
  if (status.newestInputFileTime !== undefined) {
125061
- 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 || ""));
125432
+ 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 || ""));
125062
125433
  }
125063
125434
  // Don't report anything for "up to date because it was already built" -- too verbose
125064
125435
  break;
@@ -125066,6 +125437,8 @@ var ts;
125066
125437
  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));
125067
125438
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125068
125439
  return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
125440
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
125441
+ 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));
125069
125442
  case ts.UpToDateStatusType.UpstreamOutOfDate:
125070
125443
  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));
125071
125444
  case ts.UpToDateStatusType.UpstreamBlocked:
@@ -125076,6 +125449,8 @@ var ts;
125076
125449
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
125077
125450
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
125078
125451
  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);
125452
+ case ts.UpToDateStatusType.ForceBuild:
125453
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125079
125454
  case ts.UpToDateStatusType.ContainerOnly:
125080
125455
  // Don't report status on "solution" projects
125081
125456
  // falls through
@@ -125242,6 +125617,17 @@ var ts;
125242
125617
  SymbolDisplayPartKind[SymbolDisplayPartKind["linkName"] = 23] = "linkName";
125243
125618
  SymbolDisplayPartKind[SymbolDisplayPartKind["linkText"] = 24] = "linkText";
125244
125619
  })(SymbolDisplayPartKind = ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {}));
125620
+ // Do not change existing values, as they exist in telemetry.
125621
+ var CompletionInfoFlags;
125622
+ (function (CompletionInfoFlags) {
125623
+ CompletionInfoFlags[CompletionInfoFlags["None"] = 0] = "None";
125624
+ CompletionInfoFlags[CompletionInfoFlags["MayIncludeAutoImports"] = 1] = "MayIncludeAutoImports";
125625
+ CompletionInfoFlags[CompletionInfoFlags["IsImportStatementCompletion"] = 2] = "IsImportStatementCompletion";
125626
+ CompletionInfoFlags[CompletionInfoFlags["IsContinuation"] = 4] = "IsContinuation";
125627
+ CompletionInfoFlags[CompletionInfoFlags["ResolvedModuleSpecifiers"] = 8] = "ResolvedModuleSpecifiers";
125628
+ CompletionInfoFlags[CompletionInfoFlags["ResolvedModuleSpecifiersBeyondLimit"] = 16] = "ResolvedModuleSpecifiersBeyondLimit";
125629
+ CompletionInfoFlags[CompletionInfoFlags["MayIncludeMethodSnippets"] = 32] = "MayIncludeMethodSnippets";
125630
+ })(CompletionInfoFlags = ts.CompletionInfoFlags || (ts.CompletionInfoFlags = {}));
125245
125631
  var OutliningSpanKind;
125246
125632
  (function (OutliningSpanKind) {
125247
125633
  /** Single or multi-line comments */
@@ -127254,6 +127640,14 @@ var ts;
127254
127640
  return __assign(__assign({}, createModuleSpecifierResolutionHost(program, host)), { getCommonSourceDirectory: function () { return program.getCommonSourceDirectory(); } });
127255
127641
  }
127256
127642
  ts.getModuleSpecifierResolverHost = getModuleSpecifierResolverHost;
127643
+ function moduleResolutionRespectsExports(moduleResolution) {
127644
+ return moduleResolution >= ts.ModuleResolutionKind.Node12 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
127645
+ }
127646
+ ts.moduleResolutionRespectsExports = moduleResolutionRespectsExports;
127647
+ function moduleResolutionUsesNodeModules(moduleResolution) {
127648
+ return moduleResolution === ts.ModuleResolutionKind.NodeJs || moduleResolution >= ts.ModuleResolutionKind.Node12 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
127649
+ }
127650
+ ts.moduleResolutionUsesNodeModules = moduleResolutionUsesNodeModules;
127257
127651
  function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) {
127258
127652
  return defaultImport || namedImports && namedImports.length ? makeImport(defaultImport, namedImports, moduleSpecifier, quotePreference) : undefined;
127259
127653
  }
@@ -128857,8 +129251,8 @@ var ts;
128857
129251
  if (from === to)
128858
129252
  return false;
128859
129253
  var cachedResult = moduleSpecifierCache === null || moduleSpecifierCache === void 0 ? void 0 : moduleSpecifierCache.get(from.path, to.path, preferences, {});
128860
- if ((cachedResult === null || cachedResult === void 0 ? void 0 : cachedResult.isAutoImportable) !== undefined) {
128861
- return cachedResult.isAutoImportable;
129254
+ if ((cachedResult === null || cachedResult === void 0 ? void 0 : cachedResult.isBlockedByPackageJsonDependencies) !== undefined) {
129255
+ return !cachedResult.isBlockedByPackageJsonDependencies;
128862
129256
  }
128863
129257
  var getCanonicalFileName = ts.hostGetCanonicalFileName(moduleSpecifierResolutionHost);
128864
129258
  var globalTypingsCache = (_a = moduleSpecifierResolutionHost.getGlobalTypingsCacheLocation) === null || _a === void 0 ? void 0 : _a.call(moduleSpecifierResolutionHost);
@@ -128872,7 +129266,7 @@ var ts;
128872
129266
  });
128873
129267
  if (packageJsonFilter) {
128874
129268
  var isAutoImportable = hasImportablePath && packageJsonFilter.allowsImportingSourceFile(to, moduleSpecifierResolutionHost);
128875
- moduleSpecifierCache === null || moduleSpecifierCache === void 0 ? void 0 : moduleSpecifierCache.setIsAutoImportable(from.path, to.path, preferences, {}, isAutoImportable);
129269
+ moduleSpecifierCache === null || moduleSpecifierCache === void 0 ? void 0 : moduleSpecifierCache.setBlockedByPackageJsonDependencies(from.path, to.path, preferences, {}, !isAutoImportable);
128876
129270
  return isAutoImportable;
128877
129271
  }
128878
129272
  return hasImportablePath;
@@ -131151,15 +131545,26 @@ var ts;
131151
131545
  var _a, _b, _c;
131152
131546
  var start = ts.timestamp();
131153
131547
  var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
131154
- var resolutionLimitExceeded = false;
131548
+ // Under `--moduleResolution nodenext`, we have to resolve module specifiers up front, because
131549
+ // package.json exports can mean we *can't* resolve a module specifier (that doesn't include a
131550
+ // relative path into node_modules), and we want to filter those completions out entirely.
131551
+ // Import statement completions always need specifier resolution because the module specifier is
131552
+ // part of their `insertText`, not the `codeActions` creating edits away from the cursor.
131553
+ var needsFullResolution = isForImportStatementCompletion || ts.moduleResolutionRespectsExports(ts.getEmitModuleResolutionKind(program.getCompilerOptions()));
131554
+ var skippedAny = false;
131155
131555
  var ambientCount = 0;
131156
131556
  var resolvedCount = 0;
131157
131557
  var resolvedFromCacheCount = 0;
131158
131558
  var cacheAttemptCount = 0;
131159
- var result = cb({ tryResolve: tryResolve, resolutionLimitExceeded: function () { return resolutionLimitExceeded; } });
131559
+ var result = cb({
131560
+ tryResolve: tryResolve,
131561
+ skippedAny: function () { return skippedAny; },
131562
+ resolvedAny: function () { return resolvedCount > 0; },
131563
+ resolvedBeyondLimit: function () { return resolvedCount > Completions.moduleSpecifierResolutionLimit; },
131564
+ });
131160
131565
  var hitRateMessage = cacheAttemptCount ? " (" + (resolvedFromCacheCount / cacheAttemptCount * 100).toFixed(1) + "% hit rate)" : "";
131161
131566
  (_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);
131162
- (_b = host.log) === null || _b === void 0 ? void 0 : _b.call(host, logPrefix + ": response is " + (resolutionLimitExceeded ? "incomplete" : "complete"));
131567
+ (_b = host.log) === null || _b === void 0 ? void 0 : _b.call(host, logPrefix + ": response is " + (skippedAny ? "incomplete" : "complete"));
131163
131568
  (_c = host.log) === null || _c === void 0 ? void 0 : _c.call(host, logPrefix + ": " + (ts.timestamp() - start));
131164
131569
  return result;
131165
131570
  function tryResolve(exportInfo, symbolName, isFromAmbientModule) {
@@ -131168,22 +131573,22 @@ var ts;
131168
131573
  if (result_1) {
131169
131574
  ambientCount++;
131170
131575
  }
131171
- return result_1;
131576
+ return result_1 || "failed";
131172
131577
  }
131173
- var shouldResolveModuleSpecifier = isForImportStatementCompletion || preferences.allowIncompleteCompletions && resolvedCount < Completions.moduleSpecifierResolutionLimit;
131578
+ var shouldResolveModuleSpecifier = needsFullResolution || preferences.allowIncompleteCompletions && resolvedCount < Completions.moduleSpecifierResolutionLimit;
131174
131579
  var shouldGetModuleSpecifierFromCache = !shouldResolveModuleSpecifier && preferences.allowIncompleteCompletions && cacheAttemptCount < Completions.moduleSpecifierResolutionCacheAttemptLimit;
131175
131580
  var result = (shouldResolveModuleSpecifier || shouldGetModuleSpecifierFromCache)
131176
131581
  ? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite, sourceFile, program, host, preferences, packageJsonImportFilter, shouldGetModuleSpecifierFromCache)
131177
131582
  : undefined;
131178
131583
  if (!shouldResolveModuleSpecifier && !shouldGetModuleSpecifierFromCache || shouldGetModuleSpecifierFromCache && !result) {
131179
- resolutionLimitExceeded = true;
131584
+ skippedAny = true;
131180
131585
  }
131181
131586
  resolvedCount += (result === null || result === void 0 ? void 0 : result.computedWithoutCacheCount) || 0;
131182
- resolvedFromCacheCount += exportInfo.length - resolvedCount;
131587
+ resolvedFromCacheCount += exportInfo.length - ((result === null || result === void 0 ? void 0 : result.computedWithoutCacheCount) || 0);
131183
131588
  if (shouldGetModuleSpecifierFromCache) {
131184
131589
  cacheAttemptCount++;
131185
131590
  }
131186
- return result;
131591
+ return result || (needsFullResolution ? "failed" : "skipped");
131187
131592
  }
131188
131593
  }
131189
131594
  function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext) {
@@ -131281,6 +131686,7 @@ var ts;
131281
131686
  var newEntries = resolvingModuleSpecifiers("continuePreviousIncompleteResponse", host, program, file, location.getStart(), preferences,
131282
131687
  /*isForImportStatementCompletion*/ false, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
131283
131688
  var entries = ts.mapDefined(previousResponse.entries, function (entry) {
131689
+ var _a;
131284
131690
  if (!entry.hasAction || !entry.source || !entry.data || completionEntryDataIsResolved(entry.data)) {
131285
131691
  // Not an auto import or already resolved; keep as is
131286
131692
  return entry;
@@ -131292,8 +131698,12 @@ var ts;
131292
131698
  var origin = ts.Debug.checkDefined(getAutoImportSymbolFromCompletionEntryData(entry.name, entry.data, program, host)).origin;
131293
131699
  var info = exportMap.get(file.path, entry.data.exportMapKey);
131294
131700
  var result = info && context.tryResolve(info, entry.name, !ts.isExternalModuleNameRelative(ts.stripQuotes(origin.moduleSymbol.name)));
131295
- if (!result)
131701
+ if (result === "skipped")
131296
131702
  return entry;
131703
+ if (!result || result === "failed") {
131704
+ (_a = host.log) === null || _a === void 0 ? void 0 : _a.call(host, "Unexpected failure resolving auto import for '" + entry.name + "' from '" + entry.source + "'");
131705
+ return undefined;
131706
+ }
131297
131707
  var newOrigin = __assign(__assign({}, origin), { kind: 32 /* ResolvedExport */, moduleSpecifier: result.moduleSpecifier });
131298
131708
  // Mutating for performance... feels sketchy but nobody else uses the cache,
131299
131709
  // so why bother allocating a bunch of new objects?
@@ -131302,12 +131712,13 @@ var ts;
131302
131712
  entry.sourceDisplay = [ts.textPart(newOrigin.moduleSpecifier)];
131303
131713
  return entry;
131304
131714
  });
131305
- if (!context.resolutionLimitExceeded()) {
131715
+ if (!context.skippedAny()) {
131306
131716
  previousResponse.isIncomplete = undefined;
131307
131717
  }
131308
131718
  return entries;
131309
131719
  });
131310
131720
  previousResponse.entries = newEntries;
131721
+ previousResponse.flags = (previousResponse.flags || 0) | 4 /* IsContinuation */;
131311
131722
  return previousResponse;
131312
131723
  }
131313
131724
  function jsdocCompletionInfo(entries) {
@@ -131389,12 +131800,13 @@ var ts;
131389
131800
  ts.insertSorted(entries, createCompletionEntryForLiteral(sourceFile, preferences, literal), compareCompletionEntries, /*allowDuplicates*/ true);
131390
131801
  }
131391
131802
  return {
131803
+ flags: completionData.flags,
131392
131804
  isGlobalCompletion: isInSnippetScope,
131393
131805
  isIncomplete: preferences.allowIncompleteCompletions && hasUnresolvedAutoImports ? true : undefined,
131394
131806
  isMemberCompletion: isMemberCompletionKind(completionKind),
131395
131807
  isNewIdentifierLocation: isNewIdentifierLocation,
131396
131808
  optionalReplacementSpan: getOptionalReplacementSpan(location),
131397
- entries: entries
131809
+ entries: entries,
131398
131810
  };
131399
131811
  }
131400
131812
  function isUncheckedFile(sourceFile, compilerOptions) {
@@ -132451,6 +132863,7 @@ var ts;
132451
132863
  var location = ts.getTouchingPropertyName(sourceFile, position);
132452
132864
  var keywordFilters = 0 /* None */;
132453
132865
  var isNewIdentifierLocation = false;
132866
+ var flags = 0 /* None */;
132454
132867
  if (contextToken) {
132455
132868
  var importStatementCompletion = getImportStatementCompletionInfo(contextToken);
132456
132869
  isNewIdentifierLocation = importStatementCompletion.isNewIdentifierLocation;
@@ -132470,6 +132883,7 @@ var ts;
132470
132883
  // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients
132471
132884
  // to opt in with the `includeCompletionsForImportStatements` user preference.
132472
132885
  importCompletionNode = importStatementCompletion.replacementNode;
132886
+ flags |= 2 /* IsImportStatementCompletion */;
132473
132887
  }
132474
132888
  // Bail out if this is a known invalid completion location
132475
132889
  if (!importCompletionNode && isCompletionListBlocker(contextToken)) {
@@ -132662,6 +133076,7 @@ var ts;
132662
133076
  isRightOfOpenTag: isRightOfOpenTag,
132663
133077
  importCompletionNode: importCompletionNode,
132664
133078
  hasUnresolvedAutoImports: hasUnresolvedAutoImports,
133079
+ flags: flags,
132665
133080
  };
132666
133081
  function isTagWithTypeExpression(tag) {
132667
133082
  switch (tag.kind) {
@@ -133071,6 +133486,7 @@ var ts;
133071
133486
  // Asking for completion details for an item that is not an auto-import
133072
133487
  return;
133073
133488
  }
133489
+ flags |= 1 /* MayIncludeAutoImports */;
133074
133490
  // import { type | -> token text should be blank
133075
133491
  var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken
133076
133492
  && importCompletionNode
@@ -133101,16 +133517,36 @@ var ts;
133101
133517
  return true;
133102
133518
  return charactersFuzzyMatchInString(symbolName, lowerCaseTokenText);
133103
133519
  }, function (info, symbolName, isFromAmbientModule, exportMapKey) {
133520
+ var _a;
133104
133521
  if (detailsEntryId && !ts.some(info, function (i) { return detailsEntryId.source === ts.stripQuotes(i.moduleSymbol.name); })) {
133105
133522
  return;
133106
133523
  }
133107
- var defaultExportInfo = ts.find(info, isImportableExportInfo);
133108
- if (!defaultExportInfo) {
133524
+ // Do a relatively cheap check to bail early if all re-exports are non-importable
133525
+ // due to file location or package.json dependency filtering. For non-node12+
133526
+ // module resolution modes, getting past this point guarantees that we'll be
133527
+ // able to generate a suitable module specifier, so we can safely show a completion,
133528
+ // even if we defer computing the module specifier.
133529
+ var firstImportableExportInfo = ts.find(info, isImportableExportInfo);
133530
+ if (!firstImportableExportInfo) {
133531
+ return;
133532
+ }
133533
+ // In node12+, module specifier resolution can fail due to modules being blocked
133534
+ // by package.json `exports`. If that happens, don't show a completion item.
133535
+ // N.B. in this resolution mode we always try to resolve module specifiers here,
133536
+ // because we have to know now if it's going to fail so we can omit the completion
133537
+ // from the list.
133538
+ var result = context.tryResolve(info, symbolName, isFromAmbientModule) || {};
133539
+ if (result === "failed")
133109
133540
  return;
133541
+ // If we skipped resolving module specifiers, our selection of which ExportInfo
133542
+ // to use here is arbitrary, since the info shown in the completion list derived from
133543
+ // it should be identical regardless of which one is used. During the subsequent
133544
+ // `CompletionEntryDetails` request, we'll get all the ExportInfos again and pick
133545
+ // the best one based on the module specifier it produces.
133546
+ var exportInfo = firstImportableExportInfo, moduleSpecifier;
133547
+ if (result !== "skipped") {
133548
+ (_a = result.exportInfo, exportInfo = _a === void 0 ? firstImportableExportInfo : _a, moduleSpecifier = result.moduleSpecifier);
133110
133549
  }
133111
- // If we don't need to resolve module specifiers, we can use any re-export that is importable at all
133112
- // (We need to ensure that at least one is importable to show a completion.)
133113
- var _a = context.tryResolve(info, symbolName, isFromAmbientModule) || {}, _b = _a.exportInfo, exportInfo = _b === void 0 ? defaultExportInfo : _b, moduleSpecifier = _a.moduleSpecifier;
133114
133550
  var isDefaultExport = exportInfo.exportKind === 1 /* Default */;
133115
133551
  var symbol = isDefaultExport && ts.getLocalSymbolForExportDefault(exportInfo.symbol) || exportInfo.symbol;
133116
133552
  pushAutoImportSymbol(symbol, {
@@ -133125,7 +133561,9 @@ var ts;
133125
133561
  isFromPackageJson: exportInfo.isFromPackageJson,
133126
133562
  });
133127
133563
  });
133128
- hasUnresolvedAutoImports = context.resolutionLimitExceeded();
133564
+ hasUnresolvedAutoImports = context.skippedAny();
133565
+ flags |= context.resolvedAny() ? 8 /* ResolvedModuleSpecifiers */ : 0;
133566
+ flags |= context.resolvedBeyondLimit() ? 16 /* ResolvedModuleSpecifiersBeyondLimit */ : 0;
133129
133567
  });
133130
133568
  function isImportableExportInfo(info) {
133131
133569
  var moduleFile = ts.tryCast(info.moduleSymbol.valueDeclaration, ts.isSourceFile);
@@ -133173,6 +133611,7 @@ var ts;
133173
133611
  return;
133174
133612
  }
133175
133613
  var origin = __assign({ kind: 128 /* ObjectLiteralMethod */ }, entryProps);
133614
+ flags |= 32 /* MayIncludeMethodSnippets */;
133176
133615
  symbolToOriginInfoMap[symbols.length] = origin;
133177
133616
  symbols.push(member);
133178
133617
  });
@@ -133369,7 +133808,7 @@ var ts;
133369
133808
  // through type declaration or inference.
133370
133809
  // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed -
133371
133810
  // type of parameter will flow in from the contextual type of the function
133372
- var canGetType = ts.hasInitializer(rootDeclaration) || ts.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 244 /* ForOfStatement */;
133811
+ var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 244 /* ForOfStatement */;
133373
133812
  if (!canGetType && rootDeclaration.kind === 164 /* Parameter */) {
133374
133813
  if (ts.isExpression(rootDeclaration.parent)) {
133375
133814
  canGetType = !!typeChecker.getContextualType(rootDeclaration.parent);
@@ -134644,6 +135083,8 @@ var ts;
134644
135083
  return highlightSpans(getAsyncAndAwaitOccurrences(node));
134645
135084
  case 125 /* YieldKeyword */:
134646
135085
  return highlightSpans(getYieldOccurrences(node));
135086
+ case 101 /* InKeyword */:
135087
+ return undefined;
134647
135088
  default:
134648
135089
  return ts.isModifierKind(node.kind) && (ts.isDeclaration(node.parent) || ts.isVariableStatement(node.parent))
134649
135090
  ? highlightSpans(getModifierOccurrences(node.kind, node.parent))
@@ -149412,7 +149853,7 @@ var ts;
149412
149853
  ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined.code,
149413
149854
  ts.Diagnostics.Type_0_is_not_an_array_type.code,
149414
149855
  ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type.code,
149415
- ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators.code,
149856
+ ts.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher.code,
149416
149857
  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,
149417
149858
  ts.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator.code,
149418
149859
  ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator.code,
@@ -152366,6 +152807,7 @@ var ts;
152366
152807
  var compilerOptions = program.getCompilerOptions();
152367
152808
  var moduleSpecifierResolutionHost = ts.createModuleSpecifierResolutionHost(program, host);
152368
152809
  var getChecker = ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); });
152810
+ var rejectNodeModulesRelativePaths = ts.moduleResolutionUsesNodeModules(ts.getEmitModuleResolutionKind(compilerOptions));
152369
152811
  var getModuleSpecifiers = fromCacheOnly
152370
152812
  ? function (moduleSymbol) { return ({ moduleSpecifiers: ts.moduleSpecifiers.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }); }
152371
152813
  : function (moduleSymbol, checker) { return ts.moduleSpecifiers.getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, sourceFile, moduleSpecifierResolutionHost, preferences); };
@@ -152376,19 +152818,19 @@ var ts;
152376
152818
  var importedSymbolHasValueMeaning = !!(exportInfo.targetFlags & 111551 /* Value */);
152377
152819
  var addAsTypeOnly = getAddAsTypeOnly(isValidTypeOnlyUseSite, /*isForNewImportDeclaration*/ true, exportInfo.symbol, exportInfo.targetFlags, checker, compilerOptions);
152378
152820
  computedWithoutCacheCount += computedWithoutCache ? 1 : 0;
152379
- return moduleSpecifiers === null || moduleSpecifiers === void 0 ? void 0 : moduleSpecifiers.map(function (moduleSpecifier) {
152380
- // `position` should only be undefined at a missing jsx namespace, in which case we shouldn't be looking for pure types.
152381
- return !importedSymbolHasValueMeaning && isJs && position !== undefined
152382
- ? { kind: 1 /* JsdocTypeImport */, moduleSpecifier: moduleSpecifier, position: position, exportInfo: exportInfo, isReExport: i > 0 }
152383
- : {
152384
- kind: 3 /* AddNew */,
152385
- moduleSpecifier: moduleSpecifier,
152386
- importKind: getImportKind(sourceFile, exportInfo.exportKind, compilerOptions),
152387
- useRequire: useRequire,
152388
- addAsTypeOnly: addAsTypeOnly,
152389
- exportInfo: exportInfo,
152390
- isReExport: i > 0,
152391
- };
152821
+ return ts.mapDefined(moduleSpecifiers, function (moduleSpecifier) {
152822
+ return rejectNodeModulesRelativePaths && ts.pathContainsNodeModules(moduleSpecifier) ? undefined :
152823
+ // `position` should only be undefined at a missing jsx namespace, in which case we shouldn't be looking for pure types.
152824
+ !importedSymbolHasValueMeaning && isJs && position !== undefined ? { kind: 1 /* JsdocTypeImport */, moduleSpecifier: moduleSpecifier, position: position, exportInfo: exportInfo, isReExport: i > 0 } :
152825
+ {
152826
+ kind: 3 /* AddNew */,
152827
+ moduleSpecifier: moduleSpecifier,
152828
+ importKind: getImportKind(sourceFile, exportInfo.exportKind, compilerOptions),
152829
+ useRequire: useRequire,
152830
+ addAsTypeOnly: addAsTypeOnly,
152831
+ exportInfo: exportInfo,
152832
+ isReExport: i > 0,
152833
+ };
152392
152834
  });
152393
152835
  });
152394
152836
  return { computedWithoutCacheCount: computedWithoutCacheCount, fixes: fixes };
@@ -157961,6 +158403,7 @@ var ts;
157961
158403
  var fixName = "addVoidToPromise";
157962
158404
  var fixId = "addVoidToPromise";
157963
158405
  var errorCodes = [
158406
+ 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,
157964
158407
  ts.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code
157965
158408
  ];
157966
158409
  codefix.registerCodeFix({
@@ -173944,7 +174387,7 @@ var ts;
173944
174387
  return cache.get(toFileName);
173945
174388
  },
173946
174389
  set: function (fromFileName, toFileName, preferences, options, modulePaths, moduleSpecifiers) {
173947
- ensureCache(fromFileName, preferences, options).set(toFileName, createInfo(modulePaths, moduleSpecifiers, /*isAutoImportable*/ true));
174390
+ ensureCache(fromFileName, preferences, options).set(toFileName, createInfo(modulePaths, moduleSpecifiers, /*isBlockedByPackageJsonDependencies*/ false));
173948
174391
  // If any module specifiers were generated based off paths in node_modules,
173949
174392
  // a package.json file in that package was read and is an input to the cached.
173950
174393
  // Instead of watching each individual package.json file, set up a wildcard
@@ -173970,17 +174413,17 @@ var ts;
173970
174413
  info.modulePaths = modulePaths;
173971
174414
  }
173972
174415
  else {
173973
- cache.set(toFileName, createInfo(modulePaths, /*moduleSpecifiers*/ undefined, /*isAutoImportable*/ undefined));
174416
+ cache.set(toFileName, createInfo(modulePaths, /*moduleSpecifiers*/ undefined, /*isBlockedByPackageJsonDependencies*/ undefined));
173974
174417
  }
173975
174418
  },
173976
- setIsAutoImportable: function (fromFileName, toFileName, preferences, options, isAutoImportable) {
174419
+ setBlockedByPackageJsonDependencies: function (fromFileName, toFileName, preferences, options, isBlockedByPackageJsonDependencies) {
173977
174420
  var cache = ensureCache(fromFileName, preferences, options);
173978
174421
  var info = cache.get(toFileName);
173979
174422
  if (info) {
173980
- info.isAutoImportable = isAutoImportable;
174423
+ info.isBlockedByPackageJsonDependencies = isBlockedByPackageJsonDependencies;
173981
174424
  }
173982
174425
  else {
173983
- cache.set(toFileName, createInfo(/*modulePaths*/ undefined, /*moduleSpecifiers*/ undefined, isAutoImportable));
174426
+ cache.set(toFileName, createInfo(/*modulePaths*/ undefined, /*moduleSpecifiers*/ undefined, isBlockedByPackageJsonDependencies));
173984
174427
  }
173985
174428
  },
173986
174429
  clear: function () {
@@ -174008,8 +174451,8 @@ var ts;
174008
174451
  function key(fromFileName, preferences, options) {
174009
174452
  return fromFileName + "," + preferences.importModuleSpecifierEnding + "," + preferences.importModuleSpecifierPreference + "," + options.overrideImportMode;
174010
174453
  }
174011
- function createInfo(modulePaths, moduleSpecifiers, isAutoImportable) {
174012
- return { modulePaths: modulePaths, moduleSpecifiers: moduleSpecifiers, isAutoImportable: isAutoImportable };
174454
+ function createInfo(modulePaths, moduleSpecifiers, isBlockedByPackageJsonDependencies) {
174455
+ return { modulePaths: modulePaths, moduleSpecifiers: moduleSpecifiers, isBlockedByPackageJsonDependencies: isBlockedByPackageJsonDependencies };
174013
174456
  }
174014
174457
  }
174015
174458
  server.createModuleSpecifierCache = createModuleSpecifierCache;