-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compiler): Support dynamic slot names (#9605)
* chore: try new compiler version * update mergeSlots function * chore: update lock file * add tests * simplify `mergeSlots` code * update compiler version * update lock file * fix failing test We were expecting the source code to produce an error, but in 2.4.0 of the compiler, that generates valid code * chore: changeset * chore: update deps --------- Co-authored-by: Nate Moore <[email protected]> Co-authored-by: Nate Moore <[email protected]>
- Loading branch information
1 parent
07f13e6
commit 8ce40a4
Showing
9 changed files
with
78 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"astro": patch | ||
--- | ||
|
||
Adds support for dynamic slot names |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/astro/e2e/fixtures/errors/src/pages/astro-syntax-error.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<h1>{// comment | ||
<h1>{while (true){}}</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/astro/test/fixtures/astro-slots/src/pages/dynamic-for.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
import Slotted from '../components/Slotted.astro'; | ||
const slotNames = ['a', 'b', 'c'] | ||
--- | ||
|
||
<html> | ||
<head> | ||
<!-- Head Stuff --> | ||
</head> | ||
<body> | ||
<Slotted> | ||
{()=>{ | ||
const slots:any[] = []; | ||
for (const slotName of slotNames) { | ||
slots.push(<span slot={slotName}>{slotName.toUpperCase()}</span>); | ||
} | ||
return slots; | ||
} | ||
} | ||
<span>Default</span> | ||
</Slotted> | ||
</body> | ||
</html> |
17 changes: 17 additions & 0 deletions
17
packages/astro/test/fixtures/astro-slots/src/pages/dynamic-map.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
import Slotted from '../components/Slotted.astro'; | ||
const slots = ['a', 'b', 'c'] | ||
--- | ||
|
||
<html> | ||
<head> | ||
<!-- Head Stuff --> | ||
</head> | ||
<body> | ||
<Slotted> | ||
{slots.map((slotName)=><span slot={slotName}>{slotName.toUpperCase()}</span>)} | ||
<span>Default</span> | ||
</Slotted> | ||
</body> | ||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.