@verdaccio/middleware 9.0.0-next-9.3 → 9.0.0-next-9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/_virtual/_rolldown/runtime.js +23 -0
- package/build/index.js +60 -221
- package/build/index.mjs +22 -0
- package/build/middlewares/allow.js +42 -50
- package/build/middlewares/allow.js.map +1 -1
- package/build/middlewares/allow.mjs +44 -0
- package/build/middlewares/allow.mjs.map +1 -0
- package/build/middlewares/antiLoop.d.ts +2 -2
- package/build/middlewares/antiLoop.js +22 -40
- package/build/middlewares/antiLoop.js.map +1 -1
- package/build/middlewares/antiLoop.mjs +25 -0
- package/build/middlewares/antiLoop.mjs.map +1 -0
- package/build/middlewares/api_urls.js +66 -59
- package/build/middlewares/api_urls.js.map +1 -1
- package/build/middlewares/api_urls.mjs +59 -0
- package/build/middlewares/api_urls.mjs.map +1 -0
- package/build/middlewares/dotfiles.d.ts +1 -1
- package/build/middlewares/dotfiles.js +25 -28
- package/build/middlewares/dotfiles.js.map +1 -1
- package/build/middlewares/dotfiles.mjs +27 -0
- package/build/middlewares/dotfiles.mjs.map +1 -0
- package/build/middlewares/encode-pkg.d.ts +1 -1
- package/build/middlewares/encode-pkg.js +20 -36
- package/build/middlewares/encode-pkg.js.map +1 -1
- package/build/middlewares/encode-pkg.mjs +22 -0
- package/build/middlewares/encode-pkg.mjs.map +1 -0
- package/build/middlewares/error.d.ts +3 -3
- package/build/middlewares/error.js +53 -71
- package/build/middlewares/error.js.map +1 -1
- package/build/middlewares/error.mjs +53 -0
- package/build/middlewares/error.mjs.map +1 -0
- package/build/middlewares/final.d.ts +2 -2
- package/build/middlewares/final.js +46 -57
- package/build/middlewares/final.js.map +1 -1
- package/build/middlewares/final.mjs +46 -0
- package/build/middlewares/final.mjs.map +1 -0
- package/build/middlewares/json.d.ts +1 -1
- package/build/middlewares/json.js +8 -11
- package/build/middlewares/json.js.map +1 -1
- package/build/middlewares/json.mjs +10 -0
- package/build/middlewares/json.mjs.map +1 -0
- package/build/middlewares/log.d.ts +1 -1
- package/build/middlewares/log.js +97 -125
- package/build/middlewares/log.js.map +1 -1
- package/build/middlewares/log.mjs +96 -0
- package/build/middlewares/log.mjs.map +1 -0
- package/build/middlewares/make-url-relative.d.ts +1 -1
- package/build/middlewares/make-url-relative.js +26 -41
- package/build/middlewares/make-url-relative.js.map +1 -1
- package/build/middlewares/make-url-relative.mjs +28 -0
- package/build/middlewares/make-url-relative.mjs.map +1 -0
- package/build/middlewares/match.js +8 -13
- package/build/middlewares/match.js.map +1 -1
- package/build/middlewares/match.mjs +11 -0
- package/build/middlewares/match.mjs.map +1 -0
- package/build/middlewares/media.js +15 -19
- package/build/middlewares/media.js.map +1 -1
- package/build/middlewares/media.mjs +17 -0
- package/build/middlewares/media.mjs.map +1 -0
- package/build/middlewares/rate-limit.d.ts +2 -2
- package/build/middlewares/rate-limit.js +8 -10
- package/build/middlewares/rate-limit.js.map +1 -1
- package/build/middlewares/rate-limit.mjs +9 -0
- package/build/middlewares/rate-limit.mjs.map +1 -0
- package/build/middlewares/request-options.d.ts +2 -2
- package/build/middlewares/request-options.js +18 -27
- package/build/middlewares/request-options.js.map +1 -1
- package/build/middlewares/request-options.mjs +19 -0
- package/build/middlewares/request-options.mjs.map +1 -0
- package/build/middlewares/user-agent.d.ts +1 -1
- package/build/middlewares/user-agent.js +11 -12
- package/build/middlewares/user-agent.js.map +1 -1
- package/build/middlewares/user-agent.mjs +13 -0
- package/build/middlewares/user-agent.mjs.map +1 -0
- package/build/middlewares/validation.d.ts +1 -1
- package/build/middlewares/validation.js +11 -18
- package/build/middlewares/validation.js.map +1 -1
- package/build/middlewares/validation.mjs +14 -0
- package/build/middlewares/validation.mjs.map +1 -0
- package/build/middlewares/web/index.js +4 -35
- package/build/middlewares/web/index.mjs +4 -0
- package/build/middlewares/web/render-web.d.ts +1 -1
- package/build/middlewares/web/render-web.js +80 -109
- package/build/middlewares/web/render-web.js.map +1 -1
- package/build/middlewares/web/render-web.mjs +79 -0
- package/build/middlewares/web/render-web.mjs.map +1 -0
- package/build/middlewares/web/security.js +29 -41
- package/build/middlewares/web/security.js.map +1 -1
- package/build/middlewares/web/security.mjs +30 -0
- package/build/middlewares/web/security.mjs.map +1 -0
- package/build/middlewares/web/utils/manifest.js +17 -18
- package/build/middlewares/web/utils/manifest.js.map +1 -1
- package/build/middlewares/web/utils/manifest.mjs +21 -0
- package/build/middlewares/web/utils/manifest.mjs.map +1 -0
- package/build/middlewares/web/utils/renderHTML.d.ts +5 -5
- package/build/middlewares/web/utils/renderHTML.js +109 -136
- package/build/middlewares/web/utils/renderHTML.js.map +1 -1
- package/build/middlewares/web/utils/renderHTML.mjs +113 -0
- package/build/middlewares/web/utils/renderHTML.mjs.map +1 -0
- package/build/middlewares/web/utils/template.d.ts +2 -2
- package/build/middlewares/web/utils/template.js +19 -20
- package/build/middlewares/web/utils/template.js.map +1 -1
- package/build/middlewares/web/utils/template.mjs +35 -0
- package/build/middlewares/web/utils/template.mjs.map +1 -0
- package/build/middlewares/web/utils/web-utils.js +17 -18
- package/build/middlewares/web/utils/web-utils.js.map +1 -1
- package/build/middlewares/web/utils/web-utils.mjs +18 -0
- package/build/middlewares/web/utils/web-utils.mjs.map +1 -0
- package/build/middlewares/web/web-api.d.ts +1 -2
- package/build/middlewares/web/web-api.js +18 -27
- package/build/middlewares/web/web-api.js.map +1 -1
- package/build/middlewares/web/web-api.mjs +19 -0
- package/build/middlewares/web/web-api.mjs.map +1 -0
- package/build/middlewares/web/web-middleware.js +16 -23
- package/build/middlewares/web/web-middleware.js.map +1 -1
- package/build/middlewares/web/web-middleware.mjs +16 -0
- package/build/middlewares/web/web-middleware.mjs.map +1 -0
- package/build/middlewares/web/web-urls.js +28 -29
- package/build/middlewares/web/web-urls.js.map +1 -1
- package/build/middlewares/web/web-urls.mjs +32 -0
- package/build/middlewares/web/web-urls.mjs.map +1 -0
- package/build/types.d.ts +2 -2
- package/package.json +22 -11
- package/build/index.js.map +0 -1
- package/build/middlewares/web/index.js.map +0 -1
- package/build/types.js +0 -6
- package/build/types.js.map +0 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { HEADERS } from "@verdaccio/core";
|
|
2
|
+
import buildDebug from "debug";
|
|
3
|
+
//#region src/middlewares/web/security.ts
|
|
4
|
+
var debug = buildDebug("verdaccio:middleware:web:security");
|
|
5
|
+
function setSecurityWebHeaders(_req, res, next) {
|
|
6
|
+
const framesOptions = res.getHeader(HEADERS.FRAMES_OPTIONS);
|
|
7
|
+
if (!framesOptions || !(framesOptions === "deny" || framesOptions === "sameorigin")) {
|
|
8
|
+
debug("Missing or invalid X-Frame-Options header; setting to \"deny\"");
|
|
9
|
+
res.header(HEADERS.FRAMES_OPTIONS, "deny");
|
|
10
|
+
}
|
|
11
|
+
if (!res.getHeader(HEADERS.CSP)) {
|
|
12
|
+
debug("Missing Content-Security-Policy header; setting to \"connect-src 'self'\"");
|
|
13
|
+
res.header(HEADERS.CSP, "connect-src 'self'");
|
|
14
|
+
}
|
|
15
|
+
const cto = res.getHeader(HEADERS.CTO);
|
|
16
|
+
if (!cto || cto !== "nosniff") {
|
|
17
|
+
debug("Missing or invalid X-Content-Type-Options header; setting to \"nosniff\"");
|
|
18
|
+
res.header(HEADERS.CTO, "nosniff");
|
|
19
|
+
}
|
|
20
|
+
const xss = res.getHeader(HEADERS.XSS);
|
|
21
|
+
if (!xss || !(xss === "0" || xss.startsWith("1"))) {
|
|
22
|
+
debug("Missing or invalid X-XSS-Protection header; setting to \"1; mode=block\"");
|
|
23
|
+
res.header(HEADERS.XSS, "1; mode=block");
|
|
24
|
+
}
|
|
25
|
+
next();
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { setSecurityWebHeaders };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=security.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.mjs","names":[],"sources":["../../../src/middlewares/web/security.ts"],"sourcesContent":["import buildDebug from 'debug';\n\nimport { HEADERS } from '@verdaccio/core';\n\nconst debug = buildDebug('verdaccio:middleware:web:security');\n\nexport function setSecurityWebHeaders(_req, res, next): void {\n // disable loading in frames (clickjacking, etc.)\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Frame-Options\n const framesOptions = res.getHeader(HEADERS.FRAMES_OPTIONS);\n if (!framesOptions || !(framesOptions === 'deny' || framesOptions === 'sameorigin')) {\n debug('Missing or invalid X-Frame-Options header; setting to \"deny\"');\n res.header(HEADERS.FRAMES_OPTIONS, 'deny');\n }\n\n // avoid establishing connections outside of domain\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy\n if (!res.getHeader(HEADERS.CSP)) {\n debug('Missing Content-Security-Policy header; setting to \"connect-src \\'self\\'\"');\n res.header(HEADERS.CSP, \"connect-src 'self'\");\n }\n\n // respect the content type of the response\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Content-Type-Options\n const cto = res.getHeader(HEADERS.CTO);\n if (!cto || cto !== 'nosniff') {\n debug('Missing or invalid X-Content-Type-Options header; setting to \"nosniff\"');\n res.header(HEADERS.CTO, 'nosniff');\n }\n\n // block rendering of the page in case of XSS attack\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-XSS-Protection\n const xss = res.getHeader(HEADERS.XSS);\n if (!xss || !(xss === '0' || xss.startsWith('1'))) {\n debug('Missing or invalid X-XSS-Protection header; setting to \"1; mode=block\"');\n res.header(HEADERS.XSS, '1; mode=block');\n }\n next();\n}\n"],"mappings":";;;AAIA,IAAM,QAAQ,WAAW,oCAAoC;AAE7D,SAAgB,sBAAsB,MAAM,KAAK,MAAY;CAG3D,MAAM,gBAAgB,IAAI,UAAU,QAAQ,eAAe;AAC3D,KAAI,CAAC,iBAAiB,EAAE,kBAAkB,UAAU,kBAAkB,eAAe;AACnF,QAAM,iEAA+D;AACrE,MAAI,OAAO,QAAQ,gBAAgB,OAAO;;AAK5C,KAAI,CAAC,IAAI,UAAU,QAAQ,IAAI,EAAE;AAC/B,QAAM,4EAA4E;AAClF,MAAI,OAAO,QAAQ,KAAK,qBAAqB;;CAK/C,MAAM,MAAM,IAAI,UAAU,QAAQ,IAAI;AACtC,KAAI,CAAC,OAAO,QAAQ,WAAW;AAC7B,QAAM,2EAAyE;AAC/E,MAAI,OAAO,QAAQ,KAAK,UAAU;;CAKpC,MAAM,MAAM,IAAI,UAAU,QAAQ,IAAI;AACtC,KAAI,CAAC,OAAO,EAAE,QAAQ,OAAO,IAAI,WAAW,IAAI,GAAG;AACjD,QAAM,2EAAyE;AAC/E,MAAI,OAAO,QAAQ,KAAK,gBAAgB;;AAE1C,OAAM"}
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const resolvedItem = `${stripTrailingSlash(basePath)}/${stripLeadingSlash(manifest[item])}`;
|
|
14
|
-
debug('resolved item %o', resolvedItem);
|
|
15
|
-
return resolvedItem;
|
|
16
|
-
});
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
let debug = require("debug");
|
|
3
|
+
debug = require_runtime.__toESM(debug);
|
|
4
|
+
//#region src/middlewares/web/utils/manifest.ts
|
|
5
|
+
var debug$1 = (0, debug.default)("verdaccio:middleware:web:render:manifest");
|
|
6
|
+
function getManifestValue(manifestItems, manifest, basePath = "") {
|
|
7
|
+
return manifestItems?.map((item) => {
|
|
8
|
+
debug$1("resolve item %o", item);
|
|
9
|
+
const resolvedItem = `${stripTrailingSlash(basePath)}/${stripLeadingSlash(manifest[item])}`;
|
|
10
|
+
debug$1("resolved item %o", resolvedItem);
|
|
11
|
+
return resolvedItem;
|
|
12
|
+
});
|
|
17
13
|
}
|
|
18
14
|
function stripTrailingSlash(path) {
|
|
19
|
-
|
|
15
|
+
return path.replace(/\/$/, "");
|
|
20
16
|
}
|
|
21
17
|
function stripLeadingSlash(path) {
|
|
22
|
-
|
|
18
|
+
return path.replace(/^\//, "");
|
|
23
19
|
}
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.getManifestValue = getManifestValue;
|
|
22
|
+
|
|
24
23
|
//# sourceMappingURL=manifest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","names":[
|
|
1
|
+
{"version":3,"file":"manifest.js","names":[],"sources":["../../../../src/middlewares/web/utils/manifest.ts"],"sourcesContent":["import buildDebug from 'debug';\n\nexport type Manifest = {\n // goes on first place at the header\n ico: string;\n css: string[];\n js: string[];\n};\n\nconst debug = buildDebug('verdaccio:middleware:web:render:manifest');\n\nexport function getManifestValue(\n manifestItems: string[],\n manifest,\n basePath: string = ''\n): string[] {\n return manifestItems?.map((item) => {\n debug('resolve item %o', item);\n const resolvedItem = `${stripTrailingSlash(basePath)}/${stripLeadingSlash(manifest[item])}`;\n debug('resolved item %o', resolvedItem);\n return resolvedItem;\n });\n}\n\nfunction stripTrailingSlash(path: string): string {\n return path.replace(/\\/$/, '');\n}\n\nfunction stripLeadingSlash(path: string): string {\n return path.replace(/^\\//, '');\n}\n"],"mappings":";;;;AASA,IAAM,WAAA,GAAA,MAAA,SAAmB,2CAA2C;AAEpE,SAAgB,iBACd,eACA,UACA,WAAmB,IACT;AACV,QAAO,eAAe,KAAK,SAAS;AAClC,UAAM,mBAAmB,KAAK;EAC9B,MAAM,eAAe,GAAG,mBAAmB,SAAS,CAAC,GAAG,kBAAkB,SAAS,MAAM;AACzF,UAAM,oBAAoB,aAAa;AACvC,SAAO;GACP;;AAGJ,SAAS,mBAAmB,MAAsB;AAChD,QAAO,KAAK,QAAQ,OAAO,GAAG;;AAGhC,SAAS,kBAAkB,MAAsB;AAC/C,QAAO,KAAK,QAAQ,OAAO,GAAG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import buildDebug from "debug";
|
|
2
|
+
//#region src/middlewares/web/utils/manifest.ts
|
|
3
|
+
var debug = buildDebug("verdaccio:middleware:web:render:manifest");
|
|
4
|
+
function getManifestValue(manifestItems, manifest, basePath = "") {
|
|
5
|
+
return manifestItems?.map((item) => {
|
|
6
|
+
debug("resolve item %o", item);
|
|
7
|
+
const resolvedItem = `${stripTrailingSlash(basePath)}/${stripLeadingSlash(manifest[item])}`;
|
|
8
|
+
debug("resolved item %o", resolvedItem);
|
|
9
|
+
return resolvedItem;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function stripTrailingSlash(path) {
|
|
13
|
+
return path.replace(/\/$/, "");
|
|
14
|
+
}
|
|
15
|
+
function stripLeadingSlash(path) {
|
|
16
|
+
return path.replace(/^\//, "");
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { getManifestValue };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=manifest.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.mjs","names":[],"sources":["../../../../src/middlewares/web/utils/manifest.ts"],"sourcesContent":["import buildDebug from 'debug';\n\nexport type Manifest = {\n // goes on first place at the header\n ico: string;\n css: string[];\n js: string[];\n};\n\nconst debug = buildDebug('verdaccio:middleware:web:render:manifest');\n\nexport function getManifestValue(\n manifestItems: string[],\n manifest,\n basePath: string = ''\n): string[] {\n return manifestItems?.map((item) => {\n debug('resolve item %o', item);\n const resolvedItem = `${stripTrailingSlash(basePath)}/${stripLeadingSlash(manifest[item])}`;\n debug('resolved item %o', resolvedItem);\n return resolvedItem;\n });\n}\n\nfunction stripTrailingSlash(path: string): string {\n return path.replace(/\\/$/, '');\n}\n\nfunction stripLeadingSlash(path: string): string {\n return path.replace(/^\\//, '');\n}\n"],"mappings":";;AASA,IAAM,QAAQ,WAAW,2CAA2C;AAEpE,SAAgB,iBACd,eACA,UACA,WAAmB,IACT;AACV,QAAO,eAAe,KAAK,SAAS;AAClC,QAAM,mBAAmB,KAAK;EAC9B,MAAM,eAAe,GAAG,mBAAmB,SAAS,CAAC,GAAG,kBAAkB,SAAS,MAAM;AACzF,QAAM,oBAAoB,aAAa;AACvC,SAAO;GACP;;AAGJ,SAAS,mBAAmB,MAAsB;AAChD,QAAO,KAAK,QAAQ,OAAO,GAAG;;AAGhC,SAAS,kBAAkB,MAAsB;AAC/C,QAAO,KAAK,QAAQ,OAAO,GAAG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { Response } from 'express';
|
|
2
|
+
import { ConfigYaml } from '@verdaccio/types';
|
|
3
|
+
import { RequestOptions } from '@verdaccio/url';
|
|
4
|
+
import { Manifest } from './manifest';
|
|
5
|
+
import { AssetManifest } from './template';
|
|
6
6
|
export declare function resolveLogo(logo: string | undefined, url_prefix: string | undefined, requestOptions: RequestOptions): string;
|
|
7
7
|
export default function renderHTML(config: ConfigYaml, manifest: AssetManifest, manifestFiles: Manifest | null | undefined, requestOptions: RequestOptions, res: Response): void;
|
|
@@ -1,143 +1,116 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const DEFAULT_LANGUAGE = 'es-US';
|
|
19
|
-
// Cache for rendered HTML templates: max 500 entries, 1 hour TTL
|
|
20
|
-
const cache = new _lruCache.LRUCache({
|
|
21
|
-
max: 500,
|
|
22
|
-
ttl: 1000 * 60 * 60
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_template = require("./template.js");
|
|
3
|
+
const require_web_utils = require("./web-utils.js");
|
|
4
|
+
let _verdaccio_core = require("@verdaccio/core");
|
|
5
|
+
let debug = require("debug");
|
|
6
|
+
debug = require_runtime.__toESM(debug);
|
|
7
|
+
let node_url = require("node:url");
|
|
8
|
+
let _verdaccio_config = require("@verdaccio/config");
|
|
9
|
+
let node_path = require("node:path");
|
|
10
|
+
node_path = require_runtime.__toESM(node_path);
|
|
11
|
+
let _verdaccio_url = require("@verdaccio/url");
|
|
12
|
+
let lru_cache = require("lru-cache");
|
|
13
|
+
//#region src/middlewares/web/utils/renderHTML.ts
|
|
14
|
+
var DEFAULT_LANGUAGE = "es-US";
|
|
15
|
+
var cache = new lru_cache.LRUCache({
|
|
16
|
+
max: 500,
|
|
17
|
+
ttl: 1e3 * 60 * 60
|
|
23
18
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
var debug$1 = (0, debug.default)("verdaccio:web:render");
|
|
20
|
+
var defaultManifestFiles = {
|
|
21
|
+
js: ["vendors.js", "main.js"],
|
|
22
|
+
ico: "favicon.ico",
|
|
23
|
+
css: []
|
|
29
24
|
};
|
|
30
25
|
function resolveLogo(logo, url_prefix, requestOptions) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (isLocalFile) {
|
|
36
|
-
return `${(0, _url.getPublicUrl)(url_prefix, requestOptions)}-/static/${_nodePath.default.basename(logo)}`;
|
|
37
|
-
} else if ((0, _url.isURLhasValidProtocol)(logo)) {
|
|
38
|
-
return logo;
|
|
39
|
-
} else {
|
|
40
|
-
return '';
|
|
41
|
-
}
|
|
26
|
+
if (typeof logo !== "string") return "";
|
|
27
|
+
if (logo && !(0, _verdaccio_url.isURLhasValidProtocol)(logo)) return `${(0, _verdaccio_url.getPublicUrl)(url_prefix, requestOptions)}-/static/${node_path.default.basename(logo)}`;
|
|
28
|
+
else if ((0, _verdaccio_url.isURLhasValidProtocol)(logo)) return logo;
|
|
29
|
+
else return "";
|
|
42
30
|
}
|
|
43
31
|
function renderHTML(config, manifest, manifestFiles, requestOptions, res) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
options,
|
|
125
|
-
scriptsBodyAfter,
|
|
126
|
-
metaScripts,
|
|
127
|
-
scriptsBodyBefore
|
|
128
|
-
}, manifest);
|
|
129
|
-
if (needHtmlCache) {
|
|
130
|
-
cache.set(cacheKey, webPage);
|
|
131
|
-
debug('set template cache');
|
|
132
|
-
}
|
|
133
|
-
} else {
|
|
134
|
-
debug('reuse template cache');
|
|
135
|
-
}
|
|
136
|
-
} catch (error) {
|
|
137
|
-
throw new Error(`theme could not be load, stack ${error.stack}`);
|
|
138
|
-
}
|
|
139
|
-
res.setHeader('Content-Type', _core.HEADERS.TEXT_HTML);
|
|
140
|
-
res.send(webPage);
|
|
141
|
-
debug('web rendered');
|
|
32
|
+
const { url_prefix } = config;
|
|
33
|
+
const base = (0, _verdaccio_url.getPublicUrl)(config?.url_prefix, requestOptions);
|
|
34
|
+
const basename = node_url.URL.canParse(base) ? new node_url.URL(base).pathname : base;
|
|
35
|
+
const language = config?.i18n?.web ?? DEFAULT_LANGUAGE;
|
|
36
|
+
const hideDeprecatedVersions = config?.web?.hideDeprecatedVersions ?? false;
|
|
37
|
+
const needHtmlCache = [void 0, null].includes(config?.web?.html_cache) ? true : config?.web?.html_cache;
|
|
38
|
+
const darkMode = config?.web?.darkMode ?? false;
|
|
39
|
+
const title = config?.web?.title ?? _verdaccio_config.WEB_TITLE;
|
|
40
|
+
const login = require_web_utils.hasLogin(config);
|
|
41
|
+
const scope = config?.web?.scope ?? "";
|
|
42
|
+
const favicon = resolveLogo(config?.web?.favicon, config?.url_prefix, requestOptions);
|
|
43
|
+
const logo = resolveLogo(config?.web?.logo, config?.url_prefix, requestOptions);
|
|
44
|
+
const logoDark = resolveLogo(config?.web?.logoDark, config?.url_prefix, requestOptions);
|
|
45
|
+
const pkgManagers = config?.web?.pkgManagers ?? [
|
|
46
|
+
"yarn",
|
|
47
|
+
"pnpm",
|
|
48
|
+
"npm"
|
|
49
|
+
];
|
|
50
|
+
const version = res.locals.app_version ?? "";
|
|
51
|
+
const flags = {
|
|
52
|
+
...config.flags,
|
|
53
|
+
...config.experiments
|
|
54
|
+
};
|
|
55
|
+
const primaryColor = require_web_utils.validatePrimaryColor(config?.web?.primary_color ?? config?.web?.primaryColor) ?? "#4b5e40";
|
|
56
|
+
const { scriptsBodyAfter, metaScripts, scriptsbodyBefore, showInfo, showSettings, showThemeSwitch, showFooter, showSearch, showDownloadTarball, showRaw, showUplinks } = Object.assign({}, {
|
|
57
|
+
scriptsBodyAfter: [],
|
|
58
|
+
bodyBefore: [],
|
|
59
|
+
metaScripts: []
|
|
60
|
+
}, config?.web);
|
|
61
|
+
let scriptsBodyBefore = config?.web?.scriptsBodyBefore;
|
|
62
|
+
if (scriptsbodyBefore && !scriptsBodyBefore) scriptsBodyBefore = scriptsbodyBefore;
|
|
63
|
+
const options = {
|
|
64
|
+
showInfo,
|
|
65
|
+
showSettings,
|
|
66
|
+
showThemeSwitch,
|
|
67
|
+
showFooter,
|
|
68
|
+
showSearch,
|
|
69
|
+
showDownloadTarball,
|
|
70
|
+
showRaw,
|
|
71
|
+
showUplinks,
|
|
72
|
+
darkMode,
|
|
73
|
+
url_prefix,
|
|
74
|
+
basename,
|
|
75
|
+
base,
|
|
76
|
+
primaryColor,
|
|
77
|
+
version,
|
|
78
|
+
logo,
|
|
79
|
+
logoDark,
|
|
80
|
+
favicon,
|
|
81
|
+
flags,
|
|
82
|
+
login,
|
|
83
|
+
pkgManagers,
|
|
84
|
+
title,
|
|
85
|
+
scope,
|
|
86
|
+
language,
|
|
87
|
+
hideDeprecatedVersions
|
|
88
|
+
};
|
|
89
|
+
let webPage;
|
|
90
|
+
const cacheKey = `template:${JSON.stringify(options)}`;
|
|
91
|
+
try {
|
|
92
|
+
webPage = cache.get(cacheKey);
|
|
93
|
+
if (!webPage) {
|
|
94
|
+
webPage = require_template.default({
|
|
95
|
+
manifest: manifestFiles ?? defaultManifestFiles,
|
|
96
|
+
options,
|
|
97
|
+
scriptsBodyAfter,
|
|
98
|
+
metaScripts,
|
|
99
|
+
scriptsBodyBefore
|
|
100
|
+
}, manifest);
|
|
101
|
+
if (needHtmlCache) {
|
|
102
|
+
cache.set(cacheKey, webPage);
|
|
103
|
+
debug$1("set template cache");
|
|
104
|
+
}
|
|
105
|
+
} else debug$1("reuse template cache");
|
|
106
|
+
} catch (error) {
|
|
107
|
+
throw new Error(`theme could not be load, stack ${error.stack}`);
|
|
108
|
+
}
|
|
109
|
+
res.setHeader("Content-Type", _verdaccio_core.HEADERS.TEXT_HTML);
|
|
110
|
+
res.send(webPage);
|
|
111
|
+
debug$1("web rendered");
|
|
142
112
|
}
|
|
113
|
+
//#endregion
|
|
114
|
+
exports.default = renderHTML;
|
|
115
|
+
|
|
143
116
|
//# sourceMappingURL=renderHTML.js.map
|
|
@@ -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","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","canParse","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 = URL.canParse(base) ? new URL(base).pathname : base;\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,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IACRG;EACF,CAAC;EAED,IAAIsC,OAAO;EAEX,MAAMC,QAAQ,GAAG,YAAYC,IAAI,CAACC,SAAS,CAACJ,OAAO,CAAC,EAAE;EAEtD,IAAI;IACFC,OAAO,GAAGrE,KAAK,CAACyE,GAAG,CAACH,QAAQ,CAAC;IAC7B,IAAI,CAACD,OAAO,EAAE;MACZA,OAAO,GAAG,IAAAK,iBAAc,EACtB;QACErD,QAAQ,EAAEC,aAAa,IAAIhB,oBAAoB;QAC/C8D,OAAO;QACPf,gBAAgB;QAChBC,WAAW;QACXa;MACF,CAAC,EACD9C,QACF,CAAC;MAED,IAAIW,aAAa,EAAE;QACjBhC,KAAK,CAAC2E,GAAG,CAACL,QAAQ,EAAED,OAAO,CAAC;QAC5BjE,KAAK,CAAC,oBAAoB,CAAC;MAC7B;IACF,CAAC,MAAM;MACLA,KAAK,CAAC,sBAAsB,CAAC;IAC/B;EACF,CAAC,CAAC,OAAOwE,KAAU,EAAE;IACnB,MAAM,IAAIC,KAAK,CAAC,kCAAkCD,KAAK,CAACE,KAAK,EAAE,CAAC;EAClE;EACAvD,GAAG,CAACwD,SAAS,CAAC,cAAc,EAAEC,aAAO,CAACC,SAAS,CAAC;EAChD1D,GAAG,CAAC2D,IAAI,CAACb,OAAO,CAAC;EACjBjE,KAAK,CAAC,cAAc,CAAC;AACvB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"renderHTML.js","names":[],"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 = URL.canParse(base) ? new URL(base).pathname : base;\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":";;;;;;;;;;;;;AAiBA,IAAM,mBAAmB;AAEzB,IAAM,QAAQ,IAAI,UAAA,SAAS;CAAE,KAAK;CAAK,KAAK,MAAO,KAAK;CAAI,CAAC;AAE7D,IAAM,WAAA,GAAA,MAAA,SAAmB,uBAAuB;AAEhD,IAAM,uBAAiC;CACrC,IAAI,CAAC,cAAc,UAAU;CAC7B,KAA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,KAAK,aAAa,IAAI;CACnF,MAAM,EACJ,kBACA,aACA,mBACA,UACA,cACA,iBACA,YACA,YACA,qBACA,SACA,gBACE,OAAO,OACT,EAAE,EACF;EACE,kBAAkB,EAAE;EACpB,YAAY,EAAE;EACd,aAAa,EAAE;EAChB,EACD,QAAQ,IACT;CAED,IAAI,oBAAoB,QAAQ,KAAK;AACrC,KAAI,qBAAqB,CAAC,kBACxB,qBAAoB;CAEtB,MAAM,UAA6B;EACjC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;CAED,IAAI;CAEJ,MAAM,WAAW,YAAY,KAAK,UAAU,QAAQ;AAEpD,KAAI;AACF,YAAU,MAAM,IAAI,SAAS;AAC7B,MAAI,CAAC,SAAS;AACZ,aAAU,iBAAA,QACR;IACE,UAAU,iBAAiB;IAC3B;IACA;IACA;IACA;IACD,EACD,SACD;AAED,OAAI,eAAe;AACjB,UAAM,IAAI,UAAU,QAAQ;AAC5B,YAAM,qBAAqB;;QAG7B,SAAM,uBAAuB;UAExB,OAAY;AACnB,QAAM,IAAI,MAAM,kCAAkC,MAAM,QAAQ;;AAElE,KAAI,UAAU,gBAAgB,gBAAA,QAAQ,UAAU;AAChD,KAAI,KAAK,QAAQ;AACjB,SAAM,eAAe"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import renderTemplate from "./template.mjs";
|
|
2
|
+
import { hasLogin, validatePrimaryColor } from "./web-utils.mjs";
|
|
3
|
+
import { HEADERS } from "@verdaccio/core";
|
|
4
|
+
import buildDebug from "debug";
|
|
5
|
+
import { URL } from "node:url";
|
|
6
|
+
import { WEB_TITLE } from "@verdaccio/config";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { getPublicUrl, isURLhasValidProtocol } from "@verdaccio/url";
|
|
9
|
+
import { LRUCache } from "lru-cache";
|
|
10
|
+
//#region src/middlewares/web/utils/renderHTML.ts
|
|
11
|
+
var DEFAULT_LANGUAGE = "es-US";
|
|
12
|
+
var cache = new LRUCache({
|
|
13
|
+
max: 500,
|
|
14
|
+
ttl: 1e3 * 60 * 60
|
|
15
|
+
});
|
|
16
|
+
var debug = buildDebug("verdaccio:web:render");
|
|
17
|
+
var defaultManifestFiles = {
|
|
18
|
+
js: ["vendors.js", "main.js"],
|
|
19
|
+
ico: "favicon.ico",
|
|
20
|
+
css: []
|
|
21
|
+
};
|
|
22
|
+
function resolveLogo(logo, url_prefix, requestOptions) {
|
|
23
|
+
if (typeof logo !== "string") return "";
|
|
24
|
+
if (logo && !isURLhasValidProtocol(logo)) return `${getPublicUrl(url_prefix, requestOptions)}-/static/${path.basename(logo)}`;
|
|
25
|
+
else if (isURLhasValidProtocol(logo)) return logo;
|
|
26
|
+
else return "";
|
|
27
|
+
}
|
|
28
|
+
function renderHTML(config, manifest, manifestFiles, requestOptions, res) {
|
|
29
|
+
const { url_prefix } = config;
|
|
30
|
+
const base = getPublicUrl(config?.url_prefix, requestOptions);
|
|
31
|
+
const basename = URL.canParse(base) ? new URL(base).pathname : base;
|
|
32
|
+
const language = config?.i18n?.web ?? DEFAULT_LANGUAGE;
|
|
33
|
+
const hideDeprecatedVersions = config?.web?.hideDeprecatedVersions ?? false;
|
|
34
|
+
const needHtmlCache = [void 0, null].includes(config?.web?.html_cache) ? true : config?.web?.html_cache;
|
|
35
|
+
const darkMode = config?.web?.darkMode ?? false;
|
|
36
|
+
const title = config?.web?.title ?? WEB_TITLE;
|
|
37
|
+
const login = hasLogin(config);
|
|
38
|
+
const scope = config?.web?.scope ?? "";
|
|
39
|
+
const favicon = resolveLogo(config?.web?.favicon, config?.url_prefix, requestOptions);
|
|
40
|
+
const logo = resolveLogo(config?.web?.logo, config?.url_prefix, requestOptions);
|
|
41
|
+
const logoDark = resolveLogo(config?.web?.logoDark, config?.url_prefix, requestOptions);
|
|
42
|
+
const pkgManagers = config?.web?.pkgManagers ?? [
|
|
43
|
+
"yarn",
|
|
44
|
+
"pnpm",
|
|
45
|
+
"npm"
|
|
46
|
+
];
|
|
47
|
+
const version = res.locals.app_version ?? "";
|
|
48
|
+
const flags = {
|
|
49
|
+
...config.flags,
|
|
50
|
+
...config.experiments
|
|
51
|
+
};
|
|
52
|
+
const primaryColor = validatePrimaryColor(config?.web?.primary_color ?? config?.web?.primaryColor) ?? "#4b5e40";
|
|
53
|
+
const { scriptsBodyAfter, metaScripts, scriptsbodyBefore, showInfo, showSettings, showThemeSwitch, showFooter, showSearch, showDownloadTarball, showRaw, showUplinks } = Object.assign({}, {
|
|
54
|
+
scriptsBodyAfter: [],
|
|
55
|
+
bodyBefore: [],
|
|
56
|
+
metaScripts: []
|
|
57
|
+
}, config?.web);
|
|
58
|
+
let scriptsBodyBefore = config?.web?.scriptsBodyBefore;
|
|
59
|
+
if (scriptsbodyBefore && !scriptsBodyBefore) scriptsBodyBefore = scriptsbodyBefore;
|
|
60
|
+
const options = {
|
|
61
|
+
showInfo,
|
|
62
|
+
showSettings,
|
|
63
|
+
showThemeSwitch,
|
|
64
|
+
showFooter,
|
|
65
|
+
showSearch,
|
|
66
|
+
showDownloadTarball,
|
|
67
|
+
showRaw,
|
|
68
|
+
showUplinks,
|
|
69
|
+
darkMode,
|
|
70
|
+
url_prefix,
|
|
71
|
+
basename,
|
|
72
|
+
base,
|
|
73
|
+
primaryColor,
|
|
74
|
+
version,
|
|
75
|
+
logo,
|
|
76
|
+
logoDark,
|
|
77
|
+
favicon,
|
|
78
|
+
flags,
|
|
79
|
+
login,
|
|
80
|
+
pkgManagers,
|
|
81
|
+
title,
|
|
82
|
+
scope,
|
|
83
|
+
language,
|
|
84
|
+
hideDeprecatedVersions
|
|
85
|
+
};
|
|
86
|
+
let webPage;
|
|
87
|
+
const cacheKey = `template:${JSON.stringify(options)}`;
|
|
88
|
+
try {
|
|
89
|
+
webPage = cache.get(cacheKey);
|
|
90
|
+
if (!webPage) {
|
|
91
|
+
webPage = renderTemplate({
|
|
92
|
+
manifest: manifestFiles ?? defaultManifestFiles,
|
|
93
|
+
options,
|
|
94
|
+
scriptsBodyAfter,
|
|
95
|
+
metaScripts,
|
|
96
|
+
scriptsBodyBefore
|
|
97
|
+
}, manifest);
|
|
98
|
+
if (needHtmlCache) {
|
|
99
|
+
cache.set(cacheKey, webPage);
|
|
100
|
+
debug("set template cache");
|
|
101
|
+
}
|
|
102
|
+
} else debug("reuse template cache");
|
|
103
|
+
} catch (error) {
|
|
104
|
+
throw new Error(`theme could not be load, stack ${error.stack}`);
|
|
105
|
+
}
|
|
106
|
+
res.setHeader("Content-Type", HEADERS.TEXT_HTML);
|
|
107
|
+
res.send(webPage);
|
|
108
|
+
debug("web rendered");
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
export { renderHTML as default };
|
|
112
|
+
|
|
113
|
+
//# sourceMappingURL=renderHTML.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderHTML.mjs","names":[],"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 = URL.canParse(base) ? new URL(base).pathname : base;\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":";;;;;;;;;;AAiBA,IAAM,mBAAmB;AAEzB,IAAM,QAAQ,IAAI,SAAS;CAAE,KAAK;CAAK,KAAK,MAAO,KAAK;CAAI,CAAC;AAE7D,IAAM,QAAQ,WAAW,uBAAuB;AAEhD,IAAM,uBAAiC;CACrC,IAAI,CAAC,cAAc,UAAU;CAC7B,KAAK;CACL,KAAK,EAAE;CACR;AAED,SAAgB,YACd,MACA,YACA,gBACA;AACA,KAAI,OAAO,SAAS,SAClB,QAAO;AAIT,KAFoB,QAAQ,CAAC,sBAAsB,KAAK,CAGtD,QAAO,GAAG,aAAa,YAAY,eAAe,CAAC,WAAW,KAAK,SAAS,KAAK;UACxE,sBAAsB,KAAK,CACpC,QAAO;KAEP,QAAO;;AAIX,SAAwB,WACtB,QACA,UACA,eACA,gBACA,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ACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;CAED,IAAI;CAEJ,MAAM,WAAW,YAAY,KAAK,UAAU,QAAQ;AAEpD,KAAI;AACF,YAAU,MAAM,IAAI,SAAS;AAC7B,MAAI,CAAC,SAAS;AACZ,aAAU,eACR;IACE,UAAU,iBAAiB;IAC3B;IACA;IACA;IACA;IACD,EACD,SACD;AAED,OAAI,eAAe;AACjB,UAAM,IAAI,UAAU,QAAQ;AAC5B,UAAM,qBAAqB;;QAG7B,OAAM,uBAAuB;UAExB,OAAY;AACnB,QAAM,IAAI,MAAM,kCAAkC,MAAM,QAAQ;;AAElE,KAAI,UAAU,gBAAgB,QAAQ,UAAU;AAChD,KAAI,KAAK,QAAQ;AACjB,OAAM,eAAe"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { TemplateUIOptions } from '@verdaccio/types';
|
|
2
|
+
import { Manifest } from './manifest';
|
|
3
3
|
export type Template = {
|
|
4
4
|
manifest: Manifest;
|
|
5
5
|
options: TemplateUIOptions;
|