Add Ratio node type for media feature ratio values, fix clone() nesting - #285
Merged
Conversation
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.
Contributor
|
| 📦 Package | 📋 Versions |
|---|---|
| @emnapi/core | 3 versions
|
| @emnapi/runtime | 3 versions
|
| @oxc-project/types | 3 versions
|
💡 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 |
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.
Media features like
aspect-ratio: 16/9were exposing.valueas just the numerator, silently dropping the denominator. Add a dedicatedRATIOnode type withleft/rightaccessors 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 bareNumber.Also fix
CSSNode.clone(), which assigned nestedCSSNodeproperties (value,left,right,selector) directly instead of recursively cloning them — plain-object output leaked live arena-backed node instances instead of serializable data.