@microsoft/webui 0.0.6 → 0.0.8

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/bin/webui ADDED
Binary file
package/dist/index.d.ts CHANGED
@@ -4,8 +4,8 @@ export interface BuildOptions {
4
4
  appDir: string;
5
5
  /** Entry HTML file name (default: "index.html"). */
6
6
  entry?: string;
7
- /** CSS delivery strategy: "link" (default) or "style". */
8
- css?: "link" | "style";
7
+ /** CSS delivery strategy: "link" (default), "style", or "module". */
8
+ css?: "link" | "style" | "module";
9
9
  /** Parser plugin (e.g., "fast" for FAST-HTML hydration). */
10
10
  plugin?: string;
11
11
  /** Additional component sources (npm packages or local paths). */
@@ -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,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAwB;AACxB,MAAM,WAAW,UAAU;IACzB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,aAAa,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,oCAAoC;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,8CAA8C;AAC9C,MAAM,WAAW,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AI,CAcN;AAID,yCAAyC;AACzC,wBAAgB,cAAc,CAC5B,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,UAAU,CAAC,EAAE,aAAa,GACzB,MAAM,CAMR;AAED,6DAA6D;AAC7D,wBAAgB,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAMpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,MAAM,CAMR"}
package/dist/index.js CHANGED
@@ -1,132 +1,158 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
1
3
  import { createRequire } from "node:module";
2
4
  import { execFileSync } from "node:child_process";
3
5
  import fs from "node:fs";
4
6
  import nodePath from "node:path";
5
7
  import { resolve, platformKey } from "./platform.js";
6
- const require2 = createRequire(import.meta.url);
8
+ const require = createRequire(import.meta.url);
7
9
  let addon = null;
8
10
  let fallbackWarned = false;
9
11
  function loadAddon() {
10
- if (addon) return addon;
11
- const addonPath = resolve("addon");
12
- if (addonPath) {
13
- try {
14
- if (addonPath.endsWith(".node")) {
15
- addon = require2(addonPath);
16
- } else {
17
- const m = { exports: {} };
18
- process.dlopen(m, addonPath);
19
- addon = m.exports;
20
- }
21
- return addon;
22
- } catch {
12
+ if (addon)
13
+ return addon;
14
+ 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;
27
+ }
28
+ catch {
29
+ // Fall through to WASM.
30
+ }
23
31
  }
24
- }
25
- return null;
32
+ return null;
26
33
  }
27
34
  function warnFallback() {
28
- if (fallbackWarned) return;
29
- fallbackWarned = true;
30
- console.warn(
31
- `[webui] Native addon not available for ${platformKey()}. Using WASM fallback \u2014 performance may be degraded.
32
- Install the platform-specific package for optimal performance.`
33
- );
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.`);
34
41
  }
35
- function build(options) {
36
- const native = loadAddon();
37
- if (native?.build) {
38
- return native.build(options);
39
- }
40
- const binPath = resolve("bin");
41
- if (!binPath) {
42
- throw new Error(
43
- "[webui] Cannot build: no native addon or CLI binary available."
44
- );
45
- }
46
- const args = ["build", options.appDir ?? "."];
47
- if (options.entry) args.push("--entry", options.entry);
48
- if (options.css) args.push("--css", options.css);
49
- if (options.plugin) args.push("--plugin", options.plugin);
50
- if (options.components) {
51
- for (const c of options.components) {
52
- args.push("--components", c);
42
+ // ── Build API ────────────────────────────────────────────────────────
43
+ /** Build a WebUI application from an app directory. */
44
+ export function build(options) {
45
+ const native = loadAddon();
46
+ if (native?.build) {
47
+ return native.build(options);
53
48
  }
54
- }
55
- if (options.outDir) args.push("--out", options.outDir);
56
- execFileSync(binPath, args, { stdio: "inherit" });
57
- if (options.outDir) {
58
- const protocol = fs.readFileSync(nodePath.join(options.outDir, "protocol.bin"));
59
- return { protocol, cssFiles: [], stats: emptyStats() };
60
- }
61
- return { protocol: Buffer.alloc(0), cssFiles: [], stats: emptyStats() };
49
+ // Fallback: shell out to CLI binary.
50
+ const binPath = resolve("bin");
51
+ if (!binPath) {
52
+ throw new Error("[webui] Cannot build: no native addon or CLI binary available.");
53
+ }
54
+ const args = ["build", options.appDir ?? "."];
55
+ if (options.entry)
56
+ args.push("--entry", options.entry);
57
+ if (options.css)
58
+ args.push("--css", options.css);
59
+ if (options.plugin)
60
+ args.push("--plugin", options.plugin);
61
+ if (options.components) {
62
+ for (const c of options.components) {
63
+ args.push("--components", c);
64
+ }
65
+ }
66
+ if (options.outDir)
67
+ args.push("--out", options.outDir);
68
+ execFileSync(binPath, args, { stdio: "inherit" });
69
+ // CLI fallback does not return in-memory protocol.
70
+ if (options.outDir) {
71
+ const protocol = fs.readFileSync(nodePath.join(options.outDir, "protocol.bin"));
72
+ return { protocol, cssFiles: [], stats: emptyStats() };
73
+ }
74
+ return { protocol: Buffer.alloc(0), cssFiles: [], stats: emptyStats() };
62
75
  }
63
- function render(protocol, state, options) {
64
- const native = loadAddon();
65
- if (native) {
66
- let result = "";
67
- const stateStr = typeof state === "string" ? state : JSON.stringify(state);
68
- const entry = options?.entry ?? "index.html";
69
- const requestPath = options?.requestPath ?? "/";
70
- native.render(protocol, stateStr, entry, requestPath, (chunk) => {
71
- result += chunk;
72
- }, options?.plugin);
73
- return result;
74
- }
75
- warnFallback();
76
- throw new Error(
77
- "[webui] render() requires the native addon. WASM render fallback not yet wired."
78
- );
76
+ // ── Render API ───────────────────────────────────────────────────────
77
+ /**
78
+ * Render a pre-compiled protocol with state data.
79
+ * Uses native addon when available, WASM fallback otherwise.
80
+ */
81
+ export function render(protocol, state, options) {
82
+ const native = loadAddon();
83
+ if (native) {
84
+ let result = "";
85
+ const stateStr = typeof state === "string" ? state : JSON.stringify(state);
86
+ const entry = options?.entry ?? "index.html";
87
+ const requestPath = options?.requestPath ?? "/";
88
+ native.render(protocol, stateStr, entry, requestPath, (chunk) => {
89
+ result += chunk;
90
+ }, options?.plugin);
91
+ return result;
92
+ }
93
+ warnFallback();
94
+ throw new Error("[webui] render() requires the native addon. WASM render fallback not yet wired.");
79
95
  }
80
- function renderStream(protocol, state, onChunk, options) {
81
- const native = loadAddon();
82
- if (native) {
83
- const stateStr = typeof state === "string" ? state : JSON.stringify(state);
84
- const entry = options?.entry ?? "index.html";
85
- const requestPath = options?.requestPath ?? "/";
86
- native.render(protocol, stateStr, entry, requestPath, onChunk, options?.plugin);
87
- return;
88
- }
89
- warnFallback();
90
- throw new Error(
91
- "[webui] renderStream() requires the native addon. WASM render fallback not yet wired."
92
- );
96
+ /**
97
+ * Render a protocol with streaming output.
98
+ * Each HTML fragment is passed to the onChunk callback as it is produced.
99
+ */
100
+ export function renderStream(protocol, state, onChunk, options) {
101
+ const native = loadAddon();
102
+ if (native) {
103
+ const stateStr = typeof state === "string" ? state : JSON.stringify(state);
104
+ const entry = options?.entry ?? "index.html";
105
+ const requestPath = options?.requestPath ?? "/";
106
+ native.render(protocol, stateStr, entry, requestPath, onChunk, options?.plugin);
107
+ return;
108
+ }
109
+ warnFallback();
110
+ throw new Error("[webui] renderStream() requires the native addon. WASM render fallback not yet wired.");
93
111
  }
94
- function buildAndRender(options, state, renderOpts) {
95
- const result = build(options);
96
- if (!result.protocol || result.protocol.length === 0) {
97
- throw new Error("[webui] Build did not return protocol data.");
98
- }
99
- return render(result.protocol, state, renderOpts);
112
+ // ── Convenience ──────────────────────────────────────────────────────
113
+ /** Build and render in a single call. */
114
+ export function buildAndRender(options, state, renderOpts) {
115
+ const result = build(options);
116
+ if (!result.protocol || result.protocol.length === 0) {
117
+ throw new Error("[webui] Build did not return protocol data.");
118
+ }
119
+ return render(result.protocol, state, renderOpts);
100
120
  }
101
- function inspect(protocolData) {
102
- const native = loadAddon();
103
- if (native?.inspect) {
104
- return native.inspect(protocolData);
105
- }
106
- throw new Error("[webui] inspect() requires the native addon.");
121
+ /** Inspect protocol bytes and return JSON representation. */
122
+ export function inspect(protocolData) {
123
+ const native = loadAddon();
124
+ if (native?.inspect) {
125
+ return native.inspect(protocolData);
126
+ }
127
+ throw new Error("[webui] inspect() requires the native addon.");
107
128
  }
108
- function renderPartial(protocolData, stateJson, entryId, requestPath, inventoryHex) {
109
- const native = loadAddon();
110
- if (native?.renderPartial) {
111
- return native.renderPartial(protocolData, stateJson, entryId, requestPath, inventoryHex);
112
- }
113
- throw new Error("[webui] renderPartial() requires the native addon.");
129
+ /**
130
+ * Produce a complete JSON partial response for client-side navigation.
131
+ *
132
+ * Returns a JSON string with `state`, `templates`, `inventory`, `path`, and `chain`.
133
+ * Pipe directly to the HTTP response — no post-processing needed.
134
+ *
135
+ * If you need to inspect the response, parse it with the exported `PartialResponse` type:
136
+ * ```ts
137
+ * const partial: PartialResponse = JSON.parse(renderPartial(...));
138
+ * ```
139
+ */
140
+ export function renderPartial(protocolData, stateJson, entryId, requestPath, inventoryHex) {
141
+ const native = loadAddon();
142
+ if (native?.renderPartial) {
143
+ return native.renderPartial(protocolData, stateJson, entryId, requestPath, inventoryHex);
144
+ }
145
+ throw new Error("[webui] renderPartial() requires the native addon.");
114
146
  }
147
+ // ── Helpers ──────────────────────────────────────────────────────────
115
148
  function emptyStats() {
116
- return {
117
- durationMs: 0,
118
- fragmentCount: 0,
119
- componentCount: 0,
120
- cssFileCount: 0,
121
- protocolSizeBytes: 0,
122
- tokenCount: 0
123
- };
149
+ return {
150
+ durationMs: 0,
151
+ fragmentCount: 0,
152
+ componentCount: 0,
153
+ cssFileCount: 0,
154
+ protocolSizeBytes: 0,
155
+ tokenCount: 0,
156
+ };
124
157
  }
125
- export {
126
- build,
127
- buildAndRender,
128
- inspect,
129
- render,
130
- renderPartial,
131
- renderStream
132
- };
158
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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;AAiG/C,IAAI,KAAK,GAAuB,IAAI,CAAC;AACr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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"}
package/dist/install.js CHANGED
@@ -1,23 +1,40 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
1
3
  import fs from "node:fs";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
2
6
  import { resolve, platformKey, packageName } from "./platform.js";
7
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
+ const binDir = path.resolve(__dirname, "..", "bin");
9
+ const binName = process.platform === "win32" ? "webui.exe" : "webui";
10
+ const binDest = path.join(binDir, binName);
11
+ // Locate the platform binary and copy it into bin/ so the package.json
12
+ // "bin" entry points at a real native executable.
3
13
  try {
4
- const binPath = resolve("bin");
5
- if (binPath && fs.existsSync(binPath)) {
6
- process.exit(0);
7
- }
8
- } catch {
14
+ const srcBin = resolve("bin");
15
+ if (srcBin && fs.existsSync(srcBin)) {
16
+ fs.mkdirSync(binDir, { recursive: true });
17
+ fs.copyFileSync(srcBin, binDest);
18
+ fs.chmodSync(binDest, 0o755);
19
+ process.exit(0);
20
+ }
21
+ }
22
+ catch {
23
+ // Fall through to warning.
9
24
  }
10
25
  const key = platformKey();
11
26
  let pkg;
12
27
  try {
13
- pkg = packageName();
14
- } catch {
15
- console.warn(
16
- `[webui] Warning: Unsupported platform ${key}. The webui CLI will not be available. Set WEBUI_BINARY_PATH to use a custom binary.`
17
- );
18
- process.exit(0);
28
+ pkg = packageName();
29
+ }
30
+ catch {
31
+ console.warn(`[webui] Warning: Unsupported platform ${key}. ` +
32
+ `The webui CLI will not be available. ` +
33
+ `Set WEBUI_BINARY_PATH to use a custom binary.`);
34
+ process.exit(0);
19
35
  }
20
- console.warn(
21
- `[webui] Warning: Platform package ${pkg} was not installed. This usually means your package manager was run with --no-optional. The webui CLI and native addon will not be available.
22
- To fix: reinstall without --no-optional, or set WEBUI_BINARY_PATH.`
23
- );
36
+ console.warn(`[webui] Warning: Platform package ${pkg} was not installed. ` +
37
+ `This usually means your package manager was run with --no-optional. ` +
38
+ `The webui CLI and native addon will not be available.\n` +
39
+ `To fix: reinstall without --no-optional, or set WEBUI_BINARY_PATH.`);
40
+ //# sourceMappingURL=install.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.js","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAElE,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AACpD,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC;AACrE,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE3C,uEAAuE;AACvE,kDAAkD;AAClD,IAAI,CAAC;IACH,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9B,IAAI,MAAM,IAAI,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACpC,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1C,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjC,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC7B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAAC,MAAM,CAAC;IACP,2BAA2B;AAC7B,CAAC;AAED,MAAM,GAAG,GAAG,WAAW,EAAE,CAAC;AAC1B,IAAI,GAAuB,CAAC;AAC5B,IAAI,CAAC;IACH,GAAG,GAAG,WAAW,EAAE,CAAC;AACtB,CAAC;AAAC,MAAM,CAAC;IACP,OAAO,CAAC,IAAI,CACV,yCAAyC,GAAG,IAAI;QAC9C,uCAAuC;QACvC,+CAA+C,CAClD,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,OAAO,CAAC,IAAI,CACV,qCAAqC,GAAI,sBAAsB;IAC7D,sEAAsE;IACtE,yDAAyD;IACzD,oEAAoE,CACvE,CAAC"}
package/dist/platform.js CHANGED
@@ -1,75 +1,95 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
1
3
  import { createRequire } from "node:module";
2
4
  import { existsSync } from "node:fs";
3
5
  import os from "node:os";
4
6
  import path from "node:path";
5
7
  import { fileURLToPath } from "node:url";
6
- const require2 = createRequire(import.meta.url);
8
+ const require = createRequire(import.meta.url);
7
9
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
10
  const PLATFORMS = {
9
- "darwin-arm64": "@microsoft/webui-darwin-arm64",
10
- "darwin-x64": "@microsoft/webui-darwin-x64",
11
- "linux-x64": "@microsoft/webui-linux-x64",
12
- "linux-arm64": "@microsoft/webui-linux-arm64",
13
- "win32-x64": "@microsoft/webui-win32-x64",
14
- "win32-arm64": "@microsoft/webui-win32-arm64"
11
+ "darwin-arm64": "@microsoft/webui-darwin-arm64",
12
+ "darwin-x64": "@microsoft/webui-darwin-x64",
13
+ "linux-x64": "@microsoft/webui-linux-x64",
14
+ "linux-arm64": "@microsoft/webui-linux-arm64",
15
+ "win32-x64": "@microsoft/webui-win32-x64",
16
+ "win32-arm64": "@microsoft/webui-win32-arm64",
15
17
  };
16
18
  const ADDON_NAMES = {
17
- darwin: "libwebui_node.dylib",
18
- linux: "libwebui_node.so",
19
- win32: "webui_node.dll"
19
+ darwin: "libwebui_node.dylib",
20
+ linux: "libwebui_node.so",
21
+ win32: "webui_node.dll",
20
22
  };
21
- function platformKey() {
22
- return `${process.platform}-${os.arch()}`;
23
+ export function platformKey() {
24
+ return `${process.platform}-${os.arch()}`;
23
25
  }
24
- function packageName() {
25
- const key = platformKey();
26
- const name = PLATFORMS[key];
27
- if (!name) {
28
- throw new Error(
29
- `[webui] Unsupported platform: ${key}. Supported: ${Object.keys(PLATFORMS).join(", ")}`
30
- );
31
- }
32
- return name;
26
+ export function packageName() {
27
+ const key = platformKey();
28
+ const name = PLATFORMS[key];
29
+ if (!name) {
30
+ throw new Error(`[webui] Unsupported platform: ${key}. ` +
31
+ `Supported: ${Object.keys(PLATFORMS).join(", ")}`);
32
+ }
33
+ return name;
33
34
  }
34
- function resolve(kind) {
35
- if (kind === "bin" && process.env["WEBUI_BINARY_PATH"]) {
36
- return process.env["WEBUI_BINARY_PATH"];
37
- }
38
- if (kind === "addon" && process.env["WEBUI_ADDON_PATH"]) {
39
- return process.env["WEBUI_ADDON_PATH"];
40
- }
41
- try {
42
- const pkg = packageName();
43
- const pkgDir = path.dirname(require2.resolve(`${pkg}/package.json`));
35
+ /**
36
+ * Resolve a file from the platform-specific package, with fallback to
37
+ * local cargo build output for workspace development.
38
+ *
39
+ * @param kind — "bin" for CLI binary, "addon" for .node file
40
+ * @returns Absolute path, or null if not found.
41
+ */
42
+ export function resolve(kind) {
43
+ // Environment variable overrides
44
+ if (kind === "bin" && process.env["WEBUI_BINARY_PATH"]) {
45
+ return process.env["WEBUI_BINARY_PATH"];
46
+ }
47
+ if (kind === "addon" && process.env["WEBUI_ADDON_PATH"]) {
48
+ return process.env["WEBUI_ADDON_PATH"];
49
+ }
50
+ // Try platform-specific npm package
51
+ try {
52
+ const pkg = packageName();
53
+ const pkgDir = path.dirname(require.resolve(`${pkg}/package.json`));
54
+ if (kind === "bin") {
55
+ const binName = process.platform === "win32" ? "webui.exe" : "webui";
56
+ const binPath = path.join(pkgDir, "bin", binName);
57
+ if (existsSync(binPath))
58
+ return binPath;
59
+ }
60
+ else {
61
+ const addonPath = path.join(pkgDir, "webui.node");
62
+ if (existsSync(addonPath))
63
+ return addonPath;
64
+ }
65
+ }
66
+ catch {
67
+ // Fall through to workspace fallback
68
+ }
69
+ // Workspace fallback: look for cargo build output.
70
+ // __dirname is packages/webui/dist (compiled) or packages/webui/src (source)
71
+ // so ../../.. reaches the workspace root.
72
+ const workspaceRoot = path.resolve(__dirname, "..", "..", "..");
73
+ const releasePath = path.join(workspaceRoot, "target", "release");
44
74
  if (kind === "bin") {
45
- const binName = process.platform === "win32" ? "webui.exe" : "webui";
46
- const binPath = path.join(pkgDir, "bin", binName);
47
- if (existsSync(binPath)) return binPath;
48
- } else {
49
- const addonPath = path.join(pkgDir, "webui.node");
50
- if (existsSync(addonPath)) return addonPath;
75
+ const binName = process.platform === "win32" ? "webui.exe" : "webui";
76
+ const binPath = path.join(releasePath, binName);
77
+ if (existsSync(binPath))
78
+ return binPath;
79
+ // Also check debug
80
+ const debugPath = path.join(workspaceRoot, "target", "debug", binName);
81
+ if (existsSync(debugPath))
82
+ return debugPath;
83
+ }
84
+ else {
85
+ const addonName = ADDON_NAMES[process.platform] ?? "libwebui_node.so";
86
+ const addonPath = path.join(releasePath, addonName);
87
+ if (existsSync(addonPath))
88
+ return addonPath;
89
+ const debugPath = path.join(workspaceRoot, "target", "debug", addonName);
90
+ if (existsSync(debugPath))
91
+ return debugPath;
51
92
  }
52
- } catch {
53
- }
54
- const workspaceRoot = path.resolve(__dirname, "..", "..", "..");
55
- const releasePath = path.join(workspaceRoot, "target", "release");
56
- if (kind === "bin") {
57
- const binName = process.platform === "win32" ? "webui.exe" : "webui";
58
- const binPath = path.join(releasePath, binName);
59
- if (existsSync(binPath)) return binPath;
60
- const debugPath = path.join(workspaceRoot, "target", "debug", binName);
61
- if (existsSync(debugPath)) return debugPath;
62
- } else {
63
- const addonName = ADDON_NAMES[process.platform] ?? "libwebui_node.so";
64
- const addonPath = path.join(releasePath, addonName);
65
- if (existsSync(addonPath)) return addonPath;
66
- const debugPath = path.join(workspaceRoot, "target", "debug", addonName);
67
- if (existsSync(debugPath)) return debugPath;
68
- }
69
- return null;
93
+ return null;
70
94
  }
71
- export {
72
- packageName,
73
- platformKey,
74
- resolve
75
- };
95
+ //# sourceMappingURL=platform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,MAAM,SAAS,GAA2B;IACxC,cAAc,EAAE,+BAA+B;IAC/C,YAAY,EAAE,6BAA6B;IAC3C,WAAW,EAAE,4BAA4B;IACzC,aAAa,EAAE,8BAA8B;IAC7C,WAAW,EAAE,4BAA4B;IACzC,aAAa,EAAE,8BAA8B;CAC9C,CAAC;AAEF,MAAM,WAAW,GAA2B;IAC1C,MAAM,EAAE,qBAAqB;IAC7B,KAAK,EAAE,kBAAkB;IACzB,KAAK,EAAE,gBAAgB;CACxB,CAAC;AA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,CAAC,SAAS,CAAC;YAAE,OAAO,SAAS,CAAC;QAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QACzE,IAAI,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO,SAAS,CAAC;IAC9C,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,21 @@
1
1
  {
2
+ "name": "@microsoft/webui",
3
+ "description": "WebUI — high-performance server-side rendering framework. Build-time protocol compiler and streaming renderer.",
4
+ "license": "MIT",
5
+ "version": "0.0.8",
6
+ "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/microsoft/webui.git"
10
+ },
2
11
  "bin": {
3
12
  "webui": "bin/webui"
4
13
  },
5
- "description": "WebUI — high-performance server-side rendering framework. Build-time protocol compiler and streaming renderer.",
6
- "devDependencies": {
7
- "@types/node": "^25.3.5",
8
- "esbuild": "^0.27.3",
9
- "typescript": "^5.9.3"
10
- },
14
+ "files": [
15
+ "bin/",
16
+ "dist/",
17
+ "wasm/"
18
+ ],
11
19
  "engines": {
12
20
  "node": ">=18"
13
21
  },
@@ -19,30 +27,22 @@
19
27
  }
20
28
  }
21
29
  },
22
- "files": [
23
- "bin/",
24
- "dist/",
25
- "wasm/"
26
- ],
27
- "license": "MIT",
28
- "name": "@microsoft/webui",
29
30
  "optionalDependencies": {
30
- "@microsoft/webui-darwin-arm64": "0.0.6",
31
- "@microsoft/webui-linux-arm64": "0.0.6",
32
- "@microsoft/webui-linux-x64": "0.0.6",
33
- "@microsoft/webui-win32-x64": "0.0.6",
34
- "@microsoft/webui-win32-arm64": "0.0.6",
35
- "@microsoft/webui-darwin-x64": "0.0.6"
31
+ "@microsoft/webui-darwin-x64": "0.0.8",
32
+ "@microsoft/webui-linux-arm64": "0.0.8",
33
+ "@microsoft/webui-linux-x64": "0.0.8",
34
+ "@microsoft/webui-win32-arm64": "0.0.8",
35
+ "@microsoft/webui-win32-x64": "0.0.8",
36
+ "@microsoft/webui-darwin-arm64": "0.0.8"
36
37
  },
37
- "repository": {
38
- "type": "git",
39
- "url": "https://github.com/microsoft/webui.git"
38
+ "devDependencies": {
39
+ "@types/node": "^25.3.5",
40
+ "typescript": "^5.9.3"
40
41
  },
41
- "type": "module",
42
- "version": "0.0.6",
43
42
  "scripts": {
44
- "build": "esbuild src/index.ts src/platform.ts src/install.ts --outdir=dist --format=esm --platform=node && tsc --emitDeclarationOnly",
43
+ "build": "tsc",
44
+ "postbuild": "node dist/install.js",
45
45
  "postinstall": "node --input-type=module -e \"try{await import('./dist/install.js')}catch{}\"",
46
- "test": "esbuild test/integration.test.ts --outfile=test/integration.test.js --format=esm --platform=node && node --test test/integration.test.js"
46
+ "test": "tsc --project tsconfig.test.json && node --test dist/test/integration.test.js"
47
47
  }
48
48
  }