Commit bbfa3bd
feat: add Node.js napi-rs binding and Express integration
Uses napi-rs over FFI or WASM because it compiles Rust directly into a
native .node addon, bypassing the C ABI entirely (JS↔Rust vs
JS→C→Rust→C→JS). Buffer for protocol data is zero-copy from V8 backing
store. No manual memory management (V8 ref-counting vs webui_free()).
WASM exists already for browser/universal use but is ~1.5-3x slower
than native for CPU-bound rendering.
Add webui-node crate that compiles the WebUI handler into a native
Node.js addon via napi-rs, exposing a render(html, dataJson) function.
Add Express integration example at examples/integration/node-express
following the same patterns as hyper and tiny_http (--app CLI arg,
routes for /, /assets/*, /hmr, file watcher for HMR).
- New crate: crates/webui-node (napi-rs cdylib with 10 unit tests)
- New integration: examples/integration/node-express (ESM, Express 5)
- Add napi/napi-derive/napi-build to workspace dependencies
- Add ISC license to deny.toml allowlist (napi transitive dep)
- Add node-express to xtask INTEGRATION_BUILDS
- Update DESIGN.md and README.md
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 7a9e663 commit bbfa3bd
18 files changed
Lines changed: 1690 additions & 2 deletions
File tree
- crates/webui-node
- src
- examples/integration/node-express
- src
- routes
- xtask/src
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
| |||
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| 48 | + | |
45 | 49 | | |
46 | 50 | | |
47 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
| 480 | + | |
480 | 481 | | |
481 | 482 | | |
482 | 483 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
83 | 101 | | |
84 | 102 | | |
85 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
0 commit comments