Skip to content

chore: drop node 18 and pnpm 9, support node 22 and pnpm 10 #17582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

ianzone
Copy link
Contributor

@ianzone ianzone commented Apr 20, 2025

这个 PR 做了什么? (简要描述所做更改)

  1. node 18 的维护4月底到期,此次变更将 node 18 替换成了 node 22
  2. rollup-plugin-ts 替换为 @rollup/plugin-typescript 以支持 node 22
  3. 使用 pnpm 10 重新生成 pnpm-lock.yaml
  4. 修复了一些类型错误

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

  • 错误修复(Bugfix) issue: fix #
  • 新功能(Feature)
  • 代码重构(Refactor)
  • TypeScript 类型定义修改(Typings)
  • 文档修改(Docs)
  • 代码风格更新(Code style update)
  • 其他,请描述(Other, please describe): drop node 18 and pnpm 9, support node 22 and pnpm 10

这个 PR 涉及以下平台:

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

Summary by CodeRabbit

  • 新功能

    • Harmony 平台组件定义新增了 list 及 list-item 组件,扩展了组件支持。
  • 文档

    • 更新了 Node.js 和 pnpm 的最低版本要求至 Node.js 22 和 pnpm 10。
    • 修正了部分文档格式和描述错误。
  • 构建/工具链

    • 持续集成环境的 Node.js 版本升级至 22,pnpm 升级至 10,相关依赖和配置同步更新。
    • 多个包的 Node.js 运行时最低要求从 18 升级到 20。
    • 构建工具由 rollup-plugin-ts 替换为官方 @rollup/plugin-typescript,并优化了类型声明文件的生成与配置。
    • 新增 taro-router 的 Rollup 配置文件,完善构建输出格式。
  • 修复

    • 修正了部分描述拼写错误和工作流命名错误。
    • 优化了代码中的可选链和类型安全处理,提升了健壮性。

Copy link

coderabbitai bot commented Apr 20, 2025

Walkthrough

本次变更主要集中在将 Node.js 的最低要求版本从 18 升级到 20,并将 pnpm 升级到 10,涉及所有相关的 package.json、CI 工作流和文档说明。此外,构建系统(如 Rollup 配置)从第三方 TypeScript 插件切换为官方插件,部分包的 TypeScript 配置也做了相应调整。Harmony 平台组件定义新增了 list 和 list-item 相关声明。部分构建脚本和测试命令进行了小幅优化,整体未涉及核心业务逻辑变更。

Changes

文件/路径分组 变更摘要
.github/workflows/build-rust-binding.yml
.github/workflows/nodejs.yml
.github/workflows/publish.yml
.github/workflows/sync-components-types.yml
CI 工作流升级 Node.js 版本至 22.x,pnpm 升级至 10,pnpm/action-setup 升级为 v4,部分参数调整及 job 名称修正,去除 codecov 的 move_coverage_to_trash 参数。
CONTRIBUTING.md Node.js 最低版本要求由 16(推荐 16.20.0+)提升至 22(推荐 22.14.0+),pnpm 由 7 升级至 10,修正标题格式。
npm//package.json
packages/
/package.json(绝大多数包)
所有包的 Node.js engines 字段由 ">= 18" 升级为 ">= 20"。
packages/taro-router/package.json typings 字段更名为 types,路径由 dist/index.esm.d.ts 改为 dist/index.d.ts;Node.js 要求提升。
packages/taro-h5/package.json build/test 脚本调整,依赖顺序微调,devDependencies 替换 rollup-plugin-ts 为 @rollup/plugin-typescript 并新增 rollup-plugin-dts。
packages/taro-h5/rollup.config.ts 构建插件由 rollup-plugin-ts 替换为 @rollup/plugin-typescript,增加 rollup-plugin-dts,优化声明文件生成流程。
packages/taro-h5/tsconfig.json 启用 sourceMap,include 文件由 rollup.config.mts 改为 rollup.config.ts。
packages/taro-helper/tsconfig.json
packages/taro-cli/tsconfig.json
compilerOptions 增加 paths 映射,显式指定 @babel/types 路径。
packages/taro-platform-harmony-hybrid/build/config/harmony-definition.json 新增 list 组件(含 upper-threshold-count 和 lower-threshold-count 属性)及 list-item 组件声明。
packages/taro-platform-harmony-hybrid/package.json
packages/taro-platform-harmony/package.json
packages/taro-runtime/package.json
devDependencies 替换 rollup-plugin-ts 为 @rollup/plugin-typescript。
packages/taro-platform-harmony-hybrid/rollup.config.ts
packages/taro-platform-harmony/rollup.config.ts
packages/taro-runtime/rollup.config.ts
构建插件由 rollup-plugin-ts 替换为 @rollup/plugin-typescript,路径引用简化,tsconfig 配置优化。
packages/taro-platform-harmony-hybrid/tsconfig.json compilerOptions 增加 declaration: true 和 outDir: dist。
packages/taro-router/rollup.config-1745118866046.mjs 新增 Rollup 构建配置文件,支持多种输出格式与类型声明生成。
packages/taro-rn/src/lib/index.ts export 语句顺序微调,不影响导出内容。
packages/taro-transformer-wx/package.json description 字段修正拼写错误,Node.js 要求提升。
packages/taro-transformer-wx/src/render.ts RenderParser.handleJSXInIfStatement 方法 renderScope 类型由 Scope 变为 Scope
packages/taro-cli/src/create/project.ts Node.js 最低版本校验由 18 升级至 20,调整提示信息中的标点符号和空格,提升文本一致性。
packages/taro-h5/rollup.config.ts
packages/taro-platform-harmony-hybrid/rollup.config.ts
packages/taro-platform-harmony/rollup.config.ts
packages/taro-runtime/rollup.config.ts
移除 rollup-plugin-ts,改用官方 @rollup/plugin-typescript,简化配置及路径引用。
examples//package.json
package.json
packages/taro-cli/templates/
/package.json.tmpl
@types/node 版本由 ^18 升级至 ^20,提升类型定义版本。

Sequence Diagram(s)

sequenceDiagram
    participant CI as GitHub Actions
    participant Node as Node.js
    participant pnpm as pnpm
    participant Build as 构建脚本

    CI->>Node: 安装 Node.js 22
    CI->>pnpm: 安装 pnpm 10
    CI->>Build: 运行构建/测试/发布流程
    Build-->>CI: 输出构建产物/测试结果
Loading

Suggested reviewers

  • tutuxxx

Poem

(=^・ω・^=)

升级 Node 二十,pnpm 十来临,
构建脚本焕新颜,CI 跑得更安心。
TypeScript 插件换官方,声明文件自动生,
Harmony 新增 list 组件,
小兔子欢呼跳跃在春风里!

🐇✨

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 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 2b792c6 and 111fba1.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (70)
  • examples/blended-taro-component-vue3/taro-project/package.json (1 hunks)
  • examples/mini-program-example/package.json (2 hunks)
  • examples/swiper-effect/package.json (1 hunks)
  • examples/taro-list/package.json (1 hunks)
  • npm/darwin-arm64/package.json (1 hunks)
  • npm/darwin-x64/package.json (1 hunks)
  • npm/linux-x64-gnu/package.json (1 hunks)
  • npm/linux-x64-musl/package.json (1 hunks)
  • npm/win32-x64-msvc/package.json (1 hunks)
  • package.json (1 hunks)
  • packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json (1 hunks)
  • packages/babel-plugin-transform-taroapi/package.json (1 hunks)
  • packages/babel-preset-taro/package.json (1 hunks)
  • packages/create-app/package.json (1 hunks)
  • packages/css-to-react-native/package.json (1 hunks)
  • packages/eslint-config-taro/package.json (1 hunks)
  • packages/jest-helper/package.json (1 hunks)
  • packages/postcss-html-transform/package.json (1 hunks)
  • packages/postcss-plugin-constparse/package.json (1 hunks)
  • packages/postcss-pxtransform/package.json (1 hunks)
  • packages/rollup-plugin-copy/package.json (1 hunks)
  • packages/shared/package.json (1 hunks)
  • packages/stylelint-config-taro-rn/package.json (1 hunks)
  • packages/stylelint-taro-rn/package.json (1 hunks)
  • packages/stylelint-taro/package.json (1 hunks)
  • packages/taro-api/package.json (1 hunks)
  • packages/taro-cli-convertor/package.json (1 hunks)
  • packages/taro-cli/package.json (1 hunks)
  • packages/taro-cli/src/create/project.ts (5 hunks)
  • packages/taro-cli/templates/default/package.json.tmpl (1 hunks)
  • packages/taro-cli/templates/plugin-compile/package.json.tmpl (1 hunks)
  • packages/taro-components-library-react/package.json (1 hunks)
  • packages/taro-components-library-vue3/package.json (1 hunks)
  • packages/taro-components-rn/package.json (1 hunks)
  • packages/taro-components/package.json (1 hunks)
  • packages/taro-extend/package.json (1 hunks)
  • packages/taro-framework-react/package.json (1 hunks)
  • packages/taro-framework-vue3/package.json (1 hunks)
  • packages/taro-helper/package.json (1 hunks)
  • packages/taro-loader/package.json (1 hunks)
  • packages/taro-platform-alipay/package.json (1 hunks)
  • packages/taro-platform-jd/package.json (1 hunks)
  • packages/taro-platform-qq/package.json (1 hunks)
  • packages/taro-platform-swan/package.json (1 hunks)
  • packages/taro-platform-tt/package.json (1 hunks)
  • packages/taro-platform-weapp/package.json (1 hunks)
  • packages/taro-plugin-html/package.json (1 hunks)
  • packages/taro-plugin-http/package.json (1 hunks)
  • packages/taro-plugin-inject/package.json (1 hunks)
  • packages/taro-plugin-mini-ci/package.json (1 hunks)
  • packages/taro-plugin-react-devtools/package.json (1 hunks)
  • packages/taro-plugin-vue-devtools/package.json (1 hunks)
  • packages/taro-react/package.json (1 hunks)
  • packages/taro-rn-runner/package.json (1 hunks)
  • packages/taro-rn-style-transformer/package.json (1 hunks)
  • packages/taro-rn-supporter/package.json (1 hunks)
  • packages/taro-rn-transformer/package.json (1 hunks)
  • packages/taro-rn/package.json (1 hunks)
  • packages/taro-router-rn/package.json (1 hunks)
  • packages/taro-router/package.json (2 hunks)
  • packages/taro-runner-utils/package.json (1 hunks)
  • packages/taro-runtime-rn/package.json (1 hunks)
  • packages/taro-runtime/package.json (3 hunks)
  • packages/taro-service/package.json (1 hunks)
  • packages/taro-transformer-wx/package.json (2 hunks)
  • packages/taro-webpack5-prebundle/package.json (1 hunks)
  • packages/taro-webpack5-runner/package.json (1 hunks)
  • packages/taro-with-weapp/package.json (1 hunks)
  • packages/taro/package.json (1 hunks)
  • packages/taroize/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (30)
  • packages/babel-preset-taro/package.json
  • examples/blended-taro-component-vue3/taro-project/package.json
  • package.json
  • packages/babel-plugin-transform-taroapi/package.json
  • packages/taro-loader/package.json
  • packages/taro-plugin-vue-devtools/package.json
  • examples/swiper-effect/package.json
  • packages/taro-react/package.json
  • packages/taro-plugin-mini-ci/package.json
  • packages/taro-plugin-html/package.json
  • packages/taro-cli-convertor/package.json
  • packages/taro-cli/templates/default/package.json.tmpl
  • packages/taro-runner-utils/package.json
  • npm/win32-x64-msvc/package.json
  • packages/stylelint-taro/package.json
  • packages/postcss-pxtransform/package.json
  • packages/taro-cli/templates/plugin-compile/package.json.tmpl
  • examples/taro-list/package.json
  • packages/taro-framework-vue3/package.json
  • packages/taro-transformer-wx/package.json
  • packages/taro/package.json
  • packages/rollup-plugin-copy/package.json
  • packages/taro-platform-jd/package.json
  • packages/taro-rn-supporter/package.json
  • packages/taro-cli/package.json
  • packages/taro-helper/package.json
  • packages/taro-cli/src/create/project.ts
  • npm/linux-x64-musl/package.json
  • packages/shared/package.json
  • examples/mini-program-example/package.json
🚧 Files skipped from review as they are similar to previous changes (40)
  • packages/taro-service/package.json
  • packages/stylelint-taro-rn/package.json
  • packages/taro-platform-swan/package.json
  • packages/taro-plugin-http/package.json
  • packages/taro-rn-style-transformer/package.json
  • packages/taro-rn-transformer/package.json
  • packages/taro-platform-tt/package.json
  • packages/taro-components-library-vue3/package.json
  • packages/taro-api/package.json
  • packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json
  • packages/taro-components/package.json
  • packages/taro-components-library-react/package.json
  • packages/taro-webpack5-prebundle/package.json
  • packages/eslint-config-taro/package.json
  • packages/postcss-html-transform/package.json
  • packages/taro-plugin-inject/package.json
  • packages/taro-rn-runner/package.json
  • packages/css-to-react-native/package.json
  • packages/taro-plugin-react-devtools/package.json
  • packages/taro-router-rn/package.json
  • packages/taro-rn/package.json
  • packages/taro-framework-react/package.json
  • npm/darwin-arm64/package.json
  • packages/taro-with-weapp/package.json
  • packages/stylelint-config-taro-rn/package.json
  • packages/taro-runtime-rn/package.json
  • packages/taro-components-rn/package.json
  • packages/taro-platform-qq/package.json
  • packages/taro-platform-weapp/package.json
  • npm/linux-x64-gnu/package.json
  • npm/darwin-x64/package.json
  • packages/taroize/package.json
  • packages/taro-extend/package.json
  • packages/taro-runtime/package.json
  • packages/postcss-plugin-constparse/package.json
  • packages/taro-webpack5-runner/package.json
  • packages/create-app/package.json
  • packages/taro-platform-alipay/package.json
  • packages/taro-router/package.json
  • packages/jest-helper/package.json
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
  • GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin

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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

@coderabbitai coderabbitai bot requested a review from tutuxxx April 20, 2025 05:21
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: 6

♻️ Duplicate comments (8)
packages/postcss-plugin-constparse/package.json (1)

8-10: 更新 Node.js 引擎版本到 >= 20
此处仅为引擎元数据变更,已将 engines.node 升级至 >= 20,请确保文档和 CI 同步。

packages/taro-plugin-react-devtools/package.json (1)

29-31: 更新 Node.js 引擎版本到 >= 20
此变更同步升级了 engines.node>= 20,符合仓库整体版本策略。

packages/taro-rn-runner/package.json (1)

30-32: 更新 Node.js 引擎版本到 >= 20
已将 engines.node>= 18 提升至 >= 20,请确认文档和 CI 已覆盖所有相关位置。

packages/taro-cli-convertor/package.json (1)

37-39: 更新 Node.js 引擎版本到 >= 20
engines.node 升级为 >= 20,请检查 CONTRIBUTING.md、文档及 CI 脚本中的版本要求是否一致。

packages/taro-webpack5-runner/package.json (1)

33-33: 与 packages/taro-rn 同步:确认 Node.js 引擎版本
此处同样更新为 >=20,请复核是否符合「支持 Node.js 22」的目标,必要时调整为 >=22

packages/stylelint-config-taro-rn/package.json (1)

26-26: 与 packages/taro-rn 同步:确认 Node.js 引擎版本
engines.node 已提升至 >=20,请确认是否需改为 >=22 以满足 PR 中声明的 Node.js 22 支持。

packages/babel-preset-taro/package.json (1)

27-27: 与 packages/taro-rn 同步:确认 Node.js 引擎版本
该包也将 engines.node 设置为 >=20,请核实是否应统一提高到 >=22

packages/taro-loader/package.json (1)

29-29: 与 packages/taro-rn 同步:确认 Node.js 引擎版本
此处同样为 >=20,建议检查是否需要使用 >=22 以真正支持目标版本。

🧹 Nitpick comments (12)
packages/taro-extend/package.json (1)

23-25: 建议:补充 pnpm 引擎版本声明

既然此 PR 还升级了 pnpm 至 v10,可考虑在 engines 中添加 "pnpm": ">=10",以显式声明项目对 pnpm 版本的要求。

packages/taro-rn-supporter/package.json (1)

28-30: 建议在 engines 字段中指定 pnpm 版本
本次 PR 同时升级了 pnpm 到 10,建议在 engines 中加入 "pnpm": ">= 10",以便 CI 和开发者明确定义 pnpm 版本要求。

packages/taro-rn/src/lib/index.ts (1)

18-18: 提醒:该文件为自动生成,请勿手动修改

此文件由 getLibList.js 脚本生成,手动修改会在下一次生成时被覆盖。如需调整导出顺序,请在 getLibList.js 中进行修改。

packages/taro-transformer-wx/package.json (1)

4-4: 拼写修复生效 & 建议品牌名称统一

描述字段中的 “Transfrom” 已正确修复为 “Transform”。另外,建议将 “Wechat” 统一改为官方大小写 “WeChat” 以保持一致性。

packages/taro-with-weapp/package.json (1)

33-33: Node.js 引擎版本限制更新正确
已将最低 Node.js 版本从 >=18 提升到 >=20,与项目中其他包的版本策略保持一致,成功移除了对 Node 18 的支持。
建议(可选):在 engines 字段中追加 pnpm: ">=10",以显式声明对 pnpm 版本的依赖。

packages/shared/package.json (1)

33-33: Node.js 引擎版本限制更新正确
已将最低 Node.js 版本从 >=18 提升到 >=20,与整体版本策略保持一致,移除了对 Node 18 的支持。
建议(可选):在 engines 中添加 pnpm: ">=10",以明确项目对 pnpm 10 的支持需求。

packages/postcss-pxtransform/package.json (1)

34-34: Node.js 引擎版本限制更新正确
已将最低 Node.js 版本从 >=18 提升到 >=20,与其他包同步。此更改纯元数据更新,不影响功能。
建议(可选):同样可在 engines 中声明 pnpm: ">=10",以便团队一目了然地了解 pnpm 版本要求。

packages/taro-plugin-html/package.json (1)

29-29: Node.js 引擎版本限制更新正确
已将最低 Node.js 版本从 >=18 升级至 >=20,统一了项目内各插件的运行环境要求。
建议(可选):在 engines 内同级添加 pnpm: ">=10",以强制指定开发和 CI 使用 pnpm 10 及以上版本。

packages/taro-plugin-http/package.json (1)

33-33: Node.js 引擎版本限制更新正确
已将最低 Node.js 版本要求从 >=18 调整为 >=20,与仓库中其他包保持一致,成功移除对 Node 18 的依赖。
建议(可选):在 engines 字段中加入 pnpm: ">=10",以便明确 pnpm 版本兼容性。

CONTRIBUTING.md (1)

212-212: 清理多余的格式符号
#### 似乎是多余的格式标记,可能影响文档可读性,建议删除或调整为正确的标题语法。

packages/taro-router/rollup.config-1745118866046.mjs (2)

7-28: 配置存在代码风格问题

基础配置的逻辑合理,包括输入文件、输出选项和插件配置,但存在缩进不一致问题。根据静态分析工具提示,整个文件的缩进风格与项目规范不符。

建议统一使用 2 空格缩进,符合项目其他文件的风格:

-const baseConfig = {
-    input: 'src/index.ts',
-    output: {
-        sourcemap: true,
-        exports: 'named'
-    },
-    plugins: [
-        externals({
-            deps: true,
-            devDeps: false,
-            include: [/^@tarojs\//]
-        }),
+const baseConfig = {
+  input: 'src/index.ts',
+  output: {
+    sourcemap: true,
+    exports: 'named'
+  },
+  plugins: [
+    externals({
+      deps: true,
+      devDeps: false,
+      include: [/^@tarojs\//]
+    }),
🧰 Tools
🪛 ESLint

[error] 8-8: Expected indentation of 2 spaces but found 4.

(@typescript-eslint/indent)


[error] 9-9: Expected indentation of 2 spaces but found 4.

(@typescript-eslint/indent)


[error] 10-10: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 11-11: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 12-12: Expected indentation of 2 spaces but found 4.

(@typescript-eslint/indent)


[error] 13-13: Expected indentation of 2 spaces but found 4.

(@typescript-eslint/indent)


[error] 14-14: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 15-15: Expected indentation of 6 spaces but found 12.

(@typescript-eslint/indent)


[error] 16-16: Expected indentation of 6 spaces but found 12.

(@typescript-eslint/indent)


[error] 17-17: Expected indentation of 6 spaces but found 12.

(@typescript-eslint/indent)


[error] 18-18: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 19-19: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 20-20: Expected indentation of 6 spaces but found 12.

(@typescript-eslint/indent)


[error] 21-21: Expected indentation of 6 spaces but found 12.

(@typescript-eslint/indent)


[error] 22-22: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 23-23: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 24-24: Expected indentation of 6 spaces but found 12.

(@typescript-eslint/indent)


[error] 25-25: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 26-26: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 27-27: Expected indentation of 2 spaces but found 4.

(@typescript-eslint/indent)


[error] 28-28: Extra semicolon.

(semi)


29-46: 输出配置定义了多种格式

配置了三种输出格式:

  1. 保留模块结构的输出到 dist 目录
  2. CommonJS 格式打包到 dist/index.cjs.js
  3. ES 模块格式打包到 dist/index.esm.js

这符合现代 JavaScript 库的最佳实践,但同样存在缩进问题。

🧰 Tools
🪛 ESLint

[error] 30-30: Expected indentation of 2 spaces but found 8.

(@typescript-eslint/indent)


[error] 31-31: Expected indentation of 4 spaces but found 12.

(@typescript-eslint/indent)


[error] 32-32: Expected indentation of 4 spaces but found 12.

(@typescript-eslint/indent)


[error] 33-33: Expected indentation of 4 spaces but found 12.

(@typescript-eslint/indent)


[error] 34-34: Expected indentation of 2 spaces but found 8.

(@typescript-eslint/indent)


[error] 35-35: Expected indentation of 0 spaces but found 4.

(@typescript-eslint/indent)


[error] 36-36: Expected indentation of 2 spaces but found 8.

(@typescript-eslint/indent)


[error] 37-37: Expected indentation of 4 spaces but found 12.

(@typescript-eslint/indent)


[error] 38-38: Expected indentation of 4 spaces but found 12.

(@typescript-eslint/indent)


[error] 39-39: Expected indentation of 2 spaces but found 8.

(@typescript-eslint/indent)


[error] 40-40: Expected indentation of 0 spaces but found 4.

(@typescript-eslint/indent)


[error] 41-41: Expected indentation of 0 spaces but found 4.

(@typescript-eslint/indent)


[error] 42-42: Expected indentation of 2 spaces but found 8.

(@typescript-eslint/indent)


[error] 43-43: Expected indentation of 4 spaces but found 12.

(@typescript-eslint/indent)


[error] 44-44: Expected indentation of 4 spaces but found 12.

(@typescript-eslint/indent)


[error] 45-45: Expected indentation of 2 spaces but found 8.

(@typescript-eslint/indent)


[error] 46-46: Expected indentation of 0 spaces but found 4.

(@typescript-eslint/indent)


[error] 46-46: Extra semicolon.

(semi)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ac2dfa4 and 2b792c6.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (82)
  • .github/workflows/build-rust-binding.yml (2 hunks)
  • .github/workflows/nodejs.yml (3 hunks)
  • .github/workflows/publish.yml (1 hunks)
  • .github/workflows/sync-components-types.yml (1 hunks)
  • CONTRIBUTING.md (2 hunks)
  • npm/darwin-arm64/package.json (1 hunks)
  • npm/darwin-x64/package.json (1 hunks)
  • npm/linux-x64-gnu/package.json (1 hunks)
  • npm/linux-x64-musl/package.json (1 hunks)
  • npm/win32-x64-msvc/package.json (1 hunks)
  • packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json (1 hunks)
  • packages/babel-plugin-transform-taroapi/package.json (1 hunks)
  • packages/babel-preset-taro/package.json (1 hunks)
  • packages/create-app/package.json (1 hunks)
  • packages/css-to-react-native/package.json (1 hunks)
  • packages/eslint-config-taro/package.json (1 hunks)
  • packages/jest-helper/package.json (1 hunks)
  • packages/postcss-html-transform/package.json (1 hunks)
  • packages/postcss-plugin-constparse/package.json (1 hunks)
  • packages/postcss-pxtransform/package.json (1 hunks)
  • packages/rollup-plugin-copy/package.json (1 hunks)
  • packages/shared/package.json (1 hunks)
  • packages/stylelint-config-taro-rn/package.json (1 hunks)
  • packages/stylelint-taro-rn/package.json (1 hunks)
  • packages/stylelint-taro/package.json (1 hunks)
  • packages/taro-api/package.json (1 hunks)
  • packages/taro-cli-convertor/package.json (1 hunks)
  • packages/taro-cli/package.json (1 hunks)
  • packages/taro-cli/tsconfig.json (1 hunks)
  • packages/taro-components-library-react/package.json (1 hunks)
  • packages/taro-components-library-vue3/package.json (1 hunks)
  • packages/taro-components-rn/package.json (1 hunks)
  • packages/taro-components/package.json (1 hunks)
  • packages/taro-extend/package.json (1 hunks)
  • packages/taro-framework-react/package.json (1 hunks)
  • packages/taro-framework-vue3/package.json (1 hunks)
  • packages/taro-h5/package.json (3 hunks)
  • packages/taro-h5/rollup.config.ts (3 hunks)
  • packages/taro-h5/tsconfig.json (1 hunks)
  • packages/taro-helper/package.json (1 hunks)
  • packages/taro-helper/tsconfig.json (1 hunks)
  • packages/taro-loader/package.json (1 hunks)
  • packages/taro-platform-alipay/package.json (1 hunks)
  • packages/taro-platform-harmony-hybrid/build/config/harmony-definition.json (2 hunks)
  • packages/taro-platform-harmony-hybrid/package.json (1 hunks)
  • packages/taro-platform-harmony-hybrid/rollup.config.ts (4 hunks)
  • packages/taro-platform-harmony-hybrid/tsconfig.json (1 hunks)
  • packages/taro-platform-harmony/package.json (1 hunks)
  • packages/taro-platform-harmony/rollup.config.ts (6 hunks)
  • packages/taro-platform-jd/package.json (1 hunks)
  • packages/taro-platform-qq/package.json (1 hunks)
  • packages/taro-platform-swan/package.json (1 hunks)
  • packages/taro-platform-tt/package.json (1 hunks)
  • packages/taro-platform-weapp/package.json (1 hunks)
  • packages/taro-plugin-html/package.json (1 hunks)
  • packages/taro-plugin-http/package.json (1 hunks)
  • packages/taro-plugin-inject/package.json (1 hunks)
  • packages/taro-plugin-mini-ci/package.json (1 hunks)
  • packages/taro-plugin-react-devtools/package.json (1 hunks)
  • packages/taro-plugin-vue-devtools/package.json (1 hunks)
  • packages/taro-react/package.json (1 hunks)
  • packages/taro-rn-runner/package.json (1 hunks)
  • packages/taro-rn-style-transformer/package.json (1 hunks)
  • packages/taro-rn-supporter/package.json (1 hunks)
  • packages/taro-rn-transformer/package.json (1 hunks)
  • packages/taro-rn/package.json (1 hunks)
  • packages/taro-rn/src/lib/index.ts (1 hunks)
  • packages/taro-router-rn/package.json (1 hunks)
  • packages/taro-router/package.json (2 hunks)
  • packages/taro-router/rollup.config-1745118866046.mjs (1 hunks)
  • packages/taro-runner-utils/package.json (1 hunks)
  • packages/taro-runtime-rn/package.json (1 hunks)
  • packages/taro-runtime/package.json (3 hunks)
  • packages/taro-runtime/rollup.config.ts (2 hunks)
  • packages/taro-service/package.json (1 hunks)
  • packages/taro-transformer-wx/package.json (2 hunks)
  • packages/taro-transformer-wx/src/render.ts (2 hunks)
  • packages/taro-webpack5-prebundle/package.json (1 hunks)
  • packages/taro-webpack5-runner/package.json (1 hunks)
  • packages/taro-with-weapp/package.json (1 hunks)
  • packages/taro/package.json (1 hunks)
  • packages/taroize/package.json (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/taro-transformer-wx/src/render.ts (1)
packages/taro-transformer-wx/src/utils.ts (1)
  • isArrayMapCallExpression (351-358)
🪛 GitHub Actions: Node CI
packages/taro-helper/package.json

[error] 1-1: pnpm install failed with exit code 1 due to outdated lockfile. The pnpm-lock.yaml is not up to date with package.json dependencies, causing a mismatch in specifiers.

🪛 ESLint
packages/taro-router/rollup.config-1745118866046.mjs

[error] 1-1: Extra semicolon.

(semi)


[error] 2-2: Extra semicolon.

(semi)


[error] 3-3: Extra semicolon.

(semi)


[error] 4-4: Extra semicolon.

(semi)


[error] 5-5: Extra semicolon.

(semi)


[error] 8-8: Expected indentation of 2 spaces but found 4.

(@typescript-eslint/indent)


[error] 9-9: Expected indentation of 2 spaces but found 4.

(@typescript-eslint/indent)


[error] 10-10: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 11-11: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 12-12: Expected indentation of 2 spaces but found 4.

(@typescript-eslint/indent)


[error] 13-13: Expected indentation of 2 spaces but found 4.

(@typescript-eslint/indent)


[error] 14-14: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 15-15: Expected indentation of 6 spaces but found 12.

(@typescript-eslint/indent)


[error] 16-16: Expected indentation of 6 spaces but found 12.

(@typescript-eslint/indent)


[error] 17-17: Expected indentation of 6 spaces but found 12.

(@typescript-eslint/indent)


[error] 18-18: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 19-19: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 20-20: Expected indentation of 6 spaces but found 12.

(@typescript-eslint/indent)


[error] 21-21: Expected indentation of 6 spaces but found 12.

(@typescript-eslint/indent)


[error] 22-22: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 23-23: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 24-24: Expected indentation of 6 spaces but found 12.

(@typescript-eslint/indent)


[error] 25-25: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 26-26: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 27-27: Expected indentation of 2 spaces but found 4.

(@typescript-eslint/indent)


[error] 28-28: Extra semicolon.

(semi)


[error] 30-30: Expected indentation of 2 spaces but found 8.

(@typescript-eslint/indent)


[error] 31-31: Expected indentation of 4 spaces but found 12.

(@typescript-eslint/indent)


[error] 32-32: Expected indentation of 4 spaces but found 12.

(@typescript-eslint/indent)


[error] 33-33: Expected indentation of 4 spaces but found 12.

(@typescript-eslint/indent)


[error] 34-34: Expected indentation of 2 spaces but found 8.

(@typescript-eslint/indent)


[error] 35-35: Expected indentation of 0 spaces but found 4.

(@typescript-eslint/indent)


[error] 36-36: Expected indentation of 2 spaces but found 8.

(@typescript-eslint/indent)


[error] 37-37: Expected indentation of 4 spaces but found 12.

(@typescript-eslint/indent)


[error] 38-38: Expected indentation of 4 spaces but found 12.

(@typescript-eslint/indent)


[error] 39-39: Expected indentation of 2 spaces but found 8.

(@typescript-eslint/indent)


[error] 40-40: Expected indentation of 0 spaces but found 4.

(@typescript-eslint/indent)


[error] 41-41: Expected indentation of 0 spaces but found 4.

(@typescript-eslint/indent)


[error] 42-42: Expected indentation of 2 spaces but found 8.

(@typescript-eslint/indent)


[error] 43-43: Expected indentation of 4 spaces but found 12.

(@typescript-eslint/indent)


[error] 44-44: Expected indentation of 4 spaces but found 12.

(@typescript-eslint/indent)


[error] 45-45: Expected indentation of 2 spaces but found 8.

(@typescript-eslint/indent)


[error] 46-46: Expected indentation of 0 spaces but found 4.

(@typescript-eslint/indent)


[error] 46-46: Extra semicolon.

(semi)


[error] 48-48: Expected indentation of 2 spaces but found 4.

(@typescript-eslint/indent)


[error] 48-48: Extra semicolon.

(semi)


[error] 49-49: Extra semicolon.

(semi)


[error] 51-51: Extra semicolon.

(semi)

🔇 Additional comments (93)
packages/taro-plugin-inject/package.json (1)

28-30: 确认 Node.js 引擎版本一致性
已将 engines.node>=18 更新为 >=20,这能兼容最新的 Node.js 22。请检视仓库中所有 CI 配置、文档以及其他 package.jsonengines.node 字段,确保它们也已同步调整。

packages/taro-platform-qq/package.json (1)

29-31: 同步升级 Node.js 引擎要求至 >=20
已将最低 Node.js 版本从 18 升级到 20,与仓库中其他 package.json 保持一致。请确认以下几点:

  1. CI 流水线(.github/workflows)中已使用 Node.js 22 或者对应的 >=20 版本进行测试与发布。
  2. 文档(如 README、贡献指南)中关于 Node.js 版本的说明也已同步更新。
  3. 依赖此插件的其他平台或插件是否仍兼容 Node.js >=20。
packages/taro-extend/package.json (1)

23-25: 确认:Node.js 引擎版本升级到 >=20

此处将 engines.node>=18 升级到 >=20 与仓库中其他包保持一致,已成功弃用 Node 18 并兼容 Node 22。

packages/css-to-react-native/package.json (1)

53-55: 请确认 Node.js 引擎版本定义是否符合 PR 目标
PR 目标中提到要从 Node.js 18 升级到支持 Node.js 22,但此处将 "node" 版本要求设为 ">= 20"。请确认是否应直接更改为 ">= 22" 以与 PR 目标保持一致,或保留 >= 20 的广泛兼容性。

packages/taro-rn-supporter/package.json (1)

29-29: 请确认 Node.js 引擎版本要求是否正确
目前将 "engines.node" 设为 ">= 20",但 PR 目标中提到要支持 Node.js 22。如确实只需支持 20+,请确认是否有理由不直接指定 ">= 22"

packages/taro-components-rn/package.json (1)

31-33: 确认 Node 引擎版本兼容性
已将 engines.node>=18 升级至 >=20,与仓库中其他 package.json 保持一致,也能兼容即将发布的 Node 22。请确认 CI 工作流中的测试矩阵是否包含 Node 20 和 Node 22,以确保实际运行环境与此处的引擎约束相匹配。

packages/taro-platform-swan/package.json (1)

29-31: 检查 Node.js 引擎版本与 PR 目标是否一致
PR 目标为“支持 Node 22”,但此处仅将 engines.node 提升到 >= 20。请确认最低支持版本是 Node 20(LTS)还是应直接调整为 Node 22,并确保与库中其他 package.json 保持一致。

packages/taro-runtime-rn/package.json (1)

33-33: 引擎版本更新:从 Node.js >=18 升级到 >=20
移除了对 Node.js 18 的支持,要求 Node.js 20 及以上版本,符合维护策略。

请确认此处与仓库中其他相关包的 engines.node 配置保持一致(部分包已更新为 >=22),或讨论是否统一为 >=22。

packages/taro-platform-harmony-hybrid/build/config/harmony-definition.json (2)

2331-2334: 新增 list 组件及属性声明
components 中插入了 "list" 节点,并声明了两个属性 "upper-threshold-count""lower-threshold-count",类型与其他平台保持一致。


2345-2345: 新增 list-item 组件声明
已添加 "list-item": false,表示该组件当前不接受任何属性。请确认这是否符合设计需求,或是否需要补充子节点属性。

packages/rollup-plugin-copy/package.json (1)

21-22: 请确认 Node 引擎版本一致性

PR 目标为「支持 Node.js 22」,但此处将 engines.node 设置为 >=20。请确认是否应统一为 >=22,或保留 >=20 并在 CI 测试矩阵中增加对 Node.js 22 的验证。

packages/taro-router-rn/package.json (1)

29-31:

✅ Verification successful

将 Node.js 引擎版本升级至 20+:此处已将 engines.node>=18 调整为 >=20,符合 PR 目标并与仓库内其他包保持一致。

请确保 CI 工作流、文档或脚本中对 Node 版本的要求也已同步更新。可运行以下脚本验证:


🏁 Script executed:

#!/bin/bash
# 检查仓库中是否仍存在旧的 Node.js 要求
rg '"node":\s*">=\s*18"' -l

Length of output: 29


🏁 Script executed:

#!/bin/bash
echo "=== Checking GitHub workflows for node-version:18 ==="
rg -n 'node-version:.*18' -g '.github/workflows/*.yml' || true

echo
echo "=== Checking .nvmrc ==="
if [ -f .nvmrc ]; then
  cat .nvmrc
else
  echo "No .nvmrc file present"
fi

echo
echo "=== Checking all package.json for engines.node >=18 ==="
rg -n '"node":\s*">=\s*18"' -g '*.json' || true

echo
echo "=== Checking markdown files for nvm install 18 ==="
rg -n 'nvm install.*18' -g '*.md' || true

echo
echo "=== Checking Dockerfiles for FROM node:18 ==="
rg -n 'FROM node:18' -g 'Dockerfile*' || true

Length of output: 1114


已同步升级 Node.js 引擎至 20+,未发现旧版 18 的残留引用

  • CI 工作流(.github/workflows)中无 node-version: 18
  • 仓库根目录无 .nvmrc 文件
  • 所有 package.jsonengines.node 均未找到 >=18 的配置
  • 文档(*.md)中无 nvm install ...18
  • Dockerfile 中无 FROM node:18

无需额外更新,可安全合并。

packages/taro-transformer-wx/src/render.ts (2)

792-797: 类型安全性改进

通过将 renderScope 变量的类型从 Scope 改为 Scope | undefined,并使用可选链操作符来访问父级循环的作用域,增强了代码的健壮性。这样可以防止在找不到父级循环作用域时出现运行时错误。


927-928: 类型安全调用

使用可选链操作符确保了在 renderScope 为 undefined 时不会触发运行时错误,这是一个良好的防御性编程实践。

packages/taro-transformer-wx/package.json (1)

32-33:

✅ Verification successful

引擎版本范围已更新

engines.node 已从 >= 18 提升至 >= 20,确保支持 Node.js 20 及以上版本(包括即将发布的 Node.js 22),符合本次移除对 Node 18 支持的目标。请确认仓库中所有子包的 engines 配置也已同步更改。


🏁 Script executed:

#!/bin/bash
# 在 packages 目录下查找所有 package.json,并检查 engines.node 是否已更新至 >= 20
fd -e json -g package.json packages | xargs rg -n '"node": ">= 20"'

Length of output: 3670


所有子包 engines.node 已同步更新至 ≥ 20

脚本验证了 packages/ 目录下所有 package.json 文件中的 engines.node 均已从 >= 18 提升至 >= 20,覆盖了所有子包,无需进一步操作。

packages/taro-service/package.json (1)

31-33:

❓ Verification inconclusive

确认 Node.js 引擎版本一致性
engines.node>= 18 升级至 >= 20,请确保所有相关文档、CI 工作流及其他 package.json 文件均已同步更新,以免出现版本不一致的问题。


🏁 Script executed:

#!/bin/bash
# 查找仓库中仍使用 Node.js >=18 的 package.json 文件
rg '"node": ">= 18"' -l

Length of output: 25


确认 Node.js 引擎版本一致性

仓库中所有 package.json 已检查,未发现仍使用 ">= 18"engines.node 配置。但请手动确认以下位置已同步更新为 >= 20,以免遗漏:

  • CI 工作流:.github/workflows/*.yml 中的 node-versionsetup-node 配置
  • 项目文档:README.mddocs/ 目录等说明文件
  • 其他任何引用 Node.js 版本的配置文件
packages/taro-plugin-mini-ci/package.json (1)

32-32: 确认文档与 CI 中的 Node.js 版本一致性
此处已将 engines.node>=18 升级到 >=20,请检查 .github/workflows 中的 Node 版本及项目文档(如 CONTRIBUTING.md、README.md)是否已同步更新,以确保对目标“支持 Node.js 22”的完整兼容。

packages/taro-webpack5-prebundle/package.json (1)

33-33: 确认文档与 CI 中的 Node.js 版本一致性
此处已将 engines.node>=18 升级到 >=20,请检查 .github/workflows 中的 Node 版本及项目文档(如 CONTRIBUTING.md、README.md)是否已同步更新,以确保对目标“支持 Node.js 22”的完整兼容。

packages/taro-plugin-vue-devtools/package.json (1)

30-30: 确认文档与 CI 中的 Node.js 版本一致性
此处已将 engines.node>=18 升级到 >=20,请检查 .github/workflows 中的 Node 版本及项目文档(如 CONTRIBUTING.md、README.md)是否已同步更新,以确保对目标“支持 Node.js 22”的完整兼容。

packages/taro-components-library-vue3/package.json (1)

18-18: 确认文档与 CI 中的 Node.js 版本一致性
此处已将 engines.node>=18 升级到 >=20,请检查 .github/workflows 中的 Node 版本及项目文档(如 CONTRIBUTING.md、README.md)是否已同步更新,以确保对目标“支持 Node.js 22”的完整兼容。

packages/create-app/package.json (1)

30-30: 确认文档与 CI 中的 Node.js 版本一致性
此处已将 engines.node>=18 升级到 >=20,请检查 .github/workflows 中的 Node 版本及项目文档(如 CONTRIBUTING.md、README.md)是否已同步更新,以确保对目标“支持 Node.js 22”的完整兼容。

packages/taro-react/package.json (1)

28-28: 确认 Node.js 引擎版本要求更新
已将最低 Node.js 版本要求从 ">= 18" 升级至 ">= 20"。该范围向后兼容 Node 22,满足本次 PR“支持 Node 22”目标。

packages/taro-api/package.json (1)

38-38: 确认 Node.js 引擎版本要求更新
已将最低 Node.js 版本要求从 ">= 18" 升级至 ">= 20"。该范围向后兼容 Node 22,符合 PR 目标。

npm/darwin-x64/package.json (1)

17-17: 确认 Node.js 引擎版本要求更新
已将最低 Node.js 版本要求从 ">= 18" 升级至 ">= 20",确保原生绑定包兼容 Node 22。

packages/taro/package.json (1)

23-23: 确认 Node.js 引擎版本要求更新
已将最低 Node.js 版本要求从 ">= 18" 升级至 ">= 20",满足对 Node 22 的支持需求。

packages/taro-components-library-react/package.json (1)

18-18: 确认 Node.js 引擎版本要求更新
已将最低 Node.js 版本要求从 ">= 18" 升级至 ">= 20",兼容并支持 Node 22 及更高版本。

packages/taro-rn/package.json (1)

38-38: 确认 Node.js 引擎版本要求与 PR 目标一致
PR 目标是「支持 Node.js 22」,但此处将 engines.node 设置为 >=20,建议核实是否应更新为 >=22,或说明选择 >=20 的原因。

packages/taro-runner-utils/package.json (1)

26-26: 更新 Node.js 引擎最低版本
将 engines.node 从 18 升级到 >=20,符合对 Node 18 退役后的环境要求,并可兼容 Node 22。

packages/taroize/package.json (1)

55-55: 更新 Node.js 引擎最低版本
将 engines.node 从 18 升级到 >=20,与 monorepo 中其它包保持一致,并支持 Node 22 运行时环境。

packages/taro-rn-transformer/package.json (1)

31-31: 更新 Node.js 引擎最低版本
同步将 engines.node 升级至 >=20,满足整体升级规划,同时可兼容 Node 22。

packages/postcss-html-transform/package.json (1)

27-27: 更新 Node.js 引擎最低版本
将 engines.node 从 18 升级到 >=20,与其他包一致并覆盖后续 Node 22 平台。

npm/win32-x64-msvc/package.json (1)

17-17: 更新 Node.js 引擎最低版本
同步将 engines.node 升级到 >=20,统一项目 Engine 要求并支持 Node 22。

packages/taro-platform-tt/package.json (1)

30-30: 更新 Node.js 最低版本至 >=20
此变更与仓库统一升级策略保持一致,可确保在支持 Node.js 22.x 的 CI/CD 环境中正常运行。

packages/taro-rn-style-transformer/package.json (1)

30-30: 更新 Node.js 最低版本至 >=20
此变更与其它包的引擎版本同步,符合整体升级方向。

packages/babel-plugin-transform-taroapi/package.json (1)

19-19: 更新 Node.js 最低版本至 >=20
此变更符合仓库的统一升级策略,无其他元数据变更。

packages/taro-framework-react/package.json (1)

33-33: 更新 Node.js 最低版本至 >=20
与整体框架插件和 CI 工作流的版本要求保持一致。

packages/taro-framework-vue3/package.json (1)

29-29: 更新 Node.js 最低版本至 >=20
符合 Vue3 框架插件及全局升级策略,无需额外调整。

npm/linux-x64-gnu/package.json (1)

17-17: 确认 engines.node 范围与 PR 目标一致。

PR 描述中提到支持 Node.js 22 及以上,但此处只将最低版本更新到 >=20。请核实是否应进一步升级到 >=22,以保持与 CI 配置和 CONTRIBUTING.md 中的推荐版本一致。

packages/taro-components/package.json (1)

56-56: 确认 engines.node 范围与 PR 目标一致。

PR 描述中要求支持 Node.js 22+,但此处仅将最低版本设为 >=20。建议检查并确定是否需要将其更新为 >=22,以避免与文档及 CI 流程中的版本推荐不符。

npm/linux-x64-musl/package.json (1)

16-16: 确认 engines.node 范围与 PR 目标一致。

仓库 CONTRIBUTING.md 推荐使用 Node.js 22,而这里仅升级到 >=20。请验证是否应该将此处也改为 >=22,以保证所有包的版本要求保持一致。

packages/taro-platform-jd/package.json (1)

30-30: 确认 engines.node 范围与 PR 目标一致。

当前将版本要求设为 >=20,但 PR 目标中已提出支持 Node.js 22。请审查并确认是否需要将此处也调整到 >=22

packages/taro-platform-weapp/package.json (1)

29-29: 确认 engines.node 范围与 PR 目标一致。

此处更新为 >=20,但 PR 目标及 CONTRIBUTING.md 均推荐 Node.js 22+。建议核实是否应将版本要求同步升级到 >=22

packages/taro-platform-alipay/package.json (1)

30-30: 更新 Node.js 引擎版本至 >=20
已将 "engines.node">=18 升级为 >=20,与仓库中其他包保持一致,并与 CI 工作流中对 Node 22 的支持相匹配,完成弃用 Node 18 的目标。

packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json (1)

26-26: 更新 Node.js 引擎版本至 >=20
已将 "engines.node">=18 升级为 >=20,保持与整体仓库版本要求的一致性,符合弃用 Node 18 的 PR 目标。

packages/stylelint-taro/package.json (1)

38-38: 更新 Node.js 引擎版本至 >=20
已将 "engines.node">=18 升级为 >=20,与其他相关包同步,确保 CI 环境与文档中推荐的 Node 22 兼容。

packages/stylelint-taro-rn/package.json (1)

42-42: 更新 Node.js 引擎版本至 >=20
已将 "engines.node">=18 升级为 >=20,与仓库中其他插件包对齐,满足弃用旧版本 Node.js 的需求。

packages/eslint-config-taro/package.json (1)

26-26: 更新 Node.js 引擎版本至 >=20
已将 "engines.node">=18 升级为 >=20,与整个项目的 Node.js 版本策略保持一致,无需额外调整。

npm/darwin-arm64/package.json (1)

17-18: 引擎版本更新: 将 Node.js 引擎要求从 >=18 升级到 >=20,与其他绑定包保持一致。

packages/taro-runtime/package.json (3)

22-22: 验证 Rollup CLI 参数: --configPlugin @rollup/plugin-typescript 需确保在当前 Rollup 版本中受支持,否则建议将插件直接在 rollup.config.ts 中导入并移除该 CLI 参数。


31-32: 引擎版本一致性: 将 Node.js 引擎要求从 >=18 升级到 >=20,与项目其他包同步。


43-43: 替换 TypeScript 插件: 已将弃用的 rollup-plugin-ts 替换为官方 @rollup/plugin-typescript,推荐的升级方向。

.github/workflows/build-rust-binding.yml (2)

17-17: Node.js 版本升级: 将矩阵中的 Node.js 版本从 18.x 升级至 22.x,符合弃用 Node 18 的目标。


50-53: PNPM 版本升级: 将 pnpm/action-setupv3 升级至 v4 并将 version9 升至 10,确保使用最新 pnpm。

.github/workflows/sync-components-types.yml (2)

37-43: PNPM 初始化更新: 将 pnpm/action-setup 升级至 v4 并设置 version: 10,并利用 run_install 选项执行安装。请确认 run_install 配置符合官方文档,确保参数生效。


47-49: Node.js 版本升级: 将 actions/setup-nodenode-version18 更改为 22,保持 CI 环境最新。

.github/workflows/publish.yml (2)

89-92: PNPM 设置升级: 在发布流程中将 pnpm/action-setupv3 升级到 v4 并设置 version: 10,与其他工作流保持一致。


93-98: Node.js 版本升级: 将 actions/setup-nodenode-version18 升至 22,并保留 cache: 'pnpm'registry-url

.github/workflows/nodejs.yml (4)

31-31: 校正作业名称以修复拼写错误
已将 job 名称从 nodejs-tesing 更正为 nodejs-testing,确保 CI 能正确识别并执行该步骤。


39-40: 更新测试矩阵中的 Node.js 版本
已将测试矩阵中的 Node.js 版本列表由 18.x 更新为 22.x20.x,以覆盖新的支持范围。


51-58: 请验证矩阵排除逻辑
当前配置通过 exclude 排除了 macOS 和 Windows 系统上的所有 Node.js 版本,这可能导致仅在 ubuntu-latest 上运行测试,并且 includeexclude 组合存在重复或冲突。请确认此行为是否符合预期,或者重新调整 include/exclude 规则以确保所需的组合正确执行。


65-68: 升级 pnpm 配置
已将 pnpm/action-setup 升级至 v4 并将 pnpm 版本从 9 提升至 10,与仓库中其他 CI 工作流保持一致。

packages/taro-cli/package.json (1)

43-43: 更新 Node.js 引擎版本
已将 engines.node>=18 更新为 >=20,与 CI 测试矩阵保持一致,覆盖现代 Node.js 版本。

packages/taro-cli/tsconfig.json (1)

9-12: 添加声明文件输出与路径映射
新增 "declaration": true 用于生成 .d.ts 类型声明,并对 @babel/types 添加 paths 映射,以确保模块能够正确解析,与其他子包配置保持一致。

packages/taro-helper/tsconfig.json (1)

12-15: 启用 sourceMap 并添加路径映射
新增 "sourceMap": true 以便调试时生成映射文件,并对 @babel/types 添加 paths 映射,确保模块解析与 taro-cli 保持一致。

packages/taro-platform-harmony-hybrid/package.json (1)

63-63: 更新了Rollup TypeScript插件

使用官方的@rollup/plugin-typescript替换了之前的rollup-plugin-ts,与PR的目标一致,支持Node 22。这是一个良好的更改,因为它使用了更标准、更维护良好的官方插件。

packages/taro-h5/tsconfig.json (2)

8-8: 启用了源映射生成

启用了源代码映射(sourceMap)功能,这对开发和调试非常有帮助,可以更容易地定位到编译前的源代码位置。


10-10: 更新了Rollup配置文件引用

rollup.config.mts更改为rollup.config.ts,保持了配置文件命名的一致性,这有助于简化构建过程并避免混淆。

packages/taro-platform-harmony-hybrid/tsconfig.json (1)

9-11: 增强了TypeScript编译选项

添加了declaration: trueoutDir: "dist"选项,使编译器生成声明文件(.d.ts)并将输出文件存放到dist目录,这是一个良好的改进,有助于类型推断和模块导入。

packages/taro-runtime/rollup.config.ts (2)

1-1: 更新了TypeScript插件导入

rollup-plugin-ts切换到官方的@rollup/plugin-typescript,这与PR的目标一致,提高了与Node 22的兼容性。


16-18: 简化了TypeScript插件配置

配置更简洁,仅排除了rollup.config.ts文件,避免了循环依赖问题。相比之前可能复杂的配置,这种简化可以提高可维护性和可读性。

packages/taro-router/package.json (2)

11-11: 更新了 TypeScript 声明文件的引用方式

将类型声明引用从 "typings" 更改为 "types" 并修改了路径,这符合 TypeScript 的最新建议。这种变更有助于更好地支持现代构建工具和类型检查器。


34-34: 提高了 Node.js 引擎版本要求

将 Node.js 的最低版本要求从 18 提升到 20,这与 PR 的主要目标一致,因为 Node.js 18 将在 2025 年 4 月结束维护。这个更改可以确保项目利用更新版本的 Node.js 提供的性能和安全改进。

packages/taro-h5/package.json (3)

26-27: 更新了构建和测试脚本配置

脚本更改包括:

  1. rollup.config.mts 更改为 rollup.config.ts,并添加了 --configPlugin @rollup/plugin-typescript --bundleConfigAsCjs 选项
  2. 简化了测试命令,使用更简洁的 jest 而不是直接指定路径

这些更改有助于使构建过程与新版本的 Node.js 和构建工具兼容。


43-43: 重新排序了依赖项

@tarojs/components 在依赖列表中提前排序。虽然这不影响功能,但有助于保持依赖项的组织结构更加一致。


73-75: 更新了 Rollup 相关依赖

  1. 添加了 @rollup/plugin-typescript 以替换已弃用的 rollup-plugin-ts
  2. 调整了 @rollup/plugin-node-resolve 的位置
  3. 添加了 rollup-plugin-dts 用于生成 TypeScript 声明文件

这些更改符合 PR 的目标,确保与 Node 22 的兼容性。官方的 TypeScript 插件通常有更好的维护和兼容性。

packages/taro-platform-harmony-hybrid/rollup.config.ts (4)

4-4: 替换了 TypeScript 插件依赖

rollup-plugin-ts 替换为官方的 @rollup/plugin-typescript,这是一个良好的变更,因为官方插件通常有更好的维护和兼容性支持。


33-35: 简化了 TypeScript 插件配置

配置从之前可能较复杂的自定义 tsconfig 函数简化为只排除 rollup.config.ts 文件。这使得配置更加简洁,同时保持了相同的功能。


72-73: 简化了文件路径引用

移除了使用 path.join(cwd, ...) 的复杂路径引用,改为直接使用字符串字面量。这种变更使代码更简洁,减少了不必要的依赖。


83-84: 简化了构建插件配置文件路径

同样移除了复杂的路径引用方式,使配置更加清晰。

packages/taro-platform-harmony/rollup.config.ts (7)

3-3: 替换了 TypeScript 插件依赖

rollup-plugin-ts 替换为官方的 @rollup/plugin-typescript,这符合整个项目的升级方向,确保与 Node 22 的兼容性。


19-21: 简化了 TypeScript 插件配置

移除了复杂的 tsconfig 函数配置,改为更简单的排除选项。这种简化使配置更加清晰,减少了潜在的问题。


29-31: 简化了文件路径引用

不再使用 path.join(cwd, ...) 来构建路径,而是直接使用字符串字面量。这减少了对 Node.js path 模块的依赖,使配置更加简洁。


54-57: 简化了 runtime 配置中的文件路径引用

同样采用了直接字符串路径而非 path.join 方法,保持了整个配置文件风格的一致性。


65-68: 简化了 runtime-utils 配置中的文件路径引用

采用相同的简化方式处理文件路径,与整个文件的重构风格保持一致。


76-79: 简化了 components-react 配置中的文件路径引用

继续保持了路径引用的一致性简化。


83-86: 简化了 otherConfig 的 TypeScript 配置

从之前可能的复杂配置简化为直接设置 declaration: false 和排除 rollup 配置文件。这种变更使配置更加清晰,同时保持功能一致。

packages/taro-h5/rollup.config.ts (4)

3-3: 更新了 TypeScript 编译插件

从非官方的 rollup-plugin-ts 切换到官方的 @rollup/plugin-typescript,这符合 PR 目标,提高与 Node 22 的兼容性。


6-6: 添加了声明文件生成插件

引入 rollup-plugin-dts 用于生成 TypeScript 声明文件,这是一个很好的改进,可以更好地支持 TypeScript 类型定义。


28-28: 简化了 TypeScript 配置

移除了自定义 tsconfig 配置,改为直接排除 rollup.config.ts 文件,这样配置更加清晰简洁。


50-62: 增强了构建输出配置

新增了两个关键构建配置:

  1. 生成带有内联动态导入的 ESM 输出文件
  2. 使用 dts() 插件生成对应的声明文件,用于 API 配置生成

这些变更提高了包的可用性和类型支持,特别是注释中提到的用于 taro-platform-h5\build\definition-json\parser.ts 生成 APIs 配置的功能。

packages/taro-router/rollup.config-1745118866046.mjs (2)

1-6: 导入了必要的 Rollup 插件和依赖

导入了基本的 Rollup 插件用于支持 CommonJS、Node 模块解析、TypeScript 编译等功能,与其他包的配置保持一致。

🧰 Tools
🪛 ESLint

[error] 1-1: Extra semicolon.

(semi)


[error] 2-2: Extra semicolon.

(semi)


[error] 3-3: Extra semicolon.

(semi)


[error] 4-4: Extra semicolon.

(semi)


[error] 5-5: Extra semicolon.

(semi)


23-25: TypeScript 配置包含必要的说明

TypeScript 插件配置中明确包含了源代码和类型定义目录,并添加了注释说明这样做的必要性。这是一个很好的做法,避免了生成不必要的声明文件。

🧰 Tools
🪛 ESLint

[error] 23-23: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)


[error] 24-24: Expected indentation of 6 spaces but found 12.

(@typescript-eslint/indent)


[error] 25-25: Expected indentation of 4 spaces but found 8.

(@typescript-eslint/indent)

packages/jest-helper/package.json (1)

21-22:

✅ Verification successful

确认 Node.js 引擎版本要求一致性

当前将 engines.node>=18 升级至 >=20,请验证此修改是否符合本 PR 目标(支持 Node 22 及以上),并确保仓库中所有其他 package.json 和 CI 工作流中的 Node 版本要求保持一致。

以下脚本可用于检查所有 package.json 中的 Node 引擎声明:


🏁 Script executed:

#!/bin/bash
# 检查 packages 目录下所有 package.json 的 engines.node 字段
rg -n '"node":' --glob 'packages/**/*.json'

Length of output: 3897


🏁 Script executed:

#!/bin/bash
# 检查 CI 工作流中的 node-version 和 actions/setup-node 配置
rg -n 'node-version:' --glob '.github/workflows/**/*.yml'
rg -n 'setup-node' --glob '.github/workflows/**/*.yml' -A 3

Length of output: 415


🏁 Script executed:

#!/bin/bash
# 检查 .github/workflows 目录下所有 YAML 文件中的 Node 版本配置
rg -n 'node-version:' --glob '.github/workflows/*.{yml,yaml}'
rg -n 'actions/setup-node' --glob '.github/workflows/*.{yml,yaml}' -A3

Length of output: 430


🏁 Script executed:

#!/bin/bash
# 列出并搜索 .github/workflows 目录下的 CI 配置文件中的 Node 版本
if [ -d .github/workflows ]; then
  for file in .github/workflows/*.{yml,yaml}; do
    [ -e "$file" ] || continue
    echo "=== 检查 $file ==="
    rg -n 'node-version:' "$file"
    rg -n 'actions/setup-node' "$file" -A3
  done
else
  echo ".github/workflows 目录不存在"
fi

Length of output: 3338


确认 Node.js 引擎版本一致性

  • 已检查所有 packages/**/package.json 中的 engines.node,均已统一为 >=20
  • CI 工作流(.github/workflows)中通过 matrix 测试了 20.x22.x,且 actions/setup-node@v4 已正确配置支持这些版本
  • 当前 >=20 的要求已覆盖并支持 Node 22 及以上,并与仓库中其他配置保持一致

无需进一步调整。

Comment on lines 38 to 40
"engines": {
"node": ">= 18"
"node": ">= 20"
},
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

请同步更新 pnpm 锁文件以修复 CI 失败

已将 engines.node>=18 升级到 >=20,此更改是合理的,但当前未重新生成 pnpm-lock.yaml,导致 GitHub Actions 中的 pnpm install 因锁文件与依赖不匹配而失败。请在仓库根目录运行:

pnpm install -P

或使用等效命令重新生成并提交更新后的 pnpm-lock.yaml。同时,建议检查其他子包的 package.json 中该字段一致性,以保持全项目对 Node.js 版本的统一要求。

? jsxElementPath
.findParent((p) => isArrayMapCallExpression(p as any))
?.get('arguments')[0]
.get('body').scope
: this.renderScope
const bindingNode = renderScope.getOwnBinding(assignmentName)!.path.node as any
const bindingNode = renderScope?.getOwnBinding(assignmentName)!.path.node as any
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

潜在的空值安全问题

虽然使用了可选链操作符 ?. 处理 renderScope 可能为 undefined 的情况,但随后立即使用了非空断言操作符 !,这可能导致运行时错误。

建议调整如下:

-const bindingNode = renderScope?.getOwnBinding(assignmentName)!.path.node as any
+const binding = renderScope?.getOwnBinding(assignmentName)
+const bindingNode = binding?.path.node as any
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const bindingNode = renderScope?.getOwnBinding(assignmentName)!.path.node as any
const binding = renderScope?.getOwnBinding(assignmentName)
const bindingNode = binding?.path.node as any

@@ -10,7 +10,7 @@

### 1. 环境准备

> 需要安装 [Node.js 16](https://nodejs.org/en/)(建议安装 `16.20.0` 及以上版本)及 [pnpm 7](https://pnpm.io/zh/installation)
> 需要安装 [Node.js 22](https://nodejs.org/en/)(建议安装 `v22.14.0` 及以上版本)及 [pnpm 10](https://pnpm.io/zh/installation)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

文档 Node.js 最低版本不一致
文档中建议使用 Node.js v22.14.0+,但 CI 测试矩阵和各包 package.json 中的 engines.node 均支持 >=20。请统一最低版本要求:要么将文档改为 >=20,要么在 CI 和引擎声明中仅保留 >=22

@@ -47,7 +47,7 @@
"rollup": "^3.29.4",
"rollup-plugin-copy": "workspace:*",
"rollup-plugin-node-externals": "^5.0.0",
"rollup-plugin-ts": "^3.4.5",
"@rollup/plugin-typescript": "^12.1.2",
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

升级到了更新版本的TypeScript插件

引入了@rollup/plugin-typescript^12.1.2版本,相比于harmony-hybrid包中使用的^11.1.6版本更新。这种不一致可能会导致构建行为略有差异。

建议考虑在所有包中统一插件版本,以确保构建行为的一致性。


🏁 Script executed:

#!/bin/bash
# 检查所有package.json中@rollup/plugin-typescript的版本是否一致
find . -name "package.json" -exec grep -l "@rollup/plugin-typescript" {} \; | xargs grep "@rollup/plugin-typescript"

Length of output: 2231


统一 @rollup/plugin‑typescript 插件版本

目前在各包中发现两种版本共存,可能导致构建差异:

  • ^11.1.6
    • 根目录 package.json
    • packages/taro-platform-harmony-hybrid/package.json
  • ^12.1.2
    • packages/taro-h5/package.json
    • packages/taro-platform-harmony/package.json
    • packages/taro-runtime/package.json

建议将所有包中的 @rollup/plugin‑typescript 版本统一为同一版本(例如升级到 ^12.1.2),以确保构建行为一致。

Comment on lines 47 to 51
var rollup_config = defineConfig(variesConfig.map(v => {
return Object.assign({}, baseConfig, v);
}));

export { rollup_config as default };
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

导出配置与命名不符合项目规范

  1. 变量命名使用了下划线命名法 rollup_config,而不是驼峰命名法
  2. 使用了分号,而项目其他部分看起来不使用分号
  3. 文件名带有时间戳 rollup.config-1745118866046.mjs,不够规范

建议修改为更规范的形式:

-var rollup_config = defineConfig(variesConfig.map(v => {
-    return Object.assign({}, baseConfig, v);
-}));
-
-export { rollup_config as default };
+export default defineConfig(variesConfig.map(v => {
+  return Object.assign({}, baseConfig, v)
+}))

另外,建议将文件重命名为标准的 rollup.config.mjs,移除时间戳。

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
var rollup_config = defineConfig(variesConfig.map(v => {
return Object.assign({}, baseConfig, v);
}));
export { rollup_config as default };
export default defineConfig(variesConfig.map(v => {
return Object.assign({}, baseConfig, v)
}))
🧰 Tools
🪛 ESLint

[error] 48-48: Expected indentation of 2 spaces but found 4.

(@typescript-eslint/indent)


[error] 48-48: Extra semicolon.

(semi)


[error] 49-49: Extra semicolon.

(semi)


[error] 51-51: Extra semicolon.

(semi)

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