Initial commit
This commit is contained in:
7
node_modules/ansi-escape-sequences/.travis.yml
generated
vendored
Normal file
7
node_modules/ansi-escape-sequences/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 4
|
||||
- 6
|
||||
- 8
|
||||
- 10
|
||||
- 11
|
||||
21
node_modules/ansi-escape-sequences/LICENSE
generated
vendored
Normal file
21
node_modules/ansi-escape-sequences/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-19 Lloyd Brookes <75pound@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
47
node_modules/ansi-escape-sequences/README.hbs
generated
vendored
Normal file
47
node_modules/ansi-escape-sequences/README.hbs
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
[](https://www.npmjs.org/package/ansi-escape-sequences)
|
||||
[](https://www.npmjs.org/package/ansi-escape-sequences)
|
||||
[](https://travis-ci.org/75lb/ansi-escape-sequences)
|
||||
[](https://david-dm.org/75lb/ansi-escape-sequences)
|
||||
[](https://github.com/feross/standard)
|
||||
|
||||
# ansi-escape-sequences
|
||||
A simple library containing all known terminal [ansi escape codes and sequences](http://en.wikipedia.org/wiki/ANSI_escape_code). Useful for adding colour to your command-line output, or building a dynamic text user interface.
|
||||
|
||||
## API Reference
|
||||
{{#module name="ansi-escape-sequences"}}
|
||||
{{>body~}}
|
||||
{{>member-index~}}
|
||||
{{>members~}}
|
||||
{{/module}}
|
||||
|
||||
## Load anywhere
|
||||
|
||||
This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
|
||||
|
||||
Node.js:
|
||||
|
||||
```js
|
||||
const ansi = require('ansi-escape-sequences')
|
||||
```
|
||||
|
||||
Within Node.js with ECMAScript Module support enabled:
|
||||
|
||||
```js
|
||||
import ansi from 'ansi-escape-sequences'
|
||||
```
|
||||
|
||||
Within a modern browser ECMAScript Module:
|
||||
|
||||
```js
|
||||
import ansi from './node_modules/ansi-escape-sequences/dist/index.mjs'
|
||||
```
|
||||
|
||||
Old browser (adds `window.ansi`):
|
||||
|
||||
```html
|
||||
<script nomodule src="./node_modules/ansi-escape-sequences/dist/index.js"></script>
|
||||
```
|
||||
|
||||
* * *
|
||||
|
||||
© 2014-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
|
||||
310
node_modules/ansi-escape-sequences/README.md
generated
vendored
Normal file
310
node_modules/ansi-escape-sequences/README.md
generated
vendored
Normal file
@@ -0,0 +1,310 @@
|
||||
[](https://www.npmjs.org/package/ansi-escape-sequences)
|
||||
[](https://www.npmjs.org/package/ansi-escape-sequences)
|
||||
[](https://travis-ci.org/75lb/ansi-escape-sequences)
|
||||
[](https://david-dm.org/75lb/ansi-escape-sequences)
|
||||
[](https://github.com/feross/standard)
|
||||
|
||||
# ansi-escape-sequences
|
||||
A simple library containing all known terminal [ansi escape codes and sequences](http://en.wikipedia.org/wiki/ANSI_escape_code). Useful for adding colour to your command-line output, or building a dynamic text user interface.
|
||||
|
||||
## API Reference
|
||||
**Example**
|
||||
```js
|
||||
const ansi = require('ansi-escape-sequences')
|
||||
```
|
||||
|
||||
* [ansi-escape-sequences](#module_ansi-escape-sequences)
|
||||
* [.cursor](#module_ansi-escape-sequences.cursor)
|
||||
* [.hide](#module_ansi-escape-sequences.cursor.hide)
|
||||
* [.show](#module_ansi-escape-sequences.cursor.show)
|
||||
* [.up([lines])](#module_ansi-escape-sequences.cursor.up) ⇒ <code>string</code>
|
||||
* [.down([lines])](#module_ansi-escape-sequences.cursor.down) ⇒ <code>string</code>
|
||||
* [.forward([lines])](#module_ansi-escape-sequences.cursor.forward) ⇒ <code>string</code>
|
||||
* [.back([lines])](#module_ansi-escape-sequences.cursor.back) ⇒ <code>string</code>
|
||||
* [.nextLine([lines])](#module_ansi-escape-sequences.cursor.nextLine) ⇒ <code>string</code>
|
||||
* [.previousLine([lines])](#module_ansi-escape-sequences.cursor.previousLine) ⇒ <code>string</code>
|
||||
* [.horizontalAbsolute(n)](#module_ansi-escape-sequences.cursor.horizontalAbsolute) ⇒ <code>string</code>
|
||||
* [.position(n, m)](#module_ansi-escape-sequences.cursor.position) ⇒ <code>string</code>
|
||||
* [.erase](#module_ansi-escape-sequences.erase)
|
||||
* [.display(n)](#module_ansi-escape-sequences.erase.display) ⇒ <code>string</code>
|
||||
* [.inLine(n)](#module_ansi-escape-sequences.erase.inLine) ⇒ <code>string</code>
|
||||
* [.style](#module_ansi-escape-sequences.style) : <code>enum</code>
|
||||
* [.styles(effectArray)](#module_ansi-escape-sequences.styles) ⇒ <code>string</code>
|
||||
* [.format(str, [styleArray])](#module_ansi-escape-sequences.format) ⇒ <code>string</code>
|
||||
|
||||
<a name="module_ansi-escape-sequences.cursor"></a>
|
||||
|
||||
## ansi.cursor
|
||||
cursor-related sequences
|
||||
|
||||
**Kind**: static property of [<code>ansi-escape-sequences</code>](#module_ansi-escape-sequences)
|
||||
|
||||
* [.cursor](#module_ansi-escape-sequences.cursor)
|
||||
* [.hide](#module_ansi-escape-sequences.cursor.hide)
|
||||
* [.show](#module_ansi-escape-sequences.cursor.show)
|
||||
* [.up([lines])](#module_ansi-escape-sequences.cursor.up) ⇒ <code>string</code>
|
||||
* [.down([lines])](#module_ansi-escape-sequences.cursor.down) ⇒ <code>string</code>
|
||||
* [.forward([lines])](#module_ansi-escape-sequences.cursor.forward) ⇒ <code>string</code>
|
||||
* [.back([lines])](#module_ansi-escape-sequences.cursor.back) ⇒ <code>string</code>
|
||||
* [.nextLine([lines])](#module_ansi-escape-sequences.cursor.nextLine) ⇒ <code>string</code>
|
||||
* [.previousLine([lines])](#module_ansi-escape-sequences.cursor.previousLine) ⇒ <code>string</code>
|
||||
* [.horizontalAbsolute(n)](#module_ansi-escape-sequences.cursor.horizontalAbsolute) ⇒ <code>string</code>
|
||||
* [.position(n, m)](#module_ansi-escape-sequences.cursor.position) ⇒ <code>string</code>
|
||||
|
||||
<a name="module_ansi-escape-sequences.cursor.hide"></a>
|
||||
|
||||
### cursor.hide
|
||||
Hides the cursor
|
||||
|
||||
**Kind**: static property of [<code>cursor</code>](#module_ansi-escape-sequences.cursor)
|
||||
<a name="module_ansi-escape-sequences.cursor.show"></a>
|
||||
|
||||
### cursor.show
|
||||
Shows the cursor
|
||||
|
||||
**Kind**: static property of [<code>cursor</code>](#module_ansi-escape-sequences.cursor)
|
||||
<a name="module_ansi-escape-sequences.cursor.up"></a>
|
||||
|
||||
### cursor.up([lines]) ⇒ <code>string</code>
|
||||
Moves the cursor `lines` cells up. If the cursor is already at the edge of the screen, this has no effect
|
||||
|
||||
**Kind**: static method of [<code>cursor</code>](#module_ansi-escape-sequences.cursor)
|
||||
|
||||
| Param | Type | Default |
|
||||
| --- | --- | --- |
|
||||
| [lines] | <code>number</code> | <code>1</code> |
|
||||
|
||||
<a name="module_ansi-escape-sequences.cursor.down"></a>
|
||||
|
||||
### cursor.down([lines]) ⇒ <code>string</code>
|
||||
Moves the cursor `lines` cells down. If the cursor is already at the edge of the screen, this has no effect
|
||||
|
||||
**Kind**: static method of [<code>cursor</code>](#module_ansi-escape-sequences.cursor)
|
||||
|
||||
| Param | Type | Default |
|
||||
| --- | --- | --- |
|
||||
| [lines] | <code>number</code> | <code>1</code> |
|
||||
|
||||
<a name="module_ansi-escape-sequences.cursor.forward"></a>
|
||||
|
||||
### cursor.forward([lines]) ⇒ <code>string</code>
|
||||
Moves the cursor `lines` cells forward. If the cursor is already at the edge of the screen, this has no effect
|
||||
|
||||
**Kind**: static method of [<code>cursor</code>](#module_ansi-escape-sequences.cursor)
|
||||
|
||||
| Param | Type | Default |
|
||||
| --- | --- | --- |
|
||||
| [lines] | <code>number</code> | <code>1</code> |
|
||||
|
||||
<a name="module_ansi-escape-sequences.cursor.back"></a>
|
||||
|
||||
### cursor.back([lines]) ⇒ <code>string</code>
|
||||
Moves the cursor `lines` cells back. If the cursor is already at the edge of the screen, this has no effect
|
||||
|
||||
**Kind**: static method of [<code>cursor</code>](#module_ansi-escape-sequences.cursor)
|
||||
|
||||
| Param | Type | Default |
|
||||
| --- | --- | --- |
|
||||
| [lines] | <code>number</code> | <code>1</code> |
|
||||
|
||||
<a name="module_ansi-escape-sequences.cursor.nextLine"></a>
|
||||
|
||||
### cursor.nextLine([lines]) ⇒ <code>string</code>
|
||||
Moves cursor to beginning of the line n lines down.
|
||||
|
||||
**Kind**: static method of [<code>cursor</code>](#module_ansi-escape-sequences.cursor)
|
||||
|
||||
| Param | Type | Default |
|
||||
| --- | --- | --- |
|
||||
| [lines] | <code>number</code> | <code>1</code> |
|
||||
|
||||
<a name="module_ansi-escape-sequences.cursor.previousLine"></a>
|
||||
|
||||
### cursor.previousLine([lines]) ⇒ <code>string</code>
|
||||
Moves cursor to beginning of the line n lines up.
|
||||
|
||||
**Kind**: static method of [<code>cursor</code>](#module_ansi-escape-sequences.cursor)
|
||||
|
||||
| Param | Type | Default |
|
||||
| --- | --- | --- |
|
||||
| [lines] | <code>number</code> | <code>1</code> |
|
||||
|
||||
<a name="module_ansi-escape-sequences.cursor.horizontalAbsolute"></a>
|
||||
|
||||
### cursor.horizontalAbsolute(n) ⇒ <code>string</code>
|
||||
Moves the cursor to column n.
|
||||
|
||||
**Kind**: static method of [<code>cursor</code>](#module_ansi-escape-sequences.cursor)
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| n | <code>number</code> | column number |
|
||||
|
||||
<a name="module_ansi-escape-sequences.cursor.position"></a>
|
||||
|
||||
### cursor.position(n, m) ⇒ <code>string</code>
|
||||
Moves the cursor to row n, column m. The values are 1-based, and default to 1 (top left corner) if omitted.
|
||||
|
||||
**Kind**: static method of [<code>cursor</code>](#module_ansi-escape-sequences.cursor)
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| n | <code>number</code> | row number |
|
||||
| m | <code>number</code> | column number |
|
||||
|
||||
<a name="module_ansi-escape-sequences.erase"></a>
|
||||
|
||||
## ansi.erase
|
||||
erase sequences
|
||||
|
||||
**Kind**: static property of [<code>ansi-escape-sequences</code>](#module_ansi-escape-sequences)
|
||||
|
||||
* [.erase](#module_ansi-escape-sequences.erase)
|
||||
* [.display(n)](#module_ansi-escape-sequences.erase.display) ⇒ <code>string</code>
|
||||
* [.inLine(n)](#module_ansi-escape-sequences.erase.inLine) ⇒ <code>string</code>
|
||||
|
||||
<a name="module_ansi-escape-sequences.erase.display"></a>
|
||||
|
||||
### erase.display(n) ⇒ <code>string</code>
|
||||
Clears part of the screen. If n is 0 (or missing), clear from cursor to end of screen. If n is 1, clear from cursor to beginning of the screen. If n is 2, clear entire screen.
|
||||
|
||||
**Kind**: static method of [<code>erase</code>](#module_ansi-escape-sequences.erase)
|
||||
|
||||
| Param | Type |
|
||||
| --- | --- |
|
||||
| n | <code>number</code> |
|
||||
|
||||
<a name="module_ansi-escape-sequences.erase.inLine"></a>
|
||||
|
||||
### erase.inLine(n) ⇒ <code>string</code>
|
||||
Erases part of the line. If n is zero (or missing), clear from cursor to the end of the line. If n is one, clear from cursor to beginning of the line. If n is two, clear entire line. Cursor position does not change.
|
||||
|
||||
**Kind**: static method of [<code>erase</code>](#module_ansi-escape-sequences.erase)
|
||||
|
||||
| Param | Type |
|
||||
| --- | --- |
|
||||
| n | <code>number</code> |
|
||||
|
||||
<a name="module_ansi-escape-sequences.style"></a>
|
||||
|
||||
## ansi.style : <code>enum</code>
|
||||
Various formatting styles (aka Select Graphic Rendition codes).
|
||||
|
||||
**Kind**: static enum of [<code>ansi-escape-sequences</code>](#module_ansi-escape-sequences)
|
||||
**Properties**
|
||||
|
||||
| Name | Type | Default |
|
||||
| --- | --- | --- |
|
||||
| reset | <code>string</code> | <code>"\u001b[0m"</code> |
|
||||
| bold | <code>string</code> | <code>"\u001b[1m"</code> |
|
||||
| italic | <code>string</code> | <code>"\u001b[3m"</code> |
|
||||
| underline | <code>string</code> | <code>"\u001b[4m"</code> |
|
||||
| fontDefault | <code>string</code> | <code>"\u001b[10m"</code> |
|
||||
| font2 | <code>string</code> | <code>"\u001b[11m"</code> |
|
||||
| font3 | <code>string</code> | <code>"\u001b[12m"</code> |
|
||||
| font4 | <code>string</code> | <code>"\u001b[13m"</code> |
|
||||
| font5 | <code>string</code> | <code>"\u001b[14m"</code> |
|
||||
| font6 | <code>string</code> | <code>"\u001b[15m"</code> |
|
||||
| imageNegative | <code>string</code> | <code>"\u001b[7m"</code> |
|
||||
| imagePositive | <code>string</code> | <code>"\u001b[27m"</code> |
|
||||
| black | <code>string</code> | <code>"\u001b[30m"</code> |
|
||||
| red | <code>string</code> | <code>"\u001b[31m"</code> |
|
||||
| green | <code>string</code> | <code>"\u001b[32m"</code> |
|
||||
| yellow | <code>string</code> | <code>"\u001b[33m"</code> |
|
||||
| blue | <code>string</code> | <code>"\u001b[34m"</code> |
|
||||
| magenta | <code>string</code> | <code>"\u001b[35m"</code> |
|
||||
| cyan | <code>string</code> | <code>"\u001b[36m"</code> |
|
||||
| white | <code>string</code> | <code>"\u001b[37m"</code> |
|
||||
| grey | <code>string</code> | <code>"\u001b[90m"</code> |
|
||||
| gray | <code>string</code> | <code>"\u001b[90m"</code> |
|
||||
| "bg-black" | <code>string</code> | <code>"\u001b[40m"</code> |
|
||||
| "bg-red" | <code>string</code> | <code>"\u001b[41m"</code> |
|
||||
| "bg-green" | <code>string</code> | <code>"\u001b[42m"</code> |
|
||||
| "bg-yellow" | <code>string</code> | <code>"\u001b[43m"</code> |
|
||||
| "bg-blue" | <code>string</code> | <code>"\u001b[44m"</code> |
|
||||
| "bg-magenta" | <code>string</code> | <code>"\u001b[45m"</code> |
|
||||
| "bg-cyan" | <code>string</code> | <code>"\u001b[46m"</code> |
|
||||
| "bg-white" | <code>string</code> | <code>"\u001b[47m"</code> |
|
||||
| "bg-grey" | <code>string</code> | <code>"\u001b[100m"</code> |
|
||||
| "bg-gray" | <code>string</code> | <code>"\u001b[100m"</code> |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
console.log(ansi.style.red + 'this is red' + ansi.style.reset)
|
||||
```
|
||||
<a name="module_ansi-escape-sequences.styles"></a>
|
||||
|
||||
## ansi.styles(effectArray) ⇒ <code>string</code>
|
||||
Returns an ansi sequence setting one or more effects
|
||||
|
||||
**Kind**: static method of [<code>ansi-escape-sequences</code>](#module_ansi-escape-sequences)
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| effectArray | <code>string</code> \| <code>Array.<string></code> | a style, or list or styles |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
> ansi.styles('green')
|
||||
'\u001b[32m'
|
||||
|
||||
> ansi.styles([ 'green', 'underline' ])
|
||||
'\u001b[32;4m'
|
||||
```
|
||||
<a name="module_ansi-escape-sequences.format"></a>
|
||||
|
||||
## ansi.format(str, [styleArray]) ⇒ <code>string</code>
|
||||
A convenience function, applying the provided styles to the input string and then resetting.
|
||||
|
||||
Inline styling can be applied using the syntax `[style-list]{text to format}`, where `style-list` is a space-separated list of styles from [ansi.style](#module_ansi-escape-sequences.style). For example `[bold white bg-red]{bold white text on a red background}`.
|
||||
|
||||
**Kind**: static method of [<code>ansi-escape-sequences</code>](#module_ansi-escape-sequences)
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| str | <code>string</code> | the string to format |
|
||||
| [styleArray] | <code>Array.<string></code> | a list of styles to add to the input string |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
> ansi.format('what?', 'green')
|
||||
'\u001b[32mwhat?\u001b[0m'
|
||||
|
||||
> ansi.format('what?', ['green', 'bold'])
|
||||
'\u001b[32;1mwhat?\u001b[0m'
|
||||
|
||||
> ansi.format('[green bold]{what?}')
|
||||
'\u001b[32;1mwhat?\u001b[0m'
|
||||
```
|
||||
|
||||
## Load anywhere
|
||||
|
||||
This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
|
||||
|
||||
Node.js:
|
||||
|
||||
```js
|
||||
const ansi = require('ansi-escape-sequences')
|
||||
```
|
||||
|
||||
Within Node.js with ECMAScript Module support enabled:
|
||||
|
||||
```js
|
||||
import ansi from 'ansi-escape-sequences'
|
||||
```
|
||||
|
||||
Within a modern browser ECMAScript Module:
|
||||
|
||||
```js
|
||||
import ansi from './node_modules/ansi-escape-sequences/dist/index.mjs'
|
||||
```
|
||||
|
||||
Old browser (adds `window.ansi`):
|
||||
|
||||
```html
|
||||
<script nomodule src="./node_modules/ansi-escape-sequences/dist/index.js"></script>
|
||||
```
|
||||
|
||||
* * *
|
||||
|
||||
© 2014-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
|
||||
298
node_modules/ansi-escape-sequences/dist/index.js
generated
vendored
Normal file
298
node_modules/ansi-escape-sequences/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,298 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = global || self, global.ansi = factory());
|
||||
}(this, function () { 'use strict';
|
||||
|
||||
/**
|
||||
* Takes any input and guarantees an array back.
|
||||
*
|
||||
* - converts array-like objects (e.g. `arguments`) to a real array
|
||||
* - converts `undefined` to an empty array
|
||||
* - converts any another other, singular value (including `null`) into an array containing that value
|
||||
* - ignores input which is already an array
|
||||
*
|
||||
* @module array-back
|
||||
* @example
|
||||
* > const arrayify = require('array-back')
|
||||
*
|
||||
* > arrayify(undefined)
|
||||
* []
|
||||
*
|
||||
* > arrayify(null)
|
||||
* [ null ]
|
||||
*
|
||||
* > arrayify(0)
|
||||
* [ 0 ]
|
||||
*
|
||||
* > arrayify([ 1, 2 ])
|
||||
* [ 1, 2 ]
|
||||
*
|
||||
* > function f(){ return arrayify(arguments); }
|
||||
* > f(1,2,3)
|
||||
* [ 1, 2, 3 ]
|
||||
*/
|
||||
|
||||
function isObject (input) {
|
||||
return typeof input === 'object' && input !== null
|
||||
}
|
||||
|
||||
function isArrayLike (input) {
|
||||
return isObject(input) && typeof input.length === 'number'
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {*} - the input value to convert to an array
|
||||
* @returns {Array}
|
||||
* @alias module:array-back
|
||||
*/
|
||||
function arrayify (input) {
|
||||
if (Array.isArray(input)) {
|
||||
return input
|
||||
} else {
|
||||
if (input === undefined) {
|
||||
return []
|
||||
} else if (isArrayLike(input)) {
|
||||
return Array.prototype.slice.call(input)
|
||||
} else {
|
||||
return [ input ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Control Sequence Initiator */
|
||||
const csi = '\x1b[';
|
||||
|
||||
/**
|
||||
* @exports ansi-escape-sequences
|
||||
* @typicalname ansi
|
||||
* @example
|
||||
* const ansi = require('ansi-escape-sequences')
|
||||
*/
|
||||
const ansi = {};
|
||||
|
||||
/**
|
||||
* Various formatting styles (aka Select Graphic Rendition codes).
|
||||
* @enum {string}
|
||||
* @example
|
||||
* console.log(ansi.style.red + 'this is red' + ansi.style.reset)
|
||||
*/
|
||||
ansi.style = {
|
||||
reset: '\x1b[0m',
|
||||
bold: '\x1b[1m',
|
||||
italic: '\x1b[3m',
|
||||
underline: '\x1b[4m',
|
||||
fontDefault: '\x1b[10m',
|
||||
font2: '\x1b[11m',
|
||||
font3: '\x1b[12m',
|
||||
font4: '\x1b[13m',
|
||||
font5: '\x1b[14m',
|
||||
font6: '\x1b[15m',
|
||||
imageNegative: '\x1b[7m',
|
||||
imagePositive: '\x1b[27m',
|
||||
black: '\x1b[30m',
|
||||
red: '\x1b[31m',
|
||||
green: '\x1b[32m',
|
||||
yellow: '\x1b[33m',
|
||||
blue: '\x1b[34m',
|
||||
magenta: '\x1b[35m',
|
||||
cyan: '\x1b[36m',
|
||||
white: '\x1b[37m',
|
||||
grey: '\x1b[90m',
|
||||
gray: '\x1b[90m',
|
||||
'bg-black': '\x1b[40m',
|
||||
'bg-red': '\x1b[41m',
|
||||
'bg-green': '\x1b[42m',
|
||||
'bg-yellow': '\x1b[43m',
|
||||
'bg-blue': '\x1b[44m',
|
||||
'bg-magenta': '\x1b[45m',
|
||||
'bg-cyan': '\x1b[46m',
|
||||
'bg-white': '\x1b[47m',
|
||||
'bg-grey': '\x1b[100m',
|
||||
'bg-gray': '\x1b[100m'
|
||||
};
|
||||
|
||||
/**
|
||||
* style enum - used by `ansi.styles()`.
|
||||
* @enum {number}
|
||||
* @private
|
||||
*/
|
||||
const eStyles = {
|
||||
reset: 0,
|
||||
bold: 1,
|
||||
italic: 3,
|
||||
underline: 4,
|
||||
imageNegative: 7,
|
||||
fontDefault: 10,
|
||||
font2: 11,
|
||||
font3: 12,
|
||||
font4: 13,
|
||||
font5: 14,
|
||||
font6: 15,
|
||||
imagePositive: 27,
|
||||
black: 30,
|
||||
red: 31,
|
||||
green: 32,
|
||||
yellow: 33,
|
||||
blue: 34,
|
||||
magenta: 35,
|
||||
cyan: 36,
|
||||
white: 37,
|
||||
grey: 90,
|
||||
gray: 90,
|
||||
'bg-black': 40,
|
||||
'bg-red': 41,
|
||||
'bg-green': 42,
|
||||
'bg-yellow': 43,
|
||||
'bg-blue': 44,
|
||||
'bg-magenta': 45,
|
||||
'bg-cyan': 46,
|
||||
'bg-white': 47,
|
||||
'bg-grey': 100,
|
||||
'bg-gray': 100
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns an ansi sequence setting one or more effects
|
||||
* @param {string | string[]} - a style, or list or styles
|
||||
* @returns {string}
|
||||
* @example
|
||||
* > ansi.styles('green')
|
||||
* '\u001b[32m'
|
||||
*
|
||||
* > ansi.styles([ 'green', 'underline' ])
|
||||
* '\u001b[32;4m'
|
||||
*/
|
||||
ansi.styles = function (effectArray) {
|
||||
effectArray = arrayify(effectArray);
|
||||
return csi + effectArray.map(function (effect) { return eStyles[effect] }).join(';') + 'm'
|
||||
};
|
||||
|
||||
/**
|
||||
* A convenience function, applying the provided styles to the input string and then resetting.
|
||||
*
|
||||
* Inline styling can be applied using the syntax `[style-list]{text to format}`, where `style-list` is a space-separated list of styles from {@link module:ansi-escape-sequences.style ansi.style}. For example `[bold white bg-red]{bold white text on a red background}`.
|
||||
*
|
||||
* @param {string} - the string to format
|
||||
* @param [styleArray] {string[]} - a list of styles to add to the input string
|
||||
* @returns {string}
|
||||
* @example
|
||||
* > ansi.format('what?', 'green')
|
||||
* '\u001b[32mwhat?\u001b[0m'
|
||||
*
|
||||
* > ansi.format('what?', ['green', 'bold'])
|
||||
* '\u001b[32;1mwhat?\u001b[0m'
|
||||
*
|
||||
* > ansi.format('[green bold]{what?}')
|
||||
* '\u001b[32;1mwhat?\u001b[0m'
|
||||
*/
|
||||
ansi.format = function (str, styleArray) {
|
||||
const re = /\[([\w\s-]+)\]{([^]*?)}/;
|
||||
let matches;
|
||||
if (!str) return ''
|
||||
|
||||
while (matches = str.match(re)) {
|
||||
const inlineStyles = matches[1].split(/\s+/);
|
||||
const inlineString = matches[2];
|
||||
str = str.replace(matches[0], ansi.format(inlineString, inlineStyles));
|
||||
}
|
||||
|
||||
return (styleArray && styleArray.length)
|
||||
? ansi.styles(styleArray) + str + ansi.style.reset
|
||||
: str
|
||||
};
|
||||
|
||||
/**
|
||||
* cursor-related sequences
|
||||
*/
|
||||
ansi.cursor = {
|
||||
/**
|
||||
* Moves the cursor `lines` cells up. If the cursor is already at the edge of the screen, this has no effect
|
||||
* @param [lines=1] {number}
|
||||
* @return {string}
|
||||
*/
|
||||
up: function (lines) { return csi + (lines || 1) + 'A' },
|
||||
|
||||
/**
|
||||
* Moves the cursor `lines` cells down. If the cursor is already at the edge of the screen, this has no effect
|
||||
* @param [lines=1] {number}
|
||||
* @return {string}
|
||||
*/
|
||||
down: function (lines) { return csi + (lines || 1) + 'B' },
|
||||
|
||||
/**
|
||||
* Moves the cursor `lines` cells forward. If the cursor is already at the edge of the screen, this has no effect
|
||||
* @param [lines=1] {number}
|
||||
* @return {string}
|
||||
*/
|
||||
forward: function (lines) { return csi + (lines || 1) + 'C' },
|
||||
|
||||
/**
|
||||
* Moves the cursor `lines` cells back. If the cursor is already at the edge of the screen, this has no effect
|
||||
* @param [lines=1] {number}
|
||||
* @return {string}
|
||||
*/
|
||||
back: function (lines) { return csi + (lines || 1) + 'D' },
|
||||
|
||||
/**
|
||||
* Moves cursor to beginning of the line n lines down.
|
||||
* @param [lines=1] {number}
|
||||
* @return {string}
|
||||
*/
|
||||
nextLine: function (lines) { return csi + (lines || 1) + 'E' },
|
||||
|
||||
/**
|
||||
* Moves cursor to beginning of the line n lines up.
|
||||
* @param [lines=1] {number}
|
||||
* @return {string}
|
||||
*/
|
||||
previousLine: function (lines) { return csi + (lines || 1) + 'F' },
|
||||
|
||||
/**
|
||||
* Moves the cursor to column n.
|
||||
* @param n {number} - column number
|
||||
* @return {string}
|
||||
*/
|
||||
horizontalAbsolute: function (n) { return csi + n + 'G' },
|
||||
|
||||
/**
|
||||
* Moves the cursor to row n, column m. The values are 1-based, and default to 1 (top left corner) if omitted.
|
||||
* @param n {number} - row number
|
||||
* @param m {number} - column number
|
||||
* @return {string}
|
||||
*/
|
||||
position: function (n, m) { return csi + (n || 1) + ';' + (m || 1) + 'H' },
|
||||
|
||||
/**
|
||||
* Hides the cursor
|
||||
*/
|
||||
hide: csi + '?25l',
|
||||
|
||||
/**
|
||||
* Shows the cursor
|
||||
*/
|
||||
show: csi + '?25h'
|
||||
};
|
||||
|
||||
/**
|
||||
* erase sequences
|
||||
*/
|
||||
ansi.erase = {
|
||||
/**
|
||||
* Clears part of the screen. If n is 0 (or missing), clear from cursor to end of screen. If n is 1, clear from cursor to beginning of the screen. If n is 2, clear entire screen.
|
||||
* @param n {number}
|
||||
* @return {string}
|
||||
*/
|
||||
display: function (n) { return csi + (n || 0) + 'J' },
|
||||
|
||||
/**
|
||||
* Erases part of the line. If n is zero (or missing), clear from cursor to the end of the line. If n is one, clear from cursor to beginning of the line. If n is two, clear entire line. Cursor position does not change.
|
||||
* @param n {number}
|
||||
* @return {string}
|
||||
*/
|
||||
inLine: function (n) { return csi + (n || 0) + 'K' }
|
||||
};
|
||||
|
||||
return ansi;
|
||||
|
||||
}));
|
||||
290
node_modules/ansi-escape-sequences/dist/index.mjs
generated
vendored
Normal file
290
node_modules/ansi-escape-sequences/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,290 @@
|
||||
/**
|
||||
* Takes any input and guarantees an array back.
|
||||
*
|
||||
* - converts array-like objects (e.g. `arguments`) to a real array
|
||||
* - converts `undefined` to an empty array
|
||||
* - converts any another other, singular value (including `null`) into an array containing that value
|
||||
* - ignores input which is already an array
|
||||
*
|
||||
* @module array-back
|
||||
* @example
|
||||
* > const arrayify = require('array-back')
|
||||
*
|
||||
* > arrayify(undefined)
|
||||
* []
|
||||
*
|
||||
* > arrayify(null)
|
||||
* [ null ]
|
||||
*
|
||||
* > arrayify(0)
|
||||
* [ 0 ]
|
||||
*
|
||||
* > arrayify([ 1, 2 ])
|
||||
* [ 1, 2 ]
|
||||
*
|
||||
* > function f(){ return arrayify(arguments); }
|
||||
* > f(1,2,3)
|
||||
* [ 1, 2, 3 ]
|
||||
*/
|
||||
|
||||
function isObject (input) {
|
||||
return typeof input === 'object' && input !== null
|
||||
}
|
||||
|
||||
function isArrayLike (input) {
|
||||
return isObject(input) && typeof input.length === 'number'
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {*} - the input value to convert to an array
|
||||
* @returns {Array}
|
||||
* @alias module:array-back
|
||||
*/
|
||||
function arrayify (input) {
|
||||
if (Array.isArray(input)) {
|
||||
return input
|
||||
} else {
|
||||
if (input === undefined) {
|
||||
return []
|
||||
} else if (isArrayLike(input)) {
|
||||
return Array.prototype.slice.call(input)
|
||||
} else {
|
||||
return [ input ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Control Sequence Initiator */
|
||||
const csi = '\x1b[';
|
||||
|
||||
/**
|
||||
* @exports ansi-escape-sequences
|
||||
* @typicalname ansi
|
||||
* @example
|
||||
* const ansi = require('ansi-escape-sequences')
|
||||
*/
|
||||
const ansi = {};
|
||||
|
||||
/**
|
||||
* Various formatting styles (aka Select Graphic Rendition codes).
|
||||
* @enum {string}
|
||||
* @example
|
||||
* console.log(ansi.style.red + 'this is red' + ansi.style.reset)
|
||||
*/
|
||||
ansi.style = {
|
||||
reset: '\x1b[0m',
|
||||
bold: '\x1b[1m',
|
||||
italic: '\x1b[3m',
|
||||
underline: '\x1b[4m',
|
||||
fontDefault: '\x1b[10m',
|
||||
font2: '\x1b[11m',
|
||||
font3: '\x1b[12m',
|
||||
font4: '\x1b[13m',
|
||||
font5: '\x1b[14m',
|
||||
font6: '\x1b[15m',
|
||||
imageNegative: '\x1b[7m',
|
||||
imagePositive: '\x1b[27m',
|
||||
black: '\x1b[30m',
|
||||
red: '\x1b[31m',
|
||||
green: '\x1b[32m',
|
||||
yellow: '\x1b[33m',
|
||||
blue: '\x1b[34m',
|
||||
magenta: '\x1b[35m',
|
||||
cyan: '\x1b[36m',
|
||||
white: '\x1b[37m',
|
||||
grey: '\x1b[90m',
|
||||
gray: '\x1b[90m',
|
||||
'bg-black': '\x1b[40m',
|
||||
'bg-red': '\x1b[41m',
|
||||
'bg-green': '\x1b[42m',
|
||||
'bg-yellow': '\x1b[43m',
|
||||
'bg-blue': '\x1b[44m',
|
||||
'bg-magenta': '\x1b[45m',
|
||||
'bg-cyan': '\x1b[46m',
|
||||
'bg-white': '\x1b[47m',
|
||||
'bg-grey': '\x1b[100m',
|
||||
'bg-gray': '\x1b[100m'
|
||||
};
|
||||
|
||||
/**
|
||||
* style enum - used by `ansi.styles()`.
|
||||
* @enum {number}
|
||||
* @private
|
||||
*/
|
||||
const eStyles = {
|
||||
reset: 0,
|
||||
bold: 1,
|
||||
italic: 3,
|
||||
underline: 4,
|
||||
imageNegative: 7,
|
||||
fontDefault: 10,
|
||||
font2: 11,
|
||||
font3: 12,
|
||||
font4: 13,
|
||||
font5: 14,
|
||||
font6: 15,
|
||||
imagePositive: 27,
|
||||
black: 30,
|
||||
red: 31,
|
||||
green: 32,
|
||||
yellow: 33,
|
||||
blue: 34,
|
||||
magenta: 35,
|
||||
cyan: 36,
|
||||
white: 37,
|
||||
grey: 90,
|
||||
gray: 90,
|
||||
'bg-black': 40,
|
||||
'bg-red': 41,
|
||||
'bg-green': 42,
|
||||
'bg-yellow': 43,
|
||||
'bg-blue': 44,
|
||||
'bg-magenta': 45,
|
||||
'bg-cyan': 46,
|
||||
'bg-white': 47,
|
||||
'bg-grey': 100,
|
||||
'bg-gray': 100
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns an ansi sequence setting one or more effects
|
||||
* @param {string | string[]} - a style, or list or styles
|
||||
* @returns {string}
|
||||
* @example
|
||||
* > ansi.styles('green')
|
||||
* '\u001b[32m'
|
||||
*
|
||||
* > ansi.styles([ 'green', 'underline' ])
|
||||
* '\u001b[32;4m'
|
||||
*/
|
||||
ansi.styles = function (effectArray) {
|
||||
effectArray = arrayify(effectArray);
|
||||
return csi + effectArray.map(function (effect) { return eStyles[effect] }).join(';') + 'm'
|
||||
};
|
||||
|
||||
/**
|
||||
* A convenience function, applying the provided styles to the input string and then resetting.
|
||||
*
|
||||
* Inline styling can be applied using the syntax `[style-list]{text to format}`, where `style-list` is a space-separated list of styles from {@link module:ansi-escape-sequences.style ansi.style}. For example `[bold white bg-red]{bold white text on a red background}`.
|
||||
*
|
||||
* @param {string} - the string to format
|
||||
* @param [styleArray] {string[]} - a list of styles to add to the input string
|
||||
* @returns {string}
|
||||
* @example
|
||||
* > ansi.format('what?', 'green')
|
||||
* '\u001b[32mwhat?\u001b[0m'
|
||||
*
|
||||
* > ansi.format('what?', ['green', 'bold'])
|
||||
* '\u001b[32;1mwhat?\u001b[0m'
|
||||
*
|
||||
* > ansi.format('[green bold]{what?}')
|
||||
* '\u001b[32;1mwhat?\u001b[0m'
|
||||
*/
|
||||
ansi.format = function (str, styleArray) {
|
||||
const re = /\[([\w\s-]+)\]{([^]*?)}/;
|
||||
let matches;
|
||||
if (!str) return ''
|
||||
|
||||
while (matches = str.match(re)) {
|
||||
const inlineStyles = matches[1].split(/\s+/);
|
||||
const inlineString = matches[2];
|
||||
str = str.replace(matches[0], ansi.format(inlineString, inlineStyles));
|
||||
}
|
||||
|
||||
return (styleArray && styleArray.length)
|
||||
? ansi.styles(styleArray) + str + ansi.style.reset
|
||||
: str
|
||||
};
|
||||
|
||||
/**
|
||||
* cursor-related sequences
|
||||
*/
|
||||
ansi.cursor = {
|
||||
/**
|
||||
* Moves the cursor `lines` cells up. If the cursor is already at the edge of the screen, this has no effect
|
||||
* @param [lines=1] {number}
|
||||
* @return {string}
|
||||
*/
|
||||
up: function (lines) { return csi + (lines || 1) + 'A' },
|
||||
|
||||
/**
|
||||
* Moves the cursor `lines` cells down. If the cursor is already at the edge of the screen, this has no effect
|
||||
* @param [lines=1] {number}
|
||||
* @return {string}
|
||||
*/
|
||||
down: function (lines) { return csi + (lines || 1) + 'B' },
|
||||
|
||||
/**
|
||||
* Moves the cursor `lines` cells forward. If the cursor is already at the edge of the screen, this has no effect
|
||||
* @param [lines=1] {number}
|
||||
* @return {string}
|
||||
*/
|
||||
forward: function (lines) { return csi + (lines || 1) + 'C' },
|
||||
|
||||
/**
|
||||
* Moves the cursor `lines` cells back. If the cursor is already at the edge of the screen, this has no effect
|
||||
* @param [lines=1] {number}
|
||||
* @return {string}
|
||||
*/
|
||||
back: function (lines) { return csi + (lines || 1) + 'D' },
|
||||
|
||||
/**
|
||||
* Moves cursor to beginning of the line n lines down.
|
||||
* @param [lines=1] {number}
|
||||
* @return {string}
|
||||
*/
|
||||
nextLine: function (lines) { return csi + (lines || 1) + 'E' },
|
||||
|
||||
/**
|
||||
* Moves cursor to beginning of the line n lines up.
|
||||
* @param [lines=1] {number}
|
||||
* @return {string}
|
||||
*/
|
||||
previousLine: function (lines) { return csi + (lines || 1) + 'F' },
|
||||
|
||||
/**
|
||||
* Moves the cursor to column n.
|
||||
* @param n {number} - column number
|
||||
* @return {string}
|
||||
*/
|
||||
horizontalAbsolute: function (n) { return csi + n + 'G' },
|
||||
|
||||
/**
|
||||
* Moves the cursor to row n, column m. The values are 1-based, and default to 1 (top left corner) if omitted.
|
||||
* @param n {number} - row number
|
||||
* @param m {number} - column number
|
||||
* @return {string}
|
||||
*/
|
||||
position: function (n, m) { return csi + (n || 1) + ';' + (m || 1) + 'H' },
|
||||
|
||||
/**
|
||||
* Hides the cursor
|
||||
*/
|
||||
hide: csi + '?25l',
|
||||
|
||||
/**
|
||||
* Shows the cursor
|
||||
*/
|
||||
show: csi + '?25h'
|
||||
};
|
||||
|
||||
/**
|
||||
* erase sequences
|
||||
*/
|
||||
ansi.erase = {
|
||||
/**
|
||||
* Clears part of the screen. If n is 0 (or missing), clear from cursor to end of screen. If n is 1, clear from cursor to beginning of the screen. If n is 2, clear entire screen.
|
||||
* @param n {number}
|
||||
* @return {string}
|
||||
*/
|
||||
display: function (n) { return csi + (n || 0) + 'J' },
|
||||
|
||||
/**
|
||||
* Erases part of the line. If n is zero (or missing), clear from cursor to the end of the line. If n is one, clear from cursor to beginning of the line. If n is two, clear entire line. Cursor position does not change.
|
||||
* @param n {number}
|
||||
* @return {string}
|
||||
*/
|
||||
inLine: function (n) { return csi + (n || 0) + 'K' }
|
||||
};
|
||||
|
||||
export default ansi;
|
||||
236
node_modules/ansi-escape-sequences/index.mjs
generated
vendored
Normal file
236
node_modules/ansi-escape-sequences/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,236 @@
|
||||
import arrayify from './node_modules/array-back/index.mjs'
|
||||
|
||||
/* Control Sequence Initiator */
|
||||
const csi = '\x1b['
|
||||
|
||||
/**
|
||||
* @exports ansi-escape-sequences
|
||||
* @typicalname ansi
|
||||
* @example
|
||||
* const ansi = require('ansi-escape-sequences')
|
||||
*/
|
||||
const ansi = {}
|
||||
|
||||
/**
|
||||
* Various formatting styles (aka Select Graphic Rendition codes).
|
||||
* @enum {string}
|
||||
* @example
|
||||
* console.log(ansi.style.red + 'this is red' + ansi.style.reset)
|
||||
*/
|
||||
ansi.style = {
|
||||
reset: '\x1b[0m',
|
||||
bold: '\x1b[1m',
|
||||
italic: '\x1b[3m',
|
||||
underline: '\x1b[4m',
|
||||
fontDefault: '\x1b[10m',
|
||||
font2: '\x1b[11m',
|
||||
font3: '\x1b[12m',
|
||||
font4: '\x1b[13m',
|
||||
font5: '\x1b[14m',
|
||||
font6: '\x1b[15m',
|
||||
imageNegative: '\x1b[7m',
|
||||
imagePositive: '\x1b[27m',
|
||||
black: '\x1b[30m',
|
||||
red: '\x1b[31m',
|
||||
green: '\x1b[32m',
|
||||
yellow: '\x1b[33m',
|
||||
blue: '\x1b[34m',
|
||||
magenta: '\x1b[35m',
|
||||
cyan: '\x1b[36m',
|
||||
white: '\x1b[37m',
|
||||
grey: '\x1b[90m',
|
||||
gray: '\x1b[90m',
|
||||
'bg-black': '\x1b[40m',
|
||||
'bg-red': '\x1b[41m',
|
||||
'bg-green': '\x1b[42m',
|
||||
'bg-yellow': '\x1b[43m',
|
||||
'bg-blue': '\x1b[44m',
|
||||
'bg-magenta': '\x1b[45m',
|
||||
'bg-cyan': '\x1b[46m',
|
||||
'bg-white': '\x1b[47m',
|
||||
'bg-grey': '\x1b[100m',
|
||||
'bg-gray': '\x1b[100m'
|
||||
}
|
||||
|
||||
/**
|
||||
* style enum - used by `ansi.styles()`.
|
||||
* @enum {number}
|
||||
* @private
|
||||
*/
|
||||
const eStyles = {
|
||||
reset: 0,
|
||||
bold: 1,
|
||||
italic: 3,
|
||||
underline: 4,
|
||||
imageNegative: 7,
|
||||
fontDefault: 10,
|
||||
font2: 11,
|
||||
font3: 12,
|
||||
font4: 13,
|
||||
font5: 14,
|
||||
font6: 15,
|
||||
imagePositive: 27,
|
||||
black: 30,
|
||||
red: 31,
|
||||
green: 32,
|
||||
yellow: 33,
|
||||
blue: 34,
|
||||
magenta: 35,
|
||||
cyan: 36,
|
||||
white: 37,
|
||||
grey: 90,
|
||||
gray: 90,
|
||||
'bg-black': 40,
|
||||
'bg-red': 41,
|
||||
'bg-green': 42,
|
||||
'bg-yellow': 43,
|
||||
'bg-blue': 44,
|
||||
'bg-magenta': 45,
|
||||
'bg-cyan': 46,
|
||||
'bg-white': 47,
|
||||
'bg-grey': 100,
|
||||
'bg-gray': 100
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an ansi sequence setting one or more effects
|
||||
* @param {string | string[]} - a style, or list or styles
|
||||
* @returns {string}
|
||||
* @example
|
||||
* > ansi.styles('green')
|
||||
* '\u001b[32m'
|
||||
*
|
||||
* > ansi.styles([ 'green', 'underline' ])
|
||||
* '\u001b[32;4m'
|
||||
*/
|
||||
ansi.styles = function (effectArray) {
|
||||
effectArray = arrayify(effectArray)
|
||||
return csi + effectArray.map(function (effect) { return eStyles[effect] }).join(';') + 'm'
|
||||
}
|
||||
|
||||
/**
|
||||
* A convenience function, applying the provided styles to the input string and then resetting.
|
||||
*
|
||||
* Inline styling can be applied using the syntax `[style-list]{text to format}`, where `style-list` is a space-separated list of styles from {@link module:ansi-escape-sequences.style ansi.style}. For example `[bold white bg-red]{bold white text on a red background}`.
|
||||
*
|
||||
* @param {string} - the string to format
|
||||
* @param [styleArray] {string[]} - a list of styles to add to the input string
|
||||
* @returns {string}
|
||||
* @example
|
||||
* > ansi.format('what?', 'green')
|
||||
* '\u001b[32mwhat?\u001b[0m'
|
||||
*
|
||||
* > ansi.format('what?', ['green', 'bold'])
|
||||
* '\u001b[32;1mwhat?\u001b[0m'
|
||||
*
|
||||
* > ansi.format('[green bold]{what?}')
|
||||
* '\u001b[32;1mwhat?\u001b[0m'
|
||||
*/
|
||||
ansi.format = function (str, styleArray) {
|
||||
const re = /\[([\w\s-]+)\]{([^]*?)}/
|
||||
let matches
|
||||
if (!str) return ''
|
||||
|
||||
while (matches = str.match(re)) {
|
||||
const inlineStyles = matches[1].split(/\s+/)
|
||||
const inlineString = matches[2]
|
||||
str = str.replace(matches[0], ansi.format(inlineString, inlineStyles))
|
||||
}
|
||||
|
||||
return (styleArray && styleArray.length)
|
||||
? ansi.styles(styleArray) + str + ansi.style.reset
|
||||
: str
|
||||
}
|
||||
|
||||
/**
|
||||
* cursor-related sequences
|
||||
*/
|
||||
ansi.cursor = {
|
||||
/**
|
||||
* Moves the cursor `lines` cells up. If the cursor is already at the edge of the screen, this has no effect
|
||||
* @param [lines=1] {number}
|
||||
* @return {string}
|
||||
*/
|
||||
up: function (lines) { return csi + (lines || 1) + 'A' },
|
||||
|
||||
/**
|
||||
* Moves the cursor `lines` cells down. If the cursor is already at the edge of the screen, this has no effect
|
||||
* @param [lines=1] {number}
|
||||
* @return {string}
|
||||
*/
|
||||
down: function (lines) { return csi + (lines || 1) + 'B' },
|
||||
|
||||
/**
|
||||
* Moves the cursor `lines` cells forward. If the cursor is already at the edge of the screen, this has no effect
|
||||
* @param [lines=1] {number}
|
||||
* @return {string}
|
||||
*/
|
||||
forward: function (lines) { return csi + (lines || 1) + 'C' },
|
||||
|
||||
/**
|
||||
* Moves the cursor `lines` cells back. If the cursor is already at the edge of the screen, this has no effect
|
||||
* @param [lines=1] {number}
|
||||
* @return {string}
|
||||
*/
|
||||
back: function (lines) { return csi + (lines || 1) + 'D' },
|
||||
|
||||
/**
|
||||
* Moves cursor to beginning of the line n lines down.
|
||||
* @param [lines=1] {number}
|
||||
* @return {string}
|
||||
*/
|
||||
nextLine: function (lines) { return csi + (lines || 1) + 'E' },
|
||||
|
||||
/**
|
||||
* Moves cursor to beginning of the line n lines up.
|
||||
* @param [lines=1] {number}
|
||||
* @return {string}
|
||||
*/
|
||||
previousLine: function (lines) { return csi + (lines || 1) + 'F' },
|
||||
|
||||
/**
|
||||
* Moves the cursor to column n.
|
||||
* @param n {number} - column number
|
||||
* @return {string}
|
||||
*/
|
||||
horizontalAbsolute: function (n) { return csi + n + 'G' },
|
||||
|
||||
/**
|
||||
* Moves the cursor to row n, column m. The values are 1-based, and default to 1 (top left corner) if omitted.
|
||||
* @param n {number} - row number
|
||||
* @param m {number} - column number
|
||||
* @return {string}
|
||||
*/
|
||||
position: function (n, m) { return csi + (n || 1) + ';' + (m || 1) + 'H' },
|
||||
|
||||
/**
|
||||
* Hides the cursor
|
||||
*/
|
||||
hide: csi + '?25l',
|
||||
|
||||
/**
|
||||
* Shows the cursor
|
||||
*/
|
||||
show: csi + '?25h'
|
||||
}
|
||||
|
||||
/**
|
||||
* erase sequences
|
||||
*/
|
||||
ansi.erase = {
|
||||
/**
|
||||
* Clears part of the screen. If n is 0 (or missing), clear from cursor to end of screen. If n is 1, clear from cursor to beginning of the screen. If n is 2, clear entire screen.
|
||||
* @param n {number}
|
||||
* @return {string}
|
||||
*/
|
||||
display: function (n) { return csi + (n || 0) + 'J' },
|
||||
|
||||
/**
|
||||
* Erases part of the line. If n is zero (or missing), clear from cursor to the end of the line. If n is one, clear from cursor to beginning of the line. If n is two, clear entire line. Cursor position does not change.
|
||||
* @param n {number}
|
||||
* @return {string}
|
||||
*/
|
||||
inLine: function (n) { return csi + (n || 0) + 'K' }
|
||||
}
|
||||
|
||||
export default ansi
|
||||
5
node_modules/ansi-escape-sequences/jsdoc.conf
generated
vendored
Normal file
5
node_modules/ansi-escape-sequences/jsdoc.conf
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"source": {
|
||||
"includePattern": ".+\\.(js(doc|x)?|mjs)$"
|
||||
}
|
||||
}
|
||||
21
node_modules/ansi-escape-sequences/node_modules/array-back/LICENSE
generated
vendored
Normal file
21
node_modules/ansi-escape-sequences/node_modules/array-back/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-19 Lloyd Brookes <75pound@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
40
node_modules/ansi-escape-sequences/node_modules/array-back/README.hbs
generated
vendored
Normal file
40
node_modules/ansi-escape-sequences/node_modules/array-back/README.hbs
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
[](https://www.npmjs.org/package/array-back)
|
||||
[](https://www.npmjs.org/package/array-back)
|
||||
[](https://travis-ci.org/75lb/array-back)
|
||||
[](https://coveralls.io/github/75lb/array-back?branch=master)
|
||||
[](https://david-dm.org/75lb/array-back)
|
||||
[](https://github.com/feross/standard)
|
||||
|
||||
{{>main}}
|
||||
|
||||
### Load anywhere
|
||||
|
||||
This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
|
||||
|
||||
Node.js:
|
||||
|
||||
```js
|
||||
const arrayify = require('array-back')
|
||||
```
|
||||
|
||||
Within Node.js with ECMAScript Module support enabled:
|
||||
|
||||
```js
|
||||
import arrayify from 'array-back'
|
||||
```
|
||||
|
||||
Within an modern browser ECMAScript Module:
|
||||
|
||||
```js
|
||||
import arrayify from './node_modules/array-back/index.mjs'
|
||||
```
|
||||
|
||||
Old browser (adds `window.arrayBack`):
|
||||
|
||||
```html
|
||||
<script nomodule src="./node_modules/array-back/dist/index.js"></script>
|
||||
```
|
||||
|
||||
* * *
|
||||
|
||||
© 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown).
|
||||
81
node_modules/ansi-escape-sequences/node_modules/array-back/README.md
generated
vendored
Normal file
81
node_modules/ansi-escape-sequences/node_modules/array-back/README.md
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
[](https://www.npmjs.org/package/array-back)
|
||||
[](https://www.npmjs.org/package/array-back)
|
||||
[](https://travis-ci.org/75lb/array-back)
|
||||
[](https://coveralls.io/github/75lb/array-back?branch=master)
|
||||
[](https://david-dm.org/75lb/array-back)
|
||||
[](https://github.com/feross/standard)
|
||||
|
||||
<a name="module_array-back"></a>
|
||||
|
||||
## array-back
|
||||
Takes any input and guarantees an array back.
|
||||
|
||||
- Converts array-like objects (e.g. `arguments`, `Set`) to a real array.
|
||||
- Converts `undefined` to an empty array.
|
||||
- Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value.
|
||||
- Ignores input which is already an array.
|
||||
|
||||
**Example**
|
||||
```js
|
||||
> const arrayify = require('array-back')
|
||||
|
||||
> arrayify(undefined)
|
||||
[]
|
||||
|
||||
> arrayify(null)
|
||||
[ null ]
|
||||
|
||||
> arrayify(0)
|
||||
[ 0 ]
|
||||
|
||||
> arrayify([ 1, 2 ])
|
||||
[ 1, 2 ]
|
||||
|
||||
> arrayify(new Set([ 1, 2 ]))
|
||||
[ 1, 2 ]
|
||||
|
||||
> function f(){ return arrayify(arguments); }
|
||||
> f(1,2,3)
|
||||
[ 1, 2, 3 ]
|
||||
```
|
||||
<a name="exp_module_array-back--arrayify"></a>
|
||||
|
||||
### arrayify(input) ⇒ <code>Array</code> ⏏
|
||||
**Kind**: Exported function
|
||||
|
||||
| Param | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| input | <code>\*</code> | The input value to convert to an array |
|
||||
|
||||
|
||||
### Load anywhere
|
||||
|
||||
This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
|
||||
|
||||
Node.js:
|
||||
|
||||
```js
|
||||
const arrayify = require('array-back')
|
||||
```
|
||||
|
||||
Within Node.js with ECMAScript Module support enabled:
|
||||
|
||||
```js
|
||||
import arrayify from 'array-back'
|
||||
```
|
||||
|
||||
Within an modern browser ECMAScript Module:
|
||||
|
||||
```js
|
||||
import arrayify from './node_modules/array-back/index.mjs'
|
||||
```
|
||||
|
||||
Old browser (adds `window.arrayBack`):
|
||||
|
||||
```html
|
||||
<script nomodule src="./node_modules/array-back/dist/index.js"></script>
|
||||
```
|
||||
|
||||
* * *
|
||||
|
||||
© 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown).
|
||||
70
node_modules/ansi-escape-sequences/node_modules/array-back/dist/index.js
generated
vendored
Normal file
70
node_modules/ansi-escape-sequences/node_modules/array-back/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = global || self, global.arrayBack = factory());
|
||||
}(this, function () { 'use strict';
|
||||
|
||||
/**
|
||||
* Takes any input and guarantees an array back.
|
||||
*
|
||||
* - Converts array-like objects (e.g. `arguments`, `Set`) to a real array.
|
||||
* - Converts `undefined` to an empty array.
|
||||
* - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value.
|
||||
* - Ignores input which is already an array.
|
||||
*
|
||||
* @module array-back
|
||||
* @example
|
||||
* > const arrayify = require('array-back')
|
||||
*
|
||||
* > arrayify(undefined)
|
||||
* []
|
||||
*
|
||||
* > arrayify(null)
|
||||
* [ null ]
|
||||
*
|
||||
* > arrayify(0)
|
||||
* [ 0 ]
|
||||
*
|
||||
* > arrayify([ 1, 2 ])
|
||||
* [ 1, 2 ]
|
||||
*
|
||||
* > arrayify(new Set([ 1, 2 ]))
|
||||
* [ 1, 2 ]
|
||||
*
|
||||
* > function f(){ return arrayify(arguments); }
|
||||
* > f(1,2,3)
|
||||
* [ 1, 2, 3 ]
|
||||
*/
|
||||
|
||||
function isObject (input) {
|
||||
return typeof input === 'object' && input !== null
|
||||
}
|
||||
|
||||
function isArrayLike (input) {
|
||||
return isObject(input) && typeof input.length === 'number'
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {*} - The input value to convert to an array
|
||||
* @returns {Array}
|
||||
* @alias module:array-back
|
||||
*/
|
||||
function arrayify (input) {
|
||||
if (Array.isArray(input)) {
|
||||
return input
|
||||
}
|
||||
|
||||
if (input === undefined) {
|
||||
return []
|
||||
}
|
||||
|
||||
if (isArrayLike(input) || input instanceof Set) {
|
||||
return Array.from(input)
|
||||
}
|
||||
|
||||
return [ input ]
|
||||
}
|
||||
|
||||
return arrayify;
|
||||
|
||||
}));
|
||||
62
node_modules/ansi-escape-sequences/node_modules/array-back/index.mjs
generated
vendored
Normal file
62
node_modules/ansi-escape-sequences/node_modules/array-back/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* Takes any input and guarantees an array back.
|
||||
*
|
||||
* - Converts array-like objects (e.g. `arguments`, `Set`) to a real array.
|
||||
* - Converts `undefined` to an empty array.
|
||||
* - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value.
|
||||
* - Ignores input which is already an array.
|
||||
*
|
||||
* @module array-back
|
||||
* @example
|
||||
* > const arrayify = require('array-back')
|
||||
*
|
||||
* > arrayify(undefined)
|
||||
* []
|
||||
*
|
||||
* > arrayify(null)
|
||||
* [ null ]
|
||||
*
|
||||
* > arrayify(0)
|
||||
* [ 0 ]
|
||||
*
|
||||
* > arrayify([ 1, 2 ])
|
||||
* [ 1, 2 ]
|
||||
*
|
||||
* > arrayify(new Set([ 1, 2 ]))
|
||||
* [ 1, 2 ]
|
||||
*
|
||||
* > function f(){ return arrayify(arguments); }
|
||||
* > f(1,2,3)
|
||||
* [ 1, 2, 3 ]
|
||||
*/
|
||||
|
||||
function isObject (input) {
|
||||
return typeof input === 'object' && input !== null
|
||||
}
|
||||
|
||||
function isArrayLike (input) {
|
||||
return isObject(input) && typeof input.length === 'number'
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {*} - The input value to convert to an array
|
||||
* @returns {Array}
|
||||
* @alias module:array-back
|
||||
*/
|
||||
function arrayify (input) {
|
||||
if (Array.isArray(input)) {
|
||||
return input
|
||||
}
|
||||
|
||||
if (input === undefined) {
|
||||
return []
|
||||
}
|
||||
|
||||
if (isArrayLike(input) || input instanceof Set) {
|
||||
return Array.from(input)
|
||||
}
|
||||
|
||||
return [ input ]
|
||||
}
|
||||
|
||||
export default arrayify
|
||||
46
node_modules/ansi-escape-sequences/node_modules/array-back/package.json
generated
vendored
Normal file
46
node_modules/ansi-escape-sequences/node_modules/array-back/package.json
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "array-back",
|
||||
"author": "Lloyd Brookes <75pound@gmail.com>",
|
||||
"version": "3.1.0",
|
||||
"description": "Guarantees an array back",
|
||||
"repository": "https://github.com/75lb/array-back.git",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.js",
|
||||
"keywords": [
|
||||
"to",
|
||||
"convert",
|
||||
"return",
|
||||
"array",
|
||||
"arrayify"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.mjs",
|
||||
"dist/index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "npm run test:esm && npm run test:js",
|
||||
"test:esm": "node --experimental-modules test.mjs",
|
||||
"test:js": "npm run dist:test && node dist/test.js",
|
||||
"docs": "jsdoc2md -t README.hbs index.mjs -c build/jsdoc.conf > README.md; echo",
|
||||
"cover": "nyc test-runner test.js && nyc report --reporter=text-lcov | coveralls",
|
||||
"dist": "rollup -c build/index.config.js",
|
||||
"dist:test": "rollup -c build/test.config.js",
|
||||
"lint": "standard **/*.mjs"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"coveralls": "^3.0.3",
|
||||
"jsdoc-to-markdown": "^4.0.1",
|
||||
"rollup": "^1.9.0",
|
||||
"test-runner": "^0.5.1"
|
||||
},
|
||||
"standard": {
|
||||
"ignore": [
|
||||
"dist",
|
||||
"build"
|
||||
]
|
||||
}
|
||||
}
|
||||
33
node_modules/ansi-escape-sequences/package.json
generated
vendored
Normal file
33
node_modules/ansi-escape-sequences/package.json
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "ansi-escape-sequences",
|
||||
"author": "Lloyd Brookes <75pound@gmail.com>",
|
||||
"version": "4.1.0",
|
||||
"description": "A simple library containing all known terminal ansi escape codes and sequences.",
|
||||
"repository": "https://github.com/75lb/ansi-escape-sequences.git",
|
||||
"main": "dist/index.js",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"terminal",
|
||||
"colour",
|
||||
"color",
|
||||
"command line",
|
||||
"cursor"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "test-runner test.js",
|
||||
"docs": "jsdoc2md -c jsdoc.conf -d 1 -t README.hbs index.mjs > README.md; echo",
|
||||
"dist": "rollup index.mjs -f umd -n ansi -o dist/index.js && rollup index.mjs -f esm -o dist/index.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"array-back": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jsdoc-to-markdown": "^4.0.1",
|
||||
"rollup": "^1.4.1",
|
||||
"test-runner": "^0.5.1"
|
||||
}
|
||||
}
|
||||
12
node_modules/ansi-escape-sequences/test.js
generated
vendored
Normal file
12
node_modules/ansi-escape-sequences/test.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
const TestRunner = require('test-runner')
|
||||
const ansi = require('./')
|
||||
const runner = new TestRunner()
|
||||
const a = require('assert')
|
||||
|
||||
runner.test('format', function () {
|
||||
a.strictEqual(ansi.format('clive', ['red', 'underline']), '\u001b[31;4mclive\u001b[0m')
|
||||
})
|
||||
|
||||
runner.test('inline format', function () {
|
||||
a.strictEqual(ansi.format('before [red underline]{clive} after'), 'before \u001b[31;4mclive\u001b[0m after')
|
||||
})
|
||||
Reference in New Issue
Block a user