@unocss/transformer-compile-class 0.52.4 → 0.52.6
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 +11 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +11 -3
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ const core = require('@unocss/core');
|
|
|
4
4
|
|
|
5
5
|
function transformerCompileClass(options = {}) {
|
|
6
6
|
const {
|
|
7
|
-
trigger = /(["'`]):uno
|
|
7
|
+
trigger = /(["'`]):uno(?:-)?(?<name>[^\s\1]+)?:\s([^\1]*?)\1/g,
|
|
8
8
|
classPrefix = "uno-",
|
|
9
9
|
hashFn = hash,
|
|
10
10
|
keepUnknown = true
|
|
@@ -30,8 +30,16 @@ function transformerCompileClass(options = {}) {
|
|
|
30
30
|
}
|
|
31
31
|
if (body) {
|
|
32
32
|
body = body.split(/\s+/).sort().join(" ");
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
let hash2;
|
|
34
|
+
let explicitName = false;
|
|
35
|
+
if (match.groups && match.groups.name) {
|
|
36
|
+
hash2 = match.groups.name;
|
|
37
|
+
explicitName = true;
|
|
38
|
+
} else {
|
|
39
|
+
hash2 = hashFn(body);
|
|
40
|
+
}
|
|
41
|
+
const className = `${classPrefix}${hash2}`;
|
|
42
|
+
if (tokens && tokens.has(className) && explicitName)
|
|
35
43
|
throw new Error(`duplicate compile class name '${className}', please choose different class name`);
|
|
36
44
|
replacements.unshift(className);
|
|
37
45
|
if (options.layer)
|
package/dist/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ interface CompileClassOptions {
|
|
|
28
28
|
* This parameter is backwards compatible. It accepts string only trigger
|
|
29
29
|
* words, like `:uno:` or a regex literal.
|
|
30
30
|
*
|
|
31
|
-
* @default `/(["'`]):uno
|
|
31
|
+
* @default `/(["'`]):uno(?:-)?(?<name>[^\s\1]+)?:\s([^\1]*?)\1/g`
|
|
32
32
|
*/
|
|
33
33
|
trigger?: string | RegExp;
|
|
34
34
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { escapeRegExp, expandVariantGroup } from '@unocss/core';
|
|
|
2
2
|
|
|
3
3
|
function transformerCompileClass(options = {}) {
|
|
4
4
|
const {
|
|
5
|
-
trigger = /(["'`]):uno
|
|
5
|
+
trigger = /(["'`]):uno(?:-)?(?<name>[^\s\1]+)?:\s([^\1]*?)\1/g,
|
|
6
6
|
classPrefix = "uno-",
|
|
7
7
|
hashFn = hash,
|
|
8
8
|
keepUnknown = true
|
|
@@ -28,8 +28,16 @@ function transformerCompileClass(options = {}) {
|
|
|
28
28
|
}
|
|
29
29
|
if (body) {
|
|
30
30
|
body = body.split(/\s+/).sort().join(" ");
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
let hash2;
|
|
32
|
+
let explicitName = false;
|
|
33
|
+
if (match.groups && match.groups.name) {
|
|
34
|
+
hash2 = match.groups.name;
|
|
35
|
+
explicitName = true;
|
|
36
|
+
} else {
|
|
37
|
+
hash2 = hashFn(body);
|
|
38
|
+
}
|
|
39
|
+
const className = `${classPrefix}${hash2}`;
|
|
40
|
+
if (tokens && tokens.has(className) && explicitName)
|
|
33
41
|
throw new Error(`duplicate compile class name '${className}', please choose different class name`);
|
|
34
42
|
replacements.unshift(className);
|
|
35
43
|
if (options.layer)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/transformer-compile-class",
|
|
3
|
-
"version": "0.52.
|
|
3
|
+
"version": "0.52.6",
|
|
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.52.
|
|
36
|
+
"@unocss/core": "0.52.6"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"magic-string": "^0.30.0"
|