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

architect

Package Overview
Dependencies
Maintainers
5
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.5 to 0.1.6

42

architect.js

@@ -15,3 +15,3 @@

var resolve = require('path').resolve;
var existsSync = require('path').existsSync;
var existsSync = require('fs').existsSync || require('path').existsSync;
var realpathSync = require('fs').realpathSync;

@@ -40,5 +40,3 @@ var packagePathCache = {};

if (plugin.hasOwnProperty("packagePath") && !plugin.hasOwnProperty("setup")) {
plugin.packagePath = resolvePackageSync(base, plugin.packagePath);
var packageConf = require(plugin.packagePath);
var defaults = packageConf.plugin || {};
var defaults = resolveModule(base, plugin.packagePath);
Object.keys(defaults).forEach(function (key) {

@@ -49,6 +47,5 @@ if (!plugin.hasOwnProperty(key)) {

});
plugin.setup = require(dirname(plugin.packagePath));
plugin.packagePath = defaults.packagePath;
plugin.setup = require(plugin.packagePath);
}
plugin.consumes = plugin.consumes || [];
plugin.provides = plugin.provides || [];
});

@@ -58,2 +55,25 @@ return config;

// Loads a module, getting metadata from either it's package.json or export
// object.
function resolveModule(base, modulePath) {
var packagePath;
try {
packagePath = resolvePackageSync(base, modulePath + "/package.json");
}
catch (err) {
if (err.code !== "ENOENT") throw err;
}
var metadata = packagePath && require(packagePath).plugin || {};
if (packagePath) {
modulePath = dirname(packagePath);
} else {
modulePath = resolvePackageSync(base, modulePath);
}
var module = require(modulePath);
metadata.provides = metadata.provides || module.provides || [];
metadata.consumes = metadata.consumes || module.consumes || [];
metadata.packagePath = modulePath;
return metadata;
}
// Node style package resolving so that plugins' package.json can be found relative to the config file

@@ -64,7 +84,7 @@ // It's not the full node require system algorithm, but it's the 99% case

var originalBase = base;
if (!packagePathCache.hasOwnProperty(base)) {
if (!(base in packagePathCache)) {
packagePathCache[base] = {};
}
var cache = packagePathCache[base];
if (cache.hasOwnProperty(packagePath)) {
if (packagePath in cache) {
return cache[packagePath];

@@ -74,3 +94,3 @@ }

if (packagePath[0] === "." || packagePath[0] === "/") {
newPath = resolve(base, packagePath, "package.json");
newPath = resolve(base, packagePath);
if (existsSync(newPath)) {

@@ -84,3 +104,3 @@ newPath = realpathSync(newPath);

while (base) {
newPath = resolve(base, "node_modules", packagePath, "package.json");
newPath = resolve(base, "node_modules", packagePath);
if (existsSync(newPath)) {

@@ -87,0 +107,0 @@ newPath = realpathSync(newPath);

{
"name": "architect",
"description": "A Simple yet powerful plugin system for node applications",
"version": "0.1.5",
"version": "0.1.6",
"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