unplugin / unplugin-icons

🤹 Access thousands of icons as components on-demand universally.
https://www.npmjs.com/package/unplugin-icons
MIT License
4.13k stars 144 forks source link

feat!: add Svelte 5 runes compiler support #347

Closed userquin closed 6 months ago

userquin commented 9 months ago

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

stackblitz[bot] commented 9 months ago

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

r-unruh commented 9 months ago

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

userquin commented 9 months ago

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 commented 9 months ago

https://github.com/userquin/unplugin-icons-svelte-runes

userquin commented 9 months ago

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 commented 9 months ago

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 commented 9 months ago

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 commented 9 months ago

https://github.com/userquin/unplugin-icons-svelte-runes/tree/runes-optimization