@pnpm/pnpr 0.0.0-0 → 0.0.0-26052901
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +78 -0
- package/bin/pnpr +52 -0
- package/package.json +31 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015-2016 Rico Sta. Cruz and other contributors
|
|
4
|
+
Copyright (c) 2016-2026 Zoltan Kochan and other contributors
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# @pnpm/pnpr
|
|
2
|
+
|
|
3
|
+
A pnpm-compatible npm registry server, written in Rust. Speaks the npm
|
|
4
|
+
registry protocol, so any npm-compatible client (pnpm, npm, yarn) can
|
|
5
|
+
talk to it. Proxies packages from a configured upstream like
|
|
6
|
+
npmjs.org and serves them with its own auth and access controls.
|
|
7
|
+
|
|
8
|
+
Lives in the [pnpm monorepo](https://github.com/pnpm/pnpm) under
|
|
9
|
+
[`pnpr/`](https://github.com/pnpm/pnpm/tree/main/pnpr).
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
pnpm add -g @pnpm/pnpr
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The wrapper resolves to the native binary published under
|
|
18
|
+
`@pnpm/pnpr.<platform>-<arch>` (e.g. `@pnpm/pnpr.linux-x64`). Prebuilt
|
|
19
|
+
binaries are available for `linux-x64`, `linux-arm64`, `darwin-x64`,
|
|
20
|
+
`darwin-arm64`, `win32-x64`, and `win32-arm64`.
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
Start the server with the bundled default config:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
pnpr
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
It listens on `127.0.0.1:4873` and proxies `https://registry.npmjs.org/`
|
|
31
|
+
by default. Point a client at it with:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
pnpm config set registry http://127.0.0.1:4873/
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## CLI flags
|
|
38
|
+
|
|
39
|
+
| Flag | Description |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| `-c, --config <path>` | Path to a verdaccio-shaped YAML config. When omitted, the bundled default is used. |
|
|
42
|
+
| `--listen <addr>` | Address to bind to. Defaults to `127.0.0.1:4873`. |
|
|
43
|
+
| `--storage <path>` | Override the storage directory from the loaded config. |
|
|
44
|
+
| `--public-url <url>` | URL clients should use to reach the server, used when rewriting `dist.tarball` in served packuments. Defaults to `http://<listen>`. |
|
|
45
|
+
| `--packument-ttl-secs <n>` | Seconds before a cached packument is considered stale and refetched. |
|
|
46
|
+
|
|
47
|
+
Log level is controlled via the standard `RUST_LOG` environment
|
|
48
|
+
variable (e.g. `RUST_LOG=debug pnpr`).
|
|
49
|
+
|
|
50
|
+
## Configuration
|
|
51
|
+
|
|
52
|
+
`pnpr` uses a [verdaccio](https://verdaccio.org/docs/configuration)-shaped
|
|
53
|
+
YAML config. A minimal example:
|
|
54
|
+
|
|
55
|
+
```yaml
|
|
56
|
+
storage: ./storage
|
|
57
|
+
|
|
58
|
+
uplinks:
|
|
59
|
+
npmjs:
|
|
60
|
+
url: https://registry.npmjs.org/
|
|
61
|
+
|
|
62
|
+
packages:
|
|
63
|
+
'@*/*':
|
|
64
|
+
access: $all
|
|
65
|
+
publish: $authenticated
|
|
66
|
+
proxy: npmjs
|
|
67
|
+
|
|
68
|
+
'**':
|
|
69
|
+
access: $all
|
|
70
|
+
publish: $authenticated
|
|
71
|
+
proxy: npmjs
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Pass it with `-c`:
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
pnpr -c ./pnpr.yaml
|
|
78
|
+
```
|
package/bin/pnpr
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { platform, arch, env } = process;
|
|
3
|
+
|
|
4
|
+
const PLATFORMS = {
|
|
5
|
+
win32: {
|
|
6
|
+
x64: "@pnpm/pnpr.win32-x64/pnpr.exe",
|
|
7
|
+
arm64: "@pnpm/pnpr.win32-arm64/pnpr.exe",
|
|
8
|
+
},
|
|
9
|
+
darwin: {
|
|
10
|
+
x64: "@pnpm/pnpr.darwin-x64/pnpr",
|
|
11
|
+
arm64: "@pnpm/pnpr.darwin-arm64/pnpr",
|
|
12
|
+
},
|
|
13
|
+
linux: {
|
|
14
|
+
x64: "@pnpm/pnpr.linux-x64/pnpr",
|
|
15
|
+
arm64: "@pnpm/pnpr.linux-arm64/pnpr",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const binPath = PLATFORMS?.[platform]?.[arch];
|
|
20
|
+
if (binPath) {
|
|
21
|
+
const result = require("child_process").spawnSync(
|
|
22
|
+
require.resolve(binPath),
|
|
23
|
+
process.argv.slice(2),
|
|
24
|
+
{
|
|
25
|
+
shell: false,
|
|
26
|
+
stdio: "inherit",
|
|
27
|
+
env,
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
if (result.error) {
|
|
32
|
+
throw result.error;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// result.status is null when the child was killed by a signal; falling
|
|
36
|
+
// through to `exitCode = null` would make the wrapper appear to exit 0
|
|
37
|
+
// and mask the signal. Re-raise the signal so the parent terminates
|
|
38
|
+
// the same way; fall back to a non-zero exit if that's not possible.
|
|
39
|
+
if (typeof result.status === "number") {
|
|
40
|
+
process.exitCode = result.status;
|
|
41
|
+
} else if (result.signal) {
|
|
42
|
+
process.kill(process.pid, result.signal);
|
|
43
|
+
} else {
|
|
44
|
+
process.exitCode = 1;
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
console.error(
|
|
48
|
+
"The @pnpm/pnpr package doesn't ship with prebuilt binaries for your platform yet. " +
|
|
49
|
+
"You can create an issue at https://github.com/pnpm/pnpm/issues for support."
|
|
50
|
+
);
|
|
51
|
+
process.exitCode = 1;
|
|
52
|
+
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/pnpr",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
3
|
+
"description": "pnpm-compatible npm registry server, written in Rust",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"pnpm",
|
|
6
|
+
"npm",
|
|
7
|
+
"registry"
|
|
8
|
+
],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"homepage": "https://github.com/pnpm/pnpm/tree/main/pnpr",
|
|
11
|
+
"bugs": "https://github.com/pnpm/pnpm/issues",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/pnpm/pnpm",
|
|
15
|
+
"directory": "pnpr/npm/pnpr"
|
|
16
|
+
},
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=18.*"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"bin/pnpr"
|
|
22
|
+
],
|
|
23
|
+
"version": "0.0.0-26052901",
|
|
24
|
+
"optionalDependencies": {
|
|
25
|
+
"@pnpm/pnpr.win32-x64": "0.0.0-26052901",
|
|
26
|
+
"@pnpm/pnpr.win32-arm64": "0.0.0-26052901",
|
|
27
|
+
"@pnpm/pnpr.darwin-x64": "0.0.0-26052901",
|
|
28
|
+
"@pnpm/pnpr.darwin-arm64": "0.0.0-26052901",
|
|
29
|
+
"@pnpm/pnpr.linux-x64": "0.0.0-26052901",
|
|
30
|
+
"@pnpm/pnpr.linux-arm64": "0.0.0-26052901"
|
|
31
|
+
},
|
|
32
|
+
"bin": {
|
|
33
|
+
"pnpr": "bin/pnpr"
|
|
13
34
|
}
|
|
14
35
|
}
|