1 | import { Config, CosmiconfigResult, Loaders, LoadersSync } from './types';
|
2 | type LoaderResult = Config | null;
|
3 | export type Loader = ((filepath: string, content: string) => Promise<LoaderResult>) | LoaderSync;
|
4 | export type LoaderSync = (filepath: string, content: string) => LoaderResult;
|
5 | export type Transform = ((CosmiconfigResult: CosmiconfigResult) => Promise<CosmiconfigResult>) | TransformSync;
|
6 | export type TransformSync = (CosmiconfigResult: CosmiconfigResult) => CosmiconfigResult;
|
7 | interface OptionsBase {
|
8 | packageProp?: string | Array<string>;
|
9 | searchPlaces?: Array<string>;
|
10 | ignoreEmptySearchPlaces?: boolean;
|
11 | stopDir?: string;
|
12 | cache?: boolean;
|
13 | }
|
14 | export interface Options extends OptionsBase {
|
15 | loaders?: Loaders;
|
16 | transform?: Transform;
|
17 | }
|
18 | export interface OptionsSync extends OptionsBase {
|
19 | loaders?: LoadersSync;
|
20 | transform?: TransformSync;
|
21 | }
|
22 | export interface PublicExplorerBase {
|
23 | clearLoadCache: () => void;
|
24 | clearSearchCache: () => void;
|
25 | clearCaches: () => void;
|
26 | }
|
27 | export interface PublicExplorer extends PublicExplorerBase {
|
28 | search: (searchFrom?: string) => Promise<CosmiconfigResult>;
|
29 | load: (filepath: string) => Promise<CosmiconfigResult>;
|
30 | }
|
31 | export interface PublicExplorerSync extends PublicExplorerBase {
|
32 | search: (searchFrom?: string) => CosmiconfigResult;
|
33 | load: (filepath: string) => CosmiconfigResult;
|
34 | }
|
35 | export declare const metaSearchPlaces: string[];
|
36 | declare const defaultLoaders: Readonly<{
|
37 | readonly '.cjs': LoaderSync;
|
38 | readonly '.js': LoaderSync;
|
39 | readonly '.json': LoaderSync;
|
40 | readonly '.yaml': LoaderSync;
|
41 | readonly '.yml': LoaderSync;
|
42 | readonly noExt: LoaderSync;
|
43 | }>;
|
44 | declare function cosmiconfig(moduleName: string, options?: Options): PublicExplorer;
|
45 | declare function cosmiconfigSync(moduleName: string, options?: OptionsSync): PublicExplorerSync;
|
46 | export { cosmiconfig, cosmiconfigSync, defaultLoaders };
|
47 |
|
\ | No newline at end of file |