UNPKG

@luban-cli/cli-plugin-service

Version:
29 lines (28 loc) 1.42 kB
import { Service } from "./Service"; import { WebpackChainCallback, WebpackRawConfigCallback, CommandCallback, builtinServiceCommandName, WebpackConfiguration, WebpackConfigName } from "../definitions"; declare class PluginAPI { readonly id: string; protected service: Service; constructor(id: string, service: Service); getContext(): string; resolve(_path: string): string; getClientSideEntryFile(): string; getServerSideClientEntryFile(): string; getMockConfig(): import("../main").MockConfig | undefined; getRegisteredCommands(): Partial<Record<builtinServiceCommandName, { commandCallback: CommandCallback; opts: Record<string, unknown> | CommandCallback; }>>; } declare class CommandPluginAPI extends PluginAPI { registerCommand(name: builtinServiceCommandName, opts: Record<string, unknown> | CommandCallback, callback?: CommandCallback): void; addWebpackConfig(name: WebpackConfigName): void; resolveWebpackConfig(name: WebpackConfigName): WebpackConfiguration | undefined; } declare class ConfigPluginAPI extends PluginAPI { configureWebpack(name: WebpackConfigName, fn: WebpackRawConfigCallback): void; configureAllWebpack(fn: WebpackRawConfigCallback): void; chainWebpack(name: WebpackConfigName, fn: WebpackChainCallback): void; chainAllWebpack(fn: WebpackChainCallback): void; } export { CommandPluginAPI, ConfigPluginAPI };