@verdaccio/config 9.0.0-next-9.16 → 9.0.0-next-9.18
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/build/address.js.map +1 -1
- package/build/address.mjs.map +1 -1
- package/build/agent.js +0 -1
- package/build/agent.js.map +1 -1
- package/build/agent.mjs.map +1 -1
- package/build/builder.js +0 -1
- package/build/builder.js.map +1 -1
- package/build/builder.mjs.map +1 -1
- package/build/conf/index.js +0 -1
- package/build/conf/index.js.map +1 -1
- package/build/conf/index.mjs.map +1 -1
- package/build/config-path.js.map +1 -1
- package/build/config-path.mjs.map +1 -1
- package/build/config-utils.js.map +1 -1
- package/build/config-utils.mjs.map +1 -1
- package/build/config.js.map +1 -1
- package/build/config.mjs.map +1 -1
- package/build/package-access.js.map +1 -1
- package/build/package-access.mjs.map +1 -1
- package/build/parse.js.map +1 -1
- package/build/parse.mjs.map +1 -1
- package/build/security.js.map +1 -1
- package/build/security.mjs.map +1 -1
- package/build/serverSettings.js.map +1 -1
- package/build/serverSettings.mjs.map +1 -1
- package/build/token.js +0 -1
- package/build/token.js.map +1 -1
- package/build/token.mjs.map +1 -1
- package/build/uplinks.js.map +1 -1
- package/build/uplinks.mjs.map +1 -1
- package/build/user.js.map +1 -1
- package/build/user.mjs.map +1 -1
- package/package.json +4 -4
package/build/address.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,0BAA0B;;;;;;;;;;;;;;;AAuBpD,SAAgB,aAAa,YAA0C;CAKrE,MAAM,aAAa,8DAA8D,KAAK,UAAU;CAEhG,IAAI,YACF,OAAO;EACL,OAAO,WAAW,MAAM,gBAAA;EACxB,MAAM,WAAW,MAAM,WAAW,MAAM,gBAAA;EACxC,MAAM,WAAW,MAAM,gBAAA;CACzB;CAGF,MAAM,cAAc,kCAAkC,KAAK,UAAU;CACrE,IAAI,CAAC,aAGH,OAAO;CAGT,OAAO;EACL,MAAM,YAAY;EAClB,OAAO,YAAY,MAAM;EACzB,MAAM,YAAY;CACpB;AACF;AAEA,SAAS,aAAa,GAA0B;CAC9C,OAAO,EAAE,UAAU,SAAS,QAAQ,EAAE,SAAS,GAAG,EAAE,MAAM,KAAK,EAAE,KAAK,GAAG,EAAE;AAC7E;;;;;;;;;;;;AAaA,SAAgB,iBACd,QACA,QACe;CACf,QAAM,mCAAmC,MAAM;CAE/C,IAAI,CAAC,QAAQ;EACX,QAAM,2CAA2C;EACjD,OAAO;GAAE,OAAO,gBAAA;GAAkB,MAAM,gBAAA;GAAgB,MAAM,gBAAA;EAAa;CAC7E;CAEA,IAAI,MAAM,QAAQ,MAAM,GAAG;EACzB,MAAM,iBAAiB,OAAO,QAAQ,SAAS,OAAO,SAAS,QAAQ;EAEvE,IAAI,eAAe,WAAW,GAC5B,MAAM,IAAI,MAAM,wCAAwC;EAG1D,MAAM,UAAoB,CAAC;EAC3B,MAAM,QAAyB,CAAC;EAEhC,KAAK,MAAM,OAAO,gBAAgB;GAChC,MAAM,YAAY,aAAa,GAAa;GAC5C,IAAI,WAAW;IACb,QAAM,kCAAkC,SAAS;IACjD,MAAM,KAAK,SAAS;GACtB,OAAO;IACL,QAAM,6BAA6B,GAAG;IACtC,QAAQ,KAAK,GAAa;GAC5B;EACF;EAEA,QAAQ,SAAS,QACf,OAAO,KACL,EAAE,MAAM,IAAI,GACZ,mKAGF,CACF;EAEA,IAAI,MAAM,WAAW,GACnB,MAAM,IAAI,MAAM,wDAAwD;EAG1E,MAAM,aAAa,MAAM;EAEzB,IAAI,OAAO,SAAS,GAClB,OAAO,KACL,0EAA0E,aACxE,UACF,GACF;EAGF,OAAO;CACT;CAEA,MAAM,SAAS,aAAa,MAAgB;CAC5C,IAAI,CAAC,QACH,MAAM,IAAI,MACR,qBAAqB,OAAO,mIAG9B;CAEF,OAAO;AACT"}
|
package/build/address.mjs.map
CHANGED
|
@@ -1 +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,
|
|
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,0BAA0B;;;;;;;;;;;;;;;AAuBpD,SAAgB,aAAa,YAA0C;CAKrE,MAAM,aAAa,8DAA8D,KAAK,UAAU;CAEhG,IAAI,YACF,OAAO;EACL,OAAO,WAAW,MAAM;EACxB,MAAM,WAAW,MAAM,WAAW,MAAM;EACxC,MAAM,WAAW,MAAM;CACzB;CAGF,MAAM,cAAc,kCAAkC,KAAK,UAAU;CACrE,IAAI,CAAC,aAGH,OAAO;CAGT,OAAO;EACL,MAAM,YAAY;EAClB,OAAO,YAAY,MAAM;EACzB,MAAM,YAAY;CACpB;AACF;AAEA,SAAS,aAAa,GAA0B;CAC9C,OAAO,EAAE,UAAU,SAAS,QAAQ,EAAE,SAAS,GAAG,EAAE,MAAM,KAAK,EAAE,KAAK,GAAG,EAAE;AAC7E;;;;;;;;;;;;AAaA,SAAgB,iBACd,QACA,QACe;CACf,MAAM,mCAAmC,MAAM;CAE/C,IAAI,CAAC,QAAQ;EACX,MAAM,2CAA2C;EACjD,OAAO;GAAE,OAAO;GAAkB,MAAM;GAAgB,MAAM;EAAa;CAC7E;CAEA,IAAI,MAAM,QAAQ,MAAM,GAAG;EACzB,MAAM,iBAAiB,OAAO,QAAQ,SAAS,OAAO,SAAS,QAAQ;EAEvE,IAAI,eAAe,WAAW,GAC5B,MAAM,IAAI,MAAM,wCAAwC;EAG1D,MAAM,UAAoB,CAAC;EAC3B,MAAM,QAAyB,CAAC;EAEhC,KAAK,MAAM,OAAO,gBAAgB;GAChC,MAAM,YAAY,aAAa,GAAa;GAC5C,IAAI,WAAW;IACb,MAAM,kCAAkC,SAAS;IACjD,MAAM,KAAK,SAAS;GACtB,OAAO;IACL,MAAM,6BAA6B,GAAG;IACtC,QAAQ,KAAK,GAAa;GAC5B;EACF;EAEA,QAAQ,SAAS,QACf,OAAO,KACL,EAAE,MAAM,IAAI,GACZ,mKAGF,CACF;EAEA,IAAI,MAAM,WAAW,GACnB,MAAM,IAAI,MAAM,wDAAwD;EAG1E,MAAM,aAAa,MAAM;EAEzB,IAAI,OAAO,SAAS,GAClB,OAAO,KACL,0EAA0E,aACxE,UACF,GACF;EAGF,OAAO;CACT;CAEA,MAAM,SAAS,aAAa,MAAgB;CAC5C,IAAI,CAAC,QACH,MAAM,IAAI,MACR,qBAAqB,OAAO,mIAG9B;CAEF,OAAO;AACT"}
|
package/build/agent.js
CHANGED
package/build/agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","names":[],"sources":["../src/agent.ts"],"sourcesContent":["import { isEmpty } from 'lodash-es';\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 (typeof customUserAgent === 'string' && isEmpty(customUserAgent) === false) {\n return customUserAgent;\n } else if (customUserAgent === false) {\n return 'hidden';\n }\n\n return `${name}/${version}`;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent.js","names":[],"sources":["../src/agent.ts"],"sourcesContent":["import { isEmpty } from 'lodash-es';\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 (typeof customUserAgent === 'string' && 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;CACR,IAAI,oBAAoB,MACtB,OAAO,GAAG,KAAK,GAAG;MACb,IAAI,OAAO,oBAAoB,aAAA,GAAA,UAAA,SAAoB,eAAe,MAAM,OAC7E,OAAO;MACF,IAAI,oBAAoB,OAC7B,OAAO;CAGT,OAAO,GAAG,KAAK,GAAG;AACpB"}
|
package/build/agent.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.mjs","names":[],"sources":["../src/agent.ts"],"sourcesContent":["import { isEmpty } from 'lodash-es';\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 (typeof customUserAgent === 'string' && 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;
|
|
1
|
+
{"version":3,"file":"agent.mjs","names":[],"sources":["../src/agent.ts"],"sourcesContent":["import { isEmpty } from 'lodash-es';\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 (typeof customUserAgent === 'string' && 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;CACR,IAAI,oBAAoB,MACtB,OAAO,GAAG,KAAK,GAAG;MACb,IAAI,OAAO,oBAAoB,YAAY,QAAQ,eAAe,MAAM,OAC7E,OAAO;MACF,IAAI,oBAAoB,OAC7B,OAAO;CAGT,OAAO,GAAG,KAAK,GAAG;AACpB"}
|
package/build/builder.js
CHANGED
package/build/builder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.js","names":[],"sources":["../src/builder.ts"],"sourcesContent":["import { merge } from 'lodash-es';\n\nimport type {\n AuthConf,\n ConfigYaml,\n FlagsConfig,\n HttpsConf,\n ListenAddress,\n LoggerConfigItem,\n Notifications,\n PackageAccessYaml,\n PublishOptions,\n RateLimit,\n Security,\n ServerSettingsConf,\n UpLinkConf,\n WebConf,\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({ uplinks: {}, packages: {}, security: {} }, config);\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 // PackageAccessYaml uses string for publish/access while PackageAccess uses string[]\n // The config parser normalizes these later, so the cast is safe here\n (this.config.packages as Record<string, PackageAccessYaml>)[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 addWeb(web: Partial<WebConf>) {\n this.config.web = merge(this.config.web, web);\n return this;\n }\n\n public addListen(listen: ListenAddress) {\n this.config.listen = listen;\n return this;\n }\n\n public addHttps(https: HttpsConf) {\n this.config.https = https;\n return this;\n }\n\n public addPublish(publish: Partial<PublishOptions>) {\n this.config.publish = merge(this.config.publish, publish);\n return this;\n }\n\n public addFlags(flags: Partial<FlagsConfig>) {\n this.config.flags = merge(this.config.flags, flags);\n return this;\n }\n\n public addNotify(notify: Notifications | Notifications[]) {\n this.config.notify = notify;\n return this;\n }\n\n public addMiddlewares(middlewares: any) {\n this.config.middlewares = merge(this.config.middlewares, middlewares);\n return this;\n }\n\n public addFilters(filters: any) {\n this.config.filters = merge(this.config.filters, filters);\n return this;\n }\n\n public addMaxBodySize(maxBodySize: string) {\n this.config.max_body_size = maxBodySize;\n return this;\n }\n\n public addUserRateLimit(rateLimit: RateLimit) {\n this.config.userRateLimit = merge(this.config.userRateLimit, rateLimit);\n return this;\n }\n\n public addUrlPrefix(urlPrefix: string) {\n this.config.url_prefix = urlPrefix;\n return this;\n }\n\n public addI18n(i18n: ConfigYaml['i18n']) {\n this.config.i18n = i18n;\n return this;\n }\n\n public addUserAgent(userAgent: string) {\n this.config.user_agent = userAgent;\n return this;\n }\n\n public addHttpProxy(httpProxy: string) {\n this.config.http_proxy = httpProxy;\n return this;\n }\n\n public addHttpsProxy(httpsProxy: string) {\n this.config.https_proxy = httpsProxy;\n return this;\n }\n\n public addNoProxy(noProxy: string) {\n this.config.no_proxy = noProxy;\n return this;\n }\n\n public addPlugins(plugins: string) {\n this.config.plugins = plugins;\n return this;\n }\n\n public addNotifications(notifications: Notifications) {\n this.config.notifications = notifications;\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":"
|
|
1
|
+
{"version":3,"file":"builder.js","names":[],"sources":["../src/builder.ts"],"sourcesContent":["import { merge } from 'lodash-es';\n\nimport type {\n AuthConf,\n ConfigYaml,\n FlagsConfig,\n HttpsConf,\n ListenAddress,\n LoggerConfigItem,\n Notifications,\n PackageAccessYaml,\n PublishOptions,\n RateLimit,\n Security,\n ServerSettingsConf,\n UpLinkConf,\n WebConf,\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({ uplinks: {}, packages: {}, security: {} }, config);\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 // PackageAccessYaml uses string for publish/access while PackageAccess uses string[]\n // The config parser normalizes these later, so the cast is safe here\n (this.config.packages as Record<string, PackageAccessYaml>)[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 addWeb(web: Partial<WebConf>) {\n this.config.web = merge(this.config.web, web);\n return this;\n }\n\n public addListen(listen: ListenAddress) {\n this.config.listen = listen;\n return this;\n }\n\n public addHttps(https: HttpsConf) {\n this.config.https = https;\n return this;\n }\n\n public addPublish(publish: Partial<PublishOptions>) {\n this.config.publish = merge(this.config.publish, publish);\n return this;\n }\n\n public addFlags(flags: Partial<FlagsConfig>) {\n this.config.flags = merge(this.config.flags, flags);\n return this;\n }\n\n public addNotify(notify: Notifications | Notifications[]) {\n this.config.notify = notify;\n return this;\n }\n\n public addMiddlewares(middlewares: any) {\n this.config.middlewares = merge(this.config.middlewares, middlewares);\n return this;\n }\n\n public addFilters(filters: any) {\n this.config.filters = merge(this.config.filters, filters);\n return this;\n }\n\n public addMaxBodySize(maxBodySize: string) {\n this.config.max_body_size = maxBodySize;\n return this;\n }\n\n public addUserRateLimit(rateLimit: RateLimit) {\n this.config.userRateLimit = merge(this.config.userRateLimit, rateLimit);\n return this;\n }\n\n public addUrlPrefix(urlPrefix: string) {\n this.config.url_prefix = urlPrefix;\n return this;\n }\n\n public addI18n(i18n: ConfigYaml['i18n']) {\n this.config.i18n = i18n;\n return this;\n }\n\n public addUserAgent(userAgent: string) {\n this.config.user_agent = userAgent;\n return this;\n }\n\n public addHttpProxy(httpProxy: string) {\n this.config.http_proxy = httpProxy;\n return this;\n }\n\n public addHttpsProxy(httpsProxy: string) {\n this.config.https_proxy = httpsProxy;\n return this;\n }\n\n public addNoProxy(noProxy: string) {\n this.config.no_proxy = noProxy;\n return this;\n }\n\n public addPlugins(plugins: string) {\n this.config.plugins = plugins;\n return this;\n }\n\n public addNotifications(notifications: Notifications) {\n this.config.notifications = notifications;\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":";;;;;;;;AAyBA,IAAqB,gBAArB,MAAqB,cAAc;CACjC;CAEA,YAAmB,QAA8B;EAC/C,KAAK,UAAA,GAAA,UAAA,OAAe;GAAE,SAAS,CAAC;GAAG,UAAU,CAAC;GAAG,UAAU,CAAC;EAAE,GAAG,MAAM;CACzE;CAEA,OAAc,MAAM,QAA6C;EAC/D,OAAO,IAAI,cAAc,MAAM;CACjC;CAEA,iBAAwB,SAAiB,WAA8B;EAGrE,KAAM,OAAO,SAA+C,WAAW;EACvE,OAAO;CACT;CAEA,UAAiB,IAAY,QAAoB;EAC/C,KAAK,OAAO,QAAQ,MAAM;EAC1B,OAAO;CACT;CAEA,YAAmB,UAA6B;EAC9C,KAAK,OAAO,YAAA,GAAA,UAAA,OAAiB,KAAK,OAAO,UAAU,QAAQ;EAC3D,OAAO;CACT;CAEA,QAAe,MAAyB;EACtC,KAAK,OAAO,QAAA,GAAA,UAAA,OAAa,KAAK,OAAO,MAAM,IAAI;EAC/C,OAAO;CACT;CAEA,UAAiB,KAAuB;EACtC,KAAK,OAAO,MAAM;EAClB,OAAO;CACT;CAEA,UAAiB,QAAqC;EACpD,KAAK,OAAO,UAAA,GAAA,UAAA,OAAe,KAAK,OAAO,QAAQ,MAAM;EACrD,OAAO;CACT;CAEA,WAAkB,SAA0B;EAC1C,IAAI,OAAO,YAAY,UACrB,KAAK,OAAO,UAAU;OAEtB,KAAK,OAAO,QAAQ;EAEtB,OAAO;CACT;CAEA,OAAc,KAAuB;EACnC,KAAK,OAAO,OAAA,GAAA,UAAA,OAAY,KAAK,OAAO,KAAK,GAAG;EAC5C,OAAO;CACT;CAEA,UAAiB,QAAuB;EACtC,KAAK,OAAO,SAAS;EACrB,OAAO;CACT;CAEA,SAAgB,OAAkB;EAChC,KAAK,OAAO,QAAQ;EACpB,OAAO;CACT;CAEA,WAAkB,SAAkC;EAClD,KAAK,OAAO,WAAA,GAAA,UAAA,OAAgB,KAAK,OAAO,SAAS,OAAO;EACxD,OAAO;CACT;CAEA,SAAgB,OAA6B;EAC3C,KAAK,OAAO,SAAA,GAAA,UAAA,OAAc,KAAK,OAAO,OAAO,KAAK;EAClD,OAAO;CACT;CAEA,UAAiB,QAAyC;EACxD,KAAK,OAAO,SAAS;EACrB,OAAO;CACT;CAEA,eAAsB,aAAkB;EACtC,KAAK,OAAO,eAAA,GAAA,UAAA,OAAoB,KAAK,OAAO,aAAa,WAAW;EACpE,OAAO;CACT;CAEA,WAAkB,SAAc;EAC9B,KAAK,OAAO,WAAA,GAAA,UAAA,OAAgB,KAAK,OAAO,SAAS,OAAO;EACxD,OAAO;CACT;CAEA,eAAsB,aAAqB;EACzC,KAAK,OAAO,gBAAgB;EAC5B,OAAO;CACT;CAEA,iBAAwB,WAAsB;EAC5C,KAAK,OAAO,iBAAA,GAAA,UAAA,OAAsB,KAAK,OAAO,eAAe,SAAS;EACtE,OAAO;CACT;CAEA,aAAoB,WAAmB;EACrC,KAAK,OAAO,aAAa;EACzB,OAAO;CACT;CAEA,QAAe,MAA0B;EACvC,KAAK,OAAO,OAAO;EACnB,OAAO;CACT;CAEA,aAAoB,WAAmB;EACrC,KAAK,OAAO,aAAa;EACzB,OAAO;CACT;CAEA,aAAoB,WAAmB;EACrC,KAAK,OAAO,aAAa;EACzB,OAAO;CACT;CAEA,cAAqB,YAAoB;EACvC,KAAK,OAAO,cAAc;EAC1B,OAAO;CACT;CAEA,WAAkB,SAAiB;EACjC,KAAK,OAAO,WAAW;EACvB,OAAO;CACT;CAEA,WAAkB,SAAiB;EACjC,KAAK,OAAO,UAAU;EACtB,OAAO;CACT;CAEA,iBAAwB,eAA8B;EACpD,KAAK,OAAO,gBAAgB;EAC5B,OAAO;CACT;CAEA,YAA+B;EAC7B,OAAO,KAAK;CACd;CAEA,YAA2B;EACzB,OAAO,cAAA,aAAa,KAAK,MAAM;CACjC;AACF"}
|
package/build/builder.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.mjs","names":[],"sources":["../src/builder.ts"],"sourcesContent":["import { merge } from 'lodash-es';\n\nimport type {\n AuthConf,\n ConfigYaml,\n FlagsConfig,\n HttpsConf,\n ListenAddress,\n LoggerConfigItem,\n Notifications,\n PackageAccessYaml,\n PublishOptions,\n RateLimit,\n Security,\n ServerSettingsConf,\n UpLinkConf,\n WebConf,\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({ uplinks: {}, packages: {}, security: {} }, config);\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 // PackageAccessYaml uses string for publish/access while PackageAccess uses string[]\n // The config parser normalizes these later, so the cast is safe here\n (this.config.packages as Record<string, PackageAccessYaml>)[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 addWeb(web: Partial<WebConf>) {\n this.config.web = merge(this.config.web, web);\n return this;\n }\n\n public addListen(listen: ListenAddress) {\n this.config.listen = listen;\n return this;\n }\n\n public addHttps(https: HttpsConf) {\n this.config.https = https;\n return this;\n }\n\n public addPublish(publish: Partial<PublishOptions>) {\n this.config.publish = merge(this.config.publish, publish);\n return this;\n }\n\n public addFlags(flags: Partial<FlagsConfig>) {\n this.config.flags = merge(this.config.flags, flags);\n return this;\n }\n\n public addNotify(notify: Notifications | Notifications[]) {\n this.config.notify = notify;\n return this;\n }\n\n public addMiddlewares(middlewares: any) {\n this.config.middlewares = merge(this.config.middlewares, middlewares);\n return this;\n }\n\n public addFilters(filters: any) {\n this.config.filters = merge(this.config.filters, filters);\n return this;\n }\n\n public addMaxBodySize(maxBodySize: string) {\n this.config.max_body_size = maxBodySize;\n return this;\n }\n\n public addUserRateLimit(rateLimit: RateLimit) {\n this.config.userRateLimit = merge(this.config.userRateLimit, rateLimit);\n return this;\n }\n\n public addUrlPrefix(urlPrefix: string) {\n this.config.url_prefix = urlPrefix;\n return this;\n }\n\n public addI18n(i18n: ConfigYaml['i18n']) {\n this.config.i18n = i18n;\n return this;\n }\n\n public addUserAgent(userAgent: string) {\n this.config.user_agent = userAgent;\n return this;\n }\n\n public addHttpProxy(httpProxy: string) {\n this.config.http_proxy = httpProxy;\n return this;\n }\n\n public addHttpsProxy(httpsProxy: string) {\n this.config.https_proxy = httpsProxy;\n return this;\n }\n\n public addNoProxy(noProxy: string) {\n this.config.no_proxy = noProxy;\n return this;\n }\n\n public addPlugins(plugins: string) {\n this.config.plugins = plugins;\n return this;\n }\n\n public addNotifications(notifications: Notifications) {\n this.config.notifications = notifications;\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":";;;;;;;;AAyBA,IAAqB,gBAArB,MAAqB,cAAc;CACjC;CAEA,YAAmB,QAA8B;
|
|
1
|
+
{"version":3,"file":"builder.mjs","names":[],"sources":["../src/builder.ts"],"sourcesContent":["import { merge } from 'lodash-es';\n\nimport type {\n AuthConf,\n ConfigYaml,\n FlagsConfig,\n HttpsConf,\n ListenAddress,\n LoggerConfigItem,\n Notifications,\n PackageAccessYaml,\n PublishOptions,\n RateLimit,\n Security,\n ServerSettingsConf,\n UpLinkConf,\n WebConf,\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({ uplinks: {}, packages: {}, security: {} }, config);\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 // PackageAccessYaml uses string for publish/access while PackageAccess uses string[]\n // The config parser normalizes these later, so the cast is safe here\n (this.config.packages as Record<string, PackageAccessYaml>)[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 addWeb(web: Partial<WebConf>) {\n this.config.web = merge(this.config.web, web);\n return this;\n }\n\n public addListen(listen: ListenAddress) {\n this.config.listen = listen;\n return this;\n }\n\n public addHttps(https: HttpsConf) {\n this.config.https = https;\n return this;\n }\n\n public addPublish(publish: Partial<PublishOptions>) {\n this.config.publish = merge(this.config.publish, publish);\n return this;\n }\n\n public addFlags(flags: Partial<FlagsConfig>) {\n this.config.flags = merge(this.config.flags, flags);\n return this;\n }\n\n public addNotify(notify: Notifications | Notifications[]) {\n this.config.notify = notify;\n return this;\n }\n\n public addMiddlewares(middlewares: any) {\n this.config.middlewares = merge(this.config.middlewares, middlewares);\n return this;\n }\n\n public addFilters(filters: any) {\n this.config.filters = merge(this.config.filters, filters);\n return this;\n }\n\n public addMaxBodySize(maxBodySize: string) {\n this.config.max_body_size = maxBodySize;\n return this;\n }\n\n public addUserRateLimit(rateLimit: RateLimit) {\n this.config.userRateLimit = merge(this.config.userRateLimit, rateLimit);\n return this;\n }\n\n public addUrlPrefix(urlPrefix: string) {\n this.config.url_prefix = urlPrefix;\n return this;\n }\n\n public addI18n(i18n: ConfigYaml['i18n']) {\n this.config.i18n = i18n;\n return this;\n }\n\n public addUserAgent(userAgent: string) {\n this.config.user_agent = userAgent;\n return this;\n }\n\n public addHttpProxy(httpProxy: string) {\n this.config.http_proxy = httpProxy;\n return this;\n }\n\n public addHttpsProxy(httpsProxy: string) {\n this.config.https_proxy = httpsProxy;\n return this;\n }\n\n public addNoProxy(noProxy: string) {\n this.config.no_proxy = noProxy;\n return this;\n }\n\n public addPlugins(plugins: string) {\n this.config.plugins = plugins;\n return this;\n }\n\n public addNotifications(notifications: Notifications) {\n this.config.notifications = notifications;\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":";;;;;;;;AAyBA,IAAqB,gBAArB,MAAqB,cAAc;CACjC;CAEA,YAAmB,QAA8B;EAC/C,KAAK,SAAS,MAAM;GAAE,SAAS,CAAC;GAAG,UAAU,CAAC;GAAG,UAAU,CAAC;EAAE,GAAG,MAAM;CACzE;CAEA,OAAc,MAAM,QAA6C;EAC/D,OAAO,IAAI,cAAc,MAAM;CACjC;CAEA,iBAAwB,SAAiB,WAA8B;EAGrE,KAAM,OAAO,SAA+C,WAAW;EACvE,OAAO;CACT;CAEA,UAAiB,IAAY,QAAoB;EAC/C,KAAK,OAAO,QAAQ,MAAM;EAC1B,OAAO;CACT;CAEA,YAAmB,UAA6B;EAC9C,KAAK,OAAO,WAAW,MAAM,KAAK,OAAO,UAAU,QAAQ;EAC3D,OAAO;CACT;CAEA,QAAe,MAAyB;EACtC,KAAK,OAAO,OAAO,MAAM,KAAK,OAAO,MAAM,IAAI;EAC/C,OAAO;CACT;CAEA,UAAiB,KAAuB;EACtC,KAAK,OAAO,MAAM;EAClB,OAAO;CACT;CAEA,UAAiB,QAAqC;EACpD,KAAK,OAAO,SAAS,MAAM,KAAK,OAAO,QAAQ,MAAM;EACrD,OAAO;CACT;CAEA,WAAkB,SAA0B;EAC1C,IAAI,OAAO,YAAY,UACrB,KAAK,OAAO,UAAU;OAEtB,KAAK,OAAO,QAAQ;EAEtB,OAAO;CACT;CAEA,OAAc,KAAuB;EACnC,KAAK,OAAO,MAAM,MAAM,KAAK,OAAO,KAAK,GAAG;EAC5C,OAAO;CACT;CAEA,UAAiB,QAAuB;EACtC,KAAK,OAAO,SAAS;EACrB,OAAO;CACT;CAEA,SAAgB,OAAkB;EAChC,KAAK,OAAO,QAAQ;EACpB,OAAO;CACT;CAEA,WAAkB,SAAkC;EAClD,KAAK,OAAO,UAAU,MAAM,KAAK,OAAO,SAAS,OAAO;EACxD,OAAO;CACT;CAEA,SAAgB,OAA6B;EAC3C,KAAK,OAAO,QAAQ,MAAM,KAAK,OAAO,OAAO,KAAK;EAClD,OAAO;CACT;CAEA,UAAiB,QAAyC;EACxD,KAAK,OAAO,SAAS;EACrB,OAAO;CACT;CAEA,eAAsB,aAAkB;EACtC,KAAK,OAAO,cAAc,MAAM,KAAK,OAAO,aAAa,WAAW;EACpE,OAAO;CACT;CAEA,WAAkB,SAAc;EAC9B,KAAK,OAAO,UAAU,MAAM,KAAK,OAAO,SAAS,OAAO;EACxD,OAAO;CACT;CAEA,eAAsB,aAAqB;EACzC,KAAK,OAAO,gBAAgB;EAC5B,OAAO;CACT;CAEA,iBAAwB,WAAsB;EAC5C,KAAK,OAAO,gBAAgB,MAAM,KAAK,OAAO,eAAe,SAAS;EACtE,OAAO;CACT;CAEA,aAAoB,WAAmB;EACrC,KAAK,OAAO,aAAa;EACzB,OAAO;CACT;CAEA,QAAe,MAA0B;EACvC,KAAK,OAAO,OAAO;EACnB,OAAO;CACT;CAEA,aAAoB,WAAmB;EACrC,KAAK,OAAO,aAAa;EACzB,OAAO;CACT;CAEA,aAAoB,WAAmB;EACrC,KAAK,OAAO,aAAa;EACzB,OAAO;CACT;CAEA,cAAqB,YAAoB;EACvC,KAAK,OAAO,cAAc;EAC1B,OAAO;CACT;CAEA,WAAkB,SAAiB;EACjC,KAAK,OAAO,WAAW;EACvB,OAAO;CACT;CAEA,WAAkB,SAAiB;EACjC,KAAK,OAAO,UAAU;EACtB,OAAO;CACT;CAEA,iBAAwB,eAA8B;EACpD,KAAK,OAAO,gBAAgB;EAC5B,OAAO;CACT;CAEA,YAA+B;EAC7B,OAAO,KAAK;CACd;CAEA,YAA2B;EACzB,OAAO,aAAa,KAAK,MAAM;CACjC;AACF"}
|
package/build/conf/index.js
CHANGED
package/build/conf/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/conf/index.ts"],"sourcesContent":["import { join } from 'node:path';\n\nimport { parseConfigFile } from '../parse';\n\nconst currentDir = typeof __dirname !== 'undefined' ? __dirname : import.meta.dirname;\n\nexport function getDefaultConfig(fileName: string = 'default.yaml') {\n const file = join(currentDir, `./${fileName}`);\n return parseConfigFile(file);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/conf/index.ts"],"sourcesContent":["import { join } from 'node:path';\n\nimport { parseConfigFile } from '../parse';\n\nconst currentDir = typeof __dirname !== 'undefined' ? __dirname : import.meta.dirname;\n\nexport function getDefaultConfig(fileName: string = 'default.yaml') {\n const file = join(currentDir, `./${fileName}`);\n return parseConfigFile(file);\n}\n"],"mappings":";;;AAIA,IAAM,aAAa,OAAO,cAAc,cAAc,YAAA,CAAA,EAAwB;AAE9E,SAAgB,iBAAiB,WAAmB,gBAAgB;CAElE,OAAO,cAAA,iBAAA,GAAA,UAAA,MADW,YAAY,KAAK,UACZ,CAAI;AAC7B"}
|
package/build/conf/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/conf/index.ts"],"sourcesContent":["import { join } from 'node:path';\n\nimport { parseConfigFile } from '../parse';\n\nconst currentDir = typeof __dirname !== 'undefined' ? __dirname : import.meta.dirname;\n\nexport function getDefaultConfig(fileName: string = 'default.yaml') {\n const file = join(currentDir, `./${fileName}`);\n return parseConfigFile(file);\n}\n"],"mappings":";;;AAIA,IAAM,aAAa,OAAO,cAAc,cAAc,YAAY,OAAO,KAAK;AAE9E,SAAgB,iBAAiB,WAAmB,gBAAgB;
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/conf/index.ts"],"sourcesContent":["import { join } from 'node:path';\n\nimport { parseConfigFile } from '../parse';\n\nconst currentDir = typeof __dirname !== 'undefined' ? __dirname : import.meta.dirname;\n\nexport function getDefaultConfig(fileName: string = 'default.yaml') {\n const file = join(currentDir, `./${fileName}`);\n return parseConfigFile(file);\n}\n"],"mappings":";;;AAIA,IAAM,aAAa,OAAO,cAAc,cAAc,YAAY,OAAO,KAAK;AAE9E,SAAgB,iBAAiB,WAAmB,gBAAgB;CAElE,OAAO,gBADM,KAAK,YAAY,KAAK,UACZ,CAAI;AAC7B"}
|
package/build/config-path.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-path.js","names":[],"sources":["../src/config-path.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { find } from 'lodash-es';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nimport { fileExists, folderExists } from './config-utils';\n\nconst CONFIG_FILE = 'config.yaml';\nconst XDG = 'xdg';\n\nconst pkgJSON = {\n name: 'verdaccio',\n};\n\nexport type SetupDirectory = {\n path: string;\n type: 'xdg' | 'win' | 'win32' | 'def' | 'old';\n};\n\nconst debug = buildDebug('verdaccio:config:config-path');\n\n/**\n * Find and get the first config file that match.\n * @return {String} the config file path\n */\nfunction findConfigFile(configPath?: string): string {\n debug('searching for config file %o', configPath);\n if (typeof configPath !== 'undefined') {\n const configLocation = path.resolve(configPath);\n debug('custom location %s', configLocation);\n return configLocation;\n }\n\n const configPaths: SetupDirectory[] = getConfigPaths();\n debug('%o posible locations found', configPaths.length);\n if (configPaths.length === 0) {\n debug('no configuration files can be processed');\n // this should never happens\n throw new Error('no configuration files can be processed');\n }\n\n // find the first location that already exist\n const primaryConf: SetupDirectory | void = find(configPaths, (configLocation: SetupDirectory) =>\n fileExists(configLocation.path)\n );\n\n if (typeof primaryConf !== 'undefined') {\n debug('at least one primary location detected at %s', primaryConf?.path);\n return primaryConf.path;\n }\n debug('no previous location found, creating a new one');\n debug('generating the first match path location %s', configPaths[0].path);\n return createConfigFile(configPaths[0]).path;\n}\n\nfunction createConfigFile(configLocation: SetupDirectory): SetupDirectory {\n createConfigFolder(configLocation);\n\n const defaultConfig = updateStorageLinks(configLocation, readDefaultConfig());\n\n fs.writeFileSync(configLocation.path, defaultConfig);\n\n return configLocation;\n}\n\nexport function readDefaultConfig(): string {\n const currentDir = typeof __dirname !== 'undefined' ? __dirname : import.meta.dirname;\n const pathDefaultConf: string = path.resolve(currentDir, 'conf/default.yaml');\n try {\n debug('the path of default config used from %s', pathDefaultConf);\n fs.accessSync(pathDefaultConf, fs.constants.R_OK);\n debug('configuration file has enough permissions for reading');\n } catch {\n debug('configuration file does not have enough permissions for reading');\n throw new TypeError('configuration file does not have enough permissions for reading');\n }\n\n return fs.readFileSync(pathDefaultConf, 'utf8');\n}\n\nfunction createConfigFolder(configLocation: SetupDirectory): void {\n const folder = path.dirname(configLocation.path);\n debug(`creating default config file folder at %o`, folder);\n fs.mkdirSync(folder, { recursive: true });\n debug(`folder %o created`, folder);\n}\n\n/**\n * Update the storage links to the new location if it is necessary.\n * @param configLocation\n * @param defaultConfig\n * @returns\n */\nfunction updateStorageLinks(configLocation: SetupDirectory, defaultConfig: string): string {\n debug('checking storage links for %s and type %s', configLocation.path, configLocation.type);\n if (configLocation.type !== XDG) {\n debug(`skip storage override for %s`, configLocation.type);\n return defaultConfig;\n }\n\n // $XDG_DATA_HOME defines the base directory relative to which user specific data\n // files should be stored, If $XDG_DATA_HOME is either not set or empty, a default\n // equal to $HOME/.local/share should be used.\n let dataDir =\n process.env.XDG_DATA_HOME || path.join(process.env.HOME as string, '.local', 'share');\n if (folderExists(dataDir)) {\n debug(`previous storage located`);\n debug(`update storage links to %s`, dataDir);\n dataDir = path.resolve(path.join(dataDir, pkgJSON.name, 'storage'));\n return defaultConfig.replace(/^storage: .\\/storage$/m, `storage: ${dataDir}`);\n }\n debug(`could not find a previous storage location, skip override`);\n return defaultConfig;\n}\n\n/**\n * Return a list of configuration locations by platform.\n * @returns\n */\nfunction getConfigPaths(): SetupDirectory[] {\n const listPaths: (SetupDirectory | void)[] = [\n getXDGDirectory(),\n getWindowsDirectory(),\n getRelativeDefaultDirectory(),\n getOldDirectory(),\n ];\n\n return listPaths.reduce(function (acc, currentValue: SetupDirectory | void): SetupDirectory[] {\n if (typeof currentValue !== 'undefined') {\n debug(\n 'posible directory path generated %s for type %s',\n currentValue?.path,\n currentValue.type\n );\n acc.push(currentValue);\n }\n return acc;\n }, [] as SetupDirectory[]);\n}\n\n/**\n * Get XDG_CONFIG_HOME or HOME location (usually unix)\n *\n * The XDG_CONFIG_HOME environment variable is also part of the XDG Base Directory Specification,\n * which aims to standardize the locations where applications store configuration files and other\n * user-specific data on Unix-like operating systems.\n *\n *\n *\n * https://specifications.freedesktop.org/basedir-spec/latest/\n *\n *\n * @returns\n */\nconst getXDGDirectory = (): SetupDirectory | void => {\n const xDGConfigPath =\n process.env.XDG_CONFIG_HOME || (process.env.HOME && path.join(process.env.HOME, '.config'));\n debug('XDGConfig folder path %s', xDGConfigPath);\n if (xDGConfigPath && folderExists(xDGConfigPath)) {\n debug('XDGConfig folder path %s', xDGConfigPath);\n return {\n path: path.join(xDGConfigPath, pkgJSON.name, CONFIG_FILE),\n type: XDG,\n };\n }\n};\n\n/**\n * Detect windows location, APPDATA\n * usually something like C:\\User\\<Build User>\\AppData\\Local\n * @returns\n */\nconst getWindowsDirectory = (): SetupDirectory | void => {\n if (os.platform() === 'win32' && process.env.APPDATA && folderExists(process.env.APPDATA)) {\n debug('windows appdata folder path %s', process.env.APPDATA);\n return {\n path: path.resolve(path.join(process.env.APPDATA, pkgJSON.name, CONFIG_FILE)),\n type: 'win',\n };\n }\n};\n\n/**\n * Return relative directory, this is the default.\n * It will cretate config in your {currentLocation/verdaccio/config.yaml}\n * @returns\n */\nconst getRelativeDefaultDirectory = (): SetupDirectory => {\n const relativePath = path.resolve(path.join('.', pkgJSON.name, CONFIG_FILE));\n debug('relative folder path %s', relativePath);\n return {\n path: relativePath,\n type: 'def',\n };\n};\n\n/**\n * This should never happens, consider it DEPRECATED\n * @returns\n */\nconst getOldDirectory = (): SetupDirectory => {\n const oldPath = path.resolve(path.join('.', CONFIG_FILE));\n debug('old folder path %s', oldPath);\n return {\n path: oldPath,\n type: 'old',\n };\n};\n\nexport { findConfigFile };\n"],"mappings":";;;;;;;;;;;;AAQA,IAAM,cAAc;AACpB,IAAM,MAAM;AAEZ,IAAM,UAAU,EACd,MAAM,
|
|
1
|
+
{"version":3,"file":"config-path.js","names":[],"sources":["../src/config-path.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { find } from 'lodash-es';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nimport { fileExists, folderExists } from './config-utils';\n\nconst CONFIG_FILE = 'config.yaml';\nconst XDG = 'xdg';\n\nconst pkgJSON = {\n name: 'verdaccio',\n};\n\nexport type SetupDirectory = {\n path: string;\n type: 'xdg' | 'win' | 'win32' | 'def' | 'old';\n};\n\nconst debug = buildDebug('verdaccio:config:config-path');\n\n/**\n * Find and get the first config file that match.\n * @return {String} the config file path\n */\nfunction findConfigFile(configPath?: string): string {\n debug('searching for config file %o', configPath);\n if (typeof configPath !== 'undefined') {\n const configLocation = path.resolve(configPath);\n debug('custom location %s', configLocation);\n return configLocation;\n }\n\n const configPaths: SetupDirectory[] = getConfigPaths();\n debug('%o posible locations found', configPaths.length);\n if (configPaths.length === 0) {\n debug('no configuration files can be processed');\n // this should never happens\n throw new Error('no configuration files can be processed');\n }\n\n // find the first location that already exist\n const primaryConf: SetupDirectory | void = find(configPaths, (configLocation: SetupDirectory) =>\n fileExists(configLocation.path)\n );\n\n if (typeof primaryConf !== 'undefined') {\n debug('at least one primary location detected at %s', primaryConf?.path);\n return primaryConf.path;\n }\n debug('no previous location found, creating a new one');\n debug('generating the first match path location %s', configPaths[0].path);\n return createConfigFile(configPaths[0]).path;\n}\n\nfunction createConfigFile(configLocation: SetupDirectory): SetupDirectory {\n createConfigFolder(configLocation);\n\n const defaultConfig = updateStorageLinks(configLocation, readDefaultConfig());\n\n fs.writeFileSync(configLocation.path, defaultConfig);\n\n return configLocation;\n}\n\nexport function readDefaultConfig(): string {\n const currentDir = typeof __dirname !== 'undefined' ? __dirname : import.meta.dirname;\n const pathDefaultConf: string = path.resolve(currentDir, 'conf/default.yaml');\n try {\n debug('the path of default config used from %s', pathDefaultConf);\n fs.accessSync(pathDefaultConf, fs.constants.R_OK);\n debug('configuration file has enough permissions for reading');\n } catch {\n debug('configuration file does not have enough permissions for reading');\n throw new TypeError('configuration file does not have enough permissions for reading');\n }\n\n return fs.readFileSync(pathDefaultConf, 'utf8');\n}\n\nfunction createConfigFolder(configLocation: SetupDirectory): void {\n const folder = path.dirname(configLocation.path);\n debug(`creating default config file folder at %o`, folder);\n fs.mkdirSync(folder, { recursive: true });\n debug(`folder %o created`, folder);\n}\n\n/**\n * Update the storage links to the new location if it is necessary.\n * @param configLocation\n * @param defaultConfig\n * @returns\n */\nfunction updateStorageLinks(configLocation: SetupDirectory, defaultConfig: string): string {\n debug('checking storage links for %s and type %s', configLocation.path, configLocation.type);\n if (configLocation.type !== XDG) {\n debug(`skip storage override for %s`, configLocation.type);\n return defaultConfig;\n }\n\n // $XDG_DATA_HOME defines the base directory relative to which user specific data\n // files should be stored, If $XDG_DATA_HOME is either not set or empty, a default\n // equal to $HOME/.local/share should be used.\n let dataDir =\n process.env.XDG_DATA_HOME || path.join(process.env.HOME as string, '.local', 'share');\n if (folderExists(dataDir)) {\n debug(`previous storage located`);\n debug(`update storage links to %s`, dataDir);\n dataDir = path.resolve(path.join(dataDir, pkgJSON.name, 'storage'));\n return defaultConfig.replace(/^storage: .\\/storage$/m, `storage: ${dataDir}`);\n }\n debug(`could not find a previous storage location, skip override`);\n return defaultConfig;\n}\n\n/**\n * Return a list of configuration locations by platform.\n * @returns\n */\nfunction getConfigPaths(): SetupDirectory[] {\n const listPaths: (SetupDirectory | void)[] = [\n getXDGDirectory(),\n getWindowsDirectory(),\n getRelativeDefaultDirectory(),\n getOldDirectory(),\n ];\n\n return listPaths.reduce(function (acc, currentValue: SetupDirectory | void): SetupDirectory[] {\n if (typeof currentValue !== 'undefined') {\n debug(\n 'posible directory path generated %s for type %s',\n currentValue?.path,\n currentValue.type\n );\n acc.push(currentValue);\n }\n return acc;\n }, [] as SetupDirectory[]);\n}\n\n/**\n * Get XDG_CONFIG_HOME or HOME location (usually unix)\n *\n * The XDG_CONFIG_HOME environment variable is also part of the XDG Base Directory Specification,\n * which aims to standardize the locations where applications store configuration files and other\n * user-specific data on Unix-like operating systems.\n *\n *\n *\n * https://specifications.freedesktop.org/basedir-spec/latest/\n *\n *\n * @returns\n */\nconst getXDGDirectory = (): SetupDirectory | void => {\n const xDGConfigPath =\n process.env.XDG_CONFIG_HOME || (process.env.HOME && path.join(process.env.HOME, '.config'));\n debug('XDGConfig folder path %s', xDGConfigPath);\n if (xDGConfigPath && folderExists(xDGConfigPath)) {\n debug('XDGConfig folder path %s', xDGConfigPath);\n return {\n path: path.join(xDGConfigPath, pkgJSON.name, CONFIG_FILE),\n type: XDG,\n };\n }\n};\n\n/**\n * Detect windows location, APPDATA\n * usually something like C:\\User\\<Build User>\\AppData\\Local\n * @returns\n */\nconst getWindowsDirectory = (): SetupDirectory | void => {\n if (os.platform() === 'win32' && process.env.APPDATA && folderExists(process.env.APPDATA)) {\n debug('windows appdata folder path %s', process.env.APPDATA);\n return {\n path: path.resolve(path.join(process.env.APPDATA, pkgJSON.name, CONFIG_FILE)),\n type: 'win',\n };\n }\n};\n\n/**\n * Return relative directory, this is the default.\n * It will cretate config in your {currentLocation/verdaccio/config.yaml}\n * @returns\n */\nconst getRelativeDefaultDirectory = (): SetupDirectory => {\n const relativePath = path.resolve(path.join('.', pkgJSON.name, CONFIG_FILE));\n debug('relative folder path %s', relativePath);\n return {\n path: relativePath,\n type: 'def',\n };\n};\n\n/**\n * This should never happens, consider it DEPRECATED\n * @returns\n */\nconst getOldDirectory = (): SetupDirectory => {\n const oldPath = path.resolve(path.join('.', CONFIG_FILE));\n debug('old folder path %s', oldPath);\n return {\n path: oldPath,\n type: 'old',\n };\n};\n\nexport { findConfigFile };\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-path.mjs","names":[],"sources":["../src/config-path.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { find } from 'lodash-es';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nimport { fileExists, folderExists } from './config-utils';\n\nconst CONFIG_FILE = 'config.yaml';\nconst XDG = 'xdg';\n\nconst pkgJSON = {\n name: 'verdaccio',\n};\n\nexport type SetupDirectory = {\n path: string;\n type: 'xdg' | 'win' | 'win32' | 'def' | 'old';\n};\n\nconst debug = buildDebug('verdaccio:config:config-path');\n\n/**\n * Find and get the first config file that match.\n * @return {String} the config file path\n */\nfunction findConfigFile(configPath?: string): string {\n debug('searching for config file %o', configPath);\n if (typeof configPath !== 'undefined') {\n const configLocation = path.resolve(configPath);\n debug('custom location %s', configLocation);\n return configLocation;\n }\n\n const configPaths: SetupDirectory[] = getConfigPaths();\n debug('%o posible locations found', configPaths.length);\n if (configPaths.length === 0) {\n debug('no configuration files can be processed');\n // this should never happens\n throw new Error('no configuration files can be processed');\n }\n\n // find the first location that already exist\n const primaryConf: SetupDirectory | void = find(configPaths, (configLocation: SetupDirectory) =>\n fileExists(configLocation.path)\n );\n\n if (typeof primaryConf !== 'undefined') {\n debug('at least one primary location detected at %s', primaryConf?.path);\n return primaryConf.path;\n }\n debug('no previous location found, creating a new one');\n debug('generating the first match path location %s', configPaths[0].path);\n return createConfigFile(configPaths[0]).path;\n}\n\nfunction createConfigFile(configLocation: SetupDirectory): SetupDirectory {\n createConfigFolder(configLocation);\n\n const defaultConfig = updateStorageLinks(configLocation, readDefaultConfig());\n\n fs.writeFileSync(configLocation.path, defaultConfig);\n\n return configLocation;\n}\n\nexport function readDefaultConfig(): string {\n const currentDir = typeof __dirname !== 'undefined' ? __dirname : import.meta.dirname;\n const pathDefaultConf: string = path.resolve(currentDir, 'conf/default.yaml');\n try {\n debug('the path of default config used from %s', pathDefaultConf);\n fs.accessSync(pathDefaultConf, fs.constants.R_OK);\n debug('configuration file has enough permissions for reading');\n } catch {\n debug('configuration file does not have enough permissions for reading');\n throw new TypeError('configuration file does not have enough permissions for reading');\n }\n\n return fs.readFileSync(pathDefaultConf, 'utf8');\n}\n\nfunction createConfigFolder(configLocation: SetupDirectory): void {\n const folder = path.dirname(configLocation.path);\n debug(`creating default config file folder at %o`, folder);\n fs.mkdirSync(folder, { recursive: true });\n debug(`folder %o created`, folder);\n}\n\n/**\n * Update the storage links to the new location if it is necessary.\n * @param configLocation\n * @param defaultConfig\n * @returns\n */\nfunction updateStorageLinks(configLocation: SetupDirectory, defaultConfig: string): string {\n debug('checking storage links for %s and type %s', configLocation.path, configLocation.type);\n if (configLocation.type !== XDG) {\n debug(`skip storage override for %s`, configLocation.type);\n return defaultConfig;\n }\n\n // $XDG_DATA_HOME defines the base directory relative to which user specific data\n // files should be stored, If $XDG_DATA_HOME is either not set or empty, a default\n // equal to $HOME/.local/share should be used.\n let dataDir =\n process.env.XDG_DATA_HOME || path.join(process.env.HOME as string, '.local', 'share');\n if (folderExists(dataDir)) {\n debug(`previous storage located`);\n debug(`update storage links to %s`, dataDir);\n dataDir = path.resolve(path.join(dataDir, pkgJSON.name, 'storage'));\n return defaultConfig.replace(/^storage: .\\/storage$/m, `storage: ${dataDir}`);\n }\n debug(`could not find a previous storage location, skip override`);\n return defaultConfig;\n}\n\n/**\n * Return a list of configuration locations by platform.\n * @returns\n */\nfunction getConfigPaths(): SetupDirectory[] {\n const listPaths: (SetupDirectory | void)[] = [\n getXDGDirectory(),\n getWindowsDirectory(),\n getRelativeDefaultDirectory(),\n getOldDirectory(),\n ];\n\n return listPaths.reduce(function (acc, currentValue: SetupDirectory | void): SetupDirectory[] {\n if (typeof currentValue !== 'undefined') {\n debug(\n 'posible directory path generated %s for type %s',\n currentValue?.path,\n currentValue.type\n );\n acc.push(currentValue);\n }\n return acc;\n }, [] as SetupDirectory[]);\n}\n\n/**\n * Get XDG_CONFIG_HOME or HOME location (usually unix)\n *\n * The XDG_CONFIG_HOME environment variable is also part of the XDG Base Directory Specification,\n * which aims to standardize the locations where applications store configuration files and other\n * user-specific data on Unix-like operating systems.\n *\n *\n *\n * https://specifications.freedesktop.org/basedir-spec/latest/\n *\n *\n * @returns\n */\nconst getXDGDirectory = (): SetupDirectory | void => {\n const xDGConfigPath =\n process.env.XDG_CONFIG_HOME || (process.env.HOME && path.join(process.env.HOME, '.config'));\n debug('XDGConfig folder path %s', xDGConfigPath);\n if (xDGConfigPath && folderExists(xDGConfigPath)) {\n debug('XDGConfig folder path %s', xDGConfigPath);\n return {\n path: path.join(xDGConfigPath, pkgJSON.name, CONFIG_FILE),\n type: XDG,\n };\n }\n};\n\n/**\n * Detect windows location, APPDATA\n * usually something like C:\\User\\<Build User>\\AppData\\Local\n * @returns\n */\nconst getWindowsDirectory = (): SetupDirectory | void => {\n if (os.platform() === 'win32' && process.env.APPDATA && folderExists(process.env.APPDATA)) {\n debug('windows appdata folder path %s', process.env.APPDATA);\n return {\n path: path.resolve(path.join(process.env.APPDATA, pkgJSON.name, CONFIG_FILE)),\n type: 'win',\n };\n }\n};\n\n/**\n * Return relative directory, this is the default.\n * It will cretate config in your {currentLocation/verdaccio/config.yaml}\n * @returns\n */\nconst getRelativeDefaultDirectory = (): SetupDirectory => {\n const relativePath = path.resolve(path.join('.', pkgJSON.name, CONFIG_FILE));\n debug('relative folder path %s', relativePath);\n return {\n path: relativePath,\n type: 'def',\n };\n};\n\n/**\n * This should never happens, consider it DEPRECATED\n * @returns\n */\nconst getOldDirectory = (): SetupDirectory => {\n const oldPath = path.resolve(path.join('.', CONFIG_FILE));\n debug('old folder path %s', oldPath);\n return {\n path: oldPath,\n type: 'old',\n };\n};\n\nexport { findConfigFile };\n"],"mappings":";;;;;;;AAQA,IAAM,cAAc;AACpB,IAAM,MAAM;AAEZ,IAAM,UAAU,EACd,MAAM,
|
|
1
|
+
{"version":3,"file":"config-path.mjs","names":[],"sources":["../src/config-path.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { find } from 'lodash-es';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nimport { fileExists, folderExists } from './config-utils';\n\nconst CONFIG_FILE = 'config.yaml';\nconst XDG = 'xdg';\n\nconst pkgJSON = {\n name: 'verdaccio',\n};\n\nexport type SetupDirectory = {\n path: string;\n type: 'xdg' | 'win' | 'win32' | 'def' | 'old';\n};\n\nconst debug = buildDebug('verdaccio:config:config-path');\n\n/**\n * Find and get the first config file that match.\n * @return {String} the config file path\n */\nfunction findConfigFile(configPath?: string): string {\n debug('searching for config file %o', configPath);\n if (typeof configPath !== 'undefined') {\n const configLocation = path.resolve(configPath);\n debug('custom location %s', configLocation);\n return configLocation;\n }\n\n const configPaths: SetupDirectory[] = getConfigPaths();\n debug('%o posible locations found', configPaths.length);\n if (configPaths.length === 0) {\n debug('no configuration files can be processed');\n // this should never happens\n throw new Error('no configuration files can be processed');\n }\n\n // find the first location that already exist\n const primaryConf: SetupDirectory | void = find(configPaths, (configLocation: SetupDirectory) =>\n fileExists(configLocation.path)\n );\n\n if (typeof primaryConf !== 'undefined') {\n debug('at least one primary location detected at %s', primaryConf?.path);\n return primaryConf.path;\n }\n debug('no previous location found, creating a new one');\n debug('generating the first match path location %s', configPaths[0].path);\n return createConfigFile(configPaths[0]).path;\n}\n\nfunction createConfigFile(configLocation: SetupDirectory): SetupDirectory {\n createConfigFolder(configLocation);\n\n const defaultConfig = updateStorageLinks(configLocation, readDefaultConfig());\n\n fs.writeFileSync(configLocation.path, defaultConfig);\n\n return configLocation;\n}\n\nexport function readDefaultConfig(): string {\n const currentDir = typeof __dirname !== 'undefined' ? __dirname : import.meta.dirname;\n const pathDefaultConf: string = path.resolve(currentDir, 'conf/default.yaml');\n try {\n debug('the path of default config used from %s', pathDefaultConf);\n fs.accessSync(pathDefaultConf, fs.constants.R_OK);\n debug('configuration file has enough permissions for reading');\n } catch {\n debug('configuration file does not have enough permissions for reading');\n throw new TypeError('configuration file does not have enough permissions for reading');\n }\n\n return fs.readFileSync(pathDefaultConf, 'utf8');\n}\n\nfunction createConfigFolder(configLocation: SetupDirectory): void {\n const folder = path.dirname(configLocation.path);\n debug(`creating default config file folder at %o`, folder);\n fs.mkdirSync(folder, { recursive: true });\n debug(`folder %o created`, folder);\n}\n\n/**\n * Update the storage links to the new location if it is necessary.\n * @param configLocation\n * @param defaultConfig\n * @returns\n */\nfunction updateStorageLinks(configLocation: SetupDirectory, defaultConfig: string): string {\n debug('checking storage links for %s and type %s', configLocation.path, configLocation.type);\n if (configLocation.type !== XDG) {\n debug(`skip storage override for %s`, configLocation.type);\n return defaultConfig;\n }\n\n // $XDG_DATA_HOME defines the base directory relative to which user specific data\n // files should be stored, If $XDG_DATA_HOME is either not set or empty, a default\n // equal to $HOME/.local/share should be used.\n let dataDir =\n process.env.XDG_DATA_HOME || path.join(process.env.HOME as string, '.local', 'share');\n if (folderExists(dataDir)) {\n debug(`previous storage located`);\n debug(`update storage links to %s`, dataDir);\n dataDir = path.resolve(path.join(dataDir, pkgJSON.name, 'storage'));\n return defaultConfig.replace(/^storage: .\\/storage$/m, `storage: ${dataDir}`);\n }\n debug(`could not find a previous storage location, skip override`);\n return defaultConfig;\n}\n\n/**\n * Return a list of configuration locations by platform.\n * @returns\n */\nfunction getConfigPaths(): SetupDirectory[] {\n const listPaths: (SetupDirectory | void)[] = [\n getXDGDirectory(),\n getWindowsDirectory(),\n getRelativeDefaultDirectory(),\n getOldDirectory(),\n ];\n\n return listPaths.reduce(function (acc, currentValue: SetupDirectory | void): SetupDirectory[] {\n if (typeof currentValue !== 'undefined') {\n debug(\n 'posible directory path generated %s for type %s',\n currentValue?.path,\n currentValue.type\n );\n acc.push(currentValue);\n }\n return acc;\n }, [] as SetupDirectory[]);\n}\n\n/**\n * Get XDG_CONFIG_HOME or HOME location (usually unix)\n *\n * The XDG_CONFIG_HOME environment variable is also part of the XDG Base Directory Specification,\n * which aims to standardize the locations where applications store configuration files and other\n * user-specific data on Unix-like operating systems.\n *\n *\n *\n * https://specifications.freedesktop.org/basedir-spec/latest/\n *\n *\n * @returns\n */\nconst getXDGDirectory = (): SetupDirectory | void => {\n const xDGConfigPath =\n process.env.XDG_CONFIG_HOME || (process.env.HOME && path.join(process.env.HOME, '.config'));\n debug('XDGConfig folder path %s', xDGConfigPath);\n if (xDGConfigPath && folderExists(xDGConfigPath)) {\n debug('XDGConfig folder path %s', xDGConfigPath);\n return {\n path: path.join(xDGConfigPath, pkgJSON.name, CONFIG_FILE),\n type: XDG,\n };\n }\n};\n\n/**\n * Detect windows location, APPDATA\n * usually something like C:\\User\\<Build User>\\AppData\\Local\n * @returns\n */\nconst getWindowsDirectory = (): SetupDirectory | void => {\n if (os.platform() === 'win32' && process.env.APPDATA && folderExists(process.env.APPDATA)) {\n debug('windows appdata folder path %s', process.env.APPDATA);\n return {\n path: path.resolve(path.join(process.env.APPDATA, pkgJSON.name, CONFIG_FILE)),\n type: 'win',\n };\n }\n};\n\n/**\n * Return relative directory, this is the default.\n * It will cretate config in your {currentLocation/verdaccio/config.yaml}\n * @returns\n */\nconst getRelativeDefaultDirectory = (): SetupDirectory => {\n const relativePath = path.resolve(path.join('.', pkgJSON.name, CONFIG_FILE));\n debug('relative folder path %s', relativePath);\n return {\n path: relativePath,\n type: 'def',\n };\n};\n\n/**\n * This should never happens, consider it DEPRECATED\n * @returns\n */\nconst getOldDirectory = (): SetupDirectory => {\n const oldPath = path.resolve(path.join('.', CONFIG_FILE));\n debug('old folder path %s', oldPath);\n return {\n path: oldPath,\n type: 'old',\n };\n};\n\nexport { findConfigFile };\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-utils.js","names":[],"sources":["../src/config-utils.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport fs from 'node:fs';\n\nconst debug = buildDebug('verdaccio:config:config-utils');\n\n/**\n * Check whether the path already exist.\n * @param {String} path\n * @return {Boolean}\n */\nexport function folderExists(path: string): boolean {\n try {\n debug('check folder exist', path);\n const stat = fs.statSync(path);\n const isDirectory = stat.isDirectory();\n debug('folder exist', isDirectory);\n return isDirectory;\n } catch {\n debug('folder %s does not exist', path);\n return false;\n }\n}\n\n/**\n * Check whether the file already exist.\n * @param {String} path\n * @return {Boolean}\n */\nexport function fileExists(path: string): boolean {\n try {\n debug('check file exist', path);\n const stat = fs.statSync(path);\n const isFile = stat.isFile();\n debug('file exist', isFile);\n return isFile;\n } catch {\n debug('file %s does not exist', path);\n return false;\n }\n}\n"],"mappings":";;;;;;AAGA,IAAM,WAAA,GAAA,MAAA,SAAmB
|
|
1
|
+
{"version":3,"file":"config-utils.js","names":[],"sources":["../src/config-utils.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport fs from 'node:fs';\n\nconst debug = buildDebug('verdaccio:config:config-utils');\n\n/**\n * Check whether the path already exist.\n * @param {String} path\n * @return {Boolean}\n */\nexport function folderExists(path: string): boolean {\n try {\n debug('check folder exist', path);\n const stat = fs.statSync(path);\n const isDirectory = stat.isDirectory();\n debug('folder exist', isDirectory);\n return isDirectory;\n } catch {\n debug('folder %s does not exist', path);\n return false;\n }\n}\n\n/**\n * Check whether the file already exist.\n * @param {String} path\n * @return {Boolean}\n */\nexport function fileExists(path: string): boolean {\n try {\n debug('check file exist', path);\n const stat = fs.statSync(path);\n const isFile = stat.isFile();\n debug('file exist', isFile);\n return isFile;\n } catch {\n debug('file %s does not exist', path);\n return false;\n }\n}\n"],"mappings":";;;;;;AAGA,IAAM,WAAA,GAAA,MAAA,SAAmB,+BAA+B;;;;;;AAOxD,SAAgB,aAAa,MAAuB;CAClD,IAAI;EACF,QAAM,sBAAsB,IAAI;EAEhC,MAAM,cADO,QAAA,QAAG,SAAS,IACL,EAAK,YAAY;EACrC,QAAM,gBAAgB,WAAW;EACjC,OAAO;CACT,QAAQ;EACN,QAAM,4BAA4B,IAAI;EACtC,OAAO;CACT;AACF;;;;;;AAOA,SAAgB,WAAW,MAAuB;CAChD,IAAI;EACF,QAAM,oBAAoB,IAAI;EAE9B,MAAM,SADO,QAAA,QAAG,SAAS,IACV,EAAK,OAAO;EAC3B,QAAM,cAAc,MAAM;EAC1B,OAAO;CACT,QAAQ;EACN,QAAM,0BAA0B,IAAI;EACpC,OAAO;CACT;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-utils.mjs","names":[],"sources":["../src/config-utils.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport fs from 'node:fs';\n\nconst debug = buildDebug('verdaccio:config:config-utils');\n\n/**\n * Check whether the path already exist.\n * @param {String} path\n * @return {Boolean}\n */\nexport function folderExists(path: string): boolean {\n try {\n debug('check folder exist', path);\n const stat = fs.statSync(path);\n const isDirectory = stat.isDirectory();\n debug('folder exist', isDirectory);\n return isDirectory;\n } catch {\n debug('folder %s does not exist', path);\n return false;\n }\n}\n\n/**\n * Check whether the file already exist.\n * @param {String} path\n * @return {Boolean}\n */\nexport function fileExists(path: string): boolean {\n try {\n debug('check file exist', path);\n const stat = fs.statSync(path);\n const isFile = stat.isFile();\n debug('file exist', isFile);\n return isFile;\n } catch {\n debug('file %s does not exist', path);\n return false;\n }\n}\n"],"mappings":";;;AAGA,IAAM,QAAQ,WAAW
|
|
1
|
+
{"version":3,"file":"config-utils.mjs","names":[],"sources":["../src/config-utils.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport fs from 'node:fs';\n\nconst debug = buildDebug('verdaccio:config:config-utils');\n\n/**\n * Check whether the path already exist.\n * @param {String} path\n * @return {Boolean}\n */\nexport function folderExists(path: string): boolean {\n try {\n debug('check folder exist', path);\n const stat = fs.statSync(path);\n const isDirectory = stat.isDirectory();\n debug('folder exist', isDirectory);\n return isDirectory;\n } catch {\n debug('folder %s does not exist', path);\n return false;\n }\n}\n\n/**\n * Check whether the file already exist.\n * @param {String} path\n * @return {Boolean}\n */\nexport function fileExists(path: string): boolean {\n try {\n debug('check file exist', path);\n const stat = fs.statSync(path);\n const isFile = stat.isFile();\n debug('file exist', isFile);\n return isFile;\n } catch {\n debug('file %s does not exist', path);\n return false;\n }\n}\n"],"mappings":";;;AAGA,IAAM,QAAQ,WAAW,+BAA+B;;;;;;AAOxD,SAAgB,aAAa,MAAuB;CAClD,IAAI;EACF,MAAM,sBAAsB,IAAI;EAEhC,MAAM,cADO,GAAG,SAAS,IACL,EAAK,YAAY;EACrC,MAAM,gBAAgB,WAAW;EACjC,OAAO;CACT,QAAQ;EACN,MAAM,4BAA4B,IAAI;EACtC,OAAO;CACT;AACF;;;;;;AAOA,SAAgB,WAAW,MAAuB;CAChD,IAAI;EACF,MAAM,oBAAoB,IAAI;EAE9B,MAAM,SADO,GAAG,SAAS,IACV,EAAK,OAAO;EAC3B,MAAM,cAAc,MAAM;EAC1B,OAAO;CACT,QAAQ;EACN,MAAM,0BAA0B,IAAI;EACpC,OAAO;CACT;AACF"}
|
package/build/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":[],"sources":["../src/config.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { isEmpty, merge } from 'lodash-es';\nimport assert from 'node:assert';\n\nimport { APP_ERROR, authUtils, cryptoUtils, validationUtils } from '@verdaccio/core';\nimport type {\n Config as AppConfig,\n AuthConf,\n ConfigYaml,\n FlagsConfig,\n PackageAccess,\n PackageList,\n RateLimit,\n Security,\n ServerSettingsConf,\n} from '@verdaccio/types';\n\nimport { getUserAgent } from './agent';\nimport { normalisePackageAccess } from './package-access';\nimport { defaultSecurity } from './security';\nimport defaultServerSettings from './serverSettings';\nimport { generateRandomSecretKey } from './token';\nimport { sanityCheckUplinksProps, uplinkSanityCheck } from './uplinks';\n\nconst strategicConfigProps = ['uplinks', 'packages'];\nconst allowedEnvConfig = ['http_proxy', 'https_proxy', 'no_proxy'];\nconst debug = buildDebug('verdaccio:config');\n\nexport const WEB_TITLE = 'Verdaccio';\n\n// we limit max 1000 request per 15 minutes on user endpoints\nexport const defaultUserRateLimiting = {\n windowMs: 15 * 60 * 1000, // 15 minutes\n max: 1000,\n};\n\nconst TOKEN_VALID_LENGTH = 32;\n\n/**\n * Coordinates the application configuration\n */\nclass Config implements AppConfig {\n public user_agent: string | undefined;\n public uplinks: any;\n public packages: PackageList;\n public users: any;\n public auth: AuthConf;\n public store: any;\n public server_id: string;\n public configPath: string;\n public storage: string | void;\n\n public plugins: string | void | null;\n public security: Security;\n public server: ServerSettingsConf;\n // @ts-ignore\n public secret: string;\n public flags: FlagsConfig;\n public userRateLimit: RateLimit;\n public constructor(config: ConfigYaml & { config_path: string }) {\n const self = this;\n this.storage = process.env.VERDACCIO_STORAGE_PATH || config.storage;\n if (!config.configPath) {\n config.configPath = config.config_path;\n if (!config.configPath) {\n throw new Error('configPath property is required');\n }\n }\n this.configPath = config.configPath;\n debug('config path: %s', this.configPath);\n this.plugins = config.plugins;\n this.security = merge(defaultSecurity, config.security);\n this.server = { ...defaultServerSettings, ...config.server };\n this.flags = {\n changePassword: config.flags?.changePassword ?? false,\n webLogin: config.flags?.webLogin ?? false,\n createUser: config.flags?.createUser ?? false,\n };\n this.user_agent = config.user_agent;\n\n for (const configProp in config) {\n if (self[configProp] == null) {\n self[configProp] = config[configProp];\n }\n }\n\n if (typeof this.user_agent === 'undefined') {\n // by default user agent is hidden\n debug('set default user agent');\n this.user_agent = getUserAgent(false);\n }\n\n this.userRateLimit = { ...defaultUserRateLimiting, ...config?.userRateLimit };\n\n // some weird shell scripts are valid yaml files parsed as string\n assert(validationUtils.isObject(config), APP_ERROR.CONFIG_NOT_VALID);\n\n // sanity check for strategic config properties\n strategicConfigProps.forEach(function (x): void {\n if (self[x] == null) {\n self[x] = {};\n }\n\n assert(validationUtils.isObject(self[x]), `CONFIG: bad \"${x}\" value (object expected)`);\n });\n\n this.uplinks = sanityCheckUplinksProps(uplinkSanityCheck(this.uplinks));\n this.packages = normalisePackageAccess(self.packages);\n\n // loading these from ENV if aren't in config\n allowedEnvConfig.forEach((envConf): void => {\n if (!(envConf in self)) {\n self[envConf] = process.env[envConf] || process.env[envConf.toUpperCase()];\n }\n });\n\n // unique identifier of self server (or a cluster), used to avoid loops\n // @ts-ignore\n if (!this.server_id) {\n this.server_id = cryptoUtils.generateRandomHexString(6);\n }\n }\n\n public getConfigPath() {\n return this.configPath;\n }\n\n /**\n * Check for package spec\n * @param pkgName - package name\n * @returns package access\n * @deprecated use core.authUtils instead\n */\n public getMatchedPackagesSpec(pkgName: string): PackageAccess | void {\n // TODO: remove this method and replace by library utils\n return authUtils.getMatchedPackagesSpec(pkgName, this.packages);\n }\n\n /**\n * Verify if the secret complies with the required structure.\n * The secret must be exactly 32 characters long for aes-256-ctr encryption.\n * If no secret is provided, a new one will be generated.\n * @secret external secret key\n */\n public checkSecretKey(secret?: string): string {\n debug('checking secret key init');\n if (typeof secret === 'string' && isEmpty(secret) === false) {\n debug('checking secret key length %s', secret.length);\n if (secret.length !== TOKEN_VALID_LENGTH) {\n throw new Error(\n `Invalid storage secret key length, must be ${TOKEN_VALID_LENGTH} characters long but is ${secret.length}. ` +\n `Please generate a new one. Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`\n );\n }\n debug('detected valid secret key length %s', secret.length);\n this.secret = secret;\n return this.secret;\n } else {\n debug('generating a new secret key');\n this.secret = generateRandomSecretKey();\n debug('generated a new secret key length %s', this.secret?.length);\n return this.secret;\n }\n }\n}\n\nexport { Config };\n"],"mappings":";;;;;;;;;;;;;;AAwBA,IAAM,uBAAuB,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"config.js","names":[],"sources":["../src/config.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { isEmpty, merge } from 'lodash-es';\nimport assert from 'node:assert';\n\nimport { APP_ERROR, authUtils, cryptoUtils, validationUtils } from '@verdaccio/core';\nimport type {\n Config as AppConfig,\n AuthConf,\n ConfigYaml,\n FlagsConfig,\n PackageAccess,\n PackageList,\n RateLimit,\n Security,\n ServerSettingsConf,\n} from '@verdaccio/types';\n\nimport { getUserAgent } from './agent';\nimport { normalisePackageAccess } from './package-access';\nimport { defaultSecurity } from './security';\nimport defaultServerSettings from './serverSettings';\nimport { generateRandomSecretKey } from './token';\nimport { sanityCheckUplinksProps, uplinkSanityCheck } from './uplinks';\n\nconst strategicConfigProps = ['uplinks', 'packages'];\nconst allowedEnvConfig = ['http_proxy', 'https_proxy', 'no_proxy'];\nconst debug = buildDebug('verdaccio:config');\n\nexport const WEB_TITLE = 'Verdaccio';\n\n// we limit max 1000 request per 15 minutes on user endpoints\nexport const defaultUserRateLimiting = {\n windowMs: 15 * 60 * 1000, // 15 minutes\n max: 1000,\n};\n\nconst TOKEN_VALID_LENGTH = 32;\n\n/**\n * Coordinates the application configuration\n */\nclass Config implements AppConfig {\n public user_agent: string | undefined;\n public uplinks: any;\n public packages: PackageList;\n public users: any;\n public auth: AuthConf;\n public store: any;\n public server_id: string;\n public configPath: string;\n public storage: string | void;\n\n public plugins: string | void | null;\n public security: Security;\n public server: ServerSettingsConf;\n // @ts-ignore\n public secret: string;\n public flags: FlagsConfig;\n public userRateLimit: RateLimit;\n public constructor(config: ConfigYaml & { config_path: string }) {\n const self = this;\n this.storage = process.env.VERDACCIO_STORAGE_PATH || config.storage;\n if (!config.configPath) {\n config.configPath = config.config_path;\n if (!config.configPath) {\n throw new Error('configPath property is required');\n }\n }\n this.configPath = config.configPath;\n debug('config path: %s', this.configPath);\n this.plugins = config.plugins;\n this.security = merge(defaultSecurity, config.security);\n this.server = { ...defaultServerSettings, ...config.server };\n this.flags = {\n changePassword: config.flags?.changePassword ?? false,\n webLogin: config.flags?.webLogin ?? false,\n createUser: config.flags?.createUser ?? false,\n };\n this.user_agent = config.user_agent;\n\n for (const configProp in config) {\n if (self[configProp] == null) {\n self[configProp] = config[configProp];\n }\n }\n\n if (typeof this.user_agent === 'undefined') {\n // by default user agent is hidden\n debug('set default user agent');\n this.user_agent = getUserAgent(false);\n }\n\n this.userRateLimit = { ...defaultUserRateLimiting, ...config?.userRateLimit };\n\n // some weird shell scripts are valid yaml files parsed as string\n assert(validationUtils.isObject(config), APP_ERROR.CONFIG_NOT_VALID);\n\n // sanity check for strategic config properties\n strategicConfigProps.forEach(function (x): void {\n if (self[x] == null) {\n self[x] = {};\n }\n\n assert(validationUtils.isObject(self[x]), `CONFIG: bad \"${x}\" value (object expected)`);\n });\n\n this.uplinks = sanityCheckUplinksProps(uplinkSanityCheck(this.uplinks));\n this.packages = normalisePackageAccess(self.packages);\n\n // loading these from ENV if aren't in config\n allowedEnvConfig.forEach((envConf): void => {\n if (!(envConf in self)) {\n self[envConf] = process.env[envConf] || process.env[envConf.toUpperCase()];\n }\n });\n\n // unique identifier of self server (or a cluster), used to avoid loops\n // @ts-ignore\n if (!this.server_id) {\n this.server_id = cryptoUtils.generateRandomHexString(6);\n }\n }\n\n public getConfigPath() {\n return this.configPath;\n }\n\n /**\n * Check for package spec\n * @param pkgName - package name\n * @returns package access\n * @deprecated use core.authUtils instead\n */\n public getMatchedPackagesSpec(pkgName: string): PackageAccess | void {\n // TODO: remove this method and replace by library utils\n return authUtils.getMatchedPackagesSpec(pkgName, this.packages);\n }\n\n /**\n * Verify if the secret complies with the required structure.\n * The secret must be exactly 32 characters long for aes-256-ctr encryption.\n * If no secret is provided, a new one will be generated.\n * @secret external secret key\n */\n public checkSecretKey(secret?: string): string {\n debug('checking secret key init');\n if (typeof secret === 'string' && isEmpty(secret) === false) {\n debug('checking secret key length %s', secret.length);\n if (secret.length !== TOKEN_VALID_LENGTH) {\n throw new Error(\n `Invalid storage secret key length, must be ${TOKEN_VALID_LENGTH} characters long but is ${secret.length}. ` +\n `Please generate a new one. Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`\n );\n }\n debug('detected valid secret key length %s', secret.length);\n this.secret = secret;\n return this.secret;\n } else {\n debug('generating a new secret key');\n this.secret = generateRandomSecretKey();\n debug('generated a new secret key length %s', this.secret?.length);\n return this.secret;\n }\n }\n}\n\nexport { Config };\n"],"mappings":";;;;;;;;;;;;;;AAwBA,IAAM,uBAAuB,CAAC,WAAW,UAAU;AACnD,IAAM,mBAAmB;CAAC;CAAc;CAAe;AAAU;AACjE,IAAM,WAAA,GAAA,MAAA,SAAmB,kBAAkB;AAE3C,IAAa,YAAY;AAGzB,IAAa,0BAA0B;CACrC,UAAU,MAAU;CACpB,KAAK;AACP;AAEA,IAAM,qBAAqB;;;;AAK3B,IAAM,SAAN,MAAkC;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;CACA;CACA;CACA,YAAmB,QAA8C;EAC/D,MAAM,OAAO;EACb,KAAK,UAAU,QAAQ,IAAI,0BAA0B,OAAO;EAC5D,IAAI,CAAC,OAAO,YAAY;GACtB,OAAO,aAAa,OAAO;GAC3B,IAAI,CAAC,OAAO,YACV,MAAM,IAAI,MAAM,iCAAiC;EAErD;EACA,KAAK,aAAa,OAAO;EACzB,QAAM,mBAAmB,KAAK,UAAU;EACxC,KAAK,UAAU,OAAO;EACtB,KAAK,YAAA,GAAA,UAAA,OAAiB,iBAAA,iBAAiB,OAAO,QAAQ;EACtD,KAAK,SAAS;GAAE,GAAG,uBAAA;GAAuB,GAAG,OAAO;EAAO;EAC3D,KAAK,QAAQ;GACX,gBAAgB,OAAO,OAAO,kBAAkB;GAChD,UAAU,OAAO,OAAO,YAAY;GACpC,YAAY,OAAO,OAAO,cAAc;EAC1C;EACA,KAAK,aAAa,OAAO;EAEzB,KAAK,MAAM,cAAc,QACvB,IAAI,KAAK,eAAe,MACtB,KAAK,cAAc,OAAO;EAI9B,IAAI,OAAO,KAAK,eAAe,aAAa;GAE1C,QAAM,wBAAwB;GAC9B,KAAK,aAAa,cAAA,aAAa,KAAK;EACtC;EAEA,KAAK,gBAAgB;GAAE,GAAG;GAAyB,GAAG,QAAQ;EAAc;EAG5E,CAAA,GAAA,YAAA,SAAO,gBAAA,gBAAgB,SAAS,MAAM,GAAG,gBAAA,UAAU,gBAAgB;EAGnE,qBAAqB,QAAQ,SAAU,GAAS;GAC9C,IAAI,KAAK,MAAM,MACb,KAAK,KAAK,CAAC;GAGb,CAAA,GAAA,YAAA,SAAO,gBAAA,gBAAgB,SAAS,KAAK,EAAE,GAAG,gBAAgB,EAAE,0BAA0B;EACxF,CAAC;EAED,KAAK,UAAU,gBAAA,wBAAwB,gBAAA,kBAAkB,KAAK,OAAO,CAAC;EACtE,KAAK,WAAW,uBAAA,uBAAuB,KAAK,QAAQ;EAGpD,iBAAiB,SAAS,YAAkB;GAC1C,IAAI,EAAE,WAAW,OACf,KAAK,WAAW,QAAQ,IAAI,YAAY,QAAQ,IAAI,QAAQ,YAAY;EAE5E,CAAC;EAID,IAAI,CAAC,KAAK,WACR,KAAK,YAAY,gBAAA,YAAY,wBAAwB,CAAC;CAE1D;CAEA,gBAAuB;EACrB,OAAO,KAAK;CACd;;;;;;;CAQA,uBAA8B,SAAuC;EAEnE,OAAO,gBAAA,UAAU,uBAAuB,SAAS,KAAK,QAAQ;CAChE;;;;;;;CAQA,eAAsB,QAAyB;EAC7C,QAAM,0BAA0B;EAChC,IAAI,OAAO,WAAW,aAAA,GAAA,UAAA,SAAoB,MAAM,MAAM,OAAO;GAC3D,QAAM,iCAAiC,OAAO,MAAM;GACpD,IAAI,OAAO,WAAW,oBACpB,MAAM,IAAI,MACR,8CAA8C,mBAAmB,0BAA0B,OAAO,OAAO,mGAE3G;GAEF,QAAM,uCAAuC,OAAO,MAAM;GAC1D,KAAK,SAAS;GACd,OAAO,KAAK;EACd,OAAO;GACL,QAAM,6BAA6B;GACnC,KAAK,SAAS,cAAA,wBAAwB;GACtC,QAAM,wCAAwC,KAAK,QAAQ,MAAM;GACjE,OAAO,KAAK;EACd;CACF;AACF"}
|
package/build/config.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { isEmpty, merge } from 'lodash-es';\nimport assert from 'node:assert';\n\nimport { APP_ERROR, authUtils, cryptoUtils, validationUtils } from '@verdaccio/core';\nimport type {\n Config as AppConfig,\n AuthConf,\n ConfigYaml,\n FlagsConfig,\n PackageAccess,\n PackageList,\n RateLimit,\n Security,\n ServerSettingsConf,\n} from '@verdaccio/types';\n\nimport { getUserAgent } from './agent';\nimport { normalisePackageAccess } from './package-access';\nimport { defaultSecurity } from './security';\nimport defaultServerSettings from './serverSettings';\nimport { generateRandomSecretKey } from './token';\nimport { sanityCheckUplinksProps, uplinkSanityCheck } from './uplinks';\n\nconst strategicConfigProps = ['uplinks', 'packages'];\nconst allowedEnvConfig = ['http_proxy', 'https_proxy', 'no_proxy'];\nconst debug = buildDebug('verdaccio:config');\n\nexport const WEB_TITLE = 'Verdaccio';\n\n// we limit max 1000 request per 15 minutes on user endpoints\nexport const defaultUserRateLimiting = {\n windowMs: 15 * 60 * 1000, // 15 minutes\n max: 1000,\n};\n\nconst TOKEN_VALID_LENGTH = 32;\n\n/**\n * Coordinates the application configuration\n */\nclass Config implements AppConfig {\n public user_agent: string | undefined;\n public uplinks: any;\n public packages: PackageList;\n public users: any;\n public auth: AuthConf;\n public store: any;\n public server_id: string;\n public configPath: string;\n public storage: string | void;\n\n public plugins: string | void | null;\n public security: Security;\n public server: ServerSettingsConf;\n // @ts-ignore\n public secret: string;\n public flags: FlagsConfig;\n public userRateLimit: RateLimit;\n public constructor(config: ConfigYaml & { config_path: string }) {\n const self = this;\n this.storage = process.env.VERDACCIO_STORAGE_PATH || config.storage;\n if (!config.configPath) {\n config.configPath = config.config_path;\n if (!config.configPath) {\n throw new Error('configPath property is required');\n }\n }\n this.configPath = config.configPath;\n debug('config path: %s', this.configPath);\n this.plugins = config.plugins;\n this.security = merge(defaultSecurity, config.security);\n this.server = { ...defaultServerSettings, ...config.server };\n this.flags = {\n changePassword: config.flags?.changePassword ?? false,\n webLogin: config.flags?.webLogin ?? false,\n createUser: config.flags?.createUser ?? false,\n };\n this.user_agent = config.user_agent;\n\n for (const configProp in config) {\n if (self[configProp] == null) {\n self[configProp] = config[configProp];\n }\n }\n\n if (typeof this.user_agent === 'undefined') {\n // by default user agent is hidden\n debug('set default user agent');\n this.user_agent = getUserAgent(false);\n }\n\n this.userRateLimit = { ...defaultUserRateLimiting, ...config?.userRateLimit };\n\n // some weird shell scripts are valid yaml files parsed as string\n assert(validationUtils.isObject(config), APP_ERROR.CONFIG_NOT_VALID);\n\n // sanity check for strategic config properties\n strategicConfigProps.forEach(function (x): void {\n if (self[x] == null) {\n self[x] = {};\n }\n\n assert(validationUtils.isObject(self[x]), `CONFIG: bad \"${x}\" value (object expected)`);\n });\n\n this.uplinks = sanityCheckUplinksProps(uplinkSanityCheck(this.uplinks));\n this.packages = normalisePackageAccess(self.packages);\n\n // loading these from ENV if aren't in config\n allowedEnvConfig.forEach((envConf): void => {\n if (!(envConf in self)) {\n self[envConf] = process.env[envConf] || process.env[envConf.toUpperCase()];\n }\n });\n\n // unique identifier of self server (or a cluster), used to avoid loops\n // @ts-ignore\n if (!this.server_id) {\n this.server_id = cryptoUtils.generateRandomHexString(6);\n }\n }\n\n public getConfigPath() {\n return this.configPath;\n }\n\n /**\n * Check for package spec\n * @param pkgName - package name\n * @returns package access\n * @deprecated use core.authUtils instead\n */\n public getMatchedPackagesSpec(pkgName: string): PackageAccess | void {\n // TODO: remove this method and replace by library utils\n return authUtils.getMatchedPackagesSpec(pkgName, this.packages);\n }\n\n /**\n * Verify if the secret complies with the required structure.\n * The secret must be exactly 32 characters long for aes-256-ctr encryption.\n * If no secret is provided, a new one will be generated.\n * @secret external secret key\n */\n public checkSecretKey(secret?: string): string {\n debug('checking secret key init');\n if (typeof secret === 'string' && isEmpty(secret) === false) {\n debug('checking secret key length %s', secret.length);\n if (secret.length !== TOKEN_VALID_LENGTH) {\n throw new Error(\n `Invalid storage secret key length, must be ${TOKEN_VALID_LENGTH} characters long but is ${secret.length}. ` +\n `Please generate a new one. Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`\n );\n }\n debug('detected valid secret key length %s', secret.length);\n this.secret = secret;\n return this.secret;\n } else {\n debug('generating a new secret key');\n this.secret = generateRandomSecretKey();\n debug('generated a new secret key length %s', this.secret?.length);\n return this.secret;\n }\n }\n}\n\nexport { Config };\n"],"mappings":";;;;;;;;;;;AAwBA,IAAM,uBAAuB,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { isEmpty, merge } from 'lodash-es';\nimport assert from 'node:assert';\n\nimport { APP_ERROR, authUtils, cryptoUtils, validationUtils } from '@verdaccio/core';\nimport type {\n Config as AppConfig,\n AuthConf,\n ConfigYaml,\n FlagsConfig,\n PackageAccess,\n PackageList,\n RateLimit,\n Security,\n ServerSettingsConf,\n} from '@verdaccio/types';\n\nimport { getUserAgent } from './agent';\nimport { normalisePackageAccess } from './package-access';\nimport { defaultSecurity } from './security';\nimport defaultServerSettings from './serverSettings';\nimport { generateRandomSecretKey } from './token';\nimport { sanityCheckUplinksProps, uplinkSanityCheck } from './uplinks';\n\nconst strategicConfigProps = ['uplinks', 'packages'];\nconst allowedEnvConfig = ['http_proxy', 'https_proxy', 'no_proxy'];\nconst debug = buildDebug('verdaccio:config');\n\nexport const WEB_TITLE = 'Verdaccio';\n\n// we limit max 1000 request per 15 minutes on user endpoints\nexport const defaultUserRateLimiting = {\n windowMs: 15 * 60 * 1000, // 15 minutes\n max: 1000,\n};\n\nconst TOKEN_VALID_LENGTH = 32;\n\n/**\n * Coordinates the application configuration\n */\nclass Config implements AppConfig {\n public user_agent: string | undefined;\n public uplinks: any;\n public packages: PackageList;\n public users: any;\n public auth: AuthConf;\n public store: any;\n public server_id: string;\n public configPath: string;\n public storage: string | void;\n\n public plugins: string | void | null;\n public security: Security;\n public server: ServerSettingsConf;\n // @ts-ignore\n public secret: string;\n public flags: FlagsConfig;\n public userRateLimit: RateLimit;\n public constructor(config: ConfigYaml & { config_path: string }) {\n const self = this;\n this.storage = process.env.VERDACCIO_STORAGE_PATH || config.storage;\n if (!config.configPath) {\n config.configPath = config.config_path;\n if (!config.configPath) {\n throw new Error('configPath property is required');\n }\n }\n this.configPath = config.configPath;\n debug('config path: %s', this.configPath);\n this.plugins = config.plugins;\n this.security = merge(defaultSecurity, config.security);\n this.server = { ...defaultServerSettings, ...config.server };\n this.flags = {\n changePassword: config.flags?.changePassword ?? false,\n webLogin: config.flags?.webLogin ?? false,\n createUser: config.flags?.createUser ?? false,\n };\n this.user_agent = config.user_agent;\n\n for (const configProp in config) {\n if (self[configProp] == null) {\n self[configProp] = config[configProp];\n }\n }\n\n if (typeof this.user_agent === 'undefined') {\n // by default user agent is hidden\n debug('set default user agent');\n this.user_agent = getUserAgent(false);\n }\n\n this.userRateLimit = { ...defaultUserRateLimiting, ...config?.userRateLimit };\n\n // some weird shell scripts are valid yaml files parsed as string\n assert(validationUtils.isObject(config), APP_ERROR.CONFIG_NOT_VALID);\n\n // sanity check for strategic config properties\n strategicConfigProps.forEach(function (x): void {\n if (self[x] == null) {\n self[x] = {};\n }\n\n assert(validationUtils.isObject(self[x]), `CONFIG: bad \"${x}\" value (object expected)`);\n });\n\n this.uplinks = sanityCheckUplinksProps(uplinkSanityCheck(this.uplinks));\n this.packages = normalisePackageAccess(self.packages);\n\n // loading these from ENV if aren't in config\n allowedEnvConfig.forEach((envConf): void => {\n if (!(envConf in self)) {\n self[envConf] = process.env[envConf] || process.env[envConf.toUpperCase()];\n }\n });\n\n // unique identifier of self server (or a cluster), used to avoid loops\n // @ts-ignore\n if (!this.server_id) {\n this.server_id = cryptoUtils.generateRandomHexString(6);\n }\n }\n\n public getConfigPath() {\n return this.configPath;\n }\n\n /**\n * Check for package spec\n * @param pkgName - package name\n * @returns package access\n * @deprecated use core.authUtils instead\n */\n public getMatchedPackagesSpec(pkgName: string): PackageAccess | void {\n // TODO: remove this method and replace by library utils\n return authUtils.getMatchedPackagesSpec(pkgName, this.packages);\n }\n\n /**\n * Verify if the secret complies with the required structure.\n * The secret must be exactly 32 characters long for aes-256-ctr encryption.\n * If no secret is provided, a new one will be generated.\n * @secret external secret key\n */\n public checkSecretKey(secret?: string): string {\n debug('checking secret key init');\n if (typeof secret === 'string' && isEmpty(secret) === false) {\n debug('checking secret key length %s', secret.length);\n if (secret.length !== TOKEN_VALID_LENGTH) {\n throw new Error(\n `Invalid storage secret key length, must be ${TOKEN_VALID_LENGTH} characters long but is ${secret.length}. ` +\n `Please generate a new one. Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`\n );\n }\n debug('detected valid secret key length %s', secret.length);\n this.secret = secret;\n return this.secret;\n } else {\n debug('generating a new secret key');\n this.secret = generateRandomSecretKey();\n debug('generated a new secret key length %s', this.secret?.length);\n return this.secret;\n }\n }\n}\n\nexport { Config };\n"],"mappings":";;;;;;;;;;;AAwBA,IAAM,uBAAuB,CAAC,WAAW,UAAU;AACnD,IAAM,mBAAmB;CAAC;CAAc;CAAe;AAAU;AACjE,IAAM,QAAQ,WAAW,kBAAkB;AAE3C,IAAa,YAAY;AAGzB,IAAa,0BAA0B;CACrC,UAAU,MAAU;CACpB,KAAK;AACP;AAEA,IAAM,qBAAqB;;;;AAK3B,IAAM,SAAN,MAAkC;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;CACA;CACA;CACA,YAAmB,QAA8C;EAC/D,MAAM,OAAO;EACb,KAAK,UAAU,QAAQ,IAAI,0BAA0B,OAAO;EAC5D,IAAI,CAAC,OAAO,YAAY;GACtB,OAAO,aAAa,OAAO;GAC3B,IAAI,CAAC,OAAO,YACV,MAAM,IAAI,MAAM,iCAAiC;EAErD;EACA,KAAK,aAAa,OAAO;EACzB,MAAM,mBAAmB,KAAK,UAAU;EACxC,KAAK,UAAU,OAAO;EACtB,KAAK,WAAW,MAAM,iBAAiB,OAAO,QAAQ;EACtD,KAAK,SAAS;GAAE,GAAG;GAAuB,GAAG,OAAO;EAAO;EAC3D,KAAK,QAAQ;GACX,gBAAgB,OAAO,OAAO,kBAAkB;GAChD,UAAU,OAAO,OAAO,YAAY;GACpC,YAAY,OAAO,OAAO,cAAc;EAC1C;EACA,KAAK,aAAa,OAAO;EAEzB,KAAK,MAAM,cAAc,QACvB,IAAI,KAAK,eAAe,MACtB,KAAK,cAAc,OAAO;EAI9B,IAAI,OAAO,KAAK,eAAe,aAAa;GAE1C,MAAM,wBAAwB;GAC9B,KAAK,aAAa,aAAa,KAAK;EACtC;EAEA,KAAK,gBAAgB;GAAE,GAAG;GAAyB,GAAG,QAAQ;EAAc;EAG5E,OAAO,gBAAgB,SAAS,MAAM,GAAG,UAAU,gBAAgB;EAGnE,qBAAqB,QAAQ,SAAU,GAAS;GAC9C,IAAI,KAAK,MAAM,MACb,KAAK,KAAK,CAAC;GAGb,OAAO,gBAAgB,SAAS,KAAK,EAAE,GAAG,gBAAgB,EAAE,0BAA0B;EACxF,CAAC;EAED,KAAK,UAAU,wBAAwB,kBAAkB,KAAK,OAAO,CAAC;EACtE,KAAK,WAAW,uBAAuB,KAAK,QAAQ;EAGpD,iBAAiB,SAAS,YAAkB;GAC1C,IAAI,EAAE,WAAW,OACf,KAAK,WAAW,QAAQ,IAAI,YAAY,QAAQ,IAAI,QAAQ,YAAY;EAE5E,CAAC;EAID,IAAI,CAAC,KAAK,WACR,KAAK,YAAY,YAAY,wBAAwB,CAAC;CAE1D;CAEA,gBAAuB;EACrB,OAAO,KAAK;CACd;;;;;;;CAQA,uBAA8B,SAAuC;EAEnE,OAAO,UAAU,uBAAuB,SAAS,KAAK,QAAQ;CAChE;;;;;;;CAQA,eAAsB,QAAyB;EAC7C,MAAM,0BAA0B;EAChC,IAAI,OAAO,WAAW,YAAY,QAAQ,MAAM,MAAM,OAAO;GAC3D,MAAM,iCAAiC,OAAO,MAAM;GACpD,IAAI,OAAO,WAAW,oBACpB,MAAM,IAAI,MACR,8CAA8C,mBAAmB,0BAA0B,OAAO,OAAO,mGAE3G;GAEF,MAAM,uCAAuC,OAAO,MAAM;GAC1D,KAAK,SAAS;GACd,OAAO,KAAK;EACd,OAAO;GACL,MAAM,6BAA6B;GACnC,KAAK,SAAS,wBAAwB;GACtC,MAAM,wCAAwC,KAAK,QAAQ,MAAM;GACjE,OAAO,KAAK;EACd;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-access.js","names":[],"sources":["../src/package-access.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { flatten, isEmpty, isNil, isObject, isUndefined } from 'lodash-es';\nimport assert from 'node:assert';\n\nimport { errorUtils } from '@verdaccio/core';\nimport type { PackageAccess } from '@verdaccio/types';\n\nconst debug = buildDebug('verdaccio:config:utils');\n\nexport interface LegacyPackageList {\n [key: string]: PackageAccess;\n}\n\n// @deprecated use @verdaccio/core:authUtils\nexport const ROLES = {\n $ALL: '$all',\n ALL: 'all',\n $AUTH: '$authenticated',\n $ANONYMOUS: '$anonymous',\n DEPRECATED_ALL: '@all',\n DEPRECATED_AUTH: '@authenticated',\n DEPRECATED_ANONYMOUS: '@anonymous',\n};\n\n// @deprecated use @verdaccio/core:authUtils\nexport const PACKAGE_ACCESS = {\n SCOPE: '@*/*',\n ALL: '**',\n};\n\nexport function normalizeUserList(groupsList: any): any {\n const result: any[] = [];\n if (isNil(groupsList) || isEmpty(groupsList)) {\n return result;\n }\n\n // if it's a string, split it to array\n if (typeof groupsList === 'string') {\n const groupsArray = groupsList.split(/\\s+/);\n\n result.push(groupsArray);\n } else if (Array.isArray(groupsList)) {\n result.push(groupsList);\n } else {\n throw errorUtils.getInternalError(\n 'CONFIG: bad package acl (array or string expected): ' + JSON.stringify(groupsList)\n );\n }\n\n return flatten(result);\n}\n\nexport function normalisePackageAccess(packages: LegacyPackageList): LegacyPackageList {\n const normalizedPkgs: LegacyPackageList = { ...packages };\n if (isNil(normalizedPkgs['**'])) {\n normalizedPkgs['**'] = {\n access: [],\n publish: [],\n unpublish: [],\n proxy: [],\n };\n }\n\n for (const pkg in packages) {\n if (Object.prototype.hasOwnProperty.call(packages, pkg)) {\n const packageAccess = packages[pkg];\n debug('package access %s for %s ', packageAccess, pkg);\n const isInvalid = isObject(packageAccess) && !Array.isArray(packageAccess);\n assert(isInvalid, `CONFIG: bad \"'${pkg}'\" package description (object expected)`);\n\n normalizedPkgs[pkg].access = normalizeUserList(packageAccess.access);\n normalizedPkgs[pkg].publish = normalizeUserList(packageAccess.publish);\n normalizedPkgs[pkg].proxy = normalizeUserList(packageAccess.proxy);\n // if unpublish is not defined, we set to false to fallback in publish access\n normalizedPkgs[pkg].unpublish = isUndefined(packageAccess.unpublish)\n ? false\n : normalizeUserList(packageAccess.unpublish);\n }\n }\n\n return normalizedPkgs;\n}\n"],"mappings":";;;;;;;;AAOA,IAAM,WAAA,GAAA,MAAA,SAAmB,
|
|
1
|
+
{"version":3,"file":"package-access.js","names":[],"sources":["../src/package-access.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { flatten, isEmpty, isNil, isObject, isUndefined } from 'lodash-es';\nimport assert from 'node:assert';\n\nimport { errorUtils } from '@verdaccio/core';\nimport type { PackageAccess } from '@verdaccio/types';\n\nconst debug = buildDebug('verdaccio:config:utils');\n\nexport interface LegacyPackageList {\n [key: string]: PackageAccess;\n}\n\n// @deprecated use @verdaccio/core:authUtils\nexport const ROLES = {\n $ALL: '$all',\n ALL: 'all',\n $AUTH: '$authenticated',\n $ANONYMOUS: '$anonymous',\n DEPRECATED_ALL: '@all',\n DEPRECATED_AUTH: '@authenticated',\n DEPRECATED_ANONYMOUS: '@anonymous',\n};\n\n// @deprecated use @verdaccio/core:authUtils\nexport const PACKAGE_ACCESS = {\n SCOPE: '@*/*',\n ALL: '**',\n};\n\nexport function normalizeUserList(groupsList: any): any {\n const result: any[] = [];\n if (isNil(groupsList) || isEmpty(groupsList)) {\n return result;\n }\n\n // if it's a string, split it to array\n if (typeof groupsList === 'string') {\n const groupsArray = groupsList.split(/\\s+/);\n\n result.push(groupsArray);\n } else if (Array.isArray(groupsList)) {\n result.push(groupsList);\n } else {\n throw errorUtils.getInternalError(\n 'CONFIG: bad package acl (array or string expected): ' + JSON.stringify(groupsList)\n );\n }\n\n return flatten(result);\n}\n\nexport function normalisePackageAccess(packages: LegacyPackageList): LegacyPackageList {\n const normalizedPkgs: LegacyPackageList = { ...packages };\n if (isNil(normalizedPkgs['**'])) {\n normalizedPkgs['**'] = {\n access: [],\n publish: [],\n unpublish: [],\n proxy: [],\n };\n }\n\n for (const pkg in packages) {\n if (Object.prototype.hasOwnProperty.call(packages, pkg)) {\n const packageAccess = packages[pkg];\n debug('package access %s for %s ', packageAccess, pkg);\n const isInvalid = isObject(packageAccess) && !Array.isArray(packageAccess);\n assert(isInvalid, `CONFIG: bad \"'${pkg}'\" package description (object expected)`);\n\n normalizedPkgs[pkg].access = normalizeUserList(packageAccess.access);\n normalizedPkgs[pkg].publish = normalizeUserList(packageAccess.publish);\n normalizedPkgs[pkg].proxy = normalizeUserList(packageAccess.proxy);\n // if unpublish is not defined, we set to false to fallback in publish access\n normalizedPkgs[pkg].unpublish = isUndefined(packageAccess.unpublish)\n ? false\n : normalizeUserList(packageAccess.unpublish);\n }\n }\n\n return normalizedPkgs;\n}\n"],"mappings":";;;;;;;;AAOA,IAAM,WAAA,GAAA,MAAA,SAAmB,wBAAwB;AAOjD,IAAa,QAAQ;CACnB,MAAM;CACN,KAAK;CACL,OAAO;CACP,YAAY;CACZ,gBAAgB;CAChB,iBAAiB;CACjB,sBAAsB;AACxB;AAGA,IAAa,iBAAiB;CAC5B,OAAO;CACP,KAAK;AACP;AAEA,SAAgB,kBAAkB,YAAsB;CACtD,MAAM,SAAgB,CAAC;CACvB,KAAA,GAAA,UAAA,OAAU,UAAU,MAAA,GAAA,UAAA,SAAa,UAAU,GACzC,OAAO;CAIT,IAAI,OAAO,eAAe,UAAU;EAClC,MAAM,cAAc,WAAW,MAAM,KAAK;EAE1C,OAAO,KAAK,WAAW;CACzB,OAAO,IAAI,MAAM,QAAQ,UAAU,GACjC,OAAO,KAAK,UAAU;MAEtB,MAAM,gBAAA,WAAW,iBACf,yDAAyD,KAAK,UAAU,UAAU,CACpF;CAGF,QAAA,GAAA,UAAA,SAAe,MAAM;AACvB;AAEA,SAAgB,uBAAuB,UAAgD;CACrF,MAAM,iBAAoC,EAAE,GAAG,SAAS;CACxD,KAAA,GAAA,UAAA,OAAU,eAAe,KAAK,GAC5B,eAAe,QAAQ;EACrB,QAAQ,CAAC;EACT,SAAS,CAAC;EACV,WAAW,CAAC;EACZ,OAAO,CAAC;CACV;CAGF,KAAK,MAAM,OAAO,UAChB,IAAI,OAAO,UAAU,eAAe,KAAK,UAAU,GAAG,GAAG;EACvD,MAAM,gBAAgB,SAAS;EAC/B,QAAM,6BAA6B,eAAe,GAAG;EAErD,CAAA,GAAA,YAAA,UAAA,GAAA,UAAA,UAD2B,aAAa,KAAK,CAAC,MAAM,QAAQ,aAAa,GACvD,iBAAiB,IAAI,yCAAyC;EAEhF,eAAe,KAAK,SAAS,kBAAkB,cAAc,MAAM;EACnE,eAAe,KAAK,UAAU,kBAAkB,cAAc,OAAO;EACrE,eAAe,KAAK,QAAQ,kBAAkB,cAAc,KAAK;EAEjE,eAAe,KAAK,aAAA,GAAA,UAAA,aAAwB,cAAc,SAAS,IAC/D,QACA,kBAAkB,cAAc,SAAS;CAC/C;CAGF,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-access.mjs","names":[],"sources":["../src/package-access.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { flatten, isEmpty, isNil, isObject, isUndefined } from 'lodash-es';\nimport assert from 'node:assert';\n\nimport { errorUtils } from '@verdaccio/core';\nimport type { PackageAccess } from '@verdaccio/types';\n\nconst debug = buildDebug('verdaccio:config:utils');\n\nexport interface LegacyPackageList {\n [key: string]: PackageAccess;\n}\n\n// @deprecated use @verdaccio/core:authUtils\nexport const ROLES = {\n $ALL: '$all',\n ALL: 'all',\n $AUTH: '$authenticated',\n $ANONYMOUS: '$anonymous',\n DEPRECATED_ALL: '@all',\n DEPRECATED_AUTH: '@authenticated',\n DEPRECATED_ANONYMOUS: '@anonymous',\n};\n\n// @deprecated use @verdaccio/core:authUtils\nexport const PACKAGE_ACCESS = {\n SCOPE: '@*/*',\n ALL: '**',\n};\n\nexport function normalizeUserList(groupsList: any): any {\n const result: any[] = [];\n if (isNil(groupsList) || isEmpty(groupsList)) {\n return result;\n }\n\n // if it's a string, split it to array\n if (typeof groupsList === 'string') {\n const groupsArray = groupsList.split(/\\s+/);\n\n result.push(groupsArray);\n } else if (Array.isArray(groupsList)) {\n result.push(groupsList);\n } else {\n throw errorUtils.getInternalError(\n 'CONFIG: bad package acl (array or string expected): ' + JSON.stringify(groupsList)\n );\n }\n\n return flatten(result);\n}\n\nexport function normalisePackageAccess(packages: LegacyPackageList): LegacyPackageList {\n const normalizedPkgs: LegacyPackageList = { ...packages };\n if (isNil(normalizedPkgs['**'])) {\n normalizedPkgs['**'] = {\n access: [],\n publish: [],\n unpublish: [],\n proxy: [],\n };\n }\n\n for (const pkg in packages) {\n if (Object.prototype.hasOwnProperty.call(packages, pkg)) {\n const packageAccess = packages[pkg];\n debug('package access %s for %s ', packageAccess, pkg);\n const isInvalid = isObject(packageAccess) && !Array.isArray(packageAccess);\n assert(isInvalid, `CONFIG: bad \"'${pkg}'\" package description (object expected)`);\n\n normalizedPkgs[pkg].access = normalizeUserList(packageAccess.access);\n normalizedPkgs[pkg].publish = normalizeUserList(packageAccess.publish);\n normalizedPkgs[pkg].proxy = normalizeUserList(packageAccess.proxy);\n // if unpublish is not defined, we set to false to fallback in publish access\n normalizedPkgs[pkg].unpublish = isUndefined(packageAccess.unpublish)\n ? false\n : normalizeUserList(packageAccess.unpublish);\n }\n }\n\n return normalizedPkgs;\n}\n"],"mappings":";;;;;AAOA,IAAM,QAAQ,WAAW,
|
|
1
|
+
{"version":3,"file":"package-access.mjs","names":[],"sources":["../src/package-access.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { flatten, isEmpty, isNil, isObject, isUndefined } from 'lodash-es';\nimport assert from 'node:assert';\n\nimport { errorUtils } from '@verdaccio/core';\nimport type { PackageAccess } from '@verdaccio/types';\n\nconst debug = buildDebug('verdaccio:config:utils');\n\nexport interface LegacyPackageList {\n [key: string]: PackageAccess;\n}\n\n// @deprecated use @verdaccio/core:authUtils\nexport const ROLES = {\n $ALL: '$all',\n ALL: 'all',\n $AUTH: '$authenticated',\n $ANONYMOUS: '$anonymous',\n DEPRECATED_ALL: '@all',\n DEPRECATED_AUTH: '@authenticated',\n DEPRECATED_ANONYMOUS: '@anonymous',\n};\n\n// @deprecated use @verdaccio/core:authUtils\nexport const PACKAGE_ACCESS = {\n SCOPE: '@*/*',\n ALL: '**',\n};\n\nexport function normalizeUserList(groupsList: any): any {\n const result: any[] = [];\n if (isNil(groupsList) || isEmpty(groupsList)) {\n return result;\n }\n\n // if it's a string, split it to array\n if (typeof groupsList === 'string') {\n const groupsArray = groupsList.split(/\\s+/);\n\n result.push(groupsArray);\n } else if (Array.isArray(groupsList)) {\n result.push(groupsList);\n } else {\n throw errorUtils.getInternalError(\n 'CONFIG: bad package acl (array or string expected): ' + JSON.stringify(groupsList)\n );\n }\n\n return flatten(result);\n}\n\nexport function normalisePackageAccess(packages: LegacyPackageList): LegacyPackageList {\n const normalizedPkgs: LegacyPackageList = { ...packages };\n if (isNil(normalizedPkgs['**'])) {\n normalizedPkgs['**'] = {\n access: [],\n publish: [],\n unpublish: [],\n proxy: [],\n };\n }\n\n for (const pkg in packages) {\n if (Object.prototype.hasOwnProperty.call(packages, pkg)) {\n const packageAccess = packages[pkg];\n debug('package access %s for %s ', packageAccess, pkg);\n const isInvalid = isObject(packageAccess) && !Array.isArray(packageAccess);\n assert(isInvalid, `CONFIG: bad \"'${pkg}'\" package description (object expected)`);\n\n normalizedPkgs[pkg].access = normalizeUserList(packageAccess.access);\n normalizedPkgs[pkg].publish = normalizeUserList(packageAccess.publish);\n normalizedPkgs[pkg].proxy = normalizeUserList(packageAccess.proxy);\n // if unpublish is not defined, we set to false to fallback in publish access\n normalizedPkgs[pkg].unpublish = isUndefined(packageAccess.unpublish)\n ? false\n : normalizeUserList(packageAccess.unpublish);\n }\n }\n\n return normalizedPkgs;\n}\n"],"mappings":";;;;;AAOA,IAAM,QAAQ,WAAW,wBAAwB;AAOjD,IAAa,QAAQ;CACnB,MAAM;CACN,KAAK;CACL,OAAO;CACP,YAAY;CACZ,gBAAgB;CAChB,iBAAiB;CACjB,sBAAsB;AACxB;AAGA,IAAa,iBAAiB;CAC5B,OAAO;CACP,KAAK;AACP;AAEA,SAAgB,kBAAkB,YAAsB;CACtD,MAAM,SAAgB,CAAC;CACvB,IAAI,MAAM,UAAU,KAAK,QAAQ,UAAU,GACzC,OAAO;CAIT,IAAI,OAAO,eAAe,UAAU;EAClC,MAAM,cAAc,WAAW,MAAM,KAAK;EAE1C,OAAO,KAAK,WAAW;CACzB,OAAO,IAAI,MAAM,QAAQ,UAAU,GACjC,OAAO,KAAK,UAAU;MAEtB,MAAM,WAAW,iBACf,yDAAyD,KAAK,UAAU,UAAU,CACpF;CAGF,OAAO,QAAQ,MAAM;AACvB;AAEA,SAAgB,uBAAuB,UAAgD;CACrF,MAAM,iBAAoC,EAAE,GAAG,SAAS;CACxD,IAAI,MAAM,eAAe,KAAK,GAC5B,eAAe,QAAQ;EACrB,QAAQ,CAAC;EACT,SAAS,CAAC;EACV,WAAW,CAAC;EACZ,OAAO,CAAC;CACV;CAGF,KAAK,MAAM,OAAO,UAChB,IAAI,OAAO,UAAU,eAAe,KAAK,UAAU,GAAG,GAAG;EACvD,MAAM,gBAAgB,SAAS;EAC/B,MAAM,6BAA6B,eAAe,GAAG;EAErD,OADkB,SAAS,aAAa,KAAK,CAAC,MAAM,QAAQ,aAAa,GACvD,iBAAiB,IAAI,yCAAyC;EAEhF,eAAe,KAAK,SAAS,kBAAkB,cAAc,MAAM;EACnE,eAAe,KAAK,UAAU,kBAAkB,cAAc,OAAO;EACrE,eAAe,KAAK,QAAQ,kBAAkB,cAAc,KAAK;EAEjE,eAAe,KAAK,YAAY,YAAY,cAAc,SAAS,IAC/D,QACA,kBAAkB,cAAc,SAAS;CAC/C;CAGF,OAAO;AACT"}
|
package/build/parse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","names":[],"sources":["../src/parse.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport YAML from 'js-yaml';\nimport { isObject } from 'lodash-es';\nimport fs from 'node:fs';\n\nimport { API_ERROR, APP_ERROR } from '@verdaccio/core';\nimport type { ConfigYaml } from '@verdaccio/types';\n\nimport { findConfigFile } from './config-path';\nimport { fileExists } from './config-utils';\n\nconst debug = buildDebug('verdaccio:config:parse');\n\n/**\n * Parse a YAML config file.\n * @param configPath the absolute path of the configuration file (must end in .yaml or .yml)\n */\nexport function parseConfigFile(configPath: string): ConfigYaml & {\n // @deprecated use configPath instead\n config_path: string;\n configPath: string;\n} {\n debug('parse config file %s', configPath);\n if (!fileExists(configPath)) {\n throw new Error(`config file does not exist or not reachable`);\n }\n if (!/\\.ya?ml$/i.test(configPath)) {\n throw new Error(`config file must be a YAML file (.yaml or .yml)`);\n }\n debug('parsing config file: %o', configPath);\n try {\n const yamlConfig = YAML.load(fs.readFileSync(configPath, 'utf8')) as ConfigYaml;\n\n return Object.assign({}, yamlConfig, {\n configPath,\n // @deprecated use configPath instead\n config_path: configPath,\n });\n } catch (e: any) {\n debug('failed to parse config %o error: %o', configPath, e.message);\n throw new Error(APP_ERROR.CONFIG_NOT_VALID, { cause: e });\n }\n}\n\nexport function fromJStoYAML(config: Partial<ConfigYaml>): string | null {\n debug('convert config from JSON to YAML');\n if (isObject(config)) {\n return YAML.dump(config);\n } else {\n throw new Error(`config is not a valid object`);\n }\n}\n\n/**\n * Parses and returns a configuration object of type `ConfigYaml`.\n *\n * If a string or `undefined` is provided, it is interpreted as a path to a config file\n * (or uses a default location). The config file is then loaded and parsed.\n * If an object is provided, it is assumed to be a pre-parsed configuration.\n *\n * @param {string | ConfigYaml} [config] - Optional. A path to the configuration file (string),\n * a pre-parsed config object, or `undefined`.\n * @returns {ConfigYaml} The parsed configuration object.\n * @throws {Error} If the provided config is neither a string, undefined, nor an object.\n */\nexport function getConfigParsed(config?: string | ConfigYaml): ConfigYaml {\n debug('getConfigParsed called with config: %o', typeof config);\n let configurationParsed: ConfigYaml;\n if (config === undefined || typeof config === 'string') {\n debug('using default configuration');\n const configPathLocation = findConfigFile(config);\n configurationParsed = parseConfigFile(configPathLocation);\n } else if (typeof config === 'object' && config !== null) {\n configurationParsed = config;\n\n // When config is provided as an object (programmatic API), ensure configPath\n // is set so the Config constructor does not throw.\n if (!configurationParsed.configPath) {\n configurationParsed.configPath = process.cwd();\n }\n } else {\n throw new Error(API_ERROR.CONFIG_BAD_FORMAT);\n }\n return configurationParsed;\n}\n"],"mappings":";;;;;;;;;;;;AAWA,IAAM,WAAA,GAAA,MAAA,SAAmB,
|
|
1
|
+
{"version":3,"file":"parse.js","names":[],"sources":["../src/parse.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport YAML from 'js-yaml';\nimport { isObject } from 'lodash-es';\nimport fs from 'node:fs';\n\nimport { API_ERROR, APP_ERROR } from '@verdaccio/core';\nimport type { ConfigYaml } from '@verdaccio/types';\n\nimport { findConfigFile } from './config-path';\nimport { fileExists } from './config-utils';\n\nconst debug = buildDebug('verdaccio:config:parse');\n\n/**\n * Parse a YAML config file.\n * @param configPath the absolute path of the configuration file (must end in .yaml or .yml)\n */\nexport function parseConfigFile(configPath: string): ConfigYaml & {\n // @deprecated use configPath instead\n config_path: string;\n configPath: string;\n} {\n debug('parse config file %s', configPath);\n if (!fileExists(configPath)) {\n throw new Error(`config file does not exist or not reachable`);\n }\n if (!/\\.ya?ml$/i.test(configPath)) {\n throw new Error(`config file must be a YAML file (.yaml or .yml)`);\n }\n debug('parsing config file: %o', configPath);\n try {\n const yamlConfig = YAML.load(fs.readFileSync(configPath, 'utf8')) as ConfigYaml;\n\n return Object.assign({}, yamlConfig, {\n configPath,\n // @deprecated use configPath instead\n config_path: configPath,\n });\n } catch (e: any) {\n debug('failed to parse config %o error: %o', configPath, e.message);\n throw new Error(APP_ERROR.CONFIG_NOT_VALID, { cause: e });\n }\n}\n\nexport function fromJStoYAML(config: Partial<ConfigYaml>): string | null {\n debug('convert config from JSON to YAML');\n if (isObject(config)) {\n return YAML.dump(config);\n } else {\n throw new Error(`config is not a valid object`);\n }\n}\n\n/**\n * Parses and returns a configuration object of type `ConfigYaml`.\n *\n * If a string or `undefined` is provided, it is interpreted as a path to a config file\n * (or uses a default location). The config file is then loaded and parsed.\n * If an object is provided, it is assumed to be a pre-parsed configuration.\n *\n * @param {string | ConfigYaml} [config] - Optional. A path to the configuration file (string),\n * a pre-parsed config object, or `undefined`.\n * @returns {ConfigYaml} The parsed configuration object.\n * @throws {Error} If the provided config is neither a string, undefined, nor an object.\n */\nexport function getConfigParsed(config?: string | ConfigYaml): ConfigYaml {\n debug('getConfigParsed called with config: %o', typeof config);\n let configurationParsed: ConfigYaml;\n if (config === undefined || typeof config === 'string') {\n debug('using default configuration');\n const configPathLocation = findConfigFile(config);\n configurationParsed = parseConfigFile(configPathLocation);\n } else if (typeof config === 'object' && config !== null) {\n configurationParsed = config;\n\n // When config is provided as an object (programmatic API), ensure configPath\n // is set so the Config constructor does not throw.\n if (!configurationParsed.configPath) {\n configurationParsed.configPath = process.cwd();\n }\n } else {\n throw new Error(API_ERROR.CONFIG_BAD_FORMAT);\n }\n return configurationParsed;\n}\n"],"mappings":";;;;;;;;;;;;AAWA,IAAM,WAAA,GAAA,MAAA,SAAmB,wBAAwB;;;;;AAMjD,SAAgB,gBAAgB,YAI9B;CACA,QAAM,wBAAwB,UAAU;CACxC,IAAI,CAAC,qBAAA,WAAW,UAAU,GACxB,MAAM,IAAI,MAAM,6CAA6C;CAE/D,IAAI,CAAC,YAAY,KAAK,UAAU,GAC9B,MAAM,IAAI,MAAM,iDAAiD;CAEnE,QAAM,2BAA2B,UAAU;CAC3C,IAAI;EACF,MAAM,aAAa,QAAA,QAAK,KAAK,QAAA,QAAG,aAAa,YAAY,MAAM,CAAC;EAEhE,OAAO,OAAO,OAAO,CAAC,GAAG,YAAY;GACnC;GAEA,aAAa;EACf,CAAC;CACH,SAAS,GAAQ;EACf,QAAM,uCAAuC,YAAY,EAAE,OAAO;EAClE,MAAM,IAAI,MAAM,gBAAA,UAAU,kBAAkB,EAAE,OAAO,EAAE,CAAC;CAC1D;AACF;AAEA,SAAgB,aAAa,QAA4C;CACvE,QAAM,kCAAkC;CACxC,KAAA,GAAA,UAAA,UAAa,MAAM,GACjB,OAAO,QAAA,QAAK,KAAK,MAAM;MAEvB,MAAM,IAAI,MAAM,8BAA8B;AAElD;;;;;;;;;;;;;AAcA,SAAgB,gBAAgB,QAA0C;CACxE,QAAM,0CAA0C,OAAO,MAAM;CAC7D,IAAI;CACJ,IAAI,WAAW,KAAA,KAAa,OAAO,WAAW,UAAU;EACtD,QAAM,6BAA6B;EAEnC,sBAAsB,gBADK,oBAAA,eAAe,MACJ,CAAkB;CAC1D,OAAO,IAAI,OAAO,WAAW,YAAY,WAAW,MAAM;EACxD,sBAAsB;EAItB,IAAI,CAAC,oBAAoB,YACvB,oBAAoB,aAAa,QAAQ,IAAI;CAEjD,OACE,MAAM,IAAI,MAAM,gBAAA,UAAU,iBAAiB;CAE7C,OAAO;AACT"}
|
package/build/parse.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.mjs","names":[],"sources":["../src/parse.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport YAML from 'js-yaml';\nimport { isObject } from 'lodash-es';\nimport fs from 'node:fs';\n\nimport { API_ERROR, APP_ERROR } from '@verdaccio/core';\nimport type { ConfigYaml } from '@verdaccio/types';\n\nimport { findConfigFile } from './config-path';\nimport { fileExists } from './config-utils';\n\nconst debug = buildDebug('verdaccio:config:parse');\n\n/**\n * Parse a YAML config file.\n * @param configPath the absolute path of the configuration file (must end in .yaml or .yml)\n */\nexport function parseConfigFile(configPath: string): ConfigYaml & {\n // @deprecated use configPath instead\n config_path: string;\n configPath: string;\n} {\n debug('parse config file %s', configPath);\n if (!fileExists(configPath)) {\n throw new Error(`config file does not exist or not reachable`);\n }\n if (!/\\.ya?ml$/i.test(configPath)) {\n throw new Error(`config file must be a YAML file (.yaml or .yml)`);\n }\n debug('parsing config file: %o', configPath);\n try {\n const yamlConfig = YAML.load(fs.readFileSync(configPath, 'utf8')) as ConfigYaml;\n\n return Object.assign({}, yamlConfig, {\n configPath,\n // @deprecated use configPath instead\n config_path: configPath,\n });\n } catch (e: any) {\n debug('failed to parse config %o error: %o', configPath, e.message);\n throw new Error(APP_ERROR.CONFIG_NOT_VALID, { cause: e });\n }\n}\n\nexport function fromJStoYAML(config: Partial<ConfigYaml>): string | null {\n debug('convert config from JSON to YAML');\n if (isObject(config)) {\n return YAML.dump(config);\n } else {\n throw new Error(`config is not a valid object`);\n }\n}\n\n/**\n * Parses and returns a configuration object of type `ConfigYaml`.\n *\n * If a string or `undefined` is provided, it is interpreted as a path to a config file\n * (or uses a default location). The config file is then loaded and parsed.\n * If an object is provided, it is assumed to be a pre-parsed configuration.\n *\n * @param {string | ConfigYaml} [config] - Optional. A path to the configuration file (string),\n * a pre-parsed config object, or `undefined`.\n * @returns {ConfigYaml} The parsed configuration object.\n * @throws {Error} If the provided config is neither a string, undefined, nor an object.\n */\nexport function getConfigParsed(config?: string | ConfigYaml): ConfigYaml {\n debug('getConfigParsed called with config: %o', typeof config);\n let configurationParsed: ConfigYaml;\n if (config === undefined || typeof config === 'string') {\n debug('using default configuration');\n const configPathLocation = findConfigFile(config);\n configurationParsed = parseConfigFile(configPathLocation);\n } else if (typeof config === 'object' && config !== null) {\n configurationParsed = config;\n\n // When config is provided as an object (programmatic API), ensure configPath\n // is set so the Config constructor does not throw.\n if (!configurationParsed.configPath) {\n configurationParsed.configPath = process.cwd();\n }\n } else {\n throw new Error(API_ERROR.CONFIG_BAD_FORMAT);\n }\n return configurationParsed;\n}\n"],"mappings":";;;;;;;;AAWA,IAAM,QAAQ,WAAW,
|
|
1
|
+
{"version":3,"file":"parse.mjs","names":[],"sources":["../src/parse.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport YAML from 'js-yaml';\nimport { isObject } from 'lodash-es';\nimport fs from 'node:fs';\n\nimport { API_ERROR, APP_ERROR } from '@verdaccio/core';\nimport type { ConfigYaml } from '@verdaccio/types';\n\nimport { findConfigFile } from './config-path';\nimport { fileExists } from './config-utils';\n\nconst debug = buildDebug('verdaccio:config:parse');\n\n/**\n * Parse a YAML config file.\n * @param configPath the absolute path of the configuration file (must end in .yaml or .yml)\n */\nexport function parseConfigFile(configPath: string): ConfigYaml & {\n // @deprecated use configPath instead\n config_path: string;\n configPath: string;\n} {\n debug('parse config file %s', configPath);\n if (!fileExists(configPath)) {\n throw new Error(`config file does not exist or not reachable`);\n }\n if (!/\\.ya?ml$/i.test(configPath)) {\n throw new Error(`config file must be a YAML file (.yaml or .yml)`);\n }\n debug('parsing config file: %o', configPath);\n try {\n const yamlConfig = YAML.load(fs.readFileSync(configPath, 'utf8')) as ConfigYaml;\n\n return Object.assign({}, yamlConfig, {\n configPath,\n // @deprecated use configPath instead\n config_path: configPath,\n });\n } catch (e: any) {\n debug('failed to parse config %o error: %o', configPath, e.message);\n throw new Error(APP_ERROR.CONFIG_NOT_VALID, { cause: e });\n }\n}\n\nexport function fromJStoYAML(config: Partial<ConfigYaml>): string | null {\n debug('convert config from JSON to YAML');\n if (isObject(config)) {\n return YAML.dump(config);\n } else {\n throw new Error(`config is not a valid object`);\n }\n}\n\n/**\n * Parses and returns a configuration object of type `ConfigYaml`.\n *\n * If a string or `undefined` is provided, it is interpreted as a path to a config file\n * (or uses a default location). The config file is then loaded and parsed.\n * If an object is provided, it is assumed to be a pre-parsed configuration.\n *\n * @param {string | ConfigYaml} [config] - Optional. A path to the configuration file (string),\n * a pre-parsed config object, or `undefined`.\n * @returns {ConfigYaml} The parsed configuration object.\n * @throws {Error} If the provided config is neither a string, undefined, nor an object.\n */\nexport function getConfigParsed(config?: string | ConfigYaml): ConfigYaml {\n debug('getConfigParsed called with config: %o', typeof config);\n let configurationParsed: ConfigYaml;\n if (config === undefined || typeof config === 'string') {\n debug('using default configuration');\n const configPathLocation = findConfigFile(config);\n configurationParsed = parseConfigFile(configPathLocation);\n } else if (typeof config === 'object' && config !== null) {\n configurationParsed = config;\n\n // When config is provided as an object (programmatic API), ensure configPath\n // is set so the Config constructor does not throw.\n if (!configurationParsed.configPath) {\n configurationParsed.configPath = process.cwd();\n }\n } else {\n throw new Error(API_ERROR.CONFIG_BAD_FORMAT);\n }\n return configurationParsed;\n}\n"],"mappings":";;;;;;;;AAWA,IAAM,QAAQ,WAAW,wBAAwB;;;;;AAMjD,SAAgB,gBAAgB,YAI9B;CACA,MAAM,wBAAwB,UAAU;CACxC,IAAI,CAAC,WAAW,UAAU,GACxB,MAAM,IAAI,MAAM,6CAA6C;CAE/D,IAAI,CAAC,YAAY,KAAK,UAAU,GAC9B,MAAM,IAAI,MAAM,iDAAiD;CAEnE,MAAM,2BAA2B,UAAU;CAC3C,IAAI;EACF,MAAM,aAAa,KAAK,KAAK,GAAG,aAAa,YAAY,MAAM,CAAC;EAEhE,OAAO,OAAO,OAAO,CAAC,GAAG,YAAY;GACnC;GAEA,aAAa;EACf,CAAC;CACH,SAAS,GAAQ;EACf,MAAM,uCAAuC,YAAY,EAAE,OAAO;EAClE,MAAM,IAAI,MAAM,UAAU,kBAAkB,EAAE,OAAO,EAAE,CAAC;CAC1D;AACF;AAEA,SAAgB,aAAa,QAA4C;CACvE,MAAM,kCAAkC;CACxC,IAAI,SAAS,MAAM,GACjB,OAAO,KAAK,KAAK,MAAM;MAEvB,MAAM,IAAI,MAAM,8BAA8B;AAElD;;;;;;;;;;;;;AAcA,SAAgB,gBAAgB,QAA0C;CACxE,MAAM,0CAA0C,OAAO,MAAM;CAC7D,IAAI;CACJ,IAAI,WAAW,KAAA,KAAa,OAAO,WAAW,UAAU;EACtD,MAAM,6BAA6B;EAEnC,sBAAsB,gBADK,eAAe,MACJ,CAAkB;CAC1D,OAAO,IAAI,OAAO,WAAW,YAAY,WAAW,MAAM;EACxD,sBAAsB;EAItB,IAAI,CAAC,oBAAoB,YACvB,oBAAoB,aAAa,QAAQ,IAAI;CAEjD,OACE,MAAM,IAAI,MAAM,UAAU,iBAAiB;CAE7C,OAAO;AACT"}
|
package/build/security.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.js","names":[],"sources":["../src/security.ts"],"sourcesContent":["import type { APITokenOptions, JWTOptions, Security } from '@verdaccio/types';\n\n// TODO: get this from core package\nexport const TIME_EXPIRATION_1H = '1h';\n\nconst defaultWebTokenOptions: JWTOptions = {\n sign: {\n // The expiration token for the website is 7 days\n expiresIn: TIME_EXPIRATION_1H,\n },\n verify: {},\n};\n\nconst defaultApiTokenConf: APITokenOptions = {\n legacy: true,\n};\n\nexport const defaultSecurity: Security = {\n web: defaultWebTokenOptions,\n api: defaultApiTokenConf,\n};\n"],"mappings":";AAGA,IAAa,qBAAqB;AAclC,IAAa,kBAA4B;CACvC,
|
|
1
|
+
{"version":3,"file":"security.js","names":[],"sources":["../src/security.ts"],"sourcesContent":["import type { APITokenOptions, JWTOptions, Security } from '@verdaccio/types';\n\n// TODO: get this from core package\nexport const TIME_EXPIRATION_1H = '1h';\n\nconst defaultWebTokenOptions: JWTOptions = {\n sign: {\n // The expiration token for the website is 7 days\n expiresIn: TIME_EXPIRATION_1H,\n },\n verify: {},\n};\n\nconst defaultApiTokenConf: APITokenOptions = {\n legacy: true,\n};\n\nexport const defaultSecurity: Security = {\n web: defaultWebTokenOptions,\n api: defaultApiTokenConf,\n};\n"],"mappings":";AAGA,IAAa,qBAAqB;AAclC,IAAa,kBAA4B;CACvC,KAAK;EAZL,MAAM,EAEJ,WAAA,KACF;EACA,QAAQ,CAAC;CAQJ;CACL,KAAK,EALL,QAAQ,KAKH;AACP"}
|
package/build/security.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.mjs","names":[],"sources":["../src/security.ts"],"sourcesContent":["import type { APITokenOptions, JWTOptions, Security } from '@verdaccio/types';\n\n// TODO: get this from core package\nexport const TIME_EXPIRATION_1H = '1h';\n\nconst defaultWebTokenOptions: JWTOptions = {\n sign: {\n // The expiration token for the website is 7 days\n expiresIn: TIME_EXPIRATION_1H,\n },\n verify: {},\n};\n\nconst defaultApiTokenConf: APITokenOptions = {\n legacy: true,\n};\n\nexport const defaultSecurity: Security = {\n web: defaultWebTokenOptions,\n api: defaultApiTokenConf,\n};\n"],"mappings":";AAGA,IAAa,qBAAqB;AAclC,IAAa,kBAA4B;CACvC,
|
|
1
|
+
{"version":3,"file":"security.mjs","names":[],"sources":["../src/security.ts"],"sourcesContent":["import type { APITokenOptions, JWTOptions, Security } from '@verdaccio/types';\n\n// TODO: get this from core package\nexport const TIME_EXPIRATION_1H = '1h';\n\nconst defaultWebTokenOptions: JWTOptions = {\n sign: {\n // The expiration token for the website is 7 days\n expiresIn: TIME_EXPIRATION_1H,\n },\n verify: {},\n};\n\nconst defaultApiTokenConf: APITokenOptions = {\n legacy: true,\n};\n\nexport const defaultSecurity: Security = {\n web: defaultWebTokenOptions,\n api: defaultApiTokenConf,\n};\n"],"mappings":";AAGA,IAAa,qBAAqB;AAclC,IAAa,kBAA4B;CACvC,KAAK;EAZL,MAAM,EAEJ,WAAA,KACF;EACA,QAAQ,CAAC;CAQJ;CACL,KAAK,EALL,QAAQ,KAKH;AACP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverSettings.js","names":[],"sources":["../src/serverSettings.ts"],"sourcesContent":["export default {\n // https://www.npmjs.com/package/express-rate-limit\n // values are intended to be high, please customize based on own needs\n rateLimit: {\n windowMs: 1000,\n max: 10000,\n },\n // deprecated\n keepAliveTimeout: 60,\n};\n"],"mappings":";AAAA,IAAA,yBAAe;CAGb,WAAW;EACT,UAAU;EACV,KAAK;
|
|
1
|
+
{"version":3,"file":"serverSettings.js","names":[],"sources":["../src/serverSettings.ts"],"sourcesContent":["export default {\n // https://www.npmjs.com/package/express-rate-limit\n // values are intended to be high, please customize based on own needs\n rateLimit: {\n windowMs: 1000,\n max: 10000,\n },\n // deprecated\n keepAliveTimeout: 60,\n};\n"],"mappings":";AAAA,IAAA,yBAAe;CAGb,WAAW;EACT,UAAU;EACV,KAAK;CACP;CAEA,kBAAkB;AACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverSettings.mjs","names":[],"sources":["../src/serverSettings.ts"],"sourcesContent":["export default {\n // https://www.npmjs.com/package/express-rate-limit\n // values are intended to be high, please customize based on own needs\n rateLimit: {\n windowMs: 1000,\n max: 10000,\n },\n // deprecated\n keepAliveTimeout: 60,\n};\n"],"mappings":";AAAA,IAAA,yBAAe;CAGb,WAAW;EACT,UAAU;EACV,KAAK;
|
|
1
|
+
{"version":3,"file":"serverSettings.mjs","names":[],"sources":["../src/serverSettings.ts"],"sourcesContent":["export default {\n // https://www.npmjs.com/package/express-rate-limit\n // values are intended to be high, please customize based on own needs\n rateLimit: {\n windowMs: 1000,\n max: 10000,\n },\n // deprecated\n keepAliveTimeout: 60,\n};\n"],"mappings":";AAAA,IAAA,yBAAe;CAGb,WAAW;EACT,UAAU;EACV,KAAK;CACP;CAEA,kBAAkB;AACpB"}
|
package/build/token.js
CHANGED
package/build/token.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","names":[],"sources":["../src/token.ts"],"sourcesContent":["import { randomBytes } from 'node:crypto';\n\nexport const TOKEN_VALID_LENGTH = 32;\n\n/**\n * Secret key must have 32 characters.\n */\nexport function generateRandomSecretKey(): string {\n return randomBytes(TOKEN_VALID_LENGTH).toString('base64').substring(0, TOKEN_VALID_LENGTH);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"token.js","names":[],"sources":["../src/token.ts"],"sourcesContent":["import { randomBytes } from 'node:crypto';\n\nexport const TOKEN_VALID_LENGTH = 32;\n\n/**\n * Secret key must have 32 characters.\n */\nexport function generateRandomSecretKey(): string {\n return randomBytes(TOKEN_VALID_LENGTH).toString('base64').substring(0, TOKEN_VALID_LENGTH);\n}\n"],"mappings":";;AAEA,IAAa,qBAAqB;;;;AAKlC,SAAgB,0BAAkC;CAChD,QAAA,GAAA,YAAA,aAAA,EAAqC,EAAE,SAAS,QAAQ,EAAE,UAAU,GAAA,EAAqB;AAC3F"}
|
package/build/token.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.mjs","names":[],"sources":["../src/token.ts"],"sourcesContent":["import { randomBytes } from 'node:crypto';\n\nexport const TOKEN_VALID_LENGTH = 32;\n\n/**\n * Secret key must have 32 characters.\n */\nexport function generateRandomSecretKey(): string {\n return randomBytes(TOKEN_VALID_LENGTH).toString('base64').substring(0, TOKEN_VALID_LENGTH);\n}\n"],"mappings":";;AAEA,IAAa,qBAAqB;;;;AAKlC,SAAgB,0BAAkC;
|
|
1
|
+
{"version":3,"file":"token.mjs","names":[],"sources":["../src/token.ts"],"sourcesContent":["import { randomBytes } from 'node:crypto';\n\nexport const TOKEN_VALID_LENGTH = 32;\n\n/**\n * Secret key must have 32 characters.\n */\nexport function generateRandomSecretKey(): string {\n return randomBytes(TOKEN_VALID_LENGTH).toString('base64').substring(0, TOKEN_VALID_LENGTH);\n}\n"],"mappings":";;AAEA,IAAa,qBAAqB;;;;AAKlC,SAAgB,0BAAkC;CAChD,OAAO,YAAA,EAA8B,EAAE,SAAS,QAAQ,EAAE,UAAU,GAAA,EAAqB;AAC3F"}
|
package/build/uplinks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uplinks.js","names":[],"sources":["../src/uplinks.ts"],"sourcesContent":["import { clone, isNil } from 'lodash-es';\nimport assert from 'node:assert';\n\nimport { authUtils } from '@verdaccio/core';\nimport type { PackageList, UpLinksConfList } from '@verdaccio/types';\n\nexport const DEFAULT_REGISTRY = 'https://registry.npmjs.org';\nexport const DEFAULT_UPLINK = 'npmjs';\n\nconst BLACKLIST = {\n all: true,\n anonymous: true,\n undefined: true,\n owner: true,\n none: true,\n};\n\nexport function uplinkSanityCheck(\n uplinks: UpLinksConfList,\n users: any = BLACKLIST\n): UpLinksConfList {\n const newUplinks = clone(uplinks);\n let newUsers = clone(users);\n\n for (const uplink in newUplinks) {\n if (Object.prototype.hasOwnProperty.call(newUplinks, uplink)) {\n if (typeof newUplinks[uplink].cache === 'undefined') {\n newUplinks[uplink].cache = true;\n }\n newUsers = sanityCheckNames(uplink, newUsers);\n }\n }\n\n return newUplinks;\n}\n\nexport function sanityCheckUplinksProps(configUpLinks: UpLinksConfList): UpLinksConfList {\n const uplinks = clone(configUpLinks);\n\n for (const uplink in uplinks) {\n if (Object.prototype.hasOwnProperty.call(uplinks, uplink)) {\n assert(uplinks[uplink].url, 'CONFIG: no url for uplink: ' + uplink);\n assert(\n typeof uplinks[uplink].url === 'string',\n 'CONFIG: wrong url format for uplink: ' + uplink\n );\n uplinks[uplink].url = uplinks[uplink].url.replace(/\\/$/, '');\n }\n }\n\n return uplinks;\n}\n\nexport function getProxiesForPackage(pkg: string, packages: PackageList): string[] {\n const matchedPkg = authUtils.getMatchedPackagesSpec(pkg, packages);\n return matchedPkg?.proxy || [];\n}\n\nexport function hasProxyTo(pkg: string, upLink: string, packages: PackageList): boolean {\n const proxyList = getProxiesForPackage(pkg, packages);\n if (proxyList) {\n return proxyList.some((curr) => upLink === curr);\n }\n\n return false;\n}\n\nexport function sanityCheckNames(item: string, users: any): any {\n assert(\n item !== 'all' &&\n item !== 'owner' &&\n item !== 'anonymous' &&\n item !== 'undefined' &&\n item !== 'none',\n 'CONFIG: reserved uplink name: ' + item\n );\n assert(!item.match(/\\s/), 'CONFIG: invalid uplink name: ' + item);\n assert(isNil(users[item]), 'CONFIG: duplicate uplink name: ' + item);\n users[item] = true;\n\n return users;\n}\n"],"mappings":";;;;;;AAMA,IAAa,mBAAmB;AAChC,IAAa,iBAAiB;AAE9B,IAAM,YAAY;CAChB,KAAK;CACL,WAAW;CACX,WAAW;CACX,OAAO;CACP,MAAM;
|
|
1
|
+
{"version":3,"file":"uplinks.js","names":[],"sources":["../src/uplinks.ts"],"sourcesContent":["import { clone, isNil } from 'lodash-es';\nimport assert from 'node:assert';\n\nimport { authUtils } from '@verdaccio/core';\nimport type { PackageList, UpLinksConfList } from '@verdaccio/types';\n\nexport const DEFAULT_REGISTRY = 'https://registry.npmjs.org';\nexport const DEFAULT_UPLINK = 'npmjs';\n\nconst BLACKLIST = {\n all: true,\n anonymous: true,\n undefined: true,\n owner: true,\n none: true,\n};\n\nexport function uplinkSanityCheck(\n uplinks: UpLinksConfList,\n users: any = BLACKLIST\n): UpLinksConfList {\n const newUplinks = clone(uplinks);\n let newUsers = clone(users);\n\n for (const uplink in newUplinks) {\n if (Object.prototype.hasOwnProperty.call(newUplinks, uplink)) {\n if (typeof newUplinks[uplink].cache === 'undefined') {\n newUplinks[uplink].cache = true;\n }\n newUsers = sanityCheckNames(uplink, newUsers);\n }\n }\n\n return newUplinks;\n}\n\nexport function sanityCheckUplinksProps(configUpLinks: UpLinksConfList): UpLinksConfList {\n const uplinks = clone(configUpLinks);\n\n for (const uplink in uplinks) {\n if (Object.prototype.hasOwnProperty.call(uplinks, uplink)) {\n assert(uplinks[uplink].url, 'CONFIG: no url for uplink: ' + uplink);\n assert(\n typeof uplinks[uplink].url === 'string',\n 'CONFIG: wrong url format for uplink: ' + uplink\n );\n uplinks[uplink].url = uplinks[uplink].url.replace(/\\/$/, '');\n }\n }\n\n return uplinks;\n}\n\nexport function getProxiesForPackage(pkg: string, packages: PackageList): string[] {\n const matchedPkg = authUtils.getMatchedPackagesSpec(pkg, packages);\n return matchedPkg?.proxy || [];\n}\n\nexport function hasProxyTo(pkg: string, upLink: string, packages: PackageList): boolean {\n const proxyList = getProxiesForPackage(pkg, packages);\n if (proxyList) {\n return proxyList.some((curr) => upLink === curr);\n }\n\n return false;\n}\n\nexport function sanityCheckNames(item: string, users: any): any {\n assert(\n item !== 'all' &&\n item !== 'owner' &&\n item !== 'anonymous' &&\n item !== 'undefined' &&\n item !== 'none',\n 'CONFIG: reserved uplink name: ' + item\n );\n assert(!item.match(/\\s/), 'CONFIG: invalid uplink name: ' + item);\n assert(isNil(users[item]), 'CONFIG: duplicate uplink name: ' + item);\n users[item] = true;\n\n return users;\n}\n"],"mappings":";;;;;;AAMA,IAAa,mBAAmB;AAChC,IAAa,iBAAiB;AAE9B,IAAM,YAAY;CAChB,KAAK;CACL,WAAW;CACX,WAAW;CACX,OAAO;CACP,MAAM;AACR;AAEA,SAAgB,kBACd,SACA,QAAa,WACI;CACjB,MAAM,cAAA,GAAA,UAAA,OAAmB,OAAO;CAChC,IAAI,YAAA,GAAA,UAAA,OAAiB,KAAK;CAE1B,KAAK,MAAM,UAAU,YACnB,IAAI,OAAO,UAAU,eAAe,KAAK,YAAY,MAAM,GAAG;EAC5D,IAAI,OAAO,WAAW,QAAQ,UAAU,aACtC,WAAW,QAAQ,QAAQ;EAE7B,WAAW,iBAAiB,QAAQ,QAAQ;CAC9C;CAGF,OAAO;AACT;AAEA,SAAgB,wBAAwB,eAAiD;CACvF,MAAM,WAAA,GAAA,UAAA,OAAgB,aAAa;CAEnC,KAAK,MAAM,UAAU,SACnB,IAAI,OAAO,UAAU,eAAe,KAAK,SAAS,MAAM,GAAG;EACzD,CAAA,GAAA,YAAA,SAAO,QAAQ,QAAQ,KAAK,gCAAgC,MAAM;EAClE,CAAA,GAAA,YAAA,SACE,OAAO,QAAQ,QAAQ,QAAQ,UAC/B,0CAA0C,MAC5C;EACA,QAAQ,QAAQ,MAAM,QAAQ,QAAQ,IAAI,QAAQ,OAAO,EAAE;CAC7D;CAGF,OAAO;AACT;AAEA,SAAgB,qBAAqB,KAAa,UAAiC;CAEjF,OADmB,gBAAA,UAAU,uBAAuB,KAAK,QAClD,GAAY,SAAS,CAAC;AAC/B;AAEA,SAAgB,WAAW,KAAa,QAAgB,UAAgC;CACtF,MAAM,YAAY,qBAAqB,KAAK,QAAQ;CACpD,IAAI,WACF,OAAO,UAAU,MAAM,SAAS,WAAW,IAAI;CAGjD,OAAO;AACT;AAEA,SAAgB,iBAAiB,MAAc,OAAiB;CAC9D,CAAA,GAAA,YAAA,SACE,SAAS,SACP,SAAS,WACT,SAAS,eACT,SAAS,eACT,SAAS,QACX,mCAAmC,IACrC;CACA,CAAA,GAAA,YAAA,SAAO,CAAC,KAAK,MAAM,IAAI,GAAG,kCAAkC,IAAI;CAChE,CAAA,GAAA,YAAA,UAAA,GAAA,UAAA,OAAa,MAAM,KAAK,GAAG,oCAAoC,IAAI;CACnE,MAAM,QAAQ;CAEd,OAAO;AACT"}
|
package/build/uplinks.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uplinks.mjs","names":[],"sources":["../src/uplinks.ts"],"sourcesContent":["import { clone, isNil } from 'lodash-es';\nimport assert from 'node:assert';\n\nimport { authUtils } from '@verdaccio/core';\nimport type { PackageList, UpLinksConfList } from '@verdaccio/types';\n\nexport const DEFAULT_REGISTRY = 'https://registry.npmjs.org';\nexport const DEFAULT_UPLINK = 'npmjs';\n\nconst BLACKLIST = {\n all: true,\n anonymous: true,\n undefined: true,\n owner: true,\n none: true,\n};\n\nexport function uplinkSanityCheck(\n uplinks: UpLinksConfList,\n users: any = BLACKLIST\n): UpLinksConfList {\n const newUplinks = clone(uplinks);\n let newUsers = clone(users);\n\n for (const uplink in newUplinks) {\n if (Object.prototype.hasOwnProperty.call(newUplinks, uplink)) {\n if (typeof newUplinks[uplink].cache === 'undefined') {\n newUplinks[uplink].cache = true;\n }\n newUsers = sanityCheckNames(uplink, newUsers);\n }\n }\n\n return newUplinks;\n}\n\nexport function sanityCheckUplinksProps(configUpLinks: UpLinksConfList): UpLinksConfList {\n const uplinks = clone(configUpLinks);\n\n for (const uplink in uplinks) {\n if (Object.prototype.hasOwnProperty.call(uplinks, uplink)) {\n assert(uplinks[uplink].url, 'CONFIG: no url for uplink: ' + uplink);\n assert(\n typeof uplinks[uplink].url === 'string',\n 'CONFIG: wrong url format for uplink: ' + uplink\n );\n uplinks[uplink].url = uplinks[uplink].url.replace(/\\/$/, '');\n }\n }\n\n return uplinks;\n}\n\nexport function getProxiesForPackage(pkg: string, packages: PackageList): string[] {\n const matchedPkg = authUtils.getMatchedPackagesSpec(pkg, packages);\n return matchedPkg?.proxy || [];\n}\n\nexport function hasProxyTo(pkg: string, upLink: string, packages: PackageList): boolean {\n const proxyList = getProxiesForPackage(pkg, packages);\n if (proxyList) {\n return proxyList.some((curr) => upLink === curr);\n }\n\n return false;\n}\n\nexport function sanityCheckNames(item: string, users: any): any {\n assert(\n item !== 'all' &&\n item !== 'owner' &&\n item !== 'anonymous' &&\n item !== 'undefined' &&\n item !== 'none',\n 'CONFIG: reserved uplink name: ' + item\n );\n assert(!item.match(/\\s/), 'CONFIG: invalid uplink name: ' + item);\n assert(isNil(users[item]), 'CONFIG: duplicate uplink name: ' + item);\n users[item] = true;\n\n return users;\n}\n"],"mappings":";;;;AAMA,IAAa,mBAAmB;AAChC,IAAa,iBAAiB;AAE9B,IAAM,YAAY;CAChB,KAAK;CACL,WAAW;CACX,WAAW;CACX,OAAO;CACP,MAAM;
|
|
1
|
+
{"version":3,"file":"uplinks.mjs","names":[],"sources":["../src/uplinks.ts"],"sourcesContent":["import { clone, isNil } from 'lodash-es';\nimport assert from 'node:assert';\n\nimport { authUtils } from '@verdaccio/core';\nimport type { PackageList, UpLinksConfList } from '@verdaccio/types';\n\nexport const DEFAULT_REGISTRY = 'https://registry.npmjs.org';\nexport const DEFAULT_UPLINK = 'npmjs';\n\nconst BLACKLIST = {\n all: true,\n anonymous: true,\n undefined: true,\n owner: true,\n none: true,\n};\n\nexport function uplinkSanityCheck(\n uplinks: UpLinksConfList,\n users: any = BLACKLIST\n): UpLinksConfList {\n const newUplinks = clone(uplinks);\n let newUsers = clone(users);\n\n for (const uplink in newUplinks) {\n if (Object.prototype.hasOwnProperty.call(newUplinks, uplink)) {\n if (typeof newUplinks[uplink].cache === 'undefined') {\n newUplinks[uplink].cache = true;\n }\n newUsers = sanityCheckNames(uplink, newUsers);\n }\n }\n\n return newUplinks;\n}\n\nexport function sanityCheckUplinksProps(configUpLinks: UpLinksConfList): UpLinksConfList {\n const uplinks = clone(configUpLinks);\n\n for (const uplink in uplinks) {\n if (Object.prototype.hasOwnProperty.call(uplinks, uplink)) {\n assert(uplinks[uplink].url, 'CONFIG: no url for uplink: ' + uplink);\n assert(\n typeof uplinks[uplink].url === 'string',\n 'CONFIG: wrong url format for uplink: ' + uplink\n );\n uplinks[uplink].url = uplinks[uplink].url.replace(/\\/$/, '');\n }\n }\n\n return uplinks;\n}\n\nexport function getProxiesForPackage(pkg: string, packages: PackageList): string[] {\n const matchedPkg = authUtils.getMatchedPackagesSpec(pkg, packages);\n return matchedPkg?.proxy || [];\n}\n\nexport function hasProxyTo(pkg: string, upLink: string, packages: PackageList): boolean {\n const proxyList = getProxiesForPackage(pkg, packages);\n if (proxyList) {\n return proxyList.some((curr) => upLink === curr);\n }\n\n return false;\n}\n\nexport function sanityCheckNames(item: string, users: any): any {\n assert(\n item !== 'all' &&\n item !== 'owner' &&\n item !== 'anonymous' &&\n item !== 'undefined' &&\n item !== 'none',\n 'CONFIG: reserved uplink name: ' + item\n );\n assert(!item.match(/\\s/), 'CONFIG: invalid uplink name: ' + item);\n assert(isNil(users[item]), 'CONFIG: duplicate uplink name: ' + item);\n users[item] = true;\n\n return users;\n}\n"],"mappings":";;;;AAMA,IAAa,mBAAmB;AAChC,IAAa,iBAAiB;AAE9B,IAAM,YAAY;CAChB,KAAK;CACL,WAAW;CACX,WAAW;CACX,OAAO;CACP,MAAM;AACR;AAEA,SAAgB,kBACd,SACA,QAAa,WACI;CACjB,MAAM,aAAa,MAAM,OAAO;CAChC,IAAI,WAAW,MAAM,KAAK;CAE1B,KAAK,MAAM,UAAU,YACnB,IAAI,OAAO,UAAU,eAAe,KAAK,YAAY,MAAM,GAAG;EAC5D,IAAI,OAAO,WAAW,QAAQ,UAAU,aACtC,WAAW,QAAQ,QAAQ;EAE7B,WAAW,iBAAiB,QAAQ,QAAQ;CAC9C;CAGF,OAAO;AACT;AAEA,SAAgB,wBAAwB,eAAiD;CACvF,MAAM,UAAU,MAAM,aAAa;CAEnC,KAAK,MAAM,UAAU,SACnB,IAAI,OAAO,UAAU,eAAe,KAAK,SAAS,MAAM,GAAG;EACzD,OAAO,QAAQ,QAAQ,KAAK,gCAAgC,MAAM;EAClE,OACE,OAAO,QAAQ,QAAQ,QAAQ,UAC/B,0CAA0C,MAC5C;EACA,QAAQ,QAAQ,MAAM,QAAQ,QAAQ,IAAI,QAAQ,OAAO,EAAE;CAC7D;CAGF,OAAO;AACT;AAEA,SAAgB,qBAAqB,KAAa,UAAiC;CAEjF,OADmB,UAAU,uBAAuB,KAAK,QAClD,GAAY,SAAS,CAAC;AAC/B;AAEA,SAAgB,WAAW,KAAa,QAAgB,UAAgC;CACtF,MAAM,YAAY,qBAAqB,KAAK,QAAQ;CACpD,IAAI,WACF,OAAO,UAAU,MAAM,SAAS,WAAW,IAAI;CAGjD,OAAO;AACT;AAEA,SAAgB,iBAAiB,MAAc,OAAiB;CAC9D,OACE,SAAS,SACP,SAAS,WACT,SAAS,eACT,SAAS,eACT,SAAS,QACX,mCAAmC,IACrC;CACA,OAAO,CAAC,KAAK,MAAM,IAAI,GAAG,kCAAkC,IAAI;CAChE,OAAO,MAAM,MAAM,KAAK,GAAG,oCAAoC,IAAI;CACnE,MAAM,QAAQ;CAEd,OAAO;AACT"}
|
package/build/user.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","names":[],"sources":["../src/user.ts"],"sourcesContent":["import type { RemoteUser } from '@verdaccio/types';\n\nimport { ROLES } from './package-access';\n\n/**\n * All logged users will have by default the group $all and $authenticate\n */\nexport const defaultLoggedUserRoles = [\n ROLES.$ALL,\n ROLES.$AUTH,\n ROLES.DEPRECATED_ALL,\n ROLES.DEPRECATED_AUTH,\n ROLES.ALL,\n];\n/**\n *\n */\nexport const defaultNonLoggedUserRoles = [\n ROLES.$ALL,\n ROLES.$ANONYMOUS,\n // groups without '$' are going to be deprecated eventually\n ROLES.DEPRECATED_ALL,\n ROLES.DEPRECATED_ANONYMOUS,\n];\n\n/**\n * Create a RemoteUser object\n * @return {Object} \\{ name: xx, pluginGroups: [], real_groups: [] \\}\n */\nexport function createRemoteUser(name: string, pluginGroups: string[]): RemoteUser {\n const isGroupValid: boolean = Array.isArray(pluginGroups);\n const groups = Array.from(\n new Set((isGroupValid ? pluginGroups : []).concat([...defaultLoggedUserRoles]))\n );\n\n return {\n name,\n groups,\n real_groups: pluginGroups,\n };\n}\n\n/**\n * Builds an anonymous remote user in case none is logged in.\n * @return {Object} \\{ name: xx, groups: [], real_groups: [] \\}\n */\nexport function createAnonymousRemoteUser(): RemoteUser {\n return {\n name: undefined,\n groups: [...defaultNonLoggedUserRoles],\n real_groups: [],\n };\n}\n"],"mappings":";;;;;AAOA,IAAa,yBAAyB;CACpC,uBAAA,MAAM;CACN,uBAAA,MAAM;CACN,uBAAA,MAAM;CACN,uBAAA,MAAM;CACN,uBAAA,MAAM;
|
|
1
|
+
{"version":3,"file":"user.js","names":[],"sources":["../src/user.ts"],"sourcesContent":["import type { RemoteUser } from '@verdaccio/types';\n\nimport { ROLES } from './package-access';\n\n/**\n * All logged users will have by default the group $all and $authenticate\n */\nexport const defaultLoggedUserRoles = [\n ROLES.$ALL,\n ROLES.$AUTH,\n ROLES.DEPRECATED_ALL,\n ROLES.DEPRECATED_AUTH,\n ROLES.ALL,\n];\n/**\n *\n */\nexport const defaultNonLoggedUserRoles = [\n ROLES.$ALL,\n ROLES.$ANONYMOUS,\n // groups without '$' are going to be deprecated eventually\n ROLES.DEPRECATED_ALL,\n ROLES.DEPRECATED_ANONYMOUS,\n];\n\n/**\n * Create a RemoteUser object\n * @return {Object} \\{ name: xx, pluginGroups: [], real_groups: [] \\}\n */\nexport function createRemoteUser(name: string, pluginGroups: string[]): RemoteUser {\n const isGroupValid: boolean = Array.isArray(pluginGroups);\n const groups = Array.from(\n new Set((isGroupValid ? pluginGroups : []).concat([...defaultLoggedUserRoles]))\n );\n\n return {\n name,\n groups,\n real_groups: pluginGroups,\n };\n}\n\n/**\n * Builds an anonymous remote user in case none is logged in.\n * @return {Object} \\{ name: xx, groups: [], real_groups: [] \\}\n */\nexport function createAnonymousRemoteUser(): RemoteUser {\n return {\n name: undefined,\n groups: [...defaultNonLoggedUserRoles],\n real_groups: [],\n };\n}\n"],"mappings":";;;;;AAOA,IAAa,yBAAyB;CACpC,uBAAA,MAAM;CACN,uBAAA,MAAM;CACN,uBAAA,MAAM;CACN,uBAAA,MAAM;CACN,uBAAA,MAAM;AACR;;;;AAIA,IAAa,4BAA4B;CACvC,uBAAA,MAAM;CACN,uBAAA,MAAM;CAEN,uBAAA,MAAM;CACN,uBAAA,MAAM;AACR;;;;;AAMA,SAAgB,iBAAiB,MAAc,cAAoC;CACjF,MAAM,eAAwB,MAAM,QAAQ,YAAY;CAKxD,OAAO;EACL;EACA,QANa,MAAM,KACnB,IAAI,KAAK,eAAe,eAAe,CAAC,GAAG,OAAO,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAK9E;EACA,aAAa;CACf;AACF;;;;;AAMA,SAAgB,4BAAwC;CACtD,OAAO;EACL,MAAM,KAAA;EACN,QAAQ,CAAC,GAAG,yBAAyB;EACrC,aAAa,CAAC;CAChB;AACF"}
|
package/build/user.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.mjs","names":[],"sources":["../src/user.ts"],"sourcesContent":["import type { RemoteUser } from '@verdaccio/types';\n\nimport { ROLES } from './package-access';\n\n/**\n * All logged users will have by default the group $all and $authenticate\n */\nexport const defaultLoggedUserRoles = [\n ROLES.$ALL,\n ROLES.$AUTH,\n ROLES.DEPRECATED_ALL,\n ROLES.DEPRECATED_AUTH,\n ROLES.ALL,\n];\n/**\n *\n */\nexport const defaultNonLoggedUserRoles = [\n ROLES.$ALL,\n ROLES.$ANONYMOUS,\n // groups without '$' are going to be deprecated eventually\n ROLES.DEPRECATED_ALL,\n ROLES.DEPRECATED_ANONYMOUS,\n];\n\n/**\n * Create a RemoteUser object\n * @return {Object} \\{ name: xx, pluginGroups: [], real_groups: [] \\}\n */\nexport function createRemoteUser(name: string, pluginGroups: string[]): RemoteUser {\n const isGroupValid: boolean = Array.isArray(pluginGroups);\n const groups = Array.from(\n new Set((isGroupValid ? pluginGroups : []).concat([...defaultLoggedUserRoles]))\n );\n\n return {\n name,\n groups,\n real_groups: pluginGroups,\n };\n}\n\n/**\n * Builds an anonymous remote user in case none is logged in.\n * @return {Object} \\{ name: xx, groups: [], real_groups: [] \\}\n */\nexport function createAnonymousRemoteUser(): RemoteUser {\n return {\n name: undefined,\n groups: [...defaultNonLoggedUserRoles],\n real_groups: [],\n };\n}\n"],"mappings":";;;;;AAOA,IAAa,yBAAyB;CACpC,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;
|
|
1
|
+
{"version":3,"file":"user.mjs","names":[],"sources":["../src/user.ts"],"sourcesContent":["import type { RemoteUser } from '@verdaccio/types';\n\nimport { ROLES } from './package-access';\n\n/**\n * All logged users will have by default the group $all and $authenticate\n */\nexport const defaultLoggedUserRoles = [\n ROLES.$ALL,\n ROLES.$AUTH,\n ROLES.DEPRECATED_ALL,\n ROLES.DEPRECATED_AUTH,\n ROLES.ALL,\n];\n/**\n *\n */\nexport const defaultNonLoggedUserRoles = [\n ROLES.$ALL,\n ROLES.$ANONYMOUS,\n // groups without '$' are going to be deprecated eventually\n ROLES.DEPRECATED_ALL,\n ROLES.DEPRECATED_ANONYMOUS,\n];\n\n/**\n * Create a RemoteUser object\n * @return {Object} \\{ name: xx, pluginGroups: [], real_groups: [] \\}\n */\nexport function createRemoteUser(name: string, pluginGroups: string[]): RemoteUser {\n const isGroupValid: boolean = Array.isArray(pluginGroups);\n const groups = Array.from(\n new Set((isGroupValid ? pluginGroups : []).concat([...defaultLoggedUserRoles]))\n );\n\n return {\n name,\n groups,\n real_groups: pluginGroups,\n };\n}\n\n/**\n * Builds an anonymous remote user in case none is logged in.\n * @return {Object} \\{ name: xx, groups: [], real_groups: [] \\}\n */\nexport function createAnonymousRemoteUser(): RemoteUser {\n return {\n name: undefined,\n groups: [...defaultNonLoggedUserRoles],\n real_groups: [],\n };\n}\n"],"mappings":";;;;;AAOA,IAAa,yBAAyB;CACpC,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;AACR;;;;AAIA,IAAa,4BAA4B;CACvC,MAAM;CACN,MAAM;CAEN,MAAM;CACN,MAAM;AACR;;;;;AAMA,SAAgB,iBAAiB,MAAc,cAAoC;CACjF,MAAM,eAAwB,MAAM,QAAQ,YAAY;CAKxD,OAAO;EACL;EACA,QANa,MAAM,KACnB,IAAI,KAAK,eAAe,eAAe,CAAC,GAAG,OAAO,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAK9E;EACA,aAAa;CACf;AACF;;;;;AAMA,SAAgB,4BAAwC;CACtD,OAAO;EACL,MAAM,KAAA;EACN,QAAQ,CAAC,GAAG,yBAAyB;EACrC,aAAa,CAAC;CAChB;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/config",
|
|
3
|
-
"version": "9.0.0-next-9.
|
|
3
|
+
"version": "9.0.0-next-9.18",
|
|
4
4
|
"description": "Verdaccio Configuration",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
"node": ">=24"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@verdaccio/core": "9.0.0-next-9.
|
|
36
|
+
"@verdaccio/core": "9.0.0-next-9.18",
|
|
37
37
|
"debug": "4.4.3",
|
|
38
38
|
"js-yaml": "4.1.1",
|
|
39
39
|
"lodash-es": "4.18.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@verdaccio/types": "14.0.0-next-9.7",
|
|
43
42
|
"@types/lodash-es": "4.17.12",
|
|
44
|
-
"
|
|
43
|
+
"@verdaccio/types": "14.0.0-next-9.9",
|
|
44
|
+
"vitest": "4.1.7"
|
|
45
45
|
},
|
|
46
46
|
"funding": {
|
|
47
47
|
"type": "opencollective",
|