18 releases (breaking)

Uses new Rust 2024

new 0.14.0 Feb 8, 2026
0.12.0 Sep 11, 2025
0.11.0 Feb 6, 2025
0.10.0 Dec 13, 2024
0.1.1 Feb 21, 2021

#89 in Web programming

Download history 324/week @ 2025-10-19 265/week @ 2025-10-26 318/week @ 2025-11-02 343/week @ 2025-11-09 446/week @ 2025-11-16 632/week @ 2025-11-23 579/week @ 2025-11-30 468/week @ 2025-12-07 330/week @ 2025-12-14 425/week @ 2025-12-21 722/week @ 2025-12-28 384/week @ 2026-01-04 1755/week @ 2026-01-11 2146/week @ 2026-01-18 1813/week @ 2026-01-25 2327/week @ 2026-02-01

8,059 downloads per month
Used in 15 crates (9 directly)

MIT license

61KB
1.5K SLoC

yarn-lock-parser

ActionsStatus Crates.io Docs.rs

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.

Features

  • ✅ 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

Installation

Add this to your Cargo.toml:

[dependencies]
yarn-lock-parser = "0.13"

Quick Start

use std::{error::Error, fs};
use yarn_lock_parser::{parse_str, Entry};

fn main() -> Result<(), Box<dyn Error>> {
    let yarn_lock_text = fs::read_to_string("yarn.lock")?;
    let entries: Vec<Entry> = parse_str(&yarn_lock_text)?;

    for entry in entries {
        println!("{:?}", entry);
    }

    Ok(())
}

Documentation

API documentation is available on docs.rs

Development

Requirements

Build

cargo build

Test

cargo test

Running Tests Verbosely

cargo test -- --nocapture

License

MIT

Dependencies

~1–1.5MB
~30K SLoC