@typescript-deploys/pr-build 5.6.0-pr-57196-3 → 5.6.0-pr-58760-2

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 +258 -154
  2. package/lib/typescript.js +283 -227
  3. package/package.json +1 -1
package/lib/tsc.js CHANGED
@@ -19329,6 +19329,12 @@ function unwrapParenthesizedExpression(o) {
19329
19329
  }
19330
19330
  return o;
19331
19331
  }
19332
+ function unwrapParenthesizedType(o) {
19333
+ while (o.kind === 196 /* ParenthesizedType */) {
19334
+ o = o.type;
19335
+ }
19336
+ return o;
19337
+ }
19332
19338
  function hasInferredType(node) {
19333
19339
  Debug.type(node);
19334
19340
  switch (node.kind) {
@@ -51615,6 +51621,57 @@ function createTypeChecker(host) {
51615
51621
  function onEnterNewScope(node) {
51616
51622
  return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
51617
51623
  }
51624
+ function tryVisitSimpleTypeNode(node) {
51625
+ const innerNode = unwrapParenthesizedType(node);
51626
+ switch (innerNode.kind) {
51627
+ case 183 /* TypeReference */:
51628
+ return tryVisitTypeReference(innerNode);
51629
+ case 186 /* TypeQuery */:
51630
+ return tryVisitTypeQuery(innerNode);
51631
+ case 199 /* IndexedAccessType */:
51632
+ return tryVisitIndexedAccess(innerNode);
51633
+ case 198 /* TypeOperator */:
51634
+ const typeOperatorNode = innerNode;
51635
+ if (typeOperatorNode.operator === 143 /* KeyOfKeyword */) {
51636
+ return tryVisitKeyOf(typeOperatorNode);
51637
+ }
51638
+ }
51639
+ return visitNode(node, visitExistingNodeTreeSymbols, isTypeNode);
51640
+ }
51641
+ function tryVisitIndexedAccess(node) {
51642
+ const resultObjectType = tryVisitSimpleTypeNode(node.objectType);
51643
+ if (resultObjectType === void 0) {
51644
+ return void 0;
51645
+ }
51646
+ return factory.updateIndexedAccessTypeNode(node, resultObjectType, visitNode(node.indexType, visitExistingNodeTreeSymbols, isTypeNode));
51647
+ }
51648
+ function tryVisitKeyOf(node) {
51649
+ Debug.assertEqual(node.operator, 143 /* KeyOfKeyword */);
51650
+ const type = tryVisitSimpleTypeNode(node.type);
51651
+ if (type === void 0) {
51652
+ return void 0;
51653
+ }
51654
+ return factory.updateTypeOperatorNode(node, type);
51655
+ }
51656
+ function tryVisitTypeQuery(node) {
51657
+ const { introducesError, node: exprName } = trackExistingEntityName(node.exprName, context);
51658
+ if (!introducesError) {
51659
+ return factory.updateTypeQueryNode(
51660
+ node,
51661
+ exprName,
51662
+ visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode)
51663
+ );
51664
+ }
51665
+ const serializedName = serializeTypeName(
51666
+ context,
51667
+ node.exprName,
51668
+ /*isTypeOf*/
51669
+ true
51670
+ );
51671
+ if (serializedName) {
51672
+ return setTextRange2(context, serializedName, node.exprName);
51673
+ }
51674
+ }
51618
51675
  function tryVisitTypeReference(node) {
51619
51676
  if (canReuseTypeNode(context, node)) {
51620
51677
  const { introducesError, node: newName } = trackExistingEntityName(node.typeName, context);
@@ -51748,13 +51805,13 @@ function createTypeChecker(host) {
51748
51805
  visitNode(node.default, visitExistingNodeTreeSymbols, isTypeNode)
51749
51806
  );
51750
51807
  }
51751
- if (isIndexedAccessTypeNode(node) && isTypeReferenceNode(node.objectType)) {
51752
- const objectType = tryVisitTypeReference(node.objectType);
51753
- if (!objectType) {
51808
+ if (isIndexedAccessTypeNode(node)) {
51809
+ const result = tryVisitIndexedAccess(node);
51810
+ if (!result) {
51754
51811
  hadError = true;
51755
51812
  return node;
51756
51813
  }
51757
- return factory.updateIndexedAccessTypeNode(node, objectType, visitNode(node.indexType, visitExistingNodeTreeSymbols, isTypeNode));
51814
+ return result;
51758
51815
  }
51759
51816
  if (isTypeReferenceNode(node)) {
51760
51817
  const result = tryVisitTypeReference(node);
@@ -51797,25 +51854,12 @@ function createTypeChecker(host) {
51797
51854
  return visited;
51798
51855
  }
51799
51856
  if (isTypeQueryNode(node)) {
51800
- const { introducesError, node: exprName } = trackExistingEntityName(node.exprName, context);
51801
- if (introducesError) {
51802
- const serializedName = serializeTypeName(
51803
- context,
51804
- node.exprName,
51805
- /*isTypeOf*/
51806
- true
51807
- );
51808
- if (serializedName) {
51809
- return setTextRange2(context, serializedName, node.exprName);
51810
- }
51857
+ const result = tryVisitTypeQuery(node);
51858
+ if (!result) {
51811
51859
  hadError = true;
51812
51860
  return node;
51813
51861
  }
51814
- return factory.updateTypeQueryNode(
51815
- node,
51816
- exprName,
51817
- visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode)
51818
- );
51862
+ return result;
51819
51863
  }
51820
51864
  if (isComputedPropertyName(node) && isEntityNameExpression(node.expression)) {
51821
51865
  const { node: result, introducesError } = trackExistingEntityName(node.expression, context);
@@ -51880,14 +51924,12 @@ function createTypeChecker(host) {
51880
51924
  return node;
51881
51925
  }
51882
51926
  } else if (node.operator === 143 /* KeyOfKeyword */) {
51883
- if (isTypeReferenceNode(node.type)) {
51884
- const type = tryVisitTypeReference(node.type);
51885
- if (!type) {
51886
- hadError = true;
51887
- return node;
51888
- }
51889
- return factory.updateTypeOperatorNode(node, type);
51927
+ const result = tryVisitKeyOf(node);
51928
+ if (!result) {
51929
+ hadError = true;
51930
+ return node;
51890
51931
  }
51932
+ return result;
51891
51933
  }
51892
51934
  }
51893
51935
  return visitEachChild2(node, visitExistingNodeTreeSymbols);
@@ -112755,16 +112797,16 @@ function isBuildInfoFile(file) {
112755
112797
  function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDtsEmit = false, onlyBuildInfo, includeBuildInfo) {
112756
112798
  const sourceFiles = isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile, forceDtsEmit);
112757
112799
  const options = host.getCompilerOptions();
112758
- if (options.outFile) {
112759
- if (sourceFiles.length) {
112760
- const bundle = factory.createBundle(sourceFiles);
112761
- const result = action(getOutputPathsFor(bundle, host, forceDtsEmit), bundle);
112762
- if (result) {
112763
- return result;
112800
+ if (!onlyBuildInfo) {
112801
+ if (options.outFile) {
112802
+ if (sourceFiles.length) {
112803
+ const bundle = factory.createBundle(sourceFiles);
112804
+ const result = action(getOutputPathsFor(bundle, host, forceDtsEmit), bundle);
112805
+ if (result) {
112806
+ return result;
112807
+ }
112764
112808
  }
112765
- }
112766
- } else {
112767
- if (!onlyBuildInfo) {
112809
+ } else {
112768
112810
  for (const sourceFile of sourceFiles) {
112769
112811
  const result = action(getOutputPathsFor(sourceFile, host, forceDtsEmit), sourceFile);
112770
112812
  if (result) {
@@ -112772,14 +112814,14 @@ function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDt
112772
112814
  }
112773
112815
  }
112774
112816
  }
112775
- if (includeBuildInfo) {
112776
- const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
112777
- if (buildInfoPath) return action(
112778
- { buildInfoPath },
112779
- /*sourceFileOrBundle*/
112780
- void 0
112781
- );
112782
- }
112817
+ }
112818
+ if (includeBuildInfo) {
112819
+ const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
112820
+ if (buildInfoPath) return action(
112821
+ { buildInfoPath },
112822
+ /*sourceFileOrBundle*/
112823
+ void 0
112824
+ );
112783
112825
  }
112784
112826
  }
112785
112827
  function getTsBuildInfoEmitOutputFilePath(options) {
@@ -112808,8 +112850,7 @@ function getOutputPathsForBundle(options, forceDtsPaths) {
112808
112850
  const sourceMapFilePath = jsFilePath && getSourceMapFilePath(jsFilePath, options);
112809
112851
  const declarationFilePath = forceDtsPaths || getEmitDeclarations(options) ? removeFileExtension(outPath) + ".d.ts" /* Dts */ : void 0;
112810
112852
  const declarationMapPath = declarationFilePath && getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : void 0;
112811
- const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
112812
- return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath };
112853
+ return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath };
112813
112854
  }
112814
112855
  function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
112815
112856
  const options = host.getCompilerOptions();
@@ -112823,7 +112864,7 @@ function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
112823
112864
  const sourceMapFilePath = !jsFilePath || isJsonSourceFile(sourceFile) ? void 0 : getSourceMapFilePath(jsFilePath, options);
112824
112865
  const declarationFilePath = forceDtsPaths || getEmitDeclarations(options) && !isJsonFile ? getDeclarationEmitOutputFilePath(sourceFile.fileName, host) : void 0;
112825
112866
  const declarationMapPath = declarationFilePath && getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : void 0;
112826
- return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath: void 0 };
112867
+ return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath };
112827
112868
  }
112828
112869
  }
112829
112870
  function getSourceMapFilePath(jsFilePath, options) {
@@ -112872,7 +112913,7 @@ function createAddOutput() {
112872
112913
  }
112873
112914
  }
112874
112915
  function getSingleOutputFileNames(configFile, addOutput) {
112875
- const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath } = getOutputPathsForBundle(
112916
+ const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath } = getOutputPathsForBundle(
112876
112917
  configFile.options,
112877
112918
  /*forceDtsPaths*/
112878
112919
  false
@@ -112881,7 +112922,6 @@ function getSingleOutputFileNames(configFile, addOutput) {
112881
112922
  addOutput(sourceMapFilePath);
112882
112923
  addOutput(declarationFilePath);
112883
112924
  addOutput(declarationMapPath);
112884
- addOutput(buildInfoPath);
112885
112925
  }
112886
112926
  function getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory2) {
112887
112927
  if (isDeclarationFileName(inputFileName)) return;
@@ -112932,8 +112972,8 @@ function getAllProjectOutputs(configFile, ignoreCase) {
112932
112972
  for (const inputFileName of configFile.fileNames) {
112933
112973
  getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory2);
112934
112974
  }
112935
- addOutput(getTsBuildInfoEmitOutputFilePath(configFile.options));
112936
112975
  }
112976
+ addOutput(getTsBuildInfoEmitOutputFilePath(configFile.options));
112937
112977
  return getOutputs();
112938
112978
  }
112939
112979
  function getFirstProjectOutput(configFile, ignoreCase) {
@@ -112962,7 +113002,7 @@ function getFirstProjectOutput(configFile, ignoreCase) {
112962
113002
  function emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit) {
112963
113003
  return !!forceDtsEmit && !!emitOnly;
112964
113004
  }
112965
- function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit) {
113005
+ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit, skipBuildInfo) {
112966
113006
  var compilerOptions = host.getCompilerOptions();
112967
113007
  var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0;
112968
113008
  var emittedFilesList = compilerOptions.listEmittedFiles ? [] : void 0;
@@ -112978,7 +113018,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
112978
113018
  getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit),
112979
113019
  forceDtsEmit,
112980
113020
  onlyBuildInfo,
112981
- !targetSourceFile
113021
+ !targetSourceFile && !skipBuildInfo
112982
113022
  );
112983
113023
  exit();
112984
113024
  return {
@@ -113000,7 +113040,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
113000
113040
  (_f = tracing) == null ? void 0 : _f.pop();
113001
113041
  }
113002
113042
  function emitBuildInfo(buildInfoPath) {
113003
- if (!buildInfoPath || targetSourceFile || emitSkipped) return;
113043
+ if (!buildInfoPath || targetSourceFile) return;
113004
113044
  if (host.isEmitBlocked(buildInfoPath)) {
113005
113045
  emitSkipped = true;
113006
113046
  return;
@@ -119953,7 +119993,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119953
119993
  }
119954
119994
  function emitBuildInfo(writeFileCallback) {
119955
119995
  var _a2, _b2;
119956
- Debug.assert(!options.outFile);
119957
119996
  (_a2 = tracing) == null ? void 0 : _a2.push(
119958
119997
  tracing.Phase.Emit,
119959
119998
  "emitBuildInfo",
@@ -120008,7 +120047,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120008
120047
  function getTypeChecker() {
120009
120048
  return typeChecker || (typeChecker = createTypeChecker(program));
120010
120049
  }
120011
- function emit(sourceFile, writeFileCallback, cancellationToken, emitOnly, transformers, forceDtsEmit) {
120050
+ function emit(sourceFile, writeFileCallback, cancellationToken, emitOnly, transformers, forceDtsEmit, skipBuildInfo) {
120012
120051
  var _a2, _b2;
120013
120052
  (_a2 = tracing) == null ? void 0 : _a2.push(
120014
120053
  tracing.Phase.Emit,
@@ -120017,14 +120056,25 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120017
120056
  /*separateBeginAndEnd*/
120018
120057
  true
120019
120058
  );
120020
- const result = runWithCancellationToken(() => emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnly, transformers, forceDtsEmit));
120059
+ const result = runWithCancellationToken(
120060
+ () => emitWorker(
120061
+ program,
120062
+ sourceFile,
120063
+ writeFileCallback,
120064
+ cancellationToken,
120065
+ emitOnly,
120066
+ transformers,
120067
+ forceDtsEmit,
120068
+ skipBuildInfo
120069
+ )
120070
+ );
120021
120071
  (_b2 = tracing) == null ? void 0 : _b2.pop();
120022
120072
  return result;
120023
120073
  }
120024
120074
  function isEmitBlocked(emitFileName) {
120025
120075
  return hasEmitBlockingDiagnostics.has(toPath3(emitFileName));
120026
120076
  }
120027
- function emitWorker(program2, sourceFile, writeFileCallback, cancellationToken, emitOnly, customTransformers, forceDtsEmit) {
120077
+ function emitWorker(program2, sourceFile, writeFileCallback, cancellationToken, emitOnly, customTransformers, forceDtsEmit, skipBuildInfo) {
120028
120078
  if (!forceDtsEmit) {
120029
120079
  const result = handleNoEmitOptions(program2, sourceFile, writeFileCallback, cancellationToken);
120030
120080
  if (result) return result;
@@ -120046,7 +120096,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120046
120096
  emitOnly,
120047
120097
  /*onlyBuildInfo*/
120048
120098
  false,
120049
- forceDtsEmit
120099
+ forceDtsEmit,
120100
+ skipBuildInfo
120050
120101
  )
120051
120102
  );
120052
120103
  mark("afterEmit");
@@ -122178,7 +122229,7 @@ function handleNoEmitOptions(program, sourceFile, writeFile2, cancellationToken)
122178
122229
  const options = program.getCompilerOptions();
122179
122230
  if (options.noEmit) {
122180
122231
  program.getSemanticDiagnostics(sourceFile, cancellationToken);
122181
- return sourceFile || options.outFile ? emitSkippedWithNoDiagnostics : program.emitBuildInfo(writeFile2, cancellationToken);
122232
+ return sourceFile ? emitSkippedWithNoDiagnostics : program.emitBuildInfo(writeFile2, cancellationToken);
122182
122233
  }
122183
122234
  if (!options.noEmitOnError) return void 0;
122184
122235
  let diagnostics = [
@@ -122196,7 +122247,7 @@ function handleNoEmitOptions(program, sourceFile, writeFile2, cancellationToken)
122196
122247
  }
122197
122248
  if (!diagnostics.length) return void 0;
122198
122249
  let emittedFiles;
122199
- if (!sourceFile && !options.outFile) {
122250
+ if (!sourceFile) {
122200
122251
  const emitResult = program.emitBuildInfo(writeFile2, cancellationToken);
122201
122252
  if (emitResult.diagnostics) diagnostics = [...diagnostics, ...emitResult.diagnostics];
122202
122253
  emittedFiles = emitResult.emittedFiles;
@@ -122678,17 +122729,17 @@ function createBuilderProgramState(newProgram, oldState) {
122678
122729
  const compilerOptions = newProgram.getCompilerOptions();
122679
122730
  state.compilerOptions = compilerOptions;
122680
122731
  const outFilePath = compilerOptions.outFile;
122681
- if (!outFilePath) {
122682
- state.semanticDiagnosticsPerFile = /* @__PURE__ */ new Map();
122683
- } else if (compilerOptions.composite && (oldState == null ? void 0 : oldState.outSignature) && outFilePath === oldState.compilerOptions.outFile) {
122732
+ state.semanticDiagnosticsPerFile = /* @__PURE__ */ new Map();
122733
+ if (outFilePath && compilerOptions.composite && (oldState == null ? void 0 : oldState.outSignature) && outFilePath === oldState.compilerOptions.outFile) {
122684
122734
  state.outSignature = oldState.outSignature && getEmitSignatureFromOldSignature(compilerOptions, oldState.compilerOptions, oldState.outSignature);
122685
122735
  }
122686
122736
  state.changedFilesSet = /* @__PURE__ */ new Set();
122687
122737
  state.latestChangedDtsFile = compilerOptions.composite ? oldState == null ? void 0 : oldState.latestChangedDtsFile : void 0;
122688
122738
  const useOldState = BuilderState.canReuseOldState(state.referencedMap, oldState);
122689
122739
  const oldCompilerOptions = useOldState ? oldState.compilerOptions : void 0;
122690
- const canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile && !compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
122740
+ let canCopySemanticDiagnostics = useOldState && !compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
122691
122741
  const canCopyEmitSignatures = compilerOptions.composite && (oldState == null ? void 0 : oldState.emitSignatures) && !outFilePath && !compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions);
122742
+ let canCopyEmitDiagnostics = true;
122692
122743
  if (useOldState) {
122693
122744
  (_a = oldState.changedFilesSet) == null ? void 0 : _a.forEach((value) => state.changedFilesSet.add(value));
122694
122745
  if (!outFilePath && ((_b = oldState.affectedFilesPendingEmit) == null ? void 0 : _b.size)) {
@@ -122696,6 +122747,10 @@ function createBuilderProgramState(newProgram, oldState) {
122696
122747
  state.seenAffectedFiles = /* @__PURE__ */ new Set();
122697
122748
  }
122698
122749
  state.programEmitPending = oldState.programEmitPending;
122750
+ if (outFilePath && state.changedFilesSet.size) {
122751
+ canCopySemanticDiagnostics = false;
122752
+ canCopyEmitDiagnostics = false;
122753
+ }
122699
122754
  } else {
122700
122755
  state.buildInfoEmitPending = true;
122701
122756
  }
@@ -122713,10 +122768,10 @@ function createBuilderProgramState(newProgram, oldState) {
122713
122768
  oldInfo.impliedFormat !== info.impliedFormat || // Referenced files changed
122714
122769
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) || // Referenced file was deleted in the new program
122715
122770
  newReferences && forEachKey(newReferences, (path) => !state.fileInfos.has(path) && oldState.fileInfos.has(path))) {
122716
- addFileToChangeSet(state, sourceFilePath);
122771
+ addFileToChangeSet(sourceFilePath);
122717
122772
  } else {
122718
122773
  const sourceFile = newProgram.getSourceFileByPath(sourceFilePath);
122719
- const emitDiagnostics = (_a2 = oldState.emitDiagnosticsPerFile) == null ? void 0 : _a2.get(sourceFilePath);
122774
+ const emitDiagnostics = canCopyEmitDiagnostics ? (_a2 = oldState.emitDiagnosticsPerFile) == null ? void 0 : _a2.get(sourceFilePath) : void 0;
122720
122775
  if (emitDiagnostics) {
122721
122776
  (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(
122722
122777
  sourceFilePath,
@@ -122745,16 +122800,16 @@ function createBuilderProgramState(newProgram, oldState) {
122745
122800
  });
122746
122801
  if (useOldState && forEachEntry(oldState.fileInfos, (info, sourceFilePath) => {
122747
122802
  if (state.fileInfos.has(sourceFilePath)) return false;
122748
- if (outFilePath || info.affectsGlobalScope) return true;
122803
+ if (info.affectsGlobalScope) return true;
122749
122804
  state.buildInfoEmitPending = true;
122750
- return false;
122805
+ return !!outFilePath;
122751
122806
  })) {
122752
122807
  BuilderState.getAllFilesExcludingDefaultLibraryFile(
122753
122808
  state,
122754
122809
  newProgram,
122755
122810
  /*firstSourceFile*/
122756
122811
  void 0
122757
- ).forEach((file) => addFileToChangeSet(state, file.resolvedPath));
122812
+ ).forEach((file) => addFileToChangeSet(file.resolvedPath));
122758
122813
  } else if (oldCompilerOptions) {
122759
122814
  const pendingEmitKind = compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions) ? getBuilderFileEmit(compilerOptions) : getPendingEmitKind(compilerOptions, oldCompilerOptions);
122760
122815
  if (pendingEmitKind !== 0 /* None */) {
@@ -122770,18 +122825,25 @@ function createBuilderProgramState(newProgram, oldState) {
122770
122825
  });
122771
122826
  Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
122772
122827
  state.seenAffectedFiles = state.seenAffectedFiles || /* @__PURE__ */ new Set();
122773
- state.buildInfoEmitPending = true;
122774
- } else {
122828
+ } else if (!state.changedFilesSet.size) {
122775
122829
  state.programEmitPending = state.programEmitPending ? state.programEmitPending | pendingEmitKind : pendingEmitKind;
122776
122830
  }
122831
+ state.buildInfoEmitPending = true;
122777
122832
  }
122778
122833
  }
122779
122834
  return state;
122780
- }
122781
- function addFileToChangeSet(state, path) {
122782
- state.changedFilesSet.add(path);
122783
- state.buildInfoEmitPending = true;
122784
- state.programEmitPending = void 0;
122835
+ function addFileToChangeSet(path) {
122836
+ state.changedFilesSet.add(path);
122837
+ if (outFilePath) {
122838
+ canCopySemanticDiagnostics = false;
122839
+ canCopyEmitDiagnostics = false;
122840
+ state.semanticDiagnosticsFromOldState = void 0;
122841
+ state.semanticDiagnosticsPerFile.clear();
122842
+ state.emitDiagnosticsPerFile = void 0;
122843
+ }
122844
+ state.buildInfoEmitPending = true;
122845
+ state.programEmitPending = void 0;
122846
+ }
122785
122847
  }
122786
122848
  function getEmitSignatureFromOldSignature(options, oldOptions, oldEmitSignature) {
122787
122849
  return !!options.declarationMap === !!oldOptions.declarationMap ? (
@@ -122854,6 +122916,7 @@ function backupBuilderProgramEmitState(state) {
122854
122916
  return {
122855
122917
  affectedFilesPendingEmit: state.affectedFilesPendingEmit && new Map(state.affectedFilesPendingEmit),
122856
122918
  seenEmittedFiles: state.seenEmittedFiles && new Map(state.seenEmittedFiles),
122919
+ seenProgramEmit: state.seenProgramEmit,
122857
122920
  programEmitPending: state.programEmitPending,
122858
122921
  emitSignatures: state.emitSignatures && new Map(state.emitSignatures),
122859
122922
  outSignature: state.outSignature,
@@ -122867,6 +122930,7 @@ function backupBuilderProgramEmitState(state) {
122867
122930
  function restoreBuilderProgramEmitState(state, savedEmitState) {
122868
122931
  state.affectedFilesPendingEmit = savedEmitState.affectedFilesPendingEmit;
122869
122932
  state.seenEmittedFiles = savedEmitState.seenEmittedFiles;
122933
+ state.seenProgramEmit = savedEmitState.seenProgramEmit;
122870
122934
  state.programEmitPending = savedEmitState.programEmitPending;
122871
122935
  state.emitSignatures = savedEmitState.emitSignatures;
122872
122936
  state.outSignature = savedEmitState.outSignature;
@@ -122875,6 +122939,10 @@ function restoreBuilderProgramEmitState(state, savedEmitState) {
122875
122939
  state.buildInfoEmitPending = savedEmitState.buildInfoEmitPending;
122876
122940
  state.emitDiagnosticsPerFile = savedEmitState.emitDiagnosticsPerFile;
122877
122941
  if (savedEmitState.changedFilesSet) state.changedFilesSet = savedEmitState.changedFilesSet;
122942
+ if (state.compilerOptions.outFile && state.changedFilesSet.size) {
122943
+ state.semanticDiagnosticsPerFile.clear();
122944
+ state.emitDiagnosticsPerFile = void 0;
122945
+ }
122878
122946
  }
122879
122947
  function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
122880
122948
  Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
@@ -122912,10 +122980,7 @@ function getNextAffectedFile(state, cancellationToken, host) {
122912
122980
  }
122913
122981
  const program = Debug.checkDefined(state.program);
122914
122982
  const compilerOptions = program.getCompilerOptions();
122915
- if (compilerOptions.outFile) {
122916
- Debug.assert(!state.semanticDiagnosticsPerFile);
122917
- return program;
122918
- }
122983
+ if (compilerOptions.outFile) return program;
122919
122984
  state.affectedFiles = BuilderState.getFilesAffectedByWithOldState(
122920
122985
  state,
122921
122986
  program,
@@ -122929,14 +122994,22 @@ function getNextAffectedFile(state, cancellationToken, host) {
122929
122994
  }
122930
122995
  }
122931
122996
  function clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles) {
122932
- var _a;
122933
- if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size)) return;
122934
- if (!emitOnlyDtsFiles) return state.affectedFilesPendingEmit = void 0;
122935
- state.affectedFilesPendingEmit.forEach((emitKind, path) => {
122997
+ var _a, _b;
122998
+ if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size) && !state.programEmitPending) return;
122999
+ if (!emitOnlyDtsFiles) {
123000
+ state.affectedFilesPendingEmit = void 0;
123001
+ state.programEmitPending = void 0;
123002
+ }
123003
+ (_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.forEach((emitKind, path) => {
122936
123004
  const pending = emitKind & 7 /* AllJs */;
122937
123005
  if (!pending) state.affectedFilesPendingEmit.delete(path);
122938
123006
  else state.affectedFilesPendingEmit.set(path, pending);
122939
123007
  });
123008
+ if (state.programEmitPending) {
123009
+ const pending = state.programEmitPending & 7 /* AllJs */;
123010
+ if (!pending) state.programEmitPending = void 0;
123011
+ else state.programEmitPending = pending;
123012
+ }
122940
123013
  }
122941
123014
  function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) {
122942
123015
  var _a;
@@ -123128,24 +123201,21 @@ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, invalidateJsF
123128
123201
  );
123129
123202
  return void 0;
123130
123203
  }
123131
- function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken) {
123204
+ function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile) {
123132
123205
  return concatenate(
123133
- getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken),
123206
+ getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile),
123134
123207
  Debug.checkDefined(state.program).getProgramDiagnostics(sourceFile)
123135
123208
  );
123136
123209
  }
123137
- function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken) {
123210
+ function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile) {
123211
+ semanticDiagnosticsPerFile ?? (semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile);
123138
123212
  const path = sourceFile.resolvedPath;
123139
- if (state.semanticDiagnosticsPerFile) {
123140
- const cachedDiagnostics = state.semanticDiagnosticsPerFile.get(path);
123141
- if (cachedDiagnostics) {
123142
- return filterSemanticDiagnostics(cachedDiagnostics, state.compilerOptions);
123143
- }
123213
+ const cachedDiagnostics = semanticDiagnosticsPerFile.get(path);
123214
+ if (cachedDiagnostics) {
123215
+ return filterSemanticDiagnostics(cachedDiagnostics, state.compilerOptions);
123144
123216
  }
123145
123217
  const diagnostics = Debug.checkDefined(state.program).getBindAndCheckDiagnostics(sourceFile, cancellationToken);
123146
- if (state.semanticDiagnosticsPerFile) {
123147
- state.semanticDiagnosticsPerFile.set(path, diagnostics);
123148
- }
123218
+ semanticDiagnosticsPerFile.set(path, diagnostics);
123149
123219
  return filterSemanticDiagnostics(diagnostics, state.compilerOptions);
123150
123220
  }
123151
123221
  function isProgramBundleEmitBuildInfo(info) {
@@ -123173,6 +123243,9 @@ function getBuildInfo2(state) {
123173
123243
  root,
123174
123244
  resolvedRoot: toResolvedRoot(),
123175
123245
  options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
123246
+ semanticDiagnosticsPerFile: convertToProgramBuildInfoDiagnostics(),
123247
+ emitDiagnosticsPerFile: convertToProgramBuildInfoEmitDiagnostics(),
123248
+ changeFileSet: toChangeFileSet(),
123176
123249
  outSignature: state.outSignature,
123177
123250
  latestChangedDtsFile,
123178
123251
  pendingEmit: !state.programEmitPending ? void 0 : (
@@ -123263,13 +123336,6 @@ function getBuildInfo2(state) {
123263
123336
  }
123264
123337
  }
123265
123338
  }
123266
- let changeFileSet;
123267
- if (state.changedFilesSet.size) {
123268
- for (const path of arrayFrom(state.changedFilesSet.keys()).sort(compareStringsCaseSensitive)) {
123269
- changeFileSet = append(changeFileSet, toFileId(path));
123270
- }
123271
- }
123272
- const emitDiagnosticsPerFile = convertToProgramBuildInfoEmitDiagnostics();
123273
123339
  const program = {
123274
123340
  fileNames,
123275
123341
  fileInfos,
@@ -123279,9 +123345,9 @@ function getBuildInfo2(state) {
123279
123345
  fileIdsList,
123280
123346
  referencedMap,
123281
123347
  semanticDiagnosticsPerFile,
123282
- emitDiagnosticsPerFile,
123348
+ emitDiagnosticsPerFile: convertToProgramBuildInfoEmitDiagnostics(),
123283
123349
  affectedFilesPendingEmit,
123284
- changeFileSet,
123350
+ changeFileSet: toChangeFileSet(),
123285
123351
  emitSignatures,
123286
123352
  latestChangedDtsFile
123287
123353
  };
@@ -123364,8 +123430,7 @@ function getBuildInfo2(state) {
123364
123430
  function convertToProgramBuildInfoDiagnostics() {
123365
123431
  let result;
123366
123432
  state.fileInfos.forEach((_value, key) => {
123367
- var _a2;
123368
- const value = (_a2 = state.semanticDiagnosticsPerFile) == null ? void 0 : _a2.get(key);
123433
+ const value = state.semanticDiagnosticsPerFile.get(key);
123369
123434
  if (!value) {
123370
123435
  if (!state.changedFilesSet.has(key)) result = append(result, toFileId(key));
123371
123436
  } else if (value.length) {
@@ -123434,6 +123499,15 @@ function getBuildInfo2(state) {
123434
123499
  return result;
123435
123500
  }) || array;
123436
123501
  }
123502
+ function toChangeFileSet() {
123503
+ let changeFileSet;
123504
+ if (state.changedFilesSet.size) {
123505
+ for (const path of arrayFrom(state.changedFilesSet.keys()).sort(compareStringsCaseSensitive)) {
123506
+ changeFileSet = append(changeFileSet, toFileId(path));
123507
+ }
123508
+ }
123509
+ return changeFileSet;
123510
+ }
123437
123511
  }
123438
123512
  function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
123439
123513
  let host;
@@ -123532,14 +123606,16 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123532
123606
  return emitSkippedWithNoDiagnostics;
123533
123607
  }
123534
123608
  function emitNextAffectedFile(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
123535
- var _a, _b, _c;
123609
+ var _a, _b, _c, _d;
123536
123610
  let affected = getNextAffectedFile(state, cancellationToken, host);
123537
123611
  const programEmitKind = getBuilderFileEmit(state.compilerOptions);
123538
123612
  let emitKind = emitOnlyDtsFiles ? programEmitKind & 24 /* AllDts */ : programEmitKind;
123539
123613
  if (!affected) {
123540
123614
  if (!state.compilerOptions.outFile) {
123541
123615
  const pendingAffectedFile = getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles);
123542
- if (!pendingAffectedFile) {
123616
+ if (pendingAffectedFile) {
123617
+ ({ affectedFile: affected, emitKind } = pendingAffectedFile);
123618
+ } else {
123543
123619
  const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(state);
123544
123620
  if (pendingForDiagnostics) {
123545
123621
  (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(pendingForDiagnostics.affectedFile.resolvedPath, pendingForDiagnostics.seenKind | 24 /* AllDts */);
@@ -123548,48 +123624,73 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123548
123624
  affected: pendingForDiagnostics.affectedFile
123549
123625
  };
123550
123626
  }
123551
- if (!state.buildInfoEmitPending) return void 0;
123552
- const affected2 = state.program;
123553
- const result2 = affected2.emitBuildInfo(writeFile2 || maybeBind(host, host.writeFile), cancellationToken);
123554
- state.buildInfoEmitPending = false;
123555
- return { result: result2, affected: affected2 };
123556
123627
  }
123557
- ({ affectedFile: affected, emitKind } = pendingAffectedFile);
123558
123628
  } else {
123559
- if (!state.programEmitPending) return void 0;
123560
- emitKind = state.programEmitPending;
123561
- if (emitOnlyDtsFiles) emitKind = emitKind & 24 /* AllDts */;
123562
- if (!emitKind) return void 0;
123563
- affected = state.program;
123629
+ if (state.programEmitPending) {
123630
+ emitKind = state.programEmitPending;
123631
+ if (emitOnlyDtsFiles) emitKind = emitKind & 24 /* AllDts */;
123632
+ if (emitKind) affected = state.program;
123633
+ }
123634
+ if (!affected && ((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size)) {
123635
+ const seenKind = state.seenProgramEmit || 0 /* None */;
123636
+ if (!(seenKind & 24 /* AllDts */)) {
123637
+ state.seenProgramEmit = 24 /* AllDts */ | seenKind;
123638
+ const diagnostics = [];
123639
+ state.emitDiagnosticsPerFile.forEach((d) => addRange(diagnostics, d));
123640
+ return {
123641
+ result: { emitSkipped: true, diagnostics },
123642
+ affected: state.program
123643
+ };
123644
+ }
123645
+ }
123646
+ }
123647
+ if (!affected) {
123648
+ if (!state.buildInfoEmitPending) return void 0;
123649
+ const affected2 = state.program;
123650
+ const result2 = affected2.emitBuildInfo(writeFile2 || maybeBind(host, host.writeFile), cancellationToken);
123651
+ state.buildInfoEmitPending = false;
123652
+ return { result: result2, affected: affected2 };
123564
123653
  }
123565
123654
  }
123566
123655
  let emitOnly;
123567
123656
  if (emitKind & 7 /* AllJs */) emitOnly = 0 /* Js */;
123568
123657
  if (emitKind & 24 /* AllDts */) emitOnly = emitOnly === void 0 ? 1 /* Dts */ : void 0;
123569
- if (affected === state.program) {
123570
- state.programEmitPending = state.changedFilesSet.size ? getPendingEmitKind(programEmitKind, emitKind) : state.programEmitPending ? getPendingEmitKind(state.programEmitPending, emitKind) : void 0;
123571
- }
123572
123658
  const result = state.program.emit(
123573
123659
  affected === state.program ? void 0 : affected,
123574
123660
  getWriteFileCallback(writeFile2, customTransformers),
123575
123661
  cancellationToken,
123576
123662
  emitOnly,
123577
- customTransformers
123663
+ customTransformers,
123664
+ /*forceDtsEmit*/
123665
+ void 0,
123666
+ /*skipBuildInfo*/
123667
+ true
123578
123668
  );
123579
123669
  if (affected !== state.program) {
123580
123670
  const affectedSourceFile = affected;
123581
123671
  state.seenAffectedFiles.add(affectedSourceFile.resolvedPath);
123582
123672
  if (state.affectedFilesIndex !== void 0) state.affectedFilesIndex++;
123583
123673
  state.buildInfoEmitPending = true;
123584
- const existing = ((_a = state.seenEmittedFiles) == null ? void 0 : _a.get(affectedSourceFile.resolvedPath)) || 0 /* None */;
123674
+ const existing = ((_b = state.seenEmittedFiles) == null ? void 0 : _b.get(affectedSourceFile.resolvedPath)) || 0 /* None */;
123585
123675
  (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, emitKind | existing);
123586
- const existingPending = ((_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.get(affectedSourceFile.resolvedPath)) || programEmitKind;
123676
+ const existingPending = ((_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.get(affectedSourceFile.resolvedPath)) || programEmitKind;
123587
123677
  const pendingKind = getPendingEmitKind(existingPending, emitKind | existing);
123588
123678
  if (pendingKind) (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, pendingKind);
123589
- else (_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.delete(affectedSourceFile.resolvedPath);
123679
+ else (_d = state.affectedFilesPendingEmit) == null ? void 0 : _d.delete(affectedSourceFile.resolvedPath);
123590
123680
  if (result.diagnostics.length) (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, result.diagnostics);
123591
123681
  } else {
123592
123682
  state.changedFilesSet.clear();
123683
+ state.programEmitPending = state.changedFilesSet.size ? getPendingEmitKind(programEmitKind, emitKind) : state.programEmitPending ? getPendingEmitKind(state.programEmitPending, emitKind) : void 0;
123684
+ state.seenProgramEmit = emitKind | (state.seenProgramEmit || 0 /* None */);
123685
+ let emitDiagnosticsPerFile;
123686
+ result.diagnostics.forEach((d) => {
123687
+ if (!d.file) return;
123688
+ let diagnostics = emitDiagnosticsPerFile == null ? void 0 : emitDiagnosticsPerFile.get(d.file.resolvedPath);
123689
+ if (!diagnostics) (emitDiagnosticsPerFile ?? (emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(d.file.resolvedPath, diagnostics = []);
123690
+ diagnostics.push(d);
123691
+ });
123692
+ if (emitDiagnosticsPerFile) state.emitDiagnosticsPerFile = emitDiagnosticsPerFile;
123693
+ state.buildInfoEmitPending = true;
123593
123694
  }
123594
123695
  return { result, affected };
123595
123696
  }
@@ -123711,28 +123812,37 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
123711
123812
  state.buildInfoEmitPending = true;
123712
123813
  if (!result) continue;
123713
123814
  } else {
123714
- result = state.program.getSemanticDiagnostics(
123715
- /*sourceFile*/
123716
- void 0,
123717
- cancellationToken
123815
+ let diagnostics;
123816
+ const semanticDiagnosticsPerFile = /* @__PURE__ */ new Map();
123817
+ state.program.getSourceFiles().forEach(
123818
+ (sourceFile) => diagnostics = addRange(
123819
+ diagnostics,
123820
+ getSemanticDiagnosticsOfFile(
123821
+ state,
123822
+ sourceFile,
123823
+ cancellationToken,
123824
+ semanticDiagnosticsPerFile
123825
+ )
123826
+ )
123718
123827
  );
123828
+ state.semanticDiagnosticsPerFile = semanticDiagnosticsPerFile;
123829
+ result = diagnostics || emptyArray;
123719
123830
  state.changedFilesSet.clear();
123720
123831
  state.programEmitPending = getBuilderFileEmit(state.compilerOptions);
123832
+ state.buildInfoEmitPending = true;
123721
123833
  }
123722
123834
  return { result, affected };
123723
123835
  }
123724
123836
  }
123725
123837
  function getSemanticDiagnostics(sourceFile, cancellationToken) {
123726
123838
  assertSourceFileOkWithoutNextAffectedCall(state, sourceFile);
123727
- const compilerOptions = Debug.checkDefined(state.program).getCompilerOptions();
123728
- if (compilerOptions.outFile) {
123729
- Debug.assert(!state.semanticDiagnosticsPerFile);
123730
- return Debug.checkDefined(state.program).getSemanticDiagnostics(sourceFile, cancellationToken);
123731
- }
123732
123839
  if (sourceFile) {
123733
123840
  return getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken);
123734
123841
  }
123735
- while (getSemanticDiagnosticsOfNextAffectedFile(cancellationToken)) {
123842
+ while (true) {
123843
+ const affectedResult = getSemanticDiagnosticsOfNextAffectedFile(cancellationToken);
123844
+ if (!affectedResult) break;
123845
+ if (affectedResult.affected === state.program) return affectedResult.result;
123736
123846
  }
123737
123847
  let diagnostics;
123738
123848
  for (const sourceFile2 of Debug.checkDefined(state.program).getSourceFiles()) {
@@ -123765,8 +123875,9 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
123765
123875
  const filePaths = (_a = program.fileNames) == null ? void 0 : _a.map(toPathInBuildInfoDirectory);
123766
123876
  let filePathsSetList;
123767
123877
  const latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : void 0;
123878
+ const fileInfos = /* @__PURE__ */ new Map();
123879
+ const changedFilesSet = new Set(map(program.changeFileSet, toFilePath));
123768
123880
  if (isProgramBundleEmitBuildInfo(program)) {
123769
- const fileInfos = /* @__PURE__ */ new Map();
123770
123881
  program.fileInfos.forEach((fileInfo, index) => {
123771
123882
  const path = toFilePath(index + 1);
123772
123883
  fileInfos.set(path, isString(fileInfo) ? { version: fileInfo, signature: void 0, affectsGlobalScope: void 0, impliedFormat: void 0 } : fileInfo);
@@ -123774,13 +123885,16 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
123774
123885
  state = {
123775
123886
  fileInfos,
123776
123887
  compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
123888
+ semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(program.semanticDiagnosticsPerFile),
123889
+ emitDiagnosticsPerFile: toPerFileEmitDiagnostics(program.emitDiagnosticsPerFile),
123890
+ hasReusableDiagnostic: true,
123891
+ changedFilesSet,
123777
123892
  latestChangedDtsFile,
123778
123893
  outSignature: program.outSignature,
123779
123894
  programEmitPending: program.pendingEmit === void 0 ? void 0 : toProgramEmitPending(program.pendingEmit, program.options)
123780
123895
  };
123781
123896
  } else {
123782
123897
  filePathsSetList = (_b = program.fileIdsList) == null ? void 0 : _b.map((fileIds) => new Set(fileIds.map(toFilePath)));
123783
- const fileInfos = /* @__PURE__ */ new Map();
123784
123898
  const emitSignatures = ((_c = program.options) == null ? void 0 : _c.composite) && !program.options.outFile ? /* @__PURE__ */ new Map() : void 0;
123785
123899
  program.fileInfos.forEach((fileInfo, index) => {
123786
123900
  const path = toFilePath(index + 1);
@@ -123801,13 +123915,12 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
123801
123915
  );
123802
123916
  }
123803
123917
  });
123804
- const changedFilesSet = new Set(map(program.changeFileSet, toFilePath));
123805
123918
  const fullEmitForOptions = program.affectedFilesPendingEmit ? getBuilderFileEmit(program.options || {}) : void 0;
123806
123919
  state = {
123807
123920
  fileInfos,
123808
123921
  compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
123809
123922
  referencedMap: toManyToManyPathMap(program.referencedMap, program.options ?? {}),
123810
- semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(program.semanticDiagnosticsPerFile, fileInfos, changedFilesSet),
123923
+ semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(program.semanticDiagnosticsPerFile),
123811
123924
  emitDiagnosticsPerFile: toPerFileEmitDiagnostics(program.emitDiagnosticsPerFile),
123812
123925
  hasReusableDiagnostic: true,
123813
123926
  affectedFilesPendingEmit: program.affectedFilesPendingEmit && arrayToMap(program.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
@@ -123859,7 +123972,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
123859
123972
  referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
123860
123973
  return map2;
123861
123974
  }
123862
- function toPerFileSemanticDiagnostics(diagnostics, fileInfos, changedFilesSet) {
123975
+ function toPerFileSemanticDiagnostics(diagnostics) {
123863
123976
  const semanticDiagnostics = new Map(
123864
123977
  mapDefinedIterator(
123865
123978
  fileInfos.keys(),
@@ -123870,7 +123983,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
123870
123983
  if (isNumber(value)) semanticDiagnostics.delete(toFilePath(value));
123871
123984
  else semanticDiagnostics.set(toFilePath(value[0]), value[1]);
123872
123985
  });
123873
- return semanticDiagnostics.size ? semanticDiagnostics : void 0;
123986
+ return semanticDiagnostics;
123874
123987
  }
123875
123988
  function toPerFileEmitDiagnostics(diagnostics) {
123876
123989
  return diagnostics && arrayToMap(diagnostics, (value) => toFilePath(value[0]), (value) => value[1]);
@@ -126986,8 +127099,6 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
126986
127099
  ({ buildResult, step } = buildErrors(
126987
127100
  state,
126988
127101
  projectPath,
126989
- program,
126990
- config,
126991
127102
  diagnostics,
126992
127103
  errorFlags,
126993
127104
  errorType
@@ -127050,8 +127161,6 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
127050
127161
  ({ buildResult, step } = buildErrors(
127051
127162
  state,
127052
127163
  projectPath,
127053
- program,
127054
- config,
127055
127164
  declDiagnostics,
127056
127165
  32 /* DeclarationEmitErrors */,
127057
127166
  "Declaration file"
@@ -127114,8 +127223,6 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
127114
127223
  ({ buildResult, step } = buildErrors(
127115
127224
  state,
127116
127225
  projectPath,
127117
- program,
127118
- config,
127119
127226
  emitDiagnostics,
127120
127227
  64 /* EmitErrors */,
127121
127228
  "Emit"
@@ -127295,13 +127402,10 @@ function afterProgramDone(state, program) {
127295
127402
  }
127296
127403
  state.projectCompilerOptions = state.baseCompilerOptions;
127297
127404
  }
127298
- function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
127299
- const canEmitBuildInfo = program && !program.getCompilerOptions().outFile;
127405
+ function buildErrors(state, resolvedPath, diagnostics, buildResult, errorType) {
127300
127406
  reportAndStoreErrors(state, resolvedPath, diagnostics);
127301
127407
  state.projectStatus.set(resolvedPath, { type: 0 /* Unbuildable */, reason: `${errorType} errors` });
127302
- if (canEmitBuildInfo) return { buildResult, step: 4 /* EmitBuildInfo */ };
127303
- afterProgramDone(state, program);
127304
- return { buildResult, step: 5 /* QueueReferencingProjects */ };
127408
+ return { buildResult, step: 4 /* EmitBuildInfo */ };
127305
127409
  }
127306
127410
  function isFileWatcherWithModifiedTime(value) {
127307
127411
  return !!value.watcher;
@@ -127476,7 +127580,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
127476
127580
  };
127477
127581
  }
127478
127582
  if (buildInfo.program) {
127479
- 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) : (_d = buildInfo.program.semanticDiagnosticsPerFile) == null ? void 0 : _d.length)) {
127583
+ 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) || buildInfo.program.pendingEmit !== void 0 : (_d = buildInfo.program.semanticDiagnosticsPerFile) == null ? void 0 : _d.length)) {
127480
127584
  return {
127481
127585
  type: 7 /* OutOfDateBuildInfo */,
127482
127586
  buildInfoFile: buildInfoPath