Skip to content

feat: auto stable selectors.#54

Merged
knightedcodemonkey merged 5 commits intomainfrom
bananas
Jan 16, 2026
Merged

feat: auto stable selectors.#54
knightedcodemonkey merged 5 commits intomainfrom
bananas

Conversation

@knightedcodemonkey
Copy link
Owner

@knightedcodemonkey knightedcodemonkey commented Jan 16, 2026

Copilot AI review requested due to automatic review settings January 16, 2026 17:45
@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 89.85507% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.57%. Comparing base (f8cf325) to head (3063479).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/css/src/loader.ts 85.71% 16 Missing and 2 partials ⚠️
packages/css/src/autoStableSelectors.ts 90.11% 14 Missing and 3 partials ⚠️
packages/css/src/css.ts 92.78% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #54      +/-   ##
==========================================
- Coverage   91.86%   91.57%   -0.29%     
==========================================
  Files          12       13       +1     
  Lines        3281     3668     +387     
  Branches      572      644      +72     
==========================================
+ Hits         3014     3359     +345     
- Misses        244      281      +37     
- Partials       23       28       +5     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an autoStable feature that automatically duplicates CSS class selectors with deterministic, stable namespaced class names (e.g., .foo becomes .foo, .knighted-foo). This functionality works for both plain CSS and CSS Modules, allowing for stable test selectors while maintaining CSS Modules' hashing benefits.

Changes:

  • Implements autoStable option in the CSS loader with configurable namespace, include/exclude filters
  • Integrates with LightningCSS visitor API for plain CSS transformation and post-processes CSS Modules exports
  • Adds comprehensive test coverage across unit, integration, and e2e tests with new demo application

Reviewed changes

Copilot reviewed 29 out of 31 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/css/src/autoStableSelectors.ts Core implementation of autoStable visitor for LightningCSS transformation
packages/css/src/css.ts Integration of autoStable into cssWithMeta with visitor composition
packages/css/src/loader.ts Webpack loader integration with CSS Modules export merging
packages/css/src/generateTypes.ts CLI support for autoStable type generation
packages/css/test/*.test.ts Comprehensive test coverage for autoStable functionality
packages/playwright/src/auto-stable/* Demo implementation with React/Lit integration
packages/playwright/test/auto-stable.spec.ts E2E tests for autoStable demo
packages/playwright/*.config.js Build configuration updates for webpack/rspack
docs/loader.md Documentation for autoStable feature
package.json Version bump to 1.1.0-rc.0 and dependency updates

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@knightedcodemonkey knightedcodemonkey merged commit 0726c2a into main Jan 16, 2026
7 checks passed
@knightedcodemonkey knightedcodemonkey deleted the bananas branch January 16, 2026 18:21
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.

Auto-generate stable class variants from source styles

2 participants