@verdaccio/web 8.1.0-next-8.4 → 8.1.0-next-8.6
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/CHANGELOG.md +43 -0
- package/build/api/readme.js +4 -2
- package/build/api/readme.js.map +1 -1
- package/build/api/sidebar.js +5 -3
- package/build/api/sidebar.js.map +1 -1
- package/build/middleware.d.ts +1 -1
- package/build/middleware.js +10 -3
- package/build/middleware.js.map +1 -1
- package/package.json +17 -17
- package/src/api/readme.ts +4 -4
- package/src/api/sidebar.ts +5 -5
- package/src/middleware.ts +10 -3
- package/test/static/runtime.js +3 -0
- package/test/static/vendors.js +3 -0
- package/test/static/vendor.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# @verdaccio/web
|
|
2
2
|
|
|
3
|
+
## 8.1.0-next-8.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [8995041]
|
|
8
|
+
- @verdaccio/middleware@8.0.0-next-8.6
|
|
9
|
+
- @verdaccio/auth@8.0.0-next-8.6
|
|
10
|
+
- @verdaccio/core@8.0.0-next-8.6
|
|
11
|
+
- @verdaccio/config@8.0.0-next-8.6
|
|
12
|
+
- @verdaccio/tarball@13.0.0-next-8.6
|
|
13
|
+
- @verdaccio/url@13.0.0-next-8.6
|
|
14
|
+
- @verdaccio/loaders@8.0.0-next-8.4
|
|
15
|
+
- @verdaccio/store@8.0.0-next-8.6
|
|
16
|
+
- @verdaccio/utils@8.1.0-next-8.6
|
|
17
|
+
- @verdaccio/logger@8.0.0-next-8.6
|
|
18
|
+
|
|
19
|
+
## 8.1.0-next-8.5
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- b2339e2: chore(web): fix syntax of test files
|
|
24
|
+
- 9041b0f: chore: add info to log when audit, htpasswd, theme are used
|
|
25
|
+
- Updated dependencies [ba71932]
|
|
26
|
+
- Updated dependencies [64a7fc0]
|
|
27
|
+
- Updated dependencies [9041b0f]
|
|
28
|
+
- Updated dependencies [eca6259]
|
|
29
|
+
- Updated dependencies [4adaa83]
|
|
30
|
+
- Updated dependencies [80e4cb8]
|
|
31
|
+
- Updated dependencies [5cbee6f]
|
|
32
|
+
- Updated dependencies [538bb8f]
|
|
33
|
+
- Updated dependencies [a049bba]
|
|
34
|
+
- Updated dependencies [3967a52]
|
|
35
|
+
- @verdaccio/loaders@8.0.0-next-8.4
|
|
36
|
+
- @verdaccio/config@8.0.0-next-8.5
|
|
37
|
+
- @verdaccio/core@8.0.0-next-8.5
|
|
38
|
+
- @verdaccio/store@8.0.0-next-8.5
|
|
39
|
+
- @verdaccio/auth@8.0.0-next-8.5
|
|
40
|
+
- @verdaccio/logger@8.0.0-next-8.5
|
|
41
|
+
- @verdaccio/tarball@13.0.0-next-8.5
|
|
42
|
+
- @verdaccio/url@13.0.0-next-8.5
|
|
43
|
+
- @verdaccio/middleware@8.0.0-next-8.5
|
|
44
|
+
- @verdaccio/utils@8.1.0-next-8.5
|
|
45
|
+
|
|
3
46
|
## 8.1.0-next-8.4
|
|
4
47
|
|
|
5
48
|
### Patch Changes
|
package/build/api/readme.js
CHANGED
|
@@ -53,9 +53,11 @@ function addReadmeWebApi(storage, auth) {
|
|
|
53
53
|
});
|
|
54
54
|
const pkgRouter = (0, _express.Router)(); /* eslint new-cap: 0 */
|
|
55
55
|
|
|
56
|
-
pkgRouter.get('/package/readme
|
|
56
|
+
pkgRouter.get('/package/readme/:scope(@[^/]+)?/:package/:version?', can('access'), async function (req, res, next) {
|
|
57
57
|
debug('readme hit');
|
|
58
|
-
const
|
|
58
|
+
const rawScope = req.params.scope; // May include '@'
|
|
59
|
+
const scope = rawScope ? rawScope.slice(1) : null; // Remove '@' if present
|
|
60
|
+
const name = scope ? (0, _webUtils.addScope)(scope, req.params.package) : req.params.package;
|
|
59
61
|
debug('readme name %o', name);
|
|
60
62
|
const requestOptions = {
|
|
61
63
|
protocol: req.protocol,
|
package/build/api/readme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readme.js","names":["_debug","_interopRequireDefault","require","_express","_core","_logger","_middleware","_webUtils","e","__esModule","default","NOT_README_FOUND","exports","debug","buildDebug","getReadme","readme","length","addReadmeWebApi","storage","auth","can","allow","beforeAll","a","b","logger","trace","afterAll","pkgRouter","Router","get","req","res","next","
|
|
1
|
+
{"version":3,"file":"readme.js","names":["_debug","_interopRequireDefault","require","_express","_core","_logger","_middleware","_webUtils","e","__esModule","default","NOT_README_FOUND","exports","debug","buildDebug","getReadme","readme","length","addReadmeWebApi","storage","auth","can","allow","beforeAll","a","b","logger","trace","afterAll","pkgRouter","Router","get","req","res","next","rawScope","params","scope","slice","name","addScope","package","requestOptions","protocol","headers","host","remoteAddress","socket","manifest","getPackageByOptions","uplinksLook","abbreviated","set","HEADER_TYPE","CONTENT_TYPE","HEADERS","TEXT_PLAIN_UTF8","err","_default"],"sources":["../../src/api/readme.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { Router } from 'express';\n\nimport { Auth } from '@verdaccio/auth';\nimport { HEADERS, HEADER_TYPE } from '@verdaccio/core';\nimport { logger } from '@verdaccio/logger';\nimport { $NextFunctionVer, $RequestExtend, $ResponseExtend, allow } from '@verdaccio/middleware';\nimport { Storage } from '@verdaccio/store';\nimport { Manifest } from '@verdaccio/types';\n\nimport { AuthorAvatar, addScope } from '../web-utils';\n\nexport { $RequestExtend, $ResponseExtend, $NextFunctionVer }; // Was required by other packages\n\n// TODO: review this type, should be on @verdacid/types\nexport type PackageExt = Manifest & { author: AuthorAvatar; dist?: { tarball: string } };\nexport const NOT_README_FOUND = 'ERROR: No README data found!';\nconst debug = buildDebug('verdaccio:web:api:readme');\nconst getReadme = (readme) => {\n if (typeof readme === 'string' && readme.length === 0) {\n return NOT_README_FOUND;\n }\n if (typeof readme !== 'string') {\n return NOT_README_FOUND;\n } else {\n return readme;\n }\n};\n\nfunction addReadmeWebApi(storage: Storage, auth: Auth): Router {\n debug('initialized readme web api');\n const can = allow(auth, {\n beforeAll: (a, b) => logger.trace(a, b),\n afterAll: (a, b) => logger.trace(a, b),\n });\n const pkgRouter = Router(); /* eslint new-cap: 0 */\n\n pkgRouter.get(\n '/package/readme/:scope(@[^/]+)?/:package/:version?',\n can('access'),\n async function (\n req: $RequestExtend,\n res: $ResponseExtend,\n next: $NextFunctionVer\n ): Promise<void> {\n debug('readme hit');\n const rawScope = req.params.scope; // May include '@'\n const scope = rawScope ? rawScope.slice(1) : null; // Remove '@' if present\n const name = scope ? addScope(scope, req.params.package) : req.params.package;\n debug('readme name %o', name);\n const requestOptions = {\n protocol: req.protocol,\n headers: req.headers as any,\n // FIXME: if we migrate to req.hostname, the port is not longer included.\n host: req.host,\n remoteAddress: req.socket.remoteAddress,\n };\n try {\n const manifest = (await storage.getPackageByOptions({\n name,\n uplinksLook: true,\n abbreviated: false,\n requestOptions,\n })) as Manifest;\n debug('readme pkg %o', manifest?.name);\n res.set(HEADER_TYPE.CONTENT_TYPE, HEADERS.TEXT_PLAIN_UTF8);\n next(getReadme(manifest.readme));\n } catch (err) {\n next(err);\n }\n }\n );\n return pkgRouter;\n}\n\nexport default addReadmeWebApi;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAGA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAIA,IAAAK,SAAA,GAAAL,OAAA;AAAsD,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEQ;;AAE9D;;AAEO,MAAMG,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,8BAA8B;AAC9D,MAAME,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AC,gBAAgB,EAAE0B,IAAI,CAAC;IAC7B,MAAMG,cAAc,GAAG;MACrBC,QAAQ,EAAEX,GAAG,CAACW,QAAQ;MACtBC,OAAO,EAAEZ,GAAG,CAACY,OAAc;MAC3B;MACAC,IAAI,EAAEb,GAAG,CAACa,IAAI;MACdC,aAAa,EAAEd,GAAG,CAACe,MAAM,CAACD;IAC5B,CAAC;IACD,IAAI;MACF,MAAME,QAAQ,GAAI,MAAM7B,OAAO,CAAC8B,mBAAmB,CAAC;QAClDV,IAAI;QACJW,WAAW,EAAE,IAAI;QACjBC,WAAW,EAAE,KAAK;QAClBT;MACF,CAAC,CAAc;MACf7B,KAAK,CAAC,eAAe,EAAEmC,QAAQ,EAAET,IAAI,CAAC;MACtCN,GAAG,CAACmB,GAAG,CAACC,iBAAW,CAACC,YAAY,EAAEC,aAAO,CAACC,eAAe,CAAC;MAC1DtB,IAAI,CAACnB,SAAS,CAACiC,QAAQ,CAAChC,MAAM,CAAC,CAAC;IAClC,CAAC,CAAC,OAAOyC,GAAG,EAAE;MACZvB,IAAI,CAACuB,GAAG,CAAC;IACX;EACF,CACF,CAAC;EACD,OAAO5B,SAAS;AAClB;AAAC,IAAA6B,QAAA,GAAA9C,OAAA,CAAAF,OAAA,GAEcQ,eAAe","ignoreList":[]}
|
package/build/api/sidebar.js
CHANGED
|
@@ -41,9 +41,11 @@ function addSidebarWebApi(config, storage, auth) {
|
|
|
41
41
|
beforeAll: (a, b) => _logger.logger.trace(a, b),
|
|
42
42
|
afterAll: (a, b) => _logger.logger.trace(a, b)
|
|
43
43
|
});
|
|
44
|
-
// Get package
|
|
45
|
-
router.get('/sidebar
|
|
46
|
-
const
|
|
44
|
+
// Get package sidebar
|
|
45
|
+
router.get('/sidebar/:scope(@[^/]+)?/:package', can('access'), async function (req, res, next) {
|
|
46
|
+
const rawScope = req.params.scope; // May include '@'
|
|
47
|
+
const scope = rawScope ? rawScope.slice(1) : null; // Remove '@' if present
|
|
48
|
+
const name = scope ? (0, _webUtils.addScope)(scope, req.params.package) : req.params.package;
|
|
47
49
|
const requestOptions = {
|
|
48
50
|
protocol: req.protocol,
|
|
49
51
|
headers: req.headers,
|
package/build/api/sidebar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.js","names":["_debug","_interopRequireDefault","require","_express","_core","_logger","_middleware","_tarball","_utils","_webUtils","e","__esModule","default","debug","buildDebug","addSidebarWebApi","config","storage","auth","router","Router","can","allow","beforeAll","a","b","logger","trace","afterAll","get","req","res","next","
|
|
1
|
+
{"version":3,"file":"sidebar.js","names":["_debug","_interopRequireDefault","require","_express","_core","_logger","_middleware","_tarball","_utils","_webUtils","e","__esModule","default","debug","buildDebug","addSidebarWebApi","config","storage","auth","router","Router","can","allow","beforeAll","a","b","logger","trace","afterAll","get","req","res","next","rawScope","params","scope","slice","name","addScope","package","requestOptions","protocol","headers","host","remoteAddress","socket","info","getPackageByOptions","uplinksLook","keepUpLinkData","v","query","sideBarInfo","versions","convertDistRemoteToLocalTarballUrls","hostname","url_prefix","isVersionValid","latest","author","formatAuthor","DIST_TAGS","deleteProperties","authorAvatar","web","addGravatarSupport","gravatar","err","status","HTTP_STATUS","NOT_FOUND","end","_default","exports"],"sources":["../../src/api/sidebar.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { Router } from 'express';\n\nimport { Auth } from '@verdaccio/auth';\nimport { DIST_TAGS, HTTP_STATUS } from '@verdaccio/core';\nimport { logger } from '@verdaccio/logger';\nimport { $NextFunctionVer, $RequestExtend, $ResponseExtend, allow } from '@verdaccio/middleware';\nimport { Storage } from '@verdaccio/store';\nimport { convertDistRemoteToLocalTarballUrls } from '@verdaccio/tarball';\nimport { Config, Manifest, Version } from '@verdaccio/types';\nimport { addGravatarSupport, formatAuthor, isVersionValid } from '@verdaccio/utils';\n\nimport { AuthorAvatar, addScope, deleteProperties } from '../web-utils';\n\nexport { $RequestExtend, $ResponseExtend, $NextFunctionVer }; // Was required by other packages\n\nexport type PackageExt = Manifest & { author: AuthorAvatar; dist?: { tarball: string } };\n\nexport type $SidebarPackage = Manifest & { latest: Version };\nconst debug = buildDebug('verdaccio:web:api:sidebar');\n\nfunction addSidebarWebApi(config: Config, storage: Storage, auth: Auth): Router {\n debug('initialized sidebar web api');\n const router = Router(); /* eslint new-cap: 0 */\n const can = allow(auth, {\n beforeAll: (a, b) => logger.trace(a, b),\n afterAll: (a, b) => logger.trace(a, b),\n });\n // Get package sidebar\n router.get(\n '/sidebar/:scope(@[^/]+)?/:package',\n can('access'),\n async function (\n req: $RequestExtend,\n res: $ResponseExtend,\n next: $NextFunctionVer\n ): Promise<void> {\n const rawScope = req.params.scope; // May include '@'\n const scope = rawScope ? rawScope.slice(1) : null; // Remove '@' if present\n const name: string = scope ? addScope(scope, req.params.package) : req.params.package;\n const requestOptions = {\n protocol: req.protocol,\n headers: req.headers as any,\n // FIXME: if we migrate to req.hostname, the port is not longer included.\n host: req.host,\n remoteAddress: req.socket.remoteAddress,\n };\n try {\n const info = (await storage.getPackageByOptions({\n name,\n uplinksLook: true,\n keepUpLinkData: true,\n requestOptions,\n })) as Manifest;\n const { v } = req.query;\n let sideBarInfo = { ...info };\n sideBarInfo.versions = convertDistRemoteToLocalTarballUrls(\n info,\n { protocol: req.protocol, headers: req.headers as any, host: req.hostname },\n config.url_prefix\n ).versions;\n // TODO: review this implementation\n if (typeof v === 'string' && isVersionValid(info, v)) {\n // @ts-ignore\n sideBarInfo.latest = sideBarInfo.versions[v];\n // @ts-ignore\n sideBarInfo.latest.author = formatAuthor(sideBarInfo.latest.author);\n } else {\n // @ts-ignore\n sideBarInfo.latest = sideBarInfo.versions[info[DIST_TAGS].latest];\n // @ts-ignore\n sideBarInfo.latest.author = formatAuthor(sideBarInfo.latest.author);\n }\n sideBarInfo = deleteProperties(['readme', '_attachments', '_rev', 'name'], sideBarInfo);\n const authorAvatar = config.web\n ? addGravatarSupport(sideBarInfo, config.web.gravatar)\n : addGravatarSupport(sideBarInfo);\n next(authorAvatar);\n } catch (err) {\n res.status(HTTP_STATUS.NOT_FOUND);\n res.end();\n }\n }\n );\n\n return router;\n}\n\nexport default addSidebarWebApi;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAGA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAEA,IAAAK,QAAA,GAAAL,OAAA;AAEA,IAAAM,MAAA,GAAAN,OAAA;AAEA,IAAAO,SAAA,GAAAP,OAAA;AAAwE,SAAAD,uBAAAS,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEV;;AAK9D,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,2BAA2B,CAAC;AAErD,SAASC,gBAAgBA,CAACC,MAAc,EAAEC,OAAgB,EAAEC,IAAU,EAAU;EAC9EL,KAAK,CAAC,6BAA6B,CAAC;EACpC,MAAMM,MAAM,GAAG,IAAAC,eAAM,EAAC,CAAC,CAAC,CAAC;EACzB,MAAMC,GAAG,GAAG,IAAAC,iBAAK,EAACJ,IAAI,EAAE;IACtBK,SAAS,EAAEA,CAACC,CAAC,EAAEC,CAAC,KAAKC,cAAM,CAACC,KAAK,CAACH,CAAC,EAAEC,CAAC,CAAC;IACvCG,QAAQ,EAAEA,CAACJ,CAAC,EAAEC,CAAC,KAAKC,cAAM,CAACC,KAAK,CAACH,CAAC,EAAEC,CAAC;EACvC,CAAC,CAAC;EACF;EACAN,MAAM,CAACU,GAAG,CACR,mCAAmC,EACnCR,GAAG,CAAC,QAAQ,CAAC,EACb,gBACES,GAAmB,EACnBC,GAAoB,EACpBC,IAAsB,EACP;IACf,MAAMC,QAAQ,GAAGH,GAAG,CAACI,MAAM,CAACC,KAAK,CAAC,CAAC;IACnC,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,CAAC;MACrE,CAAC,MAAM;QACL;QACAP,WAAW,CAACM,MAAM,GAAGN,WAAW,CAACC,QAAQ,CAACP,IAAI,CAACe,eAAS,CAAC,CAACH,MAAM,CAAC;QACjE;QACAN,WAAW,CAACM,MAAM,CAACC,MAAM,GAAG,IAAAC,mBAAY,EAACR,WAAW,CAACM,MAAM,CAACC,MAAM,CAAC;MACrE;MACAP,WAAW,GAAG,IAAAU,0BAAgB,EAAC,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAEV,WAAW,CAAC;MACvF,MAAMW,YAAY,GAAG/C,MAAM,CAACgD,GAAG,GAC3B,IAAAC,yBAAkB,EAACb,WAAW,EAAEpC,MAAM,CAACgD,GAAG,CAACE,QAAQ,CAAC,GACpD,IAAAD,yBAAkB,EAACb,WAAW,CAAC;MACnCpB,IAAI,CAAC+B,YAAY,CAAC;IACpB,CAAC,CAAC,OAAOI,GAAG,EAAE;MACZpC,GAAG,CAACqC,MAAM,CAACC,iBAAW,CAACC,SAAS,CAAC;MACjCvC,GAAG,CAACwC,GAAG,CAAC,CAAC;IACX;EACF,CACF,CAAC;EAED,OAAOpD,MAAM;AACf;AAAC,IAAAqD,QAAA,GAAAC,OAAA,CAAA7D,OAAA,GAEcG,gBAAgB","ignoreList":[]}
|
package/build/middleware.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare function loadTheme(config: any): Promise<any>;
|
|
2
|
-
declare const _default: (config: any, auth: any, storage: any) => Promise<import("express-serve-static-core").Router>;
|
|
2
|
+
declare const _default: (config: any, auth: any, storage: any, logger: any) => Promise<import("express-serve-static-core").Router>;
|
|
3
3
|
export default _default;
|
package/build/middleware.js
CHANGED
|
@@ -30,13 +30,20 @@ async function loadTheme(config) {
|
|
|
30
30
|
return plugin.staticPath && plugin.manifest && plugin.manifestFiles;
|
|
31
31
|
}, config?.serverSettings?.pluginPrefix ?? 'verdaccio-theme', _core.PLUGIN_CATEGORY.THEME);
|
|
32
32
|
if (plugin.length > 1) {
|
|
33
|
-
_logger.logger.warn('multiple ui themes are not supported
|
|
33
|
+
_logger.logger.warn('multiple ui themes are not supported; only the first plugin is used');
|
|
34
34
|
}
|
|
35
35
|
return _lodash.default.head(plugin);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
var _default = async (config, auth, storage) => {
|
|
39
|
-
|
|
38
|
+
var _default = async (config, auth, storage, logger) => {
|
|
39
|
+
let pluginOptions = await loadTheme(config);
|
|
40
|
+
if (!pluginOptions) {
|
|
41
|
+
pluginOptions = require('@verdaccio/ui-theme')(config.web);
|
|
42
|
+
logger.info({
|
|
43
|
+
name: '@verdaccio/ui-theme',
|
|
44
|
+
pluginCategory: _core.PLUGIN_CATEGORY.THEME
|
|
45
|
+
}, 'plugin @{name} successfully loaded (@{pluginCategory})');
|
|
46
|
+
}
|
|
40
47
|
|
|
41
48
|
// eslint-disable-next-line new-cap
|
|
42
49
|
const router = _express.default.Router();
|
package/build/middleware.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.js","names":["_express","_interopRequireDefault","require","_lodash","_core","_loaders","_logger","_middleware","_api","e","__esModule","default","loadTheme","config","_","isNil","theme","plugin","asyncLoadPlugin","logger","staticPath","manifest","manifestFiles","serverSettings","pluginPrefix","PLUGIN_CATEGORY","THEME","length","warn","head","_default","auth","storage","pluginOptions","web","router","express","Router","use","webMiddleware","tokenMiddleware","webUIJWTmiddleware","webEndpointsApi","exports"],"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 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 ?? 'verdaccio-theme',\n PLUGIN_CATEGORY.THEME\n );\n if (plugin.length > 1) {\n logger.warn('multiple ui themes are not supported
|
|
1
|
+
{"version":3,"file":"middleware.js","names":["_express","_interopRequireDefault","require","_lodash","_core","_loaders","_logger","_middleware","_api","e","__esModule","default","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","exports"],"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 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 ?? 'verdaccio-theme',\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('@verdaccio/ui-theme')(config.web);\n logger.info(\n { name: '@verdaccio/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,eAAeG,SAASA,CAACC,MAAW,EAAE;EAC3C,IAAIC,eAAC,CAACC,KAAK,CAACF,MAAM,CAACG,KAAK,CAAC,KAAK,KAAK,EAAE;IACnC,MAAMC,MAAM,GAAG,MAAM,IAAAC,wBAAe,EAClCL,MAAM,CAACG,KAAK,EACZ;MAAEH,MAAM;MAAEM,MAAM,EAANA;IAAO,CAAC;IAClB;IACA,UAAUF,MAAW,EAAE;MACrB;AACR;AACA;AACA;AACA;AACA;MACQ,OAAOA,MAAM,CAACG,UAAU,IAAIH,MAAM,CAACI,QAAQ,IAAIJ,MAAM,CAACK,aAAa;IACrE,CAAC,EACDT,MAAM,EAAEU,cAAc,EAAEC,YAAY,IAAI,iBAAiB,EACzDC,qBAAe,CAACC,KAClB,CAAC;IACD,IAAIT,MAAM,CAACU,MAAM,GAAG,CAAC,EAAE;MACrBR,cAAM,CAACS,IAAI,CAAC,qEAAqE,CAAC;IACpF;IAEA,OAAOd,eAAC,CAACe,IAAI,CAACZ,MAAM,CAAC;EACvB;AACF;AAAC,IAAAa,QAAA,GAEc,MAAAA,CAAOjB,MAAM,EAAEkB,IAAI,EAAEC,OAAO,EAAEb,MAAM,KAAK;EACtD,IAAIc,aAAa,GAAG,MAAMrB,SAAS,CAACC,MAAM,CAAC;EAC3C,IAAI,CAACoB,aAAa,EAAE;IAClBA,aAAa,GAAG/B,OAAO,CAAC,qBAAqB,CAAC,CAACW,MAAM,CAACqB,GAAG,CAAC;IAC1Df,MAAM,CAACgB,IAAI,CACT;MAAEC,IAAI,EAAE,qBAAqB;MAAEC,cAAc,EAAEZ,qBAAe,CAACC;IAAM,CAAC,EACtE,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;AAAAQ,OAAA,CAAAnC,OAAA,GAAAmB,QAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/web",
|
|
3
|
-
"version": "8.1.0-next-8.
|
|
3
|
+
"version": "8.1.0-next-8.6",
|
|
4
4
|
"description": "web ui middleware",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -24,30 +24,30 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@verdaccio/auth": "8.0.0-next-8.
|
|
28
|
-
"@verdaccio/config": "8.0.0-next-8.
|
|
29
|
-
"@verdaccio/core": "8.0.0-next-8.
|
|
30
|
-
"@verdaccio/loaders": "8.0.0-next-8.
|
|
31
|
-
"@verdaccio/logger": "8.0.0-next-8.
|
|
32
|
-
"@verdaccio/middleware": "8.0.0-next-8.
|
|
33
|
-
"@verdaccio/store": "8.0.0-next-8.
|
|
34
|
-
"@verdaccio/tarball": "13.0.0-next-8.
|
|
35
|
-
"@verdaccio/url": "13.0.0-next-8.
|
|
36
|
-
"@verdaccio/utils": "8.1.0-next-8.
|
|
27
|
+
"@verdaccio/auth": "8.0.0-next-8.6",
|
|
28
|
+
"@verdaccio/config": "8.0.0-next-8.6",
|
|
29
|
+
"@verdaccio/core": "8.0.0-next-8.6",
|
|
30
|
+
"@verdaccio/loaders": "8.0.0-next-8.4",
|
|
31
|
+
"@verdaccio/logger": "8.0.0-next-8.6",
|
|
32
|
+
"@verdaccio/middleware": "8.0.0-next-8.6",
|
|
33
|
+
"@verdaccio/store": "8.0.0-next-8.6",
|
|
34
|
+
"@verdaccio/tarball": "13.0.0-next-8.6",
|
|
35
|
+
"@verdaccio/url": "13.0.0-next-8.6",
|
|
36
|
+
"@verdaccio/utils": "8.1.0-next-8.6",
|
|
37
37
|
"debug": "4.3.7",
|
|
38
|
-
"express": "4.21.
|
|
38
|
+
"express": "4.21.2",
|
|
39
39
|
"lodash": "4.17.21"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@verdaccio/api": "8.1.0-next-8.
|
|
43
|
-
"@verdaccio/test-helper": "4.0.0-next-8.
|
|
44
|
-
"@verdaccio/types": "13.0.0-next-8.
|
|
42
|
+
"@verdaccio/api": "8.1.0-next-8.6",
|
|
43
|
+
"@verdaccio/test-helper": "4.0.0-next-8.2",
|
|
44
|
+
"@verdaccio/types": "13.0.0-next-8.2",
|
|
45
45
|
"jsdom": "20.0.3",
|
|
46
46
|
"nock": "13.5.1",
|
|
47
47
|
"node-html-parser": "4.1.5",
|
|
48
48
|
"supertest": "7.0.0",
|
|
49
|
-
"verdaccio-auth-memory": "13.0.0-next-8.
|
|
50
|
-
"verdaccio-memory": "13.0.0-next-8.
|
|
49
|
+
"verdaccio-auth-memory": "13.0.0-next-8.6",
|
|
50
|
+
"verdaccio-memory": "13.0.0-next-8.6"
|
|
51
51
|
},
|
|
52
52
|
"funding": {
|
|
53
53
|
"type": "opencollective",
|
package/src/api/readme.ts
CHANGED
|
@@ -36,7 +36,7 @@ function addReadmeWebApi(storage: Storage, auth: Auth): Router {
|
|
|
36
36
|
const pkgRouter = Router(); /* eslint new-cap: 0 */
|
|
37
37
|
|
|
38
38
|
pkgRouter.get(
|
|
39
|
-
'/package/readme
|
|
39
|
+
'/package/readme/:scope(@[^/]+)?/:package/:version?',
|
|
40
40
|
can('access'),
|
|
41
41
|
async function (
|
|
42
42
|
req: $RequestExtend,
|
|
@@ -44,9 +44,9 @@ function addReadmeWebApi(storage: Storage, auth: Auth): Router {
|
|
|
44
44
|
next: $NextFunctionVer
|
|
45
45
|
): Promise<void> {
|
|
46
46
|
debug('readme hit');
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
const rawScope = req.params.scope; // May include '@'
|
|
48
|
+
const scope = rawScope ? rawScope.slice(1) : null; // Remove '@' if present
|
|
49
|
+
const name = scope ? addScope(scope, req.params.package) : req.params.package;
|
|
50
50
|
debug('readme name %o', name);
|
|
51
51
|
const requestOptions = {
|
|
52
52
|
protocol: req.protocol,
|
package/src/api/sidebar.ts
CHANGED
|
@@ -26,18 +26,18 @@ function addSidebarWebApi(config: Config, storage: Storage, auth: Auth): Router
|
|
|
26
26
|
beforeAll: (a, b) => logger.trace(a, b),
|
|
27
27
|
afterAll: (a, b) => logger.trace(a, b),
|
|
28
28
|
});
|
|
29
|
-
// Get package
|
|
29
|
+
// Get package sidebar
|
|
30
30
|
router.get(
|
|
31
|
-
'/sidebar
|
|
31
|
+
'/sidebar/:scope(@[^/]+)?/:package',
|
|
32
32
|
can('access'),
|
|
33
33
|
async function (
|
|
34
34
|
req: $RequestExtend,
|
|
35
35
|
res: $ResponseExtend,
|
|
36
36
|
next: $NextFunctionVer
|
|
37
37
|
): Promise<void> {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
const rawScope = req.params.scope; // May include '@'
|
|
39
|
+
const scope = rawScope ? rawScope.slice(1) : null; // Remove '@' if present
|
|
40
|
+
const name: string = scope ? addScope(scope, req.params.package) : req.params.package;
|
|
41
41
|
const requestOptions = {
|
|
42
42
|
protocol: req.protocol,
|
|
43
43
|
headers: req.headers as any,
|
package/src/middleware.ts
CHANGED
|
@@ -27,15 +27,22 @@ export async function loadTheme(config: any) {
|
|
|
27
27
|
PLUGIN_CATEGORY.THEME
|
|
28
28
|
);
|
|
29
29
|
if (plugin.length > 1) {
|
|
30
|
-
logger.warn('multiple ui themes are not supported
|
|
30
|
+
logger.warn('multiple ui themes are not supported; only the first plugin is used');
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
return _.head(plugin);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
export default async (config, auth, storage) => {
|
|
38
|
-
|
|
37
|
+
export default async (config, auth, storage, logger) => {
|
|
38
|
+
let pluginOptions = await loadTheme(config);
|
|
39
|
+
if (!pluginOptions) {
|
|
40
|
+
pluginOptions = require('@verdaccio/ui-theme')(config.web);
|
|
41
|
+
logger.info(
|
|
42
|
+
{ name: '@verdaccio/ui-theme', pluginCategory: PLUGIN_CATEGORY.THEME },
|
|
43
|
+
'plugin @{name} successfully loaded (@{pluginCategory})'
|
|
44
|
+
);
|
|
45
|
+
}
|
|
39
46
|
|
|
40
47
|
// eslint-disable-next-line new-cap
|
|
41
48
|
const router = express.Router();
|
package/test/static/vendor.js
DELETED