Consolidate Keystatic renderers into a single registry factory#191
Merged
Conversation
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.
✅ Deploy Preview for lukebennett ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Keystatic renderer wiring was split:
renderers/index.tsxexportedgetDocumentRenderers(highlighter)and a separatecomponentBlockRenderersconstant, anddocument-renderer.tsxreached 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.tsxnow exports a singlecreateKeystaticRenderers(highlighter)factory returning{ componentBlocks, renderers }— one place where every renderer is registered.DocumentRenderergains an optionalhighlighter?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 onlydocument) 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 --noEmitclean.pnpm --filter @lukebennett/web build— astro build completes.Part of an architecture review pass; sibling PRs cover the AT Protocol module, manifest contract, and Cloud Image preview.