Repository navigation
feat(options): pass the collapseNesting enum through the Less wrapper - #4533
matthew-dean merged 2 commits into
Conversation
Less v5's `collapseNesting` is now an enum — `false` (default: keep authored nesting), `'native'` (CSS Nesting desugaring: parent `:is()`, child list distributed, specificity-faithful), `'compact'` (also folds same-combinator descendant runs into one `:is()`), with `true` a deprecated alias for `'native'`. The wrapper previously coerced the option to a boolean (`=== true`), so a `'native'`/`'compact'` request silently fell through to nested output. Pass the validated enum through to the compiler instead; `true` still maps to the flattened projection. lessc-alpha covers passthrough, rejection of unknown values, and the native-distributes / compact-folds render behavior.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
|
Forwarded/spread option objects can carry `collapseNesting: undefined`; the own-property check let that reach resolveCollapseNesting and throw. Gate on `!== undefined` so an absent/undefined value falls back to the default nesting mode instead of erroring. Covered in lessc-alpha.
Exposes Less v5's
collapseNestingenum through the public Less render options.Why
collapseNestingbecame an enum in Jess2.0.0-alpha.20:false(default) — keep authored nesting (native CSS nested output).'native'— the CSS Nesting desugaring: parent wrapped in:is(), child selector lists distributed, so each branch keeps its own specificity (matching the browser and Less 4.x).'compact'— like'native'but also folds same-combinator descendant runs into a single:is().true— deprecated alias for'native'.The wrapper still coerced the option to a boolean (
opts.collapseNesting === true), so a'native'or'compact'request silently fell through to nested output. This passes the validated enum straight to the compiler;truecontinues to map to the flattened projection, and an unknown value is rejected with a clear error.Tests
lessc-alphanow asserts:false/'native'/'compact'/trueeach pass through tooutput: [{ collapseNesting: <value> }].'native'distributes a child selector list (:is(.a, .b) .c,:is(.a, .b) .d) while'compact'folds it (:is(.a, .b) :is(.c, .d)).Full
packages/lessalpha suite passes (91 fixtures, packed-consumer proof against Jess2.0.0-alpha.20).