postcss-reporter
Advanced tools
Comparing version 1.2.1 to 1.3.0
# 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. |
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: |
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
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
11096
4
3
114
+ Addedlodash@^3.10.1
+ Addedlodash@3.10.1(transitive)
- Removedlodash.difference@^3.2.1
- Removedlodash.property@^3.1.2
- Removedlodash.sortbyall@^3.2.1
- Removedlodash._arraymap@3.0.0(transitive)
- Removedlodash._basecallback@3.3.1(transitive)
- Removedlodash._basecompareascending@3.0.2(transitive)
- Removedlodash._basedifference@3.0.3(transitive)
- Removedlodash._baseeach@3.0.4(transitive)
- Removedlodash._baseflatten@3.1.4(transitive)
- Removedlodash._baseget@3.7.2(transitive)
- Removedlodash._baseindexof@3.1.0(transitive)
- Removedlodash._baseisequal@3.0.7(transitive)
- Removedlodash._basesortby@3.0.0(transitive)
- Removedlodash._basesortbyorder@3.5.3(transitive)
- Removedlodash._bindcallback@3.0.1(transitive)
- Removedlodash._cacheindexof@3.0.2(transitive)
- Removedlodash._createcache@3.1.2(transitive)
- Removedlodash._getnative@3.9.1(transitive)
- Removedlodash._isiterateecall@3.0.9(transitive)
- Removedlodash._topath@3.8.1(transitive)
- Removedlodash.difference@3.2.2(transitive)
- Removedlodash.isarguments@3.1.0(transitive)
- Removedlodash.isarray@3.0.4(transitive)
- Removedlodash.istypedarray@3.0.6(transitive)
- Removedlodash.keys@3.1.2(transitive)
- Removedlodash.pairs@3.0.1(transitive)
- Removedlodash.property@3.1.2(transitive)
- Removedlodash.restparam@3.6.1(transitive)
- Removedlodash.sortbyall@3.2.1(transitive)