@unocss/transformer-compile-class 0.52.6 → 0.53.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/index.cjs +5 -2
- package/dist/index.mjs +5 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -39,8 +39,11 @@ function transformerCompileClass(options = {}) {
|
|
|
39
39
|
hash2 = hashFn(body);
|
|
40
40
|
}
|
|
41
41
|
const className = `${classPrefix}${hash2}`;
|
|
42
|
-
if (tokens && tokens.has(className) && explicitName)
|
|
43
|
-
|
|
42
|
+
if (tokens && tokens.has(className) && explicitName) {
|
|
43
|
+
const existing = uno.config.shortcuts.find((i) => i[0] === className);
|
|
44
|
+
if (existing && existing[1] !== body)
|
|
45
|
+
throw new Error(`Duplicated compile class name "${className}". One is "${body}" and the other is "${existing[1]}" Please choose different class name`);
|
|
46
|
+
}
|
|
44
47
|
replacements.unshift(className);
|
|
45
48
|
if (options.layer)
|
|
46
49
|
uno.config.shortcuts.push([className, body, { layer: options.layer }]);
|
package/dist/index.mjs
CHANGED
|
@@ -37,8 +37,11 @@ function transformerCompileClass(options = {}) {
|
|
|
37
37
|
hash2 = hashFn(body);
|
|
38
38
|
}
|
|
39
39
|
const className = `${classPrefix}${hash2}`;
|
|
40
|
-
if (tokens && tokens.has(className) && explicitName)
|
|
41
|
-
|
|
40
|
+
if (tokens && tokens.has(className) && explicitName) {
|
|
41
|
+
const existing = uno.config.shortcuts.find((i) => i[0] === className);
|
|
42
|
+
if (existing && existing[1] !== body)
|
|
43
|
+
throw new Error(`Duplicated compile class name "${className}". One is "${body}" and the other is "${existing[1]}" Please choose different class name`);
|
|
44
|
+
}
|
|
42
45
|
replacements.unshift(className);
|
|
43
46
|
if (options.layer)
|
|
44
47
|
uno.config.shortcuts.push([className, body, { layer: options.layer }]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/transformer-compile-class",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.53.0",
|
|
4
4
|
"description": "Compile group of classes into one class",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@unocss/core": "0.
|
|
36
|
+
"@unocss/core": "0.53.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"magic-string": "^0.30.0"
|