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

postcss-merge-idents

Package Overview
Dependencies
Maintainers
8
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-merge-idents - npm Package Compare versions

Comparing version 5.0.3 to 5.1.0

types/index.d.ts

8

package.json
{
"name": "postcss-merge-idents",
"version": "5.0.3",
"version": "5.1.0",
"description": "Merge keyframe and counter style identifiers.",
"main": "src/index.js",
"types": "types/index.d.ts",
"files": [
"src",
"LICENSE-MIT"
"LICENSE-MIT",
"types"
],

@@ -25,3 +27,3 @@ "keywords": [

"dependencies": {
"cssnano-utils": "^3.0.2",
"cssnano-utils": "^3.1.0",
"postcss-value-parser": "^4.2.0"

@@ -28,0 +30,0 @@ },

@@ -5,2 +5,6 @@ 'use strict';

/**
* @param {Record<string, string>} obj
* @return {(key: string) => string}
*/
function canonical(obj) {

@@ -10,2 +14,6 @@ // Prevent potential infinite loops

/**
* @param {string} key
* @return {string}
*/
return function recurse(key) {

@@ -28,10 +36,32 @@ if (

function mergeAtRules(css, pairs) {
pairs.forEach((pair) => {
pair.cache = [];
pair.replacements = [];
pair.decls = [];
pair.removals = [];
});
/**
* @param {import('postcss').Root} css
* @return {void}
*/
function mergeAtRules(css) {
const pairs = [
{
atrule: /keyframes/i,
decl: /animation/i,
/** @type {import('postcss').AtRule[]} */
cache: [],
replacements: {},
/** @type {import('postcss').Declaration[]} */
decls: [],
/** @type {import('postcss').AtRule[]} */
removals: [],
},
{
atrule: /counter-style/i,
decl: /(list-style|system)/i,
cache: [],
replacements: {},
decls: [],
removals: [],
},
];
/**
* @type {{atrule: RegExp, decl: RegExp, replacements: Record<string, string>, removals: import('postcss').AtRule[], cache: import('postcss').AtRule[], decls: import('postcss').Declaration[]}}
*/
let relevant;

@@ -58,3 +88,6 @@

cached.name.toLowerCase() === node.name.toLowerCase() &&
sameParent(cached, node) &&
sameParent(
/** @type {any} */ (cached),
/** @type {any} */ (node)
) &&
cached.nodes.toString() === toString

@@ -102,2 +135,6 @@ ) {

/**
* @type {import('postcss').PluginCreator<void>}
* @return {import('postcss').Plugin}
*/
function pluginCreator() {

@@ -108,12 +145,3 @@ return {

OnceExit(css) {
mergeAtRules(css, [
{
atrule: /keyframes/i,
decl: /animation/i,
},
{
atrule: /counter-style/i,
decl: /(list-style|system)/i,
},
]);
mergeAtRules(css);
},

@@ -120,0 +148,0 @@ };

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