@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.
@@ -6189,7 +6189,7 @@ var ts;
6189
6189
  };
6190
6190
  }
6191
6191
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
6192
- var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName) {
6192
+ var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName, modifiedTime) {
6193
6193
  // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
6194
6194
  if (!ts.isString(relativeFileName))
6195
6195
  return;
@@ -6199,7 +6199,7 @@ var ts;
6199
6199
  if (callbacks) {
6200
6200
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
6201
6201
  var fileCallback = callbacks_1[_i];
6202
- fileCallback(fileName, FileWatcherEventKind.Changed);
6202
+ fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6203
6203
  }
6204
6204
  }
6205
6205
  },
@@ -6253,7 +6253,7 @@ var ts;
6253
6253
  }
6254
6254
  else {
6255
6255
  cache.set(path, {
6256
- watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
6256
+ watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6257
6257
  refCount: 1
6258
6258
  });
6259
6259
  }
@@ -6281,7 +6281,7 @@ var ts;
6281
6281
  var newTime = modifiedTime.getTime();
6282
6282
  if (oldTime !== newTime) {
6283
6283
  watchedFile.mtime = modifiedTime;
6284
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
6284
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
6285
6285
  return true;
6286
6286
  }
6287
6287
  return false;
@@ -6532,17 +6532,18 @@ var ts;
6532
6532
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6533
6533
  /*@internal*/
6534
6534
  function createFileWatcherCallback(callback) {
6535
- return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
6535
+ return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6536
6536
  }
6537
6537
  ts.createFileWatcherCallback = createFileWatcherCallback;
6538
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists) {
6539
- return function (eventName) {
6538
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6539
+ return function (eventName, _relativeFileName, modifiedTime) {
6540
6540
  if (eventName === "rename") {
6541
- callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6541
+ modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
6542
+ callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
6542
6543
  }
6543
6544
  else {
6544
6545
  // Change
6545
- callback(fileName, FileWatcherEventKind.Changed);
6546
+ callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6546
6547
  }
6547
6548
  };
6548
6549
  }
@@ -6566,7 +6567,7 @@ var ts;
6566
6567
  }
6567
6568
  /*@internal*/
6568
6569
  function createSystemWatchFunctions(_a) {
6569
- 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;
6570
+ 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;
6570
6571
  var dynamicPollingWatchFile;
6571
6572
  var fixedChunkSizePollingWatchFile;
6572
6573
  var nonPollingWatchFile;
@@ -6588,7 +6589,7 @@ var ts;
6588
6589
  case ts.WatchFileKind.FixedChunkSizePolling:
6589
6590
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, /* pollingInterval */ undefined, /*options*/ undefined);
6590
6591
  case ts.WatchFileKind.UseFsEvents:
6591
- return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists),
6592
+ return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime),
6592
6593
  /*recursive*/ false, pollingInterval, ts.getFallbackOptions(options));
6593
6594
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
6594
6595
  if (!nonPollingWatchFile) {
@@ -6770,7 +6771,6 @@ var ts;
6770
6771
  fsWatch: fsWatch,
6771
6772
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6772
6773
  getCurrentDirectory: getCurrentDirectory,
6773
- fileExists: fileExists,
6774
6774
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
6775
6775
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
6776
6776
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
@@ -7030,7 +7030,7 @@ var ts;
7030
7030
  // File changed
7031
7031
  eventKind = FileWatcherEventKind.Changed;
7032
7032
  }
7033
- callback(fileName, eventKind);
7033
+ callback(fileName, eventKind, curr.mtime);
7034
7034
  }
7035
7035
  }
7036
7036
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
@@ -7056,10 +7056,10 @@ var ts;
7056
7056
  * Invoke the callback with rename and update the watcher if not closed
7057
7057
  * @param createWatcher
7058
7058
  */
7059
- function invokeCallbackAndUpdateWatcher(createWatcher) {
7059
+ function invokeCallbackAndUpdateWatcher(createWatcher, modifiedTime) {
7060
7060
  sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
7061
7061
  // Call the callback for current directory
7062
- callback("rename", "");
7062
+ callback("rename", "", modifiedTime);
7063
7063
  // If watcher is not closed, update it
7064
7064
  if (watcher) {
7065
7065
  watcher.close();
@@ -7105,13 +7105,14 @@ var ts;
7105
7105
  function callbackChangingToMissingFileSystemEntry(event, relativeName) {
7106
7106
  // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
7107
7107
  // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
7108
+ var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
7108
7109
  return event === "rename" &&
7109
7110
  (!relativeName ||
7110
7111
  relativeName === lastDirectoryPart ||
7111
7112
  (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
7112
- !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7113
- invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
7114
- callback(event, relativeName);
7113
+ modifiedTime === ts.missingFileModifiedTime ?
7114
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry, modifiedTime) :
7115
+ callback(event, relativeName, modifiedTime);
7115
7116
  }
7116
7117
  /**
7117
7118
  * Watch the file or directory using fs.watchFile since fs.watch threw exception
@@ -7125,12 +7126,15 @@ var ts;
7125
7126
  * and switch to existing file or directory when the missing filesystem entry is created
7126
7127
  */
7127
7128
  function watchMissingFileSystemEntry() {
7128
- return watchFile(fileOrDirectory, function (_fileName, eventKind) {
7129
- if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
7130
- // Call the callback for current file or directory
7131
- // For now it could be callback for the inner directory creation,
7132
- // but just return current directory, better than current no-op
7133
- invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
7129
+ return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
7130
+ if (eventKind === FileWatcherEventKind.Created) {
7131
+ modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
7132
+ if (modifiedTime !== ts.missingFileModifiedTime) {
7133
+ // Call the callback for current file or directory
7134
+ // For now it could be callback for the inner directory creation,
7135
+ // but just return current directory, better than current no-op
7136
+ invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry, modifiedTime);
7137
+ }
7134
7138
  }
7135
7139
  }, fallbackPollingInterval, fallbackOptions);
7136
7140
  }
@@ -7280,12 +7284,19 @@ var ts;
7280
7284
  }
7281
7285
  function getModifiedTime(path) {
7282
7286
  var _a;
7287
+ // Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
7288
+ // the CPU time performance.
7289
+ var originalStackTraceLimit = Error.stackTraceLimit;
7290
+ Error.stackTraceLimit = 0;
7283
7291
  try {
7284
7292
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
7285
7293
  }
7286
7294
  catch (e) {
7287
7295
  return undefined;
7288
7296
  }
7297
+ finally {
7298
+ Error.stackTraceLimit = originalStackTraceLimit;
7299
+ }
7289
7300
  }
7290
7301
  function setModifiedTime(path, time) {
7291
7302
  try {
@@ -9308,8 +9319,8 @@ var ts;
9308
9319
  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"),
9309
9320
  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"),
9310
9321
  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."),
9311
- 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}'"),
9312
- 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}'"),
9322
+ 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}'"),
9323
+ 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}'"),
9313
9324
  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"),
9314
9325
  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"),
9315
9326
  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"),
@@ -9353,6 +9364,8 @@ var ts;
9353
9364
  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}'."),
9354
9365
  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}'."),
9355
9366
  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."),
9367
+ 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"),
9368
+ 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"),
9356
9369
  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}'"),
9357
9370
  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."),
9358
9371
  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."),
@@ -20182,6 +20195,10 @@ var ts;
20182
20195
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
20183
20196
  }
20184
20197
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
20198
+ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
20199
+ return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
20200
+ }
20201
+ ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
20185
20202
  function getCompilerOptionValue(options, option) {
20186
20203
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
20187
20204
  }
@@ -39222,6 +39239,7 @@ var ts;
39222
39239
  type: "boolean",
39223
39240
  affectsSemanticDiagnostics: true,
39224
39241
  affectsEmit: true,
39242
+ affectsMultiFileEmitBuildInfo: true,
39225
39243
  category: ts.Diagnostics.Watch_and_Build_Modes,
39226
39244
  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,
39227
39245
  defaultValueDescription: false,
@@ -39256,12 +39274,40 @@ var ts;
39256
39274
  affectsSourceFile: true,
39257
39275
  affectsModuleResolution: true,
39258
39276
  affectsEmit: true,
39277
+ affectsMultiFileEmitBuildInfo: true,
39259
39278
  paramType: ts.Diagnostics.VERSION,
39260
39279
  showInSimplifiedHelpView: true,
39261
39280
  category: ts.Diagnostics.Language_and_Environment,
39262
39281
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
39263
39282
  defaultValueDescription: 0 /* ES3 */,
39264
39283
  };
39284
+ /*@internal*/
39285
+ ts.moduleOptionDeclaration = {
39286
+ name: "module",
39287
+ shortName: "m",
39288
+ type: new ts.Map(ts.getEntries({
39289
+ none: ts.ModuleKind.None,
39290
+ commonjs: ts.ModuleKind.CommonJS,
39291
+ amd: ts.ModuleKind.AMD,
39292
+ system: ts.ModuleKind.System,
39293
+ umd: ts.ModuleKind.UMD,
39294
+ es6: ts.ModuleKind.ES2015,
39295
+ es2015: ts.ModuleKind.ES2015,
39296
+ es2020: ts.ModuleKind.ES2020,
39297
+ es2022: ts.ModuleKind.ES2022,
39298
+ esnext: ts.ModuleKind.ESNext,
39299
+ node16: ts.ModuleKind.Node16,
39300
+ nodenext: ts.ModuleKind.NodeNext,
39301
+ })),
39302
+ affectsModuleResolution: true,
39303
+ affectsEmit: true,
39304
+ affectsMultiFileEmitBuildInfo: true,
39305
+ paramType: ts.Diagnostics.KIND,
39306
+ showInSimplifiedHelpView: true,
39307
+ category: ts.Diagnostics.Modules,
39308
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
39309
+ defaultValueDescription: undefined,
39310
+ };
39265
39311
  var commandOptionsWithoutBuild = [
39266
39312
  // CommandLine only options
39267
39313
  {
@@ -39323,37 +39369,14 @@ var ts;
39323
39369
  category: ts.Diagnostics.Command_line_Options,
39324
39370
  affectsSemanticDiagnostics: true,
39325
39371
  affectsEmit: true,
39372
+ affectsMultiFileEmitBuildInfo: true,
39326
39373
  isCommandLineOnly: true,
39327
39374
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
39328
39375
  defaultValueDescription: false,
39329
39376
  },
39330
39377
  // Basic
39331
39378
  ts.targetOptionDeclaration,
39332
- {
39333
- name: "module",
39334
- shortName: "m",
39335
- type: new ts.Map(ts.getEntries({
39336
- none: ts.ModuleKind.None,
39337
- commonjs: ts.ModuleKind.CommonJS,
39338
- amd: ts.ModuleKind.AMD,
39339
- system: ts.ModuleKind.System,
39340
- umd: ts.ModuleKind.UMD,
39341
- es6: ts.ModuleKind.ES2015,
39342
- es2015: ts.ModuleKind.ES2015,
39343
- es2020: ts.ModuleKind.ES2020,
39344
- es2022: ts.ModuleKind.ES2022,
39345
- esnext: ts.ModuleKind.ESNext,
39346
- node16: ts.ModuleKind.Node16,
39347
- nodenext: ts.ModuleKind.NodeNext,
39348
- })),
39349
- affectsModuleResolution: true,
39350
- affectsEmit: true,
39351
- paramType: ts.Diagnostics.KIND,
39352
- showInSimplifiedHelpView: true,
39353
- category: ts.Diagnostics.Modules,
39354
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
39355
- defaultValueDescription: undefined,
39356
- },
39379
+ ts.moduleOptionDeclaration,
39357
39380
  {
39358
39381
  name: "lib",
39359
39382
  type: "list",
@@ -39390,6 +39413,7 @@ var ts;
39390
39413
  type: jsxOptionMap,
39391
39414
  affectsSourceFile: true,
39392
39415
  affectsEmit: true,
39416
+ affectsMultiFileEmitBuildInfo: true,
39393
39417
  affectsModuleResolution: true,
39394
39418
  paramType: ts.Diagnostics.KIND,
39395
39419
  showInSimplifiedHelpView: true,
@@ -39402,6 +39426,7 @@ var ts;
39402
39426
  shortName: "d",
39403
39427
  type: "boolean",
39404
39428
  affectsEmit: true,
39429
+ affectsMultiFileEmitBuildInfo: true,
39405
39430
  showInSimplifiedHelpView: true,
39406
39431
  category: ts.Diagnostics.Emit,
39407
39432
  transpileOptionValue: undefined,
@@ -39412,6 +39437,7 @@ var ts;
39412
39437
  name: "declarationMap",
39413
39438
  type: "boolean",
39414
39439
  affectsEmit: true,
39440
+ affectsMultiFileEmitBuildInfo: true,
39415
39441
  showInSimplifiedHelpView: true,
39416
39442
  category: ts.Diagnostics.Emit,
39417
39443
  transpileOptionValue: undefined,
@@ -39422,6 +39448,7 @@ var ts;
39422
39448
  name: "emitDeclarationOnly",
39423
39449
  type: "boolean",
39424
39450
  affectsEmit: true,
39451
+ affectsMultiFileEmitBuildInfo: true,
39425
39452
  showInSimplifiedHelpView: true,
39426
39453
  category: ts.Diagnostics.Emit,
39427
39454
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -39432,6 +39459,7 @@ var ts;
39432
39459
  name: "sourceMap",
39433
39460
  type: "boolean",
39434
39461
  affectsEmit: true,
39462
+ affectsMultiFileEmitBuildInfo: true,
39435
39463
  showInSimplifiedHelpView: true,
39436
39464
  category: ts.Diagnostics.Emit,
39437
39465
  defaultValueDescription: false,
@@ -39441,6 +39469,9 @@ var ts;
39441
39469
  name: "outFile",
39442
39470
  type: "string",
39443
39471
  affectsEmit: true,
39472
+ affectsMultiFileEmitBuildInfo: true,
39473
+ affectsDeclarationPath: true,
39474
+ affectsBundleEmitBuildInfo: true,
39444
39475
  isFilePath: true,
39445
39476
  paramType: ts.Diagnostics.FILE,
39446
39477
  showInSimplifiedHelpView: true,
@@ -39452,6 +39483,8 @@ var ts;
39452
39483
  name: "outDir",
39453
39484
  type: "string",
39454
39485
  affectsEmit: true,
39486
+ affectsMultiFileEmitBuildInfo: true,
39487
+ affectsDeclarationPath: true,
39455
39488
  isFilePath: true,
39456
39489
  paramType: ts.Diagnostics.DIRECTORY,
39457
39490
  showInSimplifiedHelpView: true,
@@ -39462,6 +39495,8 @@ var ts;
39462
39495
  name: "rootDir",
39463
39496
  type: "string",
39464
39497
  affectsEmit: true,
39498
+ affectsMultiFileEmitBuildInfo: true,
39499
+ affectsDeclarationPath: true,
39465
39500
  isFilePath: true,
39466
39501
  paramType: ts.Diagnostics.LOCATION,
39467
39502
  category: ts.Diagnostics.Modules,
@@ -39472,6 +39507,8 @@ var ts;
39472
39507
  name: "composite",
39473
39508
  type: "boolean",
39474
39509
  affectsEmit: true,
39510
+ affectsMultiFileEmitBuildInfo: true,
39511
+ affectsBundleEmitBuildInfo: true,
39475
39512
  isTSConfigOnly: true,
39476
39513
  category: ts.Diagnostics.Projects,
39477
39514
  transpileOptionValue: undefined,
@@ -39482,6 +39519,8 @@ var ts;
39482
39519
  name: "tsBuildInfoFile",
39483
39520
  type: "string",
39484
39521
  affectsEmit: true,
39522
+ affectsMultiFileEmitBuildInfo: true,
39523
+ affectsBundleEmitBuildInfo: true,
39485
39524
  isFilePath: true,
39486
39525
  paramType: ts.Diagnostics.FILE,
39487
39526
  category: ts.Diagnostics.Projects,
@@ -39493,6 +39532,7 @@ var ts;
39493
39532
  name: "removeComments",
39494
39533
  type: "boolean",
39495
39534
  affectsEmit: true,
39535
+ affectsMultiFileEmitBuildInfo: true,
39496
39536
  showInSimplifiedHelpView: true,
39497
39537
  category: ts.Diagnostics.Emit,
39498
39538
  defaultValueDescription: false,
@@ -39511,6 +39551,7 @@ var ts;
39511
39551
  name: "importHelpers",
39512
39552
  type: "boolean",
39513
39553
  affectsEmit: true,
39554
+ affectsMultiFileEmitBuildInfo: true,
39514
39555
  category: ts.Diagnostics.Emit,
39515
39556
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
39516
39557
  defaultValueDescription: false,
@@ -39524,6 +39565,7 @@ var ts;
39524
39565
  })),
39525
39566
  affectsEmit: true,
39526
39567
  affectsSemanticDiagnostics: true,
39568
+ affectsMultiFileEmitBuildInfo: true,
39527
39569
  category: ts.Diagnostics.Emit,
39528
39570
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
39529
39571
  defaultValueDescription: 0 /* Remove */,
@@ -39532,6 +39574,7 @@ var ts;
39532
39574
  name: "downlevelIteration",
39533
39575
  type: "boolean",
39534
39576
  affectsEmit: true,
39577
+ affectsMultiFileEmitBuildInfo: true,
39535
39578
  category: ts.Diagnostics.Emit,
39536
39579
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
39537
39580
  defaultValueDescription: false,
@@ -39550,6 +39593,9 @@ var ts;
39550
39593
  type: "boolean",
39551
39594
  // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
39552
39595
  // The value of each strictFlag depends on own strictFlag value or this and never accessed directly.
39596
+ // But we need to store `strict` in builf info, even though it won't be examined directly, so that the
39597
+ // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly
39598
+ affectsMultiFileEmitBuildInfo: true,
39553
39599
  showInSimplifiedHelpView: true,
39554
39600
  category: ts.Diagnostics.Type_Checking,
39555
39601
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -39559,6 +39605,7 @@ var ts;
39559
39605
  name: "noImplicitAny",
39560
39606
  type: "boolean",
39561
39607
  affectsSemanticDiagnostics: true,
39608
+ affectsMultiFileEmitBuildInfo: true,
39562
39609
  strictFlag: true,
39563
39610
  category: ts.Diagnostics.Type_Checking,
39564
39611
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -39568,6 +39615,7 @@ var ts;
39568
39615
  name: "strictNullChecks",
39569
39616
  type: "boolean",
39570
39617
  affectsSemanticDiagnostics: true,
39618
+ affectsMultiFileEmitBuildInfo: true,
39571
39619
  strictFlag: true,
39572
39620
  category: ts.Diagnostics.Type_Checking,
39573
39621
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -39576,6 +39624,8 @@ var ts;
39576
39624
  {
39577
39625
  name: "strictFunctionTypes",
39578
39626
  type: "boolean",
39627
+ affectsSemanticDiagnostics: true,
39628
+ affectsMultiFileEmitBuildInfo: true,
39579
39629
  strictFlag: true,
39580
39630
  category: ts.Diagnostics.Type_Checking,
39581
39631
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -39584,6 +39634,8 @@ var ts;
39584
39634
  {
39585
39635
  name: "strictBindCallApply",
39586
39636
  type: "boolean",
39637
+ affectsSemanticDiagnostics: true,
39638
+ affectsMultiFileEmitBuildInfo: true,
39587
39639
  strictFlag: true,
39588
39640
  category: ts.Diagnostics.Type_Checking,
39589
39641
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -39593,6 +39645,7 @@ var ts;
39593
39645
  name: "strictPropertyInitialization",
39594
39646
  type: "boolean",
39595
39647
  affectsSemanticDiagnostics: true,
39648
+ affectsMultiFileEmitBuildInfo: true,
39596
39649
  strictFlag: true,
39597
39650
  category: ts.Diagnostics.Type_Checking,
39598
39651
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -39602,6 +39655,7 @@ var ts;
39602
39655
  name: "noImplicitThis",
39603
39656
  type: "boolean",
39604
39657
  affectsSemanticDiagnostics: true,
39658
+ affectsMultiFileEmitBuildInfo: true,
39605
39659
  strictFlag: true,
39606
39660
  category: ts.Diagnostics.Type_Checking,
39607
39661
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -39611,6 +39665,7 @@ var ts;
39611
39665
  name: "useUnknownInCatchVariables",
39612
39666
  type: "boolean",
39613
39667
  affectsSemanticDiagnostics: true,
39668
+ affectsMultiFileEmitBuildInfo: true,
39614
39669
  strictFlag: true,
39615
39670
  category: ts.Diagnostics.Type_Checking,
39616
39671
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -39620,6 +39675,8 @@ var ts;
39620
39675
  name: "alwaysStrict",
39621
39676
  type: "boolean",
39622
39677
  affectsSourceFile: true,
39678
+ affectsEmit: true,
39679
+ affectsMultiFileEmitBuildInfo: true,
39623
39680
  strictFlag: true,
39624
39681
  category: ts.Diagnostics.Type_Checking,
39625
39682
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -39630,6 +39687,7 @@ var ts;
39630
39687
  name: "noUnusedLocals",
39631
39688
  type: "boolean",
39632
39689
  affectsSemanticDiagnostics: true,
39690
+ affectsMultiFileEmitBuildInfo: true,
39633
39691
  category: ts.Diagnostics.Type_Checking,
39634
39692
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
39635
39693
  defaultValueDescription: false,
@@ -39638,6 +39696,7 @@ var ts;
39638
39696
  name: "noUnusedParameters",
39639
39697
  type: "boolean",
39640
39698
  affectsSemanticDiagnostics: true,
39699
+ affectsMultiFileEmitBuildInfo: true,
39641
39700
  category: ts.Diagnostics.Type_Checking,
39642
39701
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
39643
39702
  defaultValueDescription: false,
@@ -39646,6 +39705,7 @@ var ts;
39646
39705
  name: "exactOptionalPropertyTypes",
39647
39706
  type: "boolean",
39648
39707
  affectsSemanticDiagnostics: true,
39708
+ affectsMultiFileEmitBuildInfo: true,
39649
39709
  category: ts.Diagnostics.Type_Checking,
39650
39710
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
39651
39711
  defaultValueDescription: false,
@@ -39654,6 +39714,7 @@ var ts;
39654
39714
  name: "noImplicitReturns",
39655
39715
  type: "boolean",
39656
39716
  affectsSemanticDiagnostics: true,
39717
+ affectsMultiFileEmitBuildInfo: true,
39657
39718
  category: ts.Diagnostics.Type_Checking,
39658
39719
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
39659
39720
  defaultValueDescription: false,
@@ -39663,6 +39724,7 @@ var ts;
39663
39724
  type: "boolean",
39664
39725
  affectsBindDiagnostics: true,
39665
39726
  affectsSemanticDiagnostics: true,
39727
+ affectsMultiFileEmitBuildInfo: true,
39666
39728
  category: ts.Diagnostics.Type_Checking,
39667
39729
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
39668
39730
  defaultValueDescription: false,
@@ -39671,6 +39733,7 @@ var ts;
39671
39733
  name: "noUncheckedIndexedAccess",
39672
39734
  type: "boolean",
39673
39735
  affectsSemanticDiagnostics: true,
39736
+ affectsMultiFileEmitBuildInfo: true,
39674
39737
  category: ts.Diagnostics.Type_Checking,
39675
39738
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
39676
39739
  defaultValueDescription: false,
@@ -39679,6 +39742,7 @@ var ts;
39679
39742
  name: "noImplicitOverride",
39680
39743
  type: "boolean",
39681
39744
  affectsSemanticDiagnostics: true,
39745
+ affectsMultiFileEmitBuildInfo: true,
39682
39746
  category: ts.Diagnostics.Type_Checking,
39683
39747
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
39684
39748
  defaultValueDescription: false,
@@ -39686,6 +39750,8 @@ var ts;
39686
39750
  {
39687
39751
  name: "noPropertyAccessFromIndexSignature",
39688
39752
  type: "boolean",
39753
+ affectsSemanticDiagnostics: true,
39754
+ affectsMultiFileEmitBuildInfo: true,
39689
39755
  showInSimplifiedHelpView: false,
39690
39756
  category: ts.Diagnostics.Type_Checking,
39691
39757
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -39771,6 +39837,7 @@ var ts;
39771
39837
  name: "allowSyntheticDefaultImports",
39772
39838
  type: "boolean",
39773
39839
  affectsSemanticDiagnostics: true,
39840
+ affectsMultiFileEmitBuildInfo: true,
39774
39841
  category: ts.Diagnostics.Interop_Constraints,
39775
39842
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
39776
39843
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -39780,6 +39847,7 @@ var ts;
39780
39847
  type: "boolean",
39781
39848
  affectsSemanticDiagnostics: true,
39782
39849
  affectsEmit: true,
39850
+ affectsMultiFileEmitBuildInfo: true,
39783
39851
  showInSimplifiedHelpView: true,
39784
39852
  category: ts.Diagnostics.Interop_Constraints,
39785
39853
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -39796,6 +39864,7 @@ var ts;
39796
39864
  name: "allowUmdGlobalAccess",
39797
39865
  type: "boolean",
39798
39866
  affectsSemanticDiagnostics: true,
39867
+ affectsMultiFileEmitBuildInfo: true,
39799
39868
  category: ts.Diagnostics.Modules,
39800
39869
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
39801
39870
  defaultValueDescription: false,
@@ -39817,6 +39886,7 @@ var ts;
39817
39886
  name: "sourceRoot",
39818
39887
  type: "string",
39819
39888
  affectsEmit: true,
39889
+ affectsMultiFileEmitBuildInfo: true,
39820
39890
  paramType: ts.Diagnostics.LOCATION,
39821
39891
  category: ts.Diagnostics.Emit,
39822
39892
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -39825,6 +39895,7 @@ var ts;
39825
39895
  name: "mapRoot",
39826
39896
  type: "string",
39827
39897
  affectsEmit: true,
39898
+ affectsMultiFileEmitBuildInfo: true,
39828
39899
  paramType: ts.Diagnostics.LOCATION,
39829
39900
  category: ts.Diagnostics.Emit,
39830
39901
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -39833,6 +39904,7 @@ var ts;
39833
39904
  name: "inlineSourceMap",
39834
39905
  type: "boolean",
39835
39906
  affectsEmit: true,
39907
+ affectsMultiFileEmitBuildInfo: true,
39836
39908
  category: ts.Diagnostics.Emit,
39837
39909
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
39838
39910
  defaultValueDescription: false,
@@ -39841,6 +39913,7 @@ var ts;
39841
39913
  name: "inlineSources",
39842
39914
  type: "boolean",
39843
39915
  affectsEmit: true,
39916
+ affectsMultiFileEmitBuildInfo: true,
39844
39917
  category: ts.Diagnostics.Emit,
39845
39918
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
39846
39919
  defaultValueDescription: false,
@@ -39850,6 +39923,7 @@ var ts;
39850
39923
  name: "experimentalDecorators",
39851
39924
  type: "boolean",
39852
39925
  affectsSemanticDiagnostics: true,
39926
+ affectsMultiFileEmitBuildInfo: true,
39853
39927
  category: ts.Diagnostics.Language_and_Environment,
39854
39928
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
39855
39929
  defaultValueDescription: false,
@@ -39859,6 +39933,7 @@ var ts;
39859
39933
  type: "boolean",
39860
39934
  affectsSemanticDiagnostics: true,
39861
39935
  affectsEmit: true,
39936
+ affectsMultiFileEmitBuildInfo: true,
39862
39937
  category: ts.Diagnostics.Language_and_Environment,
39863
39938
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
39864
39939
  defaultValueDescription: false,
@@ -39883,6 +39958,7 @@ var ts;
39883
39958
  type: "string",
39884
39959
  affectsSemanticDiagnostics: true,
39885
39960
  affectsEmit: true,
39961
+ affectsMultiFileEmitBuildInfo: true,
39886
39962
  affectsModuleResolution: true,
39887
39963
  category: ts.Diagnostics.Language_and_Environment,
39888
39964
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -39900,6 +39976,9 @@ var ts;
39900
39976
  name: "out",
39901
39977
  type: "string",
39902
39978
  affectsEmit: true,
39979
+ affectsMultiFileEmitBuildInfo: true,
39980
+ affectsDeclarationPath: true,
39981
+ affectsBundleEmitBuildInfo: true,
39903
39982
  isFilePath: false,
39904
39983
  // for correct behaviour, please use outFile
39905
39984
  category: ts.Diagnostics.Backwards_Compatibility,
@@ -39911,6 +39990,7 @@ var ts;
39911
39990
  name: "reactNamespace",
39912
39991
  type: "string",
39913
39992
  affectsEmit: true,
39993
+ affectsMultiFileEmitBuildInfo: true,
39914
39994
  category: ts.Diagnostics.Language_and_Environment,
39915
39995
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
39916
39996
  defaultValueDescription: "`React`",
@@ -39918,6 +39998,8 @@ var ts;
39918
39998
  {
39919
39999
  name: "skipDefaultLibCheck",
39920
40000
  type: "boolean",
40001
+ // We need to store these to determine whether `lib` files need to be rechecked
40002
+ affectsMultiFileEmitBuildInfo: true,
39921
40003
  category: ts.Diagnostics.Completeness,
39922
40004
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
39923
40005
  defaultValueDescription: false,
@@ -39933,6 +40015,7 @@ var ts;
39933
40015
  name: "emitBOM",
39934
40016
  type: "boolean",
39935
40017
  affectsEmit: true,
40018
+ affectsMultiFileEmitBuildInfo: true,
39936
40019
  category: ts.Diagnostics.Emit,
39937
40020
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
39938
40021
  defaultValueDescription: false,
@@ -39944,6 +40027,7 @@ var ts;
39944
40027
  lf: 1 /* LineFeed */
39945
40028
  })),
39946
40029
  affectsEmit: true,
40030
+ affectsMultiFileEmitBuildInfo: true,
39947
40031
  paramType: ts.Diagnostics.NEWLINE,
39948
40032
  category: ts.Diagnostics.Emit,
39949
40033
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -39953,6 +40037,7 @@ var ts;
39953
40037
  name: "noErrorTruncation",
39954
40038
  type: "boolean",
39955
40039
  affectsSemanticDiagnostics: true,
40040
+ affectsMultiFileEmitBuildInfo: true,
39956
40041
  category: ts.Diagnostics.Output_Formatting,
39957
40042
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
39958
40043
  defaultValueDescription: false,
@@ -39983,6 +40068,7 @@ var ts;
39983
40068
  name: "stripInternal",
39984
40069
  type: "boolean",
39985
40070
  affectsEmit: true,
40071
+ affectsMultiFileEmitBuildInfo: true,
39986
40072
  category: ts.Diagnostics.Emit,
39987
40073
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
39988
40074
  defaultValueDescription: false,
@@ -40023,6 +40109,7 @@ var ts;
40023
40109
  name: "noImplicitUseStrict",
40024
40110
  type: "boolean",
40025
40111
  affectsSemanticDiagnostics: true,
40112
+ affectsMultiFileEmitBuildInfo: true,
40026
40113
  category: ts.Diagnostics.Backwards_Compatibility,
40027
40114
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
40028
40115
  defaultValueDescription: false,
@@ -40031,6 +40118,7 @@ var ts;
40031
40118
  name: "noEmitHelpers",
40032
40119
  type: "boolean",
40033
40120
  affectsEmit: true,
40121
+ affectsMultiFileEmitBuildInfo: true,
40034
40122
  category: ts.Diagnostics.Emit,
40035
40123
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
40036
40124
  defaultValueDescription: false,
@@ -40039,6 +40127,7 @@ var ts;
40039
40127
  name: "noEmitOnError",
40040
40128
  type: "boolean",
40041
40129
  affectsEmit: true,
40130
+ affectsMultiFileEmitBuildInfo: true,
40042
40131
  category: ts.Diagnostics.Emit,
40043
40132
  transpileOptionValue: undefined,
40044
40133
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -40048,6 +40137,7 @@ var ts;
40048
40137
  name: "preserveConstEnums",
40049
40138
  type: "boolean",
40050
40139
  affectsEmit: true,
40140
+ affectsMultiFileEmitBuildInfo: true,
40051
40141
  category: ts.Diagnostics.Emit,
40052
40142
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
40053
40143
  defaultValueDescription: false,
@@ -40056,6 +40146,8 @@ var ts;
40056
40146
  name: "declarationDir",
40057
40147
  type: "string",
40058
40148
  affectsEmit: true,
40149
+ affectsMultiFileEmitBuildInfo: true,
40150
+ affectsDeclarationPath: true,
40059
40151
  isFilePath: true,
40060
40152
  paramType: ts.Diagnostics.DIRECTORY,
40061
40153
  category: ts.Diagnostics.Emit,
@@ -40065,6 +40157,8 @@ var ts;
40065
40157
  {
40066
40158
  name: "skipLibCheck",
40067
40159
  type: "boolean",
40160
+ // We need to store these to determine whether `lib` files need to be rechecked
40161
+ affectsMultiFileEmitBuildInfo: true,
40068
40162
  category: ts.Diagnostics.Completeness,
40069
40163
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
40070
40164
  defaultValueDescription: false,
@@ -40074,6 +40168,7 @@ var ts;
40074
40168
  type: "boolean",
40075
40169
  affectsBindDiagnostics: true,
40076
40170
  affectsSemanticDiagnostics: true,
40171
+ affectsMultiFileEmitBuildInfo: true,
40077
40172
  category: ts.Diagnostics.Type_Checking,
40078
40173
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
40079
40174
  defaultValueDescription: undefined,
@@ -40083,6 +40178,7 @@ var ts;
40083
40178
  type: "boolean",
40084
40179
  affectsBindDiagnostics: true,
40085
40180
  affectsSemanticDiagnostics: true,
40181
+ affectsMultiFileEmitBuildInfo: true,
40086
40182
  category: ts.Diagnostics.Type_Checking,
40087
40183
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
40088
40184
  defaultValueDescription: undefined,
@@ -40091,6 +40187,7 @@ var ts;
40091
40187
  name: "suppressExcessPropertyErrors",
40092
40188
  type: "boolean",
40093
40189
  affectsSemanticDiagnostics: true,
40190
+ affectsMultiFileEmitBuildInfo: true,
40094
40191
  category: ts.Diagnostics.Backwards_Compatibility,
40095
40192
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
40096
40193
  defaultValueDescription: false,
@@ -40099,6 +40196,7 @@ var ts;
40099
40196
  name: "suppressImplicitAnyIndexErrors",
40100
40197
  type: "boolean",
40101
40198
  affectsSemanticDiagnostics: true,
40199
+ affectsMultiFileEmitBuildInfo: true,
40102
40200
  category: ts.Diagnostics.Backwards_Compatibility,
40103
40201
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
40104
40202
  defaultValueDescription: false,
@@ -40123,6 +40221,7 @@ var ts;
40123
40221
  name: "noStrictGenericChecks",
40124
40222
  type: "boolean",
40125
40223
  affectsSemanticDiagnostics: true,
40224
+ affectsMultiFileEmitBuildInfo: true,
40126
40225
  category: ts.Diagnostics.Backwards_Compatibility,
40127
40226
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
40128
40227
  defaultValueDescription: false,
@@ -40132,6 +40231,7 @@ var ts;
40132
40231
  type: "boolean",
40133
40232
  affectsSemanticDiagnostics: true,
40134
40233
  affectsEmit: true,
40234
+ affectsMultiFileEmitBuildInfo: true,
40135
40235
  category: ts.Diagnostics.Language_and_Environment,
40136
40236
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
40137
40237
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -40140,6 +40240,7 @@ var ts;
40140
40240
  name: "preserveValueImports",
40141
40241
  type: "boolean",
40142
40242
  affectsEmit: true,
40243
+ affectsMultiFileEmitBuildInfo: true,
40143
40244
  category: ts.Diagnostics.Emit,
40144
40245
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
40145
40246
  defaultValueDescription: false,
@@ -40183,6 +40284,8 @@ var ts;
40183
40284
  /* @internal */
40184
40285
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
40185
40286
  /* @internal */
40287
+ ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
40288
+ /* @internal */
40186
40289
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
40187
40290
  /* @internal */
40188
40291
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -41038,6 +41141,7 @@ var ts;
41038
41141
  return optionDefinition.type;
41039
41142
  }
41040
41143
  }
41144
+ /* @internal */
41041
41145
  function getNameOfCompilerOptionValue(value, customTypeMap) {
41042
41146
  // There is a typeMap associated with this command-line option so use it to map value back to its name
41043
41147
  return ts.forEachEntry(customTypeMap, function (mapValue, key) {
@@ -41046,6 +41150,7 @@ var ts;
41046
41150
  }
41047
41151
  });
41048
41152
  }
41153
+ ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
41049
41154
  function serializeCompilerOptions(options, pathOptions) {
41050
41155
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
41051
41156
  }
@@ -110328,7 +110433,8 @@ var ts;
110328
110433
  return;
110329
110434
  }
110330
110435
  var version = ts.version; // Extracted into a const so the form is stable between namespace and module
110331
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), /*writeByteOrderMark*/ false);
110436
+ var buildInfo = { bundle: bundle, program: program, version: version };
110437
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
110332
110438
  }
110333
110439
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
110334
110440
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -110482,13 +110588,18 @@ var ts;
110482
110588
  if (sourceMapFilePath) {
110483
110589
  var sourceMap = sourceMapGenerator.toString();
110484
110590
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110591
+ if (printer.bundleFileInfo)
110592
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
110485
110593
  }
110486
110594
  }
110487
110595
  else {
110488
110596
  writer.writeLine();
110489
110597
  }
110490
110598
  // Write the output file
110491
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110599
+ var text = writer.getText();
110600
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110601
+ if (printer.bundleFileInfo)
110602
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
110492
110603
  // Reset state
110493
110604
  writer.clear();
110494
110605
  }
@@ -110631,34 +110742,54 @@ var ts;
110631
110742
  }
110632
110743
  /*@internal*/
110633
110744
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
110745
+ var createHash = ts.maybeBind(host, host.createHash);
110634
110746
  var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
110635
- var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
110636
- if (!buildInfoText)
110747
+ var buildInfo;
110748
+ if (host.getBuildInfo) {
110749
+ var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
110750
+ if (!hostBuildInfo)
110751
+ return buildInfoPath;
110752
+ buildInfo = hostBuildInfo;
110753
+ }
110754
+ else {
110755
+ var buildInfoText = host.readFile(buildInfoPath);
110756
+ if (!buildInfoText)
110757
+ return buildInfoPath;
110758
+ buildInfo = getBuildInfo(buildInfoText);
110759
+ }
110760
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
110637
110761
  return buildInfoPath;
110638
110762
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
110639
110763
  if (!jsFileText)
110640
110764
  return jsFilePath;
110765
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
110766
+ return jsFilePath;
110641
110767
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
110642
110768
  // error if no source map or for now if inline sourcemap
110643
110769
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
110644
110770
  return sourceMapFilePath || "inline sourcemap decoding";
110771
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
110772
+ return sourceMapFilePath;
110645
110773
  // read declaration text
110646
110774
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
110647
110775
  if (declarationFilePath && !declarationText)
110648
110776
  return declarationFilePath;
110777
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
110778
+ return declarationFilePath;
110649
110779
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
110650
110780
  // error if no source map or for now if inline sourcemap
110651
110781
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
110652
110782
  return declarationMapPath || "inline sourcemap decoding";
110653
- var buildInfo = getBuildInfo(buildInfoText);
110654
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
110655
- return buildInfoPath;
110783
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
110784
+ return declarationMapPath;
110656
110785
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110657
110786
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
110658
110787
  /*onlyOwnText*/ true);
110659
110788
  var outputFiles = [];
110660
110789
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
110661
110790
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
110791
+ var changedDtsText;
110792
+ var changedDtsData;
110662
110793
  var emitHost = {
110663
110794
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
110664
110795
  getCanonicalFileName: host.getCanonicalFileName,
@@ -110674,7 +110805,7 @@ var ts;
110674
110805
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
110675
110806
  getProjectReferenceRedirect: ts.returnUndefined,
110676
110807
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
110677
- writeFile: function (name, text, writeByteOrderMark) {
110808
+ writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
110678
110809
  switch (name) {
110679
110810
  case jsFilePath:
110680
110811
  if (jsFileText === text)
@@ -110685,8 +110816,13 @@ var ts;
110685
110816
  return;
110686
110817
  break;
110687
110818
  case buildInfoPath:
110688
- var newBuildInfo = getBuildInfo(text);
110819
+ var newBuildInfo = data.buildInfo;
110689
110820
  newBuildInfo.program = buildInfo.program;
110821
+ if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
110822
+ // Update the output signature
110823
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
110824
+ newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
110825
+ }
110690
110826
  // Update sourceFileInfo
110691
110827
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
110692
110828
  newBuildInfo.bundle.js.sources = js.sources;
@@ -110694,11 +110830,13 @@ var ts;
110694
110830
  newBuildInfo.bundle.dts.sources = dts.sources;
110695
110831
  }
110696
110832
  newBuildInfo.bundle.sourceFiles = sourceFiles;
110697
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
110833
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
110698
110834
  return;
110699
110835
  case declarationFilePath:
110700
110836
  if (declarationText === text)
110701
110837
  return;
110838
+ changedDtsText = text;
110839
+ changedDtsData = data;
110702
110840
  break;
110703
110841
  case declarationMapPath:
110704
110842
  if (declarationMapText === text)
@@ -110717,6 +110855,7 @@ var ts;
110717
110855
  getSourceFileFromReference: ts.returnUndefined,
110718
110856
  redirectTargetsMap: ts.createMultiMap(),
110719
110857
  getFileIncludeReasons: ts.notImplemented,
110858
+ createHash: createHash,
110720
110859
  };
110721
110860
  emitFiles(ts.notImplementedResolver, emitHost,
110722
110861
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
@@ -115801,12 +115940,10 @@ var ts;
115801
115940
  }
115802
115941
  ts.createCompilerHost = createCompilerHost;
115803
115942
  /*@internal*/
115804
- // TODO(shkamat): update this after reworking ts build API
115805
115943
  function createCompilerHostWorker(options, setParentNodes, system) {
115806
115944
  if (system === void 0) { system = ts.sys; }
115807
115945
  var existingDirectories = new ts.Map();
115808
115946
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
115809
- var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
115810
115947
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
115811
115948
  var text;
115812
115949
  try {
@@ -115839,7 +115976,7 @@ var ts;
115839
115976
  // NOTE: If patchWriteFileEnsuringDirectory has been called,
115840
115977
  // the system.writeFile will do its own directory creation and
115841
115978
  // the ensureDirectoriesExist call will always be redundant.
115842
- 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); });
115979
+ 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); });
115843
115980
  ts.performance.mark("afterIOWrite");
115844
115981
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
115845
115982
  }
@@ -115849,35 +115986,6 @@ var ts;
115849
115986
  }
115850
115987
  }
115851
115988
  }
115852
- var outputFingerprints;
115853
- function writeFileWorker(fileName, data, writeByteOrderMark) {
115854
- if (!ts.isWatchSet(options) || !system.getModifiedTime) {
115855
- system.writeFile(fileName, data, writeByteOrderMark);
115856
- return;
115857
- }
115858
- if (!outputFingerprints) {
115859
- outputFingerprints = new ts.Map();
115860
- }
115861
- var hash = computeHash(data);
115862
- var mtimeBefore = system.getModifiedTime(fileName);
115863
- if (mtimeBefore) {
115864
- var fingerprint = outputFingerprints.get(fileName);
115865
- // If output has not been changed, and the file has no external modification
115866
- if (fingerprint &&
115867
- fingerprint.byteOrderMark === writeByteOrderMark &&
115868
- fingerprint.hash === hash &&
115869
- fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
115870
- return;
115871
- }
115872
- }
115873
- system.writeFile(fileName, data, writeByteOrderMark);
115874
- var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
115875
- outputFingerprints.set(fileName, {
115876
- hash: hash,
115877
- byteOrderMark: writeByteOrderMark,
115878
- mtime: mtimeAfter
115879
- });
115880
- }
115881
115989
  function getDefaultLibLocation() {
115882
115990
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
115883
115991
  }
@@ -117467,6 +117575,7 @@ var ts;
117467
117575
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
117468
117576
  redirectTargetsMap: redirectTargetsMap,
117469
117577
  getFileIncludeReasons: program.getFileIncludeReasons,
117578
+ createHash: ts.maybeBind(host, host.createHash),
117470
117579
  };
117471
117580
  }
117472
117581
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -119580,13 +119689,9 @@ var ts;
119580
119689
  function createManyToManyPathMap() {
119581
119690
  function create(forward, reverse, deleted) {
119582
119691
  var map = {
119583
- clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119584
- forEach: function (fn) { return forward.forEach(fn); },
119585
119692
  getKeys: function (v) { return reverse.get(v); },
119586
119693
  getValues: function (k) { return forward.get(k); },
119587
- hasKey: function (k) { return forward.has(k); },
119588
119694
  keys: function () { return forward.keys(); },
119589
- deletedKeys: function () { return deleted; },
119590
119695
  deleteKey: function (k) {
119591
119696
  (deleted || (deleted = new ts.Set())).add(k);
119592
119697
  var set = forward.get(k);
@@ -119613,11 +119718,6 @@ var ts;
119613
119718
  });
119614
119719
  return map;
119615
119720
  },
119616
- clear: function () {
119617
- forward.clear();
119618
- reverse.clear();
119619
- deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119620
- }
119621
119721
  };
119622
119722
  return map;
119623
119723
  }
@@ -119745,18 +119845,21 @@ var ts;
119745
119845
  * Creates the state of file references and signature for the new program from oldState if it is safe
119746
119846
  */
119747
119847
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119848
+ var _a, _b, _c;
119748
119849
  var fileInfos = new ts.Map();
119749
119850
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
119750
119851
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
119751
- var hasCalledUpdateShapeSignature = new ts.Set();
119752
119852
  var useOldState = canReuseOldState(referencedMap, oldState);
119753
119853
  // Ensure source files have parent pointers set
119754
119854
  newProgram.getTypeChecker();
119755
119855
  // Create the reference map, and set the file infos
119756
- for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
119757
- var sourceFile = _a[_i];
119856
+ for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
119857
+ var sourceFile = _d[_i];
119758
119858
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
119759
- var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
119859
+ var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
119860
+ var signature = oldUncommitedSignature === undefined ?
119861
+ useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
119862
+ oldUncommitedSignature || undefined;
119760
119863
  if (referencedMap) {
119761
119864
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
119762
119865
  if (newReferences) {
@@ -119764,19 +119867,26 @@ var ts;
119764
119867
  }
119765
119868
  // Copy old visible to outside files map
119766
119869
  if (useOldState) {
119767
- var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
119870
+ var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
119871
+ var exportedModules = oldUncommitedExportedModules === undefined ?
119872
+ oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
119873
+ oldUncommitedExportedModules || undefined;
119768
119874
  if (exportedModules) {
119769
119875
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119770
119876
  }
119771
119877
  }
119772
119878
  }
119773
- fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
119879
+ fileInfos.set(sourceFile.resolvedPath, {
119880
+ version: version_2,
119881
+ signature: signature,
119882
+ affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
119883
+ impliedFormat: sourceFile.impliedNodeFormat
119884
+ });
119774
119885
  }
119775
119886
  return {
119776
119887
  fileInfos: fileInfos,
119777
119888
  referencedMap: referencedMap,
119778
119889
  exportedModulesMap: exportedModulesMap,
119779
- hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
119780
119890
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
119781
119891
  };
119782
119892
  }
@@ -119790,71 +119900,42 @@ var ts;
119790
119900
  }
119791
119901
  BuilderState.releaseCache = releaseCache;
119792
119902
  /**
119793
- * Creates a clone of the state
119903
+ * Gets the files affected by the path from the program
119794
119904
  */
119795
- function clone(state) {
119905
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
119796
119906
  var _a, _b;
119797
- // Dont need to backup allFiles info since its cache anyway
119798
- return {
119799
- fileInfos: new ts.Map(state.fileInfos),
119800
- referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
119801
- exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
119802
- hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
119803
- useFileVersionAsSignature: state.useFileVersionAsSignature,
119804
- };
119907
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
119908
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119909
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119910
+ return result;
119805
119911
  }
119806
- BuilderState.clone = clone;
119807
- /**
119808
- * Gets the files affected by the path from the program
119809
- */
119810
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
119811
- // Since the operation could be cancelled, the signatures are always stored in the cache
119812
- // They will be committed once it is safe to use them
119813
- // eg when calling this api from tsserver, if there is no cancellation of the operation
119814
- // In the other cases the affected files signatures are committed only after the iteration through the result is complete
119815
- var signatureCache = cacheToUpdateSignature || new ts.Map();
119912
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119913
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
119816
119914
  var sourceFile = programOfThisState.getSourceFileByPath(path);
119817
119915
  if (!sourceFile) {
119818
119916
  return ts.emptyArray;
119819
119917
  }
119820
- if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
119918
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
119821
119919
  return [sourceFile];
119822
119920
  }
119823
- var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
119824
- if (!cacheToUpdateSignature) {
119825
- // Commit all the signatures in the signature cache
119826
- updateSignaturesFromCache(state, signatureCache);
119827
- }
119828
- return result;
119829
- }
119830
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119831
- /**
119832
- * Updates the signatures from the cache into state's fileinfo signatures
119833
- * This should be called whenever it is safe to commit the state of the builder
119834
- */
119835
- function updateSignaturesFromCache(state, signatureCache) {
119836
- signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
119921
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
119837
119922
  }
119838
- BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
119923
+ BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
119839
119924
  function updateSignatureOfFile(state, signature, path) {
119840
119925
  state.fileInfos.get(path).signature = signature;
119841
- state.hasCalledUpdateShapeSignature.add(path);
119926
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
119842
119927
  }
119843
119928
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
119844
119929
  /**
119845
119930
  * Returns if the shape of the signature has changed since last emit
119846
119931
  */
119847
- function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
119932
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
119933
+ var _a;
119848
119934
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
119849
- ts.Debug.assert(!!sourceFile);
119850
- ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
119851
119935
  // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
119852
- if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
119936
+ if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
119853
119937
  return false;
119854
- }
119855
119938
  var info = state.fileInfos.get(sourceFile.resolvedPath);
119856
- if (!info)
119857
- return ts.Debug.fail();
119858
119939
  var prevSignature = info.signature;
119859
119940
  var latestSignature;
119860
119941
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -119865,45 +119946,55 @@ var ts;
119865
119946
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119866
119947
  if (firstDts_1) {
119867
119948
  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; })); });
119868
- latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119869
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119870
- updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
119949
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
119950
+ if (latestSignature !== prevSignature) {
119951
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
119871
119952
  }
119872
119953
  }
119873
119954
  }
119874
119955
  // Default is to use file version as signature
119875
119956
  if (latestSignature === undefined) {
119876
119957
  latestSignature = sourceFile.version;
119877
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119958
+ if (state.exportedModulesMap && latestSignature !== prevSignature) {
119959
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119878
119960
  // All the references in this file are exported
119879
119961
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
119880
119962
  if (references) {
119881
- exportedModulesMapCache.set(sourceFile.resolvedPath, references);
119963
+ state.exportedModulesMap.set(sourceFile.resolvedPath, references);
119882
119964
  }
119883
119965
  else {
119884
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119966
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119885
119967
  }
119886
119968
  }
119887
119969
  }
119888
- cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
119970
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
119971
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
119972
+ info.signature = latestSignature;
119889
119973
  return latestSignature !== prevSignature;
119890
119974
  }
119891
119975
  BuilderState.updateShapeSignature = updateShapeSignature;
119976
+ function computeSignature(text, computeHash) {
119977
+ return (computeHash || ts.generateDjb2Hash)(text);
119978
+ }
119979
+ BuilderState.computeSignature = computeSignature;
119892
119980
  /**
119893
119981
  * Coverts the declaration emit result into exported modules map
119894
119982
  */
119895
- function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
119983
+ function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
119984
+ if (!state.exportedModulesMap)
119985
+ return;
119986
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119896
119987
  if (!exportedModulesFromDeclarationEmit) {
119897
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119988
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119898
119989
  return;
119899
119990
  }
119900
119991
  var exportedModules;
119901
119992
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
119902
119993
  if (exportedModules) {
119903
- exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
119994
+ state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119904
119995
  }
119905
119996
  else {
119906
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119997
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119907
119998
  }
119908
119999
  function addExportedModule(exportedModulePaths) {
119909
120000
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -119915,19 +120006,6 @@ var ts;
119915
120006
  }
119916
120007
  }
119917
120008
  BuilderState.updateExportedModules = updateExportedModules;
119918
- /**
119919
- * Updates the exported modules from cache into state's exported modules map
119920
- * This should be called whenever it is safe to commit the state of the builder
119921
- */
119922
- function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
119923
- var _a;
119924
- if (exportedModulesMapCache) {
119925
- ts.Debug.assert(!!state.exportedModulesMap);
119926
- (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
119927
- exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
119928
- }
119929
- }
119930
- BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
119931
120009
  /**
119932
120010
  * Get all the dependencies of the sourceFile
119933
120011
  */
@@ -120048,7 +120126,7 @@ var ts;
120048
120126
  /**
120049
120127
  * When program emits modular code, gets the files affected by the sourceFile whose shape has changed
120050
120128
  */
120051
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
120129
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
120052
120130
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
120053
120131
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
120054
120132
  }
@@ -120068,7 +120146,7 @@ var ts;
120068
120146
  if (!seenFileNamesMap.has(currentPath)) {
120069
120147
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
120070
120148
  seenFileNamesMap.set(currentPath, currentSourceFile);
120071
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
120149
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
120072
120150
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
120073
120151
  }
120074
120152
  }
@@ -120094,32 +120172,33 @@ var ts;
120094
120172
  * Create the state so that we can iterate on changedFiles/affected files
120095
120173
  */
120096
120174
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
120175
+ var _a, _b;
120097
120176
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
120098
120177
  state.program = newProgram;
120099
120178
  var compilerOptions = newProgram.getCompilerOptions();
120100
120179
  state.compilerOptions = compilerOptions;
120180
+ var outFilePath = ts.outFile(compilerOptions);
120101
120181
  // With --out or --outFile, any change affects all semantic diagnostics so no need to cache them
120102
- if (!ts.outFile(compilerOptions)) {
120182
+ if (!outFilePath) {
120103
120183
  state.semanticDiagnosticsPerFile = new ts.Map();
120104
120184
  }
120185
+ 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)) {
120186
+ state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
120187
+ }
120105
120188
  state.changedFilesSet = new ts.Set();
120189
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
120106
120190
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
120107
120191
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
120108
120192
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
120109
120193
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
120194
+ var canCopyEmitSignatures = compilerOptions.composite &&
120195
+ (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
120196
+ !outFilePath &&
120197
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
120110
120198
  if (useOldState) {
120111
- // Verify the sanity of old state
120112
- if (!oldState.currentChangedFilePath) {
120113
- var affectedSignatures = oldState.currentAffectedFilesSignatures;
120114
- ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
120115
- }
120116
- var changedFilesSet = oldState.changedFilesSet;
120117
- if (canCopySemanticDiagnostics) {
120118
- ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
120119
- }
120120
120199
  // Copy old state's changed files set
120121
- changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
120122
- if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
120200
+ (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
120201
+ if (!outFilePath && oldState.affectedFilesPendingEmit) {
120123
120202
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
120124
120203
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
120125
120204
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -120140,6 +120219,8 @@ var ts;
120140
120219
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
120141
120220
  // versions dont match
120142
120221
  oldInfo.version !== info.version ||
120222
+ // Implied formats dont match
120223
+ oldInfo.impliedFormat !== info.impliedFormat ||
120143
120224
  // Referenced files changed
120144
120225
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
120145
120226
  // Referenced file was deleted in the new program
@@ -120163,27 +120244,25 @@ var ts;
120163
120244
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
120164
120245
  }
120165
120246
  }
120247
+ if (canCopyEmitSignatures) {
120248
+ var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
120249
+ if (oldEmitSignature)
120250
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
120251
+ }
120166
120252
  });
120167
120253
  // If the global file is removed, add all files as changed
120168
120254
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
120169
120255
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, /*firstSourceFile*/ undefined)
120170
120256
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
120171
120257
  }
120172
- else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
120258
+ else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
120173
120259
  // Add all files to affectedFilesPendingEmit since emit changed
120174
120260
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1 /* Full */); });
120175
120261
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
120176
120262
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
120177
120263
  }
120178
- if (useOldState) {
120179
- // Any time the interpretation of a source file changes, mark it as changed
120180
- ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
120181
- if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
120182
- state.changedFilesSet.add(sourceFilePath);
120183
- }
120184
- });
120185
- }
120186
- state.buildInfoEmitPending = !!state.changedFilesSet.size;
120264
+ // Since old states change files set is copied, any additional change means we would need to emit build info
120265
+ state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
120187
120266
  return state;
120188
120267
  }
120189
120268
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -120219,30 +120298,35 @@ var ts;
120219
120298
  ts.BuilderState.releaseCache(state);
120220
120299
  state.program = undefined;
120221
120300
  }
120222
- /**
120223
- * Creates a clone of the state
120224
- */
120225
- function cloneBuilderProgramState(state) {
120226
- var _a;
120227
- var newState = ts.BuilderState.clone(state);
120228
- newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
120229
- newState.changedFilesSet = new ts.Set(state.changedFilesSet);
120230
- newState.affectedFiles = state.affectedFiles;
120231
- newState.affectedFilesIndex = state.affectedFilesIndex;
120232
- newState.currentChangedFilePath = state.currentChangedFilePath;
120233
- newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
120234
- newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
120235
- newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
120236
- newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
120237
- newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
120238
- newState.program = state.program;
120239
- newState.compilerOptions = state.compilerOptions;
120240
- newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
120241
- newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
120242
- newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
120243
- newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
120244
- newState.programEmitComplete = state.programEmitComplete;
120245
- return newState;
120301
+ function backupEmitBuilderProgramState(state) {
120302
+ var outFilePath = ts.outFile(state.compilerOptions);
120303
+ // Only in --out changeFileSet is kept around till emit
120304
+ ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
120305
+ return {
120306
+ affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
120307
+ affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
120308
+ affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
120309
+ seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
120310
+ programEmitComplete: state.programEmitComplete,
120311
+ emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
120312
+ outSignature: state.outSignature,
120313
+ dtsChangeTime: state.dtsChangeTime,
120314
+ hasChangedEmitSignature: state.hasChangedEmitSignature,
120315
+ changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
120316
+ };
120317
+ }
120318
+ function restoreEmitBuilderProgramState(state, backupEmitState) {
120319
+ state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
120320
+ state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
120321
+ state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
120322
+ state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
120323
+ state.programEmitComplete = backupEmitState.programEmitComplete;
120324
+ state.emitSignatures = backupEmitState.emitSignatures;
120325
+ state.outSignature = backupEmitState.outSignature;
120326
+ state.dtsChangeTime = backupEmitState.dtsChangeTime;
120327
+ state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
120328
+ if (backupEmitState.changedFilesSet)
120329
+ state.changedFilesSet = backupEmitState.changedFilesSet;
120246
120330
  }
120247
120331
  /**
120248
120332
  * Verifies that source file is ok to be used in calls that arent handled by next
@@ -120257,7 +120341,7 @@ var ts;
120257
120341
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
120258
120342
  */
120259
120343
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
120260
- var _a;
120344
+ var _a, _b;
120261
120345
  while (true) {
120262
120346
  var affectedFiles = state.affectedFiles;
120263
120347
  if (affectedFiles) {
@@ -120277,10 +120361,8 @@ var ts;
120277
120361
  state.changedFilesSet.delete(state.currentChangedFilePath);
120278
120362
  state.currentChangedFilePath = undefined;
120279
120363
  // Commit the changes in file signature
120280
- ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
120281
- state.currentAffectedFilesSignatures.clear();
120282
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120283
- (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
120364
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
120365
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120284
120366
  state.affectedFiles = undefined;
120285
120367
  }
120286
120368
  // Get next changed file
@@ -120298,12 +120380,7 @@ var ts;
120298
120380
  return program;
120299
120381
  }
120300
120382
  // Get next batch of affected files
120301
- if (!state.currentAffectedFilesSignatures)
120302
- state.currentAffectedFilesSignatures = new ts.Map();
120303
- if (state.exportedModulesMap) {
120304
- state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
120305
- }
120306
- state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
120383
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
120307
120384
  state.currentChangedFilePath = nextKey.value;
120308
120385
  state.affectedFilesIndex = 0;
120309
120386
  if (!state.seenAffectedFiles)
@@ -120355,7 +120432,6 @@ var ts;
120355
120432
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
120356
120433
  */
120357
120434
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120358
- var _a;
120359
120435
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
120360
120436
  // If affected files is everything except default library, then nothing more to do
120361
120437
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -120363,10 +120439,9 @@ var ts;
120363
120439
  // When a change affects the global scope, all files are considered to be affected without updating their signature
120364
120440
  // That means when affected file is handled, its signature can be out of date
120365
120441
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
120366
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
120442
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
120367
120443
  return;
120368
120444
  }
120369
- 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);
120370
120445
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
120371
120446
  return;
120372
120447
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -120386,7 +120461,7 @@ var ts;
120386
120461
  // This ensures that we dont later during incremental builds considering wrong signature.
120387
120462
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
120388
120463
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
120389
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
120464
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
120390
120465
  // If not dts emit, nothing more to do
120391
120466
  if (ts.getEmitDeclarations(state.compilerOptions)) {
120392
120467
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -120407,27 +120482,10 @@ var ts;
120407
120482
  return !state.semanticDiagnosticsFromOldState.size;
120408
120483
  }
120409
120484
  function isChangedSignature(state, path) {
120410
- var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
120411
- var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120485
+ var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
120486
+ var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120412
120487
  return newSignature !== oldSignature;
120413
120488
  }
120414
- function forEachKeyOfExportedModulesMap(state, filePath, fn) {
120415
- // Go through exported modules from cache first
120416
- var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
120417
- var result = keys && ts.forEachKey(keys, fn);
120418
- if (result)
120419
- return result;
120420
- // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
120421
- keys = state.exportedModulesMap.getKeys(filePath);
120422
- return keys && ts.forEachKey(keys, function (exportedFromPath) {
120423
- var _a;
120424
- // If the cache had an updated value, skip
120425
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
120426
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
120427
- fn(exportedFromPath) :
120428
- undefined;
120429
- });
120430
- }
120431
120489
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
120432
120490
  var _a;
120433
120491
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -120442,6 +120500,7 @@ var ts;
120442
120500
  * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
120443
120501
  */
120444
120502
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120503
+ var _a;
120445
120504
  // If there was change in signature (dts output) for the changed file,
120446
120505
  // then only we need to handle pending file emit
120447
120506
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
@@ -120468,11 +120527,10 @@ var ts;
120468
120527
  }
120469
120528
  }
120470
120529
  }
120471
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120472
120530
  var seenFileAndExportsOfFile = new ts.Set();
120473
120531
  // Go through exported modules from cache first
120474
120532
  // If exported modules has path, all files referencing file exported from are affected
120475
- forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
120533
+ (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120476
120534
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
120477
120535
  return true;
120478
120536
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -120486,19 +120544,18 @@ var ts;
120486
120544
  * return true when all work is done and we can exit handling dts emit and semantic diagnostics
120487
120545
  */
120488
120546
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
120489
- var _a;
120547
+ var _a, _b;
120490
120548
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
120491
120549
  return undefined;
120492
120550
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
120493
120551
  return true;
120494
120552
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
120495
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120496
120553
  // If exported modules has path, all files referencing file exported from are affected
120497
- forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
120554
+ (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120498
120555
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
120499
120556
  });
120500
120557
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
120501
- (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
120558
+ (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
120502
120559
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
120503
120560
  handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
120504
120561
  state, referencingFilePath, cancellationToken, computeHash, host);
@@ -120519,12 +120576,13 @@ var ts;
120519
120576
  }
120520
120577
  else {
120521
120578
  state.seenAffectedFiles.add(affected.resolvedPath);
120579
+ // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted
120580
+ state.buildInfoEmitPending = true;
120522
120581
  if (emitKind !== undefined) {
120523
120582
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
120524
120583
  }
120525
120584
  if (isPendingEmit) {
120526
120585
  state.affectedFilesPendingEmitIndex++;
120527
- state.buildInfoEmitPending = true;
120528
120586
  }
120529
120587
  else {
120530
120588
  state.affectedFilesIndex++;
@@ -120572,25 +120630,61 @@ var ts;
120572
120630
  }
120573
120631
  return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
120574
120632
  }
120633
+ function isProgramBundleEmitBuildInfo(info) {
120634
+ return !!ts.outFile(info.options || {});
120635
+ }
120636
+ ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
120575
120637
  /**
120576
120638
  * Gets the program information to be emitted in buildInfo so that we can use it to create new program
120577
120639
  */
120578
- function getProgramBuildInfo(state, getCanonicalFileName) {
120579
- if (ts.outFile(state.compilerOptions))
120580
- return undefined;
120640
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
120641
+ var outFilePath = ts.outFile(state.compilerOptions);
120642
+ if (outFilePath && !state.compilerOptions.composite)
120643
+ return;
120581
120644
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
120582
120645
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
120646
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
120647
+ if (outFilePath) {
120648
+ var fileNames_1 = [];
120649
+ var fileInfos_1 = [];
120650
+ state.program.getRootFileNames().forEach(function (f) {
120651
+ var sourceFile = state.program.getSourceFile(f);
120652
+ if (!sourceFile)
120653
+ return;
120654
+ fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
120655
+ fileInfos_1.push(sourceFile.version);
120656
+ });
120657
+ var result_15 = {
120658
+ fileNames: fileNames_1,
120659
+ fileInfos: fileInfos_1,
120660
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
120661
+ outSignature: state.outSignature,
120662
+ dtsChangeTime: state.dtsChangeTime,
120663
+ };
120664
+ return result_15;
120665
+ }
120583
120666
  var fileNames = [];
120584
120667
  var fileNameToFileId = new ts.Map();
120585
120668
  var fileIdsList;
120586
120669
  var fileNamesToFileIdListId;
120670
+ var emitSignatures;
120587
120671
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
120672
+ var _b, _c;
120588
120673
  var key = _a[0], value = _a[1];
120589
120674
  // Ensure fileId
120590
120675
  var fileId = toFileId(key);
120591
120676
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
120592
- var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120593
- var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120677
+ var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
120678
+ var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
120679
+ if (state.compilerOptions.composite) {
120680
+ var file = state.program.getSourceFileByPath(key);
120681
+ if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
120682
+ var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
120683
+ if (emitSignature !== actualSignature) {
120684
+ (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
120685
+ }
120686
+ }
120687
+ }
120594
120688
  return value.version === actualSignature ?
120595
120689
  value.affectsGlobalScope || value.impliedFormat ?
120596
120690
  // If file version is same as signature, dont serialize signature
@@ -120598,11 +120692,11 @@ var ts;
120598
120692
  // If file info only contains version and signature and both are same we can just write string
120599
120693
  value.version :
120600
120694
  actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120601
- signature === undefined ?
120695
+ oldSignature === undefined ?
120602
120696
  // If we havent computed signature, use fileInfo as is
120603
120697
  value :
120604
120698
  // Serialize fileInfo with new updated signature
120605
- { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120699
+ { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120606
120700
  // Signature of the FileInfo is undefined, serialize it as false
120607
120701
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120608
120702
  });
@@ -120617,17 +120711,13 @@ var ts;
120617
120711
  if (state.exportedModulesMap) {
120618
120712
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
120619
120713
  var _a;
120620
- if (state.currentAffectedFilesExportedModulesMap) {
120621
- if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
120622
- return undefined;
120623
- }
120624
- var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
120625
- if (newValue) {
120626
- return [toFileId(key), toFileIdListId(newValue)];
120627
- }
120628
- }
120714
+ var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
120629
120715
  // Not in temporary cache, use existing value
120630
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120716
+ if (oldValue === undefined)
120717
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120718
+ if (oldValue)
120719
+ return [toFileId(key), toFileIdListId(oldValue)];
120720
+ return undefined;
120631
120721
  });
120632
120722
  }
120633
120723
  var semanticDiagnosticsPerFile;
@@ -120638,9 +120728,7 @@ var ts;
120638
120728
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
120639
120729
  [
120640
120730
  toFileId(key),
120641
- state.hasReusableDiagnostic ?
120642
- value :
120643
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120731
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
120644
120732
  ] :
120645
120733
  toFileId(key));
120646
120734
  }
@@ -120655,16 +120743,27 @@ var ts;
120655
120743
  }
120656
120744
  }
120657
120745
  }
120658
- return {
120746
+ var changeFileSet;
120747
+ if (state.changedFilesSet.size) {
120748
+ for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
120749
+ var path = _e[_d];
120750
+ (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120751
+ }
120752
+ }
120753
+ var result = {
120659
120754
  fileNames: fileNames,
120660
120755
  fileInfos: fileInfos,
120661
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
120756
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
120662
120757
  fileIdsList: fileIdsList,
120663
120758
  referencedMap: referencedMap,
120664
120759
  exportedModulesMap: exportedModulesMap,
120665
120760
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
120666
120761
  affectedFilesPendingEmit: affectedFilesPendingEmit,
120762
+ changeFileSet: changeFileSet,
120763
+ emitSignatures: emitSignatures,
120764
+ dtsChangeTime: state.dtsChangeTime,
120667
120765
  };
120766
+ return result;
120668
120767
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
120669
120768
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
120670
120769
  }
@@ -120689,24 +120788,18 @@ var ts;
120689
120788
  }
120690
120789
  return fileIdListId;
120691
120790
  }
120692
- }
120693
- function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
120694
- var result;
120695
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120696
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120697
- var name = _a[_i];
120698
- var optionKey = name.toLowerCase();
120699
- var optionInfo = optionsNameMap.get(optionKey);
120700
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
120701
- // We need to store `strict`, even though it won't be examined directly, so that the
120702
- // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
120703
- optionKey === "strict" ||
120704
- // We need to store these to determine whether `lib` files need to be rechecked.
120705
- optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
120706
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
120791
+ function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
120792
+ var result;
120793
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120794
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120795
+ var name = _a[_i];
120796
+ var optionInfo = optionsNameMap.get(name.toLowerCase());
120797
+ if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
120798
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
120799
+ }
120707
120800
  }
120801
+ return result;
120708
120802
  }
120709
- return result;
120710
120803
  }
120711
120804
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120712
120805
  if (option) {
@@ -120780,6 +120873,10 @@ var ts;
120780
120873
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
120781
120874
  }
120782
120875
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
120876
+ function computeSignature(text, data, computeHash) {
120877
+ return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
120878
+ }
120879
+ ts.computeSignature = computeSignature;
120783
120880
  function createBuilderProgram(kind, _a) {
120784
120881
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
120785
120882
  // Return same program if underlying program doesnt change
@@ -120798,8 +120895,8 @@ var ts;
120798
120895
  */
120799
120896
  var computeHash = ts.maybeBind(host, host.createHash);
120800
120897
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
120801
- var backupState;
120802
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
120898
+ var backupEmitState;
120899
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
120803
120900
  // To ensure that we arent storing any references to old program or new program without state
120804
120901
  newProgram = undefined; // TODO: GH#18217
120805
120902
  oldProgram = undefined;
@@ -120807,20 +120904,20 @@ var ts;
120807
120904
  var getState = function () { return state; };
120808
120905
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
120809
120906
  builderProgram.getState = getState;
120810
- builderProgram.backupState = function () {
120811
- ts.Debug.assert(backupState === undefined);
120812
- backupState = cloneBuilderProgramState(state);
120907
+ builderProgram.backupEmitState = function () {
120908
+ ts.Debug.assert(backupEmitState === undefined);
120909
+ backupEmitState = backupEmitBuilderProgramState(state);
120813
120910
  };
120814
- builderProgram.restoreState = function () {
120815
- state = ts.Debug.checkDefined(backupState);
120816
- backupState = undefined;
120911
+ builderProgram.restoreEmitState = function () {
120912
+ restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
120913
+ backupEmitState = undefined;
120817
120914
  };
120818
120915
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
120819
120916
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
120820
120917
  builderProgram.emit = emit;
120821
120918
  builderProgram.releaseProgram = function () {
120822
120919
  releaseCache(state);
120823
- backupState = undefined;
120920
+ backupEmitState = undefined;
120824
120921
  };
120825
120922
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
120826
120923
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -120879,35 +120976,59 @@ var ts;
120879
120976
  return toAffectedFileEmitResult(state,
120880
120977
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
120881
120978
  // Otherwise just affected file
120882
- ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120883
- getWriteFileUpdatingSignatureCallback(writeFile) :
120979
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
120980
+ getWriteFileCallback(writeFile, customTransformers) :
120884
120981
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
120885
120982
  }
120886
- function getWriteFileUpdatingSignatureCallback(writeFile) {
120983
+ function getWriteFileCallback(writeFile, customTransformers) {
120887
120984
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
120888
- var _a;
120985
+ var _a, _b, _c;
120889
120986
  if (ts.isDeclarationFileName(fileName)) {
120890
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120891
- var file = sourceFiles[0];
120892
- var info = state.fileInfos.get(file.resolvedPath);
120893
- var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120894
- if (signature === file.version) {
120895
- var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120896
- if (newSignature !== file.version) { // Update it
120897
- if (host.storeFilesChangingSignatureDuringEmit)
120898
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120899
- if (state.exportedModulesMap)
120900
- ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
120901
- if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
120902
- state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
120987
+ if (!ts.outFile(state.compilerOptions)) {
120988
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120989
+ var newSignature = void 0;
120990
+ if (!customTransformers) {
120991
+ var file = sourceFiles[0];
120992
+ var info = state.fileInfos.get(file.resolvedPath);
120993
+ if (info.signature === file.version) {
120994
+ newSignature = computeSignature(text, data, computeHash);
120995
+ if (newSignature !== file.version) { // Update it
120996
+ if (host.storeFilesChangingSignatureDuringEmit)
120997
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120998
+ if (state.exportedModulesMap)
120999
+ ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
121000
+ if (state.affectedFiles) {
121001
+ // Keep old signature so we know what to undo if cancellation happens
121002
+ var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
121003
+ if (existing === undefined)
121004
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
121005
+ info.signature = newSignature;
121006
+ }
121007
+ else {
121008
+ // These are directly commited
121009
+ info.signature = newSignature;
121010
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
121011
+ }
121012
+ }
120903
121013
  }
120904
- else {
120905
- info.signature = newSignature;
120906
- if (state.exportedModulesMap)
120907
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
121014
+ }
121015
+ if (state.compilerOptions.composite) {
121016
+ var filePath = sourceFiles[0].resolvedPath;
121017
+ var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
121018
+ newSignature || (newSignature = computeSignature(text, data, computeHash));
121019
+ if (newSignature !== oldSignature) {
121020
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
121021
+ state.hasChangedEmitSignature = true;
120908
121022
  }
120909
121023
  }
120910
121024
  }
121025
+ else if (state.compilerOptions.composite) {
121026
+ var newSignature = computeSignature(text, data, computeHash);
121027
+ if (newSignature !== state.outSignature) {
121028
+ state.outSignature = newSignature;
121029
+ state.hasChangedEmitSignature = true;
121030
+ }
121031
+ }
120911
121032
  }
120912
121033
  if (writeFile)
120913
121034
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -120972,8 +121093,8 @@ var ts;
120972
121093
  }
120973
121094
  }
120974
121095
  }
120975
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120976
- getWriteFileUpdatingSignatureCallback(writeFile) :
121096
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
121097
+ getWriteFileCallback(writeFile, customTransformers) :
120977
121098
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120978
121099
  }
120979
121100
  /**
@@ -121062,29 +121183,58 @@ var ts;
121062
121183
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
121063
121184
  }
121064
121185
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
121065
- function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
121066
- var _a;
121186
+ function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
121187
+ var _a, _b, _c, _d;
121067
121188
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
121068
121189
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
121069
- var filePaths = program.fileNames.map(toPath);
121070
- var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
121071
- var fileInfos = new ts.Map();
121072
- program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
121073
- var state = {
121074
- fileInfos: fileInfos,
121075
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121076
- referencedMap: toManyToManyPathMap(program.referencedMap),
121077
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121078
- 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]; }),
121079
- hasReusableDiagnostic: true,
121080
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
121081
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
121082
- affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
121083
- };
121190
+ var state;
121191
+ var filePaths;
121192
+ var filePathsSetList;
121193
+ if (isProgramBundleEmitBuildInfo(program)) {
121194
+ state = {
121195
+ fileInfos: new ts.Map(),
121196
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121197
+ dtsChangeTime: program.dtsChangeTime,
121198
+ outSignature: program.outSignature,
121199
+ };
121200
+ }
121201
+ else {
121202
+ filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
121203
+ filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
121204
+ var fileInfos_2 = new ts.Map();
121205
+ var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
121206
+ program.fileInfos.forEach(function (fileInfo, index) {
121207
+ var path = toFilePath(index + 1);
121208
+ var stateFileInfo = toBuilderStateFileInfo(fileInfo);
121209
+ fileInfos_2.set(path, stateFileInfo);
121210
+ if (emitSignatures_1 && stateFileInfo.signature)
121211
+ emitSignatures_1.set(path, stateFileInfo.signature);
121212
+ });
121213
+ (_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
121214
+ if (ts.isNumber(value))
121215
+ emitSignatures_1.delete(toFilePath(value));
121216
+ else
121217
+ emitSignatures_1.set(toFilePath(value[0]), value[1]);
121218
+ });
121219
+ state = {
121220
+ fileInfos: fileInfos_2,
121221
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121222
+ referencedMap: toManyToManyPathMap(program.referencedMap),
121223
+ exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121224
+ 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]; }),
121225
+ hasReusableDiagnostic: true,
121226
+ affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
121227
+ affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
121228
+ affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
121229
+ changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
121230
+ dtsChangeTime: program.dtsChangeTime,
121231
+ emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
121232
+ };
121233
+ }
121084
121234
  return {
121085
121235
  getState: function () { return state; },
121086
- backupState: ts.noop,
121087
- restoreState: ts.noop,
121236
+ backupEmitState: ts.noop,
121237
+ restoreEmitState: ts.noop,
121088
121238
  getProgram: ts.notImplemented,
121089
121239
  getProgramOrUndefined: ts.returnUndefined,
121090
121240
  releaseProgram: ts.noop,
@@ -121129,12 +121279,24 @@ var ts;
121129
121279
  return map;
121130
121280
  }
121131
121281
  }
121132
- ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
121282
+ ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
121283
+ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
121284
+ var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
121285
+ var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
121286
+ var fileInfos = new ts.Map();
121287
+ program.fileInfos.forEach(function (fileInfo, index) {
121288
+ var path = ts.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
121289
+ var version = ts.isString(fileInfo) ? fileInfo : fileInfo.version; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
121290
+ fileInfos.set(path, version);
121291
+ });
121292
+ return fileInfos;
121293
+ }
121294
+ ts.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap;
121133
121295
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
121134
121296
  return {
121135
121297
  getState: ts.notImplemented,
121136
- backupState: ts.noop,
121137
- restoreState: ts.noop,
121298
+ backupEmitState: ts.noop,
121299
+ restoreEmitState: ts.noop,
121138
121300
  getProgram: getProgram,
121139
121301
  getProgramOrUndefined: function () { return getState().program; },
121140
121302
  releaseProgram: function () { return getState().program = undefined; },
@@ -122250,9 +122412,9 @@ var ts;
122250
122412
  if (!preferSymlinks) {
122251
122413
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
122252
122414
  // so we only need to remove them from the realpath filenames.
122253
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122254
- if (result_15)
122255
- return result_15;
122415
+ var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122416
+ if (result_16)
122417
+ return result_16;
122256
122418
  }
122257
122419
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
122258
122420
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -122272,10 +122434,10 @@ var ts;
122272
122434
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
122273
122435
  var symlinkDirectory = symlinkDirectories_1[_i];
122274
122436
  var option = ts.resolvePath(symlinkDirectory, relative);
122275
- var result_16 = cb(option, target === referenceRedirect);
122437
+ var result_17 = cb(option, target === referenceRedirect);
122276
122438
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
122277
- if (result_16)
122278
- return result_16;
122439
+ if (result_17)
122440
+ return result_17;
122279
122441
  }
122280
122442
  });
122281
122443
  });
@@ -123185,6 +123347,7 @@ var ts;
123185
123347
  readDirectory: ts.maybeBind(host, host.readDirectory),
123186
123348
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
123187
123349
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
123350
+ now: ts.maybeBind(host, host.now),
123188
123351
  };
123189
123352
  function writeFile(fileName, text, writeByteOrderMark, onError) {
123190
123353
  try {
@@ -123245,6 +123408,7 @@ var ts;
123245
123408
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
123246
123409
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
123247
123410
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
123411
+ now: ts.maybeBind(system, system.now),
123248
123412
  };
123249
123413
  }
123250
123414
  ts.createProgramHost = createProgramHost;
@@ -123312,20 +123476,26 @@ var ts;
123312
123476
  var ts;
123313
123477
  (function (ts) {
123314
123478
  function readBuilderProgram(compilerOptions, host) {
123315
- if (ts.outFile(compilerOptions))
123316
- return undefined;
123317
123479
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
123318
123480
  if (!buildInfoPath)
123319
123481
  return undefined;
123320
- var content = host.readFile(buildInfoPath);
123321
- if (!content)
123322
- return undefined;
123323
- var buildInfo = ts.getBuildInfo(content);
123482
+ var buildInfo;
123483
+ if (host.getBuildInfo) {
123484
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
123485
+ if (!buildInfo)
123486
+ return undefined;
123487
+ }
123488
+ else {
123489
+ var content = host.readFile(buildInfoPath);
123490
+ if (!content)
123491
+ return undefined;
123492
+ buildInfo = ts.getBuildInfo(content);
123493
+ }
123324
123494
  if (buildInfo.version !== ts.version)
123325
123495
  return undefined;
123326
123496
  if (!buildInfo.program)
123327
123497
  return undefined;
123328
- return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123498
+ return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123329
123499
  }
123330
123500
  ts.readBuilderProgram = readBuilderProgram;
123331
123501
  function createIncrementalCompilerHost(options, system) {
@@ -123334,6 +123504,7 @@ var ts;
123334
123504
  host.createHash = ts.maybeBind(system, system.createHash);
123335
123505
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
123336
123506
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
123507
+ host.now = ts.maybeBind(system, system.now);
123337
123508
  ts.setGetSourceFileAsHashVersioned(host, system);
123338
123509
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
123339
123510
  return host;
@@ -124069,14 +124240,17 @@ var ts;
124069
124240
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
124070
124241
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
124071
124242
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
124072
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
124073
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
124074
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
124075
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
124243
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
124244
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
124245
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
124246
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
124247
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
124248
+ UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
124076
124249
  /**
124077
124250
  * Projects with no outputs (i.e. "solution" files)
124078
124251
  */
124079
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
124252
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
124253
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
124080
124254
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
124081
124255
  function resolveConfigFileProjectName(project) {
124082
124256
  if (ts.fileExtensionIs(project, ".json" /* Json */)) {
@@ -124121,9 +124295,11 @@ var ts;
124121
124295
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
124122
124296
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
124123
124297
  }
124124
- function newer(date1, date2) {
124125
- return date2 > date1 ? date2 : date1;
124298
+ /*@internal*/
124299
+ function getCurrentTime(host) {
124300
+ return host.now ? host.now() : new Date();
124126
124301
  }
124302
+ ts.getCurrentTime = getCurrentTime;
124127
124303
  /*@internal*/
124128
124304
  function isCircularBuildOrder(buildOrder) {
124129
124305
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -124213,6 +124389,7 @@ var ts;
124213
124389
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
124214
124390
  };
124215
124391
  }
124392
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
124216
124393
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
124217
124394
  var state = {
124218
124395
  host: host,
@@ -124229,8 +124406,9 @@ var ts;
124229
124406
  resolvedConfigFilePaths: new ts.Map(),
124230
124407
  configFileCache: new ts.Map(),
124231
124408
  projectStatus: new ts.Map(),
124232
- buildInfoChecked: new ts.Map(),
124233
124409
  extendedConfigCache: new ts.Map(),
124410
+ buildInfoCache: new ts.Map(),
124411
+ outputTimeStamps: new ts.Map(),
124234
124412
  builderPrograms: new ts.Map(),
124235
124413
  diagnostics: new ts.Map(),
124236
124414
  projectPendingBuild: new ts.Map(),
@@ -124253,6 +124431,7 @@ var ts;
124253
124431
  allWatchedConfigFiles: new ts.Map(),
124254
124432
  allWatchedExtendedConfigFiles: new ts.Map(),
124255
124433
  allWatchedPackageJsonFiles: new ts.Map(),
124434
+ filesWatched: new ts.Map(),
124256
124435
  lastCachedPackageJsonLookups: new ts.Map(),
124257
124436
  timerToBuildInvalidatedProject: undefined,
124258
124437
  reportFileChangeDetected: false,
@@ -124363,11 +124542,12 @@ var ts;
124363
124542
  // Config file cache
124364
124543
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
124365
124544
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
124366
- ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
124367
124545
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
124368
124546
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
124369
124547
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
124370
124548
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
124549
+ ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
124550
+ ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
124371
124551
  // Remove watches for the program no longer in the solution
124372
124552
  if (state.watch) {
124373
124553
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
@@ -124664,21 +124844,21 @@ var ts;
124664
124844
  }
124665
124845
  function emit(writeFileCallback, cancellationToken, customTransformers) {
124666
124846
  var _a;
124667
- var _b, _c;
124847
+ var _b, _c, _d;
124668
124848
  ts.Debug.assertIsDefined(program);
124669
124849
  ts.Debug.assert(step === BuildStep.Emit);
124670
124850
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
124671
- program.backupState();
124851
+ program.backupEmitState();
124672
124852
  var declDiagnostics;
124673
124853
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
124674
124854
  var outputFiles = [];
124675
124855
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
124676
124856
  /*write*/ undefined,
124677
- /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
124857
+ /*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,
124678
124858
  /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
124679
124859
  // Don't emit .d.ts if there are decl file errors
124680
124860
  if (declDiagnostics) {
124681
- program.restoreState();
124861
+ program.restoreEmitState();
124682
124862
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
124683
124863
  return {
124684
124864
  emitSkipped: true,
@@ -124688,40 +124868,46 @@ var ts;
124688
124868
  // Actual Emit
124689
124869
  var host = state.host, compilerHost = state.compilerHost;
124690
124870
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124691
- var newestDeclarationFileContentChangedTime = minimumDate;
124692
- var anyDtsChanged = false;
124871
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
124693
124872
  var emitterDiagnostics = ts.createDiagnosticCollection();
124694
124873
  var emittedOutputs = new ts.Map();
124874
+ var options = program.getCompilerOptions();
124875
+ var isIncremental = ts.isIncrementalCompilation(options);
124876
+ var outputTimeStampMap;
124877
+ var now;
124695
124878
  ts.solutionPerformance.mark("beforeOutputFilesWrite");
124696
124879
  outputFiles.forEach(function (_a) {
124697
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124698
- var priorChangeTime;
124699
- if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124700
- // Check for unchanged .d.ts files
124701
- if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124702
- priorChangeTime = host.getModifiedTime(name);
124703
- }
124704
- else {
124880
+ var _b, _c;
124881
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124882
+ var path = toPath(state, name);
124883
+ emittedOutputs.set(toPath(state, name), name);
124884
+ if (buildInfo) {
124885
+ setBuildInfo(state, buildInfo, projectPath, options);
124886
+ 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)) {
124705
124887
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124706
- anyDtsChanged = true;
124707
124888
  }
124708
124889
  }
124709
- emittedOutputs.set(toPath(state, name), name);
124710
124890
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124711
- if (priorChangeTime !== undefined) {
124712
- newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
124891
+ if (!isIncremental && state.watch) {
124892
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
124713
124893
  }
124714
124894
  });
124715
124895
  ts.solutionPerformance.mark("afterOutputFilesWrite");
124716
124896
  ts.solutionPerformance.measure("OutputFilesWrite", "beforeOutputFilesWrite", "afterOutputFilesWrite");
124717
- finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime,
124718
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124897
+ finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124719
124898
  return emitResult;
124720
124899
  }
124721
124900
  function emitBuildInfo(writeFileCallback, cancellationToken) {
124722
124901
  ts.Debug.assertIsDefined(program);
124723
124902
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
124724
- var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
124903
+ var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
124904
+ if (data === null || data === void 0 ? void 0 : data.buildInfo)
124905
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
124906
+ if (writeFileCallback)
124907
+ writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
124908
+ else
124909
+ state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
124910
+ }, cancellationToken);
124725
124911
  if (emitResult.diagnostics.length) {
124726
124912
  reportErrors(state, emitResult.diagnostics);
124727
124913
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -124734,7 +124920,7 @@ var ts;
124734
124920
  step = BuildStep.QueueReferencingProjects;
124735
124921
  return emitResult;
124736
124922
  }
124737
- function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
124923
+ function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
124738
124924
  var _a;
124739
124925
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
124740
124926
  if (emitDiagnostics.length) {
@@ -124745,13 +124931,11 @@ var ts;
124745
124931
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
124746
124932
  }
124747
124933
  // Update time stamps for rest of the outputs
124748
- var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124934
+ updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124749
124935
  state.diagnostics.delete(projectPath);
124750
124936
  state.projectStatus.set(projectPath, {
124751
124937
  type: ts.UpToDateStatusType.UpToDate,
124752
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
124753
- maximumDate :
124754
- newestDeclarationFileContentChangedTime,
124938
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
124755
124939
  oldestOutputFileName: oldestOutputFileName
124756
124940
  });
124757
124941
  afterProgramDone(state, program, config);
@@ -124786,13 +124970,21 @@ var ts;
124786
124970
  ts.Debug.assert(!!outputFiles.length);
124787
124971
  var emitterDiagnostics = ts.createDiagnosticCollection();
124788
124972
  var emittedOutputs = new ts.Map();
124973
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124974
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
124789
124975
  outputFiles.forEach(function (_a) {
124790
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124976
+ var _b, _c;
124977
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124791
124978
  emittedOutputs.set(toPath(state, name), name);
124979
+ if (buildInfo) {
124980
+ setBuildInfo(state, buildInfo, projectPath, config.options);
124981
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
124982
+ resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124983
+ }
124984
+ }
124792
124985
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124793
124986
  });
124794
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate,
124795
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
124987
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
124796
124988
  return { emitSkipped: false, diagnostics: emitDiagnostics };
124797
124989
  }
124798
124990
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -124898,7 +125090,7 @@ var ts;
124898
125090
  }
124899
125091
  continue;
124900
125092
  }
124901
- if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
125093
+ if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
124902
125094
  reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
124903
125095
  return {
124904
125096
  kind: InvalidatedProjectKind.UpdateOutputFileStamps,
@@ -124984,7 +125176,7 @@ var ts;
124984
125176
  state.projectCompilerOptions = state.baseCompilerOptions;
124985
125177
  }
124986
125178
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
124987
- var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
125179
+ var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
124988
125180
  reportAndStoreErrors(state, resolvedPath, diagnostics);
124989
125181
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
124990
125182
  if (canEmitBuildInfo)
@@ -124992,9 +125184,101 @@ var ts;
124992
125184
  afterProgramDone(state, program, config);
124993
125185
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
124994
125186
  }
125187
+ function isFileWatcherWithModifiedTime(value) {
125188
+ return !!value.watcher;
125189
+ }
125190
+ function getModifiedTime(state, fileName) {
125191
+ var path = toPath(state, fileName);
125192
+ var existing = state.filesWatched.get(path);
125193
+ if (state.watch && !!existing) {
125194
+ if (!isFileWatcherWithModifiedTime(existing))
125195
+ return existing;
125196
+ if (existing.modifiedTime)
125197
+ return existing.modifiedTime;
125198
+ }
125199
+ var result = ts.getModifiedTime(state.host, fileName);
125200
+ if (state.watch) {
125201
+ if (existing)
125202
+ existing.modifiedTime = result;
125203
+ else
125204
+ state.filesWatched.set(path, result);
125205
+ }
125206
+ return result;
125207
+ }
125208
+ function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
125209
+ var path = toPath(state, file);
125210
+ var existing = state.filesWatched.get(path);
125211
+ if (existing && isFileWatcherWithModifiedTime(existing)) {
125212
+ existing.callbacks.push(callback);
125213
+ }
125214
+ else {
125215
+ var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
125216
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
125217
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
125218
+ existing.modifiedTime = modifiedTime;
125219
+ existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
125220
+ }, pollingInterval, options, watchType, project);
125221
+ state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
125222
+ }
125223
+ return {
125224
+ close: function () {
125225
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
125226
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
125227
+ if (existing.callbacks.length === 1) {
125228
+ state.filesWatched.delete(path);
125229
+ ts.closeFileWatcherOf(existing);
125230
+ }
125231
+ else {
125232
+ ts.unorderedRemoveItem(existing.callbacks, callback);
125233
+ }
125234
+ }
125235
+ };
125236
+ }
125237
+ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
125238
+ if (!state.watch)
125239
+ return undefined;
125240
+ var result = state.outputTimeStamps.get(resolvedConfigFilePath);
125241
+ if (!result)
125242
+ state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
125243
+ return result;
125244
+ }
125245
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
125246
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125247
+ var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
125248
+ if (existing) {
125249
+ existing.buildInfo = buildInfo;
125250
+ existing.modifiedTime = getCurrentTime(state.host);
125251
+ }
125252
+ else {
125253
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
125254
+ }
125255
+ }
125256
+ function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
125257
+ var path = toPath(state, buildInfoPath);
125258
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
125259
+ return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
125260
+ }
125261
+ function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
125262
+ var path = toPath(state, buildInfoPath);
125263
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
125264
+ if (existing !== undefined && existing.path === path) {
125265
+ return existing.buildInfo || undefined;
125266
+ }
125267
+ ts.solutionPerformance.mark("beforeGetBuildInfo");
125268
+ ts.solutionPerformance.mark("beforeBuildInfoRead");
125269
+ var value = state.readFileWithCache(buildInfoPath);
125270
+ ts.solutionPerformance.mark("afterBuildInfoRead");
125271
+ ts.solutionPerformance.measure("BuildInfoRead", "beforeBuildInfoRead", "afterBuildInfoRead");
125272
+ var buildInfo = value ? ts.getBuildInfo(value) : undefined;
125273
+ ts.Debug.assert(modifiedTime || !buildInfo);
125274
+ state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
125275
+ ts.solutionPerformance.mark("afterGetBuildInfo");
125276
+ ts.solutionPerformance.measure("GetBuildInfo", "beforeGetBuildInfo", "afterGetBuildInfo");
125277
+ return buildInfo;
125278
+ }
124995
125279
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
124996
125280
  // Check tsconfig time
124997
- var tsconfigTime = ts.getModifiedTime(state.host, configFile);
125281
+ var tsconfigTime = getModifiedTime(state, configFile);
124998
125282
  if (oldestOutputFileTime < tsconfigTime) {
124999
125283
  return {
125000
125284
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -125004,88 +125288,24 @@ var ts;
125004
125288
  }
125005
125289
  }
125006
125290
  function getUpToDateStatusWorker(state, project, resolvedPath) {
125007
- var force = !!state.options.force;
125008
- var newestInputFileName = undefined;
125009
- var newestInputFileTime = minimumDate;
125010
- var host = state.host;
125011
- // Get timestamps of input files
125012
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
125013
- var inputFile = _a[_i];
125014
- if (!host.fileExists(inputFile)) {
125015
- return {
125016
- type: ts.UpToDateStatusType.Unbuildable,
125017
- reason: inputFile + " does not exist"
125018
- };
125019
- }
125020
- if (!force) {
125021
- var inputTime = ts.getModifiedTime(host, inputFile);
125022
- if (inputTime > newestInputFileTime) {
125023
- newestInputFileName = inputFile;
125024
- newestInputFileTime = inputTime;
125025
- }
125026
- }
125027
- }
125291
+ var _a, _b, _c;
125028
125292
  // Container if no files are specified in the project
125029
125293
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
125030
125294
  return {
125031
125295
  type: ts.UpToDateStatusType.ContainerOnly
125032
125296
  };
125033
125297
  }
125034
- // Collect the expected outputs of this project
125035
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
125036
- // Now see if all outputs are newer than the newest input
125037
- var oldestOutputFileName = "(none)";
125038
- var oldestOutputFileTime = maximumDate;
125039
- var newestOutputFileName = "(none)";
125040
- var newestOutputFileTime = minimumDate;
125041
- var missingOutputFileName;
125042
- var newestDeclarationFileContentChangedTime = minimumDate;
125043
- var isOutOfDateWithInputs = false;
125044
- if (!force) {
125045
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
125046
- var output = outputs_1[_b];
125047
- // Output is missing; can stop checking
125048
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
125049
- if (!host.fileExists(output)) {
125050
- missingOutputFileName = output;
125051
- break;
125052
- }
125053
- var outputTime = ts.getModifiedTime(host, output);
125054
- if (outputTime < oldestOutputFileTime) {
125055
- oldestOutputFileTime = outputTime;
125056
- oldestOutputFileName = output;
125057
- }
125058
- // If an output is older than the newest input, we can stop checking
125059
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
125060
- if (outputTime < newestInputFileTime) {
125061
- isOutOfDateWithInputs = true;
125062
- break;
125063
- }
125064
- if (outputTime > newestOutputFileTime) {
125065
- newestOutputFileTime = outputTime;
125066
- newestOutputFileName = output;
125067
- }
125068
- // Keep track of when the most recent time a .d.ts file was changed.
125069
- // In addition to file timestamps, we also keep track of when a .d.ts file
125070
- // had its file touched but not had its contents changed - this allows us
125071
- // to skip a downstream typecheck
125072
- if (ts.isDeclarationFileName(output)) {
125073
- var outputModifiedTime = ts.getModifiedTime(host, output);
125074
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
125075
- }
125076
- }
125077
- }
125078
- var pseudoUpToDate = false;
125079
- var usesPrepend = false;
125080
- var upstreamChangedProject;
125298
+ // Fast check to see if reference projects are buildable
125299
+ var referenceStatuses;
125300
+ var force = !!state.options.force;
125081
125301
  if (project.projectReferences) {
125082
125302
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
125083
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
125084
- var ref = _d[_c];
125085
- usesPrepend = usesPrepend || !!(ref.prepend);
125303
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
125304
+ var ref = _d[_i];
125086
125305
  var resolvedRef = ts.resolveProjectReferencePath(ref);
125087
125306
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
125088
- var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
125307
+ var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
125308
+ var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
125089
125309
  // Its a circular reference ignore the status of this project
125090
125310
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
125091
125311
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) { // Container only ignore this project
@@ -125107,78 +125327,188 @@ var ts;
125107
125327
  upstreamProjectName: ref.path
125108
125328
  };
125109
125329
  }
125110
- // Check oldest output file name only if there is no missing output file name
125111
- // (a check we will have skipped if this is a forced build)
125112
- if (!force && !missingOutputFileName) {
125113
- // If the upstream project's newest file is older than our oldest output, we
125114
- // can't be out of date because of it
125115
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
125116
- continue;
125117
- }
125118
- // If the upstream project has only change .d.ts files, and we've built
125119
- // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
125120
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
125121
- pseudoUpToDate = true;
125122
- upstreamChangedProject = ref.path;
125123
- continue;
125124
- }
125125
- // We have an output older than an upstream output - we are out of date
125126
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125330
+ if (!force)
125331
+ (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
125332
+ }
125333
+ }
125334
+ if (force)
125335
+ return { type: ts.UpToDateStatusType.ForceBuild };
125336
+ // Check buildinfo first
125337
+ var host = state.host;
125338
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125339
+ var oldestOutputFileName = "(none)";
125340
+ var oldestOutputFileTime = maximumDate;
125341
+ var buildInfoTime;
125342
+ var buildInfoProgram;
125343
+ var buildInfoVersionMap;
125344
+ var newestDeclarationFileContentChangedTime;
125345
+ if (buildInfoPath) {
125346
+ var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
125347
+ buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
125348
+ if (buildInfoTime === ts.missingFileModifiedTime) {
125349
+ if (!buildInfoCacheEntry_1) {
125350
+ state.buildInfoCache.set(resolvedPath, {
125351
+ path: toPath(state, buildInfoPath),
125352
+ buildInfo: false,
125353
+ modifiedTime: buildInfoTime
125354
+ });
125355
+ }
125356
+ return {
125357
+ type: ts.UpToDateStatusType.OutputMissing,
125358
+ missingOutputFileName: buildInfoPath
125359
+ };
125360
+ }
125361
+ var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
125362
+ if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125363
+ return {
125364
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
125365
+ version: buildInfo.version
125366
+ };
125367
+ }
125368
+ if (buildInfo.program) {
125369
+ if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
125370
+ (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
125127
125371
  return {
125128
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125129
- outOfDateOutputFileName: oldestOutputFileName,
125130
- newerProjectName: ref.path
125372
+ type: ts.UpToDateStatusType.OutOfDateBuildInfo,
125373
+ buildInfoFile: buildInfoPath
125131
125374
  };
125132
125375
  }
125376
+ buildInfoProgram = buildInfo.program;
125133
125377
  }
125378
+ oldestOutputFileTime = buildInfoTime;
125379
+ oldestOutputFileName = buildInfoPath;
125380
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
125134
125381
  }
125135
- if (missingOutputFileName !== undefined) {
125136
- return {
125137
- type: ts.UpToDateStatusType.OutputMissing,
125138
- missingOutputFileName: missingOutputFileName
125139
- };
125382
+ // Check input files
125383
+ var newestInputFileName = undefined;
125384
+ var newestInputFileTime = minimumDate;
125385
+ var pseudoInputUptodate = false;
125386
+ // Get timestamps of input files
125387
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
125388
+ var inputFile = _f[_e];
125389
+ var inputTime = getModifiedTime(state, inputFile);
125390
+ if (inputTime === ts.missingFileModifiedTime) {
125391
+ return {
125392
+ type: ts.UpToDateStatusType.Unbuildable,
125393
+ reason: inputFile + " does not exist"
125394
+ };
125395
+ }
125396
+ // If an buildInfo is older than the newest input, we can stop checking
125397
+ if (buildInfoTime && buildInfoTime < inputTime) {
125398
+ var version_3 = void 0;
125399
+ var currentVersion = void 0;
125400
+ if (buildInfoProgram) {
125401
+ // Read files and see if they are same, read is anyways cached
125402
+ if (!buildInfoVersionMap)
125403
+ buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
125404
+ version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
125405
+ var text = version_3 ? state.readFileWithCache(inputFile) : undefined;
125406
+ currentVersion = text && (host.createHash || ts.generateDjb2Hash)(text);
125407
+ if (version_3 && version_3 === currentVersion)
125408
+ pseudoInputUptodate = true;
125409
+ }
125410
+ if (!version_3 || version_3 !== currentVersion) {
125411
+ return {
125412
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125413
+ outOfDateOutputFileName: buildInfoPath,
125414
+ newerInputFileName: inputFile
125415
+ };
125416
+ }
125417
+ }
125418
+ if (inputTime > newestInputFileTime) {
125419
+ newestInputFileName = inputFile;
125420
+ newestInputFileTime = inputTime;
125421
+ }
125140
125422
  }
125141
- if (isOutOfDateWithInputs) {
125142
- return {
125143
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
125144
- outOfDateOutputFileName: oldestOutputFileName,
125145
- newerInputFileName: newestInputFileName
125146
- };
125423
+ // Now see if all outputs are newer than the newest input
125424
+ // Dont check output timestamps if we have buildinfo telling us output is uptodate
125425
+ if (!buildInfoPath) {
125426
+ // Collect the expected outputs of this project
125427
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
125428
+ var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
125429
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
125430
+ var output = outputs_1[_g];
125431
+ var path = toPath(state, output);
125432
+ // Output is missing; can stop checking
125433
+ var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
125434
+ if (!outputTime) {
125435
+ outputTime = ts.getModifiedTime(state.host, output);
125436
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
125437
+ }
125438
+ if (outputTime === ts.missingFileModifiedTime) {
125439
+ return {
125440
+ type: ts.UpToDateStatusType.OutputMissing,
125441
+ missingOutputFileName: output
125442
+ };
125443
+ }
125444
+ if (outputTime < oldestOutputFileTime) {
125445
+ oldestOutputFileTime = outputTime;
125446
+ oldestOutputFileName = output;
125447
+ }
125448
+ // If an output is older than the newest input, we can stop checking
125449
+ if (outputTime < newestInputFileTime) {
125450
+ return {
125451
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125452
+ outOfDateOutputFileName: oldestOutputFileName,
125453
+ newerInputFileName: newestInputFileName
125454
+ };
125455
+ }
125456
+ }
125147
125457
  }
125148
- else {
125149
- // Check tsconfig time
125150
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125151
- if (configStatus)
125152
- return configStatus;
125153
- // Check extended config time
125154
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125155
- if (extendedConfigStatus)
125156
- return extendedConfigStatus;
125157
- // Check package file time
125158
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125159
- var path = _a[0];
125160
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125161
- });
125162
- if (dependentPackageFileStatus)
125163
- return dependentPackageFileStatus;
125164
- }
125165
- if (!force && !state.buildInfoChecked.has(resolvedPath)) {
125166
- state.buildInfoChecked.set(resolvedPath, true);
125167
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125168
- if (buildInfoPath) {
125169
- ts.solutionPerformance.mark("beforeBuildInfoRead");
125170
- var value = state.readFileWithCache(buildInfoPath);
125171
- ts.solutionPerformance.mark("afterBuildInfoRead");
125172
- ts.solutionPerformance.measure("BuildInfoRead", "beforeBuildInfoRead", "afterBuildInfoRead");
125173
- var buildInfo = value && ts.getBuildInfo(value);
125174
- if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125458
+ var seenRefs = buildInfoPath ? new ts.Set() : undefined;
125459
+ var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
125460
+ seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
125461
+ var pseudoUpToDate = false;
125462
+ var usesPrepend = false;
125463
+ var upstreamChangedProject;
125464
+ if (referenceStatuses) {
125465
+ for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
125466
+ var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
125467
+ usesPrepend = usesPrepend || !!(ref.prepend);
125468
+ // If the upstream project's newest file is older than our oldest output, we
125469
+ // can't be out of date because of it
125470
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
125471
+ continue;
125472
+ }
125473
+ // Check if tsbuildinfo path is shared, then we need to rebuild
125474
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
125175
125475
  return {
125176
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
125177
- version: buildInfo.version
125476
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125477
+ outOfDateOutputFileName: buildInfoPath,
125478
+ newerProjectName: ref.path
125178
125479
  };
125179
125480
  }
125481
+ // If the upstream project has only change .d.ts files, and we've built
125482
+ // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
125483
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
125484
+ pseudoUpToDate = true;
125485
+ upstreamChangedProject = ref.path;
125486
+ continue;
125487
+ }
125488
+ // We have an output older than an upstream output - we are out of date
125489
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125490
+ return {
125491
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125492
+ outOfDateOutputFileName: oldestOutputFileName,
125493
+ newerProjectName: ref.path
125494
+ };
125180
125495
  }
125181
125496
  }
125497
+ // Check tsconfig time
125498
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125499
+ if (configStatus)
125500
+ return configStatus;
125501
+ // Check extended config time
125502
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125503
+ if (extendedConfigStatus)
125504
+ return extendedConfigStatus;
125505
+ // Check package file time
125506
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125507
+ var path = _a[0];
125508
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125509
+ });
125510
+ if (dependentPackageFileStatus)
125511
+ return dependentPackageFileStatus;
125182
125512
  if (usesPrepend && pseudoUpToDate) {
125183
125513
  return {
125184
125514
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -125188,15 +125518,37 @@ var ts;
125188
125518
  }
125189
125519
  // Up to date
125190
125520
  return {
125191
- type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
125521
+ type: pseudoUpToDate ?
125522
+ ts.UpToDateStatusType.UpToDateWithUpstreamTypes :
125523
+ pseudoInputUptodate ?
125524
+ ts.UpToDateStatusType.UpToDateWithInputFileText :
125525
+ ts.UpToDateStatusType.UpToDate,
125192
125526
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
125193
125527
  newestInputFileTime: newestInputFileTime,
125194
- newestOutputFileTime: newestOutputFileTime,
125195
125528
  newestInputFileName: newestInputFileName,
125196
- newestOutputFileName: newestOutputFileName,
125197
125529
  oldestOutputFileName: oldestOutputFileName
125198
125530
  };
125199
125531
  }
125532
+ function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
125533
+ if (seenRefs.has(resolvedRefPath))
125534
+ return false;
125535
+ seenRefs.add(resolvedRefPath);
125536
+ var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
125537
+ if (refBuildInfo.path === buildInfoCacheEntry.path)
125538
+ return true;
125539
+ if (resolvedConfig.projectReferences) {
125540
+ // Check references
125541
+ for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
125542
+ var ref = _a[_i];
125543
+ var resolvedRef = ts.resolveProjectReferencePath(ref);
125544
+ var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
125545
+ var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
125546
+ if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
125547
+ return true;
125548
+ }
125549
+ }
125550
+ return false;
125551
+ }
125200
125552
  function getUpToDateStatus(state, project, resolvedPath) {
125201
125553
  if (project === undefined) {
125202
125554
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -125212,42 +125564,69 @@ var ts;
125212
125564
  state.projectStatus.set(resolvedPath, actual);
125213
125565
  return actual;
125214
125566
  }
125215
- function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
125567
+ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
125216
125568
  if (proj.options.noEmit)
125217
- return priorNewestUpdateTime;
125569
+ return;
125570
+ var now;
125218
125571
  ts.solutionPerformance.mark("beforeUpdateOutputTimestamps");
125219
- var host = state.host;
125220
- var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125221
- if (!skipOutputs || outputs.length !== skipOutputs.size) {
125222
- var reportVerbose = !!state.options.verbose;
125223
- var now = host.now ? host.now() : new Date();
125224
- for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125225
- var file = outputs_2[_i];
125226
- if (skipOutputs && skipOutputs.has(toPath(state, file))) {
125227
- continue;
125228
- }
125229
- if (reportVerbose) {
125230
- reportVerbose = false;
125572
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
125573
+ if (buildInfoPath) {
125574
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
125575
+ if (!!state.options.verbose)
125231
125576
  reportStatus(state, verboseMessage, proj.options.configFilePath);
125577
+ state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
125578
+ getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
125579
+ }
125580
+ state.outputTimeStamps.delete(projectPath);
125581
+ }
125582
+ else {
125583
+ var host = state.host;
125584
+ var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125585
+ var outputTimeStampMap_1 = getOutputTimeStampMap(state, projectPath);
125586
+ var modifiedOutputs_1 = outputTimeStampMap_1 ? new ts.Set() : undefined;
125587
+ if (!skipOutputs || outputs.length !== skipOutputs.size) {
125588
+ var reportVerbose = !!state.options.verbose;
125589
+ for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125590
+ var file = outputs_2[_i];
125591
+ var path = toPath(state, file);
125592
+ if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
125593
+ continue;
125594
+ if (reportVerbose) {
125595
+ reportVerbose = false;
125596
+ reportStatus(state, verboseMessage, proj.options.configFilePath);
125597
+ }
125598
+ host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
125599
+ if (outputTimeStampMap_1) {
125600
+ outputTimeStampMap_1.set(path, now);
125601
+ modifiedOutputs_1.add(path);
125602
+ }
125232
125603
  }
125233
- if (ts.isDeclarationFileName(file)) {
125234
- priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
125235
- }
125236
- host.setModifiedTime(file, now);
125237
125604
  }
125605
+ // Clear out timestamps not in output list any more
125606
+ outputTimeStampMap_1 === null || outputTimeStampMap_1 === void 0 ? void 0 : outputTimeStampMap_1.forEach(function (_value, key) {
125607
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs_1.has(key))
125608
+ outputTimeStampMap_1.delete(key);
125609
+ });
125238
125610
  }
125239
125611
  ts.solutionPerformance.mark("afterUpdateOutputTimestamps");
125240
125612
  ts.solutionPerformance.measure("UpdateOutputTimestamps", "beforeUpdateOutputTimestamps", "afterUpdateOutputTimestamps");
125241
- return priorNewestUpdateTime;
125613
+ }
125614
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
125615
+ var _a;
125616
+ if (!options.composite)
125617
+ return undefined;
125618
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125619
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, /*modifiedTime*/ undefined);
125620
+ 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;
125242
125621
  }
125243
125622
  function updateOutputTimestamps(state, proj, resolvedPath) {
125244
125623
  if (state.options.dry) {
125245
125624
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
125246
125625
  }
125247
- var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125626
+ updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125248
125627
  state.projectStatus.set(resolvedPath, {
125249
125628
  type: ts.UpToDateStatusType.UpToDate,
125250
- newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
125629
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
125251
125630
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
125252
125631
  });
125253
125632
  }
@@ -125293,6 +125672,7 @@ var ts;
125293
125672
  break;
125294
125673
  }
125295
125674
  // falls through
125675
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
125296
125676
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125297
125677
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
125298
125678
  if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
@@ -125477,12 +125857,10 @@ var ts;
125477
125857
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
125478
125858
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
125479
125859
  return;
125480
- state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
125481
- invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
125482
- }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
125860
+ 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));
125483
125861
  }
125484
125862
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
125485
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
125863
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
125486
125864
  var _a;
125487
125865
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
125488
125866
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -125514,7 +125892,7 @@ var ts;
125514
125892
  if (!state.watch)
125515
125893
  return;
125516
125894
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
125517
- 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); },
125895
+ 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); },
125518
125896
  onDeleteValue: ts.closeFileWatcher,
125519
125897
  });
125520
125898
  }
@@ -125522,7 +125900,7 @@ var ts;
125522
125900
  if (!state.watch || !state.lastCachedPackageJsonLookups)
125523
125901
  return;
125524
125902
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
125525
- 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); },
125903
+ 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); },
125526
125904
  onDeleteValue: ts.closeFileWatcher,
125527
125905
  });
125528
125906
  }
@@ -125655,19 +126033,18 @@ var ts;
125655
126033
  }
125656
126034
  }
125657
126035
  function reportUpToDateStatus(state, configFileName, status) {
125658
- if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
125659
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125660
- }
125661
126036
  switch (status.type) {
125662
126037
  case ts.UpToDateStatusType.OutOfDateWithSelf:
125663
- 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));
126038
+ 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));
125664
126039
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
125665
- 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));
126040
+ 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));
125666
126041
  case ts.UpToDateStatusType.OutputMissing:
125667
126042
  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));
126043
+ case ts.UpToDateStatusType.OutOfDateBuildInfo:
126044
+ 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));
125668
126045
  case ts.UpToDateStatusType.UpToDate:
125669
126046
  if (status.newestInputFileTime !== undefined) {
125670
- 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 || ""));
126047
+ 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 || ""));
125671
126048
  }
125672
126049
  // Don't report anything for "up to date because it was already built" -- too verbose
125673
126050
  break;
@@ -125675,6 +126052,8 @@ var ts;
125675
126052
  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));
125676
126053
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125677
126054
  return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
126055
+ case ts.UpToDateStatusType.UpToDateWithInputFileText:
126056
+ 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));
125678
126057
  case ts.UpToDateStatusType.UpstreamOutOfDate:
125679
126058
  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));
125680
126059
  case ts.UpToDateStatusType.UpstreamBlocked:
@@ -125685,6 +126064,8 @@ var ts;
125685
126064
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
125686
126065
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
125687
126066
  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);
126067
+ case ts.UpToDateStatusType.ForceBuild:
126068
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125688
126069
  case ts.UpToDateStatusType.ContainerOnly:
125689
126070
  // Don't report status on "solution" projects
125690
126071
  // falls through