You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A new `"rangeMappings"` field that marks certain mappings as covering an entire range, not just a single point. This directly solves precision loss during source map composition — the exact problem Rolldown hits ([rolldown#7555](https://github.com/nicolo-ribaudo/ecma-426/blob/main/proposals/range-mappings.md)).
10
-
11
-
### Encoding
12
-
13
-
The `rangeMappings` field uses the same `;`-separated line structure as `mappings`. Each line contains unsigned VLQs encoding **relative offsets** (1-based) to the index of each range mapping on that line. The offset is relative to the previous range mapping index on the same line.
14
-
15
-
```json
16
-
{
17
-
"mappings": "AAAA,CAAC,GAAG,...",
18
-
"rangeMappings": "ABCgB;;B"
19
-
}
20
-
```
21
-
22
-
Decoding `ABCgB` on line 1 gives offsets `[0, 1, 2, 32, 1]`, meaning mappings at indices 0, 1, 3, 35, and 36 are range mappings.
23
-
24
-
### Lookup behavior
25
-
26
-
A range mapping maps every position from its generated position up to (but not including) the next mapping. The original position is computed with a delta:
The `Mapping` struct gains an `is_range_mapping: bool` field (default `false`). On decode, `rangeMappings` is parsed and `is_range_mapping` is set on the referenced mappings. On encode, range mappings are collected and written to `rangeMappings`.
40
-
41
-
### What to implement
42
-
43
-
-[x] Decode `rangeMappings` field and set `is_range_mapping` on `Mapping` structs
44
-
-[x] Encode `rangeMappings` from `Mapping` structs with `is_range_mapping = true`
45
-
-[x] Update `original_position_for` to apply range delta when the matched mapping is a range mapping
46
-
-[x] Update `remap()` to preserve and compose range mappings through transform chains
47
-
-[x] Generator API: `add_range_mapping()` for marking a mapping as a range
48
-
-[x] WASM/NAPI bindings
49
-
-[x] CLI: show range mappings in `srcmap info` and `srcmap mappings`
Rolldown's `collapse_sourcemaps` materializes the entire token stream into `Vec<Token>` before constructing the final `SourceMap`. For large bundles with many transform plugins, this causes excessive allocations.
58
-
59
-
### What to implement
60
-
61
-
-[x]`MappingsIter`: lazy iterator over VLQ-encoded mappings (decodes one at a time, no `Vec<Mapping>`)
62
-
-[x]`StreamingGenerator`: on-the-fly VLQ encoder that emits mappings in sorted order without collecting
63
-
-[x]`remap_streaming()`: composition pipeline that streams through mappings without intermediate allocation
0 commit comments