-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: download snippet generation #7351
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This concerns me -- I would think we would absolutely want to prioritise these snippets being in the HTML sent over the wire initially as they're rather crucial content, and likely content that bots etc. would want to index/scrape too. |
Co-authored-by: Caner Akdas <[email protected]> Signed-off-by: Claudio W <[email protected]>
cea8c2e
to
ff76711
Compare
This PR attempts to introduce a system for dynamic download snippet generation. With the increasing number of different version managers, package managers, and installation methods for Node.js, we want to ease maintainability, translation, and viewing how the snippet would look with syntax highlighting.
This API allows these files to be loaded on demand, and then Shiki and MDX transpile them on the client side. This requires having Shiki and the MDX compiler present on the client side (which they already are).
This change introduces the ability to test the snippets in a sandboxed environment and, in the future, have every CodeBox be loaded on the client-side dynamically (including Learn codeboxes) on-demand without requiring them to be built during build time.
The trade-off is that the client side needs to fetch these snippets, but this request is prefetched and cached.
This introduces the API route, data generators and providers + replaces the usage of the old getDownloadSnippet with the new mechanism.
This PR also...