egg-core
Advanced tools
Comparing version 4.21.0 to 4.22.0
4.22.0 / 2022-01-07 | ||
================== | ||
**features** | ||
* [[`43f15ad`](http://github.com/eggjs/egg-core/commit/43f15ada7291734aa583c274a8af5e321688deb5)] - feat: support pnpm node_modules style (#237) (TZ | 天猪 <<atian25@qq.com>>) | ||
4.21.0 / 2021-11-24 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -334,18 +334,25 @@ 'use strict'; | ||
const name = plugin.package || plugin.name; | ||
const lookupDirs = []; | ||
const lookupDirs = new Set(); | ||
// 尝试在以下目录找到匹配的插件 | ||
// try to locate the plugin in the following directories | ||
// -> {APP_PATH}/node_modules | ||
// -> {EGG_PATH}/node_modules | ||
// -> $CWD/node_modules | ||
lookupDirs.push(path.join(this.options.baseDir, 'node_modules')); | ||
lookupDirs.add(path.join(this.options.baseDir, 'node_modules')); | ||
// 到 egg 中查找,优先从外往里查找 | ||
// try to locate the plugin at framework from upper to lower | ||
for (let i = this.eggPaths.length - 1; i >= 0; i--) { | ||
const eggPath = this.eggPaths[i]; | ||
lookupDirs.push(path.join(eggPath, 'node_modules')); | ||
lookupDirs.add(path.join(eggPath, 'node_modules')); | ||
// should find the siblings directory of framework when using pnpm | ||
// 'node_modules/.pnpm/yadan@2.0.0/node_modules/yadan/node_modules', | ||
// 'node_modules/.pnpm/yadan@2.0.0/node_modules', <- this is the sibling directory | ||
// 'node_modules/.pnpm/egg@2.33.1/node_modules/egg/node_modules', | ||
// 'node_modules/.pnpm/egg@2.33.1/node_modules', <- this is the sibling directory | ||
lookupDirs.add(path.dirname(eggPath)); | ||
} | ||
// should find the $cwd/node_modules when test the plugins under npm3 | ||
lookupDirs.push(path.join(process.cwd(), 'node_modules')); | ||
lookupDirs.add(path.join(process.cwd(), 'node_modules')); | ||
@@ -359,3 +366,3 @@ for (let dir of lookupDirs) { | ||
throw new Error(`Can not find plugin ${name} in "${lookupDirs.join(', ')}"`); | ||
throw new Error(`Can not find plugin ${name} in "${[ ...lookupDirs ].join(', ')}"`); | ||
}, | ||
@@ -362,0 +369,0 @@ |
{ | ||
"name": "egg-core", | ||
"version": "4.21.0", | ||
"version": "4.22.0", | ||
"description": "A core Pluggable framework based on koa", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
133170
2971