bimba-cli 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/serve.js +9 -17
package/package.json
CHANGED
package/serve.js
CHANGED
|
@@ -184,10 +184,9 @@ export function serve(entrypoint, flags) {
|
|
|
184
184
|
const sockets = new Set()
|
|
185
185
|
let importMapTag = null
|
|
186
186
|
|
|
187
|
-
let _lastLines = 0
|
|
188
187
|
let _fadeTimers = []
|
|
189
188
|
let _fadeId = 0
|
|
190
|
-
let
|
|
189
|
+
let _statusSaved = false
|
|
191
190
|
|
|
192
191
|
function cancelFade() {
|
|
193
192
|
_fadeTimers.forEach(t => clearTimeout(t))
|
|
@@ -196,22 +195,18 @@ export function serve(entrypoint, flags) {
|
|
|
196
195
|
|
|
197
196
|
function printStatus(file, state, errors) {
|
|
198
197
|
cancelFade()
|
|
199
|
-
if (
|
|
200
|
-
process.stdout.write('\x1b[
|
|
201
|
-
|
|
202
|
-
_cursorOnLine = false
|
|
203
|
-
} else if (_lastLines > 0) {
|
|
204
|
-
process.stdout.write(`\x1b[${_lastLines}A\x1b[J`)
|
|
205
|
-
_lastLines = 0
|
|
198
|
+
if (_statusSaved) {
|
|
199
|
+
process.stdout.write('\x1b[u\x1b[J')
|
|
200
|
+
_statusSaved = false
|
|
206
201
|
}
|
|
207
202
|
const now = new Date().toLocaleTimeString('ru-RU', { hour: '2-digit', minute: '2-digit', second: '2-digit' })
|
|
208
203
|
const status = state === 'ok' ? theme.success(' ok ') : theme.failure(' fail ')
|
|
204
|
+
process.stdout.write('\x1b[s')
|
|
205
|
+
_statusSaved = true
|
|
209
206
|
if (errors?.length) {
|
|
210
207
|
process.stdout.write(` ${theme.folder(now)} ${theme.filename(file)} ${status}\n`)
|
|
211
|
-
_lastLines = 1
|
|
212
208
|
for (const err of errors) {
|
|
213
209
|
printerr(err)
|
|
214
|
-
_lastLines += 5
|
|
215
210
|
}
|
|
216
211
|
} else {
|
|
217
212
|
const myId = ++_fadeId
|
|
@@ -221,16 +216,13 @@ export function serve(entrypoint, flags) {
|
|
|
221
216
|
const charDelay = 22
|
|
222
217
|
|
|
223
218
|
process.stdout.write(` ${theme.folder(now)} ${theme.filename(file)} ${status}`)
|
|
224
|
-
_lastLines = 1
|
|
225
|
-
_cursorOnLine = true
|
|
226
219
|
|
|
227
220
|
for (let i = 1; i <= totalLen; i++) {
|
|
228
221
|
_fadeTimers.push(setTimeout(() => {
|
|
229
|
-
if (_fadeId !== myId
|
|
230
|
-
process.stdout.write('\x1b[1D\x1b[
|
|
222
|
+
if (_fadeId !== myId) return
|
|
223
|
+
process.stdout.write('\x1b[1D \x1b[1D')
|
|
231
224
|
if (i === totalLen) {
|
|
232
|
-
|
|
233
|
-
_cursorOnLine = false
|
|
225
|
+
_statusSaved = false
|
|
234
226
|
}
|
|
235
227
|
}, startDelay + i * charDelay))
|
|
236
228
|
}
|