@typescript-deploys/pr-build 5.6.0-pr-59048-32 → 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 +260 -142
  2. package/lib/typescript.js +272 -151
  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 = [];
@@ -1084,7 +1084,7 @@ function findBestPatternMatch(values, getPattern, candidate) {
1084
1084
  for (let i = 0; i < values.length; i++) {
1085
1085
  const v = values[i];
1086
1086
  const pattern = getPattern(v);
1087
- if (pattern.prefix.length > longestMatchPrefixLength && isPatternMatch(pattern, candidate)) {
1087
+ if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) {
1088
1088
  longestMatchPrefixLength = pattern.prefix.length;
1089
1089
  matchedValue = v;
1090
1090
  }
@@ -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,40 +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, sortByAggregateLength = false) {
18284
- let result = parsedPatternsCache.get(paths);
18285
- if (result !== void 0) {
18286
- return result;
18287
- }
18288
- let matchableStringSet;
18289
- let sortedPatterns;
18290
- const pathList = getOwnKeys(paths);
18291
- for (const path of pathList) {
18292
- const patternOrStr = tryParsePattern(path);
18293
- if (patternOrStr === void 0) {
18294
- continue;
18295
- } else if (typeof patternOrStr === "string") {
18296
- (matchableStringSet ?? (matchableStringSet = /* @__PURE__ */ new Set())).add(patternOrStr);
18297
- } else {
18298
- (sortedPatterns ?? (sortedPatterns = [])).push(patternOrStr);
18299
- }
18300
- }
18301
- sortedPatterns == null ? void 0 : sortedPatterns.sort((a, b) => {
18302
- const prefixComparison = compareStringsCaseSensitive(a.prefix, b.prefix);
18303
- if (prefixComparison === 0 && sortByAggregateLength) {
18304
- return a.suffix.length - b.suffix.length;
18305
- }
18306
- return prefixComparison;
18307
- });
18308
- parsedPatternsCache.set(
18309
- paths,
18310
- result = {
18311
- matchableStringSet,
18312
- sortedPatterns
18313
- }
18314
- );
18315
- return result;
18282
+ function tryParsePatterns(paths) {
18283
+ return mapDefined(getOwnKeys(paths), (path) => tryParsePattern(path));
18316
18284
  }
18317
18285
  function positionIsSynthesized(pos) {
18318
18286
  return !(pos >= 0);
@@ -18338,14 +18306,16 @@ var emptyFileSystemEntries = {
18338
18306
  directories: emptyArray
18339
18307
  };
18340
18308
  function matchPatternOrExact(patternOrStrings, candidate) {
18341
- const { matchableStringSet, sortedPatterns } = patternOrStrings;
18342
- if (matchableStringSet == null ? void 0 : matchableStringSet.has(candidate)) {
18343
- return candidate;
18344
- }
18345
- if (sortedPatterns === void 0 || sortedPatterns.length === 0) {
18346
- return void 0;
18309
+ const patterns = [];
18310
+ for (const patternOrString of patternOrStrings) {
18311
+ if (patternOrString === candidate) {
18312
+ return candidate;
18313
+ }
18314
+ if (!isString(patternOrString)) {
18315
+ patterns.push(patternOrString);
18316
+ }
18347
18317
  }
18348
- return findBestPatternMatch(sortedPatterns, (_) => _, candidate);
18318
+ return findBestPatternMatch(patterns, (_) => _, candidate);
18349
18319
  }
18350
18320
  function sliceAfter(arr, value) {
18351
18321
  const index = arr.indexOf(value);
@@ -37968,6 +37938,8 @@ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, exis
37968
37938
  validatedFilesSpecBeforeSubstitution,
37969
37939
  validatedIncludeSpecsBeforeSubstitution,
37970
37940
  validatedExcludeSpecsBeforeSubstitution,
37941
+ pathPatterns: void 0,
37942
+ // Initialized on first use
37971
37943
  isDefaultIncludeSpec
37972
37944
  };
37973
37945
  }
@@ -39592,7 +39564,8 @@ function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, co
39592
39564
  }
39593
39565
  }
39594
39566
  function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state) {
39595
- const { baseUrl, paths } = state.compilerOptions;
39567
+ var _a;
39568
+ const { baseUrl, paths, configFile } = state.compilerOptions;
39596
39569
  if (paths && !pathIsRelative(moduleName)) {
39597
39570
  if (state.traceEnabled) {
39598
39571
  if (baseUrl) {
@@ -39601,7 +39574,7 @@ function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state
39601
39574
  trace(state.host, Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName);
39602
39575
  }
39603
39576
  const baseDirectory = getPathsBasePath(state.compilerOptions, state.host);
39604
- const pathPatterns = tryParsePatterns(paths);
39577
+ const pathPatterns = (configFile == null ? void 0 : configFile.configFileSpecs) ? (_a = configFile.configFileSpecs).pathPatterns || (_a.pathPatterns = tryParsePatterns(paths)) : void 0;
39605
39578
  return tryLoadModuleUsingPaths(
39606
39579
  extensions,
39607
39580
  moduleName,
@@ -40279,8 +40252,17 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
40279
40252
  if (state.traceEnabled) {
40280
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);
40281
40254
  }
40282
- const pathPatterns = tryParsePatterns(versionPaths.paths);
40283
- 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
+ );
40284
40266
  if (result) {
40285
40267
  return removeIgnoredPackageId(result.value);
40286
40268
  }
@@ -40872,8 +40854,17 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
40872
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);
40873
40855
  }
40874
40856
  const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
40875
- const pathPatterns = tryParsePatterns(versionPaths.paths);
40876
- 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
+ );
40877
40868
  if (fromPaths) {
40878
40869
  return fromPaths.value;
40879
40870
  }
@@ -40881,6 +40872,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
40881
40872
  return loader(extensions, candidate, !nodeModulesDirectoryExists, state);
40882
40873
  }
40883
40874
  function tryLoadModuleUsingPaths(extensions, moduleName, baseDirectory, paths, pathPatterns, loader, onlyRecordFailures, state) {
40875
+ pathPatterns || (pathPatterns = tryParsePatterns(paths));
40884
40876
  const matchedPattern = matchPatternOrExact(pathPatterns, moduleName);
40885
40877
  if (matchedPattern) {
40886
40878
  const matchedStar = isString(matchedPattern) ? void 0 : matchedText(matchedPattern, moduleName);
@@ -59732,6 +59724,12 @@ function createTypeChecker(host) {
59732
59724
  function eachUnionContains(unionTypes2, type) {
59733
59725
  for (const u of unionTypes2) {
59734
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
+ }
59735
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;
59736
59734
  if (!primitive || !containsType(u.types, primitive)) {
59737
59735
  return false;
@@ -59788,6 +59786,13 @@ function createTypeChecker(host) {
59788
59786
  for (const t of u.types) {
59789
59787
  if (insertType(checked, t)) {
59790
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
+ }
59791
59796
  insertType(result, t);
59792
59797
  }
59793
59798
  }
@@ -110906,17 +110911,16 @@ function createGetIsolatedDeclarationErrors(resolver) {
110906
110911
  function getDeclarationDiagnostics(host, resolver, file) {
110907
110912
  const compilerOptions = host.getCompilerOptions();
110908
110913
  const files = filter(getSourceFilesToEmit(host, file), isSourceFileNotJson);
110909
- const result = transformNodes(
110914
+ return contains(files, file) ? transformNodes(
110910
110915
  resolver,
110911
110916
  host,
110912
110917
  factory,
110913
110918
  compilerOptions,
110914
- file ? contains(files, file) ? [file] : emptyArray : files,
110919
+ [file],
110915
110920
  [transformDeclarations],
110916
110921
  /*allowDtsFiles*/
110917
110922
  false
110918
- );
110919
- return result.diagnostics;
110923
+ ).diagnostics : void 0;
110920
110924
  }
110921
110925
  var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 1 /* AllowUnresolvedNames */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
110922
110926
  function transformDeclarations(context) {
@@ -119219,8 +119223,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119219
119223
  let filesWithReferencesProcessed;
119220
119224
  let fileReasonsToChain;
119221
119225
  let reasonToRelatedInfo;
119222
- const cachedBindAndCheckDiagnosticsForFile = {};
119223
- const cachedDeclarationDiagnosticsForFile = {};
119226
+ let cachedBindAndCheckDiagnosticsForFile;
119227
+ let cachedDeclarationDiagnosticsForFile;
119224
119228
  let fileProcessingDiagnostics;
119225
119229
  let automaticTypeDirectiveNames;
119226
119230
  let automaticTypeDirectiveResolutions;
@@ -120300,8 +120304,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120300
120304
  );
120301
120305
  }
120302
120306
  function getCachedSemanticDiagnostics(sourceFile) {
120303
- var _a2;
120304
- return sourceFile ? (_a2 = cachedBindAndCheckDiagnosticsForFile.perFile) == null ? void 0 : _a2.get(sourceFile.path) : cachedBindAndCheckDiagnosticsForFile.allDiagnostics;
120307
+ return cachedBindAndCheckDiagnosticsForFile == null ? void 0 : cachedBindAndCheckDiagnosticsForFile.get(sourceFile.path);
120305
120308
  }
120306
120309
  function getBindAndCheckDiagnostics(sourceFile, cancellationToken) {
120307
120310
  return getBindAndCheckDiagnosticsForFile(
@@ -120323,12 +120326,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120323
120326
  return getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, programDiagnosticsInFile).diagnostics;
120324
120327
  }
120325
120328
  function getDeclarationDiagnostics2(sourceFile, cancellationToken) {
120326
- const options2 = program.getCompilerOptions();
120327
- if (!sourceFile || options2.outFile) {
120328
- return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);
120329
- } else {
120330
- return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken);
120331
- }
120329
+ return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken);
120332
120330
  }
120333
120331
  function getSyntacticDiagnosticsForFile(sourceFile) {
120334
120332
  if (isSourceFileJS(sourceFile)) {
@@ -120359,7 +120357,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120359
120357
  if (nodesToCheck) {
120360
120358
  return getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck);
120361
120359
  }
120362
- 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;
120363
120368
  }
120364
120369
  function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck) {
120365
120370
  return runWithCancellationToken(() => {
@@ -120647,7 +120652,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120647
120652
  });
120648
120653
  }
120649
120654
  function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) {
120650
- 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;
120651
120663
  }
120652
120664
  function getDeclarationDiagnosticsForFileNoCache(sourceFile, cancellationToken) {
120653
120665
  return runWithCancellationToken(() => {
@@ -120655,22 +120667,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120655
120667
  return getDeclarationDiagnostics(getEmitHost(noop), resolver, sourceFile) || emptyArray;
120656
120668
  });
120657
120669
  }
120658
- function getAndCacheDiagnostics(sourceFile, cancellationToken, cache, getDiagnostics) {
120659
- var _a2;
120660
- const cachedResult = sourceFile ? (_a2 = cache.perFile) == null ? void 0 : _a2.get(sourceFile.path) : cache.allDiagnostics;
120661
- if (cachedResult) {
120662
- return cachedResult;
120663
- }
120664
- const result = getDiagnostics(sourceFile, cancellationToken);
120665
- if (sourceFile) {
120666
- (cache.perFile || (cache.perFile = /* @__PURE__ */ new Map())).set(sourceFile.path, result);
120667
- } else {
120668
- cache.allDiagnostics = result;
120669
- }
120670
- return result;
120671
- }
120672
120670
  function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) {
120673
- return sourceFile.isDeclarationFile ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);
120671
+ return sourceFile.isDeclarationFile ? emptyArray : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);
120674
120672
  }
120675
120673
  function getOptionsDiagnostics() {
120676
120674
  return sortAndDeduplicateDiagnostics(concatenate(
@@ -121618,7 +121616,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121618
121616
  if (options.outDir || // there is --outDir specified
121619
121617
  options.rootDir || // there is --rootDir specified
121620
121618
  options.sourceRoot || // there is --sourceRoot specified
121621
- options.mapRoot) {
121619
+ options.mapRoot || // there is --mapRoot specified
121620
+ getEmitDeclarations(options) && options.declarationDir) {
121622
121621
  const dir = getCommonSourceDirectory2();
121623
121622
  if (options.outDir && dir === "" && files.some((file) => getRootLength(file.fileName) > 1)) {
121624
121623
  createDiagnosticForOptionName(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir");
@@ -121631,14 +121630,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121631
121630
  if (!getEmitDeclarations(options)) {
121632
121631
  createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "emitDeclarationOnly", "declaration", "composite");
121633
121632
  }
121634
- if (options.noEmit) {
121635
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "emitDeclarationOnly", "noEmit");
121636
- }
121637
- }
121638
- if (options.noCheck) {
121639
- if (options.noEmit) {
121640
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noCheck", "noEmit");
121641
- }
121642
121633
  }
121643
121634
  if (options.emitDecoratorMetadata && !options.experimentalDecorators) {
121644
121635
  createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators");
@@ -122375,7 +122366,6 @@ var emitSkippedWithNoDiagnostics = { diagnostics: emptyArray, sourceMaps: void 0
122375
122366
  function handleNoEmitOptions(program, sourceFile, writeFile2, cancellationToken) {
122376
122367
  const options = program.getCompilerOptions();
122377
122368
  if (options.noEmit) {
122378
- program.getSemanticDiagnostics(sourceFile, cancellationToken);
122379
122369
  return sourceFile ? emitSkippedWithNoDiagnostics : program.emitBuildInfo(writeFile2, cancellationToken);
122380
122370
  }
122381
122371
  if (!options.noEmitOnError) return void 0;
@@ -122852,9 +122842,9 @@ function getBuilderFileEmit(options) {
122852
122842
  let result = 1 /* Js */;
122853
122843
  if (options.sourceMap) result = result | 2 /* JsMap */;
122854
122844
  if (options.inlineSourceMap) result = result | 4 /* JsInlineMap */;
122855
- if (getEmitDeclarations(options)) result = result | 8 /* Dts */;
122856
- if (options.declarationMap) result = result | 16 /* DtsMap */;
122857
- 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 */;
122858
122848
  return result;
122859
122849
  }
122860
122850
  function getPendingEmitKind(optionsOrEmitKind, oldOptionsOrEmitKind) {
@@ -122865,7 +122855,8 @@ function getPendingEmitKind(optionsOrEmitKind, oldOptionsOrEmitKind) {
122865
122855
  const diff = oldEmitKind ^ emitKind;
122866
122856
  let result = 0 /* None */;
122867
122857
  if (diff & 7 /* AllJs */) result = emitKind & 7 /* AllJs */;
122868
- 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 */;
122869
122860
  return result;
122870
122861
  }
122871
122862
  function hasSameKeys(map1, map2) {
@@ -123119,25 +123110,34 @@ function getNextAffectedFile(state, cancellationToken, host) {
123119
123110
  if (!state.seenAffectedFiles) state.seenAffectedFiles = /* @__PURE__ */ new Set();
123120
123111
  }
123121
123112
  }
123122
- function clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles) {
123113
+ function clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles, isForDtsErrors) {
123123
123114
  var _a, _b;
123124
123115
  if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size) && !state.programEmitPending) return;
123125
- if (!emitOnlyDtsFiles) {
123116
+ if (!emitOnlyDtsFiles && !isForDtsErrors) {
123126
123117
  state.affectedFilesPendingEmit = void 0;
123127
123118
  state.programEmitPending = void 0;
123128
123119
  }
123129
123120
  (_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.forEach((emitKind, path) => {
123130
- const pending = emitKind & 7 /* AllJs */;
123121
+ const pending = !isForDtsErrors ? emitKind & 7 /* AllJs */ : emitKind & (7 /* AllJs */ | 48 /* AllDtsEmit */);
123131
123122
  if (!pending) state.affectedFilesPendingEmit.delete(path);
123132
123123
  else state.affectedFilesPendingEmit.set(path, pending);
123133
123124
  });
123134
123125
  if (state.programEmitPending) {
123135
- const pending = state.programEmitPending & 7 /* AllJs */;
123126
+ const pending = !isForDtsErrors ? state.programEmitPending & 7 /* AllJs */ : state.programEmitPending & (7 /* AllJs */ | 48 /* AllDtsEmit */);
123136
123127
  if (!pending) state.programEmitPending = void 0;
123137
123128
  else state.programEmitPending = pending;
123138
123129
  }
123139
123130
  }
123140
- 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) {
123141
123141
  var _a;
123142
123142
  if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size)) return void 0;
123143
123143
  return forEachEntry(state.affectedFilesPendingEmit, (emitKind, path) => {
@@ -123148,12 +123148,16 @@ function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) {
123148
123148
  return void 0;
123149
123149
  }
123150
123150
  const seenKind = (_a2 = state.seenEmittedFiles) == null ? void 0 : _a2.get(affectedFile.resolvedPath);
123151
- let pendingKind = getPendingEmitKind(emitKind, seenKind);
123152
- if (emitOnlyDtsFiles) pendingKind = pendingKind & 24 /* AllDts */;
123151
+ const pendingKind = getPendingEmitKindWithSeen(
123152
+ emitKind,
123153
+ seenKind,
123154
+ emitOnlyDtsFiles,
123155
+ isForDtsErrors
123156
+ );
123153
123157
  if (pendingKind) return { affectedFile, emitKind: pendingKind };
123154
123158
  });
123155
123159
  }
123156
- function getNextPendingEmitDiagnosticsFile(state) {
123160
+ function getNextPendingEmitDiagnosticsFile(state, isForDtsErrors) {
123157
123161
  var _a;
123158
123162
  if (!((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size)) return void 0;
123159
123163
  return forEachEntry(state.emitDiagnosticsPerFile, (diagnostics, path) => {
@@ -123164,7 +123168,7 @@ function getNextPendingEmitDiagnosticsFile(state) {
123164
123168
  return void 0;
123165
123169
  }
123166
123170
  const seenKind = ((_a2 = state.seenEmittedFiles) == null ? void 0 : _a2.get(affectedFile.resolvedPath)) || 0 /* None */;
123167
- if (!(seenKind & 24 /* AllDts */)) return { affectedFile, diagnostics, seenKind };
123171
+ if (!(seenKind & getBuilderFileEmitAllDts(isForDtsErrors))) return { affectedFile, diagnostics, seenKind };
123168
123172
  });
123169
123173
  }
123170
123174
  function removeDiagnosticsOfLibraryFiles(state) {
@@ -123219,7 +123223,7 @@ function handleDtsMayChangeOf(state, path, invalidateJsFiles, cancellationToken,
123219
123223
  addToAffectedFilesPendingEmit(
123220
123224
  state,
123221
123225
  path,
123222
- state.compilerOptions.declarationMap ? 24 /* AllDts */ : 8 /* Dts */
123226
+ state.compilerOptions.declarationMap ? 56 /* AllDts */ : 24 /* Dts */
123223
123227
  );
123224
123228
  }
123225
123229
  }
@@ -123419,8 +123423,9 @@ function getBuildInfo2(state) {
123419
123423
  root,
123420
123424
  resolvedRoot: toResolvedRoot(),
123421
123425
  options: toIncrementalBuildInfoCompilerOptions(state.compilerOptions),
123422
- semanticDiagnosticsPerFile: toIncrementalBuildInfoDiagnostics(),
123426
+ semanticDiagnosticsPerFile: !state.changedFilesSet.size ? toIncrementalBuildInfoDiagnostics() : void 0,
123423
123427
  emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
123428
+ changeFileSet: toChangeFileSet(),
123424
123429
  outSignature: state.outSignature,
123425
123430
  latestChangedDtsFile,
123426
123431
  pendingEmit: !state.programEmitPending ? void 0 : (
@@ -123504,7 +123509,7 @@ function getBuildInfo2(state) {
123504
123509
  affectedFilesPendingEmit,
123505
123510
  pendingEmit === fullEmitForOptions ? fileId : (
123506
123511
  // Pending full emit per options
123507
- pendingEmit === 8 /* Dts */ ? [fileId] : (
123512
+ pendingEmit === 24 /* Dts */ ? [fileId] : (
123508
123513
  // Pending on Dts only
123509
123514
  [fileId, pendingEmit]
123510
123515
  )
@@ -123524,6 +123529,7 @@ function getBuildInfo2(state) {
123524
123529
  referencedMap,
123525
123530
  semanticDiagnosticsPerFile,
123526
123531
  emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
123532
+ changeFileSet: toChangeFileSet(),
123527
123533
  affectedFilesPendingEmit,
123528
123534
  emitSignatures,
123529
123535
  latestChangedDtsFile,
@@ -123612,7 +123618,7 @@ function getBuildInfo2(state) {
123612
123618
  state.fileInfos.forEach((_value, key) => {
123613
123619
  const value = state.semanticDiagnosticsPerFile.get(key);
123614
123620
  if (!value) {
123615
- result = append(result, toFileId(key));
123621
+ if (!state.changedFilesSet.has(key)) result = append(result, toFileId(key));
123616
123622
  } else if (value.length) {
123617
123623
  result = append(result, [
123618
123624
  toFileId(key),
@@ -123679,6 +123685,15 @@ function getBuildInfo2(state) {
123679
123685
  return result;
123680
123686
  }) || array;
123681
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
+ }
123682
123697
  }
123683
123698
  function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
123684
123699
  let host;
@@ -123757,6 +123772,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123757
123772
  sourceFile
123758
123773
  );
123759
123774
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
123775
+ builderProgram.getDeclarationDiagnostics = getDeclarationDiagnostics2;
123760
123776
  builderProgram.emit = emit;
123761
123777
  builderProgram.releaseProgram = () => releaseCache(state);
123762
123778
  if (kind === 0 /* SemanticDiagnosticsBuilderProgram */) {
@@ -123781,21 +123797,31 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123781
123797
  }
123782
123798
  return emitSkippedWithNoDiagnostics;
123783
123799
  }
123784
- function emitNextAffectedFile(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
123800
+ function emitNextAffectedFileOrDtsErrors(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers, isForDtsErrors) {
123785
123801
  var _a, _b, _c, _d;
123786
123802
  Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
123787
123803
  let affected = getNextAffectedFile(state, cancellationToken, host);
123788
123804
  const programEmitKind = getBuilderFileEmit(state.compilerOptions);
123789
- let emitKind = emitOnlyDtsFiles ? programEmitKind & 24 /* AllDts */ : programEmitKind;
123805
+ let emitKind = !isForDtsErrors ? emitOnlyDtsFiles ? programEmitKind & 56 /* AllDts */ : programEmitKind : 8 /* DtsErrors */;
123790
123806
  if (!affected) {
123791
123807
  if (!state.compilerOptions.outFile) {
123792
- const pendingAffectedFile = getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles);
123808
+ const pendingAffectedFile = getNextAffectedFilePendingEmit(
123809
+ state,
123810
+ emitOnlyDtsFiles,
123811
+ isForDtsErrors
123812
+ );
123793
123813
  if (pendingAffectedFile) {
123794
123814
  ({ affectedFile: affected, emitKind } = pendingAffectedFile);
123795
123815
  } else {
123796
- const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(state);
123816
+ const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(
123817
+ state,
123818
+ isForDtsErrors
123819
+ );
123797
123820
  if (pendingForDiagnostics) {
123798
- (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
+ );
123799
123825
  return {
123800
123826
  result: { emitSkipped: true, diagnostics: pendingForDiagnostics.diagnostics },
123801
123827
  affected: pendingForDiagnostics.affectedFile
@@ -123804,14 +123830,18 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123804
123830
  }
123805
123831
  } else {
123806
123832
  if (state.programEmitPending) {
123807
- emitKind = state.programEmitPending;
123808
- if (emitOnlyDtsFiles) emitKind = emitKind & 24 /* AllDts */;
123833
+ emitKind = getPendingEmitKindWithSeen(
123834
+ state.programEmitPending,
123835
+ state.seenProgramEmit,
123836
+ emitOnlyDtsFiles,
123837
+ isForDtsErrors
123838
+ );
123809
123839
  if (emitKind) affected = state.program;
123810
123840
  }
123811
123841
  if (!affected && ((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size)) {
123812
123842
  const seenKind = state.seenProgramEmit || 0 /* None */;
123813
- if (!(seenKind & 24 /* AllDts */)) {
123814
- state.seenProgramEmit = 24 /* AllDts */ | seenKind;
123843
+ if (!(seenKind & getBuilderFileEmitAllDts(isForDtsErrors))) {
123844
+ state.seenProgramEmit = getBuilderFileEmitAllDts(isForDtsErrors) | seenKind;
123815
123845
  const diagnostics = [];
123816
123846
  state.emitDiagnosticsPerFile.forEach((d) => addRange(diagnostics, d));
123817
123847
  return {
@@ -123822,7 +123852,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123822
123852
  }
123823
123853
  }
123824
123854
  if (!affected) {
123825
- if (!getBuildInfoEmitPending(state)) return void 0;
123855
+ if (isForDtsErrors || !getBuildInfoEmitPending(state)) return void 0;
123826
123856
  const affected2 = state.program;
123827
123857
  const result2 = affected2.emitBuildInfo(
123828
123858
  writeFile2 || maybeBind(host, host.writeFile),
@@ -123834,8 +123864,8 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123834
123864
  }
123835
123865
  let emitOnly;
123836
123866
  if (emitKind & 7 /* AllJs */) emitOnly = 0 /* Js */;
123837
- if (emitKind & 24 /* AllDts */) emitOnly = emitOnly === void 0 ? 1 /* Dts */ : void 0;
123838
- 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(
123839
123869
  affected === state.program ? void 0 : affected,
123840
123870
  getWriteFileCallback(writeFile2, customTransformers),
123841
123871
  cancellationToken,
@@ -123845,7 +123875,13 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123845
123875
  void 0,
123846
123876
  /*skipBuildInfo*/
123847
123877
  true
123848
- );
123878
+ ) : {
123879
+ emitSkipped: true,
123880
+ diagnostics: state.program.getDeclarationDiagnostics(
123881
+ affected === state.program ? void 0 : affected,
123882
+ cancellationToken
123883
+ )
123884
+ };
123849
123885
  if (affected !== state.program) {
123850
123886
  const affectedSourceFile = affected;
123851
123887
  state.seenAffectedFiles.add(affectedSourceFile.resolvedPath);
@@ -123862,18 +123898,31 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123862
123898
  state.changedFilesSet.clear();
123863
123899
  state.programEmitPending = state.changedFilesSet.size ? getPendingEmitKind(programEmitKind, emitKind) : state.programEmitPending ? getPendingEmitKind(state.programEmitPending, emitKind) : void 0;
123864
123900
  state.seenProgramEmit = emitKind | (state.seenProgramEmit || 0 /* None */);
123865
- let emitDiagnosticsPerFile;
123866
- result.diagnostics.forEach((d) => {
123867
- if (!d.file) return;
123868
- let diagnostics = emitDiagnosticsPerFile == null ? void 0 : emitDiagnosticsPerFile.get(d.file.resolvedPath);
123869
- if (!diagnostics) (emitDiagnosticsPerFile ?? (emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(d.file.resolvedPath, diagnostics = []);
123870
- diagnostics.push(d);
123871
- });
123872
- if (emitDiagnosticsPerFile) state.emitDiagnosticsPerFile = emitDiagnosticsPerFile;
123901
+ setEmitDiagnosticsPerFile(result.diagnostics);
123873
123902
  state.buildInfoEmitPending = true;
123874
123903
  }
123875
123904
  return { result, affected };
123876
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
+ }
123877
123926
  function getWriteFileCallback(writeFile2, customTransformers) {
123878
123927
  Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
123879
123928
  if (!getEmitDeclarations(state.compilerOptions)) return writeFile2 || maybeBind(host, host.writeFile);
@@ -123973,16 +124022,69 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123973
124022
  sourceMaps
123974
124023
  };
123975
124024
  } else {
123976
- clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles);
124025
+ clearAffectedFilesPendingEmit(
124026
+ state,
124027
+ emitOnlyDtsFiles,
124028
+ /*isForDtsErrors*/
124029
+ false
124030
+ );
123977
124031
  }
123978
124032
  }
123979
- return state.program.emit(
124033
+ const emitResult = state.program.emit(
123980
124034
  targetSourceFile,
123981
124035
  getWriteFileCallback(writeFile2, customTransformers),
123982
124036
  cancellationToken,
123983
124037
  emitOnlyDtsFiles,
123984
124038
  customTransformers
123985
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
+ }
123986
124088
  }
123987
124089
  function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
123988
124090
  Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
@@ -124060,7 +124162,7 @@ function toBuilderStateFileInfoForMultiEmit(fileInfo) {
124060
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 };
124061
124163
  }
124062
124164
  function toBuilderFileEmit(value, fullEmitForOptions) {
124063
- return isNumber(value) ? fullEmitForOptions : value[1] || 8 /* Dts */;
124165
+ return isNumber(value) ? fullEmitForOptions : value[1] || 24 /* Dts */;
124064
124166
  }
124065
124167
  function toProgramEmitPending(value, options) {
124066
124168
  return !value ? getBuilderFileEmit(options || {}) : value;
@@ -124074,6 +124176,7 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
124074
124176
  let filePathsSetList;
124075
124177
  const latestChangedDtsFile = buildInfo.latestChangedDtsFile ? toAbsolutePath(buildInfo.latestChangedDtsFile) : void 0;
124076
124178
  const fileInfos = /* @__PURE__ */ new Map();
124179
+ const changedFilesSet = new Set(map(buildInfo.changeFileSet, toFilePath));
124077
124180
  if (isIncrementalBundleEmitBuildInfo(buildInfo)) {
124078
124181
  buildInfo.fileInfos.forEach((fileInfo, index) => {
124079
124182
  const path = toFilePath(index + 1);
@@ -124085,6 +124188,7 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
124085
124188
  semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(buildInfo.semanticDiagnosticsPerFile),
124086
124189
  emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
124087
124190
  hasReusableDiagnostic: true,
124191
+ changedFilesSet,
124088
124192
  latestChangedDtsFile,
124089
124193
  outSignature: buildInfo.outSignature,
124090
124194
  programEmitPending: buildInfo.pendingEmit === void 0 ? void 0 : toProgramEmitPending(buildInfo.pendingEmit, buildInfo.options),
@@ -124121,6 +124225,7 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
124121
124225
  semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(buildInfo.semanticDiagnosticsPerFile),
124122
124226
  emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
124123
124227
  hasReusableDiagnostic: true,
124228
+ changedFilesSet,
124124
124229
  affectedFilesPendingEmit: buildInfo.affectedFilesPendingEmit && arrayToMap(buildInfo.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
124125
124230
  latestChangedDtsFile,
124126
124231
  emitSignatures: (emitSignatures == null ? void 0 : emitSignatures.size) ? emitSignatures : void 0,
@@ -124173,7 +124278,7 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
124173
124278
  const semanticDiagnostics = new Map(
124174
124279
  mapDefinedIterator(
124175
124280
  fileInfos.keys(),
124176
- (key) => [key, emptyArray]
124281
+ (key) => !changedFilesSet.has(key) ? [key, emptyArray] : void 0
124177
124282
  )
124178
124283
  );
124179
124284
  diagnostics == null ? void 0 : diagnostics.forEach((value) => {
@@ -125742,7 +125847,7 @@ function toFileName(file, fileNameConvertor) {
125742
125847
  return fileNameConvertor ? fileNameConvertor(fileName) : fileName;
125743
125848
  }
125744
125849
  function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummary, writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
125745
- const isListFilesOnly = !!program.getCompilerOptions().listFilesOnly;
125850
+ const options = program.getCompilerOptions();
125746
125851
  const allDiagnostics = program.getConfigFileParsingDiagnostics().slice();
125747
125852
  const configFileParsingDiagnosticsLength = allDiagnostics.length;
125748
125853
  addRange(allDiagnostics, program.getSyntacticDiagnostics(
@@ -125752,7 +125857,7 @@ function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummar
125752
125857
  ));
125753
125858
  if (allDiagnostics.length === configFileParsingDiagnosticsLength) {
125754
125859
  addRange(allDiagnostics, program.getOptionsDiagnostics(cancellationToken));
125755
- if (!isListFilesOnly) {
125860
+ if (!options.listFilesOnly) {
125756
125861
  addRange(allDiagnostics, program.getGlobalDiagnostics(cancellationToken));
125757
125862
  if (allDiagnostics.length === configFileParsingDiagnosticsLength) {
125758
125863
  addRange(allDiagnostics, program.getSemanticDiagnostics(
@@ -125761,9 +125866,16 @@ function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummar
125761
125866
  cancellationToken
125762
125867
  ));
125763
125868
  }
125869
+ if (options.noEmit && getEmitDeclarations(options) && allDiagnostics.length === configFileParsingDiagnosticsLength) {
125870
+ addRange(allDiagnostics, program.getDeclarationDiagnostics(
125871
+ /*sourceFile*/
125872
+ void 0,
125873
+ cancellationToken
125874
+ ));
125875
+ }
125764
125876
  }
125765
125877
  }
125766
- const emitResult = isListFilesOnly ? { emitSkipped: true, diagnostics: emptyArray } : program.emit(
125878
+ const emitResult = options.listFilesOnly ? { emitSkipped: true, diagnostics: emptyArray } : program.emit(
125767
125879
  /*targetSourceFile*/
125768
125880
  void 0,
125769
125881
  writeFile2,
@@ -127582,7 +127694,7 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
127582
127694
  }
127583
127695
  }
127584
127696
  function getUpToDateStatusWorker(state, project, resolvedPath) {
127585
- var _a, _b, _c;
127697
+ var _a, _b, _c, _d, _e;
127586
127698
  if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
127587
127699
  return {
127588
127700
  type: 15 /* ContainerOnly */
@@ -127644,19 +127756,25 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
127644
127756
  };
127645
127757
  }
127646
127758
  if (incrementalBuildInfo) {
127647
- 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))) {
127648
127760
  return {
127649
127761
  type: 8 /* OutOfDateBuildInfoWithErrors */,
127650
127762
  buildInfoFile: buildInfoPath
127651
127763
  };
127652
127764
  }
127653
- 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)) {
127654
127766
  return {
127655
127767
  type: 7 /* OutOfDateBuildInfoWithPendingEmit */,
127656
127768
  buildInfoFile: buildInfoPath
127657
127769
  };
127658
127770
  }
127659
- 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
+ )) {
127660
127778
  return {
127661
127779
  type: 9 /* OutOfDateOptions */,
127662
127780
  buildInfoFile: buildInfoPath