From 06823fbf1c2e763a5bf76c3990ca98fbbcd98691 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Tue, 14 May 2024 14:05:49 +0800 Subject: updated node_modules --- .../node_modules/postcss-reporter/README.md | 2 +- .../node_modules/postcss-reporter/lib/formatter.js | 14 +++++------- .../node_modules/postcss-reporter/lib/reporter.js | 26 +++++++++++++++------- .../node_modules/postcss-reporter/lib/util.js | 12 ++++++++++ .../node_modules/postcss-reporter/package.json | 16 ++++++++----- 5 files changed, 48 insertions(+), 22 deletions(-) (limited to 'node_modules/postcss-cli') diff --git a/node_modules/postcss-cli/node_modules/postcss-reporter/README.md b/node_modules/postcss-cli/node_modules/postcss-reporter/README.md index ca6c43b9..5222656b 100644 --- a/node_modules/postcss-cli/node_modules/postcss-reporter/README.md +++ b/node_modules/postcss-cli/node_modules/postcss-reporter/README.md @@ -9,4 +9,4 @@ A PostCSS plugin to `console.log()` the messages (warnings, etc.) registered by --- ## Docs -Read **[full docs](https://github.com/postcss/postcss-reporter#readme)** on GitHub. +Read full docs **[here](https://github.com/postcss/postcss-reporter#readme)**. diff --git a/node_modules/postcss-cli/node_modules/postcss-reporter/lib/formatter.js b/node_modules/postcss-cli/node_modules/postcss-reporter/lib/formatter.js index 7358cc61..300efad7 100644 --- a/node_modules/postcss-cli/node_modules/postcss-reporter/lib/formatter.js +++ b/node_modules/postcss-cli/node_modules/postcss-reporter/lib/formatter.js @@ -3,12 +3,6 @@ var path = require('path'); var firstBy = require('thenby'); var util = require('./util'); -var supportsLargeCharset = - process.platform !== 'win32' || - process.env.CI || - process.env.TERM === 'xterm-256color'; -var warningSymbol = supportsLargeCharset ? '⚠' : '!!'; - function createSortFunction(positionless, sortByPosition) { var positionValue = 0 @@ -76,8 +70,12 @@ module.exports = function (opts) { str += '\t'; } - 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 + ' '); + } } str += message.text; diff --git a/node_modules/postcss-cli/node_modules/postcss-reporter/lib/reporter.js b/node_modules/postcss-cli/node_modules/postcss-reporter/lib/reporter.js index 71872a97..ae709c7d 100644 --- a/node_modules/postcss-cli/node_modules/postcss-reporter/lib/reporter.js +++ b/node_modules/postcss-cli/node_modules/postcss-reporter/lib/reporter.js @@ -32,7 +32,7 @@ module.exports = function (opts = {}) { }; } - var messageFilter = opts.filter || ((message) => message.type === 'warning'); + var messageFilter = opts.filter || ((message) => message.type === 'warning' || message.type === 'error'); return { postcssPlugin: 'postcss-reporter', @@ -45,6 +45,9 @@ module.exports = function (opts = {}) { ? '' : result.root.source.input.file || result.root.source.input.id; + let errorCount = 0; + let warningCount = 0; + var sourceGroupedMessages = messagesToLog.reduce((grouped, message) => { const key = util.getLocation(message).file || resultSource; @@ -52,6 +55,12 @@ module.exports = function (opts = {}) { grouped[key] = []; } + if (message.type === 'error') { + errorCount++; + } else if (message.type === 'warning') { + warningCount++; + } + grouped[key].push(message); return grouped; @@ -78,9 +87,15 @@ module.exports = function (opts = {}) { if (!report) return; + 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( pico.red( pico.bold('\n** postcss-reporter: warnings or errors were found **') @@ -89,12 +104,7 @@ module.exports = function (opts = {}) { } function shouldThrowError() { - return ( - messagesToLog.length && - messagesToLog.some((message) => { - return message.type === 'warning' || message.type === 'error'; - }) - ); + return opts.throwError || errorCount > 0; } }, }; diff --git a/node_modules/postcss-cli/node_modules/postcss-reporter/lib/util.js b/node_modules/postcss-cli/node_modules/postcss-reporter/lib/util.js index 094b3acc..54334913 100644 --- a/node_modules/postcss-cli/node_modules/postcss-reporter/lib/util.js +++ b/node_modules/postcss-cli/node_modules/postcss-reporter/lib/util.js @@ -1,3 +1,8 @@ +var supportsLargeCharset = + process.platform !== 'win32' || + process.env.CI || + process.env.TERM === 'xterm-256color'; + exports.getLocation = function (message) { var messageNode = message.node; @@ -17,3 +22,10 @@ exports.getLocation = function (message) { location.file = messageInput.file || messageInput.id; return location; }; + +exports.plur = function plur(word, count) { + return (count === 1 ? word : `${word}s`); +} + +exports.warningSymbol = supportsLargeCharset ? '⚠' : '!!'; +exports.errorSymbol = supportsLargeCharset ? '✖' : 'xx'; diff --git a/node_modules/postcss-cli/node_modules/postcss-reporter/package.json b/node_modules/postcss-cli/node_modules/postcss-reporter/package.json index 15a9867c..1d4c48f4 100644 --- a/node_modules/postcss-cli/node_modules/postcss-reporter/package.json +++ b/node_modules/postcss-cli/node_modules/postcss-reporter/package.json @@ -1,6 +1,6 @@ { "name": "postcss-reporter", - "version": "7.0.5", + "version": "7.1.0", "description": "Log PostCSS messages in the console", "main": "index.js", "files": [ @@ -17,10 +17,16 @@ "url": "https://davidtheclark.com" }, "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": { "postcss": "^8.1.0" }, -- cgit v1.2.3