feat: make node definitions type safe with zod

This commit is contained in:
2024-04-22 00:33:04 +02:00
parent 4c7c4cac2c
commit ad197db873
28 changed files with 221 additions and 147 deletions

View File

@@ -13,9 +13,7 @@ export async function getWasm(id: `${string}/${string}/${string}`) {
const file = await fs.readFile(filePath);
const bytes = new Uint8Array(file);
return bytes;
return new Uint8Array(file);
}
@@ -24,10 +22,7 @@ export async function getNodeWasm(id: `${string}/${string}/${string}`) {
const wasmBytes = await getWasm(id);
if (!wasmBytes) return null;
const wrapper = createWasmWrapper();
const module = new WebAssembly.Module(wasmBytes);
const instance = new WebAssembly.Instance(module, { ["./index_bg.js"]: wrapper });
wrapper.setInstance(instance)
const wrapper = createWasmWrapper(wasmBytes);
return wrapper;
}