介绍
pnpr 是一个兼容 pnpm 的 npm 注册表服务器,使用 Rust 编写。它使用 npm 注册表协议,因此任何兼容 npm 的客户端(pnpm、npm、yarn)都可以与之通信。它托管你自己的包,并代理上游注册表,如 registry.npmjs.org,具有自己的身份验证和访问控制——大致相当于 verdaccio 在 JavaScript 生态系统中扮演的角色。
每个注册表来源 pnpr 提供服务的都是一个声明的注册表,该注册表声明它所提供的包名称,路由将每个包名称解析为唯一的来源——没有跨来源的回退,这从根本上防止了依赖混淆攻击。
🌐 Every registry origin pnpr serves is a declared registry that claims the package names it serves, and a router resolves each package name to exactly one origin — there is no cross-origin fall-through, which closes dependency-confusion attacks by construction.
pnpr 位于 pnpm monorepo 下的 pnpr/。
🌐 pnpr lives in the pnpm monorepo under
pnpr/.
pnpr 是实验性的,仍在积极开发中。其行为、配置和 API 可能会在各个版本之间发生变化。
🌐 pnpr is experimental and still in active development. Its behavior, configuration, and APIs may change between releases.
你可以用它做什么
🌐 What you can use it for
-
A private registry — host your organization's private packages, with per-package access and publish rules.
-
A caching proxy — mirror an upstream registry (e.g. npmjs.org) to speed up installs and stay resilient to upstream outages.
-
A credential gateway — hold one upstream registry token server-side and fan it out to a whole team through pnpr's own authentication, so clients never handle the upstream credential.
-
An install accelerator — resolve a project's dependency graph server-side and hand pnpm a ready-to-use lockfile. See Install acceleration.
它与 pnpm 的关系
🌐 How it relates to pnpm
pnpr 是一个与 pnpm CLI 独立的产品。pnpm CLI 在你的机器上安装软件包;而 pnpr 是一个你运行的服务器,用于托管和代理它们。你可以单独使用其中的任何一个——但它们被设计为可以很好地协同工作,pnpm 可以将依赖解析任务交给 pnpr 服务器以加快安装速度。
🌐 pnpr is a separate product from the pnpm CLI. The pnpm CLI installs packages on your machine; pnpr is a server you run to host and proxy them. You can use either one without the other — but they're designed to work well together, and pnpm can offload dependency resolution to a pnpr server to make installs faster.
许可证
🌐 License
pnpr 是 源代码可用 的,而非开源的。它在 PolyForm Shield License 1.0.0 下授权——你可以出于任何目的运行、修改和自托管 pnpr,但不能提供与其竞争的产品。这是 pnpm monorepo 中唯一没有 MIT 许可的部分。详情请参见 License。
🌐 pnpr is source-available, not open source. It is licensed under the PolyForm Shield License 1.0.0 — you may run, modify, and self-host pnpr for any purpose except providing a product that competes with it. This is the only part of the pnpm monorepo that is not MIT licensed. See License for details.