@typescript-deploys/pr-build 5.3.0-pr-56271-4 → 5.4.0-pr-56300-6

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-insiders.20231101`;
20
+ var versionMajorMinor = "5.4";
21
+ var version = `${versionMajorMinor}.0-insiders.20231103`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -40034,6 +40034,9 @@ function createBinder() {
40034
40034
  case 213 /* CallExpression */:
40035
40035
  return hasNarrowableArgument(expr);
40036
40036
  case 217 /* ParenthesizedExpression */:
40037
+ if (isJSDocTypeAssertion(expr)) {
40038
+ return false;
40039
+ }
40037
40040
  case 235 /* NonNullExpression */:
40038
40041
  return isNarrowingExpression(expr.expression);
40039
40042
  case 226 /* BinaryExpression */:
@@ -58093,9 +58096,7 @@ function createTypeChecker(host) {
58093
58096
  if (checkType === wildcardType || extendsType === wildcardType) {
58094
58097
  return wildcardType;
58095
58098
  }
58096
- const checkTypeNode = skipTypeParentheses(root.node.checkType);
58097
- const extendsTypeNode = skipTypeParentheses(root.node.extendsType);
58098
- const checkTuples = isSimpleTupleType(checkTypeNode) && isSimpleTupleType(extendsTypeNode) && length(checkTypeNode.elements) === length(extendsTypeNode.elements);
58099
+ const checkTuples = isSimpleTupleType(root.node.checkType) && isSimpleTupleType(root.node.extendsType) && length(root.node.checkType.elements) === length(root.node.extendsType.elements);
58099
58100
  const checkTypeDeferred = isDeferredType(checkType, checkTuples);
58100
58101
  let combinedMapper;
58101
58102
  if (root.inferTypeParameters) {
@@ -63739,7 +63740,7 @@ function createTypeChecker(host) {
63739
63740
  const templateType = getTemplateTypeFromMappedType(target);
63740
63741
  const inference = createInferenceInfo(typeParameter);
63741
63742
  inferTypes([inference], sourceType, templateType);
63742
- return getTypeFromInference(inference) || unknownType;
63743
+ return getTypeFromInference(inference) || getBaseConstraintOfType(typeParameter) || unknownType;
63743
63744
  }
63744
63745
  function* getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
63745
63746
  const properties = getPropertiesOfType(target);
@@ -109750,27 +109751,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
109750
109751
  (_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Emit, "emitBuildInfo", { buildInfoPath });
109751
109752
  emitBuildInfo(bundleBuildInfo, buildInfoPath);
109752
109753
  (_f = tracing) == null ? void 0 : _f.pop();
109753
- if (!emitSkipped && emittedFilesList) {
109754
- if (!emitOnly) {
109755
- if (jsFilePath) {
109756
- emittedFilesList.push(jsFilePath);
109757
- }
109758
- if (sourceMapFilePath) {
109759
- emittedFilesList.push(sourceMapFilePath);
109760
- }
109761
- if (buildInfoPath) {
109762
- emittedFilesList.push(buildInfoPath);
109763
- }
109764
- }
109765
- if (emitOnly !== 0 /* Js */) {
109766
- if (declarationFilePath) {
109767
- emittedFilesList.push(declarationFilePath);
109768
- }
109769
- if (declarationMapPath) {
109770
- emittedFilesList.push(declarationMapPath);
109771
- }
109772
- }
109773
- }
109774
109754
  function relativeToBuildInfo(path) {
109775
109755
  return ensurePathIsNonModuleName(getRelativePathFromDirectory(buildInfoDirectory, path, host.getCanonicalFileName));
109776
109756
  }
@@ -109798,6 +109778,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
109798
109778
  void 0,
109799
109779
  { buildInfo }
109800
109780
  );
109781
+ emittedFilesList == null ? void 0 : emittedFilesList.push(buildInfoPath);
109801
109782
  }
109802
109783
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
109803
109784
  if (!sourceFileOrBundle || emitOnly || !jsFilePath) {
@@ -109843,6 +109824,12 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
109843
109824
  transform.dispose();
109844
109825
  if (bundleBuildInfo)
109845
109826
  bundleBuildInfo.js = printer.bundleFileInfo;
109827
+ if (emittedFilesList) {
109828
+ emittedFilesList.push(jsFilePath);
109829
+ if (sourceMapFilePath) {
109830
+ emittedFilesList.push(sourceMapFilePath);
109831
+ }
109832
+ }
109846
109833
  }
109847
109834
  function emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo) {
109848
109835
  if (!sourceFileOrBundle || emitOnly === 0 /* Js */)
@@ -109873,33 +109860,33 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
109873
109860
  emitterDiagnostics.add(diagnostic);
109874
109861
  }
109875
109862
  }
109876
- const printerOptions = {
109877
- removeComments: compilerOptions.removeComments,
109878
- newLine: compilerOptions.newLine,
109879
- noEmitHelpers: true,
109880
- module: compilerOptions.module,
109881
- target: compilerOptions.target,
109882
- sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
109883
- inlineSourceMap: compilerOptions.inlineSourceMap,
109884
- extendedDiagnostics: compilerOptions.extendedDiagnostics,
109885
- onlyPrintJsDocStyle: true,
109886
- omitBraceSourceMapPositions: true,
109887
- writeBundleFileInfo: !!bundleBuildInfo,
109888
- recordInternalSection: !!bundleBuildInfo,
109889
- relativeToBuildInfo
109890
- };
109891
- const declarationPrinter = createPrinter(printerOptions, {
109892
- // resolver hooks
109893
- hasGlobalName: resolver.hasGlobalName,
109894
- // transform hooks
109895
- onEmitNode: declarationTransform.emitNodeWithNotification,
109896
- isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
109897
- substituteNode: declarationTransform.substituteNode
109898
- });
109899
109863
  const declBlocked = !!declarationTransform.diagnostics && !!declarationTransform.diagnostics.length || !!host.isEmitBlocked(declarationFilePath) || !!compilerOptions.noEmit;
109900
109864
  emitSkipped = emitSkipped || declBlocked;
109901
109865
  if (!declBlocked || forceDtsEmit) {
109902
109866
  Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform");
109867
+ const printerOptions = {
109868
+ removeComments: compilerOptions.removeComments,
109869
+ newLine: compilerOptions.newLine,
109870
+ noEmitHelpers: true,
109871
+ module: compilerOptions.module,
109872
+ target: compilerOptions.target,
109873
+ sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
109874
+ inlineSourceMap: compilerOptions.inlineSourceMap,
109875
+ extendedDiagnostics: compilerOptions.extendedDiagnostics,
109876
+ onlyPrintJsDocStyle: true,
109877
+ omitBraceSourceMapPositions: true,
109878
+ writeBundleFileInfo: !!bundleBuildInfo,
109879
+ recordInternalSection: !!bundleBuildInfo,
109880
+ relativeToBuildInfo
109881
+ };
109882
+ const declarationPrinter = createPrinter(printerOptions, {
109883
+ // resolver hooks
109884
+ hasGlobalName: resolver.hasGlobalName,
109885
+ // transform hooks
109886
+ onEmitNode: declarationTransform.emitNodeWithNotification,
109887
+ isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
109888
+ substituteNode: declarationTransform.substituteNode
109889
+ });
109903
109890
  printSourceFileOrBundle(
109904
109891
  declarationFilePath,
109905
109892
  declarationMapPath,
@@ -109913,10 +109900,16 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
109913
109900
  // Explicitly do not passthru either `inline` option
109914
109901
  }
109915
109902
  );
109903
+ if (emittedFilesList) {
109904
+ emittedFilesList.push(declarationFilePath);
109905
+ if (declarationMapPath) {
109906
+ emittedFilesList.push(declarationMapPath);
109907
+ }
109908
+ }
109909
+ if (bundleBuildInfo)
109910
+ bundleBuildInfo.dts = declarationPrinter.bundleFileInfo;
109916
109911
  }
109917
109912
  declarationTransform.dispose();
109918
- if (bundleBuildInfo)
109919
- bundleBuildInfo.dts = declarationPrinter.bundleFileInfo;
109920
109913
  }
109921
109914
  function collectLinkedAliases(node) {
109922
109915
  if (isExportAssignment(node)) {
@@ -119966,6 +119959,7 @@ function createBuilderProgramState(newProgram, oldState) {
119966
119959
  const copyDeclarationFileDiagnostics = canCopySemanticDiagnostics && !compilerOptions.skipLibCheck === !oldCompilerOptions.skipLibCheck;
119967
119960
  const copyLibFileDiagnostics = copyDeclarationFileDiagnostics && !compilerOptions.skipDefaultLibCheck === !oldCompilerOptions.skipDefaultLibCheck;
119968
119961
  state.fileInfos.forEach((info, sourceFilePath) => {
119962
+ var _a2;
119969
119963
  let oldInfo;
119970
119964
  let newReferences;
119971
119965
  if (!useOldState || // File wasn't present in old state
@@ -119975,22 +119969,28 @@ function createBuilderProgramState(newProgram, oldState) {
119975
119969
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) || // Referenced file was deleted in the new program
119976
119970
  newReferences && forEachKey(newReferences, (path) => !state.fileInfos.has(path) && oldState.fileInfos.has(path))) {
119977
119971
  addFileToChangeSet(state, sourceFilePath);
119978
- } else if (canCopySemanticDiagnostics) {
119972
+ } else {
119979
119973
  const sourceFile = newProgram.getSourceFileByPath(sourceFilePath);
119980
- if (sourceFile.isDeclarationFile && !copyDeclarationFileDiagnostics)
119981
- return;
119982
- if (sourceFile.hasNoDefaultLib && !copyLibFileDiagnostics)
119983
- return;
119984
- const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
119985
- if (diagnostics) {
119986
- state.semanticDiagnosticsPerFile.set(
119974
+ const emitDiagnostics = (_a2 = oldState.emitDiagnosticsPerFile) == null ? void 0 : _a2.get(sourceFilePath);
119975
+ if (emitDiagnostics) {
119976
+ (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(
119987
119977
  sourceFilePath,
119988
- oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
119978
+ oldState.hasReusableDiagnostic ? convertToDiagnostics(emitDiagnostics, newProgram) : repopulateDiagnostics(emitDiagnostics, newProgram)
119989
119979
  );
119990
- if (!state.semanticDiagnosticsFromOldState) {
119991
- state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set();
119980
+ }
119981
+ if (canCopySemanticDiagnostics) {
119982
+ if (sourceFile.isDeclarationFile && !copyDeclarationFileDiagnostics)
119983
+ return;
119984
+ if (sourceFile.hasNoDefaultLib && !copyLibFileDiagnostics)
119985
+ return;
119986
+ const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
119987
+ if (diagnostics) {
119988
+ state.semanticDiagnosticsPerFile.set(
119989
+ sourceFilePath,
119990
+ oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
119991
+ );
119992
+ (state.semanticDiagnosticsFromOldState ?? (state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set())).add(sourceFilePath);
119992
119993
  }
119993
- state.semanticDiagnosticsFromOldState.add(sourceFilePath);
119994
119994
  }
119995
119995
  }
119996
119996
  if (canCopyEmitSignatures) {
@@ -120127,7 +120127,9 @@ function backupBuilderProgramEmitState(state) {
120127
120127
  outSignature: state.outSignature,
120128
120128
  latestChangedDtsFile: state.latestChangedDtsFile,
120129
120129
  hasChangedEmitSignature: state.hasChangedEmitSignature,
120130
- changedFilesSet: outFilePath ? new Set(state.changedFilesSet) : void 0
120130
+ changedFilesSet: outFilePath ? new Set(state.changedFilesSet) : void 0,
120131
+ buildInfoEmitPending: state.buildInfoEmitPending,
120132
+ emitDiagnosticsPerFile: state.emitDiagnosticsPerFile && new Map(state.emitDiagnosticsPerFile)
120131
120133
  };
120132
120134
  }
120133
120135
  function restoreBuilderProgramEmitState(state, savedEmitState) {
@@ -120138,6 +120140,8 @@ function restoreBuilderProgramEmitState(state, savedEmitState) {
120138
120140
  state.outSignature = savedEmitState.outSignature;
120139
120141
  state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
120140
120142
  state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
120143
+ state.buildInfoEmitPending = savedEmitState.buildInfoEmitPending;
120144
+ state.emitDiagnosticsPerFile = savedEmitState.emitDiagnosticsPerFile;
120141
120145
  if (savedEmitState.changedFilesSet)
120142
120146
  state.changedFilesSet = savedEmitState.changedFilesSet;
120143
120147
  }
@@ -120228,6 +120232,22 @@ function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) {
120228
120232
  return { affectedFile, emitKind: pendingKind };
120229
120233
  });
120230
120234
  }
120235
+ function getNextPendingEmitDiagnosticsFile(state) {
120236
+ var _a;
120237
+ if (!((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size))
120238
+ return void 0;
120239
+ return forEachEntry(state.emitDiagnosticsPerFile, (diagnostics, path) => {
120240
+ var _a2;
120241
+ const affectedFile = state.program.getSourceFileByPath(path);
120242
+ if (!affectedFile || !sourceFileMayBeEmitted(affectedFile, state.program)) {
120243
+ state.emitDiagnosticsPerFile.delete(path);
120244
+ return void 0;
120245
+ }
120246
+ const seenKind = ((_a2 = state.seenEmittedFiles) == null ? void 0 : _a2.get(affectedFile.resolvedPath)) || 0 /* None */;
120247
+ if (!(seenKind & 24 /* AllDts */))
120248
+ return { affectedFile, diagnostics, seenKind };
120249
+ });
120250
+ }
120231
120251
  function removeDiagnosticsOfLibraryFiles(state) {
120232
120252
  if (!state.cleanedDiagnosticsOfLibFiles) {
120233
120253
  state.cleanedDiagnosticsOfLibFiles = true;
@@ -120504,18 +120524,7 @@ function getBuildInfo2(state, bundle) {
120504
120524
  return void 0;
120505
120525
  });
120506
120526
  }
120507
- let semanticDiagnosticsPerFile;
120508
- if (state.semanticDiagnosticsPerFile) {
120509
- for (const key of arrayFrom(state.semanticDiagnosticsPerFile.keys()).sort(compareStringsCaseSensitive)) {
120510
- const value = state.semanticDiagnosticsPerFile.get(key);
120511
- (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(
120512
- value.length ? [
120513
- toFileId(key),
120514
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120515
- ] : toFileId(key)
120516
- );
120517
- }
120518
- }
120527
+ const semanticDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.semanticDiagnosticsPerFile);
120519
120528
  let affectedFilesPendingEmit;
120520
120529
  if ((_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.size) {
120521
120530
  const fullEmitForOptions = getBuilderFileEmit(state.compilerOptions);
@@ -120545,6 +120554,7 @@ function getBuildInfo2(state, bundle) {
120545
120554
  (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120546
120555
  }
120547
120556
  }
120557
+ const emitDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.emitDiagnosticsPerFile);
120548
120558
  const program = {
120549
120559
  fileNames,
120550
120560
  fileInfos,
@@ -120554,6 +120564,7 @@ function getBuildInfo2(state, bundle) {
120554
120564
  referencedMap,
120555
120565
  exportedModulesMap,
120556
120566
  semanticDiagnosticsPerFile,
120567
+ emitDiagnosticsPerFile,
120557
120568
  affectedFilesPendingEmit,
120558
120569
  changeFileSet,
120559
120570
  emitSignatures,
@@ -120610,73 +120621,87 @@ function getBuildInfo2(state, bundle) {
120610
120621
  if (optionInfo == null ? void 0 : optionInfo.affectsBuildInfo) {
120611
120622
  (result || (result = {}))[name] = convertToReusableCompilerOptionValue(
120612
120623
  optionInfo,
120613
- options[name],
120614
- relativeToBuildInfoEnsuringAbsolutePath
120624
+ options[name]
120615
120625
  );
120616
120626
  }
120617
120627
  }
120618
120628
  return result;
120619
120629
  }
120620
- }
120621
- function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120622
- if (option) {
120623
- Debug.assert(option.type !== "listOrElement");
120624
- if (option.type === "list") {
120625
- const values = value;
120626
- if (option.element.isFilePath && values.length) {
120627
- return values.map(relativeToBuildInfo);
120630
+ function convertToReusableCompilerOptionValue(option, value) {
120631
+ if (option) {
120632
+ Debug.assert(option.type !== "listOrElement");
120633
+ if (option.type === "list") {
120634
+ const values = value;
120635
+ if (option.element.isFilePath && values.length) {
120636
+ return values.map(relativeToBuildInfoEnsuringAbsolutePath);
120637
+ }
120638
+ } else if (option.isFilePath) {
120639
+ return relativeToBuildInfoEnsuringAbsolutePath(value);
120628
120640
  }
120629
- } else if (option.isFilePath) {
120630
- return relativeToBuildInfo(value);
120631
120641
  }
120642
+ return value;
120632
120643
  }
120633
- return value;
120634
- }
120635
- function convertToReusableDiagnostics(diagnostics, relativeToBuildInfo) {
120636
- Debug.assert(!!diagnostics.length);
120637
- return diagnostics.map((diagnostic) => {
120638
- const result = convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo);
120639
- result.reportsUnnecessary = diagnostic.reportsUnnecessary;
120640
- result.reportDeprecated = diagnostic.reportsDeprecated;
120641
- result.source = diagnostic.source;
120642
- result.skippedOn = diagnostic.skippedOn;
120643
- const { relatedInformation } = diagnostic;
120644
- result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r, relativeToBuildInfo)) : [] : void 0;
120644
+ function convertToProgramBuildInfoDiagnostics(diagnostics) {
120645
+ let result;
120646
+ if (diagnostics) {
120647
+ for (const key of arrayFrom(diagnostics.keys()).sort(compareStringsCaseSensitive)) {
120648
+ const value = diagnostics.get(key);
120649
+ (result || (result = [])).push(
120650
+ value.length ? [
120651
+ toFileId(key),
120652
+ convertToReusableDiagnostics(value)
120653
+ ] : toFileId(key)
120654
+ );
120655
+ }
120656
+ }
120645
120657
  return result;
120646
- });
120647
- }
120648
- function convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo) {
120649
- const { file } = diagnostic;
120650
- return {
120651
- ...diagnostic,
120652
- file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
120653
- messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
120654
- };
120655
- }
120656
- function convertToReusableDiagnosticMessageChain(chain) {
120657
- if (chain.repopulateInfo) {
120658
+ }
120659
+ function convertToReusableDiagnostics(diagnostics) {
120660
+ Debug.assert(!!diagnostics.length);
120661
+ return diagnostics.map((diagnostic) => {
120662
+ const result = convertToReusableDiagnosticRelatedInformation(diagnostic);
120663
+ result.reportsUnnecessary = diagnostic.reportsUnnecessary;
120664
+ result.reportDeprecated = diagnostic.reportsDeprecated;
120665
+ result.source = diagnostic.source;
120666
+ result.skippedOn = diagnostic.skippedOn;
120667
+ const { relatedInformation } = diagnostic;
120668
+ result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r)) : [] : void 0;
120669
+ return result;
120670
+ });
120671
+ }
120672
+ function convertToReusableDiagnosticRelatedInformation(diagnostic) {
120673
+ const { file } = diagnostic;
120658
120674
  return {
120659
- info: chain.repopulateInfo(),
120660
- next: convertToReusableDiagnosticMessageChainArray(chain.next)
120675
+ ...diagnostic,
120676
+ file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
120677
+ messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
120661
120678
  };
120662
120679
  }
120663
- const next = convertToReusableDiagnosticMessageChainArray(chain.next);
120664
- return next === chain.next ? chain : { ...chain, next };
120665
- }
120666
- function convertToReusableDiagnosticMessageChainArray(array) {
120667
- if (!array)
120668
- return array;
120669
- return forEach(array, (chain, index) => {
120670
- const reusable = convertToReusableDiagnosticMessageChain(chain);
120671
- if (chain === reusable)
120672
- return void 0;
120673
- const result = index > 0 ? array.slice(0, index - 1) : [];
120674
- result.push(reusable);
120675
- for (let i = index + 1; i < array.length; i++) {
120676
- result.push(convertToReusableDiagnosticMessageChain(array[i]));
120680
+ function convertToReusableDiagnosticMessageChain(chain) {
120681
+ if (chain.repopulateInfo) {
120682
+ return {
120683
+ info: chain.repopulateInfo(),
120684
+ next: convertToReusableDiagnosticMessageChainArray(chain.next)
120685
+ };
120677
120686
  }
120678
- return result;
120679
- }) || array;
120687
+ const next = convertToReusableDiagnosticMessageChainArray(chain.next);
120688
+ return next === chain.next ? chain : { ...chain, next };
120689
+ }
120690
+ function convertToReusableDiagnosticMessageChainArray(array) {
120691
+ if (!array)
120692
+ return array;
120693
+ return forEach(array, (chain, index) => {
120694
+ const reusable = convertToReusableDiagnosticMessageChain(chain);
120695
+ if (chain === reusable)
120696
+ return void 0;
120697
+ const result = index > 0 ? array.slice(0, index - 1) : [];
120698
+ result.push(reusable);
120699
+ for (let i = index + 1; i < array.length; i++) {
120700
+ result.push(convertToReusableDiagnosticMessageChain(array[i]));
120701
+ }
120702
+ return result;
120703
+ }) || array;
120704
+ }
120680
120705
  }
120681
120706
  function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
120682
120707
  let host;
@@ -120785,6 +120810,14 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
120785
120810
  if (!outFile(state.compilerOptions)) {
120786
120811
  const pendingAffectedFile = getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles);
120787
120812
  if (!pendingAffectedFile) {
120813
+ const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(state);
120814
+ if (pendingForDiagnostics) {
120815
+ (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(pendingForDiagnostics.affectedFile.resolvedPath, pendingForDiagnostics.seenKind | 24 /* AllDts */);
120816
+ return {
120817
+ result: { emitSkipped: true, diagnostics: pendingForDiagnostics.diagnostics },
120818
+ affected: pendingForDiagnostics.affectedFile
120819
+ };
120820
+ }
120788
120821
  if (!state.buildInfoEmitPending)
120789
120822
  return void 0;
120790
120823
  const affected2 = state.program;
@@ -120833,6 +120866,8 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
120833
120866
  (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, pendingKind);
120834
120867
  else
120835
120868
  (_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.delete(affectedSourceFile.resolvedPath);
120869
+ if (result.diagnostics.length)
120870
+ (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, result.diagnostics);
120836
120871
  } else {
120837
120872
  state.changedFilesSet.clear();
120838
120873
  }
@@ -121005,9 +121040,10 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
121005
121040
  }
121006
121041
  }
121007
121042
  function addToAffectedFilesPendingEmit(state, affectedFilePendingEmit, kind) {
121008
- var _a;
121043
+ var _a, _b;
121009
121044
  const existingKind = ((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.get(affectedFilePendingEmit)) || 0 /* None */;
121010
121045
  (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedFilePendingEmit, existingKind | kind);
121046
+ (_b = state.emitDiagnosticsPerFile) == null ? void 0 : _b.delete(affectedFilePendingEmit);
121011
121047
  }
121012
121048
  function toBuilderStateFileInfoForMultiEmit(fileInfo) {
121013
121049
  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 };
@@ -121072,7 +121108,8 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
121072
121108
  compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121073
121109
  referencedMap: toManyToManyPathMap(program.referencedMap),
121074
121110
  exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121075
- semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && arrayToMap(program.semanticDiagnosticsPerFile, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => isNumber(value) ? emptyArray : value[1]),
121111
+ semanticDiagnosticsPerFile: toPerFileDiagnostics(program.semanticDiagnosticsPerFile),
121112
+ emitDiagnosticsPerFile: toPerFileDiagnostics(program.emitDiagnosticsPerFile),
121076
121113
  hasReusableDiagnostic: true,
121077
121114
  affectedFilesPendingEmit: program.affectedFilesPendingEmit && arrayToMap(program.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
121078
121115
  changedFilesSet: new Set(map(program.changeFileSet, toFilePath)),
@@ -121125,6 +121162,9 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
121125
121162
  referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
121126
121163
  return map2;
121127
121164
  }
121165
+ function toPerFileDiagnostics(diagnostics) {
121166
+ return diagnostics && arrayToMap(diagnostics, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => isNumber(value) ? emptyArray : value[1]);
121167
+ }
121128
121168
  }
121129
121169
  function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
121130
121170
  const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
@@ -124709,7 +124749,7 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
124709
124749
  }
124710
124750
  }
124711
124751
  function getUpToDateStatusWorker(state, project, resolvedPath) {
124712
- var _a, _b;
124752
+ var _a, _b, _c;
124713
124753
  if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
124714
124754
  return {
124715
124755
  type: 16 /* ContainerOnly */
@@ -124783,7 +124823,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
124783
124823
  };
124784
124824
  }
124785
124825
  if (buildInfo.program) {
124786
- 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))) {
124826
+ 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))) {
124787
124827
  return {
124788
124828
  type: 8 /* OutOfDateBuildInfo */,
124789
124829
  buildInfoFile: buildInfoPath