@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.
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-insiders.20220425";
92
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220427";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -6179,7 +6179,7 @@ var ts;
6179
6179
  };
6180
6180
  }
6181
6181
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
6182
- var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName) {
6182
+ var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName, modifiedTime) {
6183
6183
  // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
6184
6184
  if (!ts.isString(relativeFileName))
6185
6185
  return;
@@ -6189,7 +6189,7 @@ var ts;
6189
6189
  if (callbacks) {
6190
6190
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
6191
6191
  var fileCallback = callbacks_1[_i];
6192
- fileCallback(fileName, FileWatcherEventKind.Changed);
6192
+ fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6193
6193
  }
6194
6194
  }
6195
6195
  },
@@ -6243,7 +6243,7 @@ var ts;
6243
6243
  }
6244
6244
  else {
6245
6245
  cache.set(path, {
6246
- watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
6246
+ watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6247
6247
  refCount: 1
6248
6248
  });
6249
6249
  }
@@ -6271,7 +6271,7 @@ var ts;
6271
6271
  var newTime = modifiedTime.getTime();
6272
6272
  if (oldTime !== newTime) {
6273
6273
  watchedFile.mtime = modifiedTime;
6274
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
6274
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
6275
6275
  return true;
6276
6276
  }
6277
6277
  return false;
@@ -6522,17 +6522,18 @@ var ts;
6522
6522
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6523
6523
  /*@internal*/
6524
6524
  function createFileWatcherCallback(callback) {
6525
- return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
6525
+ return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6526
6526
  }
6527
6527
  ts.createFileWatcherCallback = createFileWatcherCallback;
6528
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists) {
6529
- return function (eventName) {
6528
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6529
+ return function (eventName, _relativeFileName, modifiedTime) {
6530
6530
  if (eventName === "rename") {
6531
- callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6531
+ modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
6532
+ callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
6532
6533
  }
6533
6534
  else {
6534
6535
  // Change
6535
- callback(fileName, FileWatcherEventKind.Changed);
6536
+ callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6536
6537
  }
6537
6538
  };
6538
6539
  }
@@ -6556,7 +6557,7 @@ var ts;
6556
6557
  }
6557
6558
  /*@internal*/
6558
6559
  function createSystemWatchFunctions(_a) {
6559
- var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatch = _a.fsWatch, fileExists = _a.fileExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, directoryExists = _a.directoryExists, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind;
6560
+ var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatch = _a.fsWatch, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, directoryExists = _a.directoryExists, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind;
6560
6561
  var dynamicPollingWatchFile;
6561
6562
  var fixedChunkSizePollingWatchFile;
6562
6563
  var nonPollingWatchFile;
@@ -6578,7 +6579,7 @@ var ts;
6578
6579
  case ts.WatchFileKind.FixedChunkSizePolling:
6579
6580
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, /* pollingInterval */ undefined, /*options*/ undefined);
6580
6581
  case ts.WatchFileKind.UseFsEvents:
6581
- return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists),
6582
+ return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime),
6582
6583
  /*recursive*/ false, pollingInterval, ts.getFallbackOptions(options));
6583
6584
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
6584
6585
  if (!nonPollingWatchFile) {
@@ -6760,7 +6761,6 @@ var ts;
6760
6761
  fsWatch: fsWatch,
6761
6762
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6762
6763
  getCurrentDirectory: getCurrentDirectory,
6763
- fileExists: fileExists,
6764
6764
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
6765
6765
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
6766
6766
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
@@ -7020,7 +7020,7 @@ var ts;
7020
7020
  // File changed
7021
7021
  eventKind = FileWatcherEventKind.Changed;
7022
7022
  }
7023
- callback(fileName, eventKind);
7023
+ callback(fileName, eventKind, curr.mtime);
7024
7024
  }
7025
7025
  }
7026
7026
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
@@ -7046,10 +7046,10 @@ var ts;
7046
7046
  * Invoke the callback with rename and update the watcher if not closed
7047
7047
  * @param createWatcher
7048
7048
  */
7049
- function invokeCallbackAndUpdateWatcher(createWatcher) {
7049
+ function invokeCallbackAndUpdateWatcher(createWatcher, modifiedTime) {
7050
7050
  sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
7051
7051
  // Call the callback for current directory
7052
- callback("rename", "");
7052
+ callback("rename", "", modifiedTime);
7053
7053
  // If watcher is not closed, update it
7054
7054
  if (watcher) {
7055
7055
  watcher.close();
@@ -7095,13 +7095,14 @@ var ts;
7095
7095
  function callbackChangingToMissingFileSystemEntry(event, relativeName) {
7096
7096
  // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
7097
7097
  // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
7098
+ var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
7098
7099
  return event === "rename" &&
7099
7100
  (!relativeName ||
7100
7101
  relativeName === lastDirectoryPart ||
7101
7102
  (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
7102
- !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7103
- invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
7104
- callback(event, relativeName);
7103
+ modifiedTime === ts.missingFileModifiedTime ?
7104
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry, modifiedTime) :
7105
+ callback(event, relativeName, modifiedTime);
7105
7106
  }
7106
7107
  /**
7107
7108
  * Watch the file or directory using fs.watchFile since fs.watch threw exception
@@ -7115,12 +7116,15 @@ var ts;
7115
7116
  * and switch to existing file or directory when the missing filesystem entry is created
7116
7117
  */
7117
7118
  function watchMissingFileSystemEntry() {
7118
- return watchFile(fileOrDirectory, function (_fileName, eventKind) {
7119
- if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
7120
- // Call the callback for current file or directory
7121
- // For now it could be callback for the inner directory creation,
7122
- // but just return current directory, better than current no-op
7123
- invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
7119
+ return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
7120
+ if (eventKind === FileWatcherEventKind.Created) {
7121
+ modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
7122
+ if (modifiedTime !== ts.missingFileModifiedTime) {
7123
+ // Call the callback for current file or directory
7124
+ // For now it could be callback for the inner directory creation,
7125
+ // but just return current directory, better than current no-op
7126
+ invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry, modifiedTime);
7127
+ }
7124
7128
  }
7125
7129
  }, fallbackPollingInterval, fallbackOptions);
7126
7130
  }
@@ -7270,12 +7274,19 @@ var ts;
7270
7274
  }
7271
7275
  function getModifiedTime(path) {
7272
7276
  var _a;
7277
+ // Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
7278
+ // the CPU time performance.
7279
+ var originalStackTraceLimit = Error.stackTraceLimit;
7280
+ Error.stackTraceLimit = 0;
7273
7281
  try {
7274
7282
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
7275
7283
  }
7276
7284
  catch (e) {
7277
7285
  return undefined;
7278
7286
  }
7287
+ finally {
7288
+ Error.stackTraceLimit = originalStackTraceLimit;
7289
+ }
7279
7290
  }
7280
7291
  function setModifiedTime(path, time) {
7281
7292
  try {
@@ -8861,6 +8872,7 @@ var ts;
8861
8872
  This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0: diag(2807, ts.DiagnosticCategory.Error, "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807", "This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."),
8862
8873
  A_get_accessor_must_be_at_least_as_accessible_as_the_setter: diag(2808, ts.DiagnosticCategory.Error, "A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808", "A get accessor must be at least as accessible as the setter"),
8863
8874
  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."),
8875
+ Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments: diag(2810, ts.DiagnosticCategory.Error, "Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810", "Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments."),
8864
8876
  Initializer_for_property_0: diag(2811, ts.DiagnosticCategory.Error, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
8865
8877
  Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, ts.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),
8866
8878
  Class_declaration_cannot_implement_overload_list_for_0: diag(2813, ts.DiagnosticCategory.Error, "Class_declaration_cannot_implement_overload_list_for_0_2813", "Class declaration cannot implement overload list for '{0}'."),
@@ -9288,8 +9300,8 @@ var ts;
9288
9300
  Cannot_prepend_project_0_because_it_does_not_have_outFile_set: diag(6308, ts.DiagnosticCategory.Error, "Cannot_prepend_project_0_because_it_does_not_have_outFile_set_6308", "Cannot prepend project '{0}' because it does not have 'outFile' set"),
9289
9301
  Output_file_0_from_project_1_does_not_exist: diag(6309, ts.DiagnosticCategory.Error, "Output_file_0_from_project_1_does_not_exist_6309", "Output file '{0}' from project '{1}' does not exist"),
9290
9302
  Referenced_project_0_may_not_disable_emit: diag(6310, ts.DiagnosticCategory.Error, "Referenced_project_0_may_not_disable_emit_6310", "Referenced project '{0}' may not disable emit."),
9291
- Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2: diag(6350, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350", "Project '{0}' is out of date because oldest output '{1}' is older than newest input '{2}'"),
9292
- Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2: diag(6351, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351", "Project '{0}' is up to date because newest input '{1}' is older than oldest output '{2}'"),
9303
+ 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}'"),
9304
+ Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2: diag(6351, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351", "Project '{0}' is up to date because newest input '{1}' is older than output '{2}'"),
9293
9305
  Project_0_is_out_of_date_because_output_file_1_does_not_exist: diag(6352, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352", "Project '{0}' is out of date because output file '{1}' does not exist"),
9294
9306
  Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date: diag(6353, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353", "Project '{0}' is out of date because its dependency '{1}' is out of date"),
9295
9307
  Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies: diag(6354, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354", "Project '{0}' is up to date with .d.ts files from its dependencies"),
@@ -9333,6 +9345,7 @@ var ts;
9333
9345
  Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3: diag(6396, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6396", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}'."),
9334
9346
  Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4: diag(6397, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6397", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}' with Package ID '{4}'."),
9335
9347
  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."),
9348
+ 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"),
9336
9349
  The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
9337
9350
  The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
9338
9351
  The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -17296,19 +17309,11 @@ var ts;
17296
17309
  return !!name && isDynamicName(name);
17297
17310
  }
17298
17311
  ts.hasDynamicName = hasDynamicName;
17299
- function getComputedPropertyNameExpression(name) {
17300
- return ts.isElementAccessExpression(name.expression)
17301
- ? skipParentheses(name.expression.argumentExpression)
17302
- : name.expression;
17303
- }
17304
- ts.getComputedPropertyNameExpression = getComputedPropertyNameExpression;
17305
17312
  function isDynamicName(name) {
17306
17313
  if (!(name.kind === 162 /* ComputedPropertyName */ || name.kind === 207 /* ElementAccessExpression */)) {
17307
17314
  return false;
17308
17315
  }
17309
- var expr = ts.isElementAccessExpression(name)
17310
- ? skipParentheses(name.argumentExpression)
17311
- : getComputedPropertyNameExpression(name);
17316
+ var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression;
17312
17317
  return !isStringOrNumericLiteralLike(expr) &&
17313
17318
  !isSignedNumericLiteral(expr);
17314
17319
  }
@@ -17322,7 +17327,7 @@ var ts;
17322
17327
  case 8 /* NumericLiteral */:
17323
17328
  return ts.escapeLeadingUnderscores(name.text);
17324
17329
  case 162 /* ComputedPropertyName */:
17325
- var nameExpression = getComputedPropertyNameExpression(name);
17330
+ var nameExpression = name.expression;
17326
17331
  if (isStringOrNumericLiteralLike(nameExpression)) {
17327
17332
  return ts.escapeLeadingUnderscores(nameExpression.text);
17328
17333
  }
@@ -20145,6 +20150,10 @@ var ts;
20145
20150
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
20146
20151
  }
20147
20152
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
20153
+ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
20154
+ return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
20155
+ }
20156
+ ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
20148
20157
  function getCompilerOptionValue(options, option) {
20149
20158
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
20150
20159
  }
@@ -37959,7 +37968,8 @@ var ts;
37959
37968
  if (!comment) {
37960
37969
  comment = parseTrailingTagComments(start, getNodePos(), indent, indentText);
37961
37970
  }
37962
- return finishNode(factory.createJSDocCallbackTag(tagName, typeExpression, fullName, comment), start);
37971
+ var end = comment !== undefined ? getNodePos() : typeExpression.end;
37972
+ return finishNode(factory.createJSDocCallbackTag(tagName, typeExpression, fullName, comment), start, end);
37963
37973
  }
37964
37974
  function escapedTextsEqual(a, b) {
37965
37975
  while (!ts.isIdentifier(a) || !ts.isIdentifier(b)) {
@@ -39182,6 +39192,7 @@ var ts;
39182
39192
  type: "boolean",
39183
39193
  affectsSemanticDiagnostics: true,
39184
39194
  affectsEmit: true,
39195
+ affectsMultiFileEmitBuildInfo: true,
39185
39196
  category: ts.Diagnostics.Watch_and_Build_Modes,
39186
39197
  description: ts.Diagnostics.Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it,
39187
39198
  defaultValueDescription: false,
@@ -39216,12 +39227,40 @@ var ts;
39216
39227
  affectsSourceFile: true,
39217
39228
  affectsModuleResolution: true,
39218
39229
  affectsEmit: true,
39230
+ affectsMultiFileEmitBuildInfo: true,
39219
39231
  paramType: ts.Diagnostics.VERSION,
39220
39232
  showInSimplifiedHelpView: true,
39221
39233
  category: ts.Diagnostics.Language_and_Environment,
39222
39234
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
39223
39235
  defaultValueDescription: 0 /* ES3 */,
39224
39236
  };
39237
+ /*@internal*/
39238
+ ts.moduleOptionDeclaration = {
39239
+ name: "module",
39240
+ shortName: "m",
39241
+ type: new ts.Map(ts.getEntries({
39242
+ none: ts.ModuleKind.None,
39243
+ commonjs: ts.ModuleKind.CommonJS,
39244
+ amd: ts.ModuleKind.AMD,
39245
+ system: ts.ModuleKind.System,
39246
+ umd: ts.ModuleKind.UMD,
39247
+ es6: ts.ModuleKind.ES2015,
39248
+ es2015: ts.ModuleKind.ES2015,
39249
+ es2020: ts.ModuleKind.ES2020,
39250
+ es2022: ts.ModuleKind.ES2022,
39251
+ esnext: ts.ModuleKind.ESNext,
39252
+ node12: ts.ModuleKind.Node12,
39253
+ nodenext: ts.ModuleKind.NodeNext,
39254
+ })),
39255
+ affectsModuleResolution: true,
39256
+ affectsEmit: true,
39257
+ affectsMultiFileEmitBuildInfo: true,
39258
+ paramType: ts.Diagnostics.KIND,
39259
+ showInSimplifiedHelpView: true,
39260
+ category: ts.Diagnostics.Modules,
39261
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
39262
+ defaultValueDescription: undefined,
39263
+ };
39225
39264
  var commandOptionsWithoutBuild = [
39226
39265
  // CommandLine only options
39227
39266
  {
@@ -39283,37 +39322,14 @@ var ts;
39283
39322
  category: ts.Diagnostics.Command_line_Options,
39284
39323
  affectsSemanticDiagnostics: true,
39285
39324
  affectsEmit: true,
39325
+ affectsMultiFileEmitBuildInfo: true,
39286
39326
  isCommandLineOnly: true,
39287
39327
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
39288
39328
  defaultValueDescription: false,
39289
39329
  },
39290
39330
  // Basic
39291
39331
  ts.targetOptionDeclaration,
39292
- {
39293
- name: "module",
39294
- shortName: "m",
39295
- type: new ts.Map(ts.getEntries({
39296
- none: ts.ModuleKind.None,
39297
- commonjs: ts.ModuleKind.CommonJS,
39298
- amd: ts.ModuleKind.AMD,
39299
- system: ts.ModuleKind.System,
39300
- umd: ts.ModuleKind.UMD,
39301
- es6: ts.ModuleKind.ES2015,
39302
- es2015: ts.ModuleKind.ES2015,
39303
- es2020: ts.ModuleKind.ES2020,
39304
- es2022: ts.ModuleKind.ES2022,
39305
- esnext: ts.ModuleKind.ESNext,
39306
- node12: ts.ModuleKind.Node12,
39307
- nodenext: ts.ModuleKind.NodeNext,
39308
- })),
39309
- affectsModuleResolution: true,
39310
- affectsEmit: true,
39311
- paramType: ts.Diagnostics.KIND,
39312
- showInSimplifiedHelpView: true,
39313
- category: ts.Diagnostics.Modules,
39314
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
39315
- defaultValueDescription: undefined,
39316
- },
39332
+ ts.moduleOptionDeclaration,
39317
39333
  {
39318
39334
  name: "lib",
39319
39335
  type: "list",
@@ -39350,6 +39366,7 @@ var ts;
39350
39366
  type: jsxOptionMap,
39351
39367
  affectsSourceFile: true,
39352
39368
  affectsEmit: true,
39369
+ affectsMultiFileEmitBuildInfo: true,
39353
39370
  affectsModuleResolution: true,
39354
39371
  paramType: ts.Diagnostics.KIND,
39355
39372
  showInSimplifiedHelpView: true,
@@ -39362,6 +39379,7 @@ var ts;
39362
39379
  shortName: "d",
39363
39380
  type: "boolean",
39364
39381
  affectsEmit: true,
39382
+ affectsMultiFileEmitBuildInfo: true,
39365
39383
  showInSimplifiedHelpView: true,
39366
39384
  category: ts.Diagnostics.Emit,
39367
39385
  transpileOptionValue: undefined,
@@ -39372,6 +39390,7 @@ var ts;
39372
39390
  name: "declarationMap",
39373
39391
  type: "boolean",
39374
39392
  affectsEmit: true,
39393
+ affectsMultiFileEmitBuildInfo: true,
39375
39394
  showInSimplifiedHelpView: true,
39376
39395
  category: ts.Diagnostics.Emit,
39377
39396
  transpileOptionValue: undefined,
@@ -39382,6 +39401,7 @@ var ts;
39382
39401
  name: "emitDeclarationOnly",
39383
39402
  type: "boolean",
39384
39403
  affectsEmit: true,
39404
+ affectsMultiFileEmitBuildInfo: true,
39385
39405
  showInSimplifiedHelpView: true,
39386
39406
  category: ts.Diagnostics.Emit,
39387
39407
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -39392,6 +39412,7 @@ var ts;
39392
39412
  name: "sourceMap",
39393
39413
  type: "boolean",
39394
39414
  affectsEmit: true,
39415
+ affectsMultiFileEmitBuildInfo: true,
39395
39416
  showInSimplifiedHelpView: true,
39396
39417
  category: ts.Diagnostics.Emit,
39397
39418
  defaultValueDescription: false,
@@ -39401,6 +39422,9 @@ var ts;
39401
39422
  name: "outFile",
39402
39423
  type: "string",
39403
39424
  affectsEmit: true,
39425
+ affectsMultiFileEmitBuildInfo: true,
39426
+ affectsDeclarationPath: true,
39427
+ affectsBundleEmitBuildInfo: true,
39404
39428
  isFilePath: true,
39405
39429
  paramType: ts.Diagnostics.FILE,
39406
39430
  showInSimplifiedHelpView: true,
@@ -39412,6 +39436,8 @@ var ts;
39412
39436
  name: "outDir",
39413
39437
  type: "string",
39414
39438
  affectsEmit: true,
39439
+ affectsMultiFileEmitBuildInfo: true,
39440
+ affectsDeclarationPath: true,
39415
39441
  isFilePath: true,
39416
39442
  paramType: ts.Diagnostics.DIRECTORY,
39417
39443
  showInSimplifiedHelpView: true,
@@ -39422,6 +39448,8 @@ var ts;
39422
39448
  name: "rootDir",
39423
39449
  type: "string",
39424
39450
  affectsEmit: true,
39451
+ affectsMultiFileEmitBuildInfo: true,
39452
+ affectsDeclarationPath: true,
39425
39453
  isFilePath: true,
39426
39454
  paramType: ts.Diagnostics.LOCATION,
39427
39455
  category: ts.Diagnostics.Modules,
@@ -39432,6 +39460,8 @@ var ts;
39432
39460
  name: "composite",
39433
39461
  type: "boolean",
39434
39462
  affectsEmit: true,
39463
+ affectsMultiFileEmitBuildInfo: true,
39464
+ affectsBundleEmitBuildInfo: true,
39435
39465
  isTSConfigOnly: true,
39436
39466
  category: ts.Diagnostics.Projects,
39437
39467
  transpileOptionValue: undefined,
@@ -39442,6 +39472,8 @@ var ts;
39442
39472
  name: "tsBuildInfoFile",
39443
39473
  type: "string",
39444
39474
  affectsEmit: true,
39475
+ affectsMultiFileEmitBuildInfo: true,
39476
+ affectsBundleEmitBuildInfo: true,
39445
39477
  isFilePath: true,
39446
39478
  paramType: ts.Diagnostics.FILE,
39447
39479
  category: ts.Diagnostics.Projects,
@@ -39453,6 +39485,7 @@ var ts;
39453
39485
  name: "removeComments",
39454
39486
  type: "boolean",
39455
39487
  affectsEmit: true,
39488
+ affectsMultiFileEmitBuildInfo: true,
39456
39489
  showInSimplifiedHelpView: true,
39457
39490
  category: ts.Diagnostics.Emit,
39458
39491
  defaultValueDescription: false,
@@ -39471,6 +39504,7 @@ var ts;
39471
39504
  name: "importHelpers",
39472
39505
  type: "boolean",
39473
39506
  affectsEmit: true,
39507
+ affectsMultiFileEmitBuildInfo: true,
39474
39508
  category: ts.Diagnostics.Emit,
39475
39509
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
39476
39510
  defaultValueDescription: false,
@@ -39484,6 +39518,7 @@ var ts;
39484
39518
  })),
39485
39519
  affectsEmit: true,
39486
39520
  affectsSemanticDiagnostics: true,
39521
+ affectsMultiFileEmitBuildInfo: true,
39487
39522
  category: ts.Diagnostics.Emit,
39488
39523
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
39489
39524
  defaultValueDescription: 0 /* Remove */,
@@ -39492,6 +39527,7 @@ var ts;
39492
39527
  name: "downlevelIteration",
39493
39528
  type: "boolean",
39494
39529
  affectsEmit: true,
39530
+ affectsMultiFileEmitBuildInfo: true,
39495
39531
  category: ts.Diagnostics.Emit,
39496
39532
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
39497
39533
  defaultValueDescription: false,
@@ -39510,6 +39546,9 @@ var ts;
39510
39546
  type: "boolean",
39511
39547
  // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
39512
39548
  // The value of each strictFlag depends on own strictFlag value or this and never accessed directly.
39549
+ // But we need to store `strict` in builf info, even though it won't be examined directly, so that the
39550
+ // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly
39551
+ affectsMultiFileEmitBuildInfo: true,
39513
39552
  showInSimplifiedHelpView: true,
39514
39553
  category: ts.Diagnostics.Type_Checking,
39515
39554
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -39519,6 +39558,7 @@ var ts;
39519
39558
  name: "noImplicitAny",
39520
39559
  type: "boolean",
39521
39560
  affectsSemanticDiagnostics: true,
39561
+ affectsMultiFileEmitBuildInfo: true,
39522
39562
  strictFlag: true,
39523
39563
  category: ts.Diagnostics.Type_Checking,
39524
39564
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -39528,6 +39568,7 @@ var ts;
39528
39568
  name: "strictNullChecks",
39529
39569
  type: "boolean",
39530
39570
  affectsSemanticDiagnostics: true,
39571
+ affectsMultiFileEmitBuildInfo: true,
39531
39572
  strictFlag: true,
39532
39573
  category: ts.Diagnostics.Type_Checking,
39533
39574
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -39536,6 +39577,8 @@ var ts;
39536
39577
  {
39537
39578
  name: "strictFunctionTypes",
39538
39579
  type: "boolean",
39580
+ affectsSemanticDiagnostics: true,
39581
+ affectsMultiFileEmitBuildInfo: true,
39539
39582
  strictFlag: true,
39540
39583
  category: ts.Diagnostics.Type_Checking,
39541
39584
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -39544,6 +39587,8 @@ var ts;
39544
39587
  {
39545
39588
  name: "strictBindCallApply",
39546
39589
  type: "boolean",
39590
+ affectsSemanticDiagnostics: true,
39591
+ affectsMultiFileEmitBuildInfo: true,
39547
39592
  strictFlag: true,
39548
39593
  category: ts.Diagnostics.Type_Checking,
39549
39594
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -39553,6 +39598,7 @@ var ts;
39553
39598
  name: "strictPropertyInitialization",
39554
39599
  type: "boolean",
39555
39600
  affectsSemanticDiagnostics: true,
39601
+ affectsMultiFileEmitBuildInfo: true,
39556
39602
  strictFlag: true,
39557
39603
  category: ts.Diagnostics.Type_Checking,
39558
39604
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -39562,6 +39608,7 @@ var ts;
39562
39608
  name: "noImplicitThis",
39563
39609
  type: "boolean",
39564
39610
  affectsSemanticDiagnostics: true,
39611
+ affectsMultiFileEmitBuildInfo: true,
39565
39612
  strictFlag: true,
39566
39613
  category: ts.Diagnostics.Type_Checking,
39567
39614
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -39571,6 +39618,7 @@ var ts;
39571
39618
  name: "useUnknownInCatchVariables",
39572
39619
  type: "boolean",
39573
39620
  affectsSemanticDiagnostics: true,
39621
+ affectsMultiFileEmitBuildInfo: true,
39574
39622
  strictFlag: true,
39575
39623
  category: ts.Diagnostics.Type_Checking,
39576
39624
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -39580,6 +39628,8 @@ var ts;
39580
39628
  name: "alwaysStrict",
39581
39629
  type: "boolean",
39582
39630
  affectsSourceFile: true,
39631
+ affectsEmit: true,
39632
+ affectsMultiFileEmitBuildInfo: true,
39583
39633
  strictFlag: true,
39584
39634
  category: ts.Diagnostics.Type_Checking,
39585
39635
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -39590,6 +39640,7 @@ var ts;
39590
39640
  name: "noUnusedLocals",
39591
39641
  type: "boolean",
39592
39642
  affectsSemanticDiagnostics: true,
39643
+ affectsMultiFileEmitBuildInfo: true,
39593
39644
  category: ts.Diagnostics.Type_Checking,
39594
39645
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
39595
39646
  defaultValueDescription: false,
@@ -39598,6 +39649,7 @@ var ts;
39598
39649
  name: "noUnusedParameters",
39599
39650
  type: "boolean",
39600
39651
  affectsSemanticDiagnostics: true,
39652
+ affectsMultiFileEmitBuildInfo: true,
39601
39653
  category: ts.Diagnostics.Type_Checking,
39602
39654
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
39603
39655
  defaultValueDescription: false,
@@ -39606,6 +39658,7 @@ var ts;
39606
39658
  name: "exactOptionalPropertyTypes",
39607
39659
  type: "boolean",
39608
39660
  affectsSemanticDiagnostics: true,
39661
+ affectsMultiFileEmitBuildInfo: true,
39609
39662
  category: ts.Diagnostics.Type_Checking,
39610
39663
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
39611
39664
  defaultValueDescription: false,
@@ -39614,6 +39667,7 @@ var ts;
39614
39667
  name: "noImplicitReturns",
39615
39668
  type: "boolean",
39616
39669
  affectsSemanticDiagnostics: true,
39670
+ affectsMultiFileEmitBuildInfo: true,
39617
39671
  category: ts.Diagnostics.Type_Checking,
39618
39672
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
39619
39673
  defaultValueDescription: false,
@@ -39623,6 +39677,7 @@ var ts;
39623
39677
  type: "boolean",
39624
39678
  affectsBindDiagnostics: true,
39625
39679
  affectsSemanticDiagnostics: true,
39680
+ affectsMultiFileEmitBuildInfo: true,
39626
39681
  category: ts.Diagnostics.Type_Checking,
39627
39682
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
39628
39683
  defaultValueDescription: false,
@@ -39631,6 +39686,7 @@ var ts;
39631
39686
  name: "noUncheckedIndexedAccess",
39632
39687
  type: "boolean",
39633
39688
  affectsSemanticDiagnostics: true,
39689
+ affectsMultiFileEmitBuildInfo: true,
39634
39690
  category: ts.Diagnostics.Type_Checking,
39635
39691
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
39636
39692
  defaultValueDescription: false,
@@ -39639,6 +39695,7 @@ var ts;
39639
39695
  name: "noImplicitOverride",
39640
39696
  type: "boolean",
39641
39697
  affectsSemanticDiagnostics: true,
39698
+ affectsMultiFileEmitBuildInfo: true,
39642
39699
  category: ts.Diagnostics.Type_Checking,
39643
39700
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
39644
39701
  defaultValueDescription: false,
@@ -39646,6 +39703,8 @@ var ts;
39646
39703
  {
39647
39704
  name: "noPropertyAccessFromIndexSignature",
39648
39705
  type: "boolean",
39706
+ affectsSemanticDiagnostics: true,
39707
+ affectsMultiFileEmitBuildInfo: true,
39649
39708
  showInSimplifiedHelpView: false,
39650
39709
  category: ts.Diagnostics.Type_Checking,
39651
39710
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -39731,6 +39790,7 @@ var ts;
39731
39790
  name: "allowSyntheticDefaultImports",
39732
39791
  type: "boolean",
39733
39792
  affectsSemanticDiagnostics: true,
39793
+ affectsMultiFileEmitBuildInfo: true,
39734
39794
  category: ts.Diagnostics.Interop_Constraints,
39735
39795
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
39736
39796
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -39740,6 +39800,7 @@ var ts;
39740
39800
  type: "boolean",
39741
39801
  affectsSemanticDiagnostics: true,
39742
39802
  affectsEmit: true,
39803
+ affectsMultiFileEmitBuildInfo: true,
39743
39804
  showInSimplifiedHelpView: true,
39744
39805
  category: ts.Diagnostics.Interop_Constraints,
39745
39806
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -39756,6 +39817,7 @@ var ts;
39756
39817
  name: "allowUmdGlobalAccess",
39757
39818
  type: "boolean",
39758
39819
  affectsSemanticDiagnostics: true,
39820
+ affectsMultiFileEmitBuildInfo: true,
39759
39821
  category: ts.Diagnostics.Modules,
39760
39822
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
39761
39823
  defaultValueDescription: false,
@@ -39777,6 +39839,7 @@ var ts;
39777
39839
  name: "sourceRoot",
39778
39840
  type: "string",
39779
39841
  affectsEmit: true,
39842
+ affectsMultiFileEmitBuildInfo: true,
39780
39843
  paramType: ts.Diagnostics.LOCATION,
39781
39844
  category: ts.Diagnostics.Emit,
39782
39845
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -39785,6 +39848,7 @@ var ts;
39785
39848
  name: "mapRoot",
39786
39849
  type: "string",
39787
39850
  affectsEmit: true,
39851
+ affectsMultiFileEmitBuildInfo: true,
39788
39852
  paramType: ts.Diagnostics.LOCATION,
39789
39853
  category: ts.Diagnostics.Emit,
39790
39854
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -39793,6 +39857,7 @@ var ts;
39793
39857
  name: "inlineSourceMap",
39794
39858
  type: "boolean",
39795
39859
  affectsEmit: true,
39860
+ affectsMultiFileEmitBuildInfo: true,
39796
39861
  category: ts.Diagnostics.Emit,
39797
39862
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
39798
39863
  defaultValueDescription: false,
@@ -39801,6 +39866,7 @@ var ts;
39801
39866
  name: "inlineSources",
39802
39867
  type: "boolean",
39803
39868
  affectsEmit: true,
39869
+ affectsMultiFileEmitBuildInfo: true,
39804
39870
  category: ts.Diagnostics.Emit,
39805
39871
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
39806
39872
  defaultValueDescription: false,
@@ -39810,6 +39876,7 @@ var ts;
39810
39876
  name: "experimentalDecorators",
39811
39877
  type: "boolean",
39812
39878
  affectsSemanticDiagnostics: true,
39879
+ affectsMultiFileEmitBuildInfo: true,
39813
39880
  category: ts.Diagnostics.Language_and_Environment,
39814
39881
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
39815
39882
  defaultValueDescription: false,
@@ -39819,6 +39886,7 @@ var ts;
39819
39886
  type: "boolean",
39820
39887
  affectsSemanticDiagnostics: true,
39821
39888
  affectsEmit: true,
39889
+ affectsMultiFileEmitBuildInfo: true,
39822
39890
  category: ts.Diagnostics.Language_and_Environment,
39823
39891
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
39824
39892
  defaultValueDescription: false,
@@ -39843,6 +39911,7 @@ var ts;
39843
39911
  type: "string",
39844
39912
  affectsSemanticDiagnostics: true,
39845
39913
  affectsEmit: true,
39914
+ affectsMultiFileEmitBuildInfo: true,
39846
39915
  affectsModuleResolution: true,
39847
39916
  category: ts.Diagnostics.Language_and_Environment,
39848
39917
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -39860,6 +39929,9 @@ var ts;
39860
39929
  name: "out",
39861
39930
  type: "string",
39862
39931
  affectsEmit: true,
39932
+ affectsMultiFileEmitBuildInfo: true,
39933
+ affectsDeclarationPath: true,
39934
+ affectsBundleEmitBuildInfo: true,
39863
39935
  isFilePath: false,
39864
39936
  // for correct behaviour, please use outFile
39865
39937
  category: ts.Diagnostics.Backwards_Compatibility,
@@ -39871,6 +39943,7 @@ var ts;
39871
39943
  name: "reactNamespace",
39872
39944
  type: "string",
39873
39945
  affectsEmit: true,
39946
+ affectsMultiFileEmitBuildInfo: true,
39874
39947
  category: ts.Diagnostics.Language_and_Environment,
39875
39948
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
39876
39949
  defaultValueDescription: "`React`",
@@ -39878,6 +39951,8 @@ var ts;
39878
39951
  {
39879
39952
  name: "skipDefaultLibCheck",
39880
39953
  type: "boolean",
39954
+ // We need to store these to determine whether `lib` files need to be rechecked
39955
+ affectsMultiFileEmitBuildInfo: true,
39881
39956
  category: ts.Diagnostics.Completeness,
39882
39957
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
39883
39958
  defaultValueDescription: false,
@@ -39893,6 +39968,7 @@ var ts;
39893
39968
  name: "emitBOM",
39894
39969
  type: "boolean",
39895
39970
  affectsEmit: true,
39971
+ affectsMultiFileEmitBuildInfo: true,
39896
39972
  category: ts.Diagnostics.Emit,
39897
39973
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
39898
39974
  defaultValueDescription: false,
@@ -39904,6 +39980,7 @@ var ts;
39904
39980
  lf: 1 /* LineFeed */
39905
39981
  })),
39906
39982
  affectsEmit: true,
39983
+ affectsMultiFileEmitBuildInfo: true,
39907
39984
  paramType: ts.Diagnostics.NEWLINE,
39908
39985
  category: ts.Diagnostics.Emit,
39909
39986
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -39913,6 +39990,7 @@ var ts;
39913
39990
  name: "noErrorTruncation",
39914
39991
  type: "boolean",
39915
39992
  affectsSemanticDiagnostics: true,
39993
+ affectsMultiFileEmitBuildInfo: true,
39916
39994
  category: ts.Diagnostics.Output_Formatting,
39917
39995
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
39918
39996
  defaultValueDescription: false,
@@ -39943,6 +40021,7 @@ var ts;
39943
40021
  name: "stripInternal",
39944
40022
  type: "boolean",
39945
40023
  affectsEmit: true,
40024
+ affectsMultiFileEmitBuildInfo: true,
39946
40025
  category: ts.Diagnostics.Emit,
39947
40026
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
39948
40027
  defaultValueDescription: false,
@@ -39983,6 +40062,7 @@ var ts;
39983
40062
  name: "noImplicitUseStrict",
39984
40063
  type: "boolean",
39985
40064
  affectsSemanticDiagnostics: true,
40065
+ affectsMultiFileEmitBuildInfo: true,
39986
40066
  category: ts.Diagnostics.Backwards_Compatibility,
39987
40067
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
39988
40068
  defaultValueDescription: false,
@@ -39991,6 +40071,7 @@ var ts;
39991
40071
  name: "noEmitHelpers",
39992
40072
  type: "boolean",
39993
40073
  affectsEmit: true,
40074
+ affectsMultiFileEmitBuildInfo: true,
39994
40075
  category: ts.Diagnostics.Emit,
39995
40076
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
39996
40077
  defaultValueDescription: false,
@@ -39999,6 +40080,7 @@ var ts;
39999
40080
  name: "noEmitOnError",
40000
40081
  type: "boolean",
40001
40082
  affectsEmit: true,
40083
+ affectsMultiFileEmitBuildInfo: true,
40002
40084
  category: ts.Diagnostics.Emit,
40003
40085
  transpileOptionValue: undefined,
40004
40086
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -40008,6 +40090,7 @@ var ts;
40008
40090
  name: "preserveConstEnums",
40009
40091
  type: "boolean",
40010
40092
  affectsEmit: true,
40093
+ affectsMultiFileEmitBuildInfo: true,
40011
40094
  category: ts.Diagnostics.Emit,
40012
40095
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
40013
40096
  defaultValueDescription: false,
@@ -40016,6 +40099,8 @@ var ts;
40016
40099
  name: "declarationDir",
40017
40100
  type: "string",
40018
40101
  affectsEmit: true,
40102
+ affectsMultiFileEmitBuildInfo: true,
40103
+ affectsDeclarationPath: true,
40019
40104
  isFilePath: true,
40020
40105
  paramType: ts.Diagnostics.DIRECTORY,
40021
40106
  category: ts.Diagnostics.Emit,
@@ -40025,6 +40110,8 @@ var ts;
40025
40110
  {
40026
40111
  name: "skipLibCheck",
40027
40112
  type: "boolean",
40113
+ // We need to store these to determine whether `lib` files need to be rechecked
40114
+ affectsMultiFileEmitBuildInfo: true,
40028
40115
  category: ts.Diagnostics.Completeness,
40029
40116
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
40030
40117
  defaultValueDescription: false,
@@ -40034,6 +40121,7 @@ var ts;
40034
40121
  type: "boolean",
40035
40122
  affectsBindDiagnostics: true,
40036
40123
  affectsSemanticDiagnostics: true,
40124
+ affectsMultiFileEmitBuildInfo: true,
40037
40125
  category: ts.Diagnostics.Type_Checking,
40038
40126
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
40039
40127
  defaultValueDescription: undefined,
@@ -40043,6 +40131,7 @@ var ts;
40043
40131
  type: "boolean",
40044
40132
  affectsBindDiagnostics: true,
40045
40133
  affectsSemanticDiagnostics: true,
40134
+ affectsMultiFileEmitBuildInfo: true,
40046
40135
  category: ts.Diagnostics.Type_Checking,
40047
40136
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
40048
40137
  defaultValueDescription: undefined,
@@ -40051,6 +40140,7 @@ var ts;
40051
40140
  name: "suppressExcessPropertyErrors",
40052
40141
  type: "boolean",
40053
40142
  affectsSemanticDiagnostics: true,
40143
+ affectsMultiFileEmitBuildInfo: true,
40054
40144
  category: ts.Diagnostics.Backwards_Compatibility,
40055
40145
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
40056
40146
  defaultValueDescription: false,
@@ -40059,6 +40149,7 @@ var ts;
40059
40149
  name: "suppressImplicitAnyIndexErrors",
40060
40150
  type: "boolean",
40061
40151
  affectsSemanticDiagnostics: true,
40152
+ affectsMultiFileEmitBuildInfo: true,
40062
40153
  category: ts.Diagnostics.Backwards_Compatibility,
40063
40154
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
40064
40155
  defaultValueDescription: false,
@@ -40083,6 +40174,7 @@ var ts;
40083
40174
  name: "noStrictGenericChecks",
40084
40175
  type: "boolean",
40085
40176
  affectsSemanticDiagnostics: true,
40177
+ affectsMultiFileEmitBuildInfo: true,
40086
40178
  category: ts.Diagnostics.Backwards_Compatibility,
40087
40179
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
40088
40180
  defaultValueDescription: false,
@@ -40092,6 +40184,7 @@ var ts;
40092
40184
  type: "boolean",
40093
40185
  affectsSemanticDiagnostics: true,
40094
40186
  affectsEmit: true,
40187
+ affectsMultiFileEmitBuildInfo: true,
40095
40188
  category: ts.Diagnostics.Language_and_Environment,
40096
40189
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
40097
40190
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -40100,6 +40193,7 @@ var ts;
40100
40193
  name: "preserveValueImports",
40101
40194
  type: "boolean",
40102
40195
  affectsEmit: true,
40196
+ affectsMultiFileEmitBuildInfo: true,
40103
40197
  category: ts.Diagnostics.Emit,
40104
40198
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
40105
40199
  defaultValueDescription: false,
@@ -40143,6 +40237,8 @@ var ts;
40143
40237
  /* @internal */
40144
40238
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
40145
40239
  /* @internal */
40240
+ ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
40241
+ /* @internal */
40146
40242
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
40147
40243
  /* @internal */
40148
40244
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -40998,6 +41094,7 @@ var ts;
40998
41094
  return optionDefinition.type;
40999
41095
  }
41000
41096
  }
41097
+ /* @internal */
41001
41098
  function getNameOfCompilerOptionValue(value, customTypeMap) {
41002
41099
  // There is a typeMap associated with this command-line option so use it to map value back to its name
41003
41100
  return ts.forEachEntry(customTypeMap, function (mapValue, key) {
@@ -41006,6 +41103,7 @@ var ts;
41006
41103
  }
41007
41104
  });
41008
41105
  }
41106
+ ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
41009
41107
  function serializeCompilerOptions(options, pathOptions) {
41010
41108
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
41011
41109
  }
@@ -44444,7 +44542,7 @@ var ts;
44444
44542
  return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + moduleName + "\"");
44445
44543
  }
44446
44544
  if (name.kind === 162 /* ComputedPropertyName */) {
44447
- var nameExpression = ts.getComputedPropertyNameExpression(name);
44545
+ var nameExpression = name.expression;
44448
44546
  // treat computed property names where expression is string/numeric literal as just string/numeric literal
44449
44547
  if (ts.isStringOrNumericLiteralLike(nameExpression)) {
44450
44548
  return ts.escapeLeadingUnderscores(nameExpression.text);
@@ -48333,6 +48431,7 @@ var ts;
48333
48431
  var keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
48334
48432
  var numberOrBigIntType = getUnionType([numberType, bigintType]);
48335
48433
  var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
48434
+ var numericStringType = getTemplateLiteralType(["", ""], [numberType]); // The `${number}` type
48336
48435
  var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; });
48337
48436
  var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; });
48338
48437
  var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never"); // `uniqueLiteralType` is a special `never` flagged by union reduction to behave as a literal
@@ -51314,7 +51413,7 @@ var ts;
51314
51413
  }
51315
51414
  }
51316
51415
  function getExportSymbolOfValueSymbolIfExported(symbol) {
51317
- return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 ? symbol.exportSymbol : symbol);
51416
+ return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 && symbol.exportSymbol || symbol);
51318
51417
  }
51319
51418
  function symbolIsValue(symbol) {
51320
51419
  return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */ && !getTypeOnlyAliasDeclaration(symbol));
@@ -58717,7 +58816,7 @@ var ts;
58717
58816
  var typeVariable = getHomomorphicTypeVariable(type);
58718
58817
  if (typeVariable && !type.declaration.nameType) {
58719
58818
  var constraint = getConstraintOfTypeParameter(typeVariable);
58720
- if (constraint && (isArrayType(constraint) || isTupleType(constraint))) {
58819
+ if (constraint && isArrayOrTupleType(constraint)) {
58721
58820
  return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
58722
58821
  }
58723
58822
  }
@@ -59079,10 +59178,10 @@ var ts;
59079
59178
  }
59080
59179
  function isApplicableIndexType(source, target) {
59081
59180
  // A 'string' index signature applies to types assignable to 'string' or 'number', and a 'number' index
59082
- // signature applies to types assignable to 'number' and numeric string literal types.
59181
+ // signature applies to types assignable to 'number', `${number}` and numeric string literal types.
59083
59182
  return isTypeAssignableTo(source, target) ||
59084
59183
  target === stringType && isTypeAssignableTo(source, numberType) ||
59085
- target === numberType && !!(source.flags & 128 /* StringLiteral */) && ts.isNumericLiteralName(source.value);
59184
+ target === numberType && (source === numericStringType || !!(source.flags & 128 /* StringLiteral */) && ts.isNumericLiteralName(source.value));
59086
59185
  }
59087
59186
  function getIndexInfosOfStructuredType(type) {
59088
59187
  if (type.flags & 3670016 /* StructuredType */) {
@@ -60098,6 +60197,20 @@ var ts;
60098
60197
  constraints = ts.append(constraints, constraint);
60099
60198
  }
60100
60199
  }
60200
+ // Given a homomorphic mapped type { [K in keyof T]: XXX }, where T is constrained to an array or tuple type, in the
60201
+ // template type XXX, K has an added constraint of number | `${number}`.
60202
+ else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 195 /* MappedType */ && node === parent.type) {
60203
+ var mappedType = getTypeFromTypeNode(parent);
60204
+ if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
60205
+ var typeParameter = getHomomorphicTypeVariable(mappedType);
60206
+ if (typeParameter) {
60207
+ var constraint = getConstraintOfTypeParameter(typeParameter);
60208
+ if (constraint && everyType(constraint, isArrayOrTupleType)) {
60209
+ constraints = ts.append(constraints, getUnionType([numberType, numericStringType]));
60210
+ }
60211
+ }
60212
+ }
60213
+ }
60101
60214
  node = parent;
60102
60215
  }
60103
60216
  return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type;
@@ -61065,7 +61178,7 @@ var ts;
61065
61178
  while (i > 0) {
61066
61179
  i--;
61067
61180
  var t = types[i];
61068
- var remove = t.flags & 4 /* String */ && includes & 128 /* StringLiteral */ ||
61181
+ var remove = t.flags & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
61069
61182
  t.flags & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
61070
61183
  t.flags & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
61071
61184
  t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */;
@@ -61224,7 +61337,7 @@ var ts;
61224
61337
  if (!strictNullChecks && includes & 98304 /* Nullable */) {
61225
61338
  return includes & 32768 /* Undefined */ ? undefinedType : nullType;
61226
61339
  }
61227
- if (includes & 4 /* String */ && includes & 128 /* StringLiteral */ ||
61340
+ if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
61228
61341
  includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
61229
61342
  includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
61230
61343
  includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */) {
@@ -63108,7 +63221,7 @@ var ts;
63108
63221
  if (!type.declaration.nameType) {
63109
63222
  var constraint = void 0;
63110
63223
  if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 &&
63111
- (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, ts.or(isArrayType, isTupleType))) {
63224
+ (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
63112
63225
  return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
63113
63226
  }
63114
63227
  if (isGenericTupleType(t)) {
@@ -64546,7 +64659,7 @@ var ts;
64546
64659
  }
64547
64660
  return false;
64548
64661
  }
64549
- return isTupleType(target) || isArrayType(target);
64662
+ return isArrayOrTupleType(target);
64550
64663
  }
64551
64664
  if (isReadonlyArrayType(source) && isMutableArrayOrTuple(target)) {
64552
64665
  if (reportErrors) {
@@ -64676,7 +64789,7 @@ var ts;
64676
64789
  // We suppress recursive intersection property checks because they can generate lots of work when relating
64677
64790
  // recursive intersections that are structurally similar but not exactly identical. See #37854.
64678
64791
  if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
64679
- 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 */); }))) {
64792
+ 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 */); }))) {
64680
64793
  inPropertyCheck = true;
64681
64794
  result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* PropertyCheck */, recursionFlags);
64682
64795
  inPropertyCheck = false;
@@ -65664,7 +65777,7 @@ var ts;
65664
65777
  return varianceResult;
65665
65778
  }
65666
65779
  }
65667
- else if (isReadonlyArrayType(target) ? isArrayType(source) || isTupleType(source) : isArrayType(target) && isTupleType(source) && !source.target.readonly) {
65780
+ else if (isReadonlyArrayType(target) ? isArrayOrTupleType(source) : isArrayType(target) && isTupleType(source) && !source.target.readonly) {
65668
65781
  if (relation !== identityRelation) {
65669
65782
  return isRelatedTo(getIndexTypeOfType(source, numberType) || anyType, getIndexTypeOfType(target, numberType) || anyType, 3 /* Both */, reportErrors);
65670
65783
  }
@@ -66040,7 +66153,7 @@ var ts;
66040
66153
  }
66041
66154
  var result = -1 /* True */;
66042
66155
  if (isTupleType(target)) {
66043
- if (isArrayType(source) || isTupleType(source)) {
66156
+ if (isArrayOrTupleType(source)) {
66044
66157
  if (!target.target.readonly && (isReadonlyArrayType(source) || isTupleType(source) && source.target.readonly)) {
66045
66158
  return 0 /* False */;
66046
66159
  }
@@ -67001,6 +67114,9 @@ var ts;
67001
67114
  function isReadonlyArrayType(type) {
67002
67115
  return !!(ts.getObjectFlags(type) & 4 /* Reference */) && type.target === globalReadonlyArrayType;
67003
67116
  }
67117
+ function isArrayOrTupleType(type) {
67118
+ return isArrayType(type) || isTupleType(type);
67119
+ }
67004
67120
  function isMutableArrayOrTuple(type) {
67005
67121
  return isArrayType(type) && !isReadonlyArrayType(type) || isTupleType(type) && !type.target.readonly;
67006
67122
  }
@@ -67452,7 +67568,7 @@ var ts;
67452
67568
  else if (type.flags & 2097152 /* Intersection */) {
67453
67569
  result = getIntersectionType(ts.sameMap(type.types, getWidenedType));
67454
67570
  }
67455
- else if (isArrayType(type) || isTupleType(type)) {
67571
+ else if (isArrayOrTupleType(type)) {
67456
67572
  result = createTypeReference(type.target, ts.sameMap(getTypeArguments(type), getWidenedType));
67457
67573
  }
67458
67574
  if (result && context === undefined) {
@@ -67489,7 +67605,7 @@ var ts;
67489
67605
  }
67490
67606
  }
67491
67607
  }
67492
- if (isArrayType(type) || isTupleType(type)) {
67608
+ if (isArrayOrTupleType(type)) {
67493
67609
  for (var _b = 0, _c = getTypeArguments(type); _b < _c.length; _b++) {
67494
67610
  var t = _c[_b];
67495
67611
  if (reportWideningErrorsInType(t)) {
@@ -68550,7 +68666,7 @@ var ts;
68550
68666
  }
68551
68667
  // Infer from the members of source and target only if the two types are possibly related
68552
68668
  if (!typesDefinitelyUnrelated(source, target)) {
68553
- if (isArrayType(source) || isTupleType(source)) {
68669
+ if (isArrayOrTupleType(source)) {
68554
68670
  if (isTupleType(target)) {
68555
68671
  var sourceArity = getTypeReferenceArity(source);
68556
68672
  var targetArity = getTypeReferenceArity(target);
@@ -75571,8 +75687,14 @@ var ts;
75571
75687
  var parameterRange = hasRestParameter ? min
75572
75688
  : min < max ? min + "-" + max
75573
75689
  : min;
75574
- var error = hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1
75575
- : parameterRange === 1 && args.length === 0 && isPromiseResolveArityError(node) ? ts.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise
75690
+ var isVoidPromiseError = !hasRestParameter && parameterRange === 1 && args.length === 0 && isPromiseResolveArityError(node);
75691
+ if (isVoidPromiseError && ts.isInJSFile(node)) {
75692
+ return getDiagnosticForCallNode(node, ts.Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments);
75693
+ }
75694
+ var error = hasRestParameter
75695
+ ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1
75696
+ : isVoidPromiseError
75697
+ ? ts.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise
75576
75698
  : ts.Diagnostics.Expected_0_arguments_but_got_1;
75577
75699
  if (min < args.length && args.length < max) {
75578
75700
  // between min and max, but with no matching overload
@@ -109830,7 +109952,8 @@ var ts;
109830
109952
  return;
109831
109953
  }
109832
109954
  var version = ts.version; // Extracted into a const so the form is stable between namespace and module
109833
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), /*writeByteOrderMark*/ false);
109955
+ var buildInfo = { bundle: bundle, program: program, version: version };
109956
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
109834
109957
  }
109835
109958
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
109836
109959
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -109984,13 +110107,18 @@ var ts;
109984
110107
  if (sourceMapFilePath) {
109985
110108
  var sourceMap = sourceMapGenerator.toString();
109986
110109
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110110
+ if (printer.bundleFileInfo)
110111
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
109987
110112
  }
109988
110113
  }
109989
110114
  else {
109990
110115
  writer.writeLine();
109991
110116
  }
109992
110117
  // Write the output file
109993
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110118
+ var text = writer.getText();
110119
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110120
+ if (printer.bundleFileInfo)
110121
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
109994
110122
  // Reset state
109995
110123
  writer.clear();
109996
110124
  }
@@ -110133,34 +110261,54 @@ var ts;
110133
110261
  }
110134
110262
  /*@internal*/
110135
110263
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
110264
+ var createHash = ts.maybeBind(host, host.createHash);
110136
110265
  var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
110137
- var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
110138
- if (!buildInfoText)
110266
+ var buildInfo;
110267
+ if (host.getBuildInfo) {
110268
+ var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
110269
+ if (!hostBuildInfo)
110270
+ return buildInfoPath;
110271
+ buildInfo = hostBuildInfo;
110272
+ }
110273
+ else {
110274
+ var buildInfoText = host.readFile(buildInfoPath);
110275
+ if (!buildInfoText)
110276
+ return buildInfoPath;
110277
+ buildInfo = getBuildInfo(buildInfoText);
110278
+ }
110279
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
110139
110280
  return buildInfoPath;
110140
110281
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
110141
110282
  if (!jsFileText)
110142
110283
  return jsFilePath;
110284
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
110285
+ return jsFilePath;
110143
110286
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
110144
110287
  // error if no source map or for now if inline sourcemap
110145
110288
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
110146
110289
  return sourceMapFilePath || "inline sourcemap decoding";
110290
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
110291
+ return sourceMapFilePath;
110147
110292
  // read declaration text
110148
110293
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
110149
110294
  if (declarationFilePath && !declarationText)
110150
110295
  return declarationFilePath;
110296
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
110297
+ return declarationFilePath;
110151
110298
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
110152
110299
  // error if no source map or for now if inline sourcemap
110153
110300
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
110154
110301
  return declarationMapPath || "inline sourcemap decoding";
110155
- var buildInfo = getBuildInfo(buildInfoText);
110156
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
110157
- return buildInfoPath;
110302
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
110303
+ return declarationMapPath;
110158
110304
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110159
110305
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
110160
110306
  /*onlyOwnText*/ true);
110161
110307
  var outputFiles = [];
110162
110308
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
110163
110309
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
110310
+ var changedDtsText;
110311
+ var changedDtsData;
110164
110312
  var emitHost = {
110165
110313
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
110166
110314
  getCanonicalFileName: host.getCanonicalFileName,
@@ -110176,7 +110324,7 @@ var ts;
110176
110324
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
110177
110325
  getProjectReferenceRedirect: ts.returnUndefined,
110178
110326
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
110179
- writeFile: function (name, text, writeByteOrderMark) {
110327
+ writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
110180
110328
  switch (name) {
110181
110329
  case jsFilePath:
110182
110330
  if (jsFileText === text)
@@ -110187,8 +110335,13 @@ var ts;
110187
110335
  return;
110188
110336
  break;
110189
110337
  case buildInfoPath:
110190
- var newBuildInfo = getBuildInfo(text);
110338
+ var newBuildInfo = data.buildInfo;
110191
110339
  newBuildInfo.program = buildInfo.program;
110340
+ if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
110341
+ // Update the output signature
110342
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
110343
+ newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
110344
+ }
110192
110345
  // Update sourceFileInfo
110193
110346
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
110194
110347
  newBuildInfo.bundle.js.sources = js.sources;
@@ -110196,11 +110349,13 @@ var ts;
110196
110349
  newBuildInfo.bundle.dts.sources = dts.sources;
110197
110350
  }
110198
110351
  newBuildInfo.bundle.sourceFiles = sourceFiles;
110199
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
110352
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
110200
110353
  return;
110201
110354
  case declarationFilePath:
110202
110355
  if (declarationText === text)
110203
110356
  return;
110357
+ changedDtsText = text;
110358
+ changedDtsData = data;
110204
110359
  break;
110205
110360
  case declarationMapPath:
110206
110361
  if (declarationMapText === text)
@@ -110219,6 +110374,7 @@ var ts;
110219
110374
  getSourceFileFromReference: ts.returnUndefined,
110220
110375
  redirectTargetsMap: ts.createMultiMap(),
110221
110376
  getFileIncludeReasons: ts.notImplemented,
110377
+ createHash: createHash,
110222
110378
  };
110223
110379
  emitFiles(ts.notImplementedResolver, emitHost,
110224
110380
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
@@ -115303,12 +115459,10 @@ var ts;
115303
115459
  }
115304
115460
  ts.createCompilerHost = createCompilerHost;
115305
115461
  /*@internal*/
115306
- // TODO(shkamat): update this after reworking ts build API
115307
115462
  function createCompilerHostWorker(options, setParentNodes, system) {
115308
115463
  if (system === void 0) { system = ts.sys; }
115309
115464
  var existingDirectories = new ts.Map();
115310
115465
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
115311
- var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
115312
115466
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
115313
115467
  var text;
115314
115468
  try {
@@ -115341,7 +115495,7 @@ var ts;
115341
115495
  // NOTE: If patchWriteFileEnsuringDirectory has been called,
115342
115496
  // the system.writeFile will do its own directory creation and
115343
115497
  // the ensureDirectoriesExist call will always be redundant.
115344
- 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); });
115498
+ 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); });
115345
115499
  ts.performance.mark("afterIOWrite");
115346
115500
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
115347
115501
  }
@@ -115351,35 +115505,6 @@ var ts;
115351
115505
  }
115352
115506
  }
115353
115507
  }
115354
- var outputFingerprints;
115355
- function writeFileWorker(fileName, data, writeByteOrderMark) {
115356
- if (!ts.isWatchSet(options) || !system.getModifiedTime) {
115357
- system.writeFile(fileName, data, writeByteOrderMark);
115358
- return;
115359
- }
115360
- if (!outputFingerprints) {
115361
- outputFingerprints = new ts.Map();
115362
- }
115363
- var hash = computeHash(data);
115364
- var mtimeBefore = system.getModifiedTime(fileName);
115365
- if (mtimeBefore) {
115366
- var fingerprint = outputFingerprints.get(fileName);
115367
- // If output has not been changed, and the file has no external modification
115368
- if (fingerprint &&
115369
- fingerprint.byteOrderMark === writeByteOrderMark &&
115370
- fingerprint.hash === hash &&
115371
- fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
115372
- return;
115373
- }
115374
- }
115375
- system.writeFile(fileName, data, writeByteOrderMark);
115376
- var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
115377
- outputFingerprints.set(fileName, {
115378
- hash: hash,
115379
- byteOrderMark: writeByteOrderMark,
115380
- mtime: mtimeAfter
115381
- });
115382
- }
115383
115508
  function getDefaultLibLocation() {
115384
115509
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
115385
115510
  }
@@ -116931,6 +117056,7 @@ var ts;
116931
117056
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
116932
117057
  redirectTargetsMap: redirectTargetsMap,
116933
117058
  getFileIncludeReasons: program.getFileIncludeReasons,
117059
+ createHash: ts.maybeBind(host, host.createHash),
116934
117060
  };
116935
117061
  }
116936
117062
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -119044,13 +119170,9 @@ var ts;
119044
119170
  function createManyToManyPathMap() {
119045
119171
  function create(forward, reverse, deleted) {
119046
119172
  var map = {
119047
- clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119048
- forEach: function (fn) { return forward.forEach(fn); },
119049
119173
  getKeys: function (v) { return reverse.get(v); },
119050
119174
  getValues: function (k) { return forward.get(k); },
119051
- hasKey: function (k) { return forward.has(k); },
119052
119175
  keys: function () { return forward.keys(); },
119053
- deletedKeys: function () { return deleted; },
119054
119176
  deleteKey: function (k) {
119055
119177
  (deleted || (deleted = new ts.Set())).add(k);
119056
119178
  var set = forward.get(k);
@@ -119077,11 +119199,6 @@ var ts;
119077
119199
  });
119078
119200
  return map;
119079
119201
  },
119080
- clear: function () {
119081
- forward.clear();
119082
- reverse.clear();
119083
- deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119084
- }
119085
119202
  };
119086
119203
  return map;
119087
119204
  }
@@ -119209,18 +119326,21 @@ var ts;
119209
119326
  * Creates the state of file references and signature for the new program from oldState if it is safe
119210
119327
  */
119211
119328
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119329
+ var _a, _b, _c;
119212
119330
  var fileInfos = new ts.Map();
119213
119331
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
119214
119332
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
119215
- var hasCalledUpdateShapeSignature = new ts.Set();
119216
119333
  var useOldState = canReuseOldState(referencedMap, oldState);
119217
119334
  // Ensure source files have parent pointers set
119218
119335
  newProgram.getTypeChecker();
119219
119336
  // Create the reference map, and set the file infos
119220
- for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
119221
- var sourceFile = _a[_i];
119337
+ for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
119338
+ var sourceFile = _d[_i];
119222
119339
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
119223
- var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
119340
+ var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
119341
+ var signature = oldUncommitedSignature === undefined ?
119342
+ useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
119343
+ oldUncommitedSignature || undefined;
119224
119344
  if (referencedMap) {
119225
119345
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
119226
119346
  if (newReferences) {
@@ -119228,19 +119348,26 @@ var ts;
119228
119348
  }
119229
119349
  // Copy old visible to outside files map
119230
119350
  if (useOldState) {
119231
- var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
119351
+ var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
119352
+ var exportedModules = oldUncommitedExportedModules === undefined ?
119353
+ oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
119354
+ oldUncommitedExportedModules || undefined;
119232
119355
  if (exportedModules) {
119233
119356
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119234
119357
  }
119235
119358
  }
119236
119359
  }
119237
- fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
119360
+ fileInfos.set(sourceFile.resolvedPath, {
119361
+ version: version_2,
119362
+ signature: signature,
119363
+ affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
119364
+ impliedFormat: sourceFile.impliedNodeFormat
119365
+ });
119238
119366
  }
119239
119367
  return {
119240
119368
  fileInfos: fileInfos,
119241
119369
  referencedMap: referencedMap,
119242
119370
  exportedModulesMap: exportedModulesMap,
119243
- hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
119244
119371
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
119245
119372
  };
119246
119373
  }
@@ -119254,71 +119381,42 @@ var ts;
119254
119381
  }
119255
119382
  BuilderState.releaseCache = releaseCache;
119256
119383
  /**
119257
- * Creates a clone of the state
119384
+ * Gets the files affected by the path from the program
119258
119385
  */
119259
- function clone(state) {
119386
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
119260
119387
  var _a, _b;
119261
- // Dont need to backup allFiles info since its cache anyway
119262
- return {
119263
- fileInfos: new ts.Map(state.fileInfos),
119264
- referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
119265
- exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
119266
- hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
119267
- useFileVersionAsSignature: state.useFileVersionAsSignature,
119268
- };
119388
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
119389
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119390
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119391
+ return result;
119269
119392
  }
119270
- BuilderState.clone = clone;
119271
- /**
119272
- * Gets the files affected by the path from the program
119273
- */
119274
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
119275
- // Since the operation could be cancelled, the signatures are always stored in the cache
119276
- // They will be committed once it is safe to use them
119277
- // eg when calling this api from tsserver, if there is no cancellation of the operation
119278
- // In the other cases the affected files signatures are committed only after the iteration through the result is complete
119279
- var signatureCache = cacheToUpdateSignature || new ts.Map();
119393
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119394
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
119280
119395
  var sourceFile = programOfThisState.getSourceFileByPath(path);
119281
119396
  if (!sourceFile) {
119282
119397
  return ts.emptyArray;
119283
119398
  }
119284
- if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
119399
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
119285
119400
  return [sourceFile];
119286
119401
  }
119287
- var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
119288
- if (!cacheToUpdateSignature) {
119289
- // Commit all the signatures in the signature cache
119290
- updateSignaturesFromCache(state, signatureCache);
119291
- }
119292
- return result;
119293
- }
119294
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119295
- /**
119296
- * Updates the signatures from the cache into state's fileinfo signatures
119297
- * This should be called whenever it is safe to commit the state of the builder
119298
- */
119299
- function updateSignaturesFromCache(state, signatureCache) {
119300
- signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
119402
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
119301
119403
  }
119302
- BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
119404
+ BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
119303
119405
  function updateSignatureOfFile(state, signature, path) {
119304
119406
  state.fileInfos.get(path).signature = signature;
119305
- state.hasCalledUpdateShapeSignature.add(path);
119407
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
119306
119408
  }
119307
119409
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
119308
119410
  /**
119309
119411
  * Returns if the shape of the signature has changed since last emit
119310
119412
  */
119311
- function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
119413
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
119414
+ var _a;
119312
119415
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
119313
- ts.Debug.assert(!!sourceFile);
119314
- ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
119315
119416
  // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
119316
- if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
119417
+ if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
119317
119418
  return false;
119318
- }
119319
119419
  var info = state.fileInfos.get(sourceFile.resolvedPath);
119320
- if (!info)
119321
- return ts.Debug.fail();
119322
119420
  var prevSignature = info.signature;
119323
119421
  var latestSignature;
119324
119422
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -119329,45 +119427,55 @@ var ts;
119329
119427
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119330
119428
  if (firstDts_1) {
119331
119429
  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; })); });
119332
- latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119333
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119334
- updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
119430
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
119431
+ if (latestSignature !== prevSignature) {
119432
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
119335
119433
  }
119336
119434
  }
119337
119435
  }
119338
119436
  // Default is to use file version as signature
119339
119437
  if (latestSignature === undefined) {
119340
119438
  latestSignature = sourceFile.version;
119341
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119439
+ if (state.exportedModulesMap && latestSignature !== prevSignature) {
119440
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119342
119441
  // All the references in this file are exported
119343
119442
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
119344
119443
  if (references) {
119345
- exportedModulesMapCache.set(sourceFile.resolvedPath, references);
119444
+ state.exportedModulesMap.set(sourceFile.resolvedPath, references);
119346
119445
  }
119347
119446
  else {
119348
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119447
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119349
119448
  }
119350
119449
  }
119351
119450
  }
119352
- cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
119451
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
119452
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
119453
+ info.signature = latestSignature;
119353
119454
  return latestSignature !== prevSignature;
119354
119455
  }
119355
119456
  BuilderState.updateShapeSignature = updateShapeSignature;
119457
+ function computeSignature(text, computeHash) {
119458
+ return (computeHash || ts.generateDjb2Hash)(text);
119459
+ }
119460
+ BuilderState.computeSignature = computeSignature;
119356
119461
  /**
119357
119462
  * Coverts the declaration emit result into exported modules map
119358
119463
  */
119359
- function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
119464
+ function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
119465
+ if (!state.exportedModulesMap)
119466
+ return;
119467
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119360
119468
  if (!exportedModulesFromDeclarationEmit) {
119361
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119469
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119362
119470
  return;
119363
119471
  }
119364
119472
  var exportedModules;
119365
119473
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
119366
119474
  if (exportedModules) {
119367
- exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
119475
+ state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119368
119476
  }
119369
119477
  else {
119370
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119478
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119371
119479
  }
119372
119480
  function addExportedModule(exportedModulePaths) {
119373
119481
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -119379,19 +119487,6 @@ var ts;
119379
119487
  }
119380
119488
  }
119381
119489
  BuilderState.updateExportedModules = updateExportedModules;
119382
- /**
119383
- * Updates the exported modules from cache into state's exported modules map
119384
- * This should be called whenever it is safe to commit the state of the builder
119385
- */
119386
- function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
119387
- var _a;
119388
- if (exportedModulesMapCache) {
119389
- ts.Debug.assert(!!state.exportedModulesMap);
119390
- (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
119391
- exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
119392
- }
119393
- }
119394
- BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
119395
119490
  /**
119396
119491
  * Get all the dependencies of the sourceFile
119397
119492
  */
@@ -119512,7 +119607,7 @@ var ts;
119512
119607
  /**
119513
119608
  * When program emits modular code, gets the files affected by the sourceFile whose shape has changed
119514
119609
  */
119515
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
119610
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
119516
119611
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
119517
119612
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
119518
119613
  }
@@ -119532,7 +119627,7 @@ var ts;
119532
119627
  if (!seenFileNamesMap.has(currentPath)) {
119533
119628
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
119534
119629
  seenFileNamesMap.set(currentPath, currentSourceFile);
119535
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
119630
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
119536
119631
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
119537
119632
  }
119538
119633
  }
@@ -119558,32 +119653,33 @@ var ts;
119558
119653
  * Create the state so that we can iterate on changedFiles/affected files
119559
119654
  */
119560
119655
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119656
+ var _a, _b;
119561
119657
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
119562
119658
  state.program = newProgram;
119563
119659
  var compilerOptions = newProgram.getCompilerOptions();
119564
119660
  state.compilerOptions = compilerOptions;
119661
+ var outFilePath = ts.outFile(compilerOptions);
119565
119662
  // With --out or --outFile, any change affects all semantic diagnostics so no need to cache them
119566
- if (!ts.outFile(compilerOptions)) {
119663
+ if (!outFilePath) {
119567
119664
  state.semanticDiagnosticsPerFile = new ts.Map();
119568
119665
  }
119666
+ 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)) {
119667
+ state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
119668
+ }
119569
119669
  state.changedFilesSet = new ts.Set();
119670
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
119570
119671
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
119571
119672
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
119572
119673
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
119573
119674
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
119675
+ var canCopyEmitSignatures = compilerOptions.composite &&
119676
+ (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
119677
+ !outFilePath &&
119678
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
119574
119679
  if (useOldState) {
119575
- // Verify the sanity of old state
119576
- if (!oldState.currentChangedFilePath) {
119577
- var affectedSignatures = oldState.currentAffectedFilesSignatures;
119578
- ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
119579
- }
119580
- var changedFilesSet = oldState.changedFilesSet;
119581
- if (canCopySemanticDiagnostics) {
119582
- ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
119583
- }
119584
119680
  // Copy old state's changed files set
119585
- changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
119586
- if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
119681
+ (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
119682
+ if (!outFilePath && oldState.affectedFilesPendingEmit) {
119587
119683
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
119588
119684
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
119589
119685
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -119604,6 +119700,8 @@ var ts;
119604
119700
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
119605
119701
  // versions dont match
119606
119702
  oldInfo.version !== info.version ||
119703
+ // Implied formats dont match
119704
+ oldInfo.impliedFormat !== info.impliedFormat ||
119607
119705
  // Referenced files changed
119608
119706
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
119609
119707
  // Referenced file was deleted in the new program
@@ -119627,27 +119725,25 @@ var ts;
119627
119725
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
119628
119726
  }
119629
119727
  }
119728
+ if (canCopyEmitSignatures) {
119729
+ var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
119730
+ if (oldEmitSignature)
119731
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
119732
+ }
119630
119733
  });
119631
119734
  // If the global file is removed, add all files as changed
119632
119735
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
119633
119736
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, /*firstSourceFile*/ undefined)
119634
119737
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
119635
119738
  }
119636
- else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
119739
+ else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
119637
119740
  // Add all files to affectedFilesPendingEmit since emit changed
119638
119741
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1 /* Full */); });
119639
119742
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
119640
119743
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
119641
119744
  }
119642
- if (useOldState) {
119643
- // Any time the interpretation of a source file changes, mark it as changed
119644
- ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
119645
- if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
119646
- state.changedFilesSet.add(sourceFilePath);
119647
- }
119648
- });
119649
- }
119650
- state.buildInfoEmitPending = !!state.changedFilesSet.size;
119745
+ // Since old states change files set is copied, any additional change means we would need to emit build info
119746
+ state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
119651
119747
  return state;
119652
119748
  }
119653
119749
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -119683,30 +119779,35 @@ var ts;
119683
119779
  ts.BuilderState.releaseCache(state);
119684
119780
  state.program = undefined;
119685
119781
  }
119686
- /**
119687
- * Creates a clone of the state
119688
- */
119689
- function cloneBuilderProgramState(state) {
119690
- var _a;
119691
- var newState = ts.BuilderState.clone(state);
119692
- newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
119693
- newState.changedFilesSet = new ts.Set(state.changedFilesSet);
119694
- newState.affectedFiles = state.affectedFiles;
119695
- newState.affectedFilesIndex = state.affectedFilesIndex;
119696
- newState.currentChangedFilePath = state.currentChangedFilePath;
119697
- newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
119698
- newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
119699
- newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
119700
- newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
119701
- newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
119702
- newState.program = state.program;
119703
- newState.compilerOptions = state.compilerOptions;
119704
- newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
119705
- newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
119706
- newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
119707
- newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
119708
- newState.programEmitComplete = state.programEmitComplete;
119709
- return newState;
119782
+ function backupEmitBuilderProgramState(state) {
119783
+ var outFilePath = ts.outFile(state.compilerOptions);
119784
+ // Only in --out changeFileSet is kept around till emit
119785
+ ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
119786
+ return {
119787
+ affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
119788
+ affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
119789
+ affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
119790
+ seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
119791
+ programEmitComplete: state.programEmitComplete,
119792
+ emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
119793
+ outSignature: state.outSignature,
119794
+ dtsChangeTime: state.dtsChangeTime,
119795
+ hasChangedEmitSignature: state.hasChangedEmitSignature,
119796
+ changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
119797
+ };
119798
+ }
119799
+ function restoreEmitBuilderProgramState(state, backupEmitState) {
119800
+ state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
119801
+ state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
119802
+ state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
119803
+ state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
119804
+ state.programEmitComplete = backupEmitState.programEmitComplete;
119805
+ state.emitSignatures = backupEmitState.emitSignatures;
119806
+ state.outSignature = backupEmitState.outSignature;
119807
+ state.dtsChangeTime = backupEmitState.dtsChangeTime;
119808
+ state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
119809
+ if (backupEmitState.changedFilesSet)
119810
+ state.changedFilesSet = backupEmitState.changedFilesSet;
119710
119811
  }
119711
119812
  /**
119712
119813
  * Verifies that source file is ok to be used in calls that arent handled by next
@@ -119721,7 +119822,7 @@ var ts;
119721
119822
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
119722
119823
  */
119723
119824
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
119724
- var _a;
119825
+ var _a, _b;
119725
119826
  while (true) {
119726
119827
  var affectedFiles = state.affectedFiles;
119727
119828
  if (affectedFiles) {
@@ -119741,10 +119842,8 @@ var ts;
119741
119842
  state.changedFilesSet.delete(state.currentChangedFilePath);
119742
119843
  state.currentChangedFilePath = undefined;
119743
119844
  // Commit the changes in file signature
119744
- ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
119745
- state.currentAffectedFilesSignatures.clear();
119746
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
119747
- (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
119845
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119846
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119748
119847
  state.affectedFiles = undefined;
119749
119848
  }
119750
119849
  // Get next changed file
@@ -119762,12 +119861,7 @@ var ts;
119762
119861
  return program;
119763
119862
  }
119764
119863
  // Get next batch of affected files
119765
- if (!state.currentAffectedFilesSignatures)
119766
- state.currentAffectedFilesSignatures = new ts.Map();
119767
- if (state.exportedModulesMap) {
119768
- state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
119769
- }
119770
- state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
119864
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
119771
119865
  state.currentChangedFilePath = nextKey.value;
119772
119866
  state.affectedFilesIndex = 0;
119773
119867
  if (!state.seenAffectedFiles)
@@ -119819,7 +119913,6 @@ var ts;
119819
119913
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
119820
119914
  */
119821
119915
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
119822
- var _a;
119823
119916
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
119824
119917
  // If affected files is everything except default library, then nothing more to do
119825
119918
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -119827,10 +119920,9 @@ var ts;
119827
119920
  // When a change affects the global scope, all files are considered to be affected without updating their signature
119828
119921
  // That means when affected file is handled, its signature can be out of date
119829
119922
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
119830
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
119923
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
119831
119924
  return;
119832
119925
  }
119833
- 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);
119834
119926
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
119835
119927
  return;
119836
119928
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -119850,7 +119942,7 @@ var ts;
119850
119942
  // This ensures that we dont later during incremental builds considering wrong signature.
119851
119943
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
119852
119944
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
119853
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
119945
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
119854
119946
  // If not dts emit, nothing more to do
119855
119947
  if (ts.getEmitDeclarations(state.compilerOptions)) {
119856
119948
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -119871,27 +119963,10 @@ var ts;
119871
119963
  return !state.semanticDiagnosticsFromOldState.size;
119872
119964
  }
119873
119965
  function isChangedSignature(state, path) {
119874
- var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
119875
- var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
119966
+ var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
119967
+ var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
119876
119968
  return newSignature !== oldSignature;
119877
119969
  }
119878
- function forEachKeyOfExportedModulesMap(state, filePath, fn) {
119879
- // Go through exported modules from cache first
119880
- var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
119881
- var result = keys && ts.forEachKey(keys, fn);
119882
- if (result)
119883
- return result;
119884
- // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
119885
- keys = state.exportedModulesMap.getKeys(filePath);
119886
- return keys && ts.forEachKey(keys, function (exportedFromPath) {
119887
- var _a;
119888
- // If the cache had an updated value, skip
119889
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
119890
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
119891
- fn(exportedFromPath) :
119892
- undefined;
119893
- });
119894
- }
119895
119970
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
119896
119971
  var _a;
119897
119972
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -119906,6 +119981,7 @@ var ts;
119906
119981
  * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
119907
119982
  */
119908
119983
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
119984
+ var _a;
119909
119985
  // If there was change in signature (dts output) for the changed file,
119910
119986
  // then only we need to handle pending file emit
119911
119987
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
@@ -119932,11 +120008,10 @@ var ts;
119932
120008
  }
119933
120009
  }
119934
120010
  }
119935
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
119936
120011
  var seenFileAndExportsOfFile = new ts.Set();
119937
120012
  // Go through exported modules from cache first
119938
120013
  // If exported modules has path, all files referencing file exported from are affected
119939
- forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
120014
+ (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
119940
120015
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
119941
120016
  return true;
119942
120017
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -119950,19 +120025,18 @@ var ts;
119950
120025
  * return true when all work is done and we can exit handling dts emit and semantic diagnostics
119951
120026
  */
119952
120027
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
119953
- var _a;
120028
+ var _a, _b;
119954
120029
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
119955
120030
  return undefined;
119956
120031
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
119957
120032
  return true;
119958
120033
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
119959
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
119960
120034
  // If exported modules has path, all files referencing file exported from are affected
119961
- forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
120035
+ (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
119962
120036
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
119963
120037
  });
119964
120038
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
119965
- (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
120039
+ (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
119966
120040
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
119967
120041
  handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
119968
120042
  state, referencingFilePath, cancellationToken, computeHash, host);
@@ -119983,12 +120057,13 @@ var ts;
119983
120057
  }
119984
120058
  else {
119985
120059
  state.seenAffectedFiles.add(affected.resolvedPath);
120060
+ // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted
120061
+ state.buildInfoEmitPending = true;
119986
120062
  if (emitKind !== undefined) {
119987
120063
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
119988
120064
  }
119989
120065
  if (isPendingEmit) {
119990
120066
  state.affectedFilesPendingEmitIndex++;
119991
- state.buildInfoEmitPending = true;
119992
120067
  }
119993
120068
  else {
119994
120069
  state.affectedFilesIndex++;
@@ -120039,22 +120114,43 @@ var ts;
120039
120114
  /**
120040
120115
  * Gets the program information to be emitted in buildInfo so that we can use it to create new program
120041
120116
  */
120042
- function getProgramBuildInfo(state, getCanonicalFileName) {
120043
- if (ts.outFile(state.compilerOptions))
120044
- return undefined;
120117
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
120118
+ var outFilePath = ts.outFile(state.compilerOptions);
120119
+ if (outFilePath && !state.compilerOptions.composite)
120120
+ return;
120045
120121
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
120046
120122
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
120123
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
120124
+ if (outFilePath) {
120125
+ var result_15 = {
120126
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
120127
+ outSignature: state.outSignature,
120128
+ dtsChangeTime: state.dtsChangeTime,
120129
+ };
120130
+ return result_15;
120131
+ }
120047
120132
  var fileNames = [];
120048
120133
  var fileNameToFileId = new ts.Map();
120049
120134
  var fileIdsList;
120050
120135
  var fileNamesToFileIdListId;
120136
+ var emitSignatures;
120051
120137
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
120138
+ var _b, _c;
120052
120139
  var key = _a[0], value = _a[1];
120053
120140
  // Ensure fileId
120054
120141
  var fileId = toFileId(key);
120055
120142
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
120056
- var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120057
- var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120143
+ var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
120144
+ var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
120145
+ if (state.compilerOptions.composite) {
120146
+ var file = state.program.getSourceFileByPath(key);
120147
+ if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
120148
+ var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
120149
+ if (emitSignature !== actualSignature) {
120150
+ (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
120151
+ }
120152
+ }
120153
+ }
120058
120154
  return value.version === actualSignature ?
120059
120155
  value.affectsGlobalScope || value.impliedFormat ?
120060
120156
  // If file version is same as signature, dont serialize signature
@@ -120062,11 +120158,11 @@ var ts;
120062
120158
  // If file info only contains version and signature and both are same we can just write string
120063
120159
  value.version :
120064
120160
  actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120065
- signature === undefined ?
120161
+ oldSignature === undefined ?
120066
120162
  // If we havent computed signature, use fileInfo as is
120067
120163
  value :
120068
120164
  // Serialize fileInfo with new updated signature
120069
- { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120165
+ { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120070
120166
  // Signature of the FileInfo is undefined, serialize it as false
120071
120167
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120072
120168
  });
@@ -120081,17 +120177,13 @@ var ts;
120081
120177
  if (state.exportedModulesMap) {
120082
120178
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
120083
120179
  var _a;
120084
- if (state.currentAffectedFilesExportedModulesMap) {
120085
- if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
120086
- return undefined;
120087
- }
120088
- var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
120089
- if (newValue) {
120090
- return [toFileId(key), toFileIdListId(newValue)];
120091
- }
120092
- }
120180
+ var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
120093
120181
  // Not in temporary cache, use existing value
120094
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120182
+ if (oldValue === undefined)
120183
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120184
+ if (oldValue)
120185
+ return [toFileId(key), toFileIdListId(oldValue)];
120186
+ return undefined;
120095
120187
  });
120096
120188
  }
120097
120189
  var semanticDiagnosticsPerFile;
@@ -120102,9 +120194,7 @@ var ts;
120102
120194
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
120103
120195
  [
120104
120196
  toFileId(key),
120105
- state.hasReusableDiagnostic ?
120106
- value :
120107
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120197
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
120108
120198
  ] :
120109
120199
  toFileId(key));
120110
120200
  }
@@ -120119,16 +120209,27 @@ var ts;
120119
120209
  }
120120
120210
  }
120121
120211
  }
120122
- return {
120212
+ var changeFileSet;
120213
+ if (state.changedFilesSet.size) {
120214
+ for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
120215
+ var path = _e[_d];
120216
+ (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120217
+ }
120218
+ }
120219
+ var result = {
120123
120220
  fileNames: fileNames,
120124
120221
  fileInfos: fileInfos,
120125
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
120222
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
120126
120223
  fileIdsList: fileIdsList,
120127
120224
  referencedMap: referencedMap,
120128
120225
  exportedModulesMap: exportedModulesMap,
120129
120226
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
120130
120227
  affectedFilesPendingEmit: affectedFilesPendingEmit,
120228
+ changeFileSet: changeFileSet,
120229
+ emitSignatures: emitSignatures,
120230
+ dtsChangeTime: state.dtsChangeTime,
120131
120231
  };
120232
+ return result;
120132
120233
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
120133
120234
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
120134
120235
  }
@@ -120153,24 +120254,18 @@ var ts;
120153
120254
  }
120154
120255
  return fileIdListId;
120155
120256
  }
120156
- }
120157
- function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
120158
- var result;
120159
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120160
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120161
- var name = _a[_i];
120162
- var optionKey = name.toLowerCase();
120163
- var optionInfo = optionsNameMap.get(optionKey);
120164
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
120165
- // We need to store `strict`, even though it won't be examined directly, so that the
120166
- // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
120167
- optionKey === "strict" ||
120168
- // We need to store these to determine whether `lib` files need to be rechecked.
120169
- optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
120170
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
120257
+ function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
120258
+ var result;
120259
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120260
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120261
+ var name = _a[_i];
120262
+ var optionInfo = optionsNameMap.get(name.toLowerCase());
120263
+ if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
120264
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
120265
+ }
120171
120266
  }
120267
+ return result;
120172
120268
  }
120173
- return result;
120174
120269
  }
120175
120270
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120176
120271
  if (option) {
@@ -120244,6 +120339,10 @@ var ts;
120244
120339
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
120245
120340
  }
120246
120341
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
120342
+ function computeSignature(text, data, computeHash) {
120343
+ return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
120344
+ }
120345
+ ts.computeSignature = computeSignature;
120247
120346
  function createBuilderProgram(kind, _a) {
120248
120347
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
120249
120348
  // Return same program if underlying program doesnt change
@@ -120262,8 +120361,8 @@ var ts;
120262
120361
  */
120263
120362
  var computeHash = ts.maybeBind(host, host.createHash);
120264
120363
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
120265
- var backupState;
120266
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
120364
+ var backupEmitState;
120365
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
120267
120366
  // To ensure that we arent storing any references to old program or new program without state
120268
120367
  newProgram = undefined; // TODO: GH#18217
120269
120368
  oldProgram = undefined;
@@ -120271,20 +120370,20 @@ var ts;
120271
120370
  var getState = function () { return state; };
120272
120371
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
120273
120372
  builderProgram.getState = getState;
120274
- builderProgram.backupState = function () {
120275
- ts.Debug.assert(backupState === undefined);
120276
- backupState = cloneBuilderProgramState(state);
120373
+ builderProgram.backupEmitState = function () {
120374
+ ts.Debug.assert(backupEmitState === undefined);
120375
+ backupEmitState = backupEmitBuilderProgramState(state);
120277
120376
  };
120278
- builderProgram.restoreState = function () {
120279
- state = ts.Debug.checkDefined(backupState);
120280
- backupState = undefined;
120377
+ builderProgram.restoreEmitState = function () {
120378
+ restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
120379
+ backupEmitState = undefined;
120281
120380
  };
120282
120381
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
120283
120382
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
120284
120383
  builderProgram.emit = emit;
120285
120384
  builderProgram.releaseProgram = function () {
120286
120385
  releaseCache(state);
120287
- backupState = undefined;
120386
+ backupEmitState = undefined;
120288
120387
  };
120289
120388
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
120290
120389
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -120343,35 +120442,59 @@ var ts;
120343
120442
  return toAffectedFileEmitResult(state,
120344
120443
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
120345
120444
  // Otherwise just affected file
120346
- ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120347
- getWriteFileUpdatingSignatureCallback(writeFile) :
120445
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
120446
+ getWriteFileCallback(writeFile, customTransformers) :
120348
120447
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
120349
120448
  }
120350
- function getWriteFileUpdatingSignatureCallback(writeFile) {
120449
+ function getWriteFileCallback(writeFile, customTransformers) {
120351
120450
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
120352
- var _a;
120451
+ var _a, _b, _c;
120353
120452
  if (ts.isDeclarationFileName(fileName)) {
120354
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120355
- var file = sourceFiles[0];
120356
- var info = state.fileInfos.get(file.resolvedPath);
120357
- var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120358
- if (signature === file.version) {
120359
- var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120360
- if (newSignature !== file.version) { // Update it
120361
- if (host.storeFilesChangingSignatureDuringEmit)
120362
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120363
- if (state.exportedModulesMap)
120364
- ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
120365
- if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
120366
- state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
120453
+ if (!ts.outFile(state.compilerOptions)) {
120454
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120455
+ var newSignature = void 0;
120456
+ if (!customTransformers) {
120457
+ var file = sourceFiles[0];
120458
+ var info = state.fileInfos.get(file.resolvedPath);
120459
+ if (info.signature === file.version) {
120460
+ newSignature = computeSignature(text, data, computeHash);
120461
+ if (newSignature !== file.version) { // Update it
120462
+ if (host.storeFilesChangingSignatureDuringEmit)
120463
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120464
+ if (state.exportedModulesMap)
120465
+ ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
120466
+ if (state.affectedFiles) {
120467
+ // Keep old signature so we know what to undo if cancellation happens
120468
+ var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
120469
+ if (existing === undefined)
120470
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
120471
+ info.signature = newSignature;
120472
+ }
120473
+ else {
120474
+ // These are directly commited
120475
+ info.signature = newSignature;
120476
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120477
+ }
120478
+ }
120367
120479
  }
120368
- else {
120369
- info.signature = newSignature;
120370
- if (state.exportedModulesMap)
120371
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120480
+ }
120481
+ if (state.compilerOptions.composite) {
120482
+ var filePath = sourceFiles[0].resolvedPath;
120483
+ var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
120484
+ newSignature || (newSignature = computeSignature(text, data, computeHash));
120485
+ if (newSignature !== oldSignature) {
120486
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
120487
+ state.hasChangedEmitSignature = true;
120372
120488
  }
120373
120489
  }
120374
120490
  }
120491
+ else if (state.compilerOptions.composite) {
120492
+ var newSignature = computeSignature(text, data, computeHash);
120493
+ if (newSignature !== state.outSignature) {
120494
+ state.outSignature = newSignature;
120495
+ state.hasChangedEmitSignature = true;
120496
+ }
120497
+ }
120375
120498
  }
120376
120499
  if (writeFile)
120377
120500
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -120436,8 +120559,8 @@ var ts;
120436
120559
  }
120437
120560
  }
120438
120561
  }
120439
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120440
- getWriteFileUpdatingSignatureCallback(writeFile) :
120562
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
120563
+ getWriteFileCallback(writeFile, customTransformers) :
120441
120564
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120442
120565
  }
120443
120566
  /**
@@ -120526,14 +120649,28 @@ var ts;
120526
120649
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
120527
120650
  }
120528
120651
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
120529
- function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
120530
- var _a;
120652
+ function createBuilderProgramUsingProgramBuildInfo(programFromBuildInfo, buildInfoPath, host) {
120653
+ var _a, _b, _c, _d, _e;
120531
120654
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
120532
120655
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
120533
- var filePaths = program.fileNames.map(toPath);
120534
- var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
120656
+ var program = programFromBuildInfo;
120657
+ var filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
120658
+ var filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
120535
120659
  var fileInfos = new ts.Map();
120536
- program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
120660
+ var emitSignatures = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
120661
+ (_d = program.fileInfos) === null || _d === void 0 ? void 0 : _d.forEach(function (fileInfo, index) {
120662
+ var path = toFilePath(index + 1);
120663
+ var stateFileInfo = toBuilderStateFileInfo(fileInfo);
120664
+ fileInfos.set(path, stateFileInfo);
120665
+ if (emitSignatures && stateFileInfo.signature)
120666
+ emitSignatures.set(path, stateFileInfo.signature);
120667
+ });
120668
+ (_e = program.emitSignatures) === null || _e === void 0 ? void 0 : _e.forEach(function (value) {
120669
+ if (ts.isNumber(value))
120670
+ emitSignatures.delete(toFilePath(value));
120671
+ else
120672
+ emitSignatures.set(toFilePath(value[0]), value[1]);
120673
+ });
120537
120674
  var state = {
120538
120675
  fileInfos: fileInfos,
120539
120676
  compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
@@ -120544,11 +120681,15 @@ var ts;
120544
120681
  affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
120545
120682
  affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
120546
120683
  affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
120684
+ changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
120685
+ dtsChangeTime: program.dtsChangeTime,
120686
+ emitSignatures: (emitSignatures === null || emitSignatures === void 0 ? void 0 : emitSignatures.size) ? emitSignatures : undefined,
120687
+ outSignature: program.outSignature,
120547
120688
  };
120548
120689
  return {
120549
120690
  getState: function () { return state; },
120550
- backupState: ts.noop,
120551
- restoreState: ts.noop,
120691
+ backupEmitState: ts.noop,
120692
+ restoreEmitState: ts.noop,
120552
120693
  getProgram: ts.notImplemented,
120553
120694
  getProgramOrUndefined: ts.returnUndefined,
120554
120695
  releaseProgram: ts.noop,
@@ -120593,12 +120734,12 @@ var ts;
120593
120734
  return map;
120594
120735
  }
120595
120736
  }
120596
- ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
120737
+ ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
120597
120738
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
120598
120739
  return {
120599
120740
  getState: ts.notImplemented,
120600
- backupState: ts.noop,
120601
- restoreState: ts.noop,
120741
+ backupEmitState: ts.noop,
120742
+ restoreEmitState: ts.noop,
120602
120743
  getProgram: getProgram,
120603
120744
  getProgramOrUndefined: function () { return getState().program; },
120604
120745
  releaseProgram: function () { return getState().program = undefined; },
@@ -121714,9 +121855,9 @@ var ts;
121714
121855
  if (!preferSymlinks) {
121715
121856
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
121716
121857
  // so we only need to remove them from the realpath filenames.
121717
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
121718
- if (result_15)
121719
- return result_15;
121858
+ var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
121859
+ if (result_16)
121860
+ return result_16;
121720
121861
  }
121721
121862
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
121722
121863
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -121736,10 +121877,10 @@ var ts;
121736
121877
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
121737
121878
  var symlinkDirectory = symlinkDirectories_1[_i];
121738
121879
  var option = ts.resolvePath(symlinkDirectory, relative);
121739
- var result_16 = cb(option, target === referenceRedirect);
121880
+ var result_17 = cb(option, target === referenceRedirect);
121740
121881
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
121741
- if (result_16)
121742
- return result_16;
121882
+ if (result_17)
121883
+ return result_17;
121743
121884
  }
121744
121885
  });
121745
121886
  });
@@ -122631,6 +122772,7 @@ var ts;
122631
122772
  readDirectory: ts.maybeBind(host, host.readDirectory),
122632
122773
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
122633
122774
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
122775
+ now: ts.maybeBind(host, host.now),
122634
122776
  };
122635
122777
  function writeFile(fileName, text, writeByteOrderMark, onError) {
122636
122778
  try {
@@ -122691,6 +122833,7 @@ var ts;
122691
122833
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
122692
122834
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
122693
122835
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
122836
+ now: ts.maybeBind(system, system.now),
122694
122837
  };
122695
122838
  }
122696
122839
  ts.createProgramHost = createProgramHost;
@@ -122758,20 +122901,26 @@ var ts;
122758
122901
  var ts;
122759
122902
  (function (ts) {
122760
122903
  function readBuilderProgram(compilerOptions, host) {
122761
- if (ts.outFile(compilerOptions))
122762
- return undefined;
122763
122904
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
122764
122905
  if (!buildInfoPath)
122765
122906
  return undefined;
122766
- var content = host.readFile(buildInfoPath);
122767
- if (!content)
122768
- return undefined;
122769
- var buildInfo = ts.getBuildInfo(content);
122907
+ var buildInfo;
122908
+ if (host.getBuildInfo) {
122909
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
122910
+ if (!buildInfo)
122911
+ return undefined;
122912
+ }
122913
+ else {
122914
+ var content = host.readFile(buildInfoPath);
122915
+ if (!content)
122916
+ return undefined;
122917
+ buildInfo = ts.getBuildInfo(content);
122918
+ }
122770
122919
  if (buildInfo.version !== ts.version)
122771
122920
  return undefined;
122772
122921
  if (!buildInfo.program)
122773
122922
  return undefined;
122774
- return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
122923
+ return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
122775
122924
  }
122776
122925
  ts.readBuilderProgram = readBuilderProgram;
122777
122926
  function createIncrementalCompilerHost(options, system) {
@@ -122780,6 +122929,7 @@ var ts;
122780
122929
  host.createHash = ts.maybeBind(system, system.createHash);
122781
122930
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
122782
122931
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
122932
+ host.now = ts.maybeBind(system, system.now);
122783
122933
  ts.setGetSourceFileAsHashVersioned(host, system);
122784
122934
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
122785
122935
  return host;
@@ -123514,14 +123664,16 @@ var ts;
123514
123664
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
123515
123665
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
123516
123666
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
123517
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
123518
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
123519
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
123520
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
123667
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
123668
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
123669
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
123670
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
123671
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
123521
123672
  /**
123522
123673
  * Projects with no outputs (i.e. "solution" files)
123523
123674
  */
123524
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
123675
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 12] = "ContainerOnly";
123676
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 13] = "ForceBuild";
123525
123677
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
123526
123678
  function resolveConfigFileProjectName(project) {
123527
123679
  if (ts.fileExtensionIs(project, ".json" /* Json */)) {
@@ -123566,9 +123718,11 @@ var ts;
123566
123718
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
123567
123719
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
123568
123720
  }
123569
- function newer(date1, date2) {
123570
- return date2 > date1 ? date2 : date1;
123721
+ /*@internal*/
123722
+ function getCurrentTime(host) {
123723
+ return host.now ? host.now() : new Date();
123571
123724
  }
123725
+ ts.getCurrentTime = getCurrentTime;
123572
123726
  /*@internal*/
123573
123727
  function isCircularBuildOrder(buildOrder) {
123574
123728
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -123658,6 +123812,7 @@ var ts;
123658
123812
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
123659
123813
  };
123660
123814
  }
123815
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
123661
123816
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
123662
123817
  var state = {
123663
123818
  host: host,
@@ -123674,8 +123829,9 @@ var ts;
123674
123829
  resolvedConfigFilePaths: new ts.Map(),
123675
123830
  configFileCache: new ts.Map(),
123676
123831
  projectStatus: new ts.Map(),
123677
- buildInfoChecked: new ts.Map(),
123678
123832
  extendedConfigCache: new ts.Map(),
123833
+ buildInfoCache: new ts.Map(),
123834
+ outputTimeStamps: new ts.Map(),
123679
123835
  builderPrograms: new ts.Map(),
123680
123836
  diagnostics: new ts.Map(),
123681
123837
  projectPendingBuild: new ts.Map(),
@@ -123699,6 +123855,7 @@ var ts;
123699
123855
  allWatchedConfigFiles: new ts.Map(),
123700
123856
  allWatchedExtendedConfigFiles: new ts.Map(),
123701
123857
  allWatchedPackageJsonFiles: new ts.Map(),
123858
+ filesWatched: new ts.Map(),
123702
123859
  lastCachedPackageJsonLookups: new ts.Map(),
123703
123860
  timerToBuildInvalidatedProject: undefined,
123704
123861
  reportFileChangeDetected: false,
@@ -123805,11 +123962,12 @@ var ts;
123805
123962
  // Config file cache
123806
123963
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
123807
123964
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
123808
- ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
123809
123965
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
123810
123966
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
123811
123967
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
123812
123968
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
123969
+ ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
123970
+ ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
123813
123971
  // Remove watches for the program no longer in the solution
123814
123972
  if (state.watch) {
123815
123973
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
@@ -124100,21 +124258,21 @@ var ts;
124100
124258
  }
124101
124259
  function emit(writeFileCallback, cancellationToken, customTransformers) {
124102
124260
  var _a;
124103
- var _b, _c;
124261
+ var _b, _c, _d;
124104
124262
  ts.Debug.assertIsDefined(program);
124105
124263
  ts.Debug.assert(step === BuildStep.Emit);
124106
124264
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
124107
- program.backupState();
124265
+ program.backupEmitState();
124108
124266
  var declDiagnostics;
124109
124267
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
124110
124268
  var outputFiles = [];
124111
124269
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
124112
124270
  /*write*/ undefined,
124113
- /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
124271
+ /*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,
124114
124272
  /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
124115
124273
  // Don't emit .d.ts if there are decl file errors
124116
124274
  if (declDiagnostics) {
124117
- program.restoreState();
124275
+ program.restoreEmitState();
124118
124276
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
124119
124277
  return {
124120
124278
  emitSkipped: true,
@@ -124124,37 +124282,43 @@ var ts;
124124
124282
  // Actual Emit
124125
124283
  var host = state.host, compilerHost = state.compilerHost;
124126
124284
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124127
- var newestDeclarationFileContentChangedTime = minimumDate;
124128
- var anyDtsChanged = false;
124285
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
124129
124286
  var emitterDiagnostics = ts.createDiagnosticCollection();
124130
124287
  var emittedOutputs = new ts.Map();
124288
+ var options = program.getCompilerOptions();
124289
+ var isIncremental = ts.isIncrementalCompilation(options);
124290
+ var outputTimeStampMap;
124291
+ var now;
124131
124292
  outputFiles.forEach(function (_a) {
124132
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124133
- var priorChangeTime;
124134
- if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124135
- // Check for unchanged .d.ts files
124136
- if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124137
- priorChangeTime = host.getModifiedTime(name);
124138
- }
124139
- else {
124293
+ var _b, _c;
124294
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124295
+ var path = toPath(state, name);
124296
+ emittedOutputs.set(toPath(state, name), name);
124297
+ if (buildInfo) {
124298
+ setBuildInfo(state, buildInfo, projectPath, options);
124299
+ 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)) {
124140
124300
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124141
- anyDtsChanged = true;
124142
124301
  }
124143
124302
  }
124144
- emittedOutputs.set(toPath(state, name), name);
124145
124303
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124146
- if (priorChangeTime !== undefined) {
124147
- newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
124304
+ if (!isIncremental && state.watch) {
124305
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
124148
124306
  }
124149
124307
  });
124150
- finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime,
124151
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124308
+ finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124152
124309
  return emitResult;
124153
124310
  }
124154
124311
  function emitBuildInfo(writeFileCallback, cancellationToken) {
124155
124312
  ts.Debug.assertIsDefined(program);
124156
124313
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
124157
- var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
124314
+ var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
124315
+ if (data === null || data === void 0 ? void 0 : data.buildInfo)
124316
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
124317
+ if (writeFileCallback)
124318
+ writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
124319
+ else
124320
+ state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
124321
+ }, cancellationToken);
124158
124322
  if (emitResult.diagnostics.length) {
124159
124323
  reportErrors(state, emitResult.diagnostics);
124160
124324
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -124167,7 +124331,7 @@ var ts;
124167
124331
  step = BuildStep.QueueReferencingProjects;
124168
124332
  return emitResult;
124169
124333
  }
124170
- function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
124334
+ function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
124171
124335
  var _a;
124172
124336
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
124173
124337
  if (emitDiagnostics.length) {
@@ -124178,13 +124342,11 @@ var ts;
124178
124342
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
124179
124343
  }
124180
124344
  // Update time stamps for rest of the outputs
124181
- var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124345
+ updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124182
124346
  state.diagnostics.delete(projectPath);
124183
124347
  state.projectStatus.set(projectPath, {
124184
124348
  type: ts.UpToDateStatusType.UpToDate,
124185
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
124186
- maximumDate :
124187
- newestDeclarationFileContentChangedTime,
124349
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
124188
124350
  oldestOutputFileName: oldestOutputFileName
124189
124351
  });
124190
124352
  afterProgramDone(state, program, config);
@@ -124219,13 +124381,21 @@ var ts;
124219
124381
  ts.Debug.assert(!!outputFiles.length);
124220
124382
  var emitterDiagnostics = ts.createDiagnosticCollection();
124221
124383
  var emittedOutputs = new ts.Map();
124384
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124385
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
124222
124386
  outputFiles.forEach(function (_a) {
124223
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124387
+ var _b, _c;
124388
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124224
124389
  emittedOutputs.set(toPath(state, name), name);
124390
+ if (buildInfo) {
124391
+ setBuildInfo(state, buildInfo, projectPath, config.options);
124392
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
124393
+ resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124394
+ }
124395
+ }
124225
124396
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124226
124397
  });
124227
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate,
124228
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
124398
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
124229
124399
  return { emitSkipped: false, diagnostics: emitDiagnostics };
124230
124400
  }
124231
124401
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -124387,7 +124557,7 @@ var ts;
124387
124557
  state.projectCompilerOptions = state.baseCompilerOptions;
124388
124558
  }
124389
124559
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
124390
- var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
124560
+ var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
124391
124561
  reportAndStoreErrors(state, resolvedPath, diagnostics);
124392
124562
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
124393
124563
  if (canEmitBuildInfo)
@@ -124395,9 +124565,95 @@ var ts;
124395
124565
  afterProgramDone(state, program, config);
124396
124566
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
124397
124567
  }
124568
+ function isFileWatcherWithModifiedTime(value) {
124569
+ return !!value.watcher;
124570
+ }
124571
+ function getModifiedTime(state, fileName) {
124572
+ var path = toPath(state, fileName);
124573
+ var existing = state.filesWatched.get(path);
124574
+ if (state.watch && !!existing) {
124575
+ if (!isFileWatcherWithModifiedTime(existing))
124576
+ return existing;
124577
+ if (existing.modifiedTime)
124578
+ return existing.modifiedTime;
124579
+ }
124580
+ var result = ts.getModifiedTime(state.host, fileName);
124581
+ if (state.watch) {
124582
+ if (existing)
124583
+ existing.modifiedTime = result;
124584
+ else
124585
+ state.filesWatched.set(path, result);
124586
+ }
124587
+ return result;
124588
+ }
124589
+ function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
124590
+ var path = toPath(state, file);
124591
+ var existing = state.filesWatched.get(path);
124592
+ if (existing && isFileWatcherWithModifiedTime(existing)) {
124593
+ existing.callbacks.push(callback);
124594
+ }
124595
+ else {
124596
+ var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
124597
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
124598
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
124599
+ existing.modifiedTime = modifiedTime;
124600
+ existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
124601
+ }, pollingInterval, options, watchType, project);
124602
+ state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
124603
+ }
124604
+ return {
124605
+ close: function () {
124606
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
124607
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
124608
+ if (existing.callbacks.length === 1) {
124609
+ state.filesWatched.delete(path);
124610
+ ts.closeFileWatcherOf(existing);
124611
+ }
124612
+ else {
124613
+ ts.unorderedRemoveItem(existing.callbacks, callback);
124614
+ }
124615
+ }
124616
+ };
124617
+ }
124618
+ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
124619
+ if (!state.watch)
124620
+ return undefined;
124621
+ var result = state.outputTimeStamps.get(resolvedConfigFilePath);
124622
+ if (!result)
124623
+ state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
124624
+ return result;
124625
+ }
124626
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
124627
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
124628
+ var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
124629
+ if (existing) {
124630
+ existing.buildInfo = buildInfo;
124631
+ existing.modifiedTime = getCurrentTime(state.host);
124632
+ }
124633
+ else {
124634
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
124635
+ }
124636
+ }
124637
+ function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
124638
+ var path = toPath(state, buildInfoPath);
124639
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
124640
+ return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
124641
+ }
124642
+ function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
124643
+ var path = toPath(state, buildInfoPath);
124644
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
124645
+ if (existing !== undefined && existing.path === path) {
124646
+ return existing.buildInfo || undefined;
124647
+ }
124648
+ var value = state.readFileWithCache(buildInfoPath);
124649
+ var buildInfo = value ? ts.getBuildInfo(value) : undefined;
124650
+ ts.Debug.assert(modifiedTime || !buildInfo);
124651
+ state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
124652
+ return buildInfo;
124653
+ }
124398
124654
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
124399
124655
  // Check tsconfig time
124400
- var tsconfigTime = ts.getModifiedTime(state.host, configFile);
124656
+ var tsconfigTime = getModifiedTime(state, configFile);
124401
124657
  if (oldestOutputFileTime < tsconfigTime) {
124402
124658
  return {
124403
124659
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -124407,88 +124663,24 @@ var ts;
124407
124663
  }
124408
124664
  }
124409
124665
  function getUpToDateStatusWorker(state, project, resolvedPath) {
124410
- var force = !!state.options.force;
124411
- var newestInputFileName = undefined;
124412
- var newestInputFileTime = minimumDate;
124413
- var host = state.host;
124414
- // Get timestamps of input files
124415
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
124416
- var inputFile = _a[_i];
124417
- if (!host.fileExists(inputFile)) {
124418
- return {
124419
- type: ts.UpToDateStatusType.Unbuildable,
124420
- reason: inputFile + " does not exist"
124421
- };
124422
- }
124423
- if (!force) {
124424
- var inputTime = ts.getModifiedTime(host, inputFile);
124425
- if (inputTime > newestInputFileTime) {
124426
- newestInputFileName = inputFile;
124427
- newestInputFileTime = inputTime;
124428
- }
124429
- }
124430
- }
124666
+ var _a, _b, _c;
124431
124667
  // Container if no files are specified in the project
124432
124668
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
124433
124669
  return {
124434
124670
  type: ts.UpToDateStatusType.ContainerOnly
124435
124671
  };
124436
124672
  }
124437
- // Collect the expected outputs of this project
124438
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
124439
- // Now see if all outputs are newer than the newest input
124440
- var oldestOutputFileName = "(none)";
124441
- var oldestOutputFileTime = maximumDate;
124442
- var newestOutputFileName = "(none)";
124443
- var newestOutputFileTime = minimumDate;
124444
- var missingOutputFileName;
124445
- var newestDeclarationFileContentChangedTime = minimumDate;
124446
- var isOutOfDateWithInputs = false;
124447
- if (!force) {
124448
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
124449
- var output = outputs_1[_b];
124450
- // Output is missing; can stop checking
124451
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124452
- if (!host.fileExists(output)) {
124453
- missingOutputFileName = output;
124454
- break;
124455
- }
124456
- var outputTime = ts.getModifiedTime(host, output);
124457
- if (outputTime < oldestOutputFileTime) {
124458
- oldestOutputFileTime = outputTime;
124459
- oldestOutputFileName = output;
124460
- }
124461
- // If an output is older than the newest input, we can stop checking
124462
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124463
- if (outputTime < newestInputFileTime) {
124464
- isOutOfDateWithInputs = true;
124465
- break;
124466
- }
124467
- if (outputTime > newestOutputFileTime) {
124468
- newestOutputFileTime = outputTime;
124469
- newestOutputFileName = output;
124470
- }
124471
- // Keep track of when the most recent time a .d.ts file was changed.
124472
- // In addition to file timestamps, we also keep track of when a .d.ts file
124473
- // had its file touched but not had its contents changed - this allows us
124474
- // to skip a downstream typecheck
124475
- if (ts.isDeclarationFileName(output)) {
124476
- var outputModifiedTime = ts.getModifiedTime(host, output);
124477
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
124478
- }
124479
- }
124480
- }
124481
- var pseudoUpToDate = false;
124482
- var usesPrepend = false;
124483
- var upstreamChangedProject;
124673
+ // Fast check to see if reference projects are buildable
124674
+ var referenceStatuses;
124675
+ var force = !!state.options.force;
124484
124676
  if (project.projectReferences) {
124485
124677
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
124486
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
124487
- var ref = _d[_c];
124488
- usesPrepend = usesPrepend || !!(ref.prepend);
124678
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
124679
+ var ref = _d[_i];
124489
124680
  var resolvedRef = ts.resolveProjectReferencePath(ref);
124490
124681
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
124491
- var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
124682
+ var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
124683
+ var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
124492
124684
  // Its a circular reference ignore the status of this project
124493
124685
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
124494
124686
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) { // Container only ignore this project
@@ -124510,75 +124702,170 @@ var ts;
124510
124702
  upstreamProjectName: ref.path
124511
124703
  };
124512
124704
  }
124513
- // Check oldest output file name only if there is no missing output file name
124514
- // (a check we will have skipped if this is a forced build)
124515
- if (!force && !missingOutputFileName) {
124516
- // If the upstream project's newest file is older than our oldest output, we
124517
- // can't be out of date because of it
124518
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
124519
- continue;
124520
- }
124521
- // If the upstream project has only change .d.ts files, and we've built
124522
- // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
124523
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
124524
- pseudoUpToDate = true;
124525
- upstreamChangedProject = ref.path;
124526
- continue;
124527
- }
124528
- // We have an output older than an upstream output - we are out of date
124529
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
124705
+ if (!force)
124706
+ (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
124707
+ }
124708
+ }
124709
+ if (force)
124710
+ return { type: ts.UpToDateStatusType.ForceBuild };
124711
+ // Check buildinfo first
124712
+ var host = state.host;
124713
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
124714
+ var oldestOutputFileName = "(none)";
124715
+ var oldestOutputFileTime = maximumDate;
124716
+ var buildInfoTime;
124717
+ var newestDeclarationFileContentChangedTime;
124718
+ if (buildInfoPath) {
124719
+ var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
124720
+ buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
124721
+ if (buildInfoTime === ts.missingFileModifiedTime) {
124722
+ if (!buildInfoCacheEntry_1) {
124723
+ state.buildInfoCache.set(resolvedPath, {
124724
+ path: toPath(state, buildInfoPath),
124725
+ buildInfo: false,
124726
+ modifiedTime: buildInfoTime
124727
+ });
124728
+ }
124729
+ return {
124730
+ type: ts.UpToDateStatusType.OutputMissing,
124731
+ missingOutputFileName: buildInfoPath
124732
+ };
124733
+ }
124734
+ var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
124735
+ if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
124736
+ return {
124737
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
124738
+ version: buildInfo.version
124739
+ };
124740
+ }
124741
+ if (buildInfo.program) {
124742
+ if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
124743
+ (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
124530
124744
  return {
124531
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124532
- outOfDateOutputFileName: oldestOutputFileName,
124533
- newerProjectName: ref.path
124745
+ type: ts.UpToDateStatusType.OutOfDateBuildInfo,
124746
+ buildInfoFile: buildInfoPath
124534
124747
  };
124535
124748
  }
124536
124749
  }
124750
+ oldestOutputFileTime = buildInfoTime;
124751
+ oldestOutputFileName = buildInfoPath;
124752
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
124537
124753
  }
124538
- if (missingOutputFileName !== undefined) {
124539
- return {
124540
- type: ts.UpToDateStatusType.OutputMissing,
124541
- missingOutputFileName: missingOutputFileName
124542
- };
124754
+ // Check input files
124755
+ var newestInputFileName = undefined;
124756
+ var newestInputFileTime = minimumDate;
124757
+ // Get timestamps of input files
124758
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
124759
+ var inputFile = _f[_e];
124760
+ var inputTime = getModifiedTime(state, inputFile);
124761
+ if (inputTime === ts.missingFileModifiedTime) {
124762
+ return {
124763
+ type: ts.UpToDateStatusType.Unbuildable,
124764
+ reason: inputFile + " does not exist"
124765
+ };
124766
+ }
124767
+ // If an buildInfo is older than the newest input, we can stop checking
124768
+ if (buildInfoTime && buildInfoTime < inputTime) {
124769
+ return {
124770
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
124771
+ outOfDateOutputFileName: buildInfoPath,
124772
+ newerInputFileName: inputFile
124773
+ };
124774
+ }
124775
+ if (inputTime > newestInputFileTime) {
124776
+ newestInputFileName = inputFile;
124777
+ newestInputFileTime = inputTime;
124778
+ }
124543
124779
  }
124544
- if (isOutOfDateWithInputs) {
124545
- return {
124546
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
124547
- outOfDateOutputFileName: oldestOutputFileName,
124548
- newerInputFileName: newestInputFileName
124549
- };
124780
+ // Now see if all outputs are newer than the newest input
124781
+ // Dont check output timestamps if we have buildinfo telling us output is uptodate
124782
+ if (!buildInfoPath) {
124783
+ // Collect the expected outputs of this project
124784
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
124785
+ var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
124786
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
124787
+ var output = outputs_1[_g];
124788
+ var path = toPath(state, output);
124789
+ // Output is missing; can stop checking
124790
+ var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
124791
+ if (!outputTime) {
124792
+ outputTime = ts.getModifiedTime(state.host, output);
124793
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
124794
+ }
124795
+ if (outputTime === ts.missingFileModifiedTime) {
124796
+ return {
124797
+ type: ts.UpToDateStatusType.OutputMissing,
124798
+ missingOutputFileName: output
124799
+ };
124800
+ }
124801
+ if (outputTime < oldestOutputFileTime) {
124802
+ oldestOutputFileTime = outputTime;
124803
+ oldestOutputFileName = output;
124804
+ }
124805
+ // If an output is older than the newest input, we can stop checking
124806
+ if (outputTime < newestInputFileTime) {
124807
+ return {
124808
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
124809
+ outOfDateOutputFileName: oldestOutputFileName,
124810
+ newerInputFileName: newestInputFileName
124811
+ };
124812
+ }
124813
+ }
124550
124814
  }
124551
- else {
124552
- // Check tsconfig time
124553
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
124554
- if (configStatus)
124555
- return configStatus;
124556
- // Check extended config time
124557
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
124558
- if (extendedConfigStatus)
124559
- return extendedConfigStatus;
124560
- // Check package file time
124561
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
124562
- var path = _a[0];
124563
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
124564
- });
124565
- if (dependentPackageFileStatus)
124566
- return dependentPackageFileStatus;
124567
- }
124568
- if (!force && !state.buildInfoChecked.has(resolvedPath)) {
124569
- state.buildInfoChecked.set(resolvedPath, true);
124570
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
124571
- if (buildInfoPath) {
124572
- var value = state.readFileWithCache(buildInfoPath);
124573
- var buildInfo = value && ts.getBuildInfo(value);
124574
- if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
124815
+ var seenRefs = buildInfoPath ? new ts.Set() : undefined;
124816
+ var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
124817
+ seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
124818
+ var pseudoUpToDate = false;
124819
+ var usesPrepend = false;
124820
+ var upstreamChangedProject;
124821
+ if (referenceStatuses) {
124822
+ for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
124823
+ var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
124824
+ usesPrepend = usesPrepend || !!(ref.prepend);
124825
+ // If the upstream project's newest file is older than our oldest output, we
124826
+ // can't be out of date because of it
124827
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
124828
+ continue;
124829
+ }
124830
+ // Check if tsbuildinfo path is shared, then we need to rebuild
124831
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
124575
124832
  return {
124576
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
124577
- version: buildInfo.version
124833
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124834
+ outOfDateOutputFileName: buildInfoPath,
124835
+ newerProjectName: ref.path
124578
124836
  };
124579
124837
  }
124838
+ // If the upstream project has only change .d.ts files, and we've built
124839
+ // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
124840
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
124841
+ pseudoUpToDate = true;
124842
+ upstreamChangedProject = ref.path;
124843
+ continue;
124844
+ }
124845
+ // We have an output older than an upstream output - we are out of date
124846
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
124847
+ return {
124848
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124849
+ outOfDateOutputFileName: oldestOutputFileName,
124850
+ newerProjectName: ref.path
124851
+ };
124580
124852
  }
124581
124853
  }
124854
+ // Check tsconfig time
124855
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
124856
+ if (configStatus)
124857
+ return configStatus;
124858
+ // Check extended config time
124859
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
124860
+ if (extendedConfigStatus)
124861
+ return extendedConfigStatus;
124862
+ // Check package file time
124863
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
124864
+ var path = _a[0];
124865
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
124866
+ });
124867
+ if (dependentPackageFileStatus)
124868
+ return dependentPackageFileStatus;
124582
124869
  if (usesPrepend && pseudoUpToDate) {
124583
124870
  return {
124584
124871
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -124591,12 +124878,30 @@ var ts;
124591
124878
  type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
124592
124879
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
124593
124880
  newestInputFileTime: newestInputFileTime,
124594
- newestOutputFileTime: newestOutputFileTime,
124595
124881
  newestInputFileName: newestInputFileName,
124596
- newestOutputFileName: newestOutputFileName,
124597
124882
  oldestOutputFileName: oldestOutputFileName
124598
124883
  };
124599
124884
  }
124885
+ function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
124886
+ if (seenRefs.has(resolvedRefPath))
124887
+ return false;
124888
+ seenRefs.add(resolvedRefPath);
124889
+ var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
124890
+ if (refBuildInfo.path === buildInfoCacheEntry.path)
124891
+ return true;
124892
+ if (resolvedConfig.projectReferences) {
124893
+ // Check references
124894
+ for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
124895
+ var ref = _a[_i];
124896
+ var resolvedRef = ts.resolveProjectReferencePath(ref);
124897
+ var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
124898
+ var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
124899
+ if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
124900
+ return true;
124901
+ }
124902
+ }
124903
+ return false;
124904
+ }
124600
124905
  function getUpToDateStatus(state, project, resolvedPath) {
124601
124906
  if (project === undefined) {
124602
124907
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -124609,39 +124914,65 @@ var ts;
124609
124914
  state.projectStatus.set(resolvedPath, actual);
124610
124915
  return actual;
124611
124916
  }
124612
- function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
124917
+ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
124613
124918
  if (proj.options.noEmit)
124614
- return priorNewestUpdateTime;
124919
+ return;
124920
+ var now;
124921
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
124922
+ if (buildInfoPath) {
124923
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
124924
+ if (!!state.options.verbose)
124925
+ reportStatus(state, verboseMessage, proj.options.configFilePath);
124926
+ state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
124927
+ getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
124928
+ }
124929
+ state.outputTimeStamps.delete(projectPath);
124930
+ return;
124931
+ }
124615
124932
  var host = state.host;
124616
124933
  var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
124934
+ var outputTimeStampMap = getOutputTimeStampMap(state, projectPath);
124935
+ var modifiedOutputs = outputTimeStampMap ? new ts.Set() : undefined;
124617
124936
  if (!skipOutputs || outputs.length !== skipOutputs.size) {
124618
124937
  var reportVerbose = !!state.options.verbose;
124619
- var now = host.now ? host.now() : new Date();
124620
124938
  for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
124621
124939
  var file = outputs_2[_i];
124622
- if (skipOutputs && skipOutputs.has(toPath(state, file))) {
124940
+ var path = toPath(state, file);
124941
+ if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
124623
124942
  continue;
124624
- }
124625
124943
  if (reportVerbose) {
124626
124944
  reportVerbose = false;
124627
124945
  reportStatus(state, verboseMessage, proj.options.configFilePath);
124628
124946
  }
124629
- if (ts.isDeclarationFileName(file)) {
124630
- priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
124947
+ host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
124948
+ if (outputTimeStampMap) {
124949
+ outputTimeStampMap.set(path, now);
124950
+ modifiedOutputs.add(path);
124631
124951
  }
124632
- host.setModifiedTime(file, now);
124633
124952
  }
124634
124953
  }
124635
- return priorNewestUpdateTime;
124954
+ // Clear out timestamps not in output list any more
124955
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.forEach(function (_value, key) {
124956
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs.has(key))
124957
+ outputTimeStampMap.delete(key);
124958
+ });
124959
+ }
124960
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
124961
+ var _a;
124962
+ if (!options.composite)
124963
+ return undefined;
124964
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
124965
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, /*modifiedTime*/ undefined);
124966
+ 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;
124636
124967
  }
124637
124968
  function updateOutputTimestamps(state, proj, resolvedPath) {
124638
124969
  if (state.options.dry) {
124639
124970
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
124640
124971
  }
124641
- var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
124972
+ updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
124642
124973
  state.projectStatus.set(resolvedPath, {
124643
124974
  type: ts.UpToDateStatusType.UpToDate,
124644
- newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
124975
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
124645
124976
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
124646
124977
  });
124647
124978
  }
@@ -124834,12 +125165,10 @@ var ts;
124834
125165
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
124835
125166
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
124836
125167
  return;
124837
- state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
124838
- invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
124839
- }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
125168
+ 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));
124840
125169
  }
124841
125170
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
124842
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
125171
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
124843
125172
  var _a;
124844
125173
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
124845
125174
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -124871,7 +125200,7 @@ var ts;
124871
125200
  if (!state.watch)
124872
125201
  return;
124873
125202
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
124874
- 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); },
125203
+ 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); },
124875
125204
  onDeleteValue: ts.closeFileWatcher,
124876
125205
  });
124877
125206
  }
@@ -124879,7 +125208,7 @@ var ts;
124879
125208
  if (!state.watch || !state.lastCachedPackageJsonLookups)
124880
125209
  return;
124881
125210
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
124882
- 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); },
125211
+ 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); },
124883
125212
  onDeleteValue: ts.closeFileWatcher,
124884
125213
  });
124885
125214
  }
@@ -125011,19 +125340,18 @@ var ts;
125011
125340
  }
125012
125341
  }
125013
125342
  function reportUpToDateStatus(state, configFileName, status) {
125014
- if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
125015
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125016
- }
125017
125343
  switch (status.type) {
125018
125344
  case ts.UpToDateStatusType.OutOfDateWithSelf:
125019
- 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));
125345
+ 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));
125020
125346
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
125021
- 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));
125347
+ 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));
125022
125348
  case ts.UpToDateStatusType.OutputMissing:
125023
125349
  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));
125350
+ case ts.UpToDateStatusType.OutOfDateBuildInfo:
125351
+ 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));
125024
125352
  case ts.UpToDateStatusType.UpToDate:
125025
125353
  if (status.newestInputFileTime !== undefined) {
125026
- 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 || ""));
125354
+ 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 || ""));
125027
125355
  }
125028
125356
  // Don't report anything for "up to date because it was already built" -- too verbose
125029
125357
  break;
@@ -125041,6 +125369,8 @@ var ts;
125041
125369
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
125042
125370
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
125043
125371
  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);
125372
+ case ts.UpToDateStatusType.ForceBuild:
125373
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125044
125374
  case ts.UpToDateStatusType.ContainerOnly:
125045
125375
  // Don't report status on "solution" projects
125046
125376
  // falls through