/** * Resilient one-shot retry around wasm-bindgen's `init()`. * * wasm-bindgen's streaming loader rethrows on a non-OK HTTP status or a failed * fetch of `ifc-lite_bg.wasm` (it only falls back to `arrayBuffer`+`instantiate` * for the wrong-MIME case), surfacing as `TypeError: Failed to execute * 'compile' on 'WebAssembly': HTTP status code is not ok`. A transient blip — a * cold CDN edge, a mid-deploy race, a flaky proxy/antivirus — can produce a * one-off failure that a second attempt recovers. * * Extracted from the worker so it is unit-testable without a real wasm bundle. */ /** * True when `message` looks like a transient transport/download failure of the * engine binary (worth one retry) rather than a genuine corrupt-module or * validation error (which must propagate immediately so real bugs aren't * masked). * * Per the WebAssembly Web API, the streaming loader validates the HTTP response * (status, MIME, CORS) and rejects with a `TypeError` BEFORE compiling, so only * those transport failures are retry-worthy. Invalid bytes (corrupt module, * wrong magic header) reject with a `CompileError` — retrying just refetches * the same bad bytes, so those fail fast. */ export declare function isTransientWasmLoadError(message: string): boolean; export interface InitWasmRetryOptions { /** Delay before the single retry. Default 300ms; pass 0 in tests. */ retryDelayMs?: number; /** Injected sleep (tests pass an instant resolver). */ sleep?: (ms: number) => Promise; /** Injected logger (defaults to `console.warn`). */ warn?: (message: string) => void; /** Context label for the log line. */ label?: string; } /** * Run `init` once; on a transient-looking failure, wait and retry exactly once. * Non-transient failures propagate without a retry. The second failure (if any) * propagates to the caller. * * @param init Thunk that performs the actual `init(...)` call (so callers can * bind their own wasm URL / arguments). */ export declare function initWasmWithRetry(init: () => Promise, options?: InitWasmRetryOptions): Promise; //# sourceMappingURL=wasm-init-retry.d.ts.map