Repository navigation
build(tooling): add a parser-agreement column to the CSS, HTML and XML parse tables - #22907
Conversation
…L parse tables Hold webpack (and postcss, xmldom, htmlparser2 where they build a comparable tree) to css-tree, parse5 and @rgrove/parse-xml, naming the first differing node. Table-only.
|
Types CoverageCoverage after merging build/parser-agreement-column into main will be
Coverage Report |
|
This PR is packaged and the instant preview of its latest commit is available. Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@22907
yarn add -D webpack@https://pkg.pr.new/webpack@22907
pnpm add -D webpack@https://pkg.pr.new/webpack@22907 |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Shared tree-event comparison tooling/compare-tools-harness.js, test/unitCases/tooling/compare-harness.unittest.js, tooling/COMPARE_TOOLS.md |
The harness records and compares tree events, and reports parser agreement or errors. Tests cover event paths, first differences, and parser failures. The documentation describes the comparison tables and their non-gating status. |
CSS parser agreement tooling/compare-css-tools.js, test/unitCases/tooling/compare-css.unittest.js, cspell.json |
The CSS tool compares css-tree, webpack, and PostCSS trees. Tests cover matching trees and a mismatch. The spell-checker word list adds atrule. |
HTML parser agreement tooling/compare-html-tools.js, test/unitCases/tooling/compare-html.unittest.js |
The HTML tool compares webpack parser trees with parse5. Tests cover BOM handling and a tree mismatch. |
XML parser agreement tooling/compare-xml-tools.js, test/unitCases/tooling/compare-xml.unittest.js |
The XML tool compares webpack, xmldom, and htmlparser2 trees with the reference parser. Tests cover matching trees and a tree mismatch. |
Priority:
Change: Feature
Merge Risk: 
Minimal · up to f199c
-
The parser-agreement additions do not establish an actionable issue blocking merge.
Pre-merge checks: 
4
-
Full details: Title check
-
Explanation
The title uses the conventional-commit form with scope: build(tooling). The type 'build' is in the allowed list. The title names the main change: a parser-agreement column added to the CSS, HTML and XML parse tables. The changeset matches that description. The requirement that the type match the branch prefix cannot be verified from the provided context, because no branch name was given.
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Generated code sizeComparing base (
Read No asset changed size. No runtime gained or lost a runtime module. Built |
Merging this PR will not alter performance1 warning, 1 note
Comparing |
Summary
The JS parse table already says whether each parser agrees with acorn. This adds the same column to the CSS, HTML and XML parse tables. Each parser's tree is flattened the same way and compared with a reference parser's tree: css-tree for CSS, parse5 for HTML,
@rgrove/parse-xmlfor XML. The cell names the first node where they differ. A parser that builds no tree, or a tree in its own shape, readsown dialect. The column is informational and doesn't gate anything.Before (HTML), the parse table had no agreement column:
After:
Results over the installed corpora:
@rgrove/parse-xmlMost CSS disagreements come from css-tree itself: it leaves some nested rules unparsed, and it keeps IE hacks like
*zoomthat the spec drops. One is a real difference in the tree: webpack walks a block's declarations before its nested rules (Designsystemet). A sample over the repo's owntest/inputs also turned up one webpack parser difference: a<?…cut off at the end of the input becomes no node, while the spec emits a bogus comment for it. This PR doesn't change that.What kind of change does this PR introduce?
build
Did you add tests for your changes?
Yes:
test/unitCases/tooling/compare-{harness,css,html,xml}.unittest.js. The reference parsers are stubbed there, since CI doesn't install the corpora.Does this PR introduce a breaking change?
No.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
Documented in
tooling/COMPARE_TOOLS.md.Use of AI
Written with Claude Code: it prototyped the comparison over the installed corpora, wrote the code, tests and docs, and ran lint and the targeted tests. The requester directed the work and reviews it.
Generated by Claude Code
Summary by CodeRabbit