@squoosh-kit/resize 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/resize.worker.browser.mjs +2 -2
- package/dist/resize.worker.browser.mjs.map +3 -3
- package/dist/resize.worker.bun.js +2 -2
- package/dist/resize.worker.bun.js.map +3 -3
- package/dist/resize.worker.node.cjs +2 -2
- package/dist/resize.worker.node.cjs.map +3 -3
- package/dist/resize.worker.node.mjs +2 -2
- package/dist/resize.worker.node.mjs.map +3 -3
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as U,c as W,e as I,f as R}from"./chunk-x4xgrxwp.js";async function B(j){try{if(typeof process<"u"&&process.versions?.node){let D=await import("fs/promises"),J=new URL(j,import.meta.url).pathname,K=await D.readFile(J);return K.buffer.slice(K.byteOffset,K.byteOffset+K.byteLength)}}catch(D){}try{let D=new URL(j,import.meta.url),G=await fetch(D);if(!G.ok)throw Error(`Failed to fetch WASM binary: ${G.status} ${G.statusText}`);return await G.arrayBuffer()}catch(D){throw Error(`Failed to load WASM binary from "${j}": ${D instanceof Error?D.message:String(D)}`)}}var Y,$=null;function v(){if($===null||$.buffer!==Y.memory.buffer)$=new Uint8Array(Y.memory.buffer);return $}var T=0;function M(j,D){let G=D(j.length*1);return v().set(j,G/1),T=j.length,G}var k=null;function A(){if(k===null||k.buffer!==Y.memory.buffer)k=new Int32Array(Y.memory.buffer);return k}var F=null;function P(){if(F===null||F.buffer!==Y.memory.buffer)F=new Uint8ClampedArray(Y.memory.buffer);return F}function f(j,D){return P().subarray(j/1,j/1+D)}function z(j,D,G,J,K,Q,X,V){try{let q=Y.__wbindgen_add_to_stack_pointer(-16);var L=M(j,Y.__wbindgen_malloc),E=T;Y.resize(q,L,E,D,G,J,K,Q,X,V);var O=A()[q/4+0],S=A()[q/4+1],b=f(O,S).slice();return Y.__wbindgen_free(O,S*1),b}finally{Y.__wbindgen_add_to_stack_pointer(16)}}async function w(j,D){if(typeof Response==="function"&&j instanceof Response){if(typeof WebAssembly.instantiateStreaming==="function")try{return await WebAssembly.instantiateStreaming(j,D)}catch(J){if(j.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",J);else throw J}let G=await j.arrayBuffer();return await WebAssembly.instantiate(G,D)}else{let G=await WebAssembly.instantiate(j,D);if(G instanceof WebAssembly.Instance)return{instance:G,module:j};else return G}}async function H(j){if(typeof j>"u")j=new URL("squoosh_resize_bg.wasm",import.meta.url);let D={};if(typeof j==="string"||typeof Request==="function"&&j instanceof Request||typeof URL==="function"&&j instanceof URL)j=fetch(j);let{instance:G,module:J}=await w(await j,D);return Y=G.exports,H.__wbindgen_wasm_module=J,Y}var x=H;var N=null,Z=null;async function y(){if(N)return;if(Z)return Z;return Z=(async()=>{try{let j=null,D=[new URL("./wasm/squoosh_resize_bg.wasm",import.meta.url).href,new URL("../wasm/squoosh_resize_bg.wasm",import.meta.url).href],G=null;for(let J of D)try{j=await B(J);break}catch(K){G=K instanceof Error?K:Error(String(K))}if(!j)throw G||Error("Could not load WASM binary from any path");try{await x(j)}catch(J){if(J instanceof Error&&(J.message.includes("SharedArrayBuffer")||J.message.includes("first argument must be"))){if(typeof SharedArrayBuffer>"u")globalThis.SharedArrayBuffer=ArrayBuffer;try{await x(j)}catch(K){throw Error(`WASM module initialization failed even with polyfill: ${K instanceof Error?K.message:String(K)}`)}}else throw J}N=z}catch(j){throw Z=null,Error(`Failed to initialize resize WASM module: ${j instanceof Error?j.message:String(j)}`)}})(),Z}async function C(j,D){if(I(j),R(D),await y(),!N)throw Error("Resize module not initialized");let{data:G,width:J,height:K}=j,Q=D.width??J,X=D.height??K;if(D.width&&!D.height)X=Math.max(1,Math.round(K*D.width/J));else if(D.height&&!D.width)Q=Math.max(1,Math.round(J*D.height/K));if(Q<1||X<1)throw RangeError(`Output dimensions must be at least 1x1, got ${Q}x${X}`);let V=G instanceof Uint8ClampedArray?new Uint8Array(G.buffer,G.byteOffset,G.length):new Uint8Array(G.buffer,G.byteOffset,G.length);return{data:N(V,J,K,Q,X,c(D),D.premultiply??!0,D.linearRGB??!0),width:Q,height:X}}async function h(j,D,G){if(G?.aborted)throw new DOMException("Aborted","AbortError");return C(j,D)}function c(j){return{triangular:0,catrom:1,mitchell:2,lanczos3:3}[j?.method??"lanczos3"]??3}if(typeof self<"u")self.onmessage=async(j)=>{let D=j.data;if(D?.type==="worker:ping"){self.postMessage({type:"worker:ready"});return}let{id:G,type:J,payload:K}=D,Q={id:G,ok:!1};try{if(J!=="resize:run")throw Error(`Unknown message type: ${J}`);let X=await C(K.image,K.options);Q.ok=!0,Q.data=X,self.postMessage(Q)}catch(X){Q.error=X instanceof Error?X.message:String(X),self.postMessage(Q)}};export{h as resizeClient};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=0856B79639E960EE64756E2164756E21
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"/**\n * Load WASM binary from various sources with fallback strategies\n *\n * Supports:\n * - Node.js (fs/promises)\n * - Browsers (fetch)\n * - Workers (fetch)\n */\nexport async function loadWasmBinary(\n relativePath: string\n): Promise<ArrayBuffer> {\n try {\n // Strategy 1: Try Node.js fs first (most reliable)\n if (typeof process !== 'undefined' && process.versions?.node) {\n const fsModule = await import(/* @vite-ignore */ 'fs/promises');\n const fileUrl = new URL(relativePath, import.meta.url);\n const filePath = fileUrl.pathname;\n const buffer = await fsModule.readFile(filePath);\n return buffer.buffer.slice(\n buffer.byteOffset,\n buffer.byteOffset + buffer.byteLength\n );\n }\n } catch (e) {\n // Fall through to fetch strategy\n }\n\n // Strategy 2: Fallback to fetch (works in browsers and workers)\n try {\n const url = new URL(/* @vite-ignore */ relativePath, import.meta.url);\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(\n `Failed to fetch WASM binary: ${response.status} ${response.statusText}`\n );\n }\n return await response.arrayBuffer();\n } catch (error) {\n throw new Error(\n `Failed to load WASM binary from \"${relativePath}\": ${error instanceof Error ? error.message : String(error)}`\n );\n }\n}\n\n/**\n * Load WASM JavaScript module with fallback strategies\n *\n * Strategy 1: Static relative import (works everywhere)\n * Strategy 2: import.meta.resolve (Node.js 22+)\n * Strategy 3: URL-based import (browsers/workers)\n */\nexport async function loadWasmModule(\n modulePath: string\n): Promise<WebAssembly.Module> {\n // Strategy 1: Try direct static import\n try {\n return await import(/* @vite-ignore */ modulePath);\n } catch (e1) {\n // Continue to next strategy\n }\n\n // Strategy 2: Try import.meta.resolve (Node.js 22+)\n try {\n const resolvedPath = await import.meta.resolve(modulePath);\n return await import(/* @vite-ignore */ resolvedPath);\n } catch (e2) {\n // Continue to next strategy\n }\n\n // Strategy 3: Try URL-based import\n try {\n const url = new URL(/* @vite-ignore */ modulePath, import.meta.url);\n return await import(/* @vite-ignore */ url.href);\n } catch (e3) {\n throw new Error(\n `Failed to load WASM module from \"${modulePath}\". ` +\n `Ensure WASM files are in the expected location and the module can be resolved.`\n );\n }\n}\n",
|
|
6
6
|
"\nlet wasm;\n\nlet cachegetUint8Memory0 = null;\nfunction getUint8Memory0() {\n if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {\n cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachegetUint8Memory0;\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nfunction passArray8ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 1);\n getUint8Memory0().set(arg, ptr / 1);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nlet cachegetInt32Memory0 = null;\nfunction getInt32Memory0() {\n if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {\n cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);\n }\n return cachegetInt32Memory0;\n}\n\nlet cachegetUint8ClampedMemory0 = null;\nfunction getUint8ClampedMemory0() {\n if (cachegetUint8ClampedMemory0 === null || cachegetUint8ClampedMemory0.buffer !== wasm.memory.buffer) {\n cachegetUint8ClampedMemory0 = new Uint8ClampedArray(wasm.memory.buffer);\n }\n return cachegetUint8ClampedMemory0;\n}\n\nfunction getClampedArrayU8FromWasm0(ptr, len) {\n return getUint8ClampedMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n/**\n* @param {Uint8Array} input_image\n* @param {number} input_width\n* @param {number} input_height\n* @param {number} output_width\n* @param {number} output_height\n* @param {number} typ_idx\n* @param {boolean} premultiply\n* @param {boolean} color_space_conversion\n* @returns {Uint8ClampedArray}\n*/\nexport function resize(input_image, input_width, input_height, output_width, output_height, typ_idx, premultiply, color_space_conversion) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n var ptr0 = passArray8ToWasm0(input_image, wasm.__wbindgen_malloc);\n var len0 = WASM_VECTOR_LEN;\n wasm.resize(retptr, ptr0, len0, input_width, input_height, output_width, output_height, typ_idx, premultiply, color_space_conversion);\n var r0 = getInt32Memory0()[retptr / 4 + 0];\n var r1 = getInt32Memory0()[retptr / 4 + 1];\n var v1 = getClampedArrayU8FromWasm0(r0, r1).slice();\n wasm.__wbindgen_free(r0, r1 * 1);\n return v1;\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\n\nasync function load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nasync function init(input) {\n if (typeof input === 'undefined') {\n input = new URL('squoosh_resize_bg.wasm', import.meta.url);\n }\n const imports = {};\n\n\n if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {\n input = fetch(input);\n }\n\n\n\n const { instance, module } = await load(await input, imports);\n\n wasm = instance.exports;\n init.__wbindgen_wasm_module = module;\n\n return wasm;\n}\n\nexport default init;\n\n",
|
|
7
|
-
"/**\n * Resize processor - single-source worker/client implementation\n */\n\nimport {\n type WorkerRequest,\n type WorkerResponse,\n type ImageInput,\n loadWasmBinary,\n validateImageInput,\n validateResizeOptions,\n} from '@squoosh-kit/runtime';\nimport type { ResizeOptions } from './types';\nimport * as squoosh_resize_module from '../wasm/squoosh_resize';\n\n// Define the type locally to avoid module resolution issues with the linter\ntype SquooshWasmResize = (\n input_image: Uint8Array,\n input_width: number,\n input_height: number,\n output_width: number,\n output_height: number,\n typ_idx: number,\n premultiply: boolean,\n color_space_conversion: boolean\n) => Uint8ClampedArray;\n\nlet wasmResize: SquooshWasmResize | null = null;\nlet initPromise: Promise<void> | null = null;\n\nasync function init(): Promise<void> {\n if (wasmResize) {\n return;\n }\n\n if (initPromise) {\n return initPromise;\n }\n\n initPromise = (async () => {\n try {\n // Load WASM binary with robust fallback strategies\n // Try multiple paths to support both development (../wasm) and npm installed (./wasm) scenarios\n let wasmBuffer: ArrayBuffer | null = null;\n const pathsToTry = [\n new URL(\n /* @vite-ignore */ './wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n new URL(\n /* @vite-ignore */ '../wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n ];\n\n let lastError: Error | null = null;\n for (const path of pathsToTry) {\n try {\n wasmBuffer = await loadWasmBinary(path);\n break;\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(String(error));\n // Continue to next path\n }\n }\n\n if (!wasmBuffer) {\n throw (\n lastError || new Error('Could not load WASM binary from any path')\n );\n }\n\n // Initialize WASM module with the binary buffer\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (initError: unknown) {\n // If initialization fails due to SharedArrayBuffer issues, try with polyfill\n if (\n initError instanceof Error &&\n (initError.message.includes('SharedArrayBuffer') ||\n initError.message.includes('first argument must be'))\n ) {\n // Apply polyfill and retry\n if (typeof SharedArrayBuffer === 'undefined') {\n (\n globalThis as unknown as Record<string, typeof ArrayBuffer>\n ).SharedArrayBuffer = ArrayBuffer;\n }\n // Reload the module with polyfill in place\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (retryError) {\n throw new Error(\n `WASM module initialization failed even with polyfill: ${retryError instanceof Error ? retryError.message : String(retryError)}`\n );\n }\n } else {\n throw initError;\n }\n }\n // After initialization, the module's exported resize function is ready to use\n wasmResize = squoosh_resize_module.resize as unknown as SquooshWasmResize;\n } catch (error) {\n initPromise = null;\n throw new Error(\n `Failed to initialize resize WASM module: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n })();\n\n return initPromise;\n}\n\nasync function _resizeCore(\n image: ImageInput,\n options: ResizeOptions\n): Promise<ImageInput> {\n validateImageInput(image);\n validateResizeOptions(options);\n\n await init();\n if (!wasmResize) {\n throw new Error('Resize module not initialized');\n }\n\n const { data, width: inputWidth, height: inputHeight } = image;\n\n let outputWidth = options.width ?? inputWidth;\n let outputHeight = options.height ?? inputHeight;\n\n if (options.width && !options.height) {\n outputHeight = Math.max(\n 1,\n Math.round((inputHeight * options.width) / inputWidth)\n );\n } else if (options.height && !options.width) {\n outputWidth = Math.max(\n 1,\n Math.round((inputWidth * options.height) / inputHeight)\n );\n }\n\n if (outputWidth < 1 || outputHeight < 1) {\n throw new RangeError(\n `Output dimensions must be at least 1x1, got ${outputWidth}x${outputHeight}`\n );\n }\n\n // Create a zero-copy Uint8Array view if needed\n // (don't copy the buffer - just create a view on the same memory)\n const dataArray =\n data instanceof Uint8ClampedArray\n ? new Uint8Array(data.buffer as ArrayBuffer, data.byteOffset, data.length)\n : new Uint8Array(\n data.buffer as ArrayBuffer,\n data.byteOffset,\n data.length\n );\n\n const result = wasmResize(\n dataArray,\n inputWidth,\n inputHeight,\n outputWidth,\n outputHeight,\n getResizeMethod(options),\n options.premultiply ?? true,\n options.linearRGB ?? true\n );\n\n return {\n data: result,\n width: outputWidth,\n height: outputHeight,\n };\n}\n\nexport async function resizeClient(\n image: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n): Promise<ImageInput> {\n if (signal?.aborted) {\n throw new DOMException('Aborted', 'AbortError');\n }\n return _resizeCore(image, options);\n}\n\n/**\n * Map ResizeOptions method to WASM typ_idx parameter\n * typ_idx values (from Squoosh):\n * 0: Triangular - fastest, lowest quality\n * 1: Catrom - medium quality and speed\n * 2: Mitchell - good balance (default)\n * 3: Lanczos3 - highest quality, slowest\n */\nfunction getResizeMethod(options?: ResizeOptions): number {\n const methodMap: Record<string, number> = {\n triangular: 0,\n catrom: 1,\n mitchell: 2,\n lanczos3: 3,\n };\n return methodMap[options?.method ?? 'lanczos3'] ?? 3;\n}\n\n/**\n * Worker message handler\n */\nif (typeof self !== 'undefined') {\n self.onmessage = async (event: MessageEvent) => {\n const data = event.data;\n\n // Handle worker ping for initialization\n if (data?.type === 'worker:ping') {\n self.postMessage({ type: 'worker:ready' });\n return;\n }\n\n const { id, type, payload } = data as WorkerRequest<{\n image: ImageInput;\n options: ResizeOptions;\n }>;\n\n const response: WorkerResponse<ImageInput> = { id, ok: false };\n\n try {\n if (type !== 'resize:run') {\n throw new Error(`Unknown message type: ${type}`);\n }\n\n const resultImage = await _resizeCore(payload.image, payload.options);\n\n response.ok = true;\n response.data = resultImage;\n\n
|
|
7
|
+
"/**\n * Resize processor - single-source worker/client implementation\n */\n\nimport {\n type WorkerRequest,\n type WorkerResponse,\n type ImageInput,\n loadWasmBinary,\n validateImageInput,\n validateResizeOptions,\n} from '@squoosh-kit/runtime';\nimport type { ResizeOptions } from './types';\nimport * as squoosh_resize_module from '../wasm/squoosh_resize';\n\n// Define the type locally to avoid module resolution issues with the linter\ntype SquooshWasmResize = (\n input_image: Uint8Array,\n input_width: number,\n input_height: number,\n output_width: number,\n output_height: number,\n typ_idx: number,\n premultiply: boolean,\n color_space_conversion: boolean\n) => Uint8ClampedArray;\n\nlet wasmResize: SquooshWasmResize | null = null;\nlet initPromise: Promise<void> | null = null;\n\nasync function init(): Promise<void> {\n if (wasmResize) {\n return;\n }\n\n if (initPromise) {\n return initPromise;\n }\n\n initPromise = (async () => {\n try {\n // Load WASM binary with robust fallback strategies\n // Try multiple paths to support both development (../wasm) and npm installed (./wasm) scenarios\n let wasmBuffer: ArrayBuffer | null = null;\n const pathsToTry = [\n new URL(\n /* @vite-ignore */ './wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n new URL(\n /* @vite-ignore */ '../wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n ];\n\n let lastError: Error | null = null;\n for (const path of pathsToTry) {\n try {\n wasmBuffer = await loadWasmBinary(path);\n break;\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(String(error));\n // Continue to next path\n }\n }\n\n if (!wasmBuffer) {\n throw (\n lastError || new Error('Could not load WASM binary from any path')\n );\n }\n\n // Initialize WASM module with the binary buffer\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (initError: unknown) {\n // If initialization fails due to SharedArrayBuffer issues, try with polyfill\n if (\n initError instanceof Error &&\n (initError.message.includes('SharedArrayBuffer') ||\n initError.message.includes('first argument must be'))\n ) {\n // Apply polyfill and retry\n if (typeof SharedArrayBuffer === 'undefined') {\n (\n globalThis as unknown as Record<string, typeof ArrayBuffer>\n ).SharedArrayBuffer = ArrayBuffer;\n }\n // Reload the module with polyfill in place\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (retryError) {\n throw new Error(\n `WASM module initialization failed even with polyfill: ${retryError instanceof Error ? retryError.message : String(retryError)}`\n );\n }\n } else {\n throw initError;\n }\n }\n // After initialization, the module's exported resize function is ready to use\n wasmResize = squoosh_resize_module.resize as unknown as SquooshWasmResize;\n } catch (error) {\n initPromise = null;\n throw new Error(\n `Failed to initialize resize WASM module: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n })();\n\n return initPromise;\n}\n\nasync function _resizeCore(\n image: ImageInput,\n options: ResizeOptions\n): Promise<ImageInput> {\n validateImageInput(image);\n validateResizeOptions(options);\n\n await init();\n if (!wasmResize) {\n throw new Error('Resize module not initialized');\n }\n\n const { data, width: inputWidth, height: inputHeight } = image;\n\n let outputWidth = options.width ?? inputWidth;\n let outputHeight = options.height ?? inputHeight;\n\n if (options.width && !options.height) {\n outputHeight = Math.max(\n 1,\n Math.round((inputHeight * options.width) / inputWidth)\n );\n } else if (options.height && !options.width) {\n outputWidth = Math.max(\n 1,\n Math.round((inputWidth * options.height) / inputHeight)\n );\n }\n\n if (outputWidth < 1 || outputHeight < 1) {\n throw new RangeError(\n `Output dimensions must be at least 1x1, got ${outputWidth}x${outputHeight}`\n );\n }\n\n // Create a zero-copy Uint8Array view if needed\n // (don't copy the buffer - just create a view on the same memory)\n const dataArray =\n data instanceof Uint8ClampedArray\n ? new Uint8Array(data.buffer as ArrayBuffer, data.byteOffset, data.length)\n : new Uint8Array(\n data.buffer as ArrayBuffer,\n data.byteOffset,\n data.length\n );\n\n const result = wasmResize(\n dataArray,\n inputWidth,\n inputHeight,\n outputWidth,\n outputHeight,\n getResizeMethod(options),\n options.premultiply ?? true,\n options.linearRGB ?? true\n );\n\n return {\n data: result,\n width: outputWidth,\n height: outputHeight,\n };\n}\n\nexport async function resizeClient(\n image: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n): Promise<ImageInput> {\n if (signal?.aborted) {\n throw new DOMException('Aborted', 'AbortError');\n }\n return _resizeCore(image, options);\n}\n\n/**\n * Map ResizeOptions method to WASM typ_idx parameter\n * typ_idx values (from Squoosh):\n * 0: Triangular - fastest, lowest quality\n * 1: Catrom - medium quality and speed\n * 2: Mitchell - good balance (default)\n * 3: Lanczos3 - highest quality, slowest\n */\nfunction getResizeMethod(options?: ResizeOptions): number {\n const methodMap: Record<string, number> = {\n triangular: 0,\n catrom: 1,\n mitchell: 2,\n lanczos3: 3,\n };\n return methodMap[options?.method ?? 'lanczos3'] ?? 3;\n}\n\n/**\n * Worker message handler\n */\nif (typeof self !== 'undefined') {\n self.onmessage = async (event: MessageEvent) => {\n const data = event.data;\n\n // Handle worker ping for initialization\n if (data?.type === 'worker:ping') {\n self.postMessage({ type: 'worker:ready' });\n return;\n }\n\n const { id, type, payload } = data as WorkerRequest<{\n image: ImageInput;\n options: ResizeOptions;\n }>;\n\n const response: WorkerResponse<ImageInput> = { id, ok: false };\n\n try {\n if (type !== 'resize:run') {\n throw new Error(`Unknown message type: ${type}`);\n }\n\n const resultImage = await _resizeCore(payload.image, payload.options);\n\n response.ok = true;\n response.data = resultImage;\n\n // Post the response without transferring - the ImageInput with data will be cloned\n // Transfer is only used for incoming requests (image.data buffer from client)\n self.postMessage(response);\n } catch (error) {\n response.error = error instanceof Error ? error.message : String(error);\n self.postMessage(response);\n }\n };\n}\n"
|
|
8
8
|
],
|
|
9
|
-
"mappings": "6DAQA,eAAsB,CAAc,CAClC,EACsB,CACtB,GAAI,CAEF,GAAI,OAAO,QAAY,KAAe,QAAQ,UAAU,KAAM,CAC5D,IAAM,EAAW,KAAgC,uBAE3C,EADU,IAAI,IAAI,EAAc,YAAY,GAAG,EAC5B,SACnB,EAAS,MAAM,EAAS,SAAS,CAAQ,EAC/C,OAAO,EAAO,OAAO,MACnB,EAAO,WACP,EAAO,WAAa,EAAO,UAC7B,GAEF,MAAO,EAAG,EAKZ,GAAI,CACF,IAAM,EAAM,IAAI,IAAuB,EAAc,YAAY,GAAG,EAC9D,EAAW,MAAM,MAAM,CAAG,EAChC,GAAI,CAAC,EAAS,GACZ,MAAU,MACR,gCAAgC,EAAS,UAAU,EAAS,YAC9D,EAEF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
|
|
2
|
+
import{b as U,c as W,e as I,f as R}from"./chunk-pn10n1jn.js";async function B(j){try{if(typeof process<"u"&&process.versions?.node){let D=await import("fs/promises"),J=new URL(j,import.meta.url).pathname,K=await D.readFile(J);return K.buffer.slice(K.byteOffset,K.byteOffset+K.byteLength)}}catch(D){}try{let D=new URL(j,import.meta.url),G=await fetch(D);if(!G.ok)throw Error(`Failed to fetch WASM binary: ${G.status} ${G.statusText}`);return await G.arrayBuffer()}catch(D){throw Error(`Failed to load WASM binary from "${j}": ${D instanceof Error?D.message:String(D)}`)}}var Y,$=null;function v(){if($===null||$.buffer!==Y.memory.buffer)$=new Uint8Array(Y.memory.buffer);return $}var T=0;function M(j,D){let G=D(j.length*1);return v().set(j,G/1),T=j.length,G}var k=null;function A(){if(k===null||k.buffer!==Y.memory.buffer)k=new Int32Array(Y.memory.buffer);return k}var F=null;function P(){if(F===null||F.buffer!==Y.memory.buffer)F=new Uint8ClampedArray(Y.memory.buffer);return F}function f(j,D){return P().subarray(j/1,j/1+D)}function z(j,D,G,J,K,Q,X,V){try{let q=Y.__wbindgen_add_to_stack_pointer(-16);var L=M(j,Y.__wbindgen_malloc),E=T;Y.resize(q,L,E,D,G,J,K,Q,X,V);var O=A()[q/4+0],S=A()[q/4+1],b=f(O,S).slice();return Y.__wbindgen_free(O,S*1),b}finally{Y.__wbindgen_add_to_stack_pointer(16)}}async function w(j,D){if(typeof Response==="function"&&j instanceof Response){if(typeof WebAssembly.instantiateStreaming==="function")try{return await WebAssembly.instantiateStreaming(j,D)}catch(J){if(j.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",J);else throw J}let G=await j.arrayBuffer();return await WebAssembly.instantiate(G,D)}else{let G=await WebAssembly.instantiate(j,D);if(G instanceof WebAssembly.Instance)return{instance:G,module:j};else return G}}async function H(j){if(typeof j>"u")j=new URL("squoosh_resize_bg.wasm",import.meta.url);let D={};if(typeof j==="string"||typeof Request==="function"&&j instanceof Request||typeof URL==="function"&&j instanceof URL)j=fetch(j);let{instance:G,module:J}=await w(await j,D);return Y=G.exports,H.__wbindgen_wasm_module=J,Y}var x=H;var N=null,Z=null;async function y(){if(N)return;if(Z)return Z;return Z=(async()=>{try{let j=null,D=[new URL("./wasm/squoosh_resize_bg.wasm",import.meta.url).href,new URL("../wasm/squoosh_resize_bg.wasm",import.meta.url).href],G=null;for(let J of D)try{j=await B(J);break}catch(K){G=K instanceof Error?K:Error(String(K))}if(!j)throw G||Error("Could not load WASM binary from any path");try{await x(j)}catch(J){if(J instanceof Error&&(J.message.includes("SharedArrayBuffer")||J.message.includes("first argument must be"))){if(typeof SharedArrayBuffer>"u")globalThis.SharedArrayBuffer=ArrayBuffer;try{await x(j)}catch(K){throw Error(`WASM module initialization failed even with polyfill: ${K instanceof Error?K.message:String(K)}`)}}else throw J}N=z}catch(j){throw Z=null,Error(`Failed to initialize resize WASM module: ${j instanceof Error?j.message:String(j)}`)}})(),Z}async function C(j,D){if(I(j),R(D),await y(),!N)throw Error("Resize module not initialized");let{data:G,width:J,height:K}=j,Q=D.width??J,X=D.height??K;if(D.width&&!D.height)X=Math.max(1,Math.round(K*D.width/J));else if(D.height&&!D.width)Q=Math.max(1,Math.round(J*D.height/K));if(Q<1||X<1)throw RangeError(`Output dimensions must be at least 1x1, got ${Q}x${X}`);let V=G instanceof Uint8ClampedArray?new Uint8Array(G.buffer,G.byteOffset,G.length):new Uint8Array(G.buffer,G.byteOffset,G.length);return{data:N(V,J,K,Q,X,c(D),D.premultiply??!0,D.linearRGB??!0),width:Q,height:X}}async function h(j,D,G){if(G?.aborted)throw new DOMException("Aborted","AbortError");return C(j,D)}function c(j){return{triangular:0,catrom:1,mitchell:2,lanczos3:3}[j?.method??"lanczos3"]??3}if(typeof self<"u")self.onmessage=async(j)=>{let D=j.data;if(D?.type==="worker:ping"){self.postMessage({type:"worker:ready"});return}let{id:G,type:J,payload:K}=D,Q={id:G,ok:!1};try{if(J!=="resize:run")throw Error(`Unknown message type: ${J}`);let X=await C(K.image,K.options);Q.ok=!0,Q.data=X,self.postMessage(Q)}catch(X){Q.error=X instanceof Error?X.message:String(X),self.postMessage(Q)}};export{h as resizeClient};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=CD97BC9241C0F86264756E2164756E21
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"/**\n * Load WASM binary from various sources with fallback strategies\n *\n * Supports:\n * - Node.js (fs/promises)\n * - Browsers (fetch)\n * - Workers (fetch)\n */\nexport async function loadWasmBinary(\n relativePath: string\n): Promise<ArrayBuffer> {\n try {\n // Strategy 1: Try Node.js fs first (most reliable)\n if (typeof process !== 'undefined' && process.versions?.node) {\n const fsModule = await import(/* @vite-ignore */ 'fs/promises');\n const fileUrl = new URL(relativePath, import.meta.url);\n const filePath = fileUrl.pathname;\n const buffer = await fsModule.readFile(filePath);\n return buffer.buffer.slice(\n buffer.byteOffset,\n buffer.byteOffset + buffer.byteLength\n );\n }\n } catch (e) {\n // Fall through to fetch strategy\n }\n\n // Strategy 2: Fallback to fetch (works in browsers and workers)\n try {\n const url = new URL(/* @vite-ignore */ relativePath, import.meta.url);\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(\n `Failed to fetch WASM binary: ${response.status} ${response.statusText}`\n );\n }\n return await response.arrayBuffer();\n } catch (error) {\n throw new Error(\n `Failed to load WASM binary from \"${relativePath}\": ${error instanceof Error ? error.message : String(error)}`\n );\n }\n}\n\n/**\n * Load WASM JavaScript module with fallback strategies\n *\n * Strategy 1: Static relative import (works everywhere)\n * Strategy 2: import.meta.resolve (Node.js 22+)\n * Strategy 3: URL-based import (browsers/workers)\n */\nexport async function loadWasmModule(\n modulePath: string\n): Promise<WebAssembly.Module> {\n // Strategy 1: Try direct static import\n try {\n return await import(/* @vite-ignore */ modulePath);\n } catch (e1) {\n // Continue to next strategy\n }\n\n // Strategy 2: Try import.meta.resolve (Node.js 22+)\n try {\n const resolvedPath = await import.meta.resolve(modulePath);\n return await import(/* @vite-ignore */ resolvedPath);\n } catch (e2) {\n // Continue to next strategy\n }\n\n // Strategy 3: Try URL-based import\n try {\n const url = new URL(/* @vite-ignore */ modulePath, import.meta.url);\n return await import(/* @vite-ignore */ url.href);\n } catch (e3) {\n throw new Error(\n `Failed to load WASM module from \"${modulePath}\". ` +\n `Ensure WASM files are in the expected location and the module can be resolved.`\n );\n }\n}\n",
|
|
6
6
|
"\nlet wasm;\n\nlet cachegetUint8Memory0 = null;\nfunction getUint8Memory0() {\n if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {\n cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachegetUint8Memory0;\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nfunction passArray8ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 1);\n getUint8Memory0().set(arg, ptr / 1);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nlet cachegetInt32Memory0 = null;\nfunction getInt32Memory0() {\n if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {\n cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);\n }\n return cachegetInt32Memory0;\n}\n\nlet cachegetUint8ClampedMemory0 = null;\nfunction getUint8ClampedMemory0() {\n if (cachegetUint8ClampedMemory0 === null || cachegetUint8ClampedMemory0.buffer !== wasm.memory.buffer) {\n cachegetUint8ClampedMemory0 = new Uint8ClampedArray(wasm.memory.buffer);\n }\n return cachegetUint8ClampedMemory0;\n}\n\nfunction getClampedArrayU8FromWasm0(ptr, len) {\n return getUint8ClampedMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n/**\n* @param {Uint8Array} input_image\n* @param {number} input_width\n* @param {number} input_height\n* @param {number} output_width\n* @param {number} output_height\n* @param {number} typ_idx\n* @param {boolean} premultiply\n* @param {boolean} color_space_conversion\n* @returns {Uint8ClampedArray}\n*/\nexport function resize(input_image, input_width, input_height, output_width, output_height, typ_idx, premultiply, color_space_conversion) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n var ptr0 = passArray8ToWasm0(input_image, wasm.__wbindgen_malloc);\n var len0 = WASM_VECTOR_LEN;\n wasm.resize(retptr, ptr0, len0, input_width, input_height, output_width, output_height, typ_idx, premultiply, color_space_conversion);\n var r0 = getInt32Memory0()[retptr / 4 + 0];\n var r1 = getInt32Memory0()[retptr / 4 + 1];\n var v1 = getClampedArrayU8FromWasm0(r0, r1).slice();\n wasm.__wbindgen_free(r0, r1 * 1);\n return v1;\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\n\nasync function load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nasync function init(input) {\n if (typeof input === 'undefined') {\n input = new URL('squoosh_resize_bg.wasm', import.meta.url);\n }\n const imports = {};\n\n\n if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {\n input = fetch(input);\n }\n\n\n\n const { instance, module } = await load(await input, imports);\n\n wasm = instance.exports;\n init.__wbindgen_wasm_module = module;\n\n return wasm;\n}\n\nexport default init;\n\n",
|
|
7
|
-
"/**\n * Resize processor - single-source worker/client implementation\n */\n\nimport {\n type WorkerRequest,\n type WorkerResponse,\n type ImageInput,\n loadWasmBinary,\n validateImageInput,\n validateResizeOptions,\n} from '@squoosh-kit/runtime';\nimport type { ResizeOptions } from './types';\nimport * as squoosh_resize_module from '../wasm/squoosh_resize';\n\n// Define the type locally to avoid module resolution issues with the linter\ntype SquooshWasmResize = (\n input_image: Uint8Array,\n input_width: number,\n input_height: number,\n output_width: number,\n output_height: number,\n typ_idx: number,\n premultiply: boolean,\n color_space_conversion: boolean\n) => Uint8ClampedArray;\n\nlet wasmResize: SquooshWasmResize | null = null;\nlet initPromise: Promise<void> | null = null;\n\nasync function init(): Promise<void> {\n if (wasmResize) {\n return;\n }\n\n if (initPromise) {\n return initPromise;\n }\n\n initPromise = (async () => {\n try {\n // Load WASM binary with robust fallback strategies\n // Try multiple paths to support both development (../wasm) and npm installed (./wasm) scenarios\n let wasmBuffer: ArrayBuffer | null = null;\n const pathsToTry = [\n new URL(\n /* @vite-ignore */ './wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n new URL(\n /* @vite-ignore */ '../wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n ];\n\n let lastError: Error | null = null;\n for (const path of pathsToTry) {\n try {\n wasmBuffer = await loadWasmBinary(path);\n break;\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(String(error));\n // Continue to next path\n }\n }\n\n if (!wasmBuffer) {\n throw (\n lastError || new Error('Could not load WASM binary from any path')\n );\n }\n\n // Initialize WASM module with the binary buffer\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (initError: unknown) {\n // If initialization fails due to SharedArrayBuffer issues, try with polyfill\n if (\n initError instanceof Error &&\n (initError.message.includes('SharedArrayBuffer') ||\n initError.message.includes('first argument must be'))\n ) {\n // Apply polyfill and retry\n if (typeof SharedArrayBuffer === 'undefined') {\n (\n globalThis as unknown as Record<string, typeof ArrayBuffer>\n ).SharedArrayBuffer = ArrayBuffer;\n }\n // Reload the module with polyfill in place\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (retryError) {\n throw new Error(\n `WASM module initialization failed even with polyfill: ${retryError instanceof Error ? retryError.message : String(retryError)}`\n );\n }\n } else {\n throw initError;\n }\n }\n // After initialization, the module's exported resize function is ready to use\n wasmResize = squoosh_resize_module.resize as unknown as SquooshWasmResize;\n } catch (error) {\n initPromise = null;\n throw new Error(\n `Failed to initialize resize WASM module: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n })();\n\n return initPromise;\n}\n\nasync function _resizeCore(\n image: ImageInput,\n options: ResizeOptions\n): Promise<ImageInput> {\n validateImageInput(image);\n validateResizeOptions(options);\n\n await init();\n if (!wasmResize) {\n throw new Error('Resize module not initialized');\n }\n\n const { data, width: inputWidth, height: inputHeight } = image;\n\n let outputWidth = options.width ?? inputWidth;\n let outputHeight = options.height ?? inputHeight;\n\n if (options.width && !options.height) {\n outputHeight = Math.max(\n 1,\n Math.round((inputHeight * options.width) / inputWidth)\n );\n } else if (options.height && !options.width) {\n outputWidth = Math.max(\n 1,\n Math.round((inputWidth * options.height) / inputHeight)\n );\n }\n\n if (outputWidth < 1 || outputHeight < 1) {\n throw new RangeError(\n `Output dimensions must be at least 1x1, got ${outputWidth}x${outputHeight}`\n );\n }\n\n // Create a zero-copy Uint8Array view if needed\n // (don't copy the buffer - just create a view on the same memory)\n const dataArray =\n data instanceof Uint8ClampedArray\n ? new Uint8Array(data.buffer as ArrayBuffer, data.byteOffset, data.length)\n : new Uint8Array(\n data.buffer as ArrayBuffer,\n data.byteOffset,\n data.length\n );\n\n const result = wasmResize(\n dataArray,\n inputWidth,\n inputHeight,\n outputWidth,\n outputHeight,\n getResizeMethod(options),\n options.premultiply ?? true,\n options.linearRGB ?? true\n );\n\n return {\n data: result,\n width: outputWidth,\n height: outputHeight,\n };\n}\n\nexport async function resizeClient(\n image: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n): Promise<ImageInput> {\n if (signal?.aborted) {\n throw new DOMException('Aborted', 'AbortError');\n }\n return _resizeCore(image, options);\n}\n\n/**\n * Map ResizeOptions method to WASM typ_idx parameter\n * typ_idx values (from Squoosh):\n * 0: Triangular - fastest, lowest quality\n * 1: Catrom - medium quality and speed\n * 2: Mitchell - good balance (default)\n * 3: Lanczos3 - highest quality, slowest\n */\nfunction getResizeMethod(options?: ResizeOptions): number {\n const methodMap: Record<string, number> = {\n triangular: 0,\n catrom: 1,\n mitchell: 2,\n lanczos3: 3,\n };\n return methodMap[options?.method ?? 'lanczos3'] ?? 3;\n}\n\n/**\n * Worker message handler\n */\nif (typeof self !== 'undefined') {\n self.onmessage = async (event: MessageEvent) => {\n const data = event.data;\n\n // Handle worker ping for initialization\n if (data?.type === 'worker:ping') {\n self.postMessage({ type: 'worker:ready' });\n return;\n }\n\n const { id, type, payload } = data as WorkerRequest<{\n image: ImageInput;\n options: ResizeOptions;\n }>;\n\n const response: WorkerResponse<ImageInput> = { id, ok: false };\n\n try {\n if (type !== 'resize:run') {\n throw new Error(`Unknown message type: ${type}`);\n }\n\n const resultImage = await _resizeCore(payload.image, payload.options);\n\n response.ok = true;\n response.data = resultImage;\n\n
|
|
7
|
+
"/**\n * Resize processor - single-source worker/client implementation\n */\n\nimport {\n type WorkerRequest,\n type WorkerResponse,\n type ImageInput,\n loadWasmBinary,\n validateImageInput,\n validateResizeOptions,\n} from '@squoosh-kit/runtime';\nimport type { ResizeOptions } from './types';\nimport * as squoosh_resize_module from '../wasm/squoosh_resize';\n\n// Define the type locally to avoid module resolution issues with the linter\ntype SquooshWasmResize = (\n input_image: Uint8Array,\n input_width: number,\n input_height: number,\n output_width: number,\n output_height: number,\n typ_idx: number,\n premultiply: boolean,\n color_space_conversion: boolean\n) => Uint8ClampedArray;\n\nlet wasmResize: SquooshWasmResize | null = null;\nlet initPromise: Promise<void> | null = null;\n\nasync function init(): Promise<void> {\n if (wasmResize) {\n return;\n }\n\n if (initPromise) {\n return initPromise;\n }\n\n initPromise = (async () => {\n try {\n // Load WASM binary with robust fallback strategies\n // Try multiple paths to support both development (../wasm) and npm installed (./wasm) scenarios\n let wasmBuffer: ArrayBuffer | null = null;\n const pathsToTry = [\n new URL(\n /* @vite-ignore */ './wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n new URL(\n /* @vite-ignore */ '../wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n ];\n\n let lastError: Error | null = null;\n for (const path of pathsToTry) {\n try {\n wasmBuffer = await loadWasmBinary(path);\n break;\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(String(error));\n // Continue to next path\n }\n }\n\n if (!wasmBuffer) {\n throw (\n lastError || new Error('Could not load WASM binary from any path')\n );\n }\n\n // Initialize WASM module with the binary buffer\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (initError: unknown) {\n // If initialization fails due to SharedArrayBuffer issues, try with polyfill\n if (\n initError instanceof Error &&\n (initError.message.includes('SharedArrayBuffer') ||\n initError.message.includes('first argument must be'))\n ) {\n // Apply polyfill and retry\n if (typeof SharedArrayBuffer === 'undefined') {\n (\n globalThis as unknown as Record<string, typeof ArrayBuffer>\n ).SharedArrayBuffer = ArrayBuffer;\n }\n // Reload the module with polyfill in place\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (retryError) {\n throw new Error(\n `WASM module initialization failed even with polyfill: ${retryError instanceof Error ? retryError.message : String(retryError)}`\n );\n }\n } else {\n throw initError;\n }\n }\n // After initialization, the module's exported resize function is ready to use\n wasmResize = squoosh_resize_module.resize as unknown as SquooshWasmResize;\n } catch (error) {\n initPromise = null;\n throw new Error(\n `Failed to initialize resize WASM module: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n })();\n\n return initPromise;\n}\n\nasync function _resizeCore(\n image: ImageInput,\n options: ResizeOptions\n): Promise<ImageInput> {\n validateImageInput(image);\n validateResizeOptions(options);\n\n await init();\n if (!wasmResize) {\n throw new Error('Resize module not initialized');\n }\n\n const { data, width: inputWidth, height: inputHeight } = image;\n\n let outputWidth = options.width ?? inputWidth;\n let outputHeight = options.height ?? inputHeight;\n\n if (options.width && !options.height) {\n outputHeight = Math.max(\n 1,\n Math.round((inputHeight * options.width) / inputWidth)\n );\n } else if (options.height && !options.width) {\n outputWidth = Math.max(\n 1,\n Math.round((inputWidth * options.height) / inputHeight)\n );\n }\n\n if (outputWidth < 1 || outputHeight < 1) {\n throw new RangeError(\n `Output dimensions must be at least 1x1, got ${outputWidth}x${outputHeight}`\n );\n }\n\n // Create a zero-copy Uint8Array view if needed\n // (don't copy the buffer - just create a view on the same memory)\n const dataArray =\n data instanceof Uint8ClampedArray\n ? new Uint8Array(data.buffer as ArrayBuffer, data.byteOffset, data.length)\n : new Uint8Array(\n data.buffer as ArrayBuffer,\n data.byteOffset,\n data.length\n );\n\n const result = wasmResize(\n dataArray,\n inputWidth,\n inputHeight,\n outputWidth,\n outputHeight,\n getResizeMethod(options),\n options.premultiply ?? true,\n options.linearRGB ?? true\n );\n\n return {\n data: result,\n width: outputWidth,\n height: outputHeight,\n };\n}\n\nexport async function resizeClient(\n image: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n): Promise<ImageInput> {\n if (signal?.aborted) {\n throw new DOMException('Aborted', 'AbortError');\n }\n return _resizeCore(image, options);\n}\n\n/**\n * Map ResizeOptions method to WASM typ_idx parameter\n * typ_idx values (from Squoosh):\n * 0: Triangular - fastest, lowest quality\n * 1: Catrom - medium quality and speed\n * 2: Mitchell - good balance (default)\n * 3: Lanczos3 - highest quality, slowest\n */\nfunction getResizeMethod(options?: ResizeOptions): number {\n const methodMap: Record<string, number> = {\n triangular: 0,\n catrom: 1,\n mitchell: 2,\n lanczos3: 3,\n };\n return methodMap[options?.method ?? 'lanczos3'] ?? 3;\n}\n\n/**\n * Worker message handler\n */\nif (typeof self !== 'undefined') {\n self.onmessage = async (event: MessageEvent) => {\n const data = event.data;\n\n // Handle worker ping for initialization\n if (data?.type === 'worker:ping') {\n self.postMessage({ type: 'worker:ready' });\n return;\n }\n\n const { id, type, payload } = data as WorkerRequest<{\n image: ImageInput;\n options: ResizeOptions;\n }>;\n\n const response: WorkerResponse<ImageInput> = { id, ok: false };\n\n try {\n if (type !== 'resize:run') {\n throw new Error(`Unknown message type: ${type}`);\n }\n\n const resultImage = await _resizeCore(payload.image, payload.options);\n\n response.ok = true;\n response.data = resultImage;\n\n // Post the response without transferring - the ImageInput with data will be cloned\n // Transfer is only used for incoming requests (image.data buffer from client)\n self.postMessage(response);\n } catch (error) {\n response.error = error instanceof Error ? error.message : String(error);\n self.postMessage(response);\n }\n };\n}\n"
|
|
8
8
|
],
|
|
9
|
-
"mappings": ";6DAQA,eAAsB,CAAc,CAClC,EACsB,CACtB,GAAI,CAEF,GAAI,OAAO,QAAY,KAAe,QAAQ,UAAU,KAAM,CAC5D,IAAM,EAAW,KAAgC,uBAE3C,EADU,IAAI,IAAI,EAAc,YAAY,GAAG,EAC5B,SACnB,EAAS,MAAM,EAAS,SAAS,CAAQ,EAC/C,OAAO,EAAO,OAAO,MACnB,EAAO,WACP,EAAO,WAAa,EAAO,UAC7B,GAEF,MAAO,EAAG,EAKZ,GAAI,CACF,IAAM,EAAM,IAAI,IAAuB,EAAc,YAAY,GAAG,EAC9D,EAAW,MAAM,MAAM,CAAG,EAChC,GAAI,CAAC,EAAS,GACZ,MAAU,MACR,gCAAgC,EAAS,UAAU,EAAS,YAC9D,EAEF,OAAO,MAAM,EAAS,YAAY,EAClC,MAAO,EAAO,CACd,MAAU,MACR,oCAAoC,OAAkB,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,GAC7G,GCvCJ,IAAI,EAEA,EAAuB,KAC3B,SAAS,CAAe,EAAG,CACvB,GAAI,IAAyB,MAAQ,EAAqB,SAAW,EAAK,OAAO,OAC7E,EAAuB,IAAI,WAAW,EAAK,OAAO,MAAM,EAE5D,OAAO,EAGX,IAAI,EAAkB,EAEtB,SAAS,CAAiB,CAAC,EAAK,EAAQ,CACpC,IAAM,EAAM,EAAO,EAAI,OAAS,CAAC,EAGjC,OAFA,E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MAAM,IAAI,aAAa,UAAW,YAAY,EAEhD,OAAO,EAAY,EAAO,CAAO,EAWnC,SAAS,CAAe,CAAC,EAAiC,CAOxD,MAN0C,CACxC,WAAY,EACZ,OAAQ,EACR,SAAU,EACV,SAAU,CACZ,EACiB,GAAS,QAAU,aAAe,EAMrD,GAAI,OAAO,KAAS,IAClB,KAAK,UAAY,MAAO,IAAwB,CAC9C,IAAM,EAAO,EAAM,KAGnB,GAAI,GAAM,OAAS,cAAe,CAChC,KAAK,YAAY,CAAE,KAAM,cAAe,CAAC,EACzC,OAGF,IAAQ,KAAI,OAAM,WAAY,EAKxB,EAAuC,CAAE,KAAI,GAAI,EAAM,EAE7D,GAAI,CACF,GAAI,IAAS,aACX,MAAU,MAAM,yBAAyB,GAAM,EAGjD,IAAM,EAAc,MAAM,EAAY,EAAQ,MAAO,EAAQ,OAAO,EAEpE,EAAS,GAAK,GACd,EAAS,KAAO,EAIhB,KAAK,YAAY,CAAQ,EACzB,MAAO,EAAO,CACd,EAAS,MAAQ,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,EACtE,KAAK,YAAY,CAAQ",
|
|
10
|
+
"debugId": "CD97BC9241C0F86264756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var h={};
|
|
1
|
+
var h={};y(h,{resizeClient:()=>g});module.exports=_(h);async function B(j){try{if(typeof process<"u"&&process.versions?.node){let D=await import("fs/promises"),J=new URL(j,"file:///home/bnowak/repos/squoosh-kit/packages/runtime/src/wasm-loader.ts").pathname,K=await D.readFile(J);return K.buffer.slice(K.byteOffset,K.byteOffset+K.byteLength)}}catch(D){}try{let D=new URL(j,"file:///home/bnowak/repos/squoosh-kit/packages/runtime/src/wasm-loader.ts"),G=await fetch(D);if(!G.ok)throw Error(`Failed to fetch WASM binary: ${G.status} ${G.statusText}`);return await G.arrayBuffer()}catch(D){throw Error(`Failed to load WASM binary from "${j}": ${D instanceof Error?D.message:String(D)}`)}}var Y,$=null;function W(){if($===null||$.buffer!==Y.memory.buffer)$=new Uint8Array(Y.memory.buffer);return $}var T=0;function v(j,D){let G=D(j.length*1);return W().set(j,G/1),T=j.length,G}var k=null;function A(){if(k===null||k.buffer!==Y.memory.buffer)k=new Int32Array(Y.memory.buffer);return k}var F=null;function M(){if(F===null||F.buffer!==Y.memory.buffer)F=new Uint8ClampedArray(Y.memory.buffer);return F}function P(j,D){return M().subarray(j/1,j/1+D)}function z(j,D,G,J,K,Q,X,V){try{let q=Y.__wbindgen_add_to_stack_pointer(-16);var L=v(j,Y.__wbindgen_malloc),E=T;Y.resize(q,L,E,D,G,J,K,Q,X,V);var O=A()[q/4+0],S=A()[q/4+1],b=P(O,S).slice();return Y.__wbindgen_free(O,S*1),b}finally{Y.__wbindgen_add_to_stack_pointer(16)}}async function f(j,D){if(typeof Response==="function"&&j instanceof Response){if(typeof WebAssembly.instantiateStreaming==="function")try{return await WebAssembly.instantiateStreaming(j,D)}catch(J){if(j.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",J);else throw J}let G=await j.arrayBuffer();return await WebAssembly.instantiate(G,D)}else{let G=await WebAssembly.instantiate(j,D);if(G instanceof WebAssembly.Instance)return{instance:G,module:j};else return G}}async function H(j){if(typeof j>"u")j=new URL("squoosh_resize_bg.wasm","file:///home/bnowak/repos/squoosh-kit/packages/resize/wasm/squoosh_resize.js");let D={};if(typeof j==="string"||typeof Request==="function"&&j instanceof Request||typeof URL==="function"&&j instanceof URL)j=fetch(j);let{instance:G,module:J}=await f(await j,D);return Y=G.exports,H.__wbindgen_wasm_module=J,Y}var x=H;var N=null,Z=null;async function c(){if(N)return;if(Z)return Z;return Z=(async()=>{try{let j=null,D=[new URL("./wasm/squoosh_resize_bg.wasm","file:///home/bnowak/repos/squoosh-kit/packages/resize/src/resize.worker.ts").href,new URL("../wasm/squoosh_resize_bg.wasm","file:///home/bnowak/repos/squoosh-kit/packages/resize/src/resize.worker.ts").href],G=null;for(let J of D)try{j=await B(J);break}catch(K){G=K instanceof Error?K:Error(String(K))}if(!j)throw G||Error("Could not load WASM binary from any path");try{await x(j)}catch(J){if(J instanceof Error&&(J.message.includes("SharedArrayBuffer")||J.message.includes("first argument must be"))){if(typeof SharedArrayBuffer>"u")globalThis.SharedArrayBuffer=ArrayBuffer;try{await x(j)}catch(K){throw Error(`WASM module initialization failed even with polyfill: ${K instanceof Error?K.message:String(K)}`)}}else throw J}N=z}catch(j){throw Z=null,Error(`Failed to initialize resize WASM module: ${j instanceof Error?j.message:String(j)}`)}})(),Z}async function C(j,D){if(I(j),R(D),await c(),!N)throw Error("Resize module not initialized");let{data:G,width:J,height:K}=j,Q=D.width??J,X=D.height??K;if(D.width&&!D.height)X=Math.max(1,Math.round(K*D.width/J));else if(D.height&&!D.width)Q=Math.max(1,Math.round(J*D.height/K));if(Q<1||X<1)throw RangeError(`Output dimensions must be at least 1x1, got ${Q}x${X}`);let V=G instanceof Uint8ClampedArray?new Uint8Array(G.buffer,G.byteOffset,G.length):new Uint8Array(G.buffer,G.byteOffset,G.length);return{data:N(V,J,K,Q,X,d(D),D.premultiply??!0,D.linearRGB??!0),width:Q,height:X}}async function g(j,D,G){if(G?.aborted)throw new DOMException("Aborted","AbortError");return C(j,D)}function d(j){return{triangular:0,catrom:1,mitchell:2,lanczos3:3}[j?.method??"lanczos3"]??3}if(typeof self<"u")self.onmessage=async(j)=>{let D=j.data;if(D?.type==="worker:ping"){self.postMessage({type:"worker:ready"});return}let{id:G,type:J,payload:K}=D,Q={id:G,ok:!1};try{if(J!=="resize:run")throw Error(`Unknown message type: ${J}`);let X=await C(K.image,K.options);Q.ok=!0,Q.data=X,self.postMessage(Q)}catch(X){Q.error=X instanceof Error?X.message:String(X),self.postMessage(Q)}};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=31A4676B06F1B0D864756E2164756E21
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"/**\n * Load WASM binary from various sources with fallback strategies\n *\n * Supports:\n * - Node.js (fs/promises)\n * - Browsers (fetch)\n * - Workers (fetch)\n */\nexport async function loadWasmBinary(\n relativePath: string\n): Promise<ArrayBuffer> {\n try {\n // Strategy 1: Try Node.js fs first (most reliable)\n if (typeof process !== 'undefined' && process.versions?.node) {\n const fsModule = await import(/* @vite-ignore */ 'fs/promises');\n const fileUrl = new URL(relativePath, import.meta.url);\n const filePath = fileUrl.pathname;\n const buffer = await fsModule.readFile(filePath);\n return buffer.buffer.slice(\n buffer.byteOffset,\n buffer.byteOffset + buffer.byteLength\n );\n }\n } catch (e) {\n // Fall through to fetch strategy\n }\n\n // Strategy 2: Fallback to fetch (works in browsers and workers)\n try {\n const url = new URL(/* @vite-ignore */ relativePath, import.meta.url);\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(\n `Failed to fetch WASM binary: ${response.status} ${response.statusText}`\n );\n }\n return await response.arrayBuffer();\n } catch (error) {\n throw new Error(\n `Failed to load WASM binary from \"${relativePath}\": ${error instanceof Error ? error.message : String(error)}`\n );\n }\n}\n\n/**\n * Load WASM JavaScript module with fallback strategies\n *\n * Strategy 1: Static relative import (works everywhere)\n * Strategy 2: import.meta.resolve (Node.js 22+)\n * Strategy 3: URL-based import (browsers/workers)\n */\nexport async function loadWasmModule(\n modulePath: string\n): Promise<WebAssembly.Module> {\n // Strategy 1: Try direct static import\n try {\n return await import(/* @vite-ignore */ modulePath);\n } catch (e1) {\n // Continue to next strategy\n }\n\n // Strategy 2: Try import.meta.resolve (Node.js 22+)\n try {\n const resolvedPath = await import.meta.resolve(modulePath);\n return await import(/* @vite-ignore */ resolvedPath);\n } catch (e2) {\n // Continue to next strategy\n }\n\n // Strategy 3: Try URL-based import\n try {\n const url = new URL(/* @vite-ignore */ modulePath, import.meta.url);\n return await import(/* @vite-ignore */ url.href);\n } catch (e3) {\n throw new Error(\n `Failed to load WASM module from \"${modulePath}\". ` +\n `Ensure WASM files are in the expected location and the module can be resolved.`\n );\n }\n}\n",
|
|
6
6
|
"\nlet wasm;\n\nlet cachegetUint8Memory0 = null;\nfunction getUint8Memory0() {\n if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {\n cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachegetUint8Memory0;\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nfunction passArray8ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 1);\n getUint8Memory0().set(arg, ptr / 1);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nlet cachegetInt32Memory0 = null;\nfunction getInt32Memory0() {\n if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {\n cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);\n }\n return cachegetInt32Memory0;\n}\n\nlet cachegetUint8ClampedMemory0 = null;\nfunction getUint8ClampedMemory0() {\n if (cachegetUint8ClampedMemory0 === null || cachegetUint8ClampedMemory0.buffer !== wasm.memory.buffer) {\n cachegetUint8ClampedMemory0 = new Uint8ClampedArray(wasm.memory.buffer);\n }\n return cachegetUint8ClampedMemory0;\n}\n\nfunction getClampedArrayU8FromWasm0(ptr, len) {\n return getUint8ClampedMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n/**\n* @param {Uint8Array} input_image\n* @param {number} input_width\n* @param {number} input_height\n* @param {number} output_width\n* @param {number} output_height\n* @param {number} typ_idx\n* @param {boolean} premultiply\n* @param {boolean} color_space_conversion\n* @returns {Uint8ClampedArray}\n*/\nexport function resize(input_image, input_width, input_height, output_width, output_height, typ_idx, premultiply, color_space_conversion) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n var ptr0 = passArray8ToWasm0(input_image, wasm.__wbindgen_malloc);\n var len0 = WASM_VECTOR_LEN;\n wasm.resize(retptr, ptr0, len0, input_width, input_height, output_width, output_height, typ_idx, premultiply, color_space_conversion);\n var r0 = getInt32Memory0()[retptr / 4 + 0];\n var r1 = getInt32Memory0()[retptr / 4 + 1];\n var v1 = getClampedArrayU8FromWasm0(r0, r1).slice();\n wasm.__wbindgen_free(r0, r1 * 1);\n return v1;\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\n\nasync function load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nasync function init(input) {\n if (typeof input === 'undefined') {\n input = new URL('squoosh_resize_bg.wasm', import.meta.url);\n }\n const imports = {};\n\n\n if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {\n input = fetch(input);\n }\n\n\n\n const { instance, module } = await load(await input, imports);\n\n wasm = instance.exports;\n init.__wbindgen_wasm_module = module;\n\n return wasm;\n}\n\nexport default init;\n\n",
|
|
7
|
-
"/**\n * Resize processor - single-source worker/client implementation\n */\n\nimport {\n type WorkerRequest,\n type WorkerResponse,\n type ImageInput,\n loadWasmBinary,\n validateImageInput,\n validateResizeOptions,\n} from '@squoosh-kit/runtime';\nimport type { ResizeOptions } from './types';\nimport * as squoosh_resize_module from '../wasm/squoosh_resize';\n\n// Define the type locally to avoid module resolution issues with the linter\ntype SquooshWasmResize = (\n input_image: Uint8Array,\n input_width: number,\n input_height: number,\n output_width: number,\n output_height: number,\n typ_idx: number,\n premultiply: boolean,\n color_space_conversion: boolean\n) => Uint8ClampedArray;\n\nlet wasmResize: SquooshWasmResize | null = null;\nlet initPromise: Promise<void> | null = null;\n\nasync function init(): Promise<void> {\n if (wasmResize) {\n return;\n }\n\n if (initPromise) {\n return initPromise;\n }\n\n initPromise = (async () => {\n try {\n // Load WASM binary with robust fallback strategies\n // Try multiple paths to support both development (../wasm) and npm installed (./wasm) scenarios\n let wasmBuffer: ArrayBuffer | null = null;\n const pathsToTry = [\n new URL(\n /* @vite-ignore */ './wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n new URL(\n /* @vite-ignore */ '../wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n ];\n\n let lastError: Error | null = null;\n for (const path of pathsToTry) {\n try {\n wasmBuffer = await loadWasmBinary(path);\n break;\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(String(error));\n // Continue to next path\n }\n }\n\n if (!wasmBuffer) {\n throw (\n lastError || new Error('Could not load WASM binary from any path')\n );\n }\n\n // Initialize WASM module with the binary buffer\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (initError: unknown) {\n // If initialization fails due to SharedArrayBuffer issues, try with polyfill\n if (\n initError instanceof Error &&\n (initError.message.includes('SharedArrayBuffer') ||\n initError.message.includes('first argument must be'))\n ) {\n // Apply polyfill and retry\n if (typeof SharedArrayBuffer === 'undefined') {\n (\n globalThis as unknown as Record<string, typeof ArrayBuffer>\n ).SharedArrayBuffer = ArrayBuffer;\n }\n // Reload the module with polyfill in place\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (retryError) {\n throw new Error(\n `WASM module initialization failed even with polyfill: ${retryError instanceof Error ? retryError.message : String(retryError)}`\n );\n }\n } else {\n throw initError;\n }\n }\n // After initialization, the module's exported resize function is ready to use\n wasmResize = squoosh_resize_module.resize as unknown as SquooshWasmResize;\n } catch (error) {\n initPromise = null;\n throw new Error(\n `Failed to initialize resize WASM module: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n })();\n\n return initPromise;\n}\n\nasync function _resizeCore(\n image: ImageInput,\n options: ResizeOptions\n): Promise<ImageInput> {\n validateImageInput(image);\n validateResizeOptions(options);\n\n await init();\n if (!wasmResize) {\n throw new Error('Resize module not initialized');\n }\n\n const { data, width: inputWidth, height: inputHeight } = image;\n\n let outputWidth = options.width ?? inputWidth;\n let outputHeight = options.height ?? inputHeight;\n\n if (options.width && !options.height) {\n outputHeight = Math.max(\n 1,\n Math.round((inputHeight * options.width) / inputWidth)\n );\n } else if (options.height && !options.width) {\n outputWidth = Math.max(\n 1,\n Math.round((inputWidth * options.height) / inputHeight)\n );\n }\n\n if (outputWidth < 1 || outputHeight < 1) {\n throw new RangeError(\n `Output dimensions must be at least 1x1, got ${outputWidth}x${outputHeight}`\n );\n }\n\n // Create a zero-copy Uint8Array view if needed\n // (don't copy the buffer - just create a view on the same memory)\n const dataArray =\n data instanceof Uint8ClampedArray\n ? new Uint8Array(data.buffer as ArrayBuffer, data.byteOffset, data.length)\n : new Uint8Array(\n data.buffer as ArrayBuffer,\n data.byteOffset,\n data.length\n );\n\n const result = wasmResize(\n dataArray,\n inputWidth,\n inputHeight,\n outputWidth,\n outputHeight,\n getResizeMethod(options),\n options.premultiply ?? true,\n options.linearRGB ?? true\n );\n\n return {\n data: result,\n width: outputWidth,\n height: outputHeight,\n };\n}\n\nexport async function resizeClient(\n image: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n): Promise<ImageInput> {\n if (signal?.aborted) {\n throw new DOMException('Aborted', 'AbortError');\n }\n return _resizeCore(image, options);\n}\n\n/**\n * Map ResizeOptions method to WASM typ_idx parameter\n * typ_idx values (from Squoosh):\n * 0: Triangular - fastest, lowest quality\n * 1: Catrom - medium quality and speed\n * 2: Mitchell - good balance (default)\n * 3: Lanczos3 - highest quality, slowest\n */\nfunction getResizeMethod(options?: ResizeOptions): number {\n const methodMap: Record<string, number> = {\n triangular: 0,\n catrom: 1,\n mitchell: 2,\n lanczos3: 3,\n };\n return methodMap[options?.method ?? 'lanczos3'] ?? 3;\n}\n\n/**\n * Worker message handler\n */\nif (typeof self !== 'undefined') {\n self.onmessage = async (event: MessageEvent) => {\n const data = event.data;\n\n // Handle worker ping for initialization\n if (data?.type === 'worker:ping') {\n self.postMessage({ type: 'worker:ready' });\n return;\n }\n\n const { id, type, payload } = data as WorkerRequest<{\n image: ImageInput;\n options: ResizeOptions;\n }>;\n\n const response: WorkerResponse<ImageInput> = { id, ok: false };\n\n try {\n if (type !== 'resize:run') {\n throw new Error(`Unknown message type: ${type}`);\n }\n\n const resultImage = await _resizeCore(payload.image, payload.options);\n\n response.ok = true;\n response.data = resultImage;\n\n
|
|
7
|
+
"/**\n * Resize processor - single-source worker/client implementation\n */\n\nimport {\n type WorkerRequest,\n type WorkerResponse,\n type ImageInput,\n loadWasmBinary,\n validateImageInput,\n validateResizeOptions,\n} from '@squoosh-kit/runtime';\nimport type { ResizeOptions } from './types';\nimport * as squoosh_resize_module from '../wasm/squoosh_resize';\n\n// Define the type locally to avoid module resolution issues with the linter\ntype SquooshWasmResize = (\n input_image: Uint8Array,\n input_width: number,\n input_height: number,\n output_width: number,\n output_height: number,\n typ_idx: number,\n premultiply: boolean,\n color_space_conversion: boolean\n) => Uint8ClampedArray;\n\nlet wasmResize: SquooshWasmResize | null = null;\nlet initPromise: Promise<void> | null = null;\n\nasync function init(): Promise<void> {\n if (wasmResize) {\n return;\n }\n\n if (initPromise) {\n return initPromise;\n }\n\n initPromise = (async () => {\n try {\n // Load WASM binary with robust fallback strategies\n // Try multiple paths to support both development (../wasm) and npm installed (./wasm) scenarios\n let wasmBuffer: ArrayBuffer | null = null;\n const pathsToTry = [\n new URL(\n /* @vite-ignore */ './wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n new URL(\n /* @vite-ignore */ '../wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n ];\n\n let lastError: Error | null = null;\n for (const path of pathsToTry) {\n try {\n wasmBuffer = await loadWasmBinary(path);\n break;\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(String(error));\n // Continue to next path\n }\n }\n\n if (!wasmBuffer) {\n throw (\n lastError || new Error('Could not load WASM binary from any path')\n );\n }\n\n // Initialize WASM module with the binary buffer\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (initError: unknown) {\n // If initialization fails due to SharedArrayBuffer issues, try with polyfill\n if (\n initError instanceof Error &&\n (initError.message.includes('SharedArrayBuffer') ||\n initError.message.includes('first argument must be'))\n ) {\n // Apply polyfill and retry\n if (typeof SharedArrayBuffer === 'undefined') {\n (\n globalThis as unknown as Record<string, typeof ArrayBuffer>\n ).SharedArrayBuffer = ArrayBuffer;\n }\n // Reload the module with polyfill in place\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (retryError) {\n throw new Error(\n `WASM module initialization failed even with polyfill: ${retryError instanceof Error ? retryError.message : String(retryError)}`\n );\n }\n } else {\n throw initError;\n }\n }\n // After initialization, the module's exported resize function is ready to use\n wasmResize = squoosh_resize_module.resize as unknown as SquooshWasmResize;\n } catch (error) {\n initPromise = null;\n throw new Error(\n `Failed to initialize resize WASM module: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n })();\n\n return initPromise;\n}\n\nasync function _resizeCore(\n image: ImageInput,\n options: ResizeOptions\n): Promise<ImageInput> {\n validateImageInput(image);\n validateResizeOptions(options);\n\n await init();\n if (!wasmResize) {\n throw new Error('Resize module not initialized');\n }\n\n const { data, width: inputWidth, height: inputHeight } = image;\n\n let outputWidth = options.width ?? inputWidth;\n let outputHeight = options.height ?? inputHeight;\n\n if (options.width && !options.height) {\n outputHeight = Math.max(\n 1,\n Math.round((inputHeight * options.width) / inputWidth)\n );\n } else if (options.height && !options.width) {\n outputWidth = Math.max(\n 1,\n Math.round((inputWidth * options.height) / inputHeight)\n );\n }\n\n if (outputWidth < 1 || outputHeight < 1) {\n throw new RangeError(\n `Output dimensions must be at least 1x1, got ${outputWidth}x${outputHeight}`\n );\n }\n\n // Create a zero-copy Uint8Array view if needed\n // (don't copy the buffer - just create a view on the same memory)\n const dataArray =\n data instanceof Uint8ClampedArray\n ? new Uint8Array(data.buffer as ArrayBuffer, data.byteOffset, data.length)\n : new Uint8Array(\n data.buffer as ArrayBuffer,\n data.byteOffset,\n data.length\n );\n\n const result = wasmResize(\n dataArray,\n inputWidth,\n inputHeight,\n outputWidth,\n outputHeight,\n getResizeMethod(options),\n options.premultiply ?? true,\n options.linearRGB ?? true\n );\n\n return {\n data: result,\n width: outputWidth,\n height: outputHeight,\n };\n}\n\nexport async function resizeClient(\n image: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n): Promise<ImageInput> {\n if (signal?.aborted) {\n throw new DOMException('Aborted', 'AbortError');\n }\n return _resizeCore(image, options);\n}\n\n/**\n * Map ResizeOptions method to WASM typ_idx parameter\n * typ_idx values (from Squoosh):\n * 0: Triangular - fastest, lowest quality\n * 1: Catrom - medium quality and speed\n * 2: Mitchell - good balance (default)\n * 3: Lanczos3 - highest quality, slowest\n */\nfunction getResizeMethod(options?: ResizeOptions): number {\n const methodMap: Record<string, number> = {\n triangular: 0,\n catrom: 1,\n mitchell: 2,\n lanczos3: 3,\n };\n return methodMap[options?.method ?? 'lanczos3'] ?? 3;\n}\n\n/**\n * Worker message handler\n */\nif (typeof self !== 'undefined') {\n self.onmessage = async (event: MessageEvent) => {\n const data = event.data;\n\n // Handle worker ping for initialization\n if (data?.type === 'worker:ping') {\n self.postMessage({ type: 'worker:ready' });\n return;\n }\n\n const { id, type, payload } = data as WorkerRequest<{\n image: ImageInput;\n options: ResizeOptions;\n }>;\n\n const response: WorkerResponse<ImageInput> = { id, ok: false };\n\n try {\n if (type !== 'resize:run') {\n throw new Error(`Unknown message type: ${type}`);\n }\n\n const resultImage = await _resizeCore(payload.image, payload.options);\n\n response.ok = true;\n response.data = resultImage;\n\n // Post the response without transferring - the ImageInput with data will be cloned\n // Transfer is only used for incoming requests (image.data buffer from client)\n self.postMessage(response);\n } catch (error) {\n response.error = error instanceof Error ? error.message : String(error);\n self.postMessage(response);\n }\n };\n}\n"
|
|
8
8
|
],
|
|
9
|
-
"mappings": "uDAQA,eAAsB,CAAc,CAClC,EACsB,CACtB,GAAI,CAEF,GAAI,OAAO,QAAY,KAAe,QAAQ,UAAU,KAAM,CAC5D,IAAM,EAAW,KAAgC,uBAE3C,EADU,IAAI,IAAI,EAA0B,2EAAG,EAC5B,SACnB,EAAS,MAAM,EAAS,SAAS,CAAQ,EAC/C,OAAO,EAAO,OAAO,MACnB,EAAO,WACP,EAAO,WAAa,EAAO,UAC7B,GAEF,MAAO,EAAG,EAKZ,GAAI,CACF,IAAM,EAAM,IAAI,IAAuB,EAA0B,2EAAG,EAC9D,EAAW,MAAM,MAAM,CAAG,EAChC,GAAI,CAAC,EAAS,GACZ,MAAU,MACR,gCAAgC,EAAS,UAAU,EAAS,YAC9D,EAEF,OAAO,MAAM,EAAS,YAAY,EAClC,MAAO,EAAO,CACd,MAAU,MACR,oCAAoC,OAAkB,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,GAC7G,GCvCJ,IAAI,EAEA,EAAuB,KAC3B,SAAS,CAAe,EAAG,CACvB,GAAI,IAAyB,MAAQ,EAAqB,SAAW,EAAK,OAAO,OAC7E,EAAuB,IAAI,WAAW,EAAK,OAAO,MAAM,EAE5D,OAAO,EAGX,IAAI,EAAkB,EAEtB,SAAS,CAAiB,CAAC,EAAK,EAAQ,CACpC,IAAM,EAAM,EAAO,EAAI,OAAS,CAAC,EAGjC,OAFA,EAAgB,EAAE,IAAI,EAAK,EAAM,CAAC,EAClC,EAAkB,EAAI,OACf,EAGX,IAAI,EAAuB,KAC3B,SAAS,CAAe,EAAG,CACvB,GAAI,IAAyB,MAAQ,EAAqB,SAAW,EAAK,OAAO,OAC7E,EAAuB,IAAI,WAAW,EAAK,OAAO,MAAM,EAE5D,OAAO,EAGX,IAAI,EAA8B,KAClC,SA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M,OAAS,cAAe,CAChC,KAAK,YAAY,CAAE,KAAM,cAAe,CAAC,EACzC,OAGF,IAAQ,KAAI,OAAM,WAAY,EAKxB,EAAuC,CAAE,KAAI,GAAI,EAAM,EAE7D,GAAI,CACF,GAAI,IAAS,aACX,MAAU,MAAM,yBAAyB,GAAM,EAGjD,IAAM,EAAc,MAAM,EAAY,EAAQ,MAAO,EAAQ,OAAO,EAEpE,EAAS,GAAK,GACd,EAAS,KAAO,EAIhB,KAAK,YAAY,CAAQ,EACzB,MAAO,EAAO,CACd,EAAS,MAAQ,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,EACtE,KAAK,YAAY,CAAQ",
|
|
10
|
+
"debugId": "31A4676B06F1B0D864756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as U,c as W,e as I,f as R}from"./chunk-atxx2y4c.js";async function B(j){try{if(typeof process<"u"&&process.versions?.node){let D=await import("fs/promises"),J=new URL(j,import.meta.url).pathname,K=await D.readFile(J);return K.buffer.slice(K.byteOffset,K.byteOffset+K.byteLength)}}catch(D){}try{let D=new URL(j,import.meta.url),G=await fetch(D);if(!G.ok)throw Error(`Failed to fetch WASM binary: ${G.status} ${G.statusText}`);return await G.arrayBuffer()}catch(D){throw Error(`Failed to load WASM binary from "${j}": ${D instanceof Error?D.message:String(D)}`)}}var Y,$=null;function v(){if($===null||$.buffer!==Y.memory.buffer)$=new Uint8Array(Y.memory.buffer);return $}var T=0;function M(j,D){let G=D(j.length*1);return v().set(j,G/1),T=j.length,G}var k=null;function A(){if(k===null||k.buffer!==Y.memory.buffer)k=new Int32Array(Y.memory.buffer);return k}var F=null;function P(){if(F===null||F.buffer!==Y.memory.buffer)F=new Uint8ClampedArray(Y.memory.buffer);return F}function f(j,D){return P().subarray(j/1,j/1+D)}function z(j,D,G,J,K,Q,X,V){try{let q=Y.__wbindgen_add_to_stack_pointer(-16);var L=M(j,Y.__wbindgen_malloc),E=T;Y.resize(q,L,E,D,G,J,K,Q,X,V);var O=A()[q/4+0],S=A()[q/4+1],b=f(O,S).slice();return Y.__wbindgen_free(O,S*1),b}finally{Y.__wbindgen_add_to_stack_pointer(16)}}async function w(j,D){if(typeof Response==="function"&&j instanceof Response){if(typeof WebAssembly.instantiateStreaming==="function")try{return await WebAssembly.instantiateStreaming(j,D)}catch(J){if(j.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",J);else throw J}let G=await j.arrayBuffer();return await WebAssembly.instantiate(G,D)}else{let G=await WebAssembly.instantiate(j,D);if(G instanceof WebAssembly.Instance)return{instance:G,module:j};else return G}}async function H(j){if(typeof j>"u")j=new URL("squoosh_resize_bg.wasm",import.meta.url);let D={};if(typeof j==="string"||typeof Request==="function"&&j instanceof Request||typeof URL==="function"&&j instanceof URL)j=fetch(j);let{instance:G,module:J}=await w(await j,D);return Y=G.exports,H.__wbindgen_wasm_module=J,Y}var x=H;var N=null,Z=null;async function y(){if(N)return;if(Z)return Z;return Z=(async()=>{try{let j=null,D=[new URL("./wasm/squoosh_resize_bg.wasm",import.meta.url).href,new URL("../wasm/squoosh_resize_bg.wasm",import.meta.url).href],G=null;for(let J of D)try{j=await B(J);break}catch(K){G=K instanceof Error?K:Error(String(K))}if(!j)throw G||Error("Could not load WASM binary from any path");try{await x(j)}catch(J){if(J instanceof Error&&(J.message.includes("SharedArrayBuffer")||J.message.includes("first argument must be"))){if(typeof SharedArrayBuffer>"u")globalThis.SharedArrayBuffer=ArrayBuffer;try{await x(j)}catch(K){throw Error(`WASM module initialization failed even with polyfill: ${K instanceof Error?K.message:String(K)}`)}}else throw J}N=z}catch(j){throw Z=null,Error(`Failed to initialize resize WASM module: ${j instanceof Error?j.message:String(j)}`)}})(),Z}async function C(j,D){if(I(j),R(D),await y(),!N)throw Error("Resize module not initialized");let{data:G,width:J,height:K}=j,Q=D.width??J,X=D.height??K;if(D.width&&!D.height)X=Math.max(1,Math.round(K*D.width/J));else if(D.height&&!D.width)Q=Math.max(1,Math.round(J*D.height/K));if(Q<1||X<1)throw RangeError(`Output dimensions must be at least 1x1, got ${Q}x${X}`);let V=G instanceof Uint8ClampedArray?new Uint8Array(G.buffer,G.byteOffset,G.length):new Uint8Array(G.buffer,G.byteOffset,G.length);return{data:N(V,J,K,Q,X,c(D),D.premultiply??!0,D.linearRGB??!0),width:Q,height:X}}async function h(j,D,G){if(G?.aborted)throw new DOMException("Aborted","AbortError");return C(j,D)}function c(j){return{triangular:0,catrom:1,mitchell:2,lanczos3:3}[j?.method??"lanczos3"]??3}if(typeof self<"u")self.onmessage=async(j)=>{let D=j.data;if(D?.type==="worker:ping"){self.postMessage({type:"worker:ready"});return}let{id:G,type:J,payload:K}=D,Q={id:G,ok:!1};try{if(J!=="resize:run")throw Error(`Unknown message type: ${J}`);let X=await C(K.image,K.options);Q.ok=!0,Q.data=X,self.postMessage(Q)}catch(X){Q.error=X instanceof Error?X.message:String(X),self.postMessage(Q)}};export{h as resizeClient};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=A0FEBC2293DA9E7564756E2164756E21
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"/**\n * Load WASM binary from various sources with fallback strategies\n *\n * Supports:\n * - Node.js (fs/promises)\n * - Browsers (fetch)\n * - Workers (fetch)\n */\nexport async function loadWasmBinary(\n relativePath: string\n): Promise<ArrayBuffer> {\n try {\n // Strategy 1: Try Node.js fs first (most reliable)\n if (typeof process !== 'undefined' && process.versions?.node) {\n const fsModule = await import(/* @vite-ignore */ 'fs/promises');\n const fileUrl = new URL(relativePath, import.meta.url);\n const filePath = fileUrl.pathname;\n const buffer = await fsModule.readFile(filePath);\n return buffer.buffer.slice(\n buffer.byteOffset,\n buffer.byteOffset + buffer.byteLength\n );\n }\n } catch (e) {\n // Fall through to fetch strategy\n }\n\n // Strategy 2: Fallback to fetch (works in browsers and workers)\n try {\n const url = new URL(/* @vite-ignore */ relativePath, import.meta.url);\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(\n `Failed to fetch WASM binary: ${response.status} ${response.statusText}`\n );\n }\n return await response.arrayBuffer();\n } catch (error) {\n throw new Error(\n `Failed to load WASM binary from \"${relativePath}\": ${error instanceof Error ? error.message : String(error)}`\n );\n }\n}\n\n/**\n * Load WASM JavaScript module with fallback strategies\n *\n * Strategy 1: Static relative import (works everywhere)\n * Strategy 2: import.meta.resolve (Node.js 22+)\n * Strategy 3: URL-based import (browsers/workers)\n */\nexport async function loadWasmModule(\n modulePath: string\n): Promise<WebAssembly.Module> {\n // Strategy 1: Try direct static import\n try {\n return await import(/* @vite-ignore */ modulePath);\n } catch (e1) {\n // Continue to next strategy\n }\n\n // Strategy 2: Try import.meta.resolve (Node.js 22+)\n try {\n const resolvedPath = await import.meta.resolve(modulePath);\n return await import(/* @vite-ignore */ resolvedPath);\n } catch (e2) {\n // Continue to next strategy\n }\n\n // Strategy 3: Try URL-based import\n try {\n const url = new URL(/* @vite-ignore */ modulePath, import.meta.url);\n return await import(/* @vite-ignore */ url.href);\n } catch (e3) {\n throw new Error(\n `Failed to load WASM module from \"${modulePath}\". ` +\n `Ensure WASM files are in the expected location and the module can be resolved.`\n );\n }\n}\n",
|
|
6
6
|
"\nlet wasm;\n\nlet cachegetUint8Memory0 = null;\nfunction getUint8Memory0() {\n if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {\n cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachegetUint8Memory0;\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nfunction passArray8ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 1);\n getUint8Memory0().set(arg, ptr / 1);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nlet cachegetInt32Memory0 = null;\nfunction getInt32Memory0() {\n if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {\n cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);\n }\n return cachegetInt32Memory0;\n}\n\nlet cachegetUint8ClampedMemory0 = null;\nfunction getUint8ClampedMemory0() {\n if (cachegetUint8ClampedMemory0 === null || cachegetUint8ClampedMemory0.buffer !== wasm.memory.buffer) {\n cachegetUint8ClampedMemory0 = new Uint8ClampedArray(wasm.memory.buffer);\n }\n return cachegetUint8ClampedMemory0;\n}\n\nfunction getClampedArrayU8FromWasm0(ptr, len) {\n return getUint8ClampedMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n/**\n* @param {Uint8Array} input_image\n* @param {number} input_width\n* @param {number} input_height\n* @param {number} output_width\n* @param {number} output_height\n* @param {number} typ_idx\n* @param {boolean} premultiply\n* @param {boolean} color_space_conversion\n* @returns {Uint8ClampedArray}\n*/\nexport function resize(input_image, input_width, input_height, output_width, output_height, typ_idx, premultiply, color_space_conversion) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n var ptr0 = passArray8ToWasm0(input_image, wasm.__wbindgen_malloc);\n var len0 = WASM_VECTOR_LEN;\n wasm.resize(retptr, ptr0, len0, input_width, input_height, output_width, output_height, typ_idx, premultiply, color_space_conversion);\n var r0 = getInt32Memory0()[retptr / 4 + 0];\n var r1 = getInt32Memory0()[retptr / 4 + 1];\n var v1 = getClampedArrayU8FromWasm0(r0, r1).slice();\n wasm.__wbindgen_free(r0, r1 * 1);\n return v1;\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\n\nasync function load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nasync function init(input) {\n if (typeof input === 'undefined') {\n input = new URL('squoosh_resize_bg.wasm', import.meta.url);\n }\n const imports = {};\n\n\n if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {\n input = fetch(input);\n }\n\n\n\n const { instance, module } = await load(await input, imports);\n\n wasm = instance.exports;\n init.__wbindgen_wasm_module = module;\n\n return wasm;\n}\n\nexport default init;\n\n",
|
|
7
|
-
"/**\n * Resize processor - single-source worker/client implementation\n */\n\nimport {\n type WorkerRequest,\n type WorkerResponse,\n type ImageInput,\n loadWasmBinary,\n validateImageInput,\n validateResizeOptions,\n} from '@squoosh-kit/runtime';\nimport type { ResizeOptions } from './types';\nimport * as squoosh_resize_module from '../wasm/squoosh_resize';\n\n// Define the type locally to avoid module resolution issues with the linter\ntype SquooshWasmResize = (\n input_image: Uint8Array,\n input_width: number,\n input_height: number,\n output_width: number,\n output_height: number,\n typ_idx: number,\n premultiply: boolean,\n color_space_conversion: boolean\n) => Uint8ClampedArray;\n\nlet wasmResize: SquooshWasmResize | null = null;\nlet initPromise: Promise<void> | null = null;\n\nasync function init(): Promise<void> {\n if (wasmResize) {\n return;\n }\n\n if (initPromise) {\n return initPromise;\n }\n\n initPromise = (async () => {\n try {\n // Load WASM binary with robust fallback strategies\n // Try multiple paths to support both development (../wasm) and npm installed (./wasm) scenarios\n let wasmBuffer: ArrayBuffer | null = null;\n const pathsToTry = [\n new URL(\n /* @vite-ignore */ './wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n new URL(\n /* @vite-ignore */ '../wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n ];\n\n let lastError: Error | null = null;\n for (const path of pathsToTry) {\n try {\n wasmBuffer = await loadWasmBinary(path);\n break;\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(String(error));\n // Continue to next path\n }\n }\n\n if (!wasmBuffer) {\n throw (\n lastError || new Error('Could not load WASM binary from any path')\n );\n }\n\n // Initialize WASM module with the binary buffer\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (initError: unknown) {\n // If initialization fails due to SharedArrayBuffer issues, try with polyfill\n if (\n initError instanceof Error &&\n (initError.message.includes('SharedArrayBuffer') ||\n initError.message.includes('first argument must be'))\n ) {\n // Apply polyfill and retry\n if (typeof SharedArrayBuffer === 'undefined') {\n (\n globalThis as unknown as Record<string, typeof ArrayBuffer>\n ).SharedArrayBuffer = ArrayBuffer;\n }\n // Reload the module with polyfill in place\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (retryError) {\n throw new Error(\n `WASM module initialization failed even with polyfill: ${retryError instanceof Error ? retryError.message : String(retryError)}`\n );\n }\n } else {\n throw initError;\n }\n }\n // After initialization, the module's exported resize function is ready to use\n wasmResize = squoosh_resize_module.resize as unknown as SquooshWasmResize;\n } catch (error) {\n initPromise = null;\n throw new Error(\n `Failed to initialize resize WASM module: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n })();\n\n return initPromise;\n}\n\nasync function _resizeCore(\n image: ImageInput,\n options: ResizeOptions\n): Promise<ImageInput> {\n validateImageInput(image);\n validateResizeOptions(options);\n\n await init();\n if (!wasmResize) {\n throw new Error('Resize module not initialized');\n }\n\n const { data, width: inputWidth, height: inputHeight } = image;\n\n let outputWidth = options.width ?? inputWidth;\n let outputHeight = options.height ?? inputHeight;\n\n if (options.width && !options.height) {\n outputHeight = Math.max(\n 1,\n Math.round((inputHeight * options.width) / inputWidth)\n );\n } else if (options.height && !options.width) {\n outputWidth = Math.max(\n 1,\n Math.round((inputWidth * options.height) / inputHeight)\n );\n }\n\n if (outputWidth < 1 || outputHeight < 1) {\n throw new RangeError(\n `Output dimensions must be at least 1x1, got ${outputWidth}x${outputHeight}`\n );\n }\n\n // Create a zero-copy Uint8Array view if needed\n // (don't copy the buffer - just create a view on the same memory)\n const dataArray =\n data instanceof Uint8ClampedArray\n ? new Uint8Array(data.buffer as ArrayBuffer, data.byteOffset, data.length)\n : new Uint8Array(\n data.buffer as ArrayBuffer,\n data.byteOffset,\n data.length\n );\n\n const result = wasmResize(\n dataArray,\n inputWidth,\n inputHeight,\n outputWidth,\n outputHeight,\n getResizeMethod(options),\n options.premultiply ?? true,\n options.linearRGB ?? true\n );\n\n return {\n data: result,\n width: outputWidth,\n height: outputHeight,\n };\n}\n\nexport async function resizeClient(\n image: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n): Promise<ImageInput> {\n if (signal?.aborted) {\n throw new DOMException('Aborted', 'AbortError');\n }\n return _resizeCore(image, options);\n}\n\n/**\n * Map ResizeOptions method to WASM typ_idx parameter\n * typ_idx values (from Squoosh):\n * 0: Triangular - fastest, lowest quality\n * 1: Catrom - medium quality and speed\n * 2: Mitchell - good balance (default)\n * 3: Lanczos3 - highest quality, slowest\n */\nfunction getResizeMethod(options?: ResizeOptions): number {\n const methodMap: Record<string, number> = {\n triangular: 0,\n catrom: 1,\n mitchell: 2,\n lanczos3: 3,\n };\n return methodMap[options?.method ?? 'lanczos3'] ?? 3;\n}\n\n/**\n * Worker message handler\n */\nif (typeof self !== 'undefined') {\n self.onmessage = async (event: MessageEvent) => {\n const data = event.data;\n\n // Handle worker ping for initialization\n if (data?.type === 'worker:ping') {\n self.postMessage({ type: 'worker:ready' });\n return;\n }\n\n const { id, type, payload } = data as WorkerRequest<{\n image: ImageInput;\n options: ResizeOptions;\n }>;\n\n const response: WorkerResponse<ImageInput> = { id, ok: false };\n\n try {\n if (type !== 'resize:run') {\n throw new Error(`Unknown message type: ${type}`);\n }\n\n const resultImage = await _resizeCore(payload.image, payload.options);\n\n response.ok = true;\n response.data = resultImage;\n\n
|
|
7
|
+
"/**\n * Resize processor - single-source worker/client implementation\n */\n\nimport {\n type WorkerRequest,\n type WorkerResponse,\n type ImageInput,\n loadWasmBinary,\n validateImageInput,\n validateResizeOptions,\n} from '@squoosh-kit/runtime';\nimport type { ResizeOptions } from './types';\nimport * as squoosh_resize_module from '../wasm/squoosh_resize';\n\n// Define the type locally to avoid module resolution issues with the linter\ntype SquooshWasmResize = (\n input_image: Uint8Array,\n input_width: number,\n input_height: number,\n output_width: number,\n output_height: number,\n typ_idx: number,\n premultiply: boolean,\n color_space_conversion: boolean\n) => Uint8ClampedArray;\n\nlet wasmResize: SquooshWasmResize | null = null;\nlet initPromise: Promise<void> | null = null;\n\nasync function init(): Promise<void> {\n if (wasmResize) {\n return;\n }\n\n if (initPromise) {\n return initPromise;\n }\n\n initPromise = (async () => {\n try {\n // Load WASM binary with robust fallback strategies\n // Try multiple paths to support both development (../wasm) and npm installed (./wasm) scenarios\n let wasmBuffer: ArrayBuffer | null = null;\n const pathsToTry = [\n new URL(\n /* @vite-ignore */ './wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n new URL(\n /* @vite-ignore */ '../wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n ];\n\n let lastError: Error | null = null;\n for (const path of pathsToTry) {\n try {\n wasmBuffer = await loadWasmBinary(path);\n break;\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(String(error));\n // Continue to next path\n }\n }\n\n if (!wasmBuffer) {\n throw (\n lastError || new Error('Could not load WASM binary from any path')\n );\n }\n\n // Initialize WASM module with the binary buffer\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (initError: unknown) {\n // If initialization fails due to SharedArrayBuffer issues, try with polyfill\n if (\n initError instanceof Error &&\n (initError.message.includes('SharedArrayBuffer') ||\n initError.message.includes('first argument must be'))\n ) {\n // Apply polyfill and retry\n if (typeof SharedArrayBuffer === 'undefined') {\n (\n globalThis as unknown as Record<string, typeof ArrayBuffer>\n ).SharedArrayBuffer = ArrayBuffer;\n }\n // Reload the module with polyfill in place\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (retryError) {\n throw new Error(\n `WASM module initialization failed even with polyfill: ${retryError instanceof Error ? retryError.message : String(retryError)}`\n );\n }\n } else {\n throw initError;\n }\n }\n // After initialization, the module's exported resize function is ready to use\n wasmResize = squoosh_resize_module.resize as unknown as SquooshWasmResize;\n } catch (error) {\n initPromise = null;\n throw new Error(\n `Failed to initialize resize WASM module: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n })();\n\n return initPromise;\n}\n\nasync function _resizeCore(\n image: ImageInput,\n options: ResizeOptions\n): Promise<ImageInput> {\n validateImageInput(image);\n validateResizeOptions(options);\n\n await init();\n if (!wasmResize) {\n throw new Error('Resize module not initialized');\n }\n\n const { data, width: inputWidth, height: inputHeight } = image;\n\n let outputWidth = options.width ?? inputWidth;\n let outputHeight = options.height ?? inputHeight;\n\n if (options.width && !options.height) {\n outputHeight = Math.max(\n 1,\n Math.round((inputHeight * options.width) / inputWidth)\n );\n } else if (options.height && !options.width) {\n outputWidth = Math.max(\n 1,\n Math.round((inputWidth * options.height) / inputHeight)\n );\n }\n\n if (outputWidth < 1 || outputHeight < 1) {\n throw new RangeError(\n `Output dimensions must be at least 1x1, got ${outputWidth}x${outputHeight}`\n );\n }\n\n // Create a zero-copy Uint8Array view if needed\n // (don't copy the buffer - just create a view on the same memory)\n const dataArray =\n data instanceof Uint8ClampedArray\n ? new Uint8Array(data.buffer as ArrayBuffer, data.byteOffset, data.length)\n : new Uint8Array(\n data.buffer as ArrayBuffer,\n data.byteOffset,\n data.length\n );\n\n const result = wasmResize(\n dataArray,\n inputWidth,\n inputHeight,\n outputWidth,\n outputHeight,\n getResizeMethod(options),\n options.premultiply ?? true,\n options.linearRGB ?? true\n );\n\n return {\n data: result,\n width: outputWidth,\n height: outputHeight,\n };\n}\n\nexport async function resizeClient(\n image: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n): Promise<ImageInput> {\n if (signal?.aborted) {\n throw new DOMException('Aborted', 'AbortError');\n }\n return _resizeCore(image, options);\n}\n\n/**\n * Map ResizeOptions method to WASM typ_idx parameter\n * typ_idx values (from Squoosh):\n * 0: Triangular - fastest, lowest quality\n * 1: Catrom - medium quality and speed\n * 2: Mitchell - good balance (default)\n * 3: Lanczos3 - highest quality, slowest\n */\nfunction getResizeMethod(options?: ResizeOptions): number {\n const methodMap: Record<string, number> = {\n triangular: 0,\n catrom: 1,\n mitchell: 2,\n lanczos3: 3,\n };\n return methodMap[options?.method ?? 'lanczos3'] ?? 3;\n}\n\n/**\n * Worker message handler\n */\nif (typeof self !== 'undefined') {\n self.onmessage = async (event: MessageEvent) => {\n const data = event.data;\n\n // Handle worker ping for initialization\n if (data?.type === 'worker:ping') {\n self.postMessage({ type: 'worker:ready' });\n return;\n }\n\n const { id, type, payload } = data as WorkerRequest<{\n image: ImageInput;\n options: ResizeOptions;\n }>;\n\n const response: WorkerResponse<ImageInput> = { id, ok: false };\n\n try {\n if (type !== 'resize:run') {\n throw new Error(`Unknown message type: ${type}`);\n }\n\n const resultImage = await _resizeCore(payload.image, payload.options);\n\n response.ok = true;\n response.data = resultImage;\n\n // Post the response without transferring - the ImageInput with data will be cloned\n // Transfer is only used for incoming requests (image.data buffer from client)\n self.postMessage(response);\n } catch (error) {\n response.error = error instanceof Error ? error.message : String(error);\n self.postMessage(response);\n }\n };\n}\n"
|
|
8
8
|
],
|
|
9
|
-
"mappings": "6DAQA,eAAsB,CAAc,CAClC,EACsB,CACtB,GAAI,CAEF,GAAI,OAAO,QAAY,KAAe,QAAQ,UAAU,KAAM,CAC5D,IAAM,EAAW,KAAgC,uBAE3C,EADU,IAAI,IAAI,EAAc,YAAY,GAAG,EAC5B,SACnB,EAAS,MAAM,EAAS,SAAS,CAAQ,EAC/C,OAAO,EAAO,OAAO,MACnB,EAAO,WACP,EAAO,WAAa,EAAO,UAC7B,GAEF,MAAO,EAAG,EAKZ,GAAI,CACF,IAAM,EAAM,IAA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