MCPcopy Create free account
hub / github.com/nodejs/node / Display

Class Display

deps/npm/lib/utils/display.js:149–444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149class Display {
150 #logState = {
151 buffering: true,
152 buffer: [],
153 }
154
155 #outputState = {
156 buffering: true,
157 buffer: [],
158 }
159
160 // colors
161 #noColorChalk
162 #stdoutChalk
163 #stdoutColor
164 #stderrChalk
165 #stderrColor
166 #logColors
167
168 // progress
169 #progress
170
171 // options
172 #command
173 #levelIndex
174 #timing
175 #json
176 #heading
177 #silent
178
179 // display streams
180 #stdout
181 #stderr
182
183 #seenNotices = new Set()
184
185 constructor ({ stdout, stderr }) {
186 this.#stdout = setBlocking(stdout)
187 this.#stderr = setBlocking(stderr)
188
189 // Handlers are set immediately so they can buffer all events
190 process.on('log', this.#logHandler)
191 process.on('output', this.#outputHandler)
192 process.on('input', this.#inputHandler)
193 this.#progress = new Progress({ stream: stderr })
194 }
195
196 off () {
197 process.off('log', this.#logHandler)
198 this.#logState.buffer.length = 0
199 process.off('output', this.#outputHandler)
200 this.#outputState.buffer.length = 0
201 process.off('input', this.#inputHandler)
202 this.#progress.off()
203 this.#seenNotices.clear()
204 }
205
206 get chalk () {

Callers

nothing calls this directly

Calls 15

#tryWriteLogMethod · 0.95
#writeOutputMethod · 0.95
withMetaFunction · 0.85
getJsonBufferFunction · 0.85
includesMethod · 0.80
forEachMethod · 0.65
pauseMethod · 0.65
resumeMethod · 0.65
flushMethod · 0.65
pFunction · 0.50
pushMethod · 0.45
offMethod · 0.45

Tested by

no test coverage detected