rhaiper-map
Resolves Source Map v3 positions without std.
This is the resolver half of rhaiper, a minifier for Rhai scripts. It is a separate crate so firmware can translate a runtime error position back to the original source on-device, without pulling in the minifier or a JSON parser.
Only the mappings field of a source map is needed to map a generated position to an original one,
so a device can embed that one string rather than a whole JSON document:
let found = resolve?;
Decoding is a single linear pass and allocates nothing. alloc is required only for VLQ encoding,
which the minifier uses.
Columns are in whatever unit the producer wrote. rhaiper writes UTF-16 code units, as the Source
Map v3 specification requires — which differs from Rhai's own character-counted columns only on lines
containing astral-plane characters such as emoji. The rhaiper crate converts between the two for
you; if you call this crate directly, the units are yours to keep straight.
Verified against thumbv8m.main-none-eabi in CI.
License
Copyright (c) 2026 Jack Hogan. Dual-licensed under either of Apache-2.0 or MIT, at your option.