From efbc2ffe6a1ee5ec38a4396305561d6515d0943e Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Fri, 30 Aug 2024 17:21:18 +0800 Subject: node fixes, updates --- node_modules/postcss-reporter/lib/util.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'node_modules/postcss-reporter/lib/util.js') diff --git a/node_modules/postcss-reporter/lib/util.js b/node_modules/postcss-reporter/lib/util.js index 76c649bc..54334913 100644 --- a/node_modules/postcss-reporter/lib/util.js +++ b/node_modules/postcss-reporter/lib/util.js @@ -1,6 +1,9 @@ -var _ = require('lodash'); +var supportsLargeCharset = + process.platform !== 'win32' || + process.env.CI || + process.env.TERM === 'xterm-256color'; -exports.getLocation = function(message) { +exports.getLocation = function (message) { var messageNode = message.node; var location = { @@ -8,13 +11,21 @@ exports.getLocation = function(message) { column: message.column, }; - var messageInput = _.get(messageNode, 'source.input'); + var messageInput = messageNode && messageNode.source && messageNode.source.input; if (!messageInput) return location; - var originLocation = messageInput.origin && messageInput.origin(message.line, message.column) - if (originLocation) return originLocation + var originLocation = + messageInput.origin && messageInput.origin(message.line, message.column); + if (originLocation) return originLocation; 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'; -- cgit v1.2.3