Skip to content

Conversation

@ianzone
Copy link
Contributor

@ianzone ianzone commented Jun 28, 2025

这个 PR 做了什么? (简要描述所做更改)
#17842 中的杂项

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

  • 构建优化 (Chore)

Summary by CodeRabbit

  • 新功能

    • TaroPlatform 类新增 getConfig() 公共方法,用于获取当前平台配置。
    • 新增 H5 平台 API 与组件属性的模拟定义文件,提升测试覆盖面和类型准确性。
    • H5 平台新增构建后处理脚本,实现定义文件自动同步更新。
  • 修复与优化

    • 统一各包的构建产物目录为 dist,并调整主入口、类型声明等相关路径,简化包发布内容。
    • 移除部分包的冗余入口文件及 .gitignore,优化项目结构。
    • Jest 相关依赖及配置路径同步调整,保证测试环境一致性。
    • 修正部分描述、注释及文档格式,提升可读性和一致性。
    • 统一测试文件中导入方式,调整测试注释及字符串格式,提升代码可读性。
    • 调整 Rollup 配置文件及 TypeScript 配置,优化构建流程。
  • 文档

    • 优化 @tarojs/plugin-mini-ci 的 README 文档格式与表述,更加规范易读。
  • 其他

    • 删除历史变更日志(CHANGELOG)文件。

@coderabbitai
Copy link

coderabbitai bot commented Jun 28, 2025

"""

Walkthrough

本次变更主要集中于各个包的构建输出目录规范化(由 lib 统一为 dist),相关入口文件和类型声明路径同步调整。部分包的入口代理文件被移除,测试依赖和配置也做了相应修改。此外,部分文档、配置和 mock 文件进行了补充或格式优化,并有极少量公开方法和导出方式的调整。

Changes

文件/路径分组 变更摘要
.pnpmfile.cjs 为 @stencil/core 明确锁定四个 Jest 相关依赖的版本。
package.json, tests/package.json devDependencies 中 jest-taro-helper 的移除与新增。
packages/babel-plugin-transform-taroapi/tests/mocks/h5-definition.json 新增 H5 平台 API 与组件属性 mock 定义。
packages/babel-plugin-transform-taroapi/tests/index.spec.ts 测试用 definition.json 的导入路径由生产包切换为本地 mock。
packages/jest-helper/package.json, packages/jest-helper/tsconfig.json 输出目录由 lib 改为 dist,相关文件/脚本/排除规则同步调整。
packages/rollup-plugin-copy/index.js, packages/rollup-plugin-copy/package.json, packages/rollup-plugin-copy/tsconfig.json 输出目录由 lib 改为 dist,入口文件路径与 files 字段同步调整。
packages/taro-platform-harmony/package.json, packages/taro-platform-harmony/rollup.config.ts, packages/taro-platform-harmony/tsconfig.json Rollup 配置及 tsconfig 由 mts 切换为 ts,相关包含/排除规则调整。
packages/taro-plugin-mini-ci/.gitignore, packages/taro-plugin-mini-ci/README.md, packages/taro-plugin-mini-ci/index.js, packages/taro-plugin-mini-ci/package.json, packages/taro-plugin-mini-ci/tsconfig.json .gitignore 删除,README 格式优化,入口代理文件移除,输出目录与 types 路径调整。
packages/taro-runner-utils/.gitignore, packages/taro-runner-utils/package.json, packages/taro-runner-utils/tsconfig.json .gitignore 删除,types 路径与 files 字段同步调整,declarationDir 移除。
packages/taro-service/.gitignore, packages/taro-service/index.js, packages/taro-service/package.json, packages/taro-service/src/platform-plugin-base/platform.ts, packages/taro-service/tsconfig.json .gitignore 删除,入口代理文件移除,入口/types 路径同步 dist,新增 getConfig 公共方法。
packages/taro-transformer-wx/CHANGELOG.md, packages/taro-transformer-wx/index.js, packages/taro-transformer-wx/jest.config.ts, packages/taro-transformer-wx/package.json, packages/taro-transformer-wx/tsconfig.json 删除 changelog,入口代理文件移除,snapshotSerializers 路径调整,输出目录与描述修正。
packages/taroize/.gitignore, packages/taroize/index.js, packages/taroize/package.json, packages/taroize/src/index.ts, packages/taroize/tsconfig.json .gitignore 删除,入口代理文件移除,主入口与 files 字段同步 dist,parse 改为默认导出。
tests/jest.config.ts snapshotSerializers 路径由 lib 改为 dist。
packages/taro-platform-h5/package.json, packages/taro-platform-h5/scripts/post-build.mjs 新增 postbuild 脚本,将 dist/definition.json 内容复制到 babel-plugin-transform-taroapi 的测试 mock 目录。
packages/taroize/tests/* 多个测试文件中将 parse 导入改为默认导入,注释及字符串中增加中英文及标点间空格,提升可读性,无功能变更。
packages/taro-cli-convertor/tests/* 多个测试文件注释及测试描述中增加中英文及标点间空格,import 方式调整,无功能变更。
packages/taro-platform-harmony-cpp/src/index.ts 新增导出 HarmonyCPP 类。
packages/taro-platform-harmony-cpp/src/program/vite/inject-env.ts 函数签名由 this 参数改为显式 platform 参数,内部 this 访问改为 platform,逻辑不变。

Sequence Diagram(s)

sequenceDiagram
  participant 测试用例
  participant Mock定义
  participant 插件

  测试用例->>Mock定义: 导入 h5-definition.json
  测试用例->>插件: 传递 Mock 定义进行测试
  插件-->>测试用例: 返回基于 Mock 的测试结果
Loading
sequenceDiagram
  participant 构建工具
  participant 包源码
  participant dist目录

  构建工具->>包源码: 编译 TypeScript
  包源码->>dist目录: 输出 js/d.ts 文件
  构建工具-->>dist目录: 仅发布 dist 目录
Loading

Suggested reviewers

  • tutuxxx
  • yoyo837

Poem

🐇
版本锁定细心裁,
mock 定义绘新彩。
dist 目录齐整齐,
入口文件换新牌。
注释格式皆优化,
代码整洁更精彩!
— 代码兔敬上
"""


📜 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 065eca5 and 9de3182.

📒 Files selected for processing (3)
  • packages/jest-helper/package.json (1 hunks)
  • packages/taro-platform-harmony-cpp/src/index.ts (1 hunks)
  • packages/taro-platform-harmony-cpp/src/program/vite/inject-env.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/taro-platform-harmony-cpp/src/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/jest-helper/package.json
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: ianzone
PR: NervJS/taro#17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
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 文件。
🪛 Biome (1.9.4)
packages/taro-platform-harmony-cpp/src/program/vite/inject-env.ts

[error] 16-16: This aliasing of this is unnecessary.

Arrow functions inherits this from their enclosing scope.
Safe fix: Use this instead of an alias.

(lint/complexity/noUselessThisAlias)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
  • GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
  • GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
🔇 Additional comments (3)
packages/taro-platform-harmony-cpp/src/program/vite/inject-env.ts (3)

8-8: 优秀的重构:显式参数替代隐式上下文

将函数签名从隐式的 this: Harmony 上下文改为显式的 platform: Harmony 参数,提升了代码的可读性和依赖关系的清晰度。


11-11: 调用代码与函数签名变更保持一致

正确更新了所有对平台实例的引用,从 this.getConfig()this.context 改为 platform.getConfig()platform.context,与新的函数签名保持一致。

Also applies to: 17-17


16-16: 保留 this 别名以确保正确传递 Vite 插件上下文
静态分析工具对此处的“不必要的 this 别名”判定为误报。const pluginContext = this 用于在 transform 函数中获取正确的 PluginContext 并传递给 getViteHarmonyCompilerContext,不可删除。

关注位置:

  • packages/taro-platform-harmony-cpp/src/program/vite/inject-env.ts:16

保持以下代码不变:

const pluginContext = this
const compiler = getViteHarmonyCompilerContext(pluginContext)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in 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.

@coderabbitai coderabbitai bot requested review from tutuxxx and yoyo837 June 28, 2025 08:03
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: 3

🧹 Nitpick comments (4)
packages/taro-service/src/platform-plugin-base/platform.ts (1)

66-68: 新增配置访问方法实现合理

添加的 getConfig() 公共方法提供了对平台配置的受控访问,实现简洁且符合封装原则。

建议为新增的公共方法添加 JSDoc 注释,以便明确其用途和返回值:

+  /**
+   * 获取当前平台配置
+   * @returns 平台配置对象
+   */
   public getConfig() {
     return this.config
   }
packages/taroize/package.json (1)

7-10: 入口指向 dist/src/index.js,需确认包使用方路径期望

目前 tsc 输出为 dist/src/index.js,入口指向深层路径虽然可用,但社区常见做法是构建后扁平到 dist/index.js。如果下游脚手架或 bundler 有基于目录结构的假设,深层入口可能导致 tree-shaking 或 alias 处理异常。

如无特殊需求,建议修改 rootDir/outDir 或在构建后复制文件,使 main 直接指向 dist/index.js,同时提供 exports 字段明确子路径。示例 diff:

-  "main": "dist/src/index.js",
+  "main": "dist/index.js",
+  "exports": {
+    ".": "./dist/index.js"
+  },

[建议可选优化]

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

4-5: main 改为 dist/src/index.js 同时移除 CLI 文件,注意 bin 暴露

  • 将入口改到深层路径与构建目录一致 ✅
  • 但此前仓库曾存在 cli.js 并通过 bin 字段暴露;若同时删除 cli.js 但未调整 bin 字段,发布后全局命令可能失效。请检查 package.json.bin 是否仍指向旧文件。
  • 同样地,深层入口问题可参考 taroize 的建议。

Also applies to: 15-18

packages/babel-plugin-transform-taroapi/__tests__/__mocks__/h5-definition.json (1)

1-2477: 超大 JSON Mock 建议拆分或脚本化生成
整个 mock 文件近 2.5k 行,随仓库一起版本控制会拖慢 clone/checkout,并且维护成本高。

  • 可考虑按照功能域拆分为多个小文件并在测试前合并。
  • 或用脚本从源码/官方声明自动生成,减少手工同步错误。
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e123a5a and a159c7f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (37)
  • .pnpmfile.cjs (1 hunks)
  • package.json (0 hunks)
  • packages/babel-plugin-transform-taroapi/__tests__/__mocks__/h5-definition.json (1 hunks)
  • packages/babel-plugin-transform-taroapi/__tests__/index.spec.ts (1 hunks)
  • packages/jest-helper/package.json (1 hunks)
  • packages/jest-helper/tsconfig.json (1 hunks)
  • packages/rollup-plugin-copy/index.js (1 hunks)
  • packages/rollup-plugin-copy/package.json (1 hunks)
  • packages/rollup-plugin-copy/tsconfig.json (1 hunks)
  • packages/taro-platform-harmony/package.json (1 hunks)
  • packages/taro-platform-harmony/rollup.config.ts (2 hunks)
  • packages/taro-platform-harmony/tsconfig.json (1 hunks)
  • packages/taro-plugin-mini-ci/.gitignore (0 hunks)
  • packages/taro-plugin-mini-ci/README.md (15 hunks)
  • packages/taro-plugin-mini-ci/index.js (0 hunks)
  • packages/taro-plugin-mini-ci/package.json (1 hunks)
  • packages/taro-plugin-mini-ci/tsconfig.json (1 hunks)
  • packages/taro-runner-utils/.gitignore (0 hunks)
  • packages/taro-runner-utils/package.json (1 hunks)
  • packages/taro-runner-utils/tsconfig.json (1 hunks)
  • packages/taro-service/.gitignore (0 hunks)
  • packages/taro-service/index.js (0 hunks)
  • packages/taro-service/package.json (2 hunks)
  • packages/taro-service/src/platform-plugin-base/platform.ts (1 hunks)
  • packages/taro-service/tsconfig.json (0 hunks)
  • packages/taro-transformer-wx/CHANGELOG.md (0 hunks)
  • packages/taro-transformer-wx/index.js (0 hunks)
  • packages/taro-transformer-wx/jest.config.ts (0 hunks)
  • packages/taro-transformer-wx/package.json (2 hunks)
  • packages/taro-transformer-wx/tsconfig.json (1 hunks)
  • packages/taroize/.gitignore (0 hunks)
  • packages/taroize/index.js (0 hunks)
  • packages/taroize/package.json (1 hunks)
  • packages/taroize/src/index.ts (1 hunks)
  • packages/taroize/tsconfig.json (1 hunks)
  • tests/jest.config.ts (1 hunks)
  • tests/package.json (1 hunks)
💤 Files with no reviewable changes (12)
  • packages/taro-transformer-wx/jest.config.ts
  • package.json
  • packages/taro-plugin-mini-ci/.gitignore
  • packages/taro-transformer-wx/index.js
  • packages/taro-service/.gitignore
  • packages/taro-service/tsconfig.json
  • packages/taro-runner-utils/.gitignore
  • packages/taroize/.gitignore
  • packages/taro-plugin-mini-ci/index.js
  • packages/taroize/index.js
  • packages/taro-transformer-wx/CHANGELOG.md
  • packages/taro-service/index.js
🧰 Additional context used
🧠 Learnings (23)
📓 Common learnings
Learnt from: ianzone
PR: NervJS/taro#17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
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/taro-runner-utils/tsconfig.json (3)
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: ianzone
PR: NervJS/taro#17842
File: packages/taro-components/project.json:4-8
Timestamp: 2025-06-21T21:23:03.650Z
Learning: In Nx 21, project.json targets don't necessarily require explicit "executor" and "options" fields like in earlier versions. A target can be defined with just "outputs" configuration, especially for custom build processes or when using implicit executors.
Learnt from: ianzone
PR: NervJS/taro#17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
packages/taro-plugin-mini-ci/tsconfig.json (1)
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/taro-platform-harmony/rollup.config.ts (1)
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/tsconfig.json (1)
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/rollup-plugin-copy/package.json (2)
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: ianzone
PR: NervJS/taro#17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
packages/taro-transformer-wx/tsconfig.json (3)
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: ianzone
PR: NervJS/taro#17842
File: packages/taro-components/project.json:4-8
Timestamp: 2025-06-21T21:23:03.650Z
Learning: In Nx 21, project.json targets don't necessarily require explicit "executor" and "options" fields like in earlier versions. A target can be defined with just "outputs" configuration, especially for custom build processes or when using implicit executors.
Learnt from: ianzone
PR: NervJS/taro#17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
packages/rollup-plugin-copy/tsconfig.json (1)
Learnt from: ianzone
PR: NervJS/taro#17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
packages/taro-platform-harmony/tsconfig.json (1)
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/index.ts (1)
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/jest-helper/package.json (2)
Learnt from: ianzone
PR: NervJS/taro#17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
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/taro-runner-utils/package.json (1)
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/taro-platform-harmony/package.json (1)
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 文件。
tests/package.json (2)
Learnt from: ianzone
PR: NervJS/taro#17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
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/package.json (1)
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/jest-helper/tsconfig.json (2)
Learnt from: ianzone
PR: NervJS/taro#17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
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/taro-transformer-wx/package.json (1)
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 文件。
.pnpmfile.cjs (2)
Learnt from: ianzone
PR: NervJS/taro#17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
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 文件。
tests/jest.config.ts (2)
Learnt from: ianzone
PR: NervJS/taro#17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
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/taro-plugin-mini-ci/package.json (1)
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/taro-service/package.json (1)
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/babel-plugin-transform-taroapi/__tests__/index.spec.ts (2)
Learnt from: ianzone
PR: NervJS/taro#17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
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/taro-plugin-mini-ci/README.md (2)
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: ianzone
PR: NervJS/taro#17842
File: packages/taro-components/project.json:4-8
Timestamp: 2025-06-21T21:23:03.650Z
Learning: In Nx 21, project.json targets don't necessarily require explicit "executor" and "options" fields like in earlier versions. A target can be defined with just "outputs" configuration, especially for custom build processes or when using implicit executors.
🪛 LanguageTool
packages/taro-plugin-mini-ci/README.md

[uncategorized] ~327-~327: 您的意思是“"需要"”吗?
Context: ...,生成方式同上 (privateKeyPath 和 privateKey 之间必须要填写其中一个;3.6.0 版本开始支持) | | ...

(XU7_XU8)

🔇 Additional comments (25)
packages/taro-plugin-mini-ci/tsconfig.json (1)

12-13: 确认已全局移除 types/ 引用
删除 declarationDir 后,声明文件将输出至 dist。请再次搜索并确认:

  1. package.jsontypes 字段、files 数组以及任何脚本不再引用 types/ 目录;
  2. CI 流程的清理、发布脚本没有残留 rm -rf types 等命令。
    避免遗漏造成构建或发布失败。
packages/taro-platform-harmony/package.json (1)

29-29: 构建脚本配置更新正确

将 rollup 配置文件从 .mts 改为 .ts 并移除 --bundleConfigAsCjs 标志是合理的简化,与其他配置文件的更改保持一致。

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

11-11: TypeScript 配置更新与其他文件保持一致

将 include 数组中的 rollup.config.mts 更新为 rollup.config.ts 与 package.json 中的脚本更改保持一致。

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

20-20: TypeScript 插件排除配置更新正确

将排除模式从 rollup.config.mts 更新为 rollup.config.ts 与文件扩展名的更改保持一致。


84-86: 保持配置一致性

otherConfig 中同样更新排除模式,确保所有 TypeScript 插件配置的一致性。

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

8-8: package.json 输出配置验证通过

已验证 packages/taro-transformer-wx/package.json 配置:

  • main 字段已更新为 "dist/src/index.js"
  • files 配置包含 "dist"

以上均符合预期,无需进一步修改。

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

8-8: 类型声明文件路径更新正确

types 字段更新为 dist/index.d.ts 与构建输出标准化保持一致。


10-10: 发布文件配置简化合理

files 数组简化为仅包含 dist 目录,与类型声明文件合并到统一输出目录的策略一致。

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

8-8: 类型声明配置简化

保留 declaration: true 的同时移除单独的 declarationDir 配置,使类型声明文件与编译输出统一生成到 dist 目录,简化了构建配置。

.pnpmfile.cjs (2)

7-8: Jest 依赖版本锁定改进

@stencil/core 包显式锁定 jestjest-cli 版本到 27.5.1,解决了该包不自行约束 Jest 版本可能导致的依赖冲突问题。


9-10: 完善 Jest 相关依赖版本管理

补充锁定 jest-runnerjest-environment-node 版本,确保整个 Jest 测试环境的版本一致性,有助于提高测试的稳定性和可重现性。

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

7-8: 构建输出标准化变更看起来正确

将主入口点和类型声明文件路径更新到 dist 目录,并简化 files 数组的配置是合理的。这些变更与整体的构建输出标准化保持一致。

Also applies to: 17-17

packages/taro-plugin-mini-ci/package.json (1)

12-13: 构建配置标准化改进

typings 字段重命名为 types(更标准的字段名)并将所有路径更新到 dist 目录是很好的改进。这些变更与整体的包结构标准化保持一致。

Also applies to: 15-15

packages/taro-plugin-mini-ci/README.md (1)

3-3: 文档格式化改进

这些文档格式化改进提高了可读性和一致性,包括:

  • 标准化中文文本中的空格使用
  • 统一英文单词和标点符号周围的间距
  • 改进代码示例中的注释格式
  • 增强配置选项描述的一致性

这些变更不影响插件功能,纯粹是文档质量的提升。

Also applies to: 18-18, 25-25, 33-33, 39-39, 43-43, 57-57, 61-61, 76-76, 81-81, 85-85, 111-111, 113-113, 117-117, 139-139, 143-143, 150-150, 152-152, 173-173, 177-177, 281-281, 289-289, 290-290, 291-291, 292-292, 293-293, 326-326, 327-327, 328-328, 329-329, 366-366, 367-367, 377-377, 397-397, 399-399, 401-401, 403-403, 405-405, 409-409, 411-411, 425-425, 437-437, 483-483, 490-490, 492-492, 494-494, 496-496, 500-500, 516-516, 522-522, 530-530

packages/taroize/tsconfig.json (1)

5-5: 构建输出目录标准化

outDirlib 更改为 dist 与整体的包结构标准化保持一致,确保 TypeScript 编译输出与 package.json 中更新的入口点路径匹配。

tests/package.json (1)

17-17: 依赖添加正确

添加 jest-taro-helper 工作空间依赖与其他文件中的重构变更保持一致,支持测试配置中对快照序列化器的引用。

packages/rollup-plugin-copy/tsconfig.json (2)

6-6: 输出目录标准化正确

将输出目录从 lib 改为 dist 符合此次清理的统一标准。


10-10: 简化包含配置合理

移除测试目录排除配置并简化为仅包含 ./src,与其他包的配置保持一致。

packages/rollup-plugin-copy/index.js (1)

1-1: 入口文件路径更新正确

将模块引用路径从 ./lib/index.js 更新为 ./dist/index.js,与 tsconfig.json 中的输出目录变更保持一致。

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

9-9: 文件发布配置更新正确

将发布文件从 lib 更新为 dist 目录,与构建输出目录变更保持一致。


14-14: 清理脚本更新正确

将清理脚本目标目录从 ./lib 更新为 ./dist,与新的构建输出目录匹配。

tests/jest.config.ts (1)

12-12: 快照序列化器路径更新正确

将快照序列化器路径从 jest-taro-helper/lib/snapshot/serializers.js 更新为 jest-taro-helper/dist/snapshot/serializers.js,与 jest-helper 包的构建输出目录变更保持同步。

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

5-6: 编译产物目录统一到 dist 👍

outDir 改为 dist 并删除对 __tests__ 目录的排除,与本次仓库范围的目录统一保持一致,且 jest-helper 本身并无测试目录,不会引入意外文件。变更符合预期。

Also applies to: 9-9

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

10-11: 脚本与 files 字段同步到 dist

filesclean 均改指向 dist,与 tsconfig 输出一致,避免后续发布缺文件或清理不到位的问题,变更正确。

Also applies to: 15-15

packages/babel-plugin-transform-taroapi/__tests__/index.spec.ts (1)

5-6: 导入本地 mock JSON,需确保 tsconfig.resolveJsonModule 已开启

import * as definition from './__mocks__/h5-definition.json' 依赖 TypeScript resolveJsonModuleesModuleInterop。请确认包或根级 tsconfig.json 中已显式设置这两个编译选项,否则 ts-jest 在 CI 下可能因无法解析 JSON 导致构建失败。

@coderabbitai coderabbitai bot requested a review from luckyadam June 28, 2025 08:42
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: 1

🧹 Nitpick comments (1)
packages/taro-platform-h5/scripts/post-build.mjs (1)

12-24: 修复格式问题并改善错误信息

脚本的核心逻辑正确,但需要修复一些格式问题:

 try {
   // 读取源文件内容
   const sourceContent = readFileSync(sourceFileDist, 'utf8')
 
   // 写入目标文件
   writeFileSync(targetFile, sourceContent, 'utf8')
 
   console.log('✅ 成功将definition.json内容覆盖到h5-definition.json')
-
 } catch (error) {
-  console.error('❌ 脚本执行失败:', error.message)
+  console.error('❌ 脚本执行失败:', error.message)
   process.exit(1)
 }
+

注意:在构建脚本中使用 console 语句是合理的,尽管 ESLint 有警告。

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a159c7f and 6f3b270.

⛔ Files ignored due to path filters (6)
  • packages/taroize/__tests__/__snapshots__/index.test.ts.snap is excluded by !**/*.snap
  • packages/taroize/__tests__/__snapshots__/script.test.ts.snap is excluded by !**/*.snap
  • packages/taroize/__tests__/__snapshots__/template.test.ts.snap is excluded by !**/*.snap
  • packages/taroize/__tests__/__snapshots__/utils.test.ts.snap is excluded by !**/*.snap
  • packages/taroize/__tests__/__snapshots__/wxml.test.ts.snap is excluded by !**/*.snap
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • packages/taro-platform-h5/package.json (1 hunks)
  • packages/taro-platform-h5/scripts/post-build.mjs (1 hunks)
  • packages/taroize/__tests__/event.test.ts (3 hunks)
  • packages/taroize/__tests__/index.test.ts (2 hunks)
  • packages/taroize/__tests__/script.test.ts (11 hunks)
  • packages/taroize/__tests__/template.test.ts (15 hunks)
  • packages/taroize/__tests__/util.ts (2 hunks)
  • packages/taroize/__tests__/utils.test.ts (5 hunks)
  • packages/taroize/__tests__/wxml.test.ts (35 hunks)
✅ Files skipped from review due to trivial changes (7)
  • packages/taro-platform-h5/package.json
  • packages/taroize/tests/util.ts
  • packages/taroize/tests/utils.test.ts
  • packages/taroize/tests/script.test.ts
  • packages/taroize/tests/template.test.ts
  • packages/taroize/tests/wxml.test.ts
  • packages/taroize/tests/event.test.ts
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: ianzone
PR: NervJS/taro#17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
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/__tests__/index.test.ts (2)
Learnt from: ianzone
PR: NervJS/taro#17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
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/taro-platform-h5/scripts/post-build.mjs (2)
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: ianzone
PR: NervJS/taro#17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
🪛 ESLint
packages/taro-platform-h5/scripts/post-build.mjs

[error] 1-3: Run autofix to sort these imports!

(simple-import-sort/imports)


[error] 1-1: 'existsSync' is defined but never used.

(@typescript-eslint/no-unused-vars)


[error] 19-19: Unexpected console statement.

(no-console)


[error] 19-21: Block must not be padded by blank lines.

(padded-blocks)


[error] 24-24: Newline required at end of file but not found.

(eol-last)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
  • GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
  • GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
🔇 Additional comments (4)
packages/taroize/__tests__/index.test.ts (2)

36-37: 格式化改进很好

在中文字符和关键词周围添加空格提高了代码可读性,与其他测试文件的格式化保持一致。


1-1: 确认导入方式一致

  • packages/taroize/src/index.ts 中已将 parse 声明为 export default function parse
  • 测试文件 packages/taroize/tests/index.test.ts 以 import parse from '../src' 引入默认导出,符合源码导出方式
  • 整个仓库中未发现其他使用命名导入 parse 的情况

第 36–37 行的中文空格优化仅为可读性调整,无需改动。

packages/taro-platform-h5/scripts/post-build.mjs (2)

5-6: ES 模块兼容性处理正确

这是在 ES 模块中获取 __dirname 的标准做法,实现正确。


8-10: 文件路径定义正确

源文件和目标文件的路径定义准确,符合将构建输出复制到测试 mock 文件的需求。

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: 0

♻️ Duplicate comments (2)
packages/taro-platform-h5/scripts/post-build.mjs (2)

12-17: 读取源文件前缺少存在性检查,运行时易崩溃

dist/definition.json 尚未生成或路径错误时,readFileSync 会直接抛错导致脚本异常退出。建议先判断文件是否存在并给出友好提示。

-  // 读取源文件内容
-  const sourceContent = readFileSync(sourceFileDist, 'utf8')
+  // 检查源文件是否存在
+  if (!existsSync(sourceFileDist)) {
+    throw new Error(`源文件不存在: ${sourceFileDist}`)
+  }
+  // 读取源文件内容
+  const sourceContent = readFileSync(sourceFileDist, 'utf8')

1-3: 按 ESLint 要求调整导入顺序,并补充 existsSync 依赖

simple-import-sort 报错说明当前导入顺序不符合规范,同时缺少文件存在性检查所需的 existsSync。建议一起修复:

  1. 先按字母顺序排列同一行中的导入成员;
  2. 引入 existsSync 以便后续文件读写前做安全检查。
-import { readFileSync, writeFileSync } from 'fs'
-import { resolve, dirname } from 'path'
-import { fileURLToPath } from 'url'
+import { existsSync, readFileSync, writeFileSync } from 'fs'
+import { dirname, resolve } from 'path'
+import { fileURLToPath } from 'url'
🧹 Nitpick comments (2)
packages/taro-platform-h5/scripts/post-build.mjs (2)

19-22: console 调用违反仓库 ESLint 规则

no-console 已提示不可直接使用 console.log / console.error。如日志信息确属必要,可:

  1. 使用 process.stderr.write / process.stdout.write
  2. 或在文件顶部添加 /* eslint-disable no-console */ 注释,并附上理由。

请根据团队规范做取舍。


24-24: 文件末尾缺失换行符

缺少 EOF 换行会触发 eol-last 规则,影响 diff 可读性。补上一行空行即可。

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6f3b270 and 4301760.

📒 Files selected for processing (1)
  • packages/taro-platform-h5/scripts/post-build.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: ianzone
PR: NervJS/taro#17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
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/taro-platform-h5/scripts/post-build.mjs (5)
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: ianzone
PR: NervJS/taro#17842
File: packages/jest-helper/tsconfig.json:9-9
Timestamp: 2025-06-23T00:09:31.233Z
Learning: 在 jest-helper 包中,src 目录下没有 __tests__ 测试目录,只包含 resolver.ts、sequencer.ts 和 snapshot 目录。不要假设包中存在测试目录结构。
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 添加超时机制来解决这个问题。
🪛 ESLint
packages/taro-platform-h5/scripts/post-build.mjs

[error] 1-3: Run autofix to sort these imports!

(simple-import-sort/imports)


[error] 19-19: Unexpected console statement.

(no-console)


[error] 19-21: Block must not be padded by blank lines.

(padded-blocks)


[error] 24-24: Newline required at end of file but not found.

(eol-last)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Build Rust Binding / stable - aarch64-apple-darwin
  • GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
  • GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc

@codecov
Copy link

codecov bot commented Jun 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.98%. Comparing base (d93fa03) to head (9de3182).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #17910      +/-   ##
==========================================
- Coverage   55.90%   54.98%   -0.92%     
==========================================
  Files         417      417              
  Lines       21693    21693              
  Branches     5376     5369       -7     
==========================================
- Hits        12127    11928     -199     
- Misses       7935     8082     +147     
- Partials     1631     1683      +52     
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/index.ts 100.00% <100.00%> (ø)

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

@ianzone
Copy link
Contributor Author

ianzone commented Jun 28, 2025

@yoyo837 这个合了就去解决 taro/components 相关的问题,然后就可以添加 nx 了

@coderabbitai coderabbitai bot requested a review from yoyo837 June 28, 2025 10:44
@yoyo837
Copy link
Contributor

yoyo837 commented Jun 28, 2025

看下taro-components/dist下编译的有idnex-[hash].js这种,是不是上个PR就不对

@ianzone
Copy link
Contributor Author

ianzone commented Jun 28, 2025

看下taro-components/dist下编译的有idnex-[hash].js这种,是不是上个PR就不对

上个PR之前的构建就有哈希啊
image
image

@ianzone
Copy link
Contributor Author

ianzone commented Jun 28, 2025

看下taro-components/dist下编译的有idnex-[hash].js这种,是不是上个PR就不对

我说的问题是指与 taro-components 相关的循环依赖问题

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