Repository navigation
refactor(sveltekit): generate only Svelte 5 code - #422
Merged
Merged
Conversation
@prismicio/svelte v2 requires Svelte 5, so the Svelte 4 code that SvelteKit setup generated did not work. Setup, slice components, and setup instructions now always use Svelte 5 syntax. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L53y5wowGHwtT4aZJ3UsHY
1 of 3 tasks
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.
Resolves:
Description
Before this PR, SvelteKit setup and
prismic slice creategenerated Svelte 4 code in Svelte 4 projects. That code could not work, because@prismicio/sveltev2, the version that setup installs, requires Svelte 5.After this PR, the CLI always generates Svelte 5 code. Svelte 5 projects get the same files and instructions as before.
This is the first of a stack that adds SvelteKit 3 support (#418).
Checklist
Preview
How to QA 1
Run
prismic gen setupin a SvelteKit project with Svelte 5. Make sure that the generated files are the same as onmain.🤖 Generated with Claude Code
https://claude.ai/code/session_01L53y5wowGHwtT4aZJ3UsHY
Generated by Claude Code
Note
Medium Risk
Removes Svelte 4 codegen and version-based fallbacks, so Svelte 4 projects get Svelte 5 output that may not match their stack until they upgrade; aligns with @prismicio/svelte v2 requiring Svelte 5.
Overview
The SvelteKit adapter always emits Svelte 5 scaffolds and setup guidance, dropping runtime detection of the installed Svelte major and all Svelte 4 variants (
export let,<slot />, version-specific slice/layout templates).gen setupand slice creation now use a single code path:$props(),{@render children()}, and inlined head markup inrootLayoutTemplate. Manual PrismicPreview instructions are fixed to the Svelte 5 diff only. Tests shed Svelte 4 / missing-node_modulescases anduseSvelteKitno longer fakes a pinned Svelte version innode_modules.Reviewed by Cursor Bugbot for commit 3c5d817. Bugbot is set up for automated code reviews on this repo. Configure here.
Footnotes
Please use these labels when submitting a review:
⚠️ #issue: Strongly suggest a change.
❓ #ask: Ask a question.
💡 #idea: Suggest an idea.
🎉 #nice: Share a compliment. ↩