index.d.ts
1.88 KB
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
40
41
42
43
44
45
import { Config, CosmiconfigResult, Loaders, LoadersSync } from './types';
declare type LoaderResult = Config | null;
export declare type Loader = ((filepath: string, content: string) => Promise<LoaderResult>) | LoaderSync;
export declare type LoaderSync = (filepath: string, content: string) => LoaderResult;
export declare type Transform = ((CosmiconfigResult: CosmiconfigResult) => Promise<CosmiconfigResult>) | TransformSync;
export declare type TransformSync = (CosmiconfigResult: CosmiconfigResult) => CosmiconfigResult;
interface OptionsBase {
packageProp?: string | Array<string>;
searchPlaces?: Array<string>;
ignoreEmptySearchPlaces?: boolean;
stopDir?: string;
cache?: boolean;
}
export interface Options extends OptionsBase {
loaders?: Loaders;
transform?: Transform;
}
export interface OptionsSync extends OptionsBase {
loaders?: LoadersSync;
transform?: TransformSync;
}
declare function cosmiconfig(moduleName: string, options?: Options): {
readonly search: (searchFrom?: string) => Promise<CosmiconfigResult>;
readonly load: (filepath: string) => Promise<CosmiconfigResult>;
readonly clearLoadCache: () => void;
readonly clearSearchCache: () => void;
readonly clearCaches: () => void;
};
declare function cosmiconfigSync(moduleName: string, options?: OptionsSync): {
readonly search: (searchFrom?: string) => CosmiconfigResult;
readonly load: (filepath: string) => CosmiconfigResult;
readonly clearLoadCache: () => void;
readonly clearSearchCache: () => void;
readonly clearCaches: () => void;
};
declare const defaultLoaders: Readonly<{
readonly '.cjs': LoaderSync;
readonly '.js': LoaderSync;
readonly '.json': LoaderSync;
readonly '.yaml': LoaderSync;
readonly '.yml': LoaderSync;
readonly noExt: LoaderSync;
}>;
export { cosmiconfig, cosmiconfigSync, defaultLoaders };
//# sourceMappingURL=index.d.ts.map