/** * Browser bundler implementation using esbuild-wasm. * * This module handles WASM initialization and provides a bundler that * works entirely in the browser. */ import type { IBundler, BundleOptions, BundleResult } from "../types"; export interface EsbuildWasmBundlerOptions { /** * URL to the esbuild WASM file. * @default "https://unpkg.com/esbuild-wasm@{version}/esbuild.wasm" */ wasmUrl?: string; /** * URL to load esbuild-wasm module from. * @default "https://esm.sh/esbuild-wasm@{version}" */ esbuildUrl?: string; /** * Base URL for CDN imports. * npm imports like "lodash" are rewritten to "{cdnBaseUrl}/lodash@{version}". * @default "https://esm.sh" */ cdnBaseUrl?: string; /** * ECMAScript target for esm.sh CDN imports. * * This sets the `?target=` query parameter on esm.sh URLs to ensure * consistent output. Without this, esm.sh uses User-Agent detection * which can vary between environments. * * @example "es2020" * @example "es2022" * @default "es2020" */ esmTarget?: string; /** * Whether to initialize immediately on construction. * If false, initialization happens lazily on first bundle() call. * @default false */ eagerInit?: boolean; } /** * Browser bundler implementation using esbuild-wasm. * * Handles WASM initialization internally. The first bundle() call * will wait for initialization if not already complete. * * @example * ```ts * const bundler = new EsbuildWasmBundler(); * await bundler.initialize(); * * const result = await bundler.bundle({ * fs: myFilesystem, * entryPoint: "/src/index.ts", * }); * ``` */ export declare class EsbuildWasmBundler implements IBundler { private options; constructor(options?: EsbuildWasmBundlerOptions); /** * Initialize the esbuild WASM module. * Called automatically on first bundle() if not already initialized. * * Uses a global singleton pattern since esbuild-wasm can only be * initialized once per page. */ initialize(): Promise; private doInitialize; /** * Get the initialized esbuild instance. */ private getEsbuild; /** * Dispose of the esbuild WASM service. * This stops the esbuild service and allows the process to exit. * * Note: Since esbuild-wasm uses a global singleton, this affects all * instances. After dispose(), you'll need to create a new bundler. */ dispose(): Promise; private checkCrossOriginIsolation; bundle(options: BundleOptions): Promise; } //# sourceMappingURL=bundler.d.ts.map