yarn-lock-parser

Crates.ioyarn-lock-parser
lib.rsyarn-lock-parser
version0.13.0
created_at2021-02-20 23:38:14.842153+00
updated_at2026-01-11 15:27:55.210062+00
descriptionyarn.lock parser
homepage
repositoryhttps://github.com/robertohuertasm/yarn-lock-parser
max_upload_size
id358239
size63,127
Roberto Huertas (robertohuertasm)

documentation

README

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

Commit count: 37

cargo fmt