aboutsummaryrefslogtreecommitdiff
path: root/node_modules/ansi-escapes
diff options
context:
space:
mode:
authorJoel Kronqvist <work.joelkronqvist@pm.me>2022-03-11 20:46:06 +0200
committerJoel Kronqvist <work.joelkronqvist@pm.me>2022-03-11 20:46:06 +0200
commit080c5819d87b933816d724a83f3bf4f1686770a7 (patch)
tree4a2ccc68b27edf7d4cbc586c932cc7542b655e19 /node_modules/ansi-escapes
parent5ac7049a9d30733165cc212dee308163c2a14644 (diff)
parentd003b82235a9329f912522a2f70aa950dfce4998 (diff)
downloadLYLLRuoka-080c5819d87b933816d724a83f3bf4f1686770a7.tar.gz
LYLLRuoka-080c5819d87b933816d724a83f3bf4f1686770a7.zip
Merge branch 'master' of https://github.com/JoelHMikael/FoodJS
Updating remote changes
Diffstat (limited to 'node_modules/ansi-escapes')
-rw-r--r--node_modules/ansi-escapes/index.d.ts248
-rw-r--r--node_modules/ansi-escapes/index.js157
-rw-r--r--node_modules/ansi-escapes/license9
-rw-r--r--node_modules/ansi-escapes/package.json57
-rw-r--r--node_modules/ansi-escapes/readme.md245
5 files changed, 716 insertions, 0 deletions
diff --git a/node_modules/ansi-escapes/index.d.ts b/node_modules/ansi-escapes/index.d.ts
new file mode 100644
index 0000000..5201942
--- /dev/null
+++ b/node_modules/ansi-escapes/index.d.ts
@@ -0,0 +1,248 @@
+/// <reference types="node"/>
+import {LiteralUnion} from 'type-fest';
+
+declare namespace ansiEscapes {
+ interface ImageOptions {
+ /**
+ The width is given as a number followed by a unit, or the word `'auto'`.
+
+ - `N`: N character cells.
+ - `Npx`: N pixels.
+ - `N%`: N percent of the session's width or height.
+ - `auto`: The image's inherent size will be used to determine an appropriate dimension.
+ */
+ readonly width?: LiteralUnion<'auto', number | string>;
+
+ /**
+ The height is given as a number followed by a unit, or the word `'auto'`.
+
+ - `N`: N character cells.
+ - `Npx`: N pixels.
+ - `N%`: N percent of the session's width or height.
+ - `auto`: The image's inherent size will be used to determine an appropriate dimension.
+ */
+ readonly height?: LiteralUnion<'auto', number | string>;
+
+ readonly preserveAspectRatio?: boolean;
+ }
+
+ interface AnnotationOptions {
+ /**
+ Nonzero number of columns to annotate.
+
+ Default: The remainder of the line.
+ */
+ readonly length?: number;
+
+ /**
+ Starting X coordinate.
+
+ Must be used with `y` and `length`.
+
+ Default: The cursor position
+ */
+ readonly x?: number;
+
+ /**
+ Starting Y coordinate.
+
+ Must be used with `x` and `length`.
+
+ Default: Cursor position.
+ */
+ readonly y?: number;
+
+ /**
+ Create a "hidden" annotation.
+
+ Annotations created this way can be shown using the "Show Annotations" iTerm command.
+ */
+ readonly isHidden?: boolean;
+ }
+}
+
+declare const ansiEscapes: {
+ /**
+ Set the absolute position of the cursor. `x0` `y0` is the top left of the screen.
+ */
+ cursorTo(x: number, y?: number): string;
+
+ /**
+ Set the position of the cursor relative to its current position.
+ */
+ cursorMove(x: number, y?: number): string;
+
+ /**
+ Move cursor up a specific amount of rows.
+
+ @param count - Count of rows to move up. Default is `1`.
+ */
+ cursorUp(count?: number): string;
+
+ /**
+ Move cursor down a specific amount of rows.
+
+ @param count - Count of rows to move down. Default is `1`.
+ */
+ cursorDown(count?: number): string;
+
+ /**
+ Move cursor forward a specific amount of rows.
+
+ @param count - Count of rows to move forward. Default is `1`.
+ */
+ cursorForward(count?: number): string;
+
+ /**
+ Move cursor backward a specific amount of rows.
+
+ @param count - Count of rows to move backward. Default is `1`.
+ */
+ cursorBackward(count?: number): string;
+
+ /**
+ Move cursor to the left side.
+ */
+ cursorLeft: string;
+
+ /**
+ Save cursor position.
+ */
+ cursorSavePosition: string;
+
+ /**
+ Restore saved cursor position.
+ */
+ cursorRestorePosition: string;
+
+ /**
+ Get cursor position.
+ */
+ cursorGetPosition: string;
+
+ /**
+ Move cursor to the next line.
+ */
+ cursorNextLine: string;
+
+ /**
+ Move cursor to the previous line.
+ */
+ cursorPrevLine: string;
+
+ /**
+ Hide cursor.
+ */
+ cursorHide: string;
+
+ /**
+ Show cursor.
+ */
+ cursorShow: string;
+
+ /**
+ Erase from the current cursor position up the specified amount of rows.
+
+ @param count - Count of rows to erase.
+ */
+ eraseLines(count: number): string;
+
+ /**
+ Erase from the current cursor position to the end of the current line.
+ */
+ eraseEndLine: string;
+
+ /**
+ Erase from the current cursor position to the start of the current line.
+ */
+ eraseStartLine: string;
+
+ /**
+ Erase the entire current line.
+ */
+ eraseLine: string;
+
+ /**
+ Erase the screen from the current line down to the bottom of the screen.
+ */
+ eraseDown: string;
+
+ /**
+ Erase the screen from the current line up to the top of the screen.
+ */
+ eraseUp: string;
+
+ /**
+ Erase the screen and move the cursor the top left position.
+ */
+ eraseScreen: string;
+
+ /**
+ Scroll display up one line.
+ */
+ scrollUp: string;
+
+ /**
+ Scroll display down one line.
+ */
+ scrollDown: string;
+
+ /**
+ Clear the terminal screen. (Viewport)
+ */
+ clearScreen: string;
+
+ /**
+ Clear the whole terminal, including scrollback buffer. (Not just the visible part of it)
+ */
+ clearTerminal: string;
+
+ /**
+ Output a beeping sound.
+ */
+ beep: string;
+
+ /**
+ Create a clickable link.
+
+ [Supported terminals.](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) Use [`supports-hyperlinks`](https://github.com/jamestalmage/supports-hyperlinks) to detect link support.
+ */
+ link(text: string, url: string): string;
+
+ /**
+ Display an image.
+
+ _Currently only supported on iTerm2 >=3_
+
+ See [term-img](https://github.com/sindresorhus/term-img) for a higher-level module.
+
+ @param buffer - Buffer of an image. Usually read in with `fs.readFile()`.
+ */
+ image(buffer: Buffer, options?: ansiEscapes.ImageOptions): string;
+
+ iTerm: {
+ /**
+ [Inform iTerm2](https://www.iterm2.com/documentation-escape-codes.html) of the current directory to help semantic history and enable [Cmd-clicking relative paths](https://coderwall.com/p/b7e82q/quickly-open-files-in-iterm-with-cmd-click).
+
+ @param cwd - Current directory. Default: `process.cwd()`.
+ */
+ setCwd(cwd?: string): string;
+
+ /**
+ An annotation looks like this when shown:
+
+ ![screenshot of iTerm annotation](https://user-images.githubusercontent.com/924465/64382136-b60ac700-cfe9-11e9-8a35-9682e8dc4b72.png)
+
+ See the [iTerm Proprietary Escape Codes documentation](https://iterm2.com/documentation-escape-codes.html) for more information.
+
+ @param message - The message to display within the annotation. The `|` character is disallowed and will be stripped.
+ @returns An escape code which will create an annotation when printed in iTerm2.
+ */
+ annotation(message: string, options?: ansiEscapes.AnnotationOptions): string;
+ };
+
+ // TODO: remove this in the next major version
+ default: typeof ansiEscapes;
+};
+
+export = ansiEscapes;
diff --git a/node_modules/ansi-escapes/index.js b/node_modules/ansi-escapes/index.js
new file mode 100644
index 0000000..2833318
--- /dev/null
+++ b/node_modules/ansi-escapes/index.js
@@ -0,0 +1,157 @@
+'use strict';
+const ansiEscapes = module.exports;
+// TODO: remove this in the next major version
+module.exports.default = ansiEscapes;
+
+const ESC = '\u001B[';
+const OSC = '\u001B]';
+const BEL = '\u0007';
+const SEP = ';';
+const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';
+
+ansiEscapes.cursorTo = (x, y) => {
+ if (typeof x !== 'number') {
+ throw new TypeError('The `x` argument is required');
+ }
+
+ if (typeof y !== 'number') {
+ return ESC + (x + 1) + 'G';
+ }
+
+ return ESC + (y + 1) + ';' + (x + 1) + 'H';
+};
+
+ansiEscapes.cursorMove = (x, y) => {
+ if (typeof x !== 'number') {
+ throw new TypeError('The `x` argument is required');
+ }
+
+ let ret = '';
+
+ if (x < 0) {
+ ret += ESC + (-x) + 'D';
+ } else if (x > 0) {
+ ret += ESC + x + 'C';
+ }
+
+ if (y < 0) {
+ ret += ESC + (-y) + 'A';
+ } else if (y > 0) {
+ ret += ESC + y + 'B';
+ }
+
+ return ret;
+};
+
+ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A';
+ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B';
+ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C';
+ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D';
+
+ansiEscapes.cursorLeft = ESC + 'G';
+ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's';
+ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u';
+ansiEscapes.cursorGetPosition = ESC + '6n';
+ansiEscapes.cursorNextLine = ESC + 'E';
+ansiEscapes.cursorPrevLine = ESC + 'F';
+ansiEscapes.cursorHide = ESC + '?25l';
+ansiEscapes.cursorShow = ESC + '?25h';
+
+ansiEscapes.eraseLines = count => {
+ let clear = '';
+
+ for (let i = 0; i < count; i++) {
+ clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : '');
+ }
+
+ if (count) {
+ clear += ansiEscapes.cursorLeft;
+ }
+
+ return clear;
+};
+
+ansiEscapes.eraseEndLine = ESC + 'K';
+ansiEscapes.eraseStartLine = ESC + '1K';
+ansiEscapes.eraseLine = ESC + '2K';
+ansiEscapes.eraseDown = ESC + 'J';
+ansiEscapes.eraseUp = ESC + '1J';
+ansiEscapes.eraseScreen = ESC + '2J';
+ansiEscapes.scrollUp = ESC + 'S';
+ansiEscapes.scrollDown = ESC + 'T';
+
+ansiEscapes.clearScreen = '\u001Bc';
+
+ansiEscapes.clearTerminal = process.platform === 'win32' ?
+ `${ansiEscapes.eraseScreen}${ESC}0f` :
+ // 1. Erases the screen (Only done in case `2` is not supported)
+ // 2. Erases the whole screen including scrollback buffer
+ // 3. Moves cursor to the top-left position
+ // More info: https://www.real-world-systems.com/docs/ANSIcode.html
+ `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`;
+
+ansiEscapes.beep = BEL;
+
+ansiEscapes.link = (text, url) => {
+ return [
+ OSC,
+ '8',
+ SEP,
+ SEP,
+ url,
+ BEL,
+ text,
+ OSC,
+ '8',
+ SEP,
+ SEP,
+ BEL
+ ].join('');
+};
+
+ansiEscapes.image = (buffer, options = {}) => {
+ let ret = `${OSC}1337;File=inline=1`;
+
+ if (options.width) {
+ ret += `;width=${options.width}`;
+ }
+
+ if (options.height) {
+ ret += `;height=${options.height}`;
+ }
+
+ if (options.preserveAspectRatio === false) {
+ ret += ';preserveAspectRatio=0';
+ }
+
+ return ret + ':' + buffer.toString('base64') + BEL;
+};
+
+ansiEscapes.iTerm = {
+ setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
+
+ annotation: (message, options = {}) => {
+ let ret = `${OSC}1337;`;
+
+ const hasX = typeof options.x !== 'undefined';
+ const hasY = typeof options.y !== 'undefined';
+ if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== 'undefined')) {
+ throw new Error('`x`, `y` and `length` must be defined when `x` or `y` is defined');
+ }
+
+ message = message.replace(/\|/g, '');
+
+ ret += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation=';
+
+ if (options.length > 0) {
+ ret +=
+ (hasX ?
+ [message, options.length, options.x, options.y] :
+ [options.length, message]).join('|');
+ } else {
+ ret += message;
+ }
+
+ return ret + BEL;
+ }
+};
diff --git a/node_modules/ansi-escapes/license b/node_modules/ansi-escapes/license
new file mode 100644
index 0000000..fa7ceba
--- /dev/null
+++ b/node_modules/ansi-escapes/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.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.
diff --git a/node_modules/ansi-escapes/package.json b/node_modules/ansi-escapes/package.json
new file mode 100644
index 0000000..88a9356
--- /dev/null
+++ b/node_modules/ansi-escapes/package.json
@@ -0,0 +1,57 @@
+{
+ "name": "ansi-escapes",
+ "version": "4.3.2",
+ "description": "ANSI escape codes for manipulating the terminal",
+ "license": "MIT",
+ "repository": "sindresorhus/ansi-escapes",
+ "funding": "https://github.com/sponsors/sindresorhus",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "https://sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "scripts": {
+ "test": "xo && ava && tsd"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "ansi",
+ "terminal",
+ "console",
+ "cli",
+ "string",
+ "tty",
+ "escape",
+ "escapes",
+ "formatting",
+ "shell",
+ "xterm",
+ "log",
+ "logging",
+ "command-line",
+ "text",
+ "vt100",
+ "sequence",
+ "control",
+ "code",
+ "codes",
+ "cursor",
+ "iterm",
+ "iterm2"
+ ],
+ "dependencies": {
+ "type-fest": "^0.21.3"
+ },
+ "devDependencies": {
+ "@types/node": "^13.7.7",
+ "ava": "^2.1.0",
+ "tsd": "^0.14.0",
+ "xo": "^0.25.3"
+ }
+}
diff --git a/node_modules/ansi-escapes/readme.md b/node_modules/ansi-escapes/readme.md
new file mode 100644
index 0000000..9fbfec9
--- /dev/null
+++ b/node_modules/ansi-escapes/readme.md
@@ -0,0 +1,245 @@
+# ansi-escapes
+
+> [ANSI escape codes](http://www.termsys.demon.co.uk/vtansi.htm) for manipulating the terminal
+
+## Install
+
+```
+$ npm install ansi-escapes
+```
+
+## Usage
+
+```js
+const ansiEscapes = require('ansi-escapes');
+
+// Moves the cursor two rows up and to the left
+process.stdout.write(ansiEscapes.cursorUp(2) + ansiEscapes.cursorLeft);
+//=> '\u001B[2A\u001B[1000D'
+```
+
+## API
+
+### cursorTo(x, y?)
+
+Set the absolute position of the cursor. `x0` `y0` is the top left of the screen.
+
+### cursorMove(x, y?)
+
+Set the position of the cursor relative to its current position.
+
+### cursorUp(count)
+
+Move cursor up a specific amount of rows. Default is `1`.
+
+### cursorDown(count)
+
+Move cursor down a specific amount of rows. Default is `1`.
+
+### cursorForward(count)
+
+Move cursor forward a specific amount of columns. Default is `1`.
+
+### cursorBackward(count)
+
+Move cursor backward a specific amount of columns. Default is `1`.
+
+### cursorLeft
+
+Move cursor to the left side.
+
+### cursorSavePosition
+
+Save cursor position.
+
+### cursorRestorePosition
+
+Restore saved cursor position.
+
+### cursorGetPosition
+
+Get cursor position.
+
+### cursorNextLine
+
+Move cursor to the next line.
+
+### cursorPrevLine
+
+Move cursor to the previous line.
+
+### cursorHide
+
+Hide cursor.
+
+### cursorShow
+
+Show cursor.
+
+### eraseLines(count)
+
+Erase from the current cursor position up the specified amount of rows.
+
+### eraseEndLine
+
+Erase from the current cursor position to the end of the current line.
+
+### eraseStartLine
+
+Erase from the current cursor position to the start of the current line.
+
+### eraseLine
+
+Erase the entire current line.
+
+### eraseDown
+
+Erase the screen from the current line down to the bottom of the screen.
+
+### eraseUp
+
+Erase the screen from the current line up to the top of the screen.
+
+### eraseScreen
+
+Erase the screen and move the cursor the top left position.
+
+### scrollUp
+
+Scroll display up one line.
+
+### scrollDown
+
+Scroll display down one line.
+
+### clearScreen
+
+Clear the terminal screen. (Viewport)
+
+### clearTerminal
+
+Clear the whole terminal, including scrollback buffer. (Not just the visible part of it)
+
+### beep
+
+Output a beeping sound.
+
+### link(text, url)
+
+Create a clickable link.
+
+[Supported terminals.](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) Use [`supports-hyperlinks`](https://github.com/jamestalmage/supports-hyperlinks) to detect link support.
+
+### image(filePath, options?)
+
+Display an image.
+
+*Currently only supported on iTerm2 >=3*
+
+See [term-img](https://github.com/sindresorhus/term-img) for a higher-level module.
+
+#### input
+
+Type: `Buffer`
+
+Buffer of an image. Usually read in with `fs.readFile()`.
+
+#### options
+
+Type: `object`
+
+##### width
+##### height
+
+Type: `string | number`
+
+The width and height are given as a number followed by a unit, or the word "auto".
+
+- `N`: N character cells.
+- `Npx`: N pixels.
+- `N%`: N percent of the session's width or height.
+- `auto`: The image's inherent size will be used to determine an appropriate dimension.
+
+##### preserveAspectRatio
+
+Type: `boolean`\
+Default: `true`
+
+### iTerm.setCwd(path?)
+
+Type: `string`\
+Default: `process.cwd()`
+
+[Inform iTerm2](https://www.iterm2.com/documentation-escape-codes.html) of the current directory to help semantic history and enable [Cmd-clicking relative paths](https://coderwall.com/p/b7e82q/quickly-open-files-in-iterm-with-cmd-click).
+
+### iTerm.annotation(message, options?)
+
+Creates an escape code to display an "annotation" in iTerm2.
+
+An annotation looks like this when shown:
+
+<img src="https://user-images.githubusercontent.com/924465/64382136-b60ac700-cfe9-11e9-8a35-9682e8dc4b72.png" width="500">
+
+See the [iTerm Proprietary Escape Codes documentation](https://iterm2.com/documentation-escape-codes.html) for more information.
+
+#### message
+
+Type: `string`
+
+The message to display within the annotation.
+
+The `|` character is disallowed and will be stripped.
+
+#### options
+
+Type: `object`
+
+##### length
+
+Type: `number`\
+Default: The remainder of the line
+
+Nonzero number of columns to annotate.
+
+##### x
+
+Type: `number`\
+Default: Cursor position
+
+Starting X coordinate.
+
+Must be used with `y` and `length`.
+
+##### y
+
+Type: `number`\
+Default: Cursor position
+
+Starting Y coordinate.
+
+Must be used with `x` and `length`.
+
+##### isHidden
+
+Type: `boolean`\
+Default: `false`
+
+Create a "hidden" annotation.
+
+Annotations created this way can be shown using the "Show Annotations" iTerm command.
+
+## Related
+
+- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
+
+---
+
+<div align="center">
+ <b>
+ <a href="https://tidelift.com/subscription/pkg/npm-ansi-escapes?utm_source=npm-ansi-escapes&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
+ </b>
+ <br>
+ <sub>
+ Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
+ </sub>
+</div>