@typescript-deploys/pr-build 4.7.0-pr-47461-10 → 4.7.0-pr-48784-4

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.20220425";
103
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220427";
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 {
@@ -8872,6 +8883,7 @@ var ts;
8872
8883
  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
8884
  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
8885
  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."),
8886
+ 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
8887
  Initializer_for_property_0: diag(2811, ts.DiagnosticCategory.Error, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
8876
8888
  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
8889
  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 +9311,8 @@ var ts;
9299
9311
  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
9312
  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
9313
  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}'"),
9314
+ 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}'"),
9315
+ 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
9316
  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
9317
  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
9318
  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 +9356,7 @@ var ts;
9344
9356
  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
9357
  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
9358
  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."),
9359
+ 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"),
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."),
@@ -17307,19 +17320,11 @@ var ts;
17307
17320
  return !!name && isDynamicName(name);
17308
17321
  }
17309
17322
  ts.hasDynamicName = hasDynamicName;
17310
- function getComputedPropertyNameExpression(name) {
17311
- return ts.isElementAccessExpression(name.expression)
17312
- ? skipParentheses(name.expression.argumentExpression)
17313
- : name.expression;
17314
- }
17315
- ts.getComputedPropertyNameExpression = getComputedPropertyNameExpression;
17316
17323
  function isDynamicName(name) {
17317
17324
  if (!(name.kind === 162 /* ComputedPropertyName */ || name.kind === 207 /* ElementAccessExpression */)) {
17318
17325
  return false;
17319
17326
  }
17320
- var expr = ts.isElementAccessExpression(name)
17321
- ? skipParentheses(name.argumentExpression)
17322
- : getComputedPropertyNameExpression(name);
17327
+ var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression;
17323
17328
  return !isStringOrNumericLiteralLike(expr) &&
17324
17329
  !isSignedNumericLiteral(expr);
17325
17330
  }
@@ -17333,7 +17338,7 @@ var ts;
17333
17338
  case 8 /* NumericLiteral */:
17334
17339
  return ts.escapeLeadingUnderscores(name.text);
17335
17340
  case 162 /* ComputedPropertyName */:
17336
- var nameExpression = getComputedPropertyNameExpression(name);
17341
+ var nameExpression = name.expression;
17337
17342
  if (isStringOrNumericLiteralLike(nameExpression)) {
17338
17343
  return ts.escapeLeadingUnderscores(nameExpression.text);
17339
17344
  }
@@ -20156,6 +20161,10 @@ var ts;
20156
20161
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
20157
20162
  }
20158
20163
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
20164
+ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
20165
+ return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
20166
+ }
20167
+ ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
20159
20168
  function getCompilerOptionValue(options, option) {
20160
20169
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
20161
20170
  }
@@ -37970,7 +37979,8 @@ var ts;
37970
37979
  if (!comment) {
37971
37980
  comment = parseTrailingTagComments(start, getNodePos(), indent, indentText);
37972
37981
  }
37973
- 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);
37974
37984
  }
37975
37985
  function escapedTextsEqual(a, b) {
37976
37986
  while (!ts.isIdentifier(a) || !ts.isIdentifier(b)) {
@@ -39193,6 +39203,7 @@ var ts;
39193
39203
  type: "boolean",
39194
39204
  affectsSemanticDiagnostics: true,
39195
39205
  affectsEmit: true,
39206
+ affectsMultiFileEmitBuildInfo: true,
39196
39207
  category: ts.Diagnostics.Watch_and_Build_Modes,
39197
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,
39198
39209
  defaultValueDescription: false,
@@ -39227,12 +39238,40 @@ var ts;
39227
39238
  affectsSourceFile: true,
39228
39239
  affectsModuleResolution: true,
39229
39240
  affectsEmit: true,
39241
+ affectsMultiFileEmitBuildInfo: true,
39230
39242
  paramType: ts.Diagnostics.VERSION,
39231
39243
  showInSimplifiedHelpView: true,
39232
39244
  category: ts.Diagnostics.Language_and_Environment,
39233
39245
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
39234
39246
  defaultValueDescription: 0 /* ES3 */,
39235
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
+ };
39236
39275
  var commandOptionsWithoutBuild = [
39237
39276
  // CommandLine only options
39238
39277
  {
@@ -39294,37 +39333,14 @@ var ts;
39294
39333
  category: ts.Diagnostics.Command_line_Options,
39295
39334
  affectsSemanticDiagnostics: true,
39296
39335
  affectsEmit: true,
39336
+ affectsMultiFileEmitBuildInfo: true,
39297
39337
  isCommandLineOnly: true,
39298
39338
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
39299
39339
  defaultValueDescription: false,
39300
39340
  },
39301
39341
  // Basic
39302
39342
  ts.targetOptionDeclaration,
39303
- {
39304
- name: "module",
39305
- shortName: "m",
39306
- type: new ts.Map(ts.getEntries({
39307
- none: ts.ModuleKind.None,
39308
- commonjs: ts.ModuleKind.CommonJS,
39309
- amd: ts.ModuleKind.AMD,
39310
- system: ts.ModuleKind.System,
39311
- umd: ts.ModuleKind.UMD,
39312
- es6: ts.ModuleKind.ES2015,
39313
- es2015: ts.ModuleKind.ES2015,
39314
- es2020: ts.ModuleKind.ES2020,
39315
- es2022: ts.ModuleKind.ES2022,
39316
- esnext: ts.ModuleKind.ESNext,
39317
- node12: ts.ModuleKind.Node12,
39318
- nodenext: ts.ModuleKind.NodeNext,
39319
- })),
39320
- affectsModuleResolution: true,
39321
- affectsEmit: true,
39322
- paramType: ts.Diagnostics.KIND,
39323
- showInSimplifiedHelpView: true,
39324
- category: ts.Diagnostics.Modules,
39325
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
39326
- defaultValueDescription: undefined,
39327
- },
39343
+ ts.moduleOptionDeclaration,
39328
39344
  {
39329
39345
  name: "lib",
39330
39346
  type: "list",
@@ -39361,6 +39377,7 @@ var ts;
39361
39377
  type: jsxOptionMap,
39362
39378
  affectsSourceFile: true,
39363
39379
  affectsEmit: true,
39380
+ affectsMultiFileEmitBuildInfo: true,
39364
39381
  affectsModuleResolution: true,
39365
39382
  paramType: ts.Diagnostics.KIND,
39366
39383
  showInSimplifiedHelpView: true,
@@ -39373,6 +39390,7 @@ var ts;
39373
39390
  shortName: "d",
39374
39391
  type: "boolean",
39375
39392
  affectsEmit: true,
39393
+ affectsMultiFileEmitBuildInfo: true,
39376
39394
  showInSimplifiedHelpView: true,
39377
39395
  category: ts.Diagnostics.Emit,
39378
39396
  transpileOptionValue: undefined,
@@ -39383,6 +39401,7 @@ var ts;
39383
39401
  name: "declarationMap",
39384
39402
  type: "boolean",
39385
39403
  affectsEmit: true,
39404
+ affectsMultiFileEmitBuildInfo: true,
39386
39405
  showInSimplifiedHelpView: true,
39387
39406
  category: ts.Diagnostics.Emit,
39388
39407
  transpileOptionValue: undefined,
@@ -39393,6 +39412,7 @@ var ts;
39393
39412
  name: "emitDeclarationOnly",
39394
39413
  type: "boolean",
39395
39414
  affectsEmit: true,
39415
+ affectsMultiFileEmitBuildInfo: true,
39396
39416
  showInSimplifiedHelpView: true,
39397
39417
  category: ts.Diagnostics.Emit,
39398
39418
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -39403,6 +39423,7 @@ var ts;
39403
39423
  name: "sourceMap",
39404
39424
  type: "boolean",
39405
39425
  affectsEmit: true,
39426
+ affectsMultiFileEmitBuildInfo: true,
39406
39427
  showInSimplifiedHelpView: true,
39407
39428
  category: ts.Diagnostics.Emit,
39408
39429
  defaultValueDescription: false,
@@ -39412,6 +39433,9 @@ var ts;
39412
39433
  name: "outFile",
39413
39434
  type: "string",
39414
39435
  affectsEmit: true,
39436
+ affectsMultiFileEmitBuildInfo: true,
39437
+ affectsDeclarationPath: true,
39438
+ affectsBundleEmitBuildInfo: true,
39415
39439
  isFilePath: true,
39416
39440
  paramType: ts.Diagnostics.FILE,
39417
39441
  showInSimplifiedHelpView: true,
@@ -39423,6 +39447,8 @@ var ts;
39423
39447
  name: "outDir",
39424
39448
  type: "string",
39425
39449
  affectsEmit: true,
39450
+ affectsMultiFileEmitBuildInfo: true,
39451
+ affectsDeclarationPath: true,
39426
39452
  isFilePath: true,
39427
39453
  paramType: ts.Diagnostics.DIRECTORY,
39428
39454
  showInSimplifiedHelpView: true,
@@ -39433,6 +39459,8 @@ var ts;
39433
39459
  name: "rootDir",
39434
39460
  type: "string",
39435
39461
  affectsEmit: true,
39462
+ affectsMultiFileEmitBuildInfo: true,
39463
+ affectsDeclarationPath: true,
39436
39464
  isFilePath: true,
39437
39465
  paramType: ts.Diagnostics.LOCATION,
39438
39466
  category: ts.Diagnostics.Modules,
@@ -39443,6 +39471,8 @@ var ts;
39443
39471
  name: "composite",
39444
39472
  type: "boolean",
39445
39473
  affectsEmit: true,
39474
+ affectsMultiFileEmitBuildInfo: true,
39475
+ affectsBundleEmitBuildInfo: true,
39446
39476
  isTSConfigOnly: true,
39447
39477
  category: ts.Diagnostics.Projects,
39448
39478
  transpileOptionValue: undefined,
@@ -39453,6 +39483,8 @@ var ts;
39453
39483
  name: "tsBuildInfoFile",
39454
39484
  type: "string",
39455
39485
  affectsEmit: true,
39486
+ affectsMultiFileEmitBuildInfo: true,
39487
+ affectsBundleEmitBuildInfo: true,
39456
39488
  isFilePath: true,
39457
39489
  paramType: ts.Diagnostics.FILE,
39458
39490
  category: ts.Diagnostics.Projects,
@@ -39464,6 +39496,7 @@ var ts;
39464
39496
  name: "removeComments",
39465
39497
  type: "boolean",
39466
39498
  affectsEmit: true,
39499
+ affectsMultiFileEmitBuildInfo: true,
39467
39500
  showInSimplifiedHelpView: true,
39468
39501
  category: ts.Diagnostics.Emit,
39469
39502
  defaultValueDescription: false,
@@ -39482,6 +39515,7 @@ var ts;
39482
39515
  name: "importHelpers",
39483
39516
  type: "boolean",
39484
39517
  affectsEmit: true,
39518
+ affectsMultiFileEmitBuildInfo: true,
39485
39519
  category: ts.Diagnostics.Emit,
39486
39520
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
39487
39521
  defaultValueDescription: false,
@@ -39495,6 +39529,7 @@ var ts;
39495
39529
  })),
39496
39530
  affectsEmit: true,
39497
39531
  affectsSemanticDiagnostics: true,
39532
+ affectsMultiFileEmitBuildInfo: true,
39498
39533
  category: ts.Diagnostics.Emit,
39499
39534
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
39500
39535
  defaultValueDescription: 0 /* Remove */,
@@ -39503,6 +39538,7 @@ var ts;
39503
39538
  name: "downlevelIteration",
39504
39539
  type: "boolean",
39505
39540
  affectsEmit: true,
39541
+ affectsMultiFileEmitBuildInfo: true,
39506
39542
  category: ts.Diagnostics.Emit,
39507
39543
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
39508
39544
  defaultValueDescription: false,
@@ -39521,6 +39557,9 @@ var ts;
39521
39557
  type: "boolean",
39522
39558
  // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
39523
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,
39524
39563
  showInSimplifiedHelpView: true,
39525
39564
  category: ts.Diagnostics.Type_Checking,
39526
39565
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -39530,6 +39569,7 @@ var ts;
39530
39569
  name: "noImplicitAny",
39531
39570
  type: "boolean",
39532
39571
  affectsSemanticDiagnostics: true,
39572
+ affectsMultiFileEmitBuildInfo: true,
39533
39573
  strictFlag: true,
39534
39574
  category: ts.Diagnostics.Type_Checking,
39535
39575
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -39539,6 +39579,7 @@ var ts;
39539
39579
  name: "strictNullChecks",
39540
39580
  type: "boolean",
39541
39581
  affectsSemanticDiagnostics: true,
39582
+ affectsMultiFileEmitBuildInfo: true,
39542
39583
  strictFlag: true,
39543
39584
  category: ts.Diagnostics.Type_Checking,
39544
39585
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -39547,6 +39588,8 @@ var ts;
39547
39588
  {
39548
39589
  name: "strictFunctionTypes",
39549
39590
  type: "boolean",
39591
+ affectsSemanticDiagnostics: true,
39592
+ affectsMultiFileEmitBuildInfo: true,
39550
39593
  strictFlag: true,
39551
39594
  category: ts.Diagnostics.Type_Checking,
39552
39595
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -39555,6 +39598,8 @@ var ts;
39555
39598
  {
39556
39599
  name: "strictBindCallApply",
39557
39600
  type: "boolean",
39601
+ affectsSemanticDiagnostics: true,
39602
+ affectsMultiFileEmitBuildInfo: true,
39558
39603
  strictFlag: true,
39559
39604
  category: ts.Diagnostics.Type_Checking,
39560
39605
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -39564,6 +39609,7 @@ var ts;
39564
39609
  name: "strictPropertyInitialization",
39565
39610
  type: "boolean",
39566
39611
  affectsSemanticDiagnostics: true,
39612
+ affectsMultiFileEmitBuildInfo: true,
39567
39613
  strictFlag: true,
39568
39614
  category: ts.Diagnostics.Type_Checking,
39569
39615
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -39573,6 +39619,7 @@ var ts;
39573
39619
  name: "noImplicitThis",
39574
39620
  type: "boolean",
39575
39621
  affectsSemanticDiagnostics: true,
39622
+ affectsMultiFileEmitBuildInfo: true,
39576
39623
  strictFlag: true,
39577
39624
  category: ts.Diagnostics.Type_Checking,
39578
39625
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -39582,6 +39629,7 @@ var ts;
39582
39629
  name: "useUnknownInCatchVariables",
39583
39630
  type: "boolean",
39584
39631
  affectsSemanticDiagnostics: true,
39632
+ affectsMultiFileEmitBuildInfo: true,
39585
39633
  strictFlag: true,
39586
39634
  category: ts.Diagnostics.Type_Checking,
39587
39635
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -39591,6 +39639,8 @@ var ts;
39591
39639
  name: "alwaysStrict",
39592
39640
  type: "boolean",
39593
39641
  affectsSourceFile: true,
39642
+ affectsEmit: true,
39643
+ affectsMultiFileEmitBuildInfo: true,
39594
39644
  strictFlag: true,
39595
39645
  category: ts.Diagnostics.Type_Checking,
39596
39646
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -39601,6 +39651,7 @@ var ts;
39601
39651
  name: "noUnusedLocals",
39602
39652
  type: "boolean",
39603
39653
  affectsSemanticDiagnostics: true,
39654
+ affectsMultiFileEmitBuildInfo: true,
39604
39655
  category: ts.Diagnostics.Type_Checking,
39605
39656
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
39606
39657
  defaultValueDescription: false,
@@ -39609,6 +39660,7 @@ var ts;
39609
39660
  name: "noUnusedParameters",
39610
39661
  type: "boolean",
39611
39662
  affectsSemanticDiagnostics: true,
39663
+ affectsMultiFileEmitBuildInfo: true,
39612
39664
  category: ts.Diagnostics.Type_Checking,
39613
39665
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
39614
39666
  defaultValueDescription: false,
@@ -39617,6 +39669,7 @@ var ts;
39617
39669
  name: "exactOptionalPropertyTypes",
39618
39670
  type: "boolean",
39619
39671
  affectsSemanticDiagnostics: true,
39672
+ affectsMultiFileEmitBuildInfo: true,
39620
39673
  category: ts.Diagnostics.Type_Checking,
39621
39674
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
39622
39675
  defaultValueDescription: false,
@@ -39625,6 +39678,7 @@ var ts;
39625
39678
  name: "noImplicitReturns",
39626
39679
  type: "boolean",
39627
39680
  affectsSemanticDiagnostics: true,
39681
+ affectsMultiFileEmitBuildInfo: true,
39628
39682
  category: ts.Diagnostics.Type_Checking,
39629
39683
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
39630
39684
  defaultValueDescription: false,
@@ -39634,6 +39688,7 @@ var ts;
39634
39688
  type: "boolean",
39635
39689
  affectsBindDiagnostics: true,
39636
39690
  affectsSemanticDiagnostics: true,
39691
+ affectsMultiFileEmitBuildInfo: true,
39637
39692
  category: ts.Diagnostics.Type_Checking,
39638
39693
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
39639
39694
  defaultValueDescription: false,
@@ -39642,6 +39697,7 @@ var ts;
39642
39697
  name: "noUncheckedIndexedAccess",
39643
39698
  type: "boolean",
39644
39699
  affectsSemanticDiagnostics: true,
39700
+ affectsMultiFileEmitBuildInfo: true,
39645
39701
  category: ts.Diagnostics.Type_Checking,
39646
39702
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
39647
39703
  defaultValueDescription: false,
@@ -39650,6 +39706,7 @@ var ts;
39650
39706
  name: "noImplicitOverride",
39651
39707
  type: "boolean",
39652
39708
  affectsSemanticDiagnostics: true,
39709
+ affectsMultiFileEmitBuildInfo: true,
39653
39710
  category: ts.Diagnostics.Type_Checking,
39654
39711
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
39655
39712
  defaultValueDescription: false,
@@ -39657,6 +39714,8 @@ var ts;
39657
39714
  {
39658
39715
  name: "noPropertyAccessFromIndexSignature",
39659
39716
  type: "boolean",
39717
+ affectsSemanticDiagnostics: true,
39718
+ affectsMultiFileEmitBuildInfo: true,
39660
39719
  showInSimplifiedHelpView: false,
39661
39720
  category: ts.Diagnostics.Type_Checking,
39662
39721
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -39742,6 +39801,7 @@ var ts;
39742
39801
  name: "allowSyntheticDefaultImports",
39743
39802
  type: "boolean",
39744
39803
  affectsSemanticDiagnostics: true,
39804
+ affectsMultiFileEmitBuildInfo: true,
39745
39805
  category: ts.Diagnostics.Interop_Constraints,
39746
39806
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
39747
39807
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -39751,6 +39811,7 @@ var ts;
39751
39811
  type: "boolean",
39752
39812
  affectsSemanticDiagnostics: true,
39753
39813
  affectsEmit: true,
39814
+ affectsMultiFileEmitBuildInfo: true,
39754
39815
  showInSimplifiedHelpView: true,
39755
39816
  category: ts.Diagnostics.Interop_Constraints,
39756
39817
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -39767,6 +39828,7 @@ var ts;
39767
39828
  name: "allowUmdGlobalAccess",
39768
39829
  type: "boolean",
39769
39830
  affectsSemanticDiagnostics: true,
39831
+ affectsMultiFileEmitBuildInfo: true,
39770
39832
  category: ts.Diagnostics.Modules,
39771
39833
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
39772
39834
  defaultValueDescription: false,
@@ -39788,6 +39850,7 @@ var ts;
39788
39850
  name: "sourceRoot",
39789
39851
  type: "string",
39790
39852
  affectsEmit: true,
39853
+ affectsMultiFileEmitBuildInfo: true,
39791
39854
  paramType: ts.Diagnostics.LOCATION,
39792
39855
  category: ts.Diagnostics.Emit,
39793
39856
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -39796,6 +39859,7 @@ var ts;
39796
39859
  name: "mapRoot",
39797
39860
  type: "string",
39798
39861
  affectsEmit: true,
39862
+ affectsMultiFileEmitBuildInfo: true,
39799
39863
  paramType: ts.Diagnostics.LOCATION,
39800
39864
  category: ts.Diagnostics.Emit,
39801
39865
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -39804,6 +39868,7 @@ var ts;
39804
39868
  name: "inlineSourceMap",
39805
39869
  type: "boolean",
39806
39870
  affectsEmit: true,
39871
+ affectsMultiFileEmitBuildInfo: true,
39807
39872
  category: ts.Diagnostics.Emit,
39808
39873
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
39809
39874
  defaultValueDescription: false,
@@ -39812,6 +39877,7 @@ var ts;
39812
39877
  name: "inlineSources",
39813
39878
  type: "boolean",
39814
39879
  affectsEmit: true,
39880
+ affectsMultiFileEmitBuildInfo: true,
39815
39881
  category: ts.Diagnostics.Emit,
39816
39882
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
39817
39883
  defaultValueDescription: false,
@@ -39821,6 +39887,7 @@ var ts;
39821
39887
  name: "experimentalDecorators",
39822
39888
  type: "boolean",
39823
39889
  affectsSemanticDiagnostics: true,
39890
+ affectsMultiFileEmitBuildInfo: true,
39824
39891
  category: ts.Diagnostics.Language_and_Environment,
39825
39892
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
39826
39893
  defaultValueDescription: false,
@@ -39830,6 +39897,7 @@ var ts;
39830
39897
  type: "boolean",
39831
39898
  affectsSemanticDiagnostics: true,
39832
39899
  affectsEmit: true,
39900
+ affectsMultiFileEmitBuildInfo: true,
39833
39901
  category: ts.Diagnostics.Language_and_Environment,
39834
39902
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
39835
39903
  defaultValueDescription: false,
@@ -39854,6 +39922,7 @@ var ts;
39854
39922
  type: "string",
39855
39923
  affectsSemanticDiagnostics: true,
39856
39924
  affectsEmit: true,
39925
+ affectsMultiFileEmitBuildInfo: true,
39857
39926
  affectsModuleResolution: true,
39858
39927
  category: ts.Diagnostics.Language_and_Environment,
39859
39928
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -39871,6 +39940,9 @@ var ts;
39871
39940
  name: "out",
39872
39941
  type: "string",
39873
39942
  affectsEmit: true,
39943
+ affectsMultiFileEmitBuildInfo: true,
39944
+ affectsDeclarationPath: true,
39945
+ affectsBundleEmitBuildInfo: true,
39874
39946
  isFilePath: false,
39875
39947
  // for correct behaviour, please use outFile
39876
39948
  category: ts.Diagnostics.Backwards_Compatibility,
@@ -39882,6 +39954,7 @@ var ts;
39882
39954
  name: "reactNamespace",
39883
39955
  type: "string",
39884
39956
  affectsEmit: true,
39957
+ affectsMultiFileEmitBuildInfo: true,
39885
39958
  category: ts.Diagnostics.Language_and_Environment,
39886
39959
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
39887
39960
  defaultValueDescription: "`React`",
@@ -39889,6 +39962,8 @@ var ts;
39889
39962
  {
39890
39963
  name: "skipDefaultLibCheck",
39891
39964
  type: "boolean",
39965
+ // We need to store these to determine whether `lib` files need to be rechecked
39966
+ affectsMultiFileEmitBuildInfo: true,
39892
39967
  category: ts.Diagnostics.Completeness,
39893
39968
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
39894
39969
  defaultValueDescription: false,
@@ -39904,6 +39979,7 @@ var ts;
39904
39979
  name: "emitBOM",
39905
39980
  type: "boolean",
39906
39981
  affectsEmit: true,
39982
+ affectsMultiFileEmitBuildInfo: true,
39907
39983
  category: ts.Diagnostics.Emit,
39908
39984
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
39909
39985
  defaultValueDescription: false,
@@ -39915,6 +39991,7 @@ var ts;
39915
39991
  lf: 1 /* LineFeed */
39916
39992
  })),
39917
39993
  affectsEmit: true,
39994
+ affectsMultiFileEmitBuildInfo: true,
39918
39995
  paramType: ts.Diagnostics.NEWLINE,
39919
39996
  category: ts.Diagnostics.Emit,
39920
39997
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -39924,6 +40001,7 @@ var ts;
39924
40001
  name: "noErrorTruncation",
39925
40002
  type: "boolean",
39926
40003
  affectsSemanticDiagnostics: true,
40004
+ affectsMultiFileEmitBuildInfo: true,
39927
40005
  category: ts.Diagnostics.Output_Formatting,
39928
40006
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
39929
40007
  defaultValueDescription: false,
@@ -39954,6 +40032,7 @@ var ts;
39954
40032
  name: "stripInternal",
39955
40033
  type: "boolean",
39956
40034
  affectsEmit: true,
40035
+ affectsMultiFileEmitBuildInfo: true,
39957
40036
  category: ts.Diagnostics.Emit,
39958
40037
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
39959
40038
  defaultValueDescription: false,
@@ -39994,6 +40073,7 @@ var ts;
39994
40073
  name: "noImplicitUseStrict",
39995
40074
  type: "boolean",
39996
40075
  affectsSemanticDiagnostics: true,
40076
+ affectsMultiFileEmitBuildInfo: true,
39997
40077
  category: ts.Diagnostics.Backwards_Compatibility,
39998
40078
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
39999
40079
  defaultValueDescription: false,
@@ -40002,6 +40082,7 @@ var ts;
40002
40082
  name: "noEmitHelpers",
40003
40083
  type: "boolean",
40004
40084
  affectsEmit: true,
40085
+ affectsMultiFileEmitBuildInfo: true,
40005
40086
  category: ts.Diagnostics.Emit,
40006
40087
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
40007
40088
  defaultValueDescription: false,
@@ -40010,6 +40091,7 @@ var ts;
40010
40091
  name: "noEmitOnError",
40011
40092
  type: "boolean",
40012
40093
  affectsEmit: true,
40094
+ affectsMultiFileEmitBuildInfo: true,
40013
40095
  category: ts.Diagnostics.Emit,
40014
40096
  transpileOptionValue: undefined,
40015
40097
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -40019,6 +40101,7 @@ var ts;
40019
40101
  name: "preserveConstEnums",
40020
40102
  type: "boolean",
40021
40103
  affectsEmit: true,
40104
+ affectsMultiFileEmitBuildInfo: true,
40022
40105
  category: ts.Diagnostics.Emit,
40023
40106
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
40024
40107
  defaultValueDescription: false,
@@ -40027,6 +40110,8 @@ var ts;
40027
40110
  name: "declarationDir",
40028
40111
  type: "string",
40029
40112
  affectsEmit: true,
40113
+ affectsMultiFileEmitBuildInfo: true,
40114
+ affectsDeclarationPath: true,
40030
40115
  isFilePath: true,
40031
40116
  paramType: ts.Diagnostics.DIRECTORY,
40032
40117
  category: ts.Diagnostics.Emit,
@@ -40036,6 +40121,8 @@ var ts;
40036
40121
  {
40037
40122
  name: "skipLibCheck",
40038
40123
  type: "boolean",
40124
+ // We need to store these to determine whether `lib` files need to be rechecked
40125
+ affectsMultiFileEmitBuildInfo: true,
40039
40126
  category: ts.Diagnostics.Completeness,
40040
40127
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
40041
40128
  defaultValueDescription: false,
@@ -40045,6 +40132,7 @@ var ts;
40045
40132
  type: "boolean",
40046
40133
  affectsBindDiagnostics: true,
40047
40134
  affectsSemanticDiagnostics: true,
40135
+ affectsMultiFileEmitBuildInfo: true,
40048
40136
  category: ts.Diagnostics.Type_Checking,
40049
40137
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
40050
40138
  defaultValueDescription: undefined,
@@ -40054,6 +40142,7 @@ var ts;
40054
40142
  type: "boolean",
40055
40143
  affectsBindDiagnostics: true,
40056
40144
  affectsSemanticDiagnostics: true,
40145
+ affectsMultiFileEmitBuildInfo: true,
40057
40146
  category: ts.Diagnostics.Type_Checking,
40058
40147
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
40059
40148
  defaultValueDescription: undefined,
@@ -40062,6 +40151,7 @@ var ts;
40062
40151
  name: "suppressExcessPropertyErrors",
40063
40152
  type: "boolean",
40064
40153
  affectsSemanticDiagnostics: true,
40154
+ affectsMultiFileEmitBuildInfo: true,
40065
40155
  category: ts.Diagnostics.Backwards_Compatibility,
40066
40156
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
40067
40157
  defaultValueDescription: false,
@@ -40070,6 +40160,7 @@ var ts;
40070
40160
  name: "suppressImplicitAnyIndexErrors",
40071
40161
  type: "boolean",
40072
40162
  affectsSemanticDiagnostics: true,
40163
+ affectsMultiFileEmitBuildInfo: true,
40073
40164
  category: ts.Diagnostics.Backwards_Compatibility,
40074
40165
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
40075
40166
  defaultValueDescription: false,
@@ -40094,6 +40185,7 @@ var ts;
40094
40185
  name: "noStrictGenericChecks",
40095
40186
  type: "boolean",
40096
40187
  affectsSemanticDiagnostics: true,
40188
+ affectsMultiFileEmitBuildInfo: true,
40097
40189
  category: ts.Diagnostics.Backwards_Compatibility,
40098
40190
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
40099
40191
  defaultValueDescription: false,
@@ -40103,6 +40195,7 @@ var ts;
40103
40195
  type: "boolean",
40104
40196
  affectsSemanticDiagnostics: true,
40105
40197
  affectsEmit: true,
40198
+ affectsMultiFileEmitBuildInfo: true,
40106
40199
  category: ts.Diagnostics.Language_and_Environment,
40107
40200
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
40108
40201
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -40111,6 +40204,7 @@ var ts;
40111
40204
  name: "preserveValueImports",
40112
40205
  type: "boolean",
40113
40206
  affectsEmit: true,
40207
+ affectsMultiFileEmitBuildInfo: true,
40114
40208
  category: ts.Diagnostics.Emit,
40115
40209
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
40116
40210
  defaultValueDescription: false,
@@ -40154,6 +40248,8 @@ var ts;
40154
40248
  /* @internal */
40155
40249
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
40156
40250
  /* @internal */
40251
+ ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
40252
+ /* @internal */
40157
40253
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
40158
40254
  /* @internal */
40159
40255
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -41009,6 +41105,7 @@ var ts;
41009
41105
  return optionDefinition.type;
41010
41106
  }
41011
41107
  }
41108
+ /* @internal */
41012
41109
  function getNameOfCompilerOptionValue(value, customTypeMap) {
41013
41110
  // There is a typeMap associated with this command-line option so use it to map value back to its name
41014
41111
  return ts.forEachEntry(customTypeMap, function (mapValue, key) {
@@ -41017,6 +41114,7 @@ var ts;
41017
41114
  }
41018
41115
  });
41019
41116
  }
41117
+ ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
41020
41118
  function serializeCompilerOptions(options, pathOptions) {
41021
41119
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
41022
41120
  }
@@ -44455,7 +44553,7 @@ var ts;
44455
44553
  return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + moduleName + "\"");
44456
44554
  }
44457
44555
  if (name.kind === 162 /* ComputedPropertyName */) {
44458
- var nameExpression = ts.getComputedPropertyNameExpression(name);
44556
+ var nameExpression = name.expression;
44459
44557
  // treat computed property names where expression is string/numeric literal as just string/numeric literal
44460
44558
  if (ts.isStringOrNumericLiteralLike(nameExpression)) {
44461
44559
  return ts.escapeLeadingUnderscores(nameExpression.text);
@@ -48344,6 +48442,7 @@ var ts;
48344
48442
  var keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
48345
48443
  var numberOrBigIntType = getUnionType([numberType, bigintType]);
48346
48444
  var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
48445
+ var numericStringType = getTemplateLiteralType(["", ""], [numberType]); // The `${number}` type
48347
48446
  var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; });
48348
48447
  var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; });
48349
48448
  var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never"); // `uniqueLiteralType` is a special `never` flagged by union reduction to behave as a literal
@@ -51325,7 +51424,7 @@ var ts;
51325
51424
  }
51326
51425
  }
51327
51426
  function getExportSymbolOfValueSymbolIfExported(symbol) {
51328
- return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 ? symbol.exportSymbol : symbol);
51427
+ return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 && symbol.exportSymbol || symbol);
51329
51428
  }
51330
51429
  function symbolIsValue(symbol) {
51331
51430
  return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */ && !getTypeOnlyAliasDeclaration(symbol));
@@ -58728,7 +58827,7 @@ var ts;
58728
58827
  var typeVariable = getHomomorphicTypeVariable(type);
58729
58828
  if (typeVariable && !type.declaration.nameType) {
58730
58829
  var constraint = getConstraintOfTypeParameter(typeVariable);
58731
- if (constraint && (isArrayType(constraint) || isTupleType(constraint))) {
58830
+ if (constraint && isArrayOrTupleType(constraint)) {
58732
58831
  return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
58733
58832
  }
58734
58833
  }
@@ -59090,10 +59189,10 @@ var ts;
59090
59189
  }
59091
59190
  function isApplicableIndexType(source, target) {
59092
59191
  // A 'string' index signature applies to types assignable to 'string' or 'number', and a 'number' index
59093
- // signature applies to types assignable to 'number' and numeric string literal types.
59192
+ // signature applies to types assignable to 'number', `${number}` and numeric string literal types.
59094
59193
  return isTypeAssignableTo(source, target) ||
59095
59194
  target === stringType && isTypeAssignableTo(source, numberType) ||
59096
- target === numberType && !!(source.flags & 128 /* StringLiteral */) && ts.isNumericLiteralName(source.value);
59195
+ target === numberType && (source === numericStringType || !!(source.flags & 128 /* StringLiteral */) && ts.isNumericLiteralName(source.value));
59097
59196
  }
59098
59197
  function getIndexInfosOfStructuredType(type) {
59099
59198
  if (type.flags & 3670016 /* StructuredType */) {
@@ -60109,6 +60208,20 @@ var ts;
60109
60208
  constraints = ts.append(constraints, constraint);
60110
60209
  }
60111
60210
  }
60211
+ // Given a homomorphic mapped type { [K in keyof T]: XXX }, where T is constrained to an array or tuple type, in the
60212
+ // template type XXX, K has an added constraint of number | `${number}`.
60213
+ else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 195 /* MappedType */ && node === parent.type) {
60214
+ var mappedType = getTypeFromTypeNode(parent);
60215
+ if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
60216
+ var typeParameter = getHomomorphicTypeVariable(mappedType);
60217
+ if (typeParameter) {
60218
+ var constraint = getConstraintOfTypeParameter(typeParameter);
60219
+ if (constraint && everyType(constraint, isArrayOrTupleType)) {
60220
+ constraints = ts.append(constraints, getUnionType([numberType, numericStringType]));
60221
+ }
60222
+ }
60223
+ }
60224
+ }
60112
60225
  node = parent;
60113
60226
  }
60114
60227
  return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type;
@@ -61076,7 +61189,7 @@ var ts;
61076
61189
  while (i > 0) {
61077
61190
  i--;
61078
61191
  var t = types[i];
61079
- var remove = t.flags & 4 /* String */ && includes & 128 /* StringLiteral */ ||
61192
+ var remove = t.flags & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
61080
61193
  t.flags & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
61081
61194
  t.flags & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
61082
61195
  t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */;
@@ -61235,7 +61348,7 @@ var ts;
61235
61348
  if (!strictNullChecks && includes & 98304 /* Nullable */) {
61236
61349
  return includes & 32768 /* Undefined */ ? undefinedType : nullType;
61237
61350
  }
61238
- if (includes & 4 /* String */ && includes & 128 /* StringLiteral */ ||
61351
+ if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
61239
61352
  includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
61240
61353
  includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
61241
61354
  includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */) {
@@ -63119,7 +63232,7 @@ var ts;
63119
63232
  if (!type.declaration.nameType) {
63120
63233
  var constraint = void 0;
63121
63234
  if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 &&
63122
- (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, ts.or(isArrayType, isTupleType))) {
63235
+ (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
63123
63236
  return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
63124
63237
  }
63125
63238
  if (isGenericTupleType(t)) {
@@ -64557,7 +64670,7 @@ var ts;
64557
64670
  }
64558
64671
  return false;
64559
64672
  }
64560
- return isTupleType(target) || isArrayType(target);
64673
+ return isArrayOrTupleType(target);
64561
64674
  }
64562
64675
  if (isReadonlyArrayType(source) && isMutableArrayOrTuple(target)) {
64563
64676
  if (reportErrors) {
@@ -64687,7 +64800,7 @@ var ts;
64687
64800
  // We suppress recursive intersection property checks because they can generate lots of work when relating
64688
64801
  // recursive intersections that are structurally similar but not exactly identical. See #37854.
64689
64802
  if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
64690
- isNonGenericObjectType(target) && !isArrayType(target) && !isTupleType(target) && source.flags & 2097152 /* Intersection */ && getApparentType(source).flags & 3670016 /* StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* NonInferrableType */); }))) {
64803
+ isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* Intersection */ && getApparentType(source).flags & 3670016 /* StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* NonInferrableType */); }))) {
64691
64804
  inPropertyCheck = true;
64692
64805
  result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* PropertyCheck */, recursionFlags);
64693
64806
  inPropertyCheck = false;
@@ -65675,7 +65788,7 @@ var ts;
65675
65788
  return varianceResult;
65676
65789
  }
65677
65790
  }
65678
- else if (isReadonlyArrayType(target) ? isArrayType(source) || isTupleType(source) : isArrayType(target) && isTupleType(source) && !source.target.readonly) {
65791
+ else if (isReadonlyArrayType(target) ? isArrayOrTupleType(source) : isArrayType(target) && isTupleType(source) && !source.target.readonly) {
65679
65792
  if (relation !== identityRelation) {
65680
65793
  return isRelatedTo(getIndexTypeOfType(source, numberType) || anyType, getIndexTypeOfType(target, numberType) || anyType, 3 /* Both */, reportErrors);
65681
65794
  }
@@ -66051,7 +66164,7 @@ var ts;
66051
66164
  }
66052
66165
  var result = -1 /* True */;
66053
66166
  if (isTupleType(target)) {
66054
- if (isArrayType(source) || isTupleType(source)) {
66167
+ if (isArrayOrTupleType(source)) {
66055
66168
  if (!target.target.readonly && (isReadonlyArrayType(source) || isTupleType(source) && source.target.readonly)) {
66056
66169
  return 0 /* False */;
66057
66170
  }
@@ -67012,6 +67125,9 @@ var ts;
67012
67125
  function isReadonlyArrayType(type) {
67013
67126
  return !!(ts.getObjectFlags(type) & 4 /* Reference */) && type.target === globalReadonlyArrayType;
67014
67127
  }
67128
+ function isArrayOrTupleType(type) {
67129
+ return isArrayType(type) || isTupleType(type);
67130
+ }
67015
67131
  function isMutableArrayOrTuple(type) {
67016
67132
  return isArrayType(type) && !isReadonlyArrayType(type) || isTupleType(type) && !type.target.readonly;
67017
67133
  }
@@ -67463,7 +67579,7 @@ var ts;
67463
67579
  else if (type.flags & 2097152 /* Intersection */) {
67464
67580
  result = getIntersectionType(ts.sameMap(type.types, getWidenedType));
67465
67581
  }
67466
- else if (isArrayType(type) || isTupleType(type)) {
67582
+ else if (isArrayOrTupleType(type)) {
67467
67583
  result = createTypeReference(type.target, ts.sameMap(getTypeArguments(type), getWidenedType));
67468
67584
  }
67469
67585
  if (result && context === undefined) {
@@ -67500,7 +67616,7 @@ var ts;
67500
67616
  }
67501
67617
  }
67502
67618
  }
67503
- if (isArrayType(type) || isTupleType(type)) {
67619
+ if (isArrayOrTupleType(type)) {
67504
67620
  for (var _b = 0, _c = getTypeArguments(type); _b < _c.length; _b++) {
67505
67621
  var t = _c[_b];
67506
67622
  if (reportWideningErrorsInType(t)) {
@@ -68561,7 +68677,7 @@ var ts;
68561
68677
  }
68562
68678
  // Infer from the members of source and target only if the two types are possibly related
68563
68679
  if (!typesDefinitelyUnrelated(source, target)) {
68564
- if (isArrayType(source) || isTupleType(source)) {
68680
+ if (isArrayOrTupleType(source)) {
68565
68681
  if (isTupleType(target)) {
68566
68682
  var sourceArity = getTypeReferenceArity(source);
68567
68683
  var targetArity = getTypeReferenceArity(target);
@@ -75582,8 +75698,14 @@ var ts;
75582
75698
  var parameterRange = hasRestParameter ? min
75583
75699
  : min < max ? min + "-" + max
75584
75700
  : min;
75585
- var error = hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1
75586
- : 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
75587
75709
  : ts.Diagnostics.Expected_0_arguments_but_got_1;
75588
75710
  if (min < args.length && args.length < max) {
75589
75711
  // between min and max, but with no matching overload
@@ -109841,7 +109963,8 @@ var ts;
109841
109963
  return;
109842
109964
  }
109843
109965
  var version = ts.version; // Extracted into a const so the form is stable between namespace and module
109844
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), /*writeByteOrderMark*/ false);
109966
+ var buildInfo = { bundle: bundle, program: program, version: version };
109967
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
109845
109968
  }
109846
109969
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
109847
109970
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -109995,13 +110118,18 @@ var ts;
109995
110118
  if (sourceMapFilePath) {
109996
110119
  var sourceMap = sourceMapGenerator.toString();
109997
110120
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110121
+ if (printer.bundleFileInfo)
110122
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
109998
110123
  }
109999
110124
  }
110000
110125
  else {
110001
110126
  writer.writeLine();
110002
110127
  }
110003
110128
  // Write the output file
110004
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110129
+ var text = writer.getText();
110130
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110131
+ if (printer.bundleFileInfo)
110132
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
110005
110133
  // Reset state
110006
110134
  writer.clear();
110007
110135
  }
@@ -110144,34 +110272,54 @@ var ts;
110144
110272
  }
110145
110273
  /*@internal*/
110146
110274
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
110275
+ var createHash = ts.maybeBind(host, host.createHash);
110147
110276
  var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
110148
- var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
110149
- if (!buildInfoText)
110277
+ var buildInfo;
110278
+ if (host.getBuildInfo) {
110279
+ var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
110280
+ if (!hostBuildInfo)
110281
+ return buildInfoPath;
110282
+ buildInfo = hostBuildInfo;
110283
+ }
110284
+ else {
110285
+ var buildInfoText = host.readFile(buildInfoPath);
110286
+ if (!buildInfoText)
110287
+ return buildInfoPath;
110288
+ buildInfo = getBuildInfo(buildInfoText);
110289
+ }
110290
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
110150
110291
  return buildInfoPath;
110151
110292
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
110152
110293
  if (!jsFileText)
110153
110294
  return jsFilePath;
110295
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
110296
+ return jsFilePath;
110154
110297
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
110155
110298
  // error if no source map or for now if inline sourcemap
110156
110299
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
110157
110300
  return sourceMapFilePath || "inline sourcemap decoding";
110301
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
110302
+ return sourceMapFilePath;
110158
110303
  // read declaration text
110159
110304
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
110160
110305
  if (declarationFilePath && !declarationText)
110161
110306
  return declarationFilePath;
110307
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
110308
+ return declarationFilePath;
110162
110309
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
110163
110310
  // error if no source map or for now if inline sourcemap
110164
110311
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
110165
110312
  return declarationMapPath || "inline sourcemap decoding";
110166
- var buildInfo = getBuildInfo(buildInfoText);
110167
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
110168
- return buildInfoPath;
110313
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
110314
+ return declarationMapPath;
110169
110315
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110170
110316
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
110171
110317
  /*onlyOwnText*/ true);
110172
110318
  var outputFiles = [];
110173
110319
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
110174
110320
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
110321
+ var changedDtsText;
110322
+ var changedDtsData;
110175
110323
  var emitHost = {
110176
110324
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
110177
110325
  getCanonicalFileName: host.getCanonicalFileName,
@@ -110187,7 +110335,7 @@ var ts;
110187
110335
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
110188
110336
  getProjectReferenceRedirect: ts.returnUndefined,
110189
110337
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
110190
- writeFile: function (name, text, writeByteOrderMark) {
110338
+ writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
110191
110339
  switch (name) {
110192
110340
  case jsFilePath:
110193
110341
  if (jsFileText === text)
@@ -110198,8 +110346,13 @@ var ts;
110198
110346
  return;
110199
110347
  break;
110200
110348
  case buildInfoPath:
110201
- var newBuildInfo = getBuildInfo(text);
110349
+ var newBuildInfo = data.buildInfo;
110202
110350
  newBuildInfo.program = buildInfo.program;
110351
+ if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
110352
+ // Update the output signature
110353
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
110354
+ newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
110355
+ }
110203
110356
  // Update sourceFileInfo
110204
110357
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
110205
110358
  newBuildInfo.bundle.js.sources = js.sources;
@@ -110207,11 +110360,13 @@ var ts;
110207
110360
  newBuildInfo.bundle.dts.sources = dts.sources;
110208
110361
  }
110209
110362
  newBuildInfo.bundle.sourceFiles = sourceFiles;
110210
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
110363
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
110211
110364
  return;
110212
110365
  case declarationFilePath:
110213
110366
  if (declarationText === text)
110214
110367
  return;
110368
+ changedDtsText = text;
110369
+ changedDtsData = data;
110215
110370
  break;
110216
110371
  case declarationMapPath:
110217
110372
  if (declarationMapText === text)
@@ -110230,6 +110385,7 @@ var ts;
110230
110385
  getSourceFileFromReference: ts.returnUndefined,
110231
110386
  redirectTargetsMap: ts.createMultiMap(),
110232
110387
  getFileIncludeReasons: ts.notImplemented,
110388
+ createHash: createHash,
110233
110389
  };
110234
110390
  emitFiles(ts.notImplementedResolver, emitHost,
110235
110391
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
@@ -115314,12 +115470,10 @@ var ts;
115314
115470
  }
115315
115471
  ts.createCompilerHost = createCompilerHost;
115316
115472
  /*@internal*/
115317
- // TODO(shkamat): update this after reworking ts build API
115318
115473
  function createCompilerHostWorker(options, setParentNodes, system) {
115319
115474
  if (system === void 0) { system = ts.sys; }
115320
115475
  var existingDirectories = new ts.Map();
115321
115476
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
115322
- var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
115323
115477
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
115324
115478
  var text;
115325
115479
  try {
@@ -115352,7 +115506,7 @@ var ts;
115352
115506
  // NOTE: If patchWriteFileEnsuringDirectory has been called,
115353
115507
  // the system.writeFile will do its own directory creation and
115354
115508
  // the ensureDirectoriesExist call will always be redundant.
115355
- 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); });
115509
+ 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); });
115356
115510
  ts.performance.mark("afterIOWrite");
115357
115511
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
115358
115512
  }
@@ -115362,35 +115516,6 @@ var ts;
115362
115516
  }
115363
115517
  }
115364
115518
  }
115365
- var outputFingerprints;
115366
- function writeFileWorker(fileName, data, writeByteOrderMark) {
115367
- if (!ts.isWatchSet(options) || !system.getModifiedTime) {
115368
- system.writeFile(fileName, data, writeByteOrderMark);
115369
- return;
115370
- }
115371
- if (!outputFingerprints) {
115372
- outputFingerprints = new ts.Map();
115373
- }
115374
- var hash = computeHash(data);
115375
- var mtimeBefore = system.getModifiedTime(fileName);
115376
- if (mtimeBefore) {
115377
- var fingerprint = outputFingerprints.get(fileName);
115378
- // If output has not been changed, and the file has no external modification
115379
- if (fingerprint &&
115380
- fingerprint.byteOrderMark === writeByteOrderMark &&
115381
- fingerprint.hash === hash &&
115382
- fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
115383
- return;
115384
- }
115385
- }
115386
- system.writeFile(fileName, data, writeByteOrderMark);
115387
- var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
115388
- outputFingerprints.set(fileName, {
115389
- hash: hash,
115390
- byteOrderMark: writeByteOrderMark,
115391
- mtime: mtimeAfter
115392
- });
115393
- }
115394
115519
  function getDefaultLibLocation() {
115395
115520
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
115396
115521
  }
@@ -116942,6 +117067,7 @@ var ts;
116942
117067
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
116943
117068
  redirectTargetsMap: redirectTargetsMap,
116944
117069
  getFileIncludeReasons: program.getFileIncludeReasons,
117070
+ createHash: ts.maybeBind(host, host.createHash),
116945
117071
  };
116946
117072
  }
116947
117073
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -119055,13 +119181,9 @@ var ts;
119055
119181
  function createManyToManyPathMap() {
119056
119182
  function create(forward, reverse, deleted) {
119057
119183
  var map = {
119058
- clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119059
- forEach: function (fn) { return forward.forEach(fn); },
119060
119184
  getKeys: function (v) { return reverse.get(v); },
119061
119185
  getValues: function (k) { return forward.get(k); },
119062
- hasKey: function (k) { return forward.has(k); },
119063
119186
  keys: function () { return forward.keys(); },
119064
- deletedKeys: function () { return deleted; },
119065
119187
  deleteKey: function (k) {
119066
119188
  (deleted || (deleted = new ts.Set())).add(k);
119067
119189
  var set = forward.get(k);
@@ -119088,11 +119210,6 @@ var ts;
119088
119210
  });
119089
119211
  return map;
119090
119212
  },
119091
- clear: function () {
119092
- forward.clear();
119093
- reverse.clear();
119094
- deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119095
- }
119096
119213
  };
119097
119214
  return map;
119098
119215
  }
@@ -119220,18 +119337,21 @@ var ts;
119220
119337
  * Creates the state of file references and signature for the new program from oldState if it is safe
119221
119338
  */
119222
119339
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119340
+ var _a, _b, _c;
119223
119341
  var fileInfos = new ts.Map();
119224
119342
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
119225
119343
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
119226
- var hasCalledUpdateShapeSignature = new ts.Set();
119227
119344
  var useOldState = canReuseOldState(referencedMap, oldState);
119228
119345
  // Ensure source files have parent pointers set
119229
119346
  newProgram.getTypeChecker();
119230
119347
  // Create the reference map, and set the file infos
119231
- for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
119232
- var sourceFile = _a[_i];
119348
+ for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
119349
+ var sourceFile = _d[_i];
119233
119350
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
119234
- var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
119351
+ var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
119352
+ var signature = oldUncommitedSignature === undefined ?
119353
+ useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
119354
+ oldUncommitedSignature || undefined;
119235
119355
  if (referencedMap) {
119236
119356
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
119237
119357
  if (newReferences) {
@@ -119239,19 +119359,26 @@ var ts;
119239
119359
  }
119240
119360
  // Copy old visible to outside files map
119241
119361
  if (useOldState) {
119242
- var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
119362
+ var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
119363
+ var exportedModules = oldUncommitedExportedModules === undefined ?
119364
+ oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
119365
+ oldUncommitedExportedModules || undefined;
119243
119366
  if (exportedModules) {
119244
119367
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119245
119368
  }
119246
119369
  }
119247
119370
  }
119248
- fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
119371
+ fileInfos.set(sourceFile.resolvedPath, {
119372
+ version: version_2,
119373
+ signature: signature,
119374
+ affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
119375
+ impliedFormat: sourceFile.impliedNodeFormat
119376
+ });
119249
119377
  }
119250
119378
  return {
119251
119379
  fileInfos: fileInfos,
119252
119380
  referencedMap: referencedMap,
119253
119381
  exportedModulesMap: exportedModulesMap,
119254
- hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
119255
119382
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
119256
119383
  };
119257
119384
  }
@@ -119265,71 +119392,42 @@ var ts;
119265
119392
  }
119266
119393
  BuilderState.releaseCache = releaseCache;
119267
119394
  /**
119268
- * Creates a clone of the state
119395
+ * Gets the files affected by the path from the program
119269
119396
  */
119270
- function clone(state) {
119397
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
119271
119398
  var _a, _b;
119272
- // Dont need to backup allFiles info since its cache anyway
119273
- return {
119274
- fileInfos: new ts.Map(state.fileInfos),
119275
- referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
119276
- exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
119277
- hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
119278
- useFileVersionAsSignature: state.useFileVersionAsSignature,
119279
- };
119399
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
119400
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119401
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119402
+ return result;
119280
119403
  }
119281
- BuilderState.clone = clone;
119282
- /**
119283
- * Gets the files affected by the path from the program
119284
- */
119285
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
119286
- // Since the operation could be cancelled, the signatures are always stored in the cache
119287
- // They will be committed once it is safe to use them
119288
- // eg when calling this api from tsserver, if there is no cancellation of the operation
119289
- // In the other cases the affected files signatures are committed only after the iteration through the result is complete
119290
- var signatureCache = cacheToUpdateSignature || new ts.Map();
119404
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119405
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
119291
119406
  var sourceFile = programOfThisState.getSourceFileByPath(path);
119292
119407
  if (!sourceFile) {
119293
119408
  return ts.emptyArray;
119294
119409
  }
119295
- if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
119410
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
119296
119411
  return [sourceFile];
119297
119412
  }
119298
- var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
119299
- if (!cacheToUpdateSignature) {
119300
- // Commit all the signatures in the signature cache
119301
- updateSignaturesFromCache(state, signatureCache);
119302
- }
119303
- return result;
119413
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
119304
119414
  }
119305
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119306
- /**
119307
- * Updates the signatures from the cache into state's fileinfo signatures
119308
- * This should be called whenever it is safe to commit the state of the builder
119309
- */
119310
- function updateSignaturesFromCache(state, signatureCache) {
119311
- signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
119312
- }
119313
- BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
119415
+ BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
119314
119416
  function updateSignatureOfFile(state, signature, path) {
119315
119417
  state.fileInfos.get(path).signature = signature;
119316
- state.hasCalledUpdateShapeSignature.add(path);
119418
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
119317
119419
  }
119318
119420
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
119319
119421
  /**
119320
119422
  * Returns if the shape of the signature has changed since last emit
119321
119423
  */
119322
- function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
119424
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
119425
+ var _a;
119323
119426
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
119324
- ts.Debug.assert(!!sourceFile);
119325
- ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
119326
119427
  // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
119327
- if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
119428
+ if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
119328
119429
  return false;
119329
- }
119330
119430
  var info = state.fileInfos.get(sourceFile.resolvedPath);
119331
- if (!info)
119332
- return ts.Debug.fail();
119333
119431
  var prevSignature = info.signature;
119334
119432
  var latestSignature;
119335
119433
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -119340,45 +119438,55 @@ var ts;
119340
119438
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119341
119439
  if (firstDts_1) {
119342
119440
  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; })); });
119343
- latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119344
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119345
- updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
119441
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
119442
+ if (latestSignature !== prevSignature) {
119443
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
119346
119444
  }
119347
119445
  }
119348
119446
  }
119349
119447
  // Default is to use file version as signature
119350
119448
  if (latestSignature === undefined) {
119351
119449
  latestSignature = sourceFile.version;
119352
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119450
+ if (state.exportedModulesMap && latestSignature !== prevSignature) {
119451
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119353
119452
  // All the references in this file are exported
119354
119453
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
119355
119454
  if (references) {
119356
- exportedModulesMapCache.set(sourceFile.resolvedPath, references);
119455
+ state.exportedModulesMap.set(sourceFile.resolvedPath, references);
119357
119456
  }
119358
119457
  else {
119359
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119458
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119360
119459
  }
119361
119460
  }
119362
119461
  }
119363
- cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
119462
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
119463
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
119464
+ info.signature = latestSignature;
119364
119465
  return latestSignature !== prevSignature;
119365
119466
  }
119366
119467
  BuilderState.updateShapeSignature = updateShapeSignature;
119468
+ function computeSignature(text, computeHash) {
119469
+ return (computeHash || ts.generateDjb2Hash)(text);
119470
+ }
119471
+ BuilderState.computeSignature = computeSignature;
119367
119472
  /**
119368
119473
  * Coverts the declaration emit result into exported modules map
119369
119474
  */
119370
- function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
119475
+ function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
119476
+ if (!state.exportedModulesMap)
119477
+ return;
119478
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119371
119479
  if (!exportedModulesFromDeclarationEmit) {
119372
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119480
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119373
119481
  return;
119374
119482
  }
119375
119483
  var exportedModules;
119376
119484
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
119377
119485
  if (exportedModules) {
119378
- exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
119486
+ state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119379
119487
  }
119380
119488
  else {
119381
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119489
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119382
119490
  }
119383
119491
  function addExportedModule(exportedModulePaths) {
119384
119492
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -119390,19 +119498,6 @@ var ts;
119390
119498
  }
119391
119499
  }
119392
119500
  BuilderState.updateExportedModules = updateExportedModules;
119393
- /**
119394
- * Updates the exported modules from cache into state's exported modules map
119395
- * This should be called whenever it is safe to commit the state of the builder
119396
- */
119397
- function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
119398
- var _a;
119399
- if (exportedModulesMapCache) {
119400
- ts.Debug.assert(!!state.exportedModulesMap);
119401
- (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
119402
- exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
119403
- }
119404
- }
119405
- BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
119406
119501
  /**
119407
119502
  * Get all the dependencies of the sourceFile
119408
119503
  */
@@ -119523,7 +119618,7 @@ var ts;
119523
119618
  /**
119524
119619
  * When program emits modular code, gets the files affected by the sourceFile whose shape has changed
119525
119620
  */
119526
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
119621
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
119527
119622
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
119528
119623
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
119529
119624
  }
@@ -119543,7 +119638,7 @@ var ts;
119543
119638
  if (!seenFileNamesMap.has(currentPath)) {
119544
119639
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
119545
119640
  seenFileNamesMap.set(currentPath, currentSourceFile);
119546
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
119641
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
119547
119642
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
119548
119643
  }
119549
119644
  }
@@ -119569,32 +119664,33 @@ var ts;
119569
119664
  * Create the state so that we can iterate on changedFiles/affected files
119570
119665
  */
119571
119666
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119667
+ var _a, _b;
119572
119668
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
119573
119669
  state.program = newProgram;
119574
119670
  var compilerOptions = newProgram.getCompilerOptions();
119575
119671
  state.compilerOptions = compilerOptions;
119672
+ var outFilePath = ts.outFile(compilerOptions);
119576
119673
  // With --out or --outFile, any change affects all semantic diagnostics so no need to cache them
119577
- if (!ts.outFile(compilerOptions)) {
119674
+ if (!outFilePath) {
119578
119675
  state.semanticDiagnosticsPerFile = new ts.Map();
119579
119676
  }
119677
+ 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)) {
119678
+ state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
119679
+ }
119580
119680
  state.changedFilesSet = new ts.Set();
119681
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
119581
119682
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
119582
119683
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
119583
119684
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
119584
119685
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
119686
+ var canCopyEmitSignatures = compilerOptions.composite &&
119687
+ (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
119688
+ !outFilePath &&
119689
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
119585
119690
  if (useOldState) {
119586
- // Verify the sanity of old state
119587
- if (!oldState.currentChangedFilePath) {
119588
- var affectedSignatures = oldState.currentAffectedFilesSignatures;
119589
- ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
119590
- }
119591
- var changedFilesSet = oldState.changedFilesSet;
119592
- if (canCopySemanticDiagnostics) {
119593
- ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
119594
- }
119595
119691
  // Copy old state's changed files set
119596
- changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
119597
- if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
119692
+ (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
119693
+ if (!outFilePath && oldState.affectedFilesPendingEmit) {
119598
119694
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
119599
119695
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
119600
119696
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -119615,6 +119711,8 @@ var ts;
119615
119711
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
119616
119712
  // versions dont match
119617
119713
  oldInfo.version !== info.version ||
119714
+ // Implied formats dont match
119715
+ oldInfo.impliedFormat !== info.impliedFormat ||
119618
119716
  // Referenced files changed
119619
119717
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
119620
119718
  // Referenced file was deleted in the new program
@@ -119638,27 +119736,25 @@ var ts;
119638
119736
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
119639
119737
  }
119640
119738
  }
119739
+ if (canCopyEmitSignatures) {
119740
+ var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
119741
+ if (oldEmitSignature)
119742
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
119743
+ }
119641
119744
  });
119642
119745
  // If the global file is removed, add all files as changed
119643
119746
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
119644
119747
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, /*firstSourceFile*/ undefined)
119645
119748
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
119646
119749
  }
119647
- else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
119750
+ else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
119648
119751
  // Add all files to affectedFilesPendingEmit since emit changed
119649
119752
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1 /* Full */); });
119650
119753
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
119651
119754
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
119652
119755
  }
119653
- if (useOldState) {
119654
- // Any time the interpretation of a source file changes, mark it as changed
119655
- ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
119656
- if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
119657
- state.changedFilesSet.add(sourceFilePath);
119658
- }
119659
- });
119660
- }
119661
- state.buildInfoEmitPending = !!state.changedFilesSet.size;
119756
+ // Since old states change files set is copied, any additional change means we would need to emit build info
119757
+ state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
119662
119758
  return state;
119663
119759
  }
119664
119760
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -119694,30 +119790,35 @@ var ts;
119694
119790
  ts.BuilderState.releaseCache(state);
119695
119791
  state.program = undefined;
119696
119792
  }
119697
- /**
119698
- * Creates a clone of the state
119699
- */
119700
- function cloneBuilderProgramState(state) {
119701
- var _a;
119702
- var newState = ts.BuilderState.clone(state);
119703
- newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
119704
- newState.changedFilesSet = new ts.Set(state.changedFilesSet);
119705
- newState.affectedFiles = state.affectedFiles;
119706
- newState.affectedFilesIndex = state.affectedFilesIndex;
119707
- newState.currentChangedFilePath = state.currentChangedFilePath;
119708
- newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
119709
- newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
119710
- newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
119711
- newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
119712
- newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
119713
- newState.program = state.program;
119714
- newState.compilerOptions = state.compilerOptions;
119715
- newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
119716
- newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
119717
- newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
119718
- newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
119719
- newState.programEmitComplete = state.programEmitComplete;
119720
- return newState;
119793
+ function backupEmitBuilderProgramState(state) {
119794
+ var outFilePath = ts.outFile(state.compilerOptions);
119795
+ // Only in --out changeFileSet is kept around till emit
119796
+ ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
119797
+ return {
119798
+ affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
119799
+ affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
119800
+ affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
119801
+ seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
119802
+ programEmitComplete: state.programEmitComplete,
119803
+ emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
119804
+ outSignature: state.outSignature,
119805
+ dtsChangeTime: state.dtsChangeTime,
119806
+ hasChangedEmitSignature: state.hasChangedEmitSignature,
119807
+ changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
119808
+ };
119809
+ }
119810
+ function restoreEmitBuilderProgramState(state, backupEmitState) {
119811
+ state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
119812
+ state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
119813
+ state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
119814
+ state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
119815
+ state.programEmitComplete = backupEmitState.programEmitComplete;
119816
+ state.emitSignatures = backupEmitState.emitSignatures;
119817
+ state.outSignature = backupEmitState.outSignature;
119818
+ state.dtsChangeTime = backupEmitState.dtsChangeTime;
119819
+ state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
119820
+ if (backupEmitState.changedFilesSet)
119821
+ state.changedFilesSet = backupEmitState.changedFilesSet;
119721
119822
  }
119722
119823
  /**
119723
119824
  * Verifies that source file is ok to be used in calls that arent handled by next
@@ -119732,7 +119833,7 @@ var ts;
119732
119833
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
119733
119834
  */
119734
119835
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
119735
- var _a;
119836
+ var _a, _b;
119736
119837
  while (true) {
119737
119838
  var affectedFiles = state.affectedFiles;
119738
119839
  if (affectedFiles) {
@@ -119752,10 +119853,8 @@ var ts;
119752
119853
  state.changedFilesSet.delete(state.currentChangedFilePath);
119753
119854
  state.currentChangedFilePath = undefined;
119754
119855
  // Commit the changes in file signature
119755
- ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
119756
- state.currentAffectedFilesSignatures.clear();
119757
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
119758
- (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
119856
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119857
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119759
119858
  state.affectedFiles = undefined;
119760
119859
  }
119761
119860
  // Get next changed file
@@ -119773,12 +119872,7 @@ var ts;
119773
119872
  return program;
119774
119873
  }
119775
119874
  // Get next batch of affected files
119776
- if (!state.currentAffectedFilesSignatures)
119777
- state.currentAffectedFilesSignatures = new ts.Map();
119778
- if (state.exportedModulesMap) {
119779
- state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
119780
- }
119781
- state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
119875
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
119782
119876
  state.currentChangedFilePath = nextKey.value;
119783
119877
  state.affectedFilesIndex = 0;
119784
119878
  if (!state.seenAffectedFiles)
@@ -119830,7 +119924,6 @@ var ts;
119830
119924
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
119831
119925
  */
119832
119926
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
119833
- var _a;
119834
119927
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
119835
119928
  // If affected files is everything except default library, then nothing more to do
119836
119929
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -119838,10 +119931,9 @@ var ts;
119838
119931
  // When a change affects the global scope, all files are considered to be affected without updating their signature
119839
119932
  // That means when affected file is handled, its signature can be out of date
119840
119933
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
119841
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
119934
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
119842
119935
  return;
119843
119936
  }
119844
- 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);
119845
119937
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
119846
119938
  return;
119847
119939
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -119861,7 +119953,7 @@ var ts;
119861
119953
  // This ensures that we dont later during incremental builds considering wrong signature.
119862
119954
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
119863
119955
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
119864
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
119956
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
119865
119957
  // If not dts emit, nothing more to do
119866
119958
  if (ts.getEmitDeclarations(state.compilerOptions)) {
119867
119959
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -119882,27 +119974,10 @@ var ts;
119882
119974
  return !state.semanticDiagnosticsFromOldState.size;
119883
119975
  }
119884
119976
  function isChangedSignature(state, path) {
119885
- var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
119886
- var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
119977
+ var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
119978
+ var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
119887
119979
  return newSignature !== oldSignature;
119888
119980
  }
119889
- function forEachKeyOfExportedModulesMap(state, filePath, fn) {
119890
- // Go through exported modules from cache first
119891
- var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
119892
- var result = keys && ts.forEachKey(keys, fn);
119893
- if (result)
119894
- return result;
119895
- // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
119896
- keys = state.exportedModulesMap.getKeys(filePath);
119897
- return keys && ts.forEachKey(keys, function (exportedFromPath) {
119898
- var _a;
119899
- // If the cache had an updated value, skip
119900
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
119901
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
119902
- fn(exportedFromPath) :
119903
- undefined;
119904
- });
119905
- }
119906
119981
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
119907
119982
  var _a;
119908
119983
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -119917,6 +119992,7 @@ var ts;
119917
119992
  * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
119918
119993
  */
119919
119994
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
119995
+ var _a;
119920
119996
  // If there was change in signature (dts output) for the changed file,
119921
119997
  // then only we need to handle pending file emit
119922
119998
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
@@ -119943,11 +120019,10 @@ var ts;
119943
120019
  }
119944
120020
  }
119945
120021
  }
119946
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
119947
120022
  var seenFileAndExportsOfFile = new ts.Set();
119948
120023
  // Go through exported modules from cache first
119949
120024
  // If exported modules has path, all files referencing file exported from are affected
119950
- forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
120025
+ (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
119951
120026
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
119952
120027
  return true;
119953
120028
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -119961,19 +120036,18 @@ var ts;
119961
120036
  * return true when all work is done and we can exit handling dts emit and semantic diagnostics
119962
120037
  */
119963
120038
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
119964
- var _a;
120039
+ var _a, _b;
119965
120040
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
119966
120041
  return undefined;
119967
120042
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
119968
120043
  return true;
119969
120044
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
119970
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
119971
120045
  // If exported modules has path, all files referencing file exported from are affected
119972
- forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
120046
+ (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
119973
120047
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
119974
120048
  });
119975
120049
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
119976
- (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
120050
+ (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
119977
120051
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
119978
120052
  handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
119979
120053
  state, referencingFilePath, cancellationToken, computeHash, host);
@@ -119994,12 +120068,13 @@ var ts;
119994
120068
  }
119995
120069
  else {
119996
120070
  state.seenAffectedFiles.add(affected.resolvedPath);
120071
+ // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted
120072
+ state.buildInfoEmitPending = true;
119997
120073
  if (emitKind !== undefined) {
119998
120074
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
119999
120075
  }
120000
120076
  if (isPendingEmit) {
120001
120077
  state.affectedFilesPendingEmitIndex++;
120002
- state.buildInfoEmitPending = true;
120003
120078
  }
120004
120079
  else {
120005
120080
  state.affectedFilesIndex++;
@@ -120050,22 +120125,43 @@ var ts;
120050
120125
  /**
120051
120126
  * Gets the program information to be emitted in buildInfo so that we can use it to create new program
120052
120127
  */
120053
- function getProgramBuildInfo(state, getCanonicalFileName) {
120054
- if (ts.outFile(state.compilerOptions))
120055
- return undefined;
120128
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
120129
+ var outFilePath = ts.outFile(state.compilerOptions);
120130
+ if (outFilePath && !state.compilerOptions.composite)
120131
+ return;
120056
120132
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
120057
120133
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
120134
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
120135
+ if (outFilePath) {
120136
+ var result_15 = {
120137
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
120138
+ outSignature: state.outSignature,
120139
+ dtsChangeTime: state.dtsChangeTime,
120140
+ };
120141
+ return result_15;
120142
+ }
120058
120143
  var fileNames = [];
120059
120144
  var fileNameToFileId = new ts.Map();
120060
120145
  var fileIdsList;
120061
120146
  var fileNamesToFileIdListId;
120147
+ var emitSignatures;
120062
120148
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
120149
+ var _b, _c;
120063
120150
  var key = _a[0], value = _a[1];
120064
120151
  // Ensure fileId
120065
120152
  var fileId = toFileId(key);
120066
120153
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
120067
- var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120068
- var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120154
+ var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
120155
+ var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
120156
+ if (state.compilerOptions.composite) {
120157
+ var file = state.program.getSourceFileByPath(key);
120158
+ if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
120159
+ var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
120160
+ if (emitSignature !== actualSignature) {
120161
+ (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
120162
+ }
120163
+ }
120164
+ }
120069
120165
  return value.version === actualSignature ?
120070
120166
  value.affectsGlobalScope || value.impliedFormat ?
120071
120167
  // If file version is same as signature, dont serialize signature
@@ -120073,11 +120169,11 @@ var ts;
120073
120169
  // If file info only contains version and signature and both are same we can just write string
120074
120170
  value.version :
120075
120171
  actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120076
- signature === undefined ?
120172
+ oldSignature === undefined ?
120077
120173
  // If we havent computed signature, use fileInfo as is
120078
120174
  value :
120079
120175
  // Serialize fileInfo with new updated signature
120080
- { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120176
+ { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120081
120177
  // Signature of the FileInfo is undefined, serialize it as false
120082
120178
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120083
120179
  });
@@ -120092,17 +120188,13 @@ var ts;
120092
120188
  if (state.exportedModulesMap) {
120093
120189
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
120094
120190
  var _a;
120095
- if (state.currentAffectedFilesExportedModulesMap) {
120096
- if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
120097
- return undefined;
120098
- }
120099
- var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
120100
- if (newValue) {
120101
- return [toFileId(key), toFileIdListId(newValue)];
120102
- }
120103
- }
120191
+ var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
120104
120192
  // Not in temporary cache, use existing value
120105
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120193
+ if (oldValue === undefined)
120194
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120195
+ if (oldValue)
120196
+ return [toFileId(key), toFileIdListId(oldValue)];
120197
+ return undefined;
120106
120198
  });
120107
120199
  }
120108
120200
  var semanticDiagnosticsPerFile;
@@ -120113,9 +120205,7 @@ var ts;
120113
120205
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
120114
120206
  [
120115
120207
  toFileId(key),
120116
- state.hasReusableDiagnostic ?
120117
- value :
120118
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120208
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
120119
120209
  ] :
120120
120210
  toFileId(key));
120121
120211
  }
@@ -120130,16 +120220,27 @@ var ts;
120130
120220
  }
120131
120221
  }
120132
120222
  }
120133
- return {
120223
+ var changeFileSet;
120224
+ if (state.changedFilesSet.size) {
120225
+ for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
120226
+ var path = _e[_d];
120227
+ (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120228
+ }
120229
+ }
120230
+ var result = {
120134
120231
  fileNames: fileNames,
120135
120232
  fileInfos: fileInfos,
120136
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
120233
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
120137
120234
  fileIdsList: fileIdsList,
120138
120235
  referencedMap: referencedMap,
120139
120236
  exportedModulesMap: exportedModulesMap,
120140
120237
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
120141
120238
  affectedFilesPendingEmit: affectedFilesPendingEmit,
120239
+ changeFileSet: changeFileSet,
120240
+ emitSignatures: emitSignatures,
120241
+ dtsChangeTime: state.dtsChangeTime,
120142
120242
  };
120243
+ return result;
120143
120244
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
120144
120245
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
120145
120246
  }
@@ -120164,24 +120265,18 @@ var ts;
120164
120265
  }
120165
120266
  return fileIdListId;
120166
120267
  }
120167
- }
120168
- function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
120169
- var result;
120170
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120171
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120172
- var name = _a[_i];
120173
- var optionKey = name.toLowerCase();
120174
- var optionInfo = optionsNameMap.get(optionKey);
120175
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
120176
- // We need to store `strict`, even though it won't be examined directly, so that the
120177
- // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
120178
- optionKey === "strict" ||
120179
- // We need to store these to determine whether `lib` files need to be rechecked.
120180
- optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
120181
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
120268
+ function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
120269
+ var result;
120270
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120271
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120272
+ var name = _a[_i];
120273
+ var optionInfo = optionsNameMap.get(name.toLowerCase());
120274
+ if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
120275
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
120276
+ }
120182
120277
  }
120278
+ return result;
120183
120279
  }
120184
- return result;
120185
120280
  }
120186
120281
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120187
120282
  if (option) {
@@ -120255,6 +120350,10 @@ var ts;
120255
120350
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
120256
120351
  }
120257
120352
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
120353
+ function computeSignature(text, data, computeHash) {
120354
+ return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
120355
+ }
120356
+ ts.computeSignature = computeSignature;
120258
120357
  function createBuilderProgram(kind, _a) {
120259
120358
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
120260
120359
  // Return same program if underlying program doesnt change
@@ -120273,8 +120372,8 @@ var ts;
120273
120372
  */
120274
120373
  var computeHash = ts.maybeBind(host, host.createHash);
120275
120374
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
120276
- var backupState;
120277
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
120375
+ var backupEmitState;
120376
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
120278
120377
  // To ensure that we arent storing any references to old program or new program without state
120279
120378
  newProgram = undefined; // TODO: GH#18217
120280
120379
  oldProgram = undefined;
@@ -120282,20 +120381,20 @@ var ts;
120282
120381
  var getState = function () { return state; };
120283
120382
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
120284
120383
  builderProgram.getState = getState;
120285
- builderProgram.backupState = function () {
120286
- ts.Debug.assert(backupState === undefined);
120287
- backupState = cloneBuilderProgramState(state);
120384
+ builderProgram.backupEmitState = function () {
120385
+ ts.Debug.assert(backupEmitState === undefined);
120386
+ backupEmitState = backupEmitBuilderProgramState(state);
120288
120387
  };
120289
- builderProgram.restoreState = function () {
120290
- state = ts.Debug.checkDefined(backupState);
120291
- backupState = undefined;
120388
+ builderProgram.restoreEmitState = function () {
120389
+ restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
120390
+ backupEmitState = undefined;
120292
120391
  };
120293
120392
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
120294
120393
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
120295
120394
  builderProgram.emit = emit;
120296
120395
  builderProgram.releaseProgram = function () {
120297
120396
  releaseCache(state);
120298
- backupState = undefined;
120397
+ backupEmitState = undefined;
120299
120398
  };
120300
120399
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
120301
120400
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -120354,35 +120453,59 @@ var ts;
120354
120453
  return toAffectedFileEmitResult(state,
120355
120454
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
120356
120455
  // Otherwise just affected file
120357
- ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120358
- getWriteFileUpdatingSignatureCallback(writeFile) :
120456
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
120457
+ getWriteFileCallback(writeFile, customTransformers) :
120359
120458
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
120360
120459
  }
120361
- function getWriteFileUpdatingSignatureCallback(writeFile) {
120460
+ function getWriteFileCallback(writeFile, customTransformers) {
120362
120461
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
120363
- var _a;
120462
+ var _a, _b, _c;
120364
120463
  if (ts.isDeclarationFileName(fileName)) {
120365
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120366
- var file = sourceFiles[0];
120367
- var info = state.fileInfos.get(file.resolvedPath);
120368
- var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120369
- if (signature === file.version) {
120370
- var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120371
- if (newSignature !== file.version) { // Update it
120372
- if (host.storeFilesChangingSignatureDuringEmit)
120373
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120374
- if (state.exportedModulesMap)
120375
- ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
120376
- if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
120377
- state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
120464
+ if (!ts.outFile(state.compilerOptions)) {
120465
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120466
+ var newSignature = void 0;
120467
+ if (!customTransformers) {
120468
+ var file = sourceFiles[0];
120469
+ var info = state.fileInfos.get(file.resolvedPath);
120470
+ if (info.signature === file.version) {
120471
+ newSignature = computeSignature(text, data, computeHash);
120472
+ if (newSignature !== file.version) { // Update it
120473
+ if (host.storeFilesChangingSignatureDuringEmit)
120474
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120475
+ if (state.exportedModulesMap)
120476
+ ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
120477
+ if (state.affectedFiles) {
120478
+ // Keep old signature so we know what to undo if cancellation happens
120479
+ var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
120480
+ if (existing === undefined)
120481
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
120482
+ info.signature = newSignature;
120483
+ }
120484
+ else {
120485
+ // These are directly commited
120486
+ info.signature = newSignature;
120487
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120488
+ }
120489
+ }
120378
120490
  }
120379
- else {
120380
- info.signature = newSignature;
120381
- if (state.exportedModulesMap)
120382
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120491
+ }
120492
+ if (state.compilerOptions.composite) {
120493
+ var filePath = sourceFiles[0].resolvedPath;
120494
+ var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
120495
+ newSignature || (newSignature = computeSignature(text, data, computeHash));
120496
+ if (newSignature !== oldSignature) {
120497
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
120498
+ state.hasChangedEmitSignature = true;
120383
120499
  }
120384
120500
  }
120385
120501
  }
120502
+ else if (state.compilerOptions.composite) {
120503
+ var newSignature = computeSignature(text, data, computeHash);
120504
+ if (newSignature !== state.outSignature) {
120505
+ state.outSignature = newSignature;
120506
+ state.hasChangedEmitSignature = true;
120507
+ }
120508
+ }
120386
120509
  }
120387
120510
  if (writeFile)
120388
120511
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -120447,8 +120570,8 @@ var ts;
120447
120570
  }
120448
120571
  }
120449
120572
  }
120450
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120451
- getWriteFileUpdatingSignatureCallback(writeFile) :
120573
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
120574
+ getWriteFileCallback(writeFile, customTransformers) :
120452
120575
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120453
120576
  }
120454
120577
  /**
@@ -120537,14 +120660,28 @@ var ts;
120537
120660
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
120538
120661
  }
120539
120662
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
120540
- function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
120541
- var _a;
120663
+ function createBuilderProgramUsingProgramBuildInfo(programFromBuildInfo, buildInfoPath, host) {
120664
+ var _a, _b, _c, _d, _e;
120542
120665
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
120543
120666
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
120544
- var filePaths = program.fileNames.map(toPath);
120545
- var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
120667
+ var program = programFromBuildInfo;
120668
+ var filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
120669
+ var filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
120546
120670
  var fileInfos = new ts.Map();
120547
- program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
120671
+ var emitSignatures = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
120672
+ (_d = program.fileInfos) === null || _d === void 0 ? void 0 : _d.forEach(function (fileInfo, index) {
120673
+ var path = toFilePath(index + 1);
120674
+ var stateFileInfo = toBuilderStateFileInfo(fileInfo);
120675
+ fileInfos.set(path, stateFileInfo);
120676
+ if (emitSignatures && stateFileInfo.signature)
120677
+ emitSignatures.set(path, stateFileInfo.signature);
120678
+ });
120679
+ (_e = program.emitSignatures) === null || _e === void 0 ? void 0 : _e.forEach(function (value) {
120680
+ if (ts.isNumber(value))
120681
+ emitSignatures.delete(toFilePath(value));
120682
+ else
120683
+ emitSignatures.set(toFilePath(value[0]), value[1]);
120684
+ });
120548
120685
  var state = {
120549
120686
  fileInfos: fileInfos,
120550
120687
  compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
@@ -120555,11 +120692,15 @@ var ts;
120555
120692
  affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
120556
120693
  affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
120557
120694
  affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
120695
+ changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
120696
+ dtsChangeTime: program.dtsChangeTime,
120697
+ emitSignatures: (emitSignatures === null || emitSignatures === void 0 ? void 0 : emitSignatures.size) ? emitSignatures : undefined,
120698
+ outSignature: program.outSignature,
120558
120699
  };
120559
120700
  return {
120560
120701
  getState: function () { return state; },
120561
- backupState: ts.noop,
120562
- restoreState: ts.noop,
120702
+ backupEmitState: ts.noop,
120703
+ restoreEmitState: ts.noop,
120563
120704
  getProgram: ts.notImplemented,
120564
120705
  getProgramOrUndefined: ts.returnUndefined,
120565
120706
  releaseProgram: ts.noop,
@@ -120604,12 +120745,12 @@ var ts;
120604
120745
  return map;
120605
120746
  }
120606
120747
  }
120607
- ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
120748
+ ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
120608
120749
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
120609
120750
  return {
120610
120751
  getState: ts.notImplemented,
120611
- backupState: ts.noop,
120612
- restoreState: ts.noop,
120752
+ backupEmitState: ts.noop,
120753
+ restoreEmitState: ts.noop,
120613
120754
  getProgram: getProgram,
120614
120755
  getProgramOrUndefined: function () { return getState().program; },
120615
120756
  releaseProgram: function () { return getState().program = undefined; },
@@ -121725,9 +121866,9 @@ var ts;
121725
121866
  if (!preferSymlinks) {
121726
121867
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
121727
121868
  // so we only need to remove them from the realpath filenames.
121728
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
121729
- if (result_15)
121730
- return result_15;
121869
+ var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
121870
+ if (result_16)
121871
+ return result_16;
121731
121872
  }
121732
121873
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
121733
121874
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -121747,10 +121888,10 @@ var ts;
121747
121888
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
121748
121889
  var symlinkDirectory = symlinkDirectories_1[_i];
121749
121890
  var option = ts.resolvePath(symlinkDirectory, relative);
121750
- var result_16 = cb(option, target === referenceRedirect);
121891
+ var result_17 = cb(option, target === referenceRedirect);
121751
121892
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
121752
- if (result_16)
121753
- return result_16;
121893
+ if (result_17)
121894
+ return result_17;
121754
121895
  }
121755
121896
  });
121756
121897
  });
@@ -122642,6 +122783,7 @@ var ts;
122642
122783
  readDirectory: ts.maybeBind(host, host.readDirectory),
122643
122784
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
122644
122785
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
122786
+ now: ts.maybeBind(host, host.now),
122645
122787
  };
122646
122788
  function writeFile(fileName, text, writeByteOrderMark, onError) {
122647
122789
  try {
@@ -122702,6 +122844,7 @@ var ts;
122702
122844
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
122703
122845
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
122704
122846
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
122847
+ now: ts.maybeBind(system, system.now),
122705
122848
  };
122706
122849
  }
122707
122850
  ts.createProgramHost = createProgramHost;
@@ -122769,20 +122912,26 @@ var ts;
122769
122912
  var ts;
122770
122913
  (function (ts) {
122771
122914
  function readBuilderProgram(compilerOptions, host) {
122772
- if (ts.outFile(compilerOptions))
122773
- return undefined;
122774
122915
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
122775
122916
  if (!buildInfoPath)
122776
122917
  return undefined;
122777
- var content = host.readFile(buildInfoPath);
122778
- if (!content)
122779
- return undefined;
122780
- var buildInfo = ts.getBuildInfo(content);
122918
+ var buildInfo;
122919
+ if (host.getBuildInfo) {
122920
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
122921
+ if (!buildInfo)
122922
+ return undefined;
122923
+ }
122924
+ else {
122925
+ var content = host.readFile(buildInfoPath);
122926
+ if (!content)
122927
+ return undefined;
122928
+ buildInfo = ts.getBuildInfo(content);
122929
+ }
122781
122930
  if (buildInfo.version !== ts.version)
122782
122931
  return undefined;
122783
122932
  if (!buildInfo.program)
122784
122933
  return undefined;
122785
- return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
122934
+ return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
122786
122935
  }
122787
122936
  ts.readBuilderProgram = readBuilderProgram;
122788
122937
  function createIncrementalCompilerHost(options, system) {
@@ -122791,6 +122940,7 @@ var ts;
122791
122940
  host.createHash = ts.maybeBind(system, system.createHash);
122792
122941
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
122793
122942
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
122943
+ host.now = ts.maybeBind(system, system.now);
122794
122944
  ts.setGetSourceFileAsHashVersioned(host, system);
122795
122945
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
122796
122946
  return host;
@@ -123525,14 +123675,16 @@ var ts;
123525
123675
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
123526
123676
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
123527
123677
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
123528
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
123529
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
123530
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
123531
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
123678
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
123679
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
123680
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
123681
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
123682
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
123532
123683
  /**
123533
123684
  * Projects with no outputs (i.e. "solution" files)
123534
123685
  */
123535
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
123686
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 12] = "ContainerOnly";
123687
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 13] = "ForceBuild";
123536
123688
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
123537
123689
  function resolveConfigFileProjectName(project) {
123538
123690
  if (ts.fileExtensionIs(project, ".json" /* Json */)) {
@@ -123577,9 +123729,11 @@ var ts;
123577
123729
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
123578
123730
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
123579
123731
  }
123580
- function newer(date1, date2) {
123581
- return date2 > date1 ? date2 : date1;
123732
+ /*@internal*/
123733
+ function getCurrentTime(host) {
123734
+ return host.now ? host.now() : new Date();
123582
123735
  }
123736
+ ts.getCurrentTime = getCurrentTime;
123583
123737
  /*@internal*/
123584
123738
  function isCircularBuildOrder(buildOrder) {
123585
123739
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -123669,6 +123823,7 @@ var ts;
123669
123823
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
123670
123824
  };
123671
123825
  }
123826
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
123672
123827
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
123673
123828
  var state = {
123674
123829
  host: host,
@@ -123685,8 +123840,9 @@ var ts;
123685
123840
  resolvedConfigFilePaths: new ts.Map(),
123686
123841
  configFileCache: new ts.Map(),
123687
123842
  projectStatus: new ts.Map(),
123688
- buildInfoChecked: new ts.Map(),
123689
123843
  extendedConfigCache: new ts.Map(),
123844
+ buildInfoCache: new ts.Map(),
123845
+ outputTimeStamps: new ts.Map(),
123690
123846
  builderPrograms: new ts.Map(),
123691
123847
  diagnostics: new ts.Map(),
123692
123848
  projectPendingBuild: new ts.Map(),
@@ -123710,6 +123866,7 @@ var ts;
123710
123866
  allWatchedConfigFiles: new ts.Map(),
123711
123867
  allWatchedExtendedConfigFiles: new ts.Map(),
123712
123868
  allWatchedPackageJsonFiles: new ts.Map(),
123869
+ filesWatched: new ts.Map(),
123713
123870
  lastCachedPackageJsonLookups: new ts.Map(),
123714
123871
  timerToBuildInvalidatedProject: undefined,
123715
123872
  reportFileChangeDetected: false,
@@ -123816,11 +123973,12 @@ var ts;
123816
123973
  // Config file cache
123817
123974
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
123818
123975
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
123819
- ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
123820
123976
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
123821
123977
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
123822
123978
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
123823
123979
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
123980
+ ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
123981
+ ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
123824
123982
  // Remove watches for the program no longer in the solution
123825
123983
  if (state.watch) {
123826
123984
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
@@ -124111,21 +124269,21 @@ var ts;
124111
124269
  }
124112
124270
  function emit(writeFileCallback, cancellationToken, customTransformers) {
124113
124271
  var _a;
124114
- var _b, _c;
124272
+ var _b, _c, _d;
124115
124273
  ts.Debug.assertIsDefined(program);
124116
124274
  ts.Debug.assert(step === BuildStep.Emit);
124117
124275
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
124118
- program.backupState();
124276
+ program.backupEmitState();
124119
124277
  var declDiagnostics;
124120
124278
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
124121
124279
  var outputFiles = [];
124122
124280
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
124123
124281
  /*write*/ undefined,
124124
- /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
124282
+ /*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,
124125
124283
  /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
124126
124284
  // Don't emit .d.ts if there are decl file errors
124127
124285
  if (declDiagnostics) {
124128
- program.restoreState();
124286
+ program.restoreEmitState();
124129
124287
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
124130
124288
  return {
124131
124289
  emitSkipped: true,
@@ -124135,37 +124293,43 @@ var ts;
124135
124293
  // Actual Emit
124136
124294
  var host = state.host, compilerHost = state.compilerHost;
124137
124295
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124138
- var newestDeclarationFileContentChangedTime = minimumDate;
124139
- var anyDtsChanged = false;
124296
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
124140
124297
  var emitterDiagnostics = ts.createDiagnosticCollection();
124141
124298
  var emittedOutputs = new ts.Map();
124299
+ var options = program.getCompilerOptions();
124300
+ var isIncremental = ts.isIncrementalCompilation(options);
124301
+ var outputTimeStampMap;
124302
+ var now;
124142
124303
  outputFiles.forEach(function (_a) {
124143
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124144
- var priorChangeTime;
124145
- if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124146
- // Check for unchanged .d.ts files
124147
- if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124148
- priorChangeTime = host.getModifiedTime(name);
124149
- }
124150
- else {
124304
+ var _b, _c;
124305
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124306
+ var path = toPath(state, name);
124307
+ emittedOutputs.set(toPath(state, name), name);
124308
+ if (buildInfo) {
124309
+ setBuildInfo(state, buildInfo, projectPath, options);
124310
+ 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)) {
124151
124311
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124152
- anyDtsChanged = true;
124153
124312
  }
124154
124313
  }
124155
- emittedOutputs.set(toPath(state, name), name);
124156
124314
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124157
- if (priorChangeTime !== undefined) {
124158
- newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
124315
+ if (!isIncremental && state.watch) {
124316
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
124159
124317
  }
124160
124318
  });
124161
- finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime,
124162
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124319
+ finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124163
124320
  return emitResult;
124164
124321
  }
124165
124322
  function emitBuildInfo(writeFileCallback, cancellationToken) {
124166
124323
  ts.Debug.assertIsDefined(program);
124167
124324
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
124168
- var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
124325
+ var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
124326
+ if (data === null || data === void 0 ? void 0 : data.buildInfo)
124327
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
124328
+ if (writeFileCallback)
124329
+ writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
124330
+ else
124331
+ state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
124332
+ }, cancellationToken);
124169
124333
  if (emitResult.diagnostics.length) {
124170
124334
  reportErrors(state, emitResult.diagnostics);
124171
124335
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -124178,7 +124342,7 @@ var ts;
124178
124342
  step = BuildStep.QueueReferencingProjects;
124179
124343
  return emitResult;
124180
124344
  }
124181
- function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
124345
+ function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
124182
124346
  var _a;
124183
124347
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
124184
124348
  if (emitDiagnostics.length) {
@@ -124189,13 +124353,11 @@ var ts;
124189
124353
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
124190
124354
  }
124191
124355
  // Update time stamps for rest of the outputs
124192
- var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124356
+ updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124193
124357
  state.diagnostics.delete(projectPath);
124194
124358
  state.projectStatus.set(projectPath, {
124195
124359
  type: ts.UpToDateStatusType.UpToDate,
124196
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
124197
- maximumDate :
124198
- newestDeclarationFileContentChangedTime,
124360
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
124199
124361
  oldestOutputFileName: oldestOutputFileName
124200
124362
  });
124201
124363
  afterProgramDone(state, program, config);
@@ -124230,13 +124392,21 @@ var ts;
124230
124392
  ts.Debug.assert(!!outputFiles.length);
124231
124393
  var emitterDiagnostics = ts.createDiagnosticCollection();
124232
124394
  var emittedOutputs = new ts.Map();
124395
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124396
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
124233
124397
  outputFiles.forEach(function (_a) {
124234
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124398
+ var _b, _c;
124399
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124235
124400
  emittedOutputs.set(toPath(state, name), name);
124401
+ if (buildInfo) {
124402
+ setBuildInfo(state, buildInfo, projectPath, config.options);
124403
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
124404
+ resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124405
+ }
124406
+ }
124236
124407
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124237
124408
  });
124238
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate,
124239
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
124409
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
124240
124410
  return { emitSkipped: false, diagnostics: emitDiagnostics };
124241
124411
  }
124242
124412
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -124398,7 +124568,7 @@ var ts;
124398
124568
  state.projectCompilerOptions = state.baseCompilerOptions;
124399
124569
  }
124400
124570
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
124401
- var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
124571
+ var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
124402
124572
  reportAndStoreErrors(state, resolvedPath, diagnostics);
124403
124573
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
124404
124574
  if (canEmitBuildInfo)
@@ -124406,9 +124576,95 @@ var ts;
124406
124576
  afterProgramDone(state, program, config);
124407
124577
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
124408
124578
  }
124579
+ function isFileWatcherWithModifiedTime(value) {
124580
+ return !!value.watcher;
124581
+ }
124582
+ function getModifiedTime(state, fileName) {
124583
+ var path = toPath(state, fileName);
124584
+ var existing = state.filesWatched.get(path);
124585
+ if (state.watch && !!existing) {
124586
+ if (!isFileWatcherWithModifiedTime(existing))
124587
+ return existing;
124588
+ if (existing.modifiedTime)
124589
+ return existing.modifiedTime;
124590
+ }
124591
+ var result = ts.getModifiedTime(state.host, fileName);
124592
+ if (state.watch) {
124593
+ if (existing)
124594
+ existing.modifiedTime = result;
124595
+ else
124596
+ state.filesWatched.set(path, result);
124597
+ }
124598
+ return result;
124599
+ }
124600
+ function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
124601
+ var path = toPath(state, file);
124602
+ var existing = state.filesWatched.get(path);
124603
+ if (existing && isFileWatcherWithModifiedTime(existing)) {
124604
+ existing.callbacks.push(callback);
124605
+ }
124606
+ else {
124607
+ var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
124608
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
124609
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
124610
+ existing.modifiedTime = modifiedTime;
124611
+ existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
124612
+ }, pollingInterval, options, watchType, project);
124613
+ state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
124614
+ }
124615
+ return {
124616
+ close: function () {
124617
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
124618
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
124619
+ if (existing.callbacks.length === 1) {
124620
+ state.filesWatched.delete(path);
124621
+ ts.closeFileWatcherOf(existing);
124622
+ }
124623
+ else {
124624
+ ts.unorderedRemoveItem(existing.callbacks, callback);
124625
+ }
124626
+ }
124627
+ };
124628
+ }
124629
+ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
124630
+ if (!state.watch)
124631
+ return undefined;
124632
+ var result = state.outputTimeStamps.get(resolvedConfigFilePath);
124633
+ if (!result)
124634
+ state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
124635
+ return result;
124636
+ }
124637
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
124638
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
124639
+ var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
124640
+ if (existing) {
124641
+ existing.buildInfo = buildInfo;
124642
+ existing.modifiedTime = getCurrentTime(state.host);
124643
+ }
124644
+ else {
124645
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
124646
+ }
124647
+ }
124648
+ function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
124649
+ var path = toPath(state, buildInfoPath);
124650
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
124651
+ return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
124652
+ }
124653
+ function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
124654
+ var path = toPath(state, buildInfoPath);
124655
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
124656
+ if (existing !== undefined && existing.path === path) {
124657
+ return existing.buildInfo || undefined;
124658
+ }
124659
+ var value = state.readFileWithCache(buildInfoPath);
124660
+ var buildInfo = value ? ts.getBuildInfo(value) : undefined;
124661
+ ts.Debug.assert(modifiedTime || !buildInfo);
124662
+ state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
124663
+ return buildInfo;
124664
+ }
124409
124665
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
124410
124666
  // Check tsconfig time
124411
- var tsconfigTime = ts.getModifiedTime(state.host, configFile);
124667
+ var tsconfigTime = getModifiedTime(state, configFile);
124412
124668
  if (oldestOutputFileTime < tsconfigTime) {
124413
124669
  return {
124414
124670
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -124418,88 +124674,24 @@ var ts;
124418
124674
  }
124419
124675
  }
124420
124676
  function getUpToDateStatusWorker(state, project, resolvedPath) {
124421
- var force = !!state.options.force;
124422
- var newestInputFileName = undefined;
124423
- var newestInputFileTime = minimumDate;
124424
- var host = state.host;
124425
- // Get timestamps of input files
124426
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
124427
- var inputFile = _a[_i];
124428
- if (!host.fileExists(inputFile)) {
124429
- return {
124430
- type: ts.UpToDateStatusType.Unbuildable,
124431
- reason: inputFile + " does not exist"
124432
- };
124433
- }
124434
- if (!force) {
124435
- var inputTime = ts.getModifiedTime(host, inputFile);
124436
- if (inputTime > newestInputFileTime) {
124437
- newestInputFileName = inputFile;
124438
- newestInputFileTime = inputTime;
124439
- }
124440
- }
124441
- }
124677
+ var _a, _b, _c;
124442
124678
  // Container if no files are specified in the project
124443
124679
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
124444
124680
  return {
124445
124681
  type: ts.UpToDateStatusType.ContainerOnly
124446
124682
  };
124447
124683
  }
124448
- // Collect the expected outputs of this project
124449
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
124450
- // Now see if all outputs are newer than the newest input
124451
- var oldestOutputFileName = "(none)";
124452
- var oldestOutputFileTime = maximumDate;
124453
- var newestOutputFileName = "(none)";
124454
- var newestOutputFileTime = minimumDate;
124455
- var missingOutputFileName;
124456
- var newestDeclarationFileContentChangedTime = minimumDate;
124457
- var isOutOfDateWithInputs = false;
124458
- if (!force) {
124459
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
124460
- var output = outputs_1[_b];
124461
- // Output is missing; can stop checking
124462
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124463
- if (!host.fileExists(output)) {
124464
- missingOutputFileName = output;
124465
- break;
124466
- }
124467
- var outputTime = ts.getModifiedTime(host, output);
124468
- if (outputTime < oldestOutputFileTime) {
124469
- oldestOutputFileTime = outputTime;
124470
- oldestOutputFileName = output;
124471
- }
124472
- // If an output is older than the newest input, we can stop checking
124473
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124474
- if (outputTime < newestInputFileTime) {
124475
- isOutOfDateWithInputs = true;
124476
- break;
124477
- }
124478
- if (outputTime > newestOutputFileTime) {
124479
- newestOutputFileTime = outputTime;
124480
- newestOutputFileName = output;
124481
- }
124482
- // Keep track of when the most recent time a .d.ts file was changed.
124483
- // In addition to file timestamps, we also keep track of when a .d.ts file
124484
- // had its file touched but not had its contents changed - this allows us
124485
- // to skip a downstream typecheck
124486
- if (ts.isDeclarationFileName(output)) {
124487
- var outputModifiedTime = ts.getModifiedTime(host, output);
124488
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
124489
- }
124490
- }
124491
- }
124492
- var pseudoUpToDate = false;
124493
- var usesPrepend = false;
124494
- var upstreamChangedProject;
124684
+ // Fast check to see if reference projects are buildable
124685
+ var referenceStatuses;
124686
+ var force = !!state.options.force;
124495
124687
  if (project.projectReferences) {
124496
124688
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
124497
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
124498
- var ref = _d[_c];
124499
- usesPrepend = usesPrepend || !!(ref.prepend);
124689
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
124690
+ var ref = _d[_i];
124500
124691
  var resolvedRef = ts.resolveProjectReferencePath(ref);
124501
124692
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
124502
- var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
124693
+ var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
124694
+ var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
124503
124695
  // Its a circular reference ignore the status of this project
124504
124696
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
124505
124697
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) { // Container only ignore this project
@@ -124521,75 +124713,170 @@ var ts;
124521
124713
  upstreamProjectName: ref.path
124522
124714
  };
124523
124715
  }
124524
- // Check oldest output file name only if there is no missing output file name
124525
- // (a check we will have skipped if this is a forced build)
124526
- if (!force && !missingOutputFileName) {
124527
- // If the upstream project's newest file is older than our oldest output, we
124528
- // can't be out of date because of it
124529
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
124530
- continue;
124531
- }
124532
- // If the upstream project has only change .d.ts files, and we've built
124533
- // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
124534
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
124535
- pseudoUpToDate = true;
124536
- upstreamChangedProject = ref.path;
124537
- continue;
124538
- }
124539
- // We have an output older than an upstream output - we are out of date
124540
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
124716
+ if (!force)
124717
+ (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
124718
+ }
124719
+ }
124720
+ if (force)
124721
+ return { type: ts.UpToDateStatusType.ForceBuild };
124722
+ // Check buildinfo first
124723
+ var host = state.host;
124724
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
124725
+ var oldestOutputFileName = "(none)";
124726
+ var oldestOutputFileTime = maximumDate;
124727
+ var buildInfoTime;
124728
+ var newestDeclarationFileContentChangedTime;
124729
+ if (buildInfoPath) {
124730
+ var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
124731
+ buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
124732
+ if (buildInfoTime === ts.missingFileModifiedTime) {
124733
+ if (!buildInfoCacheEntry_1) {
124734
+ state.buildInfoCache.set(resolvedPath, {
124735
+ path: toPath(state, buildInfoPath),
124736
+ buildInfo: false,
124737
+ modifiedTime: buildInfoTime
124738
+ });
124739
+ }
124740
+ return {
124741
+ type: ts.UpToDateStatusType.OutputMissing,
124742
+ missingOutputFileName: buildInfoPath
124743
+ };
124744
+ }
124745
+ var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
124746
+ if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
124747
+ return {
124748
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
124749
+ version: buildInfo.version
124750
+ };
124751
+ }
124752
+ if (buildInfo.program) {
124753
+ if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
124754
+ (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
124541
124755
  return {
124542
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124543
- outOfDateOutputFileName: oldestOutputFileName,
124544
- newerProjectName: ref.path
124756
+ type: ts.UpToDateStatusType.OutOfDateBuildInfo,
124757
+ buildInfoFile: buildInfoPath
124545
124758
  };
124546
124759
  }
124547
124760
  }
124761
+ oldestOutputFileTime = buildInfoTime;
124762
+ oldestOutputFileName = buildInfoPath;
124763
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
124548
124764
  }
124549
- if (missingOutputFileName !== undefined) {
124550
- return {
124551
- type: ts.UpToDateStatusType.OutputMissing,
124552
- missingOutputFileName: missingOutputFileName
124553
- };
124765
+ // Check input files
124766
+ var newestInputFileName = undefined;
124767
+ var newestInputFileTime = minimumDate;
124768
+ // Get timestamps of input files
124769
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
124770
+ var inputFile = _f[_e];
124771
+ var inputTime = getModifiedTime(state, inputFile);
124772
+ if (inputTime === ts.missingFileModifiedTime) {
124773
+ return {
124774
+ type: ts.UpToDateStatusType.Unbuildable,
124775
+ reason: inputFile + " does not exist"
124776
+ };
124777
+ }
124778
+ // If an buildInfo is older than the newest input, we can stop checking
124779
+ if (buildInfoTime && buildInfoTime < inputTime) {
124780
+ return {
124781
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
124782
+ outOfDateOutputFileName: buildInfoPath,
124783
+ newerInputFileName: inputFile
124784
+ };
124785
+ }
124786
+ if (inputTime > newestInputFileTime) {
124787
+ newestInputFileName = inputFile;
124788
+ newestInputFileTime = inputTime;
124789
+ }
124554
124790
  }
124555
- if (isOutOfDateWithInputs) {
124556
- return {
124557
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
124558
- outOfDateOutputFileName: oldestOutputFileName,
124559
- newerInputFileName: newestInputFileName
124560
- };
124791
+ // Now see if all outputs are newer than the newest input
124792
+ // Dont check output timestamps if we have buildinfo telling us output is uptodate
124793
+ if (!buildInfoPath) {
124794
+ // Collect the expected outputs of this project
124795
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
124796
+ var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
124797
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
124798
+ var output = outputs_1[_g];
124799
+ var path = toPath(state, output);
124800
+ // Output is missing; can stop checking
124801
+ var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
124802
+ if (!outputTime) {
124803
+ outputTime = ts.getModifiedTime(state.host, output);
124804
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
124805
+ }
124806
+ if (outputTime === ts.missingFileModifiedTime) {
124807
+ return {
124808
+ type: ts.UpToDateStatusType.OutputMissing,
124809
+ missingOutputFileName: output
124810
+ };
124811
+ }
124812
+ if (outputTime < oldestOutputFileTime) {
124813
+ oldestOutputFileTime = outputTime;
124814
+ oldestOutputFileName = output;
124815
+ }
124816
+ // If an output is older than the newest input, we can stop checking
124817
+ if (outputTime < newestInputFileTime) {
124818
+ return {
124819
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
124820
+ outOfDateOutputFileName: oldestOutputFileName,
124821
+ newerInputFileName: newestInputFileName
124822
+ };
124823
+ }
124824
+ }
124561
124825
  }
124562
- else {
124563
- // Check tsconfig time
124564
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
124565
- if (configStatus)
124566
- return configStatus;
124567
- // Check extended config time
124568
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
124569
- if (extendedConfigStatus)
124570
- return extendedConfigStatus;
124571
- // Check package file time
124572
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
124573
- var path = _a[0];
124574
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
124575
- });
124576
- if (dependentPackageFileStatus)
124577
- return dependentPackageFileStatus;
124578
- }
124579
- if (!force && !state.buildInfoChecked.has(resolvedPath)) {
124580
- state.buildInfoChecked.set(resolvedPath, true);
124581
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
124582
- if (buildInfoPath) {
124583
- var value = state.readFileWithCache(buildInfoPath);
124584
- var buildInfo = value && ts.getBuildInfo(value);
124585
- if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
124826
+ var seenRefs = buildInfoPath ? new ts.Set() : undefined;
124827
+ var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
124828
+ seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
124829
+ var pseudoUpToDate = false;
124830
+ var usesPrepend = false;
124831
+ var upstreamChangedProject;
124832
+ if (referenceStatuses) {
124833
+ for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
124834
+ var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
124835
+ usesPrepend = usesPrepend || !!(ref.prepend);
124836
+ // If the upstream project's newest file is older than our oldest output, we
124837
+ // can't be out of date because of it
124838
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
124839
+ continue;
124840
+ }
124841
+ // Check if tsbuildinfo path is shared, then we need to rebuild
124842
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
124586
124843
  return {
124587
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
124588
- version: buildInfo.version
124844
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124845
+ outOfDateOutputFileName: buildInfoPath,
124846
+ newerProjectName: ref.path
124589
124847
  };
124590
124848
  }
124849
+ // If the upstream project has only change .d.ts files, and we've built
124850
+ // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
124851
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
124852
+ pseudoUpToDate = true;
124853
+ upstreamChangedProject = ref.path;
124854
+ continue;
124855
+ }
124856
+ // We have an output older than an upstream output - we are out of date
124857
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
124858
+ return {
124859
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124860
+ outOfDateOutputFileName: oldestOutputFileName,
124861
+ newerProjectName: ref.path
124862
+ };
124591
124863
  }
124592
124864
  }
124865
+ // Check tsconfig time
124866
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
124867
+ if (configStatus)
124868
+ return configStatus;
124869
+ // Check extended config time
124870
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
124871
+ if (extendedConfigStatus)
124872
+ return extendedConfigStatus;
124873
+ // Check package file time
124874
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
124875
+ var path = _a[0];
124876
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
124877
+ });
124878
+ if (dependentPackageFileStatus)
124879
+ return dependentPackageFileStatus;
124593
124880
  if (usesPrepend && pseudoUpToDate) {
124594
124881
  return {
124595
124882
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -124602,12 +124889,30 @@ var ts;
124602
124889
  type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
124603
124890
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
124604
124891
  newestInputFileTime: newestInputFileTime,
124605
- newestOutputFileTime: newestOutputFileTime,
124606
124892
  newestInputFileName: newestInputFileName,
124607
- newestOutputFileName: newestOutputFileName,
124608
124893
  oldestOutputFileName: oldestOutputFileName
124609
124894
  };
124610
124895
  }
124896
+ function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
124897
+ if (seenRefs.has(resolvedRefPath))
124898
+ return false;
124899
+ seenRefs.add(resolvedRefPath);
124900
+ var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
124901
+ if (refBuildInfo.path === buildInfoCacheEntry.path)
124902
+ return true;
124903
+ if (resolvedConfig.projectReferences) {
124904
+ // Check references
124905
+ for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
124906
+ var ref = _a[_i];
124907
+ var resolvedRef = ts.resolveProjectReferencePath(ref);
124908
+ var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
124909
+ var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
124910
+ if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
124911
+ return true;
124912
+ }
124913
+ }
124914
+ return false;
124915
+ }
124611
124916
  function getUpToDateStatus(state, project, resolvedPath) {
124612
124917
  if (project === undefined) {
124613
124918
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -124620,39 +124925,65 @@ var ts;
124620
124925
  state.projectStatus.set(resolvedPath, actual);
124621
124926
  return actual;
124622
124927
  }
124623
- function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
124928
+ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
124624
124929
  if (proj.options.noEmit)
124625
- return priorNewestUpdateTime;
124930
+ return;
124931
+ var now;
124932
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
124933
+ if (buildInfoPath) {
124934
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
124935
+ if (!!state.options.verbose)
124936
+ reportStatus(state, verboseMessage, proj.options.configFilePath);
124937
+ state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
124938
+ getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
124939
+ }
124940
+ state.outputTimeStamps.delete(projectPath);
124941
+ return;
124942
+ }
124626
124943
  var host = state.host;
124627
124944
  var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
124945
+ var outputTimeStampMap = getOutputTimeStampMap(state, projectPath);
124946
+ var modifiedOutputs = outputTimeStampMap ? new ts.Set() : undefined;
124628
124947
  if (!skipOutputs || outputs.length !== skipOutputs.size) {
124629
124948
  var reportVerbose = !!state.options.verbose;
124630
- var now = host.now ? host.now() : new Date();
124631
124949
  for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
124632
124950
  var file = outputs_2[_i];
124633
- if (skipOutputs && skipOutputs.has(toPath(state, file))) {
124951
+ var path = toPath(state, file);
124952
+ if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
124634
124953
  continue;
124635
- }
124636
124954
  if (reportVerbose) {
124637
124955
  reportVerbose = false;
124638
124956
  reportStatus(state, verboseMessage, proj.options.configFilePath);
124639
124957
  }
124640
- if (ts.isDeclarationFileName(file)) {
124641
- priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
124958
+ host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
124959
+ if (outputTimeStampMap) {
124960
+ outputTimeStampMap.set(path, now);
124961
+ modifiedOutputs.add(path);
124642
124962
  }
124643
- host.setModifiedTime(file, now);
124644
124963
  }
124645
124964
  }
124646
- return priorNewestUpdateTime;
124965
+ // Clear out timestamps not in output list any more
124966
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.forEach(function (_value, key) {
124967
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs.has(key))
124968
+ outputTimeStampMap.delete(key);
124969
+ });
124970
+ }
124971
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
124972
+ var _a;
124973
+ if (!options.composite)
124974
+ return undefined;
124975
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
124976
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, /*modifiedTime*/ undefined);
124977
+ 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;
124647
124978
  }
124648
124979
  function updateOutputTimestamps(state, proj, resolvedPath) {
124649
124980
  if (state.options.dry) {
124650
124981
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
124651
124982
  }
124652
- var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
124983
+ updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
124653
124984
  state.projectStatus.set(resolvedPath, {
124654
124985
  type: ts.UpToDateStatusType.UpToDate,
124655
- newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
124986
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
124656
124987
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
124657
124988
  });
124658
124989
  }
@@ -124845,12 +125176,10 @@ var ts;
124845
125176
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
124846
125177
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
124847
125178
  return;
124848
- state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
124849
- invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
124850
- }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
125179
+ 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));
124851
125180
  }
124852
125181
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
124853
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
125182
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
124854
125183
  var _a;
124855
125184
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
124856
125185
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -124882,7 +125211,7 @@ var ts;
124882
125211
  if (!state.watch)
124883
125212
  return;
124884
125213
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
124885
- 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); },
125214
+ 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); },
124886
125215
  onDeleteValue: ts.closeFileWatcher,
124887
125216
  });
124888
125217
  }
@@ -124890,7 +125219,7 @@ var ts;
124890
125219
  if (!state.watch || !state.lastCachedPackageJsonLookups)
124891
125220
  return;
124892
125221
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
124893
- 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); },
125222
+ createNewValue: function (path, _input) { return watchFile(state, 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); },
124894
125223
  onDeleteValue: ts.closeFileWatcher,
124895
125224
  });
124896
125225
  }
@@ -125022,19 +125351,18 @@ var ts;
125022
125351
  }
125023
125352
  }
125024
125353
  function reportUpToDateStatus(state, configFileName, status) {
125025
- if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
125026
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125027
- }
125028
125354
  switch (status.type) {
125029
125355
  case ts.UpToDateStatusType.OutOfDateWithSelf:
125030
- 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));
125356
+ 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));
125031
125357
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
125032
- 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));
125358
+ 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));
125033
125359
  case ts.UpToDateStatusType.OutputMissing:
125034
125360
  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));
125361
+ case ts.UpToDateStatusType.OutOfDateBuildInfo:
125362
+ 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));
125035
125363
  case ts.UpToDateStatusType.UpToDate:
125036
125364
  if (status.newestInputFileTime !== undefined) {
125037
- 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 || ""));
125365
+ 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 || ""));
125038
125366
  }
125039
125367
  // Don't report anything for "up to date because it was already built" -- too verbose
125040
125368
  break;
@@ -125052,6 +125380,8 @@ var ts;
125052
125380
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
125053
125381
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
125054
125382
  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);
125383
+ case ts.UpToDateStatusType.ForceBuild:
125384
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125055
125385
  case ts.UpToDateStatusType.ContainerOnly:
125056
125386
  // Don't report status on "solution" projects
125057
125387
  // falls through
@@ -157937,6 +158267,7 @@ var ts;
157937
158267
  var fixName = "addVoidToPromise";
157938
158268
  var fixId = "addVoidToPromise";
157939
158269
  var errorCodes = [
158270
+ 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,
157940
158271
  ts.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code
157941
158272
  ];
157942
158273
  codefix.registerCodeFix({