fix: drop keyword-end source map mapping#124
Conversation
The trailing mapping at `column + keyword.length` introduced in sveltejs#116 lands on whitespace, causing downstream source-map consumers to resolve adjacent expression positions onto whitespace columns.
🦋 Changeset detectedLatest commit: 02b115e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Thanks — have to admit I'm a bit surprised at this finding, I would have thought that more mappings would always make things more accurate, never less (as long as they're correct of course). What's the simplest way to reproduce this? |
|
Also seems like your local setup has a different formatting setup, could you please reduce the diff as much as possible? |
I've made a reduced case here:
Add to pnpm-workspace.yaml to downgrade then |
The trailing mapping at
column + keyword.lengthintroduced in #116 lands on whitespace, causing downstream source-map consumers to resolve adjacent expression positions onto whitespace columns.For example with single-line
return <logical-expression>lines in Svelte 5.svelte.jsrune modules, istanbulbranchMapentries from@vitest/coverage-v8viaast-v8-to-istanbuldrift one column left into the keyword's trailing whitespace, and are reported as spurious uncovered branches.I think the keyword-start mapping in #116 is sufficient for the debugger / stack-frame use cases it targets, so dropping the end mapping is the minimal fix.