登录
注册
开源
企业版
高校版
搜索
帮助中心
使用条款
关于我们
开源
企业版
高校版
私有云
模力方舟
AI 队友
登录
注册
Gitee 2025 年度开源项目评选中
代码拉取完成,页面将自动刷新
开源项目
>
WEB应用开发
>
WebUI组件/框架
&&
捐赠
捐赠前请先登录
取消
前往登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
Watch
不关注
关注所有动态
仅关注版本发行动态
关注但不提醒动态
64
Star
724
Fork
116
GVP
openInula
/
inula
代码
Issues
24
Pull Requests
0
Wiki
统计
流水线
服务
质量分析
Jenkins for Gitee
腾讯云托管
腾讯云 Serverless
悬镜安全
阿里云 SAE
Codeblitz
SBOM
我知道了,不再自动展开
更新失败,请稍后重试!
移除标识
内容风险标识
本任务被
标识为内容中包含有代码安全 Bug 、隐私泄露等敏感信息,仓库外成员不可访问
[TS-CLI] Fix two bugs: setHTMLSpread function name error and single JSX element processing limitation
待确认
#ICZU6S
缺陷
SodaGreeny574
成员
创建于
2025-09-25 11:26
--- name: Fix two bugs about: setHTMLSpread function name error and single JSX element processing limitation --- **标题:** [TS-CLI] Fix two bugs: setHTMLSpread function name error and single JSX element processing limitation **问题描述:** 在使用 TS-CLI 进行一致性测试时发现了两个 bug: ### Bug 1: JSX 属性展开错误 - **文件**: `view-generator/src/utils/props.ts` 第244行 - **错误**: `setHTMLSpread` 函数使用了错误的函数名 `setHTMLAttrs` - **影响**: 导致包含 `{...rest}` 的 JSX 组件编译失败 ### Bug 2: 只处理第一个 JSX 元素 - **文件**: `scripts/ts_cli.mjs` 第25-36行 - **错误**: `findJSX` 函数只查找第一个 JSX 元素 - **影响**: 多组件文件只处理第一个组件 **复现步骤** ### Bug 1 复现 ```bash # 创建测试文件 echo 'function Card({ title, info, ...rest }) { return <div id="card" className={info?.cls} {...rest}>{title}</div>; }' > test_spread.jsx # 运行 TS-CLI node scripts/ts_cli.mjs test_spread.jsx ``` **期望结果**: 正常输出编译后的代码 **实际结果**: [TS-CLI] generate error: TypeError: Property name expected type of string but got undefined at setHTMLSpread (file:///path/to/view-generator/dist/index.js:176:51) ### Bug 2 复现 ```bash # 创建测试文件 echo 'const Label = ({ text }) => <span className="label">{text}</span>; function Panel({ title, onClose }) { return <div className="panel" onClick={onClose}><Label text={title} /></div>; }' > test_multi.jsx # 运行 TS-CLI node scripts/ts_cli.mjs test_multi.jsx ``` **期望结果**: 输出两个组件的编译代码 **实际结果**: 只输出第一个组件 `Label` 的代码 ## 修复建议 ### Bug 1 修复 在 `view-generator/src/utils/props.ts` 第244行: ```typescript // 当前代码(错误) return t.expressionStatement(t.callExpression(t.identifier(importMap.setHTMLAttrs), args)); // 修复后 return t.expressionStatement(t.callExpression(t.identifier(importMap.setHTMLProps), args)); ``` ### Bug 2 修复 修改 `scripts/ts_cli.mjs` 中的 `findJSX` 函数以处理所有 JSX 元素,或者修改 TS-CLI 以支持多组件处理。 ## 影响范围 这些 bug 影响了: 1. 包含 JSX 属性展开的组件编译 2. 多组件文件的一致性测试 3. 整体编译器的可靠性 ## 优先级 建议优先修复 Bug 1,因为它会导致编译完全失败。Bug 2 虽然影响功能完整性,但不会导致编译错误。 **标签:** [bug][compiler] **责任人:** [暂无]
--- name: Fix two bugs about: setHTMLSpread function name error and single JSX element processing limitation --- **标题:** [TS-CLI] Fix two bugs: setHTMLSpread function name error and single JSX element processing limitation **问题描述:** 在使用 TS-CLI 进行一致性测试时发现了两个 bug: ### Bug 1: JSX 属性展开错误 - **文件**: `view-generator/src/utils/props.ts` 第244行 - **错误**: `setHTMLSpread` 函数使用了错误的函数名 `setHTMLAttrs` - **影响**: 导致包含 `{...rest}` 的 JSX 组件编译失败 ### Bug 2: 只处理第一个 JSX 元素 - **文件**: `scripts/ts_cli.mjs` 第25-36行 - **错误**: `findJSX` 函数只查找第一个 JSX 元素 - **影响**: 多组件文件只处理第一个组件 **复现步骤** ### Bug 1 复现 ```bash # 创建测试文件 echo 'function Card({ title, info, ...rest }) { return <div id="card" className={info?.cls} {...rest}>{title}</div>; }' > test_spread.jsx # 运行 TS-CLI node scripts/ts_cli.mjs test_spread.jsx ``` **期望结果**: 正常输出编译后的代码 **实际结果**: [TS-CLI] generate error: TypeError: Property name expected type of string but got undefined at setHTMLSpread (file:///path/to/view-generator/dist/index.js:176:51) ### Bug 2 复现 ```bash # 创建测试文件 echo 'const Label = ({ text }) => <span className="label">{text}</span>; function Panel({ title, onClose }) { return <div className="panel" onClick={onClose}><Label text={title} /></div>; }' > test_multi.jsx # 运行 TS-CLI node scripts/ts_cli.mjs test_multi.jsx ``` **期望结果**: 输出两个组件的编译代码 **实际结果**: 只输出第一个组件 `Label` 的代码 ## 修复建议 ### Bug 1 修复 在 `view-generator/src/utils/props.ts` 第244行: ```typescript // 当前代码(错误) return t.expressionStatement(t.callExpression(t.identifier(importMap.setHTMLAttrs), args)); // 修复后 return t.expressionStatement(t.callExpression(t.identifier(importMap.setHTMLProps), args)); ``` ### Bug 2 修复 修改 `scripts/ts_cli.mjs` 中的 `findJSX` 函数以处理所有 JSX 元素,或者修改 TS-CLI 以支持多组件处理。 ## 影响范围 这些 bug 影响了: 1. 包含 JSX 属性展开的组件编译 2. 多组件文件的一致性测试 3. 整体编译器的可靠性 ## 优先级 建议优先修复 Bug 1,因为它会导致编译完全失败。Bug 2 虽然影响功能完整性,但不会导致编译错误。 **标签:** [bug][compiler] **责任人:** [暂无]
评论 (
0
)
登录
后才可以发表评论
状态
待确认
已完成
待确认
已确认
修复中
已修复
已验收
已拒绝
负责人
未设置
标签
未设置
项目
未立项任务
未立项任务
里程碑
未关联里程碑
未关联里程碑
Pull Requests
未关联
未关联
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
未关联
分支 (20)
标签 (10)
master
dev-tools
inula2-rust-compiler
kyzx-2025
openinula-migrator
vue-adapter
v2h-elselect-fix
v2h
修复代码分支
feat-website-next
dev
redux-compatibility-test
useSyncExternalStore
changeset-release/master
coderabbitai/utg/f8e6f08
bugfix-type
bugfix-dep
fix/release-new
reconciler
reactive
inula-request@1.1.9
inula-request@1.1.8
openinula@1.0.0
openinula@0.1.14
create-inula@1.0.22
inula-cli@1.0.45
inula-intl@1.0.34
inula-request@1.1.4
inula-router@1.0.16
openinula@0.1.13
开始日期   -   截止日期
-
置顶选项
不置顶
置顶等级:高
置顶等级:中
置顶等级:低
优先级
不指定
严重
主要
次要
不重要
预计工期
(小时)
参与者(1)
TypeScript
1
https://gitee.com/openInula/inula.git
git@gitee.com:openInula/inula.git
openInula
inula
inula
点此查找更多帮助
搜索帮助
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册