Skip to content
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: deprecate svelte:component #12694

Merged
merged 5 commits into from
Aug 12, 2024

Conversation

paoloricciuti
Copy link
Member

Svelte 5 rewrite

Close #12668

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 not main.

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

Copy link

changeset-bot bot commented Aug 1, 2024

🦋 Changeset detected

Latest commit: 63968ea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

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

@paoloricciuti paoloricciuti changed the title Deprecate svelte component feat: deprecate svelte:component and warn for lowercase object.component rendering Aug 1, 2024
@Rich-Harris
Copy link
Member

The more I think about this, the more I think we should just treat <foo.bar> as a component. That's what e.g. React and Solid do. No element can have a . in the name (except for custom elements, which are easily identified by the -).

The only sticking point that I'm aware of is Svelte Native, which has something called property elements. @halfnelson would this change be a dealbreaker?

@paoloricciuti
Copy link
Member Author

The more I think about this, the more I think we should just treat <foo.bar> as a component. That's what e.g. React and Solid do. No element can have a . in the name (except for custom elements, which are easily identified by the -).

I mean technically you could have a <weird.element> on the page that is a custom element and not a web component...but to be fair i think it could be safely assumed noone is actually doing stuff like this.

The only sticking point that I'm aware of is Svelte Native, which has something called property elements. @halfnelson would this change be a dealbreaker?

How are they dealing with it? If it's a preprocessor thing wouldn't that be invisible to svelte?

@Rich-Harris
Copy link
Member

I have no idea, but it doesn't look like it's preprocessing (there is a Svelte Native preprocessor, but it only replaces bind:value with an event handler)

@paoloricciuti
Copy link
Member Author

I have no idea, but it doesn't look like it's preprocessing (there is a Svelte Native preprocessor, but it only replaces bind:value with an event handler)

I dug a bit: at least from what i could understand they are shimming the dom api and they are swapping document.createElement with something that returns their custom elements that are compatible with NativeScript

https://github.com/halfnelson/svelte-native/blob/058c4e6aea3028151710d5e1317935d9b470a468/src/dom/basicdom/DocumentNode.ts#L23-L29

But if i'm not mistaken thet will need to rewrite this part already right?

@Rich-Harris
Copy link
Member

Given that we no longer call document.createElement but instead clone nodes from templates, yes I'd expect that to break

@paoloricciuti
Copy link
Member Author

Given that we no longer call document.createElement but instead clone nodes from templates, yes I'd expect that to break

If they plan to "override" clone node treating <comp.onent> as a component would still break them but let's wait to hear from them what they plan to do to support svelte 5

@paoloricciuti
Copy link
Member Author

@Rich-Harris should we split the svelte:component working from the lowercase object.component warning so that we can at least merge that until we have an answer from @halfnelson ?

@Rich-Harris
Copy link
Member

Yeah, that's probably the right move

@paoloricciuti
Copy link
Member Author

Yeah, that's probably the right move

Ok gonna do it quickly and gonna open a new one where we can discuss

Co-authored-by: Oscar Dominguez <dominguez.celada@gmail.com>
@paoloricciuti paoloricciuti changed the title feat: deprecate svelte:component and warn for lowercase object.component rendering feat: deprecate svelte:component Aug 6, 2024
@paoloricciuti
Copy link
Member Author

@Rich-Harris should be good to go now, gonna open the second pr with the other code

@bdmackie
Copy link

bdmackie commented Aug 13, 2024

FYI after bumping to 219 I'm getting <svelte:component> is deprecated in runes mode warnings on build even though I'm dynamically rendering the components and not using svelte:component.
Repro: https://stackblitz.com/edit/svelte5-kit-iscomp-d8sd

also FYI - the Svelte 5 docs page still references using svelte:component higher up when talking about components being dynamic.

@paoloricciuti
Copy link
Member Author

FYI after bumping to 219 I'm getting <svelte:component> is deprecated in runes mode errors on build even though I'm dynamically rendering the components and not using svelte:component. Repro: https://stackblitz.com/edit/svelte5-kit-iscomp-d8sd

also FYI - the Svelte 5 docs page still references using svelte:component higher up when talking about components being dynamic.

That's because sveltekit is using it...we should probably ignore it there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Svelte 5: deprecate <svelte:component>
3 participants