fix(unplugin): emit column-accurate sourcemaps - #563
Conversation
Bare generateMap() collapses every mapping to column 0, so V8 coverage drops modules that use auto-imports. Pass hires: 'boundary' and source.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe unplugin transform now emits boundary-level, column-aware source maps with the input file as the source. New tests verify import injection, source-map accuracy, and undefined results when no auto-import is used. ChangesUnplugin sourcemap precision
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change makes generated sourcemaps column-accurate and associates them with the transformed module while preserving unchanged-file behavior; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The changes satisfy issue
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #563 +/- ##
==========================================
- Coverage 98.73% 94.60% -4.13%
==========================================
Files 14 15 +1
Lines 1817 1076 -741
Branches 374 363 -11
==========================================
- Hits 1794 1018 -776
- Misses 23 52 +29
- Partials 0 6 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
unplugin's transform calledMagicString#generateMap()with no options, so the map had one mapping per line (all at column 0) andsources: [""]. Auto-imports are prepended, so line numbers still roughly line up, but V8 coverage (@vitest/coverage-v8) drops any module that references an auto-imported global and reports 100% (0/0).Pass
{ hires: 'boundary', source: id }.hires: 'boundary'matchedhires: truefor coverage in the report while producing a smaller map.Fixes #562
Test plan
test/unplugin.test.ts: injected import is present,map.sourcesis the module id, and mappings have more than one segment on at least one linepnpm vitest run(237 tests)