@unocss/postcss 66.1.3 → 66.2.0
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/dist/esm.mjs +28 -11
- package/package.json +4 -4
package/dist/esm.mjs
CHANGED
|
@@ -247,22 +247,39 @@ function createPlugin(options) {
|
|
|
247
247
|
classes.clear();
|
|
248
248
|
const excludes = [];
|
|
249
249
|
root.walkAtRules(directiveMap.unocss, (rule) => {
|
|
250
|
+
const source = rule.source;
|
|
250
251
|
if (rule.params) {
|
|
251
|
-
const
|
|
252
|
-
const
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
|
|
252
|
+
const excludeLayers = [];
|
|
253
|
+
const includeLayers = [];
|
|
254
|
+
for (const layer of rule.params.split(",")) {
|
|
255
|
+
const name = layer.trim();
|
|
256
|
+
if (!name)
|
|
257
|
+
continue;
|
|
258
|
+
if (name.startsWith("!")) {
|
|
259
|
+
if (name.slice(1)) {
|
|
260
|
+
excludeLayers.push(name.slice(1));
|
|
261
|
+
}
|
|
262
|
+
} else {
|
|
263
|
+
includeLayers.push(name);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (excludeLayers.length > 0 && includeLayers.length > 0) {
|
|
267
|
+
console.warn(`Warning: Mixing normal and negated layer names in "@${directiveMap.unocss} ${rule.params}" is not recommended.`);
|
|
268
|
+
}
|
|
269
|
+
let result2 = "";
|
|
270
|
+
if (includeLayers.length > 0) {
|
|
271
|
+
result2 = includeLayers.map((i) => (i === "all" ? c.getLayers() : c.getLayer(i)) || "").filter(Boolean).join("\n");
|
|
272
|
+
excludes.push(...includeLayers);
|
|
273
|
+
} else if (excludeLayers.length > 0) {
|
|
274
|
+
result2 = c.getLayers(void 0, excludeLayers) || "";
|
|
275
|
+
excludes.push(...excludeLayers);
|
|
276
|
+
}
|
|
277
|
+
const css = postcss.parse(result2);
|
|
256
278
|
css.walkDecls((declaration) => {
|
|
257
279
|
declaration.source = source;
|
|
258
280
|
});
|
|
259
281
|
rule.replaceWith(css);
|
|
260
|
-
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
root.walkAtRules(directiveMap.unocss, (rule) => {
|
|
264
|
-
if (!rule.params) {
|
|
265
|
-
const source = rule.source;
|
|
282
|
+
} else {
|
|
266
283
|
const css = postcss.parse(c.getLayers(void 0, excludes) || "");
|
|
267
284
|
css.walkDecls((declaration) => {
|
|
268
285
|
declaration.source = source;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/postcss",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "66.
|
|
4
|
+
"version": "66.2.0",
|
|
5
5
|
"description": "PostCSS plugin for UnoCSS",
|
|
6
6
|
"author": "sibbng <sibbngheid@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"css-tree": "^3.1.0",
|
|
58
58
|
"postcss": "^8.5.3",
|
|
59
59
|
"tinyglobby": "^0.2.13",
|
|
60
|
-
"@unocss/
|
|
61
|
-
"@unocss/config": "66.
|
|
62
|
-
"@unocss/
|
|
60
|
+
"@unocss/core": "66.2.0",
|
|
61
|
+
"@unocss/config": "66.2.0",
|
|
62
|
+
"@unocss/rule-utils": "66.2.0"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"build": "unbuild",
|