Skip to content

Emit source maps for the plugin and its declarations - #121

Merged
nstepien merged 3 commits into
mainfrom
sourcemaps
Nov 3, 2026
Merged

nstepien merged 3 commits into
mainfrom
sourcemaps

Conversation

@nstepien

@nstepien nstepien commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

When CI runs the tests against the build in dist, coverage reports dist/index.js lines, which don't match the src/index.ts lines reported locally. Rolldown now writes a source map next to the build, which Vite reads when the tests import it, so both runs report src/index.ts with the same uncovered statement (line 180) and branches.

  • output.sourcemap writes dist/index.js.map, and the dts plugin's sourcemap writes dist/index.d.ts.map.
  • The package now publishes src, which both maps point to, so editors' "Go to Definition" and debuggers can open the source.
  • sourcemapExcludeSources keeps the JavaScript map from embedding a second copy of the source.
  • AGENTS.md says where the tests import the plugin from, why CI needs the map, and that the package publishes src for the maps to point to.

The totals still differ slightly (263 statements against 258), because the build drops five statements that only exist in the source, all of them covered: two bare return;s, a break;, and two variables it inlines.

Package size
With src/index.ts and the two maps, the package grows from 9.0 KB to 20.8 KB packed (27.6 KB to 69.3 KB unpacked). Embedding the source in the JavaScript map as well would bring it to 28.5 KB packed.

🤖 Generated with Claude Code

CI tests the build in dist, and the map lets coverage report src/index.ts
lines there, as it does locally.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

nstepien and others added 2 commits November 3, 2026 23:01
The declaration map needs src/index.ts to exist for editors to open it,
and with src published, the JavaScript map no longer embeds a copy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@nstepien
nstepien marked this pull request as ready for review November 3, 2026 23:25
@nstepien
nstepien merged commit 00ace9b into main Nov 3, 2026
12 checks passed
@nstepien
nstepien deleted the sourcemaps branch November 3, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant