Skip to content

Conversation

@bartveneman
Copy link
Member

BREAKING CHANGES:

  • Declaration.value now returns VALUE node instead of raw string
  • Declaration.values property removed
  • Declaration.children now returns [VALUE] instead of value tokens
  • parse_value() function returns CSSNode instead of CSSNode[]

Add VALUE node type (19) to wrap all declaration value tokens.
Each declaration now has a single VALUE child node that contains
the individual value tokens (IDENTIFIER, DIMENSION, etc.) as its
children.

Implementation changes:

  • Add VALUE constant (19) in arena.ts
  • Update NODES_PER_KB from 270 to 325 (+20% for VALUE wrappers)
  • Modify CSSNode.value getter to return VALUE node for declarations
  • Remove CSSNode.values getter (redundant)
  • Update ValueParser.parse_value() to return single VALUE node
  • Update DeclarationParser to create VALUE node for empty values
  • Export VALUE from constants.ts
  • Update 1068+ tests to use new API

Migration guide:
OLD: const text = declaration.value // "10px 20px"
OLD: const tokens = declaration.values // [DIMENSION, DIMENSION]
NEW: const valueNode = declaration.value // VALUE node
NEW: const text = valueNode.text // "10px 20px"
NEW: const tokens = valueNode.children // [DIMENSION, DIMENSION]

@codecov-commenter
Copy link

codecov-commenter commented Jan 2, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.09%. Comparing base (ab661d7) to head (3c2e180).

Files with missing lines Patch % Lines
src/parse-value.ts 78.57% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #97      +/-   ##
==========================================
+ Coverage   95.07%   95.09%   +0.01%     
==========================================
  Files          15       15              
  Lines        2559     2567       +8     
  Branches      662      665       +3     
==========================================
+ Hits         2433     2441       +8     
  Misses        126      126              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bartveneman bartveneman merged commit a4e5075 into main Jan 2, 2026
5 checks passed
@bartveneman bartveneman deleted the value-node branch January 2, 2026 16:48
@codecov-commenter
Copy link

codecov-commenter commented Jan 3, 2026

Bundle Report

Changes will increase total bundle size by 850 bytes (0.62%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
@projectwallace/css-parser-esm 138.76kB 850 bytes (0.62%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: @projectwallace/css-parser-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
parse-*.js 607 bytes 8.39kB 7.8% ⚠️
parse-*.js 220 bytes 6.93kB 3.28%
css-*.js -180 bytes 16.55kB -1.08%
arena.js 173 bytes 10.91kB 1.61%
constants.js 23 bytes 2.03kB 1.14%
index.js 7 bytes 1.8kB 0.39%

Files in parse-*.js:

  • ./src/parse-value.ts → Total Size: 7.8kB

Files in parse-*.js:

  • ./src/parse-declaration.ts → Total Size: 6.29kB

Files in css-*.js:

  • ./src/css-node.ts → Total Size: 15.71kB

Files in arena.js:

  • ./src/arena.ts → Total Size: 10.01kB

Files in constants.js:

  • ./src/constants.ts → Total Size: 681 bytes

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.

3 participants