(name)
| 26 | const nodes = new Map(); |
| 27 | |
| 28 | function visitNode(name) { |
| 29 | let node = nodes.get(name); |
| 30 | if ( !node ) { |
| 31 | nodes.set( name, node = new Node(name) ); |
| 32 | } else if ( node.visited ) { |
| 33 | return Promise.resolve(node); |
| 34 | } |
| 35 | |
| 36 | node.visited = true; |
| 37 | |
| 38 | return pool.getModuleInfo( name ).then( (module) => { |
| 39 | const p = module.dependencies.map( (dep) => { |
| 40 | if ( includeConditionalDependencies || !module.isConditionalDependency(dep) ) { |
| 41 | return visitNode(dep).then( (child) => child.pred.add( node ) ); |
| 42 | } |
| 43 | }); |
| 44 | return Promise.all(p); |
| 45 | }, (err) => { |
| 46 | log.error(`Module ${name} not found in pool: ${err.message}`); |
| 47 | }).then( () => node ); |
| 48 | } |
| 49 | |
| 50 | // create artificial root node and link it with roots |
| 51 | const n0 = new Node(""); |
no test coverage detected