Files
dev/scripts/lib/dev-wasm-plugin.ts
zeekayandHanzo Dev 84a6666629 fix(web): Enso rows show the chosen effort; knip and typecheck follow main
The selected Enso row draws its ring at the active effort and the rail
ring sits clear of the selection bar. The dev wasm plugin allows Node
builtins like its sibling scripts, knip learns the embed entries, and
dead files and an unused dependency go.


Co-authored-by: Hanzo Dev <[email protected]>
2026-11-21 02:50:40 -08:00

21 lines
847 B
TypeScript

// @effect-diagnostics nodeBuiltinImport:off - A build-time plugin; synchronous Node APIs keep it small.
import * as NodeFS from "node:fs";
import * as NodePath from "node:path";
const repoRoot = NodePath.resolve(import.meta.dirname, "../..");
const sourceModule = NodePath.join(repoRoot, "apps/server/src/orchestration-v2/devWasmBytes.ts");
const wasmPath = NodePath.join(repoRoot, "go/dev.wasm");
/** Pack plugin: the bundle carries `dev.wasm` inline in place of `devWasmBytes.ts`. */
export const devWasmPlugin = {
name: "hanzodev:dev-wasm",
load(id: string) {
if (NodePath.resolve(id) !== sourceModule) return;
const base64 = NodeFS.readFileSync(wasmPath).toString("base64");
return {
code: `export const devWasmBytes = () => new Uint8Array(Buffer.from("${base64}", "base64"));`,
moduleType: "js",
};
},
};