@microsoft/webui 0.0.19 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,11 @@ High-performance server-side rendering framework. Compiles HTML templates into a
10
10
  npm install @microsoft/webui
11
11
  ```
12
12
 
13
- The package automatically installs the correct platform-specific native binary for your OS and architecture (Windows, macOS, Linux - x64 and arm64).
13
+ The package automatically installs the correct platform-specific native binary
14
+ for your OS and architecture (Windows, macOS, Linux - x64 and arm64). The Node
15
+ API requires that native addon and surfaces loading errors directly. It never
16
+ falls back to a subprocess. Use the `webui` CLI explicitly for filesystem
17
+ builds.
14
18
 
15
19
  ## Quick start
16
20
 
@@ -36,23 +40,30 @@ Compiles an application directory of HTML templates into a binary protocol.
36
40
  const result = build({
37
41
  appDir: "./src", // Path to the template directory
38
42
  entry: "index.html", // Entry file (default: "index.html")
39
- css: "link", // CSS strategy: "link" or "style"
43
+ css: "link", // CSS strategy: "link", "style", or "module"
40
44
  plugin: "webui", // Parser plugin name
41
45
  components: [], // Additional component sources
42
46
  componentAssetRoots: ["settings-dialog"], // Static .webui.js asset roots
47
+ metafile: true, // Return an esbuild-compatible asset graph
43
48
  cssFileNameTemplate: "[name]-[hash].[ext]", // CSS/component asset filename template
44
49
  cssPublicBase: "https://cdn.example.com/assets", // Optional CDN/public href base
45
50
  theme: "./themes/brand.json", // Optional design-token theme validation
46
- outDir: "./dist", // Output directory for CLI fallback
47
51
  });
48
52
 
49
53
  // result.protocol - Buffer containing the compiled protocol
50
54
  // result.cssFiles - Array of [filename, content, ...] pairs
51
55
  // result.componentAssetFiles - Array of [filename, ESM content, ...] pairs
56
+ // result.metafile - Optional esbuild-compatible graph JSON
52
57
  // result.warnings - Array of non-fatal build advisory diagnostics
53
58
  // result.stats - { durationMs, fragmentCount, componentCount, cssFileCount, protocolSizeBytes, tokenCount }
54
59
  ```
55
60
 
61
+ Static component assets use a root/chunk graph. Entry-reachable dependencies
62
+ remain external, dependencies used by one root stay inline, and dependencies
63
+ with an identical multi-root consumer set are emitted once as dynamic chunks.
64
+ Asset-only records are omitted from `result.protocol`. Component assets cannot
65
+ be combined with `<route>`.
66
+
56
67
  When `theme` is provided, every required CSS token must exist in the theme
57
68
  after local and ancestor custom-property definitions are excluded. A `var()`
58
69
  usage with a literal fallback (e.g. `var(--brand, #000)`) is exempt. Missing
@@ -139,7 +150,11 @@ required.
139
150
  ### `protocol.renderStream(state, onChunk, options?): void`
140
151
 
141
152
  Renders with streaming output. Internal handler writes are coalesced around a
142
- 16 KiB target before the callback crosses into JavaScript.
153
+ 16 KiB target before the callback crosses into JavaScript. The callback runs
154
+ synchronously and its return value is ignored. In particular,
155
+ `response.write()` returning `false` does not pause native rendering, so this
156
+ API does not provide transport backpressure. A thrown callback error aborts
157
+ rendering immediately and is rethrown to the caller.
143
158
 
144
159
  ```js
145
160
  protocol.renderStream(state, (chunk) => {
@@ -147,6 +162,59 @@ protocol.renderStream(state, (chunk) => {
147
162
  });
148
163
  ```
149
164
 
165
+ ### `protocol.streamResponse(options?): StreamingSession`
166
+
167
+ Opens a progressive streaming session for an entry that declares `<boundary>`
168
+ directives. Unlike `renderStream`, the session **returns** each chunk, so your
169
+ server keeps the socket, the write order, and the backpressure contract.
170
+
171
+ ```js
172
+ import { once } from 'node:events';
173
+
174
+ const session = protocol.streamResponse({ entry: 'index.html', requestPath: '/' });
175
+ const status = session.boundary('job-status'); // resolve names once
176
+
177
+ res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
178
+ await write(res, session.writeShell(baseState));
179
+ await write(res, session.writeBoundary(status, statusState, 'updatable'));
180
+
181
+ // Patches an already-hydrated island on this same response.
182
+ await write(res, session.update(status, { jobState: 'succeeded' }));
183
+ res.end(session.finish({}));
184
+
185
+ async function write(res, chunk) {
186
+ if (res.write(chunk)) return;
187
+ // An aborted client never emits 'drain', and surfaces as 'close', not
188
+ // 'error' — so waiting on 'drain' alone would hang forever.
189
+ await new Promise((ok, fail) => {
190
+ const done = (error) => {
191
+ res.off('drain', onDrain);
192
+ res.off('close', onClose);
193
+ if (error) fail(error);
194
+ else ok();
195
+ };
196
+ const onDrain = () => done();
197
+ const onClose = () => done(new Error('client disconnected'));
198
+ res.once('drain', onDrain);
199
+ res.once('close', onClose);
200
+ });
201
+ }
202
+ ```
203
+
204
+ | Member | Returns | Description |
205
+ |--------|---------|-------------|
206
+ | `boundary(name)` | `number` | Integer handle for an authored boundary name |
207
+ | `boundaryCount` | `number` | Boundaries declared by the entry |
208
+ | `finished` | `boolean` | Whether `finish()` has been called |
209
+ | `writeShell(state)` | `Buffer` | Document prefix through the first semantic flush |
210
+ | `writeBoundary(id, state, mode?)` | `Buffer` | One boundary's markup and checkpoint (`'final'` \| `'updatable'`) |
211
+ | `update(id, state)` | `Buffer` | Projected state patch to an updatable boundary |
212
+ | `finish(state)` | `Buffer` | Tail checkpoint, terminal record, and document suffix |
213
+
214
+ Ordering is enforced. A rejected call throws and leaves the session usable, so
215
+ invalid state does not cost you the response. Sessions are independent — hold
216
+ one per in-flight request.
217
+
150
218
  ### `inspect(protocol: Buffer): string`
151
219
 
152
220
  Returns a JSON representation of the protocol for debugging.
package/bin/webui CHANGED
Binary file
package/dist/index.d.ts CHANGED
@@ -12,12 +12,12 @@ export interface BuildOptions {
12
12
  components?: string[];
13
13
  /** Root component tags emitted as static `.webui.js` ESM assets. */
14
14
  componentAssetRoots?: string[];
15
+ /** Generate and return an esbuild-compatible component asset metafile. */
16
+ metafile?: boolean;
15
17
  /** Emitted asset filename template for Link-mode CSS and component assets. Tokens: [name], [hash], [ext]. */
16
18
  cssFileNameTemplate?: string;
17
19
  /** Optional base URL/path prefix for Link-mode CSS hrefs. */
18
20
  cssPublicBase?: string;
19
- /** Output directory (used by CLI fallback for build-to-disk). */
20
- outDir?: string;
21
21
  /** Design token theme: a JSON file path or npm package name. */
22
22
  theme?: string;
23
23
  /** Projection manifest file paths, merged in order. */
@@ -51,6 +51,8 @@ export interface BuildResult {
51
51
  cssFiles: string[];
52
52
  /** Static component asset files as alternating [filename, content, ...]. */
53
53
  componentAssetFiles: string[];
54
+ /** Esbuild-compatible component asset metafile JSON when requested. */
55
+ metafile?: string;
54
56
  /** Non-fatal build advisories as plain diagnostic strings. */
55
57
  warnings: string[];
56
58
  /** Build statistics. */
@@ -68,6 +70,27 @@ export interface ProtocolOptions {
68
70
  /** Handler plugin name. */
69
71
  plugin?: string;
70
72
  }
73
+ /**
74
+ * Whether a committed boundary may receive later state updates.
75
+ *
76
+ * `final` releases every boundary-local reference once the island hydrates.
77
+ * `updatable` retains the roots and projection so `update()` can patch them,
78
+ * so use it only for boundaries you actually intend to patch.
79
+ */
80
+ export type BoundaryMode = "final" | "updatable";
81
+ /** Per-response settings for a host-driven streaming session. */
82
+ export interface StreamOptions {
83
+ /** Fragment ID to start rendering from (default: "index.html"). */
84
+ entry?: string;
85
+ /** URL path to match routes against (default: "/"). */
86
+ requestPath?: string;
87
+ /** CSP nonce applied to generated inline `<script>` tags. */
88
+ nonce?: string;
89
+ /** HTML injected at the structural `head_end` boundary. */
90
+ headInject?: string;
91
+ /** HTML injected at the structural `body_end` boundary. */
92
+ bodyInject?: string;
93
+ }
71
94
  /** Response from `renderComponentTemplates()` for on-demand component loading. */
72
95
  export interface ComponentTemplatesResponse {
73
96
  /** Module CSS `<style>` strings for the requested components. */
@@ -99,6 +122,15 @@ export interface PartialResponse {
99
122
  exact?: boolean;
100
123
  }>;
101
124
  }
125
+ interface NativeStreamingSession {
126
+ readonly boundaryCount: number;
127
+ readonly finished: boolean;
128
+ boundary(name: string): number;
129
+ writeShell(stateJson: string): Buffer;
130
+ writeBoundary(boundary: number, stateJson: string, mode?: BoundaryMode): Buffer;
131
+ update(boundary: number, stateJson: string): Buffer;
132
+ finish(stateJson: string): Buffer;
133
+ }
102
134
  /** Build a WebUI application from an app directory. */
103
135
  export declare function build(options: BuildOptions): BuildResult;
104
136
  /**
@@ -120,7 +152,67 @@ export declare class Protocol {
120
152
  renderComponentTemplates(componentTags: string[], inventoryHex: string): string;
121
153
  /** Return CSS token names in build order. */
122
154
  tokens(): string[];
155
+ /**
156
+ * Open a host-driven progressive response.
157
+ *
158
+ * Unlike {@link renderStream}, which pushes every chunk during one
159
+ * synchronous call, the returned session hands each chunk back so this
160
+ * server owns the socket, the write order, and backpressure.
161
+ */
162
+ streamResponse(options?: StreamOptions): StreamingSession;
163
+ }
164
+ /**
165
+ * A progressive HTML response written one chunk at a time.
166
+ *
167
+ * Every method returns the bytes it produced instead of writing them, so the
168
+ * caller decides when they reach the socket and can await `drain` between
169
+ * chunks. The session holds no transport and never blocks on one.
170
+ *
171
+ * Ordering is enforced: the shell first, then each boundary exactly once in
172
+ * declaration order, `update()` only after its boundary commits as
173
+ * `updatable`, and `finish()` last. A violation throws before any byte is
174
+ * produced.
175
+ *
176
+ * ```js
177
+ * const session = protocol.streamResponse({ requestPath: req.url });
178
+ * const weather = session.boundary("weather-shell");
179
+ *
180
+ * res.write(session.writeShell(shellState));
181
+ * res.write(session.writeBoundary(weather, weatherShell, "updatable"));
182
+ *
183
+ * const forecast = await forecastReady;
184
+ * if (!res.write(session.update(weather, forecast))) {
185
+ * await once(res, "drain");
186
+ * }
187
+ *
188
+ * res.end(session.finish({}));
189
+ * ```
190
+ */
191
+ export declare class StreamingSession {
192
+ #private;
193
+ /** @internal Created by {@link Protocol.streamResponse}. */
194
+ constructor(native: NativeStreamingSession);
195
+ /** Number of compile-time boundaries declared by this entry. */
196
+ get boundaryCount(): number;
197
+ /** Whether the terminal record has been written. */
198
+ get finished(): boolean;
199
+ /**
200
+ * Resolve an authored boundary name to a stable integer handle.
201
+ *
202
+ * Resolve once outside the write loop; reusing the handle costs nothing.
203
+ * An unknown name throws with the valid names and a suggestion.
204
+ */
205
+ boundary(name: string): number;
206
+ /** Render everything before the first boundary. */
207
+ writeShell(state: object | string): Buffer;
208
+ /** Render and commit the next boundary in declaration order. */
209
+ writeBoundary(boundary: number, state: object | string, mode?: BoundaryMode): Buffer;
210
+ /** Push a projected state patch to a committed `updatable` boundary. */
211
+ update(boundary: number, state: object | string): Buffer;
212
+ /** Render the document tail and emit the terminal record. */
213
+ finish(state?: object | string): Buffer;
123
214
  }
124
215
  /** Inspect protocol bytes and return JSON representation. */
125
216
  export declare function inspect(protocolData: Buffer): string;
217
+ export {};
126
218
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,gDAAgD;AAChD,MAAM,WAAW,YAAY;IAC3B,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IAClC,0BAA0B;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,oEAAoE;IACpE,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,6GAA6G;IAC7G,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,6DAA6D;IAC7D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,2EAA2E;IAC3E,yBAAyB,CAAC,EAAE,KAAK,CAAC;QAChC,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC,CAAC;CACJ;AAED,wBAAwB;AACxB,MAAM,WAAW,UAAU;IACzB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,aAAa,EAAE,MAAM,C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G5C;AAMD,6DAA6D;AAC7D,wBAAgB,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAQpD"}
package/dist/index.js CHANGED
@@ -1,132 +1,57 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
3
  import { createRequire } from "node:module";
4
- import { execFileSync } from "node:child_process";
5
- import fs from "node:fs";
6
- import nodePath from "node:path";
7
- import { resolve, platformKey } from "./platform.js";
4
+ import { packageName, platformKey, resolve } from "./platform.js";
8
5
  const require = createRequire(import.meta.url);
9
- let addon = null;
10
- let fallbackWarned = false;
6
+ let addon;
11
7
  function loadAddon() {
12
8
  if (addon)
13
9
  return addon;
14
10
  const addonPath = resolve("addon");
15
- if (addonPath) {
16
- try {
17
- // .node files load via require(), native libs (.dylib/.so/.dll) via dlopen
18
- if (addonPath.endsWith(".node")) {
19
- addon = require(addonPath);
20
- }
21
- else {
22
- const m = { exports: {} };
23
- process.dlopen(m, addonPath);
24
- addon = m.exports;
25
- }
26
- return addon;
11
+ if (!addonPath) {
12
+ throw new Error(`[webui] Native addon not found for ${platformKey()}. ${addonInstallHelp()} ` +
13
+ 'The Node API does not fall back to the CLI; invoke "webui" explicitly for filesystem builds.');
14
+ }
15
+ try {
16
+ // .node files load via require(), native libs (.dylib/.so/.dll) via dlopen
17
+ if (addonPath.endsWith(".node")) {
18
+ addon = require(addonPath);
27
19
  }
28
- catch {
29
- // Fall through to WASM.
20
+ else {
21
+ const m = { exports: {} };
22
+ process.dlopen(m, addonPath);
23
+ addon = m.exports;
30
24
  }
31
25
  }
32
- return null;
26
+ catch (cause) {
27
+ throw new Error(`[webui] Failed to load native addon at ${addonPath}. ${addonInstallHelp()}`, { cause });
28
+ }
29
+ return addon;
33
30
  }
34
- function warnFallback() {
35
- if (fallbackWarned)
36
- return;
37
- fallbackWarned = true;
38
- console.warn(`[webui] Native addon not available for ${platformKey()}. ` +
39
- `Using WASM fallback — performance may be degraded.\n` +
40
- `Install the platform-specific package for optimal performance.`);
31
+ function addonInstallHelp() {
32
+ try {
33
+ return `Reinstall ${packageName()} or set WEBUI_ADDON_PATH to a compatible addon.`;
34
+ }
35
+ catch (error) {
36
+ const platformError = error instanceof Error ? error.message : String(error);
37
+ return `${platformError} Set WEBUI_ADDON_PATH to a compatible addon.`;
38
+ }
41
39
  }
42
40
  // ── Build API ────────────────────────────────────────────────────────
43
41
  /** Build a WebUI application from an app directory. */
44
42
  export function build(options) {
45
43
  const native = loadAddon();
46
- if (native?.build) {
47
- const { projectionManifestObjects, ...nativeOptions } = options;
48
- return native.build({
49
- ...nativeOptions,
50
- projectionManifestObjects: projectionManifestObjects?.map(({ path, manifest }) => ({
51
- path,
52
- json: JSON.stringify(manifest),
53
- })),
54
- });
55
- }
56
- // Fallback: shell out to CLI binary.
57
- const binPath = resolve("bin");
58
- if (!binPath) {
59
- throw new Error("[webui] Cannot build: no native addon or CLI binary available.");
60
- }
61
- const args = ["build", options.appDir ?? "."];
62
- if (options.entry)
63
- args.push("--entry", options.entry);
64
- if (options.css)
65
- args.push("--css", options.css);
66
- if (options.plugin)
67
- args.push("--plugin", options.plugin);
68
- if (options.components) {
69
- for (const c of options.components) {
70
- args.push("--components", c);
71
- }
72
- }
73
- if (options.projectionManifests) {
74
- for (const manifest of options.projectionManifests) {
75
- args.push("--projection-manifest", manifest);
76
- }
77
- }
78
- if (options.projectionManifestObjects &&
79
- options.projectionManifestObjects.length > 0) {
80
- throw new Error("[webui] Inline projection manifest objects require the native addon; write the manifest and pass projectionManifests when using the CLI fallback.");
81
- }
82
- if (options.componentAssetRoots && options.componentAssetRoots.length > 0) {
83
- args.push("--emit-component-assets", options.componentAssetRoots.join(","));
84
- }
85
- if (options.cssFileNameTemplate) {
86
- args.push("--css-file-name-template", options.cssFileNameTemplate);
87
- }
88
- if (options.cssPublicBase) {
89
- args.push("--css-public-base", options.cssPublicBase);
90
- }
91
- if (options.theme)
92
- args.push("--theme", options.theme);
93
- if (options.outDir)
94
- args.push("--out", options.outDir);
95
- execFileSync(binPath, args, { stdio: "inherit" });
96
- // CLI fallback does not return in-memory protocol.
97
- if (options.outDir) {
98
- const protocol = fs.readFileSync(nodePath.join(options.outDir, "protocol.bin"));
99
- return {
100
- protocol,
101
- cssFiles: [],
102
- componentAssetFiles: readComponentAssetFiles(options.outDir),
103
- warnings: [],
104
- stats: emptyStats(),
105
- };
106
- }
107
- return {
108
- protocol: Buffer.alloc(0),
109
- cssFiles: [],
110
- componentAssetFiles: [],
111
- warnings: [],
112
- stats: emptyStats(),
113
- };
114
- }
115
- function readComponentAssetFiles(outDir) {
116
- const files = [];
117
- const entries = fs.readdirSync(outDir, { withFileTypes: true });
118
- for (let i = 0; i < entries.length; i++) {
119
- const entry = entries[i];
120
- if (!entry.isFile())
121
- continue;
122
- const name = entry.name;
123
- const path = nodePath.join(outDir, name);
124
- const content = fs.readFileSync(path, "utf8");
125
- if (!content.startsWith("const asset=") || !content.includes("webui-component-asset"))
126
- continue;
127
- files.push(name, content);
128
- }
129
- return files;
44
+ if (typeof native.build !== "function") {
45
+ throw new Error(`[webui] Native addon is incompatible: build() is required. ${addonInstallHelp()}`);
46
+ }
47
+ const { projectionManifestObjects, ...nativeOptions } = options;
48
+ return native.build({
49
+ ...nativeOptions,
50
+ projectionManifestObjects: projectionManifestObjects?.map(({ path, manifest }) => ({
51
+ path,
52
+ json: JSON.stringify(manifest),
53
+ })),
54
+ });
130
55
  }
131
56
  // ── Runtime protocol API ─────────────────────────────────────────────
132
57
  /**
@@ -138,11 +63,9 @@ function readComponentAssetFiles(outDir) {
138
63
  export class Protocol {
139
64
  #native;
140
65
  constructor(protocolData, options) {
141
- const native = loadAddon();
142
- const NativeProtocol = native?.Protocol;
66
+ const NativeProtocol = loadAddon().Protocol;
143
67
  if (!NativeProtocol) {
144
- warnFallback();
145
- throw new Error("[webui] Native addon is incompatible: Protocol is required.");
68
+ throw new Error(`[webui] Native addon is incompatible: Protocol is required. ${addonInstallHelp()}`);
146
69
  }
147
70
  this.#native = new NativeProtocol(protocolData, options?.plugin);
148
71
  }
@@ -169,24 +92,98 @@ export class Protocol {
169
92
  tokens() {
170
93
  return this.#native.tokens();
171
94
  }
95
+ /**
96
+ * Open a host-driven progressive response.
97
+ *
98
+ * Unlike {@link renderStream}, which pushes every chunk during one
99
+ * synchronous call, the returned session hands each chunk back so this
100
+ * server owns the socket, the write order, and backpressure.
101
+ */
102
+ streamResponse(options) {
103
+ return new StreamingSession(this.#native.streamResponse(options?.entry ?? "index.html", options?.requestPath ?? "/", {
104
+ nonce: options?.nonce,
105
+ headInject: options?.headInject,
106
+ bodyInject: options?.bodyInject,
107
+ }));
108
+ }
109
+ }
110
+ /**
111
+ * A progressive HTML response written one chunk at a time.
112
+ *
113
+ * Every method returns the bytes it produced instead of writing them, so the
114
+ * caller decides when they reach the socket and can await `drain` between
115
+ * chunks. The session holds no transport and never blocks on one.
116
+ *
117
+ * Ordering is enforced: the shell first, then each boundary exactly once in
118
+ * declaration order, `update()` only after its boundary commits as
119
+ * `updatable`, and `finish()` last. A violation throws before any byte is
120
+ * produced.
121
+ *
122
+ * ```js
123
+ * const session = protocol.streamResponse({ requestPath: req.url });
124
+ * const weather = session.boundary("weather-shell");
125
+ *
126
+ * res.write(session.writeShell(shellState));
127
+ * res.write(session.writeBoundary(weather, weatherShell, "updatable"));
128
+ *
129
+ * const forecast = await forecastReady;
130
+ * if (!res.write(session.update(weather, forecast))) {
131
+ * await once(res, "drain");
132
+ * }
133
+ *
134
+ * res.end(session.finish({}));
135
+ * ```
136
+ */
137
+ export class StreamingSession {
138
+ #native;
139
+ /** @internal Created by {@link Protocol.streamResponse}. */
140
+ constructor(native) {
141
+ this.#native = native;
142
+ }
143
+ /** Number of compile-time boundaries declared by this entry. */
144
+ get boundaryCount() {
145
+ return this.#native.boundaryCount;
146
+ }
147
+ /** Whether the terminal record has been written. */
148
+ get finished() {
149
+ return this.#native.finished;
150
+ }
151
+ /**
152
+ * Resolve an authored boundary name to a stable integer handle.
153
+ *
154
+ * Resolve once outside the write loop; reusing the handle costs nothing.
155
+ * An unknown name throws with the valid names and a suggestion.
156
+ */
157
+ boundary(name) {
158
+ return this.#native.boundary(name);
159
+ }
160
+ /** Render everything before the first boundary. */
161
+ writeShell(state) {
162
+ return this.#native.writeShell(toStateJson(state));
163
+ }
164
+ /** Render and commit the next boundary in declaration order. */
165
+ writeBoundary(boundary, state, mode = "final") {
166
+ return this.#native.writeBoundary(boundary, toStateJson(state), mode);
167
+ }
168
+ /** Push a projected state patch to a committed `updatable` boundary. */
169
+ update(boundary, state) {
170
+ return this.#native.update(boundary, toStateJson(state));
171
+ }
172
+ /** Render the document tail and emit the terminal record. */
173
+ finish(state = {}) {
174
+ return this.#native.finish(toStateJson(state));
175
+ }
176
+ }
177
+ function toStateJson(state) {
178
+ return typeof state === "string" ? state : JSON.stringify(state);
172
179
  }
173
180
  /** Inspect protocol bytes and return JSON representation. */
174
181
  export function inspect(protocolData) {
175
182
  const native = loadAddon();
176
- if (native?.inspect) {
177
- return native.inspect(protocolData);
183
+ if (typeof native.inspect !== "function") {
184
+ throw new Error(`[webui] Native addon is incompatible: inspect() is required. ${addonInstallHelp()}`);
178
185
  }
179
- throw new Error("[webui] inspect() requires the native addon.");
186
+ return native.inspect(protocolData);
180
187
  }
181
188
  // ── Helpers ──────────────────────────────────────────────────────────
182
- function emptyStats() {
183
- return {
184
- durationMs: 0,
185
- fragmentCount: 0,
186
- componentCount: 0,
187
- cssFileCount: 0,
188
- protocolSizeBytes: 0,
189
- tokenCount: 0,
190
- };
191
- }
192
189
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,MAAM,SAAS,C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,GAAG,SAAS,EAAE,CAAC;IAC3B,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CACb,gEAAgE,gBAAgB,EAAE,EAAE,CACrF,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AACtC,CAAC;AAED,wEAAwE"}
@@ -1 +1 @@
1
- {"version":3,"file":"esbuild.d.ts","sourceRoot":"","sources":["../../../src/projection/adapters/esbuild.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAIV,MAAM,EAEP,MAAM,SAAS,CAAC;AAoBjB,iEAAiE;AACjE,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAYD,qDAAqD;AACrD,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,wBAA6B,GACrC,MAAM,CAgCR"}
1
+ {"version":3,"file":"esbuild.d.ts","sourceRoot":"","sources":["../../../src/projection/adapters/esbuild.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAIV,MAAM,EAEP,MAAM,SAAS,CAAC;AAqBjB,iEAAiE;AACjE,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAYD,qDAAqD;AACrD,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,wBAA6B,GACrC,MAAM,CAgCR"}