npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@microsoft/webui

v0.0.2

Published

WebUI — high-performance server-side rendering framework. Build-time protocol compiler and streaming renderer.

Downloads

179

Readme

@microsoft/webui

High-performance server-side rendering framework. Compiles HTML templates into a binary protocol at build time and renders them with native speed at runtime — no JavaScript runtime overhead.

Installation

npm install @microsoft/webui

The package automatically installs the correct platform-specific native binary for your OS and architecture (Windows, macOS, Linux — x64 and arm64).

Quick start

import { build, render } from "@microsoft/webui";

// Build templates into a protocol
const result = build({ appDir: "./src" });

// Render with state data
const html = render(result.protocol, { name: "World", items: ["a", "b"] });
console.log(html);

API

build(options: BuildOptions): BuildResult

Compiles an application directory of HTML templates into a binary protocol.

const result = build({
  appDir: "./src",        // Path to the template directory
  entry: "index.html",   // Entry file (default: "index.html")
  css: "link",           // CSS strategy: "link" or "style"
  plugin: "fast",        // Parser plugin (e.g., "fast" for FAST-HTML)
  components: [],        // Additional component sources
  outDir: "./dist",      // Output directory for CLI fallback
});

// result.protocol  — Buffer containing the compiled protocol
// result.cssFiles  — Array of [filename, content, ...] pairs
// result.stats     — { durationMs, fragmentCount, componentCount, cssFileCount, protocolSizeBytes, tokenCount }

render(protocol: Buffer, state: object | string): string

Renders a compiled protocol with state data and returns the full HTML string.

const html = render(protocol, { title: "Hello", show: true });

renderStream(protocol: Buffer, state: object | string, onChunk: (html: string) => void): void

Renders with streaming output — each HTML fragment is passed to the callback as it is produced.

renderStream(protocol, state, (chunk) => {
  response.write(chunk);
});

buildAndRender(options: BuildOptions, state: object | string): string

Convenience function that builds and renders in a single call.

const html = buildAndRender({ appDir: "./src" }, { name: "WebUI" });

inspect(protocol: Buffer): string

Returns a JSON representation of the protocol for debugging.

const json = inspect(protocol);
console.log(JSON.parse(json));

renderPartial(protocol: Buffer, stateJson: string, entryId: string, requestPath: string, inventoryHex: string): string

Produces a JSON partial response for client-side navigation, including state, templates, and route chain.

CLI

The package also includes the webui CLI binary:

# Build templates to disk
npx webui build ./src --out ./dist

# Start a dev server
npx webui serve ./src --state ./data/state.json --port 3000

# Inspect a compiled protocol
npx webui inspect ./dist/protocol.bin

Platform support

| OS | Architecture | Package | |---|---|---| | Windows | x64 | @microsoft/webui-win32-x64 | | Windows | arm64 | @microsoft/webui-win32-arm64 | | macOS | arm64 | @microsoft/webui-darwin-arm64 | | macOS | x64 | @microsoft/webui-darwin-x64 | | Linux | x64 | @microsoft/webui-linux-x64 | | Linux | arm64 | @microsoft/webui-linux-arm64 |

Platform-specific packages are installed automatically as optional dependencies.

License

MIT