UNPKG

universal-build-plugin-version-check-test

Version:

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

42 lines 1.52 kB
import { BasePlugin } from '../core/base-plugin'; import type { PluginOptions, BuildContext } from '../types'; interface CompatibleVitePlugin { name: string; buildStart?: (opts: any) => void | Promise<void>; buildEnd?: (error?: Error) => void | Promise<void>; configureServer?: (server: any) => void | Promise<void>; configurePreviewServer?: (server: any) => void | Promise<void>; transform?: (code: string, id: string) => any | Promise<any>; generateBundle?: (options: any, bundle: any) => void | Promise<void>; writeBundle?: (options: any, bundle: any) => void | Promise<void>; [key: string]: any; } /** * Vite 插件适配器 */ export declare class Plugin extends BasePlugin { constructor(options?: PluginOptions); /** * 应用到 Vite 构建工具 */ apply(viteConfig?: any): CompatibleVitePlugin; /** * 判断是否需要转换文件 */ protected shouldTransform(id: string): boolean; /** * 转换代码 */ protected transformCode(code: string, id: string, context: BuildContext): Promise<string | null>; /** * 生成 bundle 钩子 */ protected onGenerateBundle(options: any, bundle: any, context: BuildContext): Promise<void>; /** * 写入 bundle 钩子 */ protected onWriteBundle(options: any, bundle: any, context: BuildContext): Promise<void>; } export declare const VitePlugin: (option?: PluginOptions) => CompatibleVitePlugin; export {}; //# sourceMappingURL=vite.d.ts.map