refactory: in str-impl chunk generate, remove cm when merge_code_and_sourcemap#1541
Conversation
Walkthrough此次更改涉及JavaScript块渲染过程中源映射的处理。主要修改包括将 Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- crates/mako/src/generate/chunk_pot/str_impl.rs (8 hunks)
Additional comments not posted (8)
crates/mako/src/generate/chunk_pot/str_impl.rs (8)
9-9: 导入声明已更新导入
SourceMap是必要的,以支持文件中的更改。代码更改已批准。
150-150: 类型定义已更新将
EmittedWithMapping类型更改为使用RawSourceMap而不是元组,改进了源映射的结构和清晰度。代码更改已批准。
190-191: 函数实现已更新
build_source_map函数现在直接使用source_mappings和cm参数生成RawSourceMap,确保与新类型定义的一致性。代码更改已批准。
201-201: 返回语句已更新函数现在返回
Some(source_map.into()),确保新RawSourceMap类型正确集成到返回值中。代码更改已批准。
239-239: 函数实现已更新函数现在以
Result<Vec<(String, Option<RawSourceMap>)>>的形式收集结果,确保数据流与更新的类型定义保持一致。代码更改已批准。
251-251: 函数参数已更新
cm参数已被移除,简化了函数签名,并与新的模块所有权结构保持一致。代码更改已批准。
257-257: 函数实现已更新函数现在使用
into_iter()处理modules_with_sourcemap向量,促进所有权转移并提高效率。代码更改已批准。
446-447: 函数实现已更新
build_source_map函数现在直接使用source_map_buf和cm参数生成RawSourceMap,确保与新类型定义的一致性。代码更改已批准。
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- crates/mako/src/generate/chunk_pot/str_impl.rs (7 hunks)
Additional comments not posted (4)
crates/mako/src/generate/chunk_pot/str_impl.rs (4)
149-149: 类型定义更新:
EmittedWithMapping的类型从包含BytePos和LineCol的元组更改为使用RawSourceMap,这有助于提高源映射处理的清晰度和可维护性。
Line range hint
189-200: 函数emit_module_with_mapping使用cm参数:根据 PR 的目标,预期是删除
cm参数。请确认此函数中cm的使用是否必要,或是否有遗漏未删除的情况。
238-241: 函数pot_to_chunk_module_object_string更新:此函数已正确更新以处理新的
RawSourceMap类型。集成看起来顺畅且处理得当。
253-282: 函数merge_code_and_sourcemap更新:此函数已根据 PR 的目标成功地移除了
cm参数,并使用了新的RawSourceMap类型。重构看起来效率高且清晰。
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1541 +/- ##
==========================================
+ Coverage 60.78% 60.83% +0.04%
==========================================
Files 126 126
Lines 15028 15024 -4
==========================================
+ Hits 9135 9140 +5
+ Misses 5893 5884 -9 ☔ View full report in Codecov by Sentry. |
rm
cmparameter from merge_code_and_sourcemapfor future usage, a module has an owner cm.
Summary by CodeRabbit
新功能
RawSourceMap类型。修复错误
文档