@verdaccio/middleware 9.0.0-next-9.0 → 9.0.0-next-9.2
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/middlewares/api_urls.d.ts +4 -4
- package/build/middlewares/api_urls.js +4 -4
- package/build/middlewares/api_urls.js.map +1 -1
- package/build/middlewares/log.js +8 -10
- package/build/middlewares/log.js.map +1 -1
- package/build/middlewares/media.js +1 -1
- package/build/middlewares/media.js.map +1 -1
- package/build/middlewares/rate-limit.d.ts +1 -1
- package/build/middlewares/rate-limit.js +1 -1
- package/build/middlewares/rate-limit.js.map +1 -1
- package/build/middlewares/web/render-web.js +4 -4
- package/build/middlewares/web/render-web.js.map +1 -1
- package/build/middlewares/web/utils/renderHTML.js +3 -2
- package/build/middlewares/web/utils/renderHTML.js.map +1 -1
- package/build/middlewares/web/utils/template.js +2 -1
- package/build/middlewares/web/utils/template.js.map +1 -1
- package/build/middlewares/web/web-urls.d.ts +4 -4
- package/build/middlewares/web/web-urls.js +4 -4
- package/build/middlewares/web/web-urls.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export declare enum USER_API_ENDPOINTS {
|
|
2
2
|
whoami = "/-/whoami",
|
|
3
3
|
get_user = "/-/user/:org_couchdb_user",
|
|
4
|
-
add_user = "/-/user/:org_couchdb_user/:_rev
|
|
5
|
-
user_token = "/-/user/token
|
|
4
|
+
add_user = "/-/user/:org_couchdb_user{/:_rev}{/:revision}",
|
|
5
|
+
user_token = "/-/user/token/{*subject}"
|
|
6
6
|
}
|
|
7
7
|
export declare enum STARS_API_ENDPOINTS {
|
|
8
8
|
get_user_starred_packages = "/-/_view/starredByUser"
|
|
9
9
|
}
|
|
10
10
|
export declare enum SEARCH_API_ENDPOINTS {
|
|
11
11
|
search = "/-/v1/search",
|
|
12
|
-
deprecated_search = "/-/all
|
|
12
|
+
deprecated_search = "/-/all{/:since}"
|
|
13
13
|
}
|
|
14
14
|
export declare enum PUBLISH_API_ENDPOINTS {
|
|
15
15
|
add_package = "/:package",
|
|
@@ -20,7 +20,7 @@ export declare enum PING_API_ENDPOINTS {
|
|
|
20
20
|
ping = "/-/ping"
|
|
21
21
|
}
|
|
22
22
|
export declare enum PACKAGE_API_ENDPOINTS {
|
|
23
|
-
get_package_by_version = "/:package/:version
|
|
23
|
+
get_package_by_version = "/:package{/:version}",
|
|
24
24
|
get_package_tarball = "/:package/-/:filename"
|
|
25
25
|
}
|
|
26
26
|
export declare enum DIST_TAGS_API_ENDPOINTS {
|
|
@@ -7,8 +7,8 @@ exports.USER_API_ENDPOINTS = exports.TOKEN_API_ENDPOINTS = exports.STARS_API_END
|
|
|
7
7
|
let USER_API_ENDPOINTS = exports.USER_API_ENDPOINTS = /*#__PURE__*/function (USER_API_ENDPOINTS) {
|
|
8
8
|
USER_API_ENDPOINTS["whoami"] = "/-/whoami";
|
|
9
9
|
USER_API_ENDPOINTS["get_user"] = "/-/user/:org_couchdb_user";
|
|
10
|
-
USER_API_ENDPOINTS["add_user"] = "/-/user/:org_couchdb_user/:_rev
|
|
11
|
-
USER_API_ENDPOINTS["user_token"] = "/-/user/token
|
|
10
|
+
USER_API_ENDPOINTS["add_user"] = "/-/user/:org_couchdb_user{/:_rev}{/:revision}";
|
|
11
|
+
USER_API_ENDPOINTS["user_token"] = "/-/user/token/{*subject}";
|
|
12
12
|
return USER_API_ENDPOINTS;
|
|
13
13
|
}({});
|
|
14
14
|
let STARS_API_ENDPOINTS = exports.STARS_API_ENDPOINTS = /*#__PURE__*/function (STARS_API_ENDPOINTS) {
|
|
@@ -17,7 +17,7 @@ let STARS_API_ENDPOINTS = exports.STARS_API_ENDPOINTS = /*#__PURE__*/function (S
|
|
|
17
17
|
}({});
|
|
18
18
|
let SEARCH_API_ENDPOINTS = exports.SEARCH_API_ENDPOINTS = /*#__PURE__*/function (SEARCH_API_ENDPOINTS) {
|
|
19
19
|
SEARCH_API_ENDPOINTS["search"] = "/-/v1/search";
|
|
20
|
-
SEARCH_API_ENDPOINTS["deprecated_search"] = "/-/all
|
|
20
|
+
SEARCH_API_ENDPOINTS["deprecated_search"] = "/-/all{/:since}";
|
|
21
21
|
return SEARCH_API_ENDPOINTS;
|
|
22
22
|
}({});
|
|
23
23
|
let PUBLISH_API_ENDPOINTS = exports.PUBLISH_API_ENDPOINTS = /*#__PURE__*/function (PUBLISH_API_ENDPOINTS) {
|
|
@@ -31,7 +31,7 @@ let PING_API_ENDPOINTS = exports.PING_API_ENDPOINTS = /*#__PURE__*/function (PIN
|
|
|
31
31
|
return PING_API_ENDPOINTS;
|
|
32
32
|
}({});
|
|
33
33
|
let PACKAGE_API_ENDPOINTS = exports.PACKAGE_API_ENDPOINTS = /*#__PURE__*/function (PACKAGE_API_ENDPOINTS) {
|
|
34
|
-
PACKAGE_API_ENDPOINTS["get_package_by_version"] = "/:package/:version
|
|
34
|
+
PACKAGE_API_ENDPOINTS["get_package_by_version"] = "/:package{/:version}";
|
|
35
35
|
PACKAGE_API_ENDPOINTS["get_package_tarball"] = "/:package/-/:filename";
|
|
36
36
|
return PACKAGE_API_ENDPOINTS;
|
|
37
37
|
}({});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api_urls.js","names":["USER_API_ENDPOINTS","exports","STARS_API_ENDPOINTS","SEARCH_API_ENDPOINTS","PUBLISH_API_ENDPOINTS","PING_API_ENDPOINTS","PACKAGE_API_ENDPOINTS","DIST_TAGS_API_ENDPOINTS","PROFILE_API_ENDPOINTS","TOKEN_API_ENDPOINTS","LOGIN_API_ENDPOINTS"],"sources":["../../src/middlewares/api_urls.ts"],"sourcesContent":["export enum USER_API_ENDPOINTS {\n whoami = '/-/whoami',\n get_user = '/-/user/:org_couchdb_user',\n add_user = '/-/user/:org_couchdb_user/:_rev
|
|
1
|
+
{"version":3,"file":"api_urls.js","names":["USER_API_ENDPOINTS","exports","STARS_API_ENDPOINTS","SEARCH_API_ENDPOINTS","PUBLISH_API_ENDPOINTS","PING_API_ENDPOINTS","PACKAGE_API_ENDPOINTS","DIST_TAGS_API_ENDPOINTS","PROFILE_API_ENDPOINTS","TOKEN_API_ENDPOINTS","LOGIN_API_ENDPOINTS"],"sources":["../../src/middlewares/api_urls.ts"],"sourcesContent":["export enum USER_API_ENDPOINTS {\n whoami = '/-/whoami',\n get_user = '/-/user/:org_couchdb_user',\n add_user = '/-/user/:org_couchdb_user{/:_rev}{/:revision}',\n user_token = '/-/user/token/{*subject}',\n}\n\nexport enum STARS_API_ENDPOINTS {\n get_user_starred_packages = '/-/_view/starredByUser',\n}\n\nexport enum SEARCH_API_ENDPOINTS {\n search = '/-/v1/search',\n deprecated_search = '/-/all{/:since}',\n}\n\nexport enum PUBLISH_API_ENDPOINTS {\n add_package = '/:package',\n publish_package = '/:package/-rev/:revision',\n remove_tarball = '/:package/-/:filename/-rev/:revision',\n}\n\nexport enum PING_API_ENDPOINTS {\n ping = '/-/ping',\n}\n\nexport enum PACKAGE_API_ENDPOINTS {\n get_package_by_version = '/:package{/:version}',\n get_package_tarball = '/:package/-/:filename',\n}\n\nexport enum DIST_TAGS_API_ENDPOINTS {\n tagging = '/:package/:tag',\n tagging_package = '/-/package/:package/dist-tags/:tag',\n get_dist_tags = '/-/package/:package/dist-tags',\n}\n\nexport enum PROFILE_API_ENDPOINTS {\n get_profile = '/-/npm/v1/user',\n}\n\nexport enum TOKEN_API_ENDPOINTS {\n get_tokens = '/-/npm/v1/tokens',\n delete_token = '/-/npm/v1/tokens/token/:tokenKey',\n}\n\nexport enum LOGIN_API_ENDPOINTS {\n login = '/-/v1/login',\n login_cli = '/-/v1/login_cli',\n login_cli_session = '/-/v1/login_cli/:sessionId',\n login_done = '/-/v1/done',\n login_done_session = '/-/v1/done/:sessionId',\n}\n"],"mappings":";;;;;;IAAYA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kB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ignoreList":[]}
|
package/build/middlewares/log.js
CHANGED
|
@@ -43,17 +43,15 @@ const log = logger => {
|
|
|
43
43
|
});
|
|
44
44
|
let bytesout = 0;
|
|
45
45
|
const _write = res.write;
|
|
46
|
-
// FIXME: res.write should return boolean
|
|
47
46
|
// @ts-ignore
|
|
48
|
-
res.write = function (
|
|
49
|
-
bytesout +=
|
|
50
|
-
/* eslint prefer-rest-params: "off" */
|
|
47
|
+
res.write = function (...args) {
|
|
48
|
+
bytesout += args[0]?.length || 0;
|
|
51
49
|
// @ts-ignore
|
|
52
|
-
_write.apply(res,
|
|
50
|
+
return _write.apply(res, args);
|
|
53
51
|
};
|
|
54
52
|
const log = function () {
|
|
55
53
|
const forwardedFor = req.get(_core.HEADERS.FORWARDED_FOR);
|
|
56
|
-
const remoteAddress = req.
|
|
54
|
+
const remoteAddress = req.socket.remoteAddress;
|
|
57
55
|
const remoteIP = forwardedFor ? `${forwardedFor} via ${remoteAddress}` : remoteAddress;
|
|
58
56
|
let message;
|
|
59
57
|
if (res.locals._verdaccio_error) {
|
|
@@ -83,12 +81,12 @@ const log = logger => {
|
|
|
83
81
|
});
|
|
84
82
|
const _end = res.end;
|
|
85
83
|
// @ts-ignore
|
|
86
|
-
res.end = function (
|
|
87
|
-
if (
|
|
88
|
-
bytesout +=
|
|
84
|
+
res.end = function (...args) {
|
|
85
|
+
if (args[0]) {
|
|
86
|
+
bytesout += args[0].length;
|
|
89
87
|
}
|
|
90
88
|
// @ts-ignore
|
|
91
|
-
_end.apply(res,
|
|
89
|
+
_end.apply(res, args);
|
|
92
90
|
log();
|
|
93
91
|
};
|
|
94
92
|
next();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","names":["_lodash","_interopRequireDefault","require","_core","e","__esModule","default","LOG_STATUS_MESSAGE","exports","LOG_VERDACCIO_ERROR","LOG_VERDACCIO_BYTES","log","logger","req","res","next","child","sub","_auth","headers","authorization","_","isNil","_cookie","get","cookie","url","originalUrl","info","ip","bytesin","on","chunk","length","bytesout","_write","write","
|
|
1
|
+
{"version":3,"file":"log.js","names":["_lodash","_interopRequireDefault","require","_core","e","__esModule","default","LOG_STATUS_MESSAGE","exports","LOG_VERDACCIO_ERROR","LOG_VERDACCIO_BYTES","log","logger","req","res","next","child","sub","_auth","headers","authorization","_","isNil","_cookie","get","cookie","url","originalUrl","info","ip","bytesin","on","chunk","length","bytesout","_write","write","args","apply","forwardedFor","HEADERS","FORWARDED_FOR","remoteAddress","socket","remoteIP","message","locals","_verdaccio_error","http","request","method","user","remote_user","name","status","statusCode","error","bytes","in","out","_end","end"],"sources":["../../src/middlewares/log.ts"],"sourcesContent":["import _ from 'lodash';\n\nimport { HEADERS } from '@verdaccio/core';\n\nimport type { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types';\n\n// FIXME: deprecated, moved to @verdaccio/dev-commons\nexport const LOG_STATUS_MESSAGE =\n \"@{status}, user: @{user}(@{remoteIP}), req: '@{request.method} @{request.url}'\";\nexport const LOG_VERDACCIO_ERROR = `${LOG_STATUS_MESSAGE}, error: @{!error}`;\nexport const LOG_VERDACCIO_BYTES = `${LOG_STATUS_MESSAGE}, bytes: @{bytes.in}/@{bytes.out}`;\n\nexport const log = (logger) => {\n return function log(req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer): void {\n // logger\n req.log = logger.child({ sub: 'in' });\n\n const _auth = req.headers.authorization;\n if (_.isNil(_auth) === false) {\n req.headers.authorization = '<Classified>';\n }\n\n const _cookie = req.get('cookie');\n if (_.isNil(_cookie) === false) {\n req.headers.cookie = '<Classified>';\n }\n\n req.url = req.originalUrl;\n req.log.info({ req: req, ip: req.ip }, \"@{ip} requested '@{req.method} @{req.url}'\");\n req.originalUrl = req.url;\n\n if (_.isNil(_auth) === false) {\n req.headers.authorization = _auth;\n }\n\n if (_.isNil(_cookie) === false) {\n req.headers.cookie = _cookie;\n }\n\n let bytesin = 0;\n req.on('data', function (chunk): void {\n bytesin += chunk.length;\n });\n\n let bytesout = 0;\n const _write = res.write;\n // @ts-ignore\n res.write = function (...args): boolean {\n bytesout += args[0]?.length || 0;\n // @ts-ignore\n return _write.apply(res, args);\n };\n\n const log = function (): void {\n const forwardedFor = req.get(HEADERS.FORWARDED_FOR);\n const remoteAddress = req.socket.remoteAddress;\n const remoteIP = forwardedFor ? `${forwardedFor} via ${remoteAddress}` : remoteAddress;\n let message;\n if (res.locals._verdaccio_error) {\n message = LOG_VERDACCIO_ERROR;\n } else {\n message = LOG_VERDACCIO_BYTES;\n }\n\n req.url = req.originalUrl;\n req.log.http(\n {\n request: {\n method: req.method,\n url: req.url,\n },\n user: req.remote_user?.name || null,\n remoteIP,\n status: res.statusCode,\n error: res.locals._verdaccio_error,\n bytes: {\n in: bytesin,\n out: bytesout,\n },\n },\n message\n );\n req.originalUrl = req.url;\n };\n\n req.on('close', function (): void {\n log();\n });\n\n const _end = res.end;\n // @ts-ignore\n res.end = function (...args): void {\n if (args[0]) {\n bytesout += args[0].length;\n }\n // @ts-ignore\n _end.apply(res, args);\n log();\n };\n next();\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AAA0C,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAI1C;AACO,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAC7B,gFAAgF;AAC3E,MAAME,mBAAmB,GAAAD,OAAA,CAAAC,mBAAA,GAAG,GAAGF,kBAAkB,oBAAoB;AACrE,MAAMG,mBAAmB,GAAAF,OAAA,CAAAE,mBAAA,GAAG,GAAGH,kBAAkB,mCAAmC;AAEpF,MAAMI,GAAG,GAAIC,MAAM,IAAK;EAC7B,OAAO,SAASD,GAAGA,CAACE,GAAmB,EAAEC,GAAoB,EAAEC,IAAsB,EAAQ;IAC3F;IACAF,GAAG,CA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MiD,IAAI,GAAG9C,GAAG,CAAC+C,GAAG;IACpB;IACA/C,GAAG,CAAC+C,GAAG,GAAG,UAAU,GAAGxB,IAAI,EAAQ;MACjC,IAAIA,IAAI,CAAC,CAAC,CAAC,EAAE;QACXH,QAAQ,IAAIG,IAAI,CAAC,CAAC,CAAC,CAACJ,MAAM;MAC5B;MACA;MACA2B,IAAI,CAACtB,KAAK,CAACxB,GAAG,EAAEuB,IAAI,CAAC;MACrB1B,GAAG,CAAC,CAAC;IACP,CAAC;IACDI,IAAI,CAAC,CAAC;EACR,CAAC;AACH,CAAC;AAACP,OAAA,CAAAG,GAAA,GAAAA,GAAA","ignoreList":[]}
|
|
@@ -13,7 +13,7 @@ function media(expect) {
|
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
if (typeof header !== 'string' || header.split(';')[0].trim() !== expect) {
|
|
16
|
-
next(_core.errorUtils.getCode(_core.HTTP_STATUS.UNSUPPORTED_MEDIA, 'wrong content-type, expect: ' + expect + ', got: ' + req.get
|
|
16
|
+
next(_core.errorUtils.getCode(_core.HTTP_STATUS.UNSUPPORTED_MEDIA, 'wrong content-type, expect: ' + expect + ', got: ' + req.get(_core.HEADER_TYPE.CONTENT_TYPE)));
|
|
17
17
|
} else {
|
|
18
18
|
next();
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.js","names":["_core","require","media","expect","req","res","next","header","headers","HEADER_TYPE","CONTENT_TYPE","errorUtils","getCode","HTTP_STATUS","UNSUPPORTED_MEDIA","split","trim","get"],"sources":["../../src/middlewares/media.ts"],"sourcesContent":["import { HEADER_TYPE, HTTP_STATUS, errorUtils } from '@verdaccio/core';\n\nimport type { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types';\n\nexport function media(expect: string | null): any {\n return function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer): void {\n const header = req.headers[HEADER_TYPE.CONTENT_TYPE];\n if (!header) {\n next(\n errorUtils.getCode(\n HTTP_STATUS.UNSUPPORTED_MEDIA,\n 'content-type is missing, expect: ' + expect\n )\n );\n return;\n }\n\n if (typeof header !== 'string' || header.split(';')[0].trim() !== expect) {\n next(\n errorUtils.getCode(\n HTTP_STATUS.UNSUPPORTED_MEDIA,\n 'wrong content-type, expect: ' + expect + ', got: ' + req.get
|
|
1
|
+
{"version":3,"file":"media.js","names":["_core","require","media","expect","req","res","next","header","headers","HEADER_TYPE","CONTENT_TYPE","errorUtils","getCode","HTTP_STATUS","UNSUPPORTED_MEDIA","split","trim","get"],"sources":["../../src/middlewares/media.ts"],"sourcesContent":["import { HEADER_TYPE, HTTP_STATUS, errorUtils } from '@verdaccio/core';\n\nimport type { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types';\n\nexport function media(expect: string | null): any {\n return function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer): void {\n const header = req.headers[HEADER_TYPE.CONTENT_TYPE];\n if (!header) {\n next(\n errorUtils.getCode(\n HTTP_STATUS.UNSUPPORTED_MEDIA,\n 'content-type is missing, expect: ' + expect\n )\n );\n return;\n }\n\n if (typeof header !== 'string' || header.split(';')[0].trim() !== expect) {\n next(\n errorUtils.getCode(\n HTTP_STATUS.UNSUPPORTED_MEDIA,\n 'wrong content-type, expect: ' + expect + ', got: ' + req.get(HEADER_TYPE.CONTENT_TYPE)\n )\n );\n } else {\n next();\n }\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAIO,SAASC,KAAKA,CAACC,MAAqB,EAAO;EAChD,OAAO,UAAUC,GAAmB,EAAEC,GAAoB,EAAEC,IAAsB,EAAQ;IACxF,MAAMC,MAAM,GAAGH,GAAG,CAACI,OAAO,CAACC,iBAAW,CAACC,YAAY,CAAC;IACpD,IAAI,CAACH,MAAM,EAAE;MACXD,IAAI,CACFK,gBAAU,CAACC,OAAO,CAChBC,iBAAW,CAACC,iBAAiB,EAC7B,mCAAmC,GAAGX,MACxC,CACF,CAAC;MACD;IACF;IAEA,IAAI,OAAOI,MAAM,KAAK,QAAQ,IAAIA,MAAM,CAACQ,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,CAAC,KAAKb,MAAM,EAAE;MACxEG,IAAI,CACFK,gBAAU,CAACC,OAAO,CAChBC,iBAAW,CAACC,iBAAiB,EAC7B,8BAA8B,GAAGX,MAAM,GAAG,SAAS,GAAGC,GAAG,CAACa,GAAG,CAACR,iBAAW,CAACC,YAAY,CACxF,CACF,CAAC;IACH,CAAC,MAAM;MACLJ,IAAI,CAAC,CAAC;IACR;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { RateLimit as RateLimitType } from '@verdaccio/types';
|
|
2
|
-
export declare function rateLimit(rateLimitOptions?: RateLimitType):
|
|
2
|
+
export declare function rateLimit(rateLimitOptions?: RateLimitType): import("express-rate-limit").RateLimitRequestHandler;
|
|
@@ -7,7 +7,7 @@ exports.rateLimit = rateLimit;
|
|
|
7
7
|
var _expressRateLimit = _interopRequireDefault(require("express-rate-limit"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
function rateLimit(rateLimitOptions) {
|
|
10
|
-
const limiter =
|
|
10
|
+
const limiter = (0, _expressRateLimit.default)(rateLimitOptions);
|
|
11
11
|
return limiter;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=rate-limit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rate-limit.js","names":["_expressRateLimit","_interopRequireDefault","require","e","__esModule","default","rateLimit","rateLimitOptions","limiter","RateLimit"],"sources":["../../src/middlewares/rate-limit.ts"],"sourcesContent":["import RateLimit from 'express-rate-limit';\n\nimport type { RateLimit as RateLimitType } from '@verdaccio/types';\n\nexport function rateLimit(rateLimitOptions?: RateLimitType) {\n const limiter =
|
|
1
|
+
{"version":3,"file":"rate-limit.js","names":["_expressRateLimit","_interopRequireDefault","require","e","__esModule","default","rateLimit","rateLimitOptions","limiter","RateLimit"],"sources":["../../src/middlewares/rate-limit.ts"],"sourcesContent":["import RateLimit from 'express-rate-limit';\n\nimport type { RateLimit as RateLimitType } from '@verdaccio/types';\n\nexport function rateLimit(rateLimitOptions?: RateLimitType) {\n const limiter = RateLimit(rateLimitOptions);\n return limiter;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA2C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAIpC,SAASG,SAASA,CAACC,gBAAgC,EAAE;EAC1D,MAAMC,OAAO,GAAG,IAAAC,yBAAS,EAACF,gBAAgB,CAAC;EAC3C,OAAOC,OAAO;AAChB","ignoreList":[]}
|
|
@@ -41,8 +41,8 @@ function renderWebMiddleware(config, tokenMiddleware, pluginOptions) {
|
|
|
41
41
|
router.use(_security.setSecurityWebHeaders);
|
|
42
42
|
|
|
43
43
|
// any match within the static is routed to the file system
|
|
44
|
-
router.get(_webUrls.WebUrlsNamespace.static
|
|
45
|
-
const filename = req.params
|
|
44
|
+
router.get(_webUrls.WebUrlsNamespace.static, function (req, res, next) {
|
|
45
|
+
const filename = req.params.all;
|
|
46
46
|
let file = `${staticPath}/${filename}`;
|
|
47
47
|
if (filename === 'favicon.ico' && config?.web?.favicon) {
|
|
48
48
|
file = config?.web?.favicon;
|
|
@@ -66,7 +66,7 @@ function renderWebMiddleware(config, tokenMiddleware, pluginOptions) {
|
|
|
66
66
|
if (_nodeFs.default.existsSync(absoluteLocalFile) && typeof _nodeFs.default.accessSync(absoluteLocalFile, _nodeFs.default.constants.R_OK) === 'undefined') {
|
|
67
67
|
// Note: `path.join` will break on Windows, because it transforms `/` to `\`
|
|
68
68
|
// Use POSIX version `path.posix.join` instead.
|
|
69
|
-
logo =
|
|
69
|
+
logo = `/-/static/${_nodePath.default.basename(logo)}`;
|
|
70
70
|
router.get(logo, function (_req, res, next) {
|
|
71
71
|
// @ts-ignore
|
|
72
72
|
debug('serve custom logo web:%s - local:%s', logo, absoluteLocalFile);
|
|
@@ -94,7 +94,7 @@ function renderWebMiddleware(config, tokenMiddleware, pluginOptions) {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
// Handle all web routes including security routes
|
|
97
|
-
router.get(_webUrls.WebUrlsNamespace.web
|
|
97
|
+
router.get(_webUrls.WebUrlsNamespace.web, function (req, res) {
|
|
98
98
|
(0, _renderHTML.default)(config, manifest, manifestFiles, req, res);
|
|
99
99
|
debug('render html section');
|
|
100
100
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-web.js","names":["_debug","_interopRequireDefault","require","_express","_nodeFs","_nodePath","_core","_url","_security","_renderHTML","_webUrls","e","__esModule","default","debug","buildDebug","sendFileCallback","next","err","status","HTTP_STATUS","NOT_FOUND","renderWebMiddleware","config","tokenMiddleware","pluginOptions","staticPath","manifest","manifestFiles","router","express","Router","use","setSecurityWebHeaders","get","WebUrlsNamespace","static","req","res","filename","params","file","web","favicon","isURLhasValidProtocol","url","sendFile","renderLogo","logo","absoluteLocalFile","path","posix","resolve","fs","existsSync","accessSync","constants","R_OK","
|
|
1
|
+
{"version":3,"file":"render-web.js","names":["_debug","_interopRequireDefault","require","_express","_nodeFs","_nodePath","_core","_url","_security","_renderHTML","_webUrls","e","__esModule","default","debug","buildDebug","sendFileCallback","next","err","status","HTTP_STATUS","NOT_FOUND","renderWebMiddleware","config","tokenMiddleware","pluginOptions","staticPath","manifest","manifestFiles","router","express","Router","use","setSecurityWebHeaders","get","WebUrlsNamespace","static","req","res","filename","params","all","file","web","favicon","isURLhasValidProtocol","url","sendFile","renderLogo","logo","absoluteLocalFile","path","posix","resolve","fs","existsSync","accessSync","constants","R_OK","basename","_req","undefined","logoDark","renderHTML","root"],"sources":["../../../src/middlewares/web/render-web.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport express from 'express';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { HTTP_STATUS } from '@verdaccio/core';\nimport { isURLhasValidProtocol } from '@verdaccio/url';\n\nimport { setSecurityWebHeaders } from './security';\nimport renderHTML from './utils/renderHTML';\nimport { WebUrlsNamespace } from './web-urls';\n\nconst debug = buildDebug('verdaccio:web:render');\n\nconst sendFileCallback = (next) => (err) => {\n if (!err) {\n return;\n }\n if (err.status === HTTP_STATUS.NOT_FOUND) {\n next();\n } else {\n next(err);\n }\n};\n\nexport function renderWebMiddleware(config, tokenMiddleware, pluginOptions) {\n const { staticPath, manifest, manifestFiles } = pluginOptions;\n debug('static path %o', staticPath);\n\n /* eslint new-cap:off */\n const router = express.Router();\n if (typeof tokenMiddleware === 'function') {\n router.use(tokenMiddleware);\n }\n\n router.use(setSecurityWebHeaders);\n\n // any match within the static is routed to the file system\n router.get(WebUrlsNamespace.static, function (req: express.Request<{ all: string }>, res, next) {\n const filename = req.params.all;\n let file = `${staticPath}/${filename}`;\n if (filename === 'favicon.ico' && config?.web?.favicon) {\n file = config?.web?.favicon;\n if (isURLhasValidProtocol(file)) {\n debug('redirect to favicon %s', file);\n req.url = file;\n return next();\n }\n }\n debug('render static file %o', file);\n res.sendFile(file, sendFileCallback(next));\n });\n\n function renderLogo(logo: string | undefined): string | undefined {\n // check the origin of the logo\n if (logo && !isURLhasValidProtocol(logo)) {\n // URI related to a local file\n const absoluteLocalFile = path.posix.resolve(logo);\n debug('serve local logo %s', absoluteLocalFile);\n try {\n // TODO: replace existsSync by async alternative\n if (\n fs.existsSync(absoluteLocalFile) &&\n typeof fs.accessSync(absoluteLocalFile, fs.constants.R_OK) === 'undefined'\n ) {\n // Note: `path.join` will break on Windows, because it transforms `/` to `\\`\n // Use POSIX version `path.posix.join` instead.\n logo = `/-/static/${path.basename(logo)}`;\n router.get(logo, function (_req, res, next) {\n // @ts-ignore\n debug('serve custom logo web:%s - local:%s', logo, absoluteLocalFile);\n res.sendFile(absoluteLocalFile, sendFileCallback(next));\n });\n debug('enabled custom logo %s', logo);\n } else {\n logo = undefined;\n debug(`web logo is wrong, path ${absoluteLocalFile} does not exist or is not readable`);\n }\n } catch {\n logo = undefined;\n debug(`web logo is wrong, path ${absoluteLocalFile} does not exist or is not readable`);\n }\n }\n return logo;\n }\n\n const logo = renderLogo(config?.web?.logo);\n if (config?.web?.logo) {\n config.web.logo = logo;\n }\n const logoDark = renderLogo(config?.web?.logoDark);\n if (config?.web?.logoDark) {\n config.web.logoDark = logoDark;\n }\n\n // Handle all web routes including security routes\n router.get(WebUrlsNamespace.web, function (req, res) {\n renderHTML(config, manifest, manifestFiles, req, res);\n debug('render html section');\n });\n\n router.get(WebUrlsNamespace.root, function (req, res) {\n renderHTML(config, manifest, manifestFiles, req, res);\n debug('render root');\n });\n\n return router;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,SAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AAEA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAA8C,SAAAD,uBAAAU,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,sBAAsB,CAAC;AAEhD,MAAMC,gBAAgB,GAAIC,IAAI,IAAMC,GAAG,IAAK;EAC1C,IAAI,CAACA,GAAG,EAAE;IACR;EACF;EACA,IAAIA,GAAG,CAACC,MAAM,KAAKC,iBAAW,CAACC,SAAS,EAAE;I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U,CAACzB,MAAM,EAAEoB,GAAG,EAAEmB,QAAQ,CAAC;EAClD,IAAIvC,MAAM,EAAEoB,GAAG,EAAEmB,QAAQ,EAAE;IACzBvC,MAAM,CAACoB,GAAG,CAACmB,QAAQ,GAAGA,QAAQ;EAChC;;EAEA;EACAjC,MAAM,CAACK,GAAG,CAACC,yBAAgB,CAACQ,GAAG,EAAE,UAAUN,GAAG,EAAEC,GAAG,EAAE;IACnD,IAAAyB,mBAAU,EAACxC,MAAM,EAAEI,QAAQ,EAAEC,aAAa,EAAES,GAAG,EAAEC,GAAG,CAAC;IACrDxB,KAAK,CAAC,qBAAqB,CAAC;EAC9B,CAAC,CAAC;EAEFe,MAAM,CAACK,GAAG,CAACC,yBAAgB,CAAC6B,IAAI,EAAE,UAAU3B,GAAG,EAAEC,GAAG,EAAE;IACpD,IAAAyB,mBAAU,EAACxC,MAAM,EAAEI,QAAQ,EAAEC,aAAa,EAAES,GAAG,EAAEC,GAAG,CAAC;IACrDxB,KAAK,CAAC,aAAa,CAAC;EACtB,CAAC,CAAC;EAEF,OAAOe,MAAM;AACf","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = renderHTML;
|
|
7
7
|
exports.resolveLogo = resolveLogo;
|
|
8
8
|
var _debug = _interopRequireDefault(require("debug"));
|
|
9
|
-
var _lruCache =
|
|
9
|
+
var _lruCache = require("lru-cache");
|
|
10
10
|
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
11
11
|
var _nodeUrl = require("node:url");
|
|
12
12
|
var _config = require("@verdaccio/config");
|
|
@@ -16,7 +16,8 @@ var _template = _interopRequireDefault(require("./template"));
|
|
|
16
16
|
var _webUtils = require("./web-utils");
|
|
17
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
18
|
const DEFAULT_LANGUAGE = 'es-US';
|
|
19
|
-
|
|
19
|
+
// Cache for rendered HTML templates: max 500 entries, 1 hour TTL
|
|
20
|
+
const cache = new _lruCache.LRUCache({
|
|
20
21
|
max: 500,
|
|
21
22
|
ttl: 1000 * 60 * 60
|
|
22
23
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderHTML.js","names":["_debug","_interopRequireDefault","require","_lruCache","_nodePath","_nodeUrl","_config","_core","_url","_template","_webUtils","e","__esModule","default","DEFAULT_LANGUAGE","cache","
|
|
1
|
+
{"version":3,"file":"renderHTML.js","names":["_debug","_interopRequireDefault","require","_lruCache","_nodePath","_nodeUrl","_config","_core","_url","_template","_webUtils","e","__esModule","default","DEFAULT_LANGUAGE","cache","LRUCache","max","ttl","debug","buildDebug","defaultManifestFiles","js","ico","css","resolveLogo","logo","url_prefix","requestOptions","isLocalFile","isURLhasValidProtocol","getPublicUrl","path","basename","renderHTML","config","manifest","manifestFiles","res","base","URL","pathname","language","i18n","web","hideDeprecatedVersions","needHtmlCache","undefined","includes","html_cache","darkMode","title","WEB_TITLE","login","hasLogin","scope","favicon","logoDark","pkgManagers","version","locals","app_version","flags","experiments","primaryColor","validatePrimaryColor","primary_color","scriptsBodyAfter","metaScripts","scriptsbodyBefore","showInfo","showSettings","showThemeSwitch","showFooter","showSearch","showDownloadTarball","showRaw","showUplinks","Object","assign","bodyBefore","scriptsBodyBefore","options","webPage","cacheKey","JSON","stringify","get","renderTemplate","set","error","Error","stack","setHeader","HEADERS","TEXT_HTML","send"],"sources":["../../../../src/middlewares/web/utils/renderHTML.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport type { Response } from 'express';\nimport { LRUCache } from 'lru-cache';\nimport path from 'node:path';\nimport { URL } from 'node:url';\n\nimport { WEB_TITLE } from '@verdaccio/config';\nimport { HEADERS } from '@verdaccio/core';\nimport type { ConfigYaml, TemplateUIOptions } from '@verdaccio/types';\nimport type { RequestOptions } from '@verdaccio/url';\nimport { getPublicUrl, isURLhasValidProtocol } from '@verdaccio/url';\n\nimport type { Manifest } from './manifest';\nimport renderTemplate from './template';\nimport type { AssetManifest } from './template';\nimport { hasLogin, validatePrimaryColor } from './web-utils';\n\nconst DEFAULT_LANGUAGE = 'es-US';\n// Cache for rendered HTML templates: max 500 entries, 1 hour TTL\nconst cache = new LRUCache({ max: 500, ttl: 1000 * 60 * 60 });\n\nconst debug = buildDebug('verdaccio:web:render');\n\nconst defaultManifestFiles: Manifest = {\n js: ['vendors.js', 'main.js'],\n ico: 'favicon.ico',\n css: [],\n};\n\nexport function resolveLogo(\n logo: string | undefined,\n url_prefix: string | undefined,\n requestOptions: RequestOptions\n) {\n if (typeof logo !== 'string') {\n return '';\n }\n const isLocalFile = logo && !isURLhasValidProtocol(logo);\n\n if (isLocalFile) {\n return `${getPublicUrl(url_prefix, requestOptions)}-/static/${path.basename(logo)}`;\n } else if (isURLhasValidProtocol(logo)) {\n return logo;\n } else {\n return '';\n }\n}\n\nexport default function renderHTML(\n config: ConfigYaml,\n manifest: AssetManifest,\n manifestFiles: Manifest | null | undefined,\n requestOptions: RequestOptions,\n res: Response\n) {\n const { url_prefix } = config;\n const base = getPublicUrl(config?.url_prefix, requestOptions);\n const basename = new URL(base).pathname;\n const language = config?.i18n?.web ?? DEFAULT_LANGUAGE;\n const hideDeprecatedVersions = config?.web?.hideDeprecatedVersions ?? false;\n // @ts-ignore\n const needHtmlCache = [undefined, null].includes(config?.web?.html_cache)\n ? true\n : config?.web?.html_cache;\n const darkMode = config?.web?.darkMode ?? false;\n const title = config?.web?.title ?? WEB_TITLE;\n const login = hasLogin(config);\n const scope = config?.web?.scope ?? '';\n const favicon = resolveLogo(config?.web?.favicon, config?.url_prefix, requestOptions);\n const logo = resolveLogo(config?.web?.logo, config?.url_prefix, requestOptions);\n const logoDark = resolveLogo(config?.web?.logoDark, config?.url_prefix, requestOptions);\n const pkgManagers = config?.web?.pkgManagers ?? ['yarn', 'pnpm', 'npm'];\n const version = res.locals.app_version ?? '';\n const flags = {\n ...config.flags,\n // legacy from 5.x\n ...config.experiments,\n };\n const primaryColor =\n validatePrimaryColor(config?.web?.primary_color ?? config?.web?.primaryColor) ?? '#4b5e40';\n const {\n scriptsBodyAfter,\n metaScripts,\n scriptsbodyBefore, // deprecated\n showInfo,\n showSettings,\n showThemeSwitch,\n showFooter,\n showSearch,\n showDownloadTarball,\n showRaw,\n showUplinks,\n } = Object.assign(\n {},\n {\n scriptsBodyAfter: [],\n bodyBefore: [],\n metaScripts: [],\n },\n config?.web\n );\n // Fallback\n let scriptsBodyBefore = config?.web?.scriptsBodyBefore;\n if (scriptsbodyBefore && !scriptsBodyBefore) {\n scriptsBodyBefore = scriptsbodyBefore;\n }\n const options: TemplateUIOptions = {\n showInfo,\n showSettings,\n showThemeSwitch,\n showFooter,\n showSearch,\n showDownloadTarball,\n showRaw,\n showUplinks,\n darkMode,\n url_prefix,\n basename,\n base,\n primaryColor,\n version,\n logo,\n logoDark,\n favicon,\n flags,\n login,\n pkgManagers,\n title,\n scope,\n language,\n hideDeprecatedVersions,\n };\n\n let webPage;\n\n const cacheKey = `template:${JSON.stringify(options)}`;\n\n try {\n webPage = cache.get(cacheKey);\n if (!webPage) {\n webPage = renderTemplate(\n {\n manifest: manifestFiles ?? defaultManifestFiles,\n options,\n scriptsBodyAfter,\n metaScripts,\n scriptsBodyBefore,\n },\n manifest\n );\n\n if (needHtmlCache) {\n cache.set(cacheKey, webPage);\n debug('set template cache');\n }\n } else {\n debug('reuse template cache');\n }\n } catch (error: any) {\n throw new Error(`theme could not be load, stack ${error.stack}`);\n }\n res.setHeader('Content-Type', HEADERS.TEXT_HTML);\n res.send(webPage);\n debug('web rendered');\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAGA,IAAAM,IAAA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CAACwE,GAAG,CAACH,QAAQ,CAAC;IAC7B,IAAI,CAACD,OAAO,EAAE;MACZA,OAAO,GAAG,IAAAK,iBAAc,EACtB;QACEpD,QAAQ,EAAEC,aAAa,IAAIhB,oBAAoB;QAC/C6D,OAAO;QACPf,gBAAgB;QAChBC,WAAW;QACXa;MACF,CAAC,EACD7C,QACF,CAAC;MAED,IAAIU,aAAa,EAAE;QACjB/B,KAAK,CAAC0E,GAAG,CAACL,QAAQ,EAAED,OAAO,CAAC;QAC5BhE,KAAK,CAAC,oBAAoB,CAAC;MAC7B;IACF,CAAC,MAAM;MACLA,KAAK,CAAC,sBAAsB,CAAC;IAC/B;EACF,CAAC,CAAC,OAAOuE,KAAU,EAAE;IACnB,MAAM,IAAIC,KAAK,CAAC,kCAAkCD,KAAK,CAACE,KAAK,EAAE,CAAC;EAClE;EACAtD,GAAG,CAACuD,SAAS,CAAC,cAAc,EAAEC,aAAO,CAACC,SAAS,CAAC;EAChDzD,GAAG,CAAC0D,IAAI,CAACb,OAAO,CAAC;EACjBhE,KAAK,CAAC,cAAc,CAAC;AACvB","ignoreList":[]}
|
|
@@ -23,12 +23,13 @@ function renderTemplate(template, manifest) {
|
|
|
23
23
|
<script>
|
|
24
24
|
window.__VERDACCIO_BASENAME_UI_OPTIONS=${JSON.stringify(template.options)}
|
|
25
25
|
</script>
|
|
26
|
+
${template.manifest.css?.length ? (0, _manifest.getManifestValue)(template.manifest.css, manifest, template?.options.base).map(item => `<link rel="stylesheet" href="${item}">`).join('\n ') : ''}
|
|
26
27
|
${template?.metaScripts ? template.metaScripts.join('') : ''}
|
|
27
28
|
</head>
|
|
28
29
|
<body class="body">
|
|
29
30
|
${template?.scriptsBodyBefore ? template.scriptsBodyBefore.join('') : ''}
|
|
30
31
|
<div id="root"></div>
|
|
31
|
-
${(0, _manifest.getManifestValue)(template.manifest.js, manifest, template?.options.base).map(item => `<script
|
|
32
|
+
${(0, _manifest.getManifestValue)(template.manifest.js, manifest, template?.options.base).map(item => `<script type="module" src="${item}"></script>`).join(`\n `)}
|
|
32
33
|
${template?.scriptsBodyAfter ? template.scriptsBodyAfter.join('') : ''}
|
|
33
34
|
</body>
|
|
34
35
|
</html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","names":["_debug","_interopRequireDefault","require","_manifest","e","__esModule","default","debug","buildDebug","renderTemplate","template","manifest","options","base","title","JSON","stringify","
|
|
1
|
+
{"version":3,"file":"template.js","names":["_debug","_interopRequireDefault","require","_manifest","e","__esModule","default","debug","buildDebug","renderTemplate","template","manifest","options","base","title","JSON","stringify","css","length","getManifestValue","map","item","join","metaScripts","scriptsBodyBefore","js","scriptsBodyAfter"],"sources":["../../../../src/middlewares/web/utils/template.ts"],"sourcesContent":["import buildDebug from 'debug';\n\nimport type { TemplateUIOptions } from '@verdaccio/types';\n\nimport type { Manifest } from './manifest';\nimport { getManifestValue } from './manifest';\n\nconst debug = buildDebug('verdaccio:web:render:template');\n\nexport type Template = {\n manifest: Manifest;\n options: TemplateUIOptions;\n metaScripts?: string[];\n scriptsBodyAfter?: string[];\n scriptsBodyBefore?: string[];\n};\n\nexport interface AssetManifest {\n [key: string]: string;\n}\n\nexport default function renderTemplate(template: Template, manifest: AssetManifest) {\n debug('template %o', template);\n debug('manifest %o', manifest);\n\n return `\n <!DOCTYPE html>\n <html lang=\"en-us\">\n <head>\n <meta charset=\"utf-8\">\n <base href=\"${template?.options.base}\">\n <title>${template?.options?.title ?? ''}</title>\n <link rel=\"icon\" href=\"${template?.options.base}-/static/favicon.ico\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <script>\n window.__VERDACCIO_BASENAME_UI_OPTIONS=${JSON.stringify(template.options)}\n </script>\n ${\n template.manifest.css?.length\n ? getManifestValue(template.manifest.css, manifest, template?.options.base)\n .map((item) => `<link rel=\"stylesheet\" href=\"${item}\">`)\n .join('\\n ')\n : ''\n }\n ${template?.metaScripts ? template.metaScripts.join('') : ''}\n </head>\n <body class=\"body\">\n ${template?.scriptsBodyBefore ? template.scriptsBodyBefore.join('') : ''}\n <div id=\"root\"></div>\n ${getManifestValue(template.manifest.js, manifest, template?.options.base)\n .map((item) => `<script type=\"module\" src=\"${item}\"></script>`)\n .join(`\\n `)}\n ${template?.scriptsBodyAfter ? template.scriptsBodyAfter.join('') : ''}\n </body>\n </html>\n `;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAD,OAAA;AAA8C,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,+BAA+B,CAAC;AAc1C,SAASC,cAAcA,CAACC,QAAkB,EAAEC,QAAuB,EAAE;EAClFJ,KAAK,CAAC,aAAa,EAAEG,QAAQ,CAAC;EAC9BH,KAAK,CAAC,aAAa,EAAEI,QAAQ,CAAC;EAE9B,OAAO;AACT;AACA;AACA;AACA;AACA,sBAAsBD,QAAQ,EAAEE,OAAO,CAACC,IAAI;AAC5C,iBAAiBH,QAAQ,EAAEE,OAAO,EAAEE,KAAK,IAAI,EAAE;AAC/C,iCAAiCJ,QAAQ,EAAEE,OAAO,CAACC,IAAI;AACvD;AACA;AACA,qDAAqDE,IAAI,CAACC,SAAS,CAACN,QAAQ,CAACE,OAAO,CAAC;AACrF;AACA,UACUF,QAAQ,CAACC,QAAQ,CAACM,GAAG,EAAEC,MAAM,GACzB,IAAAC,0BAAgB,EAACT,QAAQ,CAACC,QAAQ,CAACM,GAAG,EAAEN,QAAQ,EAAED,QAAQ,EAAEE,OAAO,CAACC,IAAI,CAAC,CACtEO,GAAG,CAAEC,IAAI,IAAK,gCAAgCA,IAAI,IAAI,CAAC,CACvDC,IAAI,CAAC,YAAY,CAAC,GACrB,EAAE;AAChB,UACUZ,QAAQ,EAAEa,WAAW,GAAGb,QAAQ,CAACa,WAAW,CAACD,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE;AACpE;AACA;AACA,UAAUZ,QAAQ,EAAEc,iBAAiB,GAAGd,QAAQ,CAACc,iBAAiB,CAACF,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE;AAChF;AACA,UAAU,IAAAH,0BAAgB,EAACT,QAAQ,CAACC,QAAQ,CAACc,EAAE,EAAEd,QAAQ,EAAED,QAAQ,EAAEE,OAAO,CAACC,IAAI,CAAC,CACvEO,GAAG,CAAEC,IAAI,IAAK,8BAA8BA,IAAI,aAAa,CAAC,CAC9DC,IAAI,CAAC,YAAY,CAAC;AAC7B,UAAUZ,QAAQ,EAAEgB,gBAAgB,GAAGhB,QAAQ,CAACgB,gBAAgB,CAACJ,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE;AAC9E;AACA;AACA,GAAG;AACH","ignoreList":[]}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
export declare enum WebUrls {
|
|
5
5
|
sidebar_scopped_package = "/sidebar/:scope/:package",
|
|
6
6
|
sidebar_package = "/sidebar/:package",
|
|
7
|
-
readme_package_scoped_version = "/package/readme/:scope/:package/:version
|
|
8
|
-
readme_package_version = "/package/readme/:package/:version
|
|
7
|
+
readme_package_scoped_version = "/package/readme/:scope/:package{/:version}",
|
|
8
|
+
readme_package_version = "/package/readme/:package{/:version}",
|
|
9
9
|
packages_all = "/packages",
|
|
10
10
|
user_login = "/login",
|
|
11
11
|
user_signup = "/signup",
|
|
@@ -17,9 +17,9 @@ export declare enum WebUrls {
|
|
|
17
17
|
*/
|
|
18
18
|
export declare enum WebUrlsNamespace {
|
|
19
19
|
root = "/",
|
|
20
|
-
static = "/-/static/",
|
|
20
|
+
static = "/-/static/{*all}",
|
|
21
21
|
endpoints = "/-/verdaccio/",
|
|
22
|
-
web = "/-/web/",
|
|
22
|
+
web = "/-/web/{*all}",
|
|
23
23
|
data = "/data/",
|
|
24
24
|
sec = "/sec/"
|
|
25
25
|
}
|
|
@@ -10,8 +10,8 @@ exports.WebUrlsNamespace = exports.WebUrls = void 0;
|
|
|
10
10
|
let WebUrls = exports.WebUrls = /*#__PURE__*/function (WebUrls) {
|
|
11
11
|
WebUrls["sidebar_scopped_package"] = "/sidebar/:scope/:package";
|
|
12
12
|
WebUrls["sidebar_package"] = "/sidebar/:package";
|
|
13
|
-
WebUrls["readme_package_scoped_version"] = "/package/readme/:scope/:package/:version
|
|
14
|
-
WebUrls["readme_package_version"] = "/package/readme/:package/:version
|
|
13
|
+
WebUrls["readme_package_scoped_version"] = "/package/readme/:scope/:package{/:version}";
|
|
14
|
+
WebUrls["readme_package_version"] = "/package/readme/:package{/:version}";
|
|
15
15
|
WebUrls["packages_all"] = "/packages";
|
|
16
16
|
WebUrls["user_login"] = "/login";
|
|
17
17
|
WebUrls["user_signup"] = "/signup";
|
|
@@ -24,9 +24,9 @@ let WebUrls = exports.WebUrls = /*#__PURE__*/function (WebUrls) {
|
|
|
24
24
|
*/
|
|
25
25
|
let WebUrlsNamespace = exports.WebUrlsNamespace = /*#__PURE__*/function (WebUrlsNamespace) {
|
|
26
26
|
WebUrlsNamespace["root"] = "/";
|
|
27
|
-
WebUrlsNamespace["static"] = "/-/static/";
|
|
27
|
+
WebUrlsNamespace["static"] = "/-/static/{*all}";
|
|
28
28
|
WebUrlsNamespace["endpoints"] = "/-/verdaccio/";
|
|
29
|
-
WebUrlsNamespace["web"] = "/-/web/";
|
|
29
|
+
WebUrlsNamespace["web"] = "/-/web/{*all}";
|
|
30
30
|
WebUrlsNamespace["data"] = "/data/";
|
|
31
31
|
WebUrlsNamespace["sec"] = "/sec/";
|
|
32
32
|
return WebUrlsNamespace;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-urls.js","names":["WebUrls","exports","WebUrlsNamespace"],"sources":["../../../src/middlewares/web/web-urls.ts"],"sourcesContent":["/**\n * Enum for web urls, used on the web middleware\n */\nexport enum WebUrls {\n sidebar_scopped_package = '/sidebar/:scope/:package',\n sidebar_package = '/sidebar/:package',\n readme_package_scoped_version = '/package/readme/:scope/:package/:version
|
|
1
|
+
{"version":3,"file":"web-urls.js","names":["WebUrls","exports","WebUrlsNamespace"],"sources":["../../../src/middlewares/web/web-urls.ts"],"sourcesContent":["/**\n * Enum for web urls, used on the web middleware\n */\nexport enum WebUrls {\n sidebar_scopped_package = '/sidebar/:scope/:package',\n sidebar_package = '/sidebar/:package',\n readme_package_scoped_version = '/package/readme/:scope/:package{/:version}',\n readme_package_version = '/package/readme/:package{/:version}',\n packages_all = '/packages',\n user_login = '/login',\n user_signup = '/signup',\n search = '/search/:anything',\n reset_password = '/reset_password',\n}\n\n/**\n * Enum for web urls namespace, used on the web middleware\n */\nexport enum WebUrlsNamespace {\n root = '/',\n static = '/-/static/{*all}',\n endpoints = '/-/verdaccio/',\n web = '/-/web/{*all}',\n data = '/data/',\n sec = '/sec/',\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AAFA,IAGYA,OAAO,GAAAC,OAAA,CAAAD,OAAA,0BAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAA,OAAPA,OAAO;AAAA;AAYnB;AACA;AACA;AAFA,IAGYE,gBAAgB,GAAAD,OAAA,CAAAC,gBAAA,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/middleware",
|
|
3
|
-
"version": "9.0.0-next-9.
|
|
3
|
+
"version": "9.0.0-next-9.2",
|
|
4
4
|
"description": "Verdaccio Express Middleware",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -30,24 +30,24 @@
|
|
|
30
30
|
"verdaccio"
|
|
31
31
|
],
|
|
32
32
|
"engines": {
|
|
33
|
-
"node": ">=
|
|
33
|
+
"node": ">=24"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@verdaccio/config": "9.0.0-next-9.
|
|
37
|
-
"@verdaccio/core": "9.0.0-next-9.
|
|
38
|
-
"@verdaccio/url": "14.0.0-next-9.
|
|
36
|
+
"@verdaccio/config": "9.0.0-next-9.2",
|
|
37
|
+
"@verdaccio/core": "9.0.0-next-9.2",
|
|
38
|
+
"@verdaccio/url": "14.0.0-next-9.2",
|
|
39
39
|
"debug": "4.4.3",
|
|
40
|
-
"express": "
|
|
41
|
-
"express-rate-limit": "
|
|
40
|
+
"express": "5.2.1",
|
|
41
|
+
"express-rate-limit": "8.2.1",
|
|
42
42
|
"lodash": "4.17.23",
|
|
43
|
-
"lru-cache": "
|
|
43
|
+
"lru-cache": "11.2.6"
|
|
44
44
|
},
|
|
45
45
|
"funding": {
|
|
46
46
|
"type": "opencollective",
|
|
47
47
|
"url": "https://opencollective.com/verdaccio"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@verdaccio/logger": "9.0.0-next-9.
|
|
50
|
+
"@verdaccio/logger": "9.0.0-next-9.2",
|
|
51
51
|
"@verdaccio/types": "14.0.0-next-9.0",
|
|
52
52
|
"http-errors": "2.0.1",
|
|
53
53
|
"supertest": "7.1.4",
|