mendel-development
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -10,19 +10,24 @@ /* Copyright 2015, Yahoo Inc. | ||
function mendelifyTransformStream(variations) { | ||
function mendelifyTransformStream(variations, expose) { | ||
return through.obj(function mendelify(row, enc, next) { | ||
var match = variationMatches(variations, row.file); | ||
if (match) { | ||
row.id = match.file; | ||
row.variation = match.dir; | ||
if (!avoidMendelify(row.file)) { | ||
var match = variationMatches(variations, row.file); | ||
if (match) { | ||
row.id = match.file; | ||
row.variation = match.dir; | ||
} | ||
} | ||
Object.keys(row.deps).forEach(function (key) { | ||
var depMatch = variationMatches(variations, key); | ||
if (depMatch) { | ||
row.deps[depMatch.file] = depMatch.file; | ||
delete row.deps[key]; | ||
if (!avoidMendelify(row.deps[key])) { | ||
var depMatch = variationMatches(variations, key); | ||
if (depMatch) { | ||
row.deps[depMatch.file] = depsValue( | ||
row.deps[key], variations, expose | ||
); | ||
delete row.deps[key]; | ||
} | ||
} | ||
}); | ||
row.rawSource = row.source; | ||
@@ -37,2 +42,28 @@ row.source = mendelifyRequireTransform(row.file, row.source, variations); | ||
function avoidMendelify(file) { | ||
var isExternal = file === false; | ||
var isNodeModule = -1 !== (file||'').indexOf("node_modules"); | ||
return isExternal || isNodeModule; | ||
} | ||
function depsValue(path, variations, expose) { | ||
var exposedModule = exposeKey(expose, path); | ||
if (exposedModule) { | ||
return exposedModule; | ||
} | ||
return variationMatches(variations, path).file; | ||
} | ||
function exposeKey(expose, file) { | ||
var exposedModule = false; | ||
Object.keys(expose).forEach(function(key) { | ||
var value = expose[key]; | ||
if (file === value) { | ||
exposedModule = key; | ||
} | ||
}); | ||
return exposedModule; | ||
} | ||
module.exports = mendelifyTransformStream; |
{ | ||
"name": "mendel-development", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Mendel shared dependencies for build and development", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8374
230