Socket
Socket
Sign inDemoInstall

egg-core

Package Overview
Dependencies
Maintainers
12
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-core - npm Package Compare versions

Comparing version 4.24.1 to 4.25.0

9

History.md
4.25.0 / 2022-09-07
==================
**features**
* [[`8ae1aad`](https://github.com/eggjs/egg-core.git/commit/8ae1aade1f3702f944b3c0e8794c88adc0a10459)] - feat: add load plugin methods (#245) (吖猩 <<whx89768@alibaba-inc.com>>)
**others**
* [[`7c4707c`](https://github.com/eggjs/egg-core.git/commit/7c4707c64c6df365e2c2b77b9dd8c7581c62a97f)] - Create codeql-analysis.yml (fengmk2 <<fengmk2@gmail.com>>)
4.24.1 / 2022-06-23

@@ -3,0 +12,0 @@ ==================

86

lib/loader/mixin/plugin.js

@@ -62,41 +62,10 @@ 'use strict';

// loader plugins from application
const appPlugins = this.readPluginConfigs(path.join(this.options.baseDir, 'config/plugin.default'));
debug('Loaded app plugins: %j', Object.keys(appPlugins));
// loader plugins from framework
const eggPluginConfigPaths = this.eggPaths.map(eggPath => path.join(eggPath, 'config/plugin.default'));
const eggPlugins = this.readPluginConfigs(eggPluginConfigPaths);
debug('Loaded egg plugins: %j', Object.keys(eggPlugins));
// loader plugins from process.env.EGG_PLUGINS
let customPlugins;
if (process.env.EGG_PLUGINS) {
try {
customPlugins = JSON.parse(process.env.EGG_PLUGINS);
} catch (e) {
debug('parse EGG_PLUGINS failed, %s', e);
}
}
// loader plugins from options.plugins
if (this.options.plugins) {
customPlugins = Object.assign({}, customPlugins, this.options.plugins);
}
if (customPlugins) {
for (const name in customPlugins) {
this.normalizePluginConfig(customPlugins, name);
}
debug('Loaded custom plugins: %j', Object.keys(customPlugins));
}
this.allPlugins = {};
this.appPlugins = appPlugins;
this.customPlugins = customPlugins;
this.eggPlugins = eggPlugins;
this.appPlugins = this.loadAppPlugins();
this.eggPlugins = this.loadEggPlugins();
this.customPlugins = this.loadCustomPlugins();
this._extendPlugins(this.allPlugins, eggPlugins);
this._extendPlugins(this.allPlugins, appPlugins);
this._extendPlugins(this.allPlugins, customPlugins);
this._extendPlugins(this.allPlugins, this.eggPlugins);
this._extendPlugins(this.allPlugins, this.appPlugins);
this._extendPlugins(this.allPlugins, this.customPlugins);

@@ -129,3 +98,3 @@ const enabledPluginNames = []; // enabled plugins that configured explicitly

// retrieve the ordered plugins
this.orderPlugins = this.getOrderPlugins(plugins, enabledPluginNames, appPlugins);
this.orderPlugins = this.getOrderPlugins(plugins, enabledPluginNames, this.appPlugins);

@@ -148,2 +117,43 @@ const enablePlugins = {};

loadAppPlugins() {
// loader plugins from application
const appPlugins = this.readPluginConfigs(path.join(this.options.baseDir, 'config/plugin.default'));
debug('Loaded app plugins: %j', Object.keys(appPlugins));
return appPlugins;
},
loadEggPlugins() {
// loader plugins from framework
const eggPluginConfigPaths = this.eggPaths.map(eggPath => path.join(eggPath, 'config/plugin.default'));
const eggPlugins = this.readPluginConfigs(eggPluginConfigPaths);
debug('Loaded egg plugins: %j', Object.keys(eggPlugins));
return eggPlugins;
},
loadCustomPlugins() {
// loader plugins from process.env.EGG_PLUGINS
let customPlugins;
if (process.env.EGG_PLUGINS) {
try {
customPlugins = JSON.parse(process.env.EGG_PLUGINS);
} catch (e) {
debug('parse EGG_PLUGINS failed, %s', e);
}
}
// loader plugins from options.plugins
if (this.options.plugins) {
customPlugins = Object.assign({}, customPlugins, this.options.plugins);
}
if (customPlugins) {
for (const name in customPlugins) {
this.normalizePluginConfig(customPlugins, name);
}
debug('Loaded custom plugins: %j', Object.keys(customPlugins));
}
return customPlugins;
},
/*

@@ -150,0 +160,0 @@ * Read plugin.js from multiple directory

{
"name": "egg-core",
"version": "4.24.1",
"version": "4.25.0",
"description": "A core Pluggable framework based on koa",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc