-
Notifications
You must be signed in to change notification settings - Fork 4.9k
fix(debugger): 解决jsvm debugger能力sourcemap映射问题 #18475
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
Conversation
Walkthrough在 Harmony 路径的 Babel 转换逻辑中,为同步与异步两条转换分支的 Babel 选项统一加入了 Changes
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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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)
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. Comment |
There was a problem hiding this 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
📒 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的改动在逻辑上是正确的,但建议验证以下几点以确保源映射功能正常工作:
- 确认 Babel 转换后确实生成了有效的源映射对象
- 验证调试器能够正确使用生成的源映射进行代码定位
- 测试在 Harmony 平台上的实际调试场景
可以通过以下方式进行验证:
- 在开发环境中启用该修复,查看生成的构建产物是否包含 sourcemap 文件
- 使用 jsvm debugger 设置断点,验证是否能正确定位到源代码位置
- 检查
result?.map是否不为null,可以添加临时日志进行确认Also applies to: 79-79
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
30404e8 to
3ff003e
Compare
3ff003e to
d36a73a
Compare
d36a73a to
25e320e
Compare
这个 PR 做了什么? (简要描述所做更改)
解决jsvm debugger能力sourcemap映射问题
这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台:
Summary by CodeRabbit