Closed edwinhuish closed 8 months ago
The update entails enhancements in ESLint integration, Vue.js project page management, and development workflow optimizations. It introduces new features for defining and parsing pages, improves ESLint settings in VS Code, and streamlines interactions with Vue Single File Components (SFCs). Utility functions are introduced, and the playground showcases enhanced capabilities, emphasizing code quality and developer efficiency.
Files | Change Summary |
---|---|
.vscode/settings.json |
Enhanced ESLint integration and disabled default formatter. |
packages/core/client.d.ts , .../core/src/constant.ts , .../core/src/index.ts , .../core/src/types.ts |
Added definePage function, DEFINE_PAGE constant, and related types. |
packages/core/src/context.ts |
Refactored page handling logic, updated import/export statements, and improved page initialization methods. |
packages/core/src/page.ts |
Introduced Page class for managing options, parsing different file formats, and handling Vue SFC blocks. |
packages/core/src/utils.ts |
Streamlined utility functions and imports, added async parsing function for SFCs. |
packages/core/src/child-process.ts |
Added runProcess function for managing child processes with specified configurations. |
packages/playground/src/pages/... , .../macros/utils.ts |
Expanded playground with new Vue.js examples showcasing macros, async functions, and utility functions. |
packages/playground/src/uni-pages.d.ts |
Modified accessibility of navigation options declarations. |
"In the realm of code, where logic does play,
A rabbit hopped in, with changes to say.
🐾 With a leap and a bound, ESLint's embraced,
Pages and playgrounds, so swiftly retraced.
🌟 Amidst Vue and scripts, it danced with delight,
Crafting a world, where code shines so bright."
🐇💻
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@KeJunMao @Ares-Chang @zguolee @ModyQyW
Sorry,最近大家可能都比较忙,可能没有时间看,如果非必要请不要 @,感谢。
如果比较着急,可以看自己发个包用一下。
我看你的文件改动比较大,如果不冲突最好把重构和新功能分开 pr。
如果比较着急,可以看自己发个包用一下。
我最近没有用uniapp的需求。如果有其他人需要这个功能再考虑另发包。
我看你的文件改动比较大,如果不冲突最好把重构和新功能分开 pr。
改动的细分很难界定,曾经试过在其他库提几个文件的修改,因为代码样式、实现方式等,来来回回改近十个commit,拖了十多天才通过第一个PR,后续PR都一直等第一个PR合并才能继续。。。
另,正如我之前所说,我写这个PR,仅仅是为爱发电,如果你觉得改动太多,不好梳理,或者你们按照需求去拆分commit?对于commit的owner是否我,都没问题。
此 PR 暂关闭,分支在此仓库下,你们自行决定怎么处理吧?
个人感觉definePage比其他几种方式更优雅 希望早日能实现合并
@CrazyZhang3 https://github.com/uni-ku/define-page
支持
definePage
宏 related #134playground
下的示例import
使用注意:
import
仅支持从js
或ts
导入,不支持从vue
文件里导入import
导入暂不支持别名路径definePage
和页面script不在同一个作用域,无法使用页面变量。实现原理:
使用
@vue/compiler-sfc
和@babel/types
获取宏代码节点 https://github.com/uni-helper/vite-plugin-uni-pages/blob/218af7dba0d2011470c39987287381e2e010c04c/packages/core/src/page.ts#L86-L88使用
@babel/generator
还原为 JS code https://github.com/uni-helper/vite-plugin-uni-pages/blob/218af7dba0d2011470c39987287381e2e010c04c/packages/core/src/page.ts#L99-L101创建子进程,并调用
tsx
运行生成的 script,得到结果。 https://github.com/uni-helper/vite-plugin-uni-pages/blob/0d7e869f3303c7ef1c3ac523c48c2c1c8ee6871c/packages/core/src/page.ts#L201-L212Summary by CodeRabbit
New Features
definePage
function for more flexible page definitions.Refactor
Page
instances, improving the handling of page options.Bug Fixes
Chores
child-process.ts
file for running child processes, facilitating external command execution.Documentation