@microsoft/webui 0.0.17 → 0.0.19
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 +92 -19
- package/bin/webui +0 -0
- package/dist/index.d.ts +37 -36
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +89 -80
- package/dist/index.js.map +1 -1
- package/dist/projection/adapters/esbuild.d.ts +14 -0
- package/dist/projection/adapters/esbuild.d.ts.map +1 -0
- package/dist/projection/adapters/esbuild.js +426 -0
- package/dist/projection/adapters/esbuild.js.map +1 -0
- package/dist/projection/compiler.d.ts +12 -0
- package/dist/projection/compiler.d.ts.map +1 -0
- package/dist/projection/compiler.js +1166 -0
- package/dist/projection/compiler.js.map +1 -0
- package/dist/projection/diagnostics.d.ts +153 -0
- package/dist/projection/diagnostics.d.ts.map +1 -0
- package/dist/projection/diagnostics.js +210 -0
- package/dist/projection/diagnostics.js.map +1 -0
- package/dist/projection/fixtures/conformance.d.ts +40 -0
- package/dist/projection/fixtures/conformance.d.ts.map +1 -0
- package/dist/projection/fixtures/conformance.js +602 -0
- package/dist/projection/fixtures/conformance.js.map +1 -0
- package/dist/projection/graph.d.ts +144 -0
- package/dist/projection/graph.d.ts.map +1 -0
- package/dist/projection/graph.js +4 -0
- package/dist/projection/graph.js.map +1 -0
- package/dist/projection/index.d.ts +37 -0
- package/dist/projection/index.d.ts.map +1 -0
- package/dist/projection/index.js +17 -0
- package/dist/projection/index.js.map +1 -0
- package/dist/projection/loader.d.ts +10 -0
- package/dist/projection/loader.d.ts.map +1 -0
- package/dist/projection/loader.js +45 -0
- package/dist/projection/loader.js.map +1 -0
- package/dist/projection/manifest.d.ts +97 -0
- package/dist/projection/manifest.d.ts.map +1 -0
- package/dist/projection/manifest.js +340 -0
- package/dist/projection/manifest.js.map +1 -0
- package/package.json +33 -11
package/README.md
CHANGED
|
@@ -15,14 +15,15 @@ The package automatically installs the correct platform-specific native binary f
|
|
|
15
15
|
## Quick start
|
|
16
16
|
|
|
17
17
|
```js
|
|
18
|
-
import { build,
|
|
18
|
+
import { build, Protocol } from "@microsoft/webui";
|
|
19
19
|
|
|
20
20
|
// Build templates into a protocol
|
|
21
21
|
const result = build({ appDir: "./src" });
|
|
22
22
|
|
|
23
|
-
//
|
|
24
|
-
const
|
|
25
|
-
|
|
23
|
+
// Decode and index once, then render repeatedly
|
|
24
|
+
const protocol = new Protocol(result.protocol, { plugin: "webui" });
|
|
25
|
+
const html = protocol.render({ name: "World", items: ["a", "b"] });
|
|
26
|
+
console.log(html.toString("utf8"));
|
|
26
27
|
```
|
|
27
28
|
|
|
28
29
|
## API
|
|
@@ -38,40 +39,112 @@ const result = build({
|
|
|
38
39
|
css: "link", // CSS strategy: "link" or "style"
|
|
39
40
|
plugin: "webui", // Parser plugin name
|
|
40
41
|
components: [], // Additional component sources
|
|
41
|
-
|
|
42
|
+
componentAssetRoots: ["settings-dialog"], // Static .webui.js asset roots
|
|
43
|
+
cssFileNameTemplate: "[name]-[hash].[ext]", // CSS/component asset filename template
|
|
42
44
|
cssPublicBase: "https://cdn.example.com/assets", // Optional CDN/public href base
|
|
45
|
+
theme: "./themes/brand.json", // Optional design-token theme validation
|
|
43
46
|
outDir: "./dist", // Output directory for CLI fallback
|
|
44
47
|
});
|
|
45
48
|
|
|
46
49
|
// result.protocol - Buffer containing the compiled protocol
|
|
47
50
|
// result.cssFiles - Array of [filename, content, ...] pairs
|
|
51
|
+
// result.componentAssetFiles - Array of [filename, ESM content, ...] pairs
|
|
52
|
+
// result.warnings - Array of non-fatal build advisory diagnostics
|
|
48
53
|
// result.stats - { durationMs, fragmentCount, componentCount, cssFileCount, protocolSizeBytes, tokenCount }
|
|
49
54
|
```
|
|
50
55
|
|
|
51
|
-
|
|
56
|
+
When `theme` is provided, every required CSS token must exist in the theme
|
|
57
|
+
after local and ancestor custom-property definitions are excluded. A `var()`
|
|
58
|
+
usage with a literal fallback (e.g. `var(--brand, #000)`) is exempt. Missing
|
|
59
|
+
required tokens fail the build with a structured `missing-theme-token` error.
|
|
60
|
+
Misspelled literal-fallback tokens are returned as non-fatal warnings.
|
|
52
61
|
|
|
53
|
-
|
|
62
|
+
### Optional state projection
|
|
63
|
+
|
|
64
|
+
The build-only `@microsoft/webui/projection.js` subpath exposes the
|
|
65
|
+
bundler-neutral projection compiler and the supported esbuild adapter. esbuild
|
|
66
|
+
and TypeScript are optional peer dependencies, so applications that do not use
|
|
67
|
+
projection do not install or load them:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npm install -D esbuild typescript
|
|
71
|
+
```
|
|
54
72
|
|
|
55
73
|
```js
|
|
56
|
-
|
|
74
|
+
import * as esbuild from "esbuild";
|
|
75
|
+
import { esbuildProjection } from "@microsoft/webui/projection.js";
|
|
76
|
+
|
|
77
|
+
await esbuild.build({
|
|
78
|
+
entryPoints: ["src/index.ts"],
|
|
79
|
+
outdir: "dist",
|
|
80
|
+
bundle: true,
|
|
81
|
+
splitting: true,
|
|
82
|
+
format: "esm",
|
|
83
|
+
plugins: [esbuildProjection()],
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const result = build({
|
|
87
|
+
appDir: "./src",
|
|
88
|
+
plugin: "webui",
|
|
89
|
+
projectionManifests: ["./dist/webui-projection.json"],
|
|
90
|
+
});
|
|
57
91
|
```
|
|
58
92
|
|
|
59
|
-
|
|
93
|
+
esbuild runs once and emits both browser chunks and
|
|
94
|
+
`webui-projection.json`; WebUI then embeds the exact initial/navigation
|
|
95
|
+
surfaces into `protocol.bin`. The adapter uses esbuild's resolved graph and
|
|
96
|
+
emitted output membership, so code splitting, dynamic imports, output hashes,
|
|
97
|
+
and external bundles remain application-owned.
|
|
98
|
+
|
|
99
|
+
Other bundler adapters can use the exported `AdapterContext`,
|
|
100
|
+
`compileProjection()`, and conformance fixtures without importing esbuild. The
|
|
101
|
+
package currently ships and supports `esbuildProjection()` as its official
|
|
102
|
+
adapter.
|
|
103
|
+
|
|
104
|
+
With no manifest, WebUI performs no JavaScript analysis and preserves full
|
|
105
|
+
state. Once any manifest is supplied, coverage is strict: every scripted
|
|
106
|
+
component compiled into the protocol must have exactly one entry. Shared
|
|
107
|
+
controls built as external bundles should emit their own manifest fragment,
|
|
108
|
+
then all fragments should be passed through `projectionManifests`.
|
|
109
|
+
|
|
110
|
+
Manifest keys are exact JavaScript `@observable` and `@attr` property names.
|
|
111
|
+
During hydration, an existing SSR host attribute wins over projected `@attr`
|
|
112
|
+
state. Runtime hosts never load TypeScript, esbuild, or the manifest.
|
|
113
|
+
|
|
114
|
+
### `new Protocol(protocol: Buffer, options?: ProtocolOptions)`
|
|
60
115
|
|
|
61
|
-
|
|
116
|
+
Decodes and indexes a compiled protocol once. Keep this object for the server
|
|
117
|
+
lifetime and use it for all runtime operations.
|
|
62
118
|
|
|
63
119
|
```js
|
|
64
|
-
|
|
65
|
-
response.write(chunk);
|
|
66
|
-
});
|
|
120
|
+
const protocol = new Protocol(protocolBytes, { plugin: "webui" });
|
|
67
121
|
```
|
|
68
122
|
|
|
69
|
-
|
|
123
|
+
`Protocol` owns its decoded native state. The package does not keep a hidden
|
|
124
|
+
`WeakMap`, copy the source `Buffer`, or expose render functions that accept
|
|
125
|
+
protocol bytes on every request.
|
|
126
|
+
|
|
127
|
+
### `protocol.render(state: object | string, options?: RenderOptions): Buffer`
|
|
70
128
|
|
|
71
|
-
|
|
129
|
+
Renders state into a UTF-8 Node.js `Buffer`, the canonical buffered result for
|
|
130
|
+
direct HTTP, file, or socket writes:
|
|
72
131
|
|
|
73
132
|
```js
|
|
74
|
-
|
|
133
|
+
response.end(protocol.render({ title: "Hello" }));
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Call `.toString("utf8")` explicitly when JavaScript string operations are
|
|
137
|
+
required.
|
|
138
|
+
|
|
139
|
+
### `protocol.renderStream(state, onChunk, options?): void`
|
|
140
|
+
|
|
141
|
+
Renders with streaming output. Internal handler writes are coalesced around a
|
|
142
|
+
16 KiB target before the callback crosses into JavaScript.
|
|
143
|
+
|
|
144
|
+
```js
|
|
145
|
+
protocol.renderStream(state, (chunk) => {
|
|
146
|
+
response.write(chunk);
|
|
147
|
+
});
|
|
75
148
|
```
|
|
76
149
|
|
|
77
150
|
### `inspect(protocol: Buffer): string`
|
|
@@ -83,16 +156,16 @@ const json = inspect(protocol);
|
|
|
83
156
|
console.log(JSON.parse(json));
|
|
84
157
|
```
|
|
85
158
|
|
|
86
|
-
### `renderPartial(
|
|
159
|
+
### `protocol.renderPartial(state, entryId, requestPath, inventoryHex): string`
|
|
87
160
|
|
|
88
161
|
Produces a JSON partial response for client-side navigation, including state, template metadata, condition closures, and route chain.
|
|
89
162
|
|
|
90
|
-
### `renderComponentTemplates(
|
|
163
|
+
### `protocol.renderComponentTemplates(componentTags, inventoryHex): string`
|
|
91
164
|
|
|
92
165
|
Renders templates and styles for on-demand component loading (used by `Router.ensureLoaded()`). Returns a JSON string with `templateStyles`, `templates`, `templateFunctions`, and `inventory`. Uses the same inventory bitfield as partial navigation to avoid sending duplicates.
|
|
93
166
|
|
|
94
167
|
```js
|
|
95
|
-
const json = renderComponentTemplates(
|
|
168
|
+
const json = protocol.renderComponentTemplates(["settings-dialog"], inventoryHex);
|
|
96
169
|
const { templates, templateFunctions, templateStyles, inventory } = JSON.parse(json);
|
|
97
170
|
```
|
|
98
171
|
|
package/bin/webui
CHANGED
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -10,12 +10,23 @@ export interface BuildOptions {
|
|
|
10
10
|
plugin?: string;
|
|
11
11
|
/** Additional component sources (npm packages or local paths). */
|
|
12
12
|
components?: string[];
|
|
13
|
-
/**
|
|
13
|
+
/** Root component tags emitted as static `.webui.js` ESM assets. */
|
|
14
|
+
componentAssetRoots?: string[];
|
|
15
|
+
/** Emitted asset filename template for Link-mode CSS and component assets. Tokens: [name], [hash], [ext]. */
|
|
14
16
|
cssFileNameTemplate?: string;
|
|
15
17
|
/** Optional base URL/path prefix for Link-mode CSS hrefs. */
|
|
16
18
|
cssPublicBase?: string;
|
|
17
19
|
/** Output directory (used by CLI fallback for build-to-disk). */
|
|
18
20
|
outDir?: string;
|
|
21
|
+
/** Design token theme: a JSON file path or npm package name. */
|
|
22
|
+
theme?: string;
|
|
23
|
+
/** Projection manifest file paths, merged in order. */
|
|
24
|
+
projectionManifests?: string[];
|
|
25
|
+
/** Inline manifests with logical paths anchoring root/stale validation. */
|
|
26
|
+
projectionManifestObjects?: Array<{
|
|
27
|
+
path: string;
|
|
28
|
+
manifest: unknown;
|
|
29
|
+
}>;
|
|
19
30
|
}
|
|
20
31
|
/** Build statistics. */
|
|
21
32
|
export interface BuildStats {
|
|
@@ -38,6 +49,10 @@ export interface BuildResult {
|
|
|
38
49
|
protocol: Buffer;
|
|
39
50
|
/** CSS files as alternating [filename, content, ...]. */
|
|
40
51
|
cssFiles: string[];
|
|
52
|
+
/** Static component asset files as alternating [filename, content, ...]. */
|
|
53
|
+
componentAssetFiles: string[];
|
|
54
|
+
/** Non-fatal build advisories as plain diagnostic strings. */
|
|
55
|
+
warnings: string[];
|
|
41
56
|
/** Build statistics. */
|
|
42
57
|
stats: BuildStats;
|
|
43
58
|
}
|
|
@@ -47,6 +62,9 @@ export interface RenderOptions {
|
|
|
47
62
|
entry?: string;
|
|
48
63
|
/** URL path to match routes against (default: "/"). */
|
|
49
64
|
requestPath?: string;
|
|
65
|
+
}
|
|
66
|
+
/** Options fixed for the lifetime of a loaded protocol. */
|
|
67
|
+
export interface ProtocolOptions {
|
|
50
68
|
/** Handler plugin name. */
|
|
51
69
|
plugin?: string;
|
|
52
70
|
}
|
|
@@ -84,42 +102,25 @@ export interface PartialResponse {
|
|
|
84
102
|
/** Build a WebUI application from an app directory. */
|
|
85
103
|
export declare function build(options: BuildOptions): BuildResult;
|
|
86
104
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Render a protocol with streaming output.
|
|
93
|
-
* Each HTML fragment is passed to the onChunk callback as it is produced.
|
|
105
|
+
* A decoded protocol with reusable indices for all runtime operations.
|
|
106
|
+
*
|
|
107
|
+
* Create one instance when the server loads `protocol.bin` and share it
|
|
108
|
+
* across requests. Construction decodes and indexes the protocol once.
|
|
94
109
|
*/
|
|
95
|
-
export declare
|
|
96
|
-
|
|
97
|
-
|
|
110
|
+
export declare class Protocol {
|
|
111
|
+
#private;
|
|
112
|
+
constructor(protocolData: Buffer, options?: ProtocolOptions);
|
|
113
|
+
/** Render a complete HTML response as a UTF-8 Node.js buffer. */
|
|
114
|
+
render(state: object | string, options?: RenderOptions): Buffer;
|
|
115
|
+
/** Stream a complete HTML response in chunks around 16 KiB. */
|
|
116
|
+
renderStream(state: object | string, onChunk: (html: string) => void, options?: RenderOptions): void;
|
|
117
|
+
/** Produce a complete JSON partial-navigation response. */
|
|
118
|
+
renderPartial(state: object | string, entryId: string, requestPath: string, inventoryHex: string): string;
|
|
119
|
+
/** Render component templates and styles for on-demand loading. */
|
|
120
|
+
renderComponentTemplates(componentTags: string[], inventoryHex: string): string;
|
|
121
|
+
/** Return CSS token names in build order. */
|
|
122
|
+
tokens(): string[];
|
|
123
|
+
}
|
|
98
124
|
/** Inspect protocol bytes and return JSON representation. */
|
|
99
125
|
export declare function inspect(protocolData: Buffer): string;
|
|
100
|
-
/**
|
|
101
|
-
* Produce a complete JSON partial response for client-side navigation.
|
|
102
|
-
*
|
|
103
|
-
* Returns a JSON string with `state`, `templates`, `inventory`, `path`, and `chain`.
|
|
104
|
-
* Pipe directly to the HTTP response — no post-processing needed.
|
|
105
|
-
*
|
|
106
|
-
* If you need to inspect the response, parse it with the exported `PartialResponse` type:
|
|
107
|
-
* ```ts
|
|
108
|
-
* const partial: PartialResponse = JSON.parse(renderPartial(...));
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
111
|
-
export declare function renderPartial(protocolData: Buffer, stateJson: string, entryId: string, requestPath: string, inventoryHex: string): string;
|
|
112
|
-
/**
|
|
113
|
-
* Render component templates and styles for on-demand loading.
|
|
114
|
-
*
|
|
115
|
-
* Used by `Router.ensureLoaded()` to fetch templates for components that
|
|
116
|
-
* are not part of the route tree (e.g., dialogs, popovers). Uses the same
|
|
117
|
-
* inventory bitfield as partial navigation to avoid sending duplicates.
|
|
118
|
-
*
|
|
119
|
-
* Returns a JSON string. Parse with the exported `ComponentTemplatesResponse` type:
|
|
120
|
-
* ```ts
|
|
121
|
-
* const resp: ComponentTemplatesResponse = JSON.parse(renderComponentTemplates(...));
|
|
122
|
-
* ```
|
|
123
|
-
*/
|
|
124
|
-
export declare function renderComponentTemplates(protocolData: Buffer, componentTags: string[], inventoryHex: string): string;
|
|
125
126
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,
|
|
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;I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,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM;IAS/D,+DAA+D;IAC/D,YAAY,CACV,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAC/B,OAAO,CAAC,EAAE,aAAa,GACtB,IAAI;IAUP,2DAA2D;IAC3D,aAAa,CACX,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,MAAM;IAKT,mEAAmE;IACnE,wBAAwB,CACtB,aAAa,EAAE,MAAM,EAAE,EACvB,YAAY,EAAE,MAAM,GACnB,MAAM;IAIT,6CAA6C;IAC7C,MAAM,IAAI,MAAM,EAAE;CAGnB;AAED,6DAA6D;AAC7D,wBAAgB,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAMpD"}
|
package/dist/index.js
CHANGED
|
@@ -44,7 +44,14 @@ function warnFallback() {
|
|
|
44
44
|
export function build(options) {
|
|
45
45
|
const native = loadAddon();
|
|
46
46
|
if (native?.build) {
|
|
47
|
-
|
|
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
|
+
});
|
|
48
55
|
}
|
|
49
56
|
// Fallback: shell out to CLI binary.
|
|
50
57
|
const binPath = resolve("bin");
|
|
@@ -63,66 +70,105 @@ export function build(options) {
|
|
|
63
70
|
args.push("--components", c);
|
|
64
71
|
}
|
|
65
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
|
+
}
|
|
66
85
|
if (options.cssFileNameTemplate) {
|
|
67
86
|
args.push("--css-file-name-template", options.cssFileNameTemplate);
|
|
68
87
|
}
|
|
69
88
|
if (options.cssPublicBase) {
|
|
70
89
|
args.push("--css-public-base", options.cssPublicBase);
|
|
71
90
|
}
|
|
91
|
+
if (options.theme)
|
|
92
|
+
args.push("--theme", options.theme);
|
|
72
93
|
if (options.outDir)
|
|
73
94
|
args.push("--out", options.outDir);
|
|
74
95
|
execFileSync(binPath, args, { stdio: "inherit" });
|
|
75
96
|
// CLI fallback does not return in-memory protocol.
|
|
76
97
|
if (options.outDir) {
|
|
77
98
|
const protocol = fs.readFileSync(nodePath.join(options.outDir, "protocol.bin"));
|
|
78
|
-
return {
|
|
99
|
+
return {
|
|
100
|
+
protocol,
|
|
101
|
+
cssFiles: [],
|
|
102
|
+
componentAssetFiles: readComponentAssetFiles(options.outDir),
|
|
103
|
+
warnings: [],
|
|
104
|
+
stats: emptyStats(),
|
|
105
|
+
};
|
|
79
106
|
}
|
|
80
|
-
return {
|
|
107
|
+
return {
|
|
108
|
+
protocol: Buffer.alloc(0),
|
|
109
|
+
cssFiles: [],
|
|
110
|
+
componentAssetFiles: [],
|
|
111
|
+
warnings: [],
|
|
112
|
+
stats: emptyStats(),
|
|
113
|
+
};
|
|
81
114
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return result;
|
|
98
|
-
}
|
|
99
|
-
warnFallback();
|
|
100
|
-
throw new Error("[webui] render() requires the native addon. WASM render fallback not yet wired.");
|
|
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;
|
|
101
130
|
}
|
|
131
|
+
// ── Runtime protocol API ─────────────────────────────────────────────
|
|
102
132
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
133
|
+
* A decoded protocol with reusable indices for all runtime operations.
|
|
134
|
+
*
|
|
135
|
+
* Create one instance when the server loads `protocol.bin` and share it
|
|
136
|
+
* across requests. Construction decodes and indexes the protocol once.
|
|
105
137
|
*/
|
|
106
|
-
export
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
138
|
+
export class Protocol {
|
|
139
|
+
#native;
|
|
140
|
+
constructor(protocolData, options) {
|
|
141
|
+
const native = loadAddon();
|
|
142
|
+
const NativeProtocol = native?.Protocol;
|
|
143
|
+
if (!NativeProtocol) {
|
|
144
|
+
warnFallback();
|
|
145
|
+
throw new Error("[webui] Native addon is incompatible: Protocol is required.");
|
|
146
|
+
}
|
|
147
|
+
this.#native = new NativeProtocol(protocolData, options?.plugin);
|
|
148
|
+
}
|
|
149
|
+
/** Render a complete HTML response as a UTF-8 Node.js buffer. */
|
|
150
|
+
render(state, options) {
|
|
151
|
+
const stateJson = typeof state === "string" ? state : JSON.stringify(state);
|
|
152
|
+
return this.#native.render(stateJson, options?.entry ?? "index.html", options?.requestPath ?? "/");
|
|
153
|
+
}
|
|
154
|
+
/** Stream a complete HTML response in chunks around 16 KiB. */
|
|
155
|
+
renderStream(state, onChunk, options) {
|
|
156
|
+
const stateJson = typeof state === "string" ? state : JSON.stringify(state);
|
|
157
|
+
this.#native.renderStream(stateJson, options?.entry ?? "index.html", options?.requestPath ?? "/", onChunk);
|
|
158
|
+
}
|
|
159
|
+
/** Produce a complete JSON partial-navigation response. */
|
|
160
|
+
renderPartial(state, entryId, requestPath, inventoryHex) {
|
|
161
|
+
const stateJson = typeof state === "string" ? state : JSON.stringify(state);
|
|
162
|
+
return this.#native.renderPartial(stateJson, entryId, requestPath, inventoryHex);
|
|
163
|
+
}
|
|
164
|
+
/** Render component templates and styles for on-demand loading. */
|
|
165
|
+
renderComponentTemplates(componentTags, inventoryHex) {
|
|
166
|
+
return this.#native.renderComponentTemplates(componentTags, inventoryHex);
|
|
167
|
+
}
|
|
168
|
+
/** Return CSS token names in build order. */
|
|
169
|
+
tokens() {
|
|
170
|
+
return this.#native.tokens();
|
|
114
171
|
}
|
|
115
|
-
warnFallback();
|
|
116
|
-
throw new Error("[webui] renderStream() requires the native addon. WASM render fallback not yet wired.");
|
|
117
|
-
}
|
|
118
|
-
// ── Convenience ──────────────────────────────────────────────────────
|
|
119
|
-
/** Build and render in a single call. */
|
|
120
|
-
export function buildAndRender(options, state, renderOpts) {
|
|
121
|
-
const result = build(options);
|
|
122
|
-
if (!result.protocol || result.protocol.length === 0) {
|
|
123
|
-
throw new Error("[webui] Build did not return protocol data.");
|
|
124
|
-
}
|
|
125
|
-
return render(result.protocol, state, renderOpts);
|
|
126
172
|
}
|
|
127
173
|
/** Inspect protocol bytes and return JSON representation. */
|
|
128
174
|
export function inspect(protocolData) {
|
|
@@ -132,43 +178,6 @@ export function inspect(protocolData) {
|
|
|
132
178
|
}
|
|
133
179
|
throw new Error("[webui] inspect() requires the native addon.");
|
|
134
180
|
}
|
|
135
|
-
/**
|
|
136
|
-
* Produce a complete JSON partial response for client-side navigation.
|
|
137
|
-
*
|
|
138
|
-
* Returns a JSON string with `state`, `templates`, `inventory`, `path`, and `chain`.
|
|
139
|
-
* Pipe directly to the HTTP response — no post-processing needed.
|
|
140
|
-
*
|
|
141
|
-
* If you need to inspect the response, parse it with the exported `PartialResponse` type:
|
|
142
|
-
* ```ts
|
|
143
|
-
* const partial: PartialResponse = JSON.parse(renderPartial(...));
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
146
|
-
export function renderPartial(protocolData, stateJson, entryId, requestPath, inventoryHex) {
|
|
147
|
-
const native = loadAddon();
|
|
148
|
-
if (native?.renderPartial) {
|
|
149
|
-
return native.renderPartial(protocolData, stateJson, entryId, requestPath, inventoryHex);
|
|
150
|
-
}
|
|
151
|
-
throw new Error("[webui] renderPartial() requires the native addon.");
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Render component templates and styles for on-demand loading.
|
|
155
|
-
*
|
|
156
|
-
* Used by `Router.ensureLoaded()` to fetch templates for components that
|
|
157
|
-
* are not part of the route tree (e.g., dialogs, popovers). Uses the same
|
|
158
|
-
* inventory bitfield as partial navigation to avoid sending duplicates.
|
|
159
|
-
*
|
|
160
|
-
* Returns a JSON string. Parse with the exported `ComponentTemplatesResponse` type:
|
|
161
|
-
* ```ts
|
|
162
|
-
* const resp: ComponentTemplatesResponse = JSON.parse(renderComponentTemplates(...));
|
|
163
|
-
* ```
|
|
164
|
-
*/
|
|
165
|
-
export function renderComponentTemplates(protocolData, componentTags, inventoryHex) {
|
|
166
|
-
const native = loadAddon();
|
|
167
|
-
if (native?.renderComponentTemplates) {
|
|
168
|
-
return native.renderComponentTemplates(protocolData, JSON.stringify(componentTags), inventoryHex);
|
|
169
|
-
}
|
|
170
|
-
throw new Error("[webui] renderComponentTemplates() requires the native addon.");
|
|
171
|
-
}
|
|
172
181
|
// ── Helpers ──────────────────────────────────────────────────────────
|
|
173
182
|
function emptyStats() {
|
|
174
183
|
return {
|
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,CAAC;AACzB,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;
|
|
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,CAAC;AACzB,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAmJ/C,IAAI,KAAK,GAAuB,IAAI,CAAC;AACrC,IAAI,cAAc,GAAG,KAAK,CAAC;AAE3B,SAAS,SAAS;IAChB,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IAExB,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,IAAI,SAAS,EAAE,CAAC;QACd,IAAI,CAAC;YACH,2EAA2E;YAC3E,IA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,EAAE,OAAO,EAAE,CAAC;QACpB,OAAO,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACtC,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;AAClE,CAAC;AAED,wEAAwE;AAExE,SAAS,UAAU;IACjB,OAAO;QACL,UAAU,EAAE,CAAC;QACb,aAAa,EAAE,CAAC;QAChB,cAAc,EAAE,CAAC;QACjB,YAAY,EAAE,CAAC;QACf,iBAAiB,EAAE,CAAC;QACpB,UAAU,EAAE,CAAC;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Plugin } from "esbuild";
|
|
2
|
+
/** Configuration for the official esbuild projection adapter. */
|
|
3
|
+
export interface EsbuildProjectionOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Manifest path. Relative values resolve from esbuild's `absWorkingDir`.
|
|
6
|
+
*
|
|
7
|
+
* Defaults to `<outdir>/webui-projection.json` or the directory containing
|
|
8
|
+
* `outfile`.
|
|
9
|
+
*/
|
|
10
|
+
readonly manifest?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Create the official esbuild projection plugin. */
|
|
13
|
+
export declare function esbuildProjection(options?: EsbuildProjectionOptions): Plugin;
|
|
14
|
+
//# sourceMappingURL=esbuild.d.ts.map
|
|
@@ -0,0 +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"}
|