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;
|
||||||
|
|
|
||||||
30
source/vendor/ansi-styles/index.js
vendored
30
source/vendor/ansi-styles/index.js
vendored
|
|
@ -6,9 +6,7 @@ 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`;
|
||||||
|
|
||||||
function assembleStyles() {
|
const styles = {
|
||||||
const codes = new Map();
|
|
||||||
const styles = {
|
|
||||||
modifier: {
|
modifier: {
|
||||||
reset: [0, 0],
|
reset: [0, 0],
|
||||||
// 21 isn't widely supported and 22 does the same thing
|
// 21 isn't widely supported and 22 does the same thing
|
||||||
|
|
@ -33,6 +31,8 @@ function assembleStyles() {
|
||||||
|
|
||||||
// Bright color
|
// Bright color
|
||||||
blackBright: [90, 39],
|
blackBright: [90, 39],
|
||||||
|
gray: [90, 39], // Alias of `blackBright`
|
||||||
|
grey: [90, 39], // Alias of `blackBright`
|
||||||
redBright: [91, 39],
|
redBright: [91, 39],
|
||||||
greenBright: [92, 39],
|
greenBright: [92, 39],
|
||||||
yellowBright: [93, 39],
|
yellowBright: [93, 39],
|
||||||
|
|
@ -53,6 +53,8 @@ function assembleStyles() {
|
||||||
|
|
||||||
// Bright color
|
// Bright color
|
||||||
bgBlackBright: [100, 49],
|
bgBlackBright: [100, 49],
|
||||||
|
bgGray: [100, 49], // Alias of `bgBlackBright`
|
||||||
|
bgGrey: [100, 49], // Alias of `bgBlackBright`
|
||||||
bgRedBright: [101, 49],
|
bgRedBright: [101, 49],
|
||||||
bgGreenBright: [102, 49],
|
bgGreenBright: [102, 49],
|
||||||
bgYellowBright: [103, 49],
|
bgYellowBright: [103, 49],
|
||||||
|
|
@ -61,13 +63,10 @@ function assembleStyles() {
|
||||||
bgCyanBright: [106, 49],
|
bgCyanBright: [106, 49],
|
||||||
bgWhiteBright: [107, 49],
|
bgWhiteBright: [107, 49],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Alias bright black as gray (and grey)
|
function assembleStyles() {
|
||||||
styles.color.gray = styles.color.blackBright;
|
const codes = new Map();
|
||||||
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