Files
WRNexusJSDoc/app/pages/packages/syntax.wrn
T

56 lines
6.4 KiB
Plaintext

page wrnexussyntax {
seo {
title = "@wrnexus/syntax"
description = "Editor syntax definitions and language tooling for .wrn files."
}
view {
<div class="docs-shell">
<SkipLink label="Skip to content" href="#main" class="docs-skip-link" />
<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.5.13</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/syntax</span></nav><section class="doc-intro"><span class="eyebrow">Frontend · Package reference</span><h1>@wrnexus/syntax</h1><p>Editor syntax definitions and language tooling for .wrn files.</p><div class="doc-meta"><span>v0.5.13</span><span>Private registry</span><span>Frontend</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/syntax@0.5.13</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"><p>Canonical WRN lexer, parser, AST, language metadata, source positions, and stable diagnostics. Framework tooling should import this package instead of implementing a separate <code>.wrn</code> parser.</p>
<p>See <code>docs/WRN-LANGUAGE-SPEC-1.0.md</code> in the WRNexusJS repository.</p></section><section id="api" class="api"><h2>Complete TypeScript API</h2><p>Generated from the exact installed package declarations.</p><pre data-language="typescript"><code>export &#123; LexError, Lexer &#125; from './tokenizer.js';
export &#123; ActionBlock, ApiBlock, Attr, ComputedDecl, DataApiBlock, DataMode, EffectBlock, EventDecl, LifecycleBlock, LoadBlock, ModeFunctionsBlock, PageAst, ParseError, PropDecl, RealtimeBlock, RealtimeHandler, SeoBlock, StateDecl, VOID_ELEMENTS, ViewNode, WatchBlock, parse, parseHtmlView &#125; from './parser.js';
export &#123; RuntimeType, eraseFunctionTypes, inferredRuntimeType, runtimeTypeOf, validateTypedInitializer &#125; from './types.js';
import &#123; WrnDiagnostic &#125; from './diagnostics.js';
export &#123; DiagnoseOptions, WrnDiagnosticSeverity, WrnSourcePosition, assertValidAst, classifyParseError, diagnose, diagnosticFromError, formatDiagnostic, isHydrationStrategy, isRuntimeTarget, positionAt &#125; from './diagnostics.js';
export &#123; WRN_DIAGNOSTIC_CODES, WRN_HYDRATION_STRATEGIES, WRN_LANGUAGE_VERSION, WRN_ROOT_KINDS, WRN_ROOT_MEMBERS, WRN_RUNTIME_TARGETS, WrnHydrationStrategy, WrnRootKind, WrnRootMember, WrnRuntimeTarget &#125; from './spec.js';
/** Current stable syntax contract. Bump only when parsers/codegen need migration. */
declare const WRN_SYNTAX_VERSION: &quot;0.4&quot;;
type WrnSyntaxFeature = &quot;typed-declarations&quot; | &quot;layouts&quot; | &quot;server-client-blocks&quot; | &quot;effects&quot; | &quot;watch&quot; | &quot;lifecycle&quot; | &quot;embedded-api&quot; | &quot;realtime&quot; | &quot;runtime-markers&quot;;
declare const WRN_SYNTAX_FEATURES: Readonly&lt;Record&lt;WrnSyntaxFeature, boolean&gt;&gt;;
interface SourceRange &#123;
start: number;
end: number;
&#125;
declare function createSourceRange(start: number, end: number): SourceRange;
declare function sliceSource(source: string, range: SourceRange): string;
declare function diagnosticSummary(diagnostics: readonly WrnDiagnostic[]): &#123;
errors: number;
warnings: number;
info: number;
codes: Record&lt;string, number&gt;;
&#125;;
declare function supportsSyntaxFeature(feature: string): feature is WrnSyntaxFeature;
export &#123; type SourceRange, WRN_SYNTAX_FEATURES, WRN_SYNTAX_VERSION, WrnDiagnostic, type WrnSyntaxFeature, createSourceRange, diagnosticSummary, sliceSource, supportsSyntaxFeature &#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>Parse a WRNexusJS document</h3><pre data-language="ts"><code>import &#123; parse &#125; from &quot;@wrnexus/syntax&quot;;
const ast = parse('component Greeting &#123; view &#123; &lt;p&gt;Hello&lt;/p&gt; &#125; &#125;');</code></pre></article><article class="example-card"><h3>Summarize syntax diagnostics</h3><pre data-language="ts"><code>import &#123; diagnose, diagnosticSummary &#125; from &quot;@wrnexus/syntax&quot;;
const summary = diagnosticSummary(diagnose(source));</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-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.5.13</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>
}
}