Archived
Private
Public Access
1
0

Initial commit

This commit is contained in:
2022-09-04 12:45:01 +02:00
commit f4a01d6a69
11601 changed files with 4206660 additions and 0 deletions

15
node/TestCli/node_modules/nanospinner/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,15 @@
ISC License
Copyright 2021 Usman Yunusov <usman.iunusov@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

21
node/TestCli/node_modules/nanospinner/README.md generated vendored Normal file
View File

@@ -0,0 +1,21 @@
# Nano Spinner
The simplest and tiniest terminal spinner for Node.js
```js
import { createSpinner } from 'nanospinner'
const spinner = createSpinner('Run test').start()
setTimeout(() => {
spinner.success()
}, 1000)
```
- Only **single dependency** (picocolors).
- It **45 times** smaller than `ora`.
- Support both CJS and ESM projects.
- **TypeScript** type declarations included.
## Docs
Read **[full docs](https://github.com/usmanyunusov/nanospinner#readme)** on GitHub.

22
node/TestCli/node_modules/nanospinner/consts.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
const tty = require('tty')
const isCI =
process.env.CI ||
process.env.WT_SESSION ||
process.env.ConEmuTask === '{cmd::Cmder}' ||
process.env.TERM_PROGRAM === 'vscode' ||
process.env.TERM === 'xterm-256color' ||
process.env.TERM === 'alacritty'
const isTTY = tty.isatty(1) && process.env.TERM !== 'dumb' && !('CI' in process.env)
const supportUnicode = process.platform !== 'win32' ? process.env.TERM !== 'linux' : isCI
const symbols = {
frames: isTTY
? supportUnicode
? ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
: ['-', '\\', '|', '/']
: ['-'],
tick: supportUnicode ? '✔' : '√',
cross: supportUnicode ? '✖' : '×',
}
module.exports = { isTTY, symbols }

20
node/TestCli/node_modules/nanospinner/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
interface Options {
stream?: NodeJS.WriteStream
frames?: string[]
interval?: number
text?: string
color?: string
}
interface Spinner {
success(opts?: { text?: string; mark?: string }): Spinner
error(opts?: { text?: string; mark?: string }): Spinner
stop(opts?: { text?: string; mark?: string; color?: string }): Spinner
start(opts?: { text?: string; color?: string }): Spinner
update(opts?: Options): Spinner
reset(): Spinner
clear(): Spinner
spin(): Spinner
}
export function createSpinner(text?: string, opts?: Options): Spinner

113
node/TestCli/node_modules/nanospinner/index.js generated vendored Normal file
View File

@@ -0,0 +1,113 @@
const pico = require('picocolors')
const { isTTY, symbols } = require('./consts')
const { green, red } = pico
function getLines(str = '', width = 80) {
return str
.replace(/\u001b[^m]*?m/g, '')
.split('\n')
.reduce((col, line) => (col += Math.max(1, Math.ceil(line.length / width))), 0)
}
function createSpinner(text = '', opts = {}) {
let current = 0,
interval = opts.interval || 50,
stream = opts.stream || process.stderr,
frames = opts.frames && opts.frames.length ? opts.frames : symbols.frames,
color = opts.color || 'yellow',
lines = 0,
timer
let spinner = {
reset() {
current = 0
lines = 0
timer = clearTimeout(timer)
},
clear() {
spinner.write('\x1b[1G')
for (let i = 0; i < lines; i++) {
i > 0 && spinner.write('\x1b[1A')
spinner.write('\x1b[2K\x1b[1G')
}
lines = 0
return spinner
},
write(str, clear = false) {
if (clear && isTTY) {
spinner.clear()
}
stream.write(str)
return spinner
},
render() {
let mark = pico[color](frames[current])
let str = `${mark} ${text}`
isTTY ? spinner.write(`\x1b[?25l`) : (str += '\n')
spinner.write(str, true)
isTTY && (lines = getLines(str, stream.columns))
},
spin() {
spinner.render()
current = ++current % frames.length
return spinner
},
update(opts = {}) {
text = opts.text || text
frames = opts.frames && opts.frames.length ? opts.frames : frames
interval = opts.interval || interval
color = opts.color || color
if (frames.length - 1 < current) {
current = 0
}
return spinner
},
loop() {
isTTY && (timer = setTimeout(() => spinner.loop(), interval))
return spinner.spin()
},
start(opts = {}) {
timer && spinner.reset()
return spinner.update({ text: opts.text, color: opts.color }).loop()
},
stop(opts = {}) {
timer = clearTimeout(timer)
let mark = pico[opts.color || color](frames[current])
let optsMark = opts.mark && opts.color ? pico[opts.color](opts.mark) : opts.mark
spinner.write(`${optsMark || mark} ${opts.text || text}\n`, true)
return isTTY ? spinner.write(`\x1b[?25h`) : spinner
},
success(opts = {}) {
let mark = green(symbols.tick)
return spinner.stop({ mark, ...opts })
},
error(opts = {}) {
let mark = red(symbols.cross)
return spinner.stop({ mark, ...opts })
},
}
return spinner
}
module.exports = {
createSpinner,
}

23
node/TestCli/node_modules/nanospinner/package.json generated vendored Normal file
View File

@@ -0,0 +1,23 @@
{
"name": "nanospinner",
"version": "1.0.0",
"description": "The simplest and tiniest terminal spinner for Node.js",
"keywords": [
"cli",
"console",
"spinner",
"terminal",
"loading"
],
"author": "Usman Yunusov",
"license": "ISC",
"repository": "usmanyunusov/nanospinner",
"types": "./index.d.ts",
"main": "./index.js",
"dependencies": {
"picocolors": "^1.0.0"
},
"benchmarkDependencies": {
"ora": "^6.0.1"
}
}