fix: source map integrity. - #98
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes source map integrity by implementing source map composition when rewriting module specifiers and file extensions. The changes ensure that source maps are properly preserved and updated through the transformation process, maintaining the mapping back to original TypeScript source files.
Key Changes:
- Implemented source map composition using @jridgewell libraries to merge rewrite maps with existing TypeScript compiler maps
- Added proper handling for both JavaScript source maps and TypeScript declaration maps
- Ensured source map files are renamed alongside their corresponding output files and sourceMappingURL comments are kept in sync
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/resolver.js | Core implementation of source map loading, composition, and sourceMappingURL updating for both .js and .d.ts files |
| test/unit.js | Unit tests verifying source map handling for .js and .d.ts rewrites, including cases with and without existing maps |
| test/integration.js | Integration tests validating end-to-end source map composition through the build process, with helper functions for position tracking |
| test/fixtures/sourcemaps/* | Test fixture with TypeScript project configured to generate source maps and declaration maps |
| test/fixtures/nomaps/* | Test fixture with TypeScript project configured without source maps to verify no maps are created when inputs lack them |
| package.json | Version bump to 4.0.0-rc.3 and added dependencies for source map manipulation (magic-string, @jridgewell packages) and upgraded @knighted/module to rc version with source map support |
| package-lock.json | Lock file updates for new and upgraded dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #98 +/- ##
==========================================
+ Coverage 93.21% 93.63% +0.41%
==========================================
Files 4 4
Lines 1902 2041 +139
==========================================
+ Hits 1773 1911 +138
- Misses 129 130 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.