Skip to content

Consolidate Keystatic renderers into a single registry factory#191

Merged
lukebennett88 merged 1 commit into
mainfrom
refactor/keystatic-renderer-registry
Jun 15, 2026
Merged

Consolidate Keystatic renderers into a single registry factory#191
lukebennett88 merged 1 commit into
mainfrom
refactor/keystatic-renderer-registry

Conversation

@lukebennett88

Copy link
Copy Markdown
Owner

Problem

The Keystatic renderer wiring was split: renderers/index.tsx exported getDocumentRenderers(highlighter) and a separate componentBlockRenderers constant, and document-renderer.tsx reached for the eager Shiki highlighter singleton and assembled them as defaults. The highlighter dependency was implicit, with no seam to substitute it.

Solution

renderers/index.tsx now exports a single createKeystaticRenderers(highlighter) factory returning { componentBlocks, renderers } — one place where every renderer is registered. DocumentRenderer gains an optional highlighter? prop (defaulting to the singleton), making the dependency explicit and substitutable at one seam. highlighter.ts's eager initialization is unchanged, and all existing call sites (which pass only document) are unaffected.

This is the smallest of the architecture-review candidates — a focused locality improvement, not a plugin system.

Verification

  • pnpm --filter @lukebennett/web check — prettier, biome, tsc --noEmit clean.
  • pnpm --filter @lukebennett/web build — astro build completes.
  • No stale references to the old export names remain.

Part of an architecture review pass; sibling PRs cover the AT Protocol module, manifest contract, and Cloud Image preview.

Replace the separate getDocumentRenderers/componentBlockRenderers exports
with one createKeystaticRenderers(highlighter) factory, and route the
highlighter through DocumentRenderer as an injectable prop defaulting to
the singleton.
@netlify

netlify Bot commented Jun 15, 2026

Copy link
Copy Markdown

Deploy Preview for lukebennett ready!

Name Link
🔨 Latest commit e0ef968
🔍 Latest deploy log https://app.netlify.com/projects/lukebennett/deploys/6a2fa2e2b16e9f0008c119d8
😎 Deploy Preview https://deploy-preview-191--lukebennett.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@lukebennett88 lukebennett88 merged commit 1af9e93 into main Jun 15, 2026
5 checks passed
@lukebennett88 lukebennett88 deleted the refactor/keystatic-renderer-registry branch June 15, 2026 07:06
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