UNPKG

@eggjs/utils

Version:

Utils for all egg projects

50 lines (49 loc) 1.54 kB
export interface LoaderOptions { framework: string; baseDir: string; env?: string; } export interface Plugin { name: string; version?: string; enable: boolean; implicitEnable: boolean; path: string; dependencies: string[]; optionalDependencies: string[]; env: string[]; from: string; } /** * @see https://github.com/eggjs/egg-core/blob/2920f6eade07959d25f5c4f96b154d3fbae877db/lib/loader/mixin/plugin.js#L203 */ export declare function getPlugins(options: LoaderOptions): Promise<Record<string, Plugin>>; interface Unit { type: 'plugin' | 'framework' | 'app'; path: string; } /** * @see https://github.com/eggjs/egg-core/blob/2920f6eade07959d25f5c4f96b154d3fbae877db/lib/loader/egg_loader.js#L348 */ export declare function getLoadUnits(options: LoaderOptions): Promise<Unit[]>; export declare function getConfig(options: LoaderOptions): Promise<Record<string, any>>; interface IEggLoader { loadPlugin(): Promise<void>; loadConfig(): Promise<void>; config: Record<string, any>; getLoadUnits(): Unit[]; allPlugins: Record<string, Plugin>; } interface IEggLoaderOptions { baseDir: string; app: unknown; logger: object; EggCoreClass?: unknown; } type EggLoaderImplClass<T = IEggLoader> = new (options: IEggLoaderOptions) => T; export declare function getLoader(options: LoaderOptions): Promise<IEggLoader>; export declare function findEggCore(options: LoaderOptions): Promise<{ EggCore?: object; EggLoader: EggLoaderImplClass; }>; export {};