universal-build-plugin-version-check-test
Version:
一个支持多种前端构建工具的通用插件框架,包括 Vite、Webpack、Rollup 等,提供版本检查、构建优化等功能
47 lines • 1.59 kB
TypeScript
import { BasePlugin } from '../core/base-plugin';
import type { PluginOptions, BuildContext } from '../types';
import { Logger } from '../utils/logger';
interface RollupPluginInterface {
name: string;
buildStart?: (opts: any) => void | Promise<void>;
buildEnd?: (error?: Error) => 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>;
watchChange?: (id: string, change: {
event: string;
}) => void;
}
/**
* Rollup 插件适配器
*/
export declare class RollupPlugin extends BasePlugin {
protected logger: Logger;
constructor(options?: PluginOptions);
/**
* 应用到 Rollup 构建工具
*/
apply(rollupConfig?: any): RollupPluginInterface;
/**
* 判断是否需要转换文件
*/
protected shouldTransform(id: string): boolean;
/**
* 转换代码
*/
protected transformCode(code: string, id: string, context: BuildContext): Promise<any>;
/**
* 生成 bundle 钩子
*/
protected onGenerateBundle(options: any, bundle: any, context: BuildContext): Promise<void>;
/**
* 写入 bundle 钩子
*/
protected onWriteBundle(options: any, bundle: any, context: BuildContext): Promise<void>;
/**
* 处理 bundle 文件
*/
protected processBundleFile(fileName: string, fileInfo: any, context: BuildContext): Promise<void>;
}
export {};
//# sourceMappingURL=rollup.d.ts.map