// Copia los binarios fijados de ONNX Runtime Web a public/wasm (el Space los sirve; sin CDN de terceros). import { mkdirSync, copyFileSync, readFileSync } from 'node:fs'; import path from 'node:path'; const ortDir = new URL('../node_modules/onnxruntime-web/', import.meta.url).pathname; const ver = JSON.parse(readFileSync(path.join(ortDir, 'package.json'), 'utf8')).version; const out = new URL('../public/wasm/', import.meta.url).pathname; mkdirSync(out, { recursive: true }); // `onnxruntime-web/webgpu` (build extern-wasm) usa la variante asyncify (WebGPU + WASM/CPU). for (const f of ['ort-wasm-simd-threaded.asyncify.mjs', 'ort-wasm-simd-threaded.asyncify.wasm']) copyFileSync(path.join(ortDir, 'dist', f), path.join(out, f)); console.log(`copied onnxruntime-web@${ver} wasm -> public/wasm`);