Spaces:
Running
Running
Download node_modules/@vue/cli-shared-utils/lib/spinner.js from k-l-lambda/lotus: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/spaces/k-l-lambda/lotus/resolve/main/node_modules/%40vue/cli-shared-utils/lib/spinner.js
- Command line
-
hf download hf://spaces/k-l-lambda/lotus/node_modules/@vue/cli-shared-utils/lib/spinner.js
-
curl -L -o spinner.js https://huggingface.co/spaces/k-l-lambda/lotus/resolve/main/node_modules/%40vue/cli-shared-utils/lib/spinner.js
1.12 kB
| const ora = require('ora') | |
| const chalk = require('chalk') | |
| const spinner = ora() | |
| let lastMsg = null | |
| let isPaused = false | |
| exports.logWithSpinner = (symbol, msg) => { | |
| if (!msg) { | |
| msg = symbol | |
| symbol = chalk.green('✔') | |
| } | |
| if (lastMsg) { | |
| spinner.stopAndPersist({ | |
| symbol: lastMsg.symbol, | |
| text: lastMsg.text | |
| }) | |
| } | |
| spinner.text = ' ' + msg | |
| lastMsg = { | |
| symbol: symbol + ' ', | |
| text: msg | |
| } | |
| spinner.start() | |
| } | |
| exports.stopSpinner = (persist) => { | |
| if (!spinner.isSpinning) { | |
| return | |
| } | |
| if (lastMsg && persist !== false) { | |
| spinner.stopAndPersist({ | |
| symbol: lastMsg.symbol, | |
| text: lastMsg.text | |
| }) | |
| } else { | |
| spinner.stop() | |
| } | |
| lastMsg = null | |
| } | |
| exports.pauseSpinner = () => { | |
| if (spinner.isSpinning) { | |
| spinner.stop() | |
| isPaused = true | |
| } | |
| } | |
| exports.resumeSpinner = () => { | |
| if (isPaused) { | |
| spinner.start() | |
| isPaused = false | |
| } | |
| } | |
| exports.failSpinner = (text) => { | |
| spinner.fail(text) | |
| } | |
| // silent all logs except errors during tests and keep record | |
| if (process.env.VUE_CLI_TEST) { | |
| require('./_silence')('spinner', exports) | |
| } | |