Conversation
…ts and environment files
… improved MDX processing
…pendencies for improved development workflow
…rt for dynamic MDX imports
…improved file handling and dynamic imports
…ts and MDX components for improved rendering
…sset management functions for improved performance and error handling
…ration to enhance asset management and optimize build processes
… asset management and KV namespace setup
There was a problem hiding this comment.
🟡 Changes recommended
A confirmed path traversal issue exists in getRegistryAsset() (unsandboxed filesystem read), and the registry redirect path drops caching/robots headers, impacting security and operational behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds a Vite/Vinext + Wrangler-based deployment path to run the UI on Cloudflare Workers, replacing runtime filesystem access (for Workers-incompatible routes) with build-time import.meta.glob() inlined sources/assets.
Changes:
- Add Cloudflare Workers configuration (
wrangler.jsonc) and Vinext/Vite build setup (vite.config.ts) with runtime aliasing to Workers-safe “.vite.ts” modules. - Replace runtime filesystem reads for docs/blog/registry flows with build-time globbed content and asset URL redirects where needed.
- Adjust MDX configuration to use explicit remark plugin imports and add Vinext/Wrangler scripts + dependencies.
File summaries
| File | Description |
|---|---|
| wrangler.jsonc | Adds Wrangler configuration for Workers deployment (assets, cache, KV, images). |
| vite.config.ts | Introduces Vinext + Cloudflare Vite plugin config and pre-resolve aliasing for Workers-safe modules. |
| package.json | Adds Vinext/Cloudflare/Wrangler tooling, scripts, and ESM package type. |
| next.config.ts | Updates MDX remark plugins to imported plugin functions (not string names). |
| lib/registry-source.vite.ts | Build-time globbing for registry source/** content and asset URLs. |
| lib/registry-loader.vite.ts | Workers-safe replacement for shadcn/registry backed by local registry.json + globbed sources. |
| lib/registry-asset.vite.ts | Workers-safe registry asset resolver returning emitted asset URLs (no raw byte reads). |
| lib/registry-asset.ts | Node runtime registry asset reader returning Uint8Array bodies. |
| lib/read-code-path.vite.ts | Workers-safe code browser implementation using globbed sources instead of filesystem walking. |
| lib/docs-runtime.vite.ts | Workers-safe docs enumerator using globbed MDX sources + compiled components. |
| lib/docs-runtime.ts | Node runtime docs enumerator using explicit imports + filesystem reads for sources. |
| lib/content.ts | Shifts docs content enumeration/reads to getDocAssets() instead of filesystem traversal. |
| lib/blog.ts | Shifts blog post enumeration/reads to getBlogSourceEntries() instead of filesystem access. |
| lib/blog-sources.vite.ts | Workers-safe blog source/component resolution via build-time globbing. |
| lib/blog-sources.ts | Node runtime blog source reads and dynamic component import. |
| app/(main)/registry/[...path]/route.ts | Serves registry assets via getRegistryAsset() with redirect for emitted asset URLs. |
| app/(main)/docs/[slug]/page.tsx | Loads docs from getDocAsset() and injects MDX components mapping explicitly. |
| app/(main)/blog/[slug]/page.tsx | Loads blog components via getBlogPostComponent() and injects MDX components mapping. |
| app/(api)/docs-md/[...slug]/route.ts | Serves MDX source for docs via getDocAsset() rather than filesystem reads. |
| .gitignore | Ignores Vinext/Wrangler build output directories (dist, .vinext, .wrangler). |
Review details
- Files reviewed: 19/21 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Collaborator
Author
|
On hold for now, as it is currently deployed on Render. |
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.
This PR adds support for Cloudflare Workers.