Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-reporter

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-reporter - npm Package Compare versions

Comparing version 7.0.5 to 7.1.0

14

lib/formatter.js

@@ -6,8 +6,2 @@ var pico = require('picocolors');

var supportsLargeCharset =
process.platform !== 'win32' ||
process.env.CI ||
process.env.TERM === 'xterm-256color';
var warningSymbol = supportsLargeCharset ? '⚠' : '!!';
function createSortFunction(positionless, sortByPosition) {

@@ -80,4 +74,8 @@ var positionValue = 0

if (!options.noIcon && message.type === 'warning') {
str += pico.yellow(warningSymbol + ' ');
if (!options.noIcon) {
if (message.type === 'warning') {
str += pico.yellow(util.warningSymbol + ' ');
} else if (message.type === 'error') {
str += pico.red(util.errorSymbol + ' ');
}
}

@@ -84,0 +82,0 @@

@@ -35,3 +35,3 @@ var defaultFormatter = require('./formatter');

var messageFilter = opts.filter || ((message) => message.type === 'warning');
var messageFilter = opts.filter || ((message) => message.type === 'warning' || message.type === 'error');

@@ -49,2 +49,5 @@ return {

let errorCount = 0;
let warningCount = 0;
var sourceGroupedMessages = messagesToLog.reduce((grouped, message) => {

@@ -57,2 +60,8 @@ const key = util.getLocation(message).file || resultSource;

if (message.type === 'error') {
errorCount++;
} else if (message.type === 'warning') {
warningCount++;
}
grouped[key].push(message);

@@ -84,5 +93,11 @@

const summaryColor = errorCount > 0 ? 'red' : 'yellow';
const summarySymbol = errorCount > 0 ? util.errorSymbol : util.warningSymbol;
const summary = `${summarySymbol} ${messagesToLog.length} ${util.plur('problem', messagesToLog.length)} (${errorCount} ${util.plur('error')}, ${warningCount} ${util.plur('warning')})`
report += `\n ${pico[summaryColor](pico.bold(summary))}\n`;
console.log(report);
if (opts.throwError && shouldThrowError()) {
if (shouldThrowError()) {
throw new Error(

@@ -96,8 +111,3 @@ pico.red(

function shouldThrowError() {
return (
messagesToLog.length &&
messagesToLog.some((message) => {
return message.type === 'warning' || message.type === 'error';
})
);
return opts.throwError || errorCount > 0;
}

@@ -104,0 +114,0 @@ },

@@ -0,1 +1,6 @@

var supportsLargeCharset =
process.platform !== 'win32' ||
process.env.CI ||
process.env.TERM === 'xterm-256color';
exports.getLocation = function (message) {

@@ -20,1 +25,8 @@ var messageNode = message.node;

};
exports.plur = function plur(word, count) {
return (count === 1 ? word : `${word}s`);
}
exports.warningSymbol = supportsLargeCharset ? '⚠' : '!!';
exports.errorSymbol = supportsLargeCharset ? '✖' : 'xx';
{
"name": "postcss-reporter",
"version": "7.0.5",
"version": "7.1.0",
"description": "Log PostCSS messages in the console",

@@ -20,6 +20,12 @@ "main": "index.js",

"license": "MIT",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/postcss/"
},
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/postcss/"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"peerDependencies": {

@@ -26,0 +32,0 @@ "postcss": "^8.1.0"

@@ -12,2 +12,2 @@ # postcss-reporter

## Docs
Read **[full docs](https://github.com/postcss/postcss-reporter#readme)** on GitHub.
Read full docs **[here](https://github.com/postcss/postcss-reporter#readme)**.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc