docs: update portal for WRNexusJS 0.2.74

This commit is contained in:
2026-07-21 11:23:06 +05:30
parent 11e13331fa
commit 71635ba08d
979 changed files with 4306 additions and 4163 deletions
+14 -4
View File
@@ -10,14 +10,22 @@ page wrnexuscompiler {
<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="/components">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.2.73</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.2.74</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="/components">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/compiler</span></nav><section class="doc-intro"><span class="eyebrow">Core · Package reference</span><h1>@wrnexus/compiler</h1><p>Parser and code generators for the .wrn language.</p><div class="doc-meta"><span>v0.2.73</span><span>Private registry</span><span>Core</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/compiler@0.2.73</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>Compiler for the <code>.wrn</code> language — tokenizes, parses, and lowers <code>.wrn</code> page and component files to TypeScript.</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/compiler</span></nav><section class="doc-intro"><span class="eyebrow">Core · Package reference</span><h1>@wrnexus/compiler</h1><p>Parser and code generators for the .wrn language.</p><div class="doc-meta"><span>v0.2.74</span><span>Private registry</span><span>Core</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/compiler@0.2.74</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>Compiler for the <code>.wrn</code> language — tokenizes, parses, and lowers <code>.wrn</code> page and component files to TypeScript.</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><code>@wrnexus/compiler</code> turns <code>.wrn</code> source into TypeScript that targets the framework's runtime primitives. A <code>.wrn</code> file declares either a <code>page</code> (a route) or a <code>component</code> (a reusable, prop-driven fragment) with blocks for <code>state</code>, <code>view</code> (plain HTML), <code>seo</code>, <code>style</code>, <code>functions</code>, <code>api</code>, <code>ssr</code>/<code>client</code> data bindings, and <code>realtime</code> websocket handlers. The pipeline is <code>source → Lexer → parse() → PageAst → generate() → TypeScript</code>. It is a build/server-side library — the WRNexusJS dev loader calls it to compile <code>.wrn</code> files on the fly, surfacing <code>ParseError</code> as a readable error page.</p>
<p>Static ES module imports may appear before the root declaration. Imported values are available to server-rendered expressions, including component props:</p>
<pre data-language="wrn"><code>import &#123; appUrl &#125; from &quot;@wrnexus/helpers&quot;;
layout PublicLayout &#123;
view &#123;
&lt;PublicHeader signInHref=&quot;&#123;appUrl('sso', '/sign-in')&#125;&quot; /&gt;
&#125;
&#125;</code></pre>
<pre data-language="bash"><code>bun add @wrnexus/compiler</code></pre>
<blockquote>Private package — the machine must be authenticated to the <code>wrnexus</code> npm org</blockquote>
<blockquote>(a read token in <code>~/.npmrc</code>). Requires <strong>Bun</strong> (Node is not supported).</blockquote>
@@ -57,7 +65,7 @@ page wrnexuscompiler {
<p>Exported type-only symbols describing the parsed tree:</p>
<div class="table-wrap"><table>
<thead><tr><th>Type</th><th>Description</th></tr></thead>
<tbody><tr><td><code>PageAst</code></td><td>Root node including <code>kind</code>, <code>name</code>, <code>types</code>, typed <code>props</code>, typed <code>states</code>, <code>view</code>, styles, functions, data APIs, lifecycle, and routes.</td></tr><tr><td><code>ViewNode</code></td><td><code>&#123; type: &quot;text&quot;; value &#125;</code> or <code>&#123; type: &quot;element&quot;; tag; attrs; children &#125;</code>.</td></tr><tr><td><code>Attr</code></td><td><code>&#123; name; value; event; boolean? &#125;</code> — <code>event</code> marks <code>@event</code> bindings.</td></tr><tr><td><code>StateDecl</code></td><td><code>&#123; name; valueType?; expr &#125;</code> — a typed <code>state x: Type = &lt;expr&gt;</code> declaration.</td></tr><tr><td><code>PropDecl</code></td><td><code>&#123; name; valueType?; required; default &#125;</code> — a typed prop declaration.</td></tr><tr><td><code>SeoBlock</code></td><td><code>Record&lt;string, string&gt;</code> from the <code>seo &#123; ... &#125;</code> block.</td></tr><tr><td><code>ApiBlock</code></td><td><code>&#123; method; path; body &#125;</code> — a top-level <code>api METHOD /path &#123; ... &#125;</code>.</td></tr><tr><td><code>DataApiBlock</code></td><td><code>&#123; mode; name; method; path; body &#125;</code> — an <code>api</code> inside an <code>ssr</code>/<code>client</code> block.</td></tr><tr><td><code>DataMode</code></td><td>`&quot;ssr&quot; \</td><td>&quot;client&quot;`.</td></tr><tr><td><code>ModeFunctionsBlock</code></td><td><code>&#123; mode; body &#125;</code> — a <code>functions &#123; ... &#125;</code> inside an <code>ssr</code>/<code>client</code> block.</td></tr><tr><td><code>RealtimeBlock</code></td><td><code>&#123; name; handlers &#125;</code> — a <code>realtime &lt;name&gt; &#123; on evt(args) &#123; ... &#125; &#125;</code> block.</td></tr></tbody></table></div>
<tbody><tr><td><code>PageAst</code></td><td>Root node including top-level <code>imports</code>, <code>kind</code>, <code>name</code>, <code>types</code>, typed <code>props</code>, typed <code>states</code>, <code>view</code>, styles, functions, data APIs, lifecycle, and routes.</td></tr><tr><td><code>ViewNode</code></td><td><code>&#123; type: &quot;text&quot;; value &#125;</code> or <code>&#123; type: &quot;element&quot;; tag; attrs; children &#125;</code>.</td></tr><tr><td><code>Attr</code></td><td><code>&#123; name; value; event; boolean? &#125;</code> — <code>event</code> marks <code>@event</code> bindings.</td></tr><tr><td><code>StateDecl</code></td><td><code>&#123; name; valueType?; expr &#125;</code> — a typed <code>state x: Type = &lt;expr&gt;</code> declaration.</td></tr><tr><td><code>PropDecl</code></td><td><code>&#123; name; valueType?; required; default &#125;</code> — a typed prop declaration.</td></tr><tr><td><code>SeoBlock</code></td><td><code>Record&lt;string, string&gt;</code> from the <code>seo &#123; ... &#125;</code> block.</td></tr><tr><td><code>ApiBlock</code></td><td><code>&#123; method; path; body &#125;</code> — a top-level <code>api METHOD /path &#123; ... &#125;</code>.</td></tr><tr><td><code>DataApiBlock</code></td><td><code>&#123; mode; name; method; path; body &#125;</code> — an <code>api</code> inside an <code>ssr</code>/<code>client</code> block.</td></tr><tr><td><code>DataMode</code></td><td>`&quot;ssr&quot; \</td><td>&quot;client&quot;`.</td></tr><tr><td><code>ModeFunctionsBlock</code></td><td><code>&#123; mode; body &#125;</code> — a <code>functions &#123; ... &#125;</code> inside an <code>ssr</code>/<code>client</code> block.</td></tr><tr><td><code>RealtimeBlock</code></td><td><code>&#123; name; handlers &#125;</code> — a <code>realtime &lt;name&gt; &#123; on evt(args) &#123; ... &#125; &#125;</code> block.</td></tr></tbody></table></div>
<h3 id="usage">Usage</h3>
<p>Compile a page:</p>
<pre data-language="ts"><code>import &#123; compileWireFile &#125; from &quot;@wrnexus/compiler&quot;;
@@ -234,6 +242,8 @@ interface PropDecl &#123;
&#125;
interface PageAst &#123;
type: &quot;page&quot;;
/** Static ES module imports declared before the WRN root declaration. */
imports: string[];
/**
* `page` is a route, `component` is a reusable fragment,
* and `layout` is a reusable page wrapper.
@@ -403,7 +413,7 @@ lx.next(); // &#123; type: &quot;ident&quot;, value: &quot;Home&quot;, pos: 5 &#
lx.next(); // &#123; type: &quot;lbrace&quot;, value: &quot;&#123;&quot;, pos: 10 &#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="#compilewirefile-source-string-string">compileWireFile(source: string): string</a><a class="toc-level-4" href="#compile-source-string-compileresult">compile(source: string): CompileResult</a><a class="toc-level-4" href="#parse-source-string-pageast">parse(source: string): PageAst</a><a class="toc-level-4" href="#generate-ast-pageast-string">generate(ast: PageAst): string</a><a class="toc-level-4" href="#lexer">Lexer</a><a class="toc-level-4" href="#errors">Errors</a><a class="toc-level-4" href="#ast-types">AST types</a><a class="toc-level-3" href="#usage">Usage</a><a class="toc-level-3" href="#the-wrn-language-as-parsed">The .wrn language (as parsed)</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.2.73</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.2.74</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>
<BackToTop />
</div>
}