Socket
Socket
Sign inDemoInstall

mendel-development

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mendel-development - npm Package Compare versions

Comparing version 1.0.9 to 1.1.0

proxy.js

12

apply-extra-options.js

@@ -0,1 +1,5 @@

/* Copyright 2015, Yahoo Inc.
Copyrights licensed under the MIT License.
See the accompanying LICENSE file for terms. */
var path = require('path');

@@ -17,3 +21,3 @@ var glob = require('glob');

else {
files.forEach(function (file) { b.ignore(file) });
files.forEach(function (file) { b.ignore(file); });
}

@@ -32,3 +36,3 @@ if (--b._pending === 0) b.emit('_ready');

if (err) return b.emit('error', err);
files.forEach(function (file) { b.exclude(file) });
files.forEach(function (file) { b.exclude(file); });
if (--b._pending === 0) b.emit('_ready');

@@ -58,4 +62,4 @@ });

function add (x, opts) {
if (/^[\/.]/.test(x)) b.external(path.resolve(x), opts)
else b.external(x, opts)
if (/^[\/.]/.test(x)) b.external(path.resolve(x), opts);
else b.external(x, opts);
}

@@ -62,0 +66,0 @@ })

@@ -10,7 +10,14 @@ /* Copyright 2015, Yahoo Inc.

function mendelifyTransformStream(variations, expose) {
function mendelifyTransformStream(variations, bundle) {
var externals = bundle._external;
return through.obj(function mendelify(row, enc, next) {
if (!avoidMendelify(row.file)) {
var avoidMendelifyRow = avoidMendelify(row.file);
if (!avoidMendelifyRow) {
var match = variationMatches(variations, row.file);
if (match) {
// Remove variations of externals from bundle
if (someArrayItemEndsWith(externals, match.file)) {
return next();
}
// accept file and trasform for variation
row.id = match.file;

@@ -21,15 +28,23 @@ row.variation = match.dir;

if (typeof row.expose === 'string') {
row.expose = pathOrVariationMatch(row.expose, variations);
}
Object.keys(row.deps).forEach(function (key) {
if (!avoidMendelify(row.deps[key])) {
var value = row.deps[key];
delete row.deps[key];
var value = row.deps[key];
delete row.deps[key];
var newKey = pathOrVariationMatch(key, variations);
var newValue = depsValue(value, variations, expose);
row.deps[newKey] = newValue;
var newKey = key;
var newValue = value;
if (!avoidMendelify(value) || shouldExternalize(externals, key)) {
newKey = pathOrVariationMatch(key, variations);
}
newValue = depsValue(value, newKey, variations, bundle);
row.deps[newKey] = newValue;
});
row.rawSource = row.source;
if (!avoidMendelify(row.file)) {
if (!avoidMendelifyRow) {
row.source = mendelifyRequireTransform(row.file, row.source, variations);

@@ -59,10 +74,39 @@ }

function depsValue(path, variations, expose) {
function depsValue(path, matchFile, variations, bundle) {
if (typeof path !== 'string') {
return path;
}
var expose = bundle._expose;
var externals = bundle._external;
var exposedModule = exposeKey(expose, path);
if (exposedModule) {
return exposedModule;
return pathOrVariationMatch(exposedModule, variations);
}
// remove externals from deps
if (shouldExternalize(externals, matchFile)) {
return false;
}
return pathOrVariationMatch(path, variations);
}
function shouldExternalize(externals, file) {
return someArrayItemEndsWith(externals, file);
}
function someArrayItemEndsWith(stringArray, partialString) {
for (var i = 0; i < stringArray.length; i++) {
var position = stringArray[i].indexOf(partialString);
if (
position >= 0 &&
position === stringArray[i].length - partialString.length
) {
return true;
}
}
return false;
}
function exposeKey(expose, file) {

@@ -69,0 +113,0 @@ var exposedModule = false;

{
"name": "mendel-development",
"version": "1.0.9",
"version": "1.1.0",
"description": "Mendel shared dependencies for build and development",

@@ -20,6 +20,7 @@ "main": "index.js",

"falafel": "^1.2.0",
"glob": "^7.0.3",
"shasum": "^1.0.2",
"through2": "^2.0.1",
"glob": "^7.0.3"
"tmp": "0.0.28"
}
}

@@ -0,1 +1,5 @@

/* Copyright 2015, Yahoo Inc.
Copyrights licensed under the MIT License.
See the accompanying LICENSE file for terms. */
function resolveVariations(existingVariations, variations) {

@@ -18,2 +22,2 @@ var i, j, evar, dir, resolved = [];

module.exports = resolveVariations;
module.exports = resolveVariations;

@@ -7,2 +7,3 @@ /* Copyright 2015, Yahoo Inc.

function variationMatches(variations, path) {
if (path.indexOf('node_modules') >= 0 ) return;
var result;

@@ -9,0 +10,0 @@ variations.some(function(variation) {

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