@unocss/transformer-compile-class 0.44.0 → 0.44.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.cjs CHANGED
@@ -13,12 +13,12 @@ function transformerCompileClass(options = {}) {
13
13
  return {
14
14
  name: "compile-class",
15
15
  enforce: "pre",
16
- async transform(s, _, { uno }) {
16
+ async transform(s, _, { uno, tokens }) {
17
17
  const matches = [...s.original.matchAll(regex)];
18
18
  if (!matches.length)
19
19
  return;
20
20
  for (const match of matches) {
21
- let body = match[2].trim();
21
+ let body = core.expandVariantGroup(match[2].trim());
22
22
  const start = match.index;
23
23
  const replacements = [];
24
24
  if (keepUnknown) {
@@ -36,6 +36,7 @@ function transformerCompileClass(options = {}) {
36
36
  uno.config.shortcuts.push([className, body, { layer: options.layer }]);
37
37
  else
38
38
  uno.config.shortcuts.push([className, body]);
39
+ tokens.add(className);
39
40
  }
40
41
  s.overwrite(start + 1, start + match[0].length - 1, replacements.join(" "));
41
42
  }
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { escapeRegExp } from '@unocss/core';
1
+ import { escapeRegExp, expandVariantGroup } from '@unocss/core';
2
2
 
3
3
  function transformerCompileClass(options = {}) {
4
4
  const {
@@ -11,12 +11,12 @@ function transformerCompileClass(options = {}) {
11
11
  return {
12
12
  name: "compile-class",
13
13
  enforce: "pre",
14
- async transform(s, _, { uno }) {
14
+ async transform(s, _, { uno, tokens }) {
15
15
  const matches = [...s.original.matchAll(regex)];
16
16
  if (!matches.length)
17
17
  return;
18
18
  for (const match of matches) {
19
- let body = match[2].trim();
19
+ let body = expandVariantGroup(match[2].trim());
20
20
  const start = match.index;
21
21
  const replacements = [];
22
22
  if (keepUnknown) {
@@ -34,6 +34,7 @@ function transformerCompileClass(options = {}) {
34
34
  uno.config.shortcuts.push([className, body, { layer: options.layer }]);
35
35
  else
36
36
  uno.config.shortcuts.push([className, body]);
37
+ tokens.add(className);
37
38
  }
38
39
  s.overwrite(start + 1, start + match[0].length - 1, replacements.join(" "));
39
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/transformer-compile-class",
3
- "version": "0.44.0",
3
+ "version": "0.44.3",
4
4
  "description": "Compile group of classes into one class",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -32,7 +32,7 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@unocss/core": "0.44.0"
35
+ "@unocss/core": "0.44.3"
36
36
  },
37
37
  "devDependencies": {
38
38
  "magic-string": "^0.26.2"