-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ANE-2235] Add support for PNPM v9 lockfile format #1501
base: master
Are you sure you want to change the base?
Conversation
1. Handle package keys without leading slash in v9 format 2. Add support for catalog versions (workspace:*) in v9 format 3. Improve version normalization and handling 4. Add more test cases and documentation
Integration test is consistently failing for me in GH and locally. TL;DR it’s |
- Add catalogs field to PnpmLockfile type - Create CatalogMap and CatalogEntry types for parsing catalog data - Add getPackageVersion helper to resolve catalog versions - Update version parsing to properly handle v7-v9 lockfiles
- Track dev dependencies from importers section - Consider both importers and packages sections when determining dev status - Pass dev dependency status through dependency resolution chain - Update toDependency to combine isDev flags from both sources
- Rename version field in CatalogEntry to catalogVersion to avoid collision with ProjectMapDepMetadata
- Use parseJSON instead of undefined parseCatalogEntry
- Use fully qualified Yaml.parseJSON to fix compilation error
- Add KeyMap import - Convert Object to Map Text using KeyMap.toMap
@csasarak Sorry I've made a big mess of this branch. Considering reverting my commits to restore to where you were, as I've been creating cascading issues. I'll start another branch for my experiments. |
Overview
Changes
This PR improves the PNPM v9 lockfile parsing to correctly handle:
workspace:*
orworkspace:^1.0.0
)Implementation Details
catalogs
field toPnpmLockfile
type to parse the new catalog sectionCatalogMap
andCatalogEntry
types to properly handle catalog entriesgetPackageVersion
helper to resolve catalog version referencesPnpmLockGt6
Fixes
This addresses several issues where:
Motivation
PNPM v9 introduced a new lockfile format that uses a catalog system for version management. This change ensures we can correctly parse these lockfiles and extract accurate dependency information.
Acceptance criteria
Using pnpm 9 with a v9 lockfile, all npm dependencies are correctly resolved with proper locators in the FOSSA UI.
Testing plan
Tested against PNPM's own repository (which uses v9 lockfile) to verify correct handling of:
Risks
Highlight any areas that you're unsure of, want feedback on, or want reviewers to pay particular attention to.
Example: I'm not sure I did X correctly, can reviewers please double-check that for me?
Metrics
Is this change something that can or should be tracked? If so, can we do it today? And how? If its easy, do it
References
https://fossa.atlassian.net/browse/ANE-2235
https://fossa.atlassian.net/browse/ANE-2177
https://teamfossa.slack.com/archives/C022BQWCR45/p1733495478363879
Checklist
docs/
.docs/README.ms
and gave consideration to how discoverable or not my documentation is.Changelog.md
. If this PR did not mark a release, I added my changes into an## Unreleased
section at the top..fossa.yml
orfossa-deps.{json.yml}
, I updateddocs/references/files/*.schema.json
AND I have updated example files used byfossa init
command. You may also need to update these if you have added/removed new dependency type (e.g.pip
) or analysis target type (e.g.poetry
).docs/references/subcommands/<subcommand>.md
.