import type { Target } from './platform'; import type { PluginMethods } from './plugin'; import type { RayConfig } from './ray.config'; export type CliOptions = { cwd: string; source?: string; mode?: 'development' | 'production'; watch?: boolean; target?: Target; output?: string; type?: 'app' | 'component'; mini?: boolean; analyze?: boolean; debug?: boolean; devtools?: boolean; bundler?: 'esbuild' | 'webpack'; 'transform-mode'?: 'auto' | 'pure'; 'emit-declaration-dev'?: boolean; sourcemap?: boolean; drop?: boolean; blended?: boolean | { root: string; output?: string; independent?: boolean; }; builtinEngine?: boolean; }; export interface API { options: CliOptions; config: RayConfig; /** * 在当前 cwd 路径下搜索 js ts 文件 * @param fileName - 文件名不包含后缀 */ searchJSFile(fileName: string): string; /** * require 文件并返回 module.default * @param file - 文件地址 */ requireJSFile(file: string, specifier?: string): any; /** * 在当前 cwd 路径下写入文件 * @param filePath - 文件地址 * @param context - 文件内容 */ writeFile(filePath: string, context: string | Buffer): void; callPluginMethod(event: PluginMethods, ...args: any): void; }