A powerful and extensible dependency parser for multiple programming languages.
✅ 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
go get github.com/khulnasoft/dep-parsercargo add dep-parserOr build from source:
cargo build --releaseuse 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);
}This project is now available in both Go and Rust implementations:
- Go: Original implementation in
pkg/directory - Rust: New implementation in
src/directory
types- Core data structures (Library, Dependency, Location, etc.)io- I/O traits and utilitiesutils- Helper functions for package ID generation, deduplicationrust- 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)
cargo testgo test ./...- ✅ 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
Contributions are welcome! Please feel free to submit a Pull Request.