bimba-cli 0.4.1 → 0.4.3
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/index.js +3 -1
- package/package.json +1 -1
- package/plugin.js +2 -1
- package/serve.js +22 -23
package/index.js
CHANGED
|
@@ -21,6 +21,7 @@ try {
|
|
|
21
21
|
help: { type: 'boolean' },
|
|
22
22
|
clearcache: { type: 'boolean' },
|
|
23
23
|
minify: { type: 'boolean' },
|
|
24
|
+
splitting: { type: 'boolean' },
|
|
24
25
|
target: { type: 'string' },
|
|
25
26
|
sourcemap: { type: 'string' },
|
|
26
27
|
serve: { type: 'boolean' },
|
|
@@ -143,7 +144,8 @@ async function bundle() {
|
|
|
143
144
|
outdir: flags.outdir,
|
|
144
145
|
target: flags.target || 'browser',
|
|
145
146
|
sourcemap: flags.sourcemap || 'none',
|
|
146
|
-
minify:
|
|
147
|
+
minify: true,
|
|
148
|
+
splitting: flags.splitting || false,
|
|
147
149
|
plugins: [imbaPlugin]
|
|
148
150
|
});
|
|
149
151
|
|
package/package.json
CHANGED
package/plugin.js
CHANGED
package/serve.js
CHANGED
|
@@ -187,6 +187,7 @@ export function serve(entrypoint, flags) {
|
|
|
187
187
|
let _lastLines = 0
|
|
188
188
|
let _fadeTimers = []
|
|
189
189
|
let _fadeId = 0
|
|
190
|
+
let _cursorOnLine = false
|
|
190
191
|
|
|
191
192
|
function cancelFade() {
|
|
192
193
|
_fadeTimers.forEach(t => clearTimeout(t))
|
|
@@ -195,45 +196,43 @@ export function serve(entrypoint, flags) {
|
|
|
195
196
|
|
|
196
197
|
function printStatus(file, state, errors) {
|
|
197
198
|
cancelFade()
|
|
198
|
-
if (
|
|
199
|
+
if (_cursorOnLine) {
|
|
200
|
+
process.stdout.write('\x1b[1G\x1b[J')
|
|
201
|
+
_lastLines = 0
|
|
202
|
+
_cursorOnLine = false
|
|
203
|
+
} else if (_lastLines > 0) {
|
|
199
204
|
process.stdout.write(`\x1b[${_lastLines}A\x1b[J`)
|
|
200
205
|
_lastLines = 0
|
|
201
206
|
}
|
|
202
207
|
const now = new Date().toLocaleTimeString('ru-RU', { hour: '2-digit', minute: '2-digit', second: '2-digit' })
|
|
203
208
|
const status = state === 'ok' ? theme.success(' ok ') : theme.failure(' fail ')
|
|
204
|
-
process.stdout.write(` ${theme.folder(now)} ${theme.filename(file)} ${status}\n`)
|
|
205
|
-
_lastLines = 1
|
|
206
209
|
if (errors?.length) {
|
|
210
|
+
process.stdout.write(` ${theme.folder(now)} ${theme.filename(file)} ${status}\n`)
|
|
211
|
+
_lastLines = 1
|
|
207
212
|
for (const err of errors) {
|
|
208
213
|
printerr(err)
|
|
209
214
|
_lastLines += 5
|
|
210
215
|
}
|
|
211
216
|
} else {
|
|
212
217
|
const myId = ++_fadeId
|
|
213
|
-
const
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
].map(([delay, col]) => [delay, col !== null
|
|
224
|
-
? ` ${c(now, col)} ${c(file, col)} ${c('ok', col)}`
|
|
225
|
-
: null
|
|
226
|
-
])
|
|
227
|
-
for (const [delay, line] of steps) {
|
|
218
|
+
const plainLine = ` ${now} ${file} ok `
|
|
219
|
+
const totalLen = plainLine.length
|
|
220
|
+
const startDelay = 5000
|
|
221
|
+
const charDelay = 22
|
|
222
|
+
|
|
223
|
+
process.stdout.write(` ${theme.folder(now)} ${theme.filename(file)} ${status}`)
|
|
224
|
+
_lastLines = 1
|
|
225
|
+
_cursorOnLine = true
|
|
226
|
+
|
|
227
|
+
for (let i = 1; i <= totalLen; i++) {
|
|
228
228
|
_fadeTimers.push(setTimeout(() => {
|
|
229
229
|
if (_fadeId !== myId || _lastLines !== 1) return
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
} else {
|
|
233
|
-
process.stdout.write(`\x1b[1A\x1b[2K`)
|
|
230
|
+
process.stdout.write('\x1b[1D\x1b[K')
|
|
231
|
+
if (i === totalLen) {
|
|
234
232
|
_lastLines = 0
|
|
233
|
+
_cursorOnLine = false
|
|
235
234
|
}
|
|
236
|
-
},
|
|
235
|
+
}, startDelay + i * charDelay))
|
|
237
236
|
}
|
|
238
237
|
}
|
|
239
238
|
}
|