Closed MoustaphaDev closed 10 months ago
Latest commit: 97ce7ae135f43c8929d6cfa2cc7b1b53c10c962c
The changes in this PR will be included in the next version bump.
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
!preview dynamic-slot-names
> root@0.0.0 release /home/runner/work/compiler/compiler > changeset publish "--tag" "next--dynamic-slot-names" 🦋 warn ===============================IMPORTANT!=============================== 🦋 warn Packages will be released under the next--dynamic-slot-names tag 🦋 warn ---------------------------------------------------------------------- 🦋 info npm info @astrojs/compiler 🦋 info @astrojs/compiler is being published because our local version (0.0.0-dynamic-slot-names-20240103232344) has not been published on npm 🦋 info Publishing "@astrojs/compiler" at "0.0.0-dynamic-slot-names-20240103232344" 🦋 success packages published successfully: 🦋 @astrojs/compiler@0.0.0-dynamic-slot-names-20240103232344 🦋 Creating git tag... 🦋 New tag: @astrojs/compiler@0.0.0-dynamic-slot-names-20240103232344
!preview dynamic-slot-names
> root@0.0.0 release /home/runner/work/compiler/compiler > changeset publish "--tag" "next--dynamic-slot-names" 🦋 warn ===============================IMPORTANT!=============================== 🦋 warn Packages will be released under the next--dynamic-slot-names tag 🦋 warn ---------------------------------------------------------------------- 🦋 info npm info @astrojs/compiler 🦋 warn @astrojs/compiler is not being published because version 2.4.0 is already published on npm 🦋 warn No unpublished projects to publish
!preview dynamic-slot-names
> root@0.0.0 release /home/runner/work/compiler/compiler > changeset publish "--tag" "next--dynamic-slot-names" 🦋 warn ===============================IMPORTANT!=============================== 🦋 warn Packages will be released under the next--dynamic-slot-names tag 🦋 warn ---------------------------------------------------------------------- 🦋 info npm info @astrojs/compiler 🦋 warn @astrojs/compiler is not being published because version 2.4.0 is already published on npm 🦋 warn No unpublished projects to publish
!preview dynamic-slot-names
> root@0.0.0 release /home/runner/work/compiler/compiler > changeset publish "--tag" "next--dynamic-slot-names" 🦋 warn ===============================IMPORTANT!=============================== 🦋 warn Packages will be released under the next--dynamic-slot-names tag 🦋 warn ---------------------------------------------------------------------- 🦋 info npm info @astrojs/compiler 🦋 warn @astrojs/compiler is not being published because version 2.4.0 is already published on npm 🦋 warn No unpublished projects to publish
!preview dynamic-slot-names
> root@0.0.0 release /home/runner/work/compiler/compiler > changeset publish "--tag" "next--dynamic-slot-names" 🦋 warn ===============================IMPORTANT!=============================== 🦋 warn Packages will be released under the next--dynamic-slot-names tag 🦋 warn ---------------------------------------------------------------------- 🦋 info npm info @astrojs/compiler 🦋 info @astrojs/compiler is being published because our local version (0.0.0-dynamic-slot-names-20240108101214) has not been published on npm 🦋 info Publishing "@astrojs/compiler" at "0.0.0-dynamic-slot-names-20240108101214" 🦋 success packages published successfully: 🦋 @astrojs/compiler@0.0.0-dynamic-slot-names-20240108101214 🦋 Creating git tag... 🦋 New tag: @astrojs/compiler@0.0.0-dynamic-slot-names-20240108101214
!preview dynamic-slot-names
> root@0.0.0 release /home/runner/work/compiler/compiler > changeset publish "--tag" "next--dynamic-slot-names" 🦋 warn ===============================IMPORTANT!=============================== 🦋 warn Packages will be released under the next--dynamic-slot-names tag 🦋 warn ---------------------------------------------------------------------- 🦋 info npm info @astrojs/compiler 🦋 info @astrojs/compiler is being published because our local version (0.0.0-dynamic-slot-names-20240109194342) has not been published on npm 🦋 info Publishing "@astrojs/compiler" at "0.0.0-dynamic-slot-names-20240109194342" 🦋 success packages published successfully: 🦋 @astrojs/compiler@0.0.0-dynamic-slot-names-20240109194342 🦋 Creating git tag... 🦋 New tag: @astrojs/compiler@0.0.0-dynamic-slot-names-20240109194342
!preview dynamic-slot-names
> root@0.0.0 release /home/runner/work/compiler/compiler > changeset publish "--tag" "next--dynamic-slot-names" 🦋 warn ===============================IMPORTANT!=============================== 🦋 warn Packages will be released under the next--dynamic-slot-names tag 🦋 warn ---------------------------------------------------------------------- 🦋 info npm info @astrojs/compiler 🦋 info @astrojs/compiler is being published because our local version (0.0.0-dynamic-slot-names-20240110221555) has not been published on npm 🦋 info Publishing "@astrojs/compiler" at "0.0.0-dynamic-slot-names-20240110221555" 🦋 success packages published successfully: 🦋 @astrojs/compiler@0.0.0-dynamic-slot-names-20240110221555 🦋 Creating git tag... 🦋 New tag: @astrojs/compiler@0.0.0-dynamic-slot-names-20240110221555
!preview dynamic-slot-names
> root@0.0.0 release /home/runner/work/compiler/compiler > changeset publish "--tag" "next--dynamic-slot-names" 🦋 warn ===============================IMPORTANT!=============================== 🦋 warn Packages will be released under the next--dynamic-slot-names tag 🦋 warn ---------------------------------------------------------------------- 🦋 info npm info @astrojs/compiler 🦋 info @astrojs/compiler is being published because our local version (0.0.0-dynamic-slot-names-20240111152903) has not been published on npm 🦋 info Publishing "@astrojs/compiler" at "0.0.0-dynamic-slot-names-20240111152903" 🦋 success packages published successfully: 🦋 @astrojs/compiler@0.0.0-dynamic-slot-names-20240111152903 🦋 Creating git tag... 🦋 New tag: @astrojs/compiler@0.0.0-dynamic-slot-names-20240111152903
Yes, this is backwards compatible as it doesn't break any current slot functionality. Only users on older Astro versions attempting to use this feature will encounter issues (which they of course did even before this release if they tried to). I can make a PR to docs to communicate that clearly
Changes
undefined
slot name issue will be tackled in another PRPreviously, using variables as slot names within loops was not possible because the slot object (specifically, the slot key) wasn't printed in the same location as the slotted elements.
This PR addresses this issue by refactoring the slot printing logic to ensure that the slot object is printed alongside the slotted elements when a dynamic slot name is used.
The other issues were fortuitously fixed with the refactor
Testing
Added test cases covering each issue
Docs
This wasn't possible before so we should probably document this. I'll make a docs PR