({
command,
heading,
json,
loglevel,
progress,
stderrColor,
stdoutColor,
timing,
unicode,
})
| 212 | } |
| 213 | |
| 214 | async load ({ |
| 215 | command, |
| 216 | heading, |
| 217 | json, |
| 218 | loglevel, |
| 219 | progress, |
| 220 | stderrColor, |
| 221 | stdoutColor, |
| 222 | timing, |
| 223 | unicode, |
| 224 | }) { |
| 225 | const [{ Chalk }, { createSupportsColor }] = await Promise.all([ |
| 226 | import('chalk'), |
| 227 | import('supports-color'), |
| 228 | ]) |
| 229 | // We get the chalk level based on a null stream, meaning chalk will only use what it knows about the environment to get color support since we already determined in our definitions that we want to show colors. |
| 230 | const level = Math.max(createSupportsColor(null).level, 1) |
| 231 | this.#noColorChalk = new Chalk({ level: 0 }) |
| 232 | this.#stdoutColor = stdoutColor |
| 233 | this.#stdoutChalk = stdoutColor ? new Chalk({ level }) : this.#noColorChalk |
| 234 | this.#stderrColor = stderrColor |
| 235 | this.#stderrChalk = stderrColor ? new Chalk({ level }) : this.#noColorChalk |
| 236 | this.#logColors = COLOR_PALETTE({ chalk: this.#stderrChalk }) |
| 237 | |
| 238 | this.#command = command |
| 239 | this.#levelIndex = LEVEL_OPTIONS[loglevel].index |
| 240 | this.#timing = timing |
| 241 | this.#json = json |
| 242 | this.#heading = heading |
| 243 | this.#silent = this.#levelIndex <= 0 |
| 244 | |
| 245 | // Emit resume event on the logs which will flush output |
| 246 | log.resume() |
| 247 | output.flush() |
| 248 | this.#progress.load({ |
| 249 | unicode, |
| 250 | enabled: !!progress && !this.#silent, |
| 251 | }) |
| 252 | } |
| 253 | |
| 254 | // STREAM WRITES |
| 255 |
nothing calls this directly
no test coverage detected