@unocss/transformer-directives 0.63.6 → 0.64.1
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 +7 -5
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -42,7 +42,7 @@ async function parseApply({ code, uno, applyVariable }, node, childNode) {
|
|
|
42
42
|
}, []);
|
|
43
43
|
if (!utils.length)
|
|
44
44
|
return;
|
|
45
|
-
let
|
|
45
|
+
let semicolonOffset = original[childNode.loc.end.offset] === ";" ? 1 : original[childNode.loc.end.offset] === "@" ? -1 : 0;
|
|
46
46
|
for (const i of utils) {
|
|
47
47
|
const [, _selector, body2, parent] = i;
|
|
48
48
|
const selectorOrGroup = _selector?.replace(regexScopePlaceholder, " ") || _selector;
|
|
@@ -68,18 +68,18 @@ async function parseApply({ code, uno, applyVariable }, node, childNode) {
|
|
|
68
68
|
let css = `${newSelector.replace(/.\\-/g, className)}{${body2}}`;
|
|
69
69
|
if (parent)
|
|
70
70
|
css = `${parent}{${css}}`;
|
|
71
|
-
|
|
71
|
+
semicolonOffset = 0;
|
|
72
72
|
code.appendLeft(node.loc.end.offset, css);
|
|
73
73
|
} else {
|
|
74
74
|
if (body2.includes("@"))
|
|
75
75
|
code.appendRight(original.length, body2);
|
|
76
76
|
else
|
|
77
|
-
code.appendRight(childNode.loc.end.offset +
|
|
77
|
+
code.appendRight(childNode.loc.end.offset + semicolonOffset, body2);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
code.remove(
|
|
81
81
|
childNode.loc.start.offset,
|
|
82
|
-
childNode.loc.end.offset +
|
|
82
|
+
childNode.loc.end.offset + semicolonOffset
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
function removeQuotes(value) {
|
|
@@ -144,6 +144,8 @@ async function handleFunction({ code, uno, options }, node) {
|
|
|
144
144
|
case "theme": {
|
|
145
145
|
if (node.children.size !== 1)
|
|
146
146
|
throw new Error("theme() expect exact one argument");
|
|
147
|
+
if (node.children.first.type !== "String")
|
|
148
|
+
throw new Error("theme() expect a string argument");
|
|
147
149
|
const themeStr = node.children.first.value;
|
|
148
150
|
const value = transformThemeString(themeStr, uno.config.theme, throwOnMissing);
|
|
149
151
|
if (value)
|
|
@@ -151,7 +153,7 @@ async function handleFunction({ code, uno, options }, node) {
|
|
|
151
153
|
break;
|
|
152
154
|
}
|
|
153
155
|
case "icon": {
|
|
154
|
-
const params = node.children.toArray().filter((
|
|
156
|
+
const params = node.children.toArray().filter((node2) => node2.type === "String").map((node2) => node2.value);
|
|
155
157
|
if (params.length === 0)
|
|
156
158
|
throw new Error("icon() expects at least one argument");
|
|
157
159
|
let [icon, color] = params;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/transformer-directives",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.64.1",
|
|
5
5
|
"description": "UnoCSS transformer for `@apply` directive",
|
|
6
6
|
"author": "hannoeru <me@hanlee.co>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"css-tree": "^3.0.
|
|
36
|
-
"@unocss/core": "0.
|
|
37
|
-
"@unocss/rule-utils": "0.
|
|
35
|
+
"css-tree": "^3.0.1",
|
|
36
|
+
"@unocss/core": "0.64.1",
|
|
37
|
+
"@unocss/rule-utils": "0.64.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"magic-string": "^0.30.
|
|
40
|
+
"magic-string": "^0.30.12"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "unbuild",
|