MCPcopy
hub / github.com/webpack/webpack / createReportBar

Function createReportBar

lib/ProgressPlugin.js:133–145  ·  view source on GitHub ↗
(name, color)

Source from the content-addressed store, hash-verified

131 * @returns {(percentage: number) => string} bar renderer
132 */
133const createReportBar = (name, color) => {
134 const c = getColors();
135
136 return (percentage) => {
137 const w = Math.round(percentage * BAR_LENGTH);
138 const filled = BLOCK_CHAR.repeat(w);
139 const empty = BLOCK_CHAR.repeat(BAR_LENGTH - w);
140 const colorFn =
141 color in c ? c[/** @type {keyof Colors} */ (color)] : c.green;
142
143 return `${[BULLET_ICON, name, filled].map(colorFn).join(" ")}${c.white(empty)}`;
144 };
145};
146
147/** @typedef {Required<Exclude<NonNullable<ProgressPluginOptions["progressBar"]>, boolean>>} ProgressBarOptions */
148

Callers 1

defaultHandlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected