typescript 5.3.0-dev.20231101 → 5.4.0-dev.20231103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -17,8 +17,8 @@ and limitations under the License.
17
17
  "use strict";
18
18
 
19
19
  // src/compiler/corePublic.ts
20
- var versionMajorMinor = "5.3";
21
- var version = `${versionMajorMinor}.0-dev.20231101`;
20
+ var versionMajorMinor = "5.4";
21
+ var version = `${versionMajorMinor}.0-dev.20231103`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -109748,27 +109748,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
109748
109748
  (_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Emit, "emitBuildInfo", { buildInfoPath });
109749
109749
  emitBuildInfo(bundleBuildInfo, buildInfoPath);
109750
109750
  (_f = tracing) == null ? void 0 : _f.pop();
109751
- if (!emitSkipped && emittedFilesList) {
109752
- if (!emitOnly) {
109753
- if (jsFilePath) {
109754
- emittedFilesList.push(jsFilePath);
109755
- }
109756
- if (sourceMapFilePath) {
109757
- emittedFilesList.push(sourceMapFilePath);
109758
- }
109759
- if (buildInfoPath) {
109760
- emittedFilesList.push(buildInfoPath);
109761
- }
109762
- }
109763
- if (emitOnly !== 0 /* Js */) {
109764
- if (declarationFilePath) {
109765
- emittedFilesList.push(declarationFilePath);
109766
- }
109767
- if (declarationMapPath) {
109768
- emittedFilesList.push(declarationMapPath);
109769
- }
109770
- }
109771
- }
109772
109751
  function relativeToBuildInfo(path) {
109773
109752
  return ensurePathIsNonModuleName(getRelativePathFromDirectory(buildInfoDirectory, path, host.getCanonicalFileName));
109774
109753
  }
@@ -109796,6 +109775,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
109796
109775
  void 0,
109797
109776
  { buildInfo }
109798
109777
  );
109778
+ emittedFilesList == null ? void 0 : emittedFilesList.push(buildInfoPath);
109799
109779
  }
109800
109780
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
109801
109781
  if (!sourceFileOrBundle || emitOnly || !jsFilePath) {
@@ -109841,6 +109821,12 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
109841
109821
  transform.dispose();
109842
109822
  if (bundleBuildInfo)
109843
109823
  bundleBuildInfo.js = printer.bundleFileInfo;
109824
+ if (emittedFilesList) {
109825
+ emittedFilesList.push(jsFilePath);
109826
+ if (sourceMapFilePath) {
109827
+ emittedFilesList.push(sourceMapFilePath);
109828
+ }
109829
+ }
109844
109830
  }
109845
109831
  function emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo) {
109846
109832
  if (!sourceFileOrBundle || emitOnly === 0 /* Js */)
@@ -109871,33 +109857,33 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
109871
109857
  emitterDiagnostics.add(diagnostic);
109872
109858
  }
109873
109859
  }
109874
- const printerOptions = {
109875
- removeComments: compilerOptions.removeComments,
109876
- newLine: compilerOptions.newLine,
109877
- noEmitHelpers: true,
109878
- module: compilerOptions.module,
109879
- target: compilerOptions.target,
109880
- sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
109881
- inlineSourceMap: compilerOptions.inlineSourceMap,
109882
- extendedDiagnostics: compilerOptions.extendedDiagnostics,
109883
- onlyPrintJsDocStyle: true,
109884
- omitBraceSourceMapPositions: true,
109885
- writeBundleFileInfo: !!bundleBuildInfo,
109886
- recordInternalSection: !!bundleBuildInfo,
109887
- relativeToBuildInfo
109888
- };
109889
- const declarationPrinter = createPrinter(printerOptions, {
109890
- // resolver hooks
109891
- hasGlobalName: resolver.hasGlobalName,
109892
- // transform hooks
109893
- onEmitNode: declarationTransform.emitNodeWithNotification,
109894
- isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
109895
- substituteNode: declarationTransform.substituteNode
109896
- });
109897
109860
  const declBlocked = !!declarationTransform.diagnostics && !!declarationTransform.diagnostics.length || !!host.isEmitBlocked(declarationFilePath) || !!compilerOptions.noEmit;
109898
109861
  emitSkipped = emitSkipped || declBlocked;
109899
109862
  if (!declBlocked || forceDtsEmit) {
109900
109863
  Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform");
109864
+ const printerOptions = {
109865
+ removeComments: compilerOptions.removeComments,
109866
+ newLine: compilerOptions.newLine,
109867
+ noEmitHelpers: true,
109868
+ module: compilerOptions.module,
109869
+ target: compilerOptions.target,
109870
+ sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
109871
+ inlineSourceMap: compilerOptions.inlineSourceMap,
109872
+ extendedDiagnostics: compilerOptions.extendedDiagnostics,
109873
+ onlyPrintJsDocStyle: true,
109874
+ omitBraceSourceMapPositions: true,
109875
+ writeBundleFileInfo: !!bundleBuildInfo,
109876
+ recordInternalSection: !!bundleBuildInfo,
109877
+ relativeToBuildInfo
109878
+ };
109879
+ const declarationPrinter = createPrinter(printerOptions, {
109880
+ // resolver hooks
109881
+ hasGlobalName: resolver.hasGlobalName,
109882
+ // transform hooks
109883
+ onEmitNode: declarationTransform.emitNodeWithNotification,
109884
+ isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
109885
+ substituteNode: declarationTransform.substituteNode
109886
+ });
109901
109887
  printSourceFileOrBundle(
109902
109888
  declarationFilePath,
109903
109889
  declarationMapPath,
@@ -109911,10 +109897,16 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
109911
109897
  // Explicitly do not passthru either `inline` option
109912
109898
  }
109913
109899
  );
109900
+ if (emittedFilesList) {
109901
+ emittedFilesList.push(declarationFilePath);
109902
+ if (declarationMapPath) {
109903
+ emittedFilesList.push(declarationMapPath);
109904
+ }
109905
+ }
109906
+ if (bundleBuildInfo)
109907
+ bundleBuildInfo.dts = declarationPrinter.bundleFileInfo;
109914
109908
  }
109915
109909
  declarationTransform.dispose();
109916
- if (bundleBuildInfo)
109917
- bundleBuildInfo.dts = declarationPrinter.bundleFileInfo;
109918
109910
  }
109919
109911
  function collectLinkedAliases(node) {
109920
109912
  if (isExportAssignment(node)) {
@@ -119964,6 +119956,7 @@ function createBuilderProgramState(newProgram, oldState) {
119964
119956
  const copyDeclarationFileDiagnostics = canCopySemanticDiagnostics && !compilerOptions.skipLibCheck === !oldCompilerOptions.skipLibCheck;
119965
119957
  const copyLibFileDiagnostics = copyDeclarationFileDiagnostics && !compilerOptions.skipDefaultLibCheck === !oldCompilerOptions.skipDefaultLibCheck;
119966
119958
  state.fileInfos.forEach((info, sourceFilePath) => {
119959
+ var _a2;
119967
119960
  let oldInfo;
119968
119961
  let newReferences;
119969
119962
  if (!useOldState || // File wasn't present in old state
@@ -119973,22 +119966,28 @@ function createBuilderProgramState(newProgram, oldState) {
119973
119966
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) || // Referenced file was deleted in the new program
119974
119967
  newReferences && forEachKey(newReferences, (path) => !state.fileInfos.has(path) && oldState.fileInfos.has(path))) {
119975
119968
  addFileToChangeSet(state, sourceFilePath);
119976
- } else if (canCopySemanticDiagnostics) {
119969
+ } else {
119977
119970
  const sourceFile = newProgram.getSourceFileByPath(sourceFilePath);
119978
- if (sourceFile.isDeclarationFile && !copyDeclarationFileDiagnostics)
119979
- return;
119980
- if (sourceFile.hasNoDefaultLib && !copyLibFileDiagnostics)
119981
- return;
119982
- const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
119983
- if (diagnostics) {
119984
- state.semanticDiagnosticsPerFile.set(
119971
+ const emitDiagnostics = (_a2 = oldState.emitDiagnosticsPerFile) == null ? void 0 : _a2.get(sourceFilePath);
119972
+ if (emitDiagnostics) {
119973
+ (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(
119985
119974
  sourceFilePath,
119986
- oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
119975
+ oldState.hasReusableDiagnostic ? convertToDiagnostics(emitDiagnostics, newProgram) : repopulateDiagnostics(emitDiagnostics, newProgram)
119987
119976
  );
119988
- if (!state.semanticDiagnosticsFromOldState) {
119989
- state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set();
119977
+ }
119978
+ if (canCopySemanticDiagnostics) {
119979
+ if (sourceFile.isDeclarationFile && !copyDeclarationFileDiagnostics)
119980
+ return;
119981
+ if (sourceFile.hasNoDefaultLib && !copyLibFileDiagnostics)
119982
+ return;
119983
+ const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
119984
+ if (diagnostics) {
119985
+ state.semanticDiagnosticsPerFile.set(
119986
+ sourceFilePath,
119987
+ oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
119988
+ );
119989
+ (state.semanticDiagnosticsFromOldState ?? (state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set())).add(sourceFilePath);
119990
119990
  }
119991
- state.semanticDiagnosticsFromOldState.add(sourceFilePath);
119992
119991
  }
119993
119992
  }
119994
119993
  if (canCopyEmitSignatures) {
@@ -120125,7 +120124,9 @@ function backupBuilderProgramEmitState(state) {
120125
120124
  outSignature: state.outSignature,
120126
120125
  latestChangedDtsFile: state.latestChangedDtsFile,
120127
120126
  hasChangedEmitSignature: state.hasChangedEmitSignature,
120128
- changedFilesSet: outFilePath ? new Set(state.changedFilesSet) : void 0
120127
+ changedFilesSet: outFilePath ? new Set(state.changedFilesSet) : void 0,
120128
+ buildInfoEmitPending: state.buildInfoEmitPending,
120129
+ emitDiagnosticsPerFile: state.emitDiagnosticsPerFile && new Map(state.emitDiagnosticsPerFile)
120129
120130
  };
120130
120131
  }
120131
120132
  function restoreBuilderProgramEmitState(state, savedEmitState) {
@@ -120136,6 +120137,8 @@ function restoreBuilderProgramEmitState(state, savedEmitState) {
120136
120137
  state.outSignature = savedEmitState.outSignature;
120137
120138
  state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
120138
120139
  state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
120140
+ state.buildInfoEmitPending = savedEmitState.buildInfoEmitPending;
120141
+ state.emitDiagnosticsPerFile = savedEmitState.emitDiagnosticsPerFile;
120139
120142
  if (savedEmitState.changedFilesSet)
120140
120143
  state.changedFilesSet = savedEmitState.changedFilesSet;
120141
120144
  }
@@ -120226,6 +120229,22 @@ function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) {
120226
120229
  return { affectedFile, emitKind: pendingKind };
120227
120230
  });
120228
120231
  }
120232
+ function getNextPendingEmitDiagnosticsFile(state) {
120233
+ var _a;
120234
+ if (!((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size))
120235
+ return void 0;
120236
+ return forEachEntry(state.emitDiagnosticsPerFile, (diagnostics, path) => {
120237
+ var _a2;
120238
+ const affectedFile = state.program.getSourceFileByPath(path);
120239
+ if (!affectedFile || !sourceFileMayBeEmitted(affectedFile, state.program)) {
120240
+ state.emitDiagnosticsPerFile.delete(path);
120241
+ return void 0;
120242
+ }
120243
+ const seenKind = ((_a2 = state.seenEmittedFiles) == null ? void 0 : _a2.get(affectedFile.resolvedPath)) || 0 /* None */;
120244
+ if (!(seenKind & 24 /* AllDts */))
120245
+ return { affectedFile, diagnostics, seenKind };
120246
+ });
120247
+ }
120229
120248
  function removeDiagnosticsOfLibraryFiles(state) {
120230
120249
  if (!state.cleanedDiagnosticsOfLibFiles) {
120231
120250
  state.cleanedDiagnosticsOfLibFiles = true;
@@ -120502,18 +120521,7 @@ function getBuildInfo2(state, bundle) {
120502
120521
  return void 0;
120503
120522
  });
120504
120523
  }
120505
- let semanticDiagnosticsPerFile;
120506
- if (state.semanticDiagnosticsPerFile) {
120507
- for (const key of arrayFrom(state.semanticDiagnosticsPerFile.keys()).sort(compareStringsCaseSensitive)) {
120508
- const value = state.semanticDiagnosticsPerFile.get(key);
120509
- (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(
120510
- value.length ? [
120511
- toFileId(key),
120512
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120513
- ] : toFileId(key)
120514
- );
120515
- }
120516
- }
120524
+ const semanticDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.semanticDiagnosticsPerFile);
120517
120525
  let affectedFilesPendingEmit;
120518
120526
  if ((_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.size) {
120519
120527
  const fullEmitForOptions = getBuilderFileEmit(state.compilerOptions);
@@ -120543,6 +120551,7 @@ function getBuildInfo2(state, bundle) {
120543
120551
  (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120544
120552
  }
120545
120553
  }
120554
+ const emitDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.emitDiagnosticsPerFile);
120546
120555
  const program = {
120547
120556
  fileNames,
120548
120557
  fileInfos,
@@ -120552,6 +120561,7 @@ function getBuildInfo2(state, bundle) {
120552
120561
  referencedMap,
120553
120562
  exportedModulesMap,
120554
120563
  semanticDiagnosticsPerFile,
120564
+ emitDiagnosticsPerFile,
120555
120565
  affectedFilesPendingEmit,
120556
120566
  changeFileSet,
120557
120567
  emitSignatures,
@@ -120608,73 +120618,87 @@ function getBuildInfo2(state, bundle) {
120608
120618
  if (optionInfo == null ? void 0 : optionInfo.affectsBuildInfo) {
120609
120619
  (result || (result = {}))[name] = convertToReusableCompilerOptionValue(
120610
120620
  optionInfo,
120611
- options[name],
120612
- relativeToBuildInfoEnsuringAbsolutePath
120621
+ options[name]
120613
120622
  );
120614
120623
  }
120615
120624
  }
120616
120625
  return result;
120617
120626
  }
120618
- }
120619
- function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120620
- if (option) {
120621
- Debug.assert(option.type !== "listOrElement");
120622
- if (option.type === "list") {
120623
- const values = value;
120624
- if (option.element.isFilePath && values.length) {
120625
- return values.map(relativeToBuildInfo);
120627
+ function convertToReusableCompilerOptionValue(option, value) {
120628
+ if (option) {
120629
+ Debug.assert(option.type !== "listOrElement");
120630
+ if (option.type === "list") {
120631
+ const values = value;
120632
+ if (option.element.isFilePath && values.length) {
120633
+ return values.map(relativeToBuildInfoEnsuringAbsolutePath);
120634
+ }
120635
+ } else if (option.isFilePath) {
120636
+ return relativeToBuildInfoEnsuringAbsolutePath(value);
120626
120637
  }
120627
- } else if (option.isFilePath) {
120628
- return relativeToBuildInfo(value);
120629
120638
  }
120639
+ return value;
120630
120640
  }
120631
- return value;
120632
- }
120633
- function convertToReusableDiagnostics(diagnostics, relativeToBuildInfo) {
120634
- Debug.assert(!!diagnostics.length);
120635
- return diagnostics.map((diagnostic) => {
120636
- const result = convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo);
120637
- result.reportsUnnecessary = diagnostic.reportsUnnecessary;
120638
- result.reportDeprecated = diagnostic.reportsDeprecated;
120639
- result.source = diagnostic.source;
120640
- result.skippedOn = diagnostic.skippedOn;
120641
- const { relatedInformation } = diagnostic;
120642
- result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r, relativeToBuildInfo)) : [] : void 0;
120641
+ function convertToProgramBuildInfoDiagnostics(diagnostics) {
120642
+ let result;
120643
+ if (diagnostics) {
120644
+ for (const key of arrayFrom(diagnostics.keys()).sort(compareStringsCaseSensitive)) {
120645
+ const value = diagnostics.get(key);
120646
+ (result || (result = [])).push(
120647
+ value.length ? [
120648
+ toFileId(key),
120649
+ convertToReusableDiagnostics(value)
120650
+ ] : toFileId(key)
120651
+ );
120652
+ }
120653
+ }
120643
120654
  return result;
120644
- });
120645
- }
120646
- function convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo) {
120647
- const { file } = diagnostic;
120648
- return {
120649
- ...diagnostic,
120650
- file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
120651
- messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
120652
- };
120653
- }
120654
- function convertToReusableDiagnosticMessageChain(chain) {
120655
- if (chain.repopulateInfo) {
120655
+ }
120656
+ function convertToReusableDiagnostics(diagnostics) {
120657
+ Debug.assert(!!diagnostics.length);
120658
+ return diagnostics.map((diagnostic) => {
120659
+ const result = convertToReusableDiagnosticRelatedInformation(diagnostic);
120660
+ result.reportsUnnecessary = diagnostic.reportsUnnecessary;
120661
+ result.reportDeprecated = diagnostic.reportsDeprecated;
120662
+ result.source = diagnostic.source;
120663
+ result.skippedOn = diagnostic.skippedOn;
120664
+ const { relatedInformation } = diagnostic;
120665
+ result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r)) : [] : void 0;
120666
+ return result;
120667
+ });
120668
+ }
120669
+ function convertToReusableDiagnosticRelatedInformation(diagnostic) {
120670
+ const { file } = diagnostic;
120656
120671
  return {
120657
- info: chain.repopulateInfo(),
120658
- next: convertToReusableDiagnosticMessageChainArray(chain.next)
120672
+ ...diagnostic,
120673
+ file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
120674
+ messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
120659
120675
  };
120660
120676
  }
120661
- const next = convertToReusableDiagnosticMessageChainArray(chain.next);
120662
- return next === chain.next ? chain : { ...chain, next };
120663
- }
120664
- function convertToReusableDiagnosticMessageChainArray(array) {
120665
- if (!array)
120666
- return array;
120667
- return forEach(array, (chain, index) => {
120668
- const reusable = convertToReusableDiagnosticMessageChain(chain);
120669
- if (chain === reusable)
120670
- return void 0;
120671
- const result = index > 0 ? array.slice(0, index - 1) : [];
120672
- result.push(reusable);
120673
- for (let i = index + 1; i < array.length; i++) {
120674
- result.push(convertToReusableDiagnosticMessageChain(array[i]));
120677
+ function convertToReusableDiagnosticMessageChain(chain) {
120678
+ if (chain.repopulateInfo) {
120679
+ return {
120680
+ info: chain.repopulateInfo(),
120681
+ next: convertToReusableDiagnosticMessageChainArray(chain.next)
120682
+ };
120675
120683
  }
120676
- return result;
120677
- }) || array;
120684
+ const next = convertToReusableDiagnosticMessageChainArray(chain.next);
120685
+ return next === chain.next ? chain : { ...chain, next };
120686
+ }
120687
+ function convertToReusableDiagnosticMessageChainArray(array) {
120688
+ if (!array)
120689
+ return array;
120690
+ return forEach(array, (chain, index) => {
120691
+ const reusable = convertToReusableDiagnosticMessageChain(chain);
120692
+ if (chain === reusable)
120693
+ return void 0;
120694
+ const result = index > 0 ? array.slice(0, index - 1) : [];
120695
+ result.push(reusable);
120696
+ for (let i = index + 1; i < array.length; i++) {
120697
+ result.push(convertToReusableDiagnosticMessageChain(array[i]));
120698
+ }
120699
+ return result;
120700
+ }) || array;
120701
+ }
120678
120702
  }
120679
120703
  function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
120680
120704
  let host;
@@ -120783,6 +120807,14 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
120783
120807
  if (!outFile(state.compilerOptions)) {
120784
120808
  const pendingAffectedFile = getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles);
120785
120809
  if (!pendingAffectedFile) {
120810
+ const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(state);
120811
+ if (pendingForDiagnostics) {
120812
+ (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(pendingForDiagnostics.affectedFile.resolvedPath, pendingForDiagnostics.seenKind | 24 /* AllDts */);
120813
+ return {
120814
+ result: { emitSkipped: true, diagnostics: pendingForDiagnostics.diagnostics },
120815
+ affected: pendingForDiagnostics.affectedFile
120816
+ };
120817
+ }
120786
120818
  if (!state.buildInfoEmitPending)
120787
120819
  return void 0;
120788
120820
  const affected2 = state.program;
@@ -120831,6 +120863,8 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
120831
120863
  (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, pendingKind);
120832
120864
  else
120833
120865
  (_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.delete(affectedSourceFile.resolvedPath);
120866
+ if (result.diagnostics.length)
120867
+ (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, result.diagnostics);
120834
120868
  } else {
120835
120869
  state.changedFilesSet.clear();
120836
120870
  }
@@ -121003,9 +121037,10 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
121003
121037
  }
121004
121038
  }
121005
121039
  function addToAffectedFilesPendingEmit(state, affectedFilePendingEmit, kind) {
121006
- var _a;
121040
+ var _a, _b;
121007
121041
  const existingKind = ((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.get(affectedFilePendingEmit)) || 0 /* None */;
121008
121042
  (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedFilePendingEmit, existingKind | kind);
121043
+ (_b = state.emitDiagnosticsPerFile) == null ? void 0 : _b.delete(affectedFilePendingEmit);
121009
121044
  }
121010
121045
  function toBuilderStateFileInfoForMultiEmit(fileInfo) {
121011
121046
  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 };
@@ -121070,7 +121105,8 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
121070
121105
  compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121071
121106
  referencedMap: toManyToManyPathMap(program.referencedMap),
121072
121107
  exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121073
- semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && arrayToMap(program.semanticDiagnosticsPerFile, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => isNumber(value) ? emptyArray : value[1]),
121108
+ semanticDiagnosticsPerFile: toPerFileDiagnostics(program.semanticDiagnosticsPerFile),
121109
+ emitDiagnosticsPerFile: toPerFileDiagnostics(program.emitDiagnosticsPerFile),
121074
121110
  hasReusableDiagnostic: true,
121075
121111
  affectedFilesPendingEmit: program.affectedFilesPendingEmit && arrayToMap(program.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
121076
121112
  changedFilesSet: new Set(map(program.changeFileSet, toFilePath)),
@@ -121123,6 +121159,9 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
121123
121159
  referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
121124
121160
  return map2;
121125
121161
  }
121162
+ function toPerFileDiagnostics(diagnostics) {
121163
+ return diagnostics && arrayToMap(diagnostics, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => isNumber(value) ? emptyArray : value[1]);
121164
+ }
121126
121165
  }
121127
121166
  function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
121128
121167
  const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
@@ -124707,7 +124746,7 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
124707
124746
  }
124708
124747
  }
124709
124748
  function getUpToDateStatusWorker(state, project, resolvedPath) {
124710
- var _a, _b;
124749
+ var _a, _b, _c;
124711
124750
  if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
124712
124751
  return {
124713
124752
  type: 16 /* ContainerOnly */
@@ -124781,7 +124820,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
124781
124820
  };
124782
124821
  }
124783
124822
  if (buildInfo.program) {
124784
- if (((_a = buildInfo.program.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? (_b = buildInfo.program.affectedFilesPendingEmit) == null ? void 0 : _b.length : some(buildInfo.program.semanticDiagnosticsPerFile, isArray))) {
124823
+ if (((_a = buildInfo.program.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? ((_b = buildInfo.program.affectedFilesPendingEmit) == null ? void 0 : _b.length) || ((_c = buildInfo.program.emitDiagnosticsPerFile) == null ? void 0 : _c.length) : some(buildInfo.program.semanticDiagnosticsPerFile, isArray))) {
124785
124824
  return {
124786
124825
  type: 8 /* OutOfDateBuildInfo */,
124787
124826
  buildInfoFile: buildInfoPath