Skip to content

Add Ratio node type for media feature ratio values, fix clone() nesting - #285

Merged
bartveneman merged 2 commits into
mainfrom
fix/parse-ratio
Aug 3, 2026
Merged

Add Ratio node type for media feature ratio values, fix clone() nesting#285
bartveneman merged 2 commits into
mainfrom
fix/parse-ratio

Conversation

@bartveneman

Copy link
Copy Markdown
Member

Media features like aspect-ratio: 16/9 were exposing .value as just the numerator, silently dropping the denominator. Add a dedicated RATIO node type with left/right accessors so ratio values are represented as one coherent node, matching how scalar features (min-width: 768px) already work. Plain numbers (aspect-ratio: 1) are unaffected and still parse as a bare Number.

Also fix CSSNode.clone(), which assigned nested CSSNode properties (value, left, right, selector) directly instead of recursively cloning them — plain-object output leaked live arena-backed node instances instead of serializable data.

Media features like `aspect-ratio: 16/9` were exposing `.value` as just
the numerator, silently dropping the denominator. Add a dedicated
`RATIO` node type with `left`/`right` accessors so ratio values are
represented as one coherent node, matching how scalar features
(`min-width: 768px`) already work. Plain numbers (`aspect-ratio: 1`)
are unaffected and still parse as a bare `Number`.

Also fix `CSSNode.clone()`, which assigned nested `CSSNode` properties
(`value`, `left`, `right`, `selector`) directly instead of recursively
cloning them — plain-object output leaked live arena-backed node
instances instead of serializable data.
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

⚠️ Duplicate Dependencies (found: 3, threshold: 2)

📦 Package 📋 Versions
@emnapi/core
3 versions
  • root@
    • @vitest/coverage-v8@4.1.10
      • ...
        • rolldown@1.1.5
          • @rolldown/binding-wasm32-wasi@1.1.5
            • @emnapi/core@1.11.1

  • root@
    • knip@6.29.0
      • oxc-parser@0.140.0
        • @oxc-parser/binding-wasm32-wasi@0.140.0
          • @emnapi/core@1.11.2

  • root@
    • tsdown@0.22.14
      • rolldown@1.2.1
        • @rolldown/binding-wasm32-wasi@1.2.1
          • @emnapi/core@2.0.0-alpha.3

@emnapi/runtime
3 versions
  • root@
    • @vitest/coverage-v8@4.1.10
      • ...
        • rolldown@1.1.5
          • @rolldown/binding-wasm32-wasi@1.1.5
            • @emnapi/runtime@1.11.1

  • root@
    • knip@6.29.0
      • oxc-parser@0.140.0
        • @oxc-parser/binding-wasm32-wasi@0.140.0
          • @emnapi/runtime@1.11.2

  • root@
    • tsdown@0.22.14
      • rolldown@1.2.1
        • @rolldown/binding-wasm32-wasi@1.2.1
          • @emnapi/runtime@2.0.0-alpha.3

@oxc-project/types
3 versions
  • root@
    • @vitest/coverage-v8@4.1.10
      • ...
        • vite@8.1.5
          • rolldown@1.1.5
            • @oxc-project/types@0.139.0

  • root@
    • knip@6.29.0
      • oxc-parser@0.140.0
        • @oxc-project/types@0.140.0

  • root@
    • tsdown@0.22.14
      • rolldown@1.2.1
        • @oxc-project/types@0.142.0

💡 To find out what depends on a specific package, run: pnpm -r why example-package

⚠️ Package Size Increase

📦 Package 📏 Base Size 📏 Source Size 📈 Size Change
@projectwallace/css-parser 40.6 kB 41.1 kB +562 B

@bartveneman
bartveneman merged commit 06fbbf5 into main Aug 3, 2026
8 of 9 checks passed
@bartveneman
bartveneman deleted the fix/parse-ratio branch August 3, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant