MCPcopy Create free account
hub / github.com/SAP/ui5-builder / visitNode

Function visitNode

lib/lbt/graph/dependencyGraph.js:28–48  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

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("");

Callers 1

createDependencyGraphFunction · 0.85

Calls 5

resolveMethod · 0.80
getModuleInfoMethod · 0.80
addMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected