rhaiper-map 0.1.0

Resolve Source Map v3 positions without std, for tracing Rhai runtime errors on-device
Documentation
  • Coverage
  • 84.62%
    11 out of 13 items documented0 out of 7 items with examples
  • Size
  • Source code size: 26.3 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 140.8 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • ImTheSquid/rhaiper
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ImTheSquid

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 = rhaiper_map::resolve(mappings, gen_line, gen_col)?;

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.