Commit 38bf8e5
authored
breaking: add intermedia
breaking: make AtRule.prelude return CSSNode instead of string
Changes the `.prelude` getter on at-rule nodes to return `CSSNode |
null`
instead of `string | null`, matching CSSTree's API and enabling
traversal
of structured prelude children (media queries, layer names, etc.).
BREAKING CHANGES:
- AtRule.prelude now returns CSSNode | null instead of string | null
- Use .prelude.text to get the text representation
- Use .value for raw string when prelude parsing is disabled or
unsupported
- At-rules without structured prelude parsing return null
- clone() no longer extracts prelude as a property (now part of
children)
Implementation:
- Added AT_RULE_PRELUDE (40) wrapper node type
- Parser wraps parsed prelude nodes before adding to at-rule children
- Updated prelude getter to return AT_RULE_PRELUDE node or null
- Exported AT_RULE_PRELUDE constant via constants.ts
- Updated all 1107 tests to use new API
Benefits:
- Enables walking prelude children like CSSTree
- Provides structured access to media queries, layer names, etc.
- Maintains text access via .prelude.text
- Preserves arena efficiency (one wrapper per at-rule)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <[email protected]>AtrulePrelude node type (#107)1 parent 599f11a commit 38bf8e5
File tree
7 files changed
+297
-232
lines changed- src
7 files changed
+297
-232
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
80 | 101 | | |
81 | 102 | | |
82 | 103 | | |
| |||
86 | 107 | | |
87 | 108 | | |
88 | 109 | | |
89 | | - | |
| 110 | + | |
| 111 | + | |
90 | 112 | | |
91 | 113 | | |
92 | 114 | | |
| |||
96 | 118 | | |
97 | 119 | | |
98 | 120 | | |
99 | | - | |
| 121 | + | |
| 122 | + | |
100 | 123 | | |
101 | 124 | | |
102 | 125 | | |
| |||
116 | 139 | | |
117 | 140 | | |
118 | 141 | | |
119 | | - | |
| 142 | + | |
| 143 | + | |
120 | 144 | | |
121 | 145 | | |
122 | 146 | | |
| |||
573 | 597 | | |
574 | 598 | | |
575 | 599 | | |
576 | | - | |
| 600 | + | |
| 601 | + | |
577 | 602 | | |
578 | | - | |
| 603 | + | |
579 | 604 | | |
580 | 605 | | |
581 | 606 | | |
| |||
1082 | 1107 | | |
1083 | 1108 | | |
1084 | 1109 | | |
1085 | | - | |
| 1110 | + | |
1086 | 1111 | | |
1087 | 1112 | | |
1088 | 1113 | | |
1089 | 1114 | | |
1090 | 1115 | | |
1091 | 1116 | | |
1092 | 1117 | | |
1093 | | - | |
| 1118 | + | |
| 1119 | + | |
1094 | 1120 | | |
1095 | 1121 | | |
1096 | 1122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| 96 | + | |
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
| |||
149 | 151 | | |
150 | 152 | | |
151 | 153 | | |
| 154 | + | |
152 | 155 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| 94 | + | |
93 | 95 | | |
94 | 96 | | |
95 | 97 | | |
| |||
134 | 136 | | |
135 | 137 | | |
136 | 138 | | |
| 139 | + | |
137 | 140 | | |
138 | 141 | | |
139 | 142 | | |
| |||
304 | 307 | | |
305 | 308 | | |
306 | 309 | | |
307 | | - | |
308 | | - | |
| 310 | + | |
| 311 | + | |
309 | 312 | | |
310 | | - | |
311 | | - | |
312 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
313 | 320 | | |
314 | 321 | | |
315 | 322 | | |
| |||
734 | 741 | | |
735 | 742 | | |
736 | 743 | | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
741 | 747 | | |
742 | 748 | | |
743 | 749 | | |
| |||
0 commit comments