1 | export declare type processFn<T> = (fullpath: string, content: string) => T;
|
2 | export interface CacheItem<T> {
|
3 | value: T;
|
4 | stat: {
|
5 | mtime: Date;
|
6 | };
|
7 | }
|
8 | export interface MinimalFS {
|
9 | statSync: (fullpath: string) => {
|
10 | mtime: Date;
|
11 | };
|
12 | readFileSync: (fullpath: string, encoding: 'utf8') => string;
|
13 | readlinkSync(path: string): string;
|
14 | }
|
15 | export 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 | }
|
23 | export declare function cachedProcessFile<T = any>(processor: processFn<T>, fs: MinimalFS, resolvePath: (path: string, context?: string) => string): FileProcessor<T>;
|
24 |
|
\ | No newline at end of file |