Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function log_create_wasdir(output){
console.log(colors.bgYellow(colors.yellow(' New directory was created: ')+colors.yellow(output)+' '));
console.log(colors.bgYellow(colors.white(' New directory was created: ')+colors.magenta(output)+' '));
console.log(colors.bgYellow(colors.yellow(' New directory was created: ')+colors.yellow(output)+' '));
}
const printNormal = (str) => console.log(colors.white(str))
const printTitle = (str) => console.log(colors.bold.underline.green(str))
Logger.prototype.error = function(message, extra) {
if ( ! this.isSilent) {
console.error(colors.red('error: ') + message);
if (extra)
console.error(colors.white(this._getExtra(extra)));
}
};
if (typeof err.column === 'number') {
err.column = err.column.toString();
}
let lineNumbers = (err.line.length > 0) ? colors.white(err.line + ':' + err.column).dim : '';
if (err.file && err.file.length > 0) {
msg += err.message.replace(/'(.*?)'/g, colors.red("'") + colors.red("$1") + colors.red("'"))
.replace(/(error)( )((?:TS[a-z0-9]*))(:)/g, colors.white("$1$2$3").dim);
link += err.file.includes(config.projectRoot) ?
colors.dim(' vscode://file/' + err.file + ':' + lineNumbers) + '\n' :
colors.dim(' vscode://file/' + config.projectRoot + '/' + err.file + ':' + lineNumbers) + '\n';
process.stdout.write(colors.red(' ' + err.service.toUpperCase() + ' ERROR') + ' ' +
((err.file.length > 0) ? colors.white(colors.dim(err.file) + ' ' + lineNumbers) : '') + '\n\n' +
colors.white(msg) + '\n\n'+
((err.file.length > 0) ? link : '') + '\n');
} else {
msg = err.message;
process.stdout.write(colors.red(' ' + err.service.toUpperCase() + ' ERROR') + ' ' +
colors.white(msg) + '\n\n');
}
this.line();
}
message(msg) {
//this.spinner.stop();
msg = msg ? '' + colors.white(msg).dim : '';
logger(msg);
process.stderr.write('\x1B[?25l');
if (cli.program.verbose) this.break();
}
`, (err, stdout) => {
if (err) process.stderr.write(colors.white(err));
process.stdout.write(stdout);
insertEventListener();
});
}
line() {
process.stdout.write('\n');
const col = process.stdout.columns;
let line = ' ';
for (let i = 0; i < col - 2; i++) {
line += '\u2500';
}
line += '\n';
process.stdout.write(colors.white(colors.dim(line)));
}
function createProgressBar(format, options) {
const opts = Object.assign({
complete: green('█'),
incomplete: white('█'),
width: 20,
clear: true
}, options);
const bar = new ProgressBar(format, opts);
const old = bar.tick;
const loadingChars = ['⣴', '⣆', '⢻', '⢪', '⢫'];
bar.tick = (len, tokens) => {
const newTokens = Object.assign({
loading: loadingChars[parseInt(Math.random() * 5)]
}, tokens);
old.call(bar, len, newTokens);
};
return bar;
}
fs.writeFile('./wasm/lib.temp.js', data, (err2) => {
if (err2) process.stderr.write(colors.white(err2));
fs.renameSync('./wasm/lib.temp.js', './wasm/lib.js');
});
});
}
if (!err.column) {
err.column = '';
}
if (typeof err.line === 'number') {
err.line = err.line.toString();
}
if (typeof err.column === 'number') {
err.column = err.column.toString();
}
let lineNumbers = (err.line.length > 0) ? colors.white(err.line + ':' + err.column).dim : '';
if (err.file && err.file.length > 0) {
msg += err.message.replace(/'(.*?)'/g, colors.red("'") + colors.red("$1") + colors.red("'"))
.replace(/(error)( )((?:TS[a-z0-9]*))(:)/g, colors.white("$1$2$3").dim);
link += err.file.includes(config.projectRoot) ?
colors.dim(' vscode://file/' + err.file + ':' + lineNumbers) + '\n' :
colors.dim(' vscode://file/' + config.projectRoot + '/' + err.file + ':' + lineNumbers) + '\n';
process.stdout.write(colors.red(' ' + err.service.toUpperCase() + ' ERROR') + ' ' +
((err.file.length > 0) ? colors.white(colors.dim(err.file) + ' ' + lineNumbers) : '') + '\n\n' +
colors.white(msg) + '\n\n'+
((err.file.length > 0) ? link : '') + '\n');
} else {
msg = err.message;
process.stdout.write(colors.red(' ' + err.service.toUpperCase() + ' ERROR') + ' ' +
colors.white(msg) + '\n\n');