Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lemon-coats-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@marko/runtime-tags": patch
---

Fix attribute tags not being included in pre analyze transforms.
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,19 @@ export function preAnalyze(program: t.NodePath<t.Program>) {

function normalizeBody(
state: State,
body: t.NodePath<
t.Program["body"][number] | t.MarkoTagBody["body"][number]
>[],
body:
| undefined
| t.NodePath<
| t.Program["body"][number]
| t.MarkoTagBody["body"][number]
| t.MarkoTag["attributeTags"]
>[],
) {
for (const child of body) {
if (child.isMarkoTag()) {
normalizeTag(state, child);
if (body?.length) {
for (const child of body) {
if (child.isMarkoTag()) {
normalizeTag(state, child);
}
}
}
}
Expand All @@ -40,6 +46,7 @@ function normalizeTag(state: State, tag: t.NodePath<t.MarkoTag>) {
const { node } = tag;
const { name, attributes } = node;
normalizeBody(state, tag.get("body").get("body"));
normalizeBody(state, tag.get("attributeTags"));

if (node.var) {
const insertions = getAssignmentInsertions(node.var);
Expand Down