This commit is contained in:
2024-02-07 01:33:07 -05:00
commit c1af19d441
4088 changed files with 1260170 additions and 0 deletions

21
node_modules/kolorist/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2020-present Marvin Hagemeister
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.

53
node_modules/kolorist/README.md generated vendored Normal file
View File

@ -0,0 +1,53 @@
# kolorist
Tiny library to put colors into stdin/stdout :tada:
![Screenshot of terminal colors](.github/demo.png)
## Usage
```bash
npm install --save-dev kolorist
```
```js
import { red, cyan } from 'kolorist';
console.log(red(`Error: something failed in ${cyan('my-file.js')}.`));
```
You can also disable or enable colors globally via the following environment variables:
- disable:
- `NODE_DISABLE_COLORS`
- `NO_COLOR`
- `TERM=dumb`
- `FORCE_COLOR=0`
- enable:
- `FORCE_COLOR=1`
- `FORCE_COLOR=2`
- `FORCE_COLOR=3`
On top of that you can disable colors right from node:
```js
import { options, red } from 'kolorist';
options.enabled = false;
console.log(red('foo'));
// Logs a string without colors
```
You can also strip colors from a string:
```js
import { red, stripColors } from 'kolorist';
console.log(stripColors(red('foo')));
// Logs 'foo'
```
### License
`MIT`, see [the license file](./LICENSE).

176
node_modules/kolorist/dist/cjs/index.js generated vendored Normal file
View File

@ -0,0 +1,176 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.link = exports.trueColorBg = exports.trueColor = exports.ansi256Bg = exports.ansi256 = exports.bgLightGray = exports.bgLightCyan = exports.bgLightMagenta = exports.bgLightBlue = exports.bgLightYellow = exports.bgLightGreen = exports.bgLightRed = exports.bgGray = exports.bgWhite = exports.bgCyan = exports.bgMagenta = exports.bgBlue = exports.bgYellow = exports.bgGreen = exports.bgRed = exports.bgBlack = exports.lightCyan = exports.lightMagenta = exports.lightBlue = exports.lightYellow = exports.lightGreen = exports.lightRed = exports.lightGray = exports.gray = exports.white = exports.cyan = exports.magenta = exports.blue = exports.yellow = exports.green = exports.red = exports.black = exports.strikethrough = exports.hidden = exports.inverse = exports.underline = exports.italic = exports.dim = exports.bold = exports.reset = exports.stripColors = exports.options = void 0;
let enabled = true;
// Support both browser and node environments
const globalVar = typeof self !== 'undefined'
? self
: typeof window !== 'undefined'
? window
: typeof global !== 'undefined'
? global
: {};
/**
* Detect how much colors the current terminal supports
*/
let supportLevel = 0 /* none */;
if (globalVar.process && globalVar.process.env && globalVar.process.stdout) {
const { FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, COLORTERM } = globalVar.process.env;
if (NODE_DISABLE_COLORS || NO_COLOR || FORCE_COLOR === '0') {
enabled = false;
}
else if (FORCE_COLOR === '1' ||
FORCE_COLOR === '2' ||
FORCE_COLOR === '3') {
enabled = true;
}
else if (TERM === 'dumb') {
enabled = false;
}
else if ('CI' in globalVar.process.env &&
[
'TRAVIS',
'CIRCLECI',
'APPVEYOR',
'GITLAB_CI',
'GITHUB_ACTIONS',
'BUILDKITE',
'DRONE',
].some(vendor => vendor in globalVar.process.env)) {
enabled = true;
}
else {
enabled = process.stdout.isTTY;
}
if (enabled) {
// Windows supports 24bit True Colors since Windows 10 revision #14931,
// see https://devblogs.microsoft.com/commandline/24-bit-color-in-the-windows-console/
if (process.platform === 'win32') {
supportLevel = 3 /* trueColor */;
}
else {
if (COLORTERM && (COLORTERM === 'truecolor' || COLORTERM === '24bit')) {
supportLevel = 3 /* trueColor */;
}
else if (TERM && (TERM.endsWith('-256color') || TERM.endsWith('256'))) {
supportLevel = 2 /* ansi256 */;
}
else {
supportLevel = 1 /* ansi */;
}
}
}
}
exports.options = {
enabled,
supportLevel,
};
function kolorist(start, end, level = 1 /* ansi */) {
const open = `\x1b[${start}m`;
const close = `\x1b[${end}m`;
const regex = new RegExp(`\\x1b\\[${end}m`, 'g');
return (str) => {
return exports.options.enabled && exports.options.supportLevel >= level
? open + ('' + str).replace(regex, open) + close
: '' + str;
};
}
// Lower colors into 256 color space
// Taken from https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
// which is MIT licensed and copyright by Heather Arthur and Josh Junon
function rgbToAnsi256(r, g, b) {
// We use the extended greyscale palette here, with the exception of
// black and white. normal palette only has 4 greyscale shades.
if (r >> 4 === g >> 4 && g >> 4 === b >> 4) {
if (r < 8) {
return 16;
}
if (r > 248) {
return 231;
}
return Math.round(((r - 8) / 247) * 24) + 232;
}
const ansi = 16 +
36 * Math.round((r / 255) * 5) +
6 * Math.round((g / 255) * 5) +
Math.round((b / 255) * 5);
return ansi;
}
function stripColors(str) {
return ('' + str)
.replace(/\x1b\[[0-9;]+m/g, '')
.replace(/\x1b\]8;;.*?\x07(.*?)\x1b\]8;;\x07/g, (_, group) => group);
}
exports.stripColors = stripColors;
// modifiers
exports.reset = kolorist(0, 0);
exports.bold = kolorist(1, 22);
exports.dim = kolorist(2, 22);
exports.italic = kolorist(3, 23);
exports.underline = kolorist(4, 24);
exports.inverse = kolorist(7, 27);
exports.hidden = kolorist(8, 28);
exports.strikethrough = kolorist(9, 29);
// colors
exports.black = kolorist(30, 39);
exports.red = kolorist(31, 39);
exports.green = kolorist(32, 39);
exports.yellow = kolorist(33, 39);
exports.blue = kolorist(34, 39);
exports.magenta = kolorist(35, 39);
exports.cyan = kolorist(36, 39);
exports.white = kolorist(97, 39);
exports.gray = kolorist(90, 39);
exports.lightGray = kolorist(37, 39);
exports.lightRed = kolorist(91, 39);
exports.lightGreen = kolorist(92, 39);
exports.lightYellow = kolorist(93, 39);
exports.lightBlue = kolorist(94, 39);
exports.lightMagenta = kolorist(95, 39);
exports.lightCyan = kolorist(96, 39);
// background colors
exports.bgBlack = kolorist(40, 49);
exports.bgRed = kolorist(41, 49);
exports.bgGreen = kolorist(42, 49);
exports.bgYellow = kolorist(43, 49);
exports.bgBlue = kolorist(44, 49);
exports.bgMagenta = kolorist(45, 49);
exports.bgCyan = kolorist(46, 49);
exports.bgWhite = kolorist(107, 49);
exports.bgGray = kolorist(100, 49);
exports.bgLightRed = kolorist(101, 49);
exports.bgLightGreen = kolorist(102, 49);
exports.bgLightYellow = kolorist(103, 49);
exports.bgLightBlue = kolorist(104, 49);
exports.bgLightMagenta = kolorist(105, 49);
exports.bgLightCyan = kolorist(106, 49);
exports.bgLightGray = kolorist(47, 49);
// 256 support
const ansi256 = (n) => kolorist('38;5;' + n, 0, 2 /* ansi256 */);
exports.ansi256 = ansi256;
const ansi256Bg = (n) => kolorist('48;5;' + n, 0, 2 /* ansi256 */);
exports.ansi256Bg = ansi256Bg;
// TrueColor 24bit support
const trueColor = (r, g, b) => {
return exports.options.supportLevel === 2 /* ansi256 */
? exports.ansi256(rgbToAnsi256(r, g, b))
: kolorist(`38;2;${r};${g};${b}`, 0, 3 /* trueColor */);
};
exports.trueColor = trueColor;
const trueColorBg = (r, g, b) => {
return exports.options.supportLevel === 2 /* ansi256 */
? exports.ansi256Bg(rgbToAnsi256(r, g, b))
: kolorist(`48;2;${r};${g};${b}`, 0, 3 /* trueColor */);
};
exports.trueColorBg = trueColorBg;
// Links
const OSC = '\u001B]';
const BEL = '\u0007';
const SEP = ';';
function link(text, url) {
return exports.options.enabled
? OSC + '8' + SEP + SEP + url + BEL + text + OSC + '8' + SEP + SEP + BEL
: `${text} (\u200B${url}\u200B)`;
}
exports.link = link;
//# sourceMappingURL=index.js.map

1
node_modules/kolorist/dist/cjs/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

167
node_modules/kolorist/dist/esm/index.js generated vendored Normal file
View File

@ -0,0 +1,167 @@
let enabled = true;
// Support both browser and node environments
const globalVar = typeof self !== 'undefined'
? self
: typeof window !== 'undefined'
? window
: typeof global !== 'undefined'
? global
: {};
/**
* Detect how much colors the current terminal supports
*/
let supportLevel = 0 /* none */;
if (globalVar.process && globalVar.process.env && globalVar.process.stdout) {
const { FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, COLORTERM } = globalVar.process.env;
if (NODE_DISABLE_COLORS || NO_COLOR || FORCE_COLOR === '0') {
enabled = false;
}
else if (FORCE_COLOR === '1' ||
FORCE_COLOR === '2' ||
FORCE_COLOR === '3') {
enabled = true;
}
else if (TERM === 'dumb') {
enabled = false;
}
else if ('CI' in globalVar.process.env &&
[
'TRAVIS',
'CIRCLECI',
'APPVEYOR',
'GITLAB_CI',
'GITHUB_ACTIONS',
'BUILDKITE',
'DRONE',
].some(vendor => vendor in globalVar.process.env)) {
enabled = true;
}
else {
enabled = process.stdout.isTTY;
}
if (enabled) {
// Windows supports 24bit True Colors since Windows 10 revision #14931,
// see https://devblogs.microsoft.com/commandline/24-bit-color-in-the-windows-console/
if (process.platform === 'win32') {
supportLevel = 3 /* trueColor */;
}
else {
if (COLORTERM && (COLORTERM === 'truecolor' || COLORTERM === '24bit')) {
supportLevel = 3 /* trueColor */;
}
else if (TERM && (TERM.endsWith('-256color') || TERM.endsWith('256'))) {
supportLevel = 2 /* ansi256 */;
}
else {
supportLevel = 1 /* ansi */;
}
}
}
}
export let options = {
enabled,
supportLevel,
};
function kolorist(start, end, level = 1 /* ansi */) {
const open = `\x1b[${start}m`;
const close = `\x1b[${end}m`;
const regex = new RegExp(`\\x1b\\[${end}m`, 'g');
return (str) => {
return options.enabled && options.supportLevel >= level
? open + ('' + str).replace(regex, open) + close
: '' + str;
};
}
// Lower colors into 256 color space
// Taken from https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
// which is MIT licensed and copyright by Heather Arthur and Josh Junon
function rgbToAnsi256(r, g, b) {
// We use the extended greyscale palette here, with the exception of
// black and white. normal palette only has 4 greyscale shades.
if (r >> 4 === g >> 4 && g >> 4 === b >> 4) {
if (r < 8) {
return 16;
}
if (r > 248) {
return 231;
}
return Math.round(((r - 8) / 247) * 24) + 232;
}
const ansi = 16 +
36 * Math.round((r / 255) * 5) +
6 * Math.round((g / 255) * 5) +
Math.round((b / 255) * 5);
return ansi;
}
export function stripColors(str) {
return ('' + str)
.replace(/\x1b\[[0-9;]+m/g, '')
.replace(/\x1b\]8;;.*?\x07(.*?)\x1b\]8;;\x07/g, (_, group) => group);
}
// modifiers
export const reset = kolorist(0, 0);
export const bold = kolorist(1, 22);
export const dim = kolorist(2, 22);
export const italic = kolorist(3, 23);
export const underline = kolorist(4, 24);
export const inverse = kolorist(7, 27);
export const hidden = kolorist(8, 28);
export const strikethrough = kolorist(9, 29);
// colors
export const black = kolorist(30, 39);
export const red = kolorist(31, 39);
export const green = kolorist(32, 39);
export const yellow = kolorist(33, 39);
export const blue = kolorist(34, 39);
export const magenta = kolorist(35, 39);
export const cyan = kolorist(36, 39);
export const white = kolorist(97, 39);
export const gray = kolorist(90, 39);
export const lightGray = kolorist(37, 39);
export const lightRed = kolorist(91, 39);
export const lightGreen = kolorist(92, 39);
export const lightYellow = kolorist(93, 39);
export const lightBlue = kolorist(94, 39);
export const lightMagenta = kolorist(95, 39);
export const lightCyan = kolorist(96, 39);
// background colors
export const bgBlack = kolorist(40, 49);
export const bgRed = kolorist(41, 49);
export const bgGreen = kolorist(42, 49);
export const bgYellow = kolorist(43, 49);
export const bgBlue = kolorist(44, 49);
export const bgMagenta = kolorist(45, 49);
export const bgCyan = kolorist(46, 49);
export const bgWhite = kolorist(107, 49);
export const bgGray = kolorist(100, 49);
export const bgLightRed = kolorist(101, 49);
export const bgLightGreen = kolorist(102, 49);
export const bgLightYellow = kolorist(103, 49);
export const bgLightBlue = kolorist(104, 49);
export const bgLightMagenta = kolorist(105, 49);
export const bgLightCyan = kolorist(106, 49);
export const bgLightGray = kolorist(47, 49);
// 256 support
export const ansi256 = (n) => kolorist('38;5;' + n, 0, 2 /* ansi256 */);
export const ansi256Bg = (n) => kolorist('48;5;' + n, 0, 2 /* ansi256 */);
// TrueColor 24bit support
export const trueColor = (r, g, b) => {
return options.supportLevel === 2 /* ansi256 */
? ansi256(rgbToAnsi256(r, g, b))
: kolorist(`38;2;${r};${g};${b}`, 0, 3 /* trueColor */);
};
export const trueColorBg = (r, g, b) => {
return options.supportLevel === 2 /* ansi256 */
? ansi256Bg(rgbToAnsi256(r, g, b))
: kolorist(`48;2;${r};${g};${b}`, 0, 3 /* trueColor */);
};
// Links
const OSC = '\u001B]';
const BEL = '\u0007';
const SEP = ';';
export function link(text, url) {
return options.enabled
? OSC + '8' + SEP + SEP + url + BEL + text + OSC + '8' + SEP + SEP + BEL
: `${text} (\u200B${url}\u200B)`;
}
//# sourceMappingURL=index.js.map

1
node_modules/kolorist/dist/esm/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

167
node_modules/kolorist/dist/esm/index.mjs generated vendored Normal file
View File

@ -0,0 +1,167 @@
let enabled = true;
// Support both browser and node environments
const globalVar = typeof self !== 'undefined'
? self
: typeof window !== 'undefined'
? window
: typeof global !== 'undefined'
? global
: {};
/**
* Detect how much colors the current terminal supports
*/
let supportLevel = 0 /* none */;
if (globalVar.process && globalVar.process.env && globalVar.process.stdout) {
const { FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, COLORTERM } = globalVar.process.env;
if (NODE_DISABLE_COLORS || NO_COLOR || FORCE_COLOR === '0') {
enabled = false;
}
else if (FORCE_COLOR === '1' ||
FORCE_COLOR === '2' ||
FORCE_COLOR === '3') {
enabled = true;
}
else if (TERM === 'dumb') {
enabled = false;
}
else if ('CI' in globalVar.process.env &&
[
'TRAVIS',
'CIRCLECI',
'APPVEYOR',
'GITLAB_CI',
'GITHUB_ACTIONS',
'BUILDKITE',
'DRONE',
].some(vendor => vendor in globalVar.process.env)) {
enabled = true;
}
else {
enabled = process.stdout.isTTY;
}
if (enabled) {
// Windows supports 24bit True Colors since Windows 10 revision #14931,
// see https://devblogs.microsoft.com/commandline/24-bit-color-in-the-windows-console/
if (process.platform === 'win32') {
supportLevel = 3 /* trueColor */;
}
else {
if (COLORTERM && (COLORTERM === 'truecolor' || COLORTERM === '24bit')) {
supportLevel = 3 /* trueColor */;
}
else if (TERM && (TERM.endsWith('-256color') || TERM.endsWith('256'))) {
supportLevel = 2 /* ansi256 */;
}
else {
supportLevel = 1 /* ansi */;
}
}
}
}
export let options = {
enabled,
supportLevel,
};
function kolorist(start, end, level = 1 /* ansi */) {
const open = `\x1b[${start}m`;
const close = `\x1b[${end}m`;
const regex = new RegExp(`\\x1b\\[${end}m`, 'g');
return (str) => {
return options.enabled && options.supportLevel >= level
? open + ('' + str).replace(regex, open) + close
: '' + str;
};
}
// Lower colors into 256 color space
// Taken from https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
// which is MIT licensed and copyright by Heather Arthur and Josh Junon
function rgbToAnsi256(r, g, b) {
// We use the extended greyscale palette here, with the exception of
// black and white. normal palette only has 4 greyscale shades.
if (r >> 4 === g >> 4 && g >> 4 === b >> 4) {
if (r < 8) {
return 16;
}
if (r > 248) {
return 231;
}
return Math.round(((r - 8) / 247) * 24) + 232;
}
const ansi = 16 +
36 * Math.round((r / 255) * 5) +
6 * Math.round((g / 255) * 5) +
Math.round((b / 255) * 5);
return ansi;
}
export function stripColors(str) {
return ('' + str)
.replace(/\x1b\[[0-9;]+m/g, '')
.replace(/\x1b\]8;;.*?\x07(.*?)\x1b\]8;;\x07/g, (_, group) => group);
}
// modifiers
export const reset = kolorist(0, 0);
export const bold = kolorist(1, 22);
export const dim = kolorist(2, 22);
export const italic = kolorist(3, 23);
export const underline = kolorist(4, 24);
export const inverse = kolorist(7, 27);
export const hidden = kolorist(8, 28);
export const strikethrough = kolorist(9, 29);
// colors
export const black = kolorist(30, 39);
export const red = kolorist(31, 39);
export const green = kolorist(32, 39);
export const yellow = kolorist(33, 39);
export const blue = kolorist(34, 39);
export const magenta = kolorist(35, 39);
export const cyan = kolorist(36, 39);
export const white = kolorist(97, 39);
export const gray = kolorist(90, 39);
export const lightGray = kolorist(37, 39);
export const lightRed = kolorist(91, 39);
export const lightGreen = kolorist(92, 39);
export const lightYellow = kolorist(93, 39);
export const lightBlue = kolorist(94, 39);
export const lightMagenta = kolorist(95, 39);
export const lightCyan = kolorist(96, 39);
// background colors
export const bgBlack = kolorist(40, 49);
export const bgRed = kolorist(41, 49);
export const bgGreen = kolorist(42, 49);
export const bgYellow = kolorist(43, 49);
export const bgBlue = kolorist(44, 49);
export const bgMagenta = kolorist(45, 49);
export const bgCyan = kolorist(46, 49);
export const bgWhite = kolorist(107, 49);
export const bgGray = kolorist(100, 49);
export const bgLightRed = kolorist(101, 49);
export const bgLightGreen = kolorist(102, 49);
export const bgLightYellow = kolorist(103, 49);
export const bgLightBlue = kolorist(104, 49);
export const bgLightMagenta = kolorist(105, 49);
export const bgLightCyan = kolorist(106, 49);
export const bgLightGray = kolorist(47, 49);
// 256 support
export const ansi256 = (n) => kolorist('38;5;' + n, 0, 2 /* ansi256 */);
export const ansi256Bg = (n) => kolorist('48;5;' + n, 0, 2 /* ansi256 */);
// TrueColor 24bit support
export const trueColor = (r, g, b) => {
return options.supportLevel === 2 /* ansi256 */
? ansi256(rgbToAnsi256(r, g, b))
: kolorist(`38;2;${r};${g};${b}`, 0, 3 /* trueColor */);
};
export const trueColorBg = (r, g, b) => {
return options.supportLevel === 2 /* ansi256 */
? ansi256Bg(rgbToAnsi256(r, g, b))
: kolorist(`48;2;${r};${g};${b}`, 0, 3 /* trueColor */);
};
// Links
const OSC = '\u001B]';
const BEL = '\u0007';
const SEP = ';';
export function link(text, url) {
return options.enabled
? OSC + '8' + SEP + SEP + url + BEL + text + OSC + '8' + SEP + SEP + BEL
: `${text} (\u200B${url}\u200B)`;
}
//# sourceMappingURL=index.js.map

172
node_modules/kolorist/dist/module/index.js generated vendored Normal file
View File

@ -0,0 +1,172 @@
var enabled = true;
// Support both browser and node environments
var globalVar = typeof self !== 'undefined'
? self
: typeof window !== 'undefined'
? window
: typeof global !== 'undefined'
? global
: {};
/**
* Detect how much colors the current terminal supports
*/
var supportLevel = 0 /* none */;
if (globalVar.process && globalVar.process.env && globalVar.process.stdout) {
var _a = globalVar.process.env, FORCE_COLOR = _a.FORCE_COLOR, NODE_DISABLE_COLORS = _a.NODE_DISABLE_COLORS, NO_COLOR = _a.NO_COLOR, TERM = _a.TERM, COLORTERM = _a.COLORTERM;
if (NODE_DISABLE_COLORS || NO_COLOR || FORCE_COLOR === '0') {
enabled = false;
}
else if (FORCE_COLOR === '1' ||
FORCE_COLOR === '2' ||
FORCE_COLOR === '3') {
enabled = true;
}
else if (TERM === 'dumb') {
enabled = false;
}
else if ('CI' in globalVar.process.env &&
[
'TRAVIS',
'CIRCLECI',
'APPVEYOR',
'GITLAB_CI',
'GITHUB_ACTIONS',
'BUILDKITE',
'DRONE',
].some(function (vendor) { return vendor in globalVar.process.env; })) {
enabled = true;
}
else {
enabled = process.stdout.isTTY;
}
if (enabled) {
// Windows supports 24bit True Colors since Windows 10 revision #14931,
// see https://devblogs.microsoft.com/commandline/24-bit-color-in-the-windows-console/
if (process.platform === 'win32') {
supportLevel = 3 /* trueColor */;
}
else {
if (COLORTERM && (COLORTERM === 'truecolor' || COLORTERM === '24bit')) {
supportLevel = 3 /* trueColor */;
}
else if (TERM && (TERM.endsWith('-256color') || TERM.endsWith('256'))) {
supportLevel = 2 /* ansi256 */;
}
else {
supportLevel = 1 /* ansi */;
}
}
}
}
export var options = {
enabled: enabled,
supportLevel: supportLevel,
};
function kolorist(start, end, level) {
if (level === void 0) { level = 1 /* ansi */; }
var open = "\u001B[" + start + "m";
var close = "\u001B[" + end + "m";
var regex = new RegExp("\\x1b\\[" + end + "m", 'g');
return function (str) {
return options.enabled && options.supportLevel >= level
? open + ('' + str).replace(regex, open) + close
: '' + str;
};
}
// Lower colors into 256 color space
// Taken from https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
// which is MIT licensed and copyright by Heather Arthur and Josh Junon
function rgbToAnsi256(r, g, b) {
// We use the extended greyscale palette here, with the exception of
// black and white. normal palette only has 4 greyscale shades.
if (r >> 4 === g >> 4 && g >> 4 === b >> 4) {
if (r < 8) {
return 16;
}
if (r > 248) {
return 231;
}
return Math.round(((r - 8) / 247) * 24) + 232;
}
var ansi = 16 +
36 * Math.round((r / 255) * 5) +
6 * Math.round((g / 255) * 5) +
Math.round((b / 255) * 5);
return ansi;
}
export function stripColors(str) {
return ('' + str)
.replace(/\x1b\[[0-9;]+m/g, '')
.replace(/\x1b\]8;;.*?\x07(.*?)\x1b\]8;;\x07/g, function (_, group) { return group; });
}
// modifiers
export var reset = kolorist(0, 0);
export var bold = kolorist(1, 22);
export var dim = kolorist(2, 22);
export var italic = kolorist(3, 23);
export var underline = kolorist(4, 24);
export var inverse = kolorist(7, 27);
export var hidden = kolorist(8, 28);
export var strikethrough = kolorist(9, 29);
// colors
export var black = kolorist(30, 39);
export var red = kolorist(31, 39);
export var green = kolorist(32, 39);
export var yellow = kolorist(33, 39);
export var blue = kolorist(34, 39);
export var magenta = kolorist(35, 39);
export var cyan = kolorist(36, 39);
export var white = kolorist(97, 39);
export var gray = kolorist(90, 39);
export var lightGray = kolorist(37, 39);
export var lightRed = kolorist(91, 39);
export var lightGreen = kolorist(92, 39);
export var lightYellow = kolorist(93, 39);
export var lightBlue = kolorist(94, 39);
export var lightMagenta = kolorist(95, 39);
export var lightCyan = kolorist(96, 39);
// background colors
export var bgBlack = kolorist(40, 49);
export var bgRed = kolorist(41, 49);
export var bgGreen = kolorist(42, 49);
export var bgYellow = kolorist(43, 49);
export var bgBlue = kolorist(44, 49);
export var bgMagenta = kolorist(45, 49);
export var bgCyan = kolorist(46, 49);
export var bgWhite = kolorist(107, 49);
export var bgGray = kolorist(100, 49);
export var bgLightRed = kolorist(101, 49);
export var bgLightGreen = kolorist(102, 49);
export var bgLightYellow = kolorist(103, 49);
export var bgLightBlue = kolorist(104, 49);
export var bgLightMagenta = kolorist(105, 49);
export var bgLightCyan = kolorist(106, 49);
export var bgLightGray = kolorist(47, 49);
// 256 support
export var ansi256 = function (n) {
return kolorist('38;5;' + n, 0, 2 /* ansi256 */);
};
export var ansi256Bg = function (n) {
return kolorist('48;5;' + n, 0, 2 /* ansi256 */);
};
// TrueColor 24bit support
export var trueColor = function (r, g, b) {
return options.supportLevel === 2 /* ansi256 */
? ansi256(rgbToAnsi256(r, g, b))
: kolorist("38;2;" + r + ";" + g + ";" + b, 0, 3 /* trueColor */);
};
export var trueColorBg = function (r, g, b) {
return options.supportLevel === 2 /* ansi256 */
? ansi256Bg(rgbToAnsi256(r, g, b))
: kolorist("48;2;" + r + ";" + g + ";" + b, 0, 3 /* trueColor */);
};
// Links
var OSC = '\u001B]';
var BEL = '\u0007';
var SEP = ';';
export function link(text, url) {
return options.enabled
? OSC + '8' + SEP + SEP + url + BEL + text + OSC + '8' + SEP + SEP + BEL
: text + " (\u200B" + url + "\u200B)";
}
//# sourceMappingURL=index.js.map

1
node_modules/kolorist/dist/module/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

56
node_modules/kolorist/dist/types/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,56 @@
export declare const enum SupportLevel {
none = 0,
ansi = 1,
ansi256 = 2,
trueColor = 3
}
export declare let options: {
enabled: boolean;
supportLevel: SupportLevel;
};
export declare function stripColors(str: string | number): string;
export declare const reset: (str: string | number) => string;
export declare const bold: (str: string | number) => string;
export declare const dim: (str: string | number) => string;
export declare const italic: (str: string | number) => string;
export declare const underline: (str: string | number) => string;
export declare const inverse: (str: string | number) => string;
export declare const hidden: (str: string | number) => string;
export declare const strikethrough: (str: string | number) => string;
export declare const black: (str: string | number) => string;
export declare const red: (str: string | number) => string;
export declare const green: (str: string | number) => string;
export declare const yellow: (str: string | number) => string;
export declare const blue: (str: string | number) => string;
export declare const magenta: (str: string | number) => string;
export declare const cyan: (str: string | number) => string;
export declare const white: (str: string | number) => string;
export declare const gray: (str: string | number) => string;
export declare const lightGray: (str: string | number) => string;
export declare const lightRed: (str: string | number) => string;
export declare const lightGreen: (str: string | number) => string;
export declare const lightYellow: (str: string | number) => string;
export declare const lightBlue: (str: string | number) => string;
export declare const lightMagenta: (str: string | number) => string;
export declare const lightCyan: (str: string | number) => string;
export declare const bgBlack: (str: string | number) => string;
export declare const bgRed: (str: string | number) => string;
export declare const bgGreen: (str: string | number) => string;
export declare const bgYellow: (str: string | number) => string;
export declare const bgBlue: (str: string | number) => string;
export declare const bgMagenta: (str: string | number) => string;
export declare const bgCyan: (str: string | number) => string;
export declare const bgWhite: (str: string | number) => string;
export declare const bgGray: (str: string | number) => string;
export declare const bgLightRed: (str: string | number) => string;
export declare const bgLightGreen: (str: string | number) => string;
export declare const bgLightYellow: (str: string | number) => string;
export declare const bgLightBlue: (str: string | number) => string;
export declare const bgLightMagenta: (str: string | number) => string;
export declare const bgLightCyan: (str: string | number) => string;
export declare const bgLightGray: (str: string | number) => string;
export declare const ansi256: (n: number) => (str: string | number) => string;
export declare const ansi256Bg: (n: number) => (str: string | number) => string;
export declare const trueColor: (r: number, g: number, b: number) => (str: string | number) => string;
export declare const trueColorBg: (r: number, g: number, b: number) => (str: string | number) => string;
export declare function link(text: string, url: string): string;

48
node_modules/kolorist/package.json generated vendored Normal file
View File

@ -0,0 +1,48 @@
{
"name": "kolorist",
"version": "1.8.0",
"description": "A tiny utility to colorize stdin/stdout",
"main": "dist/cjs/index.js",
"module": "dist/module/index.js",
"types": "dist/types/index.d.ts",
"scripts": {
"test": "mocha -r @esbuild-kit/cjs-loader --extension ts,js src/*.test.ts",
"build": "rimraf dist/ && tsc && tsc -p tsconfig.module.json && tsc -p tsconfig.esm.json && node tools/post-build.js",
"prepublishOnly": "npm run build"
},
"author": "Marvin Hagemeister <hello@marvinh.dev>",
"repository": {
"type": "git",
"url": "https://github.com/marvinhagemeister/kolorist.git"
},
"license": "MIT",
"devDependencies": {
"@changesets/cli": "^2.26.0",
"@esbuild-kit/cjs-loader": "^2.4.1",
"@types/mocha": "^8.2.1",
"@types/node": "^14.14.35",
"mocha": "^8.3.2",
"node-pty": "^0.10.0",
"prettier": "^2.2.1",
"rimraf": "^3.0.2",
"typescript": "^4.2.3"
},
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"browser": "./dist/module/index.js",
"import": "./dist/esm/index.mjs",
"require": "./dist/cjs/index.js"
},
"./package.json": "./package.json",
"./*": "./*"
},
"files": [
"dist/"
],
"prettier": {
"useTabs": true,
"arrowParens": "avoid",
"singleQuote": true
}
}