napi-vm
v0.1.1
Published
A sandboxed JavaScript virtual machine built from scratch in Rust with NAPI bindings for Node.js
Maintainers
Readme
napi-vm
A sandboxed JavaScript virtual machine written in Rust with Node.js NAPI and WebAssembly integrations. It includes a shared language service, browser playground, local LSP, optional Zed extension, live VM metadata, and an IPC-style command/event bridge for deterministic tests.
Quick start
npm install
npm run build
npm testconst { Vm } = require("./index.js");
const vm = new Vm();
vm.run("let answer = 40 + 2;");
console.log(vm.run("answer;")); // 42Documentation
- Getting started — installation, VM usage, host bridge, modules, and playground
- API reference —
Vm,LanguageService, andVmSession - Editor integration — playground, LSP, Zed, live metadata, and IPC commands
- Sandbox safety — containment guards and operational limits
- Development — quality gate, scripts, benchmarks, and project structure
- Roadmap — implemented features and known boundaries
Useful examples
bun examples/hotreload.ts
NAPI_VM_SESSION=1 bun examples/hotreload.ts
npm run ipc:smokeThe first command runs the VM entirely in-process. The second opt-in command
publishes live metadata for the LSP through .napi-vm/runtime.json; the
temporary locator is ignored and removed when the session stops.
Status
The core language and bridge are actively developed and covered by the native
regression suite. Run npm test to see the current verified count.
License
No license specified.
