@verdaccio/loaders 8.0.0-next-8.16 → 8.0.0-next-8.18
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.
|
@@ -51,7 +51,7 @@ function mergeConfig(appConfig, pluginConfig) {
|
|
|
51
51
|
*/
|
|
52
52
|
async function asyncLoadPlugin(pluginConfigs = {}, pluginOptions, sanityCheck, legacyMergeConfigs = false, prefix = _core.PLUGIN_PREFIX, pluginCategory = 'unknown') {
|
|
53
53
|
const logger = pluginOptions?.logger;
|
|
54
|
-
const pluginsIds = Object.keys(pluginConfigs);
|
|
54
|
+
const pluginsIds = Object.keys(pluginConfigs || {});
|
|
55
55
|
const {
|
|
56
56
|
config
|
|
57
57
|
} = pluginOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-async-loader.js","names":["_debug","_interopRequireDefault","require","_lodash","_promises","_nodePath","_core","_utils","e","__esModule","default","debug","buildDebug","isDirectory","pathFolder","stat","lstat","mergeConfig","appConfig","pluginConfig","_","merge","asyncLoadPlugin","pluginConfigs","pluginOptions","sanityCheck","legacyMergeConfigs","prefix","PLUGIN_PREFIX","pluginCategory","logger","pluginsIds","Object","keys","config","plugins","pluginId","isScoped","startsWith","includes","pluginName","pluginsPath","isAbsolute","config_path","configPath","error","resolve","join","dirname","path","pluginDir","externalFilePlugin","plugin","tryLoad","a","b","isValid","executePlugin","content","push","info","err","warn","message","length","originalConfig","isES6"],"sources":["../src/plugin-async-loader.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport _ from 'lodash';\nimport { lstat } from 'node:fs/promises';\nimport { dirname, isAbsolute, join, resolve } from 'node:path';\n\nimport { PLUGIN_PREFIX, pluginUtils } from '@verdaccio/core';\n\nimport { PluginType, isES6, isValid, tryLoad } from './utils';\n\nconst debug = buildDebug('verdaccio:plugin:loader:async');\n\nasync function isDirectory(pathFolder: string) {\n const stat = await lstat(pathFolder);\n return stat.isDirectory();\n}\n\nfunction mergeConfig(appConfig: unknown, pluginConfig: unknown) {\n return _.merge({}, appConfig, pluginConfig);\n}\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 (\"verdaccio-theme-\" prefix for theme ui plugins).\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 {*} pluginOptions a set of options 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 * @param {*} pluginCategory the category of the plugin, eg: auth, storage, middleware\n * @return {Array} list of plugins\n */\nexport async function asyncLoadPlugin<T extends pluginUtils.Plugin<T>>(\n pluginConfigs: any = {},\n pluginOptions: pluginUtils.PluginOptions,\n sanityCheck: (plugin: PluginType<T>) => boolean,\n legacyMergeConfigs: boolean = false,\n prefix: string = PLUGIN_PREFIX,\n pluginCategory: string = 'unknown'\n): Promise<PluginType<T>[]> {\n const logger = pluginOptions?.logger;\n const pluginsIds = Object.keys(pluginConfigs);\n const { config } = pluginOptions;\n let plugins: PluginType<T>[] = [];\n for (let pluginId of pluginsIds) {\n debug('>>> looking for plugin %o', pluginId);\n\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 package name %s', pluginName);\n\n // Try to load the plugin from the config.plugins path\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 logger.debug({ path: pluginsPath }, 'plugins folder defined, loading plugins from @{path} ');\n // throws if is not a directory\n try {\n await isDirectory(pluginsPath);\n const pluginDir = pluginsPath;\n const externalFilePlugin = resolve(pluginDir, pluginName);\n let plugin = tryLoad<T>(externalFilePlugin, (a: any, b: any) => {\n logger.error(a, b);\n });\n debug('external plugin %o', plugin);\n if (plugin && isValid(plugin)) {\n plugin = executePlugin(\n plugin,\n pluginConfigs[pluginId],\n pluginOptions,\n legacyMergeConfigs\n );\n if (!sanityCheck(plugin)) {\n logger.error(\n { content: externalFilePlugin },\n \"@{content} doesn't look like a valid plugin\"\n );\n continue;\n }\n debug('>>> plugin is running and passed sanity check');\n plugins.push(plugin);\n logger.info(\n { pluginName, pluginCategory },\n 'plugin @{pluginName} successfully loaded (@{pluginCategory})'\n );\n continue;\n }\n } catch (err: any) {\n logger.warn(\n { err: err.message, pluginsPath, pluginName },\n '@{err} on loading plugins at @{pluginsPath} for @{pluginName}'\n );\n }\n }\n\n // Try to load the plugin from the node_modules or global based on the `require` native algorithm\n if (typeof pluginId === 'string') {\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], pluginOptions, legacyMergeConfigs);\n if (!sanityCheck(plugin)) {\n logger.error({ pluginName }, \"@{pluginName} doesn't look like a valid plugin\");\n continue;\n }\n debug('>>> plugin is running and passed sanity check');\n plugins.push(plugin);\n logger.info(\n { pluginName, pluginCategory },\n 'plugin @{pluginName} successfully loaded (@{pluginCategory})'\n );\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('%o plugins found: %o', pluginCategory, plugins.length);\n return plugins;\n}\n\nexport function executePlugin<T>(\n plugin: PluginType<T>,\n pluginConfig: unknown,\n pluginOptions: pluginUtils.PluginOptions,\n legacyMergeConfigs: boolean = false\n): PluginType<T> {\n // this is a legacy support for plugins that are not using the new API\n if (legacyMergeConfigs) {\n debug('>>> plugin merge config enabled');\n let originalConfig = pluginOptions.config;\n pluginConfig = mergeConfig(originalConfig, pluginConfig);\n }\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, pluginOptions) as Plugin;\n } else {\n debug('plugin is commonJS');\n // @ts-expect-error improve this type\n return plugin(pluginConfig, pluginOptions) as PluginType<T>;\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAA8D,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9D,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,+BAA+B,CAAC;AAEzD,eAAeC,WAAWA,CAACC,UAAkB,EAAE;EAC7C,MAAMC,IAAI,GAAG,MAAM,IAAAC,eAAK,EAACF,UAAU,CAAC;EACpC,OAAOC,IAAI,CAACF,WAAW,CAAC,CAAC;A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qB,EACrBK,aAAwC,EACxCE,kBAA2B,GAAG,KAAK,EACpB;EACf;EACA,IAAIA,kBAAkB,EAAE;IACtBf,KAAK,CAAC,iCAAiC,CAAC;IACxC,IAAIsD,cAAc,GAAGzC,aAAa,CAACU,MAAM;IACzCf,YAAY,GAAGF,WAAW,CAACgD,cAAc,EAAE9C,YAAY,CAAC;EAC1D;EACA,IAAI,IAAA+C,YAAK,EAACd,MAAM,CAAC,EAAE;IACjBzC,KAAK,CAAC,eAAe,CAAC;IACtB;IACA;IACA,OAAO,IAAIyC,MAAM,CAAC1C,OAAO,CAACS,YAAY,EAAEK,aAAa,CAAC;EACxD,CAAC,MAAM;IACLb,KAAK,CAAC,oBAAoB,CAAC;IAC3B;IACA,OAAOyC,MAAM,CAACjC,YAAY,EAAEK,aAAa,CAAC;EAC5C;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"plugin-async-loader.js","names":["_debug","_interopRequireDefault","require","_lodash","_promises","_nodePath","_core","_utils","e","__esModule","default","debug","buildDebug","isDirectory","pathFolder","stat","lstat","mergeConfig","appConfig","pluginConfig","_","merge","asyncLoadPlugin","pluginConfigs","pluginOptions","sanityCheck","legacyMergeConfigs","prefix","PLUGIN_PREFIX","pluginCategory","logger","pluginsIds","Object","keys","config","plugins","pluginId","isScoped","startsWith","includes","pluginName","pluginsPath","isAbsolute","config_path","configPath","error","resolve","join","dirname","path","pluginDir","externalFilePlugin","plugin","tryLoad","a","b","isValid","executePlugin","content","push","info","err","warn","message","length","originalConfig","isES6"],"sources":["../src/plugin-async-loader.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport _ from 'lodash';\nimport { lstat } from 'node:fs/promises';\nimport { dirname, isAbsolute, join, resolve } from 'node:path';\n\nimport { PLUGIN_PREFIX, pluginUtils } from '@verdaccio/core';\n\nimport { PluginType, isES6, isValid, tryLoad } from './utils';\n\nconst debug = buildDebug('verdaccio:plugin:loader:async');\n\nasync function isDirectory(pathFolder: string) {\n const stat = await lstat(pathFolder);\n return stat.isDirectory();\n}\n\nfunction mergeConfig(appConfig: unknown, pluginConfig: unknown) {\n return _.merge({}, appConfig, pluginConfig);\n}\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 (\"verdaccio-theme-\" prefix for theme ui plugins).\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 {*} pluginOptions a set of options 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 * @param {*} pluginCategory the category of the plugin, eg: auth, storage, middleware\n * @return {Array} list of plugins\n */\nexport async function asyncLoadPlugin<T extends pluginUtils.Plugin<T>>(\n pluginConfigs: any = {},\n pluginOptions: pluginUtils.PluginOptions,\n sanityCheck: (plugin: PluginType<T>) => boolean,\n legacyMergeConfigs: boolean = false,\n prefix: string = PLUGIN_PREFIX,\n pluginCategory: string = 'unknown'\n): Promise<PluginType<T>[]> {\n const logger = pluginOptions?.logger;\n const pluginsIds = Object.keys(pluginConfigs || {});\n const { config } = pluginOptions;\n let plugins: PluginType<T>[] = [];\n for (let pluginId of pluginsIds) {\n debug('>>> looking for plugin %o', pluginId);\n\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 package name %s', pluginName);\n\n // Try to load the plugin from the config.plugins path\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 logger.debug({ path: pluginsPath }, 'plugins folder defined, loading plugins from @{path} ');\n // throws if is not a directory\n try {\n await isDirectory(pluginsPath);\n const pluginDir = pluginsPath;\n const externalFilePlugin = resolve(pluginDir, pluginName);\n let plugin = tryLoad<T>(externalFilePlugin, (a: any, b: any) => {\n logger.error(a, b);\n });\n debug('external plugin %o', plugin);\n if (plugin && isValid(plugin)) {\n plugin = executePlugin(\n plugin,\n pluginConfigs[pluginId],\n pluginOptions,\n legacyMergeConfigs\n );\n if (!sanityCheck(plugin)) {\n logger.error(\n { content: externalFilePlugin },\n \"@{content} doesn't look like a valid plugin\"\n );\n continue;\n }\n debug('>>> plugin is running and passed sanity check');\n plugins.push(plugin);\n logger.info(\n { pluginName, pluginCategory },\n 'plugin @{pluginName} successfully loaded (@{pluginCategory})'\n );\n continue;\n }\n } catch (err: any) {\n logger.warn(\n { err: err.message, pluginsPath, pluginName },\n '@{err} on loading plugins at @{pluginsPath} for @{pluginName}'\n );\n }\n }\n\n // Try to load the plugin from the node_modules or global based on the `require` native algorithm\n if (typeof pluginId === 'string') {\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], pluginOptions, legacyMergeConfigs);\n if (!sanityCheck(plugin)) {\n logger.error({ pluginName }, \"@{pluginName} doesn't look like a valid plugin\");\n continue;\n }\n debug('>>> plugin is running and passed sanity check');\n plugins.push(plugin);\n logger.info(\n { pluginName, pluginCategory },\n 'plugin @{pluginName} successfully loaded (@{pluginCategory})'\n );\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('%o plugins found: %o', pluginCategory, plugins.length);\n return plugins;\n}\n\nexport function executePlugin<T>(\n plugin: PluginType<T>,\n pluginConfig: unknown,\n pluginOptions: pluginUtils.PluginOptions,\n legacyMergeConfigs: boolean = false\n): PluginType<T> {\n // this is a legacy support for plugins that are not using the new API\n if (legacyMergeConfigs) {\n debug('>>> plugin merge config enabled');\n let originalConfig = pluginOptions.config;\n pluginConfig = mergeConfig(originalConfig, pluginConfig);\n }\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, pluginOptions) as Plugin;\n } else {\n debug('plugin is commonJS');\n // @ts-expect-error improve this type\n return plugin(pluginConfig, pluginOptions) as PluginType<T>;\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAA8D,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9D,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,+BAA+B,CAAC;AAEzD,eAAeC,WAAWA,CAACC,UAAkB,EAAE;EAC7C,MAAMC,IAAI,GAAG,MAAM,IAAAC,eAAK,EAACF,UAAU,CAAC;EACpC,OAAOC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;AAEO,SAASsB,aAAaA,CAC3BL,MAAqB,EACrBjC,YAAqB,EACrBK,aAAwC,EACxCE,kBAA2B,GAAG,KAAK,EACpB;EACf;EACA,IAAIA,kBAAkB,EAAE;IACtBf,KAAK,CAAC,iCAAiC,CAAC;IACxC,IAAIsD,cAAc,GAAGzC,aAAa,CAACU,MAAM;IACzCf,YAAY,GAAGF,WAAW,CAACgD,cAAc,EAAE9C,YAAY,CAAC;EAC1D;EACA,IAAI,IAAA+C,YAAK,EAACd,MAAM,CAAC,EAAE;IACjBzC,KAAK,CAAC,eAAe,CAAC;IACtB;IACA;IACA,OAAO,IAAIyC,MAAM,CAAC1C,OAAO,CAACS,YAAY,EAAEK,aAAa,CAAC;EACxD,CAAC,MAAM;IACLb,KAAK,CAAC,oBAAoB,CAAC;IAC3B;IACA,OAAOyC,MAAM,CAACjC,YAAY,EAAEK,aAAa,CAAC;EAC5C;AACF","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/loaders",
|
|
3
|
-
"version": "8.0.0-next-8.
|
|
3
|
+
"version": "8.0.0-next-8.18",
|
|
4
4
|
"description": "Verdaccio Loader Logic",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
"url": "https://github.com/verdaccio/verdaccio/issues"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@verdaccio/core": "8.0.0-next-8.
|
|
20
|
+
"@verdaccio/core": "8.0.0-next-8.28",
|
|
21
21
|
"debug": "4.4.3",
|
|
22
22
|
"lodash": "4.17.21"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@verdaccio/logger": "8.0.0-next-8.
|
|
26
|
-
"@verdaccio/config": "8.0.0-next-8.
|
|
27
|
-
"@verdaccio/core": "8.0.0-next-8.
|
|
25
|
+
"@verdaccio/logger": "8.0.0-next-8.28",
|
|
26
|
+
"@verdaccio/config": "8.0.0-next-8.28",
|
|
27
|
+
"@verdaccio/core": "8.0.0-next-8.28",
|
|
28
28
|
"@verdaccio-scope/verdaccio-auth-foo": "0.0.2",
|
|
29
29
|
"customprefix-auth": "2.0.0",
|
|
30
30
|
"vitest": "3.2.4",
|
|
31
|
-
"verdaccio-auth-memory": "13.0.0-next-8.
|
|
31
|
+
"verdaccio-auth-memory": "13.0.0-next-8.28"
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://verdaccio.org",
|
|
34
34
|
"keywords": [
|