Skip to content
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

fix: __webpack_public_path__ and __mako_public_path__ should not be replaced when it's defined by user #1442

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

sorrycc
Copy link
Member

@sorrycc sorrycc commented Jul 23, 2024

#1441 的后续。

Summary by CodeRabbit

  • 新特性

    • 更新了 PublicPathAssignment 结构以包含新的 unresolved_mark 字段,增强了对特定赋值表达式的处理逻辑。
    • 改进了对 __webpack_public_path____mako_public_path__ 的识别条件,提升了公共路径赋值的准确性。
    • 添加了新的测试用例 test_ident_defined,确保赋值表达式处理的正确性。
  • 修复

    • 改进了公共路径转换的控制流,确保在处理时考虑到 unresolved_mark 的上下文。

Copy link
Contributor

coderabbitai bot commented Jul 23, 2024

Walkthrough

此次更改引入了 unresolved_mark 字段至 PublicPathAssignment 结构体,并在 Transform 实现中更新了该结构体的实例化方式。此更新增强了对特定赋值表达式的处理逻辑,使其能够更准确地识别和管理公共路径赋值。通过引入新的测试用例,确保了相关功能的正确性和稳定性。

Changes

文件路径 更改摘要
crates/mako/src/build/transform.rs
crates/mako/src/visitors/public_path_assignment.rs
PublicPathAssignment 结构体新增 unresolved_mark 字段,并在实例化时传入该参数;改进了赋值表达式处理逻辑,增加了新测试用例以验证功能。

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.

@sorrycc sorrycc merged commit 37450e3 into master Jul 23, 2024
8 checks passed
Copy link
Contributor

@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 f28922b and b1dc14c.

Files selected for processing (2)
  • crates/mako/src/build/transform.rs (1 hunks)
  • crates/mako/src/visitors/public_path_assignment.rs (2 hunks)
Additional comments not posted (5)
crates/mako/src/visitors/public_path_assignment.rs (4)

1-1: 导入 Mark 是必要的。

为了支持新的 unresolved_mark 字段,导入 Mark 是合理的。


6-8: 新增字段 unresolved_mark 是合理的。

该字段的添加使结构体能够处理未解析的标记上下文,这对于正确转换公共路径至关重要。


15-17: 更新的逻辑是合理的。

此更改确保了 __webpack_public_path____mako_public_path__ 的赋值表达式仅在未解析上下文中进行转换,从而防止意外替换。


49-67: 新增的测试用例是合理的。

新测试用例 test_ident_defined 确保了当标识符由用户定义时,赋值表达式能够正确处理。

crates/mako/src/build/transform.rs (1)

135-135: 实例化 PublicPathAssignment 时传递 unresolved_mark 是合理的。

此更改确保 PublicPathAssignment 具有未解析标记上下文的访问权限,这对于其功能至关重要。

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.

1 participant