@unocss/transformer-variant-group 0.27.1 → 0.27.2

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
@@ -1,29 +1,15 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  const core = require('@unocss/core');
6
4
 
7
5
  function transformerVariantGroup() {
8
6
  return {
9
7
  name: "variant-group",
10
8
  enforce: "pre",
11
- async transform(code) {
12
- return transformVariantGroups(code);
9
+ transform(s) {
10
+ core.expandVariantGroup(s);
13
11
  }
14
12
  };
15
13
  }
16
- function transformVariantGroups(code) {
17
- let match;
18
- core.regexClassGroup.lastIndex = 0;
19
- while (match = core.regexClassGroup.exec(code.original)) {
20
- const start = match.index;
21
- const end = start + match[0].length;
22
- const [, pre, sep, body] = match;
23
- const replacement = body.split(/\s/g).map((i) => i.replace(/^(!?)(.*)/, `$1${pre}${sep}$2`)).join(" ");
24
- code.overwrite(start, end, replacement);
25
- }
26
- }
27
14
 
28
- exports["default"] = transformerVariantGroup;
29
- exports.transformVariantGroups = transformVariantGroups;
15
+ module.exports = transformerVariantGroup;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  import { SourceCodeTransformer } from '@unocss/core';
2
- import MagicString from 'magic-string-extra';
3
2
 
4
3
  declare function transformerVariantGroup(): SourceCodeTransformer;
5
- declare function transformVariantGroups(code: MagicString): void;
6
4
 
7
- export { transformerVariantGroup as default, transformVariantGroups };
5
+ export { transformerVariantGroup as default };
package/dist/index.mjs CHANGED
@@ -1,24 +1,13 @@
1
- import { regexClassGroup } from '@unocss/core';
1
+ import { expandVariantGroup } from '@unocss/core';
2
2
 
3
3
  function transformerVariantGroup() {
4
4
  return {
5
5
  name: "variant-group",
6
6
  enforce: "pre",
7
- async transform(code) {
8
- return transformVariantGroups(code);
7
+ transform(s) {
8
+ expandVariantGroup(s);
9
9
  }
10
10
  };
11
11
  }
12
- function transformVariantGroups(code) {
13
- let match;
14
- regexClassGroup.lastIndex = 0;
15
- while (match = regexClassGroup.exec(code.original)) {
16
- const start = match.index;
17
- const end = start + match[0].length;
18
- const [, pre, sep, body] = match;
19
- const replacement = body.split(/\s/g).map((i) => i.replace(/^(!?)(.*)/, `$1${pre}${sep}$2`)).join(" ");
20
- code.overwrite(start, end, replacement);
21
- }
22
- }
23
12
 
24
- export { transformerVariantGroup as default, transformVariantGroups };
13
+ export { transformerVariantGroup as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/transformer-variant-group",
3
- "version": "0.27.1",
3
+ "version": "0.27.2",
4
4
  "description": "Variant group transformer for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -32,10 +32,10 @@
32
32
  "module": "./dist/index.mjs",
33
33
  "types": "./dist/index.d.ts",
34
34
  "dependencies": {
35
- "@unocss/core": "0.27.1"
35
+ "@unocss/core": "0.27.2"
36
36
  },
37
37
  "devDependencies": {
38
- "magic-string-extra": "^0.1.2"
38
+ "magic-string": "^0.26.1"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "unbuild",