forked from orbit-oss/chalk
Update chalk to use the latest updates to supports-color (#247)
This commit is contained in:
parent
011dd0421e
commit
678152cf19
3 changed files with 10 additions and 8 deletions
6
index.js
6
index.js
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
const escapeStringRegexp = require('escape-string-regexp');
|
||||
const ansiStyles = require('ansi-styles');
|
||||
const supportsColor = require('supports-color');
|
||||
const stdoutColor = require('supports-color').stdout;
|
||||
|
||||
const template = require('./templates.js');
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ function applyOptions(obj, options) {
|
|||
options = options || {};
|
||||
|
||||
// Detect level if not set manually
|
||||
const scLevel = supportsColor ? supportsColor.level : 0;
|
||||
const scLevel = stdoutColor ? stdoutColor.level : 0;
|
||||
obj.level = options.level === undefined ? scLevel : options.level;
|
||||
obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
|
||||
}
|
||||
|
|
@ -224,5 +224,5 @@ function chalkTag(chalk, strings) {
|
|||
Object.defineProperties(Chalk.prototype, styles);
|
||||
|
||||
module.exports = Chalk(); // eslint-disable-line new-cap
|
||||
module.exports.supportsColor = supportsColor;
|
||||
module.exports.supportsColor = stdoutColor;
|
||||
module.exports.default = module.exports; // For TypeScript
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
"dependencies": {
|
||||
"ansi-styles": "^3.1.0",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
"supports-color": "^4.0.0"
|
||||
"supports-color": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ const resolveFrom = require('resolve-from');
|
|||
module.exports = dir => {
|
||||
require.cache[resolveFrom(dir, 'supports-color')] = {
|
||||
exports: {
|
||||
level: 3,
|
||||
hasBasic: true,
|
||||
has256: true,
|
||||
has16m: true
|
||||
stdout: {
|
||||
level: 3,
|
||||
hasBasic: true,
|
||||
has256: true,
|
||||
has16m: true
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue