typescript 5.6.0-dev.20240627 → 5.6.0-dev.20240629

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.6";
21
- var version = `${versionMajorMinor}.0-dev.20240627`;
21
+ var version = `${versionMajorMinor}.0-dev.20240629`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -4902,6 +4902,7 @@ var sys = (() => {
4902
4902
  writeFile: writeFile2,
4903
4903
  watchFile: watchFile2,
4904
4904
  watchDirectory,
4905
+ preferNonRecursiveWatch: !fsSupportsRecursiveFsWatch,
4905
4906
  resolvePath: (path) => _path.resolve(path),
4906
4907
  fileExists,
4907
4908
  directoryExists,
@@ -16142,11 +16143,11 @@ function getOwnEmitOutputFilePath(fileName, host, extension) {
16142
16143
  return emitOutputFilePathWithoutExtension + extension;
16143
16144
  }
16144
16145
  function getDeclarationEmitOutputFilePath(fileName, host) {
16145
- return getDeclarationEmitOutputFilePathWorker(fileName, host.getCompilerOptions(), host.getCurrentDirectory(), host.getCommonSourceDirectory(), (f) => host.getCanonicalFileName(f));
16146
+ return getDeclarationEmitOutputFilePathWorker(fileName, host.getCompilerOptions(), host);
16146
16147
  }
16147
- function getDeclarationEmitOutputFilePathWorker(fileName, options, currentDirectory, commonSourceDirectory, getCanonicalFileName) {
16148
+ function getDeclarationEmitOutputFilePathWorker(fileName, options, host) {
16148
16149
  const outputDir = options.declarationDir || options.outDir;
16149
- const path = outputDir ? getSourceFilePathInNewDirWorker(fileName, outputDir, currentDirectory, commonSourceDirectory, getCanonicalFileName) : fileName;
16150
+ const path = outputDir ? getSourceFilePathInNewDirWorker(fileName, outputDir, host.getCurrentDirectory(), host.getCommonSourceDirectory(), (f) => host.getCanonicalFileName(f)) : fileName;
16150
16151
  const declarationExtension = getDeclarationEmitExtensionForPath(path);
16151
16152
  return removeFileExtension(path) + declarationExtension;
16152
16153
  }
@@ -110897,17 +110898,16 @@ function createGetIsolatedDeclarationErrors(resolver) {
110897
110898
  function getDeclarationDiagnostics(host, resolver, file) {
110898
110899
  const compilerOptions = host.getCompilerOptions();
110899
110900
  const files = filter(getSourceFilesToEmit(host, file), isSourceFileNotJson);
110900
- const result = transformNodes(
110901
+ return contains(files, file) ? transformNodes(
110901
110902
  resolver,
110902
110903
  host,
110903
110904
  factory,
110904
110905
  compilerOptions,
110905
- file ? contains(files, file) ? [file] : emptyArray : files,
110906
+ [file],
110906
110907
  [transformDeclarations],
110907
110908
  /*allowDtsFiles*/
110908
110909
  false
110909
- );
110910
- return result.diagnostics;
110910
+ ).diagnostics : void 0;
110911
110911
  }
110912
110912
  var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 1 /* AllowUnresolvedNames */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
110913
110913
  function transformDeclarations(context) {
@@ -119210,8 +119210,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119210
119210
  let filesWithReferencesProcessed;
119211
119211
  let fileReasonsToChain;
119212
119212
  let reasonToRelatedInfo;
119213
- const cachedBindAndCheckDiagnosticsForFile = {};
119214
- const cachedDeclarationDiagnosticsForFile = {};
119213
+ let cachedBindAndCheckDiagnosticsForFile;
119214
+ let cachedDeclarationDiagnosticsForFile;
119215
119215
  let fileProcessingDiagnostics;
119216
119216
  let automaticTypeDirectiveNames;
119217
119217
  let automaticTypeDirectiveResolutions;
@@ -120291,8 +120291,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120291
120291
  );
120292
120292
  }
120293
120293
  function getCachedSemanticDiagnostics(sourceFile) {
120294
- var _a2;
120295
- return sourceFile ? (_a2 = cachedBindAndCheckDiagnosticsForFile.perFile) == null ? void 0 : _a2.get(sourceFile.path) : cachedBindAndCheckDiagnosticsForFile.allDiagnostics;
120294
+ return cachedBindAndCheckDiagnosticsForFile == null ? void 0 : cachedBindAndCheckDiagnosticsForFile.get(sourceFile.path);
120296
120295
  }
120297
120296
  function getBindAndCheckDiagnostics(sourceFile, cancellationToken) {
120298
120297
  return getBindAndCheckDiagnosticsForFile(
@@ -120314,12 +120313,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120314
120313
  return getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, programDiagnosticsInFile).diagnostics;
120315
120314
  }
120316
120315
  function getDeclarationDiagnostics2(sourceFile, cancellationToken) {
120317
- const options2 = program.getCompilerOptions();
120318
- if (!sourceFile || options2.outFile) {
120319
- return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);
120320
- } else {
120321
- return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken);
120322
- }
120316
+ return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken);
120323
120317
  }
120324
120318
  function getSyntacticDiagnosticsForFile(sourceFile) {
120325
120319
  if (isSourceFileJS(sourceFile)) {
@@ -120350,7 +120344,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120350
120344
  if (nodesToCheck) {
120351
120345
  return getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck);
120352
120346
  }
120353
- return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedBindAndCheckDiagnosticsForFile, getBindAndCheckDiagnosticsForFileNoCache);
120347
+ let result = cachedBindAndCheckDiagnosticsForFile == null ? void 0 : cachedBindAndCheckDiagnosticsForFile.get(sourceFile.path);
120348
+ if (!result) {
120349
+ (cachedBindAndCheckDiagnosticsForFile ?? (cachedBindAndCheckDiagnosticsForFile = /* @__PURE__ */ new Map())).set(
120350
+ sourceFile.path,
120351
+ result = getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken)
120352
+ );
120353
+ }
120354
+ return result;
120354
120355
  }
120355
120356
  function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck) {
120356
120357
  return runWithCancellationToken(() => {
@@ -120638,7 +120639,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120638
120639
  });
120639
120640
  }
120640
120641
  function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) {
120641
- return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedDeclarationDiagnosticsForFile, getDeclarationDiagnosticsForFileNoCache);
120642
+ let result = cachedDeclarationDiagnosticsForFile == null ? void 0 : cachedDeclarationDiagnosticsForFile.get(sourceFile.path);
120643
+ if (!result) {
120644
+ (cachedDeclarationDiagnosticsForFile ?? (cachedDeclarationDiagnosticsForFile = /* @__PURE__ */ new Map())).set(
120645
+ sourceFile.path,
120646
+ result = getDeclarationDiagnosticsForFileNoCache(sourceFile, cancellationToken)
120647
+ );
120648
+ }
120649
+ return result;
120642
120650
  }
120643
120651
  function getDeclarationDiagnosticsForFileNoCache(sourceFile, cancellationToken) {
120644
120652
  return runWithCancellationToken(() => {
@@ -120646,22 +120654,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120646
120654
  return getDeclarationDiagnostics(getEmitHost(noop), resolver, sourceFile) || emptyArray;
120647
120655
  });
120648
120656
  }
120649
- function getAndCacheDiagnostics(sourceFile, cancellationToken, cache, getDiagnostics) {
120650
- var _a2;
120651
- const cachedResult = sourceFile ? (_a2 = cache.perFile) == null ? void 0 : _a2.get(sourceFile.path) : cache.allDiagnostics;
120652
- if (cachedResult) {
120653
- return cachedResult;
120654
- }
120655
- const result = getDiagnostics(sourceFile, cancellationToken);
120656
- if (sourceFile) {
120657
- (cache.perFile || (cache.perFile = /* @__PURE__ */ new Map())).set(sourceFile.path, result);
120658
- } else {
120659
- cache.allDiagnostics = result;
120660
- }
120661
- return result;
120662
- }
120663
120657
  function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) {
120664
- return sourceFile.isDeclarationFile ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);
120658
+ return sourceFile.isDeclarationFile ? emptyArray : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);
120665
120659
  }
120666
120660
  function getOptionsDiagnostics() {
120667
120661
  return sortAndDeduplicateDiagnostics(concatenate(
@@ -121609,7 +121603,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121609
121603
  if (options.outDir || // there is --outDir specified
121610
121604
  options.rootDir || // there is --rootDir specified
121611
121605
  options.sourceRoot || // there is --sourceRoot specified
121612
- options.mapRoot) {
121606
+ options.mapRoot || // there is --mapRoot specified
121607
+ getEmitDeclarations(options) && options.declarationDir) {
121613
121608
  const dir = getCommonSourceDirectory2();
121614
121609
  if (options.outDir && dir === "" && files.some((file) => getRootLength(file.fileName) > 1)) {
121615
121610
  createDiagnosticForOptionName(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir");
@@ -121622,14 +121617,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121622
121617
  if (!getEmitDeclarations(options)) {
121623
121618
  createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "emitDeclarationOnly", "declaration", "composite");
121624
121619
  }
121625
- if (options.noEmit) {
121626
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "emitDeclarationOnly", "noEmit");
121627
- }
121628
- }
121629
- if (options.noCheck) {
121630
- if (options.noEmit) {
121631
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noCheck", "noEmit");
121632
- }
121633
121620
  }
121634
121621
  if (options.emitDecoratorMetadata && !options.experimentalDecorators) {
121635
121622
  createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators");
@@ -122366,7 +122353,6 @@ var emitSkippedWithNoDiagnostics = { diagnostics: emptyArray, sourceMaps: void 0
122366
122353
  function handleNoEmitOptions(program, sourceFile, writeFile2, cancellationToken) {
122367
122354
  const options = program.getCompilerOptions();
122368
122355
  if (options.noEmit) {
122369
- program.getSemanticDiagnostics(sourceFile, cancellationToken);
122370
122356
  return sourceFile ? emitSkippedWithNoDiagnostics : program.emitBuildInfo(writeFile2, cancellationToken);
122371
122357
  }
122372
122358
  if (!options.noEmitOnError) return void 0;
@@ -122843,9 +122829,9 @@ function getBuilderFileEmit(options) {
122843
122829
  let result = 1 /* Js */;
122844
122830
  if (options.sourceMap) result = result | 2 /* JsMap */;
122845
122831
  if (options.inlineSourceMap) result = result | 4 /* JsInlineMap */;
122846
- if (getEmitDeclarations(options)) result = result | 8 /* Dts */;
122847
- if (options.declarationMap) result = result | 16 /* DtsMap */;
122848
- if (options.emitDeclarationOnly) result = result & 24 /* AllDts */;
122832
+ if (getEmitDeclarations(options)) result = result | 24 /* Dts */;
122833
+ if (options.declarationMap) result = result | 32 /* DtsMap */;
122834
+ if (options.emitDeclarationOnly) result = result & 56 /* AllDts */;
122849
122835
  return result;
122850
122836
  }
122851
122837
  function getPendingEmitKind(optionsOrEmitKind, oldOptionsOrEmitKind) {
@@ -122856,7 +122842,8 @@ function getPendingEmitKind(optionsOrEmitKind, oldOptionsOrEmitKind) {
122856
122842
  const diff = oldEmitKind ^ emitKind;
122857
122843
  let result = 0 /* None */;
122858
122844
  if (diff & 7 /* AllJs */) result = emitKind & 7 /* AllJs */;
122859
- if (diff & 24 /* AllDts */) result = result | emitKind & 24 /* AllDts */;
122845
+ if (diff & 8 /* DtsErrors */) result = result | emitKind & 8 /* DtsErrors */;
122846
+ if (diff & 48 /* AllDtsEmit */) result = result | emitKind & 48 /* AllDtsEmit */;
122860
122847
  return result;
122861
122848
  }
122862
122849
  function hasSameKeys(map1, map2) {
@@ -123110,25 +123097,34 @@ function getNextAffectedFile(state, cancellationToken, host) {
123110
123097
  if (!state.seenAffectedFiles) state.seenAffectedFiles = /* @__PURE__ */ new Set();
123111
123098
  }
123112
123099
  }
123113
- function clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles) {
123100
+ function clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles, isForDtsErrors) {
123114
123101
  var _a, _b;
123115
123102
  if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size) && !state.programEmitPending) return;
123116
- if (!emitOnlyDtsFiles) {
123103
+ if (!emitOnlyDtsFiles && !isForDtsErrors) {
123117
123104
  state.affectedFilesPendingEmit = void 0;
123118
123105
  state.programEmitPending = void 0;
123119
123106
  }
123120
123107
  (_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.forEach((emitKind, path) => {
123121
- const pending = emitKind & 7 /* AllJs */;
123108
+ const pending = !isForDtsErrors ? emitKind & 7 /* AllJs */ : emitKind & (7 /* AllJs */ | 48 /* AllDtsEmit */);
123122
123109
  if (!pending) state.affectedFilesPendingEmit.delete(path);
123123
123110
  else state.affectedFilesPendingEmit.set(path, pending);
123124
123111
  });
123125
123112
  if (state.programEmitPending) {
123126
- const pending = state.programEmitPending & 7 /* AllJs */;
123113
+ const pending = !isForDtsErrors ? state.programEmitPending & 7 /* AllJs */ : state.programEmitPending & (7 /* AllJs */ | 48 /* AllDtsEmit */);
123127
123114
  if (!pending) state.programEmitPending = void 0;
123128
123115
  else state.programEmitPending = pending;
123129
123116
  }
123130
123117
  }
123131
- function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) {
123118
+ function getPendingEmitKindWithSeen(optionsOrEmitKind, seenOldOptionsOrEmitKind, emitOnlyDtsFiles, isForDtsErrors) {
123119
+ let pendingKind = getPendingEmitKind(optionsOrEmitKind, seenOldOptionsOrEmitKind);
123120
+ if (emitOnlyDtsFiles) pendingKind = pendingKind & 56 /* AllDts */;
123121
+ if (isForDtsErrors) pendingKind = pendingKind & 8 /* DtsErrors */;
123122
+ return pendingKind;
123123
+ }
123124
+ function getBuilderFileEmitAllDts(isForDtsErrors) {
123125
+ return !isForDtsErrors ? 56 /* AllDts */ : 8 /* DtsErrors */;
123126
+ }
123127
+ function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles, isForDtsErrors) {
123132
123128
  var _a;
123133
123129
  if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size)) return void 0;
123134
123130
  return forEachEntry(state.affectedFilesPendingEmit, (emitKind, path) => {
@@ -123139,12 +123135,16 @@ function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) {
123139
123135
  return void 0;
123140
123136
  }
123141
123137
  const seenKind = (_a2 = state.seenEmittedFiles) == null ? void 0 : _a2.get(affectedFile.resolvedPath);
123142
- let pendingKind = getPendingEmitKind(emitKind, seenKind);
123143
- if (emitOnlyDtsFiles) pendingKind = pendingKind & 24 /* AllDts */;
123138
+ const pendingKind = getPendingEmitKindWithSeen(
123139
+ emitKind,
123140
+ seenKind,
123141
+ emitOnlyDtsFiles,
123142
+ isForDtsErrors
123143
+ );
123144
123144
  if (pendingKind) return { affectedFile, emitKind: pendingKind };
123145
123145
  });
123146
123146
  }
123147
- function getNextPendingEmitDiagnosticsFile(state) {
123147
+ function getNextPendingEmitDiagnosticsFile(state, isForDtsErrors) {
123148
123148
  var _a;
123149
123149
  if (!((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size)) return void 0;
123150
123150
  return forEachEntry(state.emitDiagnosticsPerFile, (diagnostics, path) => {
@@ -123155,7 +123155,7 @@ function getNextPendingEmitDiagnosticsFile(state) {
123155
123155
  return void 0;
123156
123156
  }
123157
123157
  const seenKind = ((_a2 = state.seenEmittedFiles) == null ? void 0 : _a2.get(affectedFile.resolvedPath)) || 0 /* None */;
123158
- if (!(seenKind & 24 /* AllDts */)) return { affectedFile, diagnostics, seenKind };
123158
+ if (!(seenKind & getBuilderFileEmitAllDts(isForDtsErrors))) return { affectedFile, diagnostics, seenKind };
123159
123159
  });
123160
123160
  }
123161
123161
  function removeDiagnosticsOfLibraryFiles(state) {
@@ -123210,7 +123210,7 @@ function handleDtsMayChangeOf(state, path, invalidateJsFiles, cancellationToken,
123210
123210
  addToAffectedFilesPendingEmit(
123211
123211
  state,
123212
123212
  path,
123213
- state.compilerOptions.declarationMap ? 24 /* AllDts */ : 8 /* Dts */
123213
+ state.compilerOptions.declarationMap ? 56 /* AllDts */ : 24 /* Dts */
123214
123214
  );
123215
123215
  }
123216
123216
  }
@@ -123410,8 +123410,9 @@ function getBuildInfo2(state) {
123410
123410
  root,
123411
123411
  resolvedRoot: toResolvedRoot(),
123412
123412
  options: toIncrementalBuildInfoCompilerOptions(state.compilerOptions),
123413
- semanticDiagnosticsPerFile: toIncrementalBuildInfoDiagnostics(),
123413
+ semanticDiagnosticsPerFile: !state.changedFilesSet.size ? toIncrementalBuildInfoDiagnostics() : void 0,
123414
123414
  emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
123415
+ changeFileSet: toChangeFileSet(),
123415
123416
  outSignature: state.outSignature,
123416
123417
  latestChangedDtsFile,
123417
123418
  pendingEmit: !state.programEmitPending ? void 0 : (
@@ -123495,7 +123496,7 @@ function getBuildInfo2(state) {
123495
123496
  affectedFilesPendingEmit,
123496
123497
  pendingEmit === fullEmitForOptions ? fileId : (
123497
123498
  // Pending full emit per options
123498
- pendingEmit === 8 /* Dts */ ? [fileId] : (
123499
+ pendingEmit === 24 /* Dts */ ? [fileId] : (
123499
123500
  // Pending on Dts only
123500
123501
  [fileId, pendingEmit]
123501
123502
  )
@@ -123515,6 +123516,7 @@ function getBuildInfo2(state) {
123515
123516
  referencedMap,
123516
123517
  semanticDiagnosticsPerFile,
123517
123518
  emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
123519
+ changeFileSet: toChangeFileSet(),
123518
123520
  affectedFilesPendingEmit,
123519
123521
  emitSignatures,
123520
123522
  latestChangedDtsFile,
@@ -123603,7 +123605,7 @@ function getBuildInfo2(state) {
123603
123605
  state.fileInfos.forEach((_value, key) => {
123604
123606
  const value = state.semanticDiagnosticsPerFile.get(key);
123605
123607
  if (!value) {
123606
- result = append(result, toFileId(key));
123608
+ if (!state.changedFilesSet.has(key)) result = append(result, toFileId(key));
123607
123609
  } else if (value.length) {
123608
123610
  result = append(result, [
123609
123611
  toFileId(key),
@@ -123670,6 +123672,15 @@ function getBuildInfo2(state) {
123670
123672
  return result;
123671
123673
  }) || array;
123672
123674
  }
123675
+ function toChangeFileSet() {
123676
+ let changeFileSet;
123677
+ if (state.changedFilesSet.size) {
123678
+ for (const path of arrayFrom(state.changedFilesSet.keys()).sort(compareStringsCaseSensitive)) {
123679
+ changeFileSet = append(changeFileSet, toFileId(path));
123680
+ }
123681
+ }
123682
+ return changeFileSet;
123683
+ }
123673
123684
  }
123674
123685
  function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
123675
123686
  let host;
@@ -123748,6 +123759,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123748
123759
  sourceFile
123749
123760
  );
123750
123761
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
123762
+ builderProgram.getDeclarationDiagnostics = getDeclarationDiagnostics2;
123751
123763
  builderProgram.emit = emit;
123752
123764
  builderProgram.releaseProgram = () => releaseCache(state);
123753
123765
  if (kind === 0 /* SemanticDiagnosticsBuilderProgram */) {
@@ -123772,21 +123784,31 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123772
123784
  }
123773
123785
  return emitSkippedWithNoDiagnostics;
123774
123786
  }
123775
- function emitNextAffectedFile(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
123787
+ function emitNextAffectedFileOrDtsErrors(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers, isForDtsErrors) {
123776
123788
  var _a, _b, _c, _d;
123777
123789
  Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
123778
123790
  let affected = getNextAffectedFile(state, cancellationToken, host);
123779
123791
  const programEmitKind = getBuilderFileEmit(state.compilerOptions);
123780
- let emitKind = emitOnlyDtsFiles ? programEmitKind & 24 /* AllDts */ : programEmitKind;
123792
+ let emitKind = !isForDtsErrors ? emitOnlyDtsFiles ? programEmitKind & 56 /* AllDts */ : programEmitKind : 8 /* DtsErrors */;
123781
123793
  if (!affected) {
123782
123794
  if (!state.compilerOptions.outFile) {
123783
- const pendingAffectedFile = getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles);
123795
+ const pendingAffectedFile = getNextAffectedFilePendingEmit(
123796
+ state,
123797
+ emitOnlyDtsFiles,
123798
+ isForDtsErrors
123799
+ );
123784
123800
  if (pendingAffectedFile) {
123785
123801
  ({ affectedFile: affected, emitKind } = pendingAffectedFile);
123786
123802
  } else {
123787
- const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(state);
123803
+ const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(
123804
+ state,
123805
+ isForDtsErrors
123806
+ );
123788
123807
  if (pendingForDiagnostics) {
123789
- (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(pendingForDiagnostics.affectedFile.resolvedPath, pendingForDiagnostics.seenKind | 24 /* AllDts */);
123808
+ (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(
123809
+ pendingForDiagnostics.affectedFile.resolvedPath,
123810
+ pendingForDiagnostics.seenKind | getBuilderFileEmitAllDts(isForDtsErrors)
123811
+ );
123790
123812
  return {
123791
123813
  result: { emitSkipped: true, diagnostics: pendingForDiagnostics.diagnostics },
123792
123814
  affected: pendingForDiagnostics.affectedFile
@@ -123795,14 +123817,18 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123795
123817
  }
123796
123818
  } else {
123797
123819
  if (state.programEmitPending) {
123798
- emitKind = state.programEmitPending;
123799
- if (emitOnlyDtsFiles) emitKind = emitKind & 24 /* AllDts */;
123820
+ emitKind = getPendingEmitKindWithSeen(
123821
+ state.programEmitPending,
123822
+ state.seenProgramEmit,
123823
+ emitOnlyDtsFiles,
123824
+ isForDtsErrors
123825
+ );
123800
123826
  if (emitKind) affected = state.program;
123801
123827
  }
123802
123828
  if (!affected && ((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size)) {
123803
123829
  const seenKind = state.seenProgramEmit || 0 /* None */;
123804
- if (!(seenKind & 24 /* AllDts */)) {
123805
- state.seenProgramEmit = 24 /* AllDts */ | seenKind;
123830
+ if (!(seenKind & getBuilderFileEmitAllDts(isForDtsErrors))) {
123831
+ state.seenProgramEmit = getBuilderFileEmitAllDts(isForDtsErrors) | seenKind;
123806
123832
  const diagnostics = [];
123807
123833
  state.emitDiagnosticsPerFile.forEach((d) => addRange(diagnostics, d));
123808
123834
  return {
@@ -123813,7 +123839,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123813
123839
  }
123814
123840
  }
123815
123841
  if (!affected) {
123816
- if (!getBuildInfoEmitPending(state)) return void 0;
123842
+ if (isForDtsErrors || !getBuildInfoEmitPending(state)) return void 0;
123817
123843
  const affected2 = state.program;
123818
123844
  const result2 = affected2.emitBuildInfo(
123819
123845
  writeFile2 || maybeBind(host, host.writeFile),
@@ -123825,8 +123851,8 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123825
123851
  }
123826
123852
  let emitOnly;
123827
123853
  if (emitKind & 7 /* AllJs */) emitOnly = 0 /* Js */;
123828
- if (emitKind & 24 /* AllDts */) emitOnly = emitOnly === void 0 ? 1 /* Dts */ : void 0;
123829
- const result = state.program.emit(
123854
+ if (emitKind & 56 /* AllDts */) emitOnly = emitOnly === void 0 ? 1 /* Dts */ : void 0;
123855
+ const result = !isForDtsErrors ? state.program.emit(
123830
123856
  affected === state.program ? void 0 : affected,
123831
123857
  getWriteFileCallback(writeFile2, customTransformers),
123832
123858
  cancellationToken,
@@ -123836,7 +123862,13 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123836
123862
  void 0,
123837
123863
  /*skipBuildInfo*/
123838
123864
  true
123839
- );
123865
+ ) : {
123866
+ emitSkipped: true,
123867
+ diagnostics: state.program.getDeclarationDiagnostics(
123868
+ affected === state.program ? void 0 : affected,
123869
+ cancellationToken
123870
+ )
123871
+ };
123840
123872
  if (affected !== state.program) {
123841
123873
  const affectedSourceFile = affected;
123842
123874
  state.seenAffectedFiles.add(affectedSourceFile.resolvedPath);
@@ -123853,18 +123885,31 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123853
123885
  state.changedFilesSet.clear();
123854
123886
  state.programEmitPending = state.changedFilesSet.size ? getPendingEmitKind(programEmitKind, emitKind) : state.programEmitPending ? getPendingEmitKind(state.programEmitPending, emitKind) : void 0;
123855
123887
  state.seenProgramEmit = emitKind | (state.seenProgramEmit || 0 /* None */);
123856
- let emitDiagnosticsPerFile;
123857
- result.diagnostics.forEach((d) => {
123858
- if (!d.file) return;
123859
- let diagnostics = emitDiagnosticsPerFile == null ? void 0 : emitDiagnosticsPerFile.get(d.file.resolvedPath);
123860
- if (!diagnostics) (emitDiagnosticsPerFile ?? (emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(d.file.resolvedPath, diagnostics = []);
123861
- diagnostics.push(d);
123862
- });
123863
- if (emitDiagnosticsPerFile) state.emitDiagnosticsPerFile = emitDiagnosticsPerFile;
123888
+ setEmitDiagnosticsPerFile(result.diagnostics);
123864
123889
  state.buildInfoEmitPending = true;
123865
123890
  }
123866
123891
  return { result, affected };
123867
123892
  }
123893
+ function setEmitDiagnosticsPerFile(diagnostics) {
123894
+ let emitDiagnosticsPerFile;
123895
+ diagnostics.forEach((d) => {
123896
+ if (!d.file) return;
123897
+ let diagnostics2 = emitDiagnosticsPerFile == null ? void 0 : emitDiagnosticsPerFile.get(d.file.resolvedPath);
123898
+ if (!diagnostics2) (emitDiagnosticsPerFile ?? (emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(d.file.resolvedPath, diagnostics2 = []);
123899
+ diagnostics2.push(d);
123900
+ });
123901
+ if (emitDiagnosticsPerFile) state.emitDiagnosticsPerFile = emitDiagnosticsPerFile;
123902
+ }
123903
+ function emitNextAffectedFile(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
123904
+ return emitNextAffectedFileOrDtsErrors(
123905
+ writeFile2,
123906
+ cancellationToken,
123907
+ emitOnlyDtsFiles,
123908
+ customTransformers,
123909
+ /*isForDtsErrors*/
123910
+ false
123911
+ );
123912
+ }
123868
123913
  function getWriteFileCallback(writeFile2, customTransformers) {
123869
123914
  Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
123870
123915
  if (!getEmitDeclarations(state.compilerOptions)) return writeFile2 || maybeBind(host, host.writeFile);
@@ -123964,16 +124009,69 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123964
124009
  sourceMaps
123965
124010
  };
123966
124011
  } else {
123967
- clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles);
124012
+ clearAffectedFilesPendingEmit(
124013
+ state,
124014
+ emitOnlyDtsFiles,
124015
+ /*isForDtsErrors*/
124016
+ false
124017
+ );
123968
124018
  }
123969
124019
  }
123970
- return state.program.emit(
124020
+ const emitResult = state.program.emit(
123971
124021
  targetSourceFile,
123972
124022
  getWriteFileCallback(writeFile2, customTransformers),
123973
124023
  cancellationToken,
123974
124024
  emitOnlyDtsFiles,
123975
124025
  customTransformers
123976
124026
  );
124027
+ handleNonEmitBuilderWithEmitOrDtsErrors(
124028
+ targetSourceFile,
124029
+ emitOnlyDtsFiles,
124030
+ /*isForDtsErrors*/
124031
+ false,
124032
+ emitResult.diagnostics
124033
+ );
124034
+ return emitResult;
124035
+ }
124036
+ function handleNonEmitBuilderWithEmitOrDtsErrors(targetSourceFile, emitOnlyDtsFiles, isForDtsErrors, diagnostics) {
124037
+ if (!targetSourceFile && kind !== 1 /* EmitAndSemanticDiagnosticsBuilderProgram */) {
124038
+ clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles, isForDtsErrors);
124039
+ setEmitDiagnosticsPerFile(diagnostics);
124040
+ }
124041
+ }
124042
+ function getDeclarationDiagnostics2(sourceFile, cancellationToken) {
124043
+ var _a;
124044
+ Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
124045
+ if (kind === 1 /* EmitAndSemanticDiagnosticsBuilderProgram */) {
124046
+ assertSourceFileOkWithoutNextAffectedCall(state, sourceFile);
124047
+ let affectedEmitResult;
124048
+ let diagnostics;
124049
+ while (affectedEmitResult = emitNextAffectedFileOrDtsErrors(
124050
+ /*writeFile*/
124051
+ void 0,
124052
+ cancellationToken,
124053
+ /*emitOnlyDtsFiles*/
124054
+ void 0,
124055
+ /*customTransformers*/
124056
+ void 0,
124057
+ /*isForDtsErrors*/
124058
+ true
124059
+ )) {
124060
+ if (!sourceFile) diagnostics = addRange(diagnostics, affectedEmitResult.result.diagnostics);
124061
+ }
124062
+ return (!sourceFile ? diagnostics : (_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.get(sourceFile.resolvedPath)) || emptyArray;
124063
+ } else {
124064
+ const result = state.program.getDeclarationDiagnostics(sourceFile, cancellationToken);
124065
+ handleNonEmitBuilderWithEmitOrDtsErrors(
124066
+ sourceFile,
124067
+ /*emitOnlyDtsFiles*/
124068
+ void 0,
124069
+ /*isForDtsErrors*/
124070
+ true,
124071
+ result
124072
+ );
124073
+ return result;
124074
+ }
123977
124075
  }
123978
124076
  function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
123979
124077
  Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
@@ -124051,7 +124149,7 @@ function toBuilderStateFileInfoForMultiEmit(fileInfo) {
124051
124149
  return isString(fileInfo) ? { version: fileInfo, signature: fileInfo, affectsGlobalScope: void 0, impliedFormat: void 0 } : isString(fileInfo.signature) ? fileInfo : { version: fileInfo.version, signature: fileInfo.signature === false ? void 0 : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
124052
124150
  }
124053
124151
  function toBuilderFileEmit(value, fullEmitForOptions) {
124054
- return isNumber(value) ? fullEmitForOptions : value[1] || 8 /* Dts */;
124152
+ return isNumber(value) ? fullEmitForOptions : value[1] || 24 /* Dts */;
124055
124153
  }
124056
124154
  function toProgramEmitPending(value, options) {
124057
124155
  return !value ? getBuilderFileEmit(options || {}) : value;
@@ -124065,6 +124163,7 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
124065
124163
  let filePathsSetList;
124066
124164
  const latestChangedDtsFile = buildInfo.latestChangedDtsFile ? toAbsolutePath(buildInfo.latestChangedDtsFile) : void 0;
124067
124165
  const fileInfos = /* @__PURE__ */ new Map();
124166
+ const changedFilesSet = new Set(map(buildInfo.changeFileSet, toFilePath));
124068
124167
  if (isIncrementalBundleEmitBuildInfo(buildInfo)) {
124069
124168
  buildInfo.fileInfos.forEach((fileInfo, index) => {
124070
124169
  const path = toFilePath(index + 1);
@@ -124076,6 +124175,7 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
124076
124175
  semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(buildInfo.semanticDiagnosticsPerFile),
124077
124176
  emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
124078
124177
  hasReusableDiagnostic: true,
124178
+ changedFilesSet,
124079
124179
  latestChangedDtsFile,
124080
124180
  outSignature: buildInfo.outSignature,
124081
124181
  programEmitPending: buildInfo.pendingEmit === void 0 ? void 0 : toProgramEmitPending(buildInfo.pendingEmit, buildInfo.options),
@@ -124112,6 +124212,7 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
124112
124212
  semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(buildInfo.semanticDiagnosticsPerFile),
124113
124213
  emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
124114
124214
  hasReusableDiagnostic: true,
124215
+ changedFilesSet,
124115
124216
  affectedFilesPendingEmit: buildInfo.affectedFilesPendingEmit && arrayToMap(buildInfo.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
124116
124217
  latestChangedDtsFile,
124117
124218
  emitSignatures: (emitSignatures == null ? void 0 : emitSignatures.size) ? emitSignatures : void 0,
@@ -124164,7 +124265,7 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
124164
124265
  const semanticDiagnostics = new Map(
124165
124266
  mapDefinedIterator(
124166
124267
  fileInfos.keys(),
124167
- (key) => [key, emptyArray]
124268
+ (key) => !changedFilesSet.has(key) ? [key, emptyArray] : void 0
124168
124269
  )
124169
124270
  );
124170
124271
  diagnostics == null ? void 0 : diagnostics.forEach((value) => {
@@ -124306,7 +124407,7 @@ function canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(fileOrDirPath) {
124306
124407
  function canWatchAffectingLocation(filePath) {
124307
124408
  return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(filePath);
124308
124409
  }
124309
- function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootPathComponents, getCurrentDirectory) {
124410
+ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootPathComponents, getCurrentDirectory, preferNonRecursiveWatch) {
124310
124411
  const failedLookupPathComponents = getPathComponents(failedLookupLocationPath);
124311
124412
  failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
124312
124413
  const failedLookupComponents = getPathComponents(failedLookupLocation);
@@ -124338,10 +124439,11 @@ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLoo
124338
124439
  perceivedOsRootLength,
124339
124440
  nodeModulesIndex,
124340
124441
  rootPathComponents,
124341
- lastNodeModulesIndex
124442
+ lastNodeModulesIndex,
124443
+ preferNonRecursiveWatch
124342
124444
  );
124343
124445
  }
124344
- function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dirPathComponents, dirPathComponentsLength, perceivedOsRootLength, nodeModulesIndex, rootPathComponents, lastNodeModulesIndex) {
124446
+ function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dirPathComponents, dirPathComponentsLength, perceivedOsRootLength, nodeModulesIndex, rootPathComponents, lastNodeModulesIndex, preferNonRecursiveWatch) {
124345
124447
  if (nodeModulesIndex !== -1) {
124346
124448
  return getDirectoryOfFailedLookupWatch(
124347
124449
  dirComponents,
@@ -124352,11 +124454,13 @@ function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dir
124352
124454
  }
124353
124455
  let nonRecursive = true;
124354
124456
  let length2 = dirPathComponentsLength;
124355
- for (let i = 0; i < dirPathComponentsLength; i++) {
124356
- if (dirPathComponents[i] !== rootPathComponents[i]) {
124357
- nonRecursive = false;
124358
- length2 = Math.max(i + 1, perceivedOsRootLength + 1);
124359
- break;
124457
+ if (!preferNonRecursiveWatch) {
124458
+ for (let i = 0; i < dirPathComponentsLength; i++) {
124459
+ if (dirPathComponents[i] !== rootPathComponents[i]) {
124460
+ nonRecursive = false;
124461
+ length2 = Math.max(i + 1, perceivedOsRootLength + 1);
124462
+ break;
124463
+ }
124360
124464
  }
124361
124465
  }
124362
124466
  return getDirectoryOfFailedLookupWatch(
@@ -124384,7 +124488,7 @@ function getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, lengt
124384
124488
  packageDirPath: packageDirLength !== void 0 ? getPathFromPathComponents(dirPathComponents, packageDirLength) : void 0
124385
124489
  };
124386
124490
  }
124387
- function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, getCurrentDirectory, filterCustomPath) {
124491
+ function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, getCurrentDirectory, preferNonRecursiveWatch, filterCustomPath) {
124388
124492
  const typeRootPathComponents = getPathComponents(typeRootPath);
124389
124493
  if (isInDirectoryPath(rootPathComponents, typeRootPathComponents)) {
124390
124494
  return rootPath;
@@ -124397,7 +124501,8 @@ function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootP
124397
124501
  perceivedOsRootLengthForWatching(typeRootPathComponents, typeRootPathComponents.length),
124398
124502
  typeRootPathComponents.indexOf("node_modules"),
124399
124503
  rootPathComponents,
124400
- typeRootPathComponents.lastIndexOf("node_modules")
124504
+ typeRootPathComponents.lastIndexOf("node_modules"),
124505
+ preferNonRecursiveWatch
124401
124506
  );
124402
124507
  return toWatch && filterCustomPath(toWatch.dirPath) ? toWatch.dirPath : void 0;
124403
124508
  }
@@ -124906,7 +125011,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
124906
125011
  rootDir,
124907
125012
  rootPath,
124908
125013
  rootPathComponents,
124909
- getCurrentDirectory
125014
+ getCurrentDirectory,
125015
+ resolutionHost.preferNonRecursiveWatch
124910
125016
  );
124911
125017
  if (toWatch) {
124912
125018
  const { dir, dirPath, nonRecursive, packageDir, packageDirPath } = toWatch;
@@ -125105,7 +125211,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
125105
125211
  rootDir,
125106
125212
  rootPath,
125107
125213
  rootPathComponents,
125108
- getCurrentDirectory
125214
+ getCurrentDirectory,
125215
+ resolutionHost.preferNonRecursiveWatch
125109
125216
  );
125110
125217
  if (toWatch) {
125111
125218
  const { dirPath, packageDirPath } = toWatch;
@@ -125333,6 +125440,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
125333
125440
  rootPath,
125334
125441
  rootPathComponents,
125335
125442
  getCurrentDirectory,
125443
+ resolutionHost.preferNonRecursiveWatch,
125336
125444
  (dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2) || dirPathToSymlinkPackageRefCount.has(dirPath2)
125337
125445
  );
125338
125446
  if (dirPath) {
@@ -125726,7 +125834,7 @@ function toFileName(file, fileNameConvertor) {
125726
125834
  return fileNameConvertor ? fileNameConvertor(fileName) : fileName;
125727
125835
  }
125728
125836
  function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummary, writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
125729
- const isListFilesOnly = !!program.getCompilerOptions().listFilesOnly;
125837
+ const options = program.getCompilerOptions();
125730
125838
  const allDiagnostics = program.getConfigFileParsingDiagnostics().slice();
125731
125839
  const configFileParsingDiagnosticsLength = allDiagnostics.length;
125732
125840
  addRange(allDiagnostics, program.getSyntacticDiagnostics(
@@ -125736,7 +125844,7 @@ function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummar
125736
125844
  ));
125737
125845
  if (allDiagnostics.length === configFileParsingDiagnosticsLength) {
125738
125846
  addRange(allDiagnostics, program.getOptionsDiagnostics(cancellationToken));
125739
- if (!isListFilesOnly) {
125847
+ if (!options.listFilesOnly) {
125740
125848
  addRange(allDiagnostics, program.getGlobalDiagnostics(cancellationToken));
125741
125849
  if (allDiagnostics.length === configFileParsingDiagnosticsLength) {
125742
125850
  addRange(allDiagnostics, program.getSemanticDiagnostics(
@@ -125745,9 +125853,16 @@ function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummar
125745
125853
  cancellationToken
125746
125854
  ));
125747
125855
  }
125856
+ if (options.noEmit && getEmitDeclarations(options) && allDiagnostics.length === configFileParsingDiagnosticsLength) {
125857
+ addRange(allDiagnostics, program.getDeclarationDiagnostics(
125858
+ /*sourceFile*/
125859
+ void 0,
125860
+ cancellationToken
125861
+ ));
125862
+ }
125748
125863
  }
125749
125864
  }
125750
- const emitResult = isListFilesOnly ? { emitSkipped: true, diagnostics: emptyArray } : program.emit(
125865
+ const emitResult = options.listFilesOnly ? { emitSkipped: true, diagnostics: emptyArray } : program.emit(
125751
125866
  /*targetSourceFile*/
125752
125867
  void 0,
125753
125868
  writeFile2,
@@ -125801,7 +125916,8 @@ function createWatchHost(system = sys, reportWatchStatus2) {
125801
125916
  watchFile: maybeBind(system, system.watchFile) || returnNoopFileWatcher,
125802
125917
  watchDirectory: maybeBind(system, system.watchDirectory) || returnNoopFileWatcher,
125803
125918
  setTimeout: maybeBind(system, system.setTimeout) || noop,
125804
- clearTimeout: maybeBind(system, system.clearTimeout) || noop
125919
+ clearTimeout: maybeBind(system, system.clearTimeout) || noop,
125920
+ preferNonRecursiveWatch: system.preferNonRecursiveWatch
125805
125921
  };
125806
125922
  }
125807
125923
  var WatchType = {
@@ -126107,6 +126223,7 @@ function createWatchProgram(host) {
126107
126223
  compilerHost.toPath = toPath3;
126108
126224
  compilerHost.getCompilationSettings = () => compilerOptions;
126109
126225
  compilerHost.useSourceOfProjectReferenceRedirect = maybeBind(host, host.useSourceOfProjectReferenceRedirect);
126226
+ compilerHost.preferNonRecursiveWatch = host.preferNonRecursiveWatch;
126110
126227
  compilerHost.watchDirectoryOfFailedLookupLocation = (dir, cb, flags) => watchDirectory(dir, cb, flags, watchOptions, WatchType.FailedLookupLocations);
126111
126228
  compilerHost.watchAffectingFileLocation = (file, cb) => watchFile2(file, cb, 2e3 /* High */, watchOptions, WatchType.AffectingFileLocation);
126112
126229
  compilerHost.watchTypeRootsDirectory = (dir, cb, flags) => watchDirectory(dir, cb, flags, watchOptions, WatchType.TypeRoots);
@@ -127564,7 +127681,7 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
127564
127681
  }
127565
127682
  }
127566
127683
  function getUpToDateStatusWorker(state, project, resolvedPath) {
127567
- var _a, _b, _c;
127684
+ var _a, _b, _c, _d, _e;
127568
127685
  if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
127569
127686
  return {
127570
127687
  type: 15 /* ContainerOnly */
@@ -127626,19 +127743,25 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
127626
127743
  };
127627
127744
  }
127628
127745
  if (incrementalBuildInfo) {
127629
- if (!project.options.noCheck && (((_a = incrementalBuildInfo.semanticDiagnosticsPerFile) == null ? void 0 : _a.length) || !project.options.noEmit && getEmitDeclarations(project.options) && ((_b = incrementalBuildInfo.emitDiagnosticsPerFile) == null ? void 0 : _b.length))) {
127746
+ if (!project.options.noCheck && (((_a = incrementalBuildInfo.changeFileSet) == null ? void 0 : _a.length) || ((_b = incrementalBuildInfo.semanticDiagnosticsPerFile) == null ? void 0 : _b.length) || getEmitDeclarations(project.options) && ((_c = incrementalBuildInfo.emitDiagnosticsPerFile) == null ? void 0 : _c.length))) {
127630
127747
  return {
127631
127748
  type: 8 /* OutOfDateBuildInfoWithErrors */,
127632
127749
  buildInfoFile: buildInfoPath
127633
127750
  };
127634
127751
  }
127635
- if (!project.options.noEmit && (((_c = incrementalBuildInfo.affectedFilesPendingEmit) == null ? void 0 : _c.length) || incrementalBuildInfo.pendingEmit !== void 0)) {
127752
+ if (!project.options.noEmit && (((_d = incrementalBuildInfo.changeFileSet) == null ? void 0 : _d.length) || ((_e = incrementalBuildInfo.affectedFilesPendingEmit) == null ? void 0 : _e.length) || incrementalBuildInfo.pendingEmit !== void 0)) {
127636
127753
  return {
127637
127754
  type: 7 /* OutOfDateBuildInfoWithPendingEmit */,
127638
127755
  buildInfoFile: buildInfoPath
127639
127756
  };
127640
127757
  }
127641
- if (!project.options.noEmit && getPendingEmitKind(project.options, incrementalBuildInfo.options || {})) {
127758
+ if ((!project.options.noEmit || project.options.noEmit && getEmitDeclarations(project.options)) && getPendingEmitKindWithSeen(
127759
+ project.options,
127760
+ incrementalBuildInfo.options || {},
127761
+ /*emitOnlyDtsFiles*/
127762
+ void 0,
127763
+ !!project.options.noEmit
127764
+ )) {
127642
127765
  return {
127643
127766
  type: 9 /* OutOfDateOptions */,
127644
127767
  buildInfoFile: buildInfoPath