Skip to content

fix(pack): napi types for module.rules - #2470

Merged
fireairforce merged 1 commit into
nextfrom
update-loader-types
Dec 30, 2025
Merged

fix(pack): napi types for module.rules#2470
fireairforce merged 1 commit into
nextfrom
update-loader-types

Conversation

@fireairforce

Copy link
Copy Markdown
Member

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @fireairforce, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求主要更新了 pack 系统中 module.rules 的 NAPI (Native API) TypeScript 类型定义。这些更改旨在使类型结构与 Turbopack 支持的高级加载器条件对齐,如 Next.js 文档中所述。这涉及对规则配置和条件定义方式的重大重构,增强了加载器规则的灵活性和表达能力。

Highlights

  • 更新 Turbopack NAPI 类型: 重构 TurbopackRuleConfigItemTurbopackRuleCondition,使其与 Turbopack 中的高级加载器条件对齐,支持复杂的逻辑条件和内置条件。
  • 重构 JSONValueTurbopackLoaderOptions: 改进加载器选项的类型定义,确保 JSON 可序列化。
  • VS Code 配置: 在 .vscode/settings.json 中为 TypeScript 文件添加了默认格式化程序。

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

这个 PR 更新了 Turbopack module.rules 的 TypeScript 类型定义,以支持更高级的加载器条件,这与 Next.js 的文档保持了一致。这是一个很好的改进,使得类型更加精确和强大。

我发现 packages/pack-shared/src/config.ts 中的类型定义可能不完整。根据 Rust 核心代码,module.rules 的值除了支持对象形式外,还支持加载器数组的快捷方式。当前的类型似乎遗漏了对这种快捷方式的支持。我在具体的审查评论中提出了修改建议,以使类型定义与后端实现完全匹配。

Comment thread packages/pack-shared/src/config.ts
@fireairforce
fireairforce merged commit 411e526 into next Dec 30, 2025
21 checks passed
@fireairforce
fireairforce deleted the update-loader-types branch December 30, 2025 09:00
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