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

architect

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

architect - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

91

architect.js

@@ -63,6 +63,3 @@ var dirname = require('path').dirname;

checkCycles(config);
// Stamp it approved so we don't check it again.
config.checked = true;
return checkCycles(config);
}

@@ -76,3 +73,4 @@

provides: pluginConfig.provides.concat(),
consumes: pluginConfig.consumes.concat()
consumes: pluginConfig.consumes.concat(),
config: pluginConfig
});

@@ -85,2 +83,3 @@ });

var changed = true;
var sorted = [];

@@ -110,2 +109,3 @@ while(plugins.length && changed) {

});
sorted.push(plugin.config);
changed = true;

@@ -120,2 +120,4 @@ });

}
return sorted;
}

@@ -134,60 +136,41 @@

// Check the config if it's not already checked.
if (!config.checked) {
try {
checkConfig(config)
} catch (err) {
app.emit("error", err);
}
// Check the config
try {
var sortedPlugins = checkConfig(config)
} catch (err) {
return app.emit("error", err);
}
var running;
var destructors = [];
(function startPlugins() {
if (running) return;
running = true;
var pending = 0;
do {
var changed = false;
config.forEach(function (plugin) {
// Skip already-started and not-yet-ready plugins
if (plugin.started) return;
if (!plugin.consumes.every(function (name) {
return services[name];
})) { return; }
var plugin = sortedPlugins.shift();
if (!plugin)
return app.emit("ready", app);
pending++;
var imports = {};
plugin.consumes.forEach(function (name) {
imports[name] = services[name];
});
plugin.started = true;
plugin.setup(plugin, imports, function (err, provided) {
if (err) { return app.emit("error", err); }
plugin.provides.forEach(function (name) {
if (!provided.hasOwnProperty(name)) {
var err = new Error("Plugin failed to provide " + name + " service. " + JSON.stringify(plugin));
return app.emit("error", err);
}
services[name] = provided[name];
app.emit("service", name, services[name]);
changed = true;
});
if (provided && provided.hasOwnProperty("onDestroy"))
destructors.push(provided.onDestroy);
pending--;
app.emit("plugin", plugin);
if (changed) { startPlugins(); }
});
var imports = {};
if (plugin.consumes) {
plugin.consumes.forEach(function (name) {
imports[name] = services[name];
});
} while (changed);
running = false;
if (!pending) {
app.emit("ready", app);
}
}());
plugin.setup(plugin, imports, function (err, provided) {
if (err) { return app.emit("error", err); }
plugin.provides.forEach(function (name) {
if (!provided.hasOwnProperty(name)) {
var err = new Error("Plugin failed to provide " + name + " service. " + JSON.stringify(plugin));
return app.emit("error", err);
}
services[name] = provided[name];
app.emit("service", name, services[name]);
});
if (provided && provided.hasOwnProperty("onDestroy"))
destructors.push(provided.onDestroy);
app.emit("plugin", plugin);
startPlugins();
});
})();
this.destroy = function() {

@@ -194,0 +177,0 @@ destructors.forEach(function(destroy) {

{
"name": "architect",
"description": "A Simple yet powerful plugin system for node applications",
"version": "0.1.1",
"version": "0.1.2",
"author": "ajax.org B.V. <info@ajax.org>",

@@ -6,0 +6,0 @@ "contributors": [

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