UNPKG

universal-build-plugin-version-check-test

Version:

一个支持多种前端构建工具的通用插件框架,包括 Vite、Webpack、Rollup 等,提供版本检查、构建优化等功能

60 lines 1.77 kB
import { BasePlugin } from '../core/base-plugin'; import type { PluginOptions, BuildContext } from '../types'; import { Logger } from '../utils/logger'; interface WebpackCompiler { hooks: { beforeRun: { tapAsync: (name: string, callback: (compiler: any, callback: () => void) => void) => void; }; afterEmit: { tapAsync: (name: string, callback: (compilation: any, callback: () => void) => void) => void; }; watchRun: { tapAsync: (name: string, callback: (compiler: any, callback: () => void) => void) => void; }; done: { tap: (name: string, callback: (stats: any) => void) => void; }; }; options: any; } interface WebpackCompilation { hooks: { processAssets: { tap: (name: string, callback: (assets: any) => void) => void; }; }; assets: Record<string, any>; getAssets: () => Array<{ name: string; source: any; }>; } /** * Webpack 插件适配器 */ export declare class WebpackPlugin extends BasePlugin { protected logger: Logger; constructor(options?: PluginOptions); /** * 应用到 Webpack 构建工具 */ apply(compiler: WebpackCompiler): void; /** * 创建 Webpack 构建上下文 */ protected createBuildContext(bundler: 'webpack', options: any): BuildContext; /** * 资源输出后的钩子 */ protected onAfterEmit(compilation: WebpackCompilation, context: BuildContext): Promise<void>; /** * 处理资源 */ protected processAssets(assets: Array<{ name: string; source: any; }>, context: BuildContext): Promise<void>; } export {}; //# sourceMappingURL=webpack.d.ts.map