Skip to content

Comments

breaking: replace skip_comments option with on_comment#127

Merged
bartveneman merged 1 commit intomainfrom
feat/on-comment
Jan 17, 2026
Merged

breaking: replace skip_comments option with on_comment#127
bartveneman merged 1 commit intomainfrom
feat/on-comment

Conversation

@bartveneman
Copy link
Member

Replaces skip_comments with on_comment which behaves very much like CSSTree's onComment except that it contains more information.

The `CommentInfo` object passed to `on_comment` contains:
  - `start: number` - Starting offset in source (0-based)
  - `end: number` - Ending offset in source (0-based)
  - `length: number` - Length of the comment
  - `line: number` - Starting line number (1-based)
  - `column: number` - Starting column number (1-based)

Another breaking change is that comments are not created as tokens anymore. The whole token stream only contains non-comment tokens which saves time during parsing.

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 95.12195% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.92%. Comparing base (dcc949c) to head (26e382c).

Files with missing lines Patch % Lines
src/tokenize.ts 89.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #127      +/-   ##
==========================================
- Coverage   94.95%   94.92%   -0.03%     
==========================================
  Files          16       16              
  Lines        2614     2601      -13     
  Branches      681      672       -9     
==========================================
- Hits         2482     2469      -13     
  Misses        132      132              

☔ 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 f510b49 into main Jan 17, 2026
5 checks passed
@bartveneman bartveneman deleted the feat/on-comment branch January 17, 2026 20:17
@codecov-commenter
Copy link

Bundle Report

Changes will decrease total bundle size by 257 bytes (-0.18%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
@projectwallace/css-parser-esm 141.49kB -257 bytes (-0.18%) ⬇️

Affected Assets, Files, and Routes:

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

Assets Changed:

Asset Name Size Change Total Size Change (%)
parse-*.js -7 bytes 8.38kB -0.08%
parse-*.js -7 bytes 22.54kB -0.03%
parse-*.js -7 bytes 6.92kB -0.1%
parse-*.js -6 bytes 8.59kB -0.07%
parse-*.js 27 bytes 25.92kB 0.1%
tokenize.js -207 bytes 15.9kB -1.29%
parse.js -50 bytes 13.11kB -0.38%

Files in parse-*.js:

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

Files in parse-*.js:

  • ./src/parse-atrule-prelude.ts → Total Size: 21.75kB

Files in parse-*.js:

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

Files in parse-*.js:

  • ./src/parse-anplusb.ts → Total Size: 8.17kB

Files in parse-*.js:

  • ./src/parse-selector.ts → Total Size: 24.49kB

Files in tokenize.js:

  • ./src/tokenize.ts → Total Size: 15.31kB

Files in parse.js:

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

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.

2 participants