@verdaccio/config 8.0.0-next-8.38 → 8.1.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.
package/README.md CHANGED
@@ -15,6 +15,8 @@
15
15
  [![Docker Pulls](https://img.shields.io/docker/pulls/verdaccio/verdaccio?style=flat&logo=docker&label=Docker%20Pulls&color=lightgrey)](https://hub.docker.com/r/verdaccio/verdaccio)
16
16
  [![GitHub Stars](https://img.shields.io/github/stars/verdaccio?style=flat&logo=github&label=GitHub%20Stars%20%E2%AD%90&color=lightgrey)](https://github.com/verdaccio/verdaccio/stargazers)
17
17
 
18
+ > **Note:** This package is mostly for internal use by Verdaccio and is only intended to be used with Verdaccio 6.x.
19
+
18
20
  ## Overview
19
21
 
20
22
  The `@verdaccio/config` package provides a powerful configuration builder constructor for programmatically creating configuration objects for Verdaccio, a lightweight private npm proxy registry. With this package, users can easily manage various configuration aspects such as package access, uplinks, security settings, authentication, logging, and storage options.
package/build/parse.js CHANGED
@@ -38,6 +38,7 @@ function parseConfigFile(configPath) {
38
38
  config_path: configPath
39
39
  });
40
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');
41
42
  const jsonConfig = require(configPath);
42
43
  return Object.assign({}, jsonConfig, {
43
44
  configPath,
@@ -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","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 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,GAAAL,OAAA;AAGA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAA4C,SAAAD,uBAAAS,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE5C,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,wBAAwB,CAAC;;AAElD;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAACC,UAAkB,EAIhD;EACAH,KAAK,CAAC,sBAAsB,EAAEG,UAAU,CAAC;EACzC,IAAI,CAAC,IAAAC,uBAAU,EAACD,UAAU,CAAC,EAAE;I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,KAAK,CAAC,wCAAwC,EAAE,OAAOsB,MAAM,CAAC;EAC9D,IAAII,mBAA+B;EACnC,IAAIJ,MAAM,KAAKK,SAAS,IAAI,OAAOL,MAAM,KAAK,QAAQ,EAAE;IACtDtB,KAAK,CAAC,6BAA6B,CAAC;IACpC,MAAM4B,kBAAkB,GAAG,IAAAC,0BAAc,EAACP,MAAM,CAAC;IACjDI,mBAAmB,GAAGxB,eAAe,CAAC0B,kBAAkB,CAAC;;IAEzD;IACA,IAAI,CAACF,mBAAmB,CAACI,SAAS,EAAE;MAClC9B,KAAK,CAAC,mDAAmD,CAAC;;MAE1D;MACA0B,mBAAmB,CAACI,SAAS,GAAGC,iBAAI,CAACC,OAAO,CAACJ,kBAAkB,CAAC;IAClE;EACF,CAAC,MAAM,IAAI,OAAON,MAAM,KAAK,QAAQ,IAAIA,MAAM,KAAK,IAAI,EAAE;IACxDI,mBAAmB,GAAGJ,MAAM;;IAE5B;IACA,IAAI,CAACI,mBAAmB,CAACI,SAAS,EAAE;MAClC9B,KAAK,CAAC,mDAAmD,CAAC;;MAE1D;MACA0B,mBAAmB,CAACI,SAAS,GAAGJ,mBAAmB,CAACvB,UAAU;IAChE;EACF,CAAC,MAAM;IACL,MAAM,IAAIE,KAAK,CAAC4B,eAAS,CAACC,iBAAiB,CAAC;EAC9C;EACA,OAAOR,mBAAmB;AAC5B","ignoreList":[]}
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,GAAAL,OAAA;AAGA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAA4C,SAAAD,uBAAAS,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE5C,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,wBAAwB,CAAC;;AAElD;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAACC,UAAkB,EAIhD;EACA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AAInB,KAAK,CAAC,8BAA8B,CAAC;EACjD;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASsB,eAAeA,CAACH,MAA4B,EAAc;EACxExB,KAAK,CAAC,wCAAwC,EAAE,OAAOwB,MAAM,CAAC;EAC9D,IAAII,mBAA+B;EACnC,IAAIJ,MAAM,KAAKK,SAAS,IAAI,OAAOL,MAAM,KAAK,QAAQ,EAAE;IACtDxB,KAAK,CAAC,6BAA6B,CAAC;IACpC,MAAM8B,kBAAkB,GAAG,IAAAC,0BAAc,EAACP,MAAM,CAAC;IACjDI,mBAAmB,GAAG1B,eAAe,CAAC4B,kBAAkB,CAAC;;IAEzD;IACA,IAAI,CAACF,mBAAmB,CAACI,SAAS,EAAE;MAClChC,KAAK,CAAC,mDAAmD,CAAC;;MAE1D;MACA4B,mBAAmB,CAACI,SAAS,GAAGC,iBAAI,CAACC,OAAO,CAACJ,kBAAkB,CAAC;IAClE;EACF,CAAC,MAAM,IAAI,OAAON,MAAM,KAAK,QAAQ,IAAIA,MAAM,KAAK,IAAI,EAAE;IACxDI,mBAAmB,GAAGJ,MAAM;;IAE5B;IACA,IAAI,CAACI,mBAAmB,CAACI,SAAS,EAAE;MAClChC,KAAK,CAAC,mDAAmD,CAAC;;MAE1D;MACA4B,mBAAmB,CAACI,SAAS,GAAGJ,mBAAmB,CAACzB,UAAU;IAChE;EACF,CAAC,MAAM;IACL,MAAM,IAAIE,KAAK,CAAC8B,eAAS,CAACC,iBAAiB,CAAC;EAC9C;EACA,OAAOR,mBAAmB;AAC5B","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/config",
3
- "version": "8.0.0-next-8.38",
3
+ "version": "8.1.0",
4
4
  "description": "Verdaccio Configuration",
5
5
  "main": "./build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -33,14 +33,14 @@
33
33
  "node": ">=18"
34
34
  },
35
35
  "dependencies": {
36
- "@verdaccio/core": "8.0.0-next-8.38",
36
+ "@verdaccio/core": "8.1.0",
37
37
  "debug": "4.4.3",
38
38
  "js-yaml": "4.1.1",
39
39
  "lodash": "4.18.1"
40
40
  },
41
41
  "devDependencies": {
42
- "@verdaccio/types": "13.0.0-next-8.12",
43
- "vitest": "3.2.4"
42
+ "@verdaccio/types": "13.0.0",
43
+ "vitest": "4.1.2"
44
44
  },
45
45
  "funding": {
46
46
  "type": "opencollective",