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: dynamic import can not resolve part of filename tpl #1224

Merged
merged 7 commits into from
Jun 20, 2024

Conversation

Jinbao1001
Copy link
Member

@Jinbao1001 Jinbao1001 commented May 30, 2024

close #1215

Summary by CodeRabbit

  • 功能更新
    • context_module.rs文件中增加了一些新功能,包括导入std::fsstd::path::Path,更新了ContextModulePlugin实现中的键和元数据处理,修改了try_replace_context_arg函数中处理前缀和后缀的逻辑,以及新增了has_index_file_in_directory函数用于检查目录中是否存在索引文件。

Copy link
Contributor

coderabbitai bot commented May 30, 2024

Walkthrough

本次更改涉及mako crates中的几个模块。常量JS_EXTENSIONS现在已被公开,并且在context_module.rs文件中添加了新的函数和修改。动态引入模块的路径和文件扩展名已经更新,影响了代码库中的模块加载行为。

改动

文件 改动摘要
crates/mako/src/build/load.rs JS_EXTENSIONS常量由私有改为公共。
crates/mako/src/plugins/context_module.rs 添加了新函数并更新了插件实现逻辑。
e2e/fixtures/javascript.require-dynamic/expect.js 更新了动态引入模块的路径和文件扩展名。
e2e/fixtures/javascript.require-dynamic/src/index.ts 添加了新函数,并更新了现有函数中的路径。

诗歌

公开常量新风貌,路径修改兴风貌。
插件函数更精彩,动态引入别来高。
程序如诗般妙,改动似人间好。


Note

Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://coderabbit.ai

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 Configration 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
Copy link
Member

sorrycc commented May 30, 2024

补充下问题描述?

@Jinbao1001
Copy link
Member Author

Jinbao1001 commented May 30, 2024

补充下问题描述?

#1215

@@ -244,7 +252,6 @@ fn try_replace_context_arg(
suffix = Some(raw.to_string());
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你的 PR 怎么总是删空行 👀

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

下次注意...

crates/mako/src/plugins/context_module.rs Show resolved Hide resolved
@stormslowly stormslowly merged commit a35f648 into master Jun 20, 2024
8 checks passed
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.

[BUG] dynamic import 解析模版字符存在问题
5 participants