release: WRNexusJS 0.4.0

This commit is contained in:
2026-07-27 12:42:18 +05:30
parent 8b728a3e5d
commit 30e5721e84
250 changed files with 10065 additions and 3923 deletions
+32 -3
View File
@@ -11,8 +11,9 @@
- **Pages, components, and layouts are `.wrn` files.** Do NOT write `.tsx`/`.jsx`/React
for UI. Do NOT use `useState`, hooks, JSX, or a client bundler.
- **Routing is file-based** under `app/`. The filename is the route. No router config.
- **Interactivity** lives in `state` + `{expr}` + `@event` inside `.wrn`. Components render
on the server and hydrate automatically — you never write client-side JS islands.
- **Application interactivity** lives in `state` + `{expr}` + `@event` inside `.wrn`. Components render
on the server and hydrate automatically. Advanced reusable packages may declare a framework-managed
client runtime; applications never copy its JavaScript or add its `<script>` tag manually.
- **Runtime is Bun only** (uses `Bun.serve`, `bun:sqlite`, `Bun.password`, …). Node is not supported.
- To add files, prefer the CLI: `wrnexus generate page <Name>` / `component <name>` / `api <path>` / `schema <name>`.
@@ -77,7 +78,9 @@ component Counter {
```
Mount it from any page/component: `<div data-component="counter" start="0" label="Clicks"></div>`.
Components render on the server with their props, then hydrate — no per-component JS.
Components render on the server with their props, then hydrate. When an installed package component
needs native browser APIs, it marks its runtime with `data-wrnexus-runtime`; WRNexus injects that
runtime once and only on pages that use it.
## The `view { }` block (plain HTML + a few directives)
@@ -195,6 +198,29 @@ export default defineRoom({
```
Client side: a page opts in with `data-room="chat"` (handled by the realtime runtime).
## Installed systems and automatic package runtimes
WRNexus 0.4 discovers framework packages from application dependencies. A package may contribute
components, browser runtimes, assets, styles, routes, middleware, migrations, and DevToolbar panels.
Do not copy package components or public JavaScript into the application.
Example CAPTCHA usage after adding `@wrnexus/captcha`:
```wrn
<Captcha
type="alphanumeric"
action="contact-submit"
size="compact"
/>
```
The rendered component declares `data-wrnexus-runtime="captcha"`. SSR injects the hashed runtime
automatically, CSR navigation loads it when first needed, and the runtime mounts/unmounts with the page.
Server-side CAPTCHA verification is still mandatory.
Package authors declare integrations through `package.json#wrnexus` or `definePlugin()`; they should
never require consumers to edit HTML, Tailwind `@source`, static asset folders, or migration lists.
## Config (`wrnexus.config.ts`)
```ts
@@ -263,6 +289,9 @@ wrnexus create <name> # scaffold a new app
wrnexus update --latest # deps + syntax/config migrations + verification
wrnexus generate page <Name> # scaffold a page (aliases: g p)
wrnexus generate component <name> | api <path> | schema <name>
wrnexus generate system <name> # scaffold a framework-native package system
wrnexus inspect packages|plugins|routes|assets|runtimes|styles|migrations|bundle
wrnexus doctor # validate app, plugins, assets, runtimes, and migrations
wrnexus db migrate | rollback | status | new [--from-models] | generate | seed
wrnexus eject <component> # copy a Wire UI component's .wrn into app/components to customize
```