* Copies outgoing module connections. * @param {Module} oldModule the old referencing module * @param {Module} newModule the new referencing module * @param {FilterConnection} filterConnection filter predicate for replacement * @returns {void}
(oldModule, newModule, filterConnection)
| 496 | * @returns {void} |
| 497 | */ |
| 498 | copyOutgoingModuleConnections(oldModule, newModule, filterConnection) { |
| 499 | if (oldModule === newModule) return; |
| 500 | const oldMgm = this._getModuleGraphModule(oldModule); |
| 501 | const newMgm = this._getModuleGraphModule(newModule); |
| 502 | // Outgoing connections |
| 503 | const oldConnections = oldMgm.outgoingConnections; |
| 504 | if (oldConnections !== undefined) { |
| 505 | if (newMgm.outgoingConnections === undefined) { |
| 506 | newMgm.outgoingConnections = new SortableSet(); |
| 507 | } |
| 508 | const newConnections = newMgm.outgoingConnections; |
| 509 | for (const connection of oldConnections) { |
| 510 | if (filterConnection(connection)) { |
| 511 | const newConnection = connection.clone(); |
| 512 | newConnection.originModule = newModule; |
| 513 | newConnections.add(newConnection); |
| 514 | if (newConnection.module !== undefined) { |
| 515 | const otherMgm = this._getModuleGraphModule(newConnection.module); |
| 516 | otherMgm.incomingConnections.add(newConnection); |
| 517 | } |
| 518 | } |
| 519 | } |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | /** |
| 524 | * Adds the provided module to the module graph. |
no test coverage detected