@@ -15,7 +15,7 @@ namespace ts {
1515 * Create a function that reports error by writing to the system and handles the formating of the diagnostic
1616 */
1717 /*@internal */
18- export function createDiagnosticReporter ( system = sys , pretty ?: boolean ) : DiagnosticReporter {
18+ export function createDiagnosticReporter ( system : System , pretty ?: boolean ) : DiagnosticReporter {
1919 const host : FormatDiagnosticsHost = system === sys ? sysFormatDiagnosticsHost : {
2020 getCurrentDirectory : ( ) => system . getCurrentDirectory ( ) ,
2121 getNewLine : ( ) => system . newLine ,
@@ -266,6 +266,7 @@ namespace ts {
266266 */
267267 /*@internal */
268268 export interface WatchCompilerHostOfConfigFile extends WatchCompilerHost {
269+ cachedDirectoryStructureHost ?: CachedDirectoryStructureHost ;
269270 rootFiles ?: string [ ] ;
270271 options ?: CompilerOptions ;
271272 optionsToExtend ?: CompilerOptions ;
@@ -298,8 +299,7 @@ namespace ts {
298299 /**
299300 * Creates the watch compiler host that can be extended with config file or root file names and options host
300301 */
301- /*@internal */
302- export function createWatchCompilerHost ( system = sys , reportDiagnostic : DiagnosticReporter | undefined ) : WatchCompilerHost {
302+ function createWatchCompilerHost ( system = sys , reportDiagnostic : DiagnosticReporter | undefined ) : WatchCompilerHost {
303303 return {
304304 useCaseSensitiveFileNames : ( ) => system . useCaseSensitiveFileNames ,
305305 getNewLine : ( ) => system . newLine ,
@@ -325,26 +325,42 @@ namespace ts {
325325 }
326326
327327 /**
328- * Create the watched program for config file
328+ * Creates the watch compiler host from system for config file in watch mode
329329 */
330- export function createWatchOfConfigFile ( configFileName : string , optionsToExtend ?: CompilerOptions , system ?: System , reportDiagnostic ?: DiagnosticReporter ) : WatchOfConfigFile {
330+ /*@internal */
331+ export function createWatchCompilerHostOfConfigFile ( configFileName : string , optionsToExtend : CompilerOptions | undefined , system : System , reportDiagnostic : DiagnosticReporter | undefined ) : WatchCompilerHostOfConfigFile {
331332 reportDiagnostic = reportDiagnostic || createDiagnosticReporter ( system ) ;
332333 const host = createWatchCompilerHost ( system , reportDiagnostic ) as WatchCompilerHostOfConfigFile ;
333334 host . onConfigFileDiagnostic = reportDiagnostic ;
334335 host . onUnRecoverableConfigFileDiagnostic = diagnostic => reportUnrecoverableDiagnostic ( system , reportDiagnostic , diagnostic ) ;
335336 host . configFileName = configFileName ;
336337 host . optionsToExtend = optionsToExtend ;
337- return createWatch ( host ) ;
338+ return host ;
338339 }
339340
340341 /**
341- * Create the watched program for root files and compiler options
342+ * Creates the watch compiler host from system for compiling root files and options in watch mode
342343 */
343- export function createWatchOfFilesAndCompilerOptions ( rootFiles : string [ ] , options : CompilerOptions , system = sys , reportDiagnostic ?: DiagnosticReporter ) : WatchOfFilesAndCompilerOptions {
344+ /*@internal */
345+ export function createWatchCompilerHostOfFilesAndCompilerOptions ( rootFiles : string [ ] , options : CompilerOptions , system : System , reportDiagnostic : DiagnosticReporter | undefined ) : WatchCompilerHostOfFilesAndCompilerOptions {
344346 const host = createWatchCompilerHost ( system , reportDiagnostic ) as WatchCompilerHostOfFilesAndCompilerOptions ;
345347 host . rootFiles = rootFiles ;
346348 host . options = options ;
347- return createWatch ( host ) ;
349+ return host ;
350+ }
351+
352+ /**
353+ * Create the watched program for config file
354+ */
355+ export function createWatchOfConfigFile ( configFileName : string , optionsToExtend ?: CompilerOptions , system = sys , reportDiagnostic ?: DiagnosticReporter ) : WatchOfConfigFile {
356+ return createWatch ( createWatchCompilerHostOfConfigFile ( configFileName , optionsToExtend , system , reportDiagnostic ) ) ;
357+ }
358+
359+ /**
360+ * Create the watched program for root files and compiler options
361+ */
362+ export function createWatchOfFilesAndCompilerOptions ( rootFiles : string [ ] , options : CompilerOptions , system = sys , reportDiagnostic ?: DiagnosticReporter ) : WatchOfFilesAndCompilerOptions {
363+ return createWatch ( createWatchCompilerHostOfFilesAndCompilerOptions ( rootFiles , options , system , reportDiagnostic ) ) ;
348364 }
349365
350366 /**
0 commit comments