Repository navigation
Add Yarn PnP .pnp.cjs handler - #5391
Open
Shivain-codes wants to merge 1 commit into
Open
Shivain-codes wants to merge 1 commit into
Shivain-codes wants to merge 1 commit into
Conversation
Parse Yarn v2+ Plug and Play (.pnp.cjs) manifests and register the handler, with tests and fixtures. Signed-off-by: Shivain Gupta <217550659+Shivain-codes@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2728
Add support for Yarn v2+ Plug and Play manifests (
.pnp.cjs) for parsing npm dependencies.Changes
YarnPnpHandlerinsrc/packagedcode/npm.py: parses the embeddedRAW_RUNTIME_STATEJSON in.pnp.cjsfiles.packageRegistryDatais a list of[ident, [[reference, data], ...]]pairs, where references are locators such asnpm:7.0.0,workspace:., orvirtual:<hash>#npm:7.0.0; the null/null entry (the top-level package itself) is skipped,workspace:entries are skipped, andvirtual:entries yield the npm version after#npm:when present.npm.YarnPnpHandlerinAPPLICATION_PACKAGE_DATAFILE_HANDLERSinsrc/packagedcode/__init__.py, so ScanCode actually calls the handler.test_is_datafile_yarn_pnpandtest_parse_yarn_pnpintests/packagedcode/test_npm.py, with fixturestests/packagedcode/data/npm/yarn-pnp/.pnp.cjsand.pnp.cjs-expected(packages:@babel/core7.0.0,lodash4.17.21).CHANGELOG.rst(Next release) and add my name toAUTHORS.rst.Notes
is_lockfileis left unset for this handler:.pnp.cjsis a runtime manifest, not ayarn.lockfile. Happy to set it if maintainers prefer that behaviour.Tasks
Run locally:
py.test -k yarn_pnp(2 passed) and fulltests/packagedcode/test_npm.py(96 passed, no failures)