/** * TypeScript bindings for svgoo compiled to WebAssembly. * * This module is a static barrel over the tree-shakeable units: * * - `types.js` — `Config`, `OptimizeResult`, `WasmExports`, `WasmLoader` * (pure types, zero runtime weight). * - `errors.js` — `SvgoError` + `classifyError` (no imports). * - `plugin.js` — `PluginName`, `ALL`, `isPluginName` (no imports). * - `core.js` — the loader-free engine: `load`, `optimizeSync`, * `pluginsSync`, the `only()` / `drop()` / `preset()` / `plugin()` * builders. No imports from entries or the worker client. * * Async conveniences (`ensureLoaded`, `optimize`, `plugins`) live here so * browser and Node bundles only pay for the worker/machinery chunks the * caller actually reaches — `optimize()` `import()`s `worker-client.js` * lazily, exactly when `config.worker` is used. * * Entries (`browser.js` / `node.js`, selected by the package `exports` * conditions) install the environment's `WasmLoader` and re-export this * barrel; the worker scripts import `core.js` directly. * * ``` * import { optimize, PluginName, only, drop } from "@jiihpeeh/svgoo-wasm"; * * const { data } = await optimize("", { * plugins: only(PluginName.RemoveComments), // one plugin * }); * await optimize(markup, { plugins: drop(PluginName.SortAttrs) }); // preset minus one * ``` * * The plugin registry is read from the engine at runtime (`plugins()`), so the * constants in `plugin.ts` and the live module can never drift silently. */ export type { WasmWorker, WasmWorkerFactory } from "./worker-client.js"; export type { Config, OptimizeErrorDetails, OptimizeResult, PluginDescriptor, PluginInput, WasmExports, WasmLoader, } from "./types.js"; export { PluginName, ALL, isPluginName } from "./plugin.js"; export { SvgoError, classifyError, type SvgoErrorKind } from "./errors.js"; export { acquire, consumeResult, fetchWasmBytes, instantiateWasmEngine, isLoaded, load, loadUrl, only, optimizeSync, plugin, pluginsSync, preset, drop, normalizeConfig, readDefaultWasm, reset, setDefaultUrl, setWasmLoader, type ConsumedResult, type EngineSession, } from "./core.js"; /** Library version, kept in sync with the crate + package.json versions. */ export declare const VERSION = "4.1.3"; import { type Config, type OptimizeResult } from "./core.js"; export declare function ensureLoaded(): Promise; /** * `optimize(svg, config?)` — asynchronously optimize an SVG string. * * `config` mirrors svgo's own `optimize(svg, config)`: `plugins` accepts * plain names, raw svgo spellings, and `{name, params}` entries; omitted * `config` selects the default `preset-default` plugin set. Auto-loads the wasm * module from the default URL on first use unless you called `load()` first. * With `config.worker: true` the run is offloaded to a dedicated module worker * so the calling thread stays responsive; where no `Worker` exists it falls * back to the main thread. The worker client is `import()`ed lazily, so this * bundle never carries it (or pays its bytes) until `worker: true` is used. */ export declare function optimize(svg: string, config?: Config | null): Promise; /** * Asynchronously read the resolvable plugin names (svgo order, preset-default * first). This is the runtime source of truth: it is exactly `PluginName::ALL` * on the Rust side. Auto-loads the module like `optimize`. */ export declare function plugins(): Promise; //# sourceMappingURL=index.d.ts.map