A fast and reliable parser for yarn.lock files written in Rust. Supports all yarn.lock versions (v1, v2, and later). Parse lock files into structured data for dependency analysis, validation, and programmatic access.
- β Supports all yarn.lock versions (v1, v2, and later)
- β Fast and memory-efficient parsing using nom
- β
Comprehensive error handling with
thiserror - β Zero-copy where possible
- β Pure Rust implementation
Add this to your Cargo.toml:
[dependencies]
yarn-lock-parser = "0.14"use std::{error::Error, fs};
use yarn_lock_parser::parse_str;
fn main() -> Result<(), Box<dyn Error>> {
let yarn_lock_text = fs::read_to_string("yarn.lock")?;
let lockfile = parse_str(&yarn_lock_text)?;
for entry in lockfile.entries {
println!("{:?}", entry);
}
Ok(())
}API documentation is available on docs.rs
- Rust (with
cargo)
cargo buildcargo testcargo test -- --nocaptureMIT