Skip to content

feat(astro): add @json-render/astro SSR HTML renderer#218

Open
Aperrix wants to merge 10 commits intovercel-labs:mainfrom
Aperrix:feat/astro-ssr-renderer
Open

feat(astro): add @json-render/astro SSR HTML renderer#218
Aperrix wants to merge 10 commits intovercel-labs:mainfrom
Aperrix:feat/astro-ssr-renderer

Conversation

@Aperrix
Copy link

@Aperrix Aperrix commented Mar 13, 2026

Summary

  • Add @json-render/astro, an Astro renderer with defineRegistry + <Renderer /> for native .astro components. Same API pattern as React, Vue, Svelte, and Solid renderers.
  • defineRegistry(catalog, { components }) creates a typed component registry; <Renderer /> walks the spec tree rendering each element using real .astro files with <slot /> for children
  • <ElementRenderer /> uses Astro.self for recursive tree walking (visibility, props resolution, repeat)
  • Static HTML output (zero JS). Works in SSG (build time) and SSR (request time, with any adapter)
  • Astro Islands pattern: static content via @json-render/astro + interactive islands via @json-render/react (or Vue, Svelte, Solid) with client:* directives
  • Full support for $state, $cond, $item, $index, $template, visible, and repeat expressions
  • Astro example project (examples/astro/) with static demo and hybrid React island counter
  • Full documentation: README, API docs page, skill, docs-chat integration, navigation links

Test plan

  • 49 unit tests across 3 files: schema (40), defineRegistry (5), public API exports (4)
  • Schema tests: structure, defineCatalog, catalog.prompt(), catalog.validate(), catalog.jsonSchema(), catalog.zodSchema()
  • Astro-specific tests: static HTML rules, no actions, slots support, prompt modes
  • Astro example builds successfully (pnpm build in examples/astro/)
  • Type-check passes
  • Counter island uses correct defineRegistry + createHandlers pattern with proper provider order (StateProvider > VisibilityProvider > ActionProvider)

@vercel
Copy link
Contributor

vercel bot commented Mar 13, 2026

@Aperrix is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@socket-security
Copy link

socket-security bot commented Mar 13, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​astrojs/​react@​5.0.0991008295100
Addedastro@​6.0.4981008898100

View full report

Aperrix added 10 commits March 13, 2026 21:08
New package that transforms json-render specs into HTML strings on the server.
Zero framework dependencies — works in Astro, Cloudflare Workers, Node.js, Deno, Bun.

Includes schema, catalog types, renderToHtml(), escapeHtml(), and full test suite.
- Package README with Astro and Cloudflare Workers examples
- Skill file for AI agents
- API reference page for docs site
- Root README updated with package table entry and renderer section
- Changeset config, docs navigation, page titles, and docs-chat updated
Minimal Astro app demonstrating renderToHtml() with set:html,
including visibility conditions, repeat, $cond expressions,
and a registry of pure HTML component render functions.
…time state

Add 8 new tests covering SSR safety:
- No DOM globals dependency
- Synchronous output (no promises)
- No script tags or event handlers in output
- XSS escaping in HTML attributes (href, src, alt)
- Unicode content handling
- Request-time state resolution (per-request rendering)
- No caching leak between renders
- Repeat with $index for position-aware rendering

Example now demonstrates server-side state injection with timestamp.
Add islands demo page showing @json-render/astro (static SSR) coexisting
with @json-render/react (interactive island hydrated via client:visible).

Document the islands pattern for all 4 supported frameworks (React, Vue,
Svelte, Solid) in package README, skill file, and API docs page.
…igation

Counter.tsx now uses defineRegistry's createHandlers with refs pattern
(matching dashboard example) instead of disconnected no-op actions.
Fixes provider order to StateProvider > VisibilityProvider > ActionProvider.
… Renderer

Replace string-based renderToHtml() with native .astro components:
- Renderer.astro and ElementRenderer.astro for recursive spec tree walking
- defineRegistry(catalog, { components }) matching React/Vue/Svelte/Solid API
- Astro-specific schema with static HTML rules (no actions/events)
- Example .astro components (Section, Card, Heading, Text, Badge, List, etc.)
- Full test suite (schema, catalog, registry, public API exports)
- Aligned docs (README, SKILL.md, web API page) with other renderer packages
- Updated changeset for v0.14 release
@Aperrix Aperrix force-pushed the feat/astro-ssr-renderer branch from 1924cec to 71dbc33 Compare March 13, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant