-
Notifications
You must be signed in to change notification settings - Fork 0
fix: dependency graph resolution for transitive styles in loader bridge. #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #66 +/- ##
==========================================
- Coverage 92.66% 91.56% -1.10%
==========================================
Files 15 16 +1
Lines 4565 5013 +448
Branches 817 898 +81
==========================================
+ Hits 4230 4590 +360
- Misses 307 391 +84
- Partials 28 32 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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 pull request fixes dependency graph resolution for transitive styles in the loader bridge by implementing comprehensive style import tracking across the module graph.
Changes:
- Added new
styleGraph.tsmodule to traverse CSS/SCSS/Sass/Less import chains transitively - Updated loader bridge to collect and include all transitive style dependencies when building combined modules
- Extended pattern matching to include all style files (not just CSS modules)
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/css/package.json | Version bump from 1.1.0-rc.6 to 1.1.0-rc.7 |
| packages/playwright/package.json | Updated dependency version and added prebuild script |
| packages/css/src/styleGraph.ts | New module implementing transitive style import collection with support for CSS, Sass, Less dialects |
| packages/css/src/moduleGraph.ts | Exported normalizeSpecifier function for reuse in styleGraph |
| packages/css/src/loaderBridge.ts | Integrated style graph traversal, renamed collectCssModuleRequests to collectStyleImportSpecifiers, added support for non-module styles |
| packages/css/test/styleGraph.test.ts | Comprehensive test coverage for styleGraph functionality |
| packages/css/test/loaderBridge.test.ts | Updated test names and added graph traversal test |
| packages/css/test/fixtures/bridge-graph/* | New test fixtures for dependency graph testing |
| docs/loader.md | Added clarification about the distinction between loader and loader-bridge |
Comments suppressed due to low confidence (1)
packages/css/src/loaderBridge.ts:314
- The cssModulesValues array uses the string literal 'undefined' for non-CSS-module requests, but this string is truthy and will not be filtered out by filter(Boolean). This will cause Object.assign to attempt to spread the string 'undefined', which has no enumerable own properties but may cause unexpected behavior. Use the actual undefined value instead of the string 'undefined', or use null which is falsy and will be filtered out.
const cssModulesValues = options.cssRequests.map((request, index) =>
isCssModuleRequest(request)
? `__knightedStyle${index}.knightedCssModules`
: 'undefined',
)
const lines = [
`import * as __knightedUpstream from ${upstreamLiteral};`,
...cssImports,
options.emitDefault
? "const __knightedDefault = Object.prototype.hasOwnProperty.call(__knightedUpstream, 'default') ? __knightedUpstream['default'] : undefined;"
: '',
`const __knightedCss = [${cssValues.join(', ')}].filter(Boolean).join('\\n');`,
`const __knightedCssModules = Object.assign({}, ...[${cssModulesValues.join(
', ',
)}].filter(Boolean));`,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@knightedcodemonkey I've opened a new pull request, #67, to work on those changes. Once the pull request is ready, I'll request review from you. |
No description provided.