Bump dependencies
This commit is contained in:
parent
92c55db46f
commit
629d4e4890
2 changed files with 72 additions and 65 deletions
5
source/vendor/ansi-styles/index.d.ts
vendored
5
source/vendor/ansi-styles/index.d.ts
vendored
|
|
@ -187,4 +187,9 @@ declare const ansiStyles: {
|
||||||
readonly codes: ReadonlyMap<number, number>;
|
readonly codes: ReadonlyMap<number, number>;
|
||||||
} & ForegroundColor & BackgroundColor & Modifier & ConvertColor;
|
} & ForegroundColor & BackgroundColor & Modifier & ConvertColor;
|
||||||
|
|
||||||
|
declare const modifiers: readonly Modifier[];
|
||||||
|
declare const foregroundColors: readonly ForegroundColor[];
|
||||||
|
declare const backgroundColors: readonly BackgroundColor[];
|
||||||
|
declare const colors: readonly Color[];
|
||||||
|
|
||||||
export default ansiStyles;
|
export default ansiStyles;
|
||||||
|
|
|
||||||
132
source/vendor/ansi-styles/index.js
vendored
132
source/vendor/ansi-styles/index.js
vendored
|
|
@ -6,68 +6,67 @@ const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
|
||||||
|
|
||||||
const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
|
const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
|
||||||
|
|
||||||
|
const styles = {
|
||||||
|
modifier: {
|
||||||
|
reset: [0, 0],
|
||||||
|
// 21 isn't widely supported and 22 does the same thing
|
||||||
|
bold: [1, 22],
|
||||||
|
dim: [2, 22],
|
||||||
|
italic: [3, 23],
|
||||||
|
underline: [4, 24],
|
||||||
|
overline: [53, 55],
|
||||||
|
inverse: [7, 27],
|
||||||
|
hidden: [8, 28],
|
||||||
|
strikethrough: [9, 29],
|
||||||
|
},
|
||||||
|
color: {
|
||||||
|
black: [30, 39],
|
||||||
|
red: [31, 39],
|
||||||
|
green: [32, 39],
|
||||||
|
yellow: [33, 39],
|
||||||
|
blue: [34, 39],
|
||||||
|
magenta: [35, 39],
|
||||||
|
cyan: [36, 39],
|
||||||
|
white: [37, 39],
|
||||||
|
|
||||||
|
// Bright color
|
||||||
|
blackBright: [90, 39],
|
||||||
|
gray: [90, 39], // Alias of `blackBright`
|
||||||
|
grey: [90, 39], // Alias of `blackBright`
|
||||||
|
redBright: [91, 39],
|
||||||
|
greenBright: [92, 39],
|
||||||
|
yellowBright: [93, 39],
|
||||||
|
blueBright: [94, 39],
|
||||||
|
magentaBright: [95, 39],
|
||||||
|
cyanBright: [96, 39],
|
||||||
|
whiteBright: [97, 39],
|
||||||
|
},
|
||||||
|
bgColor: {
|
||||||
|
bgBlack: [40, 49],
|
||||||
|
bgRed: [41, 49],
|
||||||
|
bgGreen: [42, 49],
|
||||||
|
bgYellow: [43, 49],
|
||||||
|
bgBlue: [44, 49],
|
||||||
|
bgMagenta: [45, 49],
|
||||||
|
bgCyan: [46, 49],
|
||||||
|
bgWhite: [47, 49],
|
||||||
|
|
||||||
|
// Bright color
|
||||||
|
bgBlackBright: [100, 49],
|
||||||
|
bgGray: [100, 49], // Alias of `bgBlackBright`
|
||||||
|
bgGrey: [100, 49], // Alias of `bgBlackBright`
|
||||||
|
bgRedBright: [101, 49],
|
||||||
|
bgGreenBright: [102, 49],
|
||||||
|
bgYellowBright: [103, 49],
|
||||||
|
bgBlueBright: [104, 49],
|
||||||
|
bgMagentaBright: [105, 49],
|
||||||
|
bgCyanBright: [106, 49],
|
||||||
|
bgWhiteBright: [107, 49],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
function assembleStyles() {
|
function assembleStyles() {
|
||||||
const codes = new Map();
|
const codes = new Map();
|
||||||
const styles = {
|
|
||||||
modifier: {
|
|
||||||
reset: [0, 0],
|
|
||||||
// 21 isn't widely supported and 22 does the same thing
|
|
||||||
bold: [1, 22],
|
|
||||||
dim: [2, 22],
|
|
||||||
italic: [3, 23],
|
|
||||||
underline: [4, 24],
|
|
||||||
overline: [53, 55],
|
|
||||||
inverse: [7, 27],
|
|
||||||
hidden: [8, 28],
|
|
||||||
strikethrough: [9, 29],
|
|
||||||
},
|
|
||||||
color: {
|
|
||||||
black: [30, 39],
|
|
||||||
red: [31, 39],
|
|
||||||
green: [32, 39],
|
|
||||||
yellow: [33, 39],
|
|
||||||
blue: [34, 39],
|
|
||||||
magenta: [35, 39],
|
|
||||||
cyan: [36, 39],
|
|
||||||
white: [37, 39],
|
|
||||||
|
|
||||||
// Bright color
|
|
||||||
blackBright: [90, 39],
|
|
||||||
redBright: [91, 39],
|
|
||||||
greenBright: [92, 39],
|
|
||||||
yellowBright: [93, 39],
|
|
||||||
blueBright: [94, 39],
|
|
||||||
magentaBright: [95, 39],
|
|
||||||
cyanBright: [96, 39],
|
|
||||||
whiteBright: [97, 39],
|
|
||||||
},
|
|
||||||
bgColor: {
|
|
||||||
bgBlack: [40, 49],
|
|
||||||
bgRed: [41, 49],
|
|
||||||
bgGreen: [42, 49],
|
|
||||||
bgYellow: [43, 49],
|
|
||||||
bgBlue: [44, 49],
|
|
||||||
bgMagenta: [45, 49],
|
|
||||||
bgCyan: [46, 49],
|
|
||||||
bgWhite: [47, 49],
|
|
||||||
|
|
||||||
// Bright color
|
|
||||||
bgBlackBright: [100, 49],
|
|
||||||
bgRedBright: [101, 49],
|
|
||||||
bgGreenBright: [102, 49],
|
|
||||||
bgYellowBright: [103, 49],
|
|
||||||
bgBlueBright: [104, 49],
|
|
||||||
bgMagentaBright: [105, 49],
|
|
||||||
bgCyanBright: [106, 49],
|
|
||||||
bgWhiteBright: [107, 49],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// Alias bright black as gray (and grey)
|
|
||||||
styles.color.gray = styles.color.blackBright;
|
|
||||||
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
|
||||||
styles.color.grey = styles.color.blackBright;
|
|
||||||
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
|
||||||
|
|
||||||
for (const [groupName, group] of Object.entries(styles)) {
|
for (const [groupName, group] of Object.entries(styles)) {
|
||||||
for (const [styleName, style] of Object.entries(group)) {
|
for (const [styleName, style] of Object.entries(group)) {
|
||||||
|
|
@ -105,7 +104,7 @@ function assembleStyles() {
|
||||||
// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
|
// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
|
||||||
Object.defineProperties(styles, {
|
Object.defineProperties(styles, {
|
||||||
rgbToAnsi256: {
|
rgbToAnsi256: {
|
||||||
value(red, green, blue) {
|
value: (red, green, blue) => {
|
||||||
// We use the extended greyscale palette here, with the exception of
|
// We use the extended greyscale palette here, with the exception of
|
||||||
// black and white. normal palette only has 4 greyscale shades.
|
// black and white. normal palette only has 4 greyscale shades.
|
||||||
if (red === green && green === blue) {
|
if (red === green && green === blue) {
|
||||||
|
|
@ -128,13 +127,13 @@ function assembleStyles() {
|
||||||
enumerable: false,
|
enumerable: false,
|
||||||
},
|
},
|
||||||
hexToRgb: {
|
hexToRgb: {
|
||||||
value(hex) {
|
value: hex => {
|
||||||
const matches = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16));
|
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
||||||
if (!matches) {
|
if (!matches) {
|
||||||
return [0, 0, 0];
|
return [0, 0, 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
let {colorString} = matches.groups;
|
let [colorString] = matches;
|
||||||
|
|
||||||
if (colorString.length === 3) {
|
if (colorString.length === 3) {
|
||||||
colorString = [...colorString].map(character => character + character).join('');
|
colorString = [...colorString].map(character => character + character).join('');
|
||||||
|
|
@ -157,7 +156,7 @@ function assembleStyles() {
|
||||||
enumerable: false,
|
enumerable: false,
|
||||||
},
|
},
|
||||||
ansi256ToAnsi: {
|
ansi256ToAnsi: {
|
||||||
value(code) {
|
value: code => {
|
||||||
if (code < 8) {
|
if (code < 8) {
|
||||||
return 30 + code;
|
return 30 + code;
|
||||||
}
|
}
|
||||||
|
|
@ -215,5 +214,8 @@ function assembleStyles() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const ansiStyles = assembleStyles();
|
const ansiStyles = assembleStyles();
|
||||||
|
export const modifiers = Object.keys(styles.modifier);
|
||||||
|
export const foregroundColors = Object.keys(styles.color);
|
||||||
|
export const backgroundColors = Object.keys(styles.bgColor);
|
||||||
|
|
||||||
export default ansiStyles;
|
export default ansiStyles;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue