MCPcopy Index your code
hub / github.com/webpack/webpack-dev-server / logStatus

Method logStatus

lib/Server.js:2794–3014  ·  view source on GitHub ↗

* @private * @returns {Promise }

()

Source from the content-addressed store, hash-verified

2792 * @returns {Promise<void>}
2793 */
2794 async logStatus() {
2795 const {
2796 isColorSupported,
2797 colors: { cyan, red },
2798 } = this.#getColors();
2799
2800 /**
2801 * @param {Compiler["options"]} compilerOptions compiler options
2802 * @returns {boolean} value of the color option
2803 */
2804 const getColorsOption = (compilerOptions) => {
2805 /**
2806 * @type {boolean}
2807 */
2808 let colorsEnabled;
2809
2810 if (
2811 compilerOptions.stats &&
2812 typeof (/** @type {StatsOptions} */ (compilerOptions.stats).colors) !==
2813 "undefined"
2814 ) {
2815 colorsEnabled =
2816 /** @type {boolean} */
2817 (/** @type {StatsOptions} */ (compilerOptions.stats).colors);
2818 } else {
2819 colorsEnabled = isColorSupported();
2820 }
2821
2822 return colorsEnabled;
2823 };
2824
2825 const colors = {
2826 /**
2827 * @param {boolean} useColor need to use color?
2828 * @param {string} msg message
2829 * @returns {string} message with color
2830 */
2831 info(useColor, msg) {
2832 if (useColor) {
2833 return cyan(msg);
2834 }
2835
2836 return msg;
2837 },
2838 /**
2839 * @param {boolean} useColor need to use color?
2840 * @param {string} msg message
2841 * @returns {string} message with colors
2842 */
2843 error(useColor, msg) {
2844 if (useColor) {
2845 return red(msg);
2846 }
2847
2848 return msg;
2849 },
2850 };
2851 const useColor = getColorsOption(this.getCompilerOptions());

Callers 1

listenMethod · 0.95

Calls 5

#getColorsMethod · 0.95
getCompilerOptionsMethod · 0.95
openBrowserMethod · 0.95
infoMethod · 0.80
findIpMethod · 0.80

Tested by

no test coverage detected