@typescript-deploys/pr-build 5.3.0-pr-56281-6 → 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/lib.es5.d.ts CHANGED
@@ -1275,12 +1275,6 @@ interface ReadonlyArray<T> {
1275
1275
  * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
1276
1276
  */
1277
1277
  filter<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S[];
1278
- /**
1279
- * Returns the non-Falsy elements of an array
1280
- * @param predicate Must be exactly "Boolean"
1281
- * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
1282
- */
1283
- filter(predicate: BooleanConstructor, thisArg?: any): (T extends false | 0 | "" | null | undefined | 0n ? never : T)[];
1284
1278
  /**
1285
1279
  * Returns the elements of an array that meet the condition specified in a callback function.
1286
1280
  * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
@@ -1472,12 +1466,6 @@ interface Array<T> {
1472
1466
  * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
1473
1467
  */
1474
1468
  filter<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[];
1475
- /**
1476
- * Returns the non-Falsy elements of an array
1477
- * @param predicate Must be exactly "Boolean"
1478
- * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
1479
- */
1480
- filter(predicate: BooleanConstructor, thisArg?: any): (T extends false | 0 | "" | null | undefined | 0n ? never : T)[];
1481
1469
  /**
1482
1470
  * Returns the elements of an array that meet the condition specified in a callback function.
1483
1471
  * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
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.20231102`;
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 */:
@@ -55007,33 +55010,20 @@ function createTypeChecker(host) {
55007
55010
  return emptyArray;
55008
55011
  }
55009
55012
  function getSignaturesOfType(type, kind) {
55010
- function carveoutResult(type2, kind2) {
55011
- if (kind2 === 0 /* Call */ && type2.flags & 1048576 /* Union */) {
55012
- let memberName;
55013
- if (everyType(type2, (t) => {
55014
- var _a;
55015
- return !!((_a = t.symbol) == null ? void 0 : _a.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
55016
- })) {
55017
- if (type2.arrayFallbackSignatures) {
55018
- return type2.arrayFallbackSignatures;
55019
- }
55020
- const arrayArg = mapType(type2, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
55021
- const arrayType = createArrayType(arrayArg, someType(type2, (t) => isReadonlyArraySymbol(t.symbol.parent)));
55022
- return type2.arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind2);
55023
- }
55024
- }
55025
- return void 0;
55026
- }
55027
- let result = carveoutResult(type, kind);
55028
- if (result)
55029
- return result;
55030
- if (kind === 0 /* Call */ && type.flags & 1048576 /* Union */) {
55013
+ const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind);
55014
+ if (kind === 0 /* Call */ && !length(result) && type.flags & 1048576 /* Union */) {
55031
55015
  if (type.arrayFallbackSignatures) {
55032
55016
  return type.arrayFallbackSignatures;
55033
55017
  }
55034
- }
55035
- result = getSignaturesOfStructuredType(getReducedApparentType(type), kind);
55036
- if (kind === 0 /* Call */ && type.flags & 1048576 /* Union */) {
55018
+ let memberName;
55019
+ if (everyType(type, (t) => {
55020
+ var _a;
55021
+ return !!((_a = t.symbol) == null ? void 0 : _a.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
55022
+ })) {
55023
+ const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
55024
+ const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
55025
+ return type.arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind);
55026
+ }
55037
55027
  type.arrayFallbackSignatures = result;
55038
55028
  }
55039
55029
  return result;
@@ -63750,7 +63740,7 @@ function createTypeChecker(host) {
63750
63740
  const templateType = getTemplateTypeFromMappedType(target);
63751
63741
  const inference = createInferenceInfo(typeParameter);
63752
63742
  inferTypes([inference], sourceType, templateType);
63753
- return getTypeFromInference(inference) || unknownType;
63743
+ return getTypeFromInference(inference) || getBaseConstraintOfType(typeParameter) || unknownType;
63754
63744
  }
63755
63745
  function* getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
63756
63746
  const properties = getPropertiesOfType(target);
@@ -109761,27 +109751,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
109761
109751
  (_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Emit, "emitBuildInfo", { buildInfoPath });
109762
109752
  emitBuildInfo(bundleBuildInfo, buildInfoPath);
109763
109753
  (_f = tracing) == null ? void 0 : _f.pop();
109764
- if (!emitSkipped && emittedFilesList) {
109765
- if (!emitOnly) {
109766
- if (jsFilePath) {
109767
- emittedFilesList.push(jsFilePath);
109768
- }
109769
- if (sourceMapFilePath) {
109770
- emittedFilesList.push(sourceMapFilePath);
109771
- }
109772
- if (buildInfoPath) {
109773
- emittedFilesList.push(buildInfoPath);
109774
- }
109775
- }
109776
- if (emitOnly !== 0 /* Js */) {
109777
- if (declarationFilePath) {
109778
- emittedFilesList.push(declarationFilePath);
109779
- }
109780
- if (declarationMapPath) {
109781
- emittedFilesList.push(declarationMapPath);
109782
- }
109783
- }
109784
- }
109785
109754
  function relativeToBuildInfo(path) {
109786
109755
  return ensurePathIsNonModuleName(getRelativePathFromDirectory(buildInfoDirectory, path, host.getCanonicalFileName));
109787
109756
  }
@@ -109809,6 +109778,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
109809
109778
  void 0,
109810
109779
  { buildInfo }
109811
109780
  );
109781
+ emittedFilesList == null ? void 0 : emittedFilesList.push(buildInfoPath);
109812
109782
  }
109813
109783
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
109814
109784
  if (!sourceFileOrBundle || emitOnly || !jsFilePath) {
@@ -109854,6 +109824,12 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
109854
109824
  transform.dispose();
109855
109825
  if (bundleBuildInfo)
109856
109826
  bundleBuildInfo.js = printer.bundleFileInfo;
109827
+ if (emittedFilesList) {
109828
+ emittedFilesList.push(jsFilePath);
109829
+ if (sourceMapFilePath) {
109830
+ emittedFilesList.push(sourceMapFilePath);
109831
+ }
109832
+ }
109857
109833
  }
109858
109834
  function emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo) {
109859
109835
  if (!sourceFileOrBundle || emitOnly === 0 /* Js */)
@@ -109884,33 +109860,33 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
109884
109860
  emitterDiagnostics.add(diagnostic);
109885
109861
  }
109886
109862
  }
109887
- const printerOptions = {
109888
- removeComments: compilerOptions.removeComments,
109889
- newLine: compilerOptions.newLine,
109890
- noEmitHelpers: true,
109891
- module: compilerOptions.module,
109892
- target: compilerOptions.target,
109893
- sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
109894
- inlineSourceMap: compilerOptions.inlineSourceMap,
109895
- extendedDiagnostics: compilerOptions.extendedDiagnostics,
109896
- onlyPrintJsDocStyle: true,
109897
- omitBraceSourceMapPositions: true,
109898
- writeBundleFileInfo: !!bundleBuildInfo,
109899
- recordInternalSection: !!bundleBuildInfo,
109900
- relativeToBuildInfo
109901
- };
109902
- const declarationPrinter = createPrinter(printerOptions, {
109903
- // resolver hooks
109904
- hasGlobalName: resolver.hasGlobalName,
109905
- // transform hooks
109906
- onEmitNode: declarationTransform.emitNodeWithNotification,
109907
- isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
109908
- substituteNode: declarationTransform.substituteNode
109909
- });
109910
109863
  const declBlocked = !!declarationTransform.diagnostics && !!declarationTransform.diagnostics.length || !!host.isEmitBlocked(declarationFilePath) || !!compilerOptions.noEmit;
109911
109864
  emitSkipped = emitSkipped || declBlocked;
109912
109865
  if (!declBlocked || forceDtsEmit) {
109913
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
+ });
109914
109890
  printSourceFileOrBundle(
109915
109891
  declarationFilePath,
109916
109892
  declarationMapPath,
@@ -109924,10 +109900,16 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
109924
109900
  // Explicitly do not passthru either `inline` option
109925
109901
  }
109926
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;
109927
109911
  }
109928
109912
  declarationTransform.dispose();
109929
- if (bundleBuildInfo)
109930
- bundleBuildInfo.dts = declarationPrinter.bundleFileInfo;
109931
109913
  }
109932
109914
  function collectLinkedAliases(node) {
109933
109915
  if (isExportAssignment(node)) {
@@ -119977,6 +119959,7 @@ function createBuilderProgramState(newProgram, oldState) {
119977
119959
  const copyDeclarationFileDiagnostics = canCopySemanticDiagnostics && !compilerOptions.skipLibCheck === !oldCompilerOptions.skipLibCheck;
119978
119960
  const copyLibFileDiagnostics = copyDeclarationFileDiagnostics && !compilerOptions.skipDefaultLibCheck === !oldCompilerOptions.skipDefaultLibCheck;
119979
119961
  state.fileInfos.forEach((info, sourceFilePath) => {
119962
+ var _a2;
119980
119963
  let oldInfo;
119981
119964
  let newReferences;
119982
119965
  if (!useOldState || // File wasn't present in old state
@@ -119986,22 +119969,28 @@ function createBuilderProgramState(newProgram, oldState) {
119986
119969
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) || // Referenced file was deleted in the new program
119987
119970
  newReferences && forEachKey(newReferences, (path) => !state.fileInfos.has(path) && oldState.fileInfos.has(path))) {
119988
119971
  addFileToChangeSet(state, sourceFilePath);
119989
- } else if (canCopySemanticDiagnostics) {
119972
+ } else {
119990
119973
  const sourceFile = newProgram.getSourceFileByPath(sourceFilePath);
119991
- if (sourceFile.isDeclarationFile && !copyDeclarationFileDiagnostics)
119992
- return;
119993
- if (sourceFile.hasNoDefaultLib && !copyLibFileDiagnostics)
119994
- return;
119995
- const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
119996
- if (diagnostics) {
119997
- 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(
119998
119977
  sourceFilePath,
119999
- oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
119978
+ oldState.hasReusableDiagnostic ? convertToDiagnostics(emitDiagnostics, newProgram) : repopulateDiagnostics(emitDiagnostics, newProgram)
120000
119979
  );
120001
- if (!state.semanticDiagnosticsFromOldState) {
120002
- 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);
120003
119993
  }
120004
- state.semanticDiagnosticsFromOldState.add(sourceFilePath);
120005
119994
  }
120006
119995
  }
120007
119996
  if (canCopyEmitSignatures) {
@@ -120138,7 +120127,9 @@ function backupBuilderProgramEmitState(state) {
120138
120127
  outSignature: state.outSignature,
120139
120128
  latestChangedDtsFile: state.latestChangedDtsFile,
120140
120129
  hasChangedEmitSignature: state.hasChangedEmitSignature,
120141
- 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)
120142
120133
  };
120143
120134
  }
120144
120135
  function restoreBuilderProgramEmitState(state, savedEmitState) {
@@ -120149,6 +120140,8 @@ function restoreBuilderProgramEmitState(state, savedEmitState) {
120149
120140
  state.outSignature = savedEmitState.outSignature;
120150
120141
  state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
120151
120142
  state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
120143
+ state.buildInfoEmitPending = savedEmitState.buildInfoEmitPending;
120144
+ state.emitDiagnosticsPerFile = savedEmitState.emitDiagnosticsPerFile;
120152
120145
  if (savedEmitState.changedFilesSet)
120153
120146
  state.changedFilesSet = savedEmitState.changedFilesSet;
120154
120147
  }
@@ -120239,6 +120232,22 @@ function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) {
120239
120232
  return { affectedFile, emitKind: pendingKind };
120240
120233
  });
120241
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
+ }
120242
120251
  function removeDiagnosticsOfLibraryFiles(state) {
120243
120252
  if (!state.cleanedDiagnosticsOfLibFiles) {
120244
120253
  state.cleanedDiagnosticsOfLibFiles = true;
@@ -120515,18 +120524,7 @@ function getBuildInfo2(state, bundle) {
120515
120524
  return void 0;
120516
120525
  });
120517
120526
  }
120518
- let semanticDiagnosticsPerFile;
120519
- if (state.semanticDiagnosticsPerFile) {
120520
- for (const key of arrayFrom(state.semanticDiagnosticsPerFile.keys()).sort(compareStringsCaseSensitive)) {
120521
- const value = state.semanticDiagnosticsPerFile.get(key);
120522
- (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(
120523
- value.length ? [
120524
- toFileId(key),
120525
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120526
- ] : toFileId(key)
120527
- );
120528
- }
120529
- }
120527
+ const semanticDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.semanticDiagnosticsPerFile);
120530
120528
  let affectedFilesPendingEmit;
120531
120529
  if ((_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.size) {
120532
120530
  const fullEmitForOptions = getBuilderFileEmit(state.compilerOptions);
@@ -120556,6 +120554,7 @@ function getBuildInfo2(state, bundle) {
120556
120554
  (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120557
120555
  }
120558
120556
  }
120557
+ const emitDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.emitDiagnosticsPerFile);
120559
120558
  const program = {
120560
120559
  fileNames,
120561
120560
  fileInfos,
@@ -120565,6 +120564,7 @@ function getBuildInfo2(state, bundle) {
120565
120564
  referencedMap,
120566
120565
  exportedModulesMap,
120567
120566
  semanticDiagnosticsPerFile,
120567
+ emitDiagnosticsPerFile,
120568
120568
  affectedFilesPendingEmit,
120569
120569
  changeFileSet,
120570
120570
  emitSignatures,
@@ -120621,73 +120621,87 @@ function getBuildInfo2(state, bundle) {
120621
120621
  if (optionInfo == null ? void 0 : optionInfo.affectsBuildInfo) {
120622
120622
  (result || (result = {}))[name] = convertToReusableCompilerOptionValue(
120623
120623
  optionInfo,
120624
- options[name],
120625
- relativeToBuildInfoEnsuringAbsolutePath
120624
+ options[name]
120626
120625
  );
120627
120626
  }
120628
120627
  }
120629
120628
  return result;
120630
120629
  }
120631
- }
120632
- function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120633
- if (option) {
120634
- Debug.assert(option.type !== "listOrElement");
120635
- if (option.type === "list") {
120636
- const values = value;
120637
- if (option.element.isFilePath && values.length) {
120638
- 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);
120639
120640
  }
120640
- } else if (option.isFilePath) {
120641
- return relativeToBuildInfo(value);
120642
120641
  }
120642
+ return value;
120643
120643
  }
120644
- return value;
120645
- }
120646
- function convertToReusableDiagnostics(diagnostics, relativeToBuildInfo) {
120647
- Debug.assert(!!diagnostics.length);
120648
- return diagnostics.map((diagnostic) => {
120649
- const result = convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo);
120650
- result.reportsUnnecessary = diagnostic.reportsUnnecessary;
120651
- result.reportDeprecated = diagnostic.reportsDeprecated;
120652
- result.source = diagnostic.source;
120653
- result.skippedOn = diagnostic.skippedOn;
120654
- const { relatedInformation } = diagnostic;
120655
- 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
+ }
120656
120657
  return result;
120657
- });
120658
- }
120659
- function convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo) {
120660
- const { file } = diagnostic;
120661
- return {
120662
- ...diagnostic,
120663
- file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
120664
- messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
120665
- };
120666
- }
120667
- function convertToReusableDiagnosticMessageChain(chain) {
120668
- 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;
120669
120674
  return {
120670
- info: chain.repopulateInfo(),
120671
- next: convertToReusableDiagnosticMessageChainArray(chain.next)
120675
+ ...diagnostic,
120676
+ file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
120677
+ messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
120672
120678
  };
120673
120679
  }
120674
- const next = convertToReusableDiagnosticMessageChainArray(chain.next);
120675
- return next === chain.next ? chain : { ...chain, next };
120676
- }
120677
- function convertToReusableDiagnosticMessageChainArray(array) {
120678
- if (!array)
120679
- return array;
120680
- return forEach(array, (chain, index) => {
120681
- const reusable = convertToReusableDiagnosticMessageChain(chain);
120682
- if (chain === reusable)
120683
- return void 0;
120684
- const result = index > 0 ? array.slice(0, index - 1) : [];
120685
- result.push(reusable);
120686
- for (let i = index + 1; i < array.length; i++) {
120687
- 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
+ };
120688
120686
  }
120689
- return result;
120690
- }) || 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
+ }
120691
120705
  }
120692
120706
  function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
120693
120707
  let host;
@@ -120796,6 +120810,14 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
120796
120810
  if (!outFile(state.compilerOptions)) {
120797
120811
  const pendingAffectedFile = getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles);
120798
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
+ }
120799
120821
  if (!state.buildInfoEmitPending)
120800
120822
  return void 0;
120801
120823
  const affected2 = state.program;
@@ -120844,6 +120866,8 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
120844
120866
  (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, pendingKind);
120845
120867
  else
120846
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);
120847
120871
  } else {
120848
120872
  state.changedFilesSet.clear();
120849
120873
  }
@@ -121016,9 +121040,10 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
121016
121040
  }
121017
121041
  }
121018
121042
  function addToAffectedFilesPendingEmit(state, affectedFilePendingEmit, kind) {
121019
- var _a;
121043
+ var _a, _b;
121020
121044
  const existingKind = ((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.get(affectedFilePendingEmit)) || 0 /* None */;
121021
121045
  (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedFilePendingEmit, existingKind | kind);
121046
+ (_b = state.emitDiagnosticsPerFile) == null ? void 0 : _b.delete(affectedFilePendingEmit);
121022
121047
  }
121023
121048
  function toBuilderStateFileInfoForMultiEmit(fileInfo) {
121024
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 };
@@ -121083,7 +121108,8 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
121083
121108
  compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121084
121109
  referencedMap: toManyToManyPathMap(program.referencedMap),
121085
121110
  exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121086
- 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),
121087
121113
  hasReusableDiagnostic: true,
121088
121114
  affectedFilesPendingEmit: program.affectedFilesPendingEmit && arrayToMap(program.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
121089
121115
  changedFilesSet: new Set(map(program.changeFileSet, toFilePath)),
@@ -121136,6 +121162,9 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
121136
121162
  referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
121137
121163
  return map2;
121138
121164
  }
121165
+ function toPerFileDiagnostics(diagnostics) {
121166
+ return diagnostics && arrayToMap(diagnostics, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => isNumber(value) ? emptyArray : value[1]);
121167
+ }
121139
121168
  }
121140
121169
  function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
121141
121170
  const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
@@ -124720,7 +124749,7 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
124720
124749
  }
124721
124750
  }
124722
124751
  function getUpToDateStatusWorker(state, project, resolvedPath) {
124723
- var _a, _b;
124752
+ var _a, _b, _c;
124724
124753
  if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
124725
124754
  return {
124726
124755
  type: 16 /* ContainerOnly */
@@ -124794,7 +124823,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
124794
124823
  };
124795
124824
  }
124796
124825
  if (buildInfo.program) {
124797
- 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))) {
124798
124827
  return {
124799
124828
  type: 8 /* OutOfDateBuildInfo */,
124800
124829
  buildInfoFile: buildInfoPath