@verdaccio/loaders 6.0.0-6-next.10 → 6.0.0-6-next.13

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,50 @@
1
1
  # @verdaccio/loaders
2
2
 
3
+ ## 6.0.0-6-next.13
4
+
5
+ ### Major Changes
6
+
7
+ - 292c0a37: feat!: replace deprecated request dependency by got
8
+
9
+ This is a big refactoring of the core, fetching dependencies, improve code, more tests and better stability. This is essential for the next release, will take some time but would allow modularize more the core.
10
+
11
+ ## Notes
12
+
13
+ - Remove deprecated `request` by other `got`, retry improved, custom Agent ( got does not include it built-in)
14
+ - Remove `async` dependency from storage (used by core) it was linked with proxy somehow safe to remove now
15
+ - Refactor with promises instead callback wherever is possible
16
+ - ~Document the API~
17
+ - Improve testing, integration tests
18
+ - Bugfix
19
+ - Clean up old validations
20
+ - Improve performance
21
+
22
+ ## 💥 Breaking changes
23
+
24
+ - Plugin API methods were callbacks based are returning promises, this will break current storage plugins, check documentation for upgrade.
25
+ - Write Tarball, Read Tarball methods parameters change, a new set of options like `AbortController` signals are being provided to the `addAbortSignal` can be internally used with Streams when a request is aborted. eg: `addAbortSignal(signal, fs.createReadStream(pathName));`
26
+ - `@verdaccio/streams` stream abort support is legacy is being deprecated removed
27
+ - Remove AWS and Google Cloud packages for future refactoring [#2574](https://github.com/verdaccio/verdaccio/pull/2574).
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies [292c0a37]
32
+ - Updated dependencies [a3a209b5]
33
+ - @verdaccio/logger@6.0.0-6-next.12
34
+
35
+ ## 6.0.0-6-next.12
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies [82cb0f2b]
40
+ - @verdaccio/logger@6.0.0-6-next.11
41
+
42
+ ## 6.0.0-6-next.11
43
+
44
+ ### Patch Changes
45
+
46
+ - 31d661c7: always create plugin instance with new
47
+
3
48
  ## 6.0.0-6-next.10
4
49
 
5
50
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './plugin-loader';\n"],"file":"index.js"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from './plugin-loader';\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -104,8 +104,10 @@ function loadPlugin(config, pluginConfigs = {}, params, sanityCheck, prefix = 'v
104
104
  } // relative to config path
105
105
 
106
106
 
107
- if (plugin === null && pluginId.match(/^\.\.?($|\/)/)) {
108
- plugin = tryLoad(_path.default.resolve(_path.default.dirname(config.config_path), pluginId));
107
+ debug('config path: %s', config.configPath);
108
+
109
+ if (plugin === null && pluginId.match(/^\.\.?($|\/)/) && config.configPath) {
110
+ plugin = tryLoad(_path.default.resolve(_path.default.dirname(config.configPath), pluginId));
109
111
  }
110
112
 
111
113
  if (plugin === null) {
@@ -129,7 +131,7 @@ function loadPlugin(config, pluginConfigs = {}, params, sanityCheck, prefix = 'v
129
131
 
130
132
 
131
133
  try {
132
- plugin = isES6(plugin) ? new plugin.default(mergeConfig(config, pluginConfigs[pluginId]), params) : plugin(pluginConfigs[pluginId], params);
134
+ plugin = isES6(plugin) ? new plugin.default(mergeConfig(config, pluginConfigs[pluginId]), params) : new plugin(pluginConfigs[pluginId], params);
133
135
  } catch (error) {
134
136
  plugin = null;
135
137
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin-loader.ts"],"names":["debug","MODULE_NOT_FOUND","tryLoad","path","require","err","code","mergeConfig","appConfig","pluginConfig","_","merge","isValid","plugin","isFunction","default","isES6","Object","keys","includes","loadPlugin","config","pluginConfigs","params","sanityCheck","prefix","map","pluginId","localPlugin","Path","resolve","__dirname","plugins","pluginDir","externalFilePlugin","match","dirname","config_path","logger","error","content","Error"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;AAEA;;;;AAGA,MAAMA,KAAK,GAAG,oBAAW,yBAAX,CAAd;AAEO,MAAMC,gBAAgB,GAAG,kBAAzB;AAEP;AACA;AACA;AACA;AACA;;;;AACA,SAASC,OAAT,CAAiBC,IAAjB,EAAoC;AAClC,MAAI;AACF,WAAOC,OAAO,CAACD,IAAD,CAAd;AACD,GAFD,CAEE,OAAOE,GAAP,EAAiB;AACjB,QAAIA,GAAG,CAACC,IAAJ,KAAaL,gBAAjB,EAAmC;AACjC,aAAO,IAAP;AACD;;AACD,UAAMI,GAAN;AACD;AACF;;AAED,SAASE,WAAT,CAAqBC,SAArB,EAAgCC,YAAhC,EAAsD;AACpD,SAAOC,gBAAEC,KAAF,CAAQH,SAAR,EAAmBC,YAAnB,CAAP;AACD;;AAED,SAASG,OAAT,CAAiBC,MAAjB,EAAkC;AAChC,SAAOH,gBAAEI,UAAF,CAAaD,MAAb,KAAwBH,gBAAEI,UAAF,CAAaD,MAAM,CAACE,OAApB,CAA/B;AACD;;AAED,SAASC,KAAT,CAAeH,MAAf,EAAgC;AAC9B,SAAOI,MAAM,CAACC,IAAP,CAAYL,MAAZ,EAAoBM,QAApB,CAA6B,SAA7B,CAAP;AACD,C,CAED;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,UAAT,CACLC,MADK,EAELC,aAAkB,GAAG,EAFhB,EAGLC,MAHK,EAILC,WAJK,EAKLC,MAAc,GAAG,WALZ,EAME;AACP,SAAOR,MAAM,CAACC,IAAP,CAAYI,aAAZ,EAA2BI,GAA3B,CAAgCC,QAAD,IAAkC;AACtE,QAAId,MAAJ;;AAEA,UAAMe,WAAW,GAAGC,cAAKC,OAAL,CAAaC,SAAS,GAAG,aAAzB,EAAwCJ,QAAxC,CAApB,CAHsE,CAItE;;;AACAd,IAAAA,MAAM,GAAGX,OAAO,CAAC0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,EAAgDF,MAAhD,CAAL;AACA,WAAOZ,MAAP;AACD,GA/EM,CAAP;AAgFD","sourcesContent":["import buildDebug from 'debug';\nimport _ from 'lodash';\nimport Path from 'path';\n\nimport { logger } from '@verdaccio/logger';\nimport { Config, IPlugin } from '@verdaccio/types';\n\nconst debug = buildDebug('verdaccio:plugin:loader');\n\nexport const MODULE_NOT_FOUND = 'MODULE_NOT_FOUND';\n\n/**\n * Requires a module.\n * @param {*} path the module's path\n * @return {Object}\n */\nfunction tryLoad(path: string): any {\n try {\n return require(path);\n } catch (err: any) {\n if (err.code === MODULE_NOT_FOUND) {\n return null;\n }\n throw err;\n }\n}\n\nfunction mergeConfig(appConfig, pluginConfig): Config {\n return _.merge(appConfig, pluginConfig);\n}\n\nfunction isValid(plugin): boolean {\n return _.isFunction(plugin) || _.isFunction(plugin.default);\n}\n\nfunction isES6(plugin): boolean {\n return Object.keys(plugin).includes('default');\n}\n\n// export type PluginGeneric<R, T extends IPlugin<R> = ;\n\n/**\n * Load a plugin following the rules\n * - First try to load from the internal directory plugins (which will disappear soon or later).\n * - A second attempt from the external plugin directory\n * - A third attempt from node_modules, in case to have multiple match as for instance\n * verdaccio-ldap\n * and sinopia-ldap. All verdaccio prefix will have preferences.\n * @param {*} config a reference of the configuration settings\n * @param {*} pluginConfigs\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 * @return {Array} list of plugins\n */\nexport function loadPlugin<T extends IPlugin<T>>(\n config: Config,\n pluginConfigs: any = {},\n params: any,\n sanityCheck: any,\n prefix: string = 'verdaccio'\n): any[] {\n return Object.keys(pluginConfigs).map((pluginId: string): IPlugin<T> => {\n let plugin;\n\n const localPlugin = Path.resolve(__dirname + '/../plugins', pluginId);\n // try local plugins first\n plugin = tryLoad(localPlugin);\n\n // try the external plugin directory\n if (plugin === null && config.plugins) {\n const pluginDir = config.plugins;\n const externalFilePlugin = Path.resolve(pluginDir, pluginId);\n plugin = tryLoad(externalFilePlugin);\n\n // npm package\n if (plugin === null && pluginId.match(/^[^\\.\\/]/)) {\n plugin = tryLoad(Path.resolve(pluginDir, `${prefix}-${pluginId}`));\n // compatibility for old sinopia plugins\n if (!plugin) {\n plugin = tryLoad(Path.resolve(pluginDir, `sinopia-${pluginId}`));\n }\n }\n }\n\n // npm package\n if (plugin === null && pluginId.match(/^[^\\.\\/]/)) {\n plugin = tryLoad(`${prefix}-${pluginId}`);\n // compatibility for old sinopia plugins\n if (!plugin) {\n plugin = tryLoad(`sinopia-${pluginId}`);\n }\n }\n\n if (plugin === null) {\n plugin = tryLoad(pluginId);\n }\n\n // relative to config path\n if (plugin === null && pluginId.match(/^\\.\\.?($|\\/)/)) {\n plugin = tryLoad(Path.resolve(Path.dirname(config.config_path), pluginId));\n }\n\n if (plugin === null) {\n logger.error(\n { content: pluginId, prefix },\n 'plugin not found. try npm install @{prefix}-@{content}'\n );\n throw Error(`\n ${prefix}-${pluginId} plugin not found. try \"npm install ${prefix}-${pluginId}\"`);\n }\n\n if (!isValid(plugin)) {\n logger.error(\n { content: pluginId },\n '@{prefix}-@{content} plugin does not have the right code structure'\n );\n throw Error(`\"${pluginId}\" plugin does not have the right code structure`);\n }\n\n /* eslint new-cap:off */\n try {\n plugin = isES6(plugin)\n ? new plugin.default(mergeConfig(config, pluginConfigs[pluginId]), params)\n : plugin(pluginConfigs[pluginId], params);\n } catch (error: any) {\n plugin = null;\n logger.error({ error, pluginId }, 'error loading a plugin @{pluginId}: @{error}');\n }\n /* eslint new-cap:off */\n\n if (plugin === null || !sanityCheck(plugin)) {\n logger.error(\n { content: pluginId, prefix },\n \"@{prefix}-@{content} doesn't look like a valid plugin\"\n );\n throw Error(`sanity check has failed, \"${pluginId}\" is not a valid plugin`);\n }\n\n debug('Plugin successfully loaded: %o-%o', pluginId, prefix);\n return plugin;\n });\n}\n"],"file":"plugin-loader.js"}
1
+ {"version":3,"file":"plugin-loader.js","names":["debug","buildDebug","MODULE_NOT_FOUND","tryLoad","path","require","err","code","mergeConfig","appConfig","pluginConfig","_","merge","isValid","plugin","isFunction","default","isES6","Object","keys","includes","loadPlugin","config","pluginConfigs","params","sanityCheck","prefix","map","pluginId","localPlugin","Path","resolve","__dirname","plugins","pluginDir","externalFilePlugin","match","configPath","dirname","logger","error","content","Error"],"sources":["../src/plugin-loader.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport _ from 'lodash';\nimport Path from 'path';\n\nimport { logger } from '@verdaccio/logger';\nimport { Config, IPlugin } from '@verdaccio/types';\n\nconst debug = buildDebug('verdaccio:plugin:loader');\n\nexport const MODULE_NOT_FOUND = 'MODULE_NOT_FOUND';\n\n/**\n * Requires a module.\n * @param {*} path the module's path\n * @return {Object}\n */\nfunction tryLoad(path: string): any {\n try {\n return require(path);\n } catch (err: any) {\n if (err.code === MODULE_NOT_FOUND) {\n return null;\n }\n throw err;\n }\n}\n\nfunction mergeConfig(appConfig, pluginConfig): Config {\n return _.merge(appConfig, pluginConfig);\n}\n\nfunction isValid(plugin): boolean {\n return _.isFunction(plugin) || _.isFunction(plugin.default);\n}\n\nfunction isES6(plugin): boolean {\n return Object.keys(plugin).includes('default');\n}\n\n// export type PluginGeneric<R, T extends IPlugin<R> = ;\n\n/**\n * Load a plugin following the rules\n * - First try to load from the internal directory plugins (which will disappear soon or later).\n * - A second attempt from the external plugin directory\n * - A third attempt from node_modules, in case to have multiple match as for instance\n * verdaccio-ldap\n * and sinopia-ldap. All verdaccio prefix will have preferences.\n * @param {*} config a reference of the configuration settings\n * @param {*} pluginConfigs\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 * @return {Array} list of plugins\n */\nexport function loadPlugin<T extends IPlugin<T>>(\n config: Config,\n pluginConfigs: any = {},\n params: any,\n sanityCheck: any,\n prefix: string = 'verdaccio'\n): any[] {\n return Object.keys(pluginConfigs).map((pluginId: string): IPlugin<T> => {\n let plugin;\n\n const localPlugin = Path.resolve(__dirname + '/../plugins', pluginId);\n // try local plugins first\n plugin = tryLoad(localPlugin);\n\n // try the external plugin directory\n if (plugin === null && config.plugins) {\n const pluginDir = config.plugins;\n const externalFilePlugin = Path.resolve(pluginDir, pluginId);\n plugin = tryLoad(externalFilePlugin);\n\n // npm package\n if (plugin === null && pluginId.match(/^[^\\.\\/]/)) {\n plugin = tryLoad(Path.resolve(pluginDir, `${prefix}-${pluginId}`));\n // compatibility for old sinopia plugins\n if (!plugin) {\n plugin = tryLoad(Path.resolve(pluginDir, `sinopia-${pluginId}`));\n }\n }\n }\n\n // npm package\n if (plugin === null && pluginId.match(/^[^\\.\\/]/)) {\n plugin = tryLoad(`${prefix}-${pluginId}`);\n // compatibility for old sinopia plugins\n if (!plugin) {\n plugin = tryLoad(`sinopia-${pluginId}`);\n }\n }\n\n if (plugin === null) {\n plugin = tryLoad(pluginId);\n }\n\n // relative to config path\n debug('config path: %s', config.configPath);\n if (plugin === null && pluginId.match(/^\\.\\.?($|\\/)/) && config.configPath) {\n plugin = tryLoad(Path.resolve(Path.dirname(config.configPath), pluginId));\n }\n\n if (plugin === null) {\n logger.error(\n { content: pluginId, prefix },\n 'plugin not found. try npm install @{prefix}-@{content}'\n );\n throw Error(`\n ${prefix}-${pluginId} plugin not found. try \"npm install ${prefix}-${pluginId}\"`);\n }\n\n if (!isValid(plugin)) {\n logger.error(\n { content: pluginId },\n '@{prefix}-@{content} plugin does not have the right code structure'\n );\n throw Error(`\"${pluginId}\" plugin does not have the right code structure`);\n }\n\n /* eslint new-cap:off */\n try {\n plugin = isES6(plugin)\n ? new plugin.default(mergeConfig(config, pluginConfigs[pluginId]), params)\n : new plugin(pluginConfigs[pluginId], params);\n } catch (error: any) {\n plugin = null;\n logger.error({ error, pluginId }, 'error loading a plugin @{pluginId}: @{error}');\n }\n /* eslint new-cap:off */\n\n if (plugin === null || !sanityCheck(plugin)) {\n logger.error(\n { content: pluginId, prefix },\n \"@{prefix}-@{content} doesn't look like a valid plugin\"\n );\n throw Error(`sanity check has failed, \"${pluginId}\" is not a valid plugin`);\n }\n\n debug('Plugin successfully loaded: %o-%o', pluginId, prefix);\n return plugin;\n });\n}\n"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;AAEA;;;;AAGA,MAAMA,KAAK,GAAG,IAAAC,cAAA,EAAW,yBAAX,CAAd;AAEO,MAAMC,gBAAgB,GAAG,kBAAzB;AAEP;AACA;AACA;AACA;AACA;;;;AACA,SAASC,OAAT,CAAiBC,IAAjB,EAAoC;EAClC,IAAI;IACF,OAAOC,OAAO,CAACD,IAAD,CAAd;EACD,CAFD,CAEE,OAAOE,GAAP,EAAiB;IACjB,IAAIA,GAAG,CAACC,IAAJ,KAAaL,gBAAjB,EAAmC;MACjC,OAAO,IAAP;IACD;;IACD,MAAMI,GAAN;EACD;AACF;;AAED,SAASE,WAAT,CAAqBC,SAArB,EAAgCC,YAAhC,EAAsD;EACpD,OAAOC,eAAA,CAAEC,KAAF,CAAQH,SAAR,EAAmBC,YAAnB,CAAP;AACD;;AAED,SAASG,OAAT,CAAiBC,MAAjB,EAAkC;EAChC,OAAOH,eAAA,CAAEI,UAAF,CAAaD,MAAb,KAAwBH,eAAA,CAAEI,UAAF,CAAaD,MAAM,CAACE,OAApB,CAA/B;AACD;;AAED,SAASC,KAAT,CAAeH,MAAf,EAAgC;EAC9B,OAAOI,MAAM,CAACC,IAAP,CAAYL,MAAZ,EAAoBM,QAApB,CAA6B,SAA7B,CAAP;AACD,C,CAED;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,UAAT,CACLC,MADK,EAELC,aAAkB,GAAG,EAFhB,EAGLC,MAHK,EAILC,WAJK,EAKLC,MAAc,GAAG,WALZ,EAME;EACP,OAAOR,MAAM,CAACC,IAAP,CAAYI,aAAZ,EAA2BI,GAA3B,CAAgCC,QAAD,IAAkC;IACtE,IAAId,MAAJ;;IAEA,MAAMe,WAAW,GAAGC,aAAA,CAAKC,OAAL,CAAaC,SAAS,GA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AFF;;MAIA,MAAMgB,KAAK,CAAE,6BAA4Bd,QAAS,yBAAvC,CAAX;IACD;;IAED5B,KAAK,CAAC,mCAAD,EAAsC4B,QAAtC,EAAgDF,MAAhD,CAAL;IACA,OAAOZ,MAAP;EACD,CAhFM,CAAP;AAiFD"}
package/jest.config.js CHANGED
@@ -1,3 +1,10 @@
1
1
  const config = require('../../jest/config');
2
2
 
3
- module.exports = Object.assign({}, config, {});
3
+ module.exports = Object.assign({}, config, {
4
+ coverageThreshold: {
5
+ global: {
6
+ // FIXME: increase to 90
7
+ lines: 68,
8
+ },
9
+ },
10
+ });
package/package.json CHANGED
@@ -1,56 +1,56 @@
1
1
  {
2
- "name": "@verdaccio/loaders",
3
- "version": "6.0.0-6-next.10",
4
- "description": "loaders logic",
5
- "main": "./build/index.js",
6
- "types": "build/index.d.ts",
7
- "author": {
8
- "name": "Juan Picado",
9
- "email": "juanpicado19@gmail.com"
10
- },
11
- "repository": {
12
- "type": "https",
13
- "url": "https://github.com/verdaccio/verdaccio"
14
- },
15
- "dependencies": {
16
- "@verdaccio/logger": "6.0.0-6-next.10",
17
- "debug": "4.3.3",
18
- "lodash": "4.17.21"
19
- },
20
- "devDependencies": {
21
- "@verdaccio/core": "6.0.0-6-next.4",
22
- "@verdaccio/config": "6.0.0-6-next.12",
23
- "@verdaccio/mock": "6.0.0-6-next.13",
24
- "@verdaccio/types": "11.0.0-6-next.10"
25
- },
26
- "homepage": "https://verdaccio.org",
27
- "keywords": [
28
- "private",
29
- "package",
30
- "repository",
31
- "registry",
32
- "enterprise",
33
- "modules",
34
- "proxy",
35
- "server",
36
- "verdaccio"
37
- ],
38
- "engines": {
39
- "node": ">=14",
40
- "npm": ">=6"
41
- },
42
- "license": "MIT",
43
- "funding": {
44
- "type": "opencollective",
45
- "url": "https://opencollective.com/verdaccio"
46
- },
47
- "scripts": {
48
- "clean": "rimraf ./build",
49
- "test": "cross-env NODE_ENV=test BABEL_ENV=test jest",
50
- "type-check": "tsc --noEmit -p tsconfig.build.json",
51
- "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
52
- "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
53
- "watch": "pnpm build:js -- --watch",
54
- "build": "pnpm run build:js && pnpm run build:types"
55
- }
56
- }
2
+ "name": "@verdaccio/loaders",
3
+ "version": "6.0.0-6-next.13",
4
+ "description": "loaders logic",
5
+ "main": "./build/index.js",
6
+ "types": "build/index.d.ts",
7
+ "author": {
8
+ "name": "Juan Picado",
9
+ "email": "juanpicado19@gmail.com"
10
+ },
11
+ "repository": {
12
+ "type": "https",
13
+ "url": "https://github.com/verdaccio/verdaccio"
14
+ },
15
+ "dependencies": {
16
+ "@verdaccio/logger": "6.0.0-6-next.12",
17
+ "debug": "4.3.4",
18
+ "lodash": "4.17.21"
19
+ },
20
+ "devDependencies": {
21
+ "@verdaccio/core": "6.0.0-6-next.6",
22
+ "@verdaccio/config": "6.0.0-6-next.15",
23
+ "@verdaccio/types": "11.0.0-6-next.13"
24
+ },
25
+ "homepage": "https://verdaccio.org",
26
+ "keywords": [
27
+ "private",
28
+ "package",
29
+ "repository",
30
+ "registry",
31
+ "enterprise",
32
+ "modules",
33
+ "proxy",
34
+ "server",
35
+ "verdaccio"
36
+ ],
37
+ "engines": {
38
+ "node": ">=14",
39
+ "npm": ">=6"
40
+ },
41
+ "license": "MIT",
42
+ "funding": {
43
+ "type": "opencollective",
44
+ "url": "https://opencollective.com/verdaccio"
45
+ },
46
+ "scripts": {
47
+ "clean": "rimraf ./build",
48
+ "test": "jest",
49
+ "type-check": "tsc --noEmit -p tsconfig.build.json",
50
+ "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
51
+ "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
52
+ "watch": "pnpm build:js -- --watch",
53
+ "build": "pnpm run build:js && pnpm run build:types"
54
+ },
55
+ "readme": "# @verdaccio/loaders\n\n[![backers](https://opencollective.com/verdaccio/tiers/backer/badge.svg?label=Backer&color=brightgreen)](https://opencollective.com/verdaccio)\n[![stackshare](https://img.shields.io/badge/Follow%20on-StackShare-blue.svg?logo=stackshare&style=flat)](https://stackshare.io/verdaccio)\n[![MIT](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/verdaccio/verdaccio/blob/master/LICENSE)\n[![Crowdin](https://d322cqt584bo4o.cloudfront.net/verdaccio/localized.svg)](https://crowdin.com/project/verdaccio)\n[![TODOs](https://badgen.net/https/api.tickgit.com/badgen/github.com/verdaccio/verdaccio)](https://www.tickgit.com/browse?repo=github.com/verdaccio/verdaccio)\n\n[![Twitter followers](https://img.shields.io/twitter/follow/verdaccio_npm.svg?style=social&label=Follow)](https://twitter.com/verdaccio_npm)\n[![Github](https://img.shields.io/github/stars/verdaccio/verdaccio.svg?style=social&label=Stars)](https://github.com/verdaccio/verdaccio/stargazers)\n\n## Donations\n\nVerdaccio is run by **volunteers**; nobody is working full-time on it. If you find this project to be useful and would like to support its development, consider making a donation - **your logo might end up in this readme.** 😉\n\n**[Donate](https://opencollective.com/verdaccio)** 💵👍🏻 starting from _\\$1/month_ or just one single contribution.\n\n## Report a vulnerability\n\nIf you want to report a security vulnerability, please follow the steps which we have defined for you in our [security policy](https://github.com/verdaccio/verdaccio/security/policy).\n\n## Open Collective Sponsors\n\nSupport this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/verdaccio#sponsor)]\n\n[![sponsor](https://opencollective.com/verdaccio/sponsor/0/avatar.svg)](https://opencollective.com/verdaccio/sponsor/0/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/1/avatar.svg)](https://opencollective.com/verdaccio/sponsor/1/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/2/avatar.svg)](https://opencollective.com/verdaccio/sponsor/2/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/3/avatar.svg)](https://opencollective.com/verdaccio/sponsor/3/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/4/avatar.svg)](https://opencollective.com/verdaccio/sponsor/4/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/5/avatar.svg)](https://opencollective.com/verdaccio/sponsor/5/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/6/avatar.svg)](https://opencollective.com/verdaccio/sponsor/6/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/7/avatar.svg)](https://opencollective.com/verdaccio/sponsor/7/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/8/avatar.svg)](https://opencollective.com/verdaccio/sponsor/8/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/9/avatar.svg)](https://opencollective.com/verdaccio/sponsor/9/website)\n\n## Open Collective Backers\n\nThank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/verdaccio#backer)]\n\n[![backers](https://opencollective.com/verdaccio/backers.svg?width=890)](https://opencollective.com/verdaccio#backers)\n\n## Special Thanks\n\nThanks to the following companies to help us to achieve our goals providing free open source licenses.\n\n[![jetbrain](assets/thanks/jetbrains/logo.png)](https://www.jetbrains.com/)\n[![crowdin](assets/thanks/crowdin/logo.png)](https://crowdin.com/)\n[![balsamiq](assets/thanks/balsamiq/logo.jpg)](https://balsamiq.com/)\n\n## Contributors\n\nThis project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].\n\n[![contributors](https://opencollective.com/verdaccio/contributors.svg?width=890&button=true)](../../graphs/contributors)\n\n### FAQ / Contact / Troubleshoot\n\nIf you have any issue you can try the following options, do no desist to ask or check our issues database, perhaps someone has asked already what you are looking for.\n\n- [Blog](https://verdaccio.org/blog/)\n- [Donations](https://opencollective.com/verdaccio)\n- [Reporting an issue](https://github.com/verdaccio/verdaccio/blob/master/CONTRIBUTING.md#reporting-a-bug)\n- [Running discussions](https://github.com/verdaccio/verdaccio/issues?q=is%3Aissue+is%3Aopen+label%3Adiscuss)\n- [Chat](http://chat.verdaccio.org/)\n- [Logos](https://verdaccio.org/docs/en/logo)\n- [Docker Examples](https://github.com/verdaccio/docker-examples)\n- [FAQ](https://github.com/verdaccio/verdaccio/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Aquestion%20)\n\n### License\n\nVerdaccio is [MIT licensed](https://github.com/verdaccio/verdaccio/blob/master/LICENSE)\n\nThe Verdaccio documentation and logos (excluding /thanks, e.g., .md, .png, .sketch) files within the /assets folder) is\n[Creative Commons licensed](https://github.com/verdaccio/verdaccio/blob/master/LICENSE-docs).\n"
56
+ }
@@ -96,8 +96,9 @@ export function loadPlugin<T extends IPlugin<T>>(
96
96
  }
97
97
 
98
98
  // relative to config path
99
- if (plugin === null && pluginId.match(/^\.\.?($|\/)/)) {
100
- plugin = tryLoad(Path.resolve(Path.dirname(config.config_path), pluginId));
99
+ debug('config path: %s', config.configPath);
100
+ if (plugin === null && pluginId.match(/^\.\.?($|\/)/) && config.configPath) {
101
+ plugin = tryLoad(Path.resolve(Path.dirname(config.configPath), pluginId));
101
102
  }
102
103
 
103
104
  if (plugin === null) {
@@ -121,7 +122,7 @@ export function loadPlugin<T extends IPlugin<T>>(
121
122
  try {
122
123
  plugin = isES6(plugin)
123
124
  ? new plugin.default(mergeConfig(config, pluginConfigs[pluginId]), params)
124
- : plugin(pluginConfigs[pluginId], params);
125
+ : new plugin(pluginConfigs[pluginId], params);
125
126
  } catch (error: any) {
126
127
  plugin = null;
127
128
  logger.error({ error, pluginId }, 'error loading a plugin @{pluginId}: @{error}');