/** * Vite plugin for @ducklings/workers-ducklake on Cloudflare Workers * * This plugin handles WASM file resolution and emission for Cloudflare Workers deployments. * Designed to work with @cloudflare/vite-plugin. * * @packageDocumentation */ /** * Vite Plugin interface (minimal definition to avoid hard dependency on vite types) */ interface VitePlugin { name: string; enforce?: 'pre' | 'post'; configResolved?: (config: ResolvedConfig) => void; resolveId?: (id: string) => { id: string; external: true; } | null; writeBundle?: (options: { dir?: string; }, bundle: Record) => void; } interface ResolvedConfig { root: string; build: { outDir: string; }; } /** * Configuration options for the Ducklings Workers Vite plugin. */ interface DucklingsWorkersPluginOptions { /** * Name of the WASM file in the output directory. * @default 'duckdb-workers.wasm' */ wasmFileName?: string; } /** * Resolves the path to the WASM file bundled with @ducklings/workers-ducklake. * * @returns The absolute path to the WASM file */ declare function getWasmPath(): string; /** * Vite plugin for Cloudflare Workers that handles Ducklings Workers WASM integration. * * This plugin: * - Resolves `@ducklings/workers-ducklake/wasm` imports to a relative path for wrangler * - Copies the WASM file to the output directory after the bundle is written * * Designed to work with @cloudflare/vite-plugin. The plugin detects the actual * output directory structure created by the Cloudflare plugin and places the * WASM file in the correct location. * * @param options - Plugin configuration options * @returns Vite plugin * * @example * ```typescript * // vite.config.ts * import { defineConfig } from 'vite'; * import { cloudflare } from '@cloudflare/vite-plugin'; * import { ducklingsWorkerPlugin } from '@ducklings/workers-ducklake/vite-plugin'; * * export default defineConfig({ * plugins: [ * ducklingsWorkerPlugin(), * cloudflare(), * ], * }); * ``` */ declare function ducklingsWorkerPlugin(options?: DucklingsWorkersPluginOptions): VitePlugin; export { type DucklingsWorkersPluginOptions, ducklingsWorkerPlugin as default, ducklingsWorkerPlugin, getWasmPath };