@unocss/transformer-directives 0.60.2 → 0.60.3
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/index.mjs +5 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -52,7 +52,7 @@ function handleScreen({ code, uno }, node) {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
function calcMaxWidthBySize(size) {
|
|
55
|
-
const value = size.match(
|
|
55
|
+
const value = size.match(/^-?\d+\.?\d*/)?.[0] || "";
|
|
56
56
|
const unit = size.slice(value.length);
|
|
57
57
|
const maxWidth = Number.parseFloat(value) - 0.1;
|
|
58
58
|
return Number.isNaN(maxWidth) ? size : `${maxWidth}${unit}`;
|
|
@@ -86,6 +86,7 @@ async function parseApply({ code, uno, offset, applyVariable }, node, childNode)
|
|
|
86
86
|
}
|
|
87
87
|
if (!body)
|
|
88
88
|
return;
|
|
89
|
+
body = removeComments(body);
|
|
89
90
|
const classNames = expandVariantGroup(body).split(/\s+/g).map((className) => className.trim().replace(/\\/, ""));
|
|
90
91
|
const utils = (await Promise.all(
|
|
91
92
|
classNames.map((i) => uno.parseToken(i, "-"))
|
|
@@ -140,6 +141,9 @@ async function parseApply({ code, uno, offset, applyVariable }, node, childNode)
|
|
|
140
141
|
function removeQuotes(value) {
|
|
141
142
|
return value.replace(/^(['"])(.*)\1$/, "$2");
|
|
142
143
|
}
|
|
144
|
+
function removeComments(value) {
|
|
145
|
+
return value.replace(/(\/\*(?:.|\n)*?\*\/)|(\/\/.*)/g, "");
|
|
146
|
+
}
|
|
143
147
|
|
|
144
148
|
function handleFunction({ code, uno, options }, node) {
|
|
145
149
|
const { throwOnMissing = true } = options;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/transformer-directives",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.60.
|
|
4
|
+
"version": "0.60.3",
|
|
5
5
|
"description": "UnoCSS transformer for `@apply` directive",
|
|
6
6
|
"author": "hannoeru <me@hanlee.co>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"css-tree": "^2.3.1",
|
|
36
|
-
"@unocss/
|
|
37
|
-
"@unocss/
|
|
36
|
+
"@unocss/core": "0.60.3",
|
|
37
|
+
"@unocss/rule-utils": "0.60.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"magic-string": "^0.30.10"
|