// IFC single-thread WASM을 public/에 staging합니다. // `npm install`의 postinstall에서 자동 실행되며 반복 실행해도 같은 결과를 만듭니다. import { chmodSync, copyFileSync, existsSync, mkdirSync, rmSync, } from 'node:fs'; import { dirname, resolve } from 'node:path'; import { fileURLToPath } from 'node:url'; const __dirname = dirname(fileURLToPath(import.meta.url)); const root = resolve(__dirname, '..'); // 현재 IFC 경로는 COOP/COEP가 필요 없는 single-thread WASM만 사용합니다. const ifcEntry = fileURLToPath(import.meta.resolve('web-ifc')); const ifcSrcDir = dirname(ifcEntry); const ifcDest = resolve(root, 'public/web-ifc'); if (existsSync(ifcSrcDir)) { rmSync(ifcDest, { force: true, recursive: true }); mkdirSync(ifcDest, { recursive: true }); const src = resolve(ifcSrcDir, 'web-ifc.wasm'); const dest = resolve(ifcDest, 'web-ifc.wasm'); copyFileSync(src, dest); chmodSync(dest, 0o644); console.log(`[copy-decoders] ${src} -> ${dest}`); } else { console.warn('[copy-decoders] web-ifc not installed yet — skipping IFC wasm.'); }