@typescript-deploys/pr-build 4.8.0-pr-49285-5 → 4.8.0-pr-48784-17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsserver.js CHANGED
@@ -6200,7 +6200,7 @@ var ts;
6200
6200
  };
6201
6201
  }
6202
6202
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
6203
- var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName) {
6203
+ var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName, modifiedTime) {
6204
6204
  // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
6205
6205
  if (!ts.isString(relativeFileName))
6206
6206
  return;
@@ -6210,7 +6210,7 @@ var ts;
6210
6210
  if (callbacks) {
6211
6211
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
6212
6212
  var fileCallback = callbacks_1[_i];
6213
- fileCallback(fileName, FileWatcherEventKind.Changed);
6213
+ fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6214
6214
  }
6215
6215
  }
6216
6216
  },
@@ -6264,7 +6264,7 @@ var ts;
6264
6264
  }
6265
6265
  else {
6266
6266
  cache.set(path, {
6267
- watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
6267
+ watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6268
6268
  refCount: 1
6269
6269
  });
6270
6270
  }
@@ -6292,7 +6292,7 @@ var ts;
6292
6292
  var newTime = modifiedTime.getTime();
6293
6293
  if (oldTime !== newTime) {
6294
6294
  watchedFile.mtime = modifiedTime;
6295
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
6295
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
6296
6296
  return true;
6297
6297
  }
6298
6298
  return false;
@@ -6543,17 +6543,18 @@ var ts;
6543
6543
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6544
6544
  /*@internal*/
6545
6545
  function createFileWatcherCallback(callback) {
6546
- return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
6546
+ return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6547
6547
  }
6548
6548
  ts.createFileWatcherCallback = createFileWatcherCallback;
6549
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists) {
6550
- return function (eventName) {
6549
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6550
+ return function (eventName, _relativeFileName, modifiedTime) {
6551
6551
  if (eventName === "rename") {
6552
- callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6552
+ modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
6553
+ callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
6553
6554
  }
6554
6555
  else {
6555
6556
  // Change
6556
- callback(fileName, FileWatcherEventKind.Changed);
6557
+ callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6557
6558
  }
6558
6559
  };
6559
6560
  }
@@ -6577,7 +6578,7 @@ var ts;
6577
6578
  }
6578
6579
  /*@internal*/
6579
6580
  function createSystemWatchFunctions(_a) {
6580
- 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;
6581
+ 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;
6581
6582
  var dynamicPollingWatchFile;
6582
6583
  var fixedChunkSizePollingWatchFile;
6583
6584
  var nonPollingWatchFile;
@@ -6599,7 +6600,7 @@ var ts;
6599
6600
  case ts.WatchFileKind.FixedChunkSizePolling:
6600
6601
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, /* pollingInterval */ undefined, /*options*/ undefined);
6601
6602
  case ts.WatchFileKind.UseFsEvents:
6602
- return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists),
6603
+ return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime),
6603
6604
  /*recursive*/ false, pollingInterval, ts.getFallbackOptions(options));
6604
6605
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
6605
6606
  if (!nonPollingWatchFile) {
@@ -6781,7 +6782,6 @@ var ts;
6781
6782
  fsWatch: fsWatch,
6782
6783
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6783
6784
  getCurrentDirectory: getCurrentDirectory,
6784
- fileExists: fileExists,
6785
6785
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
6786
6786
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
6787
6787
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
@@ -7041,7 +7041,7 @@ var ts;
7041
7041
  // File changed
7042
7042
  eventKind = FileWatcherEventKind.Changed;
7043
7043
  }
7044
- callback(fileName, eventKind);
7044
+ callback(fileName, eventKind, curr.mtime);
7045
7045
  }
7046
7046
  }
7047
7047
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
@@ -7067,10 +7067,10 @@ var ts;
7067
7067
  * Invoke the callback with rename and update the watcher if not closed
7068
7068
  * @param createWatcher
7069
7069
  */
7070
- function invokeCallbackAndUpdateWatcher(createWatcher) {
7070
+ function invokeCallbackAndUpdateWatcher(createWatcher, modifiedTime) {
7071
7071
  sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
7072
7072
  // Call the callback for current directory
7073
- callback("rename", "");
7073
+ callback("rename", "", modifiedTime);
7074
7074
  // If watcher is not closed, update it
7075
7075
  if (watcher) {
7076
7076
  watcher.close();
@@ -7116,13 +7116,14 @@ var ts;
7116
7116
  function callbackChangingToMissingFileSystemEntry(event, relativeName) {
7117
7117
  // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
7118
7118
  // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
7119
+ var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
7119
7120
  return event === "rename" &&
7120
7121
  (!relativeName ||
7121
7122
  relativeName === lastDirectoryPart ||
7122
7123
  (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
7123
- !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7124
- invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
7125
- callback(event, relativeName);
7124
+ modifiedTime === ts.missingFileModifiedTime ?
7125
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry, modifiedTime) :
7126
+ callback(event, relativeName, modifiedTime);
7126
7127
  }
7127
7128
  /**
7128
7129
  * Watch the file or directory using fs.watchFile since fs.watch threw exception
@@ -7136,12 +7137,15 @@ var ts;
7136
7137
  * and switch to existing file or directory when the missing filesystem entry is created
7137
7138
  */
7138
7139
  function watchMissingFileSystemEntry() {
7139
- return watchFile(fileOrDirectory, function (_fileName, eventKind) {
7140
- if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
7141
- // Call the callback for current file or directory
7142
- // For now it could be callback for the inner directory creation,
7143
- // but just return current directory, better than current no-op
7144
- invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
7140
+ return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
7141
+ if (eventKind === FileWatcherEventKind.Created) {
7142
+ modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
7143
+ if (modifiedTime !== ts.missingFileModifiedTime) {
7144
+ // Call the callback for current file or directory
7145
+ // For now it could be callback for the inner directory creation,
7146
+ // but just return current directory, better than current no-op
7147
+ invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry, modifiedTime);
7148
+ }
7145
7149
  }
7146
7150
  }, fallbackPollingInterval, fallbackOptions);
7147
7151
  }
@@ -7291,12 +7295,19 @@ var ts;
7291
7295
  }
7292
7296
  function getModifiedTime(path) {
7293
7297
  var _a;
7298
+ // Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
7299
+ // the CPU time performance.
7300
+ var originalStackTraceLimit = Error.stackTraceLimit;
7301
+ Error.stackTraceLimit = 0;
7294
7302
  try {
7295
7303
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
7296
7304
  }
7297
7305
  catch (e) {
7298
7306
  return undefined;
7299
7307
  }
7308
+ finally {
7309
+ Error.stackTraceLimit = originalStackTraceLimit;
7310
+ }
7300
7311
  }
7301
7312
  function setModifiedTime(path, time) {
7302
7313
  try {
@@ -9319,8 +9330,8 @@ var ts;
9319
9330
  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"),
9320
9331
  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"),
9321
9332
  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."),
9322
- 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}'"),
9323
- 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}'"),
9333
+ 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}'"),
9334
+ 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}'"),
9324
9335
  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"),
9325
9336
  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"),
9326
9337
  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"),
@@ -9364,6 +9375,8 @@ var ts;
9364
9375
  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}'."),
9365
9376
  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}'."),
9366
9377
  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."),
9378
+ 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"),
9379
+ Project_0_is_up_to_date_but_needs_update_to_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_update_to_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs update to timestamps of output files that are older than input files"),
9367
9380
  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}'"),
9368
9381
  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."),
9369
9382
  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."),
@@ -20193,6 +20206,10 @@ var ts;
20193
20206
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
20194
20207
  }
20195
20208
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
20209
+ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
20210
+ return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
20211
+ }
20212
+ ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
20196
20213
  function getCompilerOptionValue(options, option) {
20197
20214
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
20198
20215
  }
@@ -39233,6 +39250,7 @@ var ts;
39233
39250
  type: "boolean",
39234
39251
  affectsSemanticDiagnostics: true,
39235
39252
  affectsEmit: true,
39253
+ affectsMultiFileEmitBuildInfo: true,
39236
39254
  category: ts.Diagnostics.Watch_and_Build_Modes,
39237
39255
  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,
39238
39256
  defaultValueDescription: false,
@@ -39267,12 +39285,40 @@ var ts;
39267
39285
  affectsSourceFile: true,
39268
39286
  affectsModuleResolution: true,
39269
39287
  affectsEmit: true,
39288
+ affectsMultiFileEmitBuildInfo: true,
39270
39289
  paramType: ts.Diagnostics.VERSION,
39271
39290
  showInSimplifiedHelpView: true,
39272
39291
  category: ts.Diagnostics.Language_and_Environment,
39273
39292
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
39274
39293
  defaultValueDescription: 0 /* ES3 */,
39275
39294
  };
39295
+ /*@internal*/
39296
+ ts.moduleOptionDeclaration = {
39297
+ name: "module",
39298
+ shortName: "m",
39299
+ type: new ts.Map(ts.getEntries({
39300
+ none: ts.ModuleKind.None,
39301
+ commonjs: ts.ModuleKind.CommonJS,
39302
+ amd: ts.ModuleKind.AMD,
39303
+ system: ts.ModuleKind.System,
39304
+ umd: ts.ModuleKind.UMD,
39305
+ es6: ts.ModuleKind.ES2015,
39306
+ es2015: ts.ModuleKind.ES2015,
39307
+ es2020: ts.ModuleKind.ES2020,
39308
+ es2022: ts.ModuleKind.ES2022,
39309
+ esnext: ts.ModuleKind.ESNext,
39310
+ node16: ts.ModuleKind.Node16,
39311
+ nodenext: ts.ModuleKind.NodeNext,
39312
+ })),
39313
+ affectsModuleResolution: true,
39314
+ affectsEmit: true,
39315
+ affectsMultiFileEmitBuildInfo: true,
39316
+ paramType: ts.Diagnostics.KIND,
39317
+ showInSimplifiedHelpView: true,
39318
+ category: ts.Diagnostics.Modules,
39319
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
39320
+ defaultValueDescription: undefined,
39321
+ };
39276
39322
  var commandOptionsWithoutBuild = [
39277
39323
  // CommandLine only options
39278
39324
  {
@@ -39334,37 +39380,14 @@ var ts;
39334
39380
  category: ts.Diagnostics.Command_line_Options,
39335
39381
  affectsSemanticDiagnostics: true,
39336
39382
  affectsEmit: true,
39383
+ affectsMultiFileEmitBuildInfo: true,
39337
39384
  isCommandLineOnly: true,
39338
39385
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
39339
39386
  defaultValueDescription: false,
39340
39387
  },
39341
39388
  // Basic
39342
39389
  ts.targetOptionDeclaration,
39343
- {
39344
- name: "module",
39345
- shortName: "m",
39346
- type: new ts.Map(ts.getEntries({
39347
- none: ts.ModuleKind.None,
39348
- commonjs: ts.ModuleKind.CommonJS,
39349
- amd: ts.ModuleKind.AMD,
39350
- system: ts.ModuleKind.System,
39351
- umd: ts.ModuleKind.UMD,
39352
- es6: ts.ModuleKind.ES2015,
39353
- es2015: ts.ModuleKind.ES2015,
39354
- es2020: ts.ModuleKind.ES2020,
39355
- es2022: ts.ModuleKind.ES2022,
39356
- esnext: ts.ModuleKind.ESNext,
39357
- node16: ts.ModuleKind.Node16,
39358
- nodenext: ts.ModuleKind.NodeNext,
39359
- })),
39360
- affectsModuleResolution: true,
39361
- affectsEmit: true,
39362
- paramType: ts.Diagnostics.KIND,
39363
- showInSimplifiedHelpView: true,
39364
- category: ts.Diagnostics.Modules,
39365
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
39366
- defaultValueDescription: undefined,
39367
- },
39390
+ ts.moduleOptionDeclaration,
39368
39391
  {
39369
39392
  name: "lib",
39370
39393
  type: "list",
@@ -39401,6 +39424,7 @@ var ts;
39401
39424
  type: jsxOptionMap,
39402
39425
  affectsSourceFile: true,
39403
39426
  affectsEmit: true,
39427
+ affectsMultiFileEmitBuildInfo: true,
39404
39428
  affectsModuleResolution: true,
39405
39429
  paramType: ts.Diagnostics.KIND,
39406
39430
  showInSimplifiedHelpView: true,
@@ -39413,6 +39437,7 @@ var ts;
39413
39437
  shortName: "d",
39414
39438
  type: "boolean",
39415
39439
  affectsEmit: true,
39440
+ affectsMultiFileEmitBuildInfo: true,
39416
39441
  showInSimplifiedHelpView: true,
39417
39442
  category: ts.Diagnostics.Emit,
39418
39443
  transpileOptionValue: undefined,
@@ -39423,6 +39448,7 @@ var ts;
39423
39448
  name: "declarationMap",
39424
39449
  type: "boolean",
39425
39450
  affectsEmit: true,
39451
+ affectsMultiFileEmitBuildInfo: true,
39426
39452
  showInSimplifiedHelpView: true,
39427
39453
  category: ts.Diagnostics.Emit,
39428
39454
  transpileOptionValue: undefined,
@@ -39433,6 +39459,7 @@ var ts;
39433
39459
  name: "emitDeclarationOnly",
39434
39460
  type: "boolean",
39435
39461
  affectsEmit: true,
39462
+ affectsMultiFileEmitBuildInfo: true,
39436
39463
  showInSimplifiedHelpView: true,
39437
39464
  category: ts.Diagnostics.Emit,
39438
39465
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -39443,6 +39470,7 @@ var ts;
39443
39470
  name: "sourceMap",
39444
39471
  type: "boolean",
39445
39472
  affectsEmit: true,
39473
+ affectsMultiFileEmitBuildInfo: true,
39446
39474
  showInSimplifiedHelpView: true,
39447
39475
  category: ts.Diagnostics.Emit,
39448
39476
  defaultValueDescription: false,
@@ -39452,6 +39480,9 @@ var ts;
39452
39480
  name: "outFile",
39453
39481
  type: "string",
39454
39482
  affectsEmit: true,
39483
+ affectsMultiFileEmitBuildInfo: true,
39484
+ affectsDeclarationPath: true,
39485
+ affectsBundleEmitBuildInfo: true,
39455
39486
  isFilePath: true,
39456
39487
  paramType: ts.Diagnostics.FILE,
39457
39488
  showInSimplifiedHelpView: true,
@@ -39463,6 +39494,8 @@ var ts;
39463
39494
  name: "outDir",
39464
39495
  type: "string",
39465
39496
  affectsEmit: true,
39497
+ affectsMultiFileEmitBuildInfo: true,
39498
+ affectsDeclarationPath: true,
39466
39499
  isFilePath: true,
39467
39500
  paramType: ts.Diagnostics.DIRECTORY,
39468
39501
  showInSimplifiedHelpView: true,
@@ -39473,6 +39506,8 @@ var ts;
39473
39506
  name: "rootDir",
39474
39507
  type: "string",
39475
39508
  affectsEmit: true,
39509
+ affectsMultiFileEmitBuildInfo: true,
39510
+ affectsDeclarationPath: true,
39476
39511
  isFilePath: true,
39477
39512
  paramType: ts.Diagnostics.LOCATION,
39478
39513
  category: ts.Diagnostics.Modules,
@@ -39483,6 +39518,8 @@ var ts;
39483
39518
  name: "composite",
39484
39519
  type: "boolean",
39485
39520
  affectsEmit: true,
39521
+ affectsMultiFileEmitBuildInfo: true,
39522
+ affectsBundleEmitBuildInfo: true,
39486
39523
  isTSConfigOnly: true,
39487
39524
  category: ts.Diagnostics.Projects,
39488
39525
  transpileOptionValue: undefined,
@@ -39493,6 +39530,8 @@ var ts;
39493
39530
  name: "tsBuildInfoFile",
39494
39531
  type: "string",
39495
39532
  affectsEmit: true,
39533
+ affectsMultiFileEmitBuildInfo: true,
39534
+ affectsBundleEmitBuildInfo: true,
39496
39535
  isFilePath: true,
39497
39536
  paramType: ts.Diagnostics.FILE,
39498
39537
  category: ts.Diagnostics.Projects,
@@ -39504,6 +39543,7 @@ var ts;
39504
39543
  name: "removeComments",
39505
39544
  type: "boolean",
39506
39545
  affectsEmit: true,
39546
+ affectsMultiFileEmitBuildInfo: true,
39507
39547
  showInSimplifiedHelpView: true,
39508
39548
  category: ts.Diagnostics.Emit,
39509
39549
  defaultValueDescription: false,
@@ -39522,6 +39562,7 @@ var ts;
39522
39562
  name: "importHelpers",
39523
39563
  type: "boolean",
39524
39564
  affectsEmit: true,
39565
+ affectsMultiFileEmitBuildInfo: true,
39525
39566
  category: ts.Diagnostics.Emit,
39526
39567
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
39527
39568
  defaultValueDescription: false,
@@ -39535,6 +39576,7 @@ var ts;
39535
39576
  })),
39536
39577
  affectsEmit: true,
39537
39578
  affectsSemanticDiagnostics: true,
39579
+ affectsMultiFileEmitBuildInfo: true,
39538
39580
  category: ts.Diagnostics.Emit,
39539
39581
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
39540
39582
  defaultValueDescription: 0 /* Remove */,
@@ -39543,6 +39585,7 @@ var ts;
39543
39585
  name: "downlevelIteration",
39544
39586
  type: "boolean",
39545
39587
  affectsEmit: true,
39588
+ affectsMultiFileEmitBuildInfo: true,
39546
39589
  category: ts.Diagnostics.Emit,
39547
39590
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
39548
39591
  defaultValueDescription: false,
@@ -39561,6 +39604,9 @@ var ts;
39561
39604
  type: "boolean",
39562
39605
  // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
39563
39606
  // The value of each strictFlag depends on own strictFlag value or this and never accessed directly.
39607
+ // But we need to store `strict` in builf info, even though it won't be examined directly, so that the
39608
+ // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly
39609
+ affectsMultiFileEmitBuildInfo: true,
39564
39610
  showInSimplifiedHelpView: true,
39565
39611
  category: ts.Diagnostics.Type_Checking,
39566
39612
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -39570,6 +39616,7 @@ var ts;
39570
39616
  name: "noImplicitAny",
39571
39617
  type: "boolean",
39572
39618
  affectsSemanticDiagnostics: true,
39619
+ affectsMultiFileEmitBuildInfo: true,
39573
39620
  strictFlag: true,
39574
39621
  category: ts.Diagnostics.Type_Checking,
39575
39622
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -39579,6 +39626,7 @@ var ts;
39579
39626
  name: "strictNullChecks",
39580
39627
  type: "boolean",
39581
39628
  affectsSemanticDiagnostics: true,
39629
+ affectsMultiFileEmitBuildInfo: true,
39582
39630
  strictFlag: true,
39583
39631
  category: ts.Diagnostics.Type_Checking,
39584
39632
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -39587,6 +39635,8 @@ var ts;
39587
39635
  {
39588
39636
  name: "strictFunctionTypes",
39589
39637
  type: "boolean",
39638
+ affectsSemanticDiagnostics: true,
39639
+ affectsMultiFileEmitBuildInfo: true,
39590
39640
  strictFlag: true,
39591
39641
  category: ts.Diagnostics.Type_Checking,
39592
39642
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -39595,6 +39645,8 @@ var ts;
39595
39645
  {
39596
39646
  name: "strictBindCallApply",
39597
39647
  type: "boolean",
39648
+ affectsSemanticDiagnostics: true,
39649
+ affectsMultiFileEmitBuildInfo: true,
39598
39650
  strictFlag: true,
39599
39651
  category: ts.Diagnostics.Type_Checking,
39600
39652
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -39604,6 +39656,7 @@ var ts;
39604
39656
  name: "strictPropertyInitialization",
39605
39657
  type: "boolean",
39606
39658
  affectsSemanticDiagnostics: true,
39659
+ affectsMultiFileEmitBuildInfo: true,
39607
39660
  strictFlag: true,
39608
39661
  category: ts.Diagnostics.Type_Checking,
39609
39662
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -39613,6 +39666,7 @@ var ts;
39613
39666
  name: "noImplicitThis",
39614
39667
  type: "boolean",
39615
39668
  affectsSemanticDiagnostics: true,
39669
+ affectsMultiFileEmitBuildInfo: true,
39616
39670
  strictFlag: true,
39617
39671
  category: ts.Diagnostics.Type_Checking,
39618
39672
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -39622,6 +39676,7 @@ var ts;
39622
39676
  name: "useUnknownInCatchVariables",
39623
39677
  type: "boolean",
39624
39678
  affectsSemanticDiagnostics: true,
39679
+ affectsMultiFileEmitBuildInfo: true,
39625
39680
  strictFlag: true,
39626
39681
  category: ts.Diagnostics.Type_Checking,
39627
39682
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -39631,6 +39686,8 @@ var ts;
39631
39686
  name: "alwaysStrict",
39632
39687
  type: "boolean",
39633
39688
  affectsSourceFile: true,
39689
+ affectsEmit: true,
39690
+ affectsMultiFileEmitBuildInfo: true,
39634
39691
  strictFlag: true,
39635
39692
  category: ts.Diagnostics.Type_Checking,
39636
39693
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -39641,6 +39698,7 @@ var ts;
39641
39698
  name: "noUnusedLocals",
39642
39699
  type: "boolean",
39643
39700
  affectsSemanticDiagnostics: true,
39701
+ affectsMultiFileEmitBuildInfo: true,
39644
39702
  category: ts.Diagnostics.Type_Checking,
39645
39703
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
39646
39704
  defaultValueDescription: false,
@@ -39649,6 +39707,7 @@ var ts;
39649
39707
  name: "noUnusedParameters",
39650
39708
  type: "boolean",
39651
39709
  affectsSemanticDiagnostics: true,
39710
+ affectsMultiFileEmitBuildInfo: true,
39652
39711
  category: ts.Diagnostics.Type_Checking,
39653
39712
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
39654
39713
  defaultValueDescription: false,
@@ -39657,6 +39716,7 @@ var ts;
39657
39716
  name: "exactOptionalPropertyTypes",
39658
39717
  type: "boolean",
39659
39718
  affectsSemanticDiagnostics: true,
39719
+ affectsMultiFileEmitBuildInfo: true,
39660
39720
  category: ts.Diagnostics.Type_Checking,
39661
39721
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
39662
39722
  defaultValueDescription: false,
@@ -39665,6 +39725,7 @@ var ts;
39665
39725
  name: "noImplicitReturns",
39666
39726
  type: "boolean",
39667
39727
  affectsSemanticDiagnostics: true,
39728
+ affectsMultiFileEmitBuildInfo: true,
39668
39729
  category: ts.Diagnostics.Type_Checking,
39669
39730
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
39670
39731
  defaultValueDescription: false,
@@ -39674,6 +39735,7 @@ var ts;
39674
39735
  type: "boolean",
39675
39736
  affectsBindDiagnostics: true,
39676
39737
  affectsSemanticDiagnostics: true,
39738
+ affectsMultiFileEmitBuildInfo: true,
39677
39739
  category: ts.Diagnostics.Type_Checking,
39678
39740
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
39679
39741
  defaultValueDescription: false,
@@ -39682,6 +39744,7 @@ var ts;
39682
39744
  name: "noUncheckedIndexedAccess",
39683
39745
  type: "boolean",
39684
39746
  affectsSemanticDiagnostics: true,
39747
+ affectsMultiFileEmitBuildInfo: true,
39685
39748
  category: ts.Diagnostics.Type_Checking,
39686
39749
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
39687
39750
  defaultValueDescription: false,
@@ -39690,6 +39753,7 @@ var ts;
39690
39753
  name: "noImplicitOverride",
39691
39754
  type: "boolean",
39692
39755
  affectsSemanticDiagnostics: true,
39756
+ affectsMultiFileEmitBuildInfo: true,
39693
39757
  category: ts.Diagnostics.Type_Checking,
39694
39758
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
39695
39759
  defaultValueDescription: false,
@@ -39697,6 +39761,8 @@ var ts;
39697
39761
  {
39698
39762
  name: "noPropertyAccessFromIndexSignature",
39699
39763
  type: "boolean",
39764
+ affectsSemanticDiagnostics: true,
39765
+ affectsMultiFileEmitBuildInfo: true,
39700
39766
  showInSimplifiedHelpView: false,
39701
39767
  category: ts.Diagnostics.Type_Checking,
39702
39768
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -39782,6 +39848,7 @@ var ts;
39782
39848
  name: "allowSyntheticDefaultImports",
39783
39849
  type: "boolean",
39784
39850
  affectsSemanticDiagnostics: true,
39851
+ affectsMultiFileEmitBuildInfo: true,
39785
39852
  category: ts.Diagnostics.Interop_Constraints,
39786
39853
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
39787
39854
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -39791,6 +39858,7 @@ var ts;
39791
39858
  type: "boolean",
39792
39859
  affectsSemanticDiagnostics: true,
39793
39860
  affectsEmit: true,
39861
+ affectsMultiFileEmitBuildInfo: true,
39794
39862
  showInSimplifiedHelpView: true,
39795
39863
  category: ts.Diagnostics.Interop_Constraints,
39796
39864
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -39807,6 +39875,7 @@ var ts;
39807
39875
  name: "allowUmdGlobalAccess",
39808
39876
  type: "boolean",
39809
39877
  affectsSemanticDiagnostics: true,
39878
+ affectsMultiFileEmitBuildInfo: true,
39810
39879
  category: ts.Diagnostics.Modules,
39811
39880
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
39812
39881
  defaultValueDescription: false,
@@ -39828,6 +39897,7 @@ var ts;
39828
39897
  name: "sourceRoot",
39829
39898
  type: "string",
39830
39899
  affectsEmit: true,
39900
+ affectsMultiFileEmitBuildInfo: true,
39831
39901
  paramType: ts.Diagnostics.LOCATION,
39832
39902
  category: ts.Diagnostics.Emit,
39833
39903
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -39836,6 +39906,7 @@ var ts;
39836
39906
  name: "mapRoot",
39837
39907
  type: "string",
39838
39908
  affectsEmit: true,
39909
+ affectsMultiFileEmitBuildInfo: true,
39839
39910
  paramType: ts.Diagnostics.LOCATION,
39840
39911
  category: ts.Diagnostics.Emit,
39841
39912
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -39844,6 +39915,7 @@ var ts;
39844
39915
  name: "inlineSourceMap",
39845
39916
  type: "boolean",
39846
39917
  affectsEmit: true,
39918
+ affectsMultiFileEmitBuildInfo: true,
39847
39919
  category: ts.Diagnostics.Emit,
39848
39920
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
39849
39921
  defaultValueDescription: false,
@@ -39852,6 +39924,7 @@ var ts;
39852
39924
  name: "inlineSources",
39853
39925
  type: "boolean",
39854
39926
  affectsEmit: true,
39927
+ affectsMultiFileEmitBuildInfo: true,
39855
39928
  category: ts.Diagnostics.Emit,
39856
39929
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
39857
39930
  defaultValueDescription: false,
@@ -39861,6 +39934,7 @@ var ts;
39861
39934
  name: "experimentalDecorators",
39862
39935
  type: "boolean",
39863
39936
  affectsSemanticDiagnostics: true,
39937
+ affectsMultiFileEmitBuildInfo: true,
39864
39938
  category: ts.Diagnostics.Language_and_Environment,
39865
39939
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
39866
39940
  defaultValueDescription: false,
@@ -39870,6 +39944,7 @@ var ts;
39870
39944
  type: "boolean",
39871
39945
  affectsSemanticDiagnostics: true,
39872
39946
  affectsEmit: true,
39947
+ affectsMultiFileEmitBuildInfo: true,
39873
39948
  category: ts.Diagnostics.Language_and_Environment,
39874
39949
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
39875
39950
  defaultValueDescription: false,
@@ -39894,6 +39969,7 @@ var ts;
39894
39969
  type: "string",
39895
39970
  affectsSemanticDiagnostics: true,
39896
39971
  affectsEmit: true,
39972
+ affectsMultiFileEmitBuildInfo: true,
39897
39973
  affectsModuleResolution: true,
39898
39974
  category: ts.Diagnostics.Language_and_Environment,
39899
39975
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -39911,6 +39987,9 @@ var ts;
39911
39987
  name: "out",
39912
39988
  type: "string",
39913
39989
  affectsEmit: true,
39990
+ affectsMultiFileEmitBuildInfo: true,
39991
+ affectsDeclarationPath: true,
39992
+ affectsBundleEmitBuildInfo: true,
39914
39993
  isFilePath: false,
39915
39994
  // for correct behaviour, please use outFile
39916
39995
  category: ts.Diagnostics.Backwards_Compatibility,
@@ -39922,6 +40001,7 @@ var ts;
39922
40001
  name: "reactNamespace",
39923
40002
  type: "string",
39924
40003
  affectsEmit: true,
40004
+ affectsMultiFileEmitBuildInfo: true,
39925
40005
  category: ts.Diagnostics.Language_and_Environment,
39926
40006
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
39927
40007
  defaultValueDescription: "`React`",
@@ -39929,6 +40009,8 @@ var ts;
39929
40009
  {
39930
40010
  name: "skipDefaultLibCheck",
39931
40011
  type: "boolean",
40012
+ // We need to store these to determine whether `lib` files need to be rechecked
40013
+ affectsMultiFileEmitBuildInfo: true,
39932
40014
  category: ts.Diagnostics.Completeness,
39933
40015
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
39934
40016
  defaultValueDescription: false,
@@ -39944,6 +40026,7 @@ var ts;
39944
40026
  name: "emitBOM",
39945
40027
  type: "boolean",
39946
40028
  affectsEmit: true,
40029
+ affectsMultiFileEmitBuildInfo: true,
39947
40030
  category: ts.Diagnostics.Emit,
39948
40031
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
39949
40032
  defaultValueDescription: false,
@@ -39955,6 +40038,7 @@ var ts;
39955
40038
  lf: 1 /* LineFeed */
39956
40039
  })),
39957
40040
  affectsEmit: true,
40041
+ affectsMultiFileEmitBuildInfo: true,
39958
40042
  paramType: ts.Diagnostics.NEWLINE,
39959
40043
  category: ts.Diagnostics.Emit,
39960
40044
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -39964,6 +40048,7 @@ var ts;
39964
40048
  name: "noErrorTruncation",
39965
40049
  type: "boolean",
39966
40050
  affectsSemanticDiagnostics: true,
40051
+ affectsMultiFileEmitBuildInfo: true,
39967
40052
  category: ts.Diagnostics.Output_Formatting,
39968
40053
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
39969
40054
  defaultValueDescription: false,
@@ -39994,6 +40079,7 @@ var ts;
39994
40079
  name: "stripInternal",
39995
40080
  type: "boolean",
39996
40081
  affectsEmit: true,
40082
+ affectsMultiFileEmitBuildInfo: true,
39997
40083
  category: ts.Diagnostics.Emit,
39998
40084
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
39999
40085
  defaultValueDescription: false,
@@ -40034,6 +40120,7 @@ var ts;
40034
40120
  name: "noImplicitUseStrict",
40035
40121
  type: "boolean",
40036
40122
  affectsSemanticDiagnostics: true,
40123
+ affectsMultiFileEmitBuildInfo: true,
40037
40124
  category: ts.Diagnostics.Backwards_Compatibility,
40038
40125
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
40039
40126
  defaultValueDescription: false,
@@ -40042,6 +40129,7 @@ var ts;
40042
40129
  name: "noEmitHelpers",
40043
40130
  type: "boolean",
40044
40131
  affectsEmit: true,
40132
+ affectsMultiFileEmitBuildInfo: true,
40045
40133
  category: ts.Diagnostics.Emit,
40046
40134
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
40047
40135
  defaultValueDescription: false,
@@ -40050,6 +40138,7 @@ var ts;
40050
40138
  name: "noEmitOnError",
40051
40139
  type: "boolean",
40052
40140
  affectsEmit: true,
40141
+ affectsMultiFileEmitBuildInfo: true,
40053
40142
  category: ts.Diagnostics.Emit,
40054
40143
  transpileOptionValue: undefined,
40055
40144
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -40059,6 +40148,7 @@ var ts;
40059
40148
  name: "preserveConstEnums",
40060
40149
  type: "boolean",
40061
40150
  affectsEmit: true,
40151
+ affectsMultiFileEmitBuildInfo: true,
40062
40152
  category: ts.Diagnostics.Emit,
40063
40153
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
40064
40154
  defaultValueDescription: false,
@@ -40067,6 +40157,8 @@ var ts;
40067
40157
  name: "declarationDir",
40068
40158
  type: "string",
40069
40159
  affectsEmit: true,
40160
+ affectsMultiFileEmitBuildInfo: true,
40161
+ affectsDeclarationPath: true,
40070
40162
  isFilePath: true,
40071
40163
  paramType: ts.Diagnostics.DIRECTORY,
40072
40164
  category: ts.Diagnostics.Emit,
@@ -40076,6 +40168,8 @@ var ts;
40076
40168
  {
40077
40169
  name: "skipLibCheck",
40078
40170
  type: "boolean",
40171
+ // We need to store these to determine whether `lib` files need to be rechecked
40172
+ affectsMultiFileEmitBuildInfo: true,
40079
40173
  category: ts.Diagnostics.Completeness,
40080
40174
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
40081
40175
  defaultValueDescription: false,
@@ -40085,6 +40179,7 @@ var ts;
40085
40179
  type: "boolean",
40086
40180
  affectsBindDiagnostics: true,
40087
40181
  affectsSemanticDiagnostics: true,
40182
+ affectsMultiFileEmitBuildInfo: true,
40088
40183
  category: ts.Diagnostics.Type_Checking,
40089
40184
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
40090
40185
  defaultValueDescription: undefined,
@@ -40094,6 +40189,7 @@ var ts;
40094
40189
  type: "boolean",
40095
40190
  affectsBindDiagnostics: true,
40096
40191
  affectsSemanticDiagnostics: true,
40192
+ affectsMultiFileEmitBuildInfo: true,
40097
40193
  category: ts.Diagnostics.Type_Checking,
40098
40194
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
40099
40195
  defaultValueDescription: undefined,
@@ -40102,6 +40198,7 @@ var ts;
40102
40198
  name: "suppressExcessPropertyErrors",
40103
40199
  type: "boolean",
40104
40200
  affectsSemanticDiagnostics: true,
40201
+ affectsMultiFileEmitBuildInfo: true,
40105
40202
  category: ts.Diagnostics.Backwards_Compatibility,
40106
40203
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
40107
40204
  defaultValueDescription: false,
@@ -40110,6 +40207,7 @@ var ts;
40110
40207
  name: "suppressImplicitAnyIndexErrors",
40111
40208
  type: "boolean",
40112
40209
  affectsSemanticDiagnostics: true,
40210
+ affectsMultiFileEmitBuildInfo: true,
40113
40211
  category: ts.Diagnostics.Backwards_Compatibility,
40114
40212
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
40115
40213
  defaultValueDescription: false,
@@ -40134,6 +40232,7 @@ var ts;
40134
40232
  name: "noStrictGenericChecks",
40135
40233
  type: "boolean",
40136
40234
  affectsSemanticDiagnostics: true,
40235
+ affectsMultiFileEmitBuildInfo: true,
40137
40236
  category: ts.Diagnostics.Backwards_Compatibility,
40138
40237
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
40139
40238
  defaultValueDescription: false,
@@ -40143,6 +40242,7 @@ var ts;
40143
40242
  type: "boolean",
40144
40243
  affectsSemanticDiagnostics: true,
40145
40244
  affectsEmit: true,
40245
+ affectsMultiFileEmitBuildInfo: true,
40146
40246
  category: ts.Diagnostics.Language_and_Environment,
40147
40247
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
40148
40248
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -40151,6 +40251,7 @@ var ts;
40151
40251
  name: "preserveValueImports",
40152
40252
  type: "boolean",
40153
40253
  affectsEmit: true,
40254
+ affectsMultiFileEmitBuildInfo: true,
40154
40255
  category: ts.Diagnostics.Emit,
40155
40256
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
40156
40257
  defaultValueDescription: false,
@@ -40194,6 +40295,8 @@ var ts;
40194
40295
  /* @internal */
40195
40296
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
40196
40297
  /* @internal */
40298
+ ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
40299
+ /* @internal */
40197
40300
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
40198
40301
  /* @internal */
40199
40302
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -41049,6 +41152,7 @@ var ts;
41049
41152
  return optionDefinition.type;
41050
41153
  }
41051
41154
  }
41155
+ /* @internal */
41052
41156
  function getNameOfCompilerOptionValue(value, customTypeMap) {
41053
41157
  // There is a typeMap associated with this command-line option so use it to map value back to its name
41054
41158
  return ts.forEachEntry(customTypeMap, function (mapValue, key) {
@@ -41057,6 +41161,7 @@ var ts;
41057
41161
  }
41058
41162
  });
41059
41163
  }
41164
+ ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
41060
41165
  function serializeCompilerOptions(options, pathOptions) {
41061
41166
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
41062
41167
  }
@@ -110339,7 +110444,8 @@ var ts;
110339
110444
  return;
110340
110445
  }
110341
110446
  var version = ts.version; // Extracted into a const so the form is stable between namespace and module
110342
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), /*writeByteOrderMark*/ false);
110447
+ var buildInfo = { bundle: bundle, program: program, version: version };
110448
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
110343
110449
  }
110344
110450
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
110345
110451
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -110493,13 +110599,18 @@ var ts;
110493
110599
  if (sourceMapFilePath) {
110494
110600
  var sourceMap = sourceMapGenerator.toString();
110495
110601
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110602
+ if (printer.bundleFileInfo)
110603
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
110496
110604
  }
110497
110605
  }
110498
110606
  else {
110499
110607
  writer.writeLine();
110500
110608
  }
110501
110609
  // Write the output file
110502
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110610
+ var text = writer.getText();
110611
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110612
+ if (printer.bundleFileInfo)
110613
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
110503
110614
  // Reset state
110504
110615
  writer.clear();
110505
110616
  }
@@ -110642,34 +110753,54 @@ var ts;
110642
110753
  }
110643
110754
  /*@internal*/
110644
110755
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
110756
+ var createHash = ts.maybeBind(host, host.createHash);
110645
110757
  var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
110646
- var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
110647
- if (!buildInfoText)
110758
+ var buildInfo;
110759
+ if (host.getBuildInfo) {
110760
+ var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
110761
+ if (!hostBuildInfo)
110762
+ return buildInfoPath;
110763
+ buildInfo = hostBuildInfo;
110764
+ }
110765
+ else {
110766
+ var buildInfoText = host.readFile(buildInfoPath);
110767
+ if (!buildInfoText)
110768
+ return buildInfoPath;
110769
+ buildInfo = getBuildInfo(buildInfoText);
110770
+ }
110771
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
110648
110772
  return buildInfoPath;
110649
110773
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
110650
110774
  if (!jsFileText)
110651
110775
  return jsFilePath;
110776
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
110777
+ return jsFilePath;
110652
110778
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
110653
110779
  // error if no source map or for now if inline sourcemap
110654
110780
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
110655
110781
  return sourceMapFilePath || "inline sourcemap decoding";
110782
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
110783
+ return sourceMapFilePath;
110656
110784
  // read declaration text
110657
110785
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
110658
110786
  if (declarationFilePath && !declarationText)
110659
110787
  return declarationFilePath;
110788
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
110789
+ return declarationFilePath;
110660
110790
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
110661
110791
  // error if no source map or for now if inline sourcemap
110662
110792
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
110663
110793
  return declarationMapPath || "inline sourcemap decoding";
110664
- var buildInfo = getBuildInfo(buildInfoText);
110665
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
110666
- return buildInfoPath;
110794
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
110795
+ return declarationMapPath;
110667
110796
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110668
110797
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
110669
110798
  /*onlyOwnText*/ true);
110670
110799
  var outputFiles = [];
110671
110800
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
110672
110801
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
110802
+ var changedDtsText;
110803
+ var changedDtsData;
110673
110804
  var emitHost = {
110674
110805
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
110675
110806
  getCanonicalFileName: host.getCanonicalFileName,
@@ -110685,7 +110816,7 @@ var ts;
110685
110816
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
110686
110817
  getProjectReferenceRedirect: ts.returnUndefined,
110687
110818
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
110688
- writeFile: function (name, text, writeByteOrderMark) {
110819
+ writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
110689
110820
  switch (name) {
110690
110821
  case jsFilePath:
110691
110822
  if (jsFileText === text)
@@ -110696,8 +110827,13 @@ var ts;
110696
110827
  return;
110697
110828
  break;
110698
110829
  case buildInfoPath:
110699
- var newBuildInfo = getBuildInfo(text);
110830
+ var newBuildInfo = data.buildInfo;
110700
110831
  newBuildInfo.program = buildInfo.program;
110832
+ if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
110833
+ // Update the output signature
110834
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
110835
+ newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
110836
+ }
110701
110837
  // Update sourceFileInfo
110702
110838
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
110703
110839
  newBuildInfo.bundle.js.sources = js.sources;
@@ -110705,11 +110841,13 @@ var ts;
110705
110841
  newBuildInfo.bundle.dts.sources = dts.sources;
110706
110842
  }
110707
110843
  newBuildInfo.bundle.sourceFiles = sourceFiles;
110708
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
110844
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
110709
110845
  return;
110710
110846
  case declarationFilePath:
110711
110847
  if (declarationText === text)
110712
110848
  return;
110849
+ changedDtsText = text;
110850
+ changedDtsData = data;
110713
110851
  break;
110714
110852
  case declarationMapPath:
110715
110853
  if (declarationMapText === text)
@@ -110728,6 +110866,7 @@ var ts;
110728
110866
  getSourceFileFromReference: ts.returnUndefined,
110729
110867
  redirectTargetsMap: ts.createMultiMap(),
110730
110868
  getFileIncludeReasons: ts.notImplemented,
110869
+ createHash: createHash,
110731
110870
  };
110732
110871
  emitFiles(ts.notImplementedResolver, emitHost,
110733
110872
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
@@ -115812,12 +115951,10 @@ var ts;
115812
115951
  }
115813
115952
  ts.createCompilerHost = createCompilerHost;
115814
115953
  /*@internal*/
115815
- // TODO(shkamat): update this after reworking ts build API
115816
115954
  function createCompilerHostWorker(options, setParentNodes, system) {
115817
115955
  if (system === void 0) { system = ts.sys; }
115818
115956
  var existingDirectories = new ts.Map();
115819
115957
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
115820
- var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
115821
115958
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
115822
115959
  var text;
115823
115960
  try {
@@ -115850,7 +115987,7 @@ var ts;
115850
115987
  // NOTE: If patchWriteFileEnsuringDirectory has been called,
115851
115988
  // the system.writeFile will do its own directory creation and
115852
115989
  // the ensureDirectoriesExist call will always be redundant.
115853
- 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); });
115990
+ 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); });
115854
115991
  ts.performance.mark("afterIOWrite");
115855
115992
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
115856
115993
  }
@@ -115860,35 +115997,6 @@ var ts;
115860
115997
  }
115861
115998
  }
115862
115999
  }
115863
- var outputFingerprints;
115864
- function writeFileWorker(fileName, data, writeByteOrderMark) {
115865
- if (!ts.isWatchSet(options) || !system.getModifiedTime) {
115866
- system.writeFile(fileName, data, writeByteOrderMark);
115867
- return;
115868
- }
115869
- if (!outputFingerprints) {
115870
- outputFingerprints = new ts.Map();
115871
- }
115872
- var hash = computeHash(data);
115873
- var mtimeBefore = system.getModifiedTime(fileName);
115874
- if (mtimeBefore) {
115875
- var fingerprint = outputFingerprints.get(fileName);
115876
- // If output has not been changed, and the file has no external modification
115877
- if (fingerprint &&
115878
- fingerprint.byteOrderMark === writeByteOrderMark &&
115879
- fingerprint.hash === hash &&
115880
- fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
115881
- return;
115882
- }
115883
- }
115884
- system.writeFile(fileName, data, writeByteOrderMark);
115885
- var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
115886
- outputFingerprints.set(fileName, {
115887
- hash: hash,
115888
- byteOrderMark: writeByteOrderMark,
115889
- mtime: mtimeAfter
115890
- });
115891
- }
115892
116000
  function getDefaultLibLocation() {
115893
116001
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
115894
116002
  }
@@ -117478,6 +117586,7 @@ var ts;
117478
117586
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
117479
117587
  redirectTargetsMap: redirectTargetsMap,
117480
117588
  getFileIncludeReasons: program.getFileIncludeReasons,
117589
+ createHash: ts.maybeBind(host, host.createHash),
117481
117590
  };
117482
117591
  }
117483
117592
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -119591,13 +119700,9 @@ var ts;
119591
119700
  function createManyToManyPathMap() {
119592
119701
  function create(forward, reverse, deleted) {
119593
119702
  var map = {
119594
- clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119595
- forEach: function (fn) { return forward.forEach(fn); },
119596
119703
  getKeys: function (v) { return reverse.get(v); },
119597
119704
  getValues: function (k) { return forward.get(k); },
119598
- hasKey: function (k) { return forward.has(k); },
119599
119705
  keys: function () { return forward.keys(); },
119600
- deletedKeys: function () { return deleted; },
119601
119706
  deleteKey: function (k) {
119602
119707
  (deleted || (deleted = new ts.Set())).add(k);
119603
119708
  var set = forward.get(k);
@@ -119624,11 +119729,6 @@ var ts;
119624
119729
  });
119625
119730
  return map;
119626
119731
  },
119627
- clear: function () {
119628
- forward.clear();
119629
- reverse.clear();
119630
- deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119631
- }
119632
119732
  };
119633
119733
  return map;
119634
119734
  }
@@ -119756,18 +119856,21 @@ var ts;
119756
119856
  * Creates the state of file references and signature for the new program from oldState if it is safe
119757
119857
  */
119758
119858
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119859
+ var _a, _b, _c;
119759
119860
  var fileInfos = new ts.Map();
119760
119861
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
119761
119862
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
119762
- var hasCalledUpdateShapeSignature = new ts.Set();
119763
119863
  var useOldState = canReuseOldState(referencedMap, oldState);
119764
119864
  // Ensure source files have parent pointers set
119765
119865
  newProgram.getTypeChecker();
119766
119866
  // Create the reference map, and set the file infos
119767
- for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
119768
- var sourceFile = _a[_i];
119867
+ for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
119868
+ var sourceFile = _d[_i];
119769
119869
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
119770
- var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
119870
+ var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
119871
+ var signature = oldUncommitedSignature === undefined ?
119872
+ useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
119873
+ oldUncommitedSignature || undefined;
119771
119874
  if (referencedMap) {
119772
119875
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
119773
119876
  if (newReferences) {
@@ -119775,19 +119878,26 @@ var ts;
119775
119878
  }
119776
119879
  // Copy old visible to outside files map
119777
119880
  if (useOldState) {
119778
- var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
119881
+ var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
119882
+ var exportedModules = oldUncommitedExportedModules === undefined ?
119883
+ oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
119884
+ oldUncommitedExportedModules || undefined;
119779
119885
  if (exportedModules) {
119780
119886
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119781
119887
  }
119782
119888
  }
119783
119889
  }
119784
- fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
119890
+ fileInfos.set(sourceFile.resolvedPath, {
119891
+ version: version_2,
119892
+ signature: signature,
119893
+ affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
119894
+ impliedFormat: sourceFile.impliedNodeFormat
119895
+ });
119785
119896
  }
119786
119897
  return {
119787
119898
  fileInfos: fileInfos,
119788
119899
  referencedMap: referencedMap,
119789
119900
  exportedModulesMap: exportedModulesMap,
119790
- hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
119791
119901
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
119792
119902
  };
119793
119903
  }
@@ -119801,71 +119911,42 @@ var ts;
119801
119911
  }
119802
119912
  BuilderState.releaseCache = releaseCache;
119803
119913
  /**
119804
- * Creates a clone of the state
119914
+ * Gets the files affected by the path from the program
119805
119915
  */
119806
- function clone(state) {
119916
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
119807
119917
  var _a, _b;
119808
- // Dont need to backup allFiles info since its cache anyway
119809
- return {
119810
- fileInfos: new ts.Map(state.fileInfos),
119811
- referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
119812
- exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
119813
- hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
119814
- useFileVersionAsSignature: state.useFileVersionAsSignature,
119815
- };
119918
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
119919
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119920
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119921
+ return result;
119816
119922
  }
119817
- BuilderState.clone = clone;
119818
- /**
119819
- * Gets the files affected by the path from the program
119820
- */
119821
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
119822
- // Since the operation could be cancelled, the signatures are always stored in the cache
119823
- // They will be committed once it is safe to use them
119824
- // eg when calling this api from tsserver, if there is no cancellation of the operation
119825
- // In the other cases the affected files signatures are committed only after the iteration through the result is complete
119826
- var signatureCache = cacheToUpdateSignature || new ts.Map();
119923
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119924
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
119827
119925
  var sourceFile = programOfThisState.getSourceFileByPath(path);
119828
119926
  if (!sourceFile) {
119829
119927
  return ts.emptyArray;
119830
119928
  }
119831
- if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
119929
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
119832
119930
  return [sourceFile];
119833
119931
  }
119834
- var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
119835
- if (!cacheToUpdateSignature) {
119836
- // Commit all the signatures in the signature cache
119837
- updateSignaturesFromCache(state, signatureCache);
119838
- }
119839
- return result;
119840
- }
119841
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119842
- /**
119843
- * Updates the signatures from the cache into state's fileinfo signatures
119844
- * This should be called whenever it is safe to commit the state of the builder
119845
- */
119846
- function updateSignaturesFromCache(state, signatureCache) {
119847
- signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
119932
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
119848
119933
  }
119849
- BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
119934
+ BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
119850
119935
  function updateSignatureOfFile(state, signature, path) {
119851
119936
  state.fileInfos.get(path).signature = signature;
119852
- state.hasCalledUpdateShapeSignature.add(path);
119937
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
119853
119938
  }
119854
119939
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
119855
119940
  /**
119856
119941
  * Returns if the shape of the signature has changed since last emit
119857
119942
  */
119858
- function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
119943
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
119944
+ var _a;
119859
119945
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
119860
- ts.Debug.assert(!!sourceFile);
119861
- ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
119862
119946
  // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
119863
- if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
119947
+ if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
119864
119948
  return false;
119865
- }
119866
119949
  var info = state.fileInfos.get(sourceFile.resolvedPath);
119867
- if (!info)
119868
- return ts.Debug.fail();
119869
119950
  var prevSignature = info.signature;
119870
119951
  var latestSignature;
119871
119952
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -119876,45 +119957,55 @@ var ts;
119876
119957
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119877
119958
  if (firstDts_1) {
119878
119959
  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; })); });
119879
- latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119880
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119881
- updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
119960
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
119961
+ if (latestSignature !== prevSignature) {
119962
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
119882
119963
  }
119883
119964
  }
119884
119965
  }
119885
119966
  // Default is to use file version as signature
119886
119967
  if (latestSignature === undefined) {
119887
119968
  latestSignature = sourceFile.version;
119888
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119969
+ if (state.exportedModulesMap && latestSignature !== prevSignature) {
119970
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119889
119971
  // All the references in this file are exported
119890
119972
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
119891
119973
  if (references) {
119892
- exportedModulesMapCache.set(sourceFile.resolvedPath, references);
119974
+ state.exportedModulesMap.set(sourceFile.resolvedPath, references);
119893
119975
  }
119894
119976
  else {
119895
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119977
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119896
119978
  }
119897
119979
  }
119898
119980
  }
119899
- cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
119981
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
119982
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
119983
+ info.signature = latestSignature;
119900
119984
  return latestSignature !== prevSignature;
119901
119985
  }
119902
119986
  BuilderState.updateShapeSignature = updateShapeSignature;
119987
+ function computeSignature(text, computeHash) {
119988
+ return (computeHash || ts.generateDjb2Hash)(text);
119989
+ }
119990
+ BuilderState.computeSignature = computeSignature;
119903
119991
  /**
119904
119992
  * Coverts the declaration emit result into exported modules map
119905
119993
  */
119906
- function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
119994
+ function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
119995
+ if (!state.exportedModulesMap)
119996
+ return;
119997
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119907
119998
  if (!exportedModulesFromDeclarationEmit) {
119908
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119999
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119909
120000
  return;
119910
120001
  }
119911
120002
  var exportedModules;
119912
120003
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
119913
120004
  if (exportedModules) {
119914
- exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
120005
+ state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119915
120006
  }
119916
120007
  else {
119917
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
120008
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119918
120009
  }
119919
120010
  function addExportedModule(exportedModulePaths) {
119920
120011
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -119926,19 +120017,6 @@ var ts;
119926
120017
  }
119927
120018
  }
119928
120019
  BuilderState.updateExportedModules = updateExportedModules;
119929
- /**
119930
- * Updates the exported modules from cache into state's exported modules map
119931
- * This should be called whenever it is safe to commit the state of the builder
119932
- */
119933
- function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
119934
- var _a;
119935
- if (exportedModulesMapCache) {
119936
- ts.Debug.assert(!!state.exportedModulesMap);
119937
- (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
119938
- exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
119939
- }
119940
- }
119941
- BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
119942
120020
  /**
119943
120021
  * Get all the dependencies of the sourceFile
119944
120022
  */
@@ -120059,7 +120137,7 @@ var ts;
120059
120137
  /**
120060
120138
  * When program emits modular code, gets the files affected by the sourceFile whose shape has changed
120061
120139
  */
120062
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
120140
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
120063
120141
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
120064
120142
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
120065
120143
  }
@@ -120079,7 +120157,7 @@ var ts;
120079
120157
  if (!seenFileNamesMap.has(currentPath)) {
120080
120158
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
120081
120159
  seenFileNamesMap.set(currentPath, currentSourceFile);
120082
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
120160
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
120083
120161
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
120084
120162
  }
120085
120163
  }
@@ -120105,32 +120183,33 @@ var ts;
120105
120183
  * Create the state so that we can iterate on changedFiles/affected files
120106
120184
  */
120107
120185
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
120186
+ var _a, _b;
120108
120187
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
120109
120188
  state.program = newProgram;
120110
120189
  var compilerOptions = newProgram.getCompilerOptions();
120111
120190
  state.compilerOptions = compilerOptions;
120191
+ var outFilePath = ts.outFile(compilerOptions);
120112
120192
  // With --out or --outFile, any change affects all semantic diagnostics so no need to cache them
120113
- if (!ts.outFile(compilerOptions)) {
120193
+ if (!outFilePath) {
120114
120194
  state.semanticDiagnosticsPerFile = new ts.Map();
120115
120195
  }
120196
+ 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)) {
120197
+ state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
120198
+ }
120116
120199
  state.changedFilesSet = new ts.Set();
120200
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
120117
120201
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
120118
120202
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
120119
120203
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
120120
120204
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
120205
+ var canCopyEmitSignatures = compilerOptions.composite &&
120206
+ (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
120207
+ !outFilePath &&
120208
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
120121
120209
  if (useOldState) {
120122
- // Verify the sanity of old state
120123
- if (!oldState.currentChangedFilePath) {
120124
- var affectedSignatures = oldState.currentAffectedFilesSignatures;
120125
- ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
120126
- }
120127
- var changedFilesSet = oldState.changedFilesSet;
120128
- if (canCopySemanticDiagnostics) {
120129
- ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
120130
- }
120131
120210
  // Copy old state's changed files set
120132
- changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
120133
- if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
120211
+ (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
120212
+ if (!outFilePath && oldState.affectedFilesPendingEmit) {
120134
120213
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
120135
120214
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
120136
120215
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -120151,6 +120230,8 @@ var ts;
120151
120230
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
120152
120231
  // versions dont match
120153
120232
  oldInfo.version !== info.version ||
120233
+ // Implied formats dont match
120234
+ oldInfo.impliedFormat !== info.impliedFormat ||
120154
120235
  // Referenced files changed
120155
120236
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
120156
120237
  // Referenced file was deleted in the new program
@@ -120174,27 +120255,25 @@ var ts;
120174
120255
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
120175
120256
  }
120176
120257
  }
120258
+ if (canCopyEmitSignatures) {
120259
+ var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
120260
+ if (oldEmitSignature)
120261
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
120262
+ }
120177
120263
  });
120178
120264
  // If the global file is removed, add all files as changed
120179
120265
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
120180
120266
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, /*firstSourceFile*/ undefined)
120181
120267
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
120182
120268
  }
120183
- else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
120269
+ else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
120184
120270
  // Add all files to affectedFilesPendingEmit since emit changed
120185
120271
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1 /* Full */); });
120186
120272
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
120187
120273
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
120188
120274
  }
120189
- if (useOldState) {
120190
- // Any time the interpretation of a source file changes, mark it as changed
120191
- ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
120192
- if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
120193
- state.changedFilesSet.add(sourceFilePath);
120194
- }
120195
- });
120196
- }
120197
- state.buildInfoEmitPending = !!state.changedFilesSet.size;
120275
+ // Since old states change files set is copied, any additional change means we would need to emit build info
120276
+ state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
120198
120277
  return state;
120199
120278
  }
120200
120279
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -120230,30 +120309,35 @@ var ts;
120230
120309
  ts.BuilderState.releaseCache(state);
120231
120310
  state.program = undefined;
120232
120311
  }
120233
- /**
120234
- * Creates a clone of the state
120235
- */
120236
- function cloneBuilderProgramState(state) {
120237
- var _a;
120238
- var newState = ts.BuilderState.clone(state);
120239
- newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
120240
- newState.changedFilesSet = new ts.Set(state.changedFilesSet);
120241
- newState.affectedFiles = state.affectedFiles;
120242
- newState.affectedFilesIndex = state.affectedFilesIndex;
120243
- newState.currentChangedFilePath = state.currentChangedFilePath;
120244
- newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
120245
- newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
120246
- newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
120247
- newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
120248
- newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
120249
- newState.program = state.program;
120250
- newState.compilerOptions = state.compilerOptions;
120251
- newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
120252
- newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
120253
- newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
120254
- newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
120255
- newState.programEmitComplete = state.programEmitComplete;
120256
- return newState;
120312
+ function backupEmitBuilderProgramState(state) {
120313
+ var outFilePath = ts.outFile(state.compilerOptions);
120314
+ // Only in --out changeFileSet is kept around till emit
120315
+ ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
120316
+ return {
120317
+ affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
120318
+ affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
120319
+ affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
120320
+ seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
120321
+ programEmitComplete: state.programEmitComplete,
120322
+ emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
120323
+ outSignature: state.outSignature,
120324
+ dtsChangeTime: state.dtsChangeTime,
120325
+ hasChangedEmitSignature: state.hasChangedEmitSignature,
120326
+ changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
120327
+ };
120328
+ }
120329
+ function restoreEmitBuilderProgramState(state, backupEmitState) {
120330
+ state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
120331
+ state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
120332
+ state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
120333
+ state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
120334
+ state.programEmitComplete = backupEmitState.programEmitComplete;
120335
+ state.emitSignatures = backupEmitState.emitSignatures;
120336
+ state.outSignature = backupEmitState.outSignature;
120337
+ state.dtsChangeTime = backupEmitState.dtsChangeTime;
120338
+ state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
120339
+ if (backupEmitState.changedFilesSet)
120340
+ state.changedFilesSet = backupEmitState.changedFilesSet;
120257
120341
  }
120258
120342
  /**
120259
120343
  * Verifies that source file is ok to be used in calls that arent handled by next
@@ -120268,7 +120352,7 @@ var ts;
120268
120352
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
120269
120353
  */
120270
120354
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
120271
- var _a;
120355
+ var _a, _b;
120272
120356
  while (true) {
120273
120357
  var affectedFiles = state.affectedFiles;
120274
120358
  if (affectedFiles) {
@@ -120288,10 +120372,8 @@ var ts;
120288
120372
  state.changedFilesSet.delete(state.currentChangedFilePath);
120289
120373
  state.currentChangedFilePath = undefined;
120290
120374
  // Commit the changes in file signature
120291
- ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
120292
- state.currentAffectedFilesSignatures.clear();
120293
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120294
- (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
120375
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
120376
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120295
120377
  state.affectedFiles = undefined;
120296
120378
  }
120297
120379
  // Get next changed file
@@ -120309,12 +120391,7 @@ var ts;
120309
120391
  return program;
120310
120392
  }
120311
120393
  // Get next batch of affected files
120312
- if (!state.currentAffectedFilesSignatures)
120313
- state.currentAffectedFilesSignatures = new ts.Map();
120314
- if (state.exportedModulesMap) {
120315
- state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
120316
- }
120317
- state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
120394
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
120318
120395
  state.currentChangedFilePath = nextKey.value;
120319
120396
  state.affectedFilesIndex = 0;
120320
120397
  if (!state.seenAffectedFiles)
@@ -120366,7 +120443,6 @@ var ts;
120366
120443
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
120367
120444
  */
120368
120445
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120369
- var _a;
120370
120446
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
120371
120447
  // If affected files is everything except default library, then nothing more to do
120372
120448
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -120374,10 +120450,9 @@ var ts;
120374
120450
  // When a change affects the global scope, all files are considered to be affected without updating their signature
120375
120451
  // That means when affected file is handled, its signature can be out of date
120376
120452
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
120377
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
120453
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
120378
120454
  return;
120379
120455
  }
120380
- 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);
120381
120456
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
120382
120457
  return;
120383
120458
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -120397,7 +120472,7 @@ var ts;
120397
120472
  // This ensures that we dont later during incremental builds considering wrong signature.
120398
120473
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
120399
120474
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
120400
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
120475
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
120401
120476
  // If not dts emit, nothing more to do
120402
120477
  if (ts.getEmitDeclarations(state.compilerOptions)) {
120403
120478
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -120418,27 +120493,10 @@ var ts;
120418
120493
  return !state.semanticDiagnosticsFromOldState.size;
120419
120494
  }
120420
120495
  function isChangedSignature(state, path) {
120421
- var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
120422
- var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120496
+ var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
120497
+ var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120423
120498
  return newSignature !== oldSignature;
120424
120499
  }
120425
- function forEachKeyOfExportedModulesMap(state, filePath, fn) {
120426
- // Go through exported modules from cache first
120427
- var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
120428
- var result = keys && ts.forEachKey(keys, fn);
120429
- if (result)
120430
- return result;
120431
- // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
120432
- keys = state.exportedModulesMap.getKeys(filePath);
120433
- return keys && ts.forEachKey(keys, function (exportedFromPath) {
120434
- var _a;
120435
- // If the cache had an updated value, skip
120436
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
120437
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
120438
- fn(exportedFromPath) :
120439
- undefined;
120440
- });
120441
- }
120442
120500
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
120443
120501
  var _a;
120444
120502
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -120453,6 +120511,7 @@ var ts;
120453
120511
  * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
120454
120512
  */
120455
120513
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120514
+ var _a;
120456
120515
  // If there was change in signature (dts output) for the changed file,
120457
120516
  // then only we need to handle pending file emit
120458
120517
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
@@ -120479,11 +120538,10 @@ var ts;
120479
120538
  }
120480
120539
  }
120481
120540
  }
120482
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120483
120541
  var seenFileAndExportsOfFile = new ts.Set();
120484
120542
  // Go through exported modules from cache first
120485
120543
  // If exported modules has path, all files referencing file exported from are affected
120486
- forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
120544
+ (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120487
120545
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
120488
120546
  return true;
120489
120547
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -120497,19 +120555,18 @@ var ts;
120497
120555
  * return true when all work is done and we can exit handling dts emit and semantic diagnostics
120498
120556
  */
120499
120557
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
120500
- var _a;
120558
+ var _a, _b;
120501
120559
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
120502
120560
  return undefined;
120503
120561
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
120504
120562
  return true;
120505
120563
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
120506
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120507
120564
  // If exported modules has path, all files referencing file exported from are affected
120508
- forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
120565
+ (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120509
120566
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
120510
120567
  });
120511
120568
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
120512
- (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
120569
+ (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
120513
120570
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
120514
120571
  handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
120515
120572
  state, referencingFilePath, cancellationToken, computeHash, host);
@@ -120530,12 +120587,13 @@ var ts;
120530
120587
  }
120531
120588
  else {
120532
120589
  state.seenAffectedFiles.add(affected.resolvedPath);
120590
+ // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted
120591
+ state.buildInfoEmitPending = true;
120533
120592
  if (emitKind !== undefined) {
120534
120593
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
120535
120594
  }
120536
120595
  if (isPendingEmit) {
120537
120596
  state.affectedFilesPendingEmitIndex++;
120538
- state.buildInfoEmitPending = true;
120539
120597
  }
120540
120598
  else {
120541
120599
  state.affectedFilesIndex++;
@@ -120583,25 +120641,61 @@ var ts;
120583
120641
  }
120584
120642
  return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
120585
120643
  }
120644
+ function isProgramBundleEmitBuildInfo(info) {
120645
+ return !!ts.outFile(info.options || {});
120646
+ }
120647
+ ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
120586
120648
  /**
120587
120649
  * Gets the program information to be emitted in buildInfo so that we can use it to create new program
120588
120650
  */
120589
- function getProgramBuildInfo(state, getCanonicalFileName) {
120590
- if (ts.outFile(state.compilerOptions))
120591
- return undefined;
120651
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
120652
+ var outFilePath = ts.outFile(state.compilerOptions);
120653
+ if (outFilePath && !state.compilerOptions.composite)
120654
+ return;
120592
120655
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
120593
120656
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
120657
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
120658
+ if (outFilePath) {
120659
+ var fileNames_1 = [];
120660
+ var fileInfos_1 = [];
120661
+ state.program.getRootFileNames().forEach(function (f) {
120662
+ var sourceFile = state.program.getSourceFile(f);
120663
+ if (!sourceFile)
120664
+ return;
120665
+ fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
120666
+ fileInfos_1.push(sourceFile.version);
120667
+ });
120668
+ var result_15 = {
120669
+ fileNames: fileNames_1,
120670
+ fileInfos: fileInfos_1,
120671
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
120672
+ outSignature: state.outSignature,
120673
+ dtsChangeTime: state.dtsChangeTime,
120674
+ };
120675
+ return result_15;
120676
+ }
120594
120677
  var fileNames = [];
120595
120678
  var fileNameToFileId = new ts.Map();
120596
120679
  var fileIdsList;
120597
120680
  var fileNamesToFileIdListId;
120681
+ var emitSignatures;
120598
120682
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
120683
+ var _b, _c;
120599
120684
  var key = _a[0], value = _a[1];
120600
120685
  // Ensure fileId
120601
120686
  var fileId = toFileId(key);
120602
120687
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
120603
- var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120604
- var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120688
+ var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
120689
+ var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
120690
+ if (state.compilerOptions.composite) {
120691
+ var file = state.program.getSourceFileByPath(key);
120692
+ if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
120693
+ var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
120694
+ if (emitSignature !== actualSignature) {
120695
+ (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
120696
+ }
120697
+ }
120698
+ }
120605
120699
  return value.version === actualSignature ?
120606
120700
  value.affectsGlobalScope || value.impliedFormat ?
120607
120701
  // If file version is same as signature, dont serialize signature
@@ -120609,11 +120703,11 @@ var ts;
120609
120703
  // If file info only contains version and signature and both are same we can just write string
120610
120704
  value.version :
120611
120705
  actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120612
- signature === undefined ?
120706
+ oldSignature === undefined ?
120613
120707
  // If we havent computed signature, use fileInfo as is
120614
120708
  value :
120615
120709
  // Serialize fileInfo with new updated signature
120616
- { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120710
+ { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120617
120711
  // Signature of the FileInfo is undefined, serialize it as false
120618
120712
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120619
120713
  });
@@ -120628,17 +120722,13 @@ var ts;
120628
120722
  if (state.exportedModulesMap) {
120629
120723
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
120630
120724
  var _a;
120631
- if (state.currentAffectedFilesExportedModulesMap) {
120632
- if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
120633
- return undefined;
120634
- }
120635
- var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
120636
- if (newValue) {
120637
- return [toFileId(key), toFileIdListId(newValue)];
120638
- }
120639
- }
120725
+ var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
120640
120726
  // Not in temporary cache, use existing value
120641
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120727
+ if (oldValue === undefined)
120728
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120729
+ if (oldValue)
120730
+ return [toFileId(key), toFileIdListId(oldValue)];
120731
+ return undefined;
120642
120732
  });
120643
120733
  }
120644
120734
  var semanticDiagnosticsPerFile;
@@ -120649,9 +120739,7 @@ var ts;
120649
120739
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
120650
120740
  [
120651
120741
  toFileId(key),
120652
- state.hasReusableDiagnostic ?
120653
- value :
120654
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120742
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
120655
120743
  ] :
120656
120744
  toFileId(key));
120657
120745
  }
@@ -120666,16 +120754,27 @@ var ts;
120666
120754
  }
120667
120755
  }
120668
120756
  }
120669
- return {
120757
+ var changeFileSet;
120758
+ if (state.changedFilesSet.size) {
120759
+ for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
120760
+ var path = _e[_d];
120761
+ (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120762
+ }
120763
+ }
120764
+ var result = {
120670
120765
  fileNames: fileNames,
120671
120766
  fileInfos: fileInfos,
120672
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
120767
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
120673
120768
  fileIdsList: fileIdsList,
120674
120769
  referencedMap: referencedMap,
120675
120770
  exportedModulesMap: exportedModulesMap,
120676
120771
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
120677
120772
  affectedFilesPendingEmit: affectedFilesPendingEmit,
120773
+ changeFileSet: changeFileSet,
120774
+ emitSignatures: emitSignatures,
120775
+ dtsChangeTime: state.dtsChangeTime,
120678
120776
  };
120777
+ return result;
120679
120778
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
120680
120779
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
120681
120780
  }
@@ -120700,24 +120799,18 @@ var ts;
120700
120799
  }
120701
120800
  return fileIdListId;
120702
120801
  }
120703
- }
120704
- function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
120705
- var result;
120706
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120707
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120708
- var name = _a[_i];
120709
- var optionKey = name.toLowerCase();
120710
- var optionInfo = optionsNameMap.get(optionKey);
120711
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
120712
- // We need to store `strict`, even though it won't be examined directly, so that the
120713
- // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
120714
- optionKey === "strict" ||
120715
- // We need to store these to determine whether `lib` files need to be rechecked.
120716
- optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
120717
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
120802
+ function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
120803
+ var result;
120804
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120805
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120806
+ var name = _a[_i];
120807
+ var optionInfo = optionsNameMap.get(name.toLowerCase());
120808
+ if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
120809
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
120810
+ }
120718
120811
  }
120812
+ return result;
120719
120813
  }
120720
- return result;
120721
120814
  }
120722
120815
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120723
120816
  if (option) {
@@ -120791,6 +120884,10 @@ var ts;
120791
120884
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
120792
120885
  }
120793
120886
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
120887
+ function computeSignature(text, data, computeHash) {
120888
+ return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
120889
+ }
120890
+ ts.computeSignature = computeSignature;
120794
120891
  function createBuilderProgram(kind, _a) {
120795
120892
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
120796
120893
  // Return same program if underlying program doesnt change
@@ -120809,8 +120906,8 @@ var ts;
120809
120906
  */
120810
120907
  var computeHash = ts.maybeBind(host, host.createHash);
120811
120908
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
120812
- var backupState;
120813
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
120909
+ var backupEmitState;
120910
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
120814
120911
  // To ensure that we arent storing any references to old program or new program without state
120815
120912
  newProgram = undefined; // TODO: GH#18217
120816
120913
  oldProgram = undefined;
@@ -120818,20 +120915,20 @@ var ts;
120818
120915
  var getState = function () { return state; };
120819
120916
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
120820
120917
  builderProgram.getState = getState;
120821
- builderProgram.backupState = function () {
120822
- ts.Debug.assert(backupState === undefined);
120823
- backupState = cloneBuilderProgramState(state);
120918
+ builderProgram.backupEmitState = function () {
120919
+ ts.Debug.assert(backupEmitState === undefined);
120920
+ backupEmitState = backupEmitBuilderProgramState(state);
120824
120921
  };
120825
- builderProgram.restoreState = function () {
120826
- state = ts.Debug.checkDefined(backupState);
120827
- backupState = undefined;
120922
+ builderProgram.restoreEmitState = function () {
120923
+ restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
120924
+ backupEmitState = undefined;
120828
120925
  };
120829
120926
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
120830
120927
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
120831
120928
  builderProgram.emit = emit;
120832
120929
  builderProgram.releaseProgram = function () {
120833
120930
  releaseCache(state);
120834
- backupState = undefined;
120931
+ backupEmitState = undefined;
120835
120932
  };
120836
120933
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
120837
120934
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -120890,35 +120987,59 @@ var ts;
120890
120987
  return toAffectedFileEmitResult(state,
120891
120988
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
120892
120989
  // Otherwise just affected file
120893
- ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120894
- getWriteFileUpdatingSignatureCallback(writeFile) :
120990
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
120991
+ getWriteFileCallback(writeFile, customTransformers) :
120895
120992
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
120896
120993
  }
120897
- function getWriteFileUpdatingSignatureCallback(writeFile) {
120994
+ function getWriteFileCallback(writeFile, customTransformers) {
120898
120995
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
120899
- var _a;
120996
+ var _a, _b, _c;
120900
120997
  if (ts.isDeclarationFileName(fileName)) {
120901
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120902
- var file = sourceFiles[0];
120903
- var info = state.fileInfos.get(file.resolvedPath);
120904
- var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120905
- if (signature === file.version) {
120906
- var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120907
- if (newSignature !== file.version) { // Update it
120908
- if (host.storeFilesChangingSignatureDuringEmit)
120909
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120910
- if (state.exportedModulesMap)
120911
- ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
120912
- if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
120913
- state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
120998
+ if (!ts.outFile(state.compilerOptions)) {
120999
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
121000
+ var newSignature = void 0;
121001
+ if (!customTransformers) {
121002
+ var file = sourceFiles[0];
121003
+ var info = state.fileInfos.get(file.resolvedPath);
121004
+ if (info.signature === file.version) {
121005
+ newSignature = computeSignature(text, data, computeHash);
121006
+ if (newSignature !== file.version) { // Update it
121007
+ if (host.storeFilesChangingSignatureDuringEmit)
121008
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
121009
+ if (state.exportedModulesMap)
121010
+ ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
121011
+ if (state.affectedFiles) {
121012
+ // Keep old signature so we know what to undo if cancellation happens
121013
+ var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
121014
+ if (existing === undefined)
121015
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
121016
+ info.signature = newSignature;
121017
+ }
121018
+ else {
121019
+ // These are directly commited
121020
+ info.signature = newSignature;
121021
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
121022
+ }
121023
+ }
120914
121024
  }
120915
- else {
120916
- info.signature = newSignature;
120917
- if (state.exportedModulesMap)
120918
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
121025
+ }
121026
+ if (state.compilerOptions.composite) {
121027
+ var filePath = sourceFiles[0].resolvedPath;
121028
+ var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
121029
+ newSignature || (newSignature = computeSignature(text, data, computeHash));
121030
+ if (newSignature !== oldSignature) {
121031
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
121032
+ state.hasChangedEmitSignature = true;
120919
121033
  }
120920
121034
  }
120921
121035
  }
121036
+ else if (state.compilerOptions.composite) {
121037
+ var newSignature = computeSignature(text, data, computeHash);
121038
+ if (newSignature !== state.outSignature) {
121039
+ state.outSignature = newSignature;
121040
+ state.hasChangedEmitSignature = true;
121041
+ }
121042
+ }
120922
121043
  }
120923
121044
  if (writeFile)
120924
121045
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -120983,8 +121104,8 @@ var ts;
120983
121104
  }
120984
121105
  }
120985
121106
  }
120986
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120987
- getWriteFileUpdatingSignatureCallback(writeFile) :
121107
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
121108
+ getWriteFileCallback(writeFile, customTransformers) :
120988
121109
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120989
121110
  }
120990
121111
  /**
@@ -121073,29 +121194,58 @@ var ts;
121073
121194
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
121074
121195
  }
121075
121196
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
121076
- function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
121077
- var _a;
121197
+ function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
121198
+ var _a, _b, _c, _d;
121078
121199
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
121079
121200
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
121080
- var filePaths = program.fileNames.map(toPath);
121081
- var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
121082
- var fileInfos = new ts.Map();
121083
- program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
121084
- var state = {
121085
- fileInfos: fileInfos,
121086
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121087
- referencedMap: toManyToManyPathMap(program.referencedMap),
121088
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121089
- semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return toFilePath(ts.isNumber(value) ? value : value[0]); }, function (value) { return ts.isNumber(value) ? ts.emptyArray : value[1]; }),
121090
- hasReusableDiagnostic: true,
121091
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
121092
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
121093
- affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
121094
- };
121201
+ var state;
121202
+ var filePaths;
121203
+ var filePathsSetList;
121204
+ if (isProgramBundleEmitBuildInfo(program)) {
121205
+ state = {
121206
+ fileInfos: new ts.Map(),
121207
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121208
+ dtsChangeTime: program.dtsChangeTime,
121209
+ outSignature: program.outSignature,
121210
+ };
121211
+ }
121212
+ else {
121213
+ filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
121214
+ filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
121215
+ var fileInfos_2 = new ts.Map();
121216
+ var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
121217
+ program.fileInfos.forEach(function (fileInfo, index) {
121218
+ var path = toFilePath(index + 1);
121219
+ var stateFileInfo = toBuilderStateFileInfo(fileInfo);
121220
+ fileInfos_2.set(path, stateFileInfo);
121221
+ if (emitSignatures_1 && stateFileInfo.signature)
121222
+ emitSignatures_1.set(path, stateFileInfo.signature);
121223
+ });
121224
+ (_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
121225
+ if (ts.isNumber(value))
121226
+ emitSignatures_1.delete(toFilePath(value));
121227
+ else
121228
+ emitSignatures_1.set(toFilePath(value[0]), value[1]);
121229
+ });
121230
+ state = {
121231
+ fileInfos: fileInfos_2,
121232
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121233
+ referencedMap: toManyToManyPathMap(program.referencedMap),
121234
+ exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121235
+ semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return toFilePath(ts.isNumber(value) ? value : value[0]); }, function (value) { return ts.isNumber(value) ? ts.emptyArray : value[1]; }),
121236
+ hasReusableDiagnostic: true,
121237
+ affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
121238
+ affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
121239
+ affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
121240
+ changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
121241
+ dtsChangeTime: program.dtsChangeTime,
121242
+ emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
121243
+ };
121244
+ }
121095
121245
  return {
121096
121246
  getState: function () { return state; },
121097
- backupState: ts.noop,
121098
- restoreState: ts.noop,
121247
+ backupEmitState: ts.noop,
121248
+ restoreEmitState: ts.noop,
121099
121249
  getProgram: ts.notImplemented,
121100
121250
  getProgramOrUndefined: ts.returnUndefined,
121101
121251
  releaseProgram: ts.noop,
@@ -121140,12 +121290,24 @@ var ts;
121140
121290
  return map;
121141
121291
  }
121142
121292
  }
121143
- ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
121293
+ ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
121294
+ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
121295
+ var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
121296
+ var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
121297
+ var fileInfos = new ts.Map();
121298
+ program.fileInfos.forEach(function (fileInfo, index) {
121299
+ var path = ts.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
121300
+ var version = ts.isString(fileInfo) ? fileInfo : fileInfo.version; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
121301
+ fileInfos.set(path, version);
121302
+ });
121303
+ return fileInfos;
121304
+ }
121305
+ ts.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap;
121144
121306
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
121145
121307
  return {
121146
121308
  getState: ts.notImplemented,
121147
- backupState: ts.noop,
121148
- restoreState: ts.noop,
121309
+ backupEmitState: ts.noop,
121310
+ restoreEmitState: ts.noop,
121149
121311
  getProgram: getProgram,
121150
121312
  getProgramOrUndefined: function () { return getState().program; },
121151
121313
  releaseProgram: function () { return getState().program = undefined; },
@@ -122261,9 +122423,9 @@ var ts;
122261
122423
  if (!preferSymlinks) {
122262
122424
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
122263
122425
  // so we only need to remove them from the realpath filenames.
122264
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122265
- if (result_15)
122266
- return result_15;
122426
+ var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122427
+ if (result_16)
122428
+ return result_16;
122267
122429
  }
122268
122430
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
122269
122431
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -122283,10 +122445,10 @@ var ts;
122283
122445
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
122284
122446
  var symlinkDirectory = symlinkDirectories_1[_i];
122285
122447
  var option = ts.resolvePath(symlinkDirectory, relative);
122286
- var result_16 = cb(option, target === referenceRedirect);
122448
+ var result_17 = cb(option, target === referenceRedirect);
122287
122449
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
122288
- if (result_16)
122289
- return result_16;
122450
+ if (result_17)
122451
+ return result_17;
122290
122452
  }
122291
122453
  });
122292
122454
  });
@@ -123196,6 +123358,7 @@ var ts;
123196
123358
  readDirectory: ts.maybeBind(host, host.readDirectory),
123197
123359
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
123198
123360
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
123361
+ now: ts.maybeBind(host, host.now),
123199
123362
  };
123200
123363
  function writeFile(fileName, text, writeByteOrderMark, onError) {
123201
123364
  try {
@@ -123256,6 +123419,7 @@ var ts;
123256
123419
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
123257
123420
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
123258
123421
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
123422
+ now: ts.maybeBind(system, system.now),
123259
123423
  };
123260
123424
  }
123261
123425
  ts.createProgramHost = createProgramHost;
@@ -123323,20 +123487,26 @@ var ts;
123323
123487
  var ts;
123324
123488
  (function (ts) {
123325
123489
  function readBuilderProgram(compilerOptions, host) {
123326
- if (ts.outFile(compilerOptions))
123327
- return undefined;
123328
123490
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
123329
123491
  if (!buildInfoPath)
123330
123492
  return undefined;
123331
- var content = host.readFile(buildInfoPath);
123332
- if (!content)
123333
- return undefined;
123334
- var buildInfo = ts.getBuildInfo(content);
123493
+ var buildInfo;
123494
+ if (host.getBuildInfo) {
123495
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
123496
+ if (!buildInfo)
123497
+ return undefined;
123498
+ }
123499
+ else {
123500
+ var content = host.readFile(buildInfoPath);
123501
+ if (!content)
123502
+ return undefined;
123503
+ buildInfo = ts.getBuildInfo(content);
123504
+ }
123335
123505
  if (buildInfo.version !== ts.version)
123336
123506
  return undefined;
123337
123507
  if (!buildInfo.program)
123338
123508
  return undefined;
123339
- return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123509
+ return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123340
123510
  }
123341
123511
  ts.readBuilderProgram = readBuilderProgram;
123342
123512
  function createIncrementalCompilerHost(options, system) {
@@ -123345,6 +123515,7 @@ var ts;
123345
123515
  host.createHash = ts.maybeBind(system, system.createHash);
123346
123516
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
123347
123517
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
123518
+ host.now = ts.maybeBind(system, system.now);
123348
123519
  ts.setGetSourceFileAsHashVersioned(host, system);
123349
123520
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
123350
123521
  return host;
@@ -124080,14 +124251,17 @@ var ts;
124080
124251
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
124081
124252
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
124082
124253
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
124083
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
124084
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
124085
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
124086
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
124254
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
124255
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
124256
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
124257
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
124258
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
124259
+ UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
124087
124260
  /**
124088
124261
  * Projects with no outputs (i.e. "solution" files)
124089
124262
  */
124090
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
124263
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
124264
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
124091
124265
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
124092
124266
  function resolveConfigFileProjectName(project) {
124093
124267
  if (ts.fileExtensionIs(project, ".json" /* Json */)) {
@@ -124132,9 +124306,11 @@ var ts;
124132
124306
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
124133
124307
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
124134
124308
  }
124135
- function newer(date1, date2) {
124136
- return date2 > date1 ? date2 : date1;
124309
+ /*@internal*/
124310
+ function getCurrentTime(host) {
124311
+ return host.now ? host.now() : new Date();
124137
124312
  }
124313
+ ts.getCurrentTime = getCurrentTime;
124138
124314
  /*@internal*/
124139
124315
  function isCircularBuildOrder(buildOrder) {
124140
124316
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -124224,6 +124400,7 @@ var ts;
124224
124400
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
124225
124401
  };
124226
124402
  }
124403
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
124227
124404
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
124228
124405
  var state = {
124229
124406
  host: host,
@@ -124240,8 +124417,9 @@ var ts;
124240
124417
  resolvedConfigFilePaths: new ts.Map(),
124241
124418
  configFileCache: new ts.Map(),
124242
124419
  projectStatus: new ts.Map(),
124243
- buildInfoChecked: new ts.Map(),
124244
124420
  extendedConfigCache: new ts.Map(),
124421
+ buildInfoCache: new ts.Map(),
124422
+ outputTimeStamps: new ts.Map(),
124245
124423
  builderPrograms: new ts.Map(),
124246
124424
  diagnostics: new ts.Map(),
124247
124425
  projectPendingBuild: new ts.Map(),
@@ -124264,6 +124442,7 @@ var ts;
124264
124442
  allWatchedConfigFiles: new ts.Map(),
124265
124443
  allWatchedExtendedConfigFiles: new ts.Map(),
124266
124444
  allWatchedPackageJsonFiles: new ts.Map(),
124445
+ filesWatched: new ts.Map(),
124267
124446
  lastCachedPackageJsonLookups: new ts.Map(),
124268
124447
  timerToBuildInvalidatedProject: undefined,
124269
124448
  reportFileChangeDetected: false,
@@ -124374,11 +124553,12 @@ var ts;
124374
124553
  // Config file cache
124375
124554
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
124376
124555
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
124377
- ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
124378
124556
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
124379
124557
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
124380
124558
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
124381
124559
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
124560
+ ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
124561
+ ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
124382
124562
  // Remove watches for the program no longer in the solution
124383
124563
  if (state.watch) {
124384
124564
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
@@ -124675,21 +124855,21 @@ var ts;
124675
124855
  }
124676
124856
  function emit(writeFileCallback, cancellationToken, customTransformers) {
124677
124857
  var _a;
124678
- var _b, _c;
124858
+ var _b, _c, _d;
124679
124859
  ts.Debug.assertIsDefined(program);
124680
124860
  ts.Debug.assert(step === BuildStep.Emit);
124681
124861
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
124682
- program.backupState();
124862
+ program.backupEmitState();
124683
124863
  var declDiagnostics;
124684
124864
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
124685
124865
  var outputFiles = [];
124686
124866
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
124687
124867
  /*write*/ undefined,
124688
- /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
124868
+ /*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,
124689
124869
  /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
124690
124870
  // Don't emit .d.ts if there are decl file errors
124691
124871
  if (declDiagnostics) {
124692
- program.restoreState();
124872
+ program.restoreEmitState();
124693
124873
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
124694
124874
  return {
124695
124875
  emitSkipped: true,
@@ -124699,40 +124879,46 @@ var ts;
124699
124879
  // Actual Emit
124700
124880
  var host = state.host, compilerHost = state.compilerHost;
124701
124881
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124702
- var newestDeclarationFileContentChangedTime = minimumDate;
124703
- var anyDtsChanged = false;
124882
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
124704
124883
  var emitterDiagnostics = ts.createDiagnosticCollection();
124705
124884
  var emittedOutputs = new ts.Map();
124885
+ var options = program.getCompilerOptions();
124886
+ var isIncremental = ts.isIncrementalCompilation(options);
124887
+ var outputTimeStampMap;
124888
+ var now;
124706
124889
  ts.solutionPerformance.mark("beforeOutputFilesWrite");
124707
124890
  outputFiles.forEach(function (_a) {
124708
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124709
- var priorChangeTime;
124710
- if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124711
- // Check for unchanged .d.ts files
124712
- if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124713
- priorChangeTime = host.getModifiedTime(name);
124714
- }
124715
- else {
124891
+ var _b, _c;
124892
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124893
+ var path = toPath(state, name);
124894
+ emittedOutputs.set(toPath(state, name), name);
124895
+ if (buildInfo) {
124896
+ setBuildInfo(state, buildInfo, projectPath, options);
124897
+ 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)) {
124716
124898
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124717
- anyDtsChanged = true;
124718
124899
  }
124719
124900
  }
124720
- emittedOutputs.set(toPath(state, name), name);
124721
124901
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124722
- if (priorChangeTime !== undefined) {
124723
- newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
124902
+ if (!isIncremental && state.watch) {
124903
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
124724
124904
  }
124725
124905
  });
124726
124906
  ts.solutionPerformance.mark("afterOutputFilesWrite");
124727
124907
  ts.solutionPerformance.measure("OutputFilesWrite", "beforeOutputFilesWrite", "afterOutputFilesWrite");
124728
- finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime,
124729
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124908
+ finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124730
124909
  return emitResult;
124731
124910
  }
124732
124911
  function emitBuildInfo(writeFileCallback, cancellationToken) {
124733
124912
  ts.Debug.assertIsDefined(program);
124734
124913
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
124735
- var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
124914
+ var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
124915
+ if (data === null || data === void 0 ? void 0 : data.buildInfo)
124916
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
124917
+ if (writeFileCallback)
124918
+ writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
124919
+ else
124920
+ state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
124921
+ }, cancellationToken);
124736
124922
  if (emitResult.diagnostics.length) {
124737
124923
  reportErrors(state, emitResult.diagnostics);
124738
124924
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -124745,7 +124931,7 @@ var ts;
124745
124931
  step = BuildStep.QueueReferencingProjects;
124746
124932
  return emitResult;
124747
124933
  }
124748
- function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
124934
+ function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
124749
124935
  var _a;
124750
124936
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
124751
124937
  if (emitDiagnostics.length) {
@@ -124756,13 +124942,11 @@ var ts;
124756
124942
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
124757
124943
  }
124758
124944
  // Update time stamps for rest of the outputs
124759
- var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124945
+ updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124760
124946
  state.diagnostics.delete(projectPath);
124761
124947
  state.projectStatus.set(projectPath, {
124762
124948
  type: ts.UpToDateStatusType.UpToDate,
124763
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
124764
- maximumDate :
124765
- newestDeclarationFileContentChangedTime,
124949
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
124766
124950
  oldestOutputFileName: oldestOutputFileName
124767
124951
  });
124768
124952
  afterProgramDone(state, program, config);
@@ -124797,13 +124981,21 @@ var ts;
124797
124981
  ts.Debug.assert(!!outputFiles.length);
124798
124982
  var emitterDiagnostics = ts.createDiagnosticCollection();
124799
124983
  var emittedOutputs = new ts.Map();
124984
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124985
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
124800
124986
  outputFiles.forEach(function (_a) {
124801
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124987
+ var _b, _c;
124988
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124802
124989
  emittedOutputs.set(toPath(state, name), name);
124990
+ if (buildInfo) {
124991
+ setBuildInfo(state, buildInfo, projectPath, config.options);
124992
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
124993
+ resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124994
+ }
124995
+ }
124803
124996
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124804
124997
  });
124805
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate,
124806
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
124998
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
124807
124999
  return { emitSkipped: false, diagnostics: emitDiagnostics };
124808
125000
  }
124809
125001
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -124909,7 +125101,7 @@ var ts;
124909
125101
  }
124910
125102
  continue;
124911
125103
  }
124912
- if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
125104
+ if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
124913
125105
  reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
124914
125106
  return {
124915
125107
  kind: InvalidatedProjectKind.UpdateOutputFileStamps,
@@ -124995,7 +125187,7 @@ var ts;
124995
125187
  state.projectCompilerOptions = state.baseCompilerOptions;
124996
125188
  }
124997
125189
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
124998
- var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
125190
+ var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
124999
125191
  reportAndStoreErrors(state, resolvedPath, diagnostics);
125000
125192
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
125001
125193
  if (canEmitBuildInfo)
@@ -125003,9 +125195,101 @@ var ts;
125003
125195
  afterProgramDone(state, program, config);
125004
125196
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
125005
125197
  }
125198
+ function isFileWatcherWithModifiedTime(value) {
125199
+ return !!value.watcher;
125200
+ }
125201
+ function getModifiedTime(state, fileName) {
125202
+ var path = toPath(state, fileName);
125203
+ var existing = state.filesWatched.get(path);
125204
+ if (state.watch && !!existing) {
125205
+ if (!isFileWatcherWithModifiedTime(existing))
125206
+ return existing;
125207
+ if (existing.modifiedTime)
125208
+ return existing.modifiedTime;
125209
+ }
125210
+ var result = ts.getModifiedTime(state.host, fileName);
125211
+ if (state.watch) {
125212
+ if (existing)
125213
+ existing.modifiedTime = result;
125214
+ else
125215
+ state.filesWatched.set(path, result);
125216
+ }
125217
+ return result;
125218
+ }
125219
+ function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
125220
+ var path = toPath(state, file);
125221
+ var existing = state.filesWatched.get(path);
125222
+ if (existing && isFileWatcherWithModifiedTime(existing)) {
125223
+ existing.callbacks.push(callback);
125224
+ }
125225
+ else {
125226
+ var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
125227
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
125228
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
125229
+ existing.modifiedTime = modifiedTime;
125230
+ existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
125231
+ }, pollingInterval, options, watchType, project);
125232
+ state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
125233
+ }
125234
+ return {
125235
+ close: function () {
125236
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
125237
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
125238
+ if (existing.callbacks.length === 1) {
125239
+ state.filesWatched.delete(path);
125240
+ ts.closeFileWatcherOf(existing);
125241
+ }
125242
+ else {
125243
+ ts.unorderedRemoveItem(existing.callbacks, callback);
125244
+ }
125245
+ }
125246
+ };
125247
+ }
125248
+ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
125249
+ if (!state.watch)
125250
+ return undefined;
125251
+ var result = state.outputTimeStamps.get(resolvedConfigFilePath);
125252
+ if (!result)
125253
+ state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
125254
+ return result;
125255
+ }
125256
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
125257
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125258
+ var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
125259
+ if (existing) {
125260
+ existing.buildInfo = buildInfo;
125261
+ existing.modifiedTime = getCurrentTime(state.host);
125262
+ }
125263
+ else {
125264
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
125265
+ }
125266
+ }
125267
+ function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
125268
+ var path = toPath(state, buildInfoPath);
125269
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
125270
+ return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
125271
+ }
125272
+ function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
125273
+ var path = toPath(state, buildInfoPath);
125274
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
125275
+ if (existing !== undefined && existing.path === path) {
125276
+ return existing.buildInfo || undefined;
125277
+ }
125278
+ ts.solutionPerformance.mark("beforeGetBuildInfo");
125279
+ ts.solutionPerformance.mark("beforeBuildInfoRead");
125280
+ var value = state.readFileWithCache(buildInfoPath);
125281
+ ts.solutionPerformance.mark("afterBuildInfoRead");
125282
+ ts.solutionPerformance.measure("BuildInfoRead", "beforeBuildInfoRead", "afterBuildInfoRead");
125283
+ var buildInfo = value ? ts.getBuildInfo(value) : undefined;
125284
+ ts.Debug.assert(modifiedTime || !buildInfo);
125285
+ state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
125286
+ ts.solutionPerformance.mark("afterGetBuildInfo");
125287
+ ts.solutionPerformance.measure("GetBuildInfo", "beforeGetBuildInfo", "afterGetBuildInfo");
125288
+ return buildInfo;
125289
+ }
125006
125290
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
125007
125291
  // Check tsconfig time
125008
- var tsconfigTime = ts.getModifiedTime(state.host, configFile);
125292
+ var tsconfigTime = getModifiedTime(state, configFile);
125009
125293
  if (oldestOutputFileTime < tsconfigTime) {
125010
125294
  return {
125011
125295
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -125015,88 +125299,24 @@ var ts;
125015
125299
  }
125016
125300
  }
125017
125301
  function getUpToDateStatusWorker(state, project, resolvedPath) {
125018
- var force = !!state.options.force;
125019
- var newestInputFileName = undefined;
125020
- var newestInputFileTime = minimumDate;
125021
- var host = state.host;
125022
- // Get timestamps of input files
125023
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
125024
- var inputFile = _a[_i];
125025
- if (!host.fileExists(inputFile)) {
125026
- return {
125027
- type: ts.UpToDateStatusType.Unbuildable,
125028
- reason: inputFile + " does not exist"
125029
- };
125030
- }
125031
- if (!force) {
125032
- var inputTime = ts.getModifiedTime(host, inputFile);
125033
- if (inputTime > newestInputFileTime) {
125034
- newestInputFileName = inputFile;
125035
- newestInputFileTime = inputTime;
125036
- }
125037
- }
125038
- }
125302
+ var _a, _b, _c;
125039
125303
  // Container if no files are specified in the project
125040
125304
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
125041
125305
  return {
125042
125306
  type: ts.UpToDateStatusType.ContainerOnly
125043
125307
  };
125044
125308
  }
125045
- // Collect the expected outputs of this project
125046
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
125047
- // Now see if all outputs are newer than the newest input
125048
- var oldestOutputFileName = "(none)";
125049
- var oldestOutputFileTime = maximumDate;
125050
- var newestOutputFileName = "(none)";
125051
- var newestOutputFileTime = minimumDate;
125052
- var missingOutputFileName;
125053
- var newestDeclarationFileContentChangedTime = minimumDate;
125054
- var isOutOfDateWithInputs = false;
125055
- if (!force) {
125056
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
125057
- var output = outputs_1[_b];
125058
- // Output is missing; can stop checking
125059
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
125060
- if (!host.fileExists(output)) {
125061
- missingOutputFileName = output;
125062
- break;
125063
- }
125064
- var outputTime = ts.getModifiedTime(host, output);
125065
- if (outputTime < oldestOutputFileTime) {
125066
- oldestOutputFileTime = outputTime;
125067
- oldestOutputFileName = output;
125068
- }
125069
- // If an output is older than the newest input, we can stop checking
125070
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
125071
- if (outputTime < newestInputFileTime) {
125072
- isOutOfDateWithInputs = true;
125073
- break;
125074
- }
125075
- if (outputTime > newestOutputFileTime) {
125076
- newestOutputFileTime = outputTime;
125077
- newestOutputFileName = output;
125078
- }
125079
- // Keep track of when the most recent time a .d.ts file was changed.
125080
- // In addition to file timestamps, we also keep track of when a .d.ts file
125081
- // had its file touched but not had its contents changed - this allows us
125082
- // to skip a downstream typecheck
125083
- if (ts.isDeclarationFileName(output)) {
125084
- var outputModifiedTime = ts.getModifiedTime(host, output);
125085
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
125086
- }
125087
- }
125088
- }
125089
- var pseudoUpToDate = false;
125090
- var usesPrepend = false;
125091
- var upstreamChangedProject;
125309
+ // Fast check to see if reference projects are buildable
125310
+ var referenceStatuses;
125311
+ var force = !!state.options.force;
125092
125312
  if (project.projectReferences) {
125093
125313
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
125094
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
125095
- var ref = _d[_c];
125096
- usesPrepend = usesPrepend || !!(ref.prepend);
125314
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
125315
+ var ref = _d[_i];
125097
125316
  var resolvedRef = ts.resolveProjectReferencePath(ref);
125098
125317
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
125099
- var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
125318
+ var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
125319
+ var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
125100
125320
  // Its a circular reference ignore the status of this project
125101
125321
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
125102
125322
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) { // Container only ignore this project
@@ -125118,78 +125338,188 @@ var ts;
125118
125338
  upstreamProjectName: ref.path
125119
125339
  };
125120
125340
  }
125121
- // Check oldest output file name only if there is no missing output file name
125122
- // (a check we will have skipped if this is a forced build)
125123
- if (!force && !missingOutputFileName) {
125124
- // If the upstream project's newest file is older than our oldest output, we
125125
- // can't be out of date because of it
125126
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
125127
- continue;
125128
- }
125129
- // If the upstream project has only change .d.ts files, and we've built
125130
- // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
125131
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
125132
- pseudoUpToDate = true;
125133
- upstreamChangedProject = ref.path;
125134
- continue;
125135
- }
125136
- // We have an output older than an upstream output - we are out of date
125137
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125341
+ if (!force)
125342
+ (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
125343
+ }
125344
+ }
125345
+ if (force)
125346
+ return { type: ts.UpToDateStatusType.ForceBuild };
125347
+ // Check buildinfo first
125348
+ var host = state.host;
125349
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125350
+ var oldestOutputFileName = "(none)";
125351
+ var oldestOutputFileTime = maximumDate;
125352
+ var buildInfoTime;
125353
+ var buildInfoProgram;
125354
+ var buildInfoVersionMap;
125355
+ var newestDeclarationFileContentChangedTime;
125356
+ if (buildInfoPath) {
125357
+ var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
125358
+ buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
125359
+ if (buildInfoTime === ts.missingFileModifiedTime) {
125360
+ if (!buildInfoCacheEntry_1) {
125361
+ state.buildInfoCache.set(resolvedPath, {
125362
+ path: toPath(state, buildInfoPath),
125363
+ buildInfo: false,
125364
+ modifiedTime: buildInfoTime
125365
+ });
125366
+ }
125367
+ return {
125368
+ type: ts.UpToDateStatusType.OutputMissing,
125369
+ missingOutputFileName: buildInfoPath
125370
+ };
125371
+ }
125372
+ var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
125373
+ if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125374
+ return {
125375
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
125376
+ version: buildInfo.version
125377
+ };
125378
+ }
125379
+ if (buildInfo.program) {
125380
+ if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
125381
+ (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
125138
125382
  return {
125139
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125140
- outOfDateOutputFileName: oldestOutputFileName,
125141
- newerProjectName: ref.path
125383
+ type: ts.UpToDateStatusType.OutOfDateBuildInfo,
125384
+ buildInfoFile: buildInfoPath
125142
125385
  };
125143
125386
  }
125387
+ buildInfoProgram = buildInfo.program;
125144
125388
  }
125389
+ oldestOutputFileTime = buildInfoTime;
125390
+ oldestOutputFileName = buildInfoPath;
125391
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
125145
125392
  }
125146
- if (missingOutputFileName !== undefined) {
125147
- return {
125148
- type: ts.UpToDateStatusType.OutputMissing,
125149
- missingOutputFileName: missingOutputFileName
125150
- };
125393
+ // Check input files
125394
+ var newestInputFileName = undefined;
125395
+ var newestInputFileTime = minimumDate;
125396
+ var pseudoInputUptodate = false;
125397
+ // Get timestamps of input files
125398
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
125399
+ var inputFile = _f[_e];
125400
+ var inputTime = getModifiedTime(state, inputFile);
125401
+ if (inputTime === ts.missingFileModifiedTime) {
125402
+ return {
125403
+ type: ts.UpToDateStatusType.Unbuildable,
125404
+ reason: inputFile + " does not exist"
125405
+ };
125406
+ }
125407
+ // If an buildInfo is older than the newest input, we can stop checking
125408
+ if (buildInfoTime && buildInfoTime < inputTime) {
125409
+ var version_3 = void 0;
125410
+ var currentVersion = void 0;
125411
+ if (buildInfoProgram) {
125412
+ // Read files and see if they are same, read is anyways cached
125413
+ if (!buildInfoVersionMap)
125414
+ buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
125415
+ version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
125416
+ var text = version_3 ? state.readFileWithCache(inputFile) : undefined;
125417
+ currentVersion = text && (host.createHash || ts.generateDjb2Hash)(text);
125418
+ if (version_3 && version_3 === currentVersion)
125419
+ pseudoInputUptodate = true;
125420
+ }
125421
+ if (!version_3 || version_3 !== currentVersion) {
125422
+ return {
125423
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125424
+ outOfDateOutputFileName: buildInfoPath,
125425
+ newerInputFileName: inputFile
125426
+ };
125427
+ }
125428
+ }
125429
+ if (inputTime > newestInputFileTime) {
125430
+ newestInputFileName = inputFile;
125431
+ newestInputFileTime = inputTime;
125432
+ }
125151
125433
  }
125152
- if (isOutOfDateWithInputs) {
125153
- return {
125154
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
125155
- outOfDateOutputFileName: oldestOutputFileName,
125156
- newerInputFileName: newestInputFileName
125157
- };
125434
+ // Now see if all outputs are newer than the newest input
125435
+ // Dont check output timestamps if we have buildinfo telling us output is uptodate
125436
+ if (!buildInfoPath) {
125437
+ // Collect the expected outputs of this project
125438
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
125439
+ var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
125440
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
125441
+ var output = outputs_1[_g];
125442
+ var path = toPath(state, output);
125443
+ // Output is missing; can stop checking
125444
+ var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
125445
+ if (!outputTime) {
125446
+ outputTime = ts.getModifiedTime(state.host, output);
125447
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
125448
+ }
125449
+ if (outputTime === ts.missingFileModifiedTime) {
125450
+ return {
125451
+ type: ts.UpToDateStatusType.OutputMissing,
125452
+ missingOutputFileName: output
125453
+ };
125454
+ }
125455
+ if (outputTime < oldestOutputFileTime) {
125456
+ oldestOutputFileTime = outputTime;
125457
+ oldestOutputFileName = output;
125458
+ }
125459
+ // If an output is older than the newest input, we can stop checking
125460
+ if (outputTime < newestInputFileTime) {
125461
+ return {
125462
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125463
+ outOfDateOutputFileName: oldestOutputFileName,
125464
+ newerInputFileName: newestInputFileName
125465
+ };
125466
+ }
125467
+ }
125158
125468
  }
125159
- else {
125160
- // Check tsconfig time
125161
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125162
- if (configStatus)
125163
- return configStatus;
125164
- // Check extended config time
125165
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125166
- if (extendedConfigStatus)
125167
- return extendedConfigStatus;
125168
- // Check package file time
125169
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125170
- var path = _a[0];
125171
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125172
- });
125173
- if (dependentPackageFileStatus)
125174
- return dependentPackageFileStatus;
125175
- }
125176
- if (!force && !state.buildInfoChecked.has(resolvedPath)) {
125177
- state.buildInfoChecked.set(resolvedPath, true);
125178
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125179
- if (buildInfoPath) {
125180
- ts.solutionPerformance.mark("beforeBuildInfoRead");
125181
- var value = state.readFileWithCache(buildInfoPath);
125182
- ts.solutionPerformance.mark("afterBuildInfoRead");
125183
- ts.solutionPerformance.measure("BuildInfoRead", "beforeBuildInfoRead", "afterBuildInfoRead");
125184
- var buildInfo = value && ts.getBuildInfo(value);
125185
- if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125469
+ var seenRefs = buildInfoPath ? new ts.Set() : undefined;
125470
+ var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
125471
+ seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
125472
+ var pseudoUpToDate = false;
125473
+ var usesPrepend = false;
125474
+ var upstreamChangedProject;
125475
+ if (referenceStatuses) {
125476
+ for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
125477
+ var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
125478
+ usesPrepend = usesPrepend || !!(ref.prepend);
125479
+ // If the upstream project's newest file is older than our oldest output, we
125480
+ // can't be out of date because of it
125481
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
125482
+ continue;
125483
+ }
125484
+ // Check if tsbuildinfo path is shared, then we need to rebuild
125485
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
125186
125486
  return {
125187
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
125188
- version: buildInfo.version
125487
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125488
+ outOfDateOutputFileName: buildInfoPath,
125489
+ newerProjectName: ref.path
125189
125490
  };
125190
125491
  }
125492
+ // If the upstream project has only change .d.ts files, and we've built
125493
+ // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
125494
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
125495
+ pseudoUpToDate = true;
125496
+ upstreamChangedProject = ref.path;
125497
+ continue;
125498
+ }
125499
+ // We have an output older than an upstream output - we are out of date
125500
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125501
+ return {
125502
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125503
+ outOfDateOutputFileName: oldestOutputFileName,
125504
+ newerProjectName: ref.path
125505
+ };
125191
125506
  }
125192
125507
  }
125508
+ // Check tsconfig time
125509
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125510
+ if (configStatus)
125511
+ return configStatus;
125512
+ // Check extended config time
125513
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125514
+ if (extendedConfigStatus)
125515
+ return extendedConfigStatus;
125516
+ // Check package file time
125517
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125518
+ var path = _a[0];
125519
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125520
+ });
125521
+ if (dependentPackageFileStatus)
125522
+ return dependentPackageFileStatus;
125193
125523
  if (usesPrepend && pseudoUpToDate) {
125194
125524
  return {
125195
125525
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -125199,15 +125529,37 @@ var ts;
125199
125529
  }
125200
125530
  // Up to date
125201
125531
  return {
125202
- type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
125532
+ type: pseudoUpToDate ?
125533
+ ts.UpToDateStatusType.UpToDateWithUpstreamTypes :
125534
+ pseudoInputUptodate ?
125535
+ ts.UpToDateStatusType.UpToDateWithInputFileText :
125536
+ ts.UpToDateStatusType.UpToDate,
125203
125537
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
125204
125538
  newestInputFileTime: newestInputFileTime,
125205
- newestOutputFileTime: newestOutputFileTime,
125206
125539
  newestInputFileName: newestInputFileName,
125207
- newestOutputFileName: newestOutputFileName,
125208
125540
  oldestOutputFileName: oldestOutputFileName
125209
125541
  };
125210
125542
  }
125543
+ function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
125544
+ if (seenRefs.has(resolvedRefPath))
125545
+ return false;
125546
+ seenRefs.add(resolvedRefPath);
125547
+ var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
125548
+ if (refBuildInfo.path === buildInfoCacheEntry.path)
125549
+ return true;
125550
+ if (resolvedConfig.projectReferences) {
125551
+ // Check references
125552
+ for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
125553
+ var ref = _a[_i];
125554
+ var resolvedRef = ts.resolveProjectReferencePath(ref);
125555
+ var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
125556
+ var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
125557
+ if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
125558
+ return true;
125559
+ }
125560
+ }
125561
+ return false;
125562
+ }
125211
125563
  function getUpToDateStatus(state, project, resolvedPath) {
125212
125564
  if (project === undefined) {
125213
125565
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -125223,42 +125575,69 @@ var ts;
125223
125575
  state.projectStatus.set(resolvedPath, actual);
125224
125576
  return actual;
125225
125577
  }
125226
- function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
125578
+ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
125227
125579
  if (proj.options.noEmit)
125228
- return priorNewestUpdateTime;
125580
+ return;
125581
+ var now;
125229
125582
  ts.solutionPerformance.mark("beforeUpdateOutputTimestamps");
125230
- var host = state.host;
125231
- var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125232
- if (!skipOutputs || outputs.length !== skipOutputs.size) {
125233
- var reportVerbose = !!state.options.verbose;
125234
- var now = host.now ? host.now() : new Date();
125235
- for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125236
- var file = outputs_2[_i];
125237
- if (skipOutputs && skipOutputs.has(toPath(state, file))) {
125238
- continue;
125239
- }
125240
- if (reportVerbose) {
125241
- reportVerbose = false;
125583
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
125584
+ if (buildInfoPath) {
125585
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
125586
+ if (!!state.options.verbose)
125242
125587
  reportStatus(state, verboseMessage, proj.options.configFilePath);
125588
+ state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
125589
+ getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
125590
+ }
125591
+ state.outputTimeStamps.delete(projectPath);
125592
+ }
125593
+ else {
125594
+ var host = state.host;
125595
+ var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125596
+ var outputTimeStampMap_1 = getOutputTimeStampMap(state, projectPath);
125597
+ var modifiedOutputs_1 = outputTimeStampMap_1 ? new ts.Set() : undefined;
125598
+ if (!skipOutputs || outputs.length !== skipOutputs.size) {
125599
+ var reportVerbose = !!state.options.verbose;
125600
+ for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125601
+ var file = outputs_2[_i];
125602
+ var path = toPath(state, file);
125603
+ if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
125604
+ continue;
125605
+ if (reportVerbose) {
125606
+ reportVerbose = false;
125607
+ reportStatus(state, verboseMessage, proj.options.configFilePath);
125608
+ }
125609
+ host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
125610
+ if (outputTimeStampMap_1) {
125611
+ outputTimeStampMap_1.set(path, now);
125612
+ modifiedOutputs_1.add(path);
125613
+ }
125243
125614
  }
125244
- if (ts.isDeclarationFileName(file)) {
125245
- priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
125246
- }
125247
- host.setModifiedTime(file, now);
125248
125615
  }
125616
+ // Clear out timestamps not in output list any more
125617
+ outputTimeStampMap_1 === null || outputTimeStampMap_1 === void 0 ? void 0 : outputTimeStampMap_1.forEach(function (_value, key) {
125618
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs_1.has(key))
125619
+ outputTimeStampMap_1.delete(key);
125620
+ });
125249
125621
  }
125250
125622
  ts.solutionPerformance.mark("afterUpdateOutputTimestamps");
125251
125623
  ts.solutionPerformance.measure("UpdateOutputTimestamps", "beforeUpdateOutputTimestamps", "afterUpdateOutputTimestamps");
125252
- return priorNewestUpdateTime;
125624
+ }
125625
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
125626
+ var _a;
125627
+ if (!options.composite)
125628
+ return undefined;
125629
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125630
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, /*modifiedTime*/ undefined);
125631
+ 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;
125253
125632
  }
125254
125633
  function updateOutputTimestamps(state, proj, resolvedPath) {
125255
125634
  if (state.options.dry) {
125256
125635
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
125257
125636
  }
125258
- var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125637
+ updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125259
125638
  state.projectStatus.set(resolvedPath, {
125260
125639
  type: ts.UpToDateStatusType.UpToDate,
125261
- newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
125640
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
125262
125641
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
125263
125642
  });
125264
125643
  }
@@ -125304,6 +125683,7 @@ var ts;
125304
125683
  break;
125305
125684
  }
125306
125685
  // falls through
125686
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
125307
125687
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125308
125688
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
125309
125689
  if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
@@ -125488,12 +125868,10 @@ var ts;
125488
125868
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
125489
125869
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
125490
125870
  return;
125491
- state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
125492
- invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
125493
- }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
125871
+ 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));
125494
125872
  }
125495
125873
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
125496
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
125874
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
125497
125875
  var _a;
125498
125876
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
125499
125877
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -125525,7 +125903,7 @@ var ts;
125525
125903
  if (!state.watch)
125526
125904
  return;
125527
125905
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
125528
- 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); },
125906
+ 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); },
125529
125907
  onDeleteValue: ts.closeFileWatcher,
125530
125908
  });
125531
125909
  }
@@ -125533,7 +125911,7 @@ var ts;
125533
125911
  if (!state.watch || !state.lastCachedPackageJsonLookups)
125534
125912
  return;
125535
125913
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
125536
- createNewValue: function (path, _input) { return state.watchFile(path, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.None); }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.PackageJson, resolved); },
125914
+ createNewValue: function (path, _input) { return watchFile(state, path, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.None); }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.PackageJson, resolved); },
125537
125915
  onDeleteValue: ts.closeFileWatcher,
125538
125916
  });
125539
125917
  }
@@ -125666,19 +126044,18 @@ var ts;
125666
126044
  }
125667
126045
  }
125668
126046
  function reportUpToDateStatus(state, configFileName, status) {
125669
- if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
125670
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125671
- }
125672
126047
  switch (status.type) {
125673
126048
  case ts.UpToDateStatusType.OutOfDateWithSelf:
125674
- 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));
126049
+ 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));
125675
126050
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
125676
- 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));
126051
+ 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));
125677
126052
  case ts.UpToDateStatusType.OutputMissing:
125678
126053
  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));
126054
+ case ts.UpToDateStatusType.OutOfDateBuildInfo:
126055
+ 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));
125679
126056
  case ts.UpToDateStatusType.UpToDate:
125680
126057
  if (status.newestInputFileTime !== undefined) {
125681
- 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 || ""));
126058
+ 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 || ""));
125682
126059
  }
125683
126060
  // Don't report anything for "up to date because it was already built" -- too verbose
125684
126061
  break;
@@ -125686,6 +126063,8 @@ var ts;
125686
126063
  return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed, relName(state, configFileName), relName(state, status.newerProjectName));
125687
126064
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125688
126065
  return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
126066
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
126067
+ return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_but_needs_update_to_timestamps_of_output_files_that_are_older_than_input_files, relName(state, configFileName));
125689
126068
  case ts.UpToDateStatusType.UpstreamOutOfDate:
125690
126069
  return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date, relName(state, configFileName), relName(state, status.upstreamProjectName));
125691
126070
  case ts.UpToDateStatusType.UpstreamBlocked:
@@ -125696,6 +126075,8 @@ var ts;
125696
126075
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
125697
126076
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
125698
126077
  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);
126078
+ case ts.UpToDateStatusType.ForceBuild:
126079
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125699
126080
  case ts.UpToDateStatusType.ContainerOnly:
125700
126081
  // Don't report status on "solution" projects
125701
126082
  // falls through