@unocss/transformer-attributify-jsx 66.4.1 → 66.5.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.
Files changed (2) hide show
  1. package/dist/index.mjs +18 -4
  2. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -1,8 +1,19 @@
1
- import process from 'node:process';
2
1
  import { parse } from '@babel/parser';
3
- import traverse from '@babel/traverse';
2
+ import _traverse from '@babel/traverse';
4
3
  import { toArray } from '@unocss/core';
5
4
 
5
+ function getEnvFlags() {
6
+ const isNode = typeof process !== "undefined" && process.stdout;
7
+ const isVSCode = isNode && !!process.env.VSCODE_CWD;
8
+ const isESLint = isNode && !!process.env.ESLINT;
9
+ return {
10
+ isNode,
11
+ isVSCode,
12
+ isESLint
13
+ };
14
+ }
15
+
16
+ const traverse = _traverse.default || _traverse;
6
17
  function createFilter(include, exclude) {
7
18
  const includePattern = toArray(include || []);
8
19
  const excludePattern = toArray(exclude || []);
@@ -36,8 +47,11 @@ function transformerAttributifyJsx(options = {}) {
36
47
  enforce: "pre",
37
48
  idFilter,
38
49
  async transform(code, _, { uno }) {
39
- if (process.env.VSCODE_CWD)
40
- return;
50
+ try {
51
+ if (getEnvFlags().isVSCode)
52
+ return;
53
+ } catch {
54
+ }
41
55
  const tasks = [];
42
56
  const ast = parse(code.toString(), {
43
57
  sourceType: "module",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/transformer-attributify-jsx",
3
3
  "type": "module",
4
- "version": "66.4.1",
4
+ "version": "66.5.0",
5
5
  "description": "Support valueless attributify in JSX/TSX.",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -33,12 +33,12 @@
33
33
  "dist"
34
34
  ],
35
35
  "dependencies": {
36
- "@babel/parser": "^7.28.0",
37
- "@babel/traverse": "^7.28.0",
38
- "@unocss/core": "66.4.1"
36
+ "@babel/parser": "7.27.7",
37
+ "@babel/traverse": "7.27.7",
38
+ "@unocss/core": "66.5.0"
39
39
  },
40
40
  "devDependencies": {
41
- "magic-string": "^0.30.17"
41
+ "magic-string": "^0.30.18"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "unbuild",