Comparing version 0.3.0-beta-13 to 0.3.0-beta-14
@@ -0,1 +1,4 @@ | ||
var R = require('ramda') | ||
var normalize = require('path').normalize; | ||
function isLocal(path) { | ||
@@ -13,3 +16,3 @@ return path[0] === '.'; | ||
module.exports = function(b, opts) { | ||
function addAmendModule(b, opts, nodeModule) { | ||
function shouldInclude(key, path) { | ||
@@ -23,9 +26,32 @@ var includeExternal = opts.includeExternal || []; | ||
var bundleExternal = opts.bundleExternal !== false; | ||
var modules = opts.modules; | ||
var modules = opts.config.modules; | ||
var parents = opts.config.parents || []; | ||
parents.forEach(function(p) { | ||
addParent(b, opts, p); | ||
}) | ||
Object.keys(modules).forEach(function(key) { | ||
var path = getRequrePath(modules[key]); | ||
if (shouldInclude(key, path)) { | ||
b.require(path); | ||
var modulePath = getRequrePath(modules[key]); | ||
if (shouldInclude(key, modulePath)) { | ||
if (nodeModule) { | ||
modulePath = normalize([ nodeModule, modulePath ].join('/')) | ||
} | ||
b.require(modulePath); | ||
} | ||
}); | ||
} | ||
function addParent(b, opts, parentConf) { | ||
var base = process.cwd(); | ||
var configFilePath = [ parentConf.nodeModule, parentConf.configFile ].join('/'); | ||
var p = require(configFilePath); | ||
var parentOpts = R.assoc('config', p, opts) | ||
b.require(configFilePath) | ||
addAmendModule(b, parentOpts, parentConf.nodeModule) | ||
} | ||
module.exports = function(b, opts) { | ||
addAmendModule(b, opts) | ||
}; | ||
// Generated by CoffeeScript 1.10.0 | ||
var Container, clearCache, evaluateType, getFullPath, getPath, isRelative, populateContainer; | ||
var Container, clearCache, evaluateType, getFullPath, getPath, isRelative, joinPaths, normalize, populateContainer; | ||
Container = require('./container'); | ||
normalize = require('path').normalize; | ||
isRelative = function(path) { | ||
@@ -10,9 +12,17 @@ return path.indexOf('.') === 0; | ||
joinPaths = function(arr) { | ||
return arr.join('/'); | ||
}; | ||
getFullPath = function(path, basePath) { | ||
if (typeof window !== "undefined" && window !== null) { | ||
return path; | ||
if (isRelative(path) && basePath !== '') { | ||
return normalize(joinPaths([basePath, path])); | ||
} else { | ||
return path; | ||
} | ||
} else if (isRelative(path)) { | ||
return [basePath, path].join('/'); | ||
return joinPaths([basePath, path]); | ||
} else { | ||
return [basePath, 'node_modules', path].join('/'); | ||
return joinPaths([basePath, 'node_modules', path]); | ||
} | ||
@@ -87,3 +97,3 @@ }; | ||
var parentModules; | ||
parentModules = require([p.nodeModule, p.configFile].join('/')); | ||
parentModules = require(joinPaths([p.nodeModule, p.configFile])); | ||
return populateContainer(di, parentModules.modules, p.nodeModule); | ||
@@ -90,0 +100,0 @@ }); |
{ | ||
"name": "amend", | ||
"version": "0.3.0-beta-13", | ||
"version": "0.3.0-beta-14", | ||
"description": "Dependency injection module and IoC container.", | ||
@@ -38,3 +38,6 @@ "main": "index.js", | ||
"author": "Ludwig Magnusson", | ||
"license": "ISC" | ||
"license": "ISC", | ||
"dependencies": { | ||
"ramda": "^0.17.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
26609
408
1
6
+ Addedramda@^0.17.1
+ Addedramda@0.17.1(transitive)