@unocss/transformer-attributify-jsx 0.50.2 → 0.50.4
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 +3 -7
- package/dist/index.mjs +3 -7
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -13,8 +13,7 @@ function createFilter(include, exclude) {
|
|
|
13
13
|
}
|
|
14
14
|
const elementRE = /<([^>\s]*\s)((?:'.*?'|".*?"|`.*?`|\{.*?\}|[^>]*?)*)/g;
|
|
15
15
|
const attributeRE = /([a-zA-Z()#][\[?a-zA-Z0-9-_:()#%\]?]*)(?:\s*=\s*((?:'[^']*')|(?:"[^"]*")|\S+))?/g;
|
|
16
|
-
const
|
|
17
|
-
const curlybraceRE = /\w+\s?=\s?\{.+?\}/g;
|
|
16
|
+
const valuedAttributeRE = /((?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:!%-.~<]+)=(?:["]([^"]*)["]|[']([^']*)[']|[{]((?:[`(](?:[^`)]*)[`)]|[^}])+)[}])/gms;
|
|
18
17
|
function transformerAttributifyJsx(options = {}) {
|
|
19
18
|
const {
|
|
20
19
|
blocklist = []
|
|
@@ -41,12 +40,9 @@ function transformerAttributifyJsx(options = {}) {
|
|
|
41
40
|
async transform(code, _, { uno }) {
|
|
42
41
|
const tasks = [];
|
|
43
42
|
for (const item of Array.from(code.original.matchAll(elementRE))) {
|
|
44
|
-
const classNamePart = item[2].match(classFilterRE);
|
|
45
43
|
let attributifyPart = item[2];
|
|
46
|
-
if (
|
|
47
|
-
attributifyPart =
|
|
48
|
-
if (curlybraceRE.test(attributifyPart))
|
|
49
|
-
attributifyPart = attributifyPart.replace(curlybraceRE, (match) => " ".repeat(match.length));
|
|
44
|
+
if (valuedAttributeRE.test(attributifyPart))
|
|
45
|
+
attributifyPart = attributifyPart.replace(valuedAttributeRE, (match) => " ".repeat(match.length));
|
|
50
46
|
for (const attr of attributifyPart.matchAll(attributeRE)) {
|
|
51
47
|
const matchedRule = attr[0].replace(/\:/i, "-");
|
|
52
48
|
if (matchedRule.includes("=") || isBlocked(matchedRule))
|
package/dist/index.mjs
CHANGED
|
@@ -11,8 +11,7 @@ function createFilter(include, exclude) {
|
|
|
11
11
|
}
|
|
12
12
|
const elementRE = /<([^>\s]*\s)((?:'.*?'|".*?"|`.*?`|\{.*?\}|[^>]*?)*)/g;
|
|
13
13
|
const attributeRE = /([a-zA-Z()#][\[?a-zA-Z0-9-_:()#%\]?]*)(?:\s*=\s*((?:'[^']*')|(?:"[^"]*")|\S+))?/g;
|
|
14
|
-
const
|
|
15
|
-
const curlybraceRE = /\w+\s?=\s?\{.+?\}/g;
|
|
14
|
+
const valuedAttributeRE = /((?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:!%-.~<]+)=(?:["]([^"]*)["]|[']([^']*)[']|[{]((?:[`(](?:[^`)]*)[`)]|[^}])+)[}])/gms;
|
|
16
15
|
function transformerAttributifyJsx(options = {}) {
|
|
17
16
|
const {
|
|
18
17
|
blocklist = []
|
|
@@ -39,12 +38,9 @@ function transformerAttributifyJsx(options = {}) {
|
|
|
39
38
|
async transform(code, _, { uno }) {
|
|
40
39
|
const tasks = [];
|
|
41
40
|
for (const item of Array.from(code.original.matchAll(elementRE))) {
|
|
42
|
-
const classNamePart = item[2].match(classFilterRE);
|
|
43
41
|
let attributifyPart = item[2];
|
|
44
|
-
if (
|
|
45
|
-
attributifyPart =
|
|
46
|
-
if (curlybraceRE.test(attributifyPart))
|
|
47
|
-
attributifyPart = attributifyPart.replace(curlybraceRE, (match) => " ".repeat(match.length));
|
|
42
|
+
if (valuedAttributeRE.test(attributifyPart))
|
|
43
|
+
attributifyPart = attributifyPart.replace(valuedAttributeRE, (match) => " ".repeat(match.length));
|
|
48
44
|
for (const attr of attributifyPart.matchAll(attributeRE)) {
|
|
49
45
|
const matchedRule = attr[0].replace(/\:/i, "-");
|
|
50
46
|
if (matchedRule.includes("=") || isBlocked(matchedRule))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/transformer-attributify-jsx",
|
|
3
|
-
"version": "0.50.
|
|
3
|
+
"version": "0.50.4",
|
|
4
4
|
"description": "Support valueless attributify in JSX/TSX.",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@unocss/core": "0.50.
|
|
36
|
+
"@unocss/core": "0.50.4"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"magic-string": "^0.30.0"
|