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!: add Svelte 5 runes compiler support #347

Merged
merged 9 commits into from
May 1, 2024

Conversation

userquin
Copy link
Member

@userquin userquin commented Feb 6, 2024

Description

See description.

We need to check if we need new custom types for runes or Svelte 5.

/cc @benmccann
/cc @dominikg

Linked Issues

closes #346

Additional context

Copy link

stackblitz bot commented Feb 6, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@r-unruh
Copy link

r-unruh commented Feb 6, 2024

You might want to add another case to the switch in src/index.ts.

@userquin userquin marked this pull request as draft February 6, 2024 18:48
@userquin userquin marked this pull request as draft February 6, 2024 18:48
@userquin
Copy link
Member Author

userquin commented Feb 6, 2024

We cannot use $props() directly in runes, we need the script (we cannot use $ as prefix in variable name in runes, it is a reserved prefix):

Working example

Reserved prefix error:

imagen

@userquin userquin marked this pull request as ready for review February 6, 2024 19:38
src/types.ts Outdated Show resolved Hide resolved
@userquin
Copy link
Member Author

userquin commented Feb 6, 2024

@userquin userquin changed the title feat: add Svelte 5 runes compiler feat!: add Svelte 5 runes compiler Feb 6, 2024
@userquin userquin changed the title feat!: add Svelte 5 runes compiler feat!: add Svelte 5 runes compiler support Feb 6, 2024
@userquin
Copy link
Member Author

userquin commented Feb 6, 2024

When removing {@html ...} from runes compiler, it seems we've found an Svelte 5 bug (?), generating all children variables but not being used:

In both cases:
imagen

Without {@html ...} (there is an extra > after svg, tested also fixing it):

imagen

With {@html ...}:

imagen

@benmccann
Copy link
Contributor

generating all children variables but not being used

I've reported that one in the past. They stated it's low priority because the bundler will remove the unused variables

@userquin
Copy link
Member Author

userquin commented Feb 6, 2024

I've reported that one in the past. They stated it's low priority because the bundler will remove the unused variables

ok, adding optimization, I'll check also the build output and create a new branch in my previous repo

@userquin userquin requested a review from benmccann February 7, 2024 00:14
@userquin
Copy link
Member Author

userquin commented Feb 7, 2024

@antfu antfu merged commit 4420eb2 into main May 1, 2024
2 checks passed
@antfu antfu deleted the userquin/feat-add-svelte-5-runes-compiler branch May 1, 2024 07:01
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 runes mode not working
4 participants