Skip to content

WASM Registry

@bolojs/wasm-registry ships the real bundler used in production — rolldown for bundling and oxc-transform for TS/JSX transforms — plus a generic registerWasmTool() seam for adding more native-binary-to-WASM tools later.

  • Bundling: rolldown/browser, invoked directly (not through registerWasmTool)
  • Transform: oxc-transform, invoked directly for single-file TS/JSX
  • Both load lazily (dynamic import()), same-origin in dev-server hosts, CDN (esm.sh) elsewhere

registerWasmTool() lets a host app register additional native binaries (esbuild, tsc, sass, swc, or anything else compiled to WASM/WASI) behind the same lazy-load dispatcher. Nothing beyond rolldown/oxc-transform is registered by default — this is a seam for consumers to plug into, not a preinstalled toolchain.

import { registerWasmTool } from '@bolojs/wasm-registry';
registerWasmTool('my-tool', async () => {
const mod = await import('my-wasm-tool');
return {
async run(args, stdin) {
const result = await mod.compile(args.join(' '));
return { stdout: result.output, stderr: result.errors, exitCode: 0 };
}
};
});
import { resolveWasmTool } from '@bolojs/wasm-registry';
const tool = await resolveWasmTool('my-tool');
if (tool) {
const result = await tool.run(['--version']);
console.log(result.stdout);
}
import { createChildProcessShim } from '@bolojs/node-runtime-shims';
import { createWasmRegistry } from '@bolojs/wasm-registry';
const registry = createWasmRegistry();
const shell = createShellService(); // from sw-sandbox
const shim = createChildProcessShim(registry, shell);

Unregistered commands fall through to the shell service.