Skip to main content

Crate webui_node

Crate webui_node 

Source
Expand description

Node.js native addon for the WebUI framework via napi-rs.

Provides high-performance server-side rendering by compiling the Rust WebUI handler directly into a .node native addon — no C ABI intermediary.

The Protocol class decodes pre-compiled protobuf data from webui build once and provides buffered and streaming render methods.

§Usage (from Node.js)

import fs from 'node:fs';

// Load the native addon
const mod = { exports: {} };
process.dlopen(mod, './target/release/libwebui_node.dylib');
const { Protocol } = mod.exports;

// Read pre-compiled protocol (from `webui build`)
const protocol = new Protocol(fs.readFileSync('./dist/protocol.bin'), 'webui');
const state = '{"name": "WebUI"}';

// Stream rendered fragments
protocol.renderStream(state, 'index.html', '/', (chunk) => process.stdout.write(chunk));

Structs§

JsBoundaryDescriptor
Runtime boundary occurrence returned by a streaming step.
JsBuildOptions
Build options for the webui build API.
JsBuildResult
Result of a successful build operation.
JsBuildStats
Build statistics returned from the build function.
JsProjectionManifest
Inline projection manifest transported through N-API.
JsStreamOptions
Optional per-response streaming settings.
JsStreamStep
Bytes and continuation state returned by one streaming session step.
Protocol
A decoded protocol and its reusable deterministic indices.
StreamingSession
A progressive HTML response driven one semantic step at a time from Node.

Functions§

build
Build a WebUI application from an app directory.
inspect
Inspect protocol bytes and return a JSON representation.