-
-
Notifications
You must be signed in to change notification settings - Fork 374
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(vitepress-twoslash): cache type informations to improve performance #798
Conversation
✅ Deploy Preview for shiki-matsu ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for shiki-next ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Sorry it might take a bit longer for me to refactor it a bit to make the logic a bit decoupled - if you want to help with that, could you make |
Hi @antfu, thank you for commenting. You mean const typesCache = createFileSystemTypesCache(options)
transformerTwoslash({
typesCache
}) , right? |
Yes, something like that |
@antfu could you check this? |
Great |
This is exciting! I made an issue for Graffle to look more into this when I have time. When it comes to Vitepress, in my mind it feels like this caching stuff should be the default, and presumably almost no one will need to opt out of it, but if they need to then sure it should be possible. My experience is that local development, not just CI builds, is very slow. So, in other words I'm hoping that a future vitepress release will just make everything faster without any effort from user needed by default. Curious to see how it will actually land. Thanks all! |
Description
VitePress Twoslash takes a long time to render large Types.
This PR solves part of this.
This PR can cache type information with the following code:
This will cache the type information in the specified directory.
Use a cache such as GitHub Actions with this to speed up your builds
Linked Issues
Nothing
Additional context
ElysiaJS appears to have cut back on Twoslash because it took 30 minutes to build the documentation. This PR may resolve it.
https://x.com/saltyAom/status/1842140132897615963