Skip to content

Add support for formatting CSS namespace selectors#209

Merged
bartveneman merged 2 commits into
mainfrom
claude/implement-issue-207-WvCam
May 16, 2026
Merged

Add support for formatting CSS namespace selectors#209
bartveneman merged 2 commits into
mainfrom
claude/implement-issue-207-WvCam

Conversation

@bartveneman
Copy link
Copy Markdown
Member

Summary

This PR adds support for properly formatting CSS namespace selectors, including type selectors and universal selectors with namespace prefixes.

Key Changes

  • Updated print_simple_selector() function to handle namespace prefixes for both type selectors (e.g., ns|div) and universal selectors (e.g., ns|*)
  • Namespace prefixes are normalized to lowercase to match CSS specification conventions
  • Added import for is_universal_selector utility function
  • Added comprehensive test coverage for namespace selector formatting, including:
    • Named namespace prefixes (ns|div, ns|*)
    • Universal namespace prefix (*|div, *|*)
    • Empty namespace prefix (|div, |*)
    • Multiple selectors with namespaces (ns|div, ns|span)

Implementation Details

  • Namespace prefixes are extracted from the node's namespace property and converted to lowercase before being prepended to the selector name
  • The implementation handles both type selectors and universal selectors consistently
  • Selectors without namespaces (where namespace is null) are formatted as before

https://claude.ai/code/session_01HfazKmPqWt1wtBF3ZUJ53P

Import is_universal_selector from css-parser and handle the namespace
property on both TypeSelector and UniversalSelector nodes, printing
the namespace prefix (e.g. ns|div, *|div, |div, ns|*) correctly.

https://claude.ai/code/session_01HfazKmPqWt1wtBF3ZUJ53P
@codecov
Copy link
Copy Markdown

codecov Bot commented May 16, 2026

Bundle Report

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

Detailed changes
Bundle name Size Change
formatCss-esm 14.61kB 209 bytes (1.45%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: formatCss-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.js 209 bytes 13.08kB 1.62%

Files in index.js:

  • ./src/lib/index.ts → Total Size: 12.6kB

@codecov
Copy link
Copy Markdown

codecov Bot commented May 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.83%. Comparing base (53000db) to head (5275926).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #209      +/-   ##
==========================================
+ Coverage   96.80%   96.83%   +0.03%     
==========================================
  Files           2        2              
  Lines         344      348       +4     
  Branches      124      127       +3     
==========================================
+ Hits          333      337       +4     
  Misses         10       10              
  Partials        1        1              

☔ 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 b8f6d3b into main May 16, 2026
8 checks passed
@bartveneman bartveneman deleted the claude/implement-issue-207-WvCam branch May 16, 2026 13:09
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