postcss-merge-rules
Advanced tools
Comparing version 4.0.2 to 4.0.3
@@ -76,2 +76,17 @@ 'use strict'; | ||
const isSupportedCache = {}; | ||
// Move to util in future | ||
function isSupportedCached(feature, browsers) { | ||
const key = JSON.stringify({ feature, browsers }); | ||
let result = isSupportedCache[key]; | ||
if (!result) { | ||
result = (0, _caniuseApi.isSupported)(feature, browsers); | ||
isSupportedCache[key] = result; | ||
} | ||
return result; | ||
} | ||
function ensureCompatibility(selectors, browsers, compatibilityCache) { | ||
@@ -96,3 +111,3 @@ // Should not merge mixins | ||
if (entry && compatible) { | ||
compatible = (0, _caniuseApi.isSupported)(entry, browsers); | ||
compatible = isSupportedCached(entry, browsers); | ||
} | ||
@@ -102,6 +117,6 @@ } | ||
if (~value.indexOf('~')) { | ||
compatible = (0, _caniuseApi.isSupported)(cssSel3, browsers); | ||
compatible = isSupportedCached(cssSel3, browsers); | ||
} | ||
if (~value.indexOf('>') || ~value.indexOf('+')) { | ||
compatible = (0, _caniuseApi.isSupported)(cssSel2, browsers); | ||
compatible = isSupportedCached(cssSel2, browsers); | ||
} | ||
@@ -112,3 +127,3 @@ } | ||
if (!node.operator) { | ||
compatible = (0, _caniuseApi.isSupported)(cssSel2, browsers); | ||
compatible = isSupportedCached(cssSel2, browsers); | ||
} | ||
@@ -119,7 +134,7 @@ | ||
if (~['=', '~=', '|='].indexOf(node.operator)) { | ||
compatible = (0, _caniuseApi.isSupported)(cssSel2, browsers); | ||
compatible = isSupportedCached(cssSel2, browsers); | ||
} | ||
// [foo^="bar"], [foo$="bar"], [foo*="bar"] | ||
if (~['^=', '$=', '*='].indexOf(node.operator)) { | ||
compatible = (0, _caniuseApi.isSupported)(cssSel3, browsers); | ||
compatible = isSupportedCached(cssSel3, browsers); | ||
} | ||
@@ -130,3 +145,3 @@ } | ||
if (node.insensitive) { | ||
compatible = (0, _caniuseApi.isSupported)('css-case-insensitive', browsers); | ||
compatible = isSupportedCached('css-case-insensitive', browsers); | ||
} | ||
@@ -133,0 +148,0 @@ } |
{ | ||
"name": "postcss-merge-rules", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"description": "Merge CSS rules with PostCSS.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
347
0
16706
5