Skip to content

Commit 7e35811

Browse files
Update dev dependencies (#84)
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
1 parent c325165 commit 7e35811

6 files changed

Lines changed: 36 additions & 24 deletions

File tree

.github/workflows/main.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13-
- 14
14-
- 12
13+
- 22
14+
- 20
15+
- 18
1516
steps:
16-
- uses: actions/checkout@v2
17-
- uses: actions/setup-node@v2
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
1819
with:
1920
node-version: ${{ matrix.node-version }}
2021
- run: npm install

index.d.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export interface CSPair { // eslint-disable-line @typescript-eslint/naming-convention
1+
export type CSPair = { // eslint-disable-line @typescript-eslint/naming-convention
22
/**
33
The ANSI terminal control sequence for starting this style.
44
*/
@@ -8,9 +8,9 @@ export interface CSPair { // eslint-disable-line @typescript-eslint/naming-conve
88
The ANSI terminal control sequence for ending this style.
99
*/
1010
readonly close: string;
11-
}
11+
};
1212

13-
export interface ColorBase {
13+
export type ColorBase = {
1414
/**
1515
The ANSI terminal control sequence for ending this color.
1616
*/
@@ -21,9 +21,9 @@ export interface ColorBase {
2121
ansi256(code: number): string;
2222

2323
ansi16m(red: number, green: number, blue: number): string;
24-
}
24+
};
2525

26-
export interface Modifier {
26+
export type Modifier = {
2727
/**
2828
Resets the current color chain.
2929
*/
@@ -70,9 +70,9 @@ export interface Modifier {
7070
Puts a horizontal line through the center of the text. (Not widely supported)
7171
*/
7272
readonly strikethrough: CSPair;
73-
}
73+
};
7474

75-
export interface ForegroundColor {
75+
export type ForegroundColor = {
7676
readonly black: CSPair;
7777
readonly red: CSPair;
7878
readonly green: CSPair;
@@ -100,9 +100,9 @@ export interface ForegroundColor {
100100
readonly cyanBright: CSPair;
101101
readonly magentaBright: CSPair;
102102
readonly whiteBright: CSPair;
103-
}
103+
};
104104

105-
export interface BackgroundColor {
105+
export type BackgroundColor = {
106106
readonly bgBlack: CSPair;
107107
readonly bgRed: CSPair;
108108
readonly bgGreen: CSPair;
@@ -130,9 +130,9 @@ export interface BackgroundColor {
130130
readonly bgCyanBright: CSPair;
131131
readonly bgMagentaBright: CSPair;
132132
readonly bgWhiteBright: CSPair;
133-
}
133+
};
134134

135-
export interface ConvertColor {
135+
export type ConvertColor = {
136136
/**
137137
Convert from the RGB color space to the ANSI 256 color space.
138138
@@ -178,7 +178,7 @@ export interface ConvertColor {
178178
@param hex - A hexadecimal string containing RGB data.
179179
*/
180180
hexToAnsi(hex: string): number;
181-
}
181+
};
182182

183183
/**
184184
Basic modifier names.

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function assembleStyles() {
109109
// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
110110
Object.defineProperties(styles, {
111111
rgbToAnsi256: {
112-
value: (red, green, blue) => {
112+
value(red, green, blue) {
113113
// We use the extended greyscale palette here, with the exception of
114114
// black and white. normal palette only has 4 greyscale shades.
115115
if (red === green && green === blue) {
@@ -132,7 +132,7 @@ function assembleStyles() {
132132
enumerable: false,
133133
},
134134
hexToRgb: {
135-
value: hex => {
135+
value(hex) {
136136
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
137137
if (!matches) {
138138
return [0, 0, 0];
@@ -161,7 +161,7 @@ function assembleStyles() {
161161
enumerable: false,
162162
},
163163
ansi256ToAnsi: {
164-
value: code => {
164+
value(code) {
165165
if (code < 8) {
166166
return 30 + code;
167167
}

index.test-d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import {expectAssignable, expectError, expectType} from 'tsd';
2-
import ansiStyles, {CSPair, ModifierName, ForegroundColorName, BackgroundColorName, ColorName} from './index.js';
2+
import ansiStyles, {
3+
type BackgroundColorName,
4+
type ColorName,
5+
type CSPair,
6+
type ForegroundColorName,
7+
type ModifierName,
8+
} from './index.js';
39

410
expectType<ReadonlyMap<number, number>>(ansiStyles.codes);
511

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
"text"
4747
],
4848
"devDependencies": {
49-
"ava": "^3.15.0",
49+
"ava": "^6.1.3",
5050
"svg-term-cli": "^2.1.1",
51-
"tsd": "^0.19.0",
52-
"xo": "^0.47.0"
51+
"tsd": "^0.31.1",
52+
"xo": "^0.58.0"
5353
}
5454
}

test/test.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import test from 'ava';
2-
import ansiStyles, {modifierNames, foregroundColorNames, backgroundColorNames, colorNames} from '../index.js';
2+
import ansiStyles, {
3+
backgroundColorNames,
4+
colorNames,
5+
foregroundColorNames,
6+
modifierNames,
7+
} from '../index.js';
38

49
test('return ANSI escape codes', t => {
510
t.is(ansiStyles.green.open, '\u001B[32m');

0 commit comments

Comments
 (0)