@meituan-nocode/vite-plugin-nocode-compiler 0.1.0-beta.4 → 0.1.0-beta.5
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.
|
@@ -8,7 +8,7 @@ const parser_1 = require("@babel/parser");
|
|
|
8
8
|
const magic_string_1 = __importDefault(require("magic-string"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const utils_1 = require("../utils/utils");
|
|
11
|
-
const
|
|
11
|
+
const estree_walker_1 = require("estree-walker");
|
|
12
12
|
/**
|
|
13
13
|
* JSX 编译器类
|
|
14
14
|
* 负责处理 JSX 文件的编译逻辑
|
|
@@ -45,7 +45,7 @@ class JSXCompiler {
|
|
|
45
45
|
let changedElementsCount = 0;
|
|
46
46
|
let currentElement = null;
|
|
47
47
|
let arrayContext = null;
|
|
48
|
-
|
|
48
|
+
(0, estree_walker_1.walk)(ast, {
|
|
49
49
|
enter: (node) => {
|
|
50
50
|
// 检测数组的 map 调用
|
|
51
51
|
if (node.type === 'CallExpression' && node.callee?.type === 'MemberExpression' && node.callee.property?.name === 'map') {
|
|
@@ -116,7 +116,7 @@ class JSXCompiler {
|
|
|
116
116
|
}
|
|
117
117
|
catch (error) {
|
|
118
118
|
this.logger.error('Error processing file:', relativePath);
|
|
119
|
-
this.logger.error(
|
|
119
|
+
this.logger.error(error);
|
|
120
120
|
return null;
|
|
121
121
|
}
|
|
122
122
|
}
|