1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- 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;
- 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 '.js': LoaderSync;
- readonly '.json': LoaderSync;
- readonly '.yaml': LoaderSync;
- readonly '.yml': LoaderSync;
- readonly noExt: LoaderSync;
- }>;
- export { cosmiconfig, cosmiconfigSync, defaultLoaders };
- //# sourceMappingURL=index.d.ts.map
|