Files
WRNexusJS/packages/react
ClintchizandClaude Opus 5 17aa3b98eb feat(islands): wire islands end to end
The island pieces existed but nothing connected .wrn compilation to island
emission. Now:

- codegen emits a data-wrn-island placeholder for component tags bound to
  .tsx imports, keeping .wrn components on the normal mount path
- the dev pipeline and static build resolve island imports, thread the
  names into codegen, and build the bundles
- collectScripts adds /__wrnexus/islands.js only when island markup is
  present, so island-free pages still ship nothing
- island routes classify as static-interactive via hasIslands

Three bugs found by driving a real page in the browser:

1. The mount runtime was never built anywhere, so the bootstrap 404'd and
   no island mounted.
2. Building the runtime separately from the islands gave each its own copy
   of React: "Cannot read properties of null (reading 'useState')". The
   runtime is now an entrypoint of the same build so React stays in one
   shared chunk. The existing single-React test only compared bundles
   within one build and could not see across build boundaries.
3. Island props arrived as attribute strings, so start={3} was "3" and
   incrementing produced "31" then "311". Props now follow JSX semantics:
   {…} parses as JSON, quoted values stay strings, and a runtime
   expression is a WRN-ISLAND-PROPS build error rather than a silent
   wrong value.

island-codegen.ts no longer imports @wrnexus/core. Compiler modules are
bundled into the Node-only VS Code extension, which contains no other
packages, so a runtime import of core broke the editor compiler; the two
helpers are implemented locally and the core dependency is dropped again.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 16:16:03 +05:30
..

@wrnexus/react

Opt-in React islands for WRNexusJS: mount npm React components inside server-rendered .wrn pages without adopting React as the framework's rendering model.

Import a .tsx component in a .wrn script block and use it as an element. The compiler emits a data-wrn-island placeholder instead of a server render, and this package's runtime mounts it in the browser with createRoot. Islands are client-only, each mounts inside its own error boundary, and roots are disposed on client-side navigation.

react and react-dom are optional peer dependencies, so apps that use no islands ship no React. A route with no islands still ships zero framework JavaScript.

Use useWrnStore(name, selector?) to read a WRNexus store from inside an island and useWrnActions(name) to write to it. Writes belong in event handlers or effects, never during render.