-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat: support migration of svelte:component
#13437
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
Conversation
🦋 Changeset detectedLatest commit: d492dc8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Judging from the tests it's impressive how many cases it handles (honestly more than I think we need to), but I'm a bit surprised about all the additional code for Component
and SvelteComponent
- why do we need to account for slots, comments, the last const binding, etc etc? My (maybe too simplistic) first thought was that we'd call context.next()
in the (Svelte)Component visitor first, then remove the this
attribute, then replace the svelte:component
tags with whatever replacement they need and potentially prepend a @const
directly before it. What's the reason this isn't enough?
I was honestly surprised too, the I'll try with your suggestion and i'm pretty sure it's simplify-able (that will result in probably a tad uglier code in some cases but i think it's perfectly reasonable). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this looks a lot better already!
svelte:component
svelte:component
Svelte 5 rewrite
Closes #13418
As usual this kinda opened a can of
wormsedge cases so i had to go through multiple hops for something and there might be better ways to do it but it should work decently (you can see the transform from the output of the test)Please note that the Svelte codebase is currently being rewritten for Svelte 5. Changes should target Svelte 5, which lives on the default branch (
main
).If your PR concerns Svelte 4 (including updates to svelte.dev.docs), please ensure the base branch is
svelte-4
and notmain
.Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint