@vnxjs/service
Version:
Vnmf Service
96 lines (89 loc) • 3.07 kB
TypeScript
import helper from '@vnxjs/helper'
import { IProjectConfig } from '@vnxjs/vnmf/types/compile'
import joi from 'joi'
import { IPlugin, IPaths, IHook, ICommand, IPlatform } from '../src/utils/types'
export { default as Kernel } from './Kernel'
export { VnmfPlatformBase } from './platform-plugin-base'
interface IModifyWebpackChain {
componentConfig?: {
includes: Set<string>
exclude: Set<string>
thirdPartyComponents: Map<Tagname, Attrs>
includeAll: boolean
}
}
export declare interface IPluginContext {
/**
* Get all currently mounted plugins
*/
plugins: Map<string, IPlugin>
/**
* Fetch all currently mounted platforms
*/
platforms: Map<string, IPlatform>
/**
* Include a collection of relevant paths for the current execution command
*/
paths: IPaths
/**
* Fetch parameters brought by the current execution command
*/
runOpts: any
/**
* For the bag. @vnxjs/helper Quicker Usage,Include all of it API
*/
helper: helper
/**
* Project Configuration
*/
initialConfig: IProjectConfig
/**
* Register a hook for other plugins,Receive a parameter,i-i-i-i-i-i-i-i-i-i-i-i-i-i-i-i-i-i-i-i-i-i-i-i-i-i-i Hook Object
*/
register: (hook: IHook) => void
/**
* . ctx Mount a method to call directly from other plugins
*/
registerMethod: (arg: (string | { name: string, fn?: Function }), fn?: Function) => void
/**
* Register a custom command
*/
registerCommand: (command: ICommand) => void
/**
* Register a custom compilation platform
*/
registerPlatform: (platform: IPlatform) => void
/**
* Trigger the registered hook.(Use`ctx.register`The hook of the method register.),Parameters required to pass into hook names and hooks
*/
applyPlugins:(args: string | { name: string; initialVal?: any; opts?: any; })=> Promise<any>
/**
* Add a reference check for plugins
*/
addPluginOptsSchema: (fn: (joi: joi.Root) => void) => void
/**
* Compile start.
*/
onBuildStart: (fn: Function) => void
/**
* Completing finished.(Saves the code and triggers it every time it's compiled.)
*/
onBuildFinish: (fn: Function) => void
/**
* Completing completed(Once the first compilation is completed after start of project, it's triggered.)
*/
onBuildComplete: (fn: Function) => void
/**
* Compiled and modified webpack Configure,In this hook.,You can be right. webpackChain Make the desired adjustments.,Equivalent to configuration [`webpackChain`](./config-detail.md#miniwebpackchain)
*/
modifyWebpackChain: (fn: (args: { chain: any, webpack: any, data?: IModifyWebpackChain }) => void) => void
/**
* Modified resulting result
*/
modifyBuildAssets: (fn: (args: { assets: any, miniPlugin: any }) => void) => void
/**
* Modify the configuration of Page Component during compilation
*/
modifyMiniConfigs: (fn: (args: { configMap: any }) => void) => void
[key: string]: any
}