@typescript-deploys/pr-build 4.8.0-pr-48784-20 → 4.8.0-pr-49285-8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsserver.js CHANGED
@@ -6211,7 +6211,7 @@ var ts;
6211
6211
  };
6212
6212
  }
6213
6213
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
6214
- var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName, modifiedTime) {
6214
+ var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName) {
6215
6215
  // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
6216
6216
  if (!ts.isString(relativeFileName))
6217
6217
  return;
@@ -6221,7 +6221,7 @@ var ts;
6221
6221
  if (callbacks) {
6222
6222
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
6223
6223
  var fileCallback = callbacks_1[_i];
6224
- fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6224
+ fileCallback(fileName, FileWatcherEventKind.Changed);
6225
6225
  }
6226
6226
  }
6227
6227
  },
@@ -6275,7 +6275,7 @@ var ts;
6275
6275
  }
6276
6276
  else {
6277
6277
  cache.set(path, {
6278
- watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6278
+ watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
6279
6279
  refCount: 1
6280
6280
  });
6281
6281
  }
@@ -6303,7 +6303,7 @@ var ts;
6303
6303
  var newTime = modifiedTime.getTime();
6304
6304
  if (oldTime !== newTime) {
6305
6305
  watchedFile.mtime = modifiedTime;
6306
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
6306
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
6307
6307
  return true;
6308
6308
  }
6309
6309
  return false;
@@ -6554,18 +6554,17 @@ var ts;
6554
6554
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6555
6555
  /*@internal*/
6556
6556
  function createFileWatcherCallback(callback) {
6557
- return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6557
+ return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
6558
6558
  }
6559
6559
  ts.createFileWatcherCallback = createFileWatcherCallback;
6560
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6561
- return function (eventName, _relativeFileName, modifiedTime) {
6560
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists) {
6561
+ return function (eventName) {
6562
6562
  if (eventName === "rename") {
6563
- modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
6564
- callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
6563
+ callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6565
6564
  }
6566
6565
  else {
6567
6566
  // Change
6568
- callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6567
+ callback(fileName, FileWatcherEventKind.Changed);
6569
6568
  }
6570
6569
  };
6571
6570
  }
@@ -6589,7 +6588,7 @@ var ts;
6589
6588
  }
6590
6589
  /*@internal*/
6591
6590
  function createSystemWatchFunctions(_a) {
6592
- 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;
6591
+ 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;
6593
6592
  var dynamicPollingWatchFile;
6594
6593
  var fixedChunkSizePollingWatchFile;
6595
6594
  var nonPollingWatchFile;
@@ -6611,7 +6610,7 @@ var ts;
6611
6610
  case ts.WatchFileKind.FixedChunkSizePolling:
6612
6611
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, /* pollingInterval */ undefined, /*options*/ undefined);
6613
6612
  case ts.WatchFileKind.UseFsEvents:
6614
- return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime),
6613
+ return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists),
6615
6614
  /*recursive*/ false, pollingInterval, ts.getFallbackOptions(options));
6616
6615
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
6617
6616
  if (!nonPollingWatchFile) {
@@ -6793,6 +6792,7 @@ var ts;
6793
6792
  fsWatch: fsWatch,
6794
6793
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6795
6794
  getCurrentDirectory: getCurrentDirectory,
6795
+ fileExists: fileExists,
6796
6796
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
6797
6797
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
6798
6798
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
@@ -7052,7 +7052,7 @@ var ts;
7052
7052
  // File changed
7053
7053
  eventKind = FileWatcherEventKind.Changed;
7054
7054
  }
7055
- callback(fileName, eventKind, curr.mtime);
7055
+ callback(fileName, eventKind);
7056
7056
  }
7057
7057
  }
7058
7058
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
@@ -7078,10 +7078,10 @@ var ts;
7078
7078
  * Invoke the callback with rename and update the watcher if not closed
7079
7079
  * @param createWatcher
7080
7080
  */
7081
- function invokeCallbackAndUpdateWatcher(createWatcher, modifiedTime) {
7081
+ function invokeCallbackAndUpdateWatcher(createWatcher) {
7082
7082
  sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
7083
7083
  // Call the callback for current directory
7084
- callback("rename", "", modifiedTime);
7084
+ callback("rename", "");
7085
7085
  // If watcher is not closed, update it
7086
7086
  if (watcher) {
7087
7087
  watcher.close();
@@ -7127,14 +7127,13 @@ var ts;
7127
7127
  function callbackChangingToMissingFileSystemEntry(event, relativeName) {
7128
7128
  // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
7129
7129
  // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
7130
- var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
7131
7130
  return event === "rename" &&
7132
7131
  (!relativeName ||
7133
7132
  relativeName === lastDirectoryPart ||
7134
7133
  (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
7135
- modifiedTime === ts.missingFileModifiedTime ?
7136
- invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry, modifiedTime) :
7137
- callback(event, relativeName, modifiedTime);
7134
+ !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7135
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
7136
+ callback(event, relativeName);
7138
7137
  }
7139
7138
  /**
7140
7139
  * Watch the file or directory using fs.watchFile since fs.watch threw exception
@@ -7148,15 +7147,12 @@ var ts;
7148
7147
  * and switch to existing file or directory when the missing filesystem entry is created
7149
7148
  */
7150
7149
  function watchMissingFileSystemEntry() {
7151
- return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
7152
- if (eventKind === FileWatcherEventKind.Created) {
7153
- modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
7154
- if (modifiedTime !== ts.missingFileModifiedTime) {
7155
- // Call the callback for current file or directory
7156
- // For now it could be callback for the inner directory creation,
7157
- // but just return current directory, better than current no-op
7158
- invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry, modifiedTime);
7159
- }
7150
+ return watchFile(fileOrDirectory, function (_fileName, eventKind) {
7151
+ if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
7152
+ // Call the callback for current file or directory
7153
+ // For now it could be callback for the inner directory creation,
7154
+ // but just return current directory, better than current no-op
7155
+ invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
7160
7156
  }
7161
7157
  }, fallbackPollingInterval, fallbackOptions);
7162
7158
  }
@@ -7306,19 +7302,12 @@ var ts;
7306
7302
  }
7307
7303
  function getModifiedTime(path) {
7308
7304
  var _a;
7309
- // Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
7310
- // the CPU time performance.
7311
- var originalStackTraceLimit = Error.stackTraceLimit;
7312
- Error.stackTraceLimit = 0;
7313
7305
  try {
7314
7306
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
7315
7307
  }
7316
7308
  catch (e) {
7317
7309
  return undefined;
7318
7310
  }
7319
- finally {
7320
- Error.stackTraceLimit = originalStackTraceLimit;
7321
- }
7322
7311
  }
7323
7312
  function setModifiedTime(path, time) {
7324
7313
  try {
@@ -9341,8 +9330,8 @@ var ts;
9341
9330
  Cannot_prepend_project_0_because_it_does_not_have_outFile_set: diag(6308, ts.DiagnosticCategory.Error, "Cannot_prepend_project_0_because_it_does_not_have_outFile_set_6308", "Cannot prepend project '{0}' because it does not have 'outFile' set"),
9342
9331
  Output_file_0_from_project_1_does_not_exist: diag(6309, ts.DiagnosticCategory.Error, "Output_file_0_from_project_1_does_not_exist_6309", "Output file '{0}' from project '{1}' does not exist"),
9343
9332
  Referenced_project_0_may_not_disable_emit: diag(6310, ts.DiagnosticCategory.Error, "Referenced_project_0_may_not_disable_emit_6310", "Referenced project '{0}' may not disable emit."),
9344
- 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}'"),
9345
- 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}'"),
9333
+ 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}'"),
9334
+ 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}'"),
9346
9335
  Project_0_is_out_of_date_because_output_file_1_does_not_exist: diag(6352, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352", "Project '{0}' is out of date because output file '{1}' does not exist"),
9347
9336
  Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date: diag(6353, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353", "Project '{0}' is out of date because its dependency '{1}' is out of date"),
9348
9337
  Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies: diag(6354, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354", "Project '{0}' is up to date with .d.ts files from its dependencies"),
@@ -9386,8 +9375,6 @@ var ts;
9386
9375
  Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3: diag(6396, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6396", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}'."),
9387
9376
  Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4: diag(6397, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6397", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}' with Package ID '{4}'."),
9388
9377
  Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."),
9389
- 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"),
9390
- 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"),
9391
9378
  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}'"),
9392
9379
  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."),
9393
9380
  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."),
@@ -20218,10 +20205,6 @@ var ts;
20218
20205
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
20219
20206
  }
20220
20207
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
20221
- function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
20222
- return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
20223
- }
20224
- ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
20225
20208
  function getCompilerOptionValue(options, option) {
20226
20209
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
20227
20210
  }
@@ -39262,7 +39245,6 @@ var ts;
39262
39245
  type: "boolean",
39263
39246
  affectsSemanticDiagnostics: true,
39264
39247
  affectsEmit: true,
39265
- affectsMultiFileEmitBuildInfo: true,
39266
39248
  category: ts.Diagnostics.Watch_and_Build_Modes,
39267
39249
  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,
39268
39250
  defaultValueDescription: false,
@@ -39297,40 +39279,12 @@ var ts;
39297
39279
  affectsSourceFile: true,
39298
39280
  affectsModuleResolution: true,
39299
39281
  affectsEmit: true,
39300
- affectsMultiFileEmitBuildInfo: true,
39301
39282
  paramType: ts.Diagnostics.VERSION,
39302
39283
  showInSimplifiedHelpView: true,
39303
39284
  category: ts.Diagnostics.Language_and_Environment,
39304
39285
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
39305
39286
  defaultValueDescription: 0 /* ES3 */,
39306
39287
  };
39307
- /*@internal*/
39308
- ts.moduleOptionDeclaration = {
39309
- name: "module",
39310
- shortName: "m",
39311
- type: new ts.Map(ts.getEntries({
39312
- none: ts.ModuleKind.None,
39313
- commonjs: ts.ModuleKind.CommonJS,
39314
- amd: ts.ModuleKind.AMD,
39315
- system: ts.ModuleKind.System,
39316
- umd: ts.ModuleKind.UMD,
39317
- es6: ts.ModuleKind.ES2015,
39318
- es2015: ts.ModuleKind.ES2015,
39319
- es2020: ts.ModuleKind.ES2020,
39320
- es2022: ts.ModuleKind.ES2022,
39321
- esnext: ts.ModuleKind.ESNext,
39322
- node16: ts.ModuleKind.Node16,
39323
- nodenext: ts.ModuleKind.NodeNext,
39324
- })),
39325
- affectsModuleResolution: true,
39326
- affectsEmit: true,
39327
- affectsMultiFileEmitBuildInfo: true,
39328
- paramType: ts.Diagnostics.KIND,
39329
- showInSimplifiedHelpView: true,
39330
- category: ts.Diagnostics.Modules,
39331
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
39332
- defaultValueDescription: undefined,
39333
- };
39334
39288
  var commandOptionsWithoutBuild = [
39335
39289
  // CommandLine only options
39336
39290
  {
@@ -39392,14 +39346,37 @@ var ts;
39392
39346
  category: ts.Diagnostics.Command_line_Options,
39393
39347
  affectsSemanticDiagnostics: true,
39394
39348
  affectsEmit: true,
39395
- affectsMultiFileEmitBuildInfo: true,
39396
39349
  isCommandLineOnly: true,
39397
39350
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
39398
39351
  defaultValueDescription: false,
39399
39352
  },
39400
39353
  // Basic
39401
39354
  ts.targetOptionDeclaration,
39402
- ts.moduleOptionDeclaration,
39355
+ {
39356
+ name: "module",
39357
+ shortName: "m",
39358
+ type: new ts.Map(ts.getEntries({
39359
+ none: ts.ModuleKind.None,
39360
+ commonjs: ts.ModuleKind.CommonJS,
39361
+ amd: ts.ModuleKind.AMD,
39362
+ system: ts.ModuleKind.System,
39363
+ umd: ts.ModuleKind.UMD,
39364
+ es6: ts.ModuleKind.ES2015,
39365
+ es2015: ts.ModuleKind.ES2015,
39366
+ es2020: ts.ModuleKind.ES2020,
39367
+ es2022: ts.ModuleKind.ES2022,
39368
+ esnext: ts.ModuleKind.ESNext,
39369
+ node16: ts.ModuleKind.Node16,
39370
+ nodenext: ts.ModuleKind.NodeNext,
39371
+ })),
39372
+ affectsModuleResolution: true,
39373
+ affectsEmit: true,
39374
+ paramType: ts.Diagnostics.KIND,
39375
+ showInSimplifiedHelpView: true,
39376
+ category: ts.Diagnostics.Modules,
39377
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
39378
+ defaultValueDescription: undefined,
39379
+ },
39403
39380
  {
39404
39381
  name: "lib",
39405
39382
  type: "list",
@@ -39436,7 +39413,6 @@ var ts;
39436
39413
  type: jsxOptionMap,
39437
39414
  affectsSourceFile: true,
39438
39415
  affectsEmit: true,
39439
- affectsMultiFileEmitBuildInfo: true,
39440
39416
  affectsModuleResolution: true,
39441
39417
  paramType: ts.Diagnostics.KIND,
39442
39418
  showInSimplifiedHelpView: true,
@@ -39449,7 +39425,6 @@ var ts;
39449
39425
  shortName: "d",
39450
39426
  type: "boolean",
39451
39427
  affectsEmit: true,
39452
- affectsMultiFileEmitBuildInfo: true,
39453
39428
  showInSimplifiedHelpView: true,
39454
39429
  category: ts.Diagnostics.Emit,
39455
39430
  transpileOptionValue: undefined,
@@ -39460,7 +39435,6 @@ var ts;
39460
39435
  name: "declarationMap",
39461
39436
  type: "boolean",
39462
39437
  affectsEmit: true,
39463
- affectsMultiFileEmitBuildInfo: true,
39464
39438
  showInSimplifiedHelpView: true,
39465
39439
  category: ts.Diagnostics.Emit,
39466
39440
  transpileOptionValue: undefined,
@@ -39471,7 +39445,6 @@ var ts;
39471
39445
  name: "emitDeclarationOnly",
39472
39446
  type: "boolean",
39473
39447
  affectsEmit: true,
39474
- affectsMultiFileEmitBuildInfo: true,
39475
39448
  showInSimplifiedHelpView: true,
39476
39449
  category: ts.Diagnostics.Emit,
39477
39450
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -39482,7 +39455,6 @@ var ts;
39482
39455
  name: "sourceMap",
39483
39456
  type: "boolean",
39484
39457
  affectsEmit: true,
39485
- affectsMultiFileEmitBuildInfo: true,
39486
39458
  showInSimplifiedHelpView: true,
39487
39459
  category: ts.Diagnostics.Emit,
39488
39460
  defaultValueDescription: false,
@@ -39492,9 +39464,6 @@ var ts;
39492
39464
  name: "outFile",
39493
39465
  type: "string",
39494
39466
  affectsEmit: true,
39495
- affectsMultiFileEmitBuildInfo: true,
39496
- affectsDeclarationPath: true,
39497
- affectsBundleEmitBuildInfo: true,
39498
39467
  isFilePath: true,
39499
39468
  paramType: ts.Diagnostics.FILE,
39500
39469
  showInSimplifiedHelpView: true,
@@ -39506,8 +39475,6 @@ var ts;
39506
39475
  name: "outDir",
39507
39476
  type: "string",
39508
39477
  affectsEmit: true,
39509
- affectsMultiFileEmitBuildInfo: true,
39510
- affectsDeclarationPath: true,
39511
39478
  isFilePath: true,
39512
39479
  paramType: ts.Diagnostics.DIRECTORY,
39513
39480
  showInSimplifiedHelpView: true,
@@ -39518,8 +39485,6 @@ var ts;
39518
39485
  name: "rootDir",
39519
39486
  type: "string",
39520
39487
  affectsEmit: true,
39521
- affectsMultiFileEmitBuildInfo: true,
39522
- affectsDeclarationPath: true,
39523
39488
  isFilePath: true,
39524
39489
  paramType: ts.Diagnostics.LOCATION,
39525
39490
  category: ts.Diagnostics.Modules,
@@ -39530,8 +39495,6 @@ var ts;
39530
39495
  name: "composite",
39531
39496
  type: "boolean",
39532
39497
  affectsEmit: true,
39533
- affectsMultiFileEmitBuildInfo: true,
39534
- affectsBundleEmitBuildInfo: true,
39535
39498
  isTSConfigOnly: true,
39536
39499
  category: ts.Diagnostics.Projects,
39537
39500
  transpileOptionValue: undefined,
@@ -39542,8 +39505,6 @@ var ts;
39542
39505
  name: "tsBuildInfoFile",
39543
39506
  type: "string",
39544
39507
  affectsEmit: true,
39545
- affectsMultiFileEmitBuildInfo: true,
39546
- affectsBundleEmitBuildInfo: true,
39547
39508
  isFilePath: true,
39548
39509
  paramType: ts.Diagnostics.FILE,
39549
39510
  category: ts.Diagnostics.Projects,
@@ -39555,7 +39516,6 @@ var ts;
39555
39516
  name: "removeComments",
39556
39517
  type: "boolean",
39557
39518
  affectsEmit: true,
39558
- affectsMultiFileEmitBuildInfo: true,
39559
39519
  showInSimplifiedHelpView: true,
39560
39520
  category: ts.Diagnostics.Emit,
39561
39521
  defaultValueDescription: false,
@@ -39574,7 +39534,6 @@ var ts;
39574
39534
  name: "importHelpers",
39575
39535
  type: "boolean",
39576
39536
  affectsEmit: true,
39577
- affectsMultiFileEmitBuildInfo: true,
39578
39537
  category: ts.Diagnostics.Emit,
39579
39538
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
39580
39539
  defaultValueDescription: false,
@@ -39588,7 +39547,6 @@ var ts;
39588
39547
  })),
39589
39548
  affectsEmit: true,
39590
39549
  affectsSemanticDiagnostics: true,
39591
- affectsMultiFileEmitBuildInfo: true,
39592
39550
  category: ts.Diagnostics.Emit,
39593
39551
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
39594
39552
  defaultValueDescription: 0 /* Remove */,
@@ -39597,7 +39555,6 @@ var ts;
39597
39555
  name: "downlevelIteration",
39598
39556
  type: "boolean",
39599
39557
  affectsEmit: true,
39600
- affectsMultiFileEmitBuildInfo: true,
39601
39558
  category: ts.Diagnostics.Emit,
39602
39559
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
39603
39560
  defaultValueDescription: false,
@@ -39616,9 +39573,6 @@ var ts;
39616
39573
  type: "boolean",
39617
39574
  // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
39618
39575
  // The value of each strictFlag depends on own strictFlag value or this and never accessed directly.
39619
- // But we need to store `strict` in builf info, even though it won't be examined directly, so that the
39620
- // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly
39621
- affectsMultiFileEmitBuildInfo: true,
39622
39576
  showInSimplifiedHelpView: true,
39623
39577
  category: ts.Diagnostics.Type_Checking,
39624
39578
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -39628,7 +39582,6 @@ var ts;
39628
39582
  name: "noImplicitAny",
39629
39583
  type: "boolean",
39630
39584
  affectsSemanticDiagnostics: true,
39631
- affectsMultiFileEmitBuildInfo: true,
39632
39585
  strictFlag: true,
39633
39586
  category: ts.Diagnostics.Type_Checking,
39634
39587
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -39638,7 +39591,6 @@ var ts;
39638
39591
  name: "strictNullChecks",
39639
39592
  type: "boolean",
39640
39593
  affectsSemanticDiagnostics: true,
39641
- affectsMultiFileEmitBuildInfo: true,
39642
39594
  strictFlag: true,
39643
39595
  category: ts.Diagnostics.Type_Checking,
39644
39596
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -39647,8 +39599,6 @@ var ts;
39647
39599
  {
39648
39600
  name: "strictFunctionTypes",
39649
39601
  type: "boolean",
39650
- affectsSemanticDiagnostics: true,
39651
- affectsMultiFileEmitBuildInfo: true,
39652
39602
  strictFlag: true,
39653
39603
  category: ts.Diagnostics.Type_Checking,
39654
39604
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -39657,8 +39607,6 @@ var ts;
39657
39607
  {
39658
39608
  name: "strictBindCallApply",
39659
39609
  type: "boolean",
39660
- affectsSemanticDiagnostics: true,
39661
- affectsMultiFileEmitBuildInfo: true,
39662
39610
  strictFlag: true,
39663
39611
  category: ts.Diagnostics.Type_Checking,
39664
39612
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -39668,7 +39616,6 @@ var ts;
39668
39616
  name: "strictPropertyInitialization",
39669
39617
  type: "boolean",
39670
39618
  affectsSemanticDiagnostics: true,
39671
- affectsMultiFileEmitBuildInfo: true,
39672
39619
  strictFlag: true,
39673
39620
  category: ts.Diagnostics.Type_Checking,
39674
39621
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -39678,7 +39625,6 @@ var ts;
39678
39625
  name: "noImplicitThis",
39679
39626
  type: "boolean",
39680
39627
  affectsSemanticDiagnostics: true,
39681
- affectsMultiFileEmitBuildInfo: true,
39682
39628
  strictFlag: true,
39683
39629
  category: ts.Diagnostics.Type_Checking,
39684
39630
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -39688,7 +39634,6 @@ var ts;
39688
39634
  name: "useUnknownInCatchVariables",
39689
39635
  type: "boolean",
39690
39636
  affectsSemanticDiagnostics: true,
39691
- affectsMultiFileEmitBuildInfo: true,
39692
39637
  strictFlag: true,
39693
39638
  category: ts.Diagnostics.Type_Checking,
39694
39639
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -39698,8 +39643,6 @@ var ts;
39698
39643
  name: "alwaysStrict",
39699
39644
  type: "boolean",
39700
39645
  affectsSourceFile: true,
39701
- affectsEmit: true,
39702
- affectsMultiFileEmitBuildInfo: true,
39703
39646
  strictFlag: true,
39704
39647
  category: ts.Diagnostics.Type_Checking,
39705
39648
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -39710,7 +39653,6 @@ var ts;
39710
39653
  name: "noUnusedLocals",
39711
39654
  type: "boolean",
39712
39655
  affectsSemanticDiagnostics: true,
39713
- affectsMultiFileEmitBuildInfo: true,
39714
39656
  category: ts.Diagnostics.Type_Checking,
39715
39657
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
39716
39658
  defaultValueDescription: false,
@@ -39719,7 +39661,6 @@ var ts;
39719
39661
  name: "noUnusedParameters",
39720
39662
  type: "boolean",
39721
39663
  affectsSemanticDiagnostics: true,
39722
- affectsMultiFileEmitBuildInfo: true,
39723
39664
  category: ts.Diagnostics.Type_Checking,
39724
39665
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
39725
39666
  defaultValueDescription: false,
@@ -39728,7 +39669,6 @@ var ts;
39728
39669
  name: "exactOptionalPropertyTypes",
39729
39670
  type: "boolean",
39730
39671
  affectsSemanticDiagnostics: true,
39731
- affectsMultiFileEmitBuildInfo: true,
39732
39672
  category: ts.Diagnostics.Type_Checking,
39733
39673
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
39734
39674
  defaultValueDescription: false,
@@ -39737,7 +39677,6 @@ var ts;
39737
39677
  name: "noImplicitReturns",
39738
39678
  type: "boolean",
39739
39679
  affectsSemanticDiagnostics: true,
39740
- affectsMultiFileEmitBuildInfo: true,
39741
39680
  category: ts.Diagnostics.Type_Checking,
39742
39681
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
39743
39682
  defaultValueDescription: false,
@@ -39747,7 +39686,6 @@ var ts;
39747
39686
  type: "boolean",
39748
39687
  affectsBindDiagnostics: true,
39749
39688
  affectsSemanticDiagnostics: true,
39750
- affectsMultiFileEmitBuildInfo: true,
39751
39689
  category: ts.Diagnostics.Type_Checking,
39752
39690
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
39753
39691
  defaultValueDescription: false,
@@ -39756,7 +39694,6 @@ var ts;
39756
39694
  name: "noUncheckedIndexedAccess",
39757
39695
  type: "boolean",
39758
39696
  affectsSemanticDiagnostics: true,
39759
- affectsMultiFileEmitBuildInfo: true,
39760
39697
  category: ts.Diagnostics.Type_Checking,
39761
39698
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
39762
39699
  defaultValueDescription: false,
@@ -39765,7 +39702,6 @@ var ts;
39765
39702
  name: "noImplicitOverride",
39766
39703
  type: "boolean",
39767
39704
  affectsSemanticDiagnostics: true,
39768
- affectsMultiFileEmitBuildInfo: true,
39769
39705
  category: ts.Diagnostics.Type_Checking,
39770
39706
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
39771
39707
  defaultValueDescription: false,
@@ -39773,8 +39709,6 @@ var ts;
39773
39709
  {
39774
39710
  name: "noPropertyAccessFromIndexSignature",
39775
39711
  type: "boolean",
39776
- affectsSemanticDiagnostics: true,
39777
- affectsMultiFileEmitBuildInfo: true,
39778
39712
  showInSimplifiedHelpView: false,
39779
39713
  category: ts.Diagnostics.Type_Checking,
39780
39714
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -39860,7 +39794,6 @@ var ts;
39860
39794
  name: "allowSyntheticDefaultImports",
39861
39795
  type: "boolean",
39862
39796
  affectsSemanticDiagnostics: true,
39863
- affectsMultiFileEmitBuildInfo: true,
39864
39797
  category: ts.Diagnostics.Interop_Constraints,
39865
39798
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
39866
39799
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -39870,7 +39803,6 @@ var ts;
39870
39803
  type: "boolean",
39871
39804
  affectsSemanticDiagnostics: true,
39872
39805
  affectsEmit: true,
39873
- affectsMultiFileEmitBuildInfo: true,
39874
39806
  showInSimplifiedHelpView: true,
39875
39807
  category: ts.Diagnostics.Interop_Constraints,
39876
39808
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -39887,7 +39819,6 @@ var ts;
39887
39819
  name: "allowUmdGlobalAccess",
39888
39820
  type: "boolean",
39889
39821
  affectsSemanticDiagnostics: true,
39890
- affectsMultiFileEmitBuildInfo: true,
39891
39822
  category: ts.Diagnostics.Modules,
39892
39823
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
39893
39824
  defaultValueDescription: false,
@@ -39909,7 +39840,6 @@ var ts;
39909
39840
  name: "sourceRoot",
39910
39841
  type: "string",
39911
39842
  affectsEmit: true,
39912
- affectsMultiFileEmitBuildInfo: true,
39913
39843
  paramType: ts.Diagnostics.LOCATION,
39914
39844
  category: ts.Diagnostics.Emit,
39915
39845
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -39918,7 +39848,6 @@ var ts;
39918
39848
  name: "mapRoot",
39919
39849
  type: "string",
39920
39850
  affectsEmit: true,
39921
- affectsMultiFileEmitBuildInfo: true,
39922
39851
  paramType: ts.Diagnostics.LOCATION,
39923
39852
  category: ts.Diagnostics.Emit,
39924
39853
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -39927,7 +39856,6 @@ var ts;
39927
39856
  name: "inlineSourceMap",
39928
39857
  type: "boolean",
39929
39858
  affectsEmit: true,
39930
- affectsMultiFileEmitBuildInfo: true,
39931
39859
  category: ts.Diagnostics.Emit,
39932
39860
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
39933
39861
  defaultValueDescription: false,
@@ -39936,7 +39864,6 @@ var ts;
39936
39864
  name: "inlineSources",
39937
39865
  type: "boolean",
39938
39866
  affectsEmit: true,
39939
- affectsMultiFileEmitBuildInfo: true,
39940
39867
  category: ts.Diagnostics.Emit,
39941
39868
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
39942
39869
  defaultValueDescription: false,
@@ -39946,7 +39873,6 @@ var ts;
39946
39873
  name: "experimentalDecorators",
39947
39874
  type: "boolean",
39948
39875
  affectsSemanticDiagnostics: true,
39949
- affectsMultiFileEmitBuildInfo: true,
39950
39876
  category: ts.Diagnostics.Language_and_Environment,
39951
39877
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
39952
39878
  defaultValueDescription: false,
@@ -39956,7 +39882,6 @@ var ts;
39956
39882
  type: "boolean",
39957
39883
  affectsSemanticDiagnostics: true,
39958
39884
  affectsEmit: true,
39959
- affectsMultiFileEmitBuildInfo: true,
39960
39885
  category: ts.Diagnostics.Language_and_Environment,
39961
39886
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
39962
39887
  defaultValueDescription: false,
@@ -39981,7 +39906,6 @@ var ts;
39981
39906
  type: "string",
39982
39907
  affectsSemanticDiagnostics: true,
39983
39908
  affectsEmit: true,
39984
- affectsMultiFileEmitBuildInfo: true,
39985
39909
  affectsModuleResolution: true,
39986
39910
  category: ts.Diagnostics.Language_and_Environment,
39987
39911
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -39999,9 +39923,6 @@ var ts;
39999
39923
  name: "out",
40000
39924
  type: "string",
40001
39925
  affectsEmit: true,
40002
- affectsMultiFileEmitBuildInfo: true,
40003
- affectsDeclarationPath: true,
40004
- affectsBundleEmitBuildInfo: true,
40005
39926
  isFilePath: false,
40006
39927
  // for correct behaviour, please use outFile
40007
39928
  category: ts.Diagnostics.Backwards_Compatibility,
@@ -40013,7 +39934,6 @@ var ts;
40013
39934
  name: "reactNamespace",
40014
39935
  type: "string",
40015
39936
  affectsEmit: true,
40016
- affectsMultiFileEmitBuildInfo: true,
40017
39937
  category: ts.Diagnostics.Language_and_Environment,
40018
39938
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
40019
39939
  defaultValueDescription: "`React`",
@@ -40021,8 +39941,6 @@ var ts;
40021
39941
  {
40022
39942
  name: "skipDefaultLibCheck",
40023
39943
  type: "boolean",
40024
- // We need to store these to determine whether `lib` files need to be rechecked
40025
- affectsMultiFileEmitBuildInfo: true,
40026
39944
  category: ts.Diagnostics.Completeness,
40027
39945
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
40028
39946
  defaultValueDescription: false,
@@ -40038,7 +39956,6 @@ var ts;
40038
39956
  name: "emitBOM",
40039
39957
  type: "boolean",
40040
39958
  affectsEmit: true,
40041
- affectsMultiFileEmitBuildInfo: true,
40042
39959
  category: ts.Diagnostics.Emit,
40043
39960
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
40044
39961
  defaultValueDescription: false,
@@ -40050,7 +39967,6 @@ var ts;
40050
39967
  lf: 1 /* LineFeed */
40051
39968
  })),
40052
39969
  affectsEmit: true,
40053
- affectsMultiFileEmitBuildInfo: true,
40054
39970
  paramType: ts.Diagnostics.NEWLINE,
40055
39971
  category: ts.Diagnostics.Emit,
40056
39972
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -40060,7 +39976,6 @@ var ts;
40060
39976
  name: "noErrorTruncation",
40061
39977
  type: "boolean",
40062
39978
  affectsSemanticDiagnostics: true,
40063
- affectsMultiFileEmitBuildInfo: true,
40064
39979
  category: ts.Diagnostics.Output_Formatting,
40065
39980
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
40066
39981
  defaultValueDescription: false,
@@ -40091,7 +40006,6 @@ var ts;
40091
40006
  name: "stripInternal",
40092
40007
  type: "boolean",
40093
40008
  affectsEmit: true,
40094
- affectsMultiFileEmitBuildInfo: true,
40095
40009
  category: ts.Diagnostics.Emit,
40096
40010
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
40097
40011
  defaultValueDescription: false,
@@ -40132,7 +40046,6 @@ var ts;
40132
40046
  name: "noImplicitUseStrict",
40133
40047
  type: "boolean",
40134
40048
  affectsSemanticDiagnostics: true,
40135
- affectsMultiFileEmitBuildInfo: true,
40136
40049
  category: ts.Diagnostics.Backwards_Compatibility,
40137
40050
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
40138
40051
  defaultValueDescription: false,
@@ -40141,7 +40054,6 @@ var ts;
40141
40054
  name: "noEmitHelpers",
40142
40055
  type: "boolean",
40143
40056
  affectsEmit: true,
40144
- affectsMultiFileEmitBuildInfo: true,
40145
40057
  category: ts.Diagnostics.Emit,
40146
40058
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
40147
40059
  defaultValueDescription: false,
@@ -40150,7 +40062,6 @@ var ts;
40150
40062
  name: "noEmitOnError",
40151
40063
  type: "boolean",
40152
40064
  affectsEmit: true,
40153
- affectsMultiFileEmitBuildInfo: true,
40154
40065
  category: ts.Diagnostics.Emit,
40155
40066
  transpileOptionValue: undefined,
40156
40067
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -40160,7 +40071,6 @@ var ts;
40160
40071
  name: "preserveConstEnums",
40161
40072
  type: "boolean",
40162
40073
  affectsEmit: true,
40163
- affectsMultiFileEmitBuildInfo: true,
40164
40074
  category: ts.Diagnostics.Emit,
40165
40075
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
40166
40076
  defaultValueDescription: false,
@@ -40169,8 +40079,6 @@ var ts;
40169
40079
  name: "declarationDir",
40170
40080
  type: "string",
40171
40081
  affectsEmit: true,
40172
- affectsMultiFileEmitBuildInfo: true,
40173
- affectsDeclarationPath: true,
40174
40082
  isFilePath: true,
40175
40083
  paramType: ts.Diagnostics.DIRECTORY,
40176
40084
  category: ts.Diagnostics.Emit,
@@ -40180,8 +40088,6 @@ var ts;
40180
40088
  {
40181
40089
  name: "skipLibCheck",
40182
40090
  type: "boolean",
40183
- // We need to store these to determine whether `lib` files need to be rechecked
40184
- affectsMultiFileEmitBuildInfo: true,
40185
40091
  category: ts.Diagnostics.Completeness,
40186
40092
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
40187
40093
  defaultValueDescription: false,
@@ -40191,7 +40097,6 @@ var ts;
40191
40097
  type: "boolean",
40192
40098
  affectsBindDiagnostics: true,
40193
40099
  affectsSemanticDiagnostics: true,
40194
- affectsMultiFileEmitBuildInfo: true,
40195
40100
  category: ts.Diagnostics.Type_Checking,
40196
40101
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
40197
40102
  defaultValueDescription: undefined,
@@ -40201,7 +40106,6 @@ var ts;
40201
40106
  type: "boolean",
40202
40107
  affectsBindDiagnostics: true,
40203
40108
  affectsSemanticDiagnostics: true,
40204
- affectsMultiFileEmitBuildInfo: true,
40205
40109
  category: ts.Diagnostics.Type_Checking,
40206
40110
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
40207
40111
  defaultValueDescription: undefined,
@@ -40210,7 +40114,6 @@ var ts;
40210
40114
  name: "suppressExcessPropertyErrors",
40211
40115
  type: "boolean",
40212
40116
  affectsSemanticDiagnostics: true,
40213
- affectsMultiFileEmitBuildInfo: true,
40214
40117
  category: ts.Diagnostics.Backwards_Compatibility,
40215
40118
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
40216
40119
  defaultValueDescription: false,
@@ -40219,7 +40122,6 @@ var ts;
40219
40122
  name: "suppressImplicitAnyIndexErrors",
40220
40123
  type: "boolean",
40221
40124
  affectsSemanticDiagnostics: true,
40222
- affectsMultiFileEmitBuildInfo: true,
40223
40125
  category: ts.Diagnostics.Backwards_Compatibility,
40224
40126
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
40225
40127
  defaultValueDescription: false,
@@ -40244,7 +40146,6 @@ var ts;
40244
40146
  name: "noStrictGenericChecks",
40245
40147
  type: "boolean",
40246
40148
  affectsSemanticDiagnostics: true,
40247
- affectsMultiFileEmitBuildInfo: true,
40248
40149
  category: ts.Diagnostics.Backwards_Compatibility,
40249
40150
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
40250
40151
  defaultValueDescription: false,
@@ -40254,7 +40155,6 @@ var ts;
40254
40155
  type: "boolean",
40255
40156
  affectsSemanticDiagnostics: true,
40256
40157
  affectsEmit: true,
40257
- affectsMultiFileEmitBuildInfo: true,
40258
40158
  category: ts.Diagnostics.Language_and_Environment,
40259
40159
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
40260
40160
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -40263,7 +40163,6 @@ var ts;
40263
40163
  name: "preserveValueImports",
40264
40164
  type: "boolean",
40265
40165
  affectsEmit: true,
40266
- affectsMultiFileEmitBuildInfo: true,
40267
40166
  category: ts.Diagnostics.Emit,
40268
40167
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
40269
40168
  defaultValueDescription: false,
@@ -40307,8 +40206,6 @@ var ts;
40307
40206
  /* @internal */
40308
40207
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
40309
40208
  /* @internal */
40310
- ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
40311
- /* @internal */
40312
40209
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
40313
40210
  /* @internal */
40314
40211
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -41171,7 +41068,6 @@ var ts;
41171
41068
  return optionDefinition.type;
41172
41069
  }
41173
41070
  }
41174
- /* @internal */
41175
41071
  function getNameOfCompilerOptionValue(value, customTypeMap) {
41176
41072
  // There is a typeMap associated with this command-line option so use it to map value back to its name
41177
41073
  return ts.forEachEntry(customTypeMap, function (mapValue, key) {
@@ -41180,7 +41076,6 @@ var ts;
41180
41076
  }
41181
41077
  });
41182
41078
  }
41183
- ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
41184
41079
  function serializeCompilerOptions(options, pathOptions) {
41185
41080
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
41186
41081
  }
@@ -110463,8 +110358,7 @@ var ts;
110463
110358
  return;
110464
110359
  }
110465
110360
  var version = ts.version; // Extracted into a const so the form is stable between namespace and module
110466
- var buildInfo = { bundle: bundle, program: program, version: version };
110467
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
110361
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), /*writeByteOrderMark*/ false);
110468
110362
  }
110469
110363
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
110470
110364
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -110618,18 +110512,13 @@ var ts;
110618
110512
  if (sourceMapFilePath) {
110619
110513
  var sourceMap = sourceMapGenerator.toString();
110620
110514
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110621
- if (printer.bundleFileInfo)
110622
- printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
110623
110515
  }
110624
110516
  }
110625
110517
  else {
110626
110518
  writer.writeLine();
110627
110519
  }
110628
110520
  // Write the output file
110629
- var text = writer.getText();
110630
- ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110631
- if (printer.bundleFileInfo)
110632
- printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
110521
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110633
110522
  // Reset state
110634
110523
  writer.clear();
110635
110524
  }
@@ -110772,54 +110661,34 @@ var ts;
110772
110661
  }
110773
110662
  /*@internal*/
110774
110663
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
110775
- var createHash = ts.maybeBind(host, host.createHash);
110776
110664
  var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
110777
- var buildInfo;
110778
- if (host.getBuildInfo) {
110779
- var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
110780
- if (!hostBuildInfo)
110781
- return buildInfoPath;
110782
- buildInfo = hostBuildInfo;
110783
- }
110784
- else {
110785
- var buildInfoText = host.readFile(buildInfoPath);
110786
- if (!buildInfoText)
110787
- return buildInfoPath;
110788
- buildInfo = getBuildInfo(buildInfoText);
110789
- }
110790
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
110665
+ var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
110666
+ if (!buildInfoText)
110791
110667
  return buildInfoPath;
110792
110668
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
110793
110669
  if (!jsFileText)
110794
110670
  return jsFilePath;
110795
- if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
110796
- return jsFilePath;
110797
110671
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
110798
110672
  // error if no source map or for now if inline sourcemap
110799
110673
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
110800
110674
  return sourceMapFilePath || "inline sourcemap decoding";
110801
- if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
110802
- return sourceMapFilePath;
110803
110675
  // read declaration text
110804
110676
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
110805
110677
  if (declarationFilePath && !declarationText)
110806
110678
  return declarationFilePath;
110807
- if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
110808
- return declarationFilePath;
110809
110679
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
110810
110680
  // error if no source map or for now if inline sourcemap
110811
110681
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
110812
110682
  return declarationMapPath || "inline sourcemap decoding";
110813
- if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
110814
- return declarationMapPath;
110683
+ var buildInfo = getBuildInfo(buildInfoText);
110684
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
110685
+ return buildInfoPath;
110815
110686
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110816
110687
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
110817
110688
  /*onlyOwnText*/ true);
110818
110689
  var outputFiles = [];
110819
110690
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
110820
110691
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
110821
- var changedDtsText;
110822
- var changedDtsData;
110823
110692
  var emitHost = {
110824
110693
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
110825
110694
  getCanonicalFileName: host.getCanonicalFileName,
@@ -110835,7 +110704,7 @@ var ts;
110835
110704
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
110836
110705
  getProjectReferenceRedirect: ts.returnUndefined,
110837
110706
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
110838
- writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
110707
+ writeFile: function (name, text, writeByteOrderMark) {
110839
110708
  switch (name) {
110840
110709
  case jsFilePath:
110841
110710
  if (jsFileText === text)
@@ -110846,13 +110715,8 @@ var ts;
110846
110715
  return;
110847
110716
  break;
110848
110717
  case buildInfoPath:
110849
- var newBuildInfo = data.buildInfo;
110718
+ var newBuildInfo = getBuildInfo(text);
110850
110719
  newBuildInfo.program = buildInfo.program;
110851
- if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
110852
- // Update the output signature
110853
- newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
110854
- newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
110855
- }
110856
110720
  // Update sourceFileInfo
110857
110721
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
110858
110722
  newBuildInfo.bundle.js.sources = js.sources;
@@ -110860,13 +110724,11 @@ var ts;
110860
110724
  newBuildInfo.bundle.dts.sources = dts.sources;
110861
110725
  }
110862
110726
  newBuildInfo.bundle.sourceFiles = sourceFiles;
110863
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
110727
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
110864
110728
  return;
110865
110729
  case declarationFilePath:
110866
110730
  if (declarationText === text)
110867
110731
  return;
110868
- changedDtsText = text;
110869
- changedDtsData = data;
110870
110732
  break;
110871
110733
  case declarationMapPath:
110872
110734
  if (declarationMapText === text)
@@ -110885,7 +110747,6 @@ var ts;
110885
110747
  getSourceFileFromReference: ts.returnUndefined,
110886
110748
  redirectTargetsMap: ts.createMultiMap(),
110887
110749
  getFileIncludeReasons: ts.notImplemented,
110888
- createHash: createHash,
110889
110750
  };
110890
110751
  emitFiles(ts.notImplementedResolver, emitHost,
110891
110752
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
@@ -115970,10 +115831,12 @@ var ts;
115970
115831
  }
115971
115832
  ts.createCompilerHost = createCompilerHost;
115972
115833
  /*@internal*/
115834
+ // TODO(shkamat): update this after reworking ts build API
115973
115835
  function createCompilerHostWorker(options, setParentNodes, system) {
115974
115836
  if (system === void 0) { system = ts.sys; }
115975
115837
  var existingDirectories = new ts.Map();
115976
115838
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
115839
+ var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
115977
115840
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
115978
115841
  var text;
115979
115842
  try {
@@ -116006,7 +115869,7 @@ var ts;
116006
115869
  // NOTE: If patchWriteFileEnsuringDirectory has been called,
116007
115870
  // the system.writeFile will do its own directory creation and
116008
115871
  // the ensureDirectoriesExist call will always be redundant.
116009
- 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); });
115872
+ 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); });
116010
115873
  ts.performance.mark("afterIOWrite");
116011
115874
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
116012
115875
  }
@@ -116016,6 +115879,35 @@ var ts;
116016
115879
  }
116017
115880
  }
116018
115881
  }
115882
+ var outputFingerprints;
115883
+ function writeFileWorker(fileName, data, writeByteOrderMark) {
115884
+ if (!ts.isWatchSet(options) || !system.getModifiedTime) {
115885
+ system.writeFile(fileName, data, writeByteOrderMark);
115886
+ return;
115887
+ }
115888
+ if (!outputFingerprints) {
115889
+ outputFingerprints = new ts.Map();
115890
+ }
115891
+ var hash = computeHash(data);
115892
+ var mtimeBefore = system.getModifiedTime(fileName);
115893
+ if (mtimeBefore) {
115894
+ var fingerprint = outputFingerprints.get(fileName);
115895
+ // If output has not been changed, and the file has no external modification
115896
+ if (fingerprint &&
115897
+ fingerprint.byteOrderMark === writeByteOrderMark &&
115898
+ fingerprint.hash === hash &&
115899
+ fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
115900
+ return;
115901
+ }
115902
+ }
115903
+ system.writeFile(fileName, data, writeByteOrderMark);
115904
+ var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
115905
+ outputFingerprints.set(fileName, {
115906
+ hash: hash,
115907
+ byteOrderMark: writeByteOrderMark,
115908
+ mtime: mtimeAfter
115909
+ });
115910
+ }
116019
115911
  function getDefaultLibLocation() {
116020
115912
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
116021
115913
  }
@@ -117605,7 +117497,6 @@ var ts;
117605
117497
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
117606
117498
  redirectTargetsMap: redirectTargetsMap,
117607
117499
  getFileIncludeReasons: program.getFileIncludeReasons,
117608
- createHash: ts.maybeBind(host, host.createHash),
117609
117500
  };
117610
117501
  }
117611
117502
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -119719,9 +119610,13 @@ var ts;
119719
119610
  function createManyToManyPathMap() {
119720
119611
  function create(forward, reverse, deleted) {
119721
119612
  var map = {
119613
+ clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119614
+ forEach: function (fn) { return forward.forEach(fn); },
119722
119615
  getKeys: function (v) { return reverse.get(v); },
119723
119616
  getValues: function (k) { return forward.get(k); },
119617
+ hasKey: function (k) { return forward.has(k); },
119724
119618
  keys: function () { return forward.keys(); },
119619
+ deletedKeys: function () { return deleted; },
119725
119620
  deleteKey: function (k) {
119726
119621
  (deleted || (deleted = new ts.Set())).add(k);
119727
119622
  var set = forward.get(k);
@@ -119748,6 +119643,11 @@ var ts;
119748
119643
  });
119749
119644
  return map;
119750
119645
  },
119646
+ clear: function () {
119647
+ forward.clear();
119648
+ reverse.clear();
119649
+ deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119650
+ }
119751
119651
  };
119752
119652
  return map;
119753
119653
  }
@@ -119875,21 +119775,18 @@ var ts;
119875
119775
  * Creates the state of file references and signature for the new program from oldState if it is safe
119876
119776
  */
119877
119777
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119878
- var _a, _b, _c;
119879
119778
  var fileInfos = new ts.Map();
119880
119779
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
119881
119780
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
119781
+ var hasCalledUpdateShapeSignature = new ts.Set();
119882
119782
  var useOldState = canReuseOldState(referencedMap, oldState);
119883
119783
  // Ensure source files have parent pointers set
119884
119784
  newProgram.getTypeChecker();
119885
119785
  // Create the reference map, and set the file infos
119886
- for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
119887
- var sourceFile = _d[_i];
119786
+ for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
119787
+ var sourceFile = _a[_i];
119888
119788
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
119889
- var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
119890
- var signature = oldUncommitedSignature === undefined ?
119891
- useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
119892
- oldUncommitedSignature || undefined;
119789
+ var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
119893
119790
  if (referencedMap) {
119894
119791
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
119895
119792
  if (newReferences) {
@@ -119897,26 +119794,19 @@ var ts;
119897
119794
  }
119898
119795
  // Copy old visible to outside files map
119899
119796
  if (useOldState) {
119900
- var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
119901
- var exportedModules = oldUncommitedExportedModules === undefined ?
119902
- oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
119903
- oldUncommitedExportedModules || undefined;
119797
+ var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
119904
119798
  if (exportedModules) {
119905
119799
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119906
119800
  }
119907
119801
  }
119908
119802
  }
119909
- fileInfos.set(sourceFile.resolvedPath, {
119910
- version: version_2,
119911
- signature: signature,
119912
- affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
119913
- impliedFormat: sourceFile.impliedNodeFormat
119914
- });
119803
+ fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
119915
119804
  }
119916
119805
  return {
119917
119806
  fileInfos: fileInfos,
119918
119807
  referencedMap: referencedMap,
119919
119808
  exportedModulesMap: exportedModulesMap,
119809
+ hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
119920
119810
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
119921
119811
  };
119922
119812
  }
@@ -119930,42 +119820,71 @@ var ts;
119930
119820
  }
119931
119821
  BuilderState.releaseCache = releaseCache;
119932
119822
  /**
119933
- * Gets the files affected by the path from the program
119823
+ * Creates a clone of the state
119934
119824
  */
119935
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
119825
+ function clone(state) {
119936
119826
  var _a, _b;
119937
- var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
119938
- (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119939
- (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119940
- return result;
119827
+ // Dont need to backup allFiles info since its cache anyway
119828
+ return {
119829
+ fileInfos: new ts.Map(state.fileInfos),
119830
+ referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
119831
+ exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
119832
+ hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
119833
+ useFileVersionAsSignature: state.useFileVersionAsSignature,
119834
+ };
119941
119835
  }
119942
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119943
- function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
119836
+ BuilderState.clone = clone;
119837
+ /**
119838
+ * Gets the files affected by the path from the program
119839
+ */
119840
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
119841
+ // Since the operation could be cancelled, the signatures are always stored in the cache
119842
+ // They will be committed once it is safe to use them
119843
+ // eg when calling this api from tsserver, if there is no cancellation of the operation
119844
+ // In the other cases the affected files signatures are committed only after the iteration through the result is complete
119845
+ var signatureCache = cacheToUpdateSignature || new ts.Map();
119944
119846
  var sourceFile = programOfThisState.getSourceFileByPath(path);
119945
119847
  if (!sourceFile) {
119946
119848
  return ts.emptyArray;
119947
119849
  }
119948
- if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
119850
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
119949
119851
  return [sourceFile];
119950
119852
  }
119951
- return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
119853
+ var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
119854
+ if (!cacheToUpdateSignature) {
119855
+ // Commit all the signatures in the signature cache
119856
+ updateSignaturesFromCache(state, signatureCache);
119857
+ }
119858
+ return result;
119859
+ }
119860
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119861
+ /**
119862
+ * Updates the signatures from the cache into state's fileinfo signatures
119863
+ * This should be called whenever it is safe to commit the state of the builder
119864
+ */
119865
+ function updateSignaturesFromCache(state, signatureCache) {
119866
+ signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
119952
119867
  }
119953
- BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
119868
+ BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
119954
119869
  function updateSignatureOfFile(state, signature, path) {
119955
119870
  state.fileInfos.get(path).signature = signature;
119956
- (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
119871
+ state.hasCalledUpdateShapeSignature.add(path);
119957
119872
  }
119958
119873
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
119959
119874
  /**
119960
119875
  * Returns if the shape of the signature has changed since last emit
119961
119876
  */
119962
- function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
119963
- var _a;
119877
+ function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
119964
119878
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
119879
+ ts.Debug.assert(!!sourceFile);
119880
+ ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
119965
119881
  // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
119966
- if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
119882
+ if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
119967
119883
  return false;
119884
+ }
119968
119885
  var info = state.fileInfos.get(sourceFile.resolvedPath);
119886
+ if (!info)
119887
+ return ts.Debug.fail();
119969
119888
  var prevSignature = info.signature;
119970
119889
  var latestSignature;
119971
119890
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -119976,55 +119895,45 @@ var ts;
119976
119895
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119977
119896
  if (firstDts_1) {
119978
119897
  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; })); });
119979
- latestSignature = computeSignature(firstDts_1.text, computeHash);
119980
- if (latestSignature !== prevSignature) {
119981
- updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
119898
+ latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119899
+ if (exportedModulesMapCache && latestSignature !== prevSignature) {
119900
+ updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
119982
119901
  }
119983
119902
  }
119984
119903
  }
119985
119904
  // Default is to use file version as signature
119986
119905
  if (latestSignature === undefined) {
119987
119906
  latestSignature = sourceFile.version;
119988
- if (state.exportedModulesMap && latestSignature !== prevSignature) {
119989
- (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119907
+ if (exportedModulesMapCache && latestSignature !== prevSignature) {
119990
119908
  // All the references in this file are exported
119991
119909
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
119992
119910
  if (references) {
119993
- state.exportedModulesMap.set(sourceFile.resolvedPath, references);
119911
+ exportedModulesMapCache.set(sourceFile.resolvedPath, references);
119994
119912
  }
119995
119913
  else {
119996
- state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119914
+ exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119997
119915
  }
119998
119916
  }
119999
119917
  }
120000
- (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
120001
- (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
120002
- info.signature = latestSignature;
119918
+ cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
120003
119919
  return latestSignature !== prevSignature;
120004
119920
  }
120005
119921
  BuilderState.updateShapeSignature = updateShapeSignature;
120006
- function computeSignature(text, computeHash) {
120007
- return (computeHash || ts.generateDjb2Hash)(text);
120008
- }
120009
- BuilderState.computeSignature = computeSignature;
120010
119922
  /**
120011
119923
  * Coverts the declaration emit result into exported modules map
120012
119924
  */
120013
- function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
120014
- if (!state.exportedModulesMap)
120015
- return;
120016
- (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119925
+ function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
120017
119926
  if (!exportedModulesFromDeclarationEmit) {
120018
- state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119927
+ exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
120019
119928
  return;
120020
119929
  }
120021
119930
  var exportedModules;
120022
119931
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
120023
119932
  if (exportedModules) {
120024
- state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119933
+ exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
120025
119934
  }
120026
119935
  else {
120027
- state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119936
+ exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
120028
119937
  }
120029
119938
  function addExportedModule(exportedModulePaths) {
120030
119939
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -120036,6 +119945,19 @@ var ts;
120036
119945
  }
120037
119946
  }
120038
119947
  BuilderState.updateExportedModules = updateExportedModules;
119948
+ /**
119949
+ * Updates the exported modules from cache into state's exported modules map
119950
+ * This should be called whenever it is safe to commit the state of the builder
119951
+ */
119952
+ function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
119953
+ var _a;
119954
+ if (exportedModulesMapCache) {
119955
+ ts.Debug.assert(!!state.exportedModulesMap);
119956
+ (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
119957
+ exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
119958
+ }
119959
+ }
119960
+ BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
120039
119961
  /**
120040
119962
  * Get all the dependencies of the sourceFile
120041
119963
  */
@@ -120156,7 +120078,7 @@ var ts;
120156
120078
  /**
120157
120079
  * When program emits modular code, gets the files affected by the sourceFile whose shape has changed
120158
120080
  */
120159
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
120081
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
120160
120082
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
120161
120083
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
120162
120084
  }
@@ -120176,7 +120098,7 @@ var ts;
120176
120098
  if (!seenFileNamesMap.has(currentPath)) {
120177
120099
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
120178
120100
  seenFileNamesMap.set(currentPath, currentSourceFile);
120179
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
120101
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
120180
120102
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
120181
120103
  }
120182
120104
  }
@@ -120202,33 +120124,32 @@ var ts;
120202
120124
  * Create the state so that we can iterate on changedFiles/affected files
120203
120125
  */
120204
120126
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
120205
- var _a, _b;
120206
120127
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
120207
120128
  state.program = newProgram;
120208
120129
  var compilerOptions = newProgram.getCompilerOptions();
120209
120130
  state.compilerOptions = compilerOptions;
120210
- var outFilePath = ts.outFile(compilerOptions);
120211
120131
  // With --out or --outFile, any change affects all semantic diagnostics so no need to cache them
120212
- if (!outFilePath) {
120132
+ if (!ts.outFile(compilerOptions)) {
120213
120133
  state.semanticDiagnosticsPerFile = new ts.Map();
120214
120134
  }
120215
- 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)) {
120216
- state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
120217
- }
120218
120135
  state.changedFilesSet = new ts.Set();
120219
- state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
120220
120136
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
120221
120137
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
120222
120138
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
120223
120139
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
120224
- var canCopyEmitSignatures = compilerOptions.composite &&
120225
- (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
120226
- !outFilePath &&
120227
- !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
120228
120140
  if (useOldState) {
120141
+ // Verify the sanity of old state
120142
+ if (!oldState.currentChangedFilePath) {
120143
+ var affectedSignatures = oldState.currentAffectedFilesSignatures;
120144
+ ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
120145
+ }
120146
+ var changedFilesSet = oldState.changedFilesSet;
120147
+ if (canCopySemanticDiagnostics) {
120148
+ ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
120149
+ }
120229
120150
  // Copy old state's changed files set
120230
- (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
120231
- if (!outFilePath && oldState.affectedFilesPendingEmit) {
120151
+ changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
120152
+ if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
120232
120153
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
120233
120154
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
120234
120155
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -120249,8 +120170,6 @@ var ts;
120249
120170
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
120250
120171
  // versions dont match
120251
120172
  oldInfo.version !== info.version ||
120252
- // Implied formats dont match
120253
- oldInfo.impliedFormat !== info.impliedFormat ||
120254
120173
  // Referenced files changed
120255
120174
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
120256
120175
  // Referenced file was deleted in the new program
@@ -120274,25 +120193,27 @@ var ts;
120274
120193
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
120275
120194
  }
120276
120195
  }
120277
- if (canCopyEmitSignatures) {
120278
- var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
120279
- if (oldEmitSignature)
120280
- (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
120281
- }
120282
120196
  });
120283
120197
  // If the global file is removed, add all files as changed
120284
120198
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
120285
120199
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, /*firstSourceFile*/ undefined)
120286
120200
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
120287
120201
  }
120288
- else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
120202
+ else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
120289
120203
  // Add all files to affectedFilesPendingEmit since emit changed
120290
120204
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1 /* Full */); });
120291
120205
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
120292
120206
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
120293
120207
  }
120294
- // Since old states change files set is copied, any additional change means we would need to emit build info
120295
- state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
120208
+ if (useOldState) {
120209
+ // Any time the interpretation of a source file changes, mark it as changed
120210
+ ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
120211
+ if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
120212
+ state.changedFilesSet.add(sourceFilePath);
120213
+ }
120214
+ });
120215
+ }
120216
+ state.buildInfoEmitPending = !!state.changedFilesSet.size;
120296
120217
  return state;
120297
120218
  }
120298
120219
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -120328,35 +120249,30 @@ var ts;
120328
120249
  ts.BuilderState.releaseCache(state);
120329
120250
  state.program = undefined;
120330
120251
  }
120331
- function backupEmitBuilderProgramState(state) {
120332
- var outFilePath = ts.outFile(state.compilerOptions);
120333
- // Only in --out changeFileSet is kept around till emit
120334
- ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
120335
- return {
120336
- affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
120337
- affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
120338
- affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
120339
- seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
120340
- programEmitComplete: state.programEmitComplete,
120341
- emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
120342
- outSignature: state.outSignature,
120343
- dtsChangeTime: state.dtsChangeTime,
120344
- hasChangedEmitSignature: state.hasChangedEmitSignature,
120345
- changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
120346
- };
120347
- }
120348
- function restoreEmitBuilderProgramState(state, backupEmitState) {
120349
- state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
120350
- state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
120351
- state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
120352
- state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
120353
- state.programEmitComplete = backupEmitState.programEmitComplete;
120354
- state.emitSignatures = backupEmitState.emitSignatures;
120355
- state.outSignature = backupEmitState.outSignature;
120356
- state.dtsChangeTime = backupEmitState.dtsChangeTime;
120357
- state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
120358
- if (backupEmitState.changedFilesSet)
120359
- state.changedFilesSet = backupEmitState.changedFilesSet;
120252
+ /**
120253
+ * Creates a clone of the state
120254
+ */
120255
+ function cloneBuilderProgramState(state) {
120256
+ var _a;
120257
+ var newState = ts.BuilderState.clone(state);
120258
+ newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
120259
+ newState.changedFilesSet = new ts.Set(state.changedFilesSet);
120260
+ newState.affectedFiles = state.affectedFiles;
120261
+ newState.affectedFilesIndex = state.affectedFilesIndex;
120262
+ newState.currentChangedFilePath = state.currentChangedFilePath;
120263
+ newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
120264
+ newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
120265
+ newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
120266
+ newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
120267
+ newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
120268
+ newState.program = state.program;
120269
+ newState.compilerOptions = state.compilerOptions;
120270
+ newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
120271
+ newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
120272
+ newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
120273
+ newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
120274
+ newState.programEmitComplete = state.programEmitComplete;
120275
+ return newState;
120360
120276
  }
120361
120277
  /**
120362
120278
  * Verifies that source file is ok to be used in calls that arent handled by next
@@ -120371,7 +120287,7 @@ var ts;
120371
120287
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
120372
120288
  */
120373
120289
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
120374
- var _a, _b;
120290
+ var _a;
120375
120291
  while (true) {
120376
120292
  var affectedFiles = state.affectedFiles;
120377
120293
  if (affectedFiles) {
@@ -120391,8 +120307,10 @@ var ts;
120391
120307
  state.changedFilesSet.delete(state.currentChangedFilePath);
120392
120308
  state.currentChangedFilePath = undefined;
120393
120309
  // Commit the changes in file signature
120394
- (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
120395
- (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120310
+ ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
120311
+ state.currentAffectedFilesSignatures.clear();
120312
+ ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120313
+ (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
120396
120314
  state.affectedFiles = undefined;
120397
120315
  }
120398
120316
  // Get next changed file
@@ -120410,7 +120328,12 @@ var ts;
120410
120328
  return program;
120411
120329
  }
120412
120330
  // Get next batch of affected files
120413
- state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
120331
+ if (!state.currentAffectedFilesSignatures)
120332
+ state.currentAffectedFilesSignatures = new ts.Map();
120333
+ if (state.exportedModulesMap) {
120334
+ state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
120335
+ }
120336
+ state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
120414
120337
  state.currentChangedFilePath = nextKey.value;
120415
120338
  state.affectedFilesIndex = 0;
120416
120339
  if (!state.seenAffectedFiles)
@@ -120462,6 +120385,7 @@ var ts;
120462
120385
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
120463
120386
  */
120464
120387
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120388
+ var _a;
120465
120389
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
120466
120390
  // If affected files is everything except default library, then nothing more to do
120467
120391
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -120469,9 +120393,10 @@ var ts;
120469
120393
  // When a change affects the global scope, all files are considered to be affected without updating their signature
120470
120394
  // That means when affected file is handled, its signature can be out of date
120471
120395
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
120472
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
120396
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
120473
120397
  return;
120474
120398
  }
120399
+ 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);
120475
120400
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
120476
120401
  return;
120477
120402
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -120491,7 +120416,7 @@ var ts;
120491
120416
  // This ensures that we dont later during incremental builds considering wrong signature.
120492
120417
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
120493
120418
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
120494
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
120419
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
120495
120420
  // If not dts emit, nothing more to do
120496
120421
  if (ts.getEmitDeclarations(state.compilerOptions)) {
120497
120422
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -120512,10 +120437,27 @@ var ts;
120512
120437
  return !state.semanticDiagnosticsFromOldState.size;
120513
120438
  }
120514
120439
  function isChangedSignature(state, path) {
120515
- var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
120516
- var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120440
+ var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
120441
+ var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120517
120442
  return newSignature !== oldSignature;
120518
120443
  }
120444
+ function forEachKeyOfExportedModulesMap(state, filePath, fn) {
120445
+ // Go through exported modules from cache first
120446
+ var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
120447
+ var result = keys && ts.forEachKey(keys, fn);
120448
+ if (result)
120449
+ return result;
120450
+ // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
120451
+ keys = state.exportedModulesMap.getKeys(filePath);
120452
+ return keys && ts.forEachKey(keys, function (exportedFromPath) {
120453
+ var _a;
120454
+ // If the cache had an updated value, skip
120455
+ return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
120456
+ !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
120457
+ fn(exportedFromPath) :
120458
+ undefined;
120459
+ });
120460
+ }
120519
120461
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
120520
120462
  var _a;
120521
120463
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -120530,7 +120472,6 @@ var ts;
120530
120472
  * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
120531
120473
  */
120532
120474
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120533
- var _a;
120534
120475
  // If there was change in signature (dts output) for the changed file,
120535
120476
  // then only we need to handle pending file emit
120536
120477
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
@@ -120557,10 +120498,11 @@ var ts;
120557
120498
  }
120558
120499
  }
120559
120500
  }
120501
+ ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120560
120502
  var seenFileAndExportsOfFile = new ts.Set();
120561
120503
  // Go through exported modules from cache first
120562
120504
  // If exported modules has path, all files referencing file exported from are affected
120563
- (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120505
+ forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
120564
120506
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
120565
120507
  return true;
120566
120508
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -120574,18 +120516,19 @@ var ts;
120574
120516
  * return true when all work is done and we can exit handling dts emit and semantic diagnostics
120575
120517
  */
120576
120518
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
120577
- var _a, _b;
120519
+ var _a;
120578
120520
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
120579
120521
  return undefined;
120580
120522
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
120581
120523
  return true;
120582
120524
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
120525
+ ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120583
120526
  // If exported modules has path, all files referencing file exported from are affected
120584
- (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120527
+ forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
120585
120528
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
120586
120529
  });
120587
120530
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
120588
- (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
120531
+ (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
120589
120532
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
120590
120533
  handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
120591
120534
  state, referencingFilePath, cancellationToken, computeHash, host);
@@ -120606,13 +120549,12 @@ var ts;
120606
120549
  }
120607
120550
  else {
120608
120551
  state.seenAffectedFiles.add(affected.resolvedPath);
120609
- // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted
120610
- state.buildInfoEmitPending = true;
120611
120552
  if (emitKind !== undefined) {
120612
120553
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
120613
120554
  }
120614
120555
  if (isPendingEmit) {
120615
120556
  state.affectedFilesPendingEmitIndex++;
120557
+ state.buildInfoEmitPending = true;
120616
120558
  }
120617
120559
  else {
120618
120560
  state.affectedFilesIndex++;
@@ -120660,61 +120602,25 @@ var ts;
120660
120602
  }
120661
120603
  return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
120662
120604
  }
120663
- function isProgramBundleEmitBuildInfo(info) {
120664
- return !!ts.outFile(info.options || {});
120665
- }
120666
- ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
120667
120605
  /**
120668
120606
  * Gets the program information to be emitted in buildInfo so that we can use it to create new program
120669
120607
  */
120670
- function getProgramBuildInfo(state, getCanonicalFileName, host) {
120671
- var outFilePath = ts.outFile(state.compilerOptions);
120672
- if (outFilePath && !state.compilerOptions.composite)
120673
- return;
120608
+ function getProgramBuildInfo(state, getCanonicalFileName) {
120609
+ if (ts.outFile(state.compilerOptions))
120610
+ return undefined;
120674
120611
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
120675
120612
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
120676
- state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
120677
- if (outFilePath) {
120678
- var fileNames_1 = [];
120679
- var fileInfos_1 = [];
120680
- state.program.getRootFileNames().forEach(function (f) {
120681
- var sourceFile = state.program.getSourceFile(f);
120682
- if (!sourceFile)
120683
- return;
120684
- fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
120685
- fileInfos_1.push(sourceFile.version);
120686
- });
120687
- var result_15 = {
120688
- fileNames: fileNames_1,
120689
- fileInfos: fileInfos_1,
120690
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
120691
- outSignature: state.outSignature,
120692
- dtsChangeTime: state.dtsChangeTime,
120693
- };
120694
- return result_15;
120695
- }
120696
120613
  var fileNames = [];
120697
120614
  var fileNameToFileId = new ts.Map();
120698
120615
  var fileIdsList;
120699
120616
  var fileNamesToFileIdListId;
120700
- var emitSignatures;
120701
120617
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
120702
- var _b, _c;
120703
120618
  var key = _a[0], value = _a[1];
120704
120619
  // Ensure fileId
120705
120620
  var fileId = toFileId(key);
120706
120621
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
120707
- var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
120708
- var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
120709
- if (state.compilerOptions.composite) {
120710
- var file = state.program.getSourceFileByPath(key);
120711
- if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
120712
- var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
120713
- if (emitSignature !== actualSignature) {
120714
- (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
120715
- }
120716
- }
120717
- }
120622
+ var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120623
+ var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120718
120624
  return value.version === actualSignature ?
120719
120625
  value.affectsGlobalScope || value.impliedFormat ?
120720
120626
  // If file version is same as signature, dont serialize signature
@@ -120722,11 +120628,11 @@ var ts;
120722
120628
  // If file info only contains version and signature and both are same we can just write string
120723
120629
  value.version :
120724
120630
  actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120725
- oldSignature === undefined ?
120631
+ signature === undefined ?
120726
120632
  // If we havent computed signature, use fileInfo as is
120727
120633
  value :
120728
120634
  // Serialize fileInfo with new updated signature
120729
- { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120635
+ { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120730
120636
  // Signature of the FileInfo is undefined, serialize it as false
120731
120637
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120732
120638
  });
@@ -120741,13 +120647,17 @@ var ts;
120741
120647
  if (state.exportedModulesMap) {
120742
120648
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
120743
120649
  var _a;
120744
- var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
120650
+ if (state.currentAffectedFilesExportedModulesMap) {
120651
+ if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
120652
+ return undefined;
120653
+ }
120654
+ var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
120655
+ if (newValue) {
120656
+ return [toFileId(key), toFileIdListId(newValue)];
120657
+ }
120658
+ }
120745
120659
  // Not in temporary cache, use existing value
120746
- if (oldValue === undefined)
120747
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120748
- if (oldValue)
120749
- return [toFileId(key), toFileIdListId(oldValue)];
120750
- return undefined;
120660
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120751
120661
  });
120752
120662
  }
120753
120663
  var semanticDiagnosticsPerFile;
@@ -120758,7 +120668,9 @@ var ts;
120758
120668
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
120759
120669
  [
120760
120670
  toFileId(key),
120761
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120671
+ state.hasReusableDiagnostic ?
120672
+ value :
120673
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
120762
120674
  ] :
120763
120675
  toFileId(key));
120764
120676
  }
@@ -120773,27 +120685,16 @@ var ts;
120773
120685
  }
120774
120686
  }
120775
120687
  }
120776
- var changeFileSet;
120777
- if (state.changedFilesSet.size) {
120778
- for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
120779
- var path = _e[_d];
120780
- (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120781
- }
120782
- }
120783
- var result = {
120688
+ return {
120784
120689
  fileNames: fileNames,
120785
120690
  fileInfos: fileInfos,
120786
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
120691
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
120787
120692
  fileIdsList: fileIdsList,
120788
120693
  referencedMap: referencedMap,
120789
120694
  exportedModulesMap: exportedModulesMap,
120790
120695
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
120791
120696
  affectedFilesPendingEmit: affectedFilesPendingEmit,
120792
- changeFileSet: changeFileSet,
120793
- emitSignatures: emitSignatures,
120794
- dtsChangeTime: state.dtsChangeTime,
120795
120697
  };
120796
- return result;
120797
120698
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
120798
120699
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
120799
120700
  }
@@ -120818,18 +120719,24 @@ var ts;
120818
120719
  }
120819
120720
  return fileIdListId;
120820
120721
  }
120821
- function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
120822
- var result;
120823
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120824
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120825
- var name = _a[_i];
120826
- var optionInfo = optionsNameMap.get(name.toLowerCase());
120827
- if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
120828
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
120829
- }
120722
+ }
120723
+ function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
120724
+ var result;
120725
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120726
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120727
+ var name = _a[_i];
120728
+ var optionKey = name.toLowerCase();
120729
+ var optionInfo = optionsNameMap.get(optionKey);
120730
+ if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
120731
+ // We need to store `strict`, even though it won't be examined directly, so that the
120732
+ // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
120733
+ optionKey === "strict" ||
120734
+ // We need to store these to determine whether `lib` files need to be rechecked.
120735
+ optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
120736
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
120830
120737
  }
120831
- return result;
120832
120738
  }
120739
+ return result;
120833
120740
  }
120834
120741
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120835
120742
  if (option) {
@@ -120903,10 +120810,6 @@ var ts;
120903
120810
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
120904
120811
  }
120905
120812
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
120906
- function computeSignature(text, data, computeHash) {
120907
- return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
120908
- }
120909
- ts.computeSignature = computeSignature;
120910
120813
  function createBuilderProgram(kind, _a) {
120911
120814
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
120912
120815
  // Return same program if underlying program doesnt change
@@ -120925,8 +120828,8 @@ var ts;
120925
120828
  */
120926
120829
  var computeHash = ts.maybeBind(host, host.createHash);
120927
120830
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
120928
- var backupEmitState;
120929
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
120831
+ var backupState;
120832
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
120930
120833
  // To ensure that we arent storing any references to old program or new program without state
120931
120834
  newProgram = undefined; // TODO: GH#18217
120932
120835
  oldProgram = undefined;
@@ -120934,20 +120837,20 @@ var ts;
120934
120837
  var getState = function () { return state; };
120935
120838
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
120936
120839
  builderProgram.getState = getState;
120937
- builderProgram.backupEmitState = function () {
120938
- ts.Debug.assert(backupEmitState === undefined);
120939
- backupEmitState = backupEmitBuilderProgramState(state);
120840
+ builderProgram.backupState = function () {
120841
+ ts.Debug.assert(backupState === undefined);
120842
+ backupState = cloneBuilderProgramState(state);
120940
120843
  };
120941
- builderProgram.restoreEmitState = function () {
120942
- restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
120943
- backupEmitState = undefined;
120844
+ builderProgram.restoreState = function () {
120845
+ state = ts.Debug.checkDefined(backupState);
120846
+ backupState = undefined;
120944
120847
  };
120945
120848
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
120946
120849
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
120947
120850
  builderProgram.emit = emit;
120948
120851
  builderProgram.releaseProgram = function () {
120949
120852
  releaseCache(state);
120950
- backupEmitState = undefined;
120853
+ backupState = undefined;
120951
120854
  };
120952
120855
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
120953
120856
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -121006,59 +120909,35 @@ var ts;
121006
120909
  return toAffectedFileEmitResult(state,
121007
120910
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
121008
120911
  // Otherwise just affected file
121009
- ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
121010
- getWriteFileCallback(writeFile, customTransformers) :
120912
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120913
+ getWriteFileUpdatingSignatureCallback(writeFile) :
121011
120914
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
121012
120915
  }
121013
- function getWriteFileCallback(writeFile, customTransformers) {
120916
+ function getWriteFileUpdatingSignatureCallback(writeFile) {
121014
120917
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
121015
- var _a, _b, _c;
120918
+ var _a;
121016
120919
  if (ts.isDeclarationFileName(fileName)) {
121017
- if (!ts.outFile(state.compilerOptions)) {
121018
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
121019
- var newSignature = void 0;
121020
- if (!customTransformers) {
121021
- var file = sourceFiles[0];
121022
- var info = state.fileInfos.get(file.resolvedPath);
121023
- if (info.signature === file.version) {
121024
- newSignature = computeSignature(text, data, computeHash);
121025
- if (newSignature !== file.version) { // Update it
121026
- if (host.storeFilesChangingSignatureDuringEmit)
121027
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
121028
- if (state.exportedModulesMap)
121029
- ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
121030
- if (state.affectedFiles) {
121031
- // Keep old signature so we know what to undo if cancellation happens
121032
- var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
121033
- if (existing === undefined)
121034
- (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
121035
- info.signature = newSignature;
121036
- }
121037
- else {
121038
- // These are directly commited
121039
- info.signature = newSignature;
121040
- (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
121041
- }
121042
- }
120920
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120921
+ var file = sourceFiles[0];
120922
+ var info = state.fileInfos.get(file.resolvedPath);
120923
+ var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120924
+ if (signature === file.version) {
120925
+ var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120926
+ if (newSignature !== file.version) { // Update it
120927
+ if (host.storeFilesChangingSignatureDuringEmit)
120928
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120929
+ if (state.exportedModulesMap)
120930
+ ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
120931
+ if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
120932
+ state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
121043
120933
  }
121044
- }
121045
- if (state.compilerOptions.composite) {
121046
- var filePath = sourceFiles[0].resolvedPath;
121047
- var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
121048
- newSignature || (newSignature = computeSignature(text, data, computeHash));
121049
- if (newSignature !== oldSignature) {
121050
- (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
121051
- state.hasChangedEmitSignature = true;
120934
+ else {
120935
+ info.signature = newSignature;
120936
+ if (state.exportedModulesMap)
120937
+ ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
121052
120938
  }
121053
120939
  }
121054
120940
  }
121055
- else if (state.compilerOptions.composite) {
121056
- var newSignature = computeSignature(text, data, computeHash);
121057
- if (newSignature !== state.outSignature) {
121058
- state.outSignature = newSignature;
121059
- state.hasChangedEmitSignature = true;
121060
- }
121061
- }
121062
120941
  }
121063
120942
  if (writeFile)
121064
120943
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -121123,8 +121002,8 @@ var ts;
121123
121002
  }
121124
121003
  }
121125
121004
  }
121126
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
121127
- getWriteFileCallback(writeFile, customTransformers) :
121005
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
121006
+ getWriteFileUpdatingSignatureCallback(writeFile) :
121128
121007
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
121129
121008
  }
121130
121009
  /**
@@ -121213,58 +121092,29 @@ var ts;
121213
121092
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
121214
121093
  }
121215
121094
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
121216
- function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
121217
- var _a, _b, _c, _d;
121095
+ function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
121096
+ var _a;
121218
121097
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
121219
121098
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
121220
- var state;
121221
- var filePaths;
121222
- var filePathsSetList;
121223
- if (isProgramBundleEmitBuildInfo(program)) {
121224
- state = {
121225
- fileInfos: new ts.Map(),
121226
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121227
- dtsChangeTime: program.dtsChangeTime,
121228
- outSignature: program.outSignature,
121229
- };
121230
- }
121231
- else {
121232
- filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
121233
- filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
121234
- var fileInfos_2 = new ts.Map();
121235
- var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
121236
- program.fileInfos.forEach(function (fileInfo, index) {
121237
- var path = toFilePath(index + 1);
121238
- var stateFileInfo = toBuilderStateFileInfo(fileInfo);
121239
- fileInfos_2.set(path, stateFileInfo);
121240
- if (emitSignatures_1 && stateFileInfo.signature)
121241
- emitSignatures_1.set(path, stateFileInfo.signature);
121242
- });
121243
- (_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
121244
- if (ts.isNumber(value))
121245
- emitSignatures_1.delete(toFilePath(value));
121246
- else
121247
- emitSignatures_1.set(toFilePath(value[0]), value[1]);
121248
- });
121249
- state = {
121250
- fileInfos: fileInfos_2,
121251
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121252
- referencedMap: toManyToManyPathMap(program.referencedMap),
121253
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121254
- 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]; }),
121255
- hasReusableDiagnostic: true,
121256
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
121257
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
121258
- affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
121259
- changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
121260
- dtsChangeTime: program.dtsChangeTime,
121261
- emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
121262
- };
121263
- }
121099
+ var filePaths = program.fileNames.map(toPath);
121100
+ var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
121101
+ var fileInfos = new ts.Map();
121102
+ program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
121103
+ var state = {
121104
+ fileInfos: fileInfos,
121105
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121106
+ referencedMap: toManyToManyPathMap(program.referencedMap),
121107
+ exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121108
+ 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]; }),
121109
+ hasReusableDiagnostic: true,
121110
+ affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
121111
+ affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
121112
+ affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
121113
+ };
121264
121114
  return {
121265
121115
  getState: function () { return state; },
121266
- backupEmitState: ts.noop,
121267
- restoreEmitState: ts.noop,
121116
+ backupState: ts.noop,
121117
+ restoreState: ts.noop,
121268
121118
  getProgram: ts.notImplemented,
121269
121119
  getProgramOrUndefined: ts.returnUndefined,
121270
121120
  releaseProgram: ts.noop,
@@ -121309,24 +121159,12 @@ var ts;
121309
121159
  return map;
121310
121160
  }
121311
121161
  }
121312
- ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
121313
- function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
121314
- var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
121315
- var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
121316
- var fileInfos = new ts.Map();
121317
- program.fileInfos.forEach(function (fileInfo, index) {
121318
- var path = ts.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
121319
- var version = ts.isString(fileInfo) ? fileInfo : fileInfo.version; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
121320
- fileInfos.set(path, version);
121321
- });
121322
- return fileInfos;
121323
- }
121324
- ts.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap;
121162
+ ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
121325
121163
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
121326
121164
  return {
121327
121165
  getState: ts.notImplemented,
121328
- backupEmitState: ts.noop,
121329
- restoreEmitState: ts.noop,
121166
+ backupState: ts.noop,
121167
+ restoreState: ts.noop,
121330
121168
  getProgram: getProgram,
121331
121169
  getProgramOrUndefined: function () { return getState().program; },
121332
121170
  releaseProgram: function () { return getState().program = undefined; },
@@ -122442,9 +122280,9 @@ var ts;
122442
122280
  if (!preferSymlinks) {
122443
122281
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
122444
122282
  // so we only need to remove them from the realpath filenames.
122445
- var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122446
- if (result_16)
122447
- return result_16;
122283
+ var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122284
+ if (result_15)
122285
+ return result_15;
122448
122286
  }
122449
122287
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
122450
122288
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -122464,10 +122302,10 @@ var ts;
122464
122302
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
122465
122303
  var symlinkDirectory = symlinkDirectories_1[_i];
122466
122304
  var option = ts.resolvePath(symlinkDirectory, relative);
122467
- var result_17 = cb(option, target === referenceRedirect);
122305
+ var result_16 = cb(option, target === referenceRedirect);
122468
122306
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
122469
- if (result_17)
122470
- return result_17;
122307
+ if (result_16)
122308
+ return result_16;
122471
122309
  }
122472
122310
  });
122473
122311
  });
@@ -123378,7 +123216,6 @@ var ts;
123378
123216
  readDirectory: ts.maybeBind(host, host.readDirectory),
123379
123217
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
123380
123218
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
123381
- now: ts.maybeBind(host, host.now),
123382
123219
  };
123383
123220
  function writeFile(fileName, text, writeByteOrderMark, onError) {
123384
123221
  try {
@@ -123439,7 +123276,6 @@ var ts;
123439
123276
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
123440
123277
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
123441
123278
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
123442
- now: ts.maybeBind(system, system.now),
123443
123279
  };
123444
123280
  }
123445
123281
  ts.createProgramHost = createProgramHost;
@@ -123507,26 +123343,20 @@ var ts;
123507
123343
  var ts;
123508
123344
  (function (ts) {
123509
123345
  function readBuilderProgram(compilerOptions, host) {
123346
+ if (ts.outFile(compilerOptions))
123347
+ return undefined;
123510
123348
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
123511
123349
  if (!buildInfoPath)
123512
123350
  return undefined;
123513
- var buildInfo;
123514
- if (host.getBuildInfo) {
123515
- buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
123516
- if (!buildInfo)
123517
- return undefined;
123518
- }
123519
- else {
123520
- var content = host.readFile(buildInfoPath);
123521
- if (!content)
123522
- return undefined;
123523
- buildInfo = ts.getBuildInfo(content);
123524
- }
123351
+ var content = host.readFile(buildInfoPath);
123352
+ if (!content)
123353
+ return undefined;
123354
+ var buildInfo = ts.getBuildInfo(content);
123525
123355
  if (buildInfo.version !== ts.version)
123526
123356
  return undefined;
123527
123357
  if (!buildInfo.program)
123528
123358
  return undefined;
123529
- return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123359
+ return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123530
123360
  }
123531
123361
  ts.readBuilderProgram = readBuilderProgram;
123532
123362
  function createIncrementalCompilerHost(options, system) {
@@ -123535,7 +123365,6 @@ var ts;
123535
123365
  host.createHash = ts.maybeBind(system, system.createHash);
123536
123366
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
123537
123367
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
123538
- host.now = ts.maybeBind(system, system.now);
123539
123368
  ts.setGetSourceFileAsHashVersioned(host, system);
123540
123369
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
123541
123370
  return host;
@@ -124271,17 +124100,14 @@ var ts;
124271
124100
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
124272
124101
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
124273
124102
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
124274
- UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
124275
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
124276
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
124277
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
124278
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
124279
- UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
124103
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
124104
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
124105
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
124106
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
124280
124107
  /**
124281
124108
  * Projects with no outputs (i.e. "solution" files)
124282
124109
  */
124283
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
124284
- UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
124110
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
124285
124111
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
124286
124112
  function resolveConfigFileProjectName(project) {
124287
124113
  if (ts.fileExtensionIs(project, ".json" /* Json */)) {
@@ -124326,11 +124152,9 @@ var ts;
124326
124152
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
124327
124153
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
124328
124154
  }
124329
- /*@internal*/
124330
- function getCurrentTime(host) {
124331
- return host.now ? host.now() : new Date();
124155
+ function newer(date1, date2) {
124156
+ return date2 > date1 ? date2 : date1;
124332
124157
  }
124333
- ts.getCurrentTime = getCurrentTime;
124334
124158
  /*@internal*/
124335
124159
  function isCircularBuildOrder(buildOrder) {
124336
124160
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -124422,7 +124246,6 @@ var ts;
124422
124246
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
124423
124247
  };
124424
124248
  }
124425
- compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
124426
124249
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
124427
124250
  var state = {
124428
124251
  host: host,
@@ -124439,9 +124262,8 @@ var ts;
124439
124262
  resolvedConfigFilePaths: new ts.Map(),
124440
124263
  configFileCache: new ts.Map(),
124441
124264
  projectStatus: new ts.Map(),
124265
+ buildInfoChecked: new ts.Map(),
124442
124266
  extendedConfigCache: new ts.Map(),
124443
- buildInfoCache: new ts.Map(),
124444
- outputTimeStamps: new ts.Map(),
124445
124267
  builderPrograms: new ts.Map(),
124446
124268
  diagnostics: new ts.Map(),
124447
124269
  projectPendingBuild: new ts.Map(),
@@ -124464,7 +124286,6 @@ var ts;
124464
124286
  allWatchedConfigFiles: new ts.Map(),
124465
124287
  allWatchedExtendedConfigFiles: new ts.Map(),
124466
124288
  allWatchedPackageJsonFiles: new ts.Map(),
124467
- filesWatched: new ts.Map(),
124468
124289
  lastCachedPackageJsonLookups: new ts.Map(),
124469
124290
  timerToBuildInvalidatedProject: undefined,
124470
124291
  reportFileChangeDetected: false,
@@ -124575,12 +124396,11 @@ var ts;
124575
124396
  // Config file cache
124576
124397
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
124577
124398
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
124399
+ ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
124578
124400
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
124579
124401
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
124580
124402
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
124581
124403
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
124582
- ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
124583
- ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
124584
124404
  // Remove watches for the program no longer in the solution
124585
124405
  if (state.watch) {
124586
124406
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
@@ -124877,21 +124697,21 @@ var ts;
124877
124697
  }
124878
124698
  function emit(writeFileCallback, cancellationToken, customTransformers) {
124879
124699
  var _a;
124880
- var _b, _c, _d;
124700
+ var _b, _c;
124881
124701
  ts.Debug.assertIsDefined(program);
124882
124702
  ts.Debug.assert(step === BuildStep.Emit);
124883
124703
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
124884
- program.backupEmitState();
124704
+ program.backupState();
124885
124705
  var declDiagnostics;
124886
124706
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
124887
124707
  var outputFiles = [];
124888
124708
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
124889
124709
  /*write*/ undefined,
124890
- /*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,
124710
+ /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
124891
124711
  /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
124892
124712
  // Don't emit .d.ts if there are decl file errors
124893
124713
  if (declDiagnostics) {
124894
- program.restoreEmitState();
124714
+ program.restoreState();
124895
124715
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
124896
124716
  return {
124897
124717
  emitSkipped: true,
@@ -124901,46 +124721,40 @@ var ts;
124901
124721
  // Actual Emit
124902
124722
  var host = state.host, compilerHost = state.compilerHost;
124903
124723
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124904
- var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
124724
+ var newestDeclarationFileContentChangedTime = minimumDate;
124725
+ var anyDtsChanged = false;
124905
124726
  var emitterDiagnostics = ts.createDiagnosticCollection();
124906
124727
  var emittedOutputs = new ts.Map();
124907
- var options = program.getCompilerOptions();
124908
- var isIncremental = ts.isIncrementalCompilation(options);
124909
- var outputTimeStampMap;
124910
- var now;
124911
124728
  ts.solutionPerformance.mark("beforeOutputFilesWrite");
124912
124729
  outputFiles.forEach(function (_a) {
124913
- var _b, _c;
124914
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124915
- var path = toPath(state, name);
124916
- emittedOutputs.set(toPath(state, name), name);
124917
- if (buildInfo) {
124918
- setBuildInfo(state, buildInfo, projectPath, options);
124919
- 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)) {
124730
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124731
+ var priorChangeTime;
124732
+ if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124733
+ // Check for unchanged .d.ts files
124734
+ if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124735
+ priorChangeTime = host.getModifiedTime(name);
124736
+ }
124737
+ else {
124920
124738
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124739
+ anyDtsChanged = true;
124921
124740
  }
124922
124741
  }
124742
+ emittedOutputs.set(toPath(state, name), name);
124923
124743
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124924
- if (!isIncremental && state.watch) {
124925
- (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
124744
+ if (priorChangeTime !== undefined) {
124745
+ newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
124926
124746
  }
124927
124747
  });
124928
124748
  ts.solutionPerformance.mark("afterOutputFilesWrite");
124929
124749
  ts.solutionPerformance.measure("OutputFilesWrite", "beforeOutputFilesWrite", "afterOutputFilesWrite");
124930
- finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124750
+ finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime,
124751
+ /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124931
124752
  return emitResult;
124932
124753
  }
124933
124754
  function emitBuildInfo(writeFileCallback, cancellationToken) {
124934
124755
  ts.Debug.assertIsDefined(program);
124935
124756
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
124936
- var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
124937
- if (data === null || data === void 0 ? void 0 : data.buildInfo)
124938
- setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
124939
- if (writeFileCallback)
124940
- writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
124941
- else
124942
- state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
124943
- }, cancellationToken);
124757
+ var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
124944
124758
  if (emitResult.diagnostics.length) {
124945
124759
  reportErrors(state, emitResult.diagnostics);
124946
124760
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -124953,7 +124767,7 @@ var ts;
124953
124767
  step = BuildStep.QueueReferencingProjects;
124954
124768
  return emitResult;
124955
124769
  }
124956
- function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
124770
+ function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
124957
124771
  var _a;
124958
124772
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
124959
124773
  if (emitDiagnostics.length) {
@@ -124964,11 +124778,13 @@ var ts;
124964
124778
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
124965
124779
  }
124966
124780
  // Update time stamps for rest of the outputs
124967
- updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124781
+ var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124968
124782
  state.diagnostics.delete(projectPath);
124969
124783
  state.projectStatus.set(projectPath, {
124970
124784
  type: ts.UpToDateStatusType.UpToDate,
124971
- newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
124785
+ newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
124786
+ maximumDate :
124787
+ newestDeclarationFileContentChangedTime,
124972
124788
  oldestOutputFileName: oldestOutputFileName
124973
124789
  });
124974
124790
  afterProgramDone(state, program, config);
@@ -125003,21 +124819,13 @@ var ts;
125003
124819
  ts.Debug.assert(!!outputFiles.length);
125004
124820
  var emitterDiagnostics = ts.createDiagnosticCollection();
125005
124821
  var emittedOutputs = new ts.Map();
125006
- var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
125007
- var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
125008
124822
  outputFiles.forEach(function (_a) {
125009
- var _b, _c;
125010
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124823
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
125011
124824
  emittedOutputs.set(toPath(state, name), name);
125012
- if (buildInfo) {
125013
- setBuildInfo(state, buildInfo, projectPath, config.options);
125014
- if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
125015
- resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
125016
- }
125017
- }
125018
124825
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
125019
124826
  });
125020
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
124827
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate,
124828
+ /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
125021
124829
  return { emitSkipped: false, diagnostics: emitDiagnostics };
125022
124830
  }
125023
124831
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -125123,7 +124931,7 @@ var ts;
125123
124931
  }
125124
124932
  continue;
125125
124933
  }
125126
- if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
124934
+ if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
125127
124935
  reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
125128
124936
  return {
125129
124937
  kind: InvalidatedProjectKind.UpdateOutputFileStamps,
@@ -125209,7 +125017,7 @@ var ts;
125209
125017
  state.projectCompilerOptions = state.baseCompilerOptions;
125210
125018
  }
125211
125019
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
125212
- var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
125020
+ var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
125213
125021
  reportAndStoreErrors(state, resolvedPath, diagnostics);
125214
125022
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
125215
125023
  if (canEmitBuildInfo)
@@ -125217,101 +125025,9 @@ var ts;
125217
125025
  afterProgramDone(state, program, config);
125218
125026
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
125219
125027
  }
125220
- function isFileWatcherWithModifiedTime(value) {
125221
- return !!value.watcher;
125222
- }
125223
- function getModifiedTime(state, fileName) {
125224
- var path = toPath(state, fileName);
125225
- var existing = state.filesWatched.get(path);
125226
- if (state.watch && !!existing) {
125227
- if (!isFileWatcherWithModifiedTime(existing))
125228
- return existing;
125229
- if (existing.modifiedTime)
125230
- return existing.modifiedTime;
125231
- }
125232
- var result = ts.getModifiedTime(state.host, fileName);
125233
- if (state.watch) {
125234
- if (existing)
125235
- existing.modifiedTime = result;
125236
- else
125237
- state.filesWatched.set(path, result);
125238
- }
125239
- return result;
125240
- }
125241
- function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
125242
- var path = toPath(state, file);
125243
- var existing = state.filesWatched.get(path);
125244
- if (existing && isFileWatcherWithModifiedTime(existing)) {
125245
- existing.callbacks.push(callback);
125246
- }
125247
- else {
125248
- var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
125249
- var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
125250
- ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
125251
- existing.modifiedTime = modifiedTime;
125252
- existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
125253
- }, pollingInterval, options, watchType, project);
125254
- state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
125255
- }
125256
- return {
125257
- close: function () {
125258
- var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
125259
- ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
125260
- if (existing.callbacks.length === 1) {
125261
- state.filesWatched.delete(path);
125262
- ts.closeFileWatcherOf(existing);
125263
- }
125264
- else {
125265
- ts.unorderedRemoveItem(existing.callbacks, callback);
125266
- }
125267
- }
125268
- };
125269
- }
125270
- function getOutputTimeStampMap(state, resolvedConfigFilePath) {
125271
- if (!state.watch)
125272
- return undefined;
125273
- var result = state.outputTimeStamps.get(resolvedConfigFilePath);
125274
- if (!result)
125275
- state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
125276
- return result;
125277
- }
125278
- function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
125279
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125280
- var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
125281
- if (existing) {
125282
- existing.buildInfo = buildInfo;
125283
- existing.modifiedTime = getCurrentTime(state.host);
125284
- }
125285
- else {
125286
- state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
125287
- }
125288
- }
125289
- function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
125290
- var path = toPath(state, buildInfoPath);
125291
- var existing = state.buildInfoCache.get(resolvedConfigPath);
125292
- return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
125293
- }
125294
- function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
125295
- var path = toPath(state, buildInfoPath);
125296
- var existing = state.buildInfoCache.get(resolvedConfigPath);
125297
- if (existing !== undefined && existing.path === path) {
125298
- return existing.buildInfo || undefined;
125299
- }
125300
- ts.solutionPerformance.mark("beforeGetBuildInfo");
125301
- ts.solutionPerformance.mark("beforeBuildInfoRead");
125302
- var value = state.readFileWithCache(buildInfoPath);
125303
- ts.solutionPerformance.mark("afterBuildInfoRead");
125304
- ts.solutionPerformance.measure("BuildInfoRead", "beforeBuildInfoRead", "afterBuildInfoRead");
125305
- var buildInfo = value ? ts.getBuildInfo(value) : undefined;
125306
- ts.Debug.assert(modifiedTime || !buildInfo);
125307
- state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
125308
- ts.solutionPerformance.mark("afterGetBuildInfo");
125309
- ts.solutionPerformance.measure("GetBuildInfo", "beforeGetBuildInfo", "afterGetBuildInfo");
125310
- return buildInfo;
125311
- }
125312
125028
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
125313
125029
  // Check tsconfig time
125314
- var tsconfigTime = getModifiedTime(state, configFile);
125030
+ var tsconfigTime = ts.getModifiedTime(state.host, configFile);
125315
125031
  if (oldestOutputFileTime < tsconfigTime) {
125316
125032
  return {
125317
125033
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -125321,24 +125037,88 @@ var ts;
125321
125037
  }
125322
125038
  }
125323
125039
  function getUpToDateStatusWorker(state, project, resolvedPath) {
125324
- var _a, _b, _c;
125040
+ var force = !!state.options.force;
125041
+ var newestInputFileName = undefined;
125042
+ var newestInputFileTime = minimumDate;
125043
+ var host = state.host;
125044
+ // Get timestamps of input files
125045
+ for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
125046
+ var inputFile = _a[_i];
125047
+ if (!host.fileExists(inputFile)) {
125048
+ return {
125049
+ type: ts.UpToDateStatusType.Unbuildable,
125050
+ reason: inputFile + " does not exist"
125051
+ };
125052
+ }
125053
+ if (!force) {
125054
+ var inputTime = ts.getModifiedTime(host, inputFile);
125055
+ if (inputTime > newestInputFileTime) {
125056
+ newestInputFileName = inputFile;
125057
+ newestInputFileTime = inputTime;
125058
+ }
125059
+ }
125060
+ }
125325
125061
  // Container if no files are specified in the project
125326
125062
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
125327
125063
  return {
125328
125064
  type: ts.UpToDateStatusType.ContainerOnly
125329
125065
  };
125330
125066
  }
125331
- // Fast check to see if reference projects are buildable
125332
- var referenceStatuses;
125333
- var force = !!state.options.force;
125067
+ // Collect the expected outputs of this project
125068
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
125069
+ // Now see if all outputs are newer than the newest input
125070
+ var oldestOutputFileName = "(none)";
125071
+ var oldestOutputFileTime = maximumDate;
125072
+ var newestOutputFileName = "(none)";
125073
+ var newestOutputFileTime = minimumDate;
125074
+ var missingOutputFileName;
125075
+ var newestDeclarationFileContentChangedTime = minimumDate;
125076
+ var isOutOfDateWithInputs = false;
125077
+ if (!force) {
125078
+ for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
125079
+ var output = outputs_1[_b];
125080
+ // Output is missing; can stop checking
125081
+ // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
125082
+ if (!host.fileExists(output)) {
125083
+ missingOutputFileName = output;
125084
+ break;
125085
+ }
125086
+ var outputTime = ts.getModifiedTime(host, output);
125087
+ if (outputTime < oldestOutputFileTime) {
125088
+ oldestOutputFileTime = outputTime;
125089
+ oldestOutputFileName = output;
125090
+ }
125091
+ // If an output is older than the newest input, we can stop checking
125092
+ // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
125093
+ if (outputTime < newestInputFileTime) {
125094
+ isOutOfDateWithInputs = true;
125095
+ break;
125096
+ }
125097
+ if (outputTime > newestOutputFileTime) {
125098
+ newestOutputFileTime = outputTime;
125099
+ newestOutputFileName = output;
125100
+ }
125101
+ // Keep track of when the most recent time a .d.ts file was changed.
125102
+ // In addition to file timestamps, we also keep track of when a .d.ts file
125103
+ // had its file touched but not had its contents changed - this allows us
125104
+ // to skip a downstream typecheck
125105
+ if (ts.isDeclarationFileName(output)) {
125106
+ var outputModifiedTime = ts.getModifiedTime(host, output);
125107
+ newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
125108
+ }
125109
+ }
125110
+ }
125111
+ var pseudoUpToDate = false;
125112
+ var usesPrepend = false;
125113
+ var upstreamChangedProject;
125334
125114
  if (project.projectReferences) {
125335
125115
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
125336
- for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
125337
- var ref = _d[_i];
125116
+ for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
125117
+ var ref = _d[_c];
125118
+ usesPrepend = usesPrepend || !!(ref.prepend);
125338
125119
  var resolvedRef = ts.resolveProjectReferencePath(ref);
125339
125120
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
125340
- var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
125341
- var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
125121
+ var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
125342
125122
  // Its a circular reference ignore the status of this project
125343
125123
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
125344
125124
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) { // Container only ignore this project
@@ -125360,188 +125140,78 @@ var ts;
125360
125140
  upstreamProjectName: ref.path
125361
125141
  };
125362
125142
  }
125363
- if (!force)
125364
- (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
125365
- }
125366
- }
125367
- if (force)
125368
- return { type: ts.UpToDateStatusType.ForceBuild };
125369
- // Check buildinfo first
125370
- var host = state.host;
125371
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125372
- var oldestOutputFileName = "(none)";
125373
- var oldestOutputFileTime = maximumDate;
125374
- var buildInfoTime;
125375
- var buildInfoProgram;
125376
- var buildInfoVersionMap;
125377
- var newestDeclarationFileContentChangedTime;
125378
- if (buildInfoPath) {
125379
- var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
125380
- buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
125381
- if (buildInfoTime === ts.missingFileModifiedTime) {
125382
- if (!buildInfoCacheEntry_1) {
125383
- state.buildInfoCache.set(resolvedPath, {
125384
- path: toPath(state, buildInfoPath),
125385
- buildInfo: false,
125386
- modifiedTime: buildInfoTime
125387
- });
125388
- }
125389
- return {
125390
- type: ts.UpToDateStatusType.OutputMissing,
125391
- missingOutputFileName: buildInfoPath
125392
- };
125393
- }
125394
- var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
125395
- if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125396
- return {
125397
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
125398
- version: buildInfo.version
125399
- };
125400
- }
125401
- if (buildInfo.program) {
125402
- if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
125403
- (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
125143
+ // Check oldest output file name only if there is no missing output file name
125144
+ // (a check we will have skipped if this is a forced build)
125145
+ if (!force && !missingOutputFileName) {
125146
+ // If the upstream project's newest file is older than our oldest output, we
125147
+ // can't be out of date because of it
125148
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
125149
+ continue;
125150
+ }
125151
+ // If the upstream project has only change .d.ts files, and we've built
125152
+ // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
125153
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
125154
+ pseudoUpToDate = true;
125155
+ upstreamChangedProject = ref.path;
125156
+ continue;
125157
+ }
125158
+ // We have an output older than an upstream output - we are out of date
125159
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125404
125160
  return {
125405
- type: ts.UpToDateStatusType.OutOfDateBuildInfo,
125406
- buildInfoFile: buildInfoPath
125161
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125162
+ outOfDateOutputFileName: oldestOutputFileName,
125163
+ newerProjectName: ref.path
125407
125164
  };
125408
125165
  }
125409
- buildInfoProgram = buildInfo.program;
125410
125166
  }
125411
- oldestOutputFileTime = buildInfoTime;
125412
- oldestOutputFileName = buildInfoPath;
125413
- newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
125414
125167
  }
125415
- // Check input files
125416
- var newestInputFileName = undefined;
125417
- var newestInputFileTime = minimumDate;
125418
- var pseudoInputUptodate = false;
125419
- // Get timestamps of input files
125420
- for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
125421
- var inputFile = _f[_e];
125422
- var inputTime = getModifiedTime(state, inputFile);
125423
- if (inputTime === ts.missingFileModifiedTime) {
125424
- return {
125425
- type: ts.UpToDateStatusType.Unbuildable,
125426
- reason: inputFile + " does not exist"
125427
- };
125428
- }
125429
- // If an buildInfo is older than the newest input, we can stop checking
125430
- if (buildInfoTime && buildInfoTime < inputTime) {
125431
- var version_3 = void 0;
125432
- var currentVersion = void 0;
125433
- if (buildInfoProgram) {
125434
- // Read files and see if they are same, read is anyways cached
125435
- if (!buildInfoVersionMap)
125436
- buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
125437
- version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
125438
- var text = version_3 ? state.readFileWithCache(inputFile) : undefined;
125439
- currentVersion = text && (host.createHash || ts.generateDjb2Hash)(text);
125440
- if (version_3 && version_3 === currentVersion)
125441
- pseudoInputUptodate = true;
125442
- }
125443
- if (!version_3 || version_3 !== currentVersion) {
125444
- return {
125445
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
125446
- outOfDateOutputFileName: buildInfoPath,
125447
- newerInputFileName: inputFile
125448
- };
125449
- }
125450
- }
125451
- if (inputTime > newestInputFileTime) {
125452
- newestInputFileName = inputFile;
125453
- newestInputFileTime = inputTime;
125454
- }
125168
+ if (missingOutputFileName !== undefined) {
125169
+ return {
125170
+ type: ts.UpToDateStatusType.OutputMissing,
125171
+ missingOutputFileName: missingOutputFileName
125172
+ };
125455
125173
  }
125456
- // Now see if all outputs are newer than the newest input
125457
- // Dont check output timestamps if we have buildinfo telling us output is uptodate
125458
- if (!buildInfoPath) {
125459
- // Collect the expected outputs of this project
125460
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
125461
- var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
125462
- for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
125463
- var output = outputs_1[_g];
125464
- var path = toPath(state, output);
125465
- // Output is missing; can stop checking
125466
- var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
125467
- if (!outputTime) {
125468
- outputTime = ts.getModifiedTime(state.host, output);
125469
- outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
125470
- }
125471
- if (outputTime === ts.missingFileModifiedTime) {
125472
- return {
125473
- type: ts.UpToDateStatusType.OutputMissing,
125474
- missingOutputFileName: output
125475
- };
125476
- }
125477
- if (outputTime < oldestOutputFileTime) {
125478
- oldestOutputFileTime = outputTime;
125479
- oldestOutputFileName = output;
125480
- }
125481
- // If an output is older than the newest input, we can stop checking
125482
- if (outputTime < newestInputFileTime) {
125483
- return {
125484
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
125485
- outOfDateOutputFileName: oldestOutputFileName,
125486
- newerInputFileName: newestInputFileName
125487
- };
125488
- }
125489
- }
125174
+ if (isOutOfDateWithInputs) {
125175
+ return {
125176
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125177
+ outOfDateOutputFileName: oldestOutputFileName,
125178
+ newerInputFileName: newestInputFileName
125179
+ };
125490
125180
  }
125491
- var seenRefs = buildInfoPath ? new ts.Set() : undefined;
125492
- var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
125493
- seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
125494
- var pseudoUpToDate = false;
125495
- var usesPrepend = false;
125496
- var upstreamChangedProject;
125497
- if (referenceStatuses) {
125498
- for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
125499
- var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
125500
- usesPrepend = usesPrepend || !!(ref.prepend);
125501
- // If the upstream project's newest file is older than our oldest output, we
125502
- // can't be out of date because of it
125503
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
125504
- continue;
125505
- }
125506
- // Check if tsbuildinfo path is shared, then we need to rebuild
125507
- if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
125181
+ else {
125182
+ // Check tsconfig time
125183
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125184
+ if (configStatus)
125185
+ return configStatus;
125186
+ // Check extended config time
125187
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125188
+ if (extendedConfigStatus)
125189
+ return extendedConfigStatus;
125190
+ // Check package file time
125191
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125192
+ var path = _a[0];
125193
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125194
+ });
125195
+ if (dependentPackageFileStatus)
125196
+ return dependentPackageFileStatus;
125197
+ }
125198
+ if (!force && !state.buildInfoChecked.has(resolvedPath)) {
125199
+ state.buildInfoChecked.set(resolvedPath, true);
125200
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125201
+ if (buildInfoPath) {
125202
+ ts.solutionPerformance.mark("beforeBuildInfoRead");
125203
+ var value = state.readFileWithCache(buildInfoPath);
125204
+ ts.solutionPerformance.mark("afterBuildInfoRead");
125205
+ ts.solutionPerformance.measure("BuildInfoRead", "beforeBuildInfoRead", "afterBuildInfoRead");
125206
+ var buildInfo = value && ts.getBuildInfo(value);
125207
+ if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125508
125208
  return {
125509
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125510
- outOfDateOutputFileName: buildInfoPath,
125511
- newerProjectName: ref.path
125209
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
125210
+ version: buildInfo.version
125512
125211
  };
125513
125212
  }
125514
- // If the upstream project has only change .d.ts files, and we've built
125515
- // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
125516
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
125517
- pseudoUpToDate = true;
125518
- upstreamChangedProject = ref.path;
125519
- continue;
125520
- }
125521
- // We have an output older than an upstream output - we are out of date
125522
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125523
- return {
125524
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125525
- outOfDateOutputFileName: oldestOutputFileName,
125526
- newerProjectName: ref.path
125527
- };
125528
125213
  }
125529
125214
  }
125530
- // Check tsconfig time
125531
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125532
- if (configStatus)
125533
- return configStatus;
125534
- // Check extended config time
125535
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125536
- if (extendedConfigStatus)
125537
- return extendedConfigStatus;
125538
- // Check package file time
125539
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125540
- var path = _a[0];
125541
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125542
- });
125543
- if (dependentPackageFileStatus)
125544
- return dependentPackageFileStatus;
125545
125215
  if (usesPrepend && pseudoUpToDate) {
125546
125216
  return {
125547
125217
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -125551,37 +125221,15 @@ var ts;
125551
125221
  }
125552
125222
  // Up to date
125553
125223
  return {
125554
- type: pseudoUpToDate ?
125555
- ts.UpToDateStatusType.UpToDateWithUpstreamTypes :
125556
- pseudoInputUptodate ?
125557
- ts.UpToDateStatusType.UpToDateWithInputFileText :
125558
- ts.UpToDateStatusType.UpToDate,
125224
+ type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
125559
125225
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
125560
125226
  newestInputFileTime: newestInputFileTime,
125227
+ newestOutputFileTime: newestOutputFileTime,
125561
125228
  newestInputFileName: newestInputFileName,
125229
+ newestOutputFileName: newestOutputFileName,
125562
125230
  oldestOutputFileName: oldestOutputFileName
125563
125231
  };
125564
125232
  }
125565
- function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
125566
- if (seenRefs.has(resolvedRefPath))
125567
- return false;
125568
- seenRefs.add(resolvedRefPath);
125569
- var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
125570
- if (refBuildInfo.path === buildInfoCacheEntry.path)
125571
- return true;
125572
- if (resolvedConfig.projectReferences) {
125573
- // Check references
125574
- for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
125575
- var ref = _a[_i];
125576
- var resolvedRef = ts.resolveProjectReferencePath(ref);
125577
- var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
125578
- var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
125579
- if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
125580
- return true;
125581
- }
125582
- }
125583
- return false;
125584
- }
125585
125233
  function getUpToDateStatus(state, project, resolvedPath) {
125586
125234
  if (project === undefined) {
125587
125235
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -125597,69 +125245,42 @@ var ts;
125597
125245
  state.projectStatus.set(resolvedPath, actual);
125598
125246
  return actual;
125599
125247
  }
125600
- function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
125248
+ function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
125601
125249
  if (proj.options.noEmit)
125602
- return;
125603
- var now;
125250
+ return priorNewestUpdateTime;
125604
125251
  ts.solutionPerformance.mark("beforeUpdateOutputTimestamps");
125605
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
125606
- if (buildInfoPath) {
125607
- if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
125608
- if (!!state.options.verbose)
125252
+ var host = state.host;
125253
+ var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125254
+ if (!skipOutputs || outputs.length !== skipOutputs.size) {
125255
+ var reportVerbose = !!state.options.verbose;
125256
+ var now = host.now ? host.now() : new Date();
125257
+ for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125258
+ var file = outputs_2[_i];
125259
+ if (skipOutputs && skipOutputs.has(toPath(state, file))) {
125260
+ continue;
125261
+ }
125262
+ if (reportVerbose) {
125263
+ reportVerbose = false;
125609
125264
  reportStatus(state, verboseMessage, proj.options.configFilePath);
125610
- state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
125611
- getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
125612
- }
125613
- state.outputTimeStamps.delete(projectPath);
125614
- }
125615
- else {
125616
- var host = state.host;
125617
- var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125618
- var outputTimeStampMap_1 = getOutputTimeStampMap(state, projectPath);
125619
- var modifiedOutputs_1 = outputTimeStampMap_1 ? new ts.Set() : undefined;
125620
- if (!skipOutputs || outputs.length !== skipOutputs.size) {
125621
- var reportVerbose = !!state.options.verbose;
125622
- for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125623
- var file = outputs_2[_i];
125624
- var path = toPath(state, file);
125625
- if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
125626
- continue;
125627
- if (reportVerbose) {
125628
- reportVerbose = false;
125629
- reportStatus(state, verboseMessage, proj.options.configFilePath);
125630
- }
125631
- host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
125632
- if (outputTimeStampMap_1) {
125633
- outputTimeStampMap_1.set(path, now);
125634
- modifiedOutputs_1.add(path);
125635
- }
125636
125265
  }
125266
+ if (ts.isDeclarationFileName(file)) {
125267
+ priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
125268
+ }
125269
+ host.setModifiedTime(file, now);
125637
125270
  }
125638
- // Clear out timestamps not in output list any more
125639
- outputTimeStampMap_1 === null || outputTimeStampMap_1 === void 0 ? void 0 : outputTimeStampMap_1.forEach(function (_value, key) {
125640
- if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs_1.has(key))
125641
- outputTimeStampMap_1.delete(key);
125642
- });
125643
125271
  }
125644
125272
  ts.solutionPerformance.mark("afterUpdateOutputTimestamps");
125645
125273
  ts.solutionPerformance.measure("UpdateOutputTimestamps", "beforeUpdateOutputTimestamps", "afterUpdateOutputTimestamps");
125646
- }
125647
- function getDtsChangeTime(state, options, resolvedConfigPath) {
125648
- var _a;
125649
- if (!options.composite)
125650
- return undefined;
125651
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125652
- var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, /*modifiedTime*/ undefined);
125653
- 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;
125274
+ return priorNewestUpdateTime;
125654
125275
  }
125655
125276
  function updateOutputTimestamps(state, proj, resolvedPath) {
125656
125277
  if (state.options.dry) {
125657
125278
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
125658
125279
  }
125659
- updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125280
+ var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125660
125281
  state.projectStatus.set(resolvedPath, {
125661
125282
  type: ts.UpToDateStatusType.UpToDate,
125662
- newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
125283
+ newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
125663
125284
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
125664
125285
  });
125665
125286
  }
@@ -125705,7 +125326,6 @@ var ts;
125705
125326
  break;
125706
125327
  }
125707
125328
  // falls through
125708
- case ts.UpToDateStatusType.UpToDateWithInputFileText:
125709
125329
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125710
125330
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
125711
125331
  if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
@@ -125897,10 +125517,12 @@ var ts;
125897
125517
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
125898
125518
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
125899
125519
  return;
125900
- 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));
125520
+ state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
125521
+ invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
125522
+ }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
125901
125523
  }
125902
125524
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
125903
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
125525
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
125904
125526
  var _a;
125905
125527
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
125906
125528
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -125932,7 +125554,7 @@ var ts;
125932
125554
  if (!state.watch)
125933
125555
  return;
125934
125556
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
125935
- 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); },
125557
+ 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); },
125936
125558
  onDeleteValue: ts.closeFileWatcher,
125937
125559
  });
125938
125560
  }
@@ -125940,7 +125562,7 @@ var ts;
125940
125562
  if (!state.watch || !state.lastCachedPackageJsonLookups)
125941
125563
  return;
125942
125564
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
125943
- 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); },
125565
+ 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); },
125944
125566
  onDeleteValue: ts.closeFileWatcher,
125945
125567
  });
125946
125568
  }
@@ -126073,18 +125695,19 @@ var ts;
126073
125695
  }
126074
125696
  }
126075
125697
  function reportUpToDateStatus(state, configFileName, status) {
125698
+ if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
125699
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125700
+ }
126076
125701
  switch (status.type) {
126077
125702
  case ts.UpToDateStatusType.OutOfDateWithSelf:
126078
- 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));
125703
+ 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));
126079
125704
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
126080
- 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));
125705
+ 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));
126081
125706
  case ts.UpToDateStatusType.OutputMissing:
126082
125707
  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));
126083
- case ts.UpToDateStatusType.OutOfDateBuildInfo:
126084
- 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));
126085
125708
  case ts.UpToDateStatusType.UpToDate:
126086
125709
  if (status.newestInputFileTime !== undefined) {
126087
- 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 || ""));
125710
+ 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 || ""));
126088
125711
  }
126089
125712
  // Don't report anything for "up to date because it was already built" -- too verbose
126090
125713
  break;
@@ -126092,8 +125715,6 @@ var ts;
126092
125715
  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));
126093
125716
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
126094
125717
  return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
126095
- case ts.UpToDateStatusType.UpToDateWithInputFileText:
126096
- 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));
126097
125718
  case ts.UpToDateStatusType.UpstreamOutOfDate:
126098
125719
  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));
126099
125720
  case ts.UpToDateStatusType.UpstreamBlocked:
@@ -126104,8 +125725,6 @@ var ts;
126104
125725
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
126105
125726
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
126106
125727
  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);
126107
- case ts.UpToDateStatusType.ForceBuild:
126108
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
126109
125728
  case ts.UpToDateStatusType.ContainerOnly:
126110
125729
  // Don't report status on "solution" projects
126111
125730
  // falls through