@typescript-deploys/pr-build 5.6.0-pr-59048-28 → 5.6.0-pr-58186-8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/lib/tsc.js +255 -181
  2. package/lib/typescript.js +267 -190
  3. package/package.json +1 -1
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-insiders.20240628`;
21
+ var version = `${versionMajorMinor}.0-insiders.20240701`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -1078,10 +1078,10 @@ function matchedText(pattern, candidate) {
1078
1078
  Debug.assert(isPatternMatch(pattern, candidate));
1079
1079
  return candidate.substring(pattern.prefix.length, candidate.length - pattern.suffix.length);
1080
1080
  }
1081
- function findBestPatternMatch(values, getPattern, candidate, endIndex = values.length) {
1081
+ function findBestPatternMatch(values, getPattern, candidate) {
1082
1082
  let matchedValue;
1083
1083
  let longestMatchPrefixLength = -1;
1084
- for (let i = 0; i < endIndex; i++) {
1084
+ for (let i = 0; i < values.length; i++) {
1085
1085
  const v = values[i];
1086
1086
  const pattern = getPattern(v);
1087
1087
  if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) {
@@ -16143,11 +16143,11 @@ function getOwnEmitOutputFilePath(fileName, host, extension) {
16143
16143
  return emitOutputFilePathWithoutExtension + extension;
16144
16144
  }
16145
16145
  function getDeclarationEmitOutputFilePath(fileName, host) {
16146
- return getDeclarationEmitOutputFilePathWorker(fileName, host.getCompilerOptions(), host.getCurrentDirectory(), host.getCommonSourceDirectory(), (f) => host.getCanonicalFileName(f));
16146
+ return getDeclarationEmitOutputFilePathWorker(fileName, host.getCompilerOptions(), host);
16147
16147
  }
16148
- function getDeclarationEmitOutputFilePathWorker(fileName, options, currentDirectory, commonSourceDirectory, getCanonicalFileName) {
16148
+ function getDeclarationEmitOutputFilePathWorker(fileName, options, host) {
16149
16149
  const outputDir = options.declarationDir || options.outDir;
16150
- 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;
16151
16151
  const declarationExtension = getDeclarationEmitExtensionForPath(path);
16152
16152
  return removeFileExtension(path) + declarationExtension;
16153
16153
  }
@@ -18279,43 +18279,8 @@ function tryParsePattern(pattern) {
18279
18279
  suffix: pattern.substr(indexOfStar + 1)
18280
18280
  };
18281
18281
  }
18282
- var parsedPatternsCache = /* @__PURE__ */ new WeakMap();
18283
- function tryParsePatterns(paths, shouldCache = true, sortByAggregateLength = false) {
18284
- let result;
18285
- if (shouldCache) {
18286
- result = parsedPatternsCache.get(paths);
18287
- if (result !== void 0) {
18288
- return result;
18289
- }
18290
- }
18291
- let matchableStringSet;
18292
- let sortedPatterns;
18293
- const pathList = getOwnKeys(paths);
18294
- for (const path of pathList) {
18295
- const patternOrStr = tryParsePattern(path);
18296
- if (patternOrStr === void 0) {
18297
- continue;
18298
- } else if (typeof patternOrStr === "string") {
18299
- (matchableStringSet ?? (matchableStringSet = /* @__PURE__ */ new Set())).add(patternOrStr);
18300
- } else {
18301
- (sortedPatterns ?? (sortedPatterns = [])).push(patternOrStr);
18302
- }
18303
- }
18304
- sortedPatterns == null ? void 0 : sortedPatterns.sort((a, b) => {
18305
- const prefixComparison = compareStringsCaseSensitive(a.prefix, b.prefix);
18306
- if (prefixComparison === 0 && sortByAggregateLength) {
18307
- return a.suffix.length - b.suffix.length;
18308
- }
18309
- return prefixComparison;
18310
- });
18311
- result = {
18312
- matchableStringSet,
18313
- sortedPatterns
18314
- };
18315
- if (shouldCache) {
18316
- parsedPatternsCache.set(paths, result);
18317
- }
18318
- return result;
18282
+ function tryParsePatterns(paths) {
18283
+ return mapDefined(getOwnKeys(paths), (path) => tryParsePattern(path));
18319
18284
  }
18320
18285
  function positionIsSynthesized(pos) {
18321
18286
  return !(pos >= 0);
@@ -18341,43 +18306,16 @@ var emptyFileSystemEntries = {
18341
18306
  directories: emptyArray
18342
18307
  };
18343
18308
  function matchPatternOrExact(patternOrStrings, candidate) {
18344
- const { matchableStringSet, sortedPatterns } = patternOrStrings;
18345
- if (matchableStringSet == null ? void 0 : matchableStringSet.has(candidate)) {
18346
- return candidate;
18347
- }
18348
- if (sortedPatterns === void 0 || sortedPatterns.length === 0) {
18349
- return void 0;
18350
- }
18351
- let index = binarySearchKey(sortedPatterns, candidate, getPatternPrefix, compareStringsCaseSensitive);
18352
- if (index < 0) {
18353
- index = ~index;
18354
- }
18355
- if (index >= sortedPatterns.length) {
18356
- index--;
18357
- }
18358
- const groupPrefix = sortedPatterns[index].prefix;
18359
- while (index > 0 && groupPrefix === sortedPatterns[index - 1].prefix) {
18360
- index--;
18361
- }
18362
- for (let i = index; i < sortedPatterns.length; i++) {
18363
- const currentPattern = sortedPatterns[i];
18364
- if (currentPattern.prefix !== groupPrefix) {
18365
- break;
18309
+ const patterns = [];
18310
+ for (const patternOrString of patternOrStrings) {
18311
+ if (patternOrString === candidate) {
18312
+ return candidate;
18366
18313
  }
18367
- if (isPatternMatch(currentPattern, candidate)) {
18368
- return currentPattern;
18314
+ if (!isString(patternOrString)) {
18315
+ patterns.push(patternOrString);
18369
18316
  }
18370
18317
  }
18371
- return findBestPatternMatch(
18372
- sortedPatterns,
18373
- (_) => _,
18374
- candidate,
18375
- /*endIndex*/
18376
- index
18377
- );
18378
- }
18379
- function getPatternPrefix(pattern) {
18380
- return pattern.prefix;
18318
+ return findBestPatternMatch(patterns, (_) => _, candidate);
18381
18319
  }
18382
18320
  function sliceAfter(arr, value) {
18383
18321
  const index = arr.indexOf(value);
@@ -39636,16 +39574,7 @@ function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state
39636
39574
  trace(state.host, Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName);
39637
39575
  }
39638
39576
  const baseDirectory = getPathsBasePath(state.compilerOptions, state.host);
39639
- let pathPatterns;
39640
- if (configFile == null ? void 0 : configFile.configFileSpecs) {
39641
- pathPatterns = (_a = configFile.configFileSpecs).pathPatterns ?? (_a.pathPatterns = tryParsePatterns(
39642
- paths,
39643
- /*shouldCache*/
39644
- false
39645
- ));
39646
- } else {
39647
- pathPatterns = tryParsePatterns(paths);
39648
- }
39577
+ const pathPatterns = (configFile == null ? void 0 : configFile.configFileSpecs) ? (_a = configFile.configFileSpecs).pathPatterns || (_a.pathPatterns = tryParsePatterns(paths)) : void 0;
39649
39578
  return tryLoadModuleUsingPaths(
39650
39579
  extensions,
39651
39580
  moduleName,
@@ -40323,8 +40252,17 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
40323
40252
  if (state.traceEnabled) {
40324
40253
  trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, version, moduleName);
40325
40254
  }
40326
- const pathPatterns = tryParsePatterns(versionPaths.paths);
40327
- const result = tryLoadModuleUsingPaths(extensions, moduleName, candidate, versionPaths.paths, pathPatterns, loader, onlyRecordFailuresForPackageFile || onlyRecordFailuresForIndex, state);
40255
+ const result = tryLoadModuleUsingPaths(
40256
+ extensions,
40257
+ moduleName,
40258
+ candidate,
40259
+ versionPaths.paths,
40260
+ /*pathPatterns*/
40261
+ void 0,
40262
+ loader,
40263
+ onlyRecordFailuresForPackageFile || onlyRecordFailuresForIndex,
40264
+ state
40265
+ );
40328
40266
  if (result) {
40329
40267
  return removeIgnoredPackageId(result.value);
40330
40268
  }
@@ -40916,8 +40854,17 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
40916
40854
  trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, version, rest);
40917
40855
  }
40918
40856
  const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
40919
- const pathPatterns = tryParsePatterns(versionPaths.paths);
40920
- const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, pathPatterns, loader, !packageDirectoryExists, state);
40857
+ const fromPaths = tryLoadModuleUsingPaths(
40858
+ extensions,
40859
+ rest,
40860
+ packageDirectory,
40861
+ versionPaths.paths,
40862
+ /*pathPatterns*/
40863
+ void 0,
40864
+ loader,
40865
+ !packageDirectoryExists,
40866
+ state
40867
+ );
40921
40868
  if (fromPaths) {
40922
40869
  return fromPaths.value;
40923
40870
  }
@@ -40925,6 +40872,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
40925
40872
  return loader(extensions, candidate, !nodeModulesDirectoryExists, state);
40926
40873
  }
40927
40874
  function tryLoadModuleUsingPaths(extensions, moduleName, baseDirectory, paths, pathPatterns, loader, onlyRecordFailures, state) {
40875
+ pathPatterns || (pathPatterns = tryParsePatterns(paths));
40928
40876
  const matchedPattern = matchPatternOrExact(pathPatterns, moduleName);
40929
40877
  if (matchedPattern) {
40930
40878
  const matchedStar = isString(matchedPattern) ? void 0 : matchedText(matchedPattern, moduleName);
@@ -59776,6 +59724,12 @@ function createTypeChecker(host) {
59776
59724
  function eachUnionContains(unionTypes2, type) {
59777
59725
  for (const u of unionTypes2) {
59778
59726
  if (!containsType(u.types, type)) {
59727
+ if (type === missingType) {
59728
+ return containsType(u.types, undefinedType);
59729
+ }
59730
+ if (type === undefinedType) {
59731
+ return containsType(u.types, missingType);
59732
+ }
59779
59733
  const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & (32 /* Enum */ | 256 /* NumberLiteral */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
59780
59734
  if (!primitive || !containsType(u.types, primitive)) {
59781
59735
  return false;
@@ -59832,6 +59786,13 @@ function createTypeChecker(host) {
59832
59786
  for (const t of u.types) {
59833
59787
  if (insertType(checked, t)) {
59834
59788
  if (eachUnionContains(unionTypes2, t)) {
59789
+ if (t === undefinedType && result.length && result[0] === missingType) {
59790
+ continue;
59791
+ }
59792
+ if (t === missingType && result.length && result[0] === undefinedType) {
59793
+ result[0] = missingType;
59794
+ continue;
59795
+ }
59835
59796
  insertType(result, t);
59836
59797
  }
59837
59798
  }
@@ -110950,17 +110911,16 @@ function createGetIsolatedDeclarationErrors(resolver) {
110950
110911
  function getDeclarationDiagnostics(host, resolver, file) {
110951
110912
  const compilerOptions = host.getCompilerOptions();
110952
110913
  const files = filter(getSourceFilesToEmit(host, file), isSourceFileNotJson);
110953
- const result = transformNodes(
110914
+ return contains(files, file) ? transformNodes(
110954
110915
  resolver,
110955
110916
  host,
110956
110917
  factory,
110957
110918
  compilerOptions,
110958
- file ? contains(files, file) ? [file] : emptyArray : files,
110919
+ [file],
110959
110920
  [transformDeclarations],
110960
110921
  /*allowDtsFiles*/
110961
110922
  false
110962
- );
110963
- return result.diagnostics;
110923
+ ).diagnostics : void 0;
110964
110924
  }
110965
110925
  var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 1 /* AllowUnresolvedNames */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
110966
110926
  function transformDeclarations(context) {
@@ -119263,8 +119223,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119263
119223
  let filesWithReferencesProcessed;
119264
119224
  let fileReasonsToChain;
119265
119225
  let reasonToRelatedInfo;
119266
- const cachedBindAndCheckDiagnosticsForFile = {};
119267
- const cachedDeclarationDiagnosticsForFile = {};
119226
+ let cachedBindAndCheckDiagnosticsForFile;
119227
+ let cachedDeclarationDiagnosticsForFile;
119268
119228
  let fileProcessingDiagnostics;
119269
119229
  let automaticTypeDirectiveNames;
119270
119230
  let automaticTypeDirectiveResolutions;
@@ -120344,8 +120304,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120344
120304
  );
120345
120305
  }
120346
120306
  function getCachedSemanticDiagnostics(sourceFile) {
120347
- var _a2;
120348
- return sourceFile ? (_a2 = cachedBindAndCheckDiagnosticsForFile.perFile) == null ? void 0 : _a2.get(sourceFile.path) : cachedBindAndCheckDiagnosticsForFile.allDiagnostics;
120307
+ return cachedBindAndCheckDiagnosticsForFile == null ? void 0 : cachedBindAndCheckDiagnosticsForFile.get(sourceFile.path);
120349
120308
  }
120350
120309
  function getBindAndCheckDiagnostics(sourceFile, cancellationToken) {
120351
120310
  return getBindAndCheckDiagnosticsForFile(
@@ -120367,12 +120326,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120367
120326
  return getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, programDiagnosticsInFile).diagnostics;
120368
120327
  }
120369
120328
  function getDeclarationDiagnostics2(sourceFile, cancellationToken) {
120370
- const options2 = program.getCompilerOptions();
120371
- if (!sourceFile || options2.outFile) {
120372
- return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);
120373
- } else {
120374
- return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken);
120375
- }
120329
+ return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken);
120376
120330
  }
120377
120331
  function getSyntacticDiagnosticsForFile(sourceFile) {
120378
120332
  if (isSourceFileJS(sourceFile)) {
@@ -120403,7 +120357,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120403
120357
  if (nodesToCheck) {
120404
120358
  return getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck);
120405
120359
  }
120406
- return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedBindAndCheckDiagnosticsForFile, getBindAndCheckDiagnosticsForFileNoCache);
120360
+ let result = cachedBindAndCheckDiagnosticsForFile == null ? void 0 : cachedBindAndCheckDiagnosticsForFile.get(sourceFile.path);
120361
+ if (!result) {
120362
+ (cachedBindAndCheckDiagnosticsForFile ?? (cachedBindAndCheckDiagnosticsForFile = /* @__PURE__ */ new Map())).set(
120363
+ sourceFile.path,
120364
+ result = getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken)
120365
+ );
120366
+ }
120367
+ return result;
120407
120368
  }
120408
120369
  function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck) {
120409
120370
  return runWithCancellationToken(() => {
@@ -120691,7 +120652,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120691
120652
  });
120692
120653
  }
120693
120654
  function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) {
120694
- return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedDeclarationDiagnosticsForFile, getDeclarationDiagnosticsForFileNoCache);
120655
+ let result = cachedDeclarationDiagnosticsForFile == null ? void 0 : cachedDeclarationDiagnosticsForFile.get(sourceFile.path);
120656
+ if (!result) {
120657
+ (cachedDeclarationDiagnosticsForFile ?? (cachedDeclarationDiagnosticsForFile = /* @__PURE__ */ new Map())).set(
120658
+ sourceFile.path,
120659
+ result = getDeclarationDiagnosticsForFileNoCache(sourceFile, cancellationToken)
120660
+ );
120661
+ }
120662
+ return result;
120695
120663
  }
120696
120664
  function getDeclarationDiagnosticsForFileNoCache(sourceFile, cancellationToken) {
120697
120665
  return runWithCancellationToken(() => {
@@ -120699,22 +120667,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120699
120667
  return getDeclarationDiagnostics(getEmitHost(noop), resolver, sourceFile) || emptyArray;
120700
120668
  });
120701
120669
  }
120702
- function getAndCacheDiagnostics(sourceFile, cancellationToken, cache, getDiagnostics) {
120703
- var _a2;
120704
- const cachedResult = sourceFile ? (_a2 = cache.perFile) == null ? void 0 : _a2.get(sourceFile.path) : cache.allDiagnostics;
120705
- if (cachedResult) {
120706
- return cachedResult;
120707
- }
120708
- const result = getDiagnostics(sourceFile, cancellationToken);
120709
- if (sourceFile) {
120710
- (cache.perFile || (cache.perFile = /* @__PURE__ */ new Map())).set(sourceFile.path, result);
120711
- } else {
120712
- cache.allDiagnostics = result;
120713
- }
120714
- return result;
120715
- }
120716
120670
  function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) {
120717
- return sourceFile.isDeclarationFile ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);
120671
+ return sourceFile.isDeclarationFile ? emptyArray : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);
120718
120672
  }
120719
120673
  function getOptionsDiagnostics() {
120720
120674
  return sortAndDeduplicateDiagnostics(concatenate(
@@ -121662,7 +121616,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121662
121616
  if (options.outDir || // there is --outDir specified
121663
121617
  options.rootDir || // there is --rootDir specified
121664
121618
  options.sourceRoot || // there is --sourceRoot specified
121665
- options.mapRoot) {
121619
+ options.mapRoot || // there is --mapRoot specified
121620
+ getEmitDeclarations(options) && options.declarationDir) {
121666
121621
  const dir = getCommonSourceDirectory2();
121667
121622
  if (options.outDir && dir === "" && files.some((file) => getRootLength(file.fileName) > 1)) {
121668
121623
  createDiagnosticForOptionName(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir");
@@ -121675,14 +121630,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121675
121630
  if (!getEmitDeclarations(options)) {
121676
121631
  createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "emitDeclarationOnly", "declaration", "composite");
121677
121632
  }
121678
- if (options.noEmit) {
121679
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "emitDeclarationOnly", "noEmit");
121680
- }
121681
- }
121682
- if (options.noCheck) {
121683
- if (options.noEmit) {
121684
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noCheck", "noEmit");
121685
- }
121686
121633
  }
121687
121634
  if (options.emitDecoratorMetadata && !options.experimentalDecorators) {
121688
121635
  createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators");
@@ -122419,7 +122366,6 @@ var emitSkippedWithNoDiagnostics = { diagnostics: emptyArray, sourceMaps: void 0
122419
122366
  function handleNoEmitOptions(program, sourceFile, writeFile2, cancellationToken) {
122420
122367
  const options = program.getCompilerOptions();
122421
122368
  if (options.noEmit) {
122422
- program.getSemanticDiagnostics(sourceFile, cancellationToken);
122423
122369
  return sourceFile ? emitSkippedWithNoDiagnostics : program.emitBuildInfo(writeFile2, cancellationToken);
122424
122370
  }
122425
122371
  if (!options.noEmitOnError) return void 0;
@@ -122896,9 +122842,9 @@ function getBuilderFileEmit(options) {
122896
122842
  let result = 1 /* Js */;
122897
122843
  if (options.sourceMap) result = result | 2 /* JsMap */;
122898
122844
  if (options.inlineSourceMap) result = result | 4 /* JsInlineMap */;
122899
- if (getEmitDeclarations(options)) result = result | 8 /* Dts */;
122900
- if (options.declarationMap) result = result | 16 /* DtsMap */;
122901
- if (options.emitDeclarationOnly) result = result & 24 /* AllDts */;
122845
+ if (getEmitDeclarations(options)) result = result | 24 /* Dts */;
122846
+ if (options.declarationMap) result = result | 32 /* DtsMap */;
122847
+ if (options.emitDeclarationOnly) result = result & 56 /* AllDts */;
122902
122848
  return result;
122903
122849
  }
122904
122850
  function getPendingEmitKind(optionsOrEmitKind, oldOptionsOrEmitKind) {
@@ -122909,7 +122855,8 @@ function getPendingEmitKind(optionsOrEmitKind, oldOptionsOrEmitKind) {
122909
122855
  const diff = oldEmitKind ^ emitKind;
122910
122856
  let result = 0 /* None */;
122911
122857
  if (diff & 7 /* AllJs */) result = emitKind & 7 /* AllJs */;
122912
- if (diff & 24 /* AllDts */) result = result | emitKind & 24 /* AllDts */;
122858
+ if (diff & 8 /* DtsErrors */) result = result | emitKind & 8 /* DtsErrors */;
122859
+ if (diff & 48 /* AllDtsEmit */) result = result | emitKind & 48 /* AllDtsEmit */;
122913
122860
  return result;
122914
122861
  }
122915
122862
  function hasSameKeys(map1, map2) {
@@ -123163,25 +123110,34 @@ function getNextAffectedFile(state, cancellationToken, host) {
123163
123110
  if (!state.seenAffectedFiles) state.seenAffectedFiles = /* @__PURE__ */ new Set();
123164
123111
  }
123165
123112
  }
123166
- function clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles) {
123113
+ function clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles, isForDtsErrors) {
123167
123114
  var _a, _b;
123168
123115
  if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size) && !state.programEmitPending) return;
123169
- if (!emitOnlyDtsFiles) {
123116
+ if (!emitOnlyDtsFiles && !isForDtsErrors) {
123170
123117
  state.affectedFilesPendingEmit = void 0;
123171
123118
  state.programEmitPending = void 0;
123172
123119
  }
123173
123120
  (_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.forEach((emitKind, path) => {
123174
- const pending = emitKind & 7 /* AllJs */;
123121
+ const pending = !isForDtsErrors ? emitKind & 7 /* AllJs */ : emitKind & (7 /* AllJs */ | 48 /* AllDtsEmit */);
123175
123122
  if (!pending) state.affectedFilesPendingEmit.delete(path);
123176
123123
  else state.affectedFilesPendingEmit.set(path, pending);
123177
123124
  });
123178
123125
  if (state.programEmitPending) {
123179
- const pending = state.programEmitPending & 7 /* AllJs */;
123126
+ const pending = !isForDtsErrors ? state.programEmitPending & 7 /* AllJs */ : state.programEmitPending & (7 /* AllJs */ | 48 /* AllDtsEmit */);
123180
123127
  if (!pending) state.programEmitPending = void 0;
123181
123128
  else state.programEmitPending = pending;
123182
123129
  }
123183
123130
  }
123184
- function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) {
123131
+ function getPendingEmitKindWithSeen(optionsOrEmitKind, seenOldOptionsOrEmitKind, emitOnlyDtsFiles, isForDtsErrors) {
123132
+ let pendingKind = getPendingEmitKind(optionsOrEmitKind, seenOldOptionsOrEmitKind);
123133
+ if (emitOnlyDtsFiles) pendingKind = pendingKind & 56 /* AllDts */;
123134
+ if (isForDtsErrors) pendingKind = pendingKind & 8 /* DtsErrors */;
123135
+ return pendingKind;
123136
+ }
123137
+ function getBuilderFileEmitAllDts(isForDtsErrors) {
123138
+ return !isForDtsErrors ? 56 /* AllDts */ : 8 /* DtsErrors */;
123139
+ }
123140
+ function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles, isForDtsErrors) {
123185
123141
  var _a;
123186
123142
  if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size)) return void 0;
123187
123143
  return forEachEntry(state.affectedFilesPendingEmit, (emitKind, path) => {
@@ -123192,12 +123148,16 @@ function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) {
123192
123148
  return void 0;
123193
123149
  }
123194
123150
  const seenKind = (_a2 = state.seenEmittedFiles) == null ? void 0 : _a2.get(affectedFile.resolvedPath);
123195
- let pendingKind = getPendingEmitKind(emitKind, seenKind);
123196
- if (emitOnlyDtsFiles) pendingKind = pendingKind & 24 /* AllDts */;
123151
+ const pendingKind = getPendingEmitKindWithSeen(
123152
+ emitKind,
123153
+ seenKind,
123154
+ emitOnlyDtsFiles,
123155
+ isForDtsErrors
123156
+ );
123197
123157
  if (pendingKind) return { affectedFile, emitKind: pendingKind };
123198
123158
  });
123199
123159
  }
123200
- function getNextPendingEmitDiagnosticsFile(state) {
123160
+ function getNextPendingEmitDiagnosticsFile(state, isForDtsErrors) {
123201
123161
  var _a;
123202
123162
  if (!((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size)) return void 0;
123203
123163
  return forEachEntry(state.emitDiagnosticsPerFile, (diagnostics, path) => {
@@ -123208,7 +123168,7 @@ function getNextPendingEmitDiagnosticsFile(state) {
123208
123168
  return void 0;
123209
123169
  }
123210
123170
  const seenKind = ((_a2 = state.seenEmittedFiles) == null ? void 0 : _a2.get(affectedFile.resolvedPath)) || 0 /* None */;
123211
- if (!(seenKind & 24 /* AllDts */)) return { affectedFile, diagnostics, seenKind };
123171
+ if (!(seenKind & getBuilderFileEmitAllDts(isForDtsErrors))) return { affectedFile, diagnostics, seenKind };
123212
123172
  });
123213
123173
  }
123214
123174
  function removeDiagnosticsOfLibraryFiles(state) {
@@ -123263,7 +123223,7 @@ function handleDtsMayChangeOf(state, path, invalidateJsFiles, cancellationToken,
123263
123223
  addToAffectedFilesPendingEmit(
123264
123224
  state,
123265
123225
  path,
123266
- state.compilerOptions.declarationMap ? 24 /* AllDts */ : 8 /* Dts */
123226
+ state.compilerOptions.declarationMap ? 56 /* AllDts */ : 24 /* Dts */
123267
123227
  );
123268
123228
  }
123269
123229
  }
@@ -123463,8 +123423,9 @@ function getBuildInfo2(state) {
123463
123423
  root,
123464
123424
  resolvedRoot: toResolvedRoot(),
123465
123425
  options: toIncrementalBuildInfoCompilerOptions(state.compilerOptions),
123466
- semanticDiagnosticsPerFile: toIncrementalBuildInfoDiagnostics(),
123426
+ semanticDiagnosticsPerFile: !state.changedFilesSet.size ? toIncrementalBuildInfoDiagnostics() : void 0,
123467
123427
  emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
123428
+ changeFileSet: toChangeFileSet(),
123468
123429
  outSignature: state.outSignature,
123469
123430
  latestChangedDtsFile,
123470
123431
  pendingEmit: !state.programEmitPending ? void 0 : (
@@ -123548,7 +123509,7 @@ function getBuildInfo2(state) {
123548
123509
  affectedFilesPendingEmit,
123549
123510
  pendingEmit === fullEmitForOptions ? fileId : (
123550
123511
  // Pending full emit per options
123551
- pendingEmit === 8 /* Dts */ ? [fileId] : (
123512
+ pendingEmit === 24 /* Dts */ ? [fileId] : (
123552
123513
  // Pending on Dts only
123553
123514
  [fileId, pendingEmit]
123554
123515
  )
@@ -123568,6 +123529,7 @@ function getBuildInfo2(state) {
123568
123529
  referencedMap,
123569
123530
  semanticDiagnosticsPerFile,
123570
123531
  emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
123532
+ changeFileSet: toChangeFileSet(),
123571
123533
  affectedFilesPendingEmit,
123572
123534
  emitSignatures,
123573
123535
  latestChangedDtsFile,
@@ -123656,7 +123618,7 @@ function getBuildInfo2(state) {
123656
123618
  state.fileInfos.forEach((_value, key) => {
123657
123619
  const value = state.semanticDiagnosticsPerFile.get(key);
123658
123620
  if (!value) {
123659
- result = append(result, toFileId(key));
123621
+ if (!state.changedFilesSet.has(key)) result = append(result, toFileId(key));
123660
123622
  } else if (value.length) {
123661
123623
  result = append(result, [
123662
123624
  toFileId(key),
@@ -123723,6 +123685,15 @@ function getBuildInfo2(state) {
123723
123685
  return result;
123724
123686
  }) || array;
123725
123687
  }
123688
+ function toChangeFileSet() {
123689
+ let changeFileSet;
123690
+ if (state.changedFilesSet.size) {
123691
+ for (const path of arrayFrom(state.changedFilesSet.keys()).sort(compareStringsCaseSensitive)) {
123692
+ changeFileSet = append(changeFileSet, toFileId(path));
123693
+ }
123694
+ }
123695
+ return changeFileSet;
123696
+ }
123726
123697
  }
123727
123698
  function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
123728
123699
  let host;
@@ -123801,6 +123772,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123801
123772
  sourceFile
123802
123773
  );
123803
123774
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
123775
+ builderProgram.getDeclarationDiagnostics = getDeclarationDiagnostics2;
123804
123776
  builderProgram.emit = emit;
123805
123777
  builderProgram.releaseProgram = () => releaseCache(state);
123806
123778
  if (kind === 0 /* SemanticDiagnosticsBuilderProgram */) {
@@ -123825,21 +123797,31 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123825
123797
  }
123826
123798
  return emitSkippedWithNoDiagnostics;
123827
123799
  }
123828
- function emitNextAffectedFile(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
123800
+ function emitNextAffectedFileOrDtsErrors(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers, isForDtsErrors) {
123829
123801
  var _a, _b, _c, _d;
123830
123802
  Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
123831
123803
  let affected = getNextAffectedFile(state, cancellationToken, host);
123832
123804
  const programEmitKind = getBuilderFileEmit(state.compilerOptions);
123833
- let emitKind = emitOnlyDtsFiles ? programEmitKind & 24 /* AllDts */ : programEmitKind;
123805
+ let emitKind = !isForDtsErrors ? emitOnlyDtsFiles ? programEmitKind & 56 /* AllDts */ : programEmitKind : 8 /* DtsErrors */;
123834
123806
  if (!affected) {
123835
123807
  if (!state.compilerOptions.outFile) {
123836
- const pendingAffectedFile = getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles);
123808
+ const pendingAffectedFile = getNextAffectedFilePendingEmit(
123809
+ state,
123810
+ emitOnlyDtsFiles,
123811
+ isForDtsErrors
123812
+ );
123837
123813
  if (pendingAffectedFile) {
123838
123814
  ({ affectedFile: affected, emitKind } = pendingAffectedFile);
123839
123815
  } else {
123840
- const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(state);
123816
+ const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(
123817
+ state,
123818
+ isForDtsErrors
123819
+ );
123841
123820
  if (pendingForDiagnostics) {
123842
- (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(pendingForDiagnostics.affectedFile.resolvedPath, pendingForDiagnostics.seenKind | 24 /* AllDts */);
123821
+ (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(
123822
+ pendingForDiagnostics.affectedFile.resolvedPath,
123823
+ pendingForDiagnostics.seenKind | getBuilderFileEmitAllDts(isForDtsErrors)
123824
+ );
123843
123825
  return {
123844
123826
  result: { emitSkipped: true, diagnostics: pendingForDiagnostics.diagnostics },
123845
123827
  affected: pendingForDiagnostics.affectedFile
@@ -123848,14 +123830,18 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123848
123830
  }
123849
123831
  } else {
123850
123832
  if (state.programEmitPending) {
123851
- emitKind = state.programEmitPending;
123852
- if (emitOnlyDtsFiles) emitKind = emitKind & 24 /* AllDts */;
123833
+ emitKind = getPendingEmitKindWithSeen(
123834
+ state.programEmitPending,
123835
+ state.seenProgramEmit,
123836
+ emitOnlyDtsFiles,
123837
+ isForDtsErrors
123838
+ );
123853
123839
  if (emitKind) affected = state.program;
123854
123840
  }
123855
123841
  if (!affected && ((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size)) {
123856
123842
  const seenKind = state.seenProgramEmit || 0 /* None */;
123857
- if (!(seenKind & 24 /* AllDts */)) {
123858
- state.seenProgramEmit = 24 /* AllDts */ | seenKind;
123843
+ if (!(seenKind & getBuilderFileEmitAllDts(isForDtsErrors))) {
123844
+ state.seenProgramEmit = getBuilderFileEmitAllDts(isForDtsErrors) | seenKind;
123859
123845
  const diagnostics = [];
123860
123846
  state.emitDiagnosticsPerFile.forEach((d) => addRange(diagnostics, d));
123861
123847
  return {
@@ -123866,7 +123852,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123866
123852
  }
123867
123853
  }
123868
123854
  if (!affected) {
123869
- if (!getBuildInfoEmitPending(state)) return void 0;
123855
+ if (isForDtsErrors || !getBuildInfoEmitPending(state)) return void 0;
123870
123856
  const affected2 = state.program;
123871
123857
  const result2 = affected2.emitBuildInfo(
123872
123858
  writeFile2 || maybeBind(host, host.writeFile),
@@ -123878,8 +123864,8 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123878
123864
  }
123879
123865
  let emitOnly;
123880
123866
  if (emitKind & 7 /* AllJs */) emitOnly = 0 /* Js */;
123881
- if (emitKind & 24 /* AllDts */) emitOnly = emitOnly === void 0 ? 1 /* Dts */ : void 0;
123882
- const result = state.program.emit(
123867
+ if (emitKind & 56 /* AllDts */) emitOnly = emitOnly === void 0 ? 1 /* Dts */ : void 0;
123868
+ const result = !isForDtsErrors ? state.program.emit(
123883
123869
  affected === state.program ? void 0 : affected,
123884
123870
  getWriteFileCallback(writeFile2, customTransformers),
123885
123871
  cancellationToken,
@@ -123889,7 +123875,13 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123889
123875
  void 0,
123890
123876
  /*skipBuildInfo*/
123891
123877
  true
123892
- );
123878
+ ) : {
123879
+ emitSkipped: true,
123880
+ diagnostics: state.program.getDeclarationDiagnostics(
123881
+ affected === state.program ? void 0 : affected,
123882
+ cancellationToken
123883
+ )
123884
+ };
123893
123885
  if (affected !== state.program) {
123894
123886
  const affectedSourceFile = affected;
123895
123887
  state.seenAffectedFiles.add(affectedSourceFile.resolvedPath);
@@ -123906,18 +123898,31 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123906
123898
  state.changedFilesSet.clear();
123907
123899
  state.programEmitPending = state.changedFilesSet.size ? getPendingEmitKind(programEmitKind, emitKind) : state.programEmitPending ? getPendingEmitKind(state.programEmitPending, emitKind) : void 0;
123908
123900
  state.seenProgramEmit = emitKind | (state.seenProgramEmit || 0 /* None */);
123909
- let emitDiagnosticsPerFile;
123910
- result.diagnostics.forEach((d) => {
123911
- if (!d.file) return;
123912
- let diagnostics = emitDiagnosticsPerFile == null ? void 0 : emitDiagnosticsPerFile.get(d.file.resolvedPath);
123913
- if (!diagnostics) (emitDiagnosticsPerFile ?? (emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(d.file.resolvedPath, diagnostics = []);
123914
- diagnostics.push(d);
123915
- });
123916
- if (emitDiagnosticsPerFile) state.emitDiagnosticsPerFile = emitDiagnosticsPerFile;
123901
+ setEmitDiagnosticsPerFile(result.diagnostics);
123917
123902
  state.buildInfoEmitPending = true;
123918
123903
  }
123919
123904
  return { result, affected };
123920
123905
  }
123906
+ function setEmitDiagnosticsPerFile(diagnostics) {
123907
+ let emitDiagnosticsPerFile;
123908
+ diagnostics.forEach((d) => {
123909
+ if (!d.file) return;
123910
+ let diagnostics2 = emitDiagnosticsPerFile == null ? void 0 : emitDiagnosticsPerFile.get(d.file.resolvedPath);
123911
+ if (!diagnostics2) (emitDiagnosticsPerFile ?? (emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(d.file.resolvedPath, diagnostics2 = []);
123912
+ diagnostics2.push(d);
123913
+ });
123914
+ if (emitDiagnosticsPerFile) state.emitDiagnosticsPerFile = emitDiagnosticsPerFile;
123915
+ }
123916
+ function emitNextAffectedFile(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
123917
+ return emitNextAffectedFileOrDtsErrors(
123918
+ writeFile2,
123919
+ cancellationToken,
123920
+ emitOnlyDtsFiles,
123921
+ customTransformers,
123922
+ /*isForDtsErrors*/
123923
+ false
123924
+ );
123925
+ }
123921
123926
  function getWriteFileCallback(writeFile2, customTransformers) {
123922
123927
  Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
123923
123928
  if (!getEmitDeclarations(state.compilerOptions)) return writeFile2 || maybeBind(host, host.writeFile);
@@ -124017,16 +124022,69 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
124017
124022
  sourceMaps
124018
124023
  };
124019
124024
  } else {
124020
- clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles);
124025
+ clearAffectedFilesPendingEmit(
124026
+ state,
124027
+ emitOnlyDtsFiles,
124028
+ /*isForDtsErrors*/
124029
+ false
124030
+ );
124021
124031
  }
124022
124032
  }
124023
- return state.program.emit(
124033
+ const emitResult = state.program.emit(
124024
124034
  targetSourceFile,
124025
124035
  getWriteFileCallback(writeFile2, customTransformers),
124026
124036
  cancellationToken,
124027
124037
  emitOnlyDtsFiles,
124028
124038
  customTransformers
124029
124039
  );
124040
+ handleNonEmitBuilderWithEmitOrDtsErrors(
124041
+ targetSourceFile,
124042
+ emitOnlyDtsFiles,
124043
+ /*isForDtsErrors*/
124044
+ false,
124045
+ emitResult.diagnostics
124046
+ );
124047
+ return emitResult;
124048
+ }
124049
+ function handleNonEmitBuilderWithEmitOrDtsErrors(targetSourceFile, emitOnlyDtsFiles, isForDtsErrors, diagnostics) {
124050
+ if (!targetSourceFile && kind !== 1 /* EmitAndSemanticDiagnosticsBuilderProgram */) {
124051
+ clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles, isForDtsErrors);
124052
+ setEmitDiagnosticsPerFile(diagnostics);
124053
+ }
124054
+ }
124055
+ function getDeclarationDiagnostics2(sourceFile, cancellationToken) {
124056
+ var _a;
124057
+ Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
124058
+ if (kind === 1 /* EmitAndSemanticDiagnosticsBuilderProgram */) {
124059
+ assertSourceFileOkWithoutNextAffectedCall(state, sourceFile);
124060
+ let affectedEmitResult;
124061
+ let diagnostics;
124062
+ while (affectedEmitResult = emitNextAffectedFileOrDtsErrors(
124063
+ /*writeFile*/
124064
+ void 0,
124065
+ cancellationToken,
124066
+ /*emitOnlyDtsFiles*/
124067
+ void 0,
124068
+ /*customTransformers*/
124069
+ void 0,
124070
+ /*isForDtsErrors*/
124071
+ true
124072
+ )) {
124073
+ if (!sourceFile) diagnostics = addRange(diagnostics, affectedEmitResult.result.diagnostics);
124074
+ }
124075
+ return (!sourceFile ? diagnostics : (_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.get(sourceFile.resolvedPath)) || emptyArray;
124076
+ } else {
124077
+ const result = state.program.getDeclarationDiagnostics(sourceFile, cancellationToken);
124078
+ handleNonEmitBuilderWithEmitOrDtsErrors(
124079
+ sourceFile,
124080
+ /*emitOnlyDtsFiles*/
124081
+ void 0,
124082
+ /*isForDtsErrors*/
124083
+ true,
124084
+ result
124085
+ );
124086
+ return result;
124087
+ }
124030
124088
  }
124031
124089
  function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
124032
124090
  Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
@@ -124104,7 +124162,7 @@ function toBuilderStateFileInfoForMultiEmit(fileInfo) {
124104
124162
  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 };
124105
124163
  }
124106
124164
  function toBuilderFileEmit(value, fullEmitForOptions) {
124107
- return isNumber(value) ? fullEmitForOptions : value[1] || 8 /* Dts */;
124165
+ return isNumber(value) ? fullEmitForOptions : value[1] || 24 /* Dts */;
124108
124166
  }
124109
124167
  function toProgramEmitPending(value, options) {
124110
124168
  return !value ? getBuilderFileEmit(options || {}) : value;
@@ -124118,6 +124176,7 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
124118
124176
  let filePathsSetList;
124119
124177
  const latestChangedDtsFile = buildInfo.latestChangedDtsFile ? toAbsolutePath(buildInfo.latestChangedDtsFile) : void 0;
124120
124178
  const fileInfos = /* @__PURE__ */ new Map();
124179
+ const changedFilesSet = new Set(map(buildInfo.changeFileSet, toFilePath));
124121
124180
  if (isIncrementalBundleEmitBuildInfo(buildInfo)) {
124122
124181
  buildInfo.fileInfos.forEach((fileInfo, index) => {
124123
124182
  const path = toFilePath(index + 1);
@@ -124129,6 +124188,7 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
124129
124188
  semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(buildInfo.semanticDiagnosticsPerFile),
124130
124189
  emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
124131
124190
  hasReusableDiagnostic: true,
124191
+ changedFilesSet,
124132
124192
  latestChangedDtsFile,
124133
124193
  outSignature: buildInfo.outSignature,
124134
124194
  programEmitPending: buildInfo.pendingEmit === void 0 ? void 0 : toProgramEmitPending(buildInfo.pendingEmit, buildInfo.options),
@@ -124165,6 +124225,7 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
124165
124225
  semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(buildInfo.semanticDiagnosticsPerFile),
124166
124226
  emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
124167
124227
  hasReusableDiagnostic: true,
124228
+ changedFilesSet,
124168
124229
  affectedFilesPendingEmit: buildInfo.affectedFilesPendingEmit && arrayToMap(buildInfo.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
124169
124230
  latestChangedDtsFile,
124170
124231
  emitSignatures: (emitSignatures == null ? void 0 : emitSignatures.size) ? emitSignatures : void 0,
@@ -124217,7 +124278,7 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
124217
124278
  const semanticDiagnostics = new Map(
124218
124279
  mapDefinedIterator(
124219
124280
  fileInfos.keys(),
124220
- (key) => [key, emptyArray]
124281
+ (key) => !changedFilesSet.has(key) ? [key, emptyArray] : void 0
124221
124282
  )
124222
124283
  );
124223
124284
  diagnostics == null ? void 0 : diagnostics.forEach((value) => {
@@ -125786,7 +125847,7 @@ function toFileName(file, fileNameConvertor) {
125786
125847
  return fileNameConvertor ? fileNameConvertor(fileName) : fileName;
125787
125848
  }
125788
125849
  function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummary, writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
125789
- const isListFilesOnly = !!program.getCompilerOptions().listFilesOnly;
125850
+ const options = program.getCompilerOptions();
125790
125851
  const allDiagnostics = program.getConfigFileParsingDiagnostics().slice();
125791
125852
  const configFileParsingDiagnosticsLength = allDiagnostics.length;
125792
125853
  addRange(allDiagnostics, program.getSyntacticDiagnostics(
@@ -125796,7 +125857,7 @@ function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummar
125796
125857
  ));
125797
125858
  if (allDiagnostics.length === configFileParsingDiagnosticsLength) {
125798
125859
  addRange(allDiagnostics, program.getOptionsDiagnostics(cancellationToken));
125799
- if (!isListFilesOnly) {
125860
+ if (!options.listFilesOnly) {
125800
125861
  addRange(allDiagnostics, program.getGlobalDiagnostics(cancellationToken));
125801
125862
  if (allDiagnostics.length === configFileParsingDiagnosticsLength) {
125802
125863
  addRange(allDiagnostics, program.getSemanticDiagnostics(
@@ -125805,9 +125866,16 @@ function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummar
125805
125866
  cancellationToken
125806
125867
  ));
125807
125868
  }
125869
+ if (options.noEmit && getEmitDeclarations(options) && allDiagnostics.length === configFileParsingDiagnosticsLength) {
125870
+ addRange(allDiagnostics, program.getDeclarationDiagnostics(
125871
+ /*sourceFile*/
125872
+ void 0,
125873
+ cancellationToken
125874
+ ));
125875
+ }
125808
125876
  }
125809
125877
  }
125810
- const emitResult = isListFilesOnly ? { emitSkipped: true, diagnostics: emptyArray } : program.emit(
125878
+ const emitResult = options.listFilesOnly ? { emitSkipped: true, diagnostics: emptyArray } : program.emit(
125811
125879
  /*targetSourceFile*/
125812
125880
  void 0,
125813
125881
  writeFile2,
@@ -127626,7 +127694,7 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
127626
127694
  }
127627
127695
  }
127628
127696
  function getUpToDateStatusWorker(state, project, resolvedPath) {
127629
- var _a, _b, _c;
127697
+ var _a, _b, _c, _d, _e;
127630
127698
  if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
127631
127699
  return {
127632
127700
  type: 15 /* ContainerOnly */
@@ -127688,19 +127756,25 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
127688
127756
  };
127689
127757
  }
127690
127758
  if (incrementalBuildInfo) {
127691
- 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))) {
127759
+ 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))) {
127692
127760
  return {
127693
127761
  type: 8 /* OutOfDateBuildInfoWithErrors */,
127694
127762
  buildInfoFile: buildInfoPath
127695
127763
  };
127696
127764
  }
127697
- if (!project.options.noEmit && (((_c = incrementalBuildInfo.affectedFilesPendingEmit) == null ? void 0 : _c.length) || incrementalBuildInfo.pendingEmit !== void 0)) {
127765
+ if (!project.options.noEmit && (((_d = incrementalBuildInfo.changeFileSet) == null ? void 0 : _d.length) || ((_e = incrementalBuildInfo.affectedFilesPendingEmit) == null ? void 0 : _e.length) || incrementalBuildInfo.pendingEmit !== void 0)) {
127698
127766
  return {
127699
127767
  type: 7 /* OutOfDateBuildInfoWithPendingEmit */,
127700
127768
  buildInfoFile: buildInfoPath
127701
127769
  };
127702
127770
  }
127703
- if (!project.options.noEmit && getPendingEmitKind(project.options, incrementalBuildInfo.options || {})) {
127771
+ if ((!project.options.noEmit || project.options.noEmit && getEmitDeclarations(project.options)) && getPendingEmitKindWithSeen(
127772
+ project.options,
127773
+ incrementalBuildInfo.options || {},
127774
+ /*emitOnlyDtsFiles*/
127775
+ void 0,
127776
+ !!project.options.noEmit
127777
+ )) {
127704
127778
  return {
127705
127779
  type: 9 /* OutOfDateOptions */,
127706
127780
  buildInfoFile: buildInfoPath