Skip to content

Conversation

@tutuxxx
Copy link
Member

@tutuxxx tutuxxx commented Oct 14, 2025

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

解决jsvm debugger能力sourcemap映射问题

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

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

这个 PR 涉及以下平台:

  • 所有平台
  • Web 端(H5)
  • 移动端(React-Native)
  • [✅ ] 鸿蒙(Harmony)
  • 鸿蒙容器(Harmony Hybrid)
  • ASCF 元服务
  • 快应用(QuickApp)
  • 所有小程序
  • 微信小程序
  • 企业微信小程序
  • 京东小程序
  • 百度小程序
  • 支付宝小程序
  • 支付宝 IOT 小程序
  • 钉钉小程序
  • QQ 小程序
  • 飞书小程序
  • 快手小程序
  • 头条小程序

Summary by CodeRabbit

  • 新功能
    • 在构建过程中启用 Babel 转换的 sourceMap 生成功能:构建产物包含更精确的映射信息,断点、错误堆栈与控制台行号更准确地映射回原始源码,提升调试与定位问题的效率。

@coderabbitai
Copy link

coderabbitai bot commented Oct 14, 2025

Walkthrough

在 Harmony 路径的 Babel 转换逻辑中,为同步与异步两条转换分支的 Babel 选项统一加入了 sourceMaps: true,以启用 Babel 转换的源映射生成;控制流、错误处理和导出签名未作变更。

Changes

Cohort / File(s) Change Summary
Harmony Babel Source Maps
packages/taro-vite-runner/src/harmony/babel.ts
transformSynctransformAsync 的选项中新增 sourceMaps: true,使 Babel 返回源映射(map);未改动控制流、错误处理或导出接口。

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Dev as 开发者
    participant ViteRunner as Vite Runner (Harmony)
    participant Babel as Babel

    Dev->>ViteRunner: 请求代码转换
    ViteRunner->>Babel: transformSync/transformAsync(opts + sourceMaps: true)
    note right of Babel: Babel 生成 { code, map }
    Babel-->>ViteRunner: 返回 { code, map }
    ViteRunner-->>Dev: 返回转换结果与源映射

    rect rgba(198,239,206,0.20)
    note over Babel: 新增:启用 sourceMaps 输出
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • 重点检查:packages/taro-vite-runner/src/harmony/babel.ts 中两处分支选项的一致性,以及调用方对返回 map 字段的兼容性。

Poem

田间代码细细描,🐇
加入小图寻旧路;
同步异步同携带,
调试步步更明了,
兔子轻跳唱欢愉。

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 标题清晰地概括了主要变更,即修复 jsvm debugger 中的 sourcemap 映射问题,与文件改动(添加 sourceMaps: true)完全对应。
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/harmony-debugger

📜 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 d36a73a and 25e320e.

📒 Files selected for processing (1)
  • packages/taro-vite-runner/src/harmony/babel.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/taro-vite-runner/src/harmony/babel.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
  • GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-gnu
  • GitHub Check: Build Rust Binding / stable - x86_64-unknown-linux-musl
  • GitHub Check: Build Rust WASM / stable - wasm32-wasi
  • GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
  • GitHub Check: Build Rust WASM / stable - wasm32-wasi

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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

🧹 Nitpick comments (1)
packages/taro-vite-runner/src/harmony/babel.ts (1)

11-11: 建议:为插件指定有意义的名称。

当前插件名称为空字符串,建议为其指定一个有意义的名称(如 'taro:harmony-babel-transform'),这样在调试 Vite 插件链时更容易识别和追踪。

可以应用以下 diff:

-    name: '',
+    name: 'taro:harmony-babel-transform',
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1414e3d and 30404e8.

📒 Files selected for processing (1)
  • packages/taro-vite-runner/src/harmony/babel.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • 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
  • GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
🔇 Additional comments (3)
packages/taro-vite-runner/src/harmony/babel.ts (3)

17-17: 正确启用了源映射生成。

为同步转换添加 sourceMaps: true 配置是正确的,这将使 Babel 生成源映射信息,配合第 63 行的 map: result?.map || null 返回语句,可以正确地为调试器提供源码映射。


79-79: 正确启用了源映射生成,保持了一致性。

为异步转换添加 sourceMaps: true 配置与同步转换保持了一致,确保两个转换分支都能生成源映射。这将解决 jsvm debugger 的源映射问题。


17-17: 验证源映射是否正确生成。

虽然添加 sourceMaps: true 的改动在逻辑上是正确的,但建议验证以下几点以确保源映射功能正常工作:

  1. 确认 Babel 转换后确实生成了有效的源映射对象
  2. 验证调试器能够正确使用生成的源映射进行代码定位
  3. 测试在 Harmony 平台上的实际调试场景

可以通过以下方式进行验证:

  1. 在开发环境中启用该修复,查看生成的构建产物是否包含 sourcemap 文件
  2. 使用 jsvm debugger 设置断点,验证是否能正确定位到源代码位置
  3. 检查 result?.map 是否不为 null,可以添加临时日志进行确认

Also applies to: 79-79

@codecov
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.97%. Comparing base (9e7250a) to head (25e320e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #18475   +/-   ##
=======================================
  Coverage   55.97%   55.97%           
=======================================
  Files         416      416           
  Lines       21563    21563           
  Branches     5260     5276   +16     
=======================================
  Hits        12070    12070           
+ Misses       7913     7878   -35     
- Partials     1580     1615   +35     
Flag Coverage Δ
taro-cli 72.85% <ø> (ø)
taro-runtime 59.87% <ø> (ø)
taro-web 53.12% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 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.

This was referenced Oct 18, 2025
@Single-Dancer Single-Dancer merged commit 2acec67 into main Nov 5, 2025
39 checks passed
@Single-Dancer Single-Dancer deleted the fix/harmony-debugger branch November 5, 2025 03:47
This was referenced Nov 8, 2025
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.

3 participants