From a886888f0b10992ef6ffb76ff515683ed0067f4f Mon Sep 17 00:00:00 2001 From: brightzhli <864345220@qq.com> Date: Thu, 16 Jan 2025 11:11:28 +0800 Subject: [PATCH] =?UTF-8?q?fix(babel):=20=E4=BF=AE=E5=A4=8Dbabel=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0part=E6=8F=92=E4=BB=B6=E5=A4=B1=E6=95=88=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 4 ++-- plugins/babel-plugin-add-part-attribute.cjs | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 177aa8f..92cb6af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tdesign-web-components", - "version": "0.0.2", + "version": "0.0.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tdesign-web-components", - "version": "0.0.2", + "version": "0.0.4", "license": "MIT", "dependencies": { "@babel/runtime": "^7.24.7", diff --git a/plugins/babel-plugin-add-part-attribute.cjs b/plugins/babel-plugin-add-part-attribute.cjs index 990350e..ed2a1c7 100644 --- a/plugins/babel-plugin-add-part-attribute.cjs +++ b/plugins/babel-plugin-add-part-attribute.cjs @@ -20,7 +20,12 @@ module.exports = function ({ types: t }) { visitor: { CallExpression(path) { const { node } = path; - if (t.isIdentifier(node.callee, { name: 'h' })) { + const { callee } = node; + if ( + t.isMemberExpression(callee) && + t.isIdentifier(callee.object, { name: 'Component' }) && + t.isIdentifier(callee.property, { name: 'h' }) + ) { const [type, props] = node.arguments; // t-开头的标签忽略