fix: better module resolution for cli. - #60
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #60 +/- ##
==========================================
+ Coverage 92.17% 92.22% +0.05%
==========================================
Files 13 14 +1
Lines 3860 3924 +64
Branches 681 690 +9
==========================================
+ Hits 3558 3619 +61
- Misses 275 278 +3
Partials 27 27 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR improves module resolution for the CLI tool by refactoring resolution logic into a dedicated module and adding support for package.json imports field (hash imports) resolution.
Changes:
- Extracted module resolution utilities into a new
moduleResolution.tsfile for better code organization - Fixed handling of hash imports (package.json
importsfield) by correctly parsing specifiers that start with# - Added comprehensive test coverage for package.json imports and hash-imports workspace scenarios
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/css/src/moduleResolution.ts | New file containing extracted module resolution utilities (normalizeResolverResult, resolveWithFactory, createResolverFactory, etc.) |
| packages/css/src/moduleGraph.ts | Refactored to use the new moduleResolution module, removing duplicated code |
| packages/css/src/generateTypes.ts | Integrated resolver factory for better module resolution, added realpath normalization for rootDir, fixed hash import parsing in splitResourceAndQuery |
| packages/css/test/generateTypes.test.ts | Added comprehensive tests for package.json imports and hash-imports workspace scenarios, updated fixture setup to use realpath |
| packages/css/package.json | Version bump from 1.1.0-rc.2 to 1.1.0-rc.3 |
| packages/playwright/package.json | Updated @knighted/css dependency to 1.1.0-rc.3 |
| package-lock.json | Updated lockfile to reflect version changes |
| packages/playwright/src/hash-imports-workspace/apps/hash-import-demo/tsconfig.json | Expanded rootDir and include paths to support workspace-wide module resolution |
| packages/playwright/src/hash-imports-workspace/apps/hash-import-demo/src/workspace-bridge/hash-imports.css | New CSS file with knighted-demo class for testing |
| packages/playwright/src/hash-imports-workspace/apps/hash-import-demo/src/render-hash-imports-demo.ts | Added import and usage of hash-imports.css stable selectors |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.