1- /*@internal */
2- namespace ts {
1+ import * as ts from "./_namespaces/ts" ;
2+
3+ /* @internal */
34export interface ReusableDiagnostic extends ReusableDiagnosticRelatedInformation {
45 /** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */
56 reportsUnnecessary ?: { } ;
@@ -9,6 +10,7 @@ export interface ReusableDiagnostic extends ReusableDiagnosticRelatedInformation
910 skippedOn ?: keyof ts . CompilerOptions ;
1011}
1112
13+ /* @internal */
1214export interface ReusableDiagnosticRelatedInformation {
1315 category : ts . DiagnosticCategory ;
1416 code : number ;
@@ -18,8 +20,10 @@ export interface ReusableDiagnosticRelatedInformation {
1820 messageText : string | ReusableDiagnosticMessageChain ;
1921}
2022
23+ /* @internal */
2124export type ReusableDiagnosticMessageChain = ts . DiagnosticMessageChain ;
2225
26+ /* @internal */
2327export interface ReusableBuilderProgramState extends ts . ReusableBuilderState {
2428 /**
2529 * Cache of bind and check diagnostics for files with their Path being the key
@@ -76,11 +80,13 @@ export interface ReusableBuilderProgramState extends ts.ReusableBuilderState {
7680 hasReusableDiagnostic ?: true ;
7781}
7882
83+ /* @internal */
7984export const enum BuilderFileEmit {
8085 DtsOnly ,
8186 Full
8287}
8388
89+ /* @internal */
8490/**
8591 * State to store the changed files, affected files and cache semantic diagnostics
8692 */
@@ -773,11 +779,17 @@ function getBinderAndCheckerDiagnosticsOfFile(state: BuilderProgramState, source
773779 return ts . filterSemanticDiagnostics ( diagnostics , state . compilerOptions ) ;
774780}
775781
782+ /* @internal */
776783export type ProgramBuildInfoFileId = number & { __programBuildInfoFileIdBrand : any } ;
784+ /* @internal */
777785export type ProgramBuildInfoFileIdListId = number & { __programBuildInfoFileIdListIdBrand : any } ;
786+ /* @internal */
778787export type ProgramBuildInfoDiagnostic = ProgramBuildInfoFileId | [ fileId : ProgramBuildInfoFileId , diagnostics : readonly ReusableDiagnostic [ ] ] ;
788+ /* @internal */
779789export type ProgramBuilderInfoFilePendingEmit = [ fileId : ProgramBuildInfoFileId , emitKind : BuilderFileEmit ] ;
790+ /* @internal */
780791export type ProgramBuildInfoReferencedMap = [ fileId : ProgramBuildInfoFileId , fileIdListId : ProgramBuildInfoFileIdListId ] [ ] ;
792+ /* @internal */
781793export type ProgramBuildInfoBuilderStateFileInfo = Omit < ts . BuilderState . FileInfo , "signature" > & {
782794 /**
783795 * Signature is
@@ -787,10 +799,12 @@ export type ProgramBuildInfoBuilderStateFileInfo = Omit<ts.BuilderState.FileInfo
787799 */
788800 signature : string | false | undefined ;
789801} ;
802+ /* @internal */
790803/**
791804 * ProgramBuildInfoFileInfo is string if FileInfo.version === FileInfo.signature && !FileInfo.affectsGlobalScope otherwise encoded FileInfo
792805 */
793806export type ProgramBuildInfoFileInfo = string | ProgramBuildInfoBuilderStateFileInfo ;
807+ /* @internal */
794808export interface ProgramBuildInfo {
795809 fileNames : readonly string [ ] ;
796810 fileInfos : readonly ProgramBuildInfoFileInfo [ ] ;
@@ -993,18 +1007,21 @@ function convertToReusableDiagnosticRelatedInformation(diagnostic: ts.Diagnostic
9931007 } ;
9941008}
9951009
1010+ /* @internal */
9961011export enum BuilderProgramKind {
9971012 SemanticDiagnosticsBuilderProgram ,
9981013 EmitAndSemanticDiagnosticsBuilderProgram
9991014}
10001015
1016+ /* @internal */
10011017export interface BuilderCreationParameters {
10021018 newProgram : ts . Program ;
10031019 host : ts . BuilderProgramHost ;
10041020 oldProgram : ts . BuilderProgram | undefined ;
10051021 configFileParsingDiagnostics : readonly ts . Diagnostic [ ] ;
10061022}
10071023
1024+ /* @internal */
10081025export function getBuilderCreationParameters ( newProgramOrRootNames : ts . Program | readonly string [ ] | undefined , hostOrOptions : ts . BuilderProgramHost | ts . CompilerOptions | undefined , oldProgramOrHost ?: ts . BuilderProgram | ts . CompilerHost , configFileParsingDiagnosticsOrOldProgram ?: readonly ts . Diagnostic [ ] | ts . BuilderProgram , configFileParsingDiagnostics ?: readonly ts . Diagnostic [ ] , projectReferences ?: readonly ts . ProjectReference [ ] ) : BuilderCreationParameters {
10091026 let host : ts . BuilderProgramHost ;
10101027 let newProgram : ts . Program ;
@@ -1037,8 +1054,11 @@ export function getBuilderCreationParameters(newProgramOrRootNames: ts.Program |
10371054 return { host, newProgram, oldProgram, configFileParsingDiagnostics : configFileParsingDiagnostics || ts . emptyArray } ;
10381055}
10391056
1057+ /* @internal */
10401058export function createBuilderProgram ( kind : BuilderProgramKind . SemanticDiagnosticsBuilderProgram , builderCreationParameters : BuilderCreationParameters ) : ts . SemanticDiagnosticsBuilderProgram ;
1059+ /* @internal */
10411060export function createBuilderProgram ( kind : BuilderProgramKind . EmitAndSemanticDiagnosticsBuilderProgram , builderCreationParameters : BuilderCreationParameters ) : ts . EmitAndSemanticDiagnosticsBuilderProgram ;
1061+ /* @internal */
10421062export function createBuilderProgram ( kind : BuilderProgramKind , { newProgram, host, oldProgram, configFileParsingDiagnostics } : BuilderCreationParameters ) {
10431063 // Return same program if underlying program doesnt change
10441064 let oldState = oldProgram && oldProgram . getState ( ) ;
@@ -1351,6 +1371,7 @@ function addToAffectedFilesPendingEmit(state: BuilderProgramState, affectedFileP
13511371 }
13521372}
13531373
1374+ /* @internal */
13541375export function toBuilderStateFileInfo ( fileInfo : ProgramBuildInfoFileInfo ) : ts . BuilderState . FileInfo {
13551376 return ts . isString ( fileInfo ) ?
13561377 { version : fileInfo , signature : fileInfo , affectsGlobalScope : undefined , impliedFormat : undefined } :
@@ -1359,6 +1380,7 @@ export function toBuilderStateFileInfo(fileInfo: ProgramBuildInfoFileInfo): ts.B
13591380 { version : fileInfo . version , signature : fileInfo . signature === false ? undefined : fileInfo . version , affectsGlobalScope : fileInfo . affectsGlobalScope , impliedFormat : fileInfo . impliedFormat } ;
13601381}
13611382
1383+ /* @internal */
13621384export function createBuildProgramUsingProgramBuildInfo ( program : ProgramBuildInfo , buildInfoPath : string , host : ts . ReadBuildProgramHost ) : ts . EmitAndSemanticDiagnosticsBuilderProgram {
13631385 const buildInfoDirectory = ts . getDirectoryPath ( ts . getNormalizedAbsolutePath ( buildInfoPath , host . getCurrentDirectory ( ) ) ) ;
13641386 const getCanonicalFileName = ts . createGetCanonicalFileName ( host . useCaseSensitiveFileNames ( ) ) ;
@@ -1432,6 +1454,7 @@ export function createBuildProgramUsingProgramBuildInfo(program: ProgramBuildInf
14321454 }
14331455}
14341456
1457+ /* @internal */
14351458export function createRedirectedBuilderProgram ( getState : ( ) => { program : ts . Program | undefined ; compilerOptions : ts . CompilerOptions ; } , configFileParsingDiagnostics : readonly ts . Diagnostic [ ] ) : ts . BuilderProgram {
14361459 return {
14371460 getState : ts . notImplemented ,
@@ -1460,4 +1483,3 @@ export function createRedirectedBuilderProgram(getState: () => { program: ts.Pro
14601483 return ts . Debug . checkDefined ( getState ( ) . program ) ;
14611484 }
14621485}
1463- }
0 commit comments