-
Notifications
You must be signed in to change notification settings - Fork 0
feat: source map support. #47
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 #47 +/- ##
==========================================
- Coverage 93.76% 93.40% -0.37%
==========================================
Files 26 26
Lines 4986 5167 +181
Branches 1114 1140 +26
==========================================
+ Hits 4675 4826 +151
- Misses 277 306 +29
- Partials 34 35 +1 ☔ 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 PR adds source map support to the module transformation system, allowing users to generate source maps alongside transformed code. The feature integrates with both the programmatic API and CLI, supporting inline maps for stdout and sidecar .map files for file outputs.
Key changes:
- Added
sourceMapoption toModuleOptionswith function overloads for type-safe return values - Refactored
formatand specifier rewriting to preserveMagicStringinstances for map generation - Added CLI flags
--source-mapand--source-map=inlinewith validation
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types.ts | Adds sourceMap?: boolean option to ModuleOptions |
| src/format.ts | Adds function overloads and returns MagicString when sourceMap is true; refactors top-level await wrapping to use prepend/append |
| src/specifier.ts | Adds updateMagicString method and refactors formatSpecifiers to accept optional MagicString |
| src/module.ts | Adds transform function overloads and generates source maps from MagicString; conditionally returns {code, map} object |
| src/cli.ts | Implements --source-map and --source-map=inline CLI support with inline and sidecar map output |
| test/module.ts | Adds test validating source map generation in transform API |
| test/cli.ts | Adds tests for inline maps to stdout, sidecar maps with out-dir, and error validation for inline+out-dir combination |
| docs/cli.md | Documents --source-map CLI option |
| README.md | Documents sourceMap option in API reference |
| docs/roadmap.md | Removes source map feature from roadmap (now implemented) |
| package.json | Version bump to 1.5.0-rc.0 |
| package-lock.json | Updates version to match package.json |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.