* Adds the given module as a sub module to this module. * * If the module is an instanceof ModuleInfo, its name is added to submodules, * its dependencies become dependencies of this module (if they are not already * included as submodules). If the included module has calculated (dynamic)
( other )
| 155 | * @param {string | ModuleInfo} other Module to include into this module |
| 156 | */ |
| 157 | addSubModule( other ) { |
| 158 | if ( other instanceof ModuleInfo ) { |
| 159 | this.addSubModule( other.name ); |
| 160 | // accumulate dependencies |
| 161 | for ( const dep of Object.keys(other._dependencies ) ) { |
| 162 | this._addDependency(dep, other._dependencies[dep]); |
| 163 | } |
| 164 | // inherit dynamic dependencies |
| 165 | if ( other.dynamicDependencies ) { |
| 166 | this.dynamicDependencies = true; |
| 167 | } |
| 168 | } else { |
| 169 | this.subModules.push( other ); |
| 170 | // when a module is added as submodule, it no longer is a dependency |
| 171 | delete this._dependencies[other]; |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | isConditionalDependency(dependency) { |
| 176 | return this._dependencies[dependency] === CONDITIONAL; |
no test coverage detected