1 | import { Config } from './commands/args';
|
2 | import { BabelRC } from './utils/babel-config';
|
3 | export declare type SetConfig = (config: Config) => Config;
|
4 | export declare type ModifyBundlerConfig<C = any> = (config: C, dev: boolean, args: Config) => C;
|
5 | export declare type ModifyBabelRC = (babelrc: BabelRC, args: Config) => BabelRC;
|
6 | export declare type onCreateApp = <A>(app: A) => void;
|
7 | export declare type OnServerListening = <S>(server: S) => void;
|
8 | export declare type OnPreBuild = (args: Config) => void;
|
9 | export declare type OnPostBuild = (args: Config) => void;
|
10 | export declare type OnPreRender = () => void;
|
11 | export declare type OnPostRender = () => void;
|
12 | export interface PluginFactory {
|
13 | setConfig?: SetConfig;
|
14 | modifyBundlerConfig?: ModifyBundlerConfig;
|
15 | modifyBabelRc?: ModifyBabelRC;
|
16 | onCreateApp?: onCreateApp;
|
17 | onServerListening?: OnServerListening;
|
18 | onPreBuild?: OnPreBuild;
|
19 | onPostBuild?: OnPostBuild;
|
20 | onPreRender?: OnPreRender;
|
21 | onPostRender?: OnPostRender;
|
22 | }
|
23 | export declare class Plugin<C = any> implements PluginFactory {
|
24 | static runPluginsMethod(plugins: Plugin[] | undefined): (method: keyof Plugin, ...args: any[]) => void;
|
25 | static propsOfPlugins(plugins: Plugin[]): (prop: keyof Plugin) => any[];
|
26 | static reduceFromPlugins<C>(plugins: Plugin[] | undefined): (method: keyof Plugin, initial: C, ...args: any[]) => C;
|
27 | readonly setConfig?: SetConfig;
|
28 | readonly modifyBundlerConfig?: ModifyBundlerConfig<C>;
|
29 | readonly modifyBabelRc?: ModifyBabelRC;
|
30 | readonly onCreateApp?: onCreateApp;
|
31 | readonly onServerListening?: OnServerListening;
|
32 | readonly onPreBuild?: OnPreBuild;
|
33 | readonly onPostBuild?: OnPostBuild;
|
34 | readonly onPreRender?: OnPreRender;
|
35 | readonly onPostRender?: OnPostRender;
|
36 | constructor(p: PluginFactory);
|
37 | }
|
38 | export declare function createPlugin<C = any>(factory: PluginFactory): Plugin<C>;
|