@unocss/transformer-attributify-jsx 66.6.6 → 66.6.8

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.
Files changed (2) hide show
  1. package/dist/index.mjs +3 -8
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  import { toArray } from "@unocss/core";
2
2
  import { parseSync } from "oxc-parser";
3
3
  import { walk } from "oxc-walker";
4
-
5
4
  //#region ../../virtual-shared/integration/src/env.ts
6
5
  function getEnvFlags() {
7
6
  const isNode = typeof process !== "undefined" && process.stdout;
@@ -11,14 +10,13 @@ function getEnvFlags() {
11
10
  isESLint: isNode && !!process.env.ESLINT
12
11
  };
13
12
  }
14
-
15
13
  //#endregion
16
14
  //#region src/resolver/oxc.ts
17
15
  async function attributifyJsxOxcResolver(params) {
18
16
  const { code, id, uno, isBlocked } = params;
19
17
  const tasks = [];
20
18
  const ast = parseSync(id, code.toString(), { sourceType: "module" });
21
- if (ast.errors?.length) throw new Error(`Oxc parse errors:\n${ast.errors.join("\n")}`);
19
+ if (ast.errors?.length) throw new Error(`Oxc parse errors:\n${ast.errors.map((err) => err.codeframe ?? err.helpMessage ?? err.message).join("\n")}`);
22
20
  walk(ast.program, { enter(node) {
23
21
  if (node.type !== "JSXAttribute") return;
24
22
  if (node.value === null) {
@@ -31,7 +29,6 @@ async function attributifyJsxOxcResolver(params) {
31
29
  } });
32
30
  await Promise.all(tasks);
33
31
  }
34
-
35
32
  //#endregion
36
33
  //#region src/resolver/regex.ts
37
34
  const elementRE = /<([^/?<>0-9$_!][^\s>]*)\s+((?:"[^"]*"|'[^"]*'|(\{[^}]*\})|[^{>])+)>/g;
@@ -72,7 +69,6 @@ async function attributifyJsxRegexResolver(params) {
72
69
  }
73
70
  await Promise.all(tasks);
74
71
  }
75
-
76
72
  //#endregion
77
73
  //#region src/index.ts
78
74
  function createFilter(include, exclude) {
@@ -108,12 +104,11 @@ function transformerAttributifyJsx(options = {}) {
108
104
  try {
109
105
  await attributifyJsxOxcResolver(params);
110
106
  } catch (error) {
111
- console.warn(`[@unocss/transformer-attributify-jsx]: Oxc resolver failed for "${id}", falling back to regex resolver:`, error);
107
+ console.warn(`[@unocss/transformer-attributify-jsx]: Oxc resolver failed for "${id}", falling back to regex resolver:\n`, error);
112
108
  await attributifyJsxRegexResolver(params);
113
109
  }
114
110
  }
115
111
  };
116
112
  }
117
-
118
113
  //#endregion
119
- export { transformerAttributifyJsx as default };
114
+ export { transformerAttributifyJsx as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/transformer-attributify-jsx",
3
3
  "type": "module",
4
- "version": "66.6.6",
4
+ "version": "66.6.8",
5
5
  "description": "Support valueless attributify in JSX/TSX.",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -29,9 +29,9 @@
29
29
  "dist"
30
30
  ],
31
31
  "dependencies": {
32
- "oxc-parser": "^0.115.0",
32
+ "oxc-parser": "^0.124.0",
33
33
  "oxc-walker": "^0.7.0",
34
- "@unocss/core": "66.6.6"
34
+ "@unocss/core": "66.6.8"
35
35
  },
36
36
  "devDependencies": {
37
37
  "magic-string": "^0.30.21"