Skip to content

fix(webui): use @microsoft/webui package in integration examples and fix render() signature#133

Merged
mohamedmansour merged 2 commits intomainfrom
akroshg/integration-examples-use-webui-package
Mar 25, 2026
Merged

fix(webui): use @microsoft/webui package in integration examples and fix render() signature#133
mohamedmansour merged 2 commits intomainfrom
akroshg/integration-examples-use-webui-package

Conversation

@akroshg
Copy link
Copy Markdown
Contributor

@akroshg akroshg commented Mar 25, 2026

Summary

Closes #130

Two changes in this PR:

1. Fix render() TypeScript wrapper (bug fix)

The Rust
ender()\ native addon function added \�ntry\ and
equest_path\ parameters during the routing rearchitecture (commit 91d5a5e) but the TypeScript \NativeAddon\ interface was never updated. This caused a \StringExpected\ runtime error when calling
ender()\ or
enderStream()\ from the @microsoft/webui\ package.

  • Updated \NativeAddon.render()\ interface to include \�ntry\ and
    equestPath\
  • Added \RenderOptions\ interface with \�ntry,
    equestPath, and \plugin\ fields
  • Updated
    ender(),
    enderStream(), and \�uildAndRender()\ to pass the new args

2. Migrate integration examples to use @microsoft/webui\ package

Both the Node.js and Electron integration examples previously used a manual \loadAddon()\ that searched \ arget/debug|release/\ for the native .dll/.so/.dylib. This bypassed the @microsoft/webui\ package entirely, meaning it didn't validate the actual package API.

Node example (\�xamples/integration/node):

  • Added @microsoft/webui\ as a workspace dependency
  • Replaced manual \loadAddon()\ with \import { build, render, renderStream } from '@microsoft/webui'\
  • Supports two modes: build+render (default) and pre-built protocol

Electron example (\�xamples/integration/electron):

  • Added @microsoft/webui\ as a workspace dependency
  • Replaced manual \process.dlopen()\ with \import { renderStream } from '@microsoft/webui'\
  • Added --packages=external\ to esbuild so the dependency isn't bundled
  • Fixed stale --css external\ in README (now --css link)

Testing

  • \cargo xtask check\ passes (1 pre-existing test failure in \webui-discovery\ unrelated to this change)
  • \pnpm --filter @microsoft/webui test\ all 10 integration tests pass
  • Node example tested: both default and pre-built protocol modes produce correct HTML
  • Electron example: esbuild compilation succeeds

akroshg and others added 2 commits March 25, 2026 14:20
The Rust render() function added entry and request_path parameters
in the routing rearchitecture (commit 91d5a5e) but the TypeScript
NativeAddon interface and render/renderStream wrappers were not
updated, causing a StringExpected error at runtime.

- Update NativeAddon.render() to include entry and requestPath args
- Add RenderOptions interface for entry, requestPath, and plugin
- Pass entry (default: index.html) and requestPath (default: /)
  through render(), renderStream(), and buildAndRender()

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace manual loadAddon() with import from @microsoft/webui in both
the Node.js and Electron integration examples. This validates that
the published npm package works correctly through the workspace.

Node example:
- Add @microsoft/webui workspace dependency
- Use build() and render() API instead of direct dlopen
- Support both build+render (default) and pre-built protocol modes

Electron example:
- Add @microsoft/webui workspace dependency with --packages=external
- Use renderStream() instead of manual process.dlopen()
- Fix stale --css external flag in README (now --css link)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mohamedmansour mohamedmansour merged commit f242671 into main Mar 25, 2026
21 checks passed
@mohamedmansour mohamedmansour deleted the akroshg/integration-examples-use-webui-package branch March 25, 2026 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

example: update the integrations/node and integrations/electron to use @microsoft/webui

2 participants