Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var tty = require('tty');
var chalk = require('chalk');
var enabled = process.env.COLOR || (!process.env.NOCOLOR && tty.isatty(1) && tty.isatty(2));
module.exports = new chalk.constructor({ enabled: enabled });
internals.color = function (name, code, forceColor) {
if ((Tty.isatty(1) && Tty.isatty(2)) || forceColor) {
var color = '\u001b[' + code + 'm';
return function (text) { return color + text + '\u001b[0m'; };
}
return function (text) { return text; };
};
function readCachedConfig(cwd) {
if (cachedConfigs[cwd]) { return cachedConfigs[cwd]; }
var config = cachedConfigs[cwd] = normalise(rc('nodesvm', defaults, cwd));
if (!_o.has(config, 'interactive')) {
config.interactive = (process.bin === 'node-svm' && tty.isatty(1) && !process.env.CI);
}
return config;
}
function resetCache () {
write(output, json = false) {
if (this.outputPath) {
fs.writeFileSync(this.outputPath, output);
} else if (isatty(process.stdout.fd) && json) {
const highlighted = highlight(output, { json: true, theme });
process.stdout.write(highlighted);
} else {
process.stdout.write(output);
}
}
}
function getMaxWidth () {
var cols
try {
var tty = require('tty')
var stdout = process.stdout
cols = !tty.isatty(stdout.fd) ? Infinity : process.stdout.getWindowSize()[0]
cols = (cols === 0) ? Infinity : cols
} catch (ex) { cols = Infinity }
return cols
}
function getMaxWidth() {
var cols
try {
var tty = require("tty")
, stdout = process.stdout
cols = !tty.isatty(stdout.fd) ? Infinity : process.stdout.getWindowSize()[0]
cols = (cols === 0) ? Infinity : cols
} catch (ex) { cols = Infinity }
return cols
}
function isatty(stream) {
if (!tty.isatty) {
return true;
}
if (!stream) {
return false;
}
if (stream.isTTY) {
return true;
}
if (stream && (typeof stream.fd === "number")) {
stream.isTTY = tty.isatty(stream.fd);
}
return stream.isTTY;
}