Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dir = path.relative(process.cwd(), dir)
}
var columns = [ dep
, has || "MISSING"
, want
, latest
, dirToPrettyLocation(dir)
]
if (long) columns[5] = type
if (npm.color) {
columns[0] = color[has === want ? "yellow" : "red"](columns[0]) // dep
columns[2] = color.green(columns[2]) // want
columns[3] = color.magenta(columns[3]) // latest
columns[4] = color.brightBlack(columns[4]) // dir
if (long) columns[5] = color.brightBlack(columns[5]) // type
}
return columns
}
function log() {
console.log(colors.green('progress ') + colors.brightBlack(format.apply(this, arguments)));
}
'pid',
'os',
'proc',
'load'
]));
data.message = ansicolors.brightBlack('memory: ');
data.message += numeral(data.proc.mem.heapUsed).format('0.0b');
data.message += ' ';
data.message += ansicolors.brightBlack('uptime: ');
data.message += numeral(data.proc.uptime).format('00:00:00');
data.message += ' ';
data.message += ansicolors.brightBlack('load: [');
data.message += data.os.load.map(function (val) {
return numeral(val).format('0.00');
}).join(' ');
data.message += ansicolors.brightBlack(']');
data.message += ' ';
data.message += ansicolors.brightBlack('delay: ');
data.message += numeral(data.proc.delay).format('0.000');
}
else if (data.type === 'error') {
data.level = 'error';
data.message = event.error.message;
data.error = serializeError(event.error);
data.url = event.url;
}
else if (event.data instanceof Error) {
data.level = _.contains(event.tags, 'fatal') ? 'fatal' : 'error';
data.message = event.data.message;
data.error = serializeError(event.data);
}
else if (_.isPlainObject(event.data) && event.data.tmpl) {
function end() {
var code = resp.statusCode + ''
, time = (Date.now() - start)
, output
output = [
ansicolors[statusDigitToColor[code[0]]](code)
, pad(time + 'ms', 6, ' ') + ' '
, ansicolors.brightBlack(
pad(bytesize(size).replace(' ', '').toUpperCase(), 9, ' ')
) + ' '
, parsed.loggedPathname || parsed.pathname
].join(' ')
if(!colorEnabled) {
output = output.replace(/\x1B\[([\d;]+?)m/g, '')
}
io.log(output)
stream.queue(null)
}
}
out.label = `${d}@npm:${data._id}`
} else {
out.label = data._id || ''
}
if (data._found === 'explicit' && data._id) {
if (npm.color) {
out.label = color.bgBlack(color.yellow(out.label.trim())) + ' '
} else {
out.label = out.label.trim() + ' '
}
}
if (data.link) out.label += ' -> ' + data.link
if (data._deduped) {
if (npm.color) {
out.label += ' ' + color.brightBlack('deduped')
} else {
out.label += ' deduped'
}
}
if (data.invalid) {
if (data.realName !== data.name) out.label += ' (' + data.realName + ')'
var invalid = 'invalid'
if (npm.color) invalid = color.bgBlack(color.red(invalid))
out.label += ' ' + invalid
}
if (data.peerInvalid) {
var peerInvalid = 'peer invalid'
if (npm.color) peerInvalid = color.bgBlack(color.red(peerInvalid))
out.label += ' ' + peerInvalid
StdOutStream.prototype._write = function (entry, encoding, callback) {
entry = JSON.parse(entry.toString('utf8'));
var crayon = ansicolors[colors[entry.level]];
var output = crayon(levels[entry.level].toUpperCase());
output += ' ';
output += ansicolors.brightBlack(entry.time);
output += ' ';
if (entry.req && entry.res) {
output += util.format('%s %s ', entry.req.method, entry.req.url);
output += levelColor(entry.res.statusCode);
output += ansicolors.brightBlack(util.format(' %dms - %d', entry.res.responseTime, entry.res.contentLength));
} else if (entry.msg) {
output += entry.msg;
}
process.stdout.write(output + '\n');
if (entry.err) {
process.stdout.write(ansicolors.brightRed(entry.err.stack) + '\n');
}
callback();
};
_deoptRow(info) {
const {
inlined
, bailoutType
, deoptReason
, timestamp
, severity
} = info
const bailoutString = severityColors[severity - 1](bailoutType)
const timestampString = (timestamp > 0
? colors.brightBlack(`${(timestamp / 1E3).toFixed()}ms`)
: 'n/a'
)
const inlinedString = colors.brightBlack(inlined)
return [
timestampString
, bailoutString
, deoptReason
, inlinedString
]
}
_deoptRow(info) {
const {
inlined
, bailoutType
, deoptReason
, timestamp
, severity
} = info
const bailoutString = severityColors[severity - 1](bailoutType)
const timestampString = (timestamp > 0
? colors.brightBlack(`${(timestamp / 1E3).toFixed()}ms`)
: 'n/a'
)
const inlinedString = colors.brightBlack(inlined)
return [
timestampString
, bailoutString
, deoptReason
, inlinedString
]
}
_summary(infos) {
const { id } = infos
const {
functionName
, file
, line
, column
} = infos[0]
const fullLoc = colors.brightBlack(`${functionName} at ${file}:${line}:${column}`)
const locationString = colors.blue(id)
return `(${locationString}): ${fullLoc}\n\n`
}