File size: 1,521 Bytes
d8f0e51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
export declare type LilconfigResult = null | {
    filepath: string;
    config: any;
    isEmpty?: boolean;
};
interface OptionsBase {
    stopDir?: string;
    searchPlaces?: string[];
    ignoreEmptySearchPlaces?: boolean;
    packageProp?: string | string[];
}
export declare type Transform = TransformSync | ((result: LilconfigResult) => Promise<LilconfigResult>);
export declare type TransformSync = (result: LilconfigResult) => LilconfigResult;
declare type LoaderResult = any;
export declare type LoaderSync = (filepath: string, content: string) => LoaderResult;
export declare type Loader = LoaderSync | ((filepath: string, content: string) => Promise<LoaderResult>);
export declare type Loaders = Record<string, Loader>;
export declare type LoadersSync = Record<string, LoaderSync>;
export interface Options extends OptionsBase {
    loaders?: Loaders;
    transform?: Transform;
}
export interface OptionsSync extends OptionsBase {
    loaders?: LoadersSync;
    transform?: TransformSync;
}
export declare const defaultLoaders: LoadersSync;
declare type AsyncSearcher = {
    search(searchFrom?: string): Promise<LilconfigResult>;
    load(filepath: string): Promise<LilconfigResult>;
};
export declare function lilconfig(name: string, options?: Partial<Options>): AsyncSearcher;
declare type SyncSearcher = {
    search(searchFrom?: string): LilconfigResult;
    load(filepath: string): LilconfigResult;
};
export declare function lilconfigSync(name: string, options?: OptionsSync): SyncSearcher;
export {};