diff --git a/src/command.ts b/src/command.ts index 2962859d..63939d71 100644 --- a/src/command.ts +++ b/src/command.ts @@ -1,7 +1,6 @@ import * as Parser from '@anycli/parser' import {IConfig} from './config' -import {IPlugin} from './plugin' export interface ICommandBase { _base: string @@ -23,7 +22,7 @@ export interface ICachedCommand extends ICommandBase { export interface IConvertToCachedOptions { id?: string - plugin?: IPlugin + pluginName?: string } export interface ICommand extends ICommandBase { diff --git a/src/engine.ts b/src/engine.ts index 70ca0dbe..2149df28 100644 --- a/src/engine.ts +++ b/src/engine.ts @@ -3,6 +3,16 @@ import {IConfig} from './config' import {IPlugin} from './plugin' import {ITopic} from './topic' +export interface LoadPluginOptions { + type: 'core' | 'user' | 'link' | 'dev' + root?: string + name?: string + config?: IConfig + tag?: string + useCache?: boolean + loadDevPlugins?: boolean +} + export interface IEngine { readonly config: IConfig readonly plugins: IPlugin[] @@ -23,5 +33,5 @@ export interface IEngine { load(config: IConfig): Promise - getPluginCommands(plugin: IPlugin): Promise + loadPlugin(opts: LoadPluginOptions): Promise } diff --git a/src/plugin.ts b/src/plugin.ts index 1696b467..74c5acbf 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -9,8 +9,13 @@ export interface IPlugin { root: string tag?: string config: IConfig - commands: ICachedCommand[] + manifest: IPluginManifest topics: ITopic[] plugins: IPlugin[] hooks: {[k: string]: string[]} } + +export interface IPluginManifest { + version: string + commands: ICachedCommand[] +}