44
55namespace ts {
66 export type DiagnosticReporter = ( diagnostic : Diagnostic ) => void ;
7- export type ParseConfigFile = ( configFileName : string , optionsToExtend : CompilerOptions , system : PartialSystem , reportDiagnostic : DiagnosticReporter , reportWatchDiagnostic : DiagnosticReporter ) => ParsedCommandLine ;
7+ export type ParseConfigFile = ( configFileName : string , optionsToExtend : CompilerOptions , system : DirectoryStructureHost , reportDiagnostic : DiagnosticReporter , reportWatchDiagnostic : DiagnosticReporter ) => ParsedCommandLine ;
88 export interface WatchingSystemHost {
99 // FS system to use
1010 system : System ;
@@ -18,7 +18,7 @@ namespace ts {
1818
1919 // Callbacks to do custom action before creating program and after creating program
2020 beforeCompile ( compilerOptions : CompilerOptions ) : void ;
21- afterCompile ( host : PartialSystem , program : Program , builder : Builder ) : void ;
21+ afterCompile ( host : DirectoryStructureHost , program : Program , builder : Builder ) : void ;
2222 }
2323
2424 const defaultFormatDiagnosticsHost : FormatDiagnosticsHost = sys ? {
@@ -61,7 +61,7 @@ namespace ts {
6161 system . write ( ts . formatDiagnosticsWithColorAndContext ( [ diagnostic ] , host ) + host . getNewLine ( ) ) ;
6262 }
6363
64- export function parseConfigFile ( configFileName : string , optionsToExtend : CompilerOptions , system : PartialSystem , reportDiagnostic : DiagnosticReporter , reportWatchDiagnostic : DiagnosticReporter ) : ParsedCommandLine {
64+ export function parseConfigFile ( configFileName : string , optionsToExtend : CompilerOptions , system : DirectoryStructureHost , reportDiagnostic : DiagnosticReporter , reportWatchDiagnostic : DiagnosticReporter ) : ParsedCommandLine {
6565 let configFileText : string ;
6666 try {
6767 configFileText = system . readFile ( configFileName ) ;
@@ -89,7 +89,7 @@ namespace ts {
8989 return configParseResult ;
9090 }
9191
92- function reportEmittedFiles ( files : string [ ] , system : PartialSystem ) : void {
92+ function reportEmittedFiles ( files : string [ ] , system : DirectoryStructureHost ) : void {
9393 if ( ! files || files . length === 0 ) {
9494 return ;
9595 }
@@ -100,7 +100,7 @@ namespace ts {
100100 }
101101 }
102102
103- export function handleEmitOutputAndReportErrors ( system : PartialSystem , program : Program ,
103+ export function handleEmitOutputAndReportErrors ( system : DirectoryStructureHost , program : Program ,
104104 emittedFiles : string [ ] , emitSkipped : boolean ,
105105 diagnostics : Diagnostic [ ] , reportDiagnostic : DiagnosticReporter
106106 ) : ExitStatus {
@@ -141,7 +141,7 @@ namespace ts {
141141 afterCompile : compileWatchedProgram ,
142142 } ;
143143
144- function compileWatchedProgram ( host : PartialSystem , program : Program , builder : Builder ) {
144+ function compileWatchedProgram ( host : DirectoryStructureHost , program : Program , builder : Builder ) {
145145 // First get and report any syntactic errors.
146146 let diagnostics = program . getSyntacticDiagnostics ( ) . slice ( ) ;
147147 let reportSemanticDiagnostics = false ;
@@ -256,14 +256,14 @@ namespace ts {
256256 watchingHost = watchingHost || createWatchingSystemHost ( compilerOptions . pretty ) ;
257257 const { system, parseConfigFile, reportDiagnostic, reportWatchDiagnostic, beforeCompile, afterCompile } = watchingHost ;
258258
259- const partialSystem = configFileName ? createCachedPartialSystem ( system ) : system ;
259+ const directoryStructureHost = configFileName ? createCachedDirectoryStructureHost ( system ) : system ;
260260 if ( configFileName ) {
261261 watchFile ( system , configFileName , scheduleProgramReload , writeLog ) ;
262262 }
263263
264- const getCurrentDirectory = memoize ( ( ) => partialSystem . getCurrentDirectory ( ) ) ;
264+ const getCurrentDirectory = memoize ( ( ) => directoryStructureHost . getCurrentDirectory ( ) ) ;
265265 const realpath = system . realpath && ( ( path : string ) => system . realpath ( path ) ) ;
266- const getCachedPartialSystem = configFileName && ( ( ) => partialSystem as CachedPartialSystem ) ;
266+ const getCachedDirectoryStructureHost = configFileName && ( ( ) => directoryStructureHost as CachedDirectoryStructureHost ) ;
267267 const getCanonicalFileName = createGetCanonicalFileName ( system . useCaseSensitiveFileNames ) ;
268268 let newLine = getNewLineCharacter ( compilerOptions , system ) ;
269269
@@ -294,7 +294,7 @@ namespace ts {
294294 getCompilationSettings : ( ) => compilerOptions ,
295295 watchDirectoryOfFailedLookupLocation : watchDirectory ,
296296 watchTypeRootsDirectory : watchDirectory ,
297- getCachedPartialSystem ,
297+ getCachedDirectoryStructureHost ,
298298 onInvalidatedResolution : scheduleProgramUpdate ,
299299 onChangedAutomaticTypeDirectiveNames,
300300 writeLog
@@ -361,7 +361,7 @@ namespace ts {
361361 missingFilePathsRequestedForRelease = undefined ;
362362 }
363363
364- afterCompile ( partialSystem , program , builder ) ;
364+ afterCompile ( directoryStructureHost , program , builder ) ;
365365 reportWatchDiagnostic ( createCompilerDiagnostic ( Diagnostics . Compilation_complete_Watching_for_file_changes ) ) ;
366366 }
367367
@@ -376,11 +376,11 @@ namespace ts {
376376 return ! isString ( hostSourceFileInfo ) ;
377377 }
378378
379- return partialSystem . fileExists ( fileName ) ;
379+ return directoryStructureHost . fileExists ( fileName ) ;
380380 }
381381
382382 function directoryExists ( directoryName : string ) {
383- return partialSystem . directoryExists ( directoryName ) ;
383+ return directoryStructureHost . directoryExists ( directoryName ) ;
384384 }
385385
386386 function readFile ( fileName : string ) {
@@ -392,7 +392,7 @@ namespace ts {
392392 }
393393
394394 function getDirectories ( path : string ) {
395- return partialSystem . getDirectories ( path ) ;
395+ return directoryStructureHost . getDirectories ( path ) ;
396396 }
397397
398398 function resolveModuleNames ( moduleNames : string [ ] , containingFile : string , reusedNames ?: string [ ] ) {
@@ -541,7 +541,7 @@ namespace ts {
541541 writeLog ( `Reloading config file: ${ configFileName } ` ) ;
542542 needsReload = false ;
543543
544- const cachedHost = partialSystem as CachedPartialSystem ;
544+ const cachedHost = directoryStructureHost as CachedDirectoryStructureHost ;
545545 cachedHost . clearCache ( ) ;
546546 const configParseResult = parseConfigFile ( configFileName , optionsToExtendForConfigFile , cachedHost , reportDiagnostic , reportWatchDiagnostic ) ;
547547 rootFileNames = configParseResult . fileNames ;
@@ -586,7 +586,7 @@ namespace ts {
586586
587587 function updateCachedSystemWithFile ( fileName : string , path : Path , eventKind : FileWatcherEventKind ) {
588588 if ( configFileName ) {
589- ( partialSystem as CachedPartialSystem ) . addOrDeleteFile ( fileName , path , eventKind ) ;
589+ ( directoryStructureHost as CachedDirectoryStructureHost ) . addOrDeleteFile ( fileName , path , eventKind ) ;
590590 }
591591 }
592592
@@ -639,7 +639,7 @@ namespace ts {
639639 const fileOrFolderPath = toPath ( fileOrFolder ) ;
640640
641641 // Since the file existance changed, update the sourceFiles cache
642- ( partialSystem as CachedPartialSystem ) . addOrDeleteFileOrFolder ( fileOrFolder , fileOrFolderPath ) ;
642+ ( directoryStructureHost as CachedDirectoryStructureHost ) . addOrDeleteFileOrFolder ( fileOrFolder , fileOrFolderPath ) ;
643643 removeSourceFile ( fileOrFolderPath ) ;
644644
645645 // If the the added or created file or folder is not supported file name, ignore the file
@@ -651,7 +651,7 @@ namespace ts {
651651
652652 // Reload is pending, do the reload
653653 if ( ! needsReload ) {
654- const result = getFileNamesFromConfigSpecs ( configFileSpecs , getDirectoryPath ( configFileName ) , compilerOptions , partialSystem ) ;
654+ const result = getFileNamesFromConfigSpecs ( configFileSpecs , getDirectoryPath ( configFileName ) , compilerOptions , directoryStructureHost ) ;
655655 if ( ! configFileSpecs . filesSpecs && result . fileNames . length === 0 ) {
656656 reportDiagnostic ( getErrorForNoInputFiles ( configFileSpecs , configFileName ) ) ;
657657 }
0 commit comments