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

postcss-minify-selectors

Package Overview
Dependencies
Maintainers
8
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-minify-selectors - npm Package Compare versions

Comparing version 5.1.3 to 5.2.0

types/index.d.ts

6

package.json
{
"name": "postcss-minify-selectors",
"version": "5.1.3",
"version": "5.2.0",
"description": "Minify selectors with PostCSS.",
"main": "src/index.js",
"types": "types/index.d.ts",
"files": [
"src",
"LICENSE-MIT"
"LICENSE-MIT",
"types"
],

@@ -10,0 +12,0 @@ "keywords": [

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

/**
* @param {parser.Attribute} selector
* @return {void}
*/
function attribute(selector) {

@@ -24,3 +28,5 @@ if (selector.value) {

if (selector.operator) {
selector.operator = selector.operator.trim();
selector.operator = /** @type {parser.AttributeOperator} */ (
selector.operator.trim()
);
}

@@ -38,22 +44,24 @@ }

selector.raws.spaces.attribute = {
before: '',
after: '',
};
if (selector.raws.spaces) {
selector.raws.spaces.attribute = {
before: '',
after: '',
};
selector.raws.spaces.operator = {
before: '',
after: '',
};
selector.raws.spaces.value = {
before: '',
after: selector.insensitive ? ' ' : '',
};
if (selector.insensitive) {
selector.raws.spaces.insensitive = {
selector.raws.spaces.operator = {
before: '',
after: '',
};
selector.raws.spaces.value = {
before: '',
after: selector.insensitive ? ' ' : '',
};
if (selector.insensitive) {
selector.raws.spaces.insensitive = {
before: '',
after: '',
};
}
}

@@ -64,2 +72,6 @@

/**
* @param {parser.Combinator} selector
* @return {void}
*/
function combinator(selector) {

@@ -81,2 +93,6 @@ const value = selector.value.trim();

/**
* @param {parser.Pseudo} selector
* @return {void}
*/
function pseudo(selector) {

@@ -93,3 +109,3 @@ const value = selector.value.toLowerCase();

parser.pseudo({
value: pseudoReplacements.get(value),
value: /** @type {string} */ (pseudoReplacements.get(value)),
})

@@ -99,3 +115,3 @@ );

if (one.value.toLowerCase() === 'even') {
if (one.value && one.value.toLowerCase() === 'even') {
one.value = '2n';

@@ -110,2 +126,3 @@ }

if (
one.value &&
one.value.toLowerCase() === '2n' &&

@@ -149,2 +166,6 @@ two.value === '+' &&

/**
* @param {parser.Tag} selector
* @return {void}
*/
function tag(selector) {

@@ -154,6 +175,10 @@ const value = selector.value.toLowerCase();

if (tagReplacements.has(value)) {
selector.value = tagReplacements.get(value);
selector.value = /** @type {string} */ (tagReplacements.get(value));
}
}
/**
* @param {parser.Universal} selector
* @return {void}
*/
function universal(selector) {

@@ -167,10 +192,16 @@ const next = selector.next();

const reducers = new Map([
['attribute', attribute],
['combinator', combinator],
['pseudo', pseudo],
['tag', tag],
['universal', universal],
]);
const reducers = new Map(
/** @type {[string, ((selector: parser.Node) => void)][]}*/ ([
['attribute', attribute],
['combinator', combinator],
['pseudo', pseudo],
['tag', tag],
['universal', universal],
])
);
/**
* @type {import('postcss').PluginCreator<void>}
* @return {import('postcss').Plugin}
*/
function pluginCreator() {

@@ -196,3 +227,7 @@ return {

if (sel.type === 'selector' && sel.parent.type !== 'pseudo') {
if (
sel.type === 'selector' &&
sel.parent &&
sel.parent.type !== 'pseudo'
) {
if (!uniqueSelectors.has(toString)) {

@@ -199,0 +234,0 @@ uniqueSelectors.add(toString);

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

/**
* @param {string} value
* @return {boolean}
*/
module.exports = function canUnquote(value) {

@@ -14,0 +18,0 @@ if (value === '-' || value === '') {

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