@@ -18,18 +18,12 @@ namespace ts {
1818 text : string ;
1919 }
2020
21- export interface ChangedProgramFiles {
22- /** Minimal set of list of files that require emit */
23- readonly filesToEmit : ReadonlyArray < string > ;
24- /** File paths of source files changed/added/removed or affected by changed files */
25- readonly changedFiles : ReadonlyArray < string > ;
26- }
27-
21+ /* @internal */
2822 export interface Builder {
2923 /**
30- * This is the callback when file infos in the builder are updated
24+ * Call this to feed new program
3125 */
32- onProgramUpdateGraph ( program : Program , hasInvalidatedResolution : HasInvalidatedResolution ) : void ;
26+ updateProgram ( newProgram : Program ) : void ;
3327 getFilesAffectedBy ( program : Program , path : Path ) : string [ ] ;
3428 emitFile ( program : Program , path : Path ) : EmitOutput ;
3529
@@ -97,6 +91,7 @@ namespace ts {
9791 signature : string ;
9892 }
9993
94+ /* @internal */
10095 export function createBuilder (
10196 getCanonicalFileName : ( fileName : string ) => string ,
10297 getEmitOutput : ( program : Program , sourceFile : SourceFile , emitOnlyDtsFiles : boolean , isDetailed : boolean ) => EmitOutput | EmitOutputDetailed ,
@@ -110,15 +105,15 @@ namespace ts {
110105 const changedFileNames = createMap < string > ( ) ;
111106 let emitHandler : EmitHandler ;
112107 return {
113- onProgramUpdateGraph ,
108+ updateProgram ,
114109 getFilesAffectedBy,
115110 emitFile,
116111 emitChangedFiles,
117112 getSemanticDiagnostics,
118113 clear
119114 } ;
120115
121- function createProgramGraph ( program : Program , hasInvalidatedResolution : HasInvalidatedResolution ) {
116+ function createProgramGraph ( program : Program ) {
122117 const currentIsModuleEmit = program . getCompilerOptions ( ) . module !== ModuleKind . None ;
123118 if ( isModuleEmit !== currentIsModuleEmit ) {
124119 isModuleEmit = currentIsModuleEmit ;
@@ -135,7 +130,7 @@ namespace ts {
135130 // Remove existing file info
136131 onDeleteValue : removeExistingFileInfo ,
137132 // We will update in place instead of deleting existing value and adding new one
138- onExistingValue : ( existingInfo , sourceFile ) => updateExistingFileInfo ( program , existingInfo , sourceFile , hasInvalidatedResolution )
133+ onExistingValue : ( existingInfo , sourceFile ) => updateExistingFileInfo ( program , existingInfo , sourceFile )
139134 }
140135 ) ;
141136 }
@@ -157,27 +152,27 @@ namespace ts {
157152 emitHandler . onRemoveSourceFile ( path ) ;
158153 }
159154
160- function updateExistingFileInfo ( program : Program , existingInfo : FileInfo , sourceFile : SourceFile , hasInvalidatedResolution : HasInvalidatedResolution ) {
155+ function updateExistingFileInfo ( program : Program , existingInfo : FileInfo , sourceFile : SourceFile ) {
161156 if ( existingInfo . version !== sourceFile . version ) {
162157 registerChangedFile ( sourceFile . path , sourceFile . fileName ) ;
163158 existingInfo . version = sourceFile . version ;
164159 emitHandler . onUpdateSourceFile ( program , sourceFile ) ;
165160 }
166- else if ( hasInvalidatedResolution ( sourceFile . path ) &&
161+ else if ( program . hasInvalidatedResolution ( sourceFile . path ) &&
167162 emitHandler . onUpdateSourceFileWithSameVersion ( program , sourceFile ) ) {
168163 registerChangedFile ( sourceFile . path , sourceFile . fileName ) ;
169164 }
170165 }
171166
172167 function ensureProgramGraph ( program : Program ) {
173168 if ( ! emitHandler ) {
174- createProgramGraph ( program , returnFalse ) ;
169+ createProgramGraph ( program ) ;
175170 }
176171 }
177172
178- function onProgramUpdateGraph ( program : Program , hasInvalidatedResolution : HasInvalidatedResolution ) {
173+ function updateProgram ( newProgram : Program ) {
179174 if ( emitHandler ) {
180- createProgramGraph ( program , hasInvalidatedResolution ) ;
175+ createProgramGraph ( newProgram ) ;
181176 }
182177 }
183178
0 commit comments