import { PluginItem, PluginOptions, PluginTarget } from '@babel/core'; import { ChainedMap, Orderable } from "../chain"; import BabelOptions from "./BabelOptions"; /** * 选项函数 */ declare type OptionsFn = (options: O, config: C) => O; declare class BabelPlugin extends ChainedMap implements Orderable { config: any; /** * @description 优先级,数组越小优先级越高 */ private priority; private beforeName; private afterName; /** * @description 插件目标对象 */ private pluginTarget; /** * @description 插件配置 */ private pluginOptions; private readonly pluginOptionsFnSet; /** * @description 插件合并项 */ private mergingName; constructor(name: string, parent: BabelOptions, priority: number); after(name: string): this; before(name: string): this; order(index: number): this; /** * 插件目标 * @param target */ use(target: PluginTarget): this; /** * 插件配置参数 * @param options */ options(options?: Options): this; merging(name?: string): this; /** * @description 修改插件参数 * @param optionsFn */ tap(optionsFn: OptionsFn): this; isValid(): boolean; isTarget(): boolean; emit(config?: Config): this; toPluginItem(config?: Config): PluginItem; } export default BabelPlugin;