postcss-discard-duplicates
Advanced tools
Comparing version 5.0.3 to 5.1.0
{ | ||
"name": "postcss-discard-duplicates", | ||
"version": "5.0.3", | ||
"version": "5.1.0", | ||
"description": "Discard duplicate rules in your CSS files with PostCSS.", | ||
"main": "src/index.js", | ||
"types": "types/index.d.ts", | ||
"files": [ | ||
"src", | ||
"LICENSE-MIT" | ||
"LICENSE-MIT", | ||
"types" | ||
], | ||
@@ -10,0 +12,0 @@ "keywords": [ |
'use strict'; | ||
/** | ||
* @param {string | undefined} value | ||
* @return {string | undefined} | ||
*/ | ||
function trimValue(value) { | ||
@@ -6,2 +10,6 @@ return value ? value.trim() : value; | ||
/** | ||
* @param {{nodes: import('postcss').Node[]}} node | ||
* @return {boolean} | ||
*/ | ||
function empty(node) { | ||
@@ -11,3 +19,10 @@ return !node.nodes.filter((child) => child.type !== 'comment').length; | ||
function equals(a, b) { | ||
/** | ||
* @param {import('postcss').AnyNode} nodeA | ||
* @param {import('postcss').AnyNode} nodeB | ||
* @return {boolean} | ||
*/ | ||
function equals(nodeA, nodeB) { | ||
const a = /** @type {any} */ (nodeA); | ||
const b = /** @type {any} */ (nodeB); | ||
if (a.type !== b.type) { | ||
@@ -72,2 +87,7 @@ return false; | ||
/** | ||
* @param {import('postcss').Rule} last | ||
* @param {import('postcss').AnyNode[]} nodes | ||
* @return {void} | ||
*/ | ||
function dedupeRule(last, nodes) { | ||
@@ -91,2 +111,7 @@ let index = nodes.indexOf(last) - 1; | ||
/** | ||
* @param {import('postcss').AtRule | import('postcss').Declaration} last | ||
* @param {import('postcss').AnyNode[]} nodes | ||
* @return {void} | ||
*/ | ||
function dedupeNode(last, nodes) { | ||
@@ -103,4 +128,11 @@ let index = nodes.includes(last) ? nodes.indexOf(last) - 1 : nodes.length - 1; | ||
/** | ||
* @param {import('postcss').AnyNode} root | ||
* @return {void} | ||
*/ | ||
function dedupe(root) { | ||
const { nodes } = root; | ||
const { nodes } = | ||
/** @type {import('postcss').Container<import('postcss').ChildNode>} */ ( | ||
root | ||
); | ||
@@ -126,2 +158,6 @@ if (!nodes) { | ||
/** | ||
* @type {import('postcss').PluginCreator<void>} | ||
* @return {import('postcss').Plugin} | ||
*/ | ||
function pluginCreator() { | ||
@@ -128,0 +164,0 @@ return { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
8139
5
157
0