@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/typescript.js CHANGED
@@ -2332,6 +2332,7 @@ __export(typescript_exports, {
2332
2332
  unusedLabelIsError: () => unusedLabelIsError,
2333
2333
  unwrapInnermostStatementOfLabel: () => unwrapInnermostStatementOfLabel,
2334
2334
  unwrapParenthesizedExpression: () => unwrapParenthesizedExpression,
2335
+ unwrapParenthesizedType: () => unwrapParenthesizedType,
2335
2336
  updateErrorForNoInputFiles: () => updateErrorForNoInputFiles,
2336
2337
  updateLanguageServiceSourceFile: () => updateLanguageServiceSourceFile,
2337
2338
  updateMissingFilePathsWatch: () => updateMissingFilePathsWatch,
@@ -23572,6 +23573,12 @@ function unwrapParenthesizedExpression(o) {
23572
23573
  }
23573
23574
  return o;
23574
23575
  }
23576
+ function unwrapParenthesizedType(o) {
23577
+ while (o.kind === 196 /* ParenthesizedType */) {
23578
+ o = o.type;
23579
+ }
23580
+ return o;
23581
+ }
23575
23582
  function hasInferredType(node) {
23576
23583
  Debug.type(node);
23577
23584
  switch (node.kind) {
@@ -56384,6 +56391,57 @@ function createTypeChecker(host) {
56384
56391
  function onEnterNewScope(node) {
56385
56392
  return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
56386
56393
  }
56394
+ function tryVisitSimpleTypeNode(node) {
56395
+ const innerNode = unwrapParenthesizedType(node);
56396
+ switch (innerNode.kind) {
56397
+ case 183 /* TypeReference */:
56398
+ return tryVisitTypeReference(innerNode);
56399
+ case 186 /* TypeQuery */:
56400
+ return tryVisitTypeQuery(innerNode);
56401
+ case 199 /* IndexedAccessType */:
56402
+ return tryVisitIndexedAccess(innerNode);
56403
+ case 198 /* TypeOperator */:
56404
+ const typeOperatorNode = innerNode;
56405
+ if (typeOperatorNode.operator === 143 /* KeyOfKeyword */) {
56406
+ return tryVisitKeyOf(typeOperatorNode);
56407
+ }
56408
+ }
56409
+ return visitNode(node, visitExistingNodeTreeSymbols, isTypeNode);
56410
+ }
56411
+ function tryVisitIndexedAccess(node) {
56412
+ const resultObjectType = tryVisitSimpleTypeNode(node.objectType);
56413
+ if (resultObjectType === void 0) {
56414
+ return void 0;
56415
+ }
56416
+ return factory.updateIndexedAccessTypeNode(node, resultObjectType, visitNode(node.indexType, visitExistingNodeTreeSymbols, isTypeNode));
56417
+ }
56418
+ function tryVisitKeyOf(node) {
56419
+ Debug.assertEqual(node.operator, 143 /* KeyOfKeyword */);
56420
+ const type = tryVisitSimpleTypeNode(node.type);
56421
+ if (type === void 0) {
56422
+ return void 0;
56423
+ }
56424
+ return factory.updateTypeOperatorNode(node, type);
56425
+ }
56426
+ function tryVisitTypeQuery(node) {
56427
+ const { introducesError, node: exprName } = trackExistingEntityName(node.exprName, context);
56428
+ if (!introducesError) {
56429
+ return factory.updateTypeQueryNode(
56430
+ node,
56431
+ exprName,
56432
+ visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode)
56433
+ );
56434
+ }
56435
+ const serializedName = serializeTypeName(
56436
+ context,
56437
+ node.exprName,
56438
+ /*isTypeOf*/
56439
+ true
56440
+ );
56441
+ if (serializedName) {
56442
+ return setTextRange2(context, serializedName, node.exprName);
56443
+ }
56444
+ }
56387
56445
  function tryVisitTypeReference(node) {
56388
56446
  if (canReuseTypeNode(context, node)) {
56389
56447
  const { introducesError, node: newName } = trackExistingEntityName(node.typeName, context);
@@ -56517,13 +56575,13 @@ function createTypeChecker(host) {
56517
56575
  visitNode(node.default, visitExistingNodeTreeSymbols, isTypeNode)
56518
56576
  );
56519
56577
  }
56520
- if (isIndexedAccessTypeNode(node) && isTypeReferenceNode(node.objectType)) {
56521
- const objectType = tryVisitTypeReference(node.objectType);
56522
- if (!objectType) {
56578
+ if (isIndexedAccessTypeNode(node)) {
56579
+ const result = tryVisitIndexedAccess(node);
56580
+ if (!result) {
56523
56581
  hadError = true;
56524
56582
  return node;
56525
56583
  }
56526
- return factory.updateIndexedAccessTypeNode(node, objectType, visitNode(node.indexType, visitExistingNodeTreeSymbols, isTypeNode));
56584
+ return result;
56527
56585
  }
56528
56586
  if (isTypeReferenceNode(node)) {
56529
56587
  const result = tryVisitTypeReference(node);
@@ -56566,25 +56624,12 @@ function createTypeChecker(host) {
56566
56624
  return visited;
56567
56625
  }
56568
56626
  if (isTypeQueryNode(node)) {
56569
- const { introducesError, node: exprName } = trackExistingEntityName(node.exprName, context);
56570
- if (introducesError) {
56571
- const serializedName = serializeTypeName(
56572
- context,
56573
- node.exprName,
56574
- /*isTypeOf*/
56575
- true
56576
- );
56577
- if (serializedName) {
56578
- return setTextRange2(context, serializedName, node.exprName);
56579
- }
56627
+ const result = tryVisitTypeQuery(node);
56628
+ if (!result) {
56580
56629
  hadError = true;
56581
56630
  return node;
56582
56631
  }
56583
- return factory.updateTypeQueryNode(
56584
- node,
56585
- exprName,
56586
- visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode)
56587
- );
56632
+ return result;
56588
56633
  }
56589
56634
  if (isComputedPropertyName(node) && isEntityNameExpression(node.expression)) {
56590
56635
  const { node: result, introducesError } = trackExistingEntityName(node.expression, context);
@@ -56649,14 +56694,12 @@ function createTypeChecker(host) {
56649
56694
  return node;
56650
56695
  }
56651
56696
  } else if (node.operator === 143 /* KeyOfKeyword */) {
56652
- if (isTypeReferenceNode(node.type)) {
56653
- const type = tryVisitTypeReference(node.type);
56654
- if (!type) {
56655
- hadError = true;
56656
- return node;
56657
- }
56658
- return factory.updateTypeOperatorNode(node, type);
56697
+ const result = tryVisitKeyOf(node);
56698
+ if (!result) {
56699
+ hadError = true;
56700
+ return node;
56659
56701
  }
56702
+ return result;
56660
56703
  }
56661
56704
  }
56662
56705
  return visitEachChild2(node, visitExistingNodeTreeSymbols);
@@ -117706,16 +117749,16 @@ function isBuildInfoFile(file) {
117706
117749
  function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDtsEmit = false, onlyBuildInfo, includeBuildInfo) {
117707
117750
  const sourceFiles = isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile, forceDtsEmit);
117708
117751
  const options = host.getCompilerOptions();
117709
- if (options.outFile) {
117710
- if (sourceFiles.length) {
117711
- const bundle = factory.createBundle(sourceFiles);
117712
- const result = action(getOutputPathsFor(bundle, host, forceDtsEmit), bundle);
117713
- if (result) {
117714
- return result;
117752
+ if (!onlyBuildInfo) {
117753
+ if (options.outFile) {
117754
+ if (sourceFiles.length) {
117755
+ const bundle = factory.createBundle(sourceFiles);
117756
+ const result = action(getOutputPathsFor(bundle, host, forceDtsEmit), bundle);
117757
+ if (result) {
117758
+ return result;
117759
+ }
117715
117760
  }
117716
- }
117717
- } else {
117718
- if (!onlyBuildInfo) {
117761
+ } else {
117719
117762
  for (const sourceFile of sourceFiles) {
117720
117763
  const result = action(getOutputPathsFor(sourceFile, host, forceDtsEmit), sourceFile);
117721
117764
  if (result) {
@@ -117723,14 +117766,14 @@ function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDt
117723
117766
  }
117724
117767
  }
117725
117768
  }
117726
- if (includeBuildInfo) {
117727
- const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
117728
- if (buildInfoPath) return action(
117729
- { buildInfoPath },
117730
- /*sourceFileOrBundle*/
117731
- void 0
117732
- );
117733
- }
117769
+ }
117770
+ if (includeBuildInfo) {
117771
+ const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
117772
+ if (buildInfoPath) return action(
117773
+ { buildInfoPath },
117774
+ /*sourceFileOrBundle*/
117775
+ void 0
117776
+ );
117734
117777
  }
117735
117778
  }
117736
117779
  function getTsBuildInfoEmitOutputFilePath(options) {
@@ -117759,8 +117802,7 @@ function getOutputPathsForBundle(options, forceDtsPaths) {
117759
117802
  const sourceMapFilePath = jsFilePath && getSourceMapFilePath(jsFilePath, options);
117760
117803
  const declarationFilePath = forceDtsPaths || getEmitDeclarations(options) ? removeFileExtension(outPath) + ".d.ts" /* Dts */ : void 0;
117761
117804
  const declarationMapPath = declarationFilePath && getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : void 0;
117762
- const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
117763
- return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath };
117805
+ return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath };
117764
117806
  }
117765
117807
  function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
117766
117808
  const options = host.getCompilerOptions();
@@ -117774,7 +117816,7 @@ function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
117774
117816
  const sourceMapFilePath = !jsFilePath || isJsonSourceFile(sourceFile) ? void 0 : getSourceMapFilePath(jsFilePath, options);
117775
117817
  const declarationFilePath = forceDtsPaths || getEmitDeclarations(options) && !isJsonFile ? getDeclarationEmitOutputFilePath(sourceFile.fileName, host) : void 0;
117776
117818
  const declarationMapPath = declarationFilePath && getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : void 0;
117777
- return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath: void 0 };
117819
+ return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath };
117778
117820
  }
117779
117821
  }
117780
117822
  function getSourceMapFilePath(jsFilePath, options) {
@@ -117823,7 +117865,7 @@ function createAddOutput() {
117823
117865
  }
117824
117866
  }
117825
117867
  function getSingleOutputFileNames(configFile, addOutput) {
117826
- const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath } = getOutputPathsForBundle(
117868
+ const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath } = getOutputPathsForBundle(
117827
117869
  configFile.options,
117828
117870
  /*forceDtsPaths*/
117829
117871
  false
@@ -117832,7 +117874,6 @@ function getSingleOutputFileNames(configFile, addOutput) {
117832
117874
  addOutput(sourceMapFilePath);
117833
117875
  addOutput(declarationFilePath);
117834
117876
  addOutput(declarationMapPath);
117835
- addOutput(buildInfoPath);
117836
117877
  }
117837
117878
  function getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory2) {
117838
117879
  if (isDeclarationFileName(inputFileName)) return;
@@ -117883,8 +117924,8 @@ function getAllProjectOutputs(configFile, ignoreCase) {
117883
117924
  for (const inputFileName of configFile.fileNames) {
117884
117925
  getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory2);
117885
117926
  }
117886
- addOutput(getTsBuildInfoEmitOutputFilePath(configFile.options));
117887
117927
  }
117928
+ addOutput(getTsBuildInfoEmitOutputFilePath(configFile.options));
117888
117929
  return getOutputs();
117889
117930
  }
117890
117931
  function getOutputFileNames(commandLine, inputFileName, ignoreCase) {
@@ -117924,7 +117965,7 @@ function getFirstProjectOutput(configFile, ignoreCase) {
117924
117965
  function emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit) {
117925
117966
  return !!forceDtsEmit && !!emitOnly;
117926
117967
  }
117927
- function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit) {
117968
+ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit, skipBuildInfo) {
117928
117969
  var compilerOptions = host.getCompilerOptions();
117929
117970
  var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0;
117930
117971
  var emittedFilesList = compilerOptions.listEmittedFiles ? [] : void 0;
@@ -117940,7 +117981,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
117940
117981
  getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit),
117941
117982
  forceDtsEmit,
117942
117983
  onlyBuildInfo,
117943
- !targetSourceFile
117984
+ !targetSourceFile && !skipBuildInfo
117944
117985
  );
117945
117986
  exit();
117946
117987
  return {
@@ -117962,7 +118003,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
117962
118003
  (_f = tracing) == null ? void 0 : _f.pop();
117963
118004
  }
117964
118005
  function emitBuildInfo(buildInfoPath) {
117965
- if (!buildInfoPath || targetSourceFile || emitSkipped) return;
118006
+ if (!buildInfoPath || targetSourceFile) return;
117966
118007
  if (host.isEmitBlocked(buildInfoPath)) {
117967
118008
  emitSkipped = true;
117968
118009
  return;
@@ -124961,7 +125002,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124961
125002
  }
124962
125003
  function emitBuildInfo(writeFileCallback) {
124963
125004
  var _a2, _b2;
124964
- Debug.assert(!options.outFile);
124965
125005
  (_a2 = tracing) == null ? void 0 : _a2.push(
124966
125006
  tracing.Phase.Emit,
124967
125007
  "emitBuildInfo",
@@ -125016,7 +125056,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125016
125056
  function getTypeChecker() {
125017
125057
  return typeChecker || (typeChecker = createTypeChecker(program));
125018
125058
  }
125019
- function emit(sourceFile, writeFileCallback, cancellationToken, emitOnly, transformers, forceDtsEmit) {
125059
+ function emit(sourceFile, writeFileCallback, cancellationToken, emitOnly, transformers, forceDtsEmit, skipBuildInfo) {
125020
125060
  var _a2, _b2;
125021
125061
  (_a2 = tracing) == null ? void 0 : _a2.push(
125022
125062
  tracing.Phase.Emit,
@@ -125025,14 +125065,25 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125025
125065
  /*separateBeginAndEnd*/
125026
125066
  true
125027
125067
  );
125028
- const result = runWithCancellationToken(() => emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnly, transformers, forceDtsEmit));
125068
+ const result = runWithCancellationToken(
125069
+ () => emitWorker(
125070
+ program,
125071
+ sourceFile,
125072
+ writeFileCallback,
125073
+ cancellationToken,
125074
+ emitOnly,
125075
+ transformers,
125076
+ forceDtsEmit,
125077
+ skipBuildInfo
125078
+ )
125079
+ );
125029
125080
  (_b2 = tracing) == null ? void 0 : _b2.pop();
125030
125081
  return result;
125031
125082
  }
125032
125083
  function isEmitBlocked(emitFileName) {
125033
125084
  return hasEmitBlockingDiagnostics.has(toPath3(emitFileName));
125034
125085
  }
125035
- function emitWorker(program2, sourceFile, writeFileCallback, cancellationToken, emitOnly, customTransformers, forceDtsEmit) {
125086
+ function emitWorker(program2, sourceFile, writeFileCallback, cancellationToken, emitOnly, customTransformers, forceDtsEmit, skipBuildInfo) {
125036
125087
  if (!forceDtsEmit) {
125037
125088
  const result = handleNoEmitOptions(program2, sourceFile, writeFileCallback, cancellationToken);
125038
125089
  if (result) return result;
@@ -125054,7 +125105,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125054
125105
  emitOnly,
125055
125106
  /*onlyBuildInfo*/
125056
125107
  false,
125057
- forceDtsEmit
125108
+ forceDtsEmit,
125109
+ skipBuildInfo
125058
125110
  )
125059
125111
  );
125060
125112
  mark("afterEmit");
@@ -127186,7 +127238,7 @@ function handleNoEmitOptions(program, sourceFile, writeFile2, cancellationToken)
127186
127238
  const options = program.getCompilerOptions();
127187
127239
  if (options.noEmit) {
127188
127240
  program.getSemanticDiagnostics(sourceFile, cancellationToken);
127189
- return sourceFile || options.outFile ? emitSkippedWithNoDiagnostics : program.emitBuildInfo(writeFile2, cancellationToken);
127241
+ return sourceFile ? emitSkippedWithNoDiagnostics : program.emitBuildInfo(writeFile2, cancellationToken);
127190
127242
  }
127191
127243
  if (!options.noEmitOnError) return void 0;
127192
127244
  let diagnostics = [
@@ -127204,7 +127256,7 @@ function handleNoEmitOptions(program, sourceFile, writeFile2, cancellationToken)
127204
127256
  }
127205
127257
  if (!diagnostics.length) return void 0;
127206
127258
  let emittedFiles;
127207
- if (!sourceFile && !options.outFile) {
127259
+ if (!sourceFile) {
127208
127260
  const emitResult = program.emitBuildInfo(writeFile2, cancellationToken);
127209
127261
  if (emitResult.diagnostics) diagnostics = [...diagnostics, ...emitResult.diagnostics];
127210
127262
  emittedFiles = emitResult.emittedFiles;
@@ -127712,17 +127764,17 @@ function createBuilderProgramState(newProgram, oldState) {
127712
127764
  const compilerOptions = newProgram.getCompilerOptions();
127713
127765
  state.compilerOptions = compilerOptions;
127714
127766
  const outFilePath = compilerOptions.outFile;
127715
- if (!outFilePath) {
127716
- state.semanticDiagnosticsPerFile = /* @__PURE__ */ new Map();
127717
- } else if (compilerOptions.composite && (oldState == null ? void 0 : oldState.outSignature) && outFilePath === oldState.compilerOptions.outFile) {
127767
+ state.semanticDiagnosticsPerFile = /* @__PURE__ */ new Map();
127768
+ if (outFilePath && compilerOptions.composite && (oldState == null ? void 0 : oldState.outSignature) && outFilePath === oldState.compilerOptions.outFile) {
127718
127769
  state.outSignature = oldState.outSignature && getEmitSignatureFromOldSignature(compilerOptions, oldState.compilerOptions, oldState.outSignature);
127719
127770
  }
127720
127771
  state.changedFilesSet = /* @__PURE__ */ new Set();
127721
127772
  state.latestChangedDtsFile = compilerOptions.composite ? oldState == null ? void 0 : oldState.latestChangedDtsFile : void 0;
127722
127773
  const useOldState = BuilderState.canReuseOldState(state.referencedMap, oldState);
127723
127774
  const oldCompilerOptions = useOldState ? oldState.compilerOptions : void 0;
127724
- const canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile && !compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
127775
+ let canCopySemanticDiagnostics = useOldState && !compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
127725
127776
  const canCopyEmitSignatures = compilerOptions.composite && (oldState == null ? void 0 : oldState.emitSignatures) && !outFilePath && !compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions);
127777
+ let canCopyEmitDiagnostics = true;
127726
127778
  if (useOldState) {
127727
127779
  (_a = oldState.changedFilesSet) == null ? void 0 : _a.forEach((value) => state.changedFilesSet.add(value));
127728
127780
  if (!outFilePath && ((_b = oldState.affectedFilesPendingEmit) == null ? void 0 : _b.size)) {
@@ -127730,6 +127782,10 @@ function createBuilderProgramState(newProgram, oldState) {
127730
127782
  state.seenAffectedFiles = /* @__PURE__ */ new Set();
127731
127783
  }
127732
127784
  state.programEmitPending = oldState.programEmitPending;
127785
+ if (outFilePath && state.changedFilesSet.size) {
127786
+ canCopySemanticDiagnostics = false;
127787
+ canCopyEmitDiagnostics = false;
127788
+ }
127733
127789
  } else {
127734
127790
  state.buildInfoEmitPending = true;
127735
127791
  }
@@ -127747,10 +127803,10 @@ function createBuilderProgramState(newProgram, oldState) {
127747
127803
  oldInfo.impliedFormat !== info.impliedFormat || // Referenced files changed
127748
127804
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) || // Referenced file was deleted in the new program
127749
127805
  newReferences && forEachKey(newReferences, (path) => !state.fileInfos.has(path) && oldState.fileInfos.has(path))) {
127750
- addFileToChangeSet(state, sourceFilePath);
127806
+ addFileToChangeSet(sourceFilePath);
127751
127807
  } else {
127752
127808
  const sourceFile = newProgram.getSourceFileByPath(sourceFilePath);
127753
- const emitDiagnostics = (_a2 = oldState.emitDiagnosticsPerFile) == null ? void 0 : _a2.get(sourceFilePath);
127809
+ const emitDiagnostics = canCopyEmitDiagnostics ? (_a2 = oldState.emitDiagnosticsPerFile) == null ? void 0 : _a2.get(sourceFilePath) : void 0;
127754
127810
  if (emitDiagnostics) {
127755
127811
  (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(
127756
127812
  sourceFilePath,
@@ -127779,16 +127835,16 @@ function createBuilderProgramState(newProgram, oldState) {
127779
127835
  });
127780
127836
  if (useOldState && forEachEntry(oldState.fileInfos, (info, sourceFilePath) => {
127781
127837
  if (state.fileInfos.has(sourceFilePath)) return false;
127782
- if (outFilePath || info.affectsGlobalScope) return true;
127838
+ if (info.affectsGlobalScope) return true;
127783
127839
  state.buildInfoEmitPending = true;
127784
- return false;
127840
+ return !!outFilePath;
127785
127841
  })) {
127786
127842
  BuilderState.getAllFilesExcludingDefaultLibraryFile(
127787
127843
  state,
127788
127844
  newProgram,
127789
127845
  /*firstSourceFile*/
127790
127846
  void 0
127791
- ).forEach((file) => addFileToChangeSet(state, file.resolvedPath));
127847
+ ).forEach((file) => addFileToChangeSet(file.resolvedPath));
127792
127848
  } else if (oldCompilerOptions) {
127793
127849
  const pendingEmitKind = compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions) ? getBuilderFileEmit(compilerOptions) : getPendingEmitKind(compilerOptions, oldCompilerOptions);
127794
127850
  if (pendingEmitKind !== 0 /* None */) {
@@ -127804,18 +127860,25 @@ function createBuilderProgramState(newProgram, oldState) {
127804
127860
  });
127805
127861
  Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
127806
127862
  state.seenAffectedFiles = state.seenAffectedFiles || /* @__PURE__ */ new Set();
127807
- state.buildInfoEmitPending = true;
127808
- } else {
127863
+ } else if (!state.changedFilesSet.size) {
127809
127864
  state.programEmitPending = state.programEmitPending ? state.programEmitPending | pendingEmitKind : pendingEmitKind;
127810
127865
  }
127866
+ state.buildInfoEmitPending = true;
127811
127867
  }
127812
127868
  }
127813
127869
  return state;
127814
- }
127815
- function addFileToChangeSet(state, path) {
127816
- state.changedFilesSet.add(path);
127817
- state.buildInfoEmitPending = true;
127818
- state.programEmitPending = void 0;
127870
+ function addFileToChangeSet(path) {
127871
+ state.changedFilesSet.add(path);
127872
+ if (outFilePath) {
127873
+ canCopySemanticDiagnostics = false;
127874
+ canCopyEmitDiagnostics = false;
127875
+ state.semanticDiagnosticsFromOldState = void 0;
127876
+ state.semanticDiagnosticsPerFile.clear();
127877
+ state.emitDiagnosticsPerFile = void 0;
127878
+ }
127879
+ state.buildInfoEmitPending = true;
127880
+ state.programEmitPending = void 0;
127881
+ }
127819
127882
  }
127820
127883
  function getEmitSignatureFromOldSignature(options, oldOptions, oldEmitSignature) {
127821
127884
  return !!options.declarationMap === !!oldOptions.declarationMap ? (
@@ -127888,6 +127951,7 @@ function backupBuilderProgramEmitState(state) {
127888
127951
  return {
127889
127952
  affectedFilesPendingEmit: state.affectedFilesPendingEmit && new Map(state.affectedFilesPendingEmit),
127890
127953
  seenEmittedFiles: state.seenEmittedFiles && new Map(state.seenEmittedFiles),
127954
+ seenProgramEmit: state.seenProgramEmit,
127891
127955
  programEmitPending: state.programEmitPending,
127892
127956
  emitSignatures: state.emitSignatures && new Map(state.emitSignatures),
127893
127957
  outSignature: state.outSignature,
@@ -127901,6 +127965,7 @@ function backupBuilderProgramEmitState(state) {
127901
127965
  function restoreBuilderProgramEmitState(state, savedEmitState) {
127902
127966
  state.affectedFilesPendingEmit = savedEmitState.affectedFilesPendingEmit;
127903
127967
  state.seenEmittedFiles = savedEmitState.seenEmittedFiles;
127968
+ state.seenProgramEmit = savedEmitState.seenProgramEmit;
127904
127969
  state.programEmitPending = savedEmitState.programEmitPending;
127905
127970
  state.emitSignatures = savedEmitState.emitSignatures;
127906
127971
  state.outSignature = savedEmitState.outSignature;
@@ -127909,6 +127974,10 @@ function restoreBuilderProgramEmitState(state, savedEmitState) {
127909
127974
  state.buildInfoEmitPending = savedEmitState.buildInfoEmitPending;
127910
127975
  state.emitDiagnosticsPerFile = savedEmitState.emitDiagnosticsPerFile;
127911
127976
  if (savedEmitState.changedFilesSet) state.changedFilesSet = savedEmitState.changedFilesSet;
127977
+ if (state.compilerOptions.outFile && state.changedFilesSet.size) {
127978
+ state.semanticDiagnosticsPerFile.clear();
127979
+ state.emitDiagnosticsPerFile = void 0;
127980
+ }
127912
127981
  }
127913
127982
  function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
127914
127983
  Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
@@ -127946,10 +128015,7 @@ function getNextAffectedFile(state, cancellationToken, host) {
127946
128015
  }
127947
128016
  const program = Debug.checkDefined(state.program);
127948
128017
  const compilerOptions = program.getCompilerOptions();
127949
- if (compilerOptions.outFile) {
127950
- Debug.assert(!state.semanticDiagnosticsPerFile);
127951
- return program;
127952
- }
128018
+ if (compilerOptions.outFile) return program;
127953
128019
  state.affectedFiles = BuilderState.getFilesAffectedByWithOldState(
127954
128020
  state,
127955
128021
  program,
@@ -127963,14 +128029,22 @@ function getNextAffectedFile(state, cancellationToken, host) {
127963
128029
  }
127964
128030
  }
127965
128031
  function clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles) {
127966
- var _a;
127967
- if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size)) return;
127968
- if (!emitOnlyDtsFiles) return state.affectedFilesPendingEmit = void 0;
127969
- state.affectedFilesPendingEmit.forEach((emitKind, path) => {
128032
+ var _a, _b;
128033
+ if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size) && !state.programEmitPending) return;
128034
+ if (!emitOnlyDtsFiles) {
128035
+ state.affectedFilesPendingEmit = void 0;
128036
+ state.programEmitPending = void 0;
128037
+ }
128038
+ (_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.forEach((emitKind, path) => {
127970
128039
  const pending = emitKind & 7 /* AllJs */;
127971
128040
  if (!pending) state.affectedFilesPendingEmit.delete(path);
127972
128041
  else state.affectedFilesPendingEmit.set(path, pending);
127973
128042
  });
128043
+ if (state.programEmitPending) {
128044
+ const pending = state.programEmitPending & 7 /* AllJs */;
128045
+ if (!pending) state.programEmitPending = void 0;
128046
+ else state.programEmitPending = pending;
128047
+ }
127974
128048
  }
127975
128049
  function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) {
127976
128050
  var _a;
@@ -128162,24 +128236,21 @@ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, invalidateJsF
128162
128236
  );
128163
128237
  return void 0;
128164
128238
  }
128165
- function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken) {
128239
+ function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile) {
128166
128240
  return concatenate(
128167
- getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken),
128241
+ getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile),
128168
128242
  Debug.checkDefined(state.program).getProgramDiagnostics(sourceFile)
128169
128243
  );
128170
128244
  }
128171
- function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken) {
128245
+ function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile) {
128246
+ semanticDiagnosticsPerFile ?? (semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile);
128172
128247
  const path = sourceFile.resolvedPath;
128173
- if (state.semanticDiagnosticsPerFile) {
128174
- const cachedDiagnostics = state.semanticDiagnosticsPerFile.get(path);
128175
- if (cachedDiagnostics) {
128176
- return filterSemanticDiagnostics(cachedDiagnostics, state.compilerOptions);
128177
- }
128248
+ const cachedDiagnostics = semanticDiagnosticsPerFile.get(path);
128249
+ if (cachedDiagnostics) {
128250
+ return filterSemanticDiagnostics(cachedDiagnostics, state.compilerOptions);
128178
128251
  }
128179
128252
  const diagnostics = Debug.checkDefined(state.program).getBindAndCheckDiagnostics(sourceFile, cancellationToken);
128180
- if (state.semanticDiagnosticsPerFile) {
128181
- state.semanticDiagnosticsPerFile.set(path, diagnostics);
128182
- }
128253
+ semanticDiagnosticsPerFile.set(path, diagnostics);
128183
128254
  return filterSemanticDiagnostics(diagnostics, state.compilerOptions);
128184
128255
  }
128185
128256
  function isProgramBundleEmitBuildInfo(info) {
@@ -128207,6 +128278,9 @@ function getBuildInfo2(state) {
128207
128278
  root,
128208
128279
  resolvedRoot: toResolvedRoot(),
128209
128280
  options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
128281
+ semanticDiagnosticsPerFile: convertToProgramBuildInfoDiagnostics(),
128282
+ emitDiagnosticsPerFile: convertToProgramBuildInfoEmitDiagnostics(),
128283
+ changeFileSet: toChangeFileSet(),
128210
128284
  outSignature: state.outSignature,
128211
128285
  latestChangedDtsFile,
128212
128286
  pendingEmit: !state.programEmitPending ? void 0 : (
@@ -128297,13 +128371,6 @@ function getBuildInfo2(state) {
128297
128371
  }
128298
128372
  }
128299
128373
  }
128300
- let changeFileSet;
128301
- if (state.changedFilesSet.size) {
128302
- for (const path of arrayFrom(state.changedFilesSet.keys()).sort(compareStringsCaseSensitive)) {
128303
- changeFileSet = append(changeFileSet, toFileId(path));
128304
- }
128305
- }
128306
- const emitDiagnosticsPerFile = convertToProgramBuildInfoEmitDiagnostics();
128307
128374
  const program = {
128308
128375
  fileNames,
128309
128376
  fileInfos,
@@ -128313,9 +128380,9 @@ function getBuildInfo2(state) {
128313
128380
  fileIdsList,
128314
128381
  referencedMap,
128315
128382
  semanticDiagnosticsPerFile,
128316
- emitDiagnosticsPerFile,
128383
+ emitDiagnosticsPerFile: convertToProgramBuildInfoEmitDiagnostics(),
128317
128384
  affectedFilesPendingEmit,
128318
- changeFileSet,
128385
+ changeFileSet: toChangeFileSet(),
128319
128386
  emitSignatures,
128320
128387
  latestChangedDtsFile
128321
128388
  };
@@ -128398,8 +128465,7 @@ function getBuildInfo2(state) {
128398
128465
  function convertToProgramBuildInfoDiagnostics() {
128399
128466
  let result;
128400
128467
  state.fileInfos.forEach((_value, key) => {
128401
- var _a2;
128402
- const value = (_a2 = state.semanticDiagnosticsPerFile) == null ? void 0 : _a2.get(key);
128468
+ const value = state.semanticDiagnosticsPerFile.get(key);
128403
128469
  if (!value) {
128404
128470
  if (!state.changedFilesSet.has(key)) result = append(result, toFileId(key));
128405
128471
  } else if (value.length) {
@@ -128468,6 +128534,15 @@ function getBuildInfo2(state) {
128468
128534
  return result;
128469
128535
  }) || array;
128470
128536
  }
128537
+ function toChangeFileSet() {
128538
+ let changeFileSet;
128539
+ if (state.changedFilesSet.size) {
128540
+ for (const path of arrayFrom(state.changedFilesSet.keys()).sort(compareStringsCaseSensitive)) {
128541
+ changeFileSet = append(changeFileSet, toFileId(path));
128542
+ }
128543
+ }
128544
+ return changeFileSet;
128545
+ }
128471
128546
  }
128472
128547
  var BuilderProgramKind = /* @__PURE__ */ ((BuilderProgramKind2) => {
128473
128548
  BuilderProgramKind2[BuilderProgramKind2["SemanticDiagnosticsBuilderProgram"] = 0] = "SemanticDiagnosticsBuilderProgram";
@@ -128571,14 +128646,16 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128571
128646
  return emitSkippedWithNoDiagnostics;
128572
128647
  }
128573
128648
  function emitNextAffectedFile(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
128574
- var _a, _b, _c;
128649
+ var _a, _b, _c, _d;
128575
128650
  let affected = getNextAffectedFile(state, cancellationToken, host);
128576
128651
  const programEmitKind = getBuilderFileEmit(state.compilerOptions);
128577
128652
  let emitKind = emitOnlyDtsFiles ? programEmitKind & 24 /* AllDts */ : programEmitKind;
128578
128653
  if (!affected) {
128579
128654
  if (!state.compilerOptions.outFile) {
128580
128655
  const pendingAffectedFile = getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles);
128581
- if (!pendingAffectedFile) {
128656
+ if (pendingAffectedFile) {
128657
+ ({ affectedFile: affected, emitKind } = pendingAffectedFile);
128658
+ } else {
128582
128659
  const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(state);
128583
128660
  if (pendingForDiagnostics) {
128584
128661
  (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(pendingForDiagnostics.affectedFile.resolvedPath, pendingForDiagnostics.seenKind | 24 /* AllDts */);
@@ -128587,48 +128664,73 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128587
128664
  affected: pendingForDiagnostics.affectedFile
128588
128665
  };
128589
128666
  }
128590
- if (!state.buildInfoEmitPending) return void 0;
128591
- const affected2 = state.program;
128592
- const result2 = affected2.emitBuildInfo(writeFile2 || maybeBind(host, host.writeFile), cancellationToken);
128593
- state.buildInfoEmitPending = false;
128594
- return { result: result2, affected: affected2 };
128595
128667
  }
128596
- ({ affectedFile: affected, emitKind } = pendingAffectedFile);
128597
128668
  } else {
128598
- if (!state.programEmitPending) return void 0;
128599
- emitKind = state.programEmitPending;
128600
- if (emitOnlyDtsFiles) emitKind = emitKind & 24 /* AllDts */;
128601
- if (!emitKind) return void 0;
128602
- affected = state.program;
128669
+ if (state.programEmitPending) {
128670
+ emitKind = state.programEmitPending;
128671
+ if (emitOnlyDtsFiles) emitKind = emitKind & 24 /* AllDts */;
128672
+ if (emitKind) affected = state.program;
128673
+ }
128674
+ if (!affected && ((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size)) {
128675
+ const seenKind = state.seenProgramEmit || 0 /* None */;
128676
+ if (!(seenKind & 24 /* AllDts */)) {
128677
+ state.seenProgramEmit = 24 /* AllDts */ | seenKind;
128678
+ const diagnostics = [];
128679
+ state.emitDiagnosticsPerFile.forEach((d) => addRange(diagnostics, d));
128680
+ return {
128681
+ result: { emitSkipped: true, diagnostics },
128682
+ affected: state.program
128683
+ };
128684
+ }
128685
+ }
128686
+ }
128687
+ if (!affected) {
128688
+ if (!state.buildInfoEmitPending) return void 0;
128689
+ const affected2 = state.program;
128690
+ const result2 = affected2.emitBuildInfo(writeFile2 || maybeBind(host, host.writeFile), cancellationToken);
128691
+ state.buildInfoEmitPending = false;
128692
+ return { result: result2, affected: affected2 };
128603
128693
  }
128604
128694
  }
128605
128695
  let emitOnly;
128606
128696
  if (emitKind & 7 /* AllJs */) emitOnly = 0 /* Js */;
128607
128697
  if (emitKind & 24 /* AllDts */) emitOnly = emitOnly === void 0 ? 1 /* Dts */ : void 0;
128608
- if (affected === state.program) {
128609
- state.programEmitPending = state.changedFilesSet.size ? getPendingEmitKind(programEmitKind, emitKind) : state.programEmitPending ? getPendingEmitKind(state.programEmitPending, emitKind) : void 0;
128610
- }
128611
128698
  const result = state.program.emit(
128612
128699
  affected === state.program ? void 0 : affected,
128613
128700
  getWriteFileCallback(writeFile2, customTransformers),
128614
128701
  cancellationToken,
128615
128702
  emitOnly,
128616
- customTransformers
128703
+ customTransformers,
128704
+ /*forceDtsEmit*/
128705
+ void 0,
128706
+ /*skipBuildInfo*/
128707
+ true
128617
128708
  );
128618
128709
  if (affected !== state.program) {
128619
128710
  const affectedSourceFile = affected;
128620
128711
  state.seenAffectedFiles.add(affectedSourceFile.resolvedPath);
128621
128712
  if (state.affectedFilesIndex !== void 0) state.affectedFilesIndex++;
128622
128713
  state.buildInfoEmitPending = true;
128623
- const existing = ((_a = state.seenEmittedFiles) == null ? void 0 : _a.get(affectedSourceFile.resolvedPath)) || 0 /* None */;
128714
+ const existing = ((_b = state.seenEmittedFiles) == null ? void 0 : _b.get(affectedSourceFile.resolvedPath)) || 0 /* None */;
128624
128715
  (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, emitKind | existing);
128625
- const existingPending = ((_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.get(affectedSourceFile.resolvedPath)) || programEmitKind;
128716
+ const existingPending = ((_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.get(affectedSourceFile.resolvedPath)) || programEmitKind;
128626
128717
  const pendingKind = getPendingEmitKind(existingPending, emitKind | existing);
128627
128718
  if (pendingKind) (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, pendingKind);
128628
- else (_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.delete(affectedSourceFile.resolvedPath);
128719
+ else (_d = state.affectedFilesPendingEmit) == null ? void 0 : _d.delete(affectedSourceFile.resolvedPath);
128629
128720
  if (result.diagnostics.length) (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, result.diagnostics);
128630
128721
  } else {
128631
128722
  state.changedFilesSet.clear();
128723
+ state.programEmitPending = state.changedFilesSet.size ? getPendingEmitKind(programEmitKind, emitKind) : state.programEmitPending ? getPendingEmitKind(state.programEmitPending, emitKind) : void 0;
128724
+ state.seenProgramEmit = emitKind | (state.seenProgramEmit || 0 /* None */);
128725
+ let emitDiagnosticsPerFile;
128726
+ result.diagnostics.forEach((d) => {
128727
+ if (!d.file) return;
128728
+ let diagnostics = emitDiagnosticsPerFile == null ? void 0 : emitDiagnosticsPerFile.get(d.file.resolvedPath);
128729
+ if (!diagnostics) (emitDiagnosticsPerFile ?? (emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(d.file.resolvedPath, diagnostics = []);
128730
+ diagnostics.push(d);
128731
+ });
128732
+ if (emitDiagnosticsPerFile) state.emitDiagnosticsPerFile = emitDiagnosticsPerFile;
128733
+ state.buildInfoEmitPending = true;
128632
128734
  }
128633
128735
  return { result, affected };
128634
128736
  }
@@ -128750,28 +128852,37 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128750
128852
  state.buildInfoEmitPending = true;
128751
128853
  if (!result) continue;
128752
128854
  } else {
128753
- result = state.program.getSemanticDiagnostics(
128754
- /*sourceFile*/
128755
- void 0,
128756
- cancellationToken
128855
+ let diagnostics;
128856
+ const semanticDiagnosticsPerFile = /* @__PURE__ */ new Map();
128857
+ state.program.getSourceFiles().forEach(
128858
+ (sourceFile) => diagnostics = addRange(
128859
+ diagnostics,
128860
+ getSemanticDiagnosticsOfFile(
128861
+ state,
128862
+ sourceFile,
128863
+ cancellationToken,
128864
+ semanticDiagnosticsPerFile
128865
+ )
128866
+ )
128757
128867
  );
128868
+ state.semanticDiagnosticsPerFile = semanticDiagnosticsPerFile;
128869
+ result = diagnostics || emptyArray;
128758
128870
  state.changedFilesSet.clear();
128759
128871
  state.programEmitPending = getBuilderFileEmit(state.compilerOptions);
128872
+ state.buildInfoEmitPending = true;
128760
128873
  }
128761
128874
  return { result, affected };
128762
128875
  }
128763
128876
  }
128764
128877
  function getSemanticDiagnostics(sourceFile, cancellationToken) {
128765
128878
  assertSourceFileOkWithoutNextAffectedCall(state, sourceFile);
128766
- const compilerOptions = Debug.checkDefined(state.program).getCompilerOptions();
128767
- if (compilerOptions.outFile) {
128768
- Debug.assert(!state.semanticDiagnosticsPerFile);
128769
- return Debug.checkDefined(state.program).getSemanticDiagnostics(sourceFile, cancellationToken);
128770
- }
128771
128879
  if (sourceFile) {
128772
128880
  return getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken);
128773
128881
  }
128774
- while (getSemanticDiagnosticsOfNextAffectedFile(cancellationToken)) {
128882
+ while (true) {
128883
+ const affectedResult = getSemanticDiagnosticsOfNextAffectedFile(cancellationToken);
128884
+ if (!affectedResult) break;
128885
+ if (affectedResult.affected === state.program) return affectedResult.result;
128775
128886
  }
128776
128887
  let diagnostics;
128777
128888
  for (const sourceFile2 of Debug.checkDefined(state.program).getSourceFiles()) {
@@ -128804,8 +128915,9 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
128804
128915
  const filePaths = (_a = program.fileNames) == null ? void 0 : _a.map(toPathInBuildInfoDirectory);
128805
128916
  let filePathsSetList;
128806
128917
  const latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : void 0;
128918
+ const fileInfos = /* @__PURE__ */ new Map();
128919
+ const changedFilesSet = new Set(map(program.changeFileSet, toFilePath));
128807
128920
  if (isProgramBundleEmitBuildInfo(program)) {
128808
- const fileInfos = /* @__PURE__ */ new Map();
128809
128921
  program.fileInfos.forEach((fileInfo, index) => {
128810
128922
  const path = toFilePath(index + 1);
128811
128923
  fileInfos.set(path, isString(fileInfo) ? { version: fileInfo, signature: void 0, affectsGlobalScope: void 0, impliedFormat: void 0 } : fileInfo);
@@ -128813,13 +128925,16 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
128813
128925
  state = {
128814
128926
  fileInfos,
128815
128927
  compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
128928
+ semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(program.semanticDiagnosticsPerFile),
128929
+ emitDiagnosticsPerFile: toPerFileEmitDiagnostics(program.emitDiagnosticsPerFile),
128930
+ hasReusableDiagnostic: true,
128931
+ changedFilesSet,
128816
128932
  latestChangedDtsFile,
128817
128933
  outSignature: program.outSignature,
128818
128934
  programEmitPending: program.pendingEmit === void 0 ? void 0 : toProgramEmitPending(program.pendingEmit, program.options)
128819
128935
  };
128820
128936
  } else {
128821
128937
  filePathsSetList = (_b = program.fileIdsList) == null ? void 0 : _b.map((fileIds) => new Set(fileIds.map(toFilePath)));
128822
- const fileInfos = /* @__PURE__ */ new Map();
128823
128938
  const emitSignatures = ((_c = program.options) == null ? void 0 : _c.composite) && !program.options.outFile ? /* @__PURE__ */ new Map() : void 0;
128824
128939
  program.fileInfos.forEach((fileInfo, index) => {
128825
128940
  const path = toFilePath(index + 1);
@@ -128840,13 +128955,12 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
128840
128955
  );
128841
128956
  }
128842
128957
  });
128843
- const changedFilesSet = new Set(map(program.changeFileSet, toFilePath));
128844
128958
  const fullEmitForOptions = program.affectedFilesPendingEmit ? getBuilderFileEmit(program.options || {}) : void 0;
128845
128959
  state = {
128846
128960
  fileInfos,
128847
128961
  compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
128848
128962
  referencedMap: toManyToManyPathMap(program.referencedMap, program.options ?? {}),
128849
- semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(program.semanticDiagnosticsPerFile, fileInfos, changedFilesSet),
128963
+ semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(program.semanticDiagnosticsPerFile),
128850
128964
  emitDiagnosticsPerFile: toPerFileEmitDiagnostics(program.emitDiagnosticsPerFile),
128851
128965
  hasReusableDiagnostic: true,
128852
128966
  affectedFilesPendingEmit: program.affectedFilesPendingEmit && arrayToMap(program.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
@@ -128898,7 +129012,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
128898
129012
  referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
128899
129013
  return map2;
128900
129014
  }
128901
- function toPerFileSemanticDiagnostics(diagnostics, fileInfos, changedFilesSet) {
129015
+ function toPerFileSemanticDiagnostics(diagnostics) {
128902
129016
  const semanticDiagnostics = new Map(
128903
129017
  mapDefinedIterator(
128904
129018
  fileInfos.keys(),
@@ -128909,7 +129023,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
128909
129023
  if (isNumber(value)) semanticDiagnostics.delete(toFilePath(value));
128910
129024
  else semanticDiagnostics.set(toFilePath(value[0]), value[1]);
128911
129025
  });
128912
- return semanticDiagnostics.size ? semanticDiagnostics : void 0;
129026
+ return semanticDiagnostics;
128913
129027
  }
128914
129028
  function toPerFileEmitDiagnostics(diagnostics) {
128915
129029
  return diagnostics && arrayToMap(diagnostics, (value) => toFilePath(value[0]), (value) => value[1]);
@@ -132085,8 +132199,6 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
132085
132199
  ({ buildResult, step } = buildErrors(
132086
132200
  state,
132087
132201
  projectPath,
132088
- program,
132089
- config,
132090
132202
  diagnostics,
132091
132203
  errorFlags,
132092
132204
  errorType
@@ -132149,8 +132261,6 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
132149
132261
  ({ buildResult, step } = buildErrors(
132150
132262
  state,
132151
132263
  projectPath,
132152
- program,
132153
- config,
132154
132264
  declDiagnostics,
132155
132265
  32 /* DeclarationEmitErrors */,
132156
132266
  "Declaration file"
@@ -132213,8 +132323,6 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
132213
132323
  ({ buildResult, step } = buildErrors(
132214
132324
  state,
132215
132325
  projectPath,
132216
- program,
132217
- config,
132218
132326
  emitDiagnostics,
132219
132327
  64 /* EmitErrors */,
132220
132328
  "Emit"
@@ -132394,13 +132502,10 @@ function afterProgramDone(state, program) {
132394
132502
  }
132395
132503
  state.projectCompilerOptions = state.baseCompilerOptions;
132396
132504
  }
132397
- function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
132398
- const canEmitBuildInfo = program && !program.getCompilerOptions().outFile;
132505
+ function buildErrors(state, resolvedPath, diagnostics, buildResult, errorType) {
132399
132506
  reportAndStoreErrors(state, resolvedPath, diagnostics);
132400
132507
  state.projectStatus.set(resolvedPath, { type: 0 /* Unbuildable */, reason: `${errorType} errors` });
132401
- if (canEmitBuildInfo) return { buildResult, step: 4 /* EmitBuildInfo */ };
132402
- afterProgramDone(state, program);
132403
- return { buildResult, step: 5 /* QueueReferencingProjects */ };
132508
+ return { buildResult, step: 4 /* EmitBuildInfo */ };
132404
132509
  }
132405
132510
  function isFileWatcherWithModifiedTime(value) {
132406
132511
  return !!value.watcher;
@@ -132575,7 +132680,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
132575
132680
  };
132576
132681
  }
132577
132682
  if (buildInfo.program) {
132578
- 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)) {
132683
+ 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)) {
132579
132684
  return {
132580
132685
  type: 7 /* OutOfDateBuildInfo */,
132581
132686
  buildInfoFile: buildInfoPath
@@ -180517,6 +180622,7 @@ __export(ts_exports2, {
180517
180622
  unusedLabelIsError: () => unusedLabelIsError,
180518
180623
  unwrapInnermostStatementOfLabel: () => unwrapInnermostStatementOfLabel,
180519
180624
  unwrapParenthesizedExpression: () => unwrapParenthesizedExpression,
180625
+ unwrapParenthesizedType: () => unwrapParenthesizedType,
180520
180626
  updateErrorForNoInputFiles: () => updateErrorForNoInputFiles,
180521
180627
  updateLanguageServiceSourceFile: () => updateLanguageServiceSourceFile,
180522
180628
  updateMissingFilePathsWatch: () => updateMissingFilePathsWatch,
@@ -184681,23 +184787,8 @@ function findProjectByName(projectName, projects) {
184681
184787
  }
184682
184788
  var noopConfigFileWatcher = { close: noop };
184683
184789
  function getConfigFileNameFromCache(info, cache) {
184684
- if (!cache) return void 0;
184685
- const configFileForOpenFile = cache.get(info.path);
184686
- if (configFileForOpenFile === void 0) return void 0;
184687
- if (!isAncestorConfigFileInfo(info)) {
184688
- return isString(configFileForOpenFile) || !configFileForOpenFile ? configFileForOpenFile : (
184689
- // direct result
184690
- configFileForOpenFile.get(
184691
- /*key*/
184692
- false
184693
- )
184694
- );
184695
- } else {
184696
- return configFileForOpenFile && !isString(configFileForOpenFile) ? (
184697
- // Map with fileName as key
184698
- configFileForOpenFile.get(info.fileName)
184699
- ) : void 0;
184700
- }
184790
+ if (!cache || isAncestorConfigFileInfo(info)) return void 0;
184791
+ return cache.get(info.path);
184701
184792
  }
184702
184793
  function isOpenScriptInfo(infoOrFileNameOrConfig) {
184703
184794
  return !!infoOrFileNameOrConfig.containingProjects;
@@ -184711,15 +184802,13 @@ var ConfiguredProjectLoadKind = /* @__PURE__ */ ((ConfiguredProjectLoadKind2) =>
184711
184802
  ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Reload"] = 2] = "Reload";
184712
184803
  return ConfiguredProjectLoadKind2;
184713
184804
  })(ConfiguredProjectLoadKind || {});
184714
- function forEachAncestorProject(info, project, cb, kind, reason, allowDeferredClosed, reloadedProjects, searchOnlyPotentialSolution, delayReloadedConfiguredProjects) {
184805
+ function forEachAncestorProject(info, project, cb, kind, reason, allowDeferredClosed, reloadedProjects, delayReloadedConfiguredProjects) {
184715
184806
  while (true) {
184716
- if (!project.isInitialLoadPending() && (searchOnlyPotentialSolution && !project.getCompilerOptions().composite || // TODO: Should this flag be shared between trying to load solution for find all references vs trying to find default project
184717
- project.getCompilerOptions().disableSolutionSearching)) return;
184807
+ if (!project.isInitialLoadPending() && (!project.getCompilerOptions().composite || project.getCompilerOptions().disableSolutionSearching)) return;
184718
184808
  const configFileName = project.projectService.getConfigFileNameForFile({
184719
184809
  fileName: project.getConfigFilePath(),
184720
184810
  path: info.path,
184721
- configFileInfo: true,
184722
- isForDefaultProject: !searchOnlyPotentialSolution
184811
+ configFileInfo: true
184723
184812
  }, kind === 0 /* Find */);
184724
184813
  if (!configFileName) return;
184725
184814
  const ancestor = project.projectService.findCreateOrReloadConfiguredProject(
@@ -184727,11 +184816,11 @@ function forEachAncestorProject(info, project, cb, kind, reason, allowDeferredCl
184727
184816
  kind,
184728
184817
  reason,
184729
184818
  allowDeferredClosed,
184730
- !searchOnlyPotentialSolution ? info.fileName : void 0,
184731
- // Config Diag event for project if its for default project
184819
+ /*triggerFile*/
184820
+ void 0,
184732
184821
  reloadedProjects,
184733
- searchOnlyPotentialSolution,
184734
- // Delay load if we are searching for solution
184822
+ /*delayLoad*/
184823
+ true,
184735
184824
  delayReloadedConfiguredProjects
184736
184825
  );
184737
184826
  if (!ancestor) return;
@@ -185832,7 +185921,7 @@ var _ProjectService = class _ProjectService {
185832
185921
  configFileExists(configFileName, canonicalConfigFilePath, info) {
185833
185922
  const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
185834
185923
  let openFilesImpactedByConfigFile;
185835
- if (this.openFiles.has(info.path) && (!isAncestorConfigFileInfo(info) || info.isForDefaultProject)) {
185924
+ if (this.openFiles.has(info.path) && !isAncestorConfigFileInfo(info)) {
185836
185925
  if (configFileExistenceInfo) (configFileExistenceInfo.openFilesImpactedByConfigFile ?? (configFileExistenceInfo.openFilesImpactedByConfigFile = /* @__PURE__ */ new Set())).add(info.path);
185837
185926
  else (openFilesImpactedByConfigFile = /* @__PURE__ */ new Set()).add(info.path);
185838
185927
  }
@@ -185960,31 +186049,24 @@ var _ProjectService = class _ProjectService {
185960
186049
  let searchPath = asNormalizedPath(getDirectoryPath(info.fileName));
185961
186050
  const isSearchPathInProjectRoot = () => containsPath(projectRootPath, searchPath, this.currentDirectory, !this.host.useCaseSensitiveFileNames);
185962
186051
  const anySearchPathOk = !projectRootPath || !isSearchPathInProjectRoot();
185963
- let searchTsconfig = true;
185964
- let searchJsconfig = true;
185965
- if (isAncestorConfigFileInfo(info)) {
185966
- if (endsWith(info.fileName, "tsconfig.json")) searchTsconfig = false;
185967
- else searchTsconfig = searchJsconfig = false;
185968
- }
186052
+ let searchInDirectory = !isAncestorConfigFileInfo(info);
185969
186053
  do {
185970
- const canonicalSearchPath = normalizedPathToPath(searchPath, this.currentDirectory, this.toCanonicalFileName);
185971
- if (searchTsconfig) {
186054
+ if (searchInDirectory) {
186055
+ const canonicalSearchPath = normalizedPathToPath(searchPath, this.currentDirectory, this.toCanonicalFileName);
185972
186056
  const tsconfigFileName = asNormalizedPath(combinePaths(searchPath, "tsconfig.json"));
185973
- const result = action(combinePaths(canonicalSearchPath, "tsconfig.json"), tsconfigFileName);
186057
+ let result = action(combinePaths(canonicalSearchPath, "tsconfig.json"), tsconfigFileName);
185974
186058
  if (result) return tsconfigFileName;
185975
- }
185976
- if (searchJsconfig) {
185977
186059
  const jsconfigFileName = asNormalizedPath(combinePaths(searchPath, "jsconfig.json"));
185978
- const result = action(combinePaths(canonicalSearchPath, "jsconfig.json"), jsconfigFileName);
186060
+ result = action(combinePaths(canonicalSearchPath, "jsconfig.json"), jsconfigFileName);
185979
186061
  if (result) return jsconfigFileName;
185980
- }
185981
- if (isNodeModulesDirectory(canonicalSearchPath)) {
185982
- break;
186062
+ if (isNodeModulesDirectory(canonicalSearchPath)) {
186063
+ break;
186064
+ }
185983
186065
  }
185984
186066
  const parentPath = asNormalizedPath(getDirectoryPath(searchPath));
185985
186067
  if (parentPath === searchPath) break;
185986
186068
  searchPath = parentPath;
185987
- searchTsconfig = searchJsconfig = true;
186069
+ searchInDirectory = true;
185988
186070
  } while (anySearchPathOk || isSearchPathInProjectRoot());
185989
186071
  return void 0;
185990
186072
  }
@@ -186007,19 +186089,8 @@ var _ProjectService = class _ProjectService {
186007
186089
  /** Caches the configFilename for script info or ancestor of open script info */
186008
186090
  setConfigFileNameForFileInCache(info, configFileName) {
186009
186091
  if (!this.openFiles.has(info.path)) return;
186010
- const config = configFileName || false;
186011
- if (!isAncestorConfigFileInfo(info)) {
186012
- this.configFileForOpenFiles.set(info.path, config);
186013
- } else {
186014
- let configFileForOpenFile = this.configFileForOpenFiles.get(info.path);
186015
- if (!configFileForOpenFile || isString(configFileForOpenFile)) {
186016
- this.configFileForOpenFiles.set(
186017
- info.path,
186018
- configFileForOpenFile = (/* @__PURE__ */ new Map()).set(false, configFileForOpenFile)
186019
- );
186020
- }
186021
- configFileForOpenFile.set(info.fileName, config);
186022
- }
186092
+ if (isAncestorConfigFileInfo(info)) return;
186093
+ this.configFileForOpenFiles.set(info.path, configFileName || false);
186023
186094
  }
186024
186095
  /**
186025
186096
  * This function tries to search for a tsconfig.json for the given file.
@@ -187396,7 +187467,7 @@ Dynamic files must always be opened with service's current directory or service
187396
187467
  seenProjects
187397
187468
  };
187398
187469
  function tryFindDefaultConfiguredProject(project) {
187399
- return isDefaultProject(project) ? defaultProject : tryFindDefaultConfiguredProjectFromReferences(project) ?? tryFindDefaultConfiguredProjectFromAncestor(project);
187470
+ return isDefaultProject(project) ? defaultProject : tryFindDefaultConfiguredProjectFromReferences(project);
187400
187471
  }
187401
187472
  function isDefaultProject(project) {
187402
187473
  if (!tryAddToSet(seenProjects, project)) return;
@@ -187419,20 +187490,6 @@ Dynamic files must always be opened with service's current directory or service
187419
187490
  reloadedProjects
187420
187491
  );
187421
187492
  }
187422
- function tryFindDefaultConfiguredProjectFromAncestor(project) {
187423
- return forEachAncestorProject(
187424
- // If not in referenced projects, try ancestors and its references
187425
- info,
187426
- project,
187427
- tryFindDefaultConfiguredProject,
187428
- kind,
187429
- `Creating possible configured project for ${info.fileName} to open`,
187430
- allowDeferredClosed,
187431
- reloadedProjects,
187432
- /*searchOnlyPotentialSolution*/
187433
- false
187434
- );
187435
- }
187436
187493
  }
187437
187494
  tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(info, kind, reloadedProjects, delayReloadedConfiguredProjects) {
187438
187495
  const allowDeferredClosed = kind === 0 /* Find */;
@@ -187455,8 +187512,6 @@ Dynamic files must always be opened with service's current directory or service
187455
187512
  `Creating project possibly referencing default composite project ${defaultProject.getProjectName()} of open file ${info.fileName}`,
187456
187513
  allowDeferredClosed,
187457
187514
  reloadedProjects,
187458
- /*searchOnlyPotentialSolution*/
187459
- true,
187460
187515
  delayReloadedConfiguredProjects
187461
187516
  );
187462
187517
  }
@@ -195000,6 +195055,7 @@ if (typeof console !== "undefined") {
195000
195055
  unusedLabelIsError,
195001
195056
  unwrapInnermostStatementOfLabel,
195002
195057
  unwrapParenthesizedExpression,
195058
+ unwrapParenthesizedType,
195003
195059
  updateErrorForNoInputFiles,
195004
195060
  updateLanguageServiceSourceFile,
195005
195061
  updateMissingFilePathsWatch,