@unocss/transformer-compile-class 0.39.3 → 0.40.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 CHANGED
@@ -32,7 +32,10 @@ function transformerCompileClass(options = {}) {
32
32
  const hash2 = hashFn(body);
33
33
  const className = `${classPrefix}${hash2}`;
34
34
  replacements.unshift(className);
35
- uno.config.shortcuts.push([className, body]);
35
+ if (options.layer)
36
+ uno.config.shortcuts.push([className, body, { layer: options.layer }]);
37
+ else
38
+ uno.config.shortcuts.push([className, body]);
36
39
  }
37
40
  s.overwrite(start + 1, start + match[0].length - 1, replacements.join(" "));
38
41
  }
package/dist/index.d.ts CHANGED
@@ -21,6 +21,10 @@ interface CompileClassOptions {
21
21
  * @default true
22
22
  */
23
23
  keepUnknown?: boolean;
24
+ /**
25
+ * The layer name of generated rules
26
+ */
27
+ layer?: string;
24
28
  }
25
29
  declare function transformerCompileClass(options?: CompileClassOptions): SourceCodeTransformer;
26
30
 
package/dist/index.mjs CHANGED
@@ -30,7 +30,10 @@ function transformerCompileClass(options = {}) {
30
30
  const hash2 = hashFn(body);
31
31
  const className = `${classPrefix}${hash2}`;
32
32
  replacements.unshift(className);
33
- uno.config.shortcuts.push([className, body]);
33
+ if (options.layer)
34
+ uno.config.shortcuts.push([className, body, { layer: options.layer }]);
35
+ else
36
+ uno.config.shortcuts.push([className, body]);
34
37
  }
35
38
  s.overwrite(start + 1, start + match[0].length - 1, replacements.join(" "));
36
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/transformer-compile-class",
3
- "version": "0.39.3",
3
+ "version": "0.40.0",
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.39.3"
35
+ "@unocss/core": "0.40.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "magic-string": "^0.26.2"