Repository navigation
feat!: wrap @import layer() and supports() in a Function node - #318
Merged
Merged
Conversation
BREAKING CHANGE: in an `@import` prelude, `layer(name)` and `supports(...)` are
now `Function` nodes instead of `LayerName` / `SupportsQuery` nodes.
- `layer(a.b)` -> Function{name='layer'} > LayerName{name='a.b'}
- `layer()` -> Function{name='layer'} without children
- `layer` -> LayerName (unchanged, name='')
- `supports(d: g)` -> Function{name='supports'} > SupportsQuery > SupportsDeclaration
- `supports((a) and (b))` -> Function{name='supports'} with the same flat
children as an `@supports` prelude
The Function owns the surrounding parentheses; a SupportsQuery only owns
parentheses that are present in the source.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
|
| 📦 Package | 📏 Base Size | 📏 Source Size | 📈 Size Change |
|---|---|---|---|
| @projectwallace/css-parser | 47.2 kB | 47.4 kB | +149 B |
Member
Author
|
The
Everything this PR touches is green: Build, Lint, Lint unused code, Unit tests, Check types, Check permissions and Diff dependencies. I'm leaving Generated by Claude Code |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
commit: |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
bartveneman
force-pushed
the
claude/sharp-thompson-4ueybv
branch
from
October 21, 2026 16:52
3150999 to
615f813
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses #195. In an
@importprelude,layer(...)andsupports(...)are nowFunctionnodes instead ofLayerName/SupportsQuerynodes.layer(a.b)LayerName{name='a.b'}Function{name='layer'} > LayerName{name='a.b'}layer()LayerName{name=''}Function{name='layer'}without childrenlayerLayerName{name=''}supports(display: grid)SupportsQuery > SupportsDeclarationFunction{name='supports'} > SupportsQuery > SupportsDeclarationsupports((a) and (b))SupportsQuery(rawvalueonly)Function{name='supports'}with the same flat children as an@supportspreludeParentheses ownership
Functionowns the outersupports(and).SupportsQueryonly owns parentheses that are present in the source: paren-less insidesupports(display: grid), with its own(…)insupports((a) and (b))and in@supports.Breaking change
Consumers matching
LAYER_NAME/SUPPORTS_QUERYdirectly in an@importprelude must now look inside theFunctionchild.@layerand@supportspreludes are unchanged, and noLayerListnode was added.LayerNametypes are unchanged. TheFunctionchild union now includesLayerName.Migration
Who is affected: anyone who walks an
@importprelude and matchesLAYER_NAMEorSUPPORTS_QUERYon its direct children.@layerand@supportspreludes are unchanged.Shapes in detail
layer(a.b)Layername='a.b',text='layer(a.b)'Functionname='layer',value='a.b', with a childLayername='a.b',text='a.b'layer()Layername=''Functionname='layer', no childrenlayer(bare)Layername=''supports(display: grid)SupportsQueryvalue='display: grid',text='supports(display: grid)', childSupportsDeclarationFunctionname='supports',value='display: grid', with a childSupportsQuerytext='display: grid', which has the childSupportsDeclarationsupports((a: b) and (c: d))SupportsQuerywith only a rawvalue, no childrenFunctionname='supports'with the same children an@supports (a: b) and (c: d)prelude has:SupportsQuery,Operator,SupportsQueryCode changes
Things to watch for:
layer: it is still aLayerNameat the top level withname === ''. Onlylayer(…)is wrapped, so handle both.layer(): it has no children, sofirst_childisnull.supports(): its children are either a singleSupportsQueryor the compound condition nodes. Don't assume a particular child type.Functiontypes:Function's child union now includesLayerName, sonode.first_childnarrows correctly.LayerListor other node type was added, and node type numbers are unchanged.Testing
pnpm exec vitest run,tsc --noEmit,oxlint,oxfmt --checkandknippass. Tests were updated to the new shapes, with added cases forlayer(), emptysupports()and compoundsupports()conditions.Generated by Claude Code