-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Contribution
- I'd be willing to implement this feature (contributing guide)
Describe the user story
Now that alternative registries such as JSR are popping up, it would be great to have support for it directly in PNPM itself.
Describe the solution you'd like
Currently if you want to install a JSR package with PNPM you must run pnpm dlx jsr add @scope/package
. This then creates a .npmrc
with a scoped registry for JSR by adding @jsr:registry=https://npm.jsr.io
to the file. This makes it possible to install JSR packages by adding the following to the package.json
:
{
"dependencies": {
"@scope/package": "npm:@jsr/[email protected]"
}
}
This is rather messy, and uses the npm compatibility registry API to download packages from the JSR registry. The proposed solution would be to handle installing packages from JSR natively. So installing a package from JSR would be simplified to:
pnpm add jsr:@scope/package
Which then installs a JSR package into the package.json
as follows:
{
"dependencies": {
"@scope/package": "jsr:@scope/[email protected]"
}
}
The package would then also be installed by using the JSR registry API, and not the npm compatibility registry API.
Describe the drawbacks of your solution
Requires maintaining an additional implementation for installing JSR packages.
Describe alternatives you've considered
Alternatively, things could be left as is, and using JSR packages will continue to be done through a NPM compatibility layer. This makes things slightly more messy for users of JSR in PNPM, but does work.
Another option could be to treat packages with a jsr:
prefix as special NPM packages that will get installed through the JSR's npm compatibility registry API instead of the JSR registry API. This could simplify internal implementation as the existing NPM registry code could be re-used.