@unocss/transformer-compile-class 0.44.1 → 0.44.4

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
@@ -12,8 +12,8 @@ function transformerCompileClass(options = {}) {
12
12
  const regex = new RegExp(`(["'\`])${core.escapeRegExp(trigger)}\\s([^\\1]*?)\\1`, "g");
13
13
  return {
14
14
  name: "compile-class",
15
- enforce: "post",
16
- async transform(s, _, { uno }) {
15
+ enforce: "pre",
16
+ async transform(s, _, { uno, tokens }) {
17
17
  const matches = [...s.original.matchAll(regex)];
18
18
  if (!matches.length)
19
19
  return;
@@ -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
@@ -10,8 +10,8 @@ function transformerCompileClass(options = {}) {
10
10
  const regex = new RegExp(`(["'\`])${escapeRegExp(trigger)}\\s([^\\1]*?)\\1`, "g");
11
11
  return {
12
12
  name: "compile-class",
13
- enforce: "post",
14
- async transform(s, _, { uno }) {
13
+ enforce: "pre",
14
+ async transform(s, _, { uno, tokens }) {
15
15
  const matches = [...s.original.matchAll(regex)];
16
16
  if (!matches.length)
17
17
  return;
@@ -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.1",
3
+ "version": "0.44.4",
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.1"
35
+ "@unocss/core": "0.44.4"
36
36
  },
37
37
  "devDependencies": {
38
38
  "magic-string": "^0.26.2"