Skip to content

feat: parse optionalDependencies from v1 lockfiles#30

Merged
robertohuertasm merged 2 commits intorobertohuertasm:masterfrom
Smona:v1-optional-dependencies
Sep 11, 2025
Merged

feat: parse optionalDependencies from v1 lockfiles#30
robertohuertasm merged 2 commits intorobertohuertasm:masterfrom
Smona:v1-optional-dependencies

Conversation

@Smona
Copy link
Contributor

@Smona Smona commented Sep 11, 2025

This is a quick shot at parsing optionalDependencies from yarn v1 lockfiles. Admittedly I have no experience with nom and very little experience with parsers in general, so this mostly works off of the existing implementation. I couldn't find a clean boundary to reuse the parser between both tags, so i went with a WET approach, but if you see a way to reuse the format definition between the two (which is identical besides the leading tag), please let me know!

Test cases are updated & passing, and a couple now test parsing optional dependencies, using a real v1 lockfile entry with one of each type of dependency.

Resolves #29

Copy link
Owner

@robertohuertasm robertohuertasm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a formatting issue. Let's fix that and we should be ready to merge.

Thanks for your contribution ❤️

@robertohuertasm robertohuertasm merged commit 7b898a8 into robertohuertasm:master Sep 11, 2025
3 checks passed
@robertohuertasm
Copy link
Owner

@Smona your change has been already published to crates.io. Thank you again for your contribution!

Smona added a commit to Smona/nu_plugin_yarn_lock that referenced this pull request Sep 11, 2025
now that support for optionalDependencies has been merged!

robertohuertasm/yarn-lock-parser#30
@Smona
Copy link
Contributor Author

Smona commented Sep 11, 2025

Yay, thanks for getting it released so quickly! And thanks for the crate as well, it enabled me to write a yarn lockfile serde plugin for nushell in pure rust, removing a noticeable delay when parsing lockfiles compared to the initial implementation using the official parser with nodejs 🦀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v1 lockfiles: optionalDependencies not parsed

2 participants