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/concise-attr-line-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"htmljs-parser": patch
---

Report the comments on the lines before a comma-continued concise attr line through `onOpenTagComment`. They were skipped without an event, so consumers dropped them.
12 changes: 12 additions & 0 deletions agent-feedback/items/2026-09-23-bench-compare-installs-with-npm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
type: dx
impact: low
effort: low
site: bench.ts
---

# Install the COMPARE build with pnpm in the bench

`COMPARE=<ref> pnpm run bench` clones the ref and runs `npm ci && npm run --if-present build` in it, but the repo only has a `pnpm-lock.yaml`, so `npm ci` exits with `EUSAGE` and the comparison never runs. Run `pnpm install --frozen-lockfile && pnpm run build` instead. Because the clone's directory is created before the install, a failed run also leaves it behind, and the next run sees it and skips the install, then fails to import the unbuilt `dist`. Only treat the clone as ready once its build has finished.

Check: `rm -rf "$TMPDIR/htmljs-bench-main" /tmp/htmljs-bench-main; COMPARE=main GREP=attr-comma pnpm run bench` fails with `The npm ci command can only install with an existing package-lock.json`.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
│ │ │╰─ attrValue.value "bar"
│ │ ╰─ attrValue "=bar"
╰─ ╰─ attrName "foo"
3├─ // comment
3╭─ // comment
│ │ ╰─ openTagComment.value " comment"
╰─ ╰─ openTagComment "// comment"
4╭─ ,bar=baz
│ │ │╰─ attrValue.value "baz"
│ │ ╰─ attrValue "=baz"
╰─ ╰─ attrName "bar"
5├─ /* block */
5╭─ /* block */
│ │ ╰─ openTagComment.value " block "
╰─ ╰─ openTagComment "/* block */"
6╭─ ,qux=qux
│ │ │╰─ attrValue.value "qux"
│ │ ╰─ attrValue "=qux"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@
│ ├─ closeTagEnd(div)
│ ├─ openTagEnd
╰─ ╰─ tagName "span"
3╭─
3╭─ input
│ ├─ closeTagEnd(span)
│ ├─ openTagEnd
╰─ ╰─ closeTagEnd(span)
╰─ ╰─ tagName "input"
4╭─ // e
│ │ ╰─ openTagComment.value " e"
╰─ ╰─ openTagComment "// e"
5╭─ /* f */
│ │ ╰─ openTagComment.value " f "
╰─ ╰─ openTagComment "/* f */"
6╭─ ,type="text"
│ │ │╰─ attrValue.value "\"text\""
│ │ ╰─ attrValue "=\"text\""
╰─ ╰─ attrName "type"
7╭─
╰─ ╰─ openTagEnd
4 changes: 4 additions & 0 deletions src/__tests__/fixtures/open-tag-comments-concise/input.marko
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
div /* c */ a=1
span // d
input
// e
/* f */
,type="text"
6 changes: 3 additions & 3 deletions src/states/OPEN_TAG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ export const OPEN_TAG: StateDefinition<OpenTagMeta> = {
}
}

// comma continues the open tag with another line attribute
// comma continues the open tag with another line attribute, so
// the comments before it are parsed as part of the open tag
if (data.charCodeAt(cur) === CODE.COMMA) {
this.pos = cur + 1;
this.consumeWhitespace();
this.pos += len;
continue;
}

Expand Down
Loading