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

postcss-reporter

Package Overview
Dependencies
Maintainers
1
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 1.2.1 to 1.3.0

5

CHANGELOG.md
# Changelog
## 1.3.0
- Check individual messages for distinct sources, then group messages by those sources,
instead of always using the PostCSS Result's source.
- Output empty string from `formatter` if there are no messages, instead of `undefined`.
## 1.2.1

@@ -4,0 +9,0 @@ - Handle variable and absent input sources.

7

lib/formatter.js
var chalk = require('chalk');
var path = require('path');
var symbols = require('log-symbols');
var sortByAll = require('lodash.sortbyall');
var property = require('lodash.property');
var _ = require('lodash');

@@ -16,5 +15,5 @@ module.exports = function(opts) {

if (!messages.length) return undefined;
if (!messages.length) return '';
var orderedMessages = sortByAll(
var orderedMessages = _.sortByAll(
messages,

@@ -21,0 +20,0 @@ function(m) {

var chalk = require('chalk');
var difference = require('lodash.difference');
var _ = require('lodash');
var defaultFormatter = require('./formatter');

@@ -22,12 +22,20 @@

var source = (!result.root.source) ? undefined
var resultSource = (!result.root.source) ? ''
: result.root.source.input.file || result.root.source.input.id
var report = formatter({
messages: messagesToLog,
source: source,
var sourceGroupedMessages = _.groupBy(messagesToLog, function(message) {
if (!message.node || !message.node.source) return resultSource;
return message.node.source.input.file || message.node.source.input.id;
});
var report = '';
_.forOwn(sourceGroupedMessages, function(messages, source) {
report += formatter({
messages: messages,
source: source,
});
});
if (options.clearMessages) {
result.messages = difference(result.messages, messagesToLog);
result.messages = _.difference(result.messages, messagesToLog);
}

@@ -34,0 +42,0 @@

{
"name": "postcss-reporter",
"version": "1.2.1",
"version": "1.3.0",
"description": "Log PostCSS messages in the console",

@@ -31,3 +31,2 @@ "main": "index.js",

"eslint": "1.3.1",
"lodash.clonedeep": "3.0.2",
"stylelint": "1.0.1",

@@ -38,5 +37,3 @@ "tape": "4.2.0"

"chalk": "^1.0.0",
"lodash.difference": "^3.2.1",
"lodash.property": "^3.1.2",
"lodash.sortbyall": "^3.2.1",
"lodash": "^3.10.1",
"log-symbols": "^1.0.2",

@@ -43,0 +40,0 @@ "postcss": "^5.0.0"

@@ -58,3 +58,3 @@ # postcss-reporter [![Build Status](https://travis-ci.org/postcss/postcss-reporter.svg?branch=master)](https://travis-ci.org/postcss/postcss-reporter)

- accepts an object containing a `messages` array and a `source` string
- returns a the string to report
- returns the string to report

@@ -61,0 +61,0 @@ For example, you could write a formatter like this:

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