40 releases (14 stable)

✓ Uses Rust 2018 edition

4.1.1 Sep 10, 2019
4.1.0 May 14, 2019
3.0.1 Mar 13, 2019
2.2.1 May 17, 2018
0.3.2 Jul 15, 2016

#169 in Web programming

Download history 429/week @ 2019-05-28 120/week @ 2019-06-04 155/week @ 2019-06-11 250/week @ 2019-06-18 626/week @ 2019-06-25 283/week @ 2019-07-02 227/week @ 2019-07-09 75/week @ 2019-07-16 51/week @ 2019-07-23 80/week @ 2019-07-30 90/week @ 2019-08-06 44/week @ 2019-08-13 91/week @ 2019-08-20 214/week @ 2019-08-27 217/week @ 2019-09-03

786 downloads per month
Used in 4 crates (3 directly)

BSD-3-Clause

110KB
2.5K SLoC

sourcemap

This library implements basic processing of JavaScript sourcemaps.

Installation

The crate is called sourcemap and you can depend on it via cargo:

[dependencies]
sourcemap = "*"

If you want to use the git version:

[dependencies.sourcemap]
git = "https://github.com/getsentry/rust-sourcemap.git"

Basic Operation

This crate can load JavaScript sourcemaps from JSON files. It uses serde for parsing of the JSON data. Due to the nature of sourcemaps the entirety of the file must be loaded into memory which can be quite memory intensive.

Usage:

use sourcemap::SourceMap;
let input: &[_] = b"{
    \"version\":3,
    \"sources\":[\"coolstuff.js\"],
    \"names\":[\"x\",\"alert\"],
    \"mappings\":\"AAAA,GAAIA,GAAI,EACR,IAAIA,GAAK,EAAG,CACVC,MAAM\"
}";
let sm = SourceMap::from_reader(input).unwrap();
let token = sm.lookup_token(0, 0).unwrap(); // line-number and column
println!("token: {}", token);

Features

Functionality of the crate can be turned on and off by feature flags. This is the current list of feature flags:

  • ram_bundle: turns on RAM bundle support

License: BSD-3-Clause

Dependencies

~4.5MB
~114K SLoC