Load preparser also from theme#2558
Open
jgosmann wants to merge 3 commits into
Open
Conversation
This will later allow to use the resolved roots for loading preparsers without duplication the roots resolution there.
… else - Preparsers weren't loaded from the theme which was inconsistent to other things (e.g. styles) and not documented. - Besides consistency, this avoids resolving addons twice which is apparently a somewhat expensive operation. Fixes slidevjs#2402.
✅ Deploy Preview for slidev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@slidev/client
create-slidev
create-slidev-theme
@slidev/parser
@slidev/cli
@slidev/types
commit: |
jgosmann
commented
Apr 24, 2026
| async function loadProject(entry: string) { | ||
| const userRoot = dirname(entry) | ||
| return markRaw(await load(userRoot, entry, async (path: string) => { | ||
| return markRaw(await load({ userRoot, roots: [userRoot] }, entry, async (path: string) => { |
Contributor
Author
There was a problem hiding this comment.
I'm not familiar with the VSCode plugin and I'm not using it. Is it fine to just consider the userRoot here? @slidev/cli seems not accessible here to use resolveOptions for resolving all the roots.
But setupPreparser is only called in node/cli.ts, so I suppose the VSCode extension is not running any preparsers anyways?
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.
Not loading preparsers from the theme is unexpected (cp. #2402, #2456) and not documented. This PR aligns the behavior such that preparsers are also loaded from the theme. It also avoids duplicating the logic to determine the roots that things are loaded from, which might also improve perforrmance by avoiding doing
resolveAddonstwice. I hope this is in line with the requested refactor.I explained my use cases for wanting to load a preparser from a theme in a prior comment.