https://github.com/robertohuertasm/yarn-lock-parser
🦀 🙀 Simple yarn.lock parser
https://github.com/robertohuertasm/yarn-lock-parser
parser parser-library rust yarn yarn-lock
Last synced: 19 days ago
JSON representation
🦀 🙀 Simple yarn.lock parser
- Host: GitHub
- URL: https://github.com/robertohuertasm/yarn-lock-parser
- Owner: robertohuertasm
- License: mit
- Created: 2021-02-20T19:43:36.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-02-06T20:54:20.000Z (about 1 year ago)
- Last Synced: 2025-08-23T13:50:22.804Z (6 months ago)
- Topics: parser, parser-library, rust, yarn, yarn-lock
- Language: Rust
- Homepage: https://crates.io/crates/yarn-lock-parser
- Size: 321 KB
- Stars: 17
- Watchers: 2
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yarn-lock-parser
[](https://github.com/robertohuertasm/yarn-lock-parser/actions) [](https://crates.io/crates/yarn-lock-parser) [](https://docs.rs/yarn-lock-parser/)
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`:
```toml
[dependencies]
yarn-lock-parser = "0.13"
```
## Quick Start
```rust
use std::{error::Error, fs};
use yarn_lock_parser::{parse_str, Entry};
fn main() -> Result<(), Box> {
let yarn_lock_text = fs::read_to_string("yarn.lock")?;
let entries: Vec = parse_str(&yarn_lock_text)?;
for entry in entries {
println!("{:?}", entry);
}
Ok(())
}
```
## Documentation
API documentation is available on [docs.rs](https://docs.rs/yarn-lock-parser/)
## Development
### Requirements
- [Rust](https://www.rust-lang.org/tools/install) (with `cargo`)
### Build
```bash
cargo build
```
### Test
```bash
cargo test
```
### Running Tests Verbosely
```bash
cargo test -- --nocapture
```
## License
MIT