verdaccio 7.0.0-next.6 → 7.0.0
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 +1 -1
- package/README.md +259 -4
- package/bin/verdaccio +1 -1
- package/build/cjs/_virtual/_rolldown/runtime.cjs +23 -0
- package/build/cjs/index.cjs +33 -0
- package/build/cjs/lib/auth-utils.cjs +14 -0
- package/build/cjs/lib/auth-utils.cjs.map +1 -0
- package/build/cjs/lib/auth.cjs +10 -0
- package/build/cjs/lib/auth.cjs.map +1 -0
- package/build/cjs/lib/cli.cjs +15 -0
- package/build/cjs/lib/cli.cjs.map +1 -0
- package/build/cjs/lib/config.cjs +20 -0
- package/build/cjs/lib/config.cjs.map +1 -0
- package/build/cjs/lib/constants.cjs +76 -0
- package/build/cjs/lib/constants.cjs.map +1 -0
- package/build/cjs/lib/legacy-storage-adapter.cjs +214 -0
- package/build/cjs/lib/legacy-storage-adapter.cjs.map +1 -0
- package/build/cjs/lib/logger/index.cjs +26 -0
- package/build/cjs/lib/logger/index.cjs.map +1 -0
- package/build/cjs/lib/run-server.cjs +64 -0
- package/build/cjs/lib/run-server.cjs.map +1 -0
- package/build/cjs/lib/storage.cjs +103 -0
- package/build/cjs/lib/storage.cjs.map +1 -0
- package/build/cjs/lib/up-storage.cjs +29 -0
- package/build/cjs/lib/utils.cjs +20 -0
- package/build/cjs/lib/utils.cjs.map +1 -0
- package/build/cjs/types/index.cjs +1 -0
- package/build/esm/index.mjs +3 -0
- package/build/esm/lib/auth-utils.mjs +11 -0
- package/build/esm/lib/auth-utils.mjs.map +1 -0
- package/build/esm/lib/auth.mjs +7 -0
- package/build/esm/lib/auth.mjs.map +1 -0
- package/build/esm/lib/cli.mjs +14 -0
- package/build/esm/lib/cli.mjs.map +1 -0
- package/build/esm/lib/config.mjs +16 -0
- package/build/esm/lib/config.mjs.map +1 -0
- package/build/esm/lib/constants.mjs +11 -0
- package/build/esm/lib/constants.mjs.map +1 -0
- package/build/esm/lib/legacy-storage-adapter.mjs +210 -0
- package/build/esm/lib/legacy-storage-adapter.mjs.map +1 -0
- package/build/esm/lib/logger/index.mjs +17 -0
- package/build/esm/lib/logger/index.mjs.map +1 -0
- package/build/esm/lib/run-server.mjs +58 -0
- package/build/esm/lib/run-server.mjs.map +1 -0
- package/build/esm/lib/storage.mjs +94 -0
- package/build/esm/lib/storage.mjs.map +1 -0
- package/build/esm/lib/up-storage.mjs +1 -0
- package/build/esm/lib/utils.mjs +17 -0
- package/build/esm/lib/utils.mjs.map +1 -0
- package/build/index.d.ts +2 -2
- package/build/lib/auth-utils.d.ts +2 -0
- package/build/lib/auth.d.ts +2 -0
- package/build/lib/cli.d.ts +2 -0
- package/build/lib/config.d.ts +5 -0
- package/build/lib/constants.d.ts +16 -0
- package/build/lib/legacy-storage-adapter.d.ts +14 -0
- package/build/lib/logger/index.d.ts +6 -0
- package/build/lib/run-server.d.ts +35 -0
- package/build/lib/storage.d.ts +16 -0
- package/build/lib/up-storage.d.ts +2 -0
- package/build/lib/utils.d.ts +2 -0
- package/build/types/index.d.ts +58 -0
- package/conf/.gitkeep +0 -0
- package/cypress/e2e/01-home.cy.ts +11 -0
- package/cypress/e2e/02-signin.cy.ts +11 -0
- package/cypress/e2e/03-layout.cy.ts +11 -0
- package/cypress/e2e/04-search.cy.ts +33 -0
- package/cypress/e2e/05-settings.cy.ts +24 -0
- package/cypress/e2e/06-publish.cy.ts +16 -0
- package/cypress/e2e/07-detail.cy.ts +19 -0
- package/cypress/e2e/08-failure-modes.cy.ts +21 -0
- package/cypress/e2e/09-manifest-rendering.cy.ts +20 -0
- package/cypress/e2e/10-session.cy.ts +17 -0
- package/cypress/e2e/11-i18n-keys.cy.ts +17 -0
- package/cypress/e2e/12-signup.cy.ts +19 -0
- package/cypress/e2e/13-change-password.cy.ts +24 -0
- package/cypress/support/e2e.ts +1 -0
- package/cypress/support/node-builtins-stub.cjs +6 -0
- package/cypress.config.ts +86 -0
- package/index.js +1 -0
- package/package.json +119 -62
- package/pnpm-workspace.yaml +32 -0
- package/renovate.json +22 -0
- package/security.txt +5 -0
- package/systemd/verdaccio.service +11 -0
- package/types/custom.d.ts +13 -0
- package/vite.config.ts +101 -0
- package/build/index.js +0 -32
- package/build/index.js.map +0 -1
- package/build/server/index.d.ts +0 -2
- package/build/server/index.js +0 -32
- package/build/server/index.js.map +0 -1
- package/build/server/registry.d.ts +0 -39
- package/build/server/registry.js +0 -154
- package/build/server/registry.js.map +0 -1
- package/build/server/request.d.ts +0 -64
- package/build/server/request.js +0 -264
- package/build/server/request.js.map +0 -1
- package/build/start.js +0 -4
- package/build/start.js.map +0 -1
- /package/build/{start.d.ts → esm/types/index.mjs} +0 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let debug = require("debug");
|
|
4
|
+
debug = require_runtime.__toESM(debug);
|
|
5
|
+
let node_stream = require("node:stream");
|
|
6
|
+
//#region src/lib/legacy-storage-adapter.ts
|
|
7
|
+
var debug$1 = (0, debug.default)("verdaccio:storage:legacy-adapter");
|
|
8
|
+
/** Resolve an error-first callback method into a promise. */
|
|
9
|
+
function fromCallback(invoke) {
|
|
10
|
+
return new Promise((resolve, reject) => {
|
|
11
|
+
invoke((err, data) => err ? reject(err) : resolve(data));
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Detect a legacy callback-based storage plugin. The new contract's `get()`
|
|
16
|
+
* takes no arguments (returns a promise); the legacy `get(cb)` declares a
|
|
17
|
+
* trailing callback, and `add(name, cb)` takes two. Arity is a stable signal
|
|
18
|
+
* here because both contracts are frozen.
|
|
19
|
+
*/
|
|
20
|
+
function isLegacyStoragePlugin(plugin) {
|
|
21
|
+
if (!plugin || typeof plugin.get !== "function") return false;
|
|
22
|
+
const getIsCallback = plugin.get.length >= 1;
|
|
23
|
+
const addIsCallback = typeof plugin.add === "function" && plugin.add.length >= 2;
|
|
24
|
+
return getIsCallback || addIsCallback;
|
|
25
|
+
}
|
|
26
|
+
/** Synthesize the new `hasPackage()` from legacy `readPackage(name, cb)`. */
|
|
27
|
+
function hasPackage(handler, pkgName) {
|
|
28
|
+
return new Promise((resolve) => {
|
|
29
|
+
handler.readPackage(pkgName, (err) => resolve(!err));
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Synthesize the new `hasTarball(file)` from a legacy `readTarball` stream:
|
|
34
|
+
* open => exists, 404/ENOENT error => missing. Mirrors the old
|
|
35
|
+
* `Storage.hasLocalTarball` probe.
|
|
36
|
+
*/
|
|
37
|
+
function hasTarball(handler, fileName) {
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
let stream = handler.readTarball(fileName);
|
|
40
|
+
let isOpen = false;
|
|
41
|
+
stream.on("error", (err) => {
|
|
42
|
+
const notFound = err?.code === "ENOENT" || err?.status === 404;
|
|
43
|
+
if (isOpen || !notFound) {
|
|
44
|
+
if (!isOpen) resolve(false);
|
|
45
|
+
else reject(err);
|
|
46
|
+
} else resolve(false);
|
|
47
|
+
stream?.abort?.();
|
|
48
|
+
stream = null;
|
|
49
|
+
});
|
|
50
|
+
stream.on("open", () => {
|
|
51
|
+
isOpen = true;
|
|
52
|
+
stream.abort?.();
|
|
53
|
+
stream = null;
|
|
54
|
+
resolve(true);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Bridge legacy `readTarball(name) => ReadTarball` to the promise contract.
|
|
60
|
+
* The legacy object is already a Readable that emits `content-length`/`open`/
|
|
61
|
+
* `error`, so it can be handed back as-is; we only wire abort to the signal.
|
|
62
|
+
*/
|
|
63
|
+
function readTarball(handler, fileName, options = {}) {
|
|
64
|
+
const stream = handler.readTarball(fileName);
|
|
65
|
+
const { signal } = options;
|
|
66
|
+
if (signal) {
|
|
67
|
+
if (signal.aborted) stream.abort?.();
|
|
68
|
+
else signal.addEventListener("abort", () => stream.abort?.(), { once: true });
|
|
69
|
+
}
|
|
70
|
+
return Promise.resolve(stream);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Bridge legacy `writeTarball(name) => UploadTarball` to a Node Writable that
|
|
74
|
+
* `@verdaccio/store` can use in `pipeline()`:
|
|
75
|
+
* - the legacy stream finalizes only when `.done()` is called (ends temp file,
|
|
76
|
+
* renames it into place, then emits `success`); store instead ends the
|
|
77
|
+
* stream and waits for `close`.
|
|
78
|
+
* - so we forward writes to the legacy stream, call `.done()` on `_final`, and
|
|
79
|
+
* only complete (emit `close`) once the legacy stream emits `success`.
|
|
80
|
+
*/
|
|
81
|
+
function writeTarball(handler, fileName, options = {}) {
|
|
82
|
+
const upload = handler.writeTarball(fileName);
|
|
83
|
+
const { signal } = options;
|
|
84
|
+
const bridge = new node_stream.Writable({
|
|
85
|
+
write(chunk, _enc, cb) {
|
|
86
|
+
if (upload.write(chunk)) cb();
|
|
87
|
+
else upload.once("drain", cb);
|
|
88
|
+
},
|
|
89
|
+
final(cb) {
|
|
90
|
+
upload.once("success", () => cb());
|
|
91
|
+
upload.once("error", (err) => cb(err));
|
|
92
|
+
upload.end();
|
|
93
|
+
upload.done();
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
upload.on("open", () => bridge.emit("open"));
|
|
97
|
+
upload.on("error", (err) => bridge.destroy(err));
|
|
98
|
+
if (signal) {
|
|
99
|
+
const onAbort = () => {
|
|
100
|
+
upload.abort?.();
|
|
101
|
+
bridge.destroy(/* @__PURE__ */ new Error("tarball upload aborted"));
|
|
102
|
+
};
|
|
103
|
+
if (signal.aborted) onAbort();
|
|
104
|
+
else signal.addEventListener("abort", onAbort, { once: true });
|
|
105
|
+
}
|
|
106
|
+
return Promise.resolve(bridge);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Bridge legacy 5-arg `updatePackage(name, updateHandler, onWrite,
|
|
110
|
+
* transformPackage, onEnd)` to the new 2-arg `updatePackage(name, handleUpdate)`
|
|
111
|
+
* where `handleUpdate(manifest) => Promise<manifest>`. The store persists the
|
|
112
|
+
* result itself (via `writePackage`/`savePackage`), so `onWrite` is a no-op:
|
|
113
|
+
* we only read-lock, run the handler, and unlock.
|
|
114
|
+
*/
|
|
115
|
+
function updatePackage(handler, name, handleUpdate) {
|
|
116
|
+
return new Promise((resolve, reject) => {
|
|
117
|
+
let updated;
|
|
118
|
+
handler.updatePackage(name, (json, cb) => {
|
|
119
|
+
Promise.resolve(handleUpdate(json)).then((result) => {
|
|
120
|
+
updated = result;
|
|
121
|
+
cb();
|
|
122
|
+
}).catch(cb);
|
|
123
|
+
}, (_name, _data, cb) => cb(), (json) => updated ?? json, (err) => err ? reject(err) : resolve(updated));
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/** Wrap a legacy per-package storage handler in the promise contract. */
|
|
127
|
+
function wrapLegacyHandler(handler) {
|
|
128
|
+
if (!handler) return handler;
|
|
129
|
+
return {
|
|
130
|
+
readPackage: (name) => fromCallback((cb) => handler.readPackage(name, cb)),
|
|
131
|
+
createPackage: (name, manifest) => fromCallback((cb) => handler.createPackage(name, manifest, cb)),
|
|
132
|
+
savePackage: (name, value) => fromCallback((cb) => handler.savePackage(name, value, cb)),
|
|
133
|
+
deletePackage: (fileName) => fromCallback((cb) => handler.deletePackage(fileName, cb)),
|
|
134
|
+
removePackage: () => fromCallback((cb) => handler.removePackage(cb)),
|
|
135
|
+
hasPackage: (name) => hasPackage(handler, name),
|
|
136
|
+
hasTarball: (fileName) => hasTarball(handler, fileName),
|
|
137
|
+
readTarball: (fileName, options) => readTarball(handler, fileName, options),
|
|
138
|
+
writeTarball: (fileName, options) => writeTarball(handler, fileName, options),
|
|
139
|
+
updatePackage: (name, handleUpdate) => updatePackage(handler, name, handleUpdate)
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The legacy contract emits the package itself, while `@verdaccio/store` reads
|
|
144
|
+
* `item.package.name` and `item.score`. Wrap whatever is not already in that shape,
|
|
145
|
+
* otherwise a plugin following the documented contract makes `/-/v1/search` fail.
|
|
146
|
+
*/
|
|
147
|
+
function toSearchItem(item) {
|
|
148
|
+
if (item !== null && typeof item === "object" && "package" in item) return item;
|
|
149
|
+
return {
|
|
150
|
+
package: item,
|
|
151
|
+
score: {
|
|
152
|
+
final: 1,
|
|
153
|
+
detail: {
|
|
154
|
+
quality: 1,
|
|
155
|
+
popularity: 1,
|
|
156
|
+
maintenance: 1
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Collect a legacy streaming `search(onPackage, onEnd, validate)` into a list.
|
|
163
|
+
*
|
|
164
|
+
* A legacy plugin has no way to receive the query, so the filtering happens here, on
|
|
165
|
+
* the emitted name. The predicate stays permissive on purpose: a plugin calls it with
|
|
166
|
+
* the basename (`pkg` for `@scope/pkg`), so any rejection there could drop a package
|
|
167
|
+
* whose full name does match.
|
|
168
|
+
*/
|
|
169
|
+
function search(plugin, query) {
|
|
170
|
+
const text = typeof query?.text === "string" ? query.text.toLowerCase() : void 0;
|
|
171
|
+
const matches = (name) => text === void 0 || typeof name === "string" && name.toLowerCase().includes(text);
|
|
172
|
+
return new Promise((resolve, reject) => {
|
|
173
|
+
const items = [];
|
|
174
|
+
try {
|
|
175
|
+
plugin.search((item, done) => {
|
|
176
|
+
const searchItem = toSearchItem(item);
|
|
177
|
+
if (matches(searchItem?.package?.name)) items.push(searchItem);
|
|
178
|
+
done();
|
|
179
|
+
}, (err) => err ? reject(err) : resolve(items), () => true);
|
|
180
|
+
} catch (err) {
|
|
181
|
+
reject(err);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Wrap a legacy callback storage plugin in the promise contract expected by
|
|
187
|
+
* `@verdaccio/store`. Token methods are exposed only when the legacy plugin
|
|
188
|
+
* implements them (store already guards their absence with SERVICE_UNAVAILABLE).
|
|
189
|
+
*/
|
|
190
|
+
function wrapLegacyStoragePlugin(plugin, logger) {
|
|
191
|
+
debug$1("wrapping legacy callback storage plugin");
|
|
192
|
+
logger.warn("a legacy callback-based storage plugin was detected and wrapped for compatibility; consider upgrading it to the promise-based storage API");
|
|
193
|
+
const wrapped = {
|
|
194
|
+
init: () => typeof plugin.init === "function" ? Promise.resolve(plugin.init()) : Promise.resolve(void 0),
|
|
195
|
+
getSecret: () => Promise.resolve(plugin.getSecret()),
|
|
196
|
+
setSecret: (secret) => Promise.resolve(plugin.setSecret(secret)),
|
|
197
|
+
get: () => fromCallback((cb) => plugin.get(cb)),
|
|
198
|
+
add: (name) => fromCallback((cb) => plugin.add(name, cb)),
|
|
199
|
+
remove: (name) => fromCallback((cb) => plugin.remove(name, cb)),
|
|
200
|
+
search: (query) => search(plugin, query),
|
|
201
|
+
getPackageStorage: (packageName) => wrapLegacyHandler(plugin.getPackageStorage(packageName))
|
|
202
|
+
};
|
|
203
|
+
for (const tokenMethod of [
|
|
204
|
+
"saveToken",
|
|
205
|
+
"deleteToken",
|
|
206
|
+
"readTokens"
|
|
207
|
+
]) if (typeof plugin[tokenMethod] === "function") wrapped[tokenMethod] = (...args) => Promise.resolve(plugin[tokenMethod](...args));
|
|
208
|
+
return Object.assign(Object.create(plugin), wrapped);
|
|
209
|
+
}
|
|
210
|
+
//#endregion
|
|
211
|
+
exports.isLegacyStoragePlugin = isLegacyStoragePlugin;
|
|
212
|
+
exports.wrapLegacyStoragePlugin = wrapLegacyStoragePlugin;
|
|
213
|
+
|
|
214
|
+
//# sourceMappingURL=legacy-storage-adapter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-storage-adapter.cjs","names":["debug","buildDebug","Writable"],"sources":["../../../src/lib/legacy-storage-adapter.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { Writable } from 'node:stream';\n\nimport { Logger } from '@verdaccio/types';\n\nconst debug = buildDebug('verdaccio:storage:legacy-adapter');\n\n/**\n * Compatibility shim that lets a LEGACY callback/stream based storage plugin\n * (the `@verdaccio/local-storage-legacy` contract used by Verdaccio < 8 and by\n * many third-party plugins) be driven by the promise-based `@verdaccio/store`.\n *\n * `@verdaccio/store` awaits every storage method:\n * await plugin.get() / add(name) / remove(name) / search(query)\n * const h = plugin.getPackageStorage(name)\n * await h.readPackage(name) / savePackage(name, v) / createPackage(...) /\n * deletePackage(file) / removePackage() / hasPackage() /\n * hasTarball(file) / writeTarball(file, {signal}) /\n * readTarball(file, {signal}) / updatePackage(name, handleUpdate)\n *\n * The legacy contract is callback/stream based instead, so we promisify it.\n * New (promise) plugins are detected and returned untouched — zero overhead on\n * the default path.\n */\n\ntype AnyFn = (...args: any[]) => any;\n\n/** Resolve an error-first callback method into a promise. */\nfunction fromCallback<T = any>(invoke: (cb: (err: any, data?: T) => void) => void): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n invoke((err, data) => (err ? reject(err) : resolve(data as T)));\n });\n}\n\n/**\n * Detect a legacy callback-based storage plugin. The new contract's `get()`\n * takes no arguments (returns a promise); the legacy `get(cb)` declares a\n * trailing callback, and `add(name, cb)` takes two. Arity is a stable signal\n * here because both contracts are frozen.\n */\nexport function isLegacyStoragePlugin(plugin: any): boolean {\n if (!plugin || typeof plugin.get !== 'function') {\n return false;\n }\n const getIsCallback = plugin.get.length >= 1;\n const addIsCallback = typeof plugin.add === 'function' && plugin.add.length >= 2;\n return getIsCallback || addIsCallback;\n}\n\n/** Synthesize the new `hasPackage()` from legacy `readPackage(name, cb)`. */\nfunction hasPackage(handler: any, pkgName: string): Promise<boolean> {\n return new Promise((resolve) => {\n handler.readPackage(pkgName, (err: any) => resolve(!err));\n });\n}\n\n/**\n * Synthesize the new `hasTarball(file)` from a legacy `readTarball` stream:\n * open => exists, 404/ENOENT error => missing. Mirrors the old\n * `Storage.hasLocalTarball` probe.\n */\nfunction hasTarball(handler: any, fileName: string): Promise<boolean> {\n return new Promise((resolve, reject) => {\n let stream: any = handler.readTarball(fileName);\n let isOpen = false;\n stream.on('error', (err: any) => {\n const notFound = err?.code === 'ENOENT' || err?.status === 404;\n if (isOpen || !notFound) {\n // a real read error after the file was already opened\n if (!isOpen) {\n resolve(false);\n } else {\n reject(err);\n }\n } else {\n resolve(false);\n }\n stream?.abort?.();\n stream = null;\n });\n stream.on('open', () => {\n isOpen = true;\n stream.abort?.();\n stream = null;\n resolve(true);\n });\n });\n}\n\n/**\n * Bridge legacy `readTarball(name) => ReadTarball` to the promise contract.\n * The legacy object is already a Readable that emits `content-length`/`open`/\n * `error`, so it can be handed back as-is; we only wire abort to the signal.\n */\nfunction readTarball(handler: any, fileName: string, options: { signal?: AbortSignal } = {}) {\n const stream = handler.readTarball(fileName);\n const { signal } = options;\n if (signal) {\n if (signal.aborted) {\n stream.abort?.();\n } else {\n signal.addEventListener('abort', () => stream.abort?.(), { once: true });\n }\n }\n return Promise.resolve(stream);\n}\n\n/**\n * Bridge legacy `writeTarball(name) => UploadTarball` to a Node Writable that\n * `@verdaccio/store` can use in `pipeline()`:\n * - the legacy stream finalizes only when `.done()` is called (ends temp file,\n * renames it into place, then emits `success`); store instead ends the\n * stream and waits for `close`.\n * - so we forward writes to the legacy stream, call `.done()` on `_final`, and\n * only complete (emit `close`) once the legacy stream emits `success`.\n */\nfunction writeTarball(handler: any, fileName: string, options: { signal?: AbortSignal } = {}) {\n const upload = handler.writeTarball(fileName);\n const { signal } = options;\n\n const bridge = new Writable({\n write(chunk, _enc, cb): void {\n if (upload.write(chunk)) {\n cb();\n } else {\n upload.once('drain', cb);\n }\n },\n final(cb): void {\n upload.once('success', () => cb());\n upload.once('error', (err: any) => cb(err));\n // `done()` waits for the legacy stream's `end`, so end it first.\n upload.end();\n upload.done();\n },\n });\n\n upload.on('open', () => bridge.emit('open'));\n upload.on('error', (err: any) => bridge.destroy(err));\n\n if (signal) {\n const onAbort = (): void => {\n upload.abort?.();\n bridge.destroy(new Error('tarball upload aborted'));\n };\n if (signal.aborted) {\n onAbort();\n } else {\n signal.addEventListener('abort', onAbort, { once: true });\n }\n }\n return Promise.resolve(bridge);\n}\n\n/**\n * Bridge legacy 5-arg `updatePackage(name, updateHandler, onWrite,\n * transformPackage, onEnd)` to the new 2-arg `updatePackage(name, handleUpdate)`\n * where `handleUpdate(manifest) => Promise<manifest>`. The store persists the\n * result itself (via `writePackage`/`savePackage`), so `onWrite` is a no-op:\n * we only read-lock, run the handler, and unlock.\n */\nfunction updatePackage(handler: any, name: string, handleUpdate: AnyFn): Promise<any> {\n return new Promise((resolve, reject) => {\n let updated: any;\n handler.updatePackage(\n name,\n // updateHandler(json, cb): run the promise handler, capture the result\n (json: any, cb: (err?: any) => void) => {\n Promise.resolve(handleUpdate(json))\n .then((result) => {\n updated = result;\n cb();\n })\n .catch(cb);\n },\n // onWrite(name, data, cb): store persists separately, so just unlock\n (_name: string, _data: any, cb: (err?: any) => void) => cb(),\n // transformPackage(json): return the updated manifest\n (json: any) => updated ?? json,\n // onEnd(err)\n (err: any) => (err ? reject(err) : resolve(updated))\n );\n });\n}\n\n/** Wrap a legacy per-package storage handler in the promise contract. */\nfunction wrapLegacyHandler(handler: any): any {\n if (!handler) {\n return handler;\n }\n return {\n readPackage: (name: string) => fromCallback((cb) => handler.readPackage(name, cb)),\n createPackage: (name: string, manifest: any) =>\n fromCallback((cb) => handler.createPackage(name, manifest, cb)),\n savePackage: (name: string, value: any) =>\n fromCallback((cb) => handler.savePackage(name, value, cb)),\n deletePackage: (fileName: string) => fromCallback((cb) => handler.deletePackage(fileName, cb)),\n removePackage: () => fromCallback((cb) => handler.removePackage(cb)),\n hasPackage: (name?: string) => hasPackage(handler, name as string),\n hasTarball: (fileName: string) => hasTarball(handler, fileName),\n readTarball: (fileName: string, options?: { signal?: AbortSignal }) =>\n readTarball(handler, fileName, options),\n writeTarball: (fileName: string, options?: { signal?: AbortSignal }) =>\n writeTarball(handler, fileName, options),\n updatePackage: (name: string, handleUpdate: AnyFn) =>\n updatePackage(handler, name, handleUpdate),\n };\n}\n\n/**\n * The legacy contract emits the package itself, while `@verdaccio/store` reads\n * `item.package.name` and `item.score`. Wrap whatever is not already in that shape,\n * otherwise a plugin following the documented contract makes `/-/v1/search` fail.\n */\nfunction toSearchItem(item: any): any {\n if (item !== null && typeof item === 'object' && 'package' in item) {\n return item;\n }\n\n return {\n package: item,\n score: { final: 1, detail: { quality: 1, popularity: 1, maintenance: 1 } },\n };\n}\n\n/**\n * Collect a legacy streaming `search(onPackage, onEnd, validate)` into a list.\n *\n * A legacy plugin has no way to receive the query, so the filtering happens here, on\n * the emitted name. The predicate stays permissive on purpose: a plugin calls it with\n * the basename (`pkg` for `@scope/pkg`), so any rejection there could drop a package\n * whose full name does match.\n */\nfunction search(plugin: any, query: any): Promise<any[]> {\n const text = typeof query?.text === 'string' ? query.text.toLowerCase() : undefined;\n const matches = (name: unknown): boolean =>\n text === undefined || (typeof name === 'string' && name.toLowerCase().includes(text));\n\n return new Promise((resolve, reject) => {\n const items: any[] = [];\n try {\n plugin.search(\n (item: any, done: () => void) => {\n const searchItem = toSearchItem(item);\n if (matches(searchItem?.package?.name)) {\n items.push(searchItem);\n }\n done();\n },\n (err: any) => (err ? reject(err) : resolve(items)),\n () => true\n );\n } catch (err) {\n reject(err);\n }\n });\n}\n\n/**\n * Wrap a legacy callback storage plugin in the promise contract expected by\n * `@verdaccio/store`. Token methods are exposed only when the legacy plugin\n * implements them (store already guards their absence with SERVICE_UNAVAILABLE).\n */\nexport function wrapLegacyStoragePlugin(plugin: any, logger: Logger): any {\n debug('wrapping legacy callback storage plugin');\n logger.warn(\n 'a legacy callback-based storage plugin was detected and wrapped for compatibility; ' +\n 'consider upgrading it to the promise-based storage API'\n );\n\n const wrapped: Record<string, AnyFn> = {\n init: () =>\n typeof plugin.init === 'function'\n ? Promise.resolve(plugin.init())\n : Promise.resolve(undefined),\n getSecret: () => Promise.resolve(plugin.getSecret()),\n setSecret: (secret: string) => Promise.resolve(plugin.setSecret(secret)),\n get: () => fromCallback((cb) => plugin.get(cb)),\n add: (name: string) => fromCallback((cb) => plugin.add(name, cb)),\n remove: (name: string) => fromCallback((cb) => plugin.remove(name, cb)),\n search: (query: any) => search(plugin, query),\n getPackageStorage: (packageName: string) =>\n wrapLegacyHandler(plugin.getPackageStorage(packageName)),\n };\n\n for (const tokenMethod of ['saveToken', 'deleteToken', 'readTokens'] as const) {\n if (typeof plugin[tokenMethod] === 'function') {\n wrapped[tokenMethod] = (...args: any[]) => Promise.resolve(plugin[tokenMethod](...args));\n }\n }\n\n // preserve any extra plugin surface (e.g. logger, config) by prototype-less merge\n return Object.assign(Object.create(plugin), wrapped);\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let debug = require("debug");
|
|
4
|
+
debug = require_runtime.__toESM(debug);
|
|
5
|
+
let _verdaccio_logger = require("@verdaccio/logger");
|
|
6
|
+
//#region src/lib/logger/index.ts
|
|
7
|
+
var logger;
|
|
8
|
+
var debug$1 = (0, debug.default)("verdaccio:logger");
|
|
9
|
+
async function setup(options) {
|
|
10
|
+
debug$1("setup logger with options %o", options);
|
|
11
|
+
if (!logger) {
|
|
12
|
+
debug$1("logger not initialized, setting up");
|
|
13
|
+
logger = await (0, _verdaccio_logger.setup)(options);
|
|
14
|
+
debug$1("logger initialized");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
Object.defineProperty(exports, "logger", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function() {
|
|
21
|
+
return logger;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
exports.setup = setup;
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["debug","createDebug","setupModule"],"sources":["../../../../src/lib/logger/index.ts"],"sourcesContent":["import createDebug from 'debug';\n\nimport { setup as setupModule } from '@verdaccio/logger';\nimport { Logger } from '@verdaccio/types';\n\nlet logger: Logger;\n\nconst debug = createDebug('verdaccio:logger');\n\ntype SetupModuleOptions = Parameters<typeof setupModule>[0];\n\nexport async function setup(options: SetupModuleOptions): Promise<void> {\n debug('setup logger with options %o', options);\n if (!logger) {\n debug('logger not initialized, setting up');\n logger = await setupModule(options);\n debug('logger initialized');\n }\n}\n\nexport { logger };\n"],"mappings":";;;;;;AAKA,IAAI;AAEJ,IAAMA,WAAAA,GAAQC,MAAAA,QAAAA,CAAY,kBAAkB;AAI5C,eAAsB,MAAM,SAA4C;CACtE,QAAM,gCAAgC,OAAO;CAC7C,IAAI,CAAC,QAAQ;EACX,QAAM,oCAAoC;EAC1C,SAAS,OAAA,GAAMC,kBAAAA,MAAAA,CAAY,OAAO;EAClC,QAAM,oBAAoB;CAC5B;AACF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_lib_config = require("./config.cjs");
|
|
4
|
+
const require_lib_logger_index = require("./logger/index.cjs");
|
|
5
|
+
const require_lib_storage = require("./storage.cjs");
|
|
6
|
+
const require_lib_utils = require("./utils.cjs");
|
|
7
|
+
let lodash_es = require("lodash-es");
|
|
8
|
+
lodash_es = require_runtime.__toESM(lodash_es);
|
|
9
|
+
let _verdaccio_node_api = require("@verdaccio/node-api");
|
|
10
|
+
let _verdaccio_server = require("@verdaccio/server");
|
|
11
|
+
//#region src/lib/run-server.ts
|
|
12
|
+
/**
|
|
13
|
+
* Build the Express app from a raw config by reusing @verdaccio/server's
|
|
14
|
+
* composition (defineAPI), but inject 7.x's Storage so legacy callback storage
|
|
15
|
+
* plugins keep working. Exposed for tests that need the app without a listener.
|
|
16
|
+
*/
|
|
17
|
+
async function endPointAPI(configHash) {
|
|
18
|
+
const appConfig = new require_lib_config.default(lodash_es.cloneDeep(configHash));
|
|
19
|
+
const storage = new require_lib_storage.Storage(appConfig, require_lib_logger_index.logger);
|
|
20
|
+
await storage.init(appConfig);
|
|
21
|
+
return (0, _verdaccio_server.defineAPI)(appConfig, storage);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Server factory passed to @verdaccio/node-api / @verdaccio/cli: maps the
|
|
25
|
+
* deprecated `logs` config key then builds the app with 7.x's legacy-aware
|
|
26
|
+
* Storage (via {@link endPointAPI}).
|
|
27
|
+
*/
|
|
28
|
+
async function startServer(config) {
|
|
29
|
+
await require_lib_utils.initLogger(config);
|
|
30
|
+
return endPointAPI(config);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Exposes a server factory to be instantiated programmatically.
|
|
34
|
+
*
|
|
35
|
+
```ts
|
|
36
|
+
const app = await runServer(); // default configuration
|
|
37
|
+
const app = await runServer('./config/config.yaml');
|
|
38
|
+
const app = await runServer({ configuration });
|
|
39
|
+
app.listen(4000, (event) => {
|
|
40
|
+
// do something
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
* @param config
|
|
44
|
+
*/
|
|
45
|
+
async function runServer(config) {
|
|
46
|
+
return (0, _verdaccio_node_api.runServer)(config, startServer);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Start the server on the port defined (or the port defined in the config file)
|
|
50
|
+
* @param config
|
|
51
|
+
* @param port
|
|
52
|
+
* @param version
|
|
53
|
+
* @param pkgName
|
|
54
|
+
*/
|
|
55
|
+
async function initServer(config, port, version, pkgName) {
|
|
56
|
+
return (0, _verdaccio_node_api.initServer)(config, port, version, pkgName, startServer);
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
exports.endPointAPI = endPointAPI;
|
|
60
|
+
exports.initServer = initServer;
|
|
61
|
+
exports.runServer = runServer;
|
|
62
|
+
exports.startServer = startServer;
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=run-server.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-server.cjs","names":["AppConfig","_","Storage","logger","defineAPI","initLogger","runServerNode","initServerNode"],"sources":["../../../src/lib/run-server.ts"],"sourcesContent":["import * as _ from 'lodash-es';\n\nimport { initServer as initServerNode, runServer as runServerNode } from '@verdaccio/node-api';\nimport { defineAPI } from '@verdaccio/server';\nimport { ConfigYaml, Config as IConfig } from '@verdaccio/types';\n\nimport AppConfig from './config';\nimport { logger } from './logger';\nimport Storage from './storage';\nimport { initLogger } from './utils';\n\n/**\n * Build the Express app from a raw config by reusing @verdaccio/server's\n * composition (defineAPI), but inject 7.x's Storage so legacy callback storage\n * plugins keep working. Exposed for tests that need the app without a listener.\n */\nexport async function endPointAPI(configHash: ConfigYaml): Promise<any> {\n const appConfig: IConfig = new AppConfig(_.cloneDeep(configHash));\n const storage = new Storage(appConfig, logger);\n await storage.init(appConfig);\n return defineAPI(appConfig, storage as any);\n}\n\n/**\n * Server factory passed to @verdaccio/node-api / @verdaccio/cli: maps the\n * deprecated `logs` config key then builds the app with 7.x's legacy-aware\n * Storage (via {@link endPointAPI}).\n */\nexport async function startServer(config: ConfigYaml): Promise<any> {\n await initLogger(config);\n return endPointAPI(config);\n}\n\n/**\n * Exposes a server factory to be instantiated programmatically.\n *\n ```ts\n const app = await runServer(); // default configuration\n const app = await runServer('./config/config.yaml');\n const app = await runServer({ configuration });\n app.listen(4000, (event) => {\n // do something\n });\n ```\n * @param config\n */\nexport async function runServer(config?: string | ConfigYaml): Promise<any> {\n return runServerNode(config, startServer);\n}\n\n/**\n * Start the server on the port defined (or the port defined in the config file)\n * @param config\n * @param port\n * @param version\n * @param pkgName\n */\nexport async function initServer(\n config: ConfigYaml,\n port: string | void,\n version: string,\n pkgName: string\n): Promise<void> {\n return initServerNode(config, port, version, pkgName, startServer);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,eAAsB,YAAY,YAAsC;CACtE,MAAM,YAAqB,IAAIA,mBAAAA,QAAUC,UAAE,UAAU,UAAU,CAAC;CAChE,MAAM,UAAU,IAAIC,oBAAAA,QAAQ,WAAWC,yBAAAA,MAAM;CAC7C,MAAM,QAAQ,KAAK,SAAS;CAC5B,QAAA,GAAOC,kBAAAA,UAAAA,CAAU,WAAW,OAAc;AAC5C;;;;;;AAOA,eAAsB,YAAY,QAAkC;CAClE,MAAMC,kBAAAA,WAAW,MAAM;CACvB,OAAO,YAAY,MAAM;AAC3B;;;;;;;;;;;;;;AAeA,eAAsB,UAAU,QAA4C;CAC1E,QAAA,GAAOC,oBAAAA,UAAAA,CAAc,QAAQ,WAAW;AAC1C;;;;;;;;AASA,eAAsB,WACpB,QACA,MACA,SACA,SACe;CACf,QAAA,GAAOC,oBAAAA,WAAAA,CAAe,QAAQ,MAAM,SAAS,SAAS,WAAW;AACnE"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
6
|
+
const require_lib_legacy_storage_adapter = require("./legacy-storage-adapter.cjs");
|
|
7
|
+
let lodash_es = require("lodash-es");
|
|
8
|
+
let _verdaccio_core = require("@verdaccio/core");
|
|
9
|
+
let debug = require("debug");
|
|
10
|
+
debug = require_runtime.__toESM(debug);
|
|
11
|
+
let node_assert = require("node:assert");
|
|
12
|
+
node_assert = require_runtime.__toESM(node_assert);
|
|
13
|
+
let _verdaccio_loaders = require("@verdaccio/loaders");
|
|
14
|
+
let _verdaccio_local_storage = require("@verdaccio/local-storage");
|
|
15
|
+
_verdaccio_local_storage = require_runtime.__toESM(_verdaccio_local_storage);
|
|
16
|
+
let _verdaccio_store = require("@verdaccio/store");
|
|
17
|
+
//#region src/lib/storage.ts
|
|
18
|
+
var debug$1 = (0, debug.default)("verdaccio:storage");
|
|
19
|
+
var LocalDatabase = _verdaccio_local_storage.default.default || _verdaccio_local_storage.default;
|
|
20
|
+
var storageSanityCheck = (plugin) => typeof plugin?.getPackageStorage !== "undefined";
|
|
21
|
+
/**
|
|
22
|
+
* Drop-in replacement for `@verdaccio/store`'s internal `LocalStorage` that
|
|
23
|
+
* loads the configured storage plugin exactly like upstream, but wraps a
|
|
24
|
+
* legacy callback-based plugin in a promisifying adapter so it satisfies the
|
|
25
|
+
* promise contract the rest of `@verdaccio/store` relies on.
|
|
26
|
+
*
|
|
27
|
+
* `@verdaccio/store` only ever calls `init()`, `getSecret()` and
|
|
28
|
+
* `getStoragePlugin()` on this object, so that is the entire surface we mirror.
|
|
29
|
+
*/
|
|
30
|
+
var CompatLocalStorage = class {
|
|
31
|
+
storagePlugin = null;
|
|
32
|
+
config;
|
|
33
|
+
logger;
|
|
34
|
+
constructor(config, logger) {
|
|
35
|
+
this.config = config;
|
|
36
|
+
this.logger = logger.child({ sub: "fs" });
|
|
37
|
+
}
|
|
38
|
+
async init() {
|
|
39
|
+
if (this.storagePlugin === null) {
|
|
40
|
+
const loaded = await this.loadStorage();
|
|
41
|
+
this.storagePlugin = require_lib_legacy_storage_adapter.isLegacyStoragePlugin(loaded) ? require_lib_legacy_storage_adapter.wrapLegacyStoragePlugin(loaded, this.logger) : loaded;
|
|
42
|
+
debug$1("storage plugin init");
|
|
43
|
+
await this.storagePlugin.init();
|
|
44
|
+
debug$1("storage plugin initialized");
|
|
45
|
+
} else this.logger.warn("storage plugin has been already initialized");
|
|
46
|
+
}
|
|
47
|
+
getStoragePlugin() {
|
|
48
|
+
if (this.storagePlugin === null) throw _verdaccio_core.errorUtils.getInternalError("storage plugin is not initialized");
|
|
49
|
+
return this.storagePlugin;
|
|
50
|
+
}
|
|
51
|
+
async getSecret(config) {
|
|
52
|
+
const secretKey = await this.storagePlugin.getSecret();
|
|
53
|
+
return this.storagePlugin.setSecret(config.checkSecretKey(secretKey));
|
|
54
|
+
}
|
|
55
|
+
async loadStorage() {
|
|
56
|
+
const Storage = await this.loadStorePlugin();
|
|
57
|
+
if ((0, lodash_es.isNil)(Storage)) {
|
|
58
|
+
(0, node_assert.default)(this.config.storage, "CONFIG: storage path not defined");
|
|
59
|
+
debug$1("no custom storage found, loading default storage @verdaccio/local-storage");
|
|
60
|
+
const localStorage = new LocalDatabase(this.config, this.logger);
|
|
61
|
+
this.logger.info({
|
|
62
|
+
name: "@verdaccio/local-storage",
|
|
63
|
+
pluginCategory: _verdaccio_core.PLUGIN_CATEGORY.STORAGE
|
|
64
|
+
}, "plugin @{name} successfully loaded (@{pluginCategory})");
|
|
65
|
+
return localStorage;
|
|
66
|
+
}
|
|
67
|
+
return Storage;
|
|
68
|
+
}
|
|
69
|
+
async loadStorePlugin() {
|
|
70
|
+
const plugins = await (0, _verdaccio_loaders.asyncLoadPlugin)(this.config.store, {
|
|
71
|
+
config: this.config,
|
|
72
|
+
logger: this.logger
|
|
73
|
+
}, storageSanityCheck, true, this.config.server?.pluginPrefix ?? _verdaccio_core.PLUGIN_PREFIX, _verdaccio_core.PLUGIN_CATEGORY.STORAGE);
|
|
74
|
+
if (plugins.length > 1) this.logger.warn("more than one storage plugins has been detected, multiple storage are not supported, one will be selected automatically");
|
|
75
|
+
return (0, lodash_es.head)(plugins);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* `@verdaccio/store` Storage, with one change: it loads the storage plugin
|
|
80
|
+
* through {@link CompatLocalStorage} so legacy callback plugins keep working.
|
|
81
|
+
*
|
|
82
|
+
* The base `init()` only creates its internal `LocalStorage` when
|
|
83
|
+
* `this.localStorage` is still null; by pre-populating it we reuse the entire
|
|
84
|
+
* rest of the upstream Storage implementation (including filter loading via
|
|
85
|
+
* `super.init`) unchanged.
|
|
86
|
+
*/
|
|
87
|
+
var Storage = class extends _verdaccio_store.Storage {
|
|
88
|
+
async init(config) {
|
|
89
|
+
if (this.localStorage === null) {
|
|
90
|
+
const localStorage = new CompatLocalStorage(this.config, this.logger);
|
|
91
|
+
await localStorage.init();
|
|
92
|
+
await localStorage.getSecret(config);
|
|
93
|
+
this.localStorage = localStorage;
|
|
94
|
+
debug$1("compat local storage initialized");
|
|
95
|
+
}
|
|
96
|
+
await super.init(config);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
100
|
+
exports.Storage = Storage;
|
|
101
|
+
exports.default = Storage;
|
|
102
|
+
|
|
103
|
+
//# sourceMappingURL=storage.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.cjs","names":["debug","buildDebug","LocalDatabaseModule","isLegacyStoragePlugin","wrapLegacyStoragePlugin","errorUtils","isNil","PLUGIN_CATEGORY","asyncLoadPlugin","PLUGIN_PREFIX","head","BaseStorage"],"sources":["../../../src/lib/storage.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { head, isNil } from 'lodash-es';\nimport assert from 'node:assert';\n\nimport { PLUGIN_CATEGORY, PLUGIN_PREFIX, errorUtils } from '@verdaccio/core';\nimport { asyncLoadPlugin } from '@verdaccio/loaders';\nimport LocalDatabaseModule from '@verdaccio/local-storage';\nimport { Storage as BaseStorage } from '@verdaccio/store';\nimport { Config, Logger } from '@verdaccio/types';\n\nimport { isLegacyStoragePlugin, wrapLegacyStoragePlugin } from './legacy-storage-adapter';\n\nconst debug = buildDebug('verdaccio:storage');\n\n// CJS/ESM interop for the default storage plugin\nconst LocalDatabase = (LocalDatabaseModule as any).default || LocalDatabaseModule;\n\n// `storageSanityCheck` only verifies `getPackageStorage` exists, which both the\n// legacy and promise contracts satisfy.\nconst storageSanityCheck = (plugin: any): boolean =>\n typeof plugin?.getPackageStorage !== 'undefined';\n\n/**\n * Drop-in replacement for `@verdaccio/store`'s internal `LocalStorage` that\n * loads the configured storage plugin exactly like upstream, but wraps a\n * legacy callback-based plugin in a promisifying adapter so it satisfies the\n * promise contract the rest of `@verdaccio/store` relies on.\n *\n * `@verdaccio/store` only ever calls `init()`, `getSecret()` and\n * `getStoragePlugin()` on this object, so that is the entire surface we mirror.\n */\nclass CompatLocalStorage {\n public storagePlugin: any = null;\n private readonly config: Config;\n private readonly logger: Logger;\n\n public constructor(config: Config, logger: Logger) {\n this.config = config;\n this.logger = logger.child({ sub: 'fs' });\n }\n\n public async init(): Promise<void> {\n if (this.storagePlugin === null) {\n const loaded = await this.loadStorage();\n this.storagePlugin = isLegacyStoragePlugin(loaded)\n ? wrapLegacyStoragePlugin(loaded, this.logger)\n : loaded;\n debug('storage plugin init');\n await this.storagePlugin.init();\n debug('storage plugin initialized');\n } else {\n this.logger.warn('storage plugin has been already initialized');\n }\n }\n\n public getStoragePlugin(): any {\n if (this.storagePlugin === null) {\n throw errorUtils.getInternalError('storage plugin is not initialized');\n }\n return this.storagePlugin;\n }\n\n public async getSecret(config: Config): Promise<void> {\n const secretKey = await this.storagePlugin.getSecret();\n return this.storagePlugin.setSecret(config.checkSecretKey(secretKey));\n }\n\n private async loadStorage(): Promise<any> {\n const Storage = await this.loadStorePlugin();\n if (isNil(Storage)) {\n assert(this.config.storage, 'CONFIG: storage path not defined');\n debug('no custom storage found, loading default storage @verdaccio/local-storage');\n const localStorage = new LocalDatabase(this.config, this.logger);\n this.logger.info(\n { name: '@verdaccio/local-storage', pluginCategory: PLUGIN_CATEGORY.STORAGE },\n 'plugin @{name} successfully loaded (@{pluginCategory})'\n );\n return localStorage;\n }\n return Storage;\n }\n\n private async loadStorePlugin(): Promise<any> {\n const plugins = await asyncLoadPlugin(\n this.config.store,\n { config: this.config, logger: this.logger },\n storageSanityCheck,\n // legacyMergeConfigs: pass the full config as the plugin's first constructor\n // arg, which legacy `(config, logger)` storage plugins require (matches the\n // pre-migration 7.x behaviour; @verdaccio/store uses false and so cannot\n // drive legacy plugins).\n true,\n this.config.server?.pluginPrefix ?? PLUGIN_PREFIX,\n PLUGIN_CATEGORY.STORAGE\n );\n if (plugins.length > 1) {\n this.logger.warn(\n 'more than one storage plugins has been detected, multiple storage are not supported, one will be selected automatically'\n );\n }\n return head(plugins);\n }\n}\n\n/**\n * `@verdaccio/store` Storage, with one change: it loads the storage plugin\n * through {@link CompatLocalStorage} so legacy callback plugins keep working.\n *\n * The base `init()` only creates its internal `LocalStorage` when\n * `this.localStorage` is still null; by pre-populating it we reuse the entire\n * rest of the upstream Storage implementation (including filter loading via\n * `super.init`) unchanged.\n */\nclass Storage extends BaseStorage {\n public async init(config: Config): Promise<void> {\n if (this.localStorage === null) {\n const localStorage = new CompatLocalStorage(this.config, this.logger);\n await localStorage.init();\n await localStorage.getSecret(config);\n // structurally compatible with the (non-exported) upstream LocalStorage\n this.localStorage = localStorage as any;\n debug('compat local storage initialized');\n }\n // localStorage is now non-null, so super.init only loads filter plugins\n await super.init(config);\n }\n}\n\nexport default Storage;\nexport { Storage };\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,IAAMA,WAAAA,GAAQC,MAAAA,QAAAA,CAAW,mBAAmB;AAG5C,IAAM,gBAAiBC,yBAAAA,QAA4B,WAAWA,yBAAAA;AAI9D,IAAM,sBAAsB,WAC1B,OAAO,QAAQ,sBAAsB;;;;;;;;;;AAWvC,IAAM,qBAAN,MAAyB;CACvB,gBAA4B;CAC5B;CACA;CAEA,YAAmB,QAAgB,QAAgB;EACjD,KAAK,SAAS;EACd,KAAK,SAAS,OAAO,MAAM,EAAE,KAAK,KAAK,CAAC;CAC1C;CAEA,MAAa,OAAsB;EACjC,IAAI,KAAK,kBAAkB,MAAM;GAC/B,MAAM,SAAS,MAAM,KAAK,YAAY;GACtC,KAAK,gBAAgBC,mCAAAA,sBAAsB,MAAM,IAC7CC,mCAAAA,wBAAwB,QAAQ,KAAK,MAAM,IAC3C;GACJ,QAAM,qBAAqB;GAC3B,MAAM,KAAK,cAAc,KAAK;GAC9B,QAAM,4BAA4B;EACpC,OACE,KAAK,OAAO,KAAK,6CAA6C;CAElE;CAEA,mBAA+B;EAC7B,IAAI,KAAK,kBAAkB,MACzB,MAAMC,gBAAAA,WAAW,iBAAiB,mCAAmC;EAEvE,OAAO,KAAK;CACd;CAEA,MAAa,UAAU,QAA+B;EACpD,MAAM,YAAY,MAAM,KAAK,cAAc,UAAU;EACrD,OAAO,KAAK,cAAc,UAAU,OAAO,eAAe,SAAS,CAAC;CACtE;CAEA,MAAc,cAA4B;EACxC,MAAM,UAAU,MAAM,KAAK,gBAAgB;EAC3C,KAAA,GAAIC,UAAAA,MAAAA,CAAM,OAAO,GAAG;GAClB,CAAA,GAAA,YAAA,QAAA,CAAO,KAAK,OAAO,SAAS,kCAAkC;GAC9D,QAAM,2EAA2E;GACjF,MAAM,eAAe,IAAI,cAAc,KAAK,QAAQ,KAAK,MAAM;GAC/D,KAAK,OAAO,KACV;IAAE,MAAM;IAA4B,gBAAgBC,gBAAAA,gBAAgB;GAAQ,GAC5E,wDACF;GACA,OAAO;EACT;EACA,OAAO;CACT;CAEA,MAAc,kBAAgC;EAC5C,MAAM,UAAU,OAAA,GAAMC,mBAAAA,gBAAAA,CACpB,KAAK,OAAO,OACZ;GAAE,QAAQ,KAAK;GAAQ,QAAQ,KAAK;EAAO,GAC3C,oBAKA,MACA,KAAK,OAAO,QAAQ,gBAAgBC,gBAAAA,eACpCF,gBAAAA,gBAAgB,OAClB;EACA,IAAI,QAAQ,SAAS,GACnB,KAAK,OAAO,KACV,yHACF;EAEF,QAAA,GAAOG,UAAAA,KAAAA,CAAK,OAAO;CACrB;AACF;;;;;;;;;;AAWA,IAAM,UAAN,cAAsBC,iBAAAA,QAAY;CAChC,MAAa,KAAK,QAA+B;EAC/C,IAAI,KAAK,iBAAiB,MAAM;GAC9B,MAAM,eAAe,IAAI,mBAAmB,KAAK,QAAQ,KAAK,MAAM;GACpE,MAAM,aAAa,KAAK;GACxB,MAAM,aAAa,UAAU,MAAM;GAEnC,KAAK,eAAe;GACpB,QAAM,kCAAkC;EAC1C;EAEA,MAAM,MAAM,KAAK,MAAM;CACzB;AACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
let _verdaccio_proxy = require("@verdaccio/proxy");
|
|
6
|
+
Object.defineProperty(exports, "ProxyStorage", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function() {
|
|
9
|
+
return _verdaccio_proxy.ProxyStorage;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "default", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function() {
|
|
15
|
+
return _verdaccio_proxy.ProxyStorage;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "setupUpLinks", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function() {
|
|
21
|
+
return _verdaccio_proxy.setupUpLinks;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "updateVersionsHiddenUpLinkNext", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function() {
|
|
27
|
+
return _verdaccio_proxy.updateVersionsHiddenUpLinkNext;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_lib_logger_index = require("./logger/index.cjs");
|
|
4
|
+
let _verdaccio_core = require("@verdaccio/core");
|
|
5
|
+
let debug = require("debug");
|
|
6
|
+
debug = require_runtime.__toESM(debug);
|
|
7
|
+
//#region src/lib/utils.ts
|
|
8
|
+
var debug$1 = (0, debug.default)("verdaccio:lib:utils");
|
|
9
|
+
async function initLogger(logConfig) {
|
|
10
|
+
if (logConfig.logs) {
|
|
11
|
+
logConfig.log = logConfig.logs;
|
|
12
|
+
_verdaccio_core.warningUtils.emit(_verdaccio_core.warningUtils.Codes.VERWAR002);
|
|
13
|
+
}
|
|
14
|
+
debug$1("initializing logger with config: %o", logConfig.log);
|
|
15
|
+
await require_lib_logger_index.setup(logConfig.log);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.initLogger = initLogger;
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":["debug","createDebug","warningUtils","setup"],"sources":["../../../src/lib/utils.ts"],"sourcesContent":["import createDebug from 'debug';\n\nimport { warningUtils } from '@verdaccio/core';\nimport { ConfigYaml, LoggerConfigItem } from '@verdaccio/types';\n\nimport { setup } from './logger';\n\nconst debug = createDebug('verdaccio:lib:utils');\n\nexport async function initLogger(logConfig: ConfigYaml) {\n if (logConfig.logs) {\n logConfig.log = logConfig.logs;\n warningUtils.emit(warningUtils.Codes.VERWAR002);\n }\n debug('initializing logger with config: %o', logConfig.log);\n await setup(logConfig.log as LoggerConfigItem);\n}\n"],"mappings":";;;;;;;AAOA,IAAMA,WAAAA,GAAQC,MAAAA,QAAAA,CAAY,qBAAqB;AAE/C,eAAsB,WAAW,WAAuB;CACtD,IAAI,UAAU,MAAM;EAClB,UAAU,MAAM,UAAU;EAC1B,gBAAA,aAAa,KAAKC,gBAAAA,aAAa,MAAM,SAAS;CAChD;CACA,QAAM,uCAAuC,UAAU,GAAG;CAC1D,MAAMC,yBAAAA,MAAM,UAAU,GAAuB;AAC/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as _ from "lodash-es";
|
|
2
|
+
import { defaultSecurity } from "@verdaccio/config";
|
|
3
|
+
//#region src/lib/auth-utils.ts
|
|
4
|
+
function getSecurity(config) {
|
|
5
|
+
if (_.isNil(config.security) === false) return _.merge(defaultSecurity, config.security);
|
|
6
|
+
return defaultSecurity;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { getSecurity };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=auth-utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-utils.mjs","names":[],"sources":["../../../src/lib/auth-utils.ts"],"sourcesContent":["import * as _ from 'lodash-es';\n\nimport { defaultSecurity } from '@verdaccio/config';\nimport { Config, Security } from '@verdaccio/types';\n\nexport function getSecurity(config: Config): Security {\n if (_.isNil(config.security) === false) {\n return _.merge(defaultSecurity, config.security);\n }\n\n return defaultSecurity;\n}\n"],"mappings":";;;AAKA,SAAgB,YAAY,QAA0B;CACpD,IAAI,EAAE,MAAM,OAAO,QAAQ,MAAM,OAC/B,OAAO,EAAE,MAAM,iBAAiB,OAAO,QAAQ;CAGjD,OAAO;AACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.mjs","names":[],"sources":["../../../src/lib/auth.ts"],"sourcesContent":["import { Auth } from '@verdaccio/auth';\n\nexport default Auth;\n"],"mappings":";;AAEA,IAAA,eAAe"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { startServer } from "./run-server.mjs";
|
|
3
|
+
import { runCli } from "@verdaccio/cli";
|
|
4
|
+
//#region src/lib/cli.ts
|
|
5
|
+
var pkgVersion = "7.0.0";
|
|
6
|
+
if (pkgVersion.includes("canary")) console.warn("\n⚠️ WARNING: You are running a CANARY build of Verdaccio (v7.0.0).\n This is an unstable pre-release version meant for testing only.\n Do not use in production. For stable releases: npm install -g verdaccio\n");
|
|
7
|
+
runCli({
|
|
8
|
+
startServer,
|
|
9
|
+
version: pkgVersion,
|
|
10
|
+
pkgName: "verdaccio"
|
|
11
|
+
});
|
|
12
|
+
//#endregion
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=cli.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":[],"sources":["../../../src/lib/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { runCli } from '@verdaccio/cli';\n\nimport { startServer } from './run-server';\n\nconst pkgVersion = process.env.PACKAGE_VERSION || 'dev';\n\nif (pkgVersion.includes('canary')) {\n console.warn(\n '\\n' +\n '⚠️ WARNING: You are running a CANARY build of Verdaccio (v' +\n pkgVersion +\n ').\\n' +\n ' This is an unstable pre-release version meant for testing only.\\n' +\n ' Do not use in production. For stable releases: npm install -g verdaccio\\n'\n );\n}\n\n// Reuse @verdaccio/cli's command set, but inject 7.x's server factory so the\n// registry boots with the legacy-callback-capable Storage.\nrunCli({ startServer, version: pkgVersion, pkgName: 'verdaccio' });\n"],"mappings":";;;;AAKA,IAAM,aAAA;AAEN,IAAI,WAAW,SAAS,QAAQ,GAC9B,QAAQ,KACN,wNAMF;AAKF,OAAO;CAAE;CAAa,SAAS;CAAY,SAAS;AAAY,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Config as Config$1 } from "@verdaccio/config";
|
|
2
|
+
import { authUtils } from "@verdaccio/core";
|
|
3
|
+
//#region src/lib/config.ts
|
|
4
|
+
var Config = class extends Config$1 {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
config.configPath = config.self_path;
|
|
7
|
+
super(config);
|
|
8
|
+
this.getMatchedPackagesSpec = (pkgName) => {
|
|
9
|
+
return authUtils.getMatchedPackagesSpec(pkgName, this.packages);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Config as default };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=config.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.mjs","names":["ConfigCore"],"sources":["../../../src/lib/config.ts"],"sourcesContent":["import { Config as ConfigCore } from '@verdaccio/config';\nimport { authUtils } from '@verdaccio/core';\n\nclass Config extends ConfigCore {\n public constructor(config: any) {\n config.configPath = config.self_path;\n super(config);\n // Temporary solution for plugins that depends on legacy configuration files\n this.getMatchedPackagesSpec = (pkgName) => {\n return authUtils.getMatchedPackagesSpec(pkgName, this.packages);\n };\n }\n}\n\nexport default Config;\n"],"mappings":";;;AAGA,IAAM,SAAN,cAAqBA,SAAW;CAC9B,YAAmB,QAAa;EAC9B,OAAO,aAAa,OAAO;EAC3B,MAAM,MAAM;EAEZ,KAAK,0BAA0B,YAAY;GACzC,OAAO,UAAU,uBAAuB,SAAS,KAAK,QAAQ;EAChE;CACF;AACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { API_ERROR, API_MESSAGE, DIST_TAGS, HEADERS, HEADER_TYPE, HTTP_STATUS, LATEST, SUPPORT_ERRORS, TOKEN_BASIC, TOKEN_BEARER, constants } from "@verdaccio/core";
|
|
2
|
+
//#region src/lib/constants.ts
|
|
3
|
+
var ROLES = constants.ROLES;
|
|
4
|
+
var ERROR_CODE = { token_required: "token is required" };
|
|
5
|
+
var DEFAULT_REGISTRY = "https://registry.npmjs.org";
|
|
6
|
+
var DEFAULT_UPLINK = "npmjs";
|
|
7
|
+
var WEB_TITLE = "Verdaccio";
|
|
8
|
+
//#endregion
|
|
9
|
+
export { API_ERROR, API_MESSAGE, DEFAULT_REGISTRY, DEFAULT_UPLINK, DIST_TAGS, ERROR_CODE, HEADERS, HEADER_TYPE, HTTP_STATUS, LATEST, ROLES, SUPPORT_ERRORS, TOKEN_BASIC, TOKEN_BEARER, WEB_TITLE };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":["coreConstants"],"sources":["../../../src/lib/constants.ts"],"sourcesContent":["import { constants as coreConstants } from '@verdaccio/core';\n\nexport {\n API_ERROR,\n API_MESSAGE,\n HTTP_STATUS,\n HEADERS,\n HEADER_TYPE,\n TOKEN_BASIC,\n TOKEN_BEARER,\n SUPPORT_ERRORS,\n DIST_TAGS,\n LATEST,\n} from '@verdaccio/core';\n\nexport const ROLES = coreConstants.ROLES;\n\n// verdaccio-specific values not provided by @verdaccio/core\nexport const ERROR_CODE = {\n token_required: 'token is required',\n};\nexport const DEFAULT_REGISTRY = 'https://registry.npmjs.org';\nexport const DEFAULT_UPLINK = 'npmjs';\nexport const WEB_TITLE = 'Verdaccio';\n"],"mappings":";;AAeA,IAAa,QAAQA,UAAc;AAGnC,IAAa,aAAa,EACxB,gBAAgB,oBAClB;AACA,IAAa,mBAAmB;AAChC,IAAa,iBAAiB;AAC9B,IAAa,YAAY"}
|