MCPcopy
hub / github.com/webpack/webpack / writeStatusMessage

Function writeStatusMessage

lib/node/nodeConsole.js:101–127  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

99 };
100
101 const writeStatusMessage = () => {
102 const column = stream.columns || 40;
103 /** @type {string[]} */
104 const all = [];
105
106 for (const state of logStatusStates) {
107 if (!state.currentMessage) continue;
108 /** @type {string[][]} */
109 const lines = [[]];
110 for (const item of state.currentMessage) {
111 const parts = item.split("\n");
112 lines[lines.length - 1].push(parts[0]);
113 for (let i = 1; i < parts.length; i++) {
114 lines.push([parts[i]]);
115 }
116 }
117 const truncateLines = lines.map((args) =>
118 truncateArgs(args, column - 1).join(" ")
119 );
120 state.currentLines = truncateLines.length;
121 for (const line of truncateLines) all.push(line);
122 }
123 if (all.length === 0) return;
124
125 const coloredLines = all.map((str) => c.bold(str));
126 stream.write(`${CLEAR_LINE}${coloredLines.join(`\n${CLEAR_LINE}`)}`);
127 };
128
129 /**
130 * @param {EXPECTED_ANY[]} statusMessage status message

Callers 3

setStatusMessageFunction · 0.85
writeColoredFunction · 0.85
nodeConsole.jsFile · 0.85

Calls 4

truncateArgsFunction · 0.85
splitMethod · 0.80
writeMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected