Commit Graph

33 Commits

Author SHA1 Message Date
“chenhuachun”
b0b5cd6b66 fix(composer): 修复 dataSources 解析时的符号转换问题
- parseDataSources 函数新增 symbols 参数以支持表达式转换
- 在 mockTemplate 和 transform 中根据 symbols 调用 transformExpression
- composition/index.ts 中调用 parseDataSources 时传入 symbols 参数
- 添加 parseDataSources 相关单元测试,验证表达式转换行为
- lifeCycles.vue 中修复条件判断结果,避免多余的 'setup' 添加
2026-06-15 22:32:55 +08:00
“chenhuachun”
0bccf7195c feat(parser): 支持模板中 ref 和 computed 的 .value 自动解包
- 在 Composition 模式模板解析中,深度克隆并转换节点时
- 替换全局 API this.$xxx 为 xxx 的引用方式
- 增加对 ref 和 computed 对象的 .value 后缀自动去除处理
- 修改 parseTemplateComposition 调用,传入 refs 和 computed 集合
- 添加单元测试,验证模板中 ref.value 自动展开为 ref 名称
- 确保生成代码中模板正确绑定解包后的 ref,不含多余 .value
2026-06-14 12:12:28 +08:00
“chenhuachun”
51a8278360 feat(parser): 支持 Uniapp 专用生命周期钩子的导入和使用
- 在 imports 结构中新增 uniHookImports,用于存储 Uniapp 钩子
- 修改解析逻辑,识别并收集 Uniapp 生命周期钩子
- 在生成 import 代码时,为 uniapp 平台添加 @dcloudio/uni-app 的导入
- lifeCycles 模块中新增 usedUniHooks 集合,区分 Vue 与 Uniapp 钩子
- 单元测试中调整相关测试模板,确保组件声明字段存在,增加兼容性验证
2026-06-12 23:52:23 +08:00
“chenhuachun”
4a2d49da0f test(composition): 统一测试代码中所有vue composables的变量命名
- 将useAttrs返回值变量名由attrs改为__attrs
- 将useRouter和useRoute返回值变量名前加__前缀
- 将useStore调用返回值变量名添加__前缀
- 统一变量命名风格,避免命名冲突
- 修改相应测试内容中的变量名匹配
- 使测试代码与编码规范保持一致
2026-06-12 16:16:00 +08:00
“chenhuachun”
def14e80c5 refactor(composition): 将 provider 改为 __provider 以避免命名冲突
- 把模板和代码中的 provider 变量重命名为 __provider
- 更新相关的全局 API 替换配置,将 replace 从 provider 改为 __provider
- 修改方法中对 provider.createMock 和 provider.apis 的调用为 __provider
- 调整测试用例以匹配新的 __provider 名称
- Vue 组件中根据 composition 模式调整 exposeOptions 的状态键名
- 更新代码中检测数据源方法相关的 provider 调用判断为 __provider
2026-06-12 15:06:35 +08:00
“chenhuachun”
d266472d2d refactor(composition): 将 state 重命名为 __state 以避免命名冲突
- 在全局 API 映射中新增 __state 配置
- 将 reactive 声明中的 state 重命名为 __state
- 更新符号表中的 reactives 集合,替换 state 为 __state
- 变换器中将 name 为 state 的标识转换为 __state
- 单元测试中替换所有 state 为 __state
- scriptSetup 解析中区分 __state 并正确处理
- 反向转换中将 __state 映射回 this.state
- 修正相关测试用例,确保 __state 正确替代 state
2026-06-12 14:31:54 +08:00
“chenhuachun”
7cbfd74669 refactor(parser): 支持解析 JSExpression 类型的计算属性和函数映射
- 扩展 parseFunctionMap 函数,接受 JSFunction 或 JSExpression 类型的映射
- 更新 parseComputed 函数以支持 JSFunction 和 JSExpression 混合的计算属性
- 修改相关类型导入,包含 JSExpression 类型声明
- 删除测试中无效的 $notify 相关断言及测试数据以保持一致性
2026-06-12 11:14:45 +08:00
“chenhuachun”
0af3bacea3 feat(coder): 支持多 UI 库全局 API 映射与识别
- 新增独立 UI 库全局 API 映射表,支持 element-plus 和 ant-design-vue
- 通过 componentMap 自动探测当前激活的 UI 库并构建有效 API 映射
- 全局 API 检测、声明生成、导入收集等流程支持传入有效 API 映射
- 使符号表构建和模板转换等环节使用动态的有效 API 映射
- 相关单元测试新增 ant-design-vue 兼容用例,覆盖多库场景
- 修正了全局 API 处理相关代码,提升 API 可扩展性和维护性
2026-06-12 00:04:44 +08:00
“chenhuachun”
4fdf1c52b1 feat(coder): 扩展 element-plus 全局 API 支持
- 添加 $message、$notify、$messageBox、$msgbox、$confirm 和 $prompt 等新全局 API
- 更新替换规则,支持调用对应的 ElMessage、ElNotification 和 ElMessageBox 方法
- 增加测试用例验证新全局 API 的导入和调用
- 确保 element-plus 只进行一次统一导入,避免重复引用
- 丰富示例代码,演示新全局 API 的使用方法
2026-06-11 23:44:50 +08:00
“chenhuachun”
0f691a4966 feat(coder): 支持 element-plus $loading 组合式API
- 新增对 element-plus 中 ElLoading.service 的支持
- 配置中添加 $loading 变量映射,免声明变量直接使用命名空间访问
- 更新相关测试确保 element-plus 的引入和使用正确
- 在测试 DSL 中新增 showLoading 函数调用 $loading 示例代码验证功能正常
2026-06-11 23:27:26 +08:00
“chenhuachun”
ea306c4cd8 feat(coder): 合并 renderer 包导入并扩展全局组合式 API 支持
- 修改模板以支持 renderer 包中多个导入标识符合并为单条 import 语句
- 在全局组合式 API 中添加多个以 __renderer__ 标记的特殊 API 配置
- 解析时合并 __renderer__ 对应的 API 导入标识符与 useProvider
- 更新返回结果中 rendererImports 字段,包含所有合并后的导入
- 增加测试验证导入合并、声明唯一性及相关使用代码正确性
- 在 renderer 包 provider 模块新增 useApis 组合式 API 函数
2026-06-11 22:53:12 +08:00
“chenhuachun”
0e3694c8e5 feat(parser): 支持 vue-router 和 vue-i18n 全局 API 转换
- 扩展 GLOBAL_API_MAP,新增 vue-router 和 vue-i18n 相关全局 API 映射
- 将 GlobalApiConfig 新增 from 字段,标明 composable 来源包
- 更新 collectGlobalApiImports,按来源包分组收集 import 标识符
- composition parser 中集成全局 API 新的导入收集逻辑
- 解析结果的 imports 增加 globalApiImports 字段支持
- 新增测试用例,覆盖 vue-router、vue-i18n API 转换和声明生成
- 确保 useI18n 声明唯一性,防止重复声明问题
2026-06-11 18:21:59 +08:00
“chenhuachun”
b7cd31b3d6 refactor(composition): 优化全局 API 处理与模板生成逻辑
- 修改模板逻辑,支持在无 props 或 emits 时生成空的 defineProps 和 defineEmits
- 重构全局 API 映射表,剔除 vue-router 和 i18n 相关内容,新增 $props 和多个实例属性映射
- 移除对 $t 和 $i18n 的特殊合并声明逻辑
- 精简全局 API 导入收集,只收集需要的 Vue Composition API 名称列表
- 更新解析流程,改用新的全局 API 导入收集方法,提升导入管理一致性
- 增加对 $props 和 $emit 在模板中的自动生成标记 needsProps 和 needsEmit
- 修改组合式 API 测试用例,增加对新增全局 API 及 getCurrentInstance 声明唯一性的验证
- 修正部分界面文本,将“状态数据名称”和“状态初始值”改为更简洁的“名称”和“初始值”
2026-06-11 17:48:39 +08:00
“chenhuachun”
54cf9081f3 feat(composition): 支持 $provider 作为全局 API 并优化引用处理
- 新增 $provider 配置,使用 inject 从 vue 中注入 provider
- 调整全局声明生成逻辑,跳过 $provider 声明,避免重复声明
- 扩展 compositionPatch 测试,新增对 provider 引用替换的验证
- 在 Vue 相关映射中添加 provider 映射为 $provider
- 修改 provider.ts,避免将 $provider 赋值到全局以防覆盖
- 增加测试用例,确保代码正确处理 provider 相关逻辑
2026-06-11 00:31:14 +08:00
“chenhuachun”
2d36513e0e test: add unit tests for Collecter and code generation utilities 2026-06-10 16:38:52 +08:00
“chenhuachun”
ed44834975 feat(coder): 支持 Composition API 模式出码
- 新增 parser/composition 目录,包含组合式 API 解析相关模块
- 支持基于 DSL 的 Composition API 风格代码生成和模板编译
- 实现全局 API ($router、$route 等) 转换与导入声明
- 支持 composables、refs、reactives、computed、methods、watch 等解析
- 新增模板脚本 <script setup> 支持,改进模板编译逻辑
- 完善生命周期钩子映射及 setup、created 等语句处理
- 优化 imports 引入处理,支持平台差异化导入规则
- 针对 Composition 模式全链路代码生成提供完整支持
2026-06-10 16:29:18 +08:00
“chenhuachun”
afb9bd1142 fix: 🐛 优化代码生成 2026-04-28 15:06:30 +08:00
“chenhuachun”
ff495c5ed4 fix: 🐛 uniapp 支持 @tap 事件 2026-04-23 22:51:28 +08:00
“chenhuachun”
268aeb952a fix: 🐛 当script有嵌套双引号,出码报错; 模版节点只有事件,没有句柄时,出码报错,如 只绑定@click.stop 2026-03-16 18:04:02 +08:00
“chenhuachun”
42b5b59b4d fix: 🐛 出码模版代码双引号替换为单引号 2026-02-27 14:52:43 +08:00
“chenhuachun”
57696df875 fix: 🐛 修复出码属性默认值和$开头的成员表达式匹配问题 2025-08-27 10:54:04 +08:00
“chenhuachun”
2ecfc5a82e fix: 🐛 coder parseWatch 2025-08-08 12:43:15 +08:00
“chenhuachun”
ca896df051 fix: 🐛 出码插槽支持scope名称 2025-07-21 14:36:27 +08:00
“chenhuachun”
bec5a28bf8 fix: 🐛 coder 双引号问题 2025-07-19 14:33:45 +08:00
“chenhuachun”
a610c53c59 fix: 🐛 icons import miss 2025-05-06 21:17:32 +08:00
“chenhuachun”
3b8849388d fix: 🐛 uniapp coder 2025-04-27 14:52:49 +08:00
“chenhuachun”
960bc99553 fix: 🐛 uniapp coder 2025-02-19 11:06:55 +08:00
“chenhuachun”
5e961d2154 feat: uniapp coder 2025-02-17 17:30:16 +08:00
陈华春
a33d595063 fix: 🐛 计算属性出码在表达式中错误 2024-08-09 08:32:29 +08:00
陈华春
2fe1524a91 内置组件增加 html 和 路由相关元素 2024-01-31 15:02:58 +08:00
陈华春
a5ff52b714 fix: 绑定事件简写箭头函数出码报错 2024-01-30 16:38:02 +08:00
陈华春
3e4a836646 fix:源码生成引用 $libs.VtjUtils 没有被替换前缀 2024-01-24 21:30:24 +08:00
陈华春
d170d22b73 优化工程 2024-01-15 10:06:47 +08:00