@verdaccio/loaders 7.0.0-next-7.17 → 7.0.0-next-7.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @verdaccio/loaders
2
2
 
3
+ ## 7.0.0-next-7.19
4
+
5
+ ### Patch Changes
6
+
7
+ - @verdaccio/logger@7.0.0-next-7.19
8
+
9
+ ## 7.0.0-next-7.18
10
+
11
+ ### Patch Changes
12
+
13
+ - @verdaccio/logger@7.0.0-next-7.18
14
+
3
15
  ## 7.0.0-next-7.17
4
16
 
5
17
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_pluginAsyncLoader","require"],"sources":["../src/index.ts"],"sourcesContent":["export { asyncLoadPlugin } from './plugin-async-loader';\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA"}
1
+ {"version":3,"file":"index.js","names":["_pluginAsyncLoader","require"],"sources":["../src/index.ts"],"sourcesContent":["export { asyncLoadPlugin } from './plugin-async-loader';\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA","ignoreList":[]}
@@ -10,7 +10,7 @@ var _fs = _interopRequireDefault(require("fs"));
10
10
  var _path = require("path");
11
11
  var _logger = require("@verdaccio/logger");
12
12
  var _utils = require("./utils");
13
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
14
  const debug = (0, _debug.default)('verdaccio:plugin:loader:async');
15
15
  const {
16
16
  lstat
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-async-loader.js","names":["_debug","_interopRequireDefault","require","_fs","_path","_logger","_utils","obj","__esModule","default","debug","buildDebug","lstat","fs","promises","isDirectory","pathFolder","stat","asyncLoadPlugin","pluginConfigs","params","sanityCheck","prefix","pluginsIds","Object","keys","config","plugins","pluginId","pluginsPath","isAbsolute","config_path","configPath","logger","error","resolve","join","dirname","path","pluginDir","externalFilePlugin","plugin","tryLoad","a","b","isValid","executePlugin","content","push","err","warn","message","isScoped","startsWith","includes","pluginName","length","pluginConfig","isES6"],"sources":["../src/plugin-async-loader.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport fs from 'fs';\nimport { dirname, isAbsolute, join, resolve } from 'path';\n\nimport { pluginUtils } from '@verdaccio/core';\nimport { logger } from '@verdaccio/logger';\nimport { Config, Logger } from '@verdaccio/types';\n\nimport { PluginType, isES6, isValid, tryLoad } from './utils';\n\nconst debug = buildDebug('verdaccio:plugin:loader:async');\n\nconst { lstat } = fs.promises ? fs.promises : require('fs/promises');\n\nasync function isDirectory(pathFolder: string) {\n const stat = await lstat(pathFolder);\n return stat.isDirectory();\n}\n\nexport type Params = { config: Config; logger: Logger };\n\n// type Plugins<T> =\n// | pluginUtils.Auth<T>\n// | pluginUtils.Storage<T>\n// | pluginUtils.ExpressMiddleware<T, unknown, unknown>;\n\n/**\n * The plugin loader find recursively plugins, if one plugin fails is ignored and report the error to the logger.\n *\n * The loader follows the order:\n * - If the at the `config.yaml` file the `plugins: ./plugins` is defined\n * - If is absolute will use the provided path\n * - If is relative, will use the base path of the config file. eg: /root/config.yaml the plugins folder should be\n * hosted at /root/plugins\n * - The next step is find at the node_modules or global based on the `require` native algorithm.\n * - If the package is scoped eg: @scope/foo, try to load the package `@scope/foo`\n * - If the package is not scoped, will use the default prefix: verdaccio-foo.\n * - If a custom prefix is provided, the verdaccio- is replaced by the config.server.pluginPrefix.\n *\n * The `sanityCheck` is the validation for the required methods to load the plugin, if the validation fails the plugin won't be loaded.\n * The `params` is an object that contains the global configuration and the logger.\n *\n * @param {*} pluginConfigs the custom plugin section\n * @param {*} params a set of params to initialize the plugin\n * @param {*} sanityCheck callback that check the shape that should fulfill the plugin\n * @param {*} prefix by default is verdaccio but can be override with config.server.pluginPrefix\n * @return {Array} list of plugins\n */\nexport async function asyncLoadPlugin<T extends pluginUtils.Plugin<T>>(\n pluginConfigs: any = {},\n params: Params,\n sanityCheck: (plugin: PluginType<T>) => boolean,\n prefix: string = 'verdaccio'\n): Promise<PluginType<T>[]> {\n const pluginsIds = Object.keys(pluginConfigs);\n const { config } = params;\n let plugins: PluginType<T>[] = [];\n for (let pluginId of pluginsIds) {\n debug('plugin %s', pluginId);\n if (typeof config.plugins === 'string') {\n let pluginsPath = config.plugins;\n debug('plugin path %s', pluginsPath);\n if (!isAbsolute(pluginsPath)) {\n if (typeof config.config_path === 'string' && !config.configPath) {\n logger.error(\n 'configPath is missing and the legacy config.config_path is not available for loading plugins'\n );\n }\n\n if (!config.configPath) {\n logger.error('config path property is required for loading plugins');\n continue;\n }\n pluginsPath = resolve(join(dirname(config.configPath), pluginsPath));\n }\n\n logger.debug({ path: pluginsPath }, 'plugins folder defined, loading plugins from @{path} ');\n // throws if is nto a directory\n try {\n await isDirectory(pluginsPath);\n const pluginDir = pluginsPath;\n const externalFilePlugin = resolve(pluginDir, `${prefix}-${pluginId}`);\n let plugin = tryLoad<T>(externalFilePlugin, (a: any, b: any) => {\n logger.error(a, b);\n });\n if (plugin && isValid(plugin)) {\n plugin = executePlugin(plugin, pluginConfigs[pluginId], params);\n if (!sanityCheck(plugin)) {\n logger.error(\n { content: externalFilePlugin },\n \"@{content} doesn't look like a valid plugin\"\n );\n continue;\n }\n plugins.push(plugin);\n continue;\n }\n } catch (err: any) {\n logger.warn(\n { err: err.message, pluginsPath, pluginId },\n '@{err} on loading plugins at @{pluginsPath} for @{pluginId}'\n );\n }\n }\n\n if (typeof pluginId === 'string') {\n const isScoped: boolean = pluginId.startsWith('@') && pluginId.includes('/');\n debug('is scoped plugin %s', isScoped);\n const pluginName = isScoped ? pluginId : `${prefix}-${pluginId}`;\n debug('plugin pkg name %s', pluginName);\n let plugin = tryLoad<T>(pluginName, (a: any, b: any) => {\n logger.error(a, b);\n });\n if (plugin && isValid(plugin)) {\n plugin = executePlugin(plugin, pluginConfigs[pluginId], params);\n if (!sanityCheck(plugin)) {\n logger.error({ content: pluginName }, \"@{content} doesn't look like a valid plugin\");\n continue;\n }\n plugins.push(plugin);\n continue;\n } else {\n logger.error(\n { pluginName },\n 'package not found, try to install @{pluginName} with a package manager'\n );\n continue;\n }\n }\n }\n debug('plugin found %s', plugins.length);\n return plugins;\n}\n\nexport function executePlugin<T>(\n plugin: PluginType<T>,\n pluginConfig: unknown,\n params: Params\n): PluginType<T> {\n if (isES6(plugin)) {\n debug('plugin is ES6');\n // @ts-expect-error no relevant for the code\n // eslint-disable-next-line new-cap\n return new plugin.default(pluginConfig, params) as Plugin;\n } else {\n debug('plugin is commonJS');\n // @ts-expect-error improve this type\n return plugin(pluginConfig, params) as PluginType<T>;\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAGA,IAAAG,OAAA,GAAAH,OAAA;AAGA,IAAAI,MAAA,GAAAJ,OAAA;AAA8D,SAAAD,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE9D,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,+BAA+B,CAAC;AAEzD,MAAM;EAAEC;AAAM,CAAC,GAAGC,WAAE,CAACC,QAAQ,GAAGD,WAAE,CAACC,QAAQ,GAAGZ,OAAO,CAAC,aAAa,CAAC;AAEpE,eAAea,WAAWA,CAACC,UAAkB,EAAE;EAC7C,MAAMC,IAAI,GAAG,MAAML,KAAK,CAACI,UAAU,CAAC;EACpC,OAAOC,IAAI,CAACF,WAAW,CAAC,CAAC;AAC3B;AAIA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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AC7BA,MAAM,GAAGK,aAAa,CAACL,MAAM,EAAEtB,aAAa,CAACS,QAAQ,CAAC,EAAER,MAAM,CAAC;QAC/D,IAAI,CAACC,WAAW,CAACoB,MAAM,CAAC,EAAE;UACxBR,cAAM,CAACC,KAAK,CAAC;YAAEa,OAAO,EAAEQ;UAAW,CAAC,EAAE,6CAA6C,CAAC;UACpF;QACF;QACA5B,OAAO,CAACqB,IAAI,CAACP,MAAM,CAAC;QACpB;MACF,CAAC,MAAM;QACLR,cAAM,CAACC,KAAK,CACV;UAAEqB;QAAW,CAAC,EACd,wEACF,CAAC;QACD;MACF;IACF;EACF;EACA7C,KAAK,CAAC,iBAAiB,EAAEiB,OAAO,CAAC6B,MAAM,CAAC;EACxC,OAAO7B,OAAO;AAChB;AAEO,SAASmB,aAAaA,CAC3BL,MAAqB,EACrBgB,YAAqB,EACrBrC,MAAc,EACC;EACf,IAAI,IAAAsC,YAAK,EAACjB,MAAM,CAAC,EAAE;IACjB/B,KAAK,CAAC,eAAe,CAAC;IACtB;IACA;IACA,OAAO,IAAI+B,MAAM,CAAChC,OAAO,CAACgD,YAAY,EAAErC,MAAM,CAAC;EACjD,CAAC,MAAM;IACLV,KAAK,CAAC,oBAAoB,CAAC;IAC3B;IACA,OAAO+B,MAAM,CAACgB,YAAY,EAAErC,MAAM,CAAC;EACrC;AACF"}
1
+ {"version":3,"file":"plugin-async-loader.js","names":["_debug","_interopRequireDefault","require","_fs","_path","_logger","_utils","e","__esModule","default","debug","buildDebug","lstat","fs","promises","isDirectory","pathFolder","stat","asyncLoadPlugin","pluginConfigs","params","sanityCheck","prefix","pluginsIds","Object","keys","config","plugins","pluginId","pluginsPath","isAbsolute","config_path","configPath","logger","error","resolve","join","dirname","path","pluginDir","externalFilePlugin","plugin","tryLoad","a","b","isValid","executePlugin","content","push","err","warn","message","isScoped","startsWith","includes","pluginName","length","pluginConfig","isES6"],"sources":["../src/plugin-async-loader.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport fs from 'fs';\nimport { dirname, isAbsolute, join, resolve } from 'path';\n\nimport { pluginUtils } from '@verdaccio/core';\nimport { logger } from '@verdaccio/logger';\nimport { Config, Logger } from '@verdaccio/types';\n\nimport { PluginType, isES6, isValid, tryLoad } from './utils';\n\nconst debug = buildDebug('verdaccio:plugin:loader:async');\n\nconst { lstat } = fs.promises ? fs.promises : require('fs/promises');\n\nasync function isDirectory(pathFolder: string) {\n const stat = await lstat(pathFolder);\n return stat.isDirectory();\n}\n\nexport type Params = { config: Config; logger: Logger };\n\n// type Plugins<T> =\n// | pluginUtils.Auth<T>\n// | pluginUtils.Storage<T>\n// | pluginUtils.ExpressMiddleware<T, unknown, unknown>;\n\n/**\n * The plugin loader find recursively plugins, if one plugin fails is ignored and report the error to the logger.\n *\n * The loader follows the order:\n * - If the at the `config.yaml` file the `plugins: ./plugins` is defined\n * - If is absolute will use the provided path\n * - If is relative, will use the base path of the config file. eg: /root/config.yaml the plugins folder should be\n * hosted at /root/plugins\n * - The next step is find at the node_modules or global based on the `require` native algorithm.\n * - If the package is scoped eg: @scope/foo, try to load the package `@scope/foo`\n * - If the package is not scoped, will use the default prefix: verdaccio-foo.\n * - If a custom prefix is provided, the verdaccio- is replaced by the config.server.pluginPrefix.\n *\n * The `sanityCheck` is the validation for the required methods to load the plugin, if the validation fails the plugin won't be loaded.\n * The `params` is an object that contains the global configuration and the logger.\n *\n * @param {*} pluginConfigs the custom plugin section\n * @param {*} params a set of params to initialize the plugin\n * @param {*} sanityCheck callback that check the shape that should fulfill the plugin\n * @param {*} prefix by default is verdaccio but can be override with config.server.pluginPrefix\n * @return {Array} list of plugins\n */\nexport async function asyncLoadPlugin<T extends pluginUtils.Plugin<T>>(\n pluginConfigs: any = {},\n params: Params,\n sanityCheck: (plugin: PluginType<T>) => boolean,\n prefix: string = 'verdaccio'\n): Promise<PluginType<T>[]> {\n const pluginsIds = Object.keys(pluginConfigs);\n const { config } = params;\n let plugins: PluginType<T>[] = [];\n for (let pluginId of pluginsIds) {\n debug('plugin %s', pluginId);\n if (typeof config.plugins === 'string') {\n let pluginsPath = config.plugins;\n debug('plugin path %s', pluginsPath);\n if (!isAbsolute(pluginsPath)) {\n if (typeof config.config_path === 'string' && !config.configPath) {\n logger.error(\n 'configPath is missing and the legacy config.config_path is not available for loading plugins'\n );\n }\n\n if (!config.configPath) {\n logger.error('config path property is required for loading plugins');\n continue;\n }\n pluginsPath = resolve(join(dirname(config.configPath), pluginsPath));\n }\n\n logger.debug({ path: pluginsPath }, 'plugins folder defined, loading plugins from @{path} ');\n // throws if is nto a directory\n try {\n await isDirectory(pluginsPath);\n const pluginDir = pluginsPath;\n const externalFilePlugin = resolve(pluginDir, `${prefix}-${pluginId}`);\n let plugin = tryLoad<T>(externalFilePlugin, (a: any, b: any) => {\n logger.error(a, b);\n });\n if (plugin && isValid(plugin)) {\n plugin = executePlugin(plugin, pluginConfigs[pluginId], params);\n if (!sanityCheck(plugin)) {\n logger.error(\n { content: externalFilePlugin },\n \"@{content} doesn't look like a valid plugin\"\n );\n continue;\n }\n plugins.push(plugin);\n continue;\n }\n } catch (err: any) {\n logger.warn(\n { err: err.message, pluginsPath, pluginId },\n '@{err} on loading plugins at @{pluginsPath} for @{pluginId}'\n );\n }\n }\n\n if (typeof pluginId === 'string') {\n const isScoped: boolean = pluginId.startsWith('@') && pluginId.includes('/');\n debug('is scoped plugin %s', isScoped);\n const pluginName = isScoped ? pluginId : `${prefix}-${pluginId}`;\n debug('plugin pkg name %s', pluginName);\n let plugin = tryLoad<T>(pluginName, (a: any, b: any) => {\n logger.error(a, b);\n });\n if (plugin && isValid(plugin)) {\n plugin = executePlugin(plugin, pluginConfigs[pluginId], params);\n if (!sanityCheck(plugin)) {\n logger.error({ content: pluginName }, \"@{content} doesn't look like a valid plugin\");\n continue;\n }\n plugins.push(plugin);\n continue;\n } else {\n logger.error(\n { pluginName },\n 'package not found, try to install @{pluginName} with a package manager'\n );\n continue;\n }\n }\n }\n debug('plugin found %s', plugins.length);\n return plugins;\n}\n\nexport function executePlugin<T>(\n plugin: PluginType<T>,\n pluginConfig: unknown,\n params: Params\n): PluginType<T> {\n if (isES6(plugin)) {\n debug('plugin is ES6');\n // @ts-expect-error no relevant for the code\n // eslint-disable-next-line new-cap\n return new plugin.default(pluginConfig, params) as Plugin;\n } else {\n debug('plugin is commonJS');\n // @ts-expect-error improve this type\n return plugin(pluginConfig, params) as PluginType<T>;\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAGA,IAAAG,OAAA,GAAAH,OAAA;AAGA,IAAAI,MAAA,GAAAJ,OAAA;AAA8D,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9D,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,+BAA+B,CAAC;AAEzD,MAAM;EAAEC;AAAM,CAAC,GAAGC,WAAE,CAACC,QAAQ,GAAGD,WAAE,CAACC,QAAQ,GAAGZ,OAAO,CAAC,aAAa,CAAC;AAEpE,eAAea,WAAWA,CAACC,UAAkB,EAAE;EAC7C,MAAMC,IAAI,GAAG,MAAML,KAAK,CAACI,UAAU,CAAC;EACpC,OAAOC,IAAI,CAACF,WAAW,CAAC,CAAC;AAC3B;AAIA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeG,eAAeA,CACnCC,aAAkB,GAAG,CAAC,CAAC,EACvBC,MAAc,EACdC,WAA+C,EAC/CC,MAAc,GAAG,WAAW,EACF;EAC1B,MAAMC,UAAU,GAAGC,MAAM,CAACC,IAAI,CAACN,aAAa,CAAC;EAC7C,MAAM;IAAEO;EAAO,C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C,EAAE,6CAA6C,CAAC;UACpF;QACF;QACA5B,OAAO,CAACqB,IAAI,CAACP,MAAM,CAAC;QACpB;MACF,CAAC,MAAM;QACLR,cAAM,CAACC,KAAK,CACV;UAAEqB;QAAW,CAAC,EACd,wEACF,CAAC;QACD;MACF;IACF;EACF;EACA7C,KAAK,CAAC,iBAAiB,EAAEiB,OAAO,CAAC6B,MAAM,CAAC;EACxC,OAAO7B,OAAO;AAChB;AAEO,SAASmB,aAAaA,CAC3BL,MAAqB,EACrBgB,YAAqB,EACrBrC,MAAc,EACC;EACf,IAAI,IAAAsC,YAAK,EAACjB,MAAM,CAAC,EAAE;IACjB/B,KAAK,CAAC,eAAe,CAAC;IACtB;IACA;IACA,OAAO,IAAI+B,MAAM,CAAChC,OAAO,CAACgD,YAAY,EAAErC,MAAM,CAAC;EACjD,CAAC,MAAM;IACLV,KAAK,CAAC,oBAAoB,CAAC;IAC3B;IACA,OAAO+B,MAAM,CAACgB,YAAY,EAAErC,MAAM,CAAC;EACrC;AACF","ignoreList":[]}
package/build/utils.js CHANGED
@@ -8,7 +8,7 @@ exports.isValid = isValid;
8
8
  exports.tryLoad = tryLoad;
9
9
  var _debug = _interopRequireDefault(require("debug"));
10
10
  var _lodash = _interopRequireDefault(require("lodash"));
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  const debug = (0, _debug.default)('verdaccio:plugin:loader:utils');
13
13
  const MODULE_NOT_FOUND = 'MODULE_NOT_FOUND';
14
14
  function isValid(plugin) {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["_debug","_interopRequireDefault","require","_lodash","obj","__esModule","default","debug","buildDebug","MODULE_NOT_FOUND","isValid","plugin","_","isFunction","isES6","Object","keys","includes","tryLoad","path","onError","err","code","msg"],"sources":["../src/utils.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport _ from 'lodash';\n\nimport { pluginUtils } from '@verdaccio/core';\n\nconst debug = buildDebug('verdaccio:plugin:loader:utils');\nconst MODULE_NOT_FOUND = 'MODULE_NOT_FOUND';\n\nexport type PluginType<T> = T extends pluginUtils.Plugin<T> ? T : never;\n\nexport function isValid<T>(plugin: PluginType<T>): boolean {\n // @ts-expect-error default not relevant\n return _.isFunction(plugin) || _.isFunction(plugin.default);\n}\n\nexport function isES6<T>(plugin: PluginType<T>): boolean {\n return Object.keys(plugin).includes('default');\n}\n\n/**\n * Requires a module.\n * @param {*} path the module's path\n * @return {Object}\n */\nexport function tryLoad<T>(path: string, onError: any): PluginType<T> | null {\n try {\n debug('loading plugin %s', path);\n return require(path) as PluginType<T>;\n } catch (err: any) {\n if (err.code === MODULE_NOT_FOUND) {\n debug('plugin %s not found', path);\n return null;\n }\n onError({ err: err.msg }, 'error loading plugin @{err}');\n throw err;\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAuB,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAIvB,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,+BAA+B,CAAC;AACzD,MAAMC,gBAAgB,GAAG,kBAAkB;AAIpC,SAASC,OAAOA,CAAIC,MAAqB,EAAW;EACzD;EACA,OAAOC,eAAC,CAACC,UAAU,CAACF,MAAM,CAAC,IAAIC,eAAC,CAACC,UAAU,CAACF,MAAM,CAACL,OAAO,CAAC;AAC7D;AAEO,SAASQ,KAAKA,CAAIH,MAAqB,EAAW;EACvD,OAAOI,MAAM,CAACC,IAAI,CAACL,MAAM,CAAC,CAACM,QAAQ,CAAC,SAAS,CAAC;AAChD;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,OAAOA,CAAIC,IAAY,EAAEC,OAAY,EAAwB;EAC3E,IAAI;IACFb,KAAK,CAAC,mBAAmB,EAAEY,IAAI,CAAC;IAChC,OAAOjB,OAAO,CAACiB,IAAI,CAAC;EACtB,CAAC,CAAC,OAAOE,GAAQ,EAAE;IACjB,IAAIA,GAAG,CAACC,IAAI,KAAKb,gBAAgB,EAAE;MACjCF,KAAK,CAAC,qBAAqB,EAAEY,IAAI,CAAC;MAClC,OAAO,IAAI;IACb;IACAC,OAAO,CAAC;MAAEC,GAAG,EAAEA,GAAG,CAACE;IAAI,CAAC,EAAE,6BAA6B,CAAC;IACxD,MAAMF,GAAG;EACX;AACF"}
1
+ {"version":3,"file":"utils.js","names":["_debug","_interopRequireDefault","require","_lodash","e","__esModule","default","debug","buildDebug","MODULE_NOT_FOUND","isValid","plugin","_","isFunction","isES6","Object","keys","includes","tryLoad","path","onError","err","code","msg"],"sources":["../src/utils.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport _ from 'lodash';\n\nimport { pluginUtils } from '@verdaccio/core';\n\nconst debug = buildDebug('verdaccio:plugin:loader:utils');\nconst MODULE_NOT_FOUND = 'MODULE_NOT_FOUND';\n\nexport type PluginType<T> = T extends pluginUtils.Plugin<T> ? T : never;\n\nexport function isValid<T>(plugin: PluginType<T>): boolean {\n // @ts-expect-error default not relevant\n return _.isFunction(plugin) || _.isFunction(plugin.default);\n}\n\nexport function isES6<T>(plugin: PluginType<T>): boolean {\n return Object.keys(plugin).includes('default');\n}\n\n/**\n * Requires a module.\n * @param {*} path the module's path\n * @return {Object}\n */\nexport function tryLoad<T>(path: string, onError: any): PluginType<T> | null {\n try {\n debug('loading plugin %s', path);\n return require(path) as PluginType<T>;\n } catch (err: any) {\n if (err.code === MODULE_NOT_FOUND) {\n debug('plugin %s not found', path);\n return null;\n }\n onError({ err: err.msg }, 'error loading plugin @{err}');\n throw err;\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAuB,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAIvB,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,+BAA+B,CAAC;AACzD,MAAMC,gBAAgB,GAAG,kBAAkB;AAIpC,SAASC,OAAOA,CAAIC,MAAqB,EAAW;EACzD;EACA,OAAOC,eAAC,CAACC,UAAU,CAACF,MAAM,CAAC,IAAIC,eAAC,CAACC,UAAU,CAACF,MAAM,CAACL,OAAO,CAAC;AAC7D;AAEO,SAASQ,KAAKA,CAAIH,MAAqB,EAAW;EACvD,OAAOI,MAAM,CAACC,IAAI,CAACL,MAAM,CAAC,CAACM,QAAQ,CAAC,SAAS,CAAC;AAChD;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,OAAOA,CAAIC,IAAY,EAAEC,OAAY,EAAwB;EAC3E,IAAI;IACFb,KAAK,CAAC,mBAAmB,EAAEY,IAAI,CAAC;IAChC,OAAOjB,OAAO,CAACiB,IAAI,CAAC;EACtB,CAAC,CAAC,OAAOE,GAAQ,EAAE;IACjB,IAAIA,GAAG,CAACC,IAAI,KAAKb,gBAAgB,EAAE;MACjCF,KAAK,CAAC,qBAAqB,EAAEY,IAAI,CAAC;MAClC,OAAO,IAAI;IACb;IACAC,OAAO,CAAC;MAAEC,GAAG,EAAEA,GAAG,CAACE;IAAI,CAAC,EAAE,6BAA6B,CAAC;IACxD,MAAMF,GAAG;EACX;AACF","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/loaders",
3
- "version": "7.0.0-next-7.17",
3
+ "version": "7.0.0-next-7.19",
4
4
  "description": "loaders logic",
5
5
  "main": "./build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -13,17 +13,17 @@
13
13
  "url": "https://github.com/verdaccio/verdaccio"
14
14
  },
15
15
  "dependencies": {
16
- "@verdaccio/logger": "7.0.0-next-7.17",
16
+ "@verdaccio/logger": "7.0.0-next-7.19",
17
17
  "debug": "4.3.4",
18
18
  "lodash": "4.17.21"
19
19
  },
20
20
  "devDependencies": {
21
- "@verdaccio/core": "7.0.0-next-7.17",
22
- "@verdaccio/config": "7.0.0-next-7.17",
23
- "@verdaccio/types": "12.0.0-next-7.4",
21
+ "@verdaccio/core": "7.0.0-next-7.19",
22
+ "@verdaccio/config": "7.0.0-next-7.19",
23
+ "@verdaccio/types": "12.0.0-next-7.5",
24
24
  "@verdaccio-scope/verdaccio-auth-foo": "0.0.2",
25
25
  "customprefix-auth": "2.0.0-next.0",
26
- "verdaccio-auth-memory": "12.0.0-next-7.17"
26
+ "verdaccio-auth-memory": "12.0.0-next-7.19"
27
27
  },
28
28
  "homepage": "https://verdaccio.org",
29
29
  "keywords": [