@unocss/extractor-arbitrary-variants 0.58.8 → 0.59.0-beta.1
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/package.json +6 -6
- package/dist/index.cjs +0 -44
- package/dist/index.d.cts +0 -8
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/extractor-arbitrary-variants",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.59.0-beta.1",
|
|
4
5
|
"description": "Extractor arbitrary variants for utilities",
|
|
5
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
7
|
"license": "MIT",
|
|
@@ -21,19 +22,18 @@
|
|
|
21
22
|
"sideEffects": false,
|
|
22
23
|
"exports": {
|
|
23
24
|
".": {
|
|
24
|
-
"types": "./dist/index.d.
|
|
25
|
-
"
|
|
26
|
-
"require": "./dist/index.cjs"
|
|
25
|
+
"types": "./dist/index.d.mts",
|
|
26
|
+
"default": "./dist/index.mjs"
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
|
-
"main": "./dist/index.
|
|
29
|
+
"main": "./dist/index.mjs",
|
|
30
30
|
"module": "./dist/index.mjs",
|
|
31
31
|
"types": "./dist/index.d.ts",
|
|
32
32
|
"files": [
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@unocss/core": "0.
|
|
36
|
+
"@unocss/core": "0.59.0-beta.1"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "unbuild",
|
package/dist/index.cjs
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const core = require('@unocss/core');
|
|
6
|
-
|
|
7
|
-
const sourceMapRE = /\/\/#\s*sourceMappingURL=.*\n?/g;
|
|
8
|
-
function removeSourceMap(code) {
|
|
9
|
-
if (code.includes("sourceMappingURL="))
|
|
10
|
-
return code.replace(sourceMapRE, "");
|
|
11
|
-
return code;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const quotedArbitraryValuesRE = /(?:[\w&:[\]-]|\[\S{1,64}=\S{1,64}\]){1,64}\[\\?['"]?\S{1,64}?['"]\]\]?[\w:-]{0,64}/g;
|
|
15
|
-
const arbitraryPropertyRE = /\[(\\\W|[\w-]){1,64}:[^\s:]{0,64}?("\S{1,64}?"|'\S{1,64}?'|`\S{1,64}?`|[^\s:]{1,64}?)[^\s:]{0,64}?\)?\]/g;
|
|
16
|
-
const arbitraryPropertyCandidateRE = /^\[(\\\W|[\w-]){1,64}:['"]?\S{1,64}?['"]?\]$/;
|
|
17
|
-
function splitCodeWithArbitraryVariants(code) {
|
|
18
|
-
const result = [];
|
|
19
|
-
for (const match of code.matchAll(arbitraryPropertyRE)) {
|
|
20
|
-
if (match.index !== 0 && !/^[\s'"`]/.test(code[match.index - 1] ?? ""))
|
|
21
|
-
continue;
|
|
22
|
-
result.push(match[0]);
|
|
23
|
-
}
|
|
24
|
-
for (const match of code.matchAll(quotedArbitraryValuesRE))
|
|
25
|
-
result.push(match[0]);
|
|
26
|
-
code.split(core.defaultSplitRE).forEach((match) => {
|
|
27
|
-
if (core.isValidSelector(match) && !arbitraryPropertyCandidateRE.test(match))
|
|
28
|
-
result.push(match);
|
|
29
|
-
});
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
32
|
-
const extractorArbitraryVariants = {
|
|
33
|
-
name: "@unocss/extractor-arbitrary-variants",
|
|
34
|
-
order: 0,
|
|
35
|
-
extract({ code }) {
|
|
36
|
-
return splitCodeWithArbitraryVariants(removeSourceMap(code));
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
exports.arbitraryPropertyRE = arbitraryPropertyRE;
|
|
41
|
-
exports.default = extractorArbitraryVariants;
|
|
42
|
-
exports.extractorArbitraryVariants = extractorArbitraryVariants;
|
|
43
|
-
exports.quotedArbitraryValuesRE = quotedArbitraryValuesRE;
|
|
44
|
-
exports.splitCodeWithArbitraryVariants = splitCodeWithArbitraryVariants;
|
package/dist/index.d.cts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Extractor } from '@unocss/core';
|
|
2
|
-
|
|
3
|
-
declare const quotedArbitraryValuesRE: RegExp;
|
|
4
|
-
declare const arbitraryPropertyRE: RegExp;
|
|
5
|
-
declare function splitCodeWithArbitraryVariants(code: string): string[];
|
|
6
|
-
declare const extractorArbitraryVariants: Extractor;
|
|
7
|
-
|
|
8
|
-
export { arbitraryPropertyRE, extractorArbitraryVariants as default, extractorArbitraryVariants, quotedArbitraryValuesRE, splitCodeWithArbitraryVariants };
|