UNPKG

970 BTypeScriptView Raw
1export declare type processFn<T> = (fullpath: string, content: string) => T;
2export interface CacheItem<T> {
3 value: T;
4 stat: {
5 mtime: Date;
6 };
7}
8export interface MinimalFS {
9 statSync: (fullpath: string) => {
10 mtime: Date;
11 };
12 readFileSync: (fullpath: string, encoding: 'utf8') => string;
13 readlinkSync(path: string): string;
14}
15export interface FileProcessor<T> {
16 process: (fullpath: string, ignoreCache?: boolean, context?: string) => T;
17 add: (fullpath: string, value: T) => void;
18 processContent: (content: string, fullpath: string) => T;
19 cache: Record<string, CacheItem<T>>;
20 postProcessors: Array<(value: T, path: string) => T>;
21 resolvePath: (path: string, context?: string) => string;
22}
23export declare function cachedProcessFile<T = any>(processor: processFn<T>, fs: MinimalFS, resolvePath: (path: string, context?: string) => string): FileProcessor<T>;
24//# sourceMappingURL=cached-process-file.d.ts.map
\No newline at end of file