Skip to content

Conversation

@ianzone
Copy link
Contributor

@ianzone ianzone commented Jul 1, 2025

这个 PR 做了什么? (简要描述所做更改)
删除 @tarojs/components 的 virtual-list 导出,解决循环依赖

这个 PR 是什么类型? (至少选择一个)

  • 错误修复 (Bugfix) issue: fix #
  • 新功能 (Feature)
  • 代码重构 (Refactor)
  • TypeScript 类型定义修改 (Types)
  • 文档修改 (Docs)
  • 代码风格更新 (Code style update)
  • 构建优化 (Chore)
  • 其他,请描述 (Other, please describe):

这个 PR 涉及以下平台:

  • 所有小程序
  • 微信小程序
  • 支付宝小程序
  • 百度小程序
  • 字节跳动小程序
  • QQ 轻应用
  • 京东小程序
  • 快应用平台(QuickApp)
  • Web 平台(H5)
  • 移动端(React-Native)
  • 鸿蒙(harmony)

Summary by CodeRabbit

  • 变更
    • 移除了 VirtualList 组件及相关类型声明,不再通过 @tarojs/components 提供 VirtualList 组件。
    • 优化了 VirtualList 组件的内部文档注释,提升注释一致性和可读性。
    • 调整了 VirtualList 组件的导入方式,改为从 @tarojs/components-advanced 包中引入。
    • 改进了代码中的注释格式和日志提示,提升代码可读性和维护性。
    • 修正了函数和变量命名,统一了大小写和拼写,增强代码规范性。
    • 优化了模板和 JSX 相关处理的注释及日志,提升调试体验。

@codecov
Copy link

codecov bot commented Jul 1, 2025

Codecov Report

Attention: Patch coverage is 91.83673% with 4 lines in your changes missing coverage. Please review.

Project coverage is 54.98%. Comparing base (3195665) to head (1617844).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/taroize/src/wxml.ts 90.00% 3 Missing ⚠️
packages/taroize/src/template.ts 88.88% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #17936   +/-   ##
=======================================
  Coverage   54.98%   54.98%           
=======================================
  Files         417      417           
  Lines       21693    21693           
  Branches     5352     5359    +7     
=======================================
  Hits        11928    11928           
- Misses       8245     8253    +8     
+ Partials     1520     1512    -8     
Flag Coverage Δ
taro-cli 72.42% <ø> (ø)
taro-runtime 59.87% <ø> (ø)
taro-web 53.19% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/taroize/src/script.ts 96.92% <100.00%> (ø)
packages/taroize/src/utils.ts 86.62% <ø> (ø)
packages/taroize/src/template.ts 88.70% <88.88%> (ø)
packages/taroize/src/wxml.ts 88.84% <90.00%> (ø)

... and 12 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai
Copy link

coderabbitai bot commented Jul 1, 2025

"""

Walkthrough

本次变更将 virtual-list 相关的入口文件(包括类型声明和实现)从 @tarojs/components 包中移除,同时在 package.json 中删除了对 virtual-list 的分发和对 @tarojs/components-advanced 的依赖。@tarojs/components-advancedvirtual-list 组件的注释格式进行了调整,示例代码中的导入路径更新,但未改动功能代码。taroize 相关脚本和模板处理逻辑进行了变量命名修正和格式优化,提升了代码可读性,未改变核心逻辑。

Changes

文件/路径 变更摘要
packages/taro-components/package.json 移除了 "virtual-list" 文件分发项和 @tarojs/components-advanced 依赖
packages/taro-components/virtual-list/index.d.ts
packages/taro-components/virtual-list/index.js
删除了 virtual-list 的类型声明和实现文件
packages/taro-components-advanced/src/components/virtual-list/index.ts 注释格式调整,示例代码导入路径更新,无功能改动
packages/taroize/src/script.ts
packages/taroize/src/wxml.ts
变量命名修正(如 vistorvisitorcreateWxmlVistorcreateWxmlVisitor)、格式优化,日志和注释改进
packages/taroize/src/utils.ts
packages/taroize/src/template.ts
packages/taroize/src/vue.ts
纯格式和注释优化,函数和变量命名修正,无功能改动
packages/taroize/tests/template.test.ts 测试断言中错误提示信息的冒号由半角改为全角

Suggested reviewers

  • yoyo837

Poem

🐇
虚拟列表悄然离,
组件精简更轻盈。
依赖删去风吹过,
包裹清新迎新春。
跳跃代码草丛里,
兔子欢歌又一程!

"""


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 14e37d0 and 1617844.

⛔ Files ignored due to path filters (1)
  • packages/taroize/__tests__/__snapshots__/wxml.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (2)
  • packages/taroize/src/template.ts (13 hunks)
  • packages/taroize/src/wxml.ts (38 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/taroize/src/template.ts
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: ianzone
PR: NervJS/taro#17746
File: packages/taro-runtime/tsdown.config.ts:10-16
Timestamp: 2025-05-25T18:02:31.387Z
Learning: 在 taro-runtime 包的 tsdown 配置中,必须禁用 treeshake 来保留 dom-external/index.js 文件。
packages/taroize/src/wxml.ts (4)
Learnt from: Single-Dancer
PR: NervJS/taro#17653
File: packages/taro-components-advanced/src/components/water-flow/node.ts:83-95
Timestamp: 2025-05-06T06:55:44.077Z
Learning: 在 Taro 的 getRectSizeSync 函数中,如果找不到指定的节点,函数会一直处于 pending 状态而不是抛出错误。在这种情况下,使用 try/catch 处理不够充分,需要添加超时处理如 Promise.race 来避免无限等待。
Learnt from: ianzone
PR: NervJS/taro#17746
File: packages/taro-runtime/tsdown.config.ts:10-16
Timestamp: 2025-05-25T18:02:31.387Z
Learning: 在 taro-runtime 包的 tsdown 配置中,必须禁用 treeshake 来保留 dom-external/index.js 文件。
Learnt from: Single-Dancer
PR: NervJS/taro#17653
File: packages/taro-components-advanced/src/components/water-flow/node.ts:83-95
Timestamp: 2025-05-06T06:55:44.077Z
Learning: 在 Taro 的 water-flow 组件中,getRectSizeSync 函数如果找不到指定的节点,会一直处于 pending 状态而不是抛出错误。在这种情况下,应该使用 Promise.race 添加超时机制,而不是仅依赖 try/catch 来处理错误。
Learnt from: Single-Dancer
PR: NervJS/taro#17653
File: packages/taro-components-advanced/src/components/water-flow/node.ts:83-95
Timestamp: 2025-05-06T06:55:44.077Z
Learning: 在 Taro 的 water-flow 组件中,getRectSizeSync 函数如果找不到指定的节点并且重试次数用尽,会一直处于 pending 状态而不是抛出错误,因为它在 retryTimes <= 0 时直接返回而不 resolve 或 reject Promise。应该使用 Promise.race 添加超时机制来解决这个问题。
🪛 Biome (1.9.4)
packages/taroize/src/wxml.ts

[error] 456-456: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-musl
  • GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
  • GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-gnu
  • GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
  • GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
  • GitHub Check: Build Rust WASM / stable - wasm32-wasi
🔇 Additional comments (13)
packages/taroize/src/wxml.ts (13)

90-91: 注释改进很好

注释格式化改进提升了代码可读性。


96-97: 注释改进很好

模板信息注释的格式化改进有助于理解代码功能。


133-134: 注释改进很好

样式属性转换的注释更加清晰明了。


140-144: 变量命名修正很好

matchs修正为matches提升了代码规范性,同时添加了null检查,这是一个很好的改进。


181-184: 注释改进很好

尺寸单位转换的注释更加详细和清晰。


198-202: 注释改进很好

模板变量处理的注释格式化改进有助于理解逻辑。


216-223: 错误消息格式化改进

错误和警告消息的格式化改进提升了输出的可读性。


230-238: 函数命名修正很好

createPreWxmlVistor修正为createPreWxmlVisitor修复了拼写错误,提升了代码规范性。


256-256: 变量命名改进

applies改为applyTemplates使变量名更加语义化,提升了代码可读性。


264-272: wxs导入相关注释改进

函数文档注释的格式化改进使参数说明更加清晰。


284-292: 函数命名修正很好

createWxmlVistor修正为createWxmlVisitor修复了拼写错误,与其他函数命名保持一致。


675-681: 变量命名一致性改进

templateBfs函数中将applies改为更具描述性的变量名,提升了代码可读性。


770-776: 解析流程注释改进

wxml页面解析流程的注释更加清晰,有助于理解预解析和正式解析的关系。

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ianzone ianzone mentioned this pull request Jul 1, 2025
1 task
"loader",
"mini",
"types",
"virtual-list",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有多处引用,文档,注释未改

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码库搜索到的virtual-list都是@tarojs/components-advanced导出的,文档中搜到的也是,除非是taro3的文档

@ianzone ianzone requested a review from yoyo837 July 1, 2025 14:44
@yoyo837
Copy link
Contributor

yoyo837 commented Jul 2, 2025

这样直接从 @tarojs/components 移除,得看看关键词 buildImportStatement 那里是不是可能会 breaking

@ianzone
Copy link
Contributor Author

ianzone commented Jul 2, 2025

这样直接从 @tarojs/components 移除,得看看关键词 buildImportStatement 那里是不是可能会 breaking

你是说它可能会生成 @tarojs/components/virtual-list 是吗?

@yoyo837
Copy link
Contributor

yoyo837 commented Jul 2, 2025

这样直接从 @tarojs/components 移除,得看看关键词 buildImportStatement 那里是不是可能会 breaking

你是说它可能会生成 @tarojs/components/virtual-list 是吗?

是的

@coderabbitai coderabbitai bot requested a review from yoyo837 July 2, 2025 04:00
@ianzone
Copy link
Contributor Author

ianzone commented Jul 2, 2025

这样直接从 @tarojs/components 移除,得看看关键词 buildImportStatement 那里是不是可能会 breaking

已添加处理逻辑

@coderabbitai coderabbitai bot requested a review from yoyo837 July 7, 2025 13:30
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/taroize/src/wxml.ts (1)

360-363: 避免在库代码中直接使用 console.log

这里用于输出编译警告,但运行时依然会打印到用户终端,污染日志:

console.log(`属性  ${nodeName}不能编译,会被替换为 wx:if`)

建议统一改为项目封装的日志函数 printLog 或移除,保持日志输出的一致性与可控性。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4e95523 and 14e37d0.

📒 Files selected for processing (2)
  • packages/taroize/src/script.ts (11 hunks)
  • packages/taroize/src/wxml.ts (35 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/taroize/src/script.ts
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: ianzone
PR: NervJS/taro#17746
File: packages/taro-runtime/tsdown.config.ts:10-16
Timestamp: 2025-05-25T18:02:31.387Z
Learning: 在 taro-runtime 包的 tsdown 配置中,必须禁用 treeshake 来保留 dom-external/index.js 文件。
packages/taroize/src/wxml.ts (4)
Learnt from: ianzone
PR: NervJS/taro#17746
File: packages/taro-runtime/tsdown.config.ts:10-16
Timestamp: 2025-05-25T18:02:31.387Z
Learning: 在 taro-runtime 包的 tsdown 配置中,必须禁用 treeshake 来保留 dom-external/index.js 文件。
Learnt from: Single-Dancer
PR: NervJS/taro#17653
File: packages/taro-components-advanced/src/components/water-flow/node.ts:83-95
Timestamp: 2025-05-06T06:55:44.077Z
Learning: 在 Taro 的 getRectSizeSync 函数中,如果找不到指定的节点,函数会一直处于 pending 状态而不是抛出错误。在这种情况下,使用 try/catch 处理不够充分,需要添加超时处理如 Promise.race 来避免无限等待。
Learnt from: Single-Dancer
PR: NervJS/taro#17653
File: packages/taro-components-advanced/src/components/water-flow/node.ts:83-95
Timestamp: 2025-05-06T06:55:44.077Z
Learning: 在 Taro 的 water-flow 组件中,getRectSizeSync 函数如果找不到指定的节点,会一直处于 pending 状态而不是抛出错误。在这种情况下,应该使用 Promise.race 添加超时机制,而不是仅依赖 try/catch 来处理错误。
Learnt from: Single-Dancer
PR: NervJS/taro#17653
File: packages/taro-components-advanced/src/components/water-flow/node.ts:83-95
Timestamp: 2025-05-06T06:55:44.077Z
Learning: 在 Taro 的 water-flow 组件中,getRectSizeSync 函数如果找不到指定的节点并且重试次数用尽,会一直处于 pending 状态而不是抛出错误,因为它在 retryTimes <= 0 时直接返回而不 resolve 或 reject Promise。应该使用 Promise.race 添加超时机制来解决这个问题。
🪛 Biome (1.9.4)
packages/taroize/src/wxml.ts

[error] 456-456: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
  • GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
  • GitHub Check: Build Rust WASM / stable - wasm32-wasi
  • GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-gnu
  • GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc

@yoyo837 yoyo837 merged commit c3ffb87 into NervJS:main Jul 8, 2025
24 checks passed
@ianzone ianzone deleted the circle branch July 8, 2025 09:18
This was referenced Jul 12, 2025
@coderabbitai coderabbitai bot mentioned this pull request Nov 24, 2025
27 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants