Skip to content

fix: when parse_* is false, add RAW nodes to AST#155

Merged
bartveneman merged 2 commits intomainfrom
fix/-skip-parse-raw-nodes
Mar 6, 2026
Merged

fix: when parse_* is false, add RAW nodes to AST#155
bartveneman merged 2 commits intomainfrom
fix/-skip-parse-raw-nodes

Conversation

@bartveneman
Copy link
Member

@bartveneman bartveneman commented Mar 6, 2026

closes #154

  • src/parse.ts: Selector fallback now creates a RAW node when
    parse_selectors_enabled is false, instead of always using SELECTOR_LIST
  • src/parse-declaration.ts: Added RAW import and an else branch that creates a
    RAW node as a child of DECLARATION when value_parser is null (parse_values:
    false)
  • src/css-node.ts: Updated the value getter to only return first_child when
    it's a VALUE node (not RAW), keeping declaration.value returning the raw text
    string when parse_values: false
  • src/parse-options.test.ts: Updated 9 test assertions — has_children: false →
    true for parse_values:false cases, SELECTOR_LIST → RAW for
    parse_selectors:false cases, plus added first_child?.type === RAW assertion
  • src/walk.test.ts: Updated 19 expected type arrays — SELECTOR_LIST → RAW for
    all parse_selectors: false cases, and added RAW after DECLARATION for all
    parse_values: false cases

some extras

  • expose ATTR_FLAG_NAMES and ATTR_OPERATOR_NAMES publicly

@codecov-commenter
Copy link

codecov-commenter commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.92%. Comparing base (00b8452) to head (2e6e133).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #155   +/-   ##
=======================================
  Coverage   94.91%   94.92%           
=======================================
  Files          16       16           
  Lines        2793     2797    +4     
  Branches      736      736           
=======================================
+ Hits         2651     2655    +4     
  Misses        142      142           

☔ 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.

@codecov-commenter
Copy link

codecov-commenter commented Mar 6, 2026

Bundle Report

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

Detailed changes
Bundle name Size Change
@projectwallace/css-parser-esm 150.65kB 532 bytes (0.35%) ⬆️

Affected Assets, Files, and Routes:

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

Assets Changed:

Asset Name Size Change Total Size Change (%)
parse-*.js 206 bytes 7.36kB 2.88%
css-*.js 36 bytes 16.29kB 0.22%
parse.js 210 bytes 13.71kB 1.56%
arena.js 20 bytes 11.07kB 0.18%
constants.js 17 bytes 2.1kB 0.82%
index.js 43 bytes 1.94kB 2.27%

Files in parse-*.js:

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

Files in css-*.js:

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

Files in parse.js:

  • ./src/parse.ts → Total Size: 12.83kB

Files in arena.js:

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

Files in constants.js:

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

Files in index.js:

  • ./src/index.ts → Total Size: 0 bytes

@bartveneman bartveneman merged commit 92b69b3 into main Mar 6, 2026
5 checks passed
@bartveneman bartveneman deleted the fix/-skip-parse-raw-nodes branch March 6, 2026 22:01
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.

node.prelude should not be null when parse_atrules_preludes is false

2 participants