@una-ui/extractor-vue-script 0.52.1 → 0.53.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.d.ts CHANGED
@@ -9,4 +9,4 @@ interface ExtractorVueScriptOptions {
9
9
  }
10
10
  declare function extractorVueScript(options?: ExtractorVueScriptOptions): Extractor;
11
11
 
12
- export = extractorVueScript;
12
+ export { extractorVueScript as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@una-ui/extractor-vue-script",
3
- "version": "0.52.1",
3
+ "version": "0.53.0",
4
4
  "description": "Unocss extractor for Vue script",
5
5
  "author": "Phojie Rengel <phojrengel@gmail.com>",
6
6
  "license": "MIT",
@@ -23,11 +23,9 @@
23
23
  "exports": {
24
24
  ".": {
25
25
  "types": "./dist/index.d.ts",
26
- "import": "./dist/index.mjs",
27
- "require": "./dist/index.cjs"
26
+ "import": "./dist/index.mjs"
28
27
  }
29
28
  },
30
- "main": "./dist/index.cjs",
31
29
  "module": "./dist/index.mjs",
32
30
  "types": "./dist/index.d.ts",
33
31
  "files": [
package/dist/index.cjs DELETED
@@ -1,37 +0,0 @@
1
- 'use strict';
2
-
3
- const core = require('@unocss/core');
4
-
5
- function generateSelectors(prefix, values) {
6
- prefix = prefix.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
7
- return values.filter((v) => Boolean(v) && v !== ":").map((v) => `[${prefix}~="${v}"]`);
8
- }
9
- function splitCodeWithArbitraryVariants(code, prefixes) {
10
- const result = [];
11
- const camelCasePrefixes = prefixes.map((prefix) => prefix.replace(/-([a-z])/g, (_, c) => c.toUpperCase()));
12
- prefixes = [...prefixes, ...camelCasePrefixes];
13
- for (const prefix of prefixes) {
14
- const regex = new RegExp(`\\b${prefix}\\s*:\\s*'([^']*)'`, "g");
15
- let match;
16
- while (true) {
17
- match = regex.exec(code);
18
- if (match === null)
19
- break;
20
- const values = match[1].split(core.defaultSplitRE);
21
- const selectors = generateSelectors(prefix, values);
22
- result.push(...selectors);
23
- }
24
- }
25
- return result;
26
- }
27
- function extractorVueScript(options) {
28
- return {
29
- name: "@una-ui/extractor-vue-script",
30
- order: 0,
31
- async extract({ code }) {
32
- return splitCodeWithArbitraryVariants(code, options?.prefixes ?? []);
33
- }
34
- };
35
- }
36
-
37
- module.exports = extractorVueScript;
package/dist/index.d.cts DELETED
@@ -1,12 +0,0 @@
1
- import { Extractor } from '@unocss/core';
2
-
3
- interface ExtractorVueScriptOptions {
4
- /**
5
- * @default []
6
- * @description List of prefixes to extract from the vue-script code.
7
- */
8
- prefixes?: string[];
9
- }
10
- declare function extractorVueScript(options?: ExtractorVueScriptOptions): Extractor;
11
-
12
- export = extractorVueScript;