* @private * @returns {void}
()
| 1639 | * @returns {void} |
| 1640 | */ |
| 1641 | setupProgressPlugin() { |
| 1642 | const { ProgressPlugin } = |
| 1643 | /** @type {MultiCompiler} */ |
| 1644 | (this.compiler).compilers |
| 1645 | ? /** @type {MultiCompiler} */ (this.compiler).compilers[0].webpack |
| 1646 | : /** @type {Compiler} */ (this.compiler).webpack; |
| 1647 | |
| 1648 | new ProgressPlugin( |
| 1649 | /** |
| 1650 | * @param {number} percent percent |
| 1651 | * @param {string} msg message |
| 1652 | * @param {string} addInfo extra information |
| 1653 | * @param {string} pluginName plugin name |
| 1654 | */ |
| 1655 | (percent, msg, addInfo, pluginName) => { |
| 1656 | percent = Math.floor(percent * 100); |
| 1657 | |
| 1658 | if (percent === 100) { |
| 1659 | msg = "Compilation completed"; |
| 1660 | } |
| 1661 | |
| 1662 | if (addInfo) { |
| 1663 | msg = `${msg} (${addInfo})`; |
| 1664 | } |
| 1665 | |
| 1666 | if (this.webSocketServer) { |
| 1667 | this.sendMessage(this.webSocketServer.clients, "progress-update", { |
| 1668 | percent, |
| 1669 | msg, |
| 1670 | pluginName, |
| 1671 | }); |
| 1672 | } |
| 1673 | |
| 1674 | if (this.server) { |
| 1675 | this.server.emit("progress-update", { percent, msg, pluginName }); |
| 1676 | } |
| 1677 | }, |
| 1678 | ).apply(/** @type {Compiler | MultiCompiler} */ (this.compiler)); |
| 1679 | } |
| 1680 | |
| 1681 | /** |
| 1682 | * @private |
no test coverage detected