@typescript-deploys/pr-build 4.8.0-pr-48784-14 → 4.8.0-pr-49285-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-insiders.20220527";
92
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220531";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -5093,6 +5093,11 @@ var ts;
5093
5093
  // Flags that require TypeFlags.Union
5094
5094
  /* @internal */
5095
5095
  ObjectFlags[ObjectFlags["ContainsIntersections"] = 16777216] = "ContainsIntersections";
5096
+ /* @internal */
5097
+ ObjectFlags[ObjectFlags["IsUnknownLikeUnionComputed"] = 33554432] = "IsUnknownLikeUnionComputed";
5098
+ /* @internal */
5099
+ ObjectFlags[ObjectFlags["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
5100
+ /* @internal */
5096
5101
  // Flags that require TypeFlags.Intersection
5097
5102
  /* @internal */
5098
5103
  ObjectFlags[ObjectFlags["IsNeverIntersectionComputed"] = 16777216] = "IsNeverIntersectionComputed";
@@ -6184,7 +6189,7 @@ var ts;
6184
6189
  };
6185
6190
  }
6186
6191
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
6187
- var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName, modifiedTime) {
6192
+ var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName) {
6188
6193
  // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
6189
6194
  if (!ts.isString(relativeFileName))
6190
6195
  return;
@@ -6194,7 +6199,7 @@ var ts;
6194
6199
  if (callbacks) {
6195
6200
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
6196
6201
  var fileCallback = callbacks_1[_i];
6197
- fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6202
+ fileCallback(fileName, FileWatcherEventKind.Changed);
6198
6203
  }
6199
6204
  }
6200
6205
  },
@@ -6248,7 +6253,7 @@ var ts;
6248
6253
  }
6249
6254
  else {
6250
6255
  cache.set(path, {
6251
- watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6256
+ watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
6252
6257
  refCount: 1
6253
6258
  });
6254
6259
  }
@@ -6276,7 +6281,7 @@ var ts;
6276
6281
  var newTime = modifiedTime.getTime();
6277
6282
  if (oldTime !== newTime) {
6278
6283
  watchedFile.mtime = modifiedTime;
6279
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
6284
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
6280
6285
  return true;
6281
6286
  }
6282
6287
  return false;
@@ -6527,18 +6532,17 @@ var ts;
6527
6532
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6528
6533
  /*@internal*/
6529
6534
  function createFileWatcherCallback(callback) {
6530
- return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6535
+ return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
6531
6536
  }
6532
6537
  ts.createFileWatcherCallback = createFileWatcherCallback;
6533
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6534
- return function (eventName, _relativeFileName, modifiedTime) {
6538
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists) {
6539
+ return function (eventName) {
6535
6540
  if (eventName === "rename") {
6536
- modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
6537
- callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
6541
+ callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6538
6542
  }
6539
6543
  else {
6540
6544
  // Change
6541
- callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6545
+ callback(fileName, FileWatcherEventKind.Changed);
6542
6546
  }
6543
6547
  };
6544
6548
  }
@@ -6562,7 +6566,7 @@ var ts;
6562
6566
  }
6563
6567
  /*@internal*/
6564
6568
  function createSystemWatchFunctions(_a) {
6565
- 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;
6569
+ var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatch = _a.fsWatch, fileExists = _a.fileExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, directoryExists = _a.directoryExists, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind;
6566
6570
  var dynamicPollingWatchFile;
6567
6571
  var fixedChunkSizePollingWatchFile;
6568
6572
  var nonPollingWatchFile;
@@ -6584,7 +6588,7 @@ var ts;
6584
6588
  case ts.WatchFileKind.FixedChunkSizePolling:
6585
6589
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, /* pollingInterval */ undefined, /*options*/ undefined);
6586
6590
  case ts.WatchFileKind.UseFsEvents:
6587
- return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime),
6591
+ return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists),
6588
6592
  /*recursive*/ false, pollingInterval, ts.getFallbackOptions(options));
6589
6593
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
6590
6594
  if (!nonPollingWatchFile) {
@@ -6766,6 +6770,7 @@ var ts;
6766
6770
  fsWatch: fsWatch,
6767
6771
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6768
6772
  getCurrentDirectory: getCurrentDirectory,
6773
+ fileExists: fileExists,
6769
6774
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
6770
6775
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
6771
6776
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
@@ -7025,7 +7030,7 @@ var ts;
7025
7030
  // File changed
7026
7031
  eventKind = FileWatcherEventKind.Changed;
7027
7032
  }
7028
- callback(fileName, eventKind, curr.mtime);
7033
+ callback(fileName, eventKind);
7029
7034
  }
7030
7035
  }
7031
7036
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
@@ -7051,10 +7056,10 @@ var ts;
7051
7056
  * Invoke the callback with rename and update the watcher if not closed
7052
7057
  * @param createWatcher
7053
7058
  */
7054
- function invokeCallbackAndUpdateWatcher(createWatcher, modifiedTime) {
7059
+ function invokeCallbackAndUpdateWatcher(createWatcher) {
7055
7060
  sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
7056
7061
  // Call the callback for current directory
7057
- callback("rename", "", modifiedTime);
7062
+ callback("rename", "");
7058
7063
  // If watcher is not closed, update it
7059
7064
  if (watcher) {
7060
7065
  watcher.close();
@@ -7100,14 +7105,13 @@ var ts;
7100
7105
  function callbackChangingToMissingFileSystemEntry(event, relativeName) {
7101
7106
  // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
7102
7107
  // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
7103
- var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
7104
7108
  return event === "rename" &&
7105
7109
  (!relativeName ||
7106
7110
  relativeName === lastDirectoryPart ||
7107
7111
  (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
7108
- modifiedTime === ts.missingFileModifiedTime ?
7109
- invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry, modifiedTime) :
7110
- callback(event, relativeName, modifiedTime);
7112
+ !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7113
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
7114
+ callback(event, relativeName);
7111
7115
  }
7112
7116
  /**
7113
7117
  * Watch the file or directory using fs.watchFile since fs.watch threw exception
@@ -7121,15 +7125,12 @@ var ts;
7121
7125
  * and switch to existing file or directory when the missing filesystem entry is created
7122
7126
  */
7123
7127
  function watchMissingFileSystemEntry() {
7124
- return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
7125
- if (eventKind === FileWatcherEventKind.Created) {
7126
- modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
7127
- if (modifiedTime !== ts.missingFileModifiedTime) {
7128
- // Call the callback for current file or directory
7129
- // For now it could be callback for the inner directory creation,
7130
- // but just return current directory, better than current no-op
7131
- invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry, modifiedTime);
7132
- }
7128
+ return watchFile(fileOrDirectory, function (_fileName, eventKind) {
7129
+ if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
7130
+ // Call the callback for current file or directory
7131
+ // For now it could be callback for the inner directory creation,
7132
+ // but just return current directory, better than current no-op
7133
+ invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
7133
7134
  }
7134
7135
  }, fallbackPollingInterval, fallbackOptions);
7135
7136
  }
@@ -7279,19 +7280,12 @@ var ts;
7279
7280
  }
7280
7281
  function getModifiedTime(path) {
7281
7282
  var _a;
7282
- // Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
7283
- // the CPU time performance.
7284
- var originalStackTraceLimit = Error.stackTraceLimit;
7285
- Error.stackTraceLimit = 0;
7286
7283
  try {
7287
7284
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
7288
7285
  }
7289
7286
  catch (e) {
7290
7287
  return undefined;
7291
7288
  }
7292
- finally {
7293
- Error.stackTraceLimit = originalStackTraceLimit;
7294
- }
7295
7289
  }
7296
7290
  function setModifiedTime(path, time) {
7297
7291
  try {
@@ -8417,6 +8411,7 @@ var ts;
8417
8411
  Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1: diag(2205, ts.DiagnosticCategory.Error, "Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2205", "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
8418
8412
  The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement: diag(2206, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206", "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."),
8419
8413
  The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement: diag(2207, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207", "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."),
8414
+ This_type_parameter_probably_needs_an_extends_object_constraint: diag(2208, ts.DiagnosticCategory.Error, "This_type_parameter_probably_needs_an_extends_object_constraint_2208", "This type parameter probably needs an `extends object` constraint."),
8420
8415
  The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8421
8416
  The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8422
8417
  Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
@@ -9312,8 +9307,8 @@ var ts;
9312
9307
  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"),
9313
9308
  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"),
9314
9309
  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."),
9315
- 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}'"),
9316
- 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}'"),
9310
+ 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}'"),
9311
+ 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}'"),
9317
9312
  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"),
9318
9313
  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"),
9319
9314
  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"),
@@ -9357,8 +9352,6 @@ var ts;
9357
9352
  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}'."),
9358
9353
  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}'."),
9359
9354
  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."),
9360
- 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"),
9361
- 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"),
9362
9355
  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}'"),
9363
9356
  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."),
9364
9357
  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."),
@@ -20188,10 +20181,6 @@ var ts;
20188
20181
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
20189
20182
  }
20190
20183
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
20191
- function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
20192
- return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
20193
- }
20194
- ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
20195
20184
  function getCompilerOptionValue(options, option) {
20196
20185
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
20197
20186
  }
@@ -39232,7 +39221,6 @@ var ts;
39232
39221
  type: "boolean",
39233
39222
  affectsSemanticDiagnostics: true,
39234
39223
  affectsEmit: true,
39235
- affectsMultiFileEmitBuildInfo: true,
39236
39224
  category: ts.Diagnostics.Watch_and_Build_Modes,
39237
39225
  description: ts.Diagnostics.Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it,
39238
39226
  defaultValueDescription: false,
@@ -39267,40 +39255,12 @@ var ts;
39267
39255
  affectsSourceFile: true,
39268
39256
  affectsModuleResolution: true,
39269
39257
  affectsEmit: true,
39270
- affectsMultiFileEmitBuildInfo: true,
39271
39258
  paramType: ts.Diagnostics.VERSION,
39272
39259
  showInSimplifiedHelpView: true,
39273
39260
  category: ts.Diagnostics.Language_and_Environment,
39274
39261
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
39275
39262
  defaultValueDescription: 0 /* ES3 */,
39276
39263
  };
39277
- /*@internal*/
39278
- ts.moduleOptionDeclaration = {
39279
- name: "module",
39280
- shortName: "m",
39281
- type: new ts.Map(ts.getEntries({
39282
- none: ts.ModuleKind.None,
39283
- commonjs: ts.ModuleKind.CommonJS,
39284
- amd: ts.ModuleKind.AMD,
39285
- system: ts.ModuleKind.System,
39286
- umd: ts.ModuleKind.UMD,
39287
- es6: ts.ModuleKind.ES2015,
39288
- es2015: ts.ModuleKind.ES2015,
39289
- es2020: ts.ModuleKind.ES2020,
39290
- es2022: ts.ModuleKind.ES2022,
39291
- esnext: ts.ModuleKind.ESNext,
39292
- node16: ts.ModuleKind.Node16,
39293
- nodenext: ts.ModuleKind.NodeNext,
39294
- })),
39295
- affectsModuleResolution: true,
39296
- affectsEmit: true,
39297
- affectsMultiFileEmitBuildInfo: true,
39298
- paramType: ts.Diagnostics.KIND,
39299
- showInSimplifiedHelpView: true,
39300
- category: ts.Diagnostics.Modules,
39301
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
39302
- defaultValueDescription: undefined,
39303
- };
39304
39264
  var commandOptionsWithoutBuild = [
39305
39265
  // CommandLine only options
39306
39266
  {
@@ -39362,14 +39322,37 @@ var ts;
39362
39322
  category: ts.Diagnostics.Command_line_Options,
39363
39323
  affectsSemanticDiagnostics: true,
39364
39324
  affectsEmit: true,
39365
- affectsMultiFileEmitBuildInfo: true,
39366
39325
  isCommandLineOnly: true,
39367
39326
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
39368
39327
  defaultValueDescription: false,
39369
39328
  },
39370
39329
  // Basic
39371
39330
  ts.targetOptionDeclaration,
39372
- ts.moduleOptionDeclaration,
39331
+ {
39332
+ name: "module",
39333
+ shortName: "m",
39334
+ type: new ts.Map(ts.getEntries({
39335
+ none: ts.ModuleKind.None,
39336
+ commonjs: ts.ModuleKind.CommonJS,
39337
+ amd: ts.ModuleKind.AMD,
39338
+ system: ts.ModuleKind.System,
39339
+ umd: ts.ModuleKind.UMD,
39340
+ es6: ts.ModuleKind.ES2015,
39341
+ es2015: ts.ModuleKind.ES2015,
39342
+ es2020: ts.ModuleKind.ES2020,
39343
+ es2022: ts.ModuleKind.ES2022,
39344
+ esnext: ts.ModuleKind.ESNext,
39345
+ node16: ts.ModuleKind.Node16,
39346
+ nodenext: ts.ModuleKind.NodeNext,
39347
+ })),
39348
+ affectsModuleResolution: true,
39349
+ affectsEmit: true,
39350
+ paramType: ts.Diagnostics.KIND,
39351
+ showInSimplifiedHelpView: true,
39352
+ category: ts.Diagnostics.Modules,
39353
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
39354
+ defaultValueDescription: undefined,
39355
+ },
39373
39356
  {
39374
39357
  name: "lib",
39375
39358
  type: "list",
@@ -39406,7 +39389,6 @@ var ts;
39406
39389
  type: jsxOptionMap,
39407
39390
  affectsSourceFile: true,
39408
39391
  affectsEmit: true,
39409
- affectsMultiFileEmitBuildInfo: true,
39410
39392
  affectsModuleResolution: true,
39411
39393
  paramType: ts.Diagnostics.KIND,
39412
39394
  showInSimplifiedHelpView: true,
@@ -39419,7 +39401,6 @@ var ts;
39419
39401
  shortName: "d",
39420
39402
  type: "boolean",
39421
39403
  affectsEmit: true,
39422
- affectsMultiFileEmitBuildInfo: true,
39423
39404
  showInSimplifiedHelpView: true,
39424
39405
  category: ts.Diagnostics.Emit,
39425
39406
  transpileOptionValue: undefined,
@@ -39430,7 +39411,6 @@ var ts;
39430
39411
  name: "declarationMap",
39431
39412
  type: "boolean",
39432
39413
  affectsEmit: true,
39433
- affectsMultiFileEmitBuildInfo: true,
39434
39414
  showInSimplifiedHelpView: true,
39435
39415
  category: ts.Diagnostics.Emit,
39436
39416
  transpileOptionValue: undefined,
@@ -39441,7 +39421,6 @@ var ts;
39441
39421
  name: "emitDeclarationOnly",
39442
39422
  type: "boolean",
39443
39423
  affectsEmit: true,
39444
- affectsMultiFileEmitBuildInfo: true,
39445
39424
  showInSimplifiedHelpView: true,
39446
39425
  category: ts.Diagnostics.Emit,
39447
39426
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -39452,7 +39431,6 @@ var ts;
39452
39431
  name: "sourceMap",
39453
39432
  type: "boolean",
39454
39433
  affectsEmit: true,
39455
- affectsMultiFileEmitBuildInfo: true,
39456
39434
  showInSimplifiedHelpView: true,
39457
39435
  category: ts.Diagnostics.Emit,
39458
39436
  defaultValueDescription: false,
@@ -39462,9 +39440,6 @@ var ts;
39462
39440
  name: "outFile",
39463
39441
  type: "string",
39464
39442
  affectsEmit: true,
39465
- affectsMultiFileEmitBuildInfo: true,
39466
- affectsDeclarationPath: true,
39467
- affectsBundleEmitBuildInfo: true,
39468
39443
  isFilePath: true,
39469
39444
  paramType: ts.Diagnostics.FILE,
39470
39445
  showInSimplifiedHelpView: true,
@@ -39476,8 +39451,6 @@ var ts;
39476
39451
  name: "outDir",
39477
39452
  type: "string",
39478
39453
  affectsEmit: true,
39479
- affectsMultiFileEmitBuildInfo: true,
39480
- affectsDeclarationPath: true,
39481
39454
  isFilePath: true,
39482
39455
  paramType: ts.Diagnostics.DIRECTORY,
39483
39456
  showInSimplifiedHelpView: true,
@@ -39488,8 +39461,6 @@ var ts;
39488
39461
  name: "rootDir",
39489
39462
  type: "string",
39490
39463
  affectsEmit: true,
39491
- affectsMultiFileEmitBuildInfo: true,
39492
- affectsDeclarationPath: true,
39493
39464
  isFilePath: true,
39494
39465
  paramType: ts.Diagnostics.LOCATION,
39495
39466
  category: ts.Diagnostics.Modules,
@@ -39500,8 +39471,6 @@ var ts;
39500
39471
  name: "composite",
39501
39472
  type: "boolean",
39502
39473
  affectsEmit: true,
39503
- affectsMultiFileEmitBuildInfo: true,
39504
- affectsBundleEmitBuildInfo: true,
39505
39474
  isTSConfigOnly: true,
39506
39475
  category: ts.Diagnostics.Projects,
39507
39476
  transpileOptionValue: undefined,
@@ -39512,8 +39481,6 @@ var ts;
39512
39481
  name: "tsBuildInfoFile",
39513
39482
  type: "string",
39514
39483
  affectsEmit: true,
39515
- affectsMultiFileEmitBuildInfo: true,
39516
- affectsBundleEmitBuildInfo: true,
39517
39484
  isFilePath: true,
39518
39485
  paramType: ts.Diagnostics.FILE,
39519
39486
  category: ts.Diagnostics.Projects,
@@ -39525,7 +39492,6 @@ var ts;
39525
39492
  name: "removeComments",
39526
39493
  type: "boolean",
39527
39494
  affectsEmit: true,
39528
- affectsMultiFileEmitBuildInfo: true,
39529
39495
  showInSimplifiedHelpView: true,
39530
39496
  category: ts.Diagnostics.Emit,
39531
39497
  defaultValueDescription: false,
@@ -39544,7 +39510,6 @@ var ts;
39544
39510
  name: "importHelpers",
39545
39511
  type: "boolean",
39546
39512
  affectsEmit: true,
39547
- affectsMultiFileEmitBuildInfo: true,
39548
39513
  category: ts.Diagnostics.Emit,
39549
39514
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
39550
39515
  defaultValueDescription: false,
@@ -39558,7 +39523,6 @@ var ts;
39558
39523
  })),
39559
39524
  affectsEmit: true,
39560
39525
  affectsSemanticDiagnostics: true,
39561
- affectsMultiFileEmitBuildInfo: true,
39562
39526
  category: ts.Diagnostics.Emit,
39563
39527
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
39564
39528
  defaultValueDescription: 0 /* Remove */,
@@ -39567,7 +39531,6 @@ var ts;
39567
39531
  name: "downlevelIteration",
39568
39532
  type: "boolean",
39569
39533
  affectsEmit: true,
39570
- affectsMultiFileEmitBuildInfo: true,
39571
39534
  category: ts.Diagnostics.Emit,
39572
39535
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
39573
39536
  defaultValueDescription: false,
@@ -39586,9 +39549,6 @@ var ts;
39586
39549
  type: "boolean",
39587
39550
  // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
39588
39551
  // The value of each strictFlag depends on own strictFlag value or this and never accessed directly.
39589
- // But we need to store `strict` in builf info, even though it won't be examined directly, so that the
39590
- // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly
39591
- affectsMultiFileEmitBuildInfo: true,
39592
39552
  showInSimplifiedHelpView: true,
39593
39553
  category: ts.Diagnostics.Type_Checking,
39594
39554
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -39598,7 +39558,6 @@ var ts;
39598
39558
  name: "noImplicitAny",
39599
39559
  type: "boolean",
39600
39560
  affectsSemanticDiagnostics: true,
39601
- affectsMultiFileEmitBuildInfo: true,
39602
39561
  strictFlag: true,
39603
39562
  category: ts.Diagnostics.Type_Checking,
39604
39563
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -39608,7 +39567,6 @@ var ts;
39608
39567
  name: "strictNullChecks",
39609
39568
  type: "boolean",
39610
39569
  affectsSemanticDiagnostics: true,
39611
- affectsMultiFileEmitBuildInfo: true,
39612
39570
  strictFlag: true,
39613
39571
  category: ts.Diagnostics.Type_Checking,
39614
39572
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -39617,8 +39575,6 @@ var ts;
39617
39575
  {
39618
39576
  name: "strictFunctionTypes",
39619
39577
  type: "boolean",
39620
- affectsSemanticDiagnostics: true,
39621
- affectsMultiFileEmitBuildInfo: true,
39622
39578
  strictFlag: true,
39623
39579
  category: ts.Diagnostics.Type_Checking,
39624
39580
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -39627,8 +39583,6 @@ var ts;
39627
39583
  {
39628
39584
  name: "strictBindCallApply",
39629
39585
  type: "boolean",
39630
- affectsSemanticDiagnostics: true,
39631
- affectsMultiFileEmitBuildInfo: true,
39632
39586
  strictFlag: true,
39633
39587
  category: ts.Diagnostics.Type_Checking,
39634
39588
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -39638,7 +39592,6 @@ var ts;
39638
39592
  name: "strictPropertyInitialization",
39639
39593
  type: "boolean",
39640
39594
  affectsSemanticDiagnostics: true,
39641
- affectsMultiFileEmitBuildInfo: true,
39642
39595
  strictFlag: true,
39643
39596
  category: ts.Diagnostics.Type_Checking,
39644
39597
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -39648,7 +39601,6 @@ var ts;
39648
39601
  name: "noImplicitThis",
39649
39602
  type: "boolean",
39650
39603
  affectsSemanticDiagnostics: true,
39651
- affectsMultiFileEmitBuildInfo: true,
39652
39604
  strictFlag: true,
39653
39605
  category: ts.Diagnostics.Type_Checking,
39654
39606
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -39658,7 +39610,6 @@ var ts;
39658
39610
  name: "useUnknownInCatchVariables",
39659
39611
  type: "boolean",
39660
39612
  affectsSemanticDiagnostics: true,
39661
- affectsMultiFileEmitBuildInfo: true,
39662
39613
  strictFlag: true,
39663
39614
  category: ts.Diagnostics.Type_Checking,
39664
39615
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -39668,8 +39619,6 @@ var ts;
39668
39619
  name: "alwaysStrict",
39669
39620
  type: "boolean",
39670
39621
  affectsSourceFile: true,
39671
- affectsEmit: true,
39672
- affectsMultiFileEmitBuildInfo: true,
39673
39622
  strictFlag: true,
39674
39623
  category: ts.Diagnostics.Type_Checking,
39675
39624
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -39680,7 +39629,6 @@ var ts;
39680
39629
  name: "noUnusedLocals",
39681
39630
  type: "boolean",
39682
39631
  affectsSemanticDiagnostics: true,
39683
- affectsMultiFileEmitBuildInfo: true,
39684
39632
  category: ts.Diagnostics.Type_Checking,
39685
39633
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
39686
39634
  defaultValueDescription: false,
@@ -39689,7 +39637,6 @@ var ts;
39689
39637
  name: "noUnusedParameters",
39690
39638
  type: "boolean",
39691
39639
  affectsSemanticDiagnostics: true,
39692
- affectsMultiFileEmitBuildInfo: true,
39693
39640
  category: ts.Diagnostics.Type_Checking,
39694
39641
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
39695
39642
  defaultValueDescription: false,
@@ -39698,7 +39645,6 @@ var ts;
39698
39645
  name: "exactOptionalPropertyTypes",
39699
39646
  type: "boolean",
39700
39647
  affectsSemanticDiagnostics: true,
39701
- affectsMultiFileEmitBuildInfo: true,
39702
39648
  category: ts.Diagnostics.Type_Checking,
39703
39649
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
39704
39650
  defaultValueDescription: false,
@@ -39707,7 +39653,6 @@ var ts;
39707
39653
  name: "noImplicitReturns",
39708
39654
  type: "boolean",
39709
39655
  affectsSemanticDiagnostics: true,
39710
- affectsMultiFileEmitBuildInfo: true,
39711
39656
  category: ts.Diagnostics.Type_Checking,
39712
39657
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
39713
39658
  defaultValueDescription: false,
@@ -39717,7 +39662,6 @@ var ts;
39717
39662
  type: "boolean",
39718
39663
  affectsBindDiagnostics: true,
39719
39664
  affectsSemanticDiagnostics: true,
39720
- affectsMultiFileEmitBuildInfo: true,
39721
39665
  category: ts.Diagnostics.Type_Checking,
39722
39666
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
39723
39667
  defaultValueDescription: false,
@@ -39726,7 +39670,6 @@ var ts;
39726
39670
  name: "noUncheckedIndexedAccess",
39727
39671
  type: "boolean",
39728
39672
  affectsSemanticDiagnostics: true,
39729
- affectsMultiFileEmitBuildInfo: true,
39730
39673
  category: ts.Diagnostics.Type_Checking,
39731
39674
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
39732
39675
  defaultValueDescription: false,
@@ -39735,7 +39678,6 @@ var ts;
39735
39678
  name: "noImplicitOverride",
39736
39679
  type: "boolean",
39737
39680
  affectsSemanticDiagnostics: true,
39738
- affectsMultiFileEmitBuildInfo: true,
39739
39681
  category: ts.Diagnostics.Type_Checking,
39740
39682
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
39741
39683
  defaultValueDescription: false,
@@ -39743,8 +39685,6 @@ var ts;
39743
39685
  {
39744
39686
  name: "noPropertyAccessFromIndexSignature",
39745
39687
  type: "boolean",
39746
- affectsSemanticDiagnostics: true,
39747
- affectsMultiFileEmitBuildInfo: true,
39748
39688
  showInSimplifiedHelpView: false,
39749
39689
  category: ts.Diagnostics.Type_Checking,
39750
39690
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -39830,7 +39770,6 @@ var ts;
39830
39770
  name: "allowSyntheticDefaultImports",
39831
39771
  type: "boolean",
39832
39772
  affectsSemanticDiagnostics: true,
39833
- affectsMultiFileEmitBuildInfo: true,
39834
39773
  category: ts.Diagnostics.Interop_Constraints,
39835
39774
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
39836
39775
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -39840,7 +39779,6 @@ var ts;
39840
39779
  type: "boolean",
39841
39780
  affectsSemanticDiagnostics: true,
39842
39781
  affectsEmit: true,
39843
- affectsMultiFileEmitBuildInfo: true,
39844
39782
  showInSimplifiedHelpView: true,
39845
39783
  category: ts.Diagnostics.Interop_Constraints,
39846
39784
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -39857,7 +39795,6 @@ var ts;
39857
39795
  name: "allowUmdGlobalAccess",
39858
39796
  type: "boolean",
39859
39797
  affectsSemanticDiagnostics: true,
39860
- affectsMultiFileEmitBuildInfo: true,
39861
39798
  category: ts.Diagnostics.Modules,
39862
39799
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
39863
39800
  defaultValueDescription: false,
@@ -39879,7 +39816,6 @@ var ts;
39879
39816
  name: "sourceRoot",
39880
39817
  type: "string",
39881
39818
  affectsEmit: true,
39882
- affectsMultiFileEmitBuildInfo: true,
39883
39819
  paramType: ts.Diagnostics.LOCATION,
39884
39820
  category: ts.Diagnostics.Emit,
39885
39821
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -39888,7 +39824,6 @@ var ts;
39888
39824
  name: "mapRoot",
39889
39825
  type: "string",
39890
39826
  affectsEmit: true,
39891
- affectsMultiFileEmitBuildInfo: true,
39892
39827
  paramType: ts.Diagnostics.LOCATION,
39893
39828
  category: ts.Diagnostics.Emit,
39894
39829
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -39897,7 +39832,6 @@ var ts;
39897
39832
  name: "inlineSourceMap",
39898
39833
  type: "boolean",
39899
39834
  affectsEmit: true,
39900
- affectsMultiFileEmitBuildInfo: true,
39901
39835
  category: ts.Diagnostics.Emit,
39902
39836
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
39903
39837
  defaultValueDescription: false,
@@ -39906,7 +39840,6 @@ var ts;
39906
39840
  name: "inlineSources",
39907
39841
  type: "boolean",
39908
39842
  affectsEmit: true,
39909
- affectsMultiFileEmitBuildInfo: true,
39910
39843
  category: ts.Diagnostics.Emit,
39911
39844
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
39912
39845
  defaultValueDescription: false,
@@ -39916,7 +39849,6 @@ var ts;
39916
39849
  name: "experimentalDecorators",
39917
39850
  type: "boolean",
39918
39851
  affectsSemanticDiagnostics: true,
39919
- affectsMultiFileEmitBuildInfo: true,
39920
39852
  category: ts.Diagnostics.Language_and_Environment,
39921
39853
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
39922
39854
  defaultValueDescription: false,
@@ -39926,7 +39858,6 @@ var ts;
39926
39858
  type: "boolean",
39927
39859
  affectsSemanticDiagnostics: true,
39928
39860
  affectsEmit: true,
39929
- affectsMultiFileEmitBuildInfo: true,
39930
39861
  category: ts.Diagnostics.Language_and_Environment,
39931
39862
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
39932
39863
  defaultValueDescription: false,
@@ -39951,7 +39882,6 @@ var ts;
39951
39882
  type: "string",
39952
39883
  affectsSemanticDiagnostics: true,
39953
39884
  affectsEmit: true,
39954
- affectsMultiFileEmitBuildInfo: true,
39955
39885
  affectsModuleResolution: true,
39956
39886
  category: ts.Diagnostics.Language_and_Environment,
39957
39887
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -39969,9 +39899,6 @@ var ts;
39969
39899
  name: "out",
39970
39900
  type: "string",
39971
39901
  affectsEmit: true,
39972
- affectsMultiFileEmitBuildInfo: true,
39973
- affectsDeclarationPath: true,
39974
- affectsBundleEmitBuildInfo: true,
39975
39902
  isFilePath: false,
39976
39903
  // for correct behaviour, please use outFile
39977
39904
  category: ts.Diagnostics.Backwards_Compatibility,
@@ -39983,7 +39910,6 @@ var ts;
39983
39910
  name: "reactNamespace",
39984
39911
  type: "string",
39985
39912
  affectsEmit: true,
39986
- affectsMultiFileEmitBuildInfo: true,
39987
39913
  category: ts.Diagnostics.Language_and_Environment,
39988
39914
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
39989
39915
  defaultValueDescription: "`React`",
@@ -39991,8 +39917,6 @@ var ts;
39991
39917
  {
39992
39918
  name: "skipDefaultLibCheck",
39993
39919
  type: "boolean",
39994
- // We need to store these to determine whether `lib` files need to be rechecked
39995
- affectsMultiFileEmitBuildInfo: true,
39996
39920
  category: ts.Diagnostics.Completeness,
39997
39921
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
39998
39922
  defaultValueDescription: false,
@@ -40008,7 +39932,6 @@ var ts;
40008
39932
  name: "emitBOM",
40009
39933
  type: "boolean",
40010
39934
  affectsEmit: true,
40011
- affectsMultiFileEmitBuildInfo: true,
40012
39935
  category: ts.Diagnostics.Emit,
40013
39936
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
40014
39937
  defaultValueDescription: false,
@@ -40020,7 +39943,6 @@ var ts;
40020
39943
  lf: 1 /* LineFeed */
40021
39944
  })),
40022
39945
  affectsEmit: true,
40023
- affectsMultiFileEmitBuildInfo: true,
40024
39946
  paramType: ts.Diagnostics.NEWLINE,
40025
39947
  category: ts.Diagnostics.Emit,
40026
39948
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -40030,7 +39952,6 @@ var ts;
40030
39952
  name: "noErrorTruncation",
40031
39953
  type: "boolean",
40032
39954
  affectsSemanticDiagnostics: true,
40033
- affectsMultiFileEmitBuildInfo: true,
40034
39955
  category: ts.Diagnostics.Output_Formatting,
40035
39956
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
40036
39957
  defaultValueDescription: false,
@@ -40061,7 +39982,6 @@ var ts;
40061
39982
  name: "stripInternal",
40062
39983
  type: "boolean",
40063
39984
  affectsEmit: true,
40064
- affectsMultiFileEmitBuildInfo: true,
40065
39985
  category: ts.Diagnostics.Emit,
40066
39986
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
40067
39987
  defaultValueDescription: false,
@@ -40102,7 +40022,6 @@ var ts;
40102
40022
  name: "noImplicitUseStrict",
40103
40023
  type: "boolean",
40104
40024
  affectsSemanticDiagnostics: true,
40105
- affectsMultiFileEmitBuildInfo: true,
40106
40025
  category: ts.Diagnostics.Backwards_Compatibility,
40107
40026
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
40108
40027
  defaultValueDescription: false,
@@ -40111,7 +40030,6 @@ var ts;
40111
40030
  name: "noEmitHelpers",
40112
40031
  type: "boolean",
40113
40032
  affectsEmit: true,
40114
- affectsMultiFileEmitBuildInfo: true,
40115
40033
  category: ts.Diagnostics.Emit,
40116
40034
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
40117
40035
  defaultValueDescription: false,
@@ -40120,7 +40038,6 @@ var ts;
40120
40038
  name: "noEmitOnError",
40121
40039
  type: "boolean",
40122
40040
  affectsEmit: true,
40123
- affectsMultiFileEmitBuildInfo: true,
40124
40041
  category: ts.Diagnostics.Emit,
40125
40042
  transpileOptionValue: undefined,
40126
40043
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -40130,7 +40047,6 @@ var ts;
40130
40047
  name: "preserveConstEnums",
40131
40048
  type: "boolean",
40132
40049
  affectsEmit: true,
40133
- affectsMultiFileEmitBuildInfo: true,
40134
40050
  category: ts.Diagnostics.Emit,
40135
40051
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
40136
40052
  defaultValueDescription: false,
@@ -40139,8 +40055,6 @@ var ts;
40139
40055
  name: "declarationDir",
40140
40056
  type: "string",
40141
40057
  affectsEmit: true,
40142
- affectsMultiFileEmitBuildInfo: true,
40143
- affectsDeclarationPath: true,
40144
40058
  isFilePath: true,
40145
40059
  paramType: ts.Diagnostics.DIRECTORY,
40146
40060
  category: ts.Diagnostics.Emit,
@@ -40150,8 +40064,6 @@ var ts;
40150
40064
  {
40151
40065
  name: "skipLibCheck",
40152
40066
  type: "boolean",
40153
- // We need to store these to determine whether `lib` files need to be rechecked
40154
- affectsMultiFileEmitBuildInfo: true,
40155
40067
  category: ts.Diagnostics.Completeness,
40156
40068
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
40157
40069
  defaultValueDescription: false,
@@ -40161,7 +40073,6 @@ var ts;
40161
40073
  type: "boolean",
40162
40074
  affectsBindDiagnostics: true,
40163
40075
  affectsSemanticDiagnostics: true,
40164
- affectsMultiFileEmitBuildInfo: true,
40165
40076
  category: ts.Diagnostics.Type_Checking,
40166
40077
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
40167
40078
  defaultValueDescription: undefined,
@@ -40171,7 +40082,6 @@ var ts;
40171
40082
  type: "boolean",
40172
40083
  affectsBindDiagnostics: true,
40173
40084
  affectsSemanticDiagnostics: true,
40174
- affectsMultiFileEmitBuildInfo: true,
40175
40085
  category: ts.Diagnostics.Type_Checking,
40176
40086
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
40177
40087
  defaultValueDescription: undefined,
@@ -40180,7 +40090,6 @@ var ts;
40180
40090
  name: "suppressExcessPropertyErrors",
40181
40091
  type: "boolean",
40182
40092
  affectsSemanticDiagnostics: true,
40183
- affectsMultiFileEmitBuildInfo: true,
40184
40093
  category: ts.Diagnostics.Backwards_Compatibility,
40185
40094
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
40186
40095
  defaultValueDescription: false,
@@ -40189,7 +40098,6 @@ var ts;
40189
40098
  name: "suppressImplicitAnyIndexErrors",
40190
40099
  type: "boolean",
40191
40100
  affectsSemanticDiagnostics: true,
40192
- affectsMultiFileEmitBuildInfo: true,
40193
40101
  category: ts.Diagnostics.Backwards_Compatibility,
40194
40102
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
40195
40103
  defaultValueDescription: false,
@@ -40214,7 +40122,6 @@ var ts;
40214
40122
  name: "noStrictGenericChecks",
40215
40123
  type: "boolean",
40216
40124
  affectsSemanticDiagnostics: true,
40217
- affectsMultiFileEmitBuildInfo: true,
40218
40125
  category: ts.Diagnostics.Backwards_Compatibility,
40219
40126
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
40220
40127
  defaultValueDescription: false,
@@ -40224,7 +40131,6 @@ var ts;
40224
40131
  type: "boolean",
40225
40132
  affectsSemanticDiagnostics: true,
40226
40133
  affectsEmit: true,
40227
- affectsMultiFileEmitBuildInfo: true,
40228
40134
  category: ts.Diagnostics.Language_and_Environment,
40229
40135
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
40230
40136
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -40233,7 +40139,6 @@ var ts;
40233
40139
  name: "preserveValueImports",
40234
40140
  type: "boolean",
40235
40141
  affectsEmit: true,
40236
- affectsMultiFileEmitBuildInfo: true,
40237
40142
  category: ts.Diagnostics.Emit,
40238
40143
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
40239
40144
  defaultValueDescription: false,
@@ -40277,8 +40182,6 @@ var ts;
40277
40182
  /* @internal */
40278
40183
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
40279
40184
  /* @internal */
40280
- ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
40281
- /* @internal */
40282
40185
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
40283
40186
  /* @internal */
40284
40187
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -41134,7 +41037,6 @@ var ts;
41134
41037
  return optionDefinition.type;
41135
41038
  }
41136
41039
  }
41137
- /* @internal */
41138
41040
  function getNameOfCompilerOptionValue(value, customTypeMap) {
41139
41041
  // There is a typeMap associated with this command-line option so use it to map value back to its name
41140
41042
  return ts.forEachEntry(customTypeMap, function (mapValue, key) {
@@ -41143,7 +41045,6 @@ var ts;
41143
41045
  }
41144
41046
  });
41145
41047
  }
41146
- ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
41147
41048
  function serializeCompilerOptions(options, pathOptions) {
41148
41049
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
41149
41050
  }
@@ -48644,6 +48545,7 @@ var ts;
48644
48545
  var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
48645
48546
  emptyTypeLiteralSymbol.members = ts.createSymbolTable();
48646
48547
  var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
48548
+ var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType;
48647
48549
  var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
48648
48550
  emptyGenericType.instantiations = new ts.Map();
48649
48551
  var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
@@ -58814,7 +58716,7 @@ var ts;
58814
58716
  }
58815
58717
  }
58816
58718
  }
58817
- else if (t.flags & 469892092 /* DisjointDomains */) {
58719
+ else if (t.flags & 469892092 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) {
58818
58720
  hasDisjointDomainType = true;
58819
58721
  }
58820
58722
  }
@@ -58826,7 +58728,7 @@ var ts;
58826
58728
  // intersection operation to reduce the union constraints.
58827
58729
  for (var _a = 0, types_6 = types; _a < types_6.length; _a++) {
58828
58730
  var t = types_6[_a];
58829
- if (t.flags & 469892092 /* DisjointDomains */) {
58731
+ if (t.flags & 469892092 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) {
58830
58732
  constraints = ts.append(constraints, t);
58831
58733
  }
58832
58734
  }
@@ -61375,7 +61277,7 @@ var ts;
61375
61277
  }
61376
61278
  return includes;
61377
61279
  }
61378
- function removeRedundantPrimitiveTypes(types, includes) {
61280
+ function removeRedundantSupertypes(types, includes) {
61379
61281
  var i = types.length;
61380
61282
  while (i > 0) {
61381
61283
  i--;
@@ -61383,7 +61285,9 @@ var ts;
61383
61285
  var remove = t.flags & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
61384
61286
  t.flags & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
61385
61287
  t.flags & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
61386
- t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */;
61288
+ t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ ||
61289
+ t.flags & 16384 /* Void */ && includes & 32768 /* Undefined */ ||
61290
+ isEmptyAnonymousObjectType(t) && includes & 470302716 /* DefinitelyNonNullable */;
61387
61291
  if (remove) {
61388
61292
  ts.orderedRemoveItemAt(types, i);
61389
61293
  }
@@ -61505,7 +61409,7 @@ var ts;
61505
61409
  // a type alias of the form "type List<T> = T & { next: List<T> }" cannot be reduced during its declaration.
61506
61410
  // Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
61507
61411
  // for intersections of types with signatures can be deterministic.
61508
- function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
61412
+ function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
61509
61413
  var typeMembershipMap = new ts.Map();
61510
61414
  var includes = addTypesToIntersection(typeMembershipMap, 0, types);
61511
61415
  var typeSet = ts.arrayFrom(typeMembershipMap.values());
@@ -61542,11 +61446,11 @@ var ts;
61542
61446
  if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
61543
61447
  includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
61544
61448
  includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
61545
- includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */) {
61546
- removeRedundantPrimitiveTypes(typeSet, includes);
61547
- }
61548
- if (includes & 16777216 /* IncludesEmptyObject */ && includes & 524288 /* Object */) {
61549
- ts.orderedRemoveItemAt(typeSet, ts.findIndex(typeSet, isEmptyAnonymousObjectType));
61449
+ includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ ||
61450
+ includes & 16384 /* Void */ && includes & 32768 /* Undefined */ ||
61451
+ includes & 16777216 /* IncludesEmptyObject */ && includes & 470302716 /* DefinitelyNonNullable */) {
61452
+ if (!noSupertypeReduction)
61453
+ removeRedundantSupertypes(typeSet, includes);
61550
61454
  }
61551
61455
  if (includes & 262144 /* IncludesMissingType */) {
61552
61456
  typeSet[typeSet.indexOf(undefinedType)] = missingType;
@@ -61585,8 +61489,9 @@ var ts;
61585
61489
  }
61586
61490
  var constituents = getCrossProductIntersections(typeSet);
61587
61491
  // We attach a denormalized origin type when at least one constituent of the cross-product union is an
61588
- // intersection (i.e. when the intersection didn't just reduce one or more unions to smaller unions).
61589
- var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152 /* Intersection */); }) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : undefined;
61492
+ // intersection (i.e. when the intersection didn't just reduce one or more unions to smaller unions) and
61493
+ // the denormalized origin has fewer constituents than the union itself.
61494
+ var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152 /* Intersection */); }) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : undefined;
61590
61495
  result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
61591
61496
  }
61592
61497
  }
@@ -61629,11 +61534,21 @@ var ts;
61629
61534
  }
61630
61535
  return intersections;
61631
61536
  }
61537
+ function getConstituentCount(type) {
61538
+ return !(type.flags & 3145728 /* UnionOrIntersection */) || type.aliasSymbol ? 1 :
61539
+ type.flags & 1048576 /* Union */ && type.origin ? getConstituentCount(type.origin) :
61540
+ getConstituentCountOfTypes(type.types);
61541
+ }
61542
+ function getConstituentCountOfTypes(types) {
61543
+ return ts.reduceLeft(types, function (n, t) { return n + getConstituentCount(t); }, 0);
61544
+ }
61632
61545
  function getTypeFromIntersectionTypeNode(node) {
61633
61546
  var links = getNodeLinks(node);
61634
61547
  if (!links.resolvedType) {
61635
61548
  var aliasSymbol = getAliasSymbolForTypeNode(node);
61636
- links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
61549
+ var types = ts.map(node.types, getTypeFromTypeNode);
61550
+ var noSupertypeReduction = types.length === 2 && !!(types[0].flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) && types[1] === emptyTypeLiteralType;
61551
+ links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
61637
61552
  }
61638
61553
  return links.resolvedType;
61639
61554
  }
@@ -64419,6 +64334,17 @@ var ts;
64419
64334
  return !!(ts.getObjectFlags(type) & 16 /* Anonymous */ && (type.members && isEmptyResolvedType(type) ||
64420
64335
  type.symbol && type.symbol.flags & 2048 /* TypeLiteral */ && getMembersOfSymbol(type.symbol).size === 0));
64421
64336
  }
64337
+ function isUnknownLikeUnionType(type) {
64338
+ if (strictNullChecks && type.flags & 1048576 /* Union */) {
64339
+ if (!(type.objectFlags & 33554432 /* IsUnknownLikeUnionComputed */)) {
64340
+ var types = type.types;
64341
+ type.objectFlags |= 33554432 /* IsUnknownLikeUnionComputed */ | (types.length >= 3 && types[0].flags & 32768 /* Undefined */ &&
64342
+ types[1].flags & 65536 /* Null */ && ts.some(types, isEmptyAnonymousObjectType) ? 67108864 /* IsUnknownLikeUnion */ : 0);
64343
+ }
64344
+ return !!(type.objectFlags & 67108864 /* IsUnknownLikeUnion */);
64345
+ }
64346
+ return false;
64347
+ }
64422
64348
  function isStringIndexSignatureOnlyType(type) {
64423
64349
  return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) ||
64424
64350
  type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isStringIndexSignatureOnlyType) ||
@@ -64498,7 +64424,7 @@ var ts;
64498
64424
  return true;
64499
64425
  if (s & 65536 /* Null */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & 65536 /* Null */))
64500
64426
  return true;
64501
- if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */)
64427
+ if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */ && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source)))
64502
64428
  return true;
64503
64429
  if (relation === assignableRelation || relation === comparableRelation) {
64504
64430
  if (s & 1 /* Any */)
@@ -64508,6 +64434,9 @@ var ts;
64508
64434
  // bit-flag enum types sometimes look like literal enum types with numeric literal values.
64509
64435
  if (s & (8 /* Number */ | 256 /* NumberLiteral */) && !(s & 1024 /* EnumLiteral */) && (t & 32 /* Enum */ || relation === assignableRelation && t & 256 /* NumberLiteral */ && t & 1024 /* EnumLiteral */))
64510
64436
  return true;
64437
+ // Anything is assignable to a union containing undefined, null, and {}
64438
+ if (isUnknownLikeUnionType(target))
64439
+ return true;
64511
64440
  }
64512
64441
  return false;
64513
64442
  }
@@ -64550,16 +64479,27 @@ var ts;
64550
64479
  function getNormalizedType(type, writing) {
64551
64480
  while (true) {
64552
64481
  var t = isFreshLiteralType(type) ? type.regularType :
64553
- ts.getObjectFlags(type) & 4 /* Reference */ && type.node ? createTypeReference(type.target, getTypeArguments(type)) :
64554
- type.flags & 3145728 /* UnionOrIntersection */ ? getReducedType(type) :
64482
+ ts.getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type :
64483
+ type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) :
64555
64484
  type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : type.substitute :
64556
64485
  type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) :
64557
64486
  type;
64558
- t = getSingleBaseForNonAugmentingSubtype(t) || t;
64559
64487
  if (t === type)
64560
- break;
64488
+ return t;
64561
64489
  type = t;
64562
64490
  }
64491
+ }
64492
+ function getNormalizedUnionOrIntersectionType(type, writing) {
64493
+ var reduced = getReducedType(type);
64494
+ if (reduced !== type) {
64495
+ return reduced;
64496
+ }
64497
+ if (type.flags & 2097152 /* Intersection */) {
64498
+ var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
64499
+ if (normalizedTypes !== type.types) {
64500
+ return getIntersectionType(normalizedTypes);
64501
+ }
64502
+ }
64563
64503
  return type;
64564
64504
  }
64565
64505
  /**
@@ -65006,6 +64946,7 @@ var ts;
65006
64946
  return 0 /* False */;
65007
64947
  }
65008
64948
  function reportErrorResults(originalSource, originalTarget, source, target, headMessage) {
64949
+ var _a, _b;
65009
64950
  var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
65010
64951
  var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
65011
64952
  source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
@@ -65046,6 +64987,9 @@ var ts;
65046
64987
  return;
65047
64988
  }
65048
64989
  reportRelationError(headMessage, source, target);
64990
+ if (strictNullChecks && source.flags & 8650752 /* TypeVariable */ && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source) && isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */))) {
64991
+ associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_probably_needs_an_extends_object_constraint));
64992
+ }
65049
64993
  }
65050
64994
  function traceUnionsOrIntersectionsTooLarge(source, target) {
65051
64995
  if (!ts.tracing) {
@@ -65832,13 +65776,6 @@ var ts;
65832
65776
  // IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
65833
65777
  if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
65834
65778
  var constraint = getConstraintOfType(source) || unknownType;
65835
- if (!getConstraintOfType(source) || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
65836
- // A type variable with no constraint is not related to the non-primitive object type.
65837
- if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
65838
- resetErrorInfo(saveErrorInfo);
65839
- return result;
65840
- }
65841
- }
65842
65779
  // hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed
65843
65780
  if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
65844
65781
  resetErrorInfo(saveErrorInfo);
@@ -67312,9 +67249,11 @@ var ts;
67312
67249
  return getSupertypeOrUnion(types);
67313
67250
  }
67314
67251
  var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 98304 /* Nullable */); });
67315
- return primaryTypes.length ?
67316
- getNullableType(getSupertypeOrUnion(primaryTypes), getFalsyFlagsOfTypes(types) & 98304 /* Nullable */) :
67317
- getUnionType(types, 2 /* Subtype */);
67252
+ if (primaryTypes.length) {
67253
+ var supertypeOrUnion = getSupertypeOrUnion(primaryTypes);
67254
+ return primaryTypes === types ? supertypeOrUnion : getUnionType(__spreadArray([supertypeOrUnion], ts.filter(types, function (t) { return !!(t.flags & 98304 /* Nullable */); }), true));
67255
+ }
67256
+ return getUnionType(types, 2 /* Subtype */);
67318
67257
  }
67319
67258
  // Return the leftmost type for which no type to the right is a subtype.
67320
67259
  function getCommonSubtype(types) {
@@ -67513,12 +67452,13 @@ var ts;
67513
67452
  // flags for the string, number, boolean, "", 0, false, void, undefined, or null types respectively. Returns
67514
67453
  // no flags for all other types (including non-falsy literal types).
67515
67454
  function getFalsyFlags(type) {
67516
- return type.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(type.types) :
67517
- type.flags & 128 /* StringLiteral */ ? type.value === "" ? 128 /* StringLiteral */ : 0 :
67518
- type.flags & 256 /* NumberLiteral */ ? type.value === 0 ? 256 /* NumberLiteral */ : 0 :
67519
- type.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(type) ? 2048 /* BigIntLiteral */ : 0 :
67520
- type.flags & 512 /* BooleanLiteral */ ? (type === falseType || type === regularFalseType) ? 512 /* BooleanLiteral */ : 0 :
67521
- type.flags & 117724 /* PossiblyFalsy */;
67455
+ var t = type.flags & 2097152 /* Intersection */ ? getBaseConstraintOrType(type) : type;
67456
+ return t.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(t.types) :
67457
+ t.flags & 128 /* StringLiteral */ ? t.value === "" ? 128 /* StringLiteral */ : 0 :
67458
+ t.flags & 256 /* NumberLiteral */ ? t.value === 0 ? 256 /* NumberLiteral */ : 0 :
67459
+ t.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(t) ? 2048 /* BigIntLiteral */ : 0 :
67460
+ t.flags & 512 /* BooleanLiteral */ ? (t === falseType || t === regularFalseType) ? 512 /* BooleanLiteral */ : 0 :
67461
+ t.flags & 117724 /* PossiblyFalsy */;
67522
67462
  }
67523
67463
  function removeDefinitelyFalsyTypes(type) {
67524
67464
  return getFalsyFlags(type) & 117632 /* DefinitelyFalsy */ ?
@@ -67558,20 +67498,22 @@ var ts;
67558
67498
  return type.flags & 32768 /* Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]);
67559
67499
  }
67560
67500
  function getGlobalNonNullableTypeInstantiation(type) {
67561
- // First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
67562
- // 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
67563
- // that isn't eliminated by a NonNullable<T> instantiation.
67564
- var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
67565
67501
  if (!deferredGlobalNonNullableTypeAlias) {
67566
67502
  deferredGlobalNonNullableTypeAlias = getGlobalSymbol("NonNullable", 524288 /* TypeAlias */, /*diagnostic*/ undefined) || unknownSymbol;
67567
67503
  }
67568
- // If the NonNullable<T> type is available, return an instantiation. Otherwise just return the reduced type.
67569
67504
  return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
67570
- getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
67571
- reducedType;
67505
+ getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [type]) :
67506
+ getIntersectionType([type, emptyObjectType]);
67572
67507
  }
67573
67508
  function getNonNullableType(type) {
67574
- return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
67509
+ if (strictNullChecks) {
67510
+ // First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
67511
+ // 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
67512
+ // that isn't eliminated by a NonNullable<T> instantiation.
67513
+ var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
67514
+ return maybeTypeOfKind(reducedType, 465829888 /* Instantiable */) ? getGlobalNonNullableTypeInstantiation(reducedType) : reducedType;
67515
+ }
67516
+ return type;
67575
67517
  }
67576
67518
  function addOptionalTypeMarker(type) {
67577
67519
  return strictNullChecks ? getUnionType([type, optionalType]) : type;
@@ -69679,6 +69621,24 @@ var ts;
69679
69621
  function getTypeWithFacts(type, include) {
69680
69622
  return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
69681
69623
  }
69624
+ function getIntersectionWithFacts(type, facts) {
69625
+ var reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
69626
+ if (strictNullChecks) {
69627
+ switch (facts) {
69628
+ case 524288 /* NEUndefined */:
69629
+ return mapType(reduced, function (t) { return getTypeFacts(t) & 65536 /* EQUndefined */ ? getIntersectionType([t, getTypeFacts(t) & 131072 /* EQNull */ && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t; });
69630
+ case 1048576 /* NENull */:
69631
+ return mapType(reduced, function (t) { return getTypeFacts(t) & 131072 /* EQNull */ ? getIntersectionType([t, getTypeFacts(t) & 65536 /* EQUndefined */ && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t; });
69632
+ case 2097152 /* NEUndefinedOrNull */:
69633
+ case 4194304 /* Truthy */:
69634
+ return mapType(reduced, function (t) { return getTypeFacts(t) & 262144 /* EQUndefinedOrNull */ ? getGlobalNonNullableTypeInstantiation(t) : t; });
69635
+ }
69636
+ }
69637
+ return reduced;
69638
+ }
69639
+ function recombineUnknownType(type) {
69640
+ return type === unknownUnionType ? unknownType : type;
69641
+ }
69682
69642
  function getTypeWithDefault(type, defaultExpression) {
69683
69643
  return defaultExpression ?
69684
69644
  getUnionType([getNonUndefinedType(type), getTypeOfExpression(defaultExpression)]) :
@@ -70736,7 +70696,7 @@ var ts;
70736
70696
  if (isEvolvingArrayTypeList(types)) {
70737
70697
  return getEvolvingArrayType(getUnionType(ts.map(types, getElementTypeOfEvolvingArrayType)));
70738
70698
  }
70739
- var result = getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction);
70699
+ var result = recombineUnknownType(getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction));
70740
70700
  if (result !== declaredType && result.flags & declaredType.flags & 1048576 /* Union */ && ts.arraysEqual(result.types, declaredType.types)) {
70741
70701
  return declaredType;
70742
70702
  }
@@ -70838,8 +70798,7 @@ var ts;
70838
70798
  }
70839
70799
  function narrowTypeByTruthiness(type, expr, assumeTrue) {
70840
70800
  if (isMatchingReference(reference, expr)) {
70841
- return type.flags & 2 /* Unknown */ && assumeTrue ? nonNullUnknownType :
70842
- getTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
70801
+ return getIntersectionWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
70843
70802
  }
70844
70803
  if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
70845
70804
  type = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
@@ -70992,9 +70951,6 @@ var ts;
70992
70951
  assumeTrue = !assumeTrue;
70993
70952
  }
70994
70953
  var valueType = getTypeOfExpression(value);
70995
- if (assumeTrue && (type.flags & 2 /* Unknown */) && (operator === 34 /* EqualsEqualsToken */ || operator === 35 /* ExclamationEqualsToken */) && (valueType.flags & 65536 /* Null */)) {
70996
- return getUnionType([nullType, undefinedType]);
70997
- }
70998
70954
  if ((type.flags & 2 /* Unknown */) && assumeTrue && (operator === 36 /* EqualsEqualsEqualsToken */ || operator === 37 /* ExclamationEqualsEqualsToken */)) {
70999
70955
  if (valueType.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */)) {
71000
70956
  return valueType;
@@ -71014,7 +70970,7 @@ var ts;
71014
70970
  valueType.flags & 65536 /* Null */ ?
71015
70971
  assumeTrue ? 131072 /* EQNull */ : 1048576 /* NENull */ :
71016
70972
  assumeTrue ? 65536 /* EQUndefined */ : 524288 /* NEUndefined */;
71017
- return type.flags & 2 /* Unknown */ && facts & (1048576 /* NENull */ | 2097152 /* NEUndefinedOrNull */) ? nonNullUnknownType : getTypeWithFacts(type, facts);
70973
+ return getIntersectionWithFacts(type, facts);
71018
70974
  }
71019
70975
  if (assumeTrue) {
71020
70976
  var filterFn = operator === 34 /* EqualsEqualsToken */ ?
@@ -71042,17 +70998,11 @@ var ts;
71042
70998
  if (type.flags & 1 /* Any */ && literal.text === "function") {
71043
70999
  return type;
71044
71000
  }
71045
- if (assumeTrue && type.flags & 2 /* Unknown */ && literal.text === "object") {
71046
- // The non-null unknown type is used to track whether a previous narrowing operation has removed the null type
71047
- // from the unknown type. For example, the expression `x && typeof x === 'object'` first narrows x to the non-null
71048
- // unknown type, and then narrows that to the non-primitive type.
71049
- return type === nonNullUnknownType ? nonPrimitiveType : getUnionType([nonPrimitiveType, nullType]);
71050
- }
71051
71001
  var facts = assumeTrue ?
71052
71002
  typeofEQFacts.get(literal.text) || 128 /* TypeofEQHostObject */ :
71053
71003
  typeofNEFacts.get(literal.text) || 32768 /* TypeofNEHostObject */;
71054
71004
  var impliedType = getImpliedTypeFromTypeofGuard(type, literal.text);
71055
- return getTypeWithFacts(assumeTrue && impliedType ? mapType(type, narrowUnionMemberByTypeof(impliedType)) : type, facts);
71005
+ return getTypeWithFacts(assumeTrue && impliedType ? narrowTypeByImpliedType(type, impliedType) : type, facts);
71056
71006
  }
71057
71007
  function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) {
71058
71008
  var everyClauseChecks = clauseStart !== clauseEnd && ts.every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck);
@@ -71101,10 +71051,10 @@ var ts;
71101
71051
  }
71102
71052
  function getImpliedTypeFromTypeofGuard(type, text) {
71103
71053
  switch (text) {
71054
+ case "object":
71055
+ return type.flags & 1 /* Any */ ? type : getUnionType([nullType, nonPrimitiveType]);
71104
71056
  case "function":
71105
71057
  return type.flags & 1 /* Any */ ? type : globalFunctionType;
71106
- case "object":
71107
- return type.flags & 2 /* Unknown */ ? getUnionType([nonPrimitiveType, nullType]) : type;
71108
71058
  default:
71109
71059
  return typeofTypesByName.get(text);
71110
71060
  }
@@ -71115,22 +71065,27 @@ var ts;
71115
71065
  // the guard. For example: narrowing `{} | undefined` by `"boolean"` should produce the type `boolean`, not
71116
71066
  // the filtered type `{}`. For this reason we narrow constituents of the union individually, in addition to
71117
71067
  // filtering by type-facts.
71118
- function narrowUnionMemberByTypeof(candidate) {
71119
- return function (type) {
71120
- if (isTypeSubtypeOf(type, candidate)) {
71121
- return type;
71122
- }
71123
- if (isTypeSubtypeOf(candidate, type)) {
71124
- return candidate;
71068
+ function narrowTypeByImpliedType(type, candidate) {
71069
+ if (type.flags & 3 /* AnyOrUnknown */) {
71070
+ return candidate;
71071
+ }
71072
+ return mapType(type, function (t) {
71073
+ if (isTypeRelatedTo(t, candidate, strictSubtypeRelation)) {
71074
+ return t;
71125
71075
  }
71126
- if (type.flags & 465829888 /* Instantiable */) {
71127
- var constraint = getBaseConstraintOfType(type) || anyType;
71128
- if (isTypeSubtypeOf(candidate, constraint)) {
71129
- return getIntersectionType([type, candidate]);
71076
+ return mapType(candidate, function (c) {
71077
+ if (!areTypesComparable(t, c)) {
71078
+ return neverType;
71130
71079
  }
71131
- }
71132
- return type;
71133
- };
71080
+ if (c.flags & 131068 /* Primitive */ && t.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(t)) {
71081
+ return isTypeSubtypeOf(c, t) ? c : neverType;
71082
+ }
71083
+ if (c === globalFunctionType && isTypeSubtypeOf(c, t)) {
71084
+ return c;
71085
+ }
71086
+ return getIntersectionType([t, c]);
71087
+ });
71088
+ });
71134
71089
  }
71135
71090
  function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
71136
71091
  var switchWitnesses = getSwitchClauseTypeOfWitnesses(switchStatement, /*retainDefault*/ true);
@@ -71189,7 +71144,7 @@ var ts;
71189
71144
  because it is caught in the first clause.
71190
71145
  */
71191
71146
  var impliedType = getTypeWithFacts(getUnionType(clauseWitnesses.map(function (text) { return getImpliedTypeFromTypeofGuard(type, text) || type; })), switchFacts);
71192
- return getTypeWithFacts(mapType(type, narrowUnionMemberByTypeof(impliedType)), switchFacts);
71147
+ return getTypeWithFacts(narrowTypeByImpliedType(type, impliedType), switchFacts);
71193
71148
  }
71194
71149
  function isMatchingConstructorReference(expr) {
71195
71150
  return (ts.isPropertyAccessExpression(expr) && ts.idText(expr.name) === "constructor" ||
@@ -71493,7 +71448,9 @@ var ts;
71493
71448
  !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
71494
71449
  }
71495
71450
  function isGenericTypeWithUnionConstraint(type) {
71496
- return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
71451
+ return type.flags & 2097152 /* Intersection */ ?
71452
+ ts.some(type.types, isGenericTypeWithUnionConstraint) :
71453
+ !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
71497
71454
  }
71498
71455
  function isGenericTypeWithoutNullableConstraint(type) {
71499
71456
  return !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
@@ -71521,7 +71478,7 @@ var ts;
71521
71478
  var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
71522
71479
  someType(type, isGenericTypeWithUnionConstraint) &&
71523
71480
  (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
71524
- return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
71481
+ return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
71525
71482
  }
71526
71483
  function isExportOrExportExpression(location) {
71527
71484
  return !!ts.findAncestor(location, function (n) {
@@ -82621,7 +82578,7 @@ var ts;
82621
82578
  // For a binding pattern, validate the initializer and exit
82622
82579
  if (ts.isBindingPattern(node.name)) {
82623
82580
  var needCheckInitializer = node.initializer && node.parent.parent.kind !== 243 /* ForInStatement */;
82624
- var needCheckWidenedType = node.name.elements.length === 0;
82581
+ var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression));
82625
82582
  if (needCheckInitializer || needCheckWidenedType) {
82626
82583
  // Don't validate for-in initializer as it is already an error
82627
82584
  var widenedType = getWidenedTypeForVariableLikeDeclaration(node);
@@ -110369,8 +110326,7 @@ var ts;
110369
110326
  return;
110370
110327
  }
110371
110328
  var version = ts.version; // Extracted into a const so the form is stable between namespace and module
110372
- var buildInfo = { bundle: bundle, program: program, version: version };
110373
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
110329
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), /*writeByteOrderMark*/ false);
110374
110330
  }
110375
110331
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
110376
110332
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -110524,18 +110480,13 @@ var ts;
110524
110480
  if (sourceMapFilePath) {
110525
110481
  var sourceMap = sourceMapGenerator.toString();
110526
110482
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110527
- if (printer.bundleFileInfo)
110528
- printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
110529
110483
  }
110530
110484
  }
110531
110485
  else {
110532
110486
  writer.writeLine();
110533
110487
  }
110534
110488
  // Write the output file
110535
- var text = writer.getText();
110536
- ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110537
- if (printer.bundleFileInfo)
110538
- printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
110489
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110539
110490
  // Reset state
110540
110491
  writer.clear();
110541
110492
  }
@@ -110678,54 +110629,34 @@ var ts;
110678
110629
  }
110679
110630
  /*@internal*/
110680
110631
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
110681
- var createHash = ts.maybeBind(host, host.createHash);
110682
110632
  var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
110683
- var buildInfo;
110684
- if (host.getBuildInfo) {
110685
- var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
110686
- if (!hostBuildInfo)
110687
- return buildInfoPath;
110688
- buildInfo = hostBuildInfo;
110689
- }
110690
- else {
110691
- var buildInfoText = host.readFile(buildInfoPath);
110692
- if (!buildInfoText)
110693
- return buildInfoPath;
110694
- buildInfo = getBuildInfo(buildInfoText);
110695
- }
110696
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
110633
+ var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
110634
+ if (!buildInfoText)
110697
110635
  return buildInfoPath;
110698
110636
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
110699
110637
  if (!jsFileText)
110700
110638
  return jsFilePath;
110701
- if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
110702
- return jsFilePath;
110703
110639
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
110704
110640
  // error if no source map or for now if inline sourcemap
110705
110641
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
110706
110642
  return sourceMapFilePath || "inline sourcemap decoding";
110707
- if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
110708
- return sourceMapFilePath;
110709
110643
  // read declaration text
110710
110644
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
110711
110645
  if (declarationFilePath && !declarationText)
110712
110646
  return declarationFilePath;
110713
- if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
110714
- return declarationFilePath;
110715
110647
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
110716
110648
  // error if no source map or for now if inline sourcemap
110717
110649
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
110718
110650
  return declarationMapPath || "inline sourcemap decoding";
110719
- if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
110720
- return declarationMapPath;
110651
+ var buildInfo = getBuildInfo(buildInfoText);
110652
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
110653
+ return buildInfoPath;
110721
110654
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110722
110655
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
110723
110656
  /*onlyOwnText*/ true);
110724
110657
  var outputFiles = [];
110725
110658
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
110726
110659
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
110727
- var changedDtsText;
110728
- var changedDtsData;
110729
110660
  var emitHost = {
110730
110661
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
110731
110662
  getCanonicalFileName: host.getCanonicalFileName,
@@ -110741,7 +110672,7 @@ var ts;
110741
110672
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
110742
110673
  getProjectReferenceRedirect: ts.returnUndefined,
110743
110674
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
110744
- writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
110675
+ writeFile: function (name, text, writeByteOrderMark) {
110745
110676
  switch (name) {
110746
110677
  case jsFilePath:
110747
110678
  if (jsFileText === text)
@@ -110752,13 +110683,8 @@ var ts;
110752
110683
  return;
110753
110684
  break;
110754
110685
  case buildInfoPath:
110755
- var newBuildInfo = data.buildInfo;
110686
+ var newBuildInfo = getBuildInfo(text);
110756
110687
  newBuildInfo.program = buildInfo.program;
110757
- if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
110758
- // Update the output signature
110759
- newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
110760
- newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
110761
- }
110762
110688
  // Update sourceFileInfo
110763
110689
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
110764
110690
  newBuildInfo.bundle.js.sources = js.sources;
@@ -110766,13 +110692,11 @@ var ts;
110766
110692
  newBuildInfo.bundle.dts.sources = dts.sources;
110767
110693
  }
110768
110694
  newBuildInfo.bundle.sourceFiles = sourceFiles;
110769
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
110695
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
110770
110696
  return;
110771
110697
  case declarationFilePath:
110772
110698
  if (declarationText === text)
110773
110699
  return;
110774
- changedDtsText = text;
110775
- changedDtsData = data;
110776
110700
  break;
110777
110701
  case declarationMapPath:
110778
110702
  if (declarationMapText === text)
@@ -110791,7 +110715,6 @@ var ts;
110791
110715
  getSourceFileFromReference: ts.returnUndefined,
110792
110716
  redirectTargetsMap: ts.createMultiMap(),
110793
110717
  getFileIncludeReasons: ts.notImplemented,
110794
- createHash: createHash,
110795
110718
  };
110796
110719
  emitFiles(ts.notImplementedResolver, emitHost,
110797
110720
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
@@ -115876,10 +115799,12 @@ var ts;
115876
115799
  }
115877
115800
  ts.createCompilerHost = createCompilerHost;
115878
115801
  /*@internal*/
115802
+ // TODO(shkamat): update this after reworking ts build API
115879
115803
  function createCompilerHostWorker(options, setParentNodes, system) {
115880
115804
  if (system === void 0) { system = ts.sys; }
115881
115805
  var existingDirectories = new ts.Map();
115882
115806
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
115807
+ var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
115883
115808
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
115884
115809
  var text;
115885
115810
  try {
@@ -115912,7 +115837,7 @@ var ts;
115912
115837
  // NOTE: If patchWriteFileEnsuringDirectory has been called,
115913
115838
  // the system.writeFile will do its own directory creation and
115914
115839
  // the ensureDirectoriesExist call will always be redundant.
115915
- 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); });
115840
+ 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); });
115916
115841
  ts.performance.mark("afterIOWrite");
115917
115842
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
115918
115843
  }
@@ -115922,6 +115847,35 @@ var ts;
115922
115847
  }
115923
115848
  }
115924
115849
  }
115850
+ var outputFingerprints;
115851
+ function writeFileWorker(fileName, data, writeByteOrderMark) {
115852
+ if (!ts.isWatchSet(options) || !system.getModifiedTime) {
115853
+ system.writeFile(fileName, data, writeByteOrderMark);
115854
+ return;
115855
+ }
115856
+ if (!outputFingerprints) {
115857
+ outputFingerprints = new ts.Map();
115858
+ }
115859
+ var hash = computeHash(data);
115860
+ var mtimeBefore = system.getModifiedTime(fileName);
115861
+ if (mtimeBefore) {
115862
+ var fingerprint = outputFingerprints.get(fileName);
115863
+ // If output has not been changed, and the file has no external modification
115864
+ if (fingerprint &&
115865
+ fingerprint.byteOrderMark === writeByteOrderMark &&
115866
+ fingerprint.hash === hash &&
115867
+ fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
115868
+ return;
115869
+ }
115870
+ }
115871
+ system.writeFile(fileName, data, writeByteOrderMark);
115872
+ var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
115873
+ outputFingerprints.set(fileName, {
115874
+ hash: hash,
115875
+ byteOrderMark: writeByteOrderMark,
115876
+ mtime: mtimeAfter
115877
+ });
115878
+ }
115925
115879
  function getDefaultLibLocation() {
115926
115880
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
115927
115881
  }
@@ -117511,7 +117465,6 @@ var ts;
117511
117465
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
117512
117466
  redirectTargetsMap: redirectTargetsMap,
117513
117467
  getFileIncludeReasons: program.getFileIncludeReasons,
117514
- createHash: ts.maybeBind(host, host.createHash),
117515
117468
  };
117516
117469
  }
117517
117470
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -119625,9 +119578,13 @@ var ts;
119625
119578
  function createManyToManyPathMap() {
119626
119579
  function create(forward, reverse, deleted) {
119627
119580
  var map = {
119581
+ clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119582
+ forEach: function (fn) { return forward.forEach(fn); },
119628
119583
  getKeys: function (v) { return reverse.get(v); },
119629
119584
  getValues: function (k) { return forward.get(k); },
119585
+ hasKey: function (k) { return forward.has(k); },
119630
119586
  keys: function () { return forward.keys(); },
119587
+ deletedKeys: function () { return deleted; },
119631
119588
  deleteKey: function (k) {
119632
119589
  (deleted || (deleted = new ts.Set())).add(k);
119633
119590
  var set = forward.get(k);
@@ -119654,6 +119611,11 @@ var ts;
119654
119611
  });
119655
119612
  return map;
119656
119613
  },
119614
+ clear: function () {
119615
+ forward.clear();
119616
+ reverse.clear();
119617
+ deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119618
+ }
119657
119619
  };
119658
119620
  return map;
119659
119621
  }
@@ -119781,21 +119743,18 @@ var ts;
119781
119743
  * Creates the state of file references and signature for the new program from oldState if it is safe
119782
119744
  */
119783
119745
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119784
- var _a, _b, _c;
119785
119746
  var fileInfos = new ts.Map();
119786
119747
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
119787
119748
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
119749
+ var hasCalledUpdateShapeSignature = new ts.Set();
119788
119750
  var useOldState = canReuseOldState(referencedMap, oldState);
119789
119751
  // Ensure source files have parent pointers set
119790
119752
  newProgram.getTypeChecker();
119791
119753
  // Create the reference map, and set the file infos
119792
- for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
119793
- var sourceFile = _d[_i];
119754
+ for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
119755
+ var sourceFile = _a[_i];
119794
119756
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
119795
- var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
119796
- var signature = oldUncommitedSignature === undefined ?
119797
- useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
119798
- oldUncommitedSignature || undefined;
119757
+ var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
119799
119758
  if (referencedMap) {
119800
119759
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
119801
119760
  if (newReferences) {
@@ -119803,26 +119762,19 @@ var ts;
119803
119762
  }
119804
119763
  // Copy old visible to outside files map
119805
119764
  if (useOldState) {
119806
- var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
119807
- var exportedModules = oldUncommitedExportedModules === undefined ?
119808
- oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
119809
- oldUncommitedExportedModules || undefined;
119765
+ var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
119810
119766
  if (exportedModules) {
119811
119767
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119812
119768
  }
119813
119769
  }
119814
119770
  }
119815
- fileInfos.set(sourceFile.resolvedPath, {
119816
- version: version_2,
119817
- signature: signature,
119818
- affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
119819
- impliedFormat: sourceFile.impliedNodeFormat
119820
- });
119771
+ fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
119821
119772
  }
119822
119773
  return {
119823
119774
  fileInfos: fileInfos,
119824
119775
  referencedMap: referencedMap,
119825
119776
  exportedModulesMap: exportedModulesMap,
119777
+ hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
119826
119778
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
119827
119779
  };
119828
119780
  }
@@ -119836,42 +119788,71 @@ var ts;
119836
119788
  }
119837
119789
  BuilderState.releaseCache = releaseCache;
119838
119790
  /**
119839
- * Gets the files affected by the path from the program
119791
+ * Creates a clone of the state
119840
119792
  */
119841
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
119793
+ function clone(state) {
119842
119794
  var _a, _b;
119843
- var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
119844
- (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119845
- (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119846
- return result;
119795
+ // Dont need to backup allFiles info since its cache anyway
119796
+ return {
119797
+ fileInfos: new ts.Map(state.fileInfos),
119798
+ referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
119799
+ exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
119800
+ hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
119801
+ useFileVersionAsSignature: state.useFileVersionAsSignature,
119802
+ };
119847
119803
  }
119848
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119849
- function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
119804
+ BuilderState.clone = clone;
119805
+ /**
119806
+ * Gets the files affected by the path from the program
119807
+ */
119808
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
119809
+ // Since the operation could be cancelled, the signatures are always stored in the cache
119810
+ // They will be committed once it is safe to use them
119811
+ // eg when calling this api from tsserver, if there is no cancellation of the operation
119812
+ // In the other cases the affected files signatures are committed only after the iteration through the result is complete
119813
+ var signatureCache = cacheToUpdateSignature || new ts.Map();
119850
119814
  var sourceFile = programOfThisState.getSourceFileByPath(path);
119851
119815
  if (!sourceFile) {
119852
119816
  return ts.emptyArray;
119853
119817
  }
119854
- if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
119818
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
119855
119819
  return [sourceFile];
119856
119820
  }
119857
- return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
119821
+ var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
119822
+ if (!cacheToUpdateSignature) {
119823
+ // Commit all the signatures in the signature cache
119824
+ updateSignaturesFromCache(state, signatureCache);
119825
+ }
119826
+ return result;
119827
+ }
119828
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119829
+ /**
119830
+ * Updates the signatures from the cache into state's fileinfo signatures
119831
+ * This should be called whenever it is safe to commit the state of the builder
119832
+ */
119833
+ function updateSignaturesFromCache(state, signatureCache) {
119834
+ signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
119858
119835
  }
119859
- BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
119836
+ BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
119860
119837
  function updateSignatureOfFile(state, signature, path) {
119861
119838
  state.fileInfos.get(path).signature = signature;
119862
- (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
119839
+ state.hasCalledUpdateShapeSignature.add(path);
119863
119840
  }
119864
119841
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
119865
119842
  /**
119866
119843
  * Returns if the shape of the signature has changed since last emit
119867
119844
  */
119868
- function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
119869
- var _a;
119845
+ function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
119870
119846
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
119847
+ ts.Debug.assert(!!sourceFile);
119848
+ ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
119871
119849
  // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
119872
- if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
119850
+ if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
119873
119851
  return false;
119852
+ }
119874
119853
  var info = state.fileInfos.get(sourceFile.resolvedPath);
119854
+ if (!info)
119855
+ return ts.Debug.fail();
119875
119856
  var prevSignature = info.signature;
119876
119857
  var latestSignature;
119877
119858
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -119882,55 +119863,45 @@ var ts;
119882
119863
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119883
119864
  if (firstDts_1) {
119884
119865
  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; })); });
119885
- latestSignature = computeSignature(firstDts_1.text, computeHash);
119886
- if (latestSignature !== prevSignature) {
119887
- updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
119866
+ latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119867
+ if (exportedModulesMapCache && latestSignature !== prevSignature) {
119868
+ updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
119888
119869
  }
119889
119870
  }
119890
119871
  }
119891
119872
  // Default is to use file version as signature
119892
119873
  if (latestSignature === undefined) {
119893
119874
  latestSignature = sourceFile.version;
119894
- if (state.exportedModulesMap && latestSignature !== prevSignature) {
119895
- (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119875
+ if (exportedModulesMapCache && latestSignature !== prevSignature) {
119896
119876
  // All the references in this file are exported
119897
119877
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
119898
119878
  if (references) {
119899
- state.exportedModulesMap.set(sourceFile.resolvedPath, references);
119879
+ exportedModulesMapCache.set(sourceFile.resolvedPath, references);
119900
119880
  }
119901
119881
  else {
119902
- state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119882
+ exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119903
119883
  }
119904
119884
  }
119905
119885
  }
119906
- (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
119907
- (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
119908
- info.signature = latestSignature;
119886
+ cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
119909
119887
  return latestSignature !== prevSignature;
119910
119888
  }
119911
119889
  BuilderState.updateShapeSignature = updateShapeSignature;
119912
- function computeSignature(text, computeHash) {
119913
- return (computeHash || ts.generateDjb2Hash)(text);
119914
- }
119915
- BuilderState.computeSignature = computeSignature;
119916
119890
  /**
119917
119891
  * Coverts the declaration emit result into exported modules map
119918
119892
  */
119919
- function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
119920
- if (!state.exportedModulesMap)
119921
- return;
119922
- (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119893
+ function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
119923
119894
  if (!exportedModulesFromDeclarationEmit) {
119924
- state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119895
+ exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119925
119896
  return;
119926
119897
  }
119927
119898
  var exportedModules;
119928
119899
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
119929
119900
  if (exportedModules) {
119930
- state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119901
+ exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
119931
119902
  }
119932
119903
  else {
119933
- state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119904
+ exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119934
119905
  }
119935
119906
  function addExportedModule(exportedModulePaths) {
119936
119907
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -119942,6 +119913,19 @@ var ts;
119942
119913
  }
119943
119914
  }
119944
119915
  BuilderState.updateExportedModules = updateExportedModules;
119916
+ /**
119917
+ * Updates the exported modules from cache into state's exported modules map
119918
+ * This should be called whenever it is safe to commit the state of the builder
119919
+ */
119920
+ function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
119921
+ var _a;
119922
+ if (exportedModulesMapCache) {
119923
+ ts.Debug.assert(!!state.exportedModulesMap);
119924
+ (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
119925
+ exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
119926
+ }
119927
+ }
119928
+ BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
119945
119929
  /**
119946
119930
  * Get all the dependencies of the sourceFile
119947
119931
  */
@@ -120062,7 +120046,7 @@ var ts;
120062
120046
  /**
120063
120047
  * When program emits modular code, gets the files affected by the sourceFile whose shape has changed
120064
120048
  */
120065
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
120049
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
120066
120050
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
120067
120051
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
120068
120052
  }
@@ -120082,7 +120066,7 @@ var ts;
120082
120066
  if (!seenFileNamesMap.has(currentPath)) {
120083
120067
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
120084
120068
  seenFileNamesMap.set(currentPath, currentSourceFile);
120085
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
120069
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
120086
120070
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
120087
120071
  }
120088
120072
  }
@@ -120108,33 +120092,32 @@ var ts;
120108
120092
  * Create the state so that we can iterate on changedFiles/affected files
120109
120093
  */
120110
120094
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
120111
- var _a, _b;
120112
120095
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
120113
120096
  state.program = newProgram;
120114
120097
  var compilerOptions = newProgram.getCompilerOptions();
120115
120098
  state.compilerOptions = compilerOptions;
120116
- var outFilePath = ts.outFile(compilerOptions);
120117
120099
  // With --out or --outFile, any change affects all semantic diagnostics so no need to cache them
120118
- if (!outFilePath) {
120100
+ if (!ts.outFile(compilerOptions)) {
120119
120101
  state.semanticDiagnosticsPerFile = new ts.Map();
120120
120102
  }
120121
- 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)) {
120122
- state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
120123
- }
120124
120103
  state.changedFilesSet = new ts.Set();
120125
- state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
120126
120104
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
120127
120105
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
120128
120106
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
120129
120107
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
120130
- var canCopyEmitSignatures = compilerOptions.composite &&
120131
- (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
120132
- !outFilePath &&
120133
- !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
120134
120108
  if (useOldState) {
120109
+ // Verify the sanity of old state
120110
+ if (!oldState.currentChangedFilePath) {
120111
+ var affectedSignatures = oldState.currentAffectedFilesSignatures;
120112
+ ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
120113
+ }
120114
+ var changedFilesSet = oldState.changedFilesSet;
120115
+ if (canCopySemanticDiagnostics) {
120116
+ ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
120117
+ }
120135
120118
  // Copy old state's changed files set
120136
- (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
120137
- if (!outFilePath && oldState.affectedFilesPendingEmit) {
120119
+ changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
120120
+ if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
120138
120121
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
120139
120122
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
120140
120123
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -120155,8 +120138,6 @@ var ts;
120155
120138
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
120156
120139
  // versions dont match
120157
120140
  oldInfo.version !== info.version ||
120158
- // Implied formats dont match
120159
- oldInfo.impliedFormat !== info.impliedFormat ||
120160
120141
  // Referenced files changed
120161
120142
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
120162
120143
  // Referenced file was deleted in the new program
@@ -120180,25 +120161,27 @@ var ts;
120180
120161
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
120181
120162
  }
120182
120163
  }
120183
- if (canCopyEmitSignatures) {
120184
- var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
120185
- if (oldEmitSignature)
120186
- (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
120187
- }
120188
120164
  });
120189
120165
  // If the global file is removed, add all files as changed
120190
120166
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
120191
120167
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, /*firstSourceFile*/ undefined)
120192
120168
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
120193
120169
  }
120194
- else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
120170
+ else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
120195
120171
  // Add all files to affectedFilesPendingEmit since emit changed
120196
120172
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1 /* Full */); });
120197
120173
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
120198
120174
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
120199
120175
  }
120200
- // Since old states change files set is copied, any additional change means we would need to emit build info
120201
- state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
120176
+ if (useOldState) {
120177
+ // Any time the interpretation of a source file changes, mark it as changed
120178
+ ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
120179
+ if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
120180
+ state.changedFilesSet.add(sourceFilePath);
120181
+ }
120182
+ });
120183
+ }
120184
+ state.buildInfoEmitPending = !!state.changedFilesSet.size;
120202
120185
  return state;
120203
120186
  }
120204
120187
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -120234,35 +120217,30 @@ var ts;
120234
120217
  ts.BuilderState.releaseCache(state);
120235
120218
  state.program = undefined;
120236
120219
  }
120237
- function backupEmitBuilderProgramState(state) {
120238
- var outFilePath = ts.outFile(state.compilerOptions);
120239
- // Only in --out changeFileSet is kept around till emit
120240
- ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
120241
- return {
120242
- affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
120243
- affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
120244
- affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
120245
- seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
120246
- programEmitComplete: state.programEmitComplete,
120247
- emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
120248
- outSignature: state.outSignature,
120249
- dtsChangeTime: state.dtsChangeTime,
120250
- hasChangedEmitSignature: state.hasChangedEmitSignature,
120251
- changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
120252
- };
120253
- }
120254
- function restoreEmitBuilderProgramState(state, backupEmitState) {
120255
- state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
120256
- state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
120257
- state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
120258
- state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
120259
- state.programEmitComplete = backupEmitState.programEmitComplete;
120260
- state.emitSignatures = backupEmitState.emitSignatures;
120261
- state.outSignature = backupEmitState.outSignature;
120262
- state.dtsChangeTime = backupEmitState.dtsChangeTime;
120263
- state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
120264
- if (backupEmitState.changedFilesSet)
120265
- state.changedFilesSet = backupEmitState.changedFilesSet;
120220
+ /**
120221
+ * Creates a clone of the state
120222
+ */
120223
+ function cloneBuilderProgramState(state) {
120224
+ var _a;
120225
+ var newState = ts.BuilderState.clone(state);
120226
+ newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
120227
+ newState.changedFilesSet = new ts.Set(state.changedFilesSet);
120228
+ newState.affectedFiles = state.affectedFiles;
120229
+ newState.affectedFilesIndex = state.affectedFilesIndex;
120230
+ newState.currentChangedFilePath = state.currentChangedFilePath;
120231
+ newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
120232
+ newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
120233
+ newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
120234
+ newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
120235
+ newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
120236
+ newState.program = state.program;
120237
+ newState.compilerOptions = state.compilerOptions;
120238
+ newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
120239
+ newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
120240
+ newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
120241
+ newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
120242
+ newState.programEmitComplete = state.programEmitComplete;
120243
+ return newState;
120266
120244
  }
120267
120245
  /**
120268
120246
  * Verifies that source file is ok to be used in calls that arent handled by next
@@ -120277,7 +120255,7 @@ var ts;
120277
120255
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
120278
120256
  */
120279
120257
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
120280
- var _a, _b;
120258
+ var _a;
120281
120259
  while (true) {
120282
120260
  var affectedFiles = state.affectedFiles;
120283
120261
  if (affectedFiles) {
@@ -120297,8 +120275,10 @@ var ts;
120297
120275
  state.changedFilesSet.delete(state.currentChangedFilePath);
120298
120276
  state.currentChangedFilePath = undefined;
120299
120277
  // Commit the changes in file signature
120300
- (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
120301
- (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120278
+ ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
120279
+ state.currentAffectedFilesSignatures.clear();
120280
+ ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120281
+ (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
120302
120282
  state.affectedFiles = undefined;
120303
120283
  }
120304
120284
  // Get next changed file
@@ -120316,7 +120296,12 @@ var ts;
120316
120296
  return program;
120317
120297
  }
120318
120298
  // Get next batch of affected files
120319
- state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
120299
+ if (!state.currentAffectedFilesSignatures)
120300
+ state.currentAffectedFilesSignatures = new ts.Map();
120301
+ if (state.exportedModulesMap) {
120302
+ state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
120303
+ }
120304
+ state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
120320
120305
  state.currentChangedFilePath = nextKey.value;
120321
120306
  state.affectedFilesIndex = 0;
120322
120307
  if (!state.seenAffectedFiles)
@@ -120368,6 +120353,7 @@ var ts;
120368
120353
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
120369
120354
  */
120370
120355
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120356
+ var _a;
120371
120357
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
120372
120358
  // If affected files is everything except default library, then nothing more to do
120373
120359
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -120375,9 +120361,10 @@ var ts;
120375
120361
  // When a change affects the global scope, all files are considered to be affected without updating their signature
120376
120362
  // That means when affected file is handled, its signature can be out of date
120377
120363
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
120378
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
120364
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
120379
120365
  return;
120380
120366
  }
120367
+ ts.Debug.assert(state.hasCalledUpdateShapeSignature.has(affectedFile.resolvedPath) || ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.has(affectedFile.resolvedPath)), "Signature not updated for affected file: " + affectedFile.fileName);
120381
120368
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
120382
120369
  return;
120383
120370
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -120397,7 +120384,7 @@ var ts;
120397
120384
  // This ensures that we dont later during incremental builds considering wrong signature.
120398
120385
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
120399
120386
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
120400
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
120387
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
120401
120388
  // If not dts emit, nothing more to do
120402
120389
  if (ts.getEmitDeclarations(state.compilerOptions)) {
120403
120390
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -120418,10 +120405,27 @@ var ts;
120418
120405
  return !state.semanticDiagnosticsFromOldState.size;
120419
120406
  }
120420
120407
  function isChangedSignature(state, path) {
120421
- var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
120422
- var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120408
+ var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
120409
+ var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120423
120410
  return newSignature !== oldSignature;
120424
120411
  }
120412
+ function forEachKeyOfExportedModulesMap(state, filePath, fn) {
120413
+ // Go through exported modules from cache first
120414
+ var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
120415
+ var result = keys && ts.forEachKey(keys, fn);
120416
+ if (result)
120417
+ return result;
120418
+ // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
120419
+ keys = state.exportedModulesMap.getKeys(filePath);
120420
+ return keys && ts.forEachKey(keys, function (exportedFromPath) {
120421
+ var _a;
120422
+ // If the cache had an updated value, skip
120423
+ return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
120424
+ !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
120425
+ fn(exportedFromPath) :
120426
+ undefined;
120427
+ });
120428
+ }
120425
120429
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
120426
120430
  var _a;
120427
120431
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -120436,7 +120440,6 @@ var ts;
120436
120440
  * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
120437
120441
  */
120438
120442
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120439
- var _a;
120440
120443
  // If there was change in signature (dts output) for the changed file,
120441
120444
  // then only we need to handle pending file emit
120442
120445
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
@@ -120463,10 +120466,11 @@ var ts;
120463
120466
  }
120464
120467
  }
120465
120468
  }
120469
+ ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120466
120470
  var seenFileAndExportsOfFile = new ts.Set();
120467
120471
  // Go through exported modules from cache first
120468
120472
  // If exported modules has path, all files referencing file exported from are affected
120469
- (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120473
+ forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
120470
120474
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
120471
120475
  return true;
120472
120476
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -120480,18 +120484,19 @@ var ts;
120480
120484
  * return true when all work is done and we can exit handling dts emit and semantic diagnostics
120481
120485
  */
120482
120486
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
120483
- var _a, _b;
120487
+ var _a;
120484
120488
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
120485
120489
  return undefined;
120486
120490
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
120487
120491
  return true;
120488
120492
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
120493
+ ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120489
120494
  // If exported modules has path, all files referencing file exported from are affected
120490
- (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120495
+ forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
120491
120496
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
120492
120497
  });
120493
120498
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
120494
- (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
120499
+ (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
120495
120500
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
120496
120501
  handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
120497
120502
  state, referencingFilePath, cancellationToken, computeHash, host);
@@ -120512,13 +120517,12 @@ var ts;
120512
120517
  }
120513
120518
  else {
120514
120519
  state.seenAffectedFiles.add(affected.resolvedPath);
120515
- // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted
120516
- state.buildInfoEmitPending = true;
120517
120520
  if (emitKind !== undefined) {
120518
120521
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
120519
120522
  }
120520
120523
  if (isPendingEmit) {
120521
120524
  state.affectedFilesPendingEmitIndex++;
120525
+ state.buildInfoEmitPending = true;
120522
120526
  }
120523
120527
  else {
120524
120528
  state.affectedFilesIndex++;
@@ -120566,61 +120570,25 @@ var ts;
120566
120570
  }
120567
120571
  return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
120568
120572
  }
120569
- function isProgramBundleEmitBuildInfo(info) {
120570
- return !!ts.outFile(info.options || {});
120571
- }
120572
- ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
120573
120573
  /**
120574
120574
  * Gets the program information to be emitted in buildInfo so that we can use it to create new program
120575
120575
  */
120576
- function getProgramBuildInfo(state, getCanonicalFileName, host) {
120577
- var outFilePath = ts.outFile(state.compilerOptions);
120578
- if (outFilePath && !state.compilerOptions.composite)
120579
- return;
120576
+ function getProgramBuildInfo(state, getCanonicalFileName) {
120577
+ if (ts.outFile(state.compilerOptions))
120578
+ return undefined;
120580
120579
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
120581
120580
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
120582
- state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
120583
- if (outFilePath) {
120584
- var fileNames_1 = [];
120585
- var fileInfos_1 = [];
120586
- state.program.getRootFileNames().forEach(function (f) {
120587
- var sourceFile = state.program.getSourceFile(f);
120588
- if (!sourceFile)
120589
- return;
120590
- fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
120591
- fileInfos_1.push(sourceFile.version);
120592
- });
120593
- var result_15 = {
120594
- fileNames: fileNames_1,
120595
- fileInfos: fileInfos_1,
120596
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
120597
- outSignature: state.outSignature,
120598
- dtsChangeTime: state.dtsChangeTime,
120599
- };
120600
- return result_15;
120601
- }
120602
120581
  var fileNames = [];
120603
120582
  var fileNameToFileId = new ts.Map();
120604
120583
  var fileIdsList;
120605
120584
  var fileNamesToFileIdListId;
120606
- var emitSignatures;
120607
120585
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
120608
- var _b, _c;
120609
120586
  var key = _a[0], value = _a[1];
120610
120587
  // Ensure fileId
120611
120588
  var fileId = toFileId(key);
120612
120589
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
120613
- var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
120614
- var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
120615
- if (state.compilerOptions.composite) {
120616
- var file = state.program.getSourceFileByPath(key);
120617
- if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
120618
- var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
120619
- if (emitSignature !== actualSignature) {
120620
- (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
120621
- }
120622
- }
120623
- }
120590
+ var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120591
+ var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120624
120592
  return value.version === actualSignature ?
120625
120593
  value.affectsGlobalScope || value.impliedFormat ?
120626
120594
  // If file version is same as signature, dont serialize signature
@@ -120628,11 +120596,11 @@ var ts;
120628
120596
  // If file info only contains version and signature and both are same we can just write string
120629
120597
  value.version :
120630
120598
  actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120631
- oldSignature === undefined ?
120599
+ signature === undefined ?
120632
120600
  // If we havent computed signature, use fileInfo as is
120633
120601
  value :
120634
120602
  // Serialize fileInfo with new updated signature
120635
- { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120603
+ { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120636
120604
  // Signature of the FileInfo is undefined, serialize it as false
120637
120605
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120638
120606
  });
@@ -120647,13 +120615,17 @@ var ts;
120647
120615
  if (state.exportedModulesMap) {
120648
120616
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
120649
120617
  var _a;
120650
- var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
120618
+ if (state.currentAffectedFilesExportedModulesMap) {
120619
+ if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
120620
+ return undefined;
120621
+ }
120622
+ var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
120623
+ if (newValue) {
120624
+ return [toFileId(key), toFileIdListId(newValue)];
120625
+ }
120626
+ }
120651
120627
  // Not in temporary cache, use existing value
120652
- if (oldValue === undefined)
120653
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120654
- if (oldValue)
120655
- return [toFileId(key), toFileIdListId(oldValue)];
120656
- return undefined;
120628
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120657
120629
  });
120658
120630
  }
120659
120631
  var semanticDiagnosticsPerFile;
@@ -120664,7 +120636,9 @@ var ts;
120664
120636
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
120665
120637
  [
120666
120638
  toFileId(key),
120667
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120639
+ state.hasReusableDiagnostic ?
120640
+ value :
120641
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
120668
120642
  ] :
120669
120643
  toFileId(key));
120670
120644
  }
@@ -120679,27 +120653,16 @@ var ts;
120679
120653
  }
120680
120654
  }
120681
120655
  }
120682
- var changeFileSet;
120683
- if (state.changedFilesSet.size) {
120684
- for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
120685
- var path = _e[_d];
120686
- (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120687
- }
120688
- }
120689
- var result = {
120656
+ return {
120690
120657
  fileNames: fileNames,
120691
120658
  fileInfos: fileInfos,
120692
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
120659
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
120693
120660
  fileIdsList: fileIdsList,
120694
120661
  referencedMap: referencedMap,
120695
120662
  exportedModulesMap: exportedModulesMap,
120696
120663
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
120697
120664
  affectedFilesPendingEmit: affectedFilesPendingEmit,
120698
- changeFileSet: changeFileSet,
120699
- emitSignatures: emitSignatures,
120700
- dtsChangeTime: state.dtsChangeTime,
120701
120665
  };
120702
- return result;
120703
120666
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
120704
120667
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
120705
120668
  }
@@ -120724,18 +120687,24 @@ var ts;
120724
120687
  }
120725
120688
  return fileIdListId;
120726
120689
  }
120727
- function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
120728
- var result;
120729
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120730
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120731
- var name = _a[_i];
120732
- var optionInfo = optionsNameMap.get(name.toLowerCase());
120733
- if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
120734
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
120735
- }
120690
+ }
120691
+ function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
120692
+ var result;
120693
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120694
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120695
+ var name = _a[_i];
120696
+ var optionKey = name.toLowerCase();
120697
+ var optionInfo = optionsNameMap.get(optionKey);
120698
+ if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
120699
+ // We need to store `strict`, even though it won't be examined directly, so that the
120700
+ // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
120701
+ optionKey === "strict" ||
120702
+ // We need to store these to determine whether `lib` files need to be rechecked.
120703
+ optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
120704
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
120736
120705
  }
120737
- return result;
120738
120706
  }
120707
+ return result;
120739
120708
  }
120740
120709
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120741
120710
  if (option) {
@@ -120809,10 +120778,6 @@ var ts;
120809
120778
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
120810
120779
  }
120811
120780
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
120812
- function computeSignature(text, data, computeHash) {
120813
- return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
120814
- }
120815
- ts.computeSignature = computeSignature;
120816
120781
  function createBuilderProgram(kind, _a) {
120817
120782
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
120818
120783
  // Return same program if underlying program doesnt change
@@ -120831,8 +120796,8 @@ var ts;
120831
120796
  */
120832
120797
  var computeHash = ts.maybeBind(host, host.createHash);
120833
120798
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
120834
- var backupEmitState;
120835
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
120799
+ var backupState;
120800
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
120836
120801
  // To ensure that we arent storing any references to old program or new program without state
120837
120802
  newProgram = undefined; // TODO: GH#18217
120838
120803
  oldProgram = undefined;
@@ -120840,20 +120805,20 @@ var ts;
120840
120805
  var getState = function () { return state; };
120841
120806
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
120842
120807
  builderProgram.getState = getState;
120843
- builderProgram.backupEmitState = function () {
120844
- ts.Debug.assert(backupEmitState === undefined);
120845
- backupEmitState = backupEmitBuilderProgramState(state);
120808
+ builderProgram.backupState = function () {
120809
+ ts.Debug.assert(backupState === undefined);
120810
+ backupState = cloneBuilderProgramState(state);
120846
120811
  };
120847
- builderProgram.restoreEmitState = function () {
120848
- restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
120849
- backupEmitState = undefined;
120812
+ builderProgram.restoreState = function () {
120813
+ state = ts.Debug.checkDefined(backupState);
120814
+ backupState = undefined;
120850
120815
  };
120851
120816
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
120852
120817
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
120853
120818
  builderProgram.emit = emit;
120854
120819
  builderProgram.releaseProgram = function () {
120855
120820
  releaseCache(state);
120856
- backupEmitState = undefined;
120821
+ backupState = undefined;
120857
120822
  };
120858
120823
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
120859
120824
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -120912,59 +120877,35 @@ var ts;
120912
120877
  return toAffectedFileEmitResult(state,
120913
120878
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
120914
120879
  // Otherwise just affected file
120915
- ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
120916
- getWriteFileCallback(writeFile, customTransformers) :
120880
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120881
+ getWriteFileUpdatingSignatureCallback(writeFile) :
120917
120882
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
120918
120883
  }
120919
- function getWriteFileCallback(writeFile, customTransformers) {
120884
+ function getWriteFileUpdatingSignatureCallback(writeFile) {
120920
120885
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
120921
- var _a, _b, _c;
120886
+ var _a;
120922
120887
  if (ts.isDeclarationFileName(fileName)) {
120923
- if (!ts.outFile(state.compilerOptions)) {
120924
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120925
- var newSignature = void 0;
120926
- if (!customTransformers) {
120927
- var file = sourceFiles[0];
120928
- var info = state.fileInfos.get(file.resolvedPath);
120929
- if (info.signature === file.version) {
120930
- newSignature = computeSignature(text, data, computeHash);
120931
- if (newSignature !== file.version) { // Update it
120932
- if (host.storeFilesChangingSignatureDuringEmit)
120933
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120934
- if (state.exportedModulesMap)
120935
- ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
120936
- if (state.affectedFiles) {
120937
- // Keep old signature so we know what to undo if cancellation happens
120938
- var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
120939
- if (existing === undefined)
120940
- (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
120941
- info.signature = newSignature;
120942
- }
120943
- else {
120944
- // These are directly commited
120945
- info.signature = newSignature;
120946
- (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120947
- }
120948
- }
120888
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120889
+ var file = sourceFiles[0];
120890
+ var info = state.fileInfos.get(file.resolvedPath);
120891
+ var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120892
+ if (signature === file.version) {
120893
+ var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120894
+ if (newSignature !== file.version) { // Update it
120895
+ if (host.storeFilesChangingSignatureDuringEmit)
120896
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120897
+ if (state.exportedModulesMap)
120898
+ ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
120899
+ if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
120900
+ state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
120949
120901
  }
120950
- }
120951
- if (state.compilerOptions.composite) {
120952
- var filePath = sourceFiles[0].resolvedPath;
120953
- var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
120954
- newSignature || (newSignature = computeSignature(text, data, computeHash));
120955
- if (newSignature !== oldSignature) {
120956
- (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
120957
- state.hasChangedEmitSignature = true;
120902
+ else {
120903
+ info.signature = newSignature;
120904
+ if (state.exportedModulesMap)
120905
+ ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120958
120906
  }
120959
120907
  }
120960
120908
  }
120961
- else if (state.compilerOptions.composite) {
120962
- var newSignature = computeSignature(text, data, computeHash);
120963
- if (newSignature !== state.outSignature) {
120964
- state.outSignature = newSignature;
120965
- state.hasChangedEmitSignature = true;
120966
- }
120967
- }
120968
120909
  }
120969
120910
  if (writeFile)
120970
120911
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -121029,8 +120970,8 @@ var ts;
121029
120970
  }
121030
120971
  }
121031
120972
  }
121032
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
121033
- getWriteFileCallback(writeFile, customTransformers) :
120973
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120974
+ getWriteFileUpdatingSignatureCallback(writeFile) :
121034
120975
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
121035
120976
  }
121036
120977
  /**
@@ -121119,58 +121060,29 @@ var ts;
121119
121060
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
121120
121061
  }
121121
121062
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
121122
- function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
121123
- var _a, _b, _c, _d;
121063
+ function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
121064
+ var _a;
121124
121065
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
121125
121066
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
121126
- var state;
121127
- var filePaths;
121128
- var filePathsSetList;
121129
- if (isProgramBundleEmitBuildInfo(program)) {
121130
- state = {
121131
- fileInfos: new ts.Map(),
121132
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121133
- dtsChangeTime: program.dtsChangeTime,
121134
- outSignature: program.outSignature,
121135
- };
121136
- }
121137
- else {
121138
- filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
121139
- filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
121140
- var fileInfos_2 = new ts.Map();
121141
- var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
121142
- program.fileInfos.forEach(function (fileInfo, index) {
121143
- var path = toFilePath(index + 1);
121144
- var stateFileInfo = toBuilderStateFileInfo(fileInfo);
121145
- fileInfos_2.set(path, stateFileInfo);
121146
- if (emitSignatures_1 && stateFileInfo.signature)
121147
- emitSignatures_1.set(path, stateFileInfo.signature);
121148
- });
121149
- (_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
121150
- if (ts.isNumber(value))
121151
- emitSignatures_1.delete(toFilePath(value));
121152
- else
121153
- emitSignatures_1.set(toFilePath(value[0]), value[1]);
121154
- });
121155
- state = {
121156
- fileInfos: fileInfos_2,
121157
- compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121158
- referencedMap: toManyToManyPathMap(program.referencedMap),
121159
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121160
- 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]; }),
121161
- hasReusableDiagnostic: true,
121162
- affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
121163
- affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
121164
- affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
121165
- changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
121166
- dtsChangeTime: program.dtsChangeTime,
121167
- emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
121168
- };
121169
- }
121067
+ var filePaths = program.fileNames.map(toPath);
121068
+ var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
121069
+ var fileInfos = new ts.Map();
121070
+ program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
121071
+ var state = {
121072
+ fileInfos: fileInfos,
121073
+ compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121074
+ referencedMap: toManyToManyPathMap(program.referencedMap),
121075
+ exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121076
+ 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]; }),
121077
+ hasReusableDiagnostic: true,
121078
+ affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
121079
+ affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
121080
+ affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
121081
+ };
121170
121082
  return {
121171
121083
  getState: function () { return state; },
121172
- backupEmitState: ts.noop,
121173
- restoreEmitState: ts.noop,
121084
+ backupState: ts.noop,
121085
+ restoreState: ts.noop,
121174
121086
  getProgram: ts.notImplemented,
121175
121087
  getProgramOrUndefined: ts.returnUndefined,
121176
121088
  releaseProgram: ts.noop,
@@ -121215,24 +121127,12 @@ var ts;
121215
121127
  return map;
121216
121128
  }
121217
121129
  }
121218
- ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
121219
- function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
121220
- var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
121221
- var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
121222
- var fileInfos = new ts.Map();
121223
- program.fileInfos.forEach(function (fileInfo, index) {
121224
- var path = ts.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
121225
- var version = ts.isString(fileInfo) ? fileInfo : fileInfo.version; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
121226
- fileInfos.set(path, version);
121227
- });
121228
- return fileInfos;
121229
- }
121230
- ts.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap;
121130
+ ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
121231
121131
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
121232
121132
  return {
121233
121133
  getState: ts.notImplemented,
121234
- backupEmitState: ts.noop,
121235
- restoreEmitState: ts.noop,
121134
+ backupState: ts.noop,
121135
+ restoreState: ts.noop,
121236
121136
  getProgram: getProgram,
121237
121137
  getProgramOrUndefined: function () { return getState().program; },
121238
121138
  releaseProgram: function () { return getState().program = undefined; },
@@ -122348,9 +122248,9 @@ var ts;
122348
122248
  if (!preferSymlinks) {
122349
122249
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
122350
122250
  // so we only need to remove them from the realpath filenames.
122351
- var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122352
- if (result_16)
122353
- return result_16;
122251
+ var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122252
+ if (result_15)
122253
+ return result_15;
122354
122254
  }
122355
122255
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
122356
122256
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -122370,10 +122270,10 @@ var ts;
122370
122270
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
122371
122271
  var symlinkDirectory = symlinkDirectories_1[_i];
122372
122272
  var option = ts.resolvePath(symlinkDirectory, relative);
122373
- var result_17 = cb(option, target === referenceRedirect);
122273
+ var result_16 = cb(option, target === referenceRedirect);
122374
122274
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
122375
- if (result_17)
122376
- return result_17;
122275
+ if (result_16)
122276
+ return result_16;
122377
122277
  }
122378
122278
  });
122379
122279
  });
@@ -123283,7 +123183,6 @@ var ts;
123283
123183
  readDirectory: ts.maybeBind(host, host.readDirectory),
123284
123184
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
123285
123185
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
123286
- now: ts.maybeBind(host, host.now),
123287
123186
  };
123288
123187
  function writeFile(fileName, text, writeByteOrderMark, onError) {
123289
123188
  try {
@@ -123344,7 +123243,6 @@ var ts;
123344
123243
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
123345
123244
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
123346
123245
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
123347
- now: ts.maybeBind(system, system.now),
123348
123246
  };
123349
123247
  }
123350
123248
  ts.createProgramHost = createProgramHost;
@@ -123412,26 +123310,20 @@ var ts;
123412
123310
  var ts;
123413
123311
  (function (ts) {
123414
123312
  function readBuilderProgram(compilerOptions, host) {
123313
+ if (ts.outFile(compilerOptions))
123314
+ return undefined;
123415
123315
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
123416
123316
  if (!buildInfoPath)
123417
123317
  return undefined;
123418
- var buildInfo;
123419
- if (host.getBuildInfo) {
123420
- buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
123421
- if (!buildInfo)
123422
- return undefined;
123423
- }
123424
- else {
123425
- var content = host.readFile(buildInfoPath);
123426
- if (!content)
123427
- return undefined;
123428
- buildInfo = ts.getBuildInfo(content);
123429
- }
123318
+ var content = host.readFile(buildInfoPath);
123319
+ if (!content)
123320
+ return undefined;
123321
+ var buildInfo = ts.getBuildInfo(content);
123430
123322
  if (buildInfo.version !== ts.version)
123431
123323
  return undefined;
123432
123324
  if (!buildInfo.program)
123433
123325
  return undefined;
123434
- return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123326
+ return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123435
123327
  }
123436
123328
  ts.readBuilderProgram = readBuilderProgram;
123437
123329
  function createIncrementalCompilerHost(options, system) {
@@ -123440,7 +123332,6 @@ var ts;
123440
123332
  host.createHash = ts.maybeBind(system, system.createHash);
123441
123333
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
123442
123334
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
123443
- host.now = ts.maybeBind(system, system.now);
123444
123335
  ts.setGetSourceFileAsHashVersioned(host, system);
123445
123336
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
123446
123337
  return host;
@@ -124176,17 +124067,14 @@ var ts;
124176
124067
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
124177
124068
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
124178
124069
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
124179
- UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
124180
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
124181
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
124182
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
124183
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
124184
- UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
124070
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
124071
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
124072
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
124073
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
124185
124074
  /**
124186
124075
  * Projects with no outputs (i.e. "solution" files)
124187
124076
  */
124188
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
124189
- UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
124077
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
124190
124078
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
124191
124079
  function resolveConfigFileProjectName(project) {
124192
124080
  if (ts.fileExtensionIs(project, ".json" /* Json */)) {
@@ -124231,11 +124119,9 @@ var ts;
124231
124119
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
124232
124120
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
124233
124121
  }
124234
- /*@internal*/
124235
- function getCurrentTime(host) {
124236
- return host.now ? host.now() : new Date();
124122
+ function newer(date1, date2) {
124123
+ return date2 > date1 ? date2 : date1;
124237
124124
  }
124238
- ts.getCurrentTime = getCurrentTime;
124239
124125
  /*@internal*/
124240
124126
  function isCircularBuildOrder(buildOrder) {
124241
124127
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -124325,7 +124211,6 @@ var ts;
124325
124211
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
124326
124212
  };
124327
124213
  }
124328
- compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
124329
124214
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
124330
124215
  var state = {
124331
124216
  host: host,
@@ -124342,9 +124227,8 @@ var ts;
124342
124227
  resolvedConfigFilePaths: new ts.Map(),
124343
124228
  configFileCache: new ts.Map(),
124344
124229
  projectStatus: new ts.Map(),
124230
+ buildInfoChecked: new ts.Map(),
124345
124231
  extendedConfigCache: new ts.Map(),
124346
- buildInfoCache: new ts.Map(),
124347
- outputTimeStamps: new ts.Map(),
124348
124232
  builderPrograms: new ts.Map(),
124349
124233
  diagnostics: new ts.Map(),
124350
124234
  projectPendingBuild: new ts.Map(),
@@ -124367,7 +124251,6 @@ var ts;
124367
124251
  allWatchedConfigFiles: new ts.Map(),
124368
124252
  allWatchedExtendedConfigFiles: new ts.Map(),
124369
124253
  allWatchedPackageJsonFiles: new ts.Map(),
124370
- filesWatched: new ts.Map(),
124371
124254
  lastCachedPackageJsonLookups: new ts.Map(),
124372
124255
  timerToBuildInvalidatedProject: undefined,
124373
124256
  reportFileChangeDetected: false,
@@ -124478,12 +124361,11 @@ var ts;
124478
124361
  // Config file cache
124479
124362
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
124480
124363
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
124364
+ ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
124481
124365
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
124482
124366
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
124483
124367
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
124484
124368
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
124485
- ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
124486
- ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
124487
124369
  // Remove watches for the program no longer in the solution
124488
124370
  if (state.watch) {
124489
124371
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
@@ -124780,21 +124662,21 @@ var ts;
124780
124662
  }
124781
124663
  function emit(writeFileCallback, cancellationToken, customTransformers) {
124782
124664
  var _a;
124783
- var _b, _c, _d;
124665
+ var _b, _c;
124784
124666
  ts.Debug.assertIsDefined(program);
124785
124667
  ts.Debug.assert(step === BuildStep.Emit);
124786
124668
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
124787
- program.backupEmitState();
124669
+ program.backupState();
124788
124670
  var declDiagnostics;
124789
124671
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
124790
124672
  var outputFiles = [];
124791
124673
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
124792
124674
  /*write*/ undefined,
124793
- /*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,
124675
+ /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
124794
124676
  /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
124795
124677
  // Don't emit .d.ts if there are decl file errors
124796
124678
  if (declDiagnostics) {
124797
- program.restoreEmitState();
124679
+ program.restoreState();
124798
124680
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
124799
124681
  return {
124800
124682
  emitSkipped: true,
@@ -124804,46 +124686,40 @@ var ts;
124804
124686
  // Actual Emit
124805
124687
  var host = state.host, compilerHost = state.compilerHost;
124806
124688
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124807
- var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
124689
+ var newestDeclarationFileContentChangedTime = minimumDate;
124690
+ var anyDtsChanged = false;
124808
124691
  var emitterDiagnostics = ts.createDiagnosticCollection();
124809
124692
  var emittedOutputs = new ts.Map();
124810
- var options = program.getCompilerOptions();
124811
- var isIncremental = ts.isIncrementalCompilation(options);
124812
- var outputTimeStampMap;
124813
- var now;
124814
124693
  ts.solutionPerformance.mark("beforeOutputFilesWrite");
124815
124694
  outputFiles.forEach(function (_a) {
124816
- var _b, _c;
124817
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124818
- var path = toPath(state, name);
124819
- emittedOutputs.set(toPath(state, name), name);
124820
- if (buildInfo) {
124821
- setBuildInfo(state, buildInfo, projectPath, options);
124822
- 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)) {
124695
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124696
+ var priorChangeTime;
124697
+ if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124698
+ // Check for unchanged .d.ts files
124699
+ if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124700
+ priorChangeTime = host.getModifiedTime(name);
124701
+ }
124702
+ else {
124823
124703
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124704
+ anyDtsChanged = true;
124824
124705
  }
124825
124706
  }
124707
+ emittedOutputs.set(toPath(state, name), name);
124826
124708
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124827
- if (!isIncremental && state.watch) {
124828
- (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
124709
+ if (priorChangeTime !== undefined) {
124710
+ newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
124829
124711
  }
124830
124712
  });
124831
124713
  ts.solutionPerformance.mark("afterOutputFilesWrite");
124832
124714
  ts.solutionPerformance.measure("OutputFilesWrite", "beforeOutputFilesWrite", "afterOutputFilesWrite");
124833
- finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124715
+ finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime,
124716
+ /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124834
124717
  return emitResult;
124835
124718
  }
124836
124719
  function emitBuildInfo(writeFileCallback, cancellationToken) {
124837
124720
  ts.Debug.assertIsDefined(program);
124838
124721
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
124839
- var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
124840
- if (data === null || data === void 0 ? void 0 : data.buildInfo)
124841
- setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
124842
- if (writeFileCallback)
124843
- writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
124844
- else
124845
- state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
124846
- }, cancellationToken);
124722
+ var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
124847
124723
  if (emitResult.diagnostics.length) {
124848
124724
  reportErrors(state, emitResult.diagnostics);
124849
124725
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -124856,7 +124732,7 @@ var ts;
124856
124732
  step = BuildStep.QueueReferencingProjects;
124857
124733
  return emitResult;
124858
124734
  }
124859
- function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
124735
+ function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
124860
124736
  var _a;
124861
124737
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
124862
124738
  if (emitDiagnostics.length) {
@@ -124867,11 +124743,13 @@ var ts;
124867
124743
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
124868
124744
  }
124869
124745
  // Update time stamps for rest of the outputs
124870
- updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124746
+ var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124871
124747
  state.diagnostics.delete(projectPath);
124872
124748
  state.projectStatus.set(projectPath, {
124873
124749
  type: ts.UpToDateStatusType.UpToDate,
124874
- newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
124750
+ newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
124751
+ maximumDate :
124752
+ newestDeclarationFileContentChangedTime,
124875
124753
  oldestOutputFileName: oldestOutputFileName
124876
124754
  });
124877
124755
  afterProgramDone(state, program, config);
@@ -124906,21 +124784,13 @@ var ts;
124906
124784
  ts.Debug.assert(!!outputFiles.length);
124907
124785
  var emitterDiagnostics = ts.createDiagnosticCollection();
124908
124786
  var emittedOutputs = new ts.Map();
124909
- var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124910
- var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
124911
124787
  outputFiles.forEach(function (_a) {
124912
- var _b, _c;
124913
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124788
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124914
124789
  emittedOutputs.set(toPath(state, name), name);
124915
- if (buildInfo) {
124916
- setBuildInfo(state, buildInfo, projectPath, config.options);
124917
- if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
124918
- resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124919
- }
124920
- }
124921
124790
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124922
124791
  });
124923
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
124792
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate,
124793
+ /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
124924
124794
  return { emitSkipped: false, diagnostics: emitDiagnostics };
124925
124795
  }
124926
124796
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -125026,7 +124896,7 @@ var ts;
125026
124896
  }
125027
124897
  continue;
125028
124898
  }
125029
- if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
124899
+ if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
125030
124900
  reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
125031
124901
  return {
125032
124902
  kind: InvalidatedProjectKind.UpdateOutputFileStamps,
@@ -125112,7 +124982,7 @@ var ts;
125112
124982
  state.projectCompilerOptions = state.baseCompilerOptions;
125113
124983
  }
125114
124984
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
125115
- var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
124985
+ var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
125116
124986
  reportAndStoreErrors(state, resolvedPath, diagnostics);
125117
124987
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
125118
124988
  if (canEmitBuildInfo)
@@ -125120,101 +124990,9 @@ var ts;
125120
124990
  afterProgramDone(state, program, config);
125121
124991
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
125122
124992
  }
125123
- function isFileWatcherWithModifiedTime(value) {
125124
- return !!value.watcher;
125125
- }
125126
- function getModifiedTime(state, fileName) {
125127
- var path = toPath(state, fileName);
125128
- var existing = state.filesWatched.get(path);
125129
- if (state.watch && !!existing) {
125130
- if (!isFileWatcherWithModifiedTime(existing))
125131
- return existing;
125132
- if (existing.modifiedTime)
125133
- return existing.modifiedTime;
125134
- }
125135
- var result = ts.getModifiedTime(state.host, fileName);
125136
- if (state.watch) {
125137
- if (existing)
125138
- existing.modifiedTime = result;
125139
- else
125140
- state.filesWatched.set(path, result);
125141
- }
125142
- return result;
125143
- }
125144
- function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
125145
- var path = toPath(state, file);
125146
- var existing = state.filesWatched.get(path);
125147
- if (existing && isFileWatcherWithModifiedTime(existing)) {
125148
- existing.callbacks.push(callback);
125149
- }
125150
- else {
125151
- var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
125152
- var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
125153
- ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
125154
- existing.modifiedTime = modifiedTime;
125155
- existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
125156
- }, pollingInterval, options, watchType, project);
125157
- state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
125158
- }
125159
- return {
125160
- close: function () {
125161
- var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
125162
- ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
125163
- if (existing.callbacks.length === 1) {
125164
- state.filesWatched.delete(path);
125165
- ts.closeFileWatcherOf(existing);
125166
- }
125167
- else {
125168
- ts.unorderedRemoveItem(existing.callbacks, callback);
125169
- }
125170
- }
125171
- };
125172
- }
125173
- function getOutputTimeStampMap(state, resolvedConfigFilePath) {
125174
- if (!state.watch)
125175
- return undefined;
125176
- var result = state.outputTimeStamps.get(resolvedConfigFilePath);
125177
- if (!result)
125178
- state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
125179
- return result;
125180
- }
125181
- function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
125182
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125183
- var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
125184
- if (existing) {
125185
- existing.buildInfo = buildInfo;
125186
- existing.modifiedTime = getCurrentTime(state.host);
125187
- }
125188
- else {
125189
- state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
125190
- }
125191
- }
125192
- function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
125193
- var path = toPath(state, buildInfoPath);
125194
- var existing = state.buildInfoCache.get(resolvedConfigPath);
125195
- return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
125196
- }
125197
- function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
125198
- var path = toPath(state, buildInfoPath);
125199
- var existing = state.buildInfoCache.get(resolvedConfigPath);
125200
- if (existing !== undefined && existing.path === path) {
125201
- return existing.buildInfo || undefined;
125202
- }
125203
- ts.solutionPerformance.mark("beforeGetBuildInfo");
125204
- ts.solutionPerformance.mark("beforeBuildInfoRead");
125205
- var value = state.readFileWithCache(buildInfoPath);
125206
- ts.solutionPerformance.mark("afterBuildInfoRead");
125207
- ts.solutionPerformance.measure("BuildInfoRead", "beforeBuildInfoRead", "afterBuildInfoRead");
125208
- var buildInfo = value ? ts.getBuildInfo(value) : undefined;
125209
- ts.Debug.assert(modifiedTime || !buildInfo);
125210
- state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
125211
- ts.solutionPerformance.mark("afterGetBuildInfo");
125212
- ts.solutionPerformance.measure("GetBuildInfo", "beforeGetBuildInfo", "afterGetBuildInfo");
125213
- return buildInfo;
125214
- }
125215
124993
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
125216
124994
  // Check tsconfig time
125217
- var tsconfigTime = getModifiedTime(state, configFile);
124995
+ var tsconfigTime = ts.getModifiedTime(state.host, configFile);
125218
124996
  if (oldestOutputFileTime < tsconfigTime) {
125219
124997
  return {
125220
124998
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -125224,24 +125002,88 @@ var ts;
125224
125002
  }
125225
125003
  }
125226
125004
  function getUpToDateStatusWorker(state, project, resolvedPath) {
125227
- var _a, _b, _c;
125005
+ var force = !!state.options.force;
125006
+ var newestInputFileName = undefined;
125007
+ var newestInputFileTime = minimumDate;
125008
+ var host = state.host;
125009
+ // Get timestamps of input files
125010
+ for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
125011
+ var inputFile = _a[_i];
125012
+ if (!host.fileExists(inputFile)) {
125013
+ return {
125014
+ type: ts.UpToDateStatusType.Unbuildable,
125015
+ reason: inputFile + " does not exist"
125016
+ };
125017
+ }
125018
+ if (!force) {
125019
+ var inputTime = ts.getModifiedTime(host, inputFile);
125020
+ if (inputTime > newestInputFileTime) {
125021
+ newestInputFileName = inputFile;
125022
+ newestInputFileTime = inputTime;
125023
+ }
125024
+ }
125025
+ }
125228
125026
  // Container if no files are specified in the project
125229
125027
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
125230
125028
  return {
125231
125029
  type: ts.UpToDateStatusType.ContainerOnly
125232
125030
  };
125233
125031
  }
125234
- // Fast check to see if reference projects are buildable
125235
- var referenceStatuses;
125236
- var force = !!state.options.force;
125032
+ // Collect the expected outputs of this project
125033
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
125034
+ // Now see if all outputs are newer than the newest input
125035
+ var oldestOutputFileName = "(none)";
125036
+ var oldestOutputFileTime = maximumDate;
125037
+ var newestOutputFileName = "(none)";
125038
+ var newestOutputFileTime = minimumDate;
125039
+ var missingOutputFileName;
125040
+ var newestDeclarationFileContentChangedTime = minimumDate;
125041
+ var isOutOfDateWithInputs = false;
125042
+ if (!force) {
125043
+ for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
125044
+ var output = outputs_1[_b];
125045
+ // Output is missing; can stop checking
125046
+ // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
125047
+ if (!host.fileExists(output)) {
125048
+ missingOutputFileName = output;
125049
+ break;
125050
+ }
125051
+ var outputTime = ts.getModifiedTime(host, output);
125052
+ if (outputTime < oldestOutputFileTime) {
125053
+ oldestOutputFileTime = outputTime;
125054
+ oldestOutputFileName = output;
125055
+ }
125056
+ // If an output is older than the newest input, we can stop checking
125057
+ // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
125058
+ if (outputTime < newestInputFileTime) {
125059
+ isOutOfDateWithInputs = true;
125060
+ break;
125061
+ }
125062
+ if (outputTime > newestOutputFileTime) {
125063
+ newestOutputFileTime = outputTime;
125064
+ newestOutputFileName = output;
125065
+ }
125066
+ // Keep track of when the most recent time a .d.ts file was changed.
125067
+ // In addition to file timestamps, we also keep track of when a .d.ts file
125068
+ // had its file touched but not had its contents changed - this allows us
125069
+ // to skip a downstream typecheck
125070
+ if (ts.isDeclarationFileName(output)) {
125071
+ var outputModifiedTime = ts.getModifiedTime(host, output);
125072
+ newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
125073
+ }
125074
+ }
125075
+ }
125076
+ var pseudoUpToDate = false;
125077
+ var usesPrepend = false;
125078
+ var upstreamChangedProject;
125237
125079
  if (project.projectReferences) {
125238
125080
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
125239
- for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
125240
- var ref = _d[_i];
125081
+ for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
125082
+ var ref = _d[_c];
125083
+ usesPrepend = usesPrepend || !!(ref.prepend);
125241
125084
  var resolvedRef = ts.resolveProjectReferencePath(ref);
125242
125085
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
125243
- var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
125244
- var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
125086
+ var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
125245
125087
  // Its a circular reference ignore the status of this project
125246
125088
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
125247
125089
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) { // Container only ignore this project
@@ -125263,188 +125105,78 @@ var ts;
125263
125105
  upstreamProjectName: ref.path
125264
125106
  };
125265
125107
  }
125266
- if (!force)
125267
- (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
125268
- }
125269
- }
125270
- if (force)
125271
- return { type: ts.UpToDateStatusType.ForceBuild };
125272
- // Check buildinfo first
125273
- var host = state.host;
125274
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125275
- var oldestOutputFileName = "(none)";
125276
- var oldestOutputFileTime = maximumDate;
125277
- var buildInfoTime;
125278
- var buildInfoProgram;
125279
- var buildInfoVersionMap;
125280
- var newestDeclarationFileContentChangedTime;
125281
- if (buildInfoPath) {
125282
- var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
125283
- buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
125284
- if (buildInfoTime === ts.missingFileModifiedTime) {
125285
- if (!buildInfoCacheEntry_1) {
125286
- state.buildInfoCache.set(resolvedPath, {
125287
- path: toPath(state, buildInfoPath),
125288
- buildInfo: false,
125289
- modifiedTime: buildInfoTime
125290
- });
125291
- }
125292
- return {
125293
- type: ts.UpToDateStatusType.OutputMissing,
125294
- missingOutputFileName: buildInfoPath
125295
- };
125296
- }
125297
- var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
125298
- if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125299
- return {
125300
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
125301
- version: buildInfo.version
125302
- };
125303
- }
125304
- if (buildInfo.program) {
125305
- if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
125306
- (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
125108
+ // Check oldest output file name only if there is no missing output file name
125109
+ // (a check we will have skipped if this is a forced build)
125110
+ if (!force && !missingOutputFileName) {
125111
+ // If the upstream project's newest file is older than our oldest output, we
125112
+ // can't be out of date because of it
125113
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
125114
+ continue;
125115
+ }
125116
+ // If the upstream project has only change .d.ts files, and we've built
125117
+ // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
125118
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
125119
+ pseudoUpToDate = true;
125120
+ upstreamChangedProject = ref.path;
125121
+ continue;
125122
+ }
125123
+ // We have an output older than an upstream output - we are out of date
125124
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125307
125125
  return {
125308
- type: ts.UpToDateStatusType.OutOfDateBuildInfo,
125309
- buildInfoFile: buildInfoPath
125126
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125127
+ outOfDateOutputFileName: oldestOutputFileName,
125128
+ newerProjectName: ref.path
125310
125129
  };
125311
125130
  }
125312
- buildInfoProgram = buildInfo.program;
125313
125131
  }
125314
- oldestOutputFileTime = buildInfoTime;
125315
- oldestOutputFileName = buildInfoPath;
125316
- newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
125317
125132
  }
125318
- // Check input files
125319
- var newestInputFileName = undefined;
125320
- var newestInputFileTime = minimumDate;
125321
- var pseudoInputUptodate = false;
125322
- // Get timestamps of input files
125323
- for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
125324
- var inputFile = _f[_e];
125325
- var inputTime = getModifiedTime(state, inputFile);
125326
- if (inputTime === ts.missingFileModifiedTime) {
125327
- return {
125328
- type: ts.UpToDateStatusType.Unbuildable,
125329
- reason: inputFile + " does not exist"
125330
- };
125331
- }
125332
- // If an buildInfo is older than the newest input, we can stop checking
125333
- if (buildInfoTime && buildInfoTime < inputTime) {
125334
- var version_3 = void 0;
125335
- var currentVersion = void 0;
125336
- if (buildInfoProgram) {
125337
- // Read files and see if they are same, read is anyways cached
125338
- if (!buildInfoVersionMap)
125339
- buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
125340
- version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
125341
- var text = version_3 ? state.readFileWithCache(inputFile) : undefined;
125342
- currentVersion = text && (host.createHash || ts.generateDjb2Hash)(text);
125343
- if (version_3 && version_3 === currentVersion)
125344
- pseudoInputUptodate = true;
125345
- }
125346
- if (!version_3 || version_3 !== currentVersion) {
125347
- return {
125348
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
125349
- outOfDateOutputFileName: buildInfoPath,
125350
- newerInputFileName: inputFile
125351
- };
125352
- }
125353
- }
125354
- if (inputTime > newestInputFileTime) {
125355
- newestInputFileName = inputFile;
125356
- newestInputFileTime = inputTime;
125357
- }
125133
+ if (missingOutputFileName !== undefined) {
125134
+ return {
125135
+ type: ts.UpToDateStatusType.OutputMissing,
125136
+ missingOutputFileName: missingOutputFileName
125137
+ };
125358
125138
  }
125359
- // Now see if all outputs are newer than the newest input
125360
- // Dont check output timestamps if we have buildinfo telling us output is uptodate
125361
- if (!buildInfoPath) {
125362
- // Collect the expected outputs of this project
125363
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
125364
- var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
125365
- for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
125366
- var output = outputs_1[_g];
125367
- var path = toPath(state, output);
125368
- // Output is missing; can stop checking
125369
- var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
125370
- if (!outputTime) {
125371
- outputTime = ts.getModifiedTime(state.host, output);
125372
- outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
125373
- }
125374
- if (outputTime === ts.missingFileModifiedTime) {
125375
- return {
125376
- type: ts.UpToDateStatusType.OutputMissing,
125377
- missingOutputFileName: output
125378
- };
125379
- }
125380
- if (outputTime < oldestOutputFileTime) {
125381
- oldestOutputFileTime = outputTime;
125382
- oldestOutputFileName = output;
125383
- }
125384
- // If an output is older than the newest input, we can stop checking
125385
- if (outputTime < newestInputFileTime) {
125386
- return {
125387
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
125388
- outOfDateOutputFileName: oldestOutputFileName,
125389
- newerInputFileName: newestInputFileName
125390
- };
125391
- }
125392
- }
125139
+ if (isOutOfDateWithInputs) {
125140
+ return {
125141
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125142
+ outOfDateOutputFileName: oldestOutputFileName,
125143
+ newerInputFileName: newestInputFileName
125144
+ };
125393
125145
  }
125394
- var seenRefs = buildInfoPath ? new ts.Set() : undefined;
125395
- var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
125396
- seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
125397
- var pseudoUpToDate = false;
125398
- var usesPrepend = false;
125399
- var upstreamChangedProject;
125400
- if (referenceStatuses) {
125401
- for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
125402
- var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
125403
- usesPrepend = usesPrepend || !!(ref.prepend);
125404
- // If the upstream project's newest file is older than our oldest output, we
125405
- // can't be out of date because of it
125406
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
125407
- continue;
125408
- }
125409
- // Check if tsbuildinfo path is shared, then we need to rebuild
125410
- if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
125146
+ else {
125147
+ // Check tsconfig time
125148
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125149
+ if (configStatus)
125150
+ return configStatus;
125151
+ // Check extended config time
125152
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125153
+ if (extendedConfigStatus)
125154
+ return extendedConfigStatus;
125155
+ // Check package file time
125156
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125157
+ var path = _a[0];
125158
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125159
+ });
125160
+ if (dependentPackageFileStatus)
125161
+ return dependentPackageFileStatus;
125162
+ }
125163
+ if (!force && !state.buildInfoChecked.has(resolvedPath)) {
125164
+ state.buildInfoChecked.set(resolvedPath, true);
125165
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
125166
+ if (buildInfoPath) {
125167
+ ts.solutionPerformance.mark("beforeBuildInfoRead");
125168
+ var value = state.readFileWithCache(buildInfoPath);
125169
+ ts.solutionPerformance.mark("afterBuildInfoRead");
125170
+ ts.solutionPerformance.measure("BuildInfoRead", "beforeBuildInfoRead", "afterBuildInfoRead");
125171
+ var buildInfo = value && ts.getBuildInfo(value);
125172
+ if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125411
125173
  return {
125412
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125413
- outOfDateOutputFileName: buildInfoPath,
125414
- newerProjectName: ref.path
125174
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
125175
+ version: buildInfo.version
125415
125176
  };
125416
125177
  }
125417
- // If the upstream project has only change .d.ts files, and we've built
125418
- // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
125419
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
125420
- pseudoUpToDate = true;
125421
- upstreamChangedProject = ref.path;
125422
- continue;
125423
- }
125424
- // We have an output older than an upstream output - we are out of date
125425
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125426
- return {
125427
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125428
- outOfDateOutputFileName: oldestOutputFileName,
125429
- newerProjectName: ref.path
125430
- };
125431
125178
  }
125432
125179
  }
125433
- // Check tsconfig time
125434
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125435
- if (configStatus)
125436
- return configStatus;
125437
- // Check extended config time
125438
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125439
- if (extendedConfigStatus)
125440
- return extendedConfigStatus;
125441
- // Check package file time
125442
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125443
- var path = _a[0];
125444
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125445
- });
125446
- if (dependentPackageFileStatus)
125447
- return dependentPackageFileStatus;
125448
125180
  if (usesPrepend && pseudoUpToDate) {
125449
125181
  return {
125450
125182
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -125454,37 +125186,15 @@ var ts;
125454
125186
  }
125455
125187
  // Up to date
125456
125188
  return {
125457
- type: pseudoUpToDate ?
125458
- ts.UpToDateStatusType.UpToDateWithUpstreamTypes :
125459
- pseudoInputUptodate ?
125460
- ts.UpToDateStatusType.UpToDateWithInputFileText :
125461
- ts.UpToDateStatusType.UpToDate,
125189
+ type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
125462
125190
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
125463
125191
  newestInputFileTime: newestInputFileTime,
125192
+ newestOutputFileTime: newestOutputFileTime,
125464
125193
  newestInputFileName: newestInputFileName,
125194
+ newestOutputFileName: newestOutputFileName,
125465
125195
  oldestOutputFileName: oldestOutputFileName
125466
125196
  };
125467
125197
  }
125468
- function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
125469
- if (seenRefs.has(resolvedRefPath))
125470
- return false;
125471
- seenRefs.add(resolvedRefPath);
125472
- var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
125473
- if (refBuildInfo.path === buildInfoCacheEntry.path)
125474
- return true;
125475
- if (resolvedConfig.projectReferences) {
125476
- // Check references
125477
- for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
125478
- var ref = _a[_i];
125479
- var resolvedRef = ts.resolveProjectReferencePath(ref);
125480
- var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
125481
- var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
125482
- if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
125483
- return true;
125484
- }
125485
- }
125486
- return false;
125487
- }
125488
125198
  function getUpToDateStatus(state, project, resolvedPath) {
125489
125199
  if (project === undefined) {
125490
125200
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -125500,69 +125210,42 @@ var ts;
125500
125210
  state.projectStatus.set(resolvedPath, actual);
125501
125211
  return actual;
125502
125212
  }
125503
- function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
125213
+ function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
125504
125214
  if (proj.options.noEmit)
125505
- return;
125506
- var now;
125215
+ return priorNewestUpdateTime;
125507
125216
  ts.solutionPerformance.mark("beforeUpdateOutputTimestamps");
125508
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
125509
- if (buildInfoPath) {
125510
- if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
125511
- if (!!state.options.verbose)
125217
+ var host = state.host;
125218
+ var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125219
+ if (!skipOutputs || outputs.length !== skipOutputs.size) {
125220
+ var reportVerbose = !!state.options.verbose;
125221
+ var now = host.now ? host.now() : new Date();
125222
+ for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125223
+ var file = outputs_2[_i];
125224
+ if (skipOutputs && skipOutputs.has(toPath(state, file))) {
125225
+ continue;
125226
+ }
125227
+ if (reportVerbose) {
125228
+ reportVerbose = false;
125512
125229
  reportStatus(state, verboseMessage, proj.options.configFilePath);
125513
- state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
125514
- getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
125515
- }
125516
- state.outputTimeStamps.delete(projectPath);
125517
- }
125518
- else {
125519
- var host = state.host;
125520
- var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125521
- var outputTimeStampMap_1 = getOutputTimeStampMap(state, projectPath);
125522
- var modifiedOutputs_1 = outputTimeStampMap_1 ? new ts.Set() : undefined;
125523
- if (!skipOutputs || outputs.length !== skipOutputs.size) {
125524
- var reportVerbose = !!state.options.verbose;
125525
- for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
125526
- var file = outputs_2[_i];
125527
- var path = toPath(state, file);
125528
- if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
125529
- continue;
125530
- if (reportVerbose) {
125531
- reportVerbose = false;
125532
- reportStatus(state, verboseMessage, proj.options.configFilePath);
125533
- }
125534
- host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
125535
- if (outputTimeStampMap_1) {
125536
- outputTimeStampMap_1.set(path, now);
125537
- modifiedOutputs_1.add(path);
125538
- }
125539
125230
  }
125231
+ if (ts.isDeclarationFileName(file)) {
125232
+ priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
125233
+ }
125234
+ host.setModifiedTime(file, now);
125540
125235
  }
125541
- // Clear out timestamps not in output list any more
125542
- outputTimeStampMap_1 === null || outputTimeStampMap_1 === void 0 ? void 0 : outputTimeStampMap_1.forEach(function (_value, key) {
125543
- if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs_1.has(key))
125544
- outputTimeStampMap_1.delete(key);
125545
- });
125546
125236
  }
125547
125237
  ts.solutionPerformance.mark("afterUpdateOutputTimestamps");
125548
125238
  ts.solutionPerformance.measure("UpdateOutputTimestamps", "beforeUpdateOutputTimestamps", "afterUpdateOutputTimestamps");
125549
- }
125550
- function getDtsChangeTime(state, options, resolvedConfigPath) {
125551
- var _a;
125552
- if (!options.composite)
125553
- return undefined;
125554
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125555
- var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, /*modifiedTime*/ undefined);
125556
- 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;
125239
+ return priorNewestUpdateTime;
125557
125240
  }
125558
125241
  function updateOutputTimestamps(state, proj, resolvedPath) {
125559
125242
  if (state.options.dry) {
125560
125243
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
125561
125244
  }
125562
- updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125245
+ var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125563
125246
  state.projectStatus.set(resolvedPath, {
125564
125247
  type: ts.UpToDateStatusType.UpToDate,
125565
- newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
125248
+ newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
125566
125249
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
125567
125250
  });
125568
125251
  }
@@ -125608,7 +125291,6 @@ var ts;
125608
125291
  break;
125609
125292
  }
125610
125293
  // falls through
125611
- case ts.UpToDateStatusType.UpToDateWithInputFileText:
125612
125294
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125613
125295
  case ts.UpToDateStatusType.OutOfDateWithPrepend:
125614
125296
  if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
@@ -125793,10 +125475,12 @@ var ts;
125793
125475
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
125794
125476
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
125795
125477
  return;
125796
- 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));
125478
+ state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
125479
+ invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
125480
+ }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
125797
125481
  }
125798
125482
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
125799
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
125483
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
125800
125484
  var _a;
125801
125485
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
125802
125486
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -125828,7 +125512,7 @@ var ts;
125828
125512
  if (!state.watch)
125829
125513
  return;
125830
125514
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
125831
- 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); },
125515
+ 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); },
125832
125516
  onDeleteValue: ts.closeFileWatcher,
125833
125517
  });
125834
125518
  }
@@ -125836,7 +125520,7 @@ var ts;
125836
125520
  if (!state.watch || !state.lastCachedPackageJsonLookups)
125837
125521
  return;
125838
125522
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
125839
- 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); },
125523
+ 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); },
125840
125524
  onDeleteValue: ts.closeFileWatcher,
125841
125525
  });
125842
125526
  }
@@ -125969,18 +125653,19 @@ var ts;
125969
125653
  }
125970
125654
  }
125971
125655
  function reportUpToDateStatus(state, configFileName, status) {
125656
+ if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
125657
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125658
+ }
125972
125659
  switch (status.type) {
125973
125660
  case ts.UpToDateStatusType.OutOfDateWithSelf:
125974
- 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));
125661
+ 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));
125975
125662
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
125976
- 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));
125663
+ return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName));
125977
125664
  case ts.UpToDateStatusType.OutputMissing:
125978
125665
  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));
125979
- case ts.UpToDateStatusType.OutOfDateBuildInfo:
125980
- 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));
125981
125666
  case ts.UpToDateStatusType.UpToDate:
125982
125667
  if (status.newestInputFileTime !== undefined) {
125983
- 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 || ""));
125668
+ 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 || ""));
125984
125669
  }
125985
125670
  // Don't report anything for "up to date because it was already built" -- too verbose
125986
125671
  break;
@@ -125988,8 +125673,6 @@ var ts;
125988
125673
  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));
125989
125674
  case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
125990
125675
  return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
125991
- case ts.UpToDateStatusType.UpToDateWithInputFileText:
125992
- 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));
125993
125676
  case ts.UpToDateStatusType.UpstreamOutOfDate:
125994
125677
  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));
125995
125678
  case ts.UpToDateStatusType.UpstreamBlocked:
@@ -126000,8 +125683,6 @@ var ts;
126000
125683
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
126001
125684
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
126002
125685
  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);
126003
- case ts.UpToDateStatusType.ForceBuild:
126004
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
126005
125686
  case ts.UpToDateStatusType.ContainerOnly:
126006
125687
  // Don't report status on "solution" projects
126007
125688
  // falls through