@verdaccio/config 8.1.2 → 8.2.0

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.
Files changed (61) hide show
  1. package/build/_virtual/_rolldown/runtime.js +23 -0
  2. package/build/address.js +80 -102
  3. package/build/address.js.map +1 -1
  4. package/build/address.mjs +86 -0
  5. package/build/address.mjs.map +1 -0
  6. package/build/agent.js +11 -16
  7. package/build/agent.js.map +1 -1
  8. package/build/agent.mjs +12 -0
  9. package/build/agent.mjs.map +1 -0
  10. package/build/builder.js +128 -131
  11. package/build/builder.js.map +1 -1
  12. package/build/builder.mjs +129 -0
  13. package/build/builder.mjs.map +1 -0
  14. package/build/conf/index.js +10 -11
  15. package/build/conf/index.js.map +1 -1
  16. package/build/conf/index.mjs +12 -0
  17. package/build/conf/index.mjs.map +1 -0
  18. package/build/config-path.js +154 -163
  19. package/build/config-path.js.map +1 -1
  20. package/build/config-path.mjs +171 -0
  21. package/build/config-path.mjs.map +1 -0
  22. package/build/config-utils.js +37 -41
  23. package/build/config-utils.js.map +1 -1
  24. package/build/config-utils.mjs +40 -0
  25. package/build/config-utils.mjs.map +1 -0
  26. package/build/config.js +154 -203
  27. package/build/config.js.map +1 -1
  28. package/build/config.mjs +153 -0
  29. package/build/config.mjs.map +1 -0
  30. package/build/index.js +52 -167
  31. package/build/index.mjs +14 -0
  32. package/build/package-access.js +52 -68
  33. package/build/package-access.js.map +1 -1
  34. package/build/package-access.mjs +52 -0
  35. package/build/package-access.mjs.map +1 -0
  36. package/build/parse.js +83 -100
  37. package/build/parse.js.map +1 -1
  38. package/build/parse.mjs +85 -0
  39. package/build/parse.mjs.map +1 -0
  40. package/build/security.js +15 -22
  41. package/build/security.js.map +1 -1
  42. package/build/security.mjs +16 -0
  43. package/build/security.mjs.map +1 -0
  44. package/build/serverSettings.js +10 -15
  45. package/build/serverSettings.js.map +1 -1
  46. package/build/serverSettings.mjs +12 -0
  47. package/build/serverSettings.mjs.map +1 -0
  48. package/build/token.js +10 -13
  49. package/build/token.js.map +1 -1
  50. package/build/token.mjs +13 -0
  51. package/build/token.mjs.map +1 -0
  52. package/build/uplinks.js +47 -55
  53. package/build/uplinks.js.map +1 -1
  54. package/build/uplinks.mjs +50 -0
  55. package/build/uplinks.mjs.map +1 -0
  56. package/build/user.js +42 -37
  57. package/build/user.js.map +1 -1
  58. package/build/user.mjs +48 -0
  59. package/build/user.mjs.map +1 -0
  60. package/package.json +43 -30
  61. package/build/index.js.map +0 -1
package/build/parse.js CHANGED
@@ -1,109 +1,92 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.fromJStoYAML = fromJStoYAML;
7
- exports.getConfigParsed = getConfigParsed;
8
- exports.parseConfigFile = parseConfigFile;
9
- var _debug = _interopRequireDefault(require("debug"));
10
- var _jsYaml = _interopRequireDefault(require("js-yaml"));
11
- var _lodash = require("lodash");
12
- var _nodeFs = _interopRequireDefault(require("node:fs"));
13
- var _nodePath = _interopRequireDefault(require("node:path"));
14
- var _core = require("@verdaccio/core");
15
- var _configPath = require("./config-path");
16
- var _configUtils = require("./config-utils");
17
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
- const debug = (0, _debug.default)('verdaccio:config:parse');
19
-
1
+ const require_runtime = require("./_virtual/_rolldown/runtime.js");
2
+ const require_config_utils = require("./config-utils.js");
3
+ const require_config_path = require("./config-path.js");
4
+ let debug = require("debug");
5
+ debug = require_runtime.__toESM(debug);
6
+ let lodash = require("lodash");
7
+ lodash = require_runtime.__toESM(lodash);
8
+ let _verdaccio_core = require("@verdaccio/core");
9
+ let node_fs = require("node:fs");
10
+ node_fs = require_runtime.__toESM(node_fs);
11
+ let node_path = require("node:path");
12
+ node_path = require_runtime.__toESM(node_path);
13
+ let js_yaml = require("js-yaml");
14
+ let node_module = require("node:module");
15
+ //#region src/parse.ts
16
+ var debug$1 = (0, debug.default)("verdaccio:config:parse");
20
17
  /**
21
- * Parse a config file from yaml to JSON.
22
- * @param configPath the absolute path of the configuration file
23
- */
18
+ * Parse a config file from yaml to JSON.
19
+ * @param configPath the absolute path of the configuration file
20
+ */
24
21
  function parseConfigFile(configPath) {
25
- debug('parse config file %s', configPath);
26
- if (!(0, _configUtils.fileExists)(configPath)) {
27
- throw new Error(`config file does not exist or not reachable`);
28
- }
29
- debug('parsing config file: %o', configPath);
30
- try {
31
- if (/\.ya?ml$/i.test(configPath)) {
32
- const yamlConfig = _jsYaml.default.load(_nodeFs.default.readFileSync(configPath, 'utf8'), {
33
- strict: false
34
- });
35
- return Object.assign({}, yamlConfig, {
36
- configPath,
37
- // @deprecated use configPath instead
38
- config_path: configPath
39
- });
40
- }
41
- process.emitWarning('Using JavaScript config files is deprecated and will be removed in the next major version. Please migrate to YAML or use the ConfigBuilder.', 'DeprecationWarning');
42
- const jsonConfig = require(configPath);
43
- return Object.assign({}, jsonConfig, {
44
- configPath,
45
- // @deprecated use configPath instead
46
- config_path: configPath
47
- });
48
- } catch (e) {
49
- if (e.code !== 'MODULE_NOT_FOUND') {
50
- debug('config module not found %o error: %o', configPath, e.message);
51
- throw Error(_core.APP_ERROR.CONFIG_NOT_VALID);
52
- }
53
- throw e;
54
- }
22
+ debug$1("parse config file %s", configPath);
23
+ if (!require_config_utils.fileExists(configPath)) throw new Error(`config file does not exist or not reachable`);
24
+ debug$1("parsing config file: %o", configPath);
25
+ try {
26
+ if (/\.ya?ml$/i.test(configPath)) {
27
+ const content = node_fs.default.readFileSync(configPath, "utf8");
28
+ const yamlConfig = content.trim() === "" ? {} : (0, js_yaml.load)(content, { schema: js_yaml.YAML11_SCHEMA });
29
+ return Object.assign({}, yamlConfig, {
30
+ configPath,
31
+ config_path: configPath
32
+ });
33
+ }
34
+ _verdaccio_core.warningUtils.emit(_verdaccio_core.warningUtils.Codes.VERDEP004);
35
+ const jsonConfig = ({}.url ? (0, node_module.createRequire)({}.url) : (0, node_module.createRequire)(__filename))(configPath);
36
+ return Object.assign({}, jsonConfig, {
37
+ configPath,
38
+ config_path: configPath
39
+ });
40
+ } catch (e) {
41
+ if (e.code !== "MODULE_NOT_FOUND") {
42
+ debug$1("config module not found %o error: %o", configPath, e.message);
43
+ throw Error(_verdaccio_core.APP_ERROR.CONFIG_NOT_VALID);
44
+ }
45
+ throw e;
46
+ }
55
47
  }
56
48
  function fromJStoYAML(config) {
57
- debug('convert config from JSON to YAML');
58
- if ((0, _lodash.isObject)(config)) {
59
- return _jsYaml.default.dump(config);
60
- } else {
61
- throw new Error(`config is not a valid object`);
62
- }
49
+ debug$1("convert config from JSON to YAML");
50
+ if (lodash.default.isObject(config)) return (0, js_yaml.dump)(config);
51
+ else throw new Error(`config is not a valid object`);
63
52
  }
64
-
65
53
  /**
66
- * Parses and returns a configuration object of type `ConfigYaml`.
67
- *
68
- * If a string or `undefined` is provided, it is interpreted as a path to a config file
69
- * (or uses a default location). The config file is then loaded and parsed.
70
- * If an object is provided, it is assumed to be a pre-parsed configuration.
71
- * Backward compability: ensures the returned configuration object has a `self_path` property set,
72
- * either to the config file path or to a property within the object.
73
- *
74
- * @param {string | ConfigYaml} [config] - Optional. A path to the configuration file (string),
75
- * a pre-parsed config object, or `undefined`.
76
- * @returns {ConfigYaml} The parsed configuration object with a guaranteed `self_path` property.
77
- * @throws {Error} If the provided config is neither a string, undefined, nor an object.
78
- */
54
+ * Parses and returns a configuration object of type `ConfigYaml`.
55
+ *
56
+ * If a string or `undefined` is provided, it is interpreted as a path to a config file
57
+ * (or uses a default location). The config file is then loaded and parsed.
58
+ * If an object is provided, it is assumed to be a pre-parsed configuration.
59
+ * Backward compability: ensures the returned configuration object has a `self_path` property set,
60
+ * either to the config file path or to a property within the object.
61
+ *
62
+ * @param {string | ConfigYaml} [config] - Optional. A path to the configuration file (string),
63
+ * a pre-parsed config object, or `undefined`.
64
+ * @returns {ConfigYaml} The parsed configuration object with a guaranteed `self_path` property.
65
+ * @throws {Error} If the provided config is neither a string, undefined, nor an object.
66
+ */
79
67
  function getConfigParsed(config) {
80
- debug('getConfigParsed called with config: %o', typeof config);
81
- let configurationParsed;
82
- if (config === undefined || typeof config === 'string') {
83
- debug('using default configuration');
84
- const configPathLocation = (0, _configPath.findConfigFile)(config);
85
- configurationParsed = parseConfigFile(configPathLocation);
86
-
87
- // @ts-expect-error
88
- if (!configurationParsed.self_path) {
89
- debug('self_path not defined, using config path location');
90
-
91
- // @ts-expect-error
92
- configurationParsed.self_path = _nodePath.default.resolve(configPathLocation);
93
- }
94
- } else if (typeof config === 'object' && config !== null) {
95
- configurationParsed = config;
96
-
97
- // @ts-expect-error
98
- if (!configurationParsed.self_path) {
99
- debug('self_path not defined, using config path location');
100
-
101
- // @ts-expect-error
102
- configurationParsed.self_path = configurationParsed.configPath;
103
- }
104
- } else {
105
- throw new Error(_core.API_ERROR.CONFIG_BAD_FORMAT);
106
- }
107
- return configurationParsed;
68
+ debug$1("getConfigParsed called with config: %o", typeof config);
69
+ let configurationParsed;
70
+ if (config === void 0 || typeof config === "string") {
71
+ debug$1("using default configuration");
72
+ const configPathLocation = require_config_path.findConfigFile(config);
73
+ configurationParsed = parseConfigFile(configPathLocation);
74
+ if (!configurationParsed.self_path) {
75
+ debug$1("self_path not defined, using config path location");
76
+ configurationParsed.self_path = node_path.default.resolve(configPathLocation);
77
+ }
78
+ } else if (typeof config === "object" && config !== null) {
79
+ configurationParsed = config;
80
+ if (!configurationParsed.self_path) {
81
+ debug$1("self_path not defined, using config path location");
82
+ configurationParsed.self_path = configurationParsed.configPath;
83
+ }
84
+ } else throw new Error(_verdaccio_core.API_ERROR.CONFIG_BAD_FORMAT);
85
+ return configurationParsed;
108
86
  }
87
+ //#endregion
88
+ exports.fromJStoYAML = fromJStoYAML;
89
+ exports.getConfigParsed = getConfigParsed;
90
+ exports.parseConfigFile = parseConfigFile;
91
+
109
92
  //# sourceMappingURL=parse.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse.js","names":["_debug","_interopRequireDefault","require","_jsYaml","_lodash","_nodeFs","_nodePath","_core","_configPath","_configUtils","e","__esModule","default","debug","buildDebug","parseConfigFile","configPath","fileExists","Error","test","yamlConfig","YAML","load","fs","readFileSync","strict","Object","assign","config_path","process","emitWarning","jsonConfig","code","message","APP_ERROR","CONFIG_NOT_VALID","fromJStoYAML","config","isObject","dump","getConfigParsed","configurationParsed","undefined","configPathLocation","findConfigFile","self_path","path","resolve","API_ERROR","CONFIG_BAD_FORMAT"],"sources":["../src/parse.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport YAML from 'js-yaml';\nimport { isObject } from 'lodash';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { API_ERROR, APP_ERROR } from '@verdaccio/core';\nimport type { ConfigYaml } from '@verdaccio/types';\n\nimport { findConfigFile } from './config-path';\nimport { fileExists } from './config-utils';\n\nconst debug = buildDebug('verdaccio:config:parse');\n\n/**\n * Parse a config file from yaml to JSON.\n * @param configPath the absolute path of the configuration file\n */\nexport function parseConfigFile(configPath: string): ConfigYaml & {\n // @deprecated use configPath instead\n config_path: string;\n configPath: string;\n} {\n debug('parse config file %s', configPath);\n if (!fileExists(configPath)) {\n throw new Error(`config file does not exist or not reachable`);\n }\n debug('parsing config file: %o', configPath);\n try {\n if (/\\.ya?ml$/i.test(configPath)) {\n const yamlConfig = YAML.load(fs.readFileSync(configPath, 'utf8'), {\n strict: false,\n }) as ConfigYaml;\n\n return Object.assign({}, yamlConfig, {\n configPath,\n // @deprecated use configPath instead\n config_path: configPath,\n });\n }\n\n process.emitWarning(\n 'Using JavaScript config files is deprecated and will be removed in the next major version. Please migrate to YAML or use the ConfigBuilder.',\n 'DeprecationWarning'\n );\n const jsonConfig = require(configPath) as ConfigYaml;\n return Object.assign({}, jsonConfig, {\n configPath,\n // @deprecated use configPath instead\n config_path: configPath,\n });\n } catch (e: any) {\n if (e.code !== 'MODULE_NOT_FOUND') {\n debug('config module not found %o error: %o', configPath, e.message);\n throw Error(APP_ERROR.CONFIG_NOT_VALID);\n }\n\n throw e;\n }\n}\n\nexport function fromJStoYAML(config: Partial<ConfigYaml>): string | null {\n debug('convert config from JSON to YAML');\n if (isObject(config)) {\n return YAML.dump(config);\n } else {\n throw new Error(`config is not a valid object`);\n }\n}\n\n/**\n * Parses and returns a configuration object of type `ConfigYaml`.\n *\n * If a string or `undefined` is provided, it is interpreted as a path to a config file\n * (or uses a default location). The config file is then loaded and parsed.\n * If an object is provided, it is assumed to be a pre-parsed configuration.\n * Backward compability: ensures the returned configuration object has a `self_path` property set,\n * either to the config file path or to a property within the object.\n *\n * @param {string | ConfigYaml} [config] - Optional. A path to the configuration file (string),\n * a pre-parsed config object, or `undefined`.\n * @returns {ConfigYaml} The parsed configuration object with a guaranteed `self_path` property.\n * @throws {Error} If the provided config is neither a string, undefined, nor an object.\n */\nexport function getConfigParsed(config?: string | ConfigYaml): ConfigYaml {\n debug('getConfigParsed called with config: %o', typeof config);\n let configurationParsed: ConfigYaml;\n if (config === undefined || typeof config === 'string') {\n debug('using default configuration');\n const configPathLocation = findConfigFile(config);\n configurationParsed = parseConfigFile(configPathLocation);\n\n // @ts-expect-error\n if (!configurationParsed.self_path) {\n debug('self_path not defined, using config path location');\n\n // @ts-expect-error\n configurationParsed.self_path = path.resolve(configPathLocation);\n }\n } else if (typeof config === 'object' && config !== null) {\n configurationParsed = config;\n\n // @ts-expect-error\n if (!configurationParsed.self_path) {\n debug('self_path not defined, using config path location');\n\n // @ts-expect-error\n configurationParsed.self_path = configurationParsed.configPath;\n }\n } else {\n throw new Error(API_ERROR.CONFIG_BAD_FORMAT);\n }\n return configurationParsed;\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEA,IAAAK,KAAA,G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E,KAAK,CAAC8B,eAAS,CAACC,iBAAiB,CAAC;EAC9C;EACA,OAAOR,mBAAmB;AAC5B","ignoreList":[]}
1
+ {"version":3,"file":"parse.js","names":[],"sources":["../src/parse.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { YAML11_SCHEMA, dump, load } from 'js-yaml';\nimport _ from 'lodash';\nimport fs from 'node:fs';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\n\nimport { API_ERROR, APP_ERROR, warningUtils } from '@verdaccio/core';\nimport type { ConfigYaml } from '@verdaccio/types';\n\nimport { findConfigFile } from './config-path';\nimport { fileExists } from './config-utils';\n\nconst debug = buildDebug('verdaccio:config:parse');\n\n/**\n * Parse a config file from yaml to JSON.\n * @param configPath the absolute path of the configuration file\n */\nexport function parseConfigFile(configPath: string): ConfigYaml & {\n // @deprecated use configPath instead\n config_path: string;\n configPath: string;\n} {\n debug('parse config file %s', configPath);\n if (!fileExists(configPath)) {\n throw new Error(`config file does not exist or not reachable`);\n }\n debug('parsing config file: %o', configPath);\n try {\n if (/\\.ya?ml$/i.test(configPath)) {\n const content = fs.readFileSync(configPath, 'utf8');\n // js-yaml v5 throws on empty input and defaults to the YAML 1.2 core\n // schema; keep the v4 behavior: an empty config parses as {} and the\n // YAML 1.1 schema preserves yes/no/on/off booleans and merge keys\n const yamlConfig =\n content.trim() === ''\n ? ({} as ConfigYaml)\n : (load(content, { schema: YAML11_SCHEMA }) as ConfigYaml);\n\n return Object.assign({}, yamlConfig, {\n configPath,\n // @deprecated use configPath instead\n config_path: configPath,\n });\n }\n\n warningUtils.emit(warningUtils.Codes.VERDEP004);\n // rolldown rewrites bare `require` to a throwing stub in the ESM output and\n // lowers `import.meta` to `{}` in the CJS output, so `import.meta.url` is\n // only truthy in the ESM build; module-scoped __filename covers the CJS\n // build (checking `typeof __filename`/`typeof require` instead is unsafe:\n // node -e and the REPL leak both as globals into ES modules)\n const requireFile = import.meta.url\n ? createRequire(import.meta.url)\n : createRequire(__filename);\n const jsonConfig = requireFile(configPath) as ConfigYaml;\n return Object.assign({}, jsonConfig, {\n configPath,\n // @deprecated use configPath instead\n config_path: configPath,\n });\n } catch (e: any) {\n if (e.code !== 'MODULE_NOT_FOUND') {\n debug('config module not found %o error: %o', configPath, e.message);\n throw Error(APP_ERROR.CONFIG_NOT_VALID);\n }\n\n throw e;\n }\n}\n\nexport function fromJStoYAML(config: Partial<ConfigYaml>): string | null {\n debug('convert config from JSON to YAML');\n if (_.isObject(config)) {\n return dump(config);\n } else {\n throw new Error(`config is not a valid object`);\n }\n}\n\n/**\n * Parses and returns a configuration object of type `ConfigYaml`.\n *\n * If a string or `undefined` is provided, it is interpreted as a path to a config file\n * (or uses a default location). The config file is then loaded and parsed.\n * If an object is provided, it is assumed to be a pre-parsed configuration.\n * Backward compability: ensures the returned configuration object has a `self_path` property set,\n * either to the config file path or to a property within the object.\n *\n * @param {string | ConfigYaml} [config] - Optional. A path to the configuration file (string),\n * a pre-parsed config object, or `undefined`.\n * @returns {ConfigYaml} The parsed configuration object with a guaranteed `self_path` property.\n * @throws {Error} If the provided config is neither a string, undefined, nor an object.\n */\nexport function getConfigParsed(config?: string | ConfigYaml): ConfigYaml {\n debug('getConfigParsed called with config: %o', typeof config);\n let configurationParsed: ConfigYaml;\n if (config === undefined || typeof config === 'string') {\n debug('using default configuration');\n const configPathLocation = findConfigFile(config);\n configurationParsed = parseConfigFile(configPathLocation);\n\n // @ts-expect-error\n if (!configurationParsed.self_path) {\n debug('self_path not defined, using config path location');\n\n // @ts-expect-error\n configurationParsed.self_path = path.resolve(configPathLocation);\n }\n } else if (typeof config === 'object' && config !== null) {\n configurationParsed = config;\n\n // @ts-expect-error\n if (!configurationParsed.self_path) {\n debug('self_path not defined, using config path location');\n\n // @ts-expect-error\n configurationParsed.self_path = configurationParsed.configPath;\n }\n } else {\n throw new Error(API_ERROR.CONFIG_BAD_FORMAT);\n }\n return configurationParsed;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAaA,IAAM,WAAA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gBAAgB,kBAAkB;EAGxD,IAAI,CAAC,oBAAoB,WAAW;GAClC,QAAM,mDAAmD;GAGzD,oBAAoB,YAAY,UAAA,QAAK,QAAQ,kBAAkB;EACjE;CACF,OAAO,IAAI,OAAO,WAAW,YAAY,WAAW,MAAM;EACxD,sBAAsB;EAGtB,IAAI,CAAC,oBAAoB,WAAW;GAClC,QAAM,mDAAmD;GAGzD,oBAAoB,YAAY,oBAAoB;EACtD;CACF,OACE,MAAM,IAAI,MAAM,gBAAA,UAAU,iBAAiB;CAE7C,OAAO;AACT"}
@@ -0,0 +1,85 @@
1
+ import { fileExists } from "./config-utils.mjs";
2
+ import { findConfigFile } from "./config-path.mjs";
3
+ import buildDebug from "debug";
4
+ import _ from "lodash";
5
+ import { API_ERROR, APP_ERROR, warningUtils } from "@verdaccio/core";
6
+ import fs from "node:fs";
7
+ import path from "node:path";
8
+ import { YAML11_SCHEMA, dump, load } from "js-yaml";
9
+ import { createRequire } from "node:module";
10
+ //#region src/parse.ts
11
+ var debug = buildDebug("verdaccio:config:parse");
12
+ /**
13
+ * Parse a config file from yaml to JSON.
14
+ * @param configPath the absolute path of the configuration file
15
+ */
16
+ function parseConfigFile(configPath) {
17
+ debug("parse config file %s", configPath);
18
+ if (!fileExists(configPath)) throw new Error(`config file does not exist or not reachable`);
19
+ debug("parsing config file: %o", configPath);
20
+ try {
21
+ if (/\.ya?ml$/i.test(configPath)) {
22
+ const content = fs.readFileSync(configPath, "utf8");
23
+ const yamlConfig = content.trim() === "" ? {} : load(content, { schema: YAML11_SCHEMA });
24
+ return Object.assign({}, yamlConfig, {
25
+ configPath,
26
+ config_path: configPath
27
+ });
28
+ }
29
+ warningUtils.emit(warningUtils.Codes.VERDEP004);
30
+ const jsonConfig = (import.meta.url ? createRequire(import.meta.url) : createRequire(__filename))(configPath);
31
+ return Object.assign({}, jsonConfig, {
32
+ configPath,
33
+ config_path: configPath
34
+ });
35
+ } catch (e) {
36
+ if (e.code !== "MODULE_NOT_FOUND") {
37
+ debug("config module not found %o error: %o", configPath, e.message);
38
+ throw Error(APP_ERROR.CONFIG_NOT_VALID);
39
+ }
40
+ throw e;
41
+ }
42
+ }
43
+ function fromJStoYAML(config) {
44
+ debug("convert config from JSON to YAML");
45
+ if (_.isObject(config)) return dump(config);
46
+ else throw new Error(`config is not a valid object`);
47
+ }
48
+ /**
49
+ * Parses and returns a configuration object of type `ConfigYaml`.
50
+ *
51
+ * If a string or `undefined` is provided, it is interpreted as a path to a config file
52
+ * (or uses a default location). The config file is then loaded and parsed.
53
+ * If an object is provided, it is assumed to be a pre-parsed configuration.
54
+ * Backward compability: ensures the returned configuration object has a `self_path` property set,
55
+ * either to the config file path or to a property within the object.
56
+ *
57
+ * @param {string | ConfigYaml} [config] - Optional. A path to the configuration file (string),
58
+ * a pre-parsed config object, or `undefined`.
59
+ * @returns {ConfigYaml} The parsed configuration object with a guaranteed `self_path` property.
60
+ * @throws {Error} If the provided config is neither a string, undefined, nor an object.
61
+ */
62
+ function getConfigParsed(config) {
63
+ debug("getConfigParsed called with config: %o", typeof config);
64
+ let configurationParsed;
65
+ if (config === void 0 || typeof config === "string") {
66
+ debug("using default configuration");
67
+ const configPathLocation = findConfigFile(config);
68
+ configurationParsed = parseConfigFile(configPathLocation);
69
+ if (!configurationParsed.self_path) {
70
+ debug("self_path not defined, using config path location");
71
+ configurationParsed.self_path = path.resolve(configPathLocation);
72
+ }
73
+ } else if (typeof config === "object" && config !== null) {
74
+ configurationParsed = config;
75
+ if (!configurationParsed.self_path) {
76
+ debug("self_path not defined, using config path location");
77
+ configurationParsed.self_path = configurationParsed.configPath;
78
+ }
79
+ } else throw new Error(API_ERROR.CONFIG_BAD_FORMAT);
80
+ return configurationParsed;
81
+ }
82
+ //#endregion
83
+ export { fromJStoYAML, getConfigParsed, parseConfigFile };
84
+
85
+ //# sourceMappingURL=parse.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.mjs","names":[],"sources":["../src/parse.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { YAML11_SCHEMA, dump, load } from 'js-yaml';\nimport _ from 'lodash';\nimport fs from 'node:fs';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\n\nimport { API_ERROR, APP_ERROR, warningUtils } from '@verdaccio/core';\nimport type { ConfigYaml } from '@verdaccio/types';\n\nimport { findConfigFile } from './config-path';\nimport { fileExists } from './config-utils';\n\nconst debug = buildDebug('verdaccio:config:parse');\n\n/**\n * Parse a config file from yaml to JSON.\n * @param configPath the absolute path of the configuration file\n */\nexport function parseConfigFile(configPath: string): ConfigYaml & {\n // @deprecated use configPath instead\n config_path: string;\n configPath: string;\n} {\n debug('parse config file %s', configPath);\n if (!fileExists(configPath)) {\n throw new Error(`config file does not exist or not reachable`);\n }\n debug('parsing config file: %o', configPath);\n try {\n if (/\\.ya?ml$/i.test(configPath)) {\n const content = fs.readFileSync(configPath, 'utf8');\n // js-yaml v5 throws on empty input and defaults to the YAML 1.2 core\n // schema; keep the v4 behavior: an empty config parses as {} and the\n // YAML 1.1 schema preserves yes/no/on/off booleans and merge keys\n const yamlConfig =\n content.trim() === ''\n ? ({} as ConfigYaml)\n : (load(content, { schema: YAML11_SCHEMA }) as ConfigYaml);\n\n return Object.assign({}, yamlConfig, {\n configPath,\n // @deprecated use configPath instead\n config_path: configPath,\n });\n }\n\n warningUtils.emit(warningUtils.Codes.VERDEP004);\n // rolldown rewrites bare `require` to a throwing stub in the ESM output and\n // lowers `import.meta` to `{}` in the CJS output, so `import.meta.url` is\n // only truthy in the ESM build; module-scoped __filename covers the CJS\n // build (checking `typeof __filename`/`typeof require` instead is unsafe:\n // node -e and the REPL leak both as globals into ES modules)\n const requireFile = import.meta.url\n ? createRequire(import.meta.url)\n : createRequire(__filename);\n const jsonConfig = requireFile(configPath) as ConfigYaml;\n return Object.assign({}, jsonConfig, {\n configPath,\n // @deprecated use configPath instead\n config_path: configPath,\n });\n } catch (e: any) {\n if (e.code !== 'MODULE_NOT_FOUND') {\n debug('config module not found %o error: %o', configPath, e.message);\n throw Error(APP_ERROR.CONFIG_NOT_VALID);\n }\n\n throw e;\n }\n}\n\nexport function fromJStoYAML(config: Partial<ConfigYaml>): string | null {\n debug('convert config from JSON to YAML');\n if (_.isObject(config)) {\n return dump(config);\n } else {\n throw new Error(`config is not a valid object`);\n }\n}\n\n/**\n * Parses and returns a configuration object of type `ConfigYaml`.\n *\n * If a string or `undefined` is provided, it is interpreted as a path to a config file\n * (or uses a default location). The config file is then loaded and parsed.\n * If an object is provided, it is assumed to be a pre-parsed configuration.\n * Backward compability: ensures the returned configuration object has a `self_path` property set,\n * either to the config file path or to a property within the object.\n *\n * @param {string | ConfigYaml} [config] - Optional. A path to the configuration file (string),\n * a pre-parsed config object, or `undefined`.\n * @returns {ConfigYaml} The parsed configuration object with a guaranteed `self_path` property.\n * @throws {Error} If the provided config is neither a string, undefined, nor an object.\n */\nexport function getConfigParsed(config?: string | ConfigYaml): ConfigYaml {\n debug('getConfigParsed called with config: %o', typeof config);\n let configurationParsed: ConfigYaml;\n if (config === undefined || typeof config === 'string') {\n debug('using default configuration');\n const configPathLocation = findConfigFile(config);\n configurationParsed = parseConfigFile(configPathLocation);\n\n // @ts-expect-error\n if (!configurationParsed.self_path) {\n debug('self_path not defined, using config path location');\n\n // @ts-expect-error\n configurationParsed.self_path = path.resolve(configPathLocation);\n }\n } else if (typeof config === 'object' && config !== null) {\n configurationParsed = config;\n\n // @ts-expect-error\n if (!configurationParsed.self_path) {\n debug('self_path not defined, using config path location');\n\n // @ts-expect-error\n configurationParsed.self_path = configurationParsed.configPath;\n }\n } else {\n throw new Error(API_ERROR.CONFIG_BAD_FORMAT);\n }\n return configurationParsed;\n}\n"],"mappings":";;;;;;;;;;AAaA,IAAM,QAAQ,WAAW,wBAAwB;;;;;AAMjD,SAAgB,gBAAgB,YAI9B;CACA,MAAM,wBAAwB,UAAU;CACxC,IAAI,CAAC,WAAW,UAAU,GACxB,MAAM,IAAI,MAAM,6CAA6C;CAE/D,MAAM,2B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EACtD;CACF,OACE,MAAM,IAAI,MAAM,UAAU,iBAAiB;CAE7C,OAAO;AACT"}
package/build/security.js CHANGED
@@ -1,24 +1,17 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.defaultSecurity = exports.TIME_EXPIRATION_1H = void 0;
7
- // TODO: get this from core package
8
- const TIME_EXPIRATION_1H = exports.TIME_EXPIRATION_1H = '1h';
9
- const defaultWebTokenOptions = {
10
- sign: {
11
- // The expiration token for the website is 7 days
12
- expiresIn: TIME_EXPIRATION_1H
13
- },
14
- verify: {}
15
- };
16
- const defaultApiTokenConf = {
17
- legacy: true,
18
- migrateToSecureLegacySignature: true
19
- };
20
- const defaultSecurity = exports.defaultSecurity = {
21
- web: defaultWebTokenOptions,
22
- api: defaultApiTokenConf
1
+ //#region src/security.ts
2
+ var TIME_EXPIRATION_1H = "1h";
3
+ var defaultSecurity = {
4
+ web: {
5
+ sign: { expiresIn: "1h" },
6
+ verify: {}
7
+ },
8
+ api: {
9
+ legacy: true,
10
+ migrateToSecureLegacySignature: true
11
+ }
23
12
  };
13
+ //#endregion
14
+ exports.TIME_EXPIRATION_1H = TIME_EXPIRATION_1H;
15
+ exports.defaultSecurity = defaultSecurity;
16
+
24
17
  //# sourceMappingURL=security.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"security.js","names":["TIME_EXPIRATION_1H","exports","defaultWebTokenOptions","sign","expiresIn","verify","defaultApiTokenConf","legacy","migrateToSecureLegacySignature","defaultSecurity","web","api"],"sources":["../src/security.ts"],"sourcesContent":["import type { APITokenOptions, JWTOptions, Security } from '@verdaccio/types';\n\n// TODO: get this from core package\nexport const TIME_EXPIRATION_1H = '1h';\n\nconst defaultWebTokenOptions: JWTOptions = {\n sign: {\n // The expiration token for the website is 7 days\n expiresIn: TIME_EXPIRATION_1H,\n },\n verify: {},\n};\n\nconst defaultApiTokenConf: APITokenOptions = {\n legacy: true,\n migrateToSecureLegacySignature: true,\n};\n\nexport const defaultSecurity: Security = {\n web: defaultWebTokenOptions,\n api: defaultApiTokenConf,\n};\n"],"mappings":";;;;;;AAEA;AACO,MAAMA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,IAAI;AAEtC,MAAME,sBAAkC,GAAG;EACzCC,IAAI,EAAE;IACJ;IACAC,SAAS,EAAEJ;EACb,CAAC;EACDK,MAAM,EAAE,CAAC;AACX,CAAC;AAED,MAAMC,mBAAoC,GAAG;EAC3CC,MAAM,EAAE,IAAI;EACZC,8BAA8B,EAAE;AAClC,CAAC;AAEM,MAAMC,eAAyB,GAAAR,OAAA,CAAAQ,eAAA,GAAG;EACvCC,GAAG,EAAER,sBAAsB;EAC3BS,GAAG,EAAEL;AACP,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"security.js","names":[],"sources":["../src/security.ts"],"sourcesContent":["import type { APITokenOptions, JWTOptions, Security } from '@verdaccio/types';\n\n// TODO: get this from core package\nexport const TIME_EXPIRATION_1H = '1h';\n\nconst defaultWebTokenOptions: JWTOptions = {\n sign: {\n // The expiration token for the website is 7 days\n expiresIn: TIME_EXPIRATION_1H,\n },\n verify: {},\n};\n\nconst defaultApiTokenConf: APITokenOptions = {\n legacy: true,\n migrateToSecureLegacySignature: true,\n};\n\nexport const defaultSecurity: Security = {\n web: defaultWebTokenOptions,\n api: defaultApiTokenConf,\n};\n"],"mappings":";AAGA,IAAa,qBAAqB;AAelC,IAAa,kBAA4B;CACvC,KAAK;EAbL,MAAM,EAEJ,WAAA,KACF;EACA,QAAQ,CAAC;CASJ;CACL,KAAK;EANL,QAAQ;EACR,gCAAgC;CAK3B;AACP"}
@@ -0,0 +1,16 @@
1
+ //#region src/security.ts
2
+ var TIME_EXPIRATION_1H = "1h";
3
+ var defaultSecurity = {
4
+ web: {
5
+ sign: { expiresIn: "1h" },
6
+ verify: {}
7
+ },
8
+ api: {
9
+ legacy: true,
10
+ migrateToSecureLegacySignature: true
11
+ }
12
+ };
13
+ //#endregion
14
+ export { TIME_EXPIRATION_1H, defaultSecurity };
15
+
16
+ //# sourceMappingURL=security.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security.mjs","names":[],"sources":["../src/security.ts"],"sourcesContent":["import type { APITokenOptions, JWTOptions, Security } from '@verdaccio/types';\n\n// TODO: get this from core package\nexport const TIME_EXPIRATION_1H = '1h';\n\nconst defaultWebTokenOptions: JWTOptions = {\n sign: {\n // The expiration token for the website is 7 days\n expiresIn: TIME_EXPIRATION_1H,\n },\n verify: {},\n};\n\nconst defaultApiTokenConf: APITokenOptions = {\n legacy: true,\n migrateToSecureLegacySignature: true,\n};\n\nexport const defaultSecurity: Security = {\n web: defaultWebTokenOptions,\n api: defaultApiTokenConf,\n};\n"],"mappings":";AAGA,IAAa,qBAAqB;AAelC,IAAa,kBAA4B;CACvC,KAAK;EAbL,MAAM,EAEJ,WAAA,KACF;EACA,QAAQ,CAAC;CASJ;CACL,KAAK;EANL,QAAQ;EACR,gCAAgC;CAK3B;AACP"}
@@ -1,17 +1,12 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _default = exports.default = {
8
- // https://www.npmjs.com/package/express-rate-limit
9
- // values are intended to be high, please customize based on own needs
10
- rateLimit: {
11
- windowMs: 1000,
12
- max: 10000
13
- },
14
- // deprecated
15
- keepAliveTimeout: 60
1
+ //#region src/serverSettings.ts
2
+ var serverSettings_default = {
3
+ rateLimit: {
4
+ windowMs: 1e3,
5
+ max: 1e4
6
+ },
7
+ keepAliveTimeout: 60
16
8
  };
9
+ //#endregion
10
+ exports.default = serverSettings_default;
11
+
17
12
  //# sourceMappingURL=serverSettings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"serverSettings.js","names":["rateLimit","windowMs","max","keepAliveTimeout"],"sources":["../src/serverSettings.ts"],"sourcesContent":["export default {\n // https://www.npmjs.com/package/express-rate-limit\n // values are intended to be high, please customize based on own needs\n rateLimit: {\n windowMs: 1000,\n max: 10000,\n },\n // deprecated\n keepAliveTimeout: 60,\n};\n"],"mappings":";;;;;;iCAAe;EACb;EACA;EACAA,SAAS,EAAE;IACTC,QAAQ,EAAE,IAAI;IACdC,GAAG,EAAE;EACP,CAAC;EACD;EACAC,gBAAgB,EAAE;AACpB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"serverSettings.js","names":[],"sources":["../src/serverSettings.ts"],"sourcesContent":["export default {\n // https://www.npmjs.com/package/express-rate-limit\n // values are intended to be high, please customize based on own needs\n rateLimit: {\n windowMs: 1000,\n max: 10000,\n },\n // deprecated\n keepAliveTimeout: 60,\n};\n"],"mappings":";AAAA,IAAA,yBAAe;CAGb,WAAW;EACT,UAAU;EACV,KAAK;CACP;CAEA,kBAAkB;AACpB"}
@@ -0,0 +1,12 @@
1
+ //#region src/serverSettings.ts
2
+ var serverSettings_default = {
3
+ rateLimit: {
4
+ windowMs: 1e3,
5
+ max: 1e4
6
+ },
7
+ keepAliveTimeout: 60
8
+ };
9
+ //#endregion
10
+ export { serverSettings_default as default };
11
+
12
+ //# sourceMappingURL=serverSettings.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serverSettings.mjs","names":[],"sources":["../src/serverSettings.ts"],"sourcesContent":["export default {\n // https://www.npmjs.com/package/express-rate-limit\n // values are intended to be high, please customize based on own needs\n rateLimit: {\n windowMs: 1000,\n max: 10000,\n },\n // deprecated\n keepAliveTimeout: 60,\n};\n"],"mappings":";AAAA,IAAA,yBAAe;CAGb,WAAW;EACT,UAAU;EACV,KAAK;CACP;CAEA,kBAAkB;AACpB"}
package/build/token.js CHANGED
@@ -1,17 +1,14 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.TOKEN_VALID_LENGTH = void 0;
7
- exports.generateRandomSecretKey = generateRandomSecretKey;
8
- var _nodeCrypto = require("node:crypto");
9
- const TOKEN_VALID_LENGTH = exports.TOKEN_VALID_LENGTH = 32;
10
-
1
+ let node_crypto = require("node:crypto");
2
+ //#region src/token.ts
3
+ var TOKEN_VALID_LENGTH = 32;
11
4
  /**
12
- * Secret key must have 32 characters.
13
- */
5
+ * Secret key must have 32 characters.
6
+ */
14
7
  function generateRandomSecretKey() {
15
- return (0, _nodeCrypto.randomBytes)(TOKEN_VALID_LENGTH).toString('base64').substring(0, TOKEN_VALID_LENGTH);
8
+ return (0, node_crypto.randomBytes)(32).toString("base64").substring(0, 32);
16
9
  }
10
+ //#endregion
11
+ exports.TOKEN_VALID_LENGTH = TOKEN_VALID_LENGTH;
12
+ exports.generateRandomSecretKey = generateRandomSecretKey;
13
+
17
14
  //# sourceMappingURL=token.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"token.js","names":["_nodeCrypto","require","TOKEN_VALID_LENGTH","exports","generateRandomSecretKey","randomBytes","toString","substring"],"sources":["../src/token.ts"],"sourcesContent":["import { randomBytes } from 'node:crypto';\n\nexport const TOKEN_VALID_LENGTH = 32;\n\n/**\n * Secret key must have 32 characters.\n */\nexport function generateRandomSecretKey(): string {\n return randomBytes(TOKEN_VALID_LENGTH).toString('base64').substring(0, TOKEN_VALID_LENGTH);\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAEO,MAAMC,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,EAAE;;AAEpC;AACA;AACA;AACO,SAASE,uBAAuBA,CAAA,EAAW;EAChD,OAAO,IAAAC,uBAAW,EAACH,kBAAkB,CAAC,CAACI,QAAQ,CAAC,QAAQ,CAAC,CAACC,SAAS,CAAC,CAAC,EAAEL,kBAAkB,CAAC;AAC5F","ignoreList":[]}
1
+ {"version":3,"file":"token.js","names":[],"sources":["../src/token.ts"],"sourcesContent":["import { randomBytes } from 'node:crypto';\n\nexport const TOKEN_VALID_LENGTH = 32;\n\n/**\n * Secret key must have 32 characters.\n */\nexport function generateRandomSecretKey(): string {\n return randomBytes(TOKEN_VALID_LENGTH).toString('base64').substring(0, TOKEN_VALID_LENGTH);\n}\n"],"mappings":";;AAEA,IAAa,qBAAqB;;;;AAKlC,SAAgB,0BAAkC;CAChD,QAAA,GAAA,YAAA,aAAA,EAAqC,EAAE,SAAS,QAAQ,EAAE,UAAU,GAAA,EAAqB;AAC3F"}
@@ -0,0 +1,13 @@
1
+ import { randomBytes } from "node:crypto";
2
+ //#region src/token.ts
3
+ var TOKEN_VALID_LENGTH = 32;
4
+ /**
5
+ * Secret key must have 32 characters.
6
+ */
7
+ function generateRandomSecretKey() {
8
+ return randomBytes(32).toString("base64").substring(0, 32);
9
+ }
10
+ //#endregion
11
+ export { TOKEN_VALID_LENGTH, generateRandomSecretKey };
12
+
13
+ //# sourceMappingURL=token.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.mjs","names":[],"sources":["../src/token.ts"],"sourcesContent":["import { randomBytes } from 'node:crypto';\n\nexport const TOKEN_VALID_LENGTH = 32;\n\n/**\n * Secret key must have 32 characters.\n */\nexport function generateRandomSecretKey(): string {\n return randomBytes(TOKEN_VALID_LENGTH).toString('base64').substring(0, TOKEN_VALID_LENGTH);\n}\n"],"mappings":";;AAEA,IAAa,qBAAqB;;;;AAKlC,SAAgB,0BAAkC;CAChD,OAAO,YAAA,EAA8B,EAAE,SAAS,QAAQ,EAAE,UAAU,GAAA,EAAqB;AAC3F"}