friendly-errors-webpack-plugin
Advanced tools
Comparing version 1.2.0 to 1.3.0
{ | ||
"name": "friendly-errors-webpack-plugin", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "", | ||
@@ -44,4 +44,5 @@ "main": "index.js", | ||
"chalk": "^1.1.3", | ||
"error-stack-parser": "^2.0.0" | ||
"error-stack-parser": "^2.0.0", | ||
"string-length": "^1.0.1" | ||
} | ||
} |
@@ -5,2 +5,4 @@ 'use strict'; | ||
const chalk = require('chalk'); | ||
const stringLength = require('string-length'); | ||
const readline = require('readline'); | ||
@@ -52,5 +54,22 @@ class Debugger { | ||
if (this.enabled) { | ||
const date = new Date(); | ||
const dateString = chalk.grey(date.toLocaleTimeString()); | ||
const titleFormatted = colors.formatTitle(severity, title); | ||
const subTitleFormatted = colors.formatText(severity, subtitle); | ||
this.log(titleFormatted, subTitleFormatted); | ||
const message = `${titleFormatted} ${subTitleFormatted}` | ||
// In test environment we don't include timestamp | ||
if(process.env.NODE_ENV === 'test') { | ||
this.log(message); | ||
this.log(); | ||
return; | ||
} | ||
// Make timestamp appear at the end of the line | ||
let logSpace = process.stdout.columns - stringLength(message) - stringLength(dateString) | ||
if (logSpace <= 0) { | ||
logSpace = 10 | ||
} | ||
this.log(`${message}${' '.repeat(logSpace)}${dateString}`); | ||
this.log(); | ||
@@ -61,4 +80,8 @@ } | ||
clearConsole () { | ||
if (!this.capturing && this.enabled) { | ||
process.stdout.write('\x1bc'); | ||
if (!this.capturing && this.enabled && process.stdout.isTTY) { | ||
// Fill screen with blank lines. Then move to 0 (beginning of visible part) and clear it | ||
const blank = '\n'.repeat(process.stdout.rows) | ||
console.log(blank) | ||
readline.cursorTo(process.stdout, 0, 0) | ||
readline.clearScreenDown(process.stdout) | ||
} | ||
@@ -65,0 +88,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23499
534
3
1
+ Addedstring-length@^1.0.1
+ Addedstring-length@1.0.1(transitive)