11namespace ts {
2- export type AffectedFileResult < T > = { result : T ; affected : SourceFile | Program ; } | undefined ;
2+ export type AffectedFileResult < T > = { result : T ; affected : ts . SourceFile | ts . Program ; } | undefined ;
33
44export interface BuilderProgramHost {
55 /**
@@ -14,7 +14,7 @@ export interface BuilderProgramHost {
1414 * When emit or emitNextAffectedFile are called without writeFile,
1515 * this callback if present would be used to write files
1616 */
17- writeFile ?: WriteFileCallback ;
17+ writeFile ?: ts . WriteFileCallback ;
1818 /**
1919 * disable using source file version as signature for testing
2020 */
@@ -32,20 +32,20 @@ export interface BuilderProgramHost {
3232 */
3333export interface BuilderProgram {
3434 /*@internal */
35- getState ( ) : ReusableBuilderProgramState ;
35+ getState ( ) : ts . ReusableBuilderProgramState ;
3636 /*@internal */
3737 backupState ( ) : void ;
3838 /*@internal */
3939 restoreState ( ) : void ;
4040 /**
4141 * Returns current program
4242 */
43- getProgram ( ) : Program ;
43+ getProgram ( ) : ts . Program ;
4444 /**
4545 * Returns current program that could be undefined if the program was released
4646 */
4747 /*@internal */
48- getProgramOrUndefined ( ) : Program | undefined ;
48+ getProgramOrUndefined ( ) : ts . Program | undefined ;
4949 /**
5050 * Releases reference to the program, making all the other operations that need program to fail.
5151 */
@@ -54,39 +54,39 @@ export interface BuilderProgram {
5454 /**
5555 * Get compiler options of the program
5656 */
57- getCompilerOptions ( ) : CompilerOptions ;
57+ getCompilerOptions ( ) : ts . CompilerOptions ;
5858 /**
5959 * Get the source file in the program with file name
6060 */
61- getSourceFile ( fileName : string ) : SourceFile | undefined ;
61+ getSourceFile ( fileName : string ) : ts . SourceFile | undefined ;
6262 /**
6363 * Get a list of files in the program
6464 */
65- getSourceFiles ( ) : readonly SourceFile [ ] ;
65+ getSourceFiles ( ) : readonly ts . SourceFile [ ] ;
6666 /**
6767 * Get the diagnostics for compiler options
6868 */
69- getOptionsDiagnostics ( cancellationToken ?: CancellationToken ) : readonly Diagnostic [ ] ;
69+ getOptionsDiagnostics ( cancellationToken ?: ts . CancellationToken ) : readonly ts . Diagnostic [ ] ;
7070 /**
7171 * Get the diagnostics that dont belong to any file
7272 */
73- getGlobalDiagnostics ( cancellationToken ?: CancellationToken ) : readonly Diagnostic [ ] ;
73+ getGlobalDiagnostics ( cancellationToken ?: ts . CancellationToken ) : readonly ts . Diagnostic [ ] ;
7474 /**
7575 * Get the diagnostics from config file parsing
7676 */
77- getConfigFileParsingDiagnostics ( ) : readonly Diagnostic [ ] ;
77+ getConfigFileParsingDiagnostics ( ) : readonly ts . Diagnostic [ ] ;
7878 /**
7979 * Get the syntax diagnostics, for all source files if source file is not supplied
8080 */
81- getSyntacticDiagnostics ( sourceFile ?: SourceFile , cancellationToken ?: CancellationToken ) : readonly Diagnostic [ ] ;
81+ getSyntacticDiagnostics ( sourceFile ?: ts . SourceFile , cancellationToken ?: ts . CancellationToken ) : readonly ts . Diagnostic [ ] ;
8282 /**
8383 * Get the declaration diagnostics, for all source files if source file is not supplied
8484 */
85- getDeclarationDiagnostics ( sourceFile ?: SourceFile , cancellationToken ?: CancellationToken ) : readonly DiagnosticWithLocation [ ] ;
85+ getDeclarationDiagnostics ( sourceFile ?: ts . SourceFile , cancellationToken ?: ts . CancellationToken ) : readonly ts . DiagnosticWithLocation [ ] ;
8686 /**
8787 * Get all the dependencies of the file
8888 */
89- getAllDependencies ( sourceFile : SourceFile ) : readonly string [ ] ;
89+ getAllDependencies ( sourceFile : ts . SourceFile ) : readonly string [ ] ;
9090
9191 /**
9292 * Gets the semantic diagnostics from the program corresponding to this state of file (if provided) or whole program
@@ -96,7 +96,7 @@ export interface BuilderProgram {
9696 * In case of SemanticDiagnosticsBuilderProgram if the source file is not provided,
9797 * it will iterate through all the affected files, to ensure that cache stays valid and yet provide a way to get all semantic diagnostics
9898 */
99- getSemanticDiagnostics ( sourceFile ?: SourceFile , cancellationToken ?: CancellationToken ) : readonly Diagnostic [ ] ;
99+ getSemanticDiagnostics ( sourceFile ?: ts . SourceFile , cancellationToken ?: ts . CancellationToken ) : readonly ts . Diagnostic [ ] ;
100100 /**
101101 * Emits the JavaScript and declaration files.
102102 * When targetSource file is specified, emits the files corresponding to that source file,
@@ -108,9 +108,9 @@ export interface BuilderProgram {
108108 * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host
109109 * in that order would be used to write the files
110110 */
111- emit ( targetSourceFile ?: SourceFile , writeFile ?: WriteFileCallback , cancellationToken ?: CancellationToken , emitOnlyDtsFiles ?: boolean , customTransformers ?: CustomTransformers ) : EmitResult ;
111+ emit ( targetSourceFile ?: ts . SourceFile , writeFile ?: ts . WriteFileCallback , cancellationToken ?: ts . CancellationToken , emitOnlyDtsFiles ?: boolean , customTransformers ?: ts . CustomTransformers ) : ts . EmitResult ;
112112 /*@internal */
113- emitBuildInfo ( writeFile ?: WriteFileCallback , cancellationToken ?: CancellationToken ) : EmitResult ;
113+ emitBuildInfo ( writeFile ?: ts . WriteFileCallback , cancellationToken ?: ts . CancellationToken ) : ts . EmitResult ;
114114 /**
115115 * Get the current directory of the program
116116 */
@@ -127,7 +127,7 @@ export interface SemanticDiagnosticsBuilderProgram extends BuilderProgram {
127127 * Gets the semantic diagnostics from the program for the next affected file and caches it
128128 * Returns undefined if the iteration is complete
129129 */
130- getSemanticDiagnosticsOfNextAffectedFile ( cancellationToken ?: CancellationToken , ignoreSourceFile ?: ( sourceFile : SourceFile ) => boolean ) : AffectedFileResult < readonly Diagnostic [ ] > ;
130+ getSemanticDiagnosticsOfNextAffectedFile ( cancellationToken ?: ts . CancellationToken , ignoreSourceFile ?: ( sourceFile : ts . SourceFile ) => boolean ) : AffectedFileResult < readonly ts . Diagnostic [ ] > ;
131131}
132132
133133/**
@@ -140,35 +140,35 @@ export interface EmitAndSemanticDiagnosticsBuilderProgram extends SemanticDiagno
140140 * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host
141141 * in that order would be used to write the files
142142 */
143- emitNextAffectedFile ( writeFile ?: WriteFileCallback , cancellationToken ?: CancellationToken , emitOnlyDtsFiles ?: boolean , customTransformers ?: CustomTransformers ) : AffectedFileResult < EmitResult > ;
143+ emitNextAffectedFile ( writeFile ?: ts . WriteFileCallback , cancellationToken ?: ts . CancellationToken , emitOnlyDtsFiles ?: boolean , customTransformers ?: ts . CustomTransformers ) : AffectedFileResult < ts . EmitResult > ;
144144}
145145
146146/**
147147 * Create the builder to manage semantic diagnostics and cache them
148148 */
149- export function createSemanticDiagnosticsBuilderProgram ( newProgram : Program , host : BuilderProgramHost , oldProgram ?: SemanticDiagnosticsBuilderProgram , configFileParsingDiagnostics ?: readonly Diagnostic [ ] ) : SemanticDiagnosticsBuilderProgram ;
150- export function createSemanticDiagnosticsBuilderProgram ( rootNames : readonly string [ ] | undefined , options : CompilerOptions | undefined , host ?: CompilerHost , oldProgram ?: SemanticDiagnosticsBuilderProgram , configFileParsingDiagnostics ?: readonly Diagnostic [ ] , projectReferences ?: readonly ProjectReference [ ] ) : SemanticDiagnosticsBuilderProgram ;
151- export function createSemanticDiagnosticsBuilderProgram ( newProgramOrRootNames : Program | readonly string [ ] | undefined , hostOrOptions : BuilderProgramHost | CompilerOptions | undefined , oldProgramOrHost ?: CompilerHost | SemanticDiagnosticsBuilderProgram , configFileParsingDiagnosticsOrOldProgram ?: readonly Diagnostic [ ] | SemanticDiagnosticsBuilderProgram , configFileParsingDiagnostics ?: readonly Diagnostic [ ] , projectReferences ?: readonly ProjectReference [ ] ) {
152- return createBuilderProgram ( BuilderProgramKind . SemanticDiagnosticsBuilderProgram , getBuilderCreationParameters ( newProgramOrRootNames , hostOrOptions , oldProgramOrHost , configFileParsingDiagnosticsOrOldProgram , configFileParsingDiagnostics , projectReferences ) ) ;
149+ export function createSemanticDiagnosticsBuilderProgram ( newProgram : ts . Program , host : BuilderProgramHost , oldProgram ?: SemanticDiagnosticsBuilderProgram , configFileParsingDiagnostics ?: readonly ts . Diagnostic [ ] ) : SemanticDiagnosticsBuilderProgram ;
150+ export function createSemanticDiagnosticsBuilderProgram ( rootNames : readonly string [ ] | undefined , options : ts . CompilerOptions | undefined , host ?: ts . CompilerHost , oldProgram ?: SemanticDiagnosticsBuilderProgram , configFileParsingDiagnostics ?: readonly ts . Diagnostic [ ] , projectReferences ?: readonly ts . ProjectReference [ ] ) : SemanticDiagnosticsBuilderProgram ;
151+ export function createSemanticDiagnosticsBuilderProgram ( newProgramOrRootNames : ts . Program | readonly string [ ] | undefined , hostOrOptions : BuilderProgramHost | ts . CompilerOptions | undefined , oldProgramOrHost ?: ts . CompilerHost | SemanticDiagnosticsBuilderProgram , configFileParsingDiagnosticsOrOldProgram ?: readonly ts . Diagnostic [ ] | SemanticDiagnosticsBuilderProgram , configFileParsingDiagnostics ?: readonly ts . Diagnostic [ ] , projectReferences ?: readonly ts . ProjectReference [ ] ) {
152+ return ts . createBuilderProgram ( ts . BuilderProgramKind . SemanticDiagnosticsBuilderProgram , ts . getBuilderCreationParameters ( newProgramOrRootNames , hostOrOptions , oldProgramOrHost , configFileParsingDiagnosticsOrOldProgram , configFileParsingDiagnostics , projectReferences ) ) ;
153153}
154154
155155/**
156156 * Create the builder that can handle the changes in program and iterate through changed files
157157 * to emit the those files and manage semantic diagnostics cache as well
158158 */
159- export function createEmitAndSemanticDiagnosticsBuilderProgram ( newProgram : Program , host : BuilderProgramHost , oldProgram ?: EmitAndSemanticDiagnosticsBuilderProgram , configFileParsingDiagnostics ?: readonly Diagnostic [ ] ) : EmitAndSemanticDiagnosticsBuilderProgram ;
160- export function createEmitAndSemanticDiagnosticsBuilderProgram ( rootNames : readonly string [ ] | undefined , options : CompilerOptions | undefined , host ?: CompilerHost , oldProgram ?: EmitAndSemanticDiagnosticsBuilderProgram , configFileParsingDiagnostics ?: readonly Diagnostic [ ] , projectReferences ?: readonly ProjectReference [ ] ) : EmitAndSemanticDiagnosticsBuilderProgram ;
161- export function createEmitAndSemanticDiagnosticsBuilderProgram ( newProgramOrRootNames : Program | readonly string [ ] | undefined , hostOrOptions : BuilderProgramHost | CompilerOptions | undefined , oldProgramOrHost ?: CompilerHost | EmitAndSemanticDiagnosticsBuilderProgram , configFileParsingDiagnosticsOrOldProgram ?: readonly Diagnostic [ ] | EmitAndSemanticDiagnosticsBuilderProgram , configFileParsingDiagnostics ?: readonly Diagnostic [ ] , projectReferences ?: readonly ProjectReference [ ] ) {
162- return createBuilderProgram ( BuilderProgramKind . EmitAndSemanticDiagnosticsBuilderProgram , getBuilderCreationParameters ( newProgramOrRootNames , hostOrOptions , oldProgramOrHost , configFileParsingDiagnosticsOrOldProgram , configFileParsingDiagnostics , projectReferences ) ) ;
159+ export function createEmitAndSemanticDiagnosticsBuilderProgram ( newProgram : ts . Program , host : BuilderProgramHost , oldProgram ?: EmitAndSemanticDiagnosticsBuilderProgram , configFileParsingDiagnostics ?: readonly ts . Diagnostic [ ] ) : EmitAndSemanticDiagnosticsBuilderProgram ;
160+ export function createEmitAndSemanticDiagnosticsBuilderProgram ( rootNames : readonly string [ ] | undefined , options : ts . CompilerOptions | undefined , host ?: ts . CompilerHost , oldProgram ?: EmitAndSemanticDiagnosticsBuilderProgram , configFileParsingDiagnostics ?: readonly ts . Diagnostic [ ] , projectReferences ?: readonly ts . ProjectReference [ ] ) : EmitAndSemanticDiagnosticsBuilderProgram ;
161+ export function createEmitAndSemanticDiagnosticsBuilderProgram ( newProgramOrRootNames : ts . Program | readonly string [ ] | undefined , hostOrOptions : BuilderProgramHost | ts . CompilerOptions | undefined , oldProgramOrHost ?: ts . CompilerHost | EmitAndSemanticDiagnosticsBuilderProgram , configFileParsingDiagnosticsOrOldProgram ?: readonly ts . Diagnostic [ ] | EmitAndSemanticDiagnosticsBuilderProgram , configFileParsingDiagnostics ?: readonly ts . Diagnostic [ ] , projectReferences ?: readonly ts . ProjectReference [ ] ) {
162+ return ts . createBuilderProgram ( ts . BuilderProgramKind . EmitAndSemanticDiagnosticsBuilderProgram , ts . getBuilderCreationParameters ( newProgramOrRootNames , hostOrOptions , oldProgramOrHost , configFileParsingDiagnosticsOrOldProgram , configFileParsingDiagnostics , projectReferences ) ) ;
163163}
164164
165165/**
166166 * Creates a builder thats just abstraction over program and can be used with watch
167167 */
168- export function createAbstractBuilder ( newProgram : Program , host : BuilderProgramHost , oldProgram ?: BuilderProgram , configFileParsingDiagnostics ?: readonly Diagnostic [ ] ) : BuilderProgram ;
169- export function createAbstractBuilder ( rootNames : readonly string [ ] | undefined , options : CompilerOptions | undefined , host ?: CompilerHost , oldProgram ?: BuilderProgram , configFileParsingDiagnostics ?: readonly Diagnostic [ ] , projectReferences ?: readonly ProjectReference [ ] ) : BuilderProgram ;
170- export function createAbstractBuilder ( newProgramOrRootNames : Program | readonly string [ ] | undefined , hostOrOptions : BuilderProgramHost | CompilerOptions | undefined , oldProgramOrHost ?: CompilerHost | BuilderProgram , configFileParsingDiagnosticsOrOldProgram ?: readonly Diagnostic [ ] | BuilderProgram , configFileParsingDiagnostics ?: readonly Diagnostic [ ] , projectReferences ?: readonly ProjectReference [ ] ) : BuilderProgram {
171- const { newProgram, configFileParsingDiagnostics : newConfigFileParsingDiagnostics } = getBuilderCreationParameters ( newProgramOrRootNames , hostOrOptions , oldProgramOrHost , configFileParsingDiagnosticsOrOldProgram , configFileParsingDiagnostics , projectReferences ) ;
172- return createRedirectedBuilderProgram ( ( ) => ( { program : newProgram , compilerOptions : newProgram . getCompilerOptions ( ) } ) , newConfigFileParsingDiagnostics ) ;
168+ export function createAbstractBuilder ( newProgram : ts . Program , host : BuilderProgramHost , oldProgram ?: BuilderProgram , configFileParsingDiagnostics ?: readonly ts . Diagnostic [ ] ) : BuilderProgram ;
169+ export function createAbstractBuilder ( rootNames : readonly string [ ] | undefined , options : ts . CompilerOptions | undefined , host ?: ts . CompilerHost , oldProgram ?: BuilderProgram , configFileParsingDiagnostics ?: readonly ts . Diagnostic [ ] , projectReferences ?: readonly ts . ProjectReference [ ] ) : BuilderProgram ;
170+ export function createAbstractBuilder ( newProgramOrRootNames : ts . Program | readonly string [ ] | undefined , hostOrOptions : BuilderProgramHost | ts . CompilerOptions | undefined , oldProgramOrHost ?: ts . CompilerHost | BuilderProgram , configFileParsingDiagnosticsOrOldProgram ?: readonly ts . Diagnostic [ ] | BuilderProgram , configFileParsingDiagnostics ?: readonly ts . Diagnostic [ ] , projectReferences ?: readonly ts . ProjectReference [ ] ) : BuilderProgram {
171+ const { newProgram, configFileParsingDiagnostics : newConfigFileParsingDiagnostics } = ts . getBuilderCreationParameters ( newProgramOrRootNames , hostOrOptions , oldProgramOrHost , configFileParsingDiagnosticsOrOldProgram , configFileParsingDiagnostics , projectReferences ) ;
172+ return ts . createRedirectedBuilderProgram ( ( ) => ( { program : newProgram , compilerOptions : newProgram . getCompilerOptions ( ) } ) , newConfigFileParsingDiagnostics ) ;
173173}
174174}
0 commit comments