@verdaccio/config 9.0.0-next-9.3 → 9.0.0-next-9.4

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 (71) hide show
  1. package/build/_virtual/_rolldown/runtime.js +23 -0
  2. package/build/_virtual/_rolldown/runtime.mjs +7 -0
  3. package/build/address.d.ts +1 -1
  4. package/build/address.js +80 -102
  5. package/build/address.js.map +1 -1
  6. package/build/address.mjs +86 -0
  7. package/build/address.mjs.map +1 -0
  8. package/build/agent.js +11 -16
  9. package/build/agent.js.map +1 -1
  10. package/build/agent.mjs +12 -0
  11. package/build/agent.mjs.map +1 -0
  12. package/build/builder.d.ts +1 -1
  13. package/build/builder.js +58 -62
  14. package/build/builder.js.map +1 -1
  15. package/build/builder.mjs +60 -0
  16. package/build/builder.mjs.map +1 -0
  17. package/build/conf/index.d.ts +1 -1
  18. package/build/conf/index.js +9 -11
  19. package/build/conf/index.js.map +1 -1
  20. package/build/conf/index.mjs +10 -0
  21. package/build/conf/index.mjs.map +1 -0
  22. package/build/config-path.js +152 -163
  23. package/build/config-path.js.map +1 -1
  24. package/build/config-path.mjs +169 -0
  25. package/build/config-path.mjs.map +1 -0
  26. package/build/config-utils.js +37 -41
  27. package/build/config-utils.js.map +1 -1
  28. package/build/config-utils.mjs +40 -0
  29. package/build/config-utils.mjs.map +1 -0
  30. package/build/config.d.ts +1 -1
  31. package/build/config.js +170 -201
  32. package/build/config.js.map +1 -1
  33. package/build/config.mjs +171 -0
  34. package/build/config.mjs.map +1 -0
  35. package/build/index.js +52 -167
  36. package/build/index.mjs +14 -0
  37. package/build/package-access.d.ts +1 -1
  38. package/build/package-access.js +52 -68
  39. package/build/package-access.js.map +1 -1
  40. package/build/package-access.mjs +52 -0
  41. package/build/package-access.mjs.map +1 -0
  42. package/build/parse.d.ts +1 -1
  43. package/build/parse.js +80 -99
  44. package/build/parse.js.map +1 -1
  45. package/build/parse.mjs +83 -0
  46. package/build/parse.mjs.map +1 -0
  47. package/build/security.d.ts +1 -1
  48. package/build/security.js +15 -22
  49. package/build/security.js.map +1 -1
  50. package/build/security.mjs +16 -0
  51. package/build/security.mjs.map +1 -0
  52. package/build/serverSettings.js +10 -15
  53. package/build/serverSettings.js.map +1 -1
  54. package/build/serverSettings.mjs +12 -0
  55. package/build/serverSettings.mjs.map +1 -0
  56. package/build/token.js +11 -13
  57. package/build/token.js.map +1 -1
  58. package/build/token.mjs +13 -0
  59. package/build/token.mjs.map +1 -0
  60. package/build/uplinks.d.ts +1 -1
  61. package/build/uplinks.js +47 -55
  62. package/build/uplinks.js.map +1 -1
  63. package/build/uplinks.mjs +50 -0
  64. package/build/uplinks.mjs.map +1 -0
  65. package/build/user.d.ts +1 -1
  66. package/build/user.js +42 -37
  67. package/build/user.js.map +1 -1
  68. package/build/user.mjs +48 -0
  69. package/build/user.mjs.map +1 -0
  70. package/package.json +18 -7
  71. package/build/index.js.map +0 -1
@@ -0,0 +1,23 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
23
+ exports.__toESM = __toESM;
@@ -0,0 +1,7 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
3
+ if (typeof require !== "undefined") return require.apply(this, arguments);
4
+ throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
5
+ });
6
+ //#endregion
7
+ export { __require };
@@ -1,4 +1,4 @@
1
- import type { ListenAddress as ConfigListenAddress, Logger } from '@verdaccio/types';
1
+ import { ListenAddress as ConfigListenAddress, Logger } from '@verdaccio/types';
2
2
  export interface ListenAddress {
3
3
  proto: string;
4
4
  host?: string;
package/build/address.js CHANGED
@@ -1,111 +1,89 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getListenAddress = getListenAddress;
7
- exports.parseAddress = parseAddress;
8
- var _debug = _interopRequireDefault(require("debug"));
9
- var _core = require("@verdaccio/core");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- const debug = (0, _debug.default)('verdaccio:config:address');
1
+ const require_runtime = require("./_virtual/_rolldown/runtime.js");
2
+ let debug = require("debug");
3
+ debug = require_runtime.__toESM(debug);
4
+ let _verdaccio_core = require("@verdaccio/core");
5
+ //#region src/address.ts
6
+ var debug$1 = (0, debug.default)("verdaccio:config:address");
12
7
  /**
13
- * Parse an internet address
14
- * Allow:
15
- - https:localhost:1234 - protocol + host + port
16
- - localhost:1234 - host + port
17
- - 1234 - port
18
- - http::1234 - protocol + port
19
- - https://localhost:443/ - full url + https
20
- - http://[::1]:443/ - ipv6
21
- - unix:/tmp/http.sock - unix sockets
22
- - https://unix:/tmp/http.sock - unix sockets (https)
23
- * @param {*} urlAddress the internet address definition
24
- * @return {Object|Null} literal object that represent the address parsed
25
- */
8
+ * Parse an internet address
9
+ * Allow:
10
+ - https:localhost:1234 - protocol + host + port
11
+ - localhost:1234 - host + port
12
+ - 1234 - port
13
+ - http::1234 - protocol + port
14
+ - https://localhost:443/ - full url + https
15
+ - http://[::1]:443/ - ipv6
16
+ - unix:/tmp/http.sock - unix sockets
17
+ - https://unix:/tmp/http.sock - unix sockets (https)
18
+ * @param {*} urlAddress the internet address definition
19
+ * @return {Object|Null} literal object that represent the address parsed
20
+ */
26
21
  function parseAddress(urlAddress) {
27
- //
28
- // TODO: refactor it to something more reasonable?
29
- //
30
- // protocol : // ( host )|( ipv6 ): port /
31
- const urlPattern = /^((https?):(\/\/)?)?((([^\/:]*)|\[([^\[\]]+)\]):)?(\d+)\/?$/.exec(urlAddress);
32
- if (urlPattern) {
33
- return {
34
- proto: urlPattern[2] || _core.DEFAULT_PROTOCOL,
35
- host: urlPattern[6] || urlPattern[7] || _core.DEFAULT_DOMAIN,
36
- port: urlPattern[8] || _core.DEFAULT_PORT
37
- };
38
- }
39
- const unixPattern = /^(?:(https?):\/\/)?unix:(\/.*)$/.exec(urlAddress);
40
- if (!unixPattern) {
41
- // if we cannot match the unix pattern, we return null
42
- // this is to avoid returning a wrong object
43
- return null;
44
- }
45
- return {
46
- host: unixPattern[2],
47
- proto: unixPattern[1] || 'unix',
48
- path: unixPattern[2]
49
- };
22
+ const urlPattern = /^((https?):(\/\/)?)?((([^\/:]*)|\[([^\[\]]+)\]):)?(\d+)\/?$/.exec(urlAddress);
23
+ if (urlPattern) return {
24
+ proto: urlPattern[2] || _verdaccio_core.DEFAULT_PROTOCOL,
25
+ host: urlPattern[6] || urlPattern[7] || _verdaccio_core.DEFAULT_DOMAIN,
26
+ port: urlPattern[8] || _verdaccio_core.DEFAULT_PORT
27
+ };
28
+ const unixPattern = /^(?:(https?):\/\/)?unix:(\/.*)$/.exec(urlAddress);
29
+ if (!unixPattern) return null;
30
+ return {
31
+ host: unixPattern[2],
32
+ proto: unixPattern[1] || "unix",
33
+ path: unixPattern[2]
34
+ };
50
35
  }
51
36
  function addrToString(a) {
52
- return a.proto === 'unix' ? `unix:${a.host}` : `${a.proto}://${a.host}:${a.port}`;
37
+ return a.proto === "unix" ? `unix:${a.host}` : `${a.proto}://${a.host}:${a.port}`;
53
38
  }
54
-
55
39
  /**
56
- * Retrieve all addresses defined in the config file.
57
- * Verdaccio is able to listen multiple ports
58
- * @param {String} argListen
59
- * @param {String} configListen
60
- * eg:
61
- * listen:
62
- - localhost:5555
63
- - localhost:5557
64
- @return {Array}
65
- */
40
+ * Retrieve all addresses defined in the config file.
41
+ * Verdaccio is able to listen multiple ports
42
+ * @param {String} argListen
43
+ * @param {String} configListen
44
+ * eg:
45
+ * listen:
46
+ - localhost:5555
47
+ - localhost:5557
48
+ @return {Array}
49
+ */
66
50
  function getListenAddress(listen, logger) {
67
- debug('getListenAddress called with %o', listen);
68
- if (!listen) {
69
- debug('No listen address provided, using default');
70
- return {
71
- proto: _core.DEFAULT_PROTOCOL,
72
- host: _core.DEFAULT_DOMAIN,
73
- port: _core.DEFAULT_PORT
74
- };
75
- }
76
- if (Array.isArray(listen)) {
77
- const filteredListen = listen.filter(item => typeof item === 'string');
78
- if (filteredListen.length === 0) {
79
- throw new Error('Listen addresses array cannot be empty');
80
- }
81
- const invalid = [];
82
- const valid = [];
83
- for (const raw of filteredListen) {
84
- const candidate = parseAddress(raw);
85
- if (candidate) {
86
- debug('valid listen address found: %o', candidate);
87
- valid.push(candidate);
88
- } else {
89
- debug('invalid address found: %o', raw);
90
- invalid.push(raw);
91
- }
92
- }
93
- invalid.forEach(bad => logger.warn({
94
- addr: bad
95
- }, 'invalid address - @{addr}, we expect a port (e.g. "4873"), ' + 'host:port (e.g. "localhost:4873"), full url ' + '(e.g. "http://localhost:4873/") or unix:/path/socket'));
96
- if (valid.length === 0) {
97
- throw new Error('No valid listen addresses found in configuration array');
98
- }
99
- const firstValid = valid[0];
100
- if (listen.length > 1) {
101
- logger.warn(`Multiple listen addresses are not supported, using the first valid one ${addrToString(firstValid)}`);
102
- }
103
- return firstValid;
104
- }
105
- const single = parseAddress(listen);
106
- if (!single) {
107
- throw new Error(`Invalid address - ${listen}, we expect a port (e.g. "4873"), ` + `host:port (e.g. "localhost:4873"), full url ` + `(e.g. "http://localhost:4873/") or unix:/path/socket`);
108
- }
109
- return single;
51
+ debug$1("getListenAddress called with %o", listen);
52
+ if (!listen) {
53
+ debug$1("No listen address provided, using default");
54
+ return {
55
+ proto: _verdaccio_core.DEFAULT_PROTOCOL,
56
+ host: _verdaccio_core.DEFAULT_DOMAIN,
57
+ port: _verdaccio_core.DEFAULT_PORT
58
+ };
59
+ }
60
+ if (Array.isArray(listen)) {
61
+ const filteredListen = listen.filter((item) => typeof item === "string");
62
+ if (filteredListen.length === 0) throw new Error("Listen addresses array cannot be empty");
63
+ const invalid = [];
64
+ const valid = [];
65
+ for (const raw of filteredListen) {
66
+ const candidate = parseAddress(raw);
67
+ if (candidate) {
68
+ debug$1("valid listen address found: %o", candidate);
69
+ valid.push(candidate);
70
+ } else {
71
+ debug$1("invalid address found: %o", raw);
72
+ invalid.push(raw);
73
+ }
74
+ }
75
+ invalid.forEach((bad) => logger.warn({ addr: bad }, "invalid address - @{addr}, we expect a port (e.g. \"4873\"), host:port (e.g. \"localhost:4873\"), full url (e.g. \"http://localhost:4873/\") or unix:/path/socket"));
76
+ if (valid.length === 0) throw new Error("No valid listen addresses found in configuration array");
77
+ const firstValid = valid[0];
78
+ if (listen.length > 1) logger.warn(`Multiple listen addresses are not supported, using the first valid one ${addrToString(firstValid)}`);
79
+ return firstValid;
80
+ }
81
+ const single = parseAddress(listen);
82
+ if (!single) throw new Error(`Invalid address - ${listen}, we expect a port (e.g. "4873"), host:port (e.g. "localhost:4873"), full url (e.g. "http://localhost:4873/") or unix:/path/socket`);
83
+ return single;
110
84
  }
85
+ //#endregion
86
+ exports.getListenAddress = getListenAddress;
87
+ exports.parseAddress = parseAddress;
88
+
111
89
  //# sourceMappingURL=address.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"address.js","names":["_debug","_interopRequireDefault","require","_core","e","__esModule","default","debug","createDebug","parseAddress","urlAddress","urlPattern","exec","proto","DEFAULT_PROTOCOL","host","DEFAULT_DOMAIN","port","DEFAULT_PORT","unixPattern","path","addrToString","a","getListenAddress","listen","logger","Array","isArray","filteredListen","filter","item","length","Error","invalid","valid","raw","candidate","push","forEach","bad","warn","addr","firstValid","single"],"sources":["../src/address.ts"],"sourcesContent":["import createDebug from 'debug';\n\nimport { DEFAULT_DOMAIN, DEFAULT_PORT, DEFAULT_PROTOCOL } from '@verdaccio/core';\nimport type { ListenAddress as ConfigListenAddress, Logger } from '@verdaccio/types';\n\nconst debug = createDebug('verdaccio:config:address');\n\nexport interface ListenAddress {\n proto: string;\n host?: string;\n port?: string;\n path?: string;\n}\n\n/**\n * Parse an internet address\n * Allow:\n - https:localhost:1234 - protocol + host + port\n - localhost:1234 - host + port\n - 1234 - port\n - http::1234 - protocol + port\n - https://localhost:443/ - full url + https\n - http://[::1]:443/ - ipv6\n - unix:/tmp/http.sock - unix sockets\n - https://unix:/tmp/http.sock - unix sockets (https)\n * @param {*} urlAddress the internet address definition\n * @return {Object|Null} literal object that represent the address parsed\n */\nexport function parseAddress(urlAddress: string): ListenAddress | null {\n //\n // TODO: refactor it to something more reasonable?\n //\n // protocol : // ( host )|( ipv6 ): port /\n const urlPattern = /^((https?):(\\/\\/)?)?((([^\\/:]*)|\\[([^\\[\\]]+)\\]):)?(\\d+)\\/?$/.exec(urlAddress);\n\n if (urlPattern) {\n return {\n proto: urlPattern[2] || DEFAULT_PROTOCOL,\n host: urlPattern[6] || urlPattern[7] || DEFAULT_DOMAIN,\n port: urlPattern[8] || DEFAULT_PORT,\n };\n }\n\n const unixPattern = /^(?:(https?):\\/\\/)?unix:(\\/.*)$/.exec(urlAddress);\n if (!unixPattern) {\n // if we cannot match the unix pattern, we return null\n // this is to avoid returning a wrong object\n return null;\n }\n\n return {\n host: unixPattern[2],\n proto: unixPattern[1] || 'unix',\n path: unixPattern[2],\n };\n}\n\nfunction addrToString(a: ListenAddress): string {\n return a.proto === 'unix' ? `unix:${a.host}` : `${a.proto}://${a.host}:${a.port}`;\n}\n\n/**\n * Retrieve all addresses defined in the config file.\n * Verdaccio is able to listen multiple ports\n * @param {String} argListen\n * @param {String} configListen\n * eg:\n * listen:\n - localhost:5555\n - localhost:5557\n @return {Array}\n */\nexport function getListenAddress(\n listen: ConfigListenAddress | string | undefined,\n logger: Logger\n): ListenAddress {\n debug('getListenAddress called with %o', listen);\n\n if (!listen) {\n debug('No listen address provided, using default');\n return { proto: DEFAULT_PROTOCOL, host: DEFAULT_DOMAIN, port: DEFAULT_PORT };\n }\n\n if (Array.isArray(listen)) {\n const filteredListen = listen.filter((item) => typeof item === 'string');\n\n if (filteredListen.length === 0) {\n throw new Error('Listen addresses array cannot be empty');\n }\n\n const invalid: string[] = [];\n const valid: ListenAddress[] = [];\n\n for (const raw of filteredListen) {\n const candidate = parseAddress(raw as string);\n if (candidate) {\n debug('valid listen address found: %o', candidate);\n valid.push(candidate);\n } else {\n debug('invalid address found: %o', raw);\n invalid.push(raw as string);\n }\n }\n\n invalid.forEach((bad) =>\n logger.warn(\n { addr: bad },\n 'invalid address - @{addr}, we expect a port (e.g. \"4873\"), ' +\n 'host:port (e.g. \"localhost:4873\"), full url ' +\n '(e.g. \"http://localhost:4873/\") or unix:/path/socket'\n )\n );\n\n if (valid.length === 0) {\n throw new Error('No valid listen addresses found in configuration array');\n }\n\n const firstValid = valid[0];\n\n if (listen.length > 1) {\n logger.warn(\n `Multiple listen addresses are not supported, using the first valid one ${addrToString(\n firstValid\n )}`\n );\n }\n\n return firstValid;\n }\n\n const single = parseAddress(listen as string);\n if (!single) {\n throw new Error(\n `Invalid address - ${listen}, we expect a port (e.g. \"4873\"), ` +\n `host:port (e.g. \"localhost:4873\"), full url ` +\n `(e.g. \"http://localhost:4873/\") or unix:/path/socket`\n );\n }\n return single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CAAC;IAC3E;IAEA,MAAMU,UAAU,GAAGR,KAAK,CAAC,CAAC,CAAC;IAE3B,IAAIV,MAAM,CAACO,MAAM,GAAG,CAAC,EAAE;MACrBN,MAAM,CAACe,IAAI,CACT,0EAA0EnB,YAAY,CACpFqB,UACF,CAAC,EACH,CAAC;IACH;IAEA,OAAOA,UAAU;EACnB;EAEA,MAAMC,MAAM,GAAGlC,YAAY,CAACe,MAAgB,CAAC;EAC7C,IAAI,CAACmB,MAAM,EAAE;IACX,MAAM,IAAIX,KAAK,CACb,qBAAqBR,MAAM,oCAAoC,GAC7D,8CAA8C,GAC9C,sDACJ,CAAC;EACH;EACA,OAAOmB,MAAM;AACf","ignoreList":[]}
1
+ {"version":3,"file":"address.js","names":[],"sources":["../src/address.ts"],"sourcesContent":["import createDebug from 'debug';\n\nimport { DEFAULT_DOMAIN, DEFAULT_PORT, DEFAULT_PROTOCOL } from '@verdaccio/core';\nimport type { ListenAddress as ConfigListenAddress, Logger } from '@verdaccio/types';\n\nconst debug = createDebug('verdaccio:config:address');\n\nexport interface ListenAddress {\n proto: string;\n host?: string;\n port?: string;\n path?: string;\n}\n\n/**\n * Parse an internet address\n * Allow:\n - https:localhost:1234 - protocol + host + port\n - localhost:1234 - host + port\n - 1234 - port\n - http::1234 - protocol + port\n - https://localhost:443/ - full url + https\n - http://[::1]:443/ - ipv6\n - unix:/tmp/http.sock - unix sockets\n - https://unix:/tmp/http.sock - unix sockets (https)\n * @param {*} urlAddress the internet address definition\n * @return {Object|Null} literal object that represent the address parsed\n */\nexport function parseAddress(urlAddress: string): ListenAddress | null {\n //\n // TODO: refactor it to something more reasonable?\n //\n // protocol : // ( host )|( ipv6 ): port /\n const urlPattern = /^((https?):(\\/\\/)?)?((([^\\/:]*)|\\[([^\\[\\]]+)\\]):)?(\\d+)\\/?$/.exec(urlAddress);\n\n if (urlPattern) {\n return {\n proto: urlPattern[2] || DEFAULT_PROTOCOL,\n host: urlPattern[6] || urlPattern[7] || DEFAULT_DOMAIN,\n port: urlPattern[8] || DEFAULT_PORT,\n };\n }\n\n const unixPattern = /^(?:(https?):\\/\\/)?unix:(\\/.*)$/.exec(urlAddress);\n if (!unixPattern) {\n // if we cannot match the unix pattern, we return null\n // this is to avoid returning a wrong object\n return null;\n }\n\n return {\n host: unixPattern[2],\n proto: unixPattern[1] || 'unix',\n path: unixPattern[2],\n };\n}\n\nfunction addrToString(a: ListenAddress): string {\n return a.proto === 'unix' ? `unix:${a.host}` : `${a.proto}://${a.host}:${a.port}`;\n}\n\n/**\n * Retrieve all addresses defined in the config file.\n * Verdaccio is able to listen multiple ports\n * @param {String} argListen\n * @param {String} configListen\n * eg:\n * listen:\n - localhost:5555\n - localhost:5557\n @return {Array}\n */\nexport function getListenAddress(\n listen: ConfigListenAddress | string | undefined,\n logger: Logger\n): ListenAddress {\n debug('getListenAddress called with %o', listen);\n\n if (!listen) {\n debug('No listen address provided, using default');\n return { proto: DEFAULT_PROTOCOL, host: DEFAULT_DOMAIN, port: DEFAULT_PORT };\n }\n\n if (Array.isArray(listen)) {\n const filteredListen = listen.filter((item) => typeof item === 'string');\n\n if (filteredListen.length === 0) {\n throw new Error('Listen addresses array cannot be empty');\n }\n\n const invalid: string[] = [];\n const valid: ListenAddress[] = [];\n\n for (const raw of filteredListen) {\n const candidate = parseAddress(raw as string);\n if (candidate) {\n debug('valid listen address found: %o', candidate);\n valid.push(candidate);\n } else {\n debug('invalid address found: %o', raw);\n invalid.push(raw as string);\n }\n }\n\n invalid.forEach((bad) =>\n logger.warn(\n { addr: bad },\n 'invalid address - @{addr}, we expect a port (e.g. \"4873\"), ' +\n 'host:port (e.g. \"localhost:4873\"), full url ' +\n '(e.g. \"http://localhost:4873/\") or unix:/path/socket'\n )\n );\n\n if (valid.length === 0) {\n throw new Error('No valid listen addresses found in configuration array');\n }\n\n const firstValid = valid[0];\n\n if (listen.length > 1) {\n logger.warn(\n `Multiple listen addresses are not supported, using the first valid one ${addrToString(\n firstValid\n )}`\n );\n }\n\n return firstValid;\n }\n\n const single = parseAddress(listen as string);\n if (!single) {\n throw new Error(\n `Invalid address - ${listen}, we expect a port (e.g. \"4873\"), ` +\n `host:port (e.g. \"localhost:4873\"), full url ` +\n `(e.g. \"http://localhost:4873/\") or unix:/path/socket`\n );\n }\n return single;\n}\n"],"mappings":";;;;;AAKA,IAAM,WAAA,GAAA,MAAA,SAAoB,2BAA2B;;;;;;;;;;;;;;;AAuBrD,SAAgB,aAAa,YAA0C;CAKrE,MAAM,aAAa,8DAA8D,KAAK,WAAW;AAEjG,KAAI,WACF,QAAO;EACL,OAAO,WAAW,MAAM,gBAAA;EACxB,MAAM,WAAW,MAAM,WAAW,MAAM,gBAAA;EACxC,MAAM,WAAW,MAAM,gBAAA;EACxB;CAGH,MAAM,cAAc,kCAAkC,KAAK,WAAW;AACtE,KAAI,CAAC,YAGH,QAAO;AAGT,QAAO;EACL,MAAM,YAAY;EAClB,OAAO,YAAY,MAAM;EACzB,MAAM,YAAY;EACnB;;AAGH,SAAS,aAAa,GAA0B;AAC9C,QAAO,EAAE,UAAU,SAAS,QAAQ,EAAE,SAAS,GAAG,EAAE,MAAM,KAAK,EAAE,KAAK,GAAG,EAAE;;;;;;;;;;;;;AAc7E,SAAgB,iBACd,QACA,QACe;AACf,SAAM,mCAAmC,OAAO;AAEhD,KAAI,CAAC,QAAQ;AACX,UAAM,4CAA4C;AAClD,SAAO;GAAE,OAAO,gBAAA;GAAkB,MAAM,gBAAA;GAAgB,MAAM,gBAAA;GAAc;;AAG9E,KAAI,MAAM,QAAQ,OAAO,EAAE;EACzB,MAAM,iBAAiB,OAAO,QAAQ,SAAS,OAAO,SAAS,SAAS;AAExE,MAAI,eAAe,WAAW,EAC5B,OAAM,IAAI,MAAM,yCAAyC;EAG3D,MAAM,UAAoB,EAAE;EAC5B,MAAM,QAAyB,EAAE;AAEjC,OAAK,MAAM,OAAO,gBAAgB;GAChC,MAAM,YAAY,aAAa,IAAc;AAC7C,OAAI,WAAW;AACb,YAAM,kCAAkC,UAAU;AAClD,UAAM,KAAK,UAAU;UAChB;AACL,YAAM,6BAA6B,IAAI;AACvC,YAAQ,KAAK,IAAc;;;AAI/B,UAAQ,SAAS,QACf,OAAO,KACL,EAAE,MAAM,KAAK,EACb,oKAGD,CACF;AAED,MAAI,MAAM,WAAW,EACnB,OAAM,IAAI,MAAM,yDAAyD;EAG3E,MAAM,aAAa,MAAM;AAEzB,MAAI,OAAO,SAAS,EAClB,QAAO,KACL,0EAA0E,aACxE,WACD,GACF;AAGH,SAAO;;CAGT,MAAM,SAAS,aAAa,OAAiB;AAC7C,KAAI,CAAC,OACH,OAAM,IAAI,MACR,qBAAqB,OAAO,oIAG7B;AAEH,QAAO"}
@@ -0,0 +1,86 @@
1
+ import buildDebug from "debug";
2
+ import { DEFAULT_DOMAIN, DEFAULT_PORT, DEFAULT_PROTOCOL } from "@verdaccio/core";
3
+ //#region src/address.ts
4
+ var debug = buildDebug("verdaccio:config:address");
5
+ /**
6
+ * Parse an internet address
7
+ * Allow:
8
+ - https:localhost:1234 - protocol + host + port
9
+ - localhost:1234 - host + port
10
+ - 1234 - port
11
+ - http::1234 - protocol + port
12
+ - https://localhost:443/ - full url + https
13
+ - http://[::1]:443/ - ipv6
14
+ - unix:/tmp/http.sock - unix sockets
15
+ - https://unix:/tmp/http.sock - unix sockets (https)
16
+ * @param {*} urlAddress the internet address definition
17
+ * @return {Object|Null} literal object that represent the address parsed
18
+ */
19
+ function parseAddress(urlAddress) {
20
+ const urlPattern = /^((https?):(\/\/)?)?((([^\/:]*)|\[([^\[\]]+)\]):)?(\d+)\/?$/.exec(urlAddress);
21
+ if (urlPattern) return {
22
+ proto: urlPattern[2] || DEFAULT_PROTOCOL,
23
+ host: urlPattern[6] || urlPattern[7] || DEFAULT_DOMAIN,
24
+ port: urlPattern[8] || DEFAULT_PORT
25
+ };
26
+ const unixPattern = /^(?:(https?):\/\/)?unix:(\/.*)$/.exec(urlAddress);
27
+ if (!unixPattern) return null;
28
+ return {
29
+ host: unixPattern[2],
30
+ proto: unixPattern[1] || "unix",
31
+ path: unixPattern[2]
32
+ };
33
+ }
34
+ function addrToString(a) {
35
+ return a.proto === "unix" ? `unix:${a.host}` : `${a.proto}://${a.host}:${a.port}`;
36
+ }
37
+ /**
38
+ * Retrieve all addresses defined in the config file.
39
+ * Verdaccio is able to listen multiple ports
40
+ * @param {String} argListen
41
+ * @param {String} configListen
42
+ * eg:
43
+ * listen:
44
+ - localhost:5555
45
+ - localhost:5557
46
+ @return {Array}
47
+ */
48
+ function getListenAddress(listen, logger) {
49
+ debug("getListenAddress called with %o", listen);
50
+ if (!listen) {
51
+ debug("No listen address provided, using default");
52
+ return {
53
+ proto: DEFAULT_PROTOCOL,
54
+ host: DEFAULT_DOMAIN,
55
+ port: DEFAULT_PORT
56
+ };
57
+ }
58
+ if (Array.isArray(listen)) {
59
+ const filteredListen = listen.filter((item) => typeof item === "string");
60
+ if (filteredListen.length === 0) throw new Error("Listen addresses array cannot be empty");
61
+ const invalid = [];
62
+ const valid = [];
63
+ for (const raw of filteredListen) {
64
+ const candidate = parseAddress(raw);
65
+ if (candidate) {
66
+ debug("valid listen address found: %o", candidate);
67
+ valid.push(candidate);
68
+ } else {
69
+ debug("invalid address found: %o", raw);
70
+ invalid.push(raw);
71
+ }
72
+ }
73
+ invalid.forEach((bad) => logger.warn({ addr: bad }, "invalid address - @{addr}, we expect a port (e.g. \"4873\"), host:port (e.g. \"localhost:4873\"), full url (e.g. \"http://localhost:4873/\") or unix:/path/socket"));
74
+ if (valid.length === 0) throw new Error("No valid listen addresses found in configuration array");
75
+ const firstValid = valid[0];
76
+ if (listen.length > 1) logger.warn(`Multiple listen addresses are not supported, using the first valid one ${addrToString(firstValid)}`);
77
+ return firstValid;
78
+ }
79
+ const single = parseAddress(listen);
80
+ if (!single) throw new Error(`Invalid address - ${listen}, we expect a port (e.g. "4873"), host:port (e.g. "localhost:4873"), full url (e.g. "http://localhost:4873/") or unix:/path/socket`);
81
+ return single;
82
+ }
83
+ //#endregion
84
+ export { getListenAddress, parseAddress };
85
+
86
+ //# sourceMappingURL=address.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.mjs","names":[],"sources":["../src/address.ts"],"sourcesContent":["import createDebug from 'debug';\n\nimport { DEFAULT_DOMAIN, DEFAULT_PORT, DEFAULT_PROTOCOL } from '@verdaccio/core';\nimport type { ListenAddress as ConfigListenAddress, Logger } from '@verdaccio/types';\n\nconst debug = createDebug('verdaccio:config:address');\n\nexport interface ListenAddress {\n proto: string;\n host?: string;\n port?: string;\n path?: string;\n}\n\n/**\n * Parse an internet address\n * Allow:\n - https:localhost:1234 - protocol + host + port\n - localhost:1234 - host + port\n - 1234 - port\n - http::1234 - protocol + port\n - https://localhost:443/ - full url + https\n - http://[::1]:443/ - ipv6\n - unix:/tmp/http.sock - unix sockets\n - https://unix:/tmp/http.sock - unix sockets (https)\n * @param {*} urlAddress the internet address definition\n * @return {Object|Null} literal object that represent the address parsed\n */\nexport function parseAddress(urlAddress: string): ListenAddress | null {\n //\n // TODO: refactor it to something more reasonable?\n //\n // protocol : // ( host )|( ipv6 ): port /\n const urlPattern = /^((https?):(\\/\\/)?)?((([^\\/:]*)|\\[([^\\[\\]]+)\\]):)?(\\d+)\\/?$/.exec(urlAddress);\n\n if (urlPattern) {\n return {\n proto: urlPattern[2] || DEFAULT_PROTOCOL,\n host: urlPattern[6] || urlPattern[7] || DEFAULT_DOMAIN,\n port: urlPattern[8] || DEFAULT_PORT,\n };\n }\n\n const unixPattern = /^(?:(https?):\\/\\/)?unix:(\\/.*)$/.exec(urlAddress);\n if (!unixPattern) {\n // if we cannot match the unix pattern, we return null\n // this is to avoid returning a wrong object\n return null;\n }\n\n return {\n host: unixPattern[2],\n proto: unixPattern[1] || 'unix',\n path: unixPattern[2],\n };\n}\n\nfunction addrToString(a: ListenAddress): string {\n return a.proto === 'unix' ? `unix:${a.host}` : `${a.proto}://${a.host}:${a.port}`;\n}\n\n/**\n * Retrieve all addresses defined in the config file.\n * Verdaccio is able to listen multiple ports\n * @param {String} argListen\n * @param {String} configListen\n * eg:\n * listen:\n - localhost:5555\n - localhost:5557\n @return {Array}\n */\nexport function getListenAddress(\n listen: ConfigListenAddress | string | undefined,\n logger: Logger\n): ListenAddress {\n debug('getListenAddress called with %o', listen);\n\n if (!listen) {\n debug('No listen address provided, using default');\n return { proto: DEFAULT_PROTOCOL, host: DEFAULT_DOMAIN, port: DEFAULT_PORT };\n }\n\n if (Array.isArray(listen)) {\n const filteredListen = listen.filter((item) => typeof item === 'string');\n\n if (filteredListen.length === 0) {\n throw new Error('Listen addresses array cannot be empty');\n }\n\n const invalid: string[] = [];\n const valid: ListenAddress[] = [];\n\n for (const raw of filteredListen) {\n const candidate = parseAddress(raw as string);\n if (candidate) {\n debug('valid listen address found: %o', candidate);\n valid.push(candidate);\n } else {\n debug('invalid address found: %o', raw);\n invalid.push(raw as string);\n }\n }\n\n invalid.forEach((bad) =>\n logger.warn(\n { addr: bad },\n 'invalid address - @{addr}, we expect a port (e.g. \"4873\"), ' +\n 'host:port (e.g. \"localhost:4873\"), full url ' +\n '(e.g. \"http://localhost:4873/\") or unix:/path/socket'\n )\n );\n\n if (valid.length === 0) {\n throw new Error('No valid listen addresses found in configuration array');\n }\n\n const firstValid = valid[0];\n\n if (listen.length > 1) {\n logger.warn(\n `Multiple listen addresses are not supported, using the first valid one ${addrToString(\n firstValid\n )}`\n );\n }\n\n return firstValid;\n }\n\n const single = parseAddress(listen as string);\n if (!single) {\n throw new Error(\n `Invalid address - ${listen}, we expect a port (e.g. \"4873\"), ` +\n `host:port (e.g. \"localhost:4873\"), full url ` +\n `(e.g. \"http://localhost:4873/\") or unix:/path/socket`\n );\n }\n return single;\n}\n"],"mappings":";;;AAKA,IAAM,QAAQ,WAAY,2BAA2B;;;;;;;;;;;;;;;AAuBrD,SAAgB,aAAa,YAA0C;CAKrE,MAAM,aAAa,8DAA8D,KAAK,WAAW;AAEjG,KAAI,WACF,QAAO;EACL,OAAO,W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AAO,oIAG7B;AAEH,QAAO"}
package/build/agent.js CHANGED
@@ -1,19 +1,14 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getUserAgent = getUserAgent;
7
- var _lodash = _interopRequireDefault(require("lodash"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
1
+ const require_runtime = require("./_virtual/_rolldown/runtime.js");
2
+ let lodash = require("lodash");
3
+ lodash = require_runtime.__toESM(lodash);
4
+ //#region src/agent.ts
9
5
  function getUserAgent(customUserAgent, version, name) {
10
- if (customUserAgent === true) {
11
- return `${name}/${version}`;
12
- } else if (_lodash.default.isString(customUserAgent) && _lodash.default.isEmpty(customUserAgent) === false) {
13
- return customUserAgent;
14
- } else if (customUserAgent === false) {
15
- return 'hidden';
16
- }
17
- return `${name}/${version}`;
6
+ if (customUserAgent === true) return `${name}/${version}`;
7
+ else if (lodash.default.isString(customUserAgent) && lodash.default.isEmpty(customUserAgent) === false) return customUserAgent;
8
+ else if (customUserAgent === false) return "hidden";
9
+ return `${name}/${version}`;
18
10
  }
11
+ //#endregion
12
+ exports.getUserAgent = getUserAgent;
13
+
19
14
  //# sourceMappingURL=agent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent.js","names":["_lodash","_interopRequireDefault","require","e","__esModule","default","getUserAgent","customUserAgent","version","name","_","isString","isEmpty"],"sources":["../src/agent.ts"],"sourcesContent":["import _ from 'lodash';\n\nexport function getUserAgent(\n customUserAgent?: boolean | string,\n version?: string,\n name?: string\n): string {\n if (customUserAgent === true) {\n return `${name}/${version}`;\n } else if (_.isString(customUserAgent) && _.isEmpty(customUserAgent) === false) {\n return customUserAgent;\n } else if (customUserAgent === false) {\n return 'hidden';\n }\n\n return `${name}/${version}`;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuB,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhB,SAASG,YAAYA,CAC1BC,eAAkC,EAClCC,OAAgB,EAChBC,IAAa,EACL;EACR,IAAIF,eAAe,KAAK,IAAI,EAAE;IAC5B,OAAO,GAAGE,IAAI,IAAID,OAAO,EAAE;EAC7B,CAAC,MAAM,IAAIE,eAAC,CAACC,QAAQ,CAACJ,eAAe,CAAC,IAAIG,eAAC,CAACE,OAAO,CAACL,eAAe,CAAC,KAAK,KAAK,EAAE;IAC9E,OAAOA,eAAe;EACxB,CAAC,MAAM,IAAIA,eAAe,KAAK,KAAK,EAAE;IACpC,OAAO,QAAQ;EACjB;EAEA,OAAO,GAAGE,IAAI,IAAID,OAAO,EAAE;AAC7B","ignoreList":[]}
1
+ {"version":3,"file":"agent.js","names":[],"sources":["../src/agent.ts"],"sourcesContent":["import _ from 'lodash';\n\nexport function getUserAgent(\n customUserAgent?: boolean | string,\n version?: string,\n name?: string\n): string {\n if (customUserAgent === true) {\n return `${name}/${version}`;\n } else if (_.isString(customUserAgent) && _.isEmpty(customUserAgent) === false) {\n return customUserAgent;\n } else if (customUserAgent === false) {\n return 'hidden';\n }\n\n return `${name}/${version}`;\n}\n"],"mappings":";;;;AAEA,SAAgB,aACd,iBACA,SACA,MACQ;AACR,KAAI,oBAAoB,KACtB,QAAO,GAAG,KAAK,GAAG;UACT,OAAA,QAAE,SAAS,gBAAgB,IAAI,OAAA,QAAE,QAAQ,gBAAgB,KAAK,MACvE,QAAO;UACE,oBAAoB,MAC7B,QAAO;AAGT,QAAO,GAAG,KAAK,GAAG"}
@@ -0,0 +1,12 @@
1
+ import _ from "lodash";
2
+ //#region src/agent.ts
3
+ function getUserAgent(customUserAgent, version, name) {
4
+ if (customUserAgent === true) return `${name}/${version}`;
5
+ else if (_.isString(customUserAgent) && _.isEmpty(customUserAgent) === false) return customUserAgent;
6
+ else if (customUserAgent === false) return "hidden";
7
+ return `${name}/${version}`;
8
+ }
9
+ //#endregion
10
+ export { getUserAgent };
11
+
12
+ //# sourceMappingURL=agent.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.mjs","names":[],"sources":["../src/agent.ts"],"sourcesContent":["import _ from 'lodash';\n\nexport function getUserAgent(\n customUserAgent?: boolean | string,\n version?: string,\n name?: string\n): string {\n if (customUserAgent === true) {\n return `${name}/${version}`;\n } else if (_.isString(customUserAgent) && _.isEmpty(customUserAgent) === false) {\n return customUserAgent;\n } else if (customUserAgent === false) {\n return 'hidden';\n }\n\n return `${name}/${version}`;\n}\n"],"mappings":";;AAEA,SAAgB,aACd,iBACA,SACA,MACQ;AACR,KAAI,oBAAoB,KACtB,QAAO,GAAG,KAAK,GAAG;UACT,EAAE,SAAS,gBAAgB,IAAI,EAAE,QAAQ,gBAAgB,KAAK,MACvE,QAAO;UACE,oBAAoB,MAC7B,QAAO;AAGT,QAAO,GAAG,KAAK,GAAG"}
@@ -1,4 +1,4 @@
1
- import type { AuthConf, ConfigYaml, LoggerConfigItem, PackageAccessYaml, Security, ServerSettingsConf, UpLinkConf } from '@verdaccio/types';
1
+ import { AuthConf, ConfigYaml, LoggerConfigItem, PackageAccessYaml, Security, ServerSettingsConf, UpLinkConf } from '@verdaccio/types';
2
2
  /**
3
3
  * Helper configuration builder constructor, used to build the configuration for testing or
4
4
  * programatically creating a configuration.
package/build/builder.js CHANGED
@@ -1,65 +1,61 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _lodash = require("lodash");
8
- var _ = require(".");
1
+ require("./_virtual/_rolldown/runtime.js");
2
+ const require_parse = require("./parse.js");
3
+ require("./index.js");
4
+ let lodash = require("lodash");
5
+ //#region src/builder.ts
9
6
  /**
10
- * Helper configuration builder constructor, used to build the configuration for testing or
11
- * programatically creating a configuration.
12
- */
13
- class ConfigBuilder {
14
- constructor(config) {
15
- this.config = (0, _lodash.merge)(config, {
16
- uplinks: {},
17
- packages: {},
18
- security: {}
19
- });
20
- }
21
- static build(config) {
22
- return new ConfigBuilder(config);
23
- }
24
- addPackageAccess(pattern, pkgAccess) {
25
- // @ts-ignore
26
- this.config.packages[pattern] = pkgAccess;
27
- return this;
28
- }
29
- addUplink(id, uplink) {
30
- this.config.uplinks[id] = uplink;
31
- return this;
32
- }
33
- addSecurity(security) {
34
- this.config.security = (0, _lodash.merge)(this.config.security, security);
35
- return this;
36
- }
37
- addAuth(auth) {
38
- this.config.auth = (0, _lodash.merge)(this.config.auth, auth);
39
- return this;
40
- }
41
- addLogger(log) {
42
- this.config.log = log;
43
- return this;
44
- }
45
- addServer(server) {
46
- this.config.server = (0, _lodash.merge)(this.config.server, server);
47
- return this;
48
- }
49
- addStorage(storage) {
50
- if (typeof storage === 'string') {
51
- this.config.storage = storage;
52
- } else {
53
- this.config.store = storage;
54
- }
55
- return this;
56
- }
57
- getConfig() {
58
- return this.config;
59
- }
60
- getAsYaml() {
61
- return (0, _.fromJStoYAML)(this.config);
62
- }
63
- }
7
+ * Helper configuration builder constructor, used to build the configuration for testing or
8
+ * programatically creating a configuration.
9
+ */
10
+ var ConfigBuilder = class ConfigBuilder {
11
+ config;
12
+ constructor(config) {
13
+ this.config = (0, lodash.merge)(config, {
14
+ uplinks: {},
15
+ packages: {},
16
+ security: {}
17
+ });
18
+ }
19
+ static build(config) {
20
+ return new ConfigBuilder(config);
21
+ }
22
+ addPackageAccess(pattern, pkgAccess) {
23
+ this.config.packages[pattern] = pkgAccess;
24
+ return this;
25
+ }
26
+ addUplink(id, uplink) {
27
+ this.config.uplinks[id] = uplink;
28
+ return this;
29
+ }
30
+ addSecurity(security) {
31
+ this.config.security = (0, lodash.merge)(this.config.security, security);
32
+ return this;
33
+ }
34
+ addAuth(auth) {
35
+ this.config.auth = (0, lodash.merge)(this.config.auth, auth);
36
+ return this;
37
+ }
38
+ addLogger(log) {
39
+ this.config.log = log;
40
+ return this;
41
+ }
42
+ addServer(server) {
43
+ this.config.server = (0, lodash.merge)(this.config.server, server);
44
+ return this;
45
+ }
46
+ addStorage(storage) {
47
+ if (typeof storage === "string") this.config.storage = storage;
48
+ else this.config.store = storage;
49
+ return this;
50
+ }
51
+ getConfig() {
52
+ return this.config;
53
+ }
54
+ getAsYaml() {
55
+ return require_parse.fromJStoYAML(this.config);
56
+ }
57
+ };
58
+ //#endregion
64
59
  exports.default = ConfigBuilder;
60
+
65
61
  //# sourceMappingURL=builder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"builder.js","names":["_lodash","require","_","ConfigBuilder","constructor","config","merge","uplinks","packages","security","build","addPackageAccess","pattern","pkgAccess","addUplink","id","uplink","addSecurity","addAuth","auth","addLogger","log","addServer","server","addStorage","storage","store","getConfig","getAsYaml","fromJStoYAML","exports","default"],"sources":["../src/builder.ts"],"sourcesContent":["import { merge } from 'lodash';\n\nimport type {\n AuthConf,\n ConfigYaml,\n LoggerConfigItem,\n PackageAccessYaml,\n Security,\n ServerSettingsConf,\n UpLinkConf,\n} from '@verdaccio/types';\n\nimport { fromJStoYAML } from '.';\n\n/**\n * Helper configuration builder constructor, used to build the configuration for testing or\n * programatically creating a configuration.\n */\nexport default class ConfigBuilder {\n private config: ConfigYaml;\n\n public constructor(config?: Partial<ConfigYaml>) {\n this.config = merge(config, { uplinks: {}, packages: {}, security: {} });\n }\n\n public static build(config?: Partial<ConfigYaml>): ConfigBuilder {\n return new ConfigBuilder(config);\n }\n\n public addPackageAccess(pattern: string, pkgAccess: PackageAccessYaml) {\n // @ts-ignore\n this.config.packages[pattern] = pkgAccess;\n return this;\n }\n\n public addUplink(id: string, uplink: UpLinkConf) {\n this.config.uplinks[id] = uplink;\n return this;\n }\n\n public addSecurity(security: Partial<Security>) {\n this.config.security = merge(this.config.security, security);\n return this;\n }\n\n public addAuth(auth: Partial<AuthConf>) {\n this.config.auth = merge(this.config.auth, auth);\n return this;\n }\n\n public addLogger(log: LoggerConfigItem) {\n this.config.log = log;\n return this;\n }\n\n public addServer(server: Partial<ServerSettingsConf>) {\n this.config.server = merge(this.config.server, server);\n return this;\n }\n\n public addStorage(storage: string | object) {\n if (typeof storage === 'string') {\n this.config.storage = storage;\n } else {\n this.config.store = storage;\n }\n return this;\n }\n\n public getConfig(): ConfigYaml {\n return this.config;\n }\n\n public getAsYaml(): string {\n return fromJStoYAML(this.config) as string;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAYA,IAAAC,CAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACe,MAAME,aAAa,CAAC;EAG1BC,WAAWA,CAACC,MAA4B,EAAE;IAC/C,IAAI,CAACA,MAAM,GAAG,IAAAC,aAAK,EAACD,MAAM,EAAE;MAAEE,OAAO,EAAE,CAAC,CAAC;MAAEC,QAAQ,EAAE,CAAC,CAAC;MAAEC,QAAQ,EAAE,CAAC;IAAE,CAAC,CAAC;EAC1E;EAEA,OAAcC,KAAKA,CAACL,MAA4B,EAAiB;IAC/D,OAAO,IAAIF,aAAa,CAACE,MAAM,CAAC;EAClC;EAEOM,gBAAgBA,CAACC,OAAe,EAAEC,SAA4B,EAAE;IACrE;IACA,IAAI,CAACR,MAAM,CAACG,QAAQ,CAACI,OAAO,CAAC,GAAGC,SAAS;IACzC,OAAO,IAAI;EACb;EAEOC,SAASA,CAACC,EAAU,EAAEC,MAAkB,EAAE;IAC/C,IAAI,CAACX,MAAM,CAACE,OAAO,CAACQ,EAAE,CAAC,GAAGC,MAAM;IAChC,OAAO,IAAI;EACb;EAEOC,WAAWA,CAACR,QAA2B,EAAE;IAC9C,IAAI,CAACJ,MAAM,CAACI,QAAQ,GAAG,IAAAH,aAAK,EAAC,IAAI,CAACD,MAAM,CAACI,QAAQ,EAAEA,QAAQ,CAAC;IAC5D,OAAO,IAAI;EACb;EAEOS,OAAOA,CAACC,IAAuB,EAAE;IACtC,IAAI,CAACd,MAAM,CAACc,IAAI,GAAG,IAAAb,aAAK,EAAC,IAAI,CAACD,MAAM,CAACc,IAAI,EAAEA,IAAI,CAAC;IAChD,OAAO,IAAI;EACb;EAEOC,SAASA,CAACC,GAAqB,EAAE;IACtC,IAAI,CAAChB,MAAM,CAACgB,GAAG,GAAGA,GAAG;IACrB,OAAO,IAAI;EACb;EAEOC,SAASA,CAACC,MAAmC,EAAE;IACpD,IAAI,CAAClB,MAAM,CAACkB,MAAM,GAAG,IAAAjB,aAAK,EAAC,IAAI,CAACD,MAAM,CAACkB,MAAM,EAAEA,MAAM,CAAC;IACtD,OAAO,IAAI;EACb;EAEOC,UAAUA,CAACC,OAAwB,EAAE;IAC1C,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MAC/B,IAAI,CAACpB,MAAM,CAACoB,OAAO,GAAGA,OAAO;IAC/B,CAAC,MAAM;MACL,IAAI,CAACpB,MAAM,CAACqB,KAAK,GAAGD,OAAO;IAC7B;IACA,OAAO,IAAI;EACb;EAEOE,SAASA,CAAA,EAAe;IAC7B,OAAO,IAAI,CAACtB,MAAM;EACpB;EAEOuB,SAASA,CAAA,EAAW;IACzB,OAAO,IAAAC,cAAY,EAAC,IAAI,CAACxB,MAAM,CAAC;EAClC;AACF;AAACyB,OAAA,CAAAC,OAAA,GAAA5B,aAAA","ignoreList":[]}
1
+ {"version":3,"file":"builder.js","names":[],"sources":["../src/builder.ts"],"sourcesContent":["import { merge } from 'lodash';\n\nimport type {\n AuthConf,\n ConfigYaml,\n LoggerConfigItem,\n PackageAccessYaml,\n Security,\n ServerSettingsConf,\n UpLinkConf,\n} from '@verdaccio/types';\n\nimport { fromJStoYAML } from '.';\n\n/**\n * Helper configuration builder constructor, used to build the configuration for testing or\n * programatically creating a configuration.\n */\nexport default class ConfigBuilder {\n private config: ConfigYaml;\n\n public constructor(config?: Partial<ConfigYaml>) {\n this.config = merge(config, { uplinks: {}, packages: {}, security: {} });\n }\n\n public static build(config?: Partial<ConfigYaml>): ConfigBuilder {\n return new ConfigBuilder(config);\n }\n\n public addPackageAccess(pattern: string, pkgAccess: PackageAccessYaml) {\n // @ts-ignore\n this.config.packages[pattern] = pkgAccess;\n return this;\n }\n\n public addUplink(id: string, uplink: UpLinkConf) {\n this.config.uplinks[id] = uplink;\n return this;\n }\n\n public addSecurity(security: Partial<Security>) {\n this.config.security = merge(this.config.security, security);\n return this;\n }\n\n public addAuth(auth: Partial<AuthConf>) {\n this.config.auth = merge(this.config.auth, auth);\n return this;\n }\n\n public addLogger(log: LoggerConfigItem) {\n this.config.log = log;\n return this;\n }\n\n public addServer(server: Partial<ServerSettingsConf>) {\n this.config.server = merge(this.config.server, server);\n return this;\n }\n\n public addStorage(storage: string | object) {\n if (typeof storage === 'string') {\n this.config.storage = storage;\n } else {\n this.config.store = storage;\n }\n return this;\n }\n\n public getConfig(): ConfigYaml {\n return this.config;\n }\n\n public getAsYaml(): string {\n return fromJStoYAML(this.config) as string;\n }\n}\n"],"mappings":";;;;;;;;;AAkBA,IAAqB,gBAArB,MAAqB,cAAc;CACjC;CAEA,YAAmB,QAA8B;AAC/C,OAAK,UAAA,GAAA,OAAA,OAAe,QAAQ;GAAE,SAAS,EAAE;GAAE,UAAU,EAAE;GAAE,UAAU,EAAE;GAAE,CAAC;;CAG1E,OAAc,MAAM,QAA6C;AAC/D,SAAO,IAAI,cAAc,OAAO;;CAGlC,iBAAwB,SAAiB,WAA8B;AAErE,OAAK,OAAO,SAAS,WAAW;AAChC,SAAO;;CAGT,UAAiB,IAAY,QAAoB;AAC/C,OAAK,OAAO,QAAQ,MAAM;AAC1B,SAAO;;CAGT,YAAmB,UAA6B;AAC9C,OAAK,OAAO,YAAA,GAAA,OAAA,OAAiB,KAAK,OAAO,UAAU,SAAS;AAC5D,SAAO;;CAGT,QAAe,MAAyB;AACtC,OAAK,OAAO,QAAA,GAAA,OAAA,OAAa,KAAK,OAAO,MAAM,KAAK;AAChD,SAAO;;CAGT,UAAiB,KAAuB;AACtC,OAAK,OAAO,MAAM;AAClB,SAAO;;CAGT,UAAiB,QAAqC;AACpD,OAAK,OAAO,UAAA,GAAA,OAAA,OAAe,KAAK,OAAO,QAAQ,OAAO;AACtD,SAAO;;CAGT,WAAkB,SAA0B;AAC1C,MAAI,OAAO,YAAY,SACrB,MAAK,OAAO,UAAU;MAEtB,MAAK,OAAO,QAAQ;AAEtB,SAAO;;CAGT,YAA+B;AAC7B,SAAO,KAAK;;CAGd,YAA2B;AACzB,SAAO,cAAA,aAAa,KAAK,OAAO"}