docs: update portal for WRNexusJS 0.8.5

This commit is contained in:
2026-08-07 15:55:24 +05:30
parent 6ceae24497
commit be24c6cad6
100 changed files with 5033 additions and 1050 deletions
+45 -4
View File
@@ -10,11 +10,11 @@ page wrnexusdevserver {
<header class="topbar">
<a class="brand" href="/"><span>W</span> WRNexusJS</a>
<nav aria-label="Primary"><a href="/getting-started">Get started</a><a href="/packages">Packages</a><a href="https://component.wrnexusjs.dev/">Components</a><a href="/language">Language</a><a href="/architecture">Architecture</a></nav>
<div class="topbar-actions"><a class="preview-pill" href="/access">Private preview · v0.8.4</a><button data-wire-theme-toggle class="theme-button" aria-label="Toggle color theme" title="Toggle color theme">◐</button></div>
<div class="topbar-actions"><a class="preview-pill" href="/access">Private preview · v0.8.5</a><button data-wire-theme-toggle class="theme-button" aria-label="Toggle color theme" title="Toggle color theme">◐</button></div>
</header>
<div class="mobile-doc-nav"><details><summary>Browse documentation</summary><nav><a href="/getting-started">Get started</a><a href="/packages">Packages</a><a href="https://component.wrnexusjs.dev/">Components</a><a href="/language">Language</a><a href="/architecture">Architecture</a><a href="/tutorial">Tutorial</a><a href="/guides/project-structure">Guides</a><a href="/examples">Examples</a><a href="/search">Search</a></nav></details></div>
<main class="portal-main docs-layout">
<article id="main" class="documentation prose standalone package-document"><nav class="breadcrumbs" aria-label="Breadcrumb"><a href="/">Home</a><span>/</span><a href="/packages">Packages</a><span>/</span><span aria-current="page">@wrnexus/dev-server</span></nav><section class="doc-intro"><span class="eyebrow">Runtime · Package reference</span><h1>@wrnexus/dev-server</h1><p>Development and production servers, HMR, assets, and gateways.</p><div class="doc-meta"><span>v0.8.4</span><span>Private registry</span><span>Runtime</span></div><section id="access" class="access-callout"><h2>Install the package</h2><p>After WorkRoot approves private registry access, install the release-aligned package:</p><pre><code>bun add @wrnexus/dev-server@0.8.4</code><button type="button" class="copy-button" aria-label="Copy installation command">Copy</button></pre><p><a href="/access">Request preview access</a>. Never put registry tokens in source control.</p></section></section><section id="guide"><blockquote>The WRNexusJS HTTP + WebSocket server runtime — request dispatch, SSR document assembly, live-reload (HMR), and the portable production handler.</blockquote>
<article id="main" class="documentation prose standalone package-document"><nav class="breadcrumbs" aria-label="Breadcrumb"><a href="/">Home</a><span>/</span><a href="/packages">Packages</a><span>/</span><span aria-current="page">@wrnexus/dev-server</span></nav><section class="doc-intro"><span class="eyebrow">Runtime · Package reference</span><h1>@wrnexus/dev-server</h1><p>Development and production servers, HMR, assets, and gateways.</p><div class="doc-meta"><span>v0.8.5</span><span>Private registry</span><span>Runtime</span></div><section id="access" class="access-callout"><h2>Install the package</h2><p>After WorkRoot approves private registry access, install the release-aligned package:</p><pre><code>bun add @wrnexus/dev-server@0.8.5</code><button type="button" class="copy-button" aria-label="Copy installation command">Copy</button></pre><p><a href="/access">Request preview access</a>. Never put registry tokens in source control.</p></section></section><section id="guide"><blockquote>The WRNexusJS HTTP + WebSocket server runtime — request dispatch, SSR document assembly, live-reload (HMR), and the portable production handler.</blockquote>
<p>Part of the <strong>WRNexusJS</strong> framework — an SSR-first, Bun-native full-stack web framework.</p>
<h3 id="overview">Overview</h3>
<p>This package is the server runtime that powers a WRNexusJS app in both development and production. A single <strong>request runtime</strong> (<code>createHandlers</code>) owns HTTP/WebSocket dispatch and SSR document assembly; it knows nothing about _how_ modules and assets are produced, so the dev and prod entry points wire in different backends: dev uses dynamic module loading plus on-the-fly bundling and injects a live-reload client; prod uses a static, pre-built manifest with cache-immutable assets. The package also ships a multi-app <strong>gateway</strong> (route several apps by <code>Host</code> header behind one port) and a portable <code>node:http</code> adapter for WinterCG hosts. It is entirely server-side and Bun-native (<code>Bun.serve</code>, <code>Bun.file</code>, <code>Bun.gzipSync</code>).</p>
@@ -237,6 +237,7 @@ import &#123; DevToolbarConfig, DevToolbarPlatformSnapshot, DevToolbarPanel &#12
import &#123; ClientRuntimeDefinition, PluginInput &#125; from '@wrnexus/plugin';
import &#123; CacheCoordinator &#125; from '@wrnexus/cache';
import &#123; DevToolbarCollector &#125; from '@wrnexus/dev-toolbar/server';
import &#123; AuthzModule &#125; from '@wrnexus/authz';
import &#123; IncomingMessage, ServerResponse, Server &#125; from 'node:http';
/** Exit code a dev-server child uses to request a clean supervisor restart. */
@@ -575,6 +576,11 @@ interface ProdManifest &#123;
name: string;
mod: RouteModule;
&#125;[];
/** RPC service implementations (from app/services/*.ts). */
services?: &#123;
name: string;
mod: RouteModule;
&#125;[];
&#125;
interface ProductionPluginAsset &#123;
path: string;
@@ -604,6 +610,19 @@ interface ProdOptions &#123;
frameworkCssPath?: string;
/** Pre-built `window.__wireSchemas = &#123;...&#125;` script for client validation. */
schemasJs?: string;
/**
* Authorization declarations discovered by `wrnexus build` from
* `app/authz/*.ts`, statically imported into the generated entry (the
* catalog holds policy FUNCTIONS, so — unlike `schemasJs` — it cannot be
* JSON-serialised). `module` is `undefined` for a file with no default
* export. In the NORMAL generated-entry build, the catalog is already set
* by the generated `.authz-setup.ts` module before this ever runs (see
* `applyAuthzManifestEarly` below); `createProductionHandlers` merges this
* same list again as an idempotent second pass — with its warnings — so a
* caller that bypasses the generated entry and calls it directly still gets
* a correctly merged catalog.
*/
authz?: AuthzManifestEntry[];
/** Resolved i18n bundle (default lang + locale messages). */
i18n?: ResolvedI18n;
/** Default database connection (driver + url); enables `getDb()`. */
@@ -668,6 +687,28 @@ interface ProdOptions &#123;
/** Enable only for the CLI's supervised exact-production development mode. */
developmentRuntime?: boolean;
&#125;
/** One `app/authz/*.ts` declaration as passed through `ProdOptions.authz`. */
interface AuthzManifestEntry &#123;
source: string;
/** Undefined when the declaration file has no default export. */
module?: AuthzModule;
&#125;
/**
* Merge + `setAuthzCatalog` as EARLY as possible, deliberately silently (no
* missing-default-export warnings). Called ONLY from the generated
* `.authz-setup.ts` module that `wrnexus build` imports FIRST in the
* production entry — before any other static import, including app
* middleware — so that a middleware module reading `getAuthzCatalog()` at its
* own module scope (the same eager shape `authzMiddleware(&#123; catalog, ... &#125;)`
* itself requires) sees a populated catalog. `createProductionHandlers` below
* performs the exact same merge again, WITH its warnings, as the canonical,
* always-warns second pass — this function stays silent specifically so the
* normal boot path does not print the same &quot;no default export&quot; warning
* twice. A genuine conflict still throws here (via `mergeCatalogs`), which
* fails the boot at import time — before the entry body, and thus
* `createProductionHandlers`, ever runs.
*/
declare function applyAuthzManifestEarly(entries: AuthzManifestEntry[]): void;
/**
* Build the portable request handler from a precompiled manifest — a
* WinterCG-style `fetch(request) =&gt; Response` plus the websocket handlers, with
@@ -778,7 +819,7 @@ interface RunningServer &#123;
&#125;
declare function startServer(opts: ServeOptions): Promise&lt;RunningServer&gt;;
export &#123; type AssetServer, type FetchHandler, type GatewayApp, type GatewayAuth, type GatewayOptions, type GatewaySecurity, RESTART_EXIT_CODE, type RunningGateway, type RunningServer, type RuntimeDeps, type ServeOptions, type WrnCompileMetrics, type WsData, createHandlers, createProductionHandlers, createProductionServer, expandStaticComponents, getWrnCompileMetrics, nodeListener, precomputePartialStaticShell, resetWrnCompileMetrics, serveNode, startGateway, startServer, toRequest, writeResponse &#125;;
export &#123; type AssetServer, type AuthzManifestEntry, type FetchHandler, type GatewayApp, type GatewayAuth, type GatewayOptions, type GatewaySecurity, RESTART_EXIT_CODE, type RunningGateway, type RunningServer, type RuntimeDeps, type ServeOptions, type WrnCompileMetrics, type WsData, applyAuthzManifestEarly, createHandlers, createProductionHandlers, createProductionServer, expandStaticComponents, getWrnCompileMetrics, nodeListener, precomputePartialStaticShell, resetWrnCompileMetrics, serveNode, startGateway, startServer, toRequest, writeResponse &#125;;
</code></pre></section><section id="examples" class="examples"><h2>Examples</h2><p>Copy-ready examples from the installed package documentation.</p><div class="example-grid"><article class="example-card"><h3>Programmatic dev server</h3><pre data-language="ts"><code>import &#123; startServer &#125; from &quot;@wrnexus/dev-server&quot;;
const server = await startServer(&#123;
@@ -819,7 +860,7 @@ await startGateway(&#123;
&#125;);</code></pre></article></div></section></article>
<aside class="on-this-page"><h2>On this page</h2><nav><a class="toc-level-2" href="#guide">Guide</a><a class="toc-level-3" href="#overview">Overview</a><a class="toc-level-3" href="#api">API</a><a class="toc-level-4" href="#main-entry-wrnexus-dev-server">Main entry (@wrnexus/dev-server)</a><a class="toc-level-4" href="#startserver-opts">startServer(opts)</a><a class="toc-level-4" href="#createhandlers-deps">createHandlers(deps)</a><a class="toc-level-4" href="#createproductionserver-manifest-opts-createproductionhandlers-manifest-opts">createProductionServer(manifest, opts) / createProductionHandlers(manifest, opts)</a><a class="toc-level-4" href="#startgateway-opts-multi-app-gateway">startGateway(opts) — multi-app gateway</a><a class="toc-level-4" href="#node-http-adapter-from-adapters-node-ts">node:http adapter (from ./adapters/node.ts)</a><a class="toc-level-4" href="#subpath-export-wrnexus-dev-server-serve-entry">Subpath export: @wrnexus/dev-server/serve-entry</a><a class="toc-level-3" href="#usage">Usage</a><a class="toc-level-4" href="#programmatic-dev-server">Programmatic dev server</a><a class="toc-level-4" href="#production-server-from-a-build-manifest">Production server from a build manifest</a><a class="toc-level-4" href="#embedding-the-handler-on-node-http">Embedding the handler on node:http</a><a class="toc-level-4" href="#multi-app-gateway">Multi-app gateway</a><a class="toc-level-3" href="#framework-asset-routes">Framework asset routes</a><a class="toc-level-3" href="#requirements-notes">Requirements / Notes</a><a class="toc-level-2" href="#api">Complete API</a><a class="toc-level-2" href="#examples">Examples</a></nav></aside>
</main>
<footer><div class="footer-brand"><span class="footer-mark" aria-hidden="true">W</span><p><strong>WRNexusJS 0.8.4</strong><span>Complete API documentation generated from installed package declarations.</span></p></div><nav aria-label="Footer"><a href="/packages">All packages</a><a href="/getting-started">Get started</a><a href="/security">Security</a><a href="/support">Support</a><a href="/llms.txt">AI guide</a></nav><p class="footer-meta">Private Developer Preview · Bun-native</p></footer>
<footer><div class="footer-brand"><span class="footer-mark" aria-hidden="true">W</span><p><strong>WRNexusJS 0.8.5</strong><span>Complete API documentation generated from installed package declarations.</span></p></div><nav aria-label="Footer"><a href="/packages">All packages</a><a href="/getting-started">Get started</a><a href="/security">Security</a><a href="/support">Support</a><a href="/llms.txt">AI guide</a></nav><p class="footer-meta">Private Developer Preview · Bun-native</p></footer>
</div>
}
}