🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@eggjs/core

Package Overview
Dependencies
Maintainers
9
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eggjs/core - npm Package Compare versions

Comparing version
7.0.2-beta.10
to
7.0.2-beta.11
+21
-6
dist/loader/egg_loader.js

@@ -486,3 +486,3 @@ import utils_default from "../utils/index.js";

if (plugin.package) assert(isValidatePackageName(plugin.package), `plugin ${plugin.name} invalid, use 'path' instead of package: "${plugin.package}"`);
if (plugin.path && this.#isBundlePluginPathArtifact(plugin.path)) return this.#resolveBundlePluginPath(plugin);
if (this.#isBundleModeForThisApp() && (!plugin.path || this.#isBundlePluginPathArtifact(plugin.path))) return this.#resolveBundlePluginPath(plugin);
return this.#resolvePluginPath(plugin);

@@ -496,5 +496,13 @@ }

*/
/**
* Whether an active bundle store belongs to THIS app. The store is shared via globalThis
* across @eggjs/core copies, so one registered for a different app must not reinterpret this
* app's plugin paths — mirror `ManifestStore.load()`'s `bundleStore.baseDir === baseDir` gate.
*/
#isBundleModeForThisApp() {
const bundleStore = ManifestStore.getBundleStore();
return !!bundleStore && path.resolve(bundleStore.baseDir) === path.resolve(this.options.baseDir);
}
#isBundlePluginPathArtifact(pluginPath) {
const bundleStore = ManifestStore.getBundleStore();
if (!bundleStore || path.resolve(bundleStore.baseDir) !== path.resolve(this.options.baseDir)) return false;
if (!this.#isBundleModeForThisApp()) return false;
return path.resolve(pluginPath) === path.resolve(this.options.baseDir);

@@ -512,7 +520,14 @@ }

for (const name$1 of candidates) try {
const entry = utils_default.resolvePath(name$1, { paths: [...this.lookupDirs] });
const realDir = path.dirname(entry);
let realDir;
try {
realDir = path.dirname(utils_default.resolvePath(name$1, { paths: [...this.lookupDirs] }));
} catch {
realDir = path.dirname(utils_default.resolvePath(`${name$1}/package.json`, { paths: [...this.lookupDirs] }));
}
const segments = realDir.split(/[/\\]/);
const nmIdx = segments.lastIndexOf("node_modules");
if (nmIdx !== -1) return path.join(this.options.baseDir, ...segments.slice(nmIdx));
if (nmIdx !== -1) {
const rebased = path.join(this.options.baseDir, ...segments.slice(nmIdx));
if (fs.existsSync(rebased)) return rebased;
}
return realDir;

@@ -519,0 +534,0 @@ } catch (err) {

{
"name": "@eggjs/core",
"version": "7.0.2-beta.10",
"version": "7.0.2-beta.11",
"description": "A core plugin framework based on @eggjs/koa",

@@ -45,9 +45,9 @@ "keywords": [

"utility": "^2.5.0",
"@eggjs/koa": "3.1.2-beta.10",
"@eggjs/router": "4.0.2-beta.10",
"@eggjs/path-matching": "3.0.2-beta.10",
"@eggjs/loader-fs": "1.0.0-beta.10",
"@eggjs/utils": "5.0.2-beta.10",
"@eggjs/typings": "4.1.2-beta.10",
"@eggjs/extend2": "5.0.2-beta.10"
"@eggjs/extend2": "5.0.2-beta.11",
"@eggjs/loader-fs": "1.0.0-beta.11",
"@eggjs/path-matching": "3.0.2-beta.11",
"@eggjs/router": "4.0.2-beta.11",
"@eggjs/koa": "3.1.2-beta.11",
"@eggjs/utils": "5.0.2-beta.11",
"@eggjs/typings": "4.1.2-beta.11"
},

@@ -64,5 +64,5 @@ "devDependencies": {

"urllib": "^4.8.2",
"@eggjs/mock": "7.0.2-beta.10",
"@eggjs/supertest": "9.0.2-beta.10",
"@eggjs/tsconfig": "3.1.2-beta.10"
"@eggjs/supertest": "9.0.2-beta.11",
"@eggjs/tsconfig": "3.1.2-beta.11",
"@eggjs/mock": "7.0.2-beta.11"
},

@@ -69,0 +69,0 @@ "engines": {