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(bundler-mako): config mako.plugins should work #1400

Merged
merged 2 commits into from
Jul 11, 2024
Merged

Conversation

sorrycc
Copy link
Member

@sorrycc sorrycc commented Jul 11, 2024

ref:
https://github.com/ant-design/ant-design/actions/runs/9886514323/job/27306524583?pr=49821

Summary by CodeRabbit

  • 新功能

    • 动态加载内容功能:基于文件路径内容动态加载,路径以 'foo.bar' 结尾时返回 JSX 组件内容。
  • 代码优化

    • 合并 changelogPaths 声明为单行,并更新迭代语法。

Copy link
Contributor

coderabbitai bot commented Jul 11, 2024

Warning

Review failed

The pull request is closed.

Walkthrough

此次更新主要涉及动态加载内容的功能,特别是当路径以 foo.bar 结尾时返回组件的 JSX 内容。此外,还对 mako 配置处理进行了调整,删除了多余的插件配置和简化了变更日志文件的路径声明。

Changes

文件路径 变更摘要
e2e/fixtures.umi/config.mako.plugins/.umirc.ts 添加了支持动态加载内容的功能,当路径以 foo.bar 结尾时返回 JSX 内容。
e2e/fixtures.umi/config.mako.plugins/expect.js 新增一行注释 // keep
e2e/fixtures.umi/config.mako.plugins/pages/foo.bar 添加注释,指示某内容应通过加载钩子处理。
e2e/fixtures.umi/config.mako.plugins/pages/index.tsx 导出函数 App,记录加载 foo.bar 文件结果并返回简单 JSX 元素。
packages/bundler-mako/index.js 1. checkConfig 函数中增加了对 plugins 的支持。
2. 从 getMakoConfig 函数中移除了 makoPlugins 解构。
3. 设置 lessLoader 对象的 plugins 为空数组。
scripts/format-changelog.ts 合并了 changelogPaths 的声明,并更新了 forEach 语法。

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 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.

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

Outside diff range, codebase verification and nitpick comments (1)
e2e/fixtures.umi/config.mako.plugins/pages/index.tsx (1)

2-3: 建议使用动态导入。

使用 require 语句可能不是在现代代码库中进行动态导入的最佳方式。建议使用 import() 以提高可维护性和性能。

export default async function App() {
  const module = await import('./foo.bar');
  console.log(module);
  return <div>123456</div>;
}
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 20d5762 and a583a78.

Files selected for processing (5)
  • e2e/fixtures.umi/config.mako.plugins/.umirc.ts (1 hunks)
  • e2e/fixtures.umi/config.mako.plugins/expect.js (1 hunks)
  • e2e/fixtures.umi/config.mako.plugins/pages/foo.bar (1 hunks)
  • e2e/fixtures.umi/config.mako.plugins/pages/index.tsx (1 hunks)
  • packages/bundler-mako/index.js (3 hunks)
Files skipped from review due to trivial changes (2)
  • e2e/fixtures.umi/config.mako.plugins/expect.js
  • e2e/fixtures.umi/config.mako.plugins/pages/foo.bar
Additional comments not posted (4)
e2e/fixtures.umi/config.mako.plugins/pages/index.tsx (1)

4-4: JSX 渲染看起来不错。

渲染一个简单的 JSX 元素,如果符合需求,可以接受。

e2e/fixtures.umi/config.mako.plugins/.umirc.ts (2)

6-13: 确保 load 函数的正确性。

该函数处理以 'foo.bar' 结尾的文件路径,返回内容和类型。请确保此逻辑符合预期。


17-17: mfsu 属性设置看起来不错。

mfsu 设置为 false,如果这是预期行为,可以接受。

packages/bundler-mako/index.js (1)

243-243: 验证 supportMakoConfigKeys 数组的更改。

将 'plugins' 添加到 supportMakoConfigKeys 数组中,确保配置接受 plugins 数组。请验证该更改的正确性。

@sorrycc sorrycc merged commit ec08907 into master Jul 11, 2024
5 checks passed
@sorrycc sorrycc deleted the sorrycc-6m2m branch August 9, 2024 03:35
@coderabbitai coderabbitai bot mentioned this pull request Sep 12, 2024
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