import type { RollupOptions } from "rollup"; import { ModuleConfig } from "./adapter/web_module"; import type { Plugin, RollupCache } from "rollup"; import { LocalCache } from "./Cache/LocalCache"; /** * 缓存配置项 */ export declare type CacheConfig = { ignore?: string[]; root?: string; maxAge?: number; }; export declare type CompilerModuleConfig = ModuleConfig & { cache?: false | CacheConfig; }; export declare class Compiler { options: RollupOptions; /** * 需要打包模块的解析配置 * @property extraBundle 若为 true,将会把 远程代码下载并经过 rollup 打包;若为 Array,将会打包区域内的代码; root 下的代码是必定被打包的,所以不用填; * @property useDataCache 使用 indexDB 进行打包代码缓存以提高速度 */ moduleConfig: CompilerModuleConfig; inWorker: false | "classic" | "module"; destroyed: boolean; destroy(): void; constructor(options: RollupOptions, /** * 需要打包模块的解析配置 * @property extraBundle 若为 true,将会把 远程代码下载并经过 rollup 打包;若为 Array,将会打包区域内的代码; root 下的代码是必定被打包的,所以不用填; * @property useDataCache 使用 indexDB 进行打包代码缓存以提高速度 */ moduleConfig: CompilerModuleConfig); plugins: Plugin[]; refreshPlugin(): void; moduleCache: LocalCache; getModuleConfig(): string; reporter: { lastEvaluate: { time: number; }; }; RollupCache: RollupCache; checkCache(url: string): Promise; CompileMultiFile(paths: string[]): Promise; CompileSingleFile(url: string): Promise; /** * 在 worker 线程中启动,将自身导出为 comlink 接口 * @params force 强制使用 force 模式 */ useWorker(force?: boolean): boolean; }