Skip to content

Commit c25c32a

Browse files
committed
Update dependencies
1 parent 655653b commit c25c32a

7 files changed

Lines changed: 56 additions & 30 deletions

File tree

index.d.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,17 @@ declare namespace chalk {
261261
readonly magenta: Chalk;
262262
readonly cyan: Chalk;
263263
readonly white: Chalk;
264+
265+
/*
266+
Alias for `blackBright`.
267+
*/
264268
readonly gray: Chalk;
269+
270+
/*
271+
Alias for `blackBright`.
272+
*/
265273
readonly grey: Chalk;
274+
266275
readonly blackBright: Chalk;
267276
readonly redBright: Chalk;
268277
readonly greenBright: Chalk;
@@ -280,6 +289,17 @@ declare namespace chalk {
280289
readonly bgMagenta: Chalk;
281290
readonly bgCyan: Chalk;
282291
readonly bgWhite: Chalk;
292+
293+
/*
294+
Alias for `bgBlackBright`.
295+
*/
296+
readonly bgGray: Chalk;
297+
298+
/*
299+
Alias for `bgBlackBright`.
300+
*/
301+
readonly bgGrey: Chalk;
302+
283303
readonly bgBlackBright: Chalk;
284304
readonly bgRedBright: Chalk;
285305
readonly bgGreenBright: Chalk;

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@
4040
"text"
4141
],
4242
"dependencies": {
43-
"ansi-styles": "^3.2.1",
44-
"supports-color": "^6.1.0"
43+
"ansi-styles": "^4.0.0",
44+
"supports-color": "^7.0.0"
4545
},
4646
"devDependencies": {
47-
"ava": "^1.4.1",
48-
"coveralls": "^3.0.3",
49-
"execa": "^1.0.0",
50-
"import-fresh": "^3.0.0",
47+
"ava": "^2.2.0",
48+
"coveralls": "^3.0.5",
49+
"execa": "^2.0.3",
50+
"import-fresh": "^3.1.0",
5151
"matcha": "^0.7.0",
52-
"nyc": "^14.0.0",
52+
"nyc": "^14.1.1",
5353
"resolve-from": "^5.0.0",
54-
"tsd": "^0.7.2",
54+
"tsd": "^0.7.4",
5555
"xo": "^0.24.0"
5656
}
5757
}

readme.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
<img src="https://cdn.jsdelivr.net/gh/chalk/ansi-styles@8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
1515

16+
**This readme reflects the next major version that is currently in development. You probably want [the v2 readme](https://www.npmjs.com/package/chalk).**
17+
1618

1719
## Highlights
1820

@@ -180,7 +182,7 @@ Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=
180182
- `magenta`
181183
- `cyan`
182184
- `white`
183-
- `gray` ("bright black")
185+
- `blackBright` (alias: `gray`, `grey`)
184186
- `redBright`
185187
- `greenBright`
186188
- `yellowBright`
@@ -199,7 +201,7 @@ Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=
199201
- `bgMagenta`
200202
- `bgCyan`
201203
- `bgWhite`
202-
- `bgBlackBright`
204+
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
203205
- `bgRedBright`
204206
- `bgGreenBright`
205207
- `bgYellowBright`

source/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,9 @@ const applyStyle = (self, string) => {
193193
}
194194
}
195195

196-
// We can move both next actions out of loop, because remaining actions in loop won't have any/visible effect on parts we add here
197-
// Close the styling before a linebreak and reopen
198-
// after next line to fix a bleed issue on macOS
199-
// https://github.com/chalk/chalk/pull/92
196+
// We can move both next actions out of loop, because remaining actions in loop won't have
197+
// any/visible effect on parts we add here. Close the styling before a linebreak and reopen
198+
// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
200199
const lfIndex = string.indexOf('\n');
201200
if (lfIndex !== -1) {
202201
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);

source/util.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@ const stringReplaceAll = (string, substring, replacer) => {
66
return string;
77
}
88

9-
const subLen = substring.length;
10-
let end = 0;
11-
let res = '';
9+
const substringLength = substring.length;
10+
let endIndex = 0;
11+
let returnValue = '';
1212
do {
13-
res += string.substr(end, index - end) + replacer;
14-
end = index + subLen;
15-
index = string.indexOf(substring, end);
13+
returnValue += string.substr(endIndex, index - endIndex) + replacer;
14+
endIndex = index + substringLength;
15+
index = string.indexOf(substring, endIndex);
1616
} while (index !== -1);
1717

18-
res += string.substr(end);
19-
return res;
18+
returnValue += string.substr(endIndex);
19+
return returnValue;
2020
};
2121

2222
const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
23-
let end = 0;
24-
let res = '';
23+
let endIndex = 0;
24+
let returnValue = '';
2525
do {
2626
const gotCR = string[index - 1] === '\r';
27-
res += string.substr(end, (gotCR ? index - 1 : index) - end) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
28-
end = index + 1;
29-
index = string.indexOf('\n', end);
27+
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
28+
endIndex = index + 1;
29+
index = string.indexOf('\n', endIndex);
3030
} while (index !== -1);
3131

32-
res += string.substr(end);
33-
return res;
32+
returnValue += string.substr(endIndex);
33+
return returnValue;
3434
};
3535

3636
module.exports = {

test/chalk.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,7 @@ test('don\'t emit RGB codes if level is 0', t => {
101101
t.is(new chalk.Instance({level: 0}).hex('#FF0000')('hello'), 'hello');
102102
t.is(new chalk.Instance({level: 0}).bgHex('#FF0000')('hello'), 'hello');
103103
});
104+
105+
test('supports blackBright color', t => {
106+
t.is(chalk.blackBright('foo'), '\u001B[90mfoo\u001B[39m');
107+
});

test/level.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,6 @@ test('propagate enable/disable changes from child colors', t => {
4040
});
4141

4242
test('disable colors if they are not supported', async t => {
43-
t.is(await execa.stdout('node', [path.join(__dirname, '_fixture')]), 'test');
43+
const {stdout} = await execa.node(path.join(__dirname, '_fixture'));
44+
t.is(stdout, 'test');
4445
});

0 commit comments

Comments
 (0)