Skip to content

refactory: in str-impl chunk generate, remove cm when merge_code_and_sourcemap#1541

Merged
stormslowly merged 2 commits intomasterfrom
refactory/str_impl_source_generate_segregation_from_cm
Aug 29, 2024
Merged

refactory: in str-impl chunk generate, remove cm when merge_code_and_sourcemap#1541
stormslowly merged 2 commits intomasterfrom
refactory/str_impl_source_generate_segregation_from_cm

Conversation

@stormslowly
Copy link
Contributor

@stormslowly stormslowly commented Aug 28, 2024

rm cm parameter from merge_code_and_sourcemap
for future usage, a module has an owner cm.

Summary by CodeRabbit

  • 新功能

    • 更新了JavaScript代码块渲染过程中的源映射处理,采用了更结构化的RawSourceMap类型。
  • 修复错误

    • 修正了源映射处理的逻辑,确保数据流和类型定义的一致性。
  • 文档

    • 更新了测试用例,以反映新的源映射处理方式,确保集成的完整性。

@coderabbitai
Copy link

coderabbitai bot commented Aug 28, 2024

Walkthrough

此次更改涉及JavaScript块渲染过程中源映射的处理。主要修改包括将EmittedWithMapping类型从包含BytePosLineCol的元组更改为使用RawSourceMap,使源映射的表示更加结构化。相关函数的实现也进行了调整,以确保与新类型定义的一致性,同时更新了测试以验证新处理方式的正确性。

Changes

文件路径 更改摘要
crates/mako/src/generate/chunk_pot/str_impl.rs EmittedWithMapping类型从元组更改为RawSourceMap,并更新相关函数以适应新类型,同时调整测试以确保新实现的正确性。

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?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 71f85e1 and e37b28b.

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_mappingscm 参数生成 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_bufcm 参数生成 RawSourceMap,确保与新类型定义的一致性。

代码更改已批准。

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e37b28b and 4cbcc4b.

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 的类型从包含 BytePosLineCol 的元组更改为使用 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
Copy link

codecov bot commented Aug 28, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 60.83%. Comparing base (71f85e1) to head (4cbcc4b).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
crates/mako/src/generate/chunk_pot/str_impl.rs 80.00% 4 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

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