UNPKG

hins

Version:

[![codecov](https://codecov.io/gh/l-zoy/hins/branch/main/graph/badge.svg)](https://codecov.io/gh/l-zoy/hins) [![GitHub license](https://img.shields.io/github/license/l-zoy/hins)](https://github.com/l-zoy/hins/blob/master/LICENSE) ![node-current](https://i

117 lines (116 loc) 3.14 kB
import { ICoreStage, ICoreApplyHookTypes } from './enum'; import ReadConfig from './ReadConfig'; import Api from './Api'; import type { IConfigPlugins, ICoreApplyHook, IApplyPlugin, ITypeHooks, ICoreStart, ICommands, INonEmpty, IWorkDir, IMethods, IPlugin, IConfig, ICore, IHook } from './types'; export default class Core { /** * @desc directory path */ cwd: IWorkDir; /** * @desc extra command */ args?: ICoreStart; /** * @desc registered Plugins */ plugins: Record<string, IPlugin>; /** * @desc list of plugins when registering, */ extraPlugins: IApplyPlugin[]; /** * @desc initial Plugins */ initPlugins: IApplyPlugin[]; /** * @desc registered commands */ commands: Record<string, ICommands>; /** * @desc Apply Plugin enumeration value, provide a plug-in use */ ApplyHookType: typeof ICoreApplyHookTypes; /** * @desc plugin Methods */ pluginMethods: Record<string, IMethods>; /** * @desc { Record<string, IHook[]> } */ hooksByPluginId: Record<string, IHook[]>; /** * @desc lifecycle stage */ stage: ICoreStage; /** * @desc enum lifecycle */ coreStage: typeof ICoreStage; /** * @desc internal Plugins */ internalPlugins: IConfigPlugins; /** * @desc Initialize the configuration file, the config at this time is still to be verified */ initConfig: IConfig; /** * @desc the final processed config */ config: IConfig; /** * @desc Config Instance */ configInstance: ReadConfig; /** * @desc runtime babel */ babelRegister: INonEmpty<ICore>['babelRegister']; /** * @desc monitor config */ watchConfig: INonEmpty<ICore>['watchConfig']; /** * @desc applyHooks shortcut */ applyAddHooks: ITypeHooks; /** * @desc applyHooks shortcut */ applyModifyHooks: ITypeHooks; /** * @desc applyHooks shortcut */ applyEventHooks: ITypeHooks; /** * @desc api Instance */ ApiInstance: Api; /** * @name Core * @param { Function } options.babelRegister - provide config runtime. `type:Function` * @param { Array } options.possibleConfigName - config name path `type:string[]` * @param { Array } options.plugins Array - default plugin `type:string[]` * @param { object } options.isWatch - watch config `type:object` * @param { string } options.cwd - work path `type:string` */ constructor(options: ICore); registerLifeCycle(): void; setStage(stage: ICoreStage): void; init(): void; applyHooks(options: ICoreApplyHook): Promise<any>; readyPlugins(): Promise<void>; readyConfig(): Promise<void>; /** * @name start * @param { string } options.args - other argument. * @param { string } options.command - command */ start(options: ICoreStart): Promise<any>; /** * @name reset * @desc In order not to fock here, you need to initialize the properties */ reset(): void; }