Skip to content

πŸ¦€ πŸ™€ Simple yarn.lock parser

License

Notifications You must be signed in to change notification settings

robertohuertasm/yarn-lock-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

40 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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.14"

Quick Start

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(())
}

Documentation

API documentation is available on docs.rs

Development

Requirements

Build

cargo build

Test

cargo test

Running Tests Verbosely

cargo test -- --nocapture

License

MIT

About

πŸ¦€ πŸ™€ Simple yarn.lock parser

Topics

Resources

License

Stars

Watchers

Forks

Contributors 5

Languages