dep-parser π
A powerful and extensible dependency parser for multiple programming languages.

π Features
β
Supports multiple package managers (npm, pnpm, yarn, etc.)
β
Structured project layout inspired by modern package managers
β
Automated test cases & test data
β
Highly extensible & developer-friendly
π¦ Installation
Go Version
go get github.com/khulnasoft/dep-parser
Rust Version
cargo add dep-parser
Or build from source:
cargo build --release
π Usage
Rust Example
use dep_parser::rust::cargo::parse::CargoParser;
use dep_parser::types::Parser;
use std::fs::File;
fn main() {
let mut f = File::open("Cargo.lock").expect("Failed to open file");
let parser = CargoParser::new();
let (libs, deps) = parser.parse(&mut f).expect("Failed to parse");
println!("Libraries: {:?}", libs);
println!("Dependencies: {:?}", deps);
}
ποΈ Project Structure
This project is now available in both Go and Rust implementations:
- Go: Original implementation in
pkg/ directory
- Rust: New implementation in
src/ directory
Rust Modules
types - Core data structures (Library, Dependency, Location, etc.)
io - I/O traits and utilities
utils - Helper functions for package ID generation, deduplication
rust - Rust-specific parsers (Cargo.lock, binary)
golang - Go-specific parsers (go.mod, go.sum, binary)
nodejs - Node.js parsers (npm, yarn, pnpm)
python - Python parsers (pip, poetry, requirements)
java - Java parsers (JAR, POM)
- Other language parsers (php, ruby, dart, dotnet, conda, gradle, hex, julia, sbt, swift, c, frameworks)
π§ͺ Testing
Rust Tests
cargo test
Go Tests
go test ./...
π Development Status
- β
Core types and utilities converted to Rust
- β
Rust/Cargo parser fully implemented and tested
- β οΈ Other language parsers have placeholder implementations (return "not yet implemented" errors)
- π Binary parser requires Rust equivalent of go-rustaudit
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.