import { TransactionalFileSystem } from "../fileSystem" ; import { ts } from "../typescript" ; import { readDirectory } from "./readDirectory" ; export interface GetTsParseConfigHostOptions { encoding : string ; } export interface TsParseConfigHostResult extends ts . ParseConfigHost { getDirectories ( ) : string [ ] ; clearDirectories ( ) : void ; } export function getTsParseConfigHost ( fileSystemWrapper , options ) { const directories = [ ] ; const useCaseSensitiveFileNames = false ; const host = { useCaseSensitiveFileNames , readDirectory : ( rootDir , extensions , excludes , includes , depth ) => { const result = readDirectory ( fileSystemWrapper , useCaseSensitiveFileNames , rootDir , extensions , excludes , includes , depth ) ; directories . push ( ... result . directories ) ; return result . files ; } , fileExists : path => fileSystemWrapper . fileExistsSync ( fileSystemWrapper . getStandardizedAbsolutePath ( path ) ) , readFile : path => fileSystemWrapper . readFileSync ( fileSystemWrapper . getStandardizedAbsolutePath ( path ) , options . encoding ) , getDirectories : ( ) => [ ... directories ] , clearDirectories : ( ) => directories . length = 0 , } ; return host ; }