fix: loader query default exports, lexer jsx fallback. - #51
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #51 +/- ##
==========================================
+ Coverage 92.20% 92.54% +0.34%
==========================================
Files 11 12 +1
Lines 2859 3126 +267
Branches 496 550 +54
==========================================
+ Hits 2636 2893 +257
- Misses 204 210 +6
- Partials 19 23 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This pull request fixes loader query default exports and adds a JSX/TSX fallback using oxc-parser. The changes enable the CSS loader to properly handle JSX/TSX files when es-module-lexer fails, and standardizes the generated type names across all selector modules.
Key changes:
- Introduced a new lexer module that falls back to oxc-parser for JSX/TSX files or when es-module-lexer fails to parse
- Added default export declarations to loader query type definitions
- Standardized generated type names to use
KnightedCssStableSelectorsconsistently - Bumped package version from 1.0.8 to 1.0.9
Reviewed changes
Copilot reviewed 21 out of 24 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/css/src/lexer.ts | New module providing JSX/TSX-aware import/export analysis with oxc-parser fallback |
| packages/css/src/moduleInfo.ts | Refactored to use the new analyzeModule function from lexer |
| packages/css/src/generateTypes.ts | Updated to use analyzeModule for finding selector imports in TSX files |
| packages/css/loader-queries.d.ts | Added default export declarations for knightedCss in loader query modules |
| packages/css/test/lexer.test.ts | Comprehensive tests for the new lexer functionality |
| packages/css/test/moduleInfo.test.ts | Added tests for JSX/TSX default export detection |
| packages/css/test/generateTypes.test.ts | Added test for TSX selector import discovery |
| packages/css/test/moduleGraph.test.ts | Added tests for edge cases in module resolution |
| packages/css/test/fixtures/combined/*.tsx,.js | Test fixtures for JSX/TSX fallback scenarios |
| packages/playwright/src/lit-react/cards/fallback-card/* | New card component demonstrating oxc-parser fallback |
| packages/playwright/src/lit-react/cards/combined-types-card/* | Updated to use standardized type names with aliasing |
| packages/playwright/test/lit-react.spec.ts | Added test for fallback card functionality |
| packages/playwright/playwright.config.ts | Reduced global test timeout from 20s to 5s |
| packages/playwright/package.json | Added types script and updated pretest to run it |
| packages/css/package.json | Bumped version to 1.0.9 |
| .gitignore | Added .knighted-css/ directory |
| docs/how-it-works.md | Documented JSX/TSX fallback support |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.