import { LoadContext } from '@ovotech/potygen'; /** * Handle both "last updated" checks on files as well as actually checking file contents. */ export declare class CacheStore { /** * Path to the cache file */ fileName: string; /** * If enabled is false, do not perform any caching */ enabled: boolean; /** * If true, initialize the cache with empty values so that after save everything is overwritten */ cacheClear: boolean; /** * Current version of the cache, if version mismatch, clear the cache */ cacheVersion: string; contents: Map; updates: Map; constructor( /** * Path to the cache file */ fileName: string, /** * If enabled is false, do not perform any caching */ enabled?: boolean, /** * If true, initialize the cache with empty values so that after save everything is overwritten */ cacheClear?: boolean, /** * Current version of the cache, if version mismatch, clear the cache */ cacheVersion?: string); /** * Check the file's last modified time (mtime). * If its after the time stored in cache, consider the file stale. */ isStale(path: string): Promise; /** * For a given path and file content, check if content is present in the cache. * If it is not, run the process function and store the results in the cache, * keyed by md5 of the initial content */ cachedOrProcessed(path: string, content: string, process: (path: string, content: string) => Promise<{ path: string; content: string; } | undefined>): Promise<{ path: string; content: string; isCached?: boolean; } | undefined>; /** * Load the cache from file */ load(): Promise; /** * Save current state in the cache file */ save(): Promise; } export declare const toEmitter: (ctx: LoadContext, cacheStore: CacheStore, options: { root: string; template: string; typePrefix?: string; }) => Promise<(path: string) => Promise<{ path: string; } | undefined>>;