postcss-merge-rules 8.0.4 → 8.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-merge-rules",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.5",
|
|
4
4
|
"description": "Merge CSS rules with PostCSS.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"node": "^22.11.0 || ^24.11.0 || >=26.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@webref/css": "8.7.
|
|
58
|
+
"@webref/css": "8.7.2",
|
|
59
59
|
"postcss": "^8.5.26",
|
|
60
60
|
"postcss-simple-vars": "^7.0.1",
|
|
61
61
|
"postcss-discard-comments": "^8.0.4"
|
|
@@ -130,22 +130,39 @@ function isHostPseudoClass(selector) {
|
|
|
130
130
|
return selector.includes(':host');
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
/** @type {WeakMap<string[], Map<string, boolean>>} */
|
|
134
|
+
const isSupportedCache = new WeakMap();
|
|
135
|
+
// Stable stand-in key when `browsers` is undefined, since a fresh `[]` on
|
|
136
|
+
// every call would never hit the WeakMap.
|
|
137
|
+
/** @type {string[]} */
|
|
138
|
+
const noBrowsers = [];
|
|
134
139
|
|
|
135
140
|
// Move to util in future
|
|
136
141
|
/**
|
|
142
|
+
* `browsers` is the same array reference for an entire file's processing, so
|
|
143
|
+
* keying on it directly (rather than re-serializing it per call) avoids
|
|
144
|
+
* rebuilding a JSON string on every lookup, including cache hits.
|
|
145
|
+
*
|
|
137
146
|
* @param {string} feature
|
|
138
147
|
* @param {string[] | undefined} browsers
|
|
148
|
+
* @return {boolean}
|
|
139
149
|
*/
|
|
140
150
|
function isSupportedCached(feature, browsers) {
|
|
141
|
-
const key =
|
|
142
|
-
let
|
|
151
|
+
const key = browsers ?? noBrowsers;
|
|
152
|
+
let byFeature = isSupportedCache.get(key);
|
|
153
|
+
if (!byFeature) {
|
|
154
|
+
byFeature = new Map();
|
|
155
|
+
isSupportedCache.set(key, byFeature);
|
|
156
|
+
}
|
|
143
157
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
158
|
+
const cached = byFeature.get(feature);
|
|
159
|
+
if (cached !== undefined) {
|
|
160
|
+
return cached;
|
|
147
161
|
}
|
|
148
162
|
|
|
163
|
+
const result = isSupported(feature, /** @type {string[]} */ (browsers));
|
|
164
|
+
byFeature.set(feature, result);
|
|
165
|
+
|
|
149
166
|
return result;
|
|
150
167
|
}
|
|
151
168
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureCompatibility.d.ts","sourceRoot":"","sources":["../../src/lib/ensureCompatibility.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA;;;;GAIG;AACH,iBAAS,UAAU,CAAC,UAAU,EAJnB,MAAM,EAIa,EAAE,UAAU,EAH/B,MAAM,EAGyB,GAF9B,OAAO,CAWlB;AAED;;;GAGG;AACH,iBAAS,QAAQ,CAAC,QAAQ,EAHf,MAGe,GAFd,OAAO,CAIlB;
|
|
1
|
+
{"version":3,"file":"ensureCompatibility.d.ts","sourceRoot":"","sources":["../../src/lib/ensureCompatibility.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA;;;;GAIG;AACH,iBAAS,UAAU,CAAC,UAAU,EAJnB,MAAM,EAIa,EAAE,UAAU,EAH/B,MAAM,EAGyB,GAF9B,OAAO,CAWlB;AAED;;;GAGG;AACH,iBAAS,QAAQ,CAAC,QAAQ,EAHf,MAGe,GAFd,OAAO,CAIlB;AA4GD;;;;;GAKG;AACH,iBAAS,mBAAmB,CAAC,SAAS,EAL3B,MAAM,EAKqB,EAAE,QAAQ,AAJ7C,CACA,EADO,MAAM,EAAE,YAI8B,EAAE,kBAAkB,AAHjE,CACA,EADO,GAAG,CAAC,MAAM,EAAC,OAAO,CAAC,YAGuC,GAFxD,OAAO,CA0ElB"}
|