@wrnexus/playground
Interactive framework examples and executable playground utilities.
Install the package
After WorkRoot approves private registry access, install the release-aligned package:
bun add @wrnexus/playground@0.8.7Request preview access. Never put registry tokens in source control.
A deployable, shareable .wrn playground with diagnostics, generated JavaScript, safe SSR-shaped HTML, sandboxed preview, reactive/UI examples, and version adapters.
Run wrnexus playground, or deploy createPlaygroundHandler().
Complete TypeScript API
Generated from the exact installed package declarations.
interface PlaygroundCompilation {
source: string;
generated: string;
client: string;
html: string;
interactiveHtml: string;
diagnostics: Array<{
code: string;
message: string;
severity: string;
}>;
version: string;
}
interface PlaygroundVersionAdapter {
version: string;
compile(source: string): Promise<Omit<PlaygroundCompilation, "source" | "version">>;
}
declare function compilePlayground(source: string, version?: string): PlaygroundCompilation;
declare function encodePlaygroundShare(source: string): string;
declare function decodePlaygroundShare(value: string): string;
declare function comparePlaygroundVersions(source: string, adapters: PlaygroundVersionAdapter[]): Promise<{
current: PlaygroundCompilation;
comparisons: {
generated: string;
client: string;
html: string;
interactiveHtml: string;
diagnostics: Array<{
code: string;
message: string;
severity: string;
}>;
version: string;
}[];
}>;
declare function createPlaygroundHandler(options?: {
versions?: PlaygroundVersionAdapter[];
examples?: Record<string, string>;
}): (request: Request) => Promise<Response>;
export { type PlaygroundCompilation, type PlaygroundVersionAdapter, comparePlaygroundVersions, compilePlayground, createPlaygroundHandler, decodePlaygroundShare, encodePlaygroundShare };
Examples
Copy-ready examples from the installed package documentation.
Install @wrnexus/playground
bun add @wrnexus/playgroundImport @wrnexus/playground
import * as playground from "@wrnexus/playground";