New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

breadboard

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

breadboard - npm Package Compare versions

Comparing version

to
2.0.0

spec/index.spec.js

9

index.js

@@ -20,2 +20,9 @@ 'use strict';

if (!containerRoot) {
return Promise.reject(new Error('Expected container root to be specified'));
}
if (!options.entry) {
return Promise.reject(new Error('Expected application entry point to be specified'));
}
return Promise

@@ -30,3 +37,3 @@ .all([

initialState: options.initialState,
substitutes: options.substitutes
substitutes: substitutes
}))

@@ -33,0 +40,0 @@ .catch((err) => {

8

lib/getDependencyModules.js

@@ -5,2 +5,3 @@ 'use strict';

const stat = require('fs').statSync;
const resolvePath = require('path').resolve;
const includes = require('lodash/includes');

@@ -10,3 +11,3 @@ const d = debug('breadboard:setup');

module.exports = (packageDir, blacklist, substitutes) => {
const packageJsonPath = `${packageDir}/package.json`;
const absolutePackageJsonPath = resolvePath(process.cwd(), `${packageDir}/package.json`);

@@ -18,5 +19,4 @@ return new Promise((resolve, reject) => {

try {
stat(packageJsonPath);
packageJsonModuleNames = Object.keys(require(packageJsonPath).dependencies);
stat(absolutePackageJsonPath);
packageJsonModuleNames = Object.keys(require(absolutePackageJsonPath).dependencies);
d('package.json modules', Object.keys(packageJsonModules));

@@ -23,0 +23,0 @@ }

@@ -5,24 +5,26 @@ 'use strict';

const d = debug('breadboard:setup');
const loadSanitisedNativeModules = (modules, nativeModuleName) => {
const excludedNativesRegExp = /^internal\/|_|v8\//;
if (!excludedNativesRegExp.test(nativeModuleName)) {
Object.defineProperty(modules, nativeModuleName, {
enumerable: true,
get: () => {
d(`Requiring ${nativeModuleName}`);
return require(nativeModuleName);
}
});
}
return modules;
};
const excludeSubstitutes = (modules, substitutes) => {
return modules.filter(module => !substitutes.some(substitute => substitute === module));
};
module.exports = (substitutes) => {
const natives = Object.keys(process.binding('natives'));
const natives = excludeSubstitutes(Object.keys(process.binding('natives')), substitutes);
return new Promise((resolve) => {
const nativeModules = natives.reduce((nms, nativeModuleName) => {
if (substitutes.some(substituteName => substituteName === nativeModuleName)) {
return nms;
}
if (!/^internal\/|_/.test(nativeModuleName)) {
Object.defineProperty(nms, nativeModuleName, {
enumerable: true,
get: () => {
d(`Requiring ${nativeModuleName}`);
return require(nativeModuleName);
}
});
}
return nms;
}, {});
const nativeModules = natives.reduce(loadSanitisedNativeModules, {});
d('Native modules', Object.keys(nativeModules));

@@ -29,0 +31,0 @@

{
"name": "breadboard",
"version": "1.0.1",
"version": "2.0.0",
"description": "Lightweight IOC container for Node.js",
"main": "index.js",
"engines": {
"node": "~4.4"
},
"repository": "notonthehighstreet/breadboard",
"scripts": {
"test": "./node_modules/ava/cli.js",
"test": "./node_modules/ava/cli.js --serial",
"coverage": "./node_modules/.bin/nyc ./node_modules/ava/cli.js --all",

@@ -34,3 +37,4 @@ "report": "npm run coverage && ./node_modules/.bin/nyc report --reporter=html",

"include": [
"lib/**/*.js"
"lib/**/*.js",
"index.js"
],

@@ -37,0 +41,0 @@ "exclude": [

![](http://i.imgur.com/3lFs20I.png)
# Breadboard
[![Test Coverage](https://codeclimate.com/repos/56e00704db68c03776006380/badges/bb9a78dab8325eafba2c/coverage.svg)](https://codeclimate.com/repos/56e00704db68c03776006380/coverage)
[![Code Climate](https://codeclimate.com/github/notonthehighstreet/breadboard/badges/gpa.svg)](https://codeclimate.com/github/notonthehighstreet/breadboard)
[![Test Coverage](https://codeclimate.com/github/notonthehighstreet/breadboard/badges/coverage.svg)](https://codeclimate.com/github/notonthehighstreet/breadboard/coverage)
[![Build Status](https://travis-ci.org/notonthehighstreet/breadboard.svg?branch=master)](https://travis-ci.org/notonthehighstreet/breadboard)

@@ -60,3 +61,3 @@

server.listen(80, () => {
debug('Server listening on port 80');
d('Server listening on port 80');
});

@@ -98,2 +99,5 @@

## Prerequisites
Node.js ~4.4
## API

@@ -100,0 +104,0 @@ `breadboard(options)`

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet