Conversation
This iterates on the spec outlined by @coreyfarrel in #46. For each :: separated item: * If the item has no : then it is a commit-ish * If the item has : then split into name and value. * If the name is semver then do semver lookup of ref or tag * If the name is path then use the value as the subdir to install from. * If the name is unknown then warn that the name-value pair is being ignored. This loop errors if duplicate values are found. Unknown values log a warning instead of erroring.
|
ahhhhhh shieeeet |
|
NPM CLI doesn't support |
wraithgar
pushed a commit
to npm/pacote
that referenced
this pull request
Feb 6, 2026
This implements the `gitSubdir` parameter, which is already parsed by npa, finally allowing users of npm to specifiy subdirectories in git dependencies. The respective parsing logic has already been agreed on and implemented nearly 4 years ago here: npm/npm-package-arg#91. In this PR, the git fetcher is changed to resolve the `gitSubdir` parameter from the spec if found, as suggested by the author in the original npa PR. ## References Fixes npm/cli#528 Fixes npm/npm#2974 Relates to npm/npm-package-arg#46 Relates to npm/npm-package-arg#91 Inspired from and crediting sspiff@8bd5461, which seems to have been lost after merging the PR at npa.
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.
This builds off of #46, and
more specifically the spec laid out by @coreyfarrell. Namely:
For each :: separated item:
This loop errors if duplicate values are found.
Unknown values log a warning instead of erroring.
This also introduces the concept of a
pathspecifier that is assignedto the
gitSubdirattribute. Consuming libs (e.g. pacote) will need tolook for that and react to its presence accordingly.
Credit: @sspiff for the original PR and @coreyfarrell for the spec