export namespace MemoryTree { export type DataBuffer = Buffer | string | {} | undefined export interface Build { (pathname: string, withbuilding?: boolean): Promise } export interface BuildProvider { (options: Options, store: Store): Build } export interface Store { onBuildingChange: (listener: (building: boolean) => void) => void setBuilding: { (num: 1|-1): void } isBuilding: { ():boolean } _set: { (path: string, data: DataBuffer): void } _get: { (path: string): DataBuffer } load: { (path: string): Promise } _reset: { (): void } } export interface Options { root: string dest?: string watch: boolean // if can be built buildFilter?: { (pathname: string): boolean } watchFilter?: { (pathname: string): boolean } // fired on file(s) changed buildWatcher?: { (pathname: string, eventType: string, build: Build, store: Store): void } // save data into memory by result.outputPath & result.data onSet: { (pathname: string, data: DataBuffer, store: Store): Promise<{ data: DataBuffer, outputPath: string, originPath: string }> } // get data from memory onGet: { (pathname: string, data: DataBuffer, store: Store): Promise } // if can be persisted outputFilter?: { (pathname: string, data?: DataBuffer): boolean } } export interface MemoryTree { store: MemoryTree.Store, input: MemoryTree.Build, output: MemoryTree.Build } }