@pnpm/pnpr 0.0.0-26060602 → 0.0.0-26062301

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.
Files changed (3) hide show
  1. package/README.md +47 -13
  2. package/bin/pnpr +27 -3
  3. package/package.json +9 -7
package/README.md CHANGED
@@ -16,8 +16,9 @@ pnpm add -g @pnpm/pnpr
16
16
 
17
17
  The wrapper resolves to the native binary published under
18
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`.
19
+ binaries are available for `linux-x64`, `linux-arm64`, `linux-x64-musl`,
20
+ `linux-arm64-musl`, `darwin-x64`, `darwin-arm64`, `win32-x64`, and
21
+ `win32-arm64`.
21
22
 
22
23
  ## Usage
23
24
 
@@ -64,11 +65,13 @@ packages:
64
65
  '@*/*':
65
66
  access: $all
66
67
  publish: $authenticated
68
+ unpublish: $authenticated
67
69
  proxy: npmjs
68
70
 
69
71
  '**':
70
72
  access: $all
71
73
  publish: $authenticated
74
+ unpublish: $authenticated
72
75
  proxy: npmjs
73
76
  ```
74
77
 
@@ -91,8 +94,8 @@ pnpr -c ./pnpr.yaml
91
94
  By default both are local directories. Adding an `s3:` block moves the
92
95
  **hosted** store into an S3-compatible object store, so the durable data
93
96
  is replicated by the provider and can be shared by several stateless
94
- `pnpr` replicas. The cache and the resolver databases always
95
- stay on local disk — only the hosted store is pluggable.
97
+ `pnpr` replicas. The cache stays on local disk — only the hosted
98
+ package store is pluggable here.
96
99
 
97
100
  Because any S3-compatible endpoint works, this also covers **Cloudflare
98
101
  R2**, **MinIO**, **Backblaze B2**, **Wasabi**, etc. — point `endpoint`
@@ -155,6 +158,7 @@ packages:
155
158
  '**':
156
159
  access: $all
157
160
  publish: $authenticated
161
+ unpublish: $authenticated
158
162
  proxy: npmjs
159
163
  ```
160
164
 
@@ -181,21 +185,30 @@ s3:
181
185
  secretAccessKey: minioadmin
182
186
  ```
183
187
 
184
- ### Storing users and tokens in a networked SQLite database
188
+ ### Storing users and tokens in a shared SQL database
185
189
 
186
190
  Auth state — the registered users and their bearer tokens — is the other
187
191
  piece of per-instance disk state. By default users live in an
188
192
  htpasswd file and tokens in a local SQLite database (see `auth:` above),
189
193
  so two `pnpr` replicas don't see each other's accounts. Adding a
190
- `backend:` block moves both into one **networked SQLite** database
191
- (libsql / [Turso](https://turso.tech)), so several stateless replicas
192
- share a consistent set of logins and tokens — the auth half of running
193
- `pnpr` horizontally scaled.
194
+ `backend:` block moves both into one shared SQL database, so several
195
+ stateless replicas share a consistent set of logins and tokens — the
196
+ auth half of running `pnpr` horizontally scaled.
194
197
 
195
- The schema is the same SQLite the local backend uses (the `tokens` table
196
- is identical; users move from the htpasswd file into a `users` table), so
197
- a database can be migrated between the two. Token lookups happen on the
198
- request hot path, so the database should be low-latency from the server.
198
+ The same auth traits drive every backend, and the SQL schema sticks to
199
+ common column types so records can be moved between supported drivers.
200
+ Only one backend may be selected in a config file.
201
+
202
+ Database drivers are Cargo-feature gated:
203
+
204
+ | Backend | Config key | Cargo feature |
205
+ | --- | --- | --- |
206
+ | libsql / Turso | `backend.libsql` | `backend-libsql` (enabled by default) |
207
+ | PostgreSQL | `backend.postgres` or `backend.postgresql` | `backend-postgres` |
208
+ | MySQL-compatible | `backend.mysql` | `backend-mysql` |
209
+
210
+ Token lookups happen on the request hot path, so the database should be
211
+ low-latency from the server.
199
212
 
200
213
  ```yaml
201
214
  storage: ./storage
@@ -234,6 +247,27 @@ replica's writes (a token issued or revoked elsewhere) only after the
234
247
  next background sync, so lower `syncIntervalSecs` means less
235
248
  revocation lag. Omit `replicaPath` to always read the primary directly.
236
249
 
250
+ PostgreSQL:
251
+
252
+ ```yaml
253
+ backend:
254
+ postgres:
255
+ url: ${PNPR_POSTGRES_URL}
256
+ maxConnections: 16
257
+ ```
258
+
259
+ MySQL:
260
+
261
+ ```yaml
262
+ backend:
263
+ mysql:
264
+ url: ${PNPR_MYSQL_URL}
265
+ maxConnections: 16
266
+ ```
267
+
268
+ For PostgreSQL or MySQL support, build pnpr with the matching Cargo
269
+ feature, for example `cargo build -p pnpr --features backend-postgres`.
270
+
237
271
  When the `backend:` block is absent, auth stays on local disk and the
238
272
  `auth.htpasswd` / `auth.tokens` settings apply as before. The
239
273
  `auth.htpasswd.max_users` registration cap is honored either way.
package/bin/pnpr CHANGED
@@ -11,12 +11,18 @@ const PLATFORMS = {
11
11
  arm64: "@pnpm/pnpr.darwin-arm64/pnpr",
12
12
  },
13
13
  linux: {
14
- x64: "@pnpm/pnpr.linux-x64/pnpr",
15
- arm64: "@pnpm/pnpr.linux-arm64/pnpr",
14
+ x64: {
15
+ glibc: "@pnpm/pnpr.linux-x64/pnpr",
16
+ musl: "@pnpm/pnpr.linux-x64-musl/pnpr",
17
+ },
18
+ arm64: {
19
+ glibc: "@pnpm/pnpr.linux-arm64/pnpr",
20
+ musl: "@pnpm/pnpr.linux-arm64-musl/pnpr",
21
+ },
16
22
  },
17
23
  };
18
24
 
19
- const binPath = PLATFORMS?.[platform]?.[arch];
25
+ const binPath = getBinPath();
20
26
  if (binPath) {
21
27
  const result = require("child_process").spawnSync(
22
28
  require.resolve(binPath),
@@ -50,3 +56,21 @@ if (binPath) {
50
56
  );
51
57
  process.exitCode = 1;
52
58
  }
59
+
60
+ function getBinPath() {
61
+ const platformEntry = PLATFORMS?.[platform]?.[arch];
62
+
63
+ if (platformEntry == null || typeof platformEntry === "string") {
64
+ return platformEntry;
65
+ }
66
+
67
+ return platformEntry[detectLinuxLibc()];
68
+ }
69
+
70
+ function detectLinuxLibc() {
71
+ if (platform !== "linux") {
72
+ return null;
73
+ }
74
+
75
+ return process.report.getReport().header.glibcVersionRuntime ? "glibc" : "musl";
76
+ }
package/package.json CHANGED
@@ -21,14 +21,16 @@
21
21
  "bin/pnpr",
22
22
  "LICENSE.md"
23
23
  ],
24
- "version": "0.0.0-26060602",
24
+ "version": "0.0.0-26062301",
25
25
  "optionalDependencies": {
26
- "@pnpm/pnpr.win32-x64": "0.0.0-26060602",
27
- "@pnpm/pnpr.win32-arm64": "0.0.0-26060602",
28
- "@pnpm/pnpr.darwin-x64": "0.0.0-26060602",
29
- "@pnpm/pnpr.darwin-arm64": "0.0.0-26060602",
30
- "@pnpm/pnpr.linux-x64": "0.0.0-26060602",
31
- "@pnpm/pnpr.linux-arm64": "0.0.0-26060602"
26
+ "@pnpm/pnpr.win32-x64": "0.0.0-26062301",
27
+ "@pnpm/pnpr.win32-arm64": "0.0.0-26062301",
28
+ "@pnpm/pnpr.darwin-x64": "0.0.0-26062301",
29
+ "@pnpm/pnpr.darwin-arm64": "0.0.0-26062301",
30
+ "@pnpm/pnpr.linux-x64": "0.0.0-26062301",
31
+ "@pnpm/pnpr.linux-arm64": "0.0.0-26062301",
32
+ "@pnpm/pnpr.linux-x64-musl": "0.0.0-26062301",
33
+ "@pnpm/pnpr.linux-arm64-musl": "0.0.0-26062301"
32
34
  },
33
35
  "bin": {
34
36
  "pnpr": "bin/pnpr"