| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Rules inside @layer blocks were silently dropped by _populateRules, which only descends into @media. This makes NativeScript unable to consume stylesheets emitted by modern build-time CSS compilers (Tailwind v4, Panda, Bamboo — all emit cascade layers). - css-tree adapter captures the @layer prelude and nested rules - _populateRules assigns each ruleset a layerPath of first-seen ordinals; statement form `@layer a, b;` pre-declares order, dotted names resolve through ancestors, anonymous blocks get synthetic ids - compareSelectors orders by layerPath before specificity, with unlayered rules sorting last (winning) per spec - @import "x.css" layer(name) nests the imported sheet's rules
|
View your CI Pipeline Execution ↗ for commit 4182f37
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at 2026-09-28 05:07:31 UTC |
Sorry, something went wrong.
npm i https://pkg.pr.new/@nativescript/core@11462 npm i https://pkg.pr.new/@nativescript/vite@11462 npm i https://pkg.pr.new/@nativescript/webpack@11462 commit: 4182f37 |
Sorry, something went wrong.
The build-time css→AST serialization (webpack css2json-loader, vite's
bundled-css serializer in @nativescript/vite helpers/main-entry) runs the
rework parser, which mis-parsed `@layer` into garbage selectors and
dropped the rules. Teach it both forms — `@layer name { rules }` and the
order-declaring `@layer a, b;` statement — emitting layer nodes the
cascade now consumes. Also fixes the legacy __CSS_PARSER__=rework
runtime path.
Spec drives the same ordering through the rework AST end to end.
| Back | FazBrowse Home | New Git URL |
PR Checklist
What is the current behavior?
Rules inside @layer blocks are silently dropped: _populateRules (ui/styling/style-scope.ts) only descends into @media at-rules, so every modern build-time CSS pipeline that emits cascade layers (Tailwind v4, Panda CSS, Bamboo, UnoCSS) produces a stylesheet that is dead on NativeScript — see NativeScript/tailwind#197 for the same wall hit from the Tailwind side.
What is the new behavior?
@layer applies per CSS Cascading and Inheritance Level 5:
Deliberately not implemented: !important layer-order reversal — NativeScript does not implement !important at all today (cleanupImportantFlags warns and strips), so there is nothing to reverse. @supports/@container/@scope remain dropped (they need real condition evaluation; dropping is safer than unconditional application).
Known follow-up (out of scope here)
The bundler-side serializers — @nativescript/vite's bundled-css path (helpers/main-entry.ts, parseCssToAst) and webpack's css2json-loader — run the npm css package (reworkcss/css), which misparses @layer into bogus selectors and drops the rules. That package is a separate upstream; swapping those call sites to core's now-layer-aware vendored parser (or css-tree) is the natural follow-up.
Tests
New ui/styling/css-layer.spec.ts — 13 cases covering population, statement ordering over specificity+position, unlayered-beats-layered, nested/dotted equivalence, anonymous ordering, media queries inside layers, keyframes inside layers, and the same ordering driven through the rework-parser AST end to end. Verified on-device (iOS sim) via a harness probe: a class rule in the later layer beat an id selector in the earlier one, and an unlayered rule beat a layered id selector. Full packages/core suite: 510 tests passing locally.
Implements #11461.