// node-worker.mjs: the worker run-node.mjs starts for one module. It compiles the module, // decodes every case through sink.mjs in order, and posts each case's start and result; // run-node.mjs ends it from outside when a case passes the wall-clock limit. import { parentPort, workerData } from 'node:worker_threads'; import { decode } from './sink.mjs'; const { moduleBytes, cases } = workerData; const module = await WebAssembly.compile(moduleBytes); for (let i = 0; i < cases.length; i++) { const c = cases[i]; parentPort.postMessage({ start: i }); const r = await decode(module, c.cap, c.payload, c.set); parentPort.postMessage({ done: i, r }); } parentPort.postMessage({ end: true });