@una-ui/extractor-vue-script 0.2.0-beta.6 → 0.4.0-beta.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 +5 -5
- package/dist/index.d.cts +13 -0
- package/dist/index.d.mts +13 -0
- package/dist/index.d.ts +3 -4
- package/dist/index.mjs +5 -2
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,14 +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 generateSelectors(prefix, values) {
|
|
6
|
+
prefix = prefix.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
8
7
|
return values.filter((v) => Boolean(v) && v !== ":").map((v) => `[${prefix}~="${v}"]`);
|
|
9
8
|
}
|
|
10
9
|
function splitCodeWithArbitraryVariants(code, prefixes) {
|
|
11
10
|
const result = [];
|
|
11
|
+
const camelCasePrefixes = prefixes.map((prefix) => prefix.replace(/-([a-z])/g, (_, c) => c.toUpperCase()));
|
|
12
|
+
prefixes = [...prefixes, ...camelCasePrefixes];
|
|
12
13
|
for (const prefix of prefixes) {
|
|
13
14
|
const regex = new RegExp(`^\\s*${prefix}:\\s+'.*',?\\s*$`, "mg");
|
|
14
15
|
const matches = code.match(regex);
|
|
@@ -22,7 +23,7 @@ function splitCodeWithArbitraryVariants(code, prefixes) {
|
|
|
22
23
|
}
|
|
23
24
|
return result;
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
+
function extractorVueScript(options) {
|
|
26
27
|
return {
|
|
27
28
|
name: "@una-ui/extractor-vue-script",
|
|
28
29
|
order: 0,
|
|
@@ -32,5 +33,4 @@ function extractor(options) {
|
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
exports
|
|
36
|
-
exports.splitCodeWithArbitraryVariants = splitCodeWithArbitraryVariants;
|
|
36
|
+
module.exports = extractorVueScript;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
|
|
11
|
+
declare function extractorVueScript(options?: ExtractorVueScriptOptions): Extractor;
|
|
12
|
+
|
|
13
|
+
export { extractorVueScript as default };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
|
|
11
|
+
declare function extractorVueScript(options?: ExtractorVueScriptOptions): Extractor;
|
|
12
|
+
|
|
13
|
+
export { extractorVueScript as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,11 +4,10 @@ interface ExtractorVueScriptOptions {
|
|
|
4
4
|
/**
|
|
5
5
|
* @default []
|
|
6
6
|
* @description List of prefixes to extract from the vue-script code.
|
|
7
|
-
|
|
7
|
+
*/
|
|
8
8
|
prefixes?: string[];
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
declare function
|
|
12
|
-
declare function extractor(options?: ExtractorVueScriptOptions): Extractor;
|
|
11
|
+
declare function extractorVueScript(options?: ExtractorVueScriptOptions): Extractor;
|
|
13
12
|
|
|
14
|
-
export {
|
|
13
|
+
export { extractorVueScript as default };
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { defaultSplitRE } from '@unocss/core';
|
|
2
2
|
|
|
3
3
|
function generateSelectors(prefix, values) {
|
|
4
|
+
prefix = prefix.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
4
5
|
return values.filter((v) => Boolean(v) && v !== ":").map((v) => `[${prefix}~="${v}"]`);
|
|
5
6
|
}
|
|
6
7
|
function splitCodeWithArbitraryVariants(code, prefixes) {
|
|
7
8
|
const result = [];
|
|
9
|
+
const camelCasePrefixes = prefixes.map((prefix) => prefix.replace(/-([a-z])/g, (_, c) => c.toUpperCase()));
|
|
10
|
+
prefixes = [...prefixes, ...camelCasePrefixes];
|
|
8
11
|
for (const prefix of prefixes) {
|
|
9
12
|
const regex = new RegExp(`^\\s*${prefix}:\\s+'.*',?\\s*$`, "mg");
|
|
10
13
|
const matches = code.match(regex);
|
|
@@ -18,7 +21,7 @@ function splitCodeWithArbitraryVariants(code, prefixes) {
|
|
|
18
21
|
}
|
|
19
22
|
return result;
|
|
20
23
|
}
|
|
21
|
-
function
|
|
24
|
+
function extractorVueScript(options) {
|
|
22
25
|
return {
|
|
23
26
|
name: "@una-ui/extractor-vue-script",
|
|
24
27
|
order: 0,
|
|
@@ -28,4 +31,4 @@ function extractor(options) {
|
|
|
28
31
|
};
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
export {
|
|
34
|
+
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.
|
|
3
|
+
"version": "0.4.0-beta.0",
|
|
4
4
|
"description": "Unocss extractor for Vue script",
|
|
5
5
|
"author": "Phojie Rengel <phojrengel@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
25
|
"types": "./dist/index.d.ts",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
26
|
+
"import": "./dist/index.mjs",
|
|
27
|
+
"require": "./dist/index.cjs"
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"main": "./dist/index.cjs",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@unocss/core": "^0.
|
|
40
|
+
"@unocss/core": "^0.57.3"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "unbuild",
|