Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

egg-core

Package Overview
Dependencies
Maintainers
5
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 3.20.2 to 3.20.3

6

History.md
3.20.3 / 2018-03-09
==================
**fixes**
* [[`661bb3e`](http://github.com/eggjs/egg-core/commit/661bb3eb2c0df07195f94fa835cc61e5c1df2f5e)] - fix: should not load optional plugin & their deps (#155) (zōng yǔ <<gxcsoccer@users.noreply.github.com>>)
3.20.2 / 2017-12-19

@@ -3,0 +9,0 @@ ==================

42

lib/utils/sequencify.js
'use strict';
function sequence(tasks, names, results, missing, recursive, nest, optional) {
const debug = require('debug')('egg-core#sequencify');
function sequence(tasks, names, results, missing, recursive, nest, optional, parent) {
names.forEach(function(name) {
if (results.indexOf(name) !== -1) {
return; // de-dup results
}
if (results.requires[name]) return;
const node = tasks[name];
// if it's an optional dependency, it can be ignore when
if (optional === true) {
// name is not exist
if (!node) return;
// or it's disabled
if (node && node.enable === false) return;
}
if (!node) {
if (optional === true) return;
missing.push(name);
} else if (nest.indexOf(name) > -1) {
} else if (nest.includes(name)) {
nest.push(name);

@@ -26,10 +21,16 @@ recursive.push(nest.slice(0));

if (node.dependencies.length) {
sequence(tasks, node.dependencies, results, missing, recursive, nest);
sequence(tasks, node.dependencies, results, missing, recursive, nest, optional, name);
}
if (node.optionalDependencies.length) {
sequence(tasks, node.optionalDependencies, results, missing, recursive, nest, true);
sequence(tasks, node.optionalDependencies, results, missing, recursive, nest, true, name);
}
nest.pop(name);
}
results.push(name);
if (!optional) {
results.requires[name] = true;
debug('task: %s is enabled by %s', name, parent);
}
if (!results.sequence.includes(name)) {
results.sequence.push(name);
}
});

@@ -41,14 +42,17 @@ }

module.exports = function(tasks, names) {
let results = []; // the final sequence
const results = {
sequence: [],
requires: {},
}; // the final sequence
const missing = []; // missing tasks
const recursive = []; // recursive task dependencies
sequence(tasks, names, results, missing, recursive, []);
sequence(tasks, names, results, missing, recursive, [], false, 'app');
if (missing.length || recursive.length) {
results = []; // results are incomplete at best, completely wrong at worst, remove them to avoid confusion
results.sequence = []; // results are incomplete at best, completely wrong at worst, remove them to avoid confusion
}
return {
sequence: results,
sequence: results.sequence.filter(item => results.requires[item]),
missingTasks: missing,

@@ -55,0 +59,0 @@ recursiveDependencies: recursive,

{
"name": "egg-core",
"version": "3.20.2",
"version": "3.20.3",
"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