Class: DependencyBuilder

DependencyBuilder

new DependencyBuilder(configParser)

Creates an instance of DependencyBuilder class.
Parameters:
Name Type Description
configParser object instance of ConfigParser object.
Source:

Members

<protected> _queue

Properties:
Name Type Description
_queue array List of modules, which dependencies should be resolved. Initially, it is copy of the array of modules, passed for resolving; during the process more modules may be added to the queue. For example, these might be conditional modules.
Default Value:
  • []
Source:

Methods

<protected> _cleanup()

Clears the used resources during the process of resolving dependencies.
Source:

<protected> _processConditionalModules(module)

Processes conditional modules. If a module has conditional module as dependency, this module will be added to the list of modules, which dependencies should be resolved.
Parameters:
Name Type Description
module object Module, which will be checked for conditional modules as dependencies.
Source:

<protected> _resolveDependencies()

Processes all modules in the DependencyBuilder#_queue and resolves their dependencies. The function implements standard topological sorting based on depth-first search.
Source:

_testConditionalModule(testFunction) → {boolean}

Executes the test function of an conditional module and adds it to the list of module dependencies if the function returns true.
Parameters:
Name Type Description
testFunction function | string The function which have to be executed. May be Function object or string.
Source:
Returns:
The result of the execution of the test function.
Type
boolean

<protected> _visit(module)

Visits a module during the process of resolving dependencies. The function will throw exception in case of circular dependencies among modules.
Parameters:
Name Type Description
module object The module which have to be visited.
Source:

resolveDependencies(modules) → {array}

Resolves modules dependencies.
Parameters:
Name Type Description
modules array List of modules which dependencies should be resolved.
Source:
Returns:
List of module names, representing module dependencies. Module name itself is being returned too.
Type
array