Skip to content

Draft: Add support for remapping with range mappings#48

Open
takikawa wants to merge 5 commits intojridgewell:mainfrom
takikawa:range-mappings-remapping
Open

Draft: Add support for remapping with range mappings#48
takikawa wants to merge 5 commits intojridgewell:mainfrom
takikawa:range-mappings-remapping

Conversation

@takikawa
Copy link
Copy Markdown
Contributor

@takikawa takikawa commented Mar 3, 2026

This is a draft PR for remapping support with range mappings.

Marking draft because the tests are not quite passing in the current state. They were working in a previous iteration but I've rebased it to the latest trace-mapping code, and haven't had time to debug all the differences between my working branch and HEAD quite yet.

While rebasing it, some interesting points came up:

  • Previously I had some complicated code for threading the range mapping related state (i.e., where the end point is) but it could make sense to put that data in TraceMap's rangeSegments so that it can be easily queried from a SourcemapSegment.
  • There's still a need for an operation like traceSegmentsInRange so that when you have a range mapping to compose with other mappings, you can find the overlapping ranges or regular mappings.

Would be happy to keep fixing this up if this seems like a good approach.

takikawa added 5 commits March 2, 2026 18:24
* Adjust rangeSegments to map to range mapping info such as the end
  point, not just a boolean state of being a range or not.
* Add isRange to allow querying the range mapping data for a segment
* Add traceSegmentsInRange for finding segments in a range
* add back line information for traceSegmentsInRange because
  it needs to be represented somehow in the return result
  (an alternative would be a start line + array of arrays)
* fixes most range mapping remapping test failures that came up
  due to rebasing these patches
  * Expose range mappings from remapping SourceMap
  * Conditionalize calling setRangeSegment
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