UNPKG

644 Btext/coffeescriptView Raw
1Container = require './container'
2findModule = require('./find-module').instance
3findPath = require('./find-module').path
4populateDi = require('./populate-di')(findModule)
5addParent = require('./add-parent')(findModule, populateDi)
6getConfPaths = require('./get-conf-paths')(findPath, findModule)
7cc = require('./clear-cache')
8
9getPath = (o) -> o.path
10
11module.exports = (opts) ->
12 { config, baseDir, annotations, clearCache } = opts
13
14 cc(getConfPaths(baseDir, config).map(getPath)) if clearCache
15
16 di = new Container(annotations)
17 config.parents?.forEach (p) ->
18 addParent di, baseDir, p, []
19 populateDi di, baseDir, config.modules, []