* Move the target forward as long resolveTargetFilter is fulfilled * @param {ModuleGraph} moduleGraph the module graph * @param {ResolveTargetFilter} resolveTargetFilter filter function to further resolve target * @param {((target: TargetItemWithConnection) => ModuleGraphConnection | undefined
(moduleGraph, resolveTargetFilter, updateOriginalConnection)
| 1753 | * @returns {TargetItemWithConnection | undefined} the resolved target when moved |
| 1754 | */ |
| 1755 | moveTarget(moduleGraph, resolveTargetFilter, updateOriginalConnection) { |
| 1756 | const target = this._getTarget(moduleGraph, resolveTargetFilter, undefined); |
| 1757 | if (target === CIRCULAR) return; |
| 1758 | if (!target) return; |
| 1759 | const originalTarget = |
| 1760 | /** @type {TargetItem} */ |
| 1761 | ( |
| 1762 | /** @type {Target} */ |
| 1763 | (this._getMaxTarget()).values().next().value |
| 1764 | ); |
| 1765 | if ( |
| 1766 | originalTarget.connection === target.connection && |
| 1767 | originalTarget.export === target.export |
| 1768 | ) { |
| 1769 | return; |
| 1770 | } |
| 1771 | /** @type {Target} */ |
| 1772 | (this._target).clear(); |
| 1773 | /** @type {Target} */ |
| 1774 | (this._target).set(undefined, { |
| 1775 | connection: updateOriginalConnection |
| 1776 | ? updateOriginalConnection(target) || target.connection |
| 1777 | : target.connection, |
| 1778 | export: /** @type {NonNullable<TargetItemWithConnection["export"]>} */ ( |
| 1779 | target.export |
| 1780 | ), |
| 1781 | priority: 0 |
| 1782 | }); |
| 1783 | return target; |
| 1784 | } |
| 1785 | |
| 1786 | /** |
| 1787 | * Creates a nested exports info. |
no test coverage detected