3 个不稳定版本
使用旧的 Rust 2015
0.2.0 | 2017年4月25日 |
---|---|
0.1.1 | 2016年6月14日 |
0.1.0 | 2016年6月5日 |
在 #consuming 中排名 8
25KB
607 行代码(不包括注释)
js-source-mapper
一个专注于性能的 Rust 库,用于消费 JavaScript 源映射。支持 Source Map 修订版 3。
用法
[dependencies]
js-source-mapper = "0.1.1"
extern crate js_source_mapper;
use js_source_mapper::{Cache, consume};
fn main() {
let cache = consume(r#"{
"version": 3,
"file": "foo.js",
"sources": ["source.js"],
"names": ["name1", "name1", "name3"],
"mappings": ";EAACA;;IAEEA;;MAEEE",
"sourceRoot": "http://example.com"
}"#).unwrap();
let mapping = cache.mapping_for_generated_position(2, 2);
assert!(mapping.original.line == 1);
assert!(mapping.original.column == 1);
assert!(mapping.source == "source.js".into());
assert!(mapping.name == "name1".into());
}
开发
模糊测试
要在 Windows 上运行 cargo-fuzz,请运行 etc/docker 中指定的 Docker 镜像。以下命令很有用
docker run --rm -v <full_path_to_project_root>:/project -w /project cargo-fuzz cargo fuzz run fuzzer_script_1
依赖项
~0.7–1.4MB
~33K SLoC