Improve sourcemap tracing with interpolation
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 26.3k
- Forks
- 1.8k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 20
Description
Feature Use Case
As of my understanding, the chain of source transforms and corresponding sourcemaps gets collapsed into a final sourcemap by tracing each final codechunk to its origins. As it appears to me, the trace only works when the final token (line,column) positions have corresponding positions in the mapping chain. When a mapping in the chain has more coarse positions, it doesn't work?
Example: An identifier token in the result has position (3,34), line 3 is traced to map line 6, column 34 is traced to a position in map line 6, chunk of col 34. When map line 6 does not have such a chunk, tracing ends. So map must have chunks for every token, or, when it is token agnostic, for every character.
Most plugins use MagicString for mapping, which provides character-position granularity, but we should not rely on that?
Feature Proposal
Sourcemap collapse tracing should be able to interpolate to the next known position when an intermediate sourcemap does not supply an entry for the position being traced.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files or tests. Start by locating sourcemap collapse tracing and reviewing how intermediate mappings are handled for positions without an entry. Compare coarse mappings with character-granular mappings, then verify that tracing interpolates to the next known position without regressing existing sourcemap behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100