Comparing version 0.3.0-beta-11 to 0.3.0-beta-12
// Generated by CoffeeScript 1.9.3 | ||
var Container, clearCache, evaluateType, getFullPath, getPath, isRelative; | ||
var Container, clearCache, evaluateType, getFullPath, getPath, isRelative, populateContainer; | ||
@@ -51,14 +51,7 @@ Container = require('./container'); | ||
module.exports = function(options) { | ||
var basePath, config, di, modules, opts, parents; | ||
config = options.config, basePath = options.basePath, opts = options.opts, parents = options.parents; | ||
if (config == null) { | ||
throw new TypeError('No configuration was provided for loadConfig'); | ||
} | ||
di = new Container(opts, parents); | ||
modules = config.modules || {}; | ||
if ((options != null ? options.clearCache : void 0) === true) { | ||
populateContainer = function(di, modules, basePath) { | ||
if ((typeof options !== "undefined" && options !== null ? options.clearCache : void 0) === true) { | ||
clearCache(modules, basePath); | ||
} | ||
Object.keys(modules).forEach(function(key) { | ||
return Object.keys(modules).forEach(function(key) { | ||
var e, fullPath, module, moduleConfig, path, type; | ||
@@ -81,3 +74,20 @@ moduleConfig = modules[key]; | ||
}); | ||
}; | ||
module.exports = function(options) { | ||
var basePath, config, configParents, di, modules, opts, parents; | ||
config = options.config, basePath = options.basePath, opts = options.opts, parents = options.parents; | ||
if (config == null) { | ||
throw new TypeError('No configuration was provided for loadConfig'); | ||
} | ||
di = new Container(opts, parents); | ||
modules = config.modules || {}; | ||
configParents = config.parents || []; | ||
configParents.forEach(function(p) { | ||
var parentModules; | ||
parentModules = require([p.nodeModule, p.configFile].join('/')); | ||
return populateContainer(di, parentModules.modules, p.nodeModule); | ||
}); | ||
populateContainer(di, modules, basePath); | ||
return di; | ||
}; |
@@ -12,3 +12,3 @@ // Generated by CoffeeScript 1.9.3 | ||
this.caller = caller; | ||
this.message = 'Could not find any module with name ' + module; | ||
this.message = 'Could not find any module with name ' + this.module; | ||
if (this.caller != null) { | ||
@@ -15,0 +15,0 @@ this.message = this.message + ', required from module ' + this.caller; |
{ | ||
"name": "amend", | ||
"version": "0.3.0-beta-11", | ||
"version": "0.3.0-beta-12", | ||
"description": "Dependency injection module and IoC container.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
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
25454
380
5