Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
/**
* Colors.
*/
exports.colors = [6, 2, 3, 4, 5, 1];
try {
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
// eslint-disable-next-line import/no-extraneous-dependencies
var supportsColor = require('supports-color');
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
exports.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221];
}
} catch (error) {} // Swallow - we only care if `supports-color` is available; it doesn't have to be.
/**
* Build up the default `inspectOpts` object from the environment variables.
*
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
*/
exports.inspectOpts = Object.keys(process.env).filter(function (key) {
return /^debug_/i.test(key);
}).reduce(function (obj, key) {
// Camel-case
var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) {
'use strict'
var supported = require('supports-color').stderr.hasBasic
var width = require('string-width')
var stringify = require('unist-util-stringify-position')
var repeat = require('repeat-string')
var statistics = require('vfile-statistics')
var sort = require('vfile-sort')
module.exports = reporter
// Check which characters should be used.
var windows = process.platform === 'win32'
// `log-symbols` without chalk:
/* istanbul ignore next - Windows. */
var chars = windows ? {error: '×', warning: '‼'} : {error: '✖', warning: '⚠'}
// Match trailing white-space.
var trailing = /\s*$/
exports.save = save;
exports.load = load;
exports.useColors = useColors;
/**
* Colors.
*/
exports.colors = [6, 2, 3, 4, 5, 1];
try {
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
// eslint-disable-next-line import/no-extraneous-dependencies
const supportsColor = require('supports-color');
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
exports.colors = [
20,
21,
26,
27,
32,
33,
38,
39,
40,
41,
42,
43,
44,
45,
56,
self.app.use(function (req, res, next) {
// Log requests using the "debug" module so that the output is hidden by default.
// Enable with DEBUG=* environment variable.
self.debug(
(supportsColor.stderr ? '\x1B[90m' : '') +
req.method + ' ' + req.originalUrl + ' ' + req.ip +
(supportsColor.stderr ? '\x1B[0m' : '')
)
next()
})
}
exports.save = save;
exports.load = load;
exports.useColors = useColors;
/**
* Colors.
*/
exports.colors = [6, 2, 3, 4, 5, 1];
try {
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
// eslint-disable-next-line import/no-extraneous-dependencies
const supportsColor = require('supports-color');
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
exports.colors = [
20,
21,
26,
27,
32,
33,
38,
39,
40,
41,
42,
43,
44,
45,
56,
exports.save = save;
exports.load = load;
exports.useColors = useColors;
/**
* Colors.
*/
exports.colors = [6, 2, 3, 4, 5, 1];
try {
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
// eslint-disable-next-line import/no-extraneous-dependencies
const supportsColor = require('supports-color');
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
exports.colors = [
20,
21,
26,
27,
32,
33,
38,
39,
40,
41,
42,
43,
44,
45,
56,
module.exports = function(options) {
let colorize;
options = options || {
level: 'warn',
silent: false
};
colorize = !options.noColor && supportsColor.stdout && supportsColor.stderr;
const prettyFormat = format.prettyPrint({ depth: 100 });
const logger = createLogger({
level: options.level,
silent: options.silent,
transports: [
new transports.Console({
format: colorize
? format.combine(prettyFormat, format.cli())
: format.combine(prettyFormat, format.simple())
})
]
});
return {
silly: function(tag, message) {
function getCodeFrame(node) {
return codeFrame(
state.file.code,
node.loc.start.line,
node.loc.start.column,
{
highlightCode: Boolean(supportsColor.stderr),
}
);
}
function withColorSupport(wrappedFunc) {
if (supportsColor.stdout && supportsColor.stderr) {
return wrappedFunc;
}
return (msg) => msg;
}
const red = withColorSupport((str) => `\x1b[31m${str}\x1b[0m`);