@verdaccio/web 8.1.0-next-8.12 → 8.1.0-next-8.14

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/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # @verdaccio/web - Verdaccio Web Middleware
2
+
3
+ [![Verdaccio Home](https://img.shields.io/badge/Homepage-Verdaccio-405236?style=flat)](https://verdaccio.org)
4
+ [![MIT License](https://img.shields.io/github/license/verdaccio/verdaccio?label=License&color=405236)](https://github.com/verdaccio/verdaccio/blob/master/LICENSE)
5
+ [![Verdaccio Latest](https://img.shields.io/npm/v/verdaccio?label=Latest%20Version&color=405236)](https://github.com/verdaccio/verdaccio)
6
+ [![This Package Latest](https://img.shields.io/npm/v/@verdaccio/web?label=@verdaccio/web&color=405236)](https://npmjs.com/package/@verdaccio/web)
7
+
8
+ [![Documentation](https://img.shields.io/badge/Help-Verdaccio?style=flat&logo=Verdaccio&label=Verdaccio&color=cd4000)](https://verdaccio.org/docs)
9
+ [![Discord](https://img.shields.io/badge/Chat-Discord?style=flat&logo=Discord&label=Discord&color=cd4000)](https://discord.com/channels/388674437219745793)
10
+ [![Bluesky](https://img.shields.io/badge/Follow-Bluesky?style=flat&logo=Bluesky&label=Bluesky&color=cd4000)](https://bsky.app/profile/verdaccio.org)
11
+ [![Backers](https://img.shields.io/opencollective/backers/verdaccio?style=flat&logo=opencollective&label=Join%20Backers&color=cd4000)](https://opencollective.com/verdaccio/contribute)
12
+ [![Sponsors](https://img.shields.io/opencollective/sponsors/verdaccio?style=flat&logo=opencollective&label=Sponsor%20Us&color=cd4000)](https://opencollective.com/verdaccio/contribute)
13
+
14
+ [![Verdaccio Downloads](https://img.shields.io/npm/dm/verdaccio?style=flat&logo=npm&label=Npm%20Downloads&color=lightgrey)](https://www.npmjs.com/package/verdaccio)
15
+ [![Docker Pulls](https://img.shields.io/docker/pulls/verdaccio/verdaccio?style=flat&logo=docker&label=Docker%20Pulls&color=lightgrey)](https://hub.docker.com/r/verdaccio/verdaccio)
16
+ [![GitHub Stars](https://img.shields.io/github/stars/verdaccio?style=flat&logo=github&label=GitHub%20Stars%20%E2%AD%90&color=lightgrey)](https://github.com/verdaccio/verdaccio/stargazers)
17
+
18
+ ## Donations
19
+
20
+ Verdaccio is run by **volunteers**; nobody is working full-time on it. If you find this project to be useful and would like to support its development, consider making a donation - **your logo might end up in this readme.** 😉
21
+
22
+ **[Donate](https://opencollective.com/verdaccio)** 💵👍🏻 starting from _\$1/month_ or just one single contribution.
23
+
24
+ ## Report a vulnerability
25
+
26
+ If you want to report a security vulnerability, please follow the steps which we have defined for you in our [security policy](https://github.com/verdaccio/verdaccio/security/policy).
27
+
28
+ ## Open Collective Sponsors
29
+
30
+ Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/verdaccio/contribute)]
31
+
32
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/0/avatar.svg)](https://opencollective.com/verdaccio/sponsor/0/website)
33
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/1/avatar.svg)](https://opencollective.com/verdaccio/sponsor/1/website)
34
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/2/avatar.svg)](https://opencollective.com/verdaccio/sponsor/2/website)
35
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/3/avatar.svg)](https://opencollective.com/verdaccio/sponsor/3/website)
36
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/4/avatar.svg)](https://opencollective.com/verdaccio/sponsor/4/website)
37
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/5/avatar.svg)](https://opencollective.com/verdaccio/sponsor/5/website)
38
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/6/avatar.svg)](https://opencollective.com/verdaccio/sponsor/6/website)
39
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/7/avatar.svg)](https://opencollective.com/verdaccio/sponsor/7/website)
40
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/8/avatar.svg)](https://opencollective.com/verdaccio/sponsor/8/website)
41
+ [![sponsor](https://opencollective.com/verdaccio/sponsor/9/avatar.svg)](https://opencollective.com/verdaccio/sponsor/9/website)
42
+
43
+ ## Open Collective Backers
44
+
45
+ Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/verdaccio/contribute)]
46
+
47
+ [![backers](https://opencollective.com/verdaccio/backers.svg?width=890)](https://opencollective.com/verdaccio/contributes)
48
+
49
+ ## Special Thanks
50
+
51
+ Thanks to the following companies to help us to achieve our goals providing free open source licenses.
52
+
53
+ [![jetbrains](https://github.com/verdaccio/verdaccio/blob/master/assets/thanks/jetbrains/logo.jpg?raw=true)](https://www.jetbrains.com/)
54
+ [![crowdin](https://github.com/verdaccio/verdaccio/blob/master/assets/thanks/crowdin/logo.png?raw=true)](https://crowdin.com/)
55
+
56
+ ## Contributors
57
+
58
+ This project exists thanks to all the people who contribute. [[Contribute](https://github.com/verdaccio/verdaccio/blob/master/CONTRIBUTING.md)].
59
+
60
+ [![contributors](https://opencollective.com/verdaccio/contributors.svg?width=890&button=true)](https://github.com/verdaccio/verdaccio/graphs/contributors)
61
+
62
+ ## FAQ / Contact / Troubleshoot
63
+
64
+ If you have any issue you can try the following options. Do not hesitate to ask or check our issues database. Perhaps someone has asked already what you are looking for.
65
+
66
+ - [Blog](https://verdaccio.org/blog/)
67
+ - [Donations](https://opencollective.com/verdaccio)
68
+ - [Reporting an issue](https://github.com/verdaccio/verdaccio/blob/master/CONTRIBUTING.md#reporting-a-bug)
69
+ - [Running discussions](https://github.com/orgs/verdaccio/discussions)
70
+ - [Chat](https://discord.com/channels/388674437219745793)
71
+ - [Logos](https://verdaccio.org/docs/logo)
72
+ - [Docker Examples](https://github.com/verdaccio/verdaccio/tree/master/docker-examples)
73
+ - [FAQ](https://github.com/verdaccio/verdaccio/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Aquestion%20)
74
+
75
+ ## License
76
+
77
+ Verdaccio is [MIT licensed](https://github.com/verdaccio/verdaccio/blob/master/LICENSE)
78
+
79
+ The Verdaccio documentation and logos (excluding /thanks, e.g., .md, .png, .sketch files within the /assets folder) are
80
+ [Creative Commons licensed](https://creativecommons.org/licenses/by/4.0/).
package/build/api/user.js CHANGED
@@ -50,7 +50,7 @@ function addUserAuthApi(auth, config) {
50
50
  const {
51
51
  name
52
52
  } = req.remote_user;
53
- if (_core.validatioUtils.validatePassword(password.new, config?.serverSettings?.passwordValidationRegex) === false) {
53
+ if (_core.validationUtils.validatePassword(password.new, config?.serverSettings?.passwordValidationRegex) === false) {
54
54
  return next(_core.errorUtils.getCode(_core.HTTP_STATUS.BAD_REQUEST, _core.APP_ERROR.PASSWORD_VALIDATION));
55
55
  }
56
56
  auth.changePassword(name, password.old, password.new, (err, isUpdated) => {
@@ -1 +1 @@
1
- {"version":3,"file":"user.js","names":["_debug","_interopRequireDefault","require","_express","_lodash","_core","_middleware","e","__esModule","default","debug","buildDebug","addUserAuthApi","auth","config","route","Router","post","WebUrls","user_login","rateLimit","userRateLimit","req","res","next","username","password","body","authenticate","err","user","errorCode","message","HTTP_STATUS","UNAUTHORIZED","INTERNAL_ERROR","errorUtils","getCode","remote_user","jWTSignOptions","security","web","sign","set","HEADERS","CACHE_CONTROL","token","jwtEncrypt","name","flags","changePassword","put","reset_password","_","isNil","status","API_ERROR","MUST_BE_LOGGED","validatioUtils","validatePassword","new","serverSettings","passwordValidationRegex","BAD_REQUEST","APP_ERROR","PASSWORD_VALIDATION","old","isUpdated","ok","getInternalError","INTERNAL_SERVER_ERROR","_default","exports"],"sources":["../../src/api/user.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { Request, Response, Router } from 'express';\nimport _ from 'lodash';\n\nimport { Auth } from '@verdaccio/auth';\nimport {\n API_ERROR,\n APP_ERROR,\n HEADERS,\n HTTP_STATUS,\n VerdaccioError,\n errorUtils,\n validatioUtils,\n} from '@verdaccio/core';\nimport { rateLimit } from '@verdaccio/middleware';\nimport { WebUrls } from '@verdaccio/middleware';\nimport { Config, JWTSignOptions, RemoteUser } from '@verdaccio/types';\n\nimport { $NextFunctionVer } from './package';\n\nconst debug = buildDebug('verdaccio:web:api:user');\n\nfunction addUserAuthApi(auth: Auth, config: Config): Router {\n const route = Router(); /* eslint new-cap: 0 */\n route.post(\n WebUrls.user_login,\n rateLimit(config?.userRateLimit),\n function (req: Request, res: Response, next: $NextFunctionVer): void {\n const { username, password } = req.body;\n debug('authenticate %o', username);\n auth.authenticate(\n username,\n password,\n async (err: VerdaccioError | null, user?: RemoteUser): Promise<void> => {\n if (err) {\n const errorCode = err.message ? HTTP_STATUS.UNAUTHORIZED : HTTP_STATUS.INTERNAL_ERROR;\n debug('error authenticate %o', errorCode);\n next(errorUtils.getCode(errorCode, err.message));\n } else {\n req.remote_user = user as RemoteUser;\n const jWTSignOptions: JWTSignOptions = config.security.web.sign;\n res.set(HEADERS.CACHE_CONTROL, 'no-cache, no-store');\n next({\n token: await auth.jwtEncrypt(user as RemoteUser, jWTSignOptions),\n username: req.remote_user.name,\n });\n }\n }\n );\n }\n );\n\n if (config?.flags?.changePassword === true) {\n route.put(\n WebUrls.reset_password,\n rateLimit(config?.userRateLimit),\n function (req: Request, res: Response, next: $NextFunctionVer): void {\n if (_.isNil(req.remote_user.name)) {\n res.status(HTTP_STATUS.UNAUTHORIZED);\n return next({\n // FUTURE: update to a more meaningful message\n message: API_ERROR.MUST_BE_LOGGED,\n });\n }\n\n const { password } = req.body;\n const { name } = req.remote_user;\n\n if (\n validatioUtils.validatePassword(\n password.new,\n config?.serverSettings?.passwordValidationRegex\n ) === false\n ) {\n return next(errorUtils.getCode(HTTP_STATUS.BAD_REQUEST, APP_ERROR.PASSWORD_VALIDATION));\n }\n\n auth.changePassword(name as string, password.old, password.new, (err, isUpdated): void => {\n if (_.isNil(err) && isUpdated) {\n next({\n ok: true,\n });\n } else {\n return next(errorUtils.getInternalError(API_ERROR.INTERNAL_SERVER_ERROR));\n }\n });\n }\n );\n }\n\n return route;\n}\n\nexport default addUserAuthApi;\n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/B,GAAG,EAAEsC,SAAS,KAAW;QACxF,IAAId,eAAC,CAACC,KAAK,CAACzB,GAAG,CAAC,IAAIsC,SAAS,EAAE;UAC7B3C,IAAI,CAAC;YACH4C,EAAE,EAAE;UACN,CAAC,CAAC;QACJ,CAAC,MAAM;UACL,OAAO5C,IAAI,CAACY,gBAAU,CAACiC,gBAAgB,CAACb,eAAS,CAACc,qBAAqB,CAAC,CAAC;QAC3E;MACF,CAAC,CAAC;IACJ,CACF,CAAC;EACH;EAEA,OAAOvD,KAAK;AACd;AAAC,IAAAwD,QAAA,GAAAC,OAAA,CAAA/D,OAAA,GAEcG,cAAc","ignoreList":[]}
1
+ {"version":3,"file":"user.js","names":["_debug","_interopRequireDefault","require","_express","_lodash","_core","_middleware","e","__esModule","default","debug","buildDebug","addUserAuthApi","auth","config","route","Router","post","WebUrls","user_login","rateLimit","userRateLimit","req","res","next","username","password","body","authenticate","err","user","errorCode","message","HTTP_STATUS","UNAUTHORIZED","INTERNAL_ERROR","errorUtils","getCode","remote_user","jWTSignOptions","security","web","sign","set","HEADERS","CACHE_CONTROL","token","jwtEncrypt","name","flags","changePassword","put","reset_password","_","isNil","status","API_ERROR","MUST_BE_LOGGED","validationUtils","validatePassword","new","serverSettings","passwordValidationRegex","BAD_REQUEST","APP_ERROR","PASSWORD_VALIDATION","old","isUpdated","ok","getInternalError","INTERNAL_SERVER_ERROR","_default","exports"],"sources":["../../src/api/user.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { Request, Response, Router } from 'express';\nimport _ from 'lodash';\n\nimport { Auth } from '@verdaccio/auth';\nimport {\n API_ERROR,\n APP_ERROR,\n HEADERS,\n HTTP_STATUS,\n VerdaccioError,\n errorUtils,\n validationUtils,\n} from '@verdaccio/core';\nimport { rateLimit } from '@verdaccio/middleware';\nimport { WebUrls } from '@verdaccio/middleware';\nimport { Config, JWTSignOptions, RemoteUser } from '@verdaccio/types';\n\nimport { $NextFunctionVer } from './package';\n\nconst debug = buildDebug('verdaccio:web:api:user');\n\nfunction addUserAuthApi(auth: Auth, config: Config): Router {\n const route = Router(); /* eslint new-cap: 0 */\n route.post(\n WebUrls.user_login,\n rateLimit(config?.userRateLimit),\n function (req: Request, res: Response, next: $NextFunctionVer): void {\n const { username, password } = req.body;\n debug('authenticate %o', username);\n auth.authenticate(\n username,\n password,\n async (err: VerdaccioError | null, user?: RemoteUser): Promise<void> => {\n if (err) {\n const errorCode = err.message ? HTTP_STATUS.UNAUTHORIZED : HTTP_STATUS.INTERNAL_ERROR;\n debug('error authenticate %o', errorCode);\n next(errorUtils.getCode(errorCode, err.message));\n } else {\n req.remote_user = user as RemoteUser;\n const jWTSignOptions: JWTSignOptions = config.security.web.sign;\n res.set(HEADERS.CACHE_CONTROL, 'no-cache, no-store');\n next({\n token: await auth.jwtEncrypt(user as RemoteUser, jWTSignOptions),\n username: req.remote_user.name,\n });\n }\n }\n );\n }\n );\n\n if (config?.flags?.changePassword === true) {\n route.put(\n WebUrls.reset_password,\n rateLimit(config?.userRateLimit),\n function (req: Request, res: Response, next: $NextFunctionVer): void {\n if (_.isNil(req.remote_user.name)) {\n res.status(HTTP_STATUS.UNAUTHORIZED);\n return next({\n // FUTURE: update to a more meaningful message\n message: API_ERROR.MUST_BE_LOGGED,\n });\n }\n\n const { password } = req.body;\n const { name } = req.remote_user;\n\n if (\n validationUtils.validatePassword(\n password.new,\n config?.serverSettings?.passwordValidationRegex\n ) === false\n ) {\n return next(errorUtils.getCode(HTTP_STATUS.BAD_REQUEST, APP_ERROR.PASSWORD_VALIDATION));\n }\n\n auth.changePassword(name as string, password.old, password.new, (err, isUpdated): void => {\n if (_.isNil(err) && isUpdated) {\n next({\n ok: true,\n });\n } else {\n return next(errorUtils.getInternalError(API_ERROR.INTERNAL_SERVER_ERROR));\n }\n });\n }\n );\n }\n\n return route;\n}\n\nexport default addUserAuthApi;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,G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AIsC,SAAS,EAAE;UAC7B3C,IAAI,CAAC;YACH4C,EAAE,EAAE;UACN,CAAC,CAAC;QACJ,CAAC,MAAM;UACL,OAAO5C,IAAI,CAACY,gBAAU,CAACiC,gBAAgB,CAACb,eAAS,CAACc,qBAAqB,CAAC,CAAC;QAC3E;MACF,CAAC,CAAC;IACJ,CACF,CAAC;EACH;EAEA,OAAOvD,KAAK;AACd;AAAC,IAAAwD,QAAA,GAAAC,OAAA,CAAA/D,OAAA,GAEcG,cAAc","ignoreList":[]}
@@ -30,7 +30,7 @@ async function loadTheme(config) {
30
30
  - `manifestFiles`: A object with one property `js` and the array (order matters) of the manifest id to be loaded in the template dynamically.
31
31
  */
32
32
  return plugin.staticPath && plugin.manifest && plugin.manifestFiles;
33
- }, config?.serverSettings?.pluginPrefix ?? PLUGIN_UI_PREFIX, _core.PLUGIN_CATEGORY.THEME);
33
+ }, false, config?.serverSettings?.pluginPrefix ?? PLUGIN_UI_PREFIX, _core.PLUGIN_CATEGORY.THEME);
34
34
  if (plugin.length > 1) {
35
35
  _logger.logger.warn('multiple ui themes are not supported; only the first plugin is used');
36
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.js","names":["_express","_interopRequireDefault","require","_lodash","_core","_loaders","_logger","_middleware","_api","e","__esModule","default","PLUGIN_UI_PREFIX","exports","DEFAULT_PLUGIN_UI_THEME","loadTheme","config","_","isNil","theme","plugin","asyncLoadPlugin","logger","staticPath","manifest","manifestFiles","serverSettings","pluginPrefix","PLUGIN_CATEGORY","THEME","length","warn","head","_default","auth","storage","pluginOptions","web","info","name","pluginCategory","router","express","Router","use","webMiddleware","tokenMiddleware","webUIJWTmiddleware","webEndpointsApi"],"sources":["../src/middleware.ts"],"sourcesContent":["import express from 'express';\nimport _ from 'lodash';\n\nimport { PLUGIN_CATEGORY } from '@verdaccio/core';\nimport { asyncLoadPlugin } from '@verdaccio/loaders';\nimport { logger } from '@verdaccio/logger';\nimport { webMiddleware } from '@verdaccio/middleware';\n\nimport webEndpointsApi from './api';\n\nexport const PLUGIN_UI_PREFIX = 'verdaccio-theme';\nexport const DEFAULT_PLUGIN_UI_THEME = '@verdaccio/ui-theme';\n\nexport async function loadTheme(config: any) {\n if (_.isNil(config.theme) === false) {\n const plugin = await asyncLoadPlugin(\n config.theme,\n { config, logger },\n // TODO: add types { staticPath: string; manifest: unknown; manifestFiles: unknown }\n function (plugin: any) {\n /**\n *\n - `staticPath`: is the same data returned in Verdaccio 5.\n - `manifest`: A webpack manifest object.\n - `manifestFiles`: A object with one property `js` and the array (order matters) of the manifest id to be loaded in the template dynamically.\n */\n return plugin.staticPath && plugin.manifest && plugin.manifestFiles;\n },\n config?.serverSettings?.pluginPrefix ?? PLUGIN_UI_PREFIX,\n PLUGIN_CATEGORY.THEME\n );\n if (plugin.length > 1) {\n logger.warn('multiple ui themes are not supported; only the first plugin is used');\n }\n\n return _.head(plugin);\n }\n}\n\nexport default async (config, auth, storage, logger) => {\n let pluginOptions = await loadTheme(config);\n if (!pluginOptions) {\n pluginOptions = require(DEFAULT_PLUGIN_UI_THEME)(config.web);\n logger.info(\n { name: DEFAULT_PLUGIN_UI_THEME, pluginCategory: PLUGIN_CATEGORY.THEME },\n 'plugin @{name} successfully loaded (@{pluginCategory})'\n );\n }\n\n // eslint-disable-next-line new-cap\n const router = express.Router();\n // load application\n router.use(\n webMiddleware(\n config,\n {\n tokenMiddleware: auth.webUIJWTmiddleware(),\n webEndpointsApi: webEndpointsApi(auth, storage, config),\n },\n pluginOptions\n )\n );\n return router;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAEA,IAAAM,IAAA,GAAAP,sBAAA,CAAAC,OAA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,qBAAe,CAACC;IAAM,CAAC,EACxE,wDACF,CAAC;EACH;;EAEA;EACA,MAAMY,MAAM,GAAGC,gBAAO,CAACC,MAAM,CAAC,CAAC;EAC/B;EACAF,MAAM,CAACG,GAAG,CACR,IAAAC,yBAAa,EACX7B,MAAM,EACN;IACE8B,eAAe,EAAEZ,IAAI,CAACa,kBAAkB,CAAC,CAAC;IAC1CC,eAAe,EAAE,IAAAA,YAAe,EAACd,IAAI,EAAEC,OAAO,EAAEnB,MAAM;EACxD,CAAC,EACDoB,aACF,CACF,CAAC;EACD,OAAOK,MAAM;AACf,CAAC;AAAA5B,OAAA,CAAAF,OAAA,GAAAsB,QAAA","ignoreList":[]}
1
+ {"version":3,"file":"middleware.js","names":["_express","_interopRequireDefault","require","_lodash","_core","_loaders","_logger","_middleware","_api","e","__esModule","default","PLUGIN_UI_PREFIX","exports","DEFAULT_PLUGIN_UI_THEME","loadTheme","config","_","isNil","theme","plugin","asyncLoadPlugin","logger","staticPath","manifest","manifestFiles","serverSettings","pluginPrefix","PLUGIN_CATEGORY","THEME","length","warn","head","_default","auth","storage","pluginOptions","web","info","name","pluginCategory","router","express","Router","use","webMiddleware","tokenMiddleware","webUIJWTmiddleware","webEndpointsApi"],"sources":["../src/middleware.ts"],"sourcesContent":["import express from 'express';\nimport _ from 'lodash';\n\nimport { PLUGIN_CATEGORY } from '@verdaccio/core';\nimport { asyncLoadPlugin } from '@verdaccio/loaders';\nimport { logger } from '@verdaccio/logger';\nimport { webMiddleware } from '@verdaccio/middleware';\n\nimport webEndpointsApi from './api';\n\nexport const PLUGIN_UI_PREFIX = 'verdaccio-theme';\nexport const DEFAULT_PLUGIN_UI_THEME = '@verdaccio/ui-theme';\n\nexport async function loadTheme(config: any) {\n if (_.isNil(config.theme) === false) {\n const plugin = await asyncLoadPlugin(\n config.theme,\n { config, logger },\n // TODO: add types { staticPath: string; manifest: unknown; manifestFiles: unknown }\n function (plugin: any) {\n /**\n *\n - `staticPath`: is the same data returned in Verdaccio 5.\n - `manifest`: A webpack manifest object.\n - `manifestFiles`: A object with one property `js` and the array (order matters) of the manifest id to be loaded in the template dynamically.\n */\n return plugin.staticPath && plugin.manifest && plugin.manifestFiles;\n },\n false,\n config?.serverSettings?.pluginPrefix ?? PLUGIN_UI_PREFIX,\n PLUGIN_CATEGORY.THEME\n );\n if (plugin.length > 1) {\n logger.warn('multiple ui themes are not supported; only the first plugin is used');\n }\n\n return _.head(plugin);\n }\n}\n\nexport default async (config, auth, storage, logger) => {\n let pluginOptions = await loadTheme(config);\n if (!pluginOptions) {\n pluginOptions = require(DEFAULT_PLUGIN_UI_THEME)(config.web);\n logger.info(\n { name: DEFAULT_PLUGIN_UI_THEME, pluginCategory: PLUGIN_CATEGORY.THEME },\n 'plugin @{name} successfully loaded (@{pluginCategory})'\n );\n }\n\n // eslint-disable-next-line new-cap\n const router = express.Router();\n // load application\n router.use(\n webMiddleware(\n config,\n {\n tokenMiddleware: auth.webUIJWTmiddleware(),\n webEndpointsApi: webEndpointsApi(auth, storage, config),\n },\n pluginOptions\n )\n );\n return router;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAEA,IAAAM,IAAA,GAAAP,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE7B,MAAMG,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,iBAAiB;AAC1C,MAAME,uBAAuB,GAAAD,OAAA,CAAAC,uBAAA,GAAG,qBAAqB;AAErD,eAAeC,SAASA,CAACC,MAAW,EAAE;EA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,EAACd,IAAI,EAAEC,OAAO,EAAEnB,MAAM;EACxD,CAAC,EACDoB,aACF,CACF,CAAC;EACD,OAAOK,MAAM;AACf,CAAC;AAAA5B,OAAA,CAAAF,OAAA,GAAAsB,QAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@verdaccio/web",
3
- "version": "8.1.0-next-8.12",
4
- "description": "web ui middleware",
3
+ "version": "8.1.0-next-8.14",
4
+ "description": "Verdaccio Web Middleware",
5
5
  "main": "./build/index.js",
6
6
  "types": "build/index.d.ts",
7
7
  "repository": {
8
8
  "type": "https",
9
- "url": "https://github.com/verdaccio/verdaccio"
9
+ "url": "https://github.com/verdaccio/verdaccio",
10
+ "directory": "packages/web"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/verdaccio/verdaccio/issues"
10
14
  },
11
15
  "keywords": [
12
16
  "private",
@@ -24,29 +28,29 @@
24
28
  },
25
29
  "license": "MIT",
26
30
  "dependencies": {
27
- "@verdaccio/auth": "8.0.0-next-8.12",
28
- "@verdaccio/config": "8.0.0-next-8.12",
29
- "@verdaccio/core": "8.0.0-next-8.12",
30
- "@verdaccio/loaders": "8.0.0-next-8.4",
31
- "@verdaccio/logger": "8.0.0-next-8.12",
32
- "@verdaccio/middleware": "8.0.0-next-8.12",
33
- "@verdaccio/store": "8.0.0-next-8.12",
34
- "@verdaccio/tarball": "13.0.0-next-8.12",
35
- "@verdaccio/url": "13.0.0-next-8.12",
36
- "@verdaccio/utils": "8.1.0-next-8.12",
31
+ "@verdaccio/auth": "8.0.0-next-8.14",
32
+ "@verdaccio/config": "8.0.0-next-8.14",
33
+ "@verdaccio/core": "8.0.0-next-8.14",
34
+ "@verdaccio/loaders": "8.0.0-next-8.6",
35
+ "@verdaccio/logger": "8.0.0-next-8.14",
36
+ "@verdaccio/middleware": "8.0.0-next-8.14",
37
+ "@verdaccio/store": "8.0.0-next-8.14",
38
+ "@verdaccio/tarball": "13.0.0-next-8.14",
39
+ "@verdaccio/url": "13.0.0-next-8.14",
40
+ "@verdaccio/utils": "8.1.0-next-8.14",
37
41
  "debug": "4.4.0",
38
42
  "express": "4.21.2",
39
43
  "lodash": "4.17.21"
40
44
  },
41
45
  "devDependencies": {
42
- "@verdaccio/api": "8.1.0-next-8.12",
43
- "@verdaccio/test-helper": "4.0.0-next-8.3",
44
- "@verdaccio/types": "13.0.0-next-8.3",
46
+ "@verdaccio/api": "8.1.0-next-8.14",
47
+ "@verdaccio/test-helper": "4.0.0-next-8.4",
48
+ "@verdaccio/types": "13.0.0-next-8.5",
45
49
  "jsdom": "25.0.1",
46
50
  "node-html-parser": "4.1.5",
47
51
  "supertest": "7.0.0",
48
- "verdaccio-auth-memory": "13.0.0-next-8.12",
49
- "verdaccio-memory": "13.0.0-next-8.12"
52
+ "verdaccio-auth-memory": "13.0.0-next-8.14",
53
+ "verdaccio-memory": "13.0.0-next-8.14"
50
54
  },
51
55
  "funding": {
52
56
  "type": "opencollective",
package/.babelrc DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "../../.babelrc"
3
- }