Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rust pnpm lockfile implementation (#4906)
### Description This PR is a fairly faithful Rust port of the Go implementation. There are two intentional differences: - A few fields in the lockfile are no longer serialized in a flow. This is a short coming of `serde_yaml` (dtolnay/serde-yaml#303). Luckily pnpm doesn't care, but it does mean that the outputs between Go and Rust aren't byte identical - I didn't port [convertLockfileV6DepPathToV5DepPath](https://github.com/pnpm/pnpm/blob/e2293bd6e6033cd26a7e58e151b2770cfd1699d8/lockfile/lockfile-file/src/experiments/inlineSpecifiersLockfileConverters.ts#L162) to Rust and instead added functionality to the `DepPath` parser to handle both v5 and v6 paths. Reviewer notes: - Start with `dep_path.rs`, this is primarily the parsing of "dependency paths" which is pnpm's term for lockfile keys. They consist of a package name, version, and sometimes a suffix which can contain the resolved versions of peer dependencies and/or patches. - `data.rs` contains all of the structure for the lockfile as well as the logic for traversing the lockfile - `se.rs`/`de.rs` contain some custom logic for handling the `lockfileVersion` field - All helper methods of `PnpmLockfile` in Go got ported to Rust using snake case ### Testing Instructions Ported all existing unit tests. Existing integration and e2e tests pass. Manual testing that `turbo prune` output can be used with `pnpm install --frozen-lockfile`. --------- Co-authored-by: Chris Olszewski <Chris Olszewski>
- Loading branch information