fix(lockfiles) trailing zero yaml parse (#6296)
### Description
Fixes #6232
This PR allows us to properly deserialize semver versions from YAML in
`yarn.lock`. Previously we would fail at parsing ranges with trailing
zeros e.g. `(0.10f32).to_string() == "0.1"`.
The approach taken in this PR is due to some outstanding quirks in
`serde_yaml`:
-
https://github.com/dtolnay/serde-yaml/issues/165#issuecomment-644311452
- https://github.com/dtolnay/serde-yaml/issues/388
Our usage of `#[serde(flatten)]` in `LockfileData` caused attempting to
parse `2` or `0.10` as a `String` to fail. To avoid this we first parse
the document as a map with a union of the metadata/package entries and
then convert this to the expected structure. This provides us the type
safety of the old implementation, but at the cost of rebuilding the map.
As a minor thing, I removed all unused `Serialize`/`Deserialize`
implementations to make it clear which codepaths actually get used.
### Testing Instructions
Existing unit tests pass.
I changed out the old unit tests for `SemverString` to be captured by
the new `berry_semver.lock` test fixture which covers the same cases. We
do this because even if parsing versions works when invoked directly,
adding `#[serde(flatten)]`/`#[serde(untagged)]` to any containing
structure changes the behavior.
Closes TURBO-1540
---------
Co-authored-by: Chris Olszewski <Chris Olszewski>