Skip to content

Conversation

@guoyunhe
Copy link
Contributor

@guoyunhe guoyunhe commented Nov 26, 2025

兼容旧的 /lib//es/ import 用法

Summary by CodeRabbit

发布说明

  • 新增功能
    • 扩展了包导出路径,现在支持从./lib和./es目录下直接导入多个子模块(包括生成器、接口和区域配置),提供更灵活便捷的导入方式和更多模块组织选项。

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Nov 26, 2025

@guoyunhe is attempting to deploy a commit to the React Component Team on Vercel.

A member of the Team first needs to authorize it.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @guoyunhe, 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!

This pull request enhances the package's compatibility by extending the exports field within package.json. The update specifically introduces mappings for /lib/ and /es/ paths for various modules, allowing existing consumers to continue using their current import statements without disruption. This change is crucial for maintaining stability and preventing breaking changes for users relying on previous module resolution patterns.

Highlights

  • Backwards Compatibility: Added new exports configurations in package.json to ensure compatibility with older import paths like /lib/ and /es/ for modules such as generate, interface, and locale.
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.

@coderabbitai
Copy link

coderabbitai bot commented Nov 26, 2025

Walkthrough

package.json 中的导出映射得到扩展,新增了针对 ./lib./es 分组下 generate、interface 和 locale 模块的多条公共导出路径,并为每条路径配置了对应的类型、导入和 require 映射。现有导出保持不变。

Changes

内聚群组 / 文件 变更总结
导出路径配置
package.json
新增 8 条导出路径:./lib/generate./lib/generate/*./lib/interface./lib/locale/*./es/generate./es/generate/*./es/interface./es/locale/*,每条路径均包含 types、import 和 require 映射

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • 变更仅涉及 package.json 配置,无运行时逻辑改动
  • 遵循现有导出映射的一致性模式
  • 需验证所有导出路径映射正确无误

Possibly related PRs

  • feat: support exports #951: 该 PR 同样修改 package.json 的导出映射,为 generate/interface/locale 添加子路径导出,与本 PR 触及相同的导出配置区域

Suggested reviewers

  • zombieJ

Poem

🐰 导出地图又扩大,
lib 和 es 都照顾,
生成、接口、地域齐,
模块化之路更宽阔!✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding new export paths to package.json for backwards compatibility, which matches the actual changes made.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7e39aa1 and 25d1d6c.

📒 Files selected for processing (1)
  • package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Socket Security: Pull Request Alerts
  • GitHub Check: test / react component workflow
🔇 Additional comments (2)
package.json (2)

20-79: 导出重复是有意的向后兼容设计。

新增的 ./lib/*./es/* 导出路径与现有导出(如 ./generate./interface./locale/*)指向相同的文件,这是为了支持旧的导入模式。这种方法允许消费者在迁移期间使用任一导入路径,是管理 API 演变的合理做法。


40-79: The repository clone operation failed, preventing direct verification of the file paths. However, I can still provide a rewritten review based on the structural analysis.

The original review correctly identifies that while the export structure is sound, verification of the actual file paths is necessary. Let me rewrite the review comment:


Export structure is correct, but file path existence in built artifacts requires verification.

The new export entries (lines 40-79) correctly provide backward-compatible support for ./lib/ and ./es/ import patterns. Each export includes complete types, import, and require mappings that align with the existing export patterns.

However, the following exported file paths must exist in the built distribution for these exports to function correctly:

  • ./es/generate/index.{js,d.ts} and ./lib/generate/index.js
  • ./es/interface.{js,d.ts} and ./lib/interface.js
  • ./es/locale/ and ./lib/locale/ with their respective modules

Verify that all these paths are present in the build output before merging, as referencing non-existent paths will cause module resolution failures for consuming packages.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

这个 Pull Request 通过在 package.json 中为 exports 字段添加额外的条目来确保向后兼容性,以支持旧的 /lib//es/ 导入路径。这些更改看起来是正确的,并且可以实现预期的功能。然而,这也引入了大量的重复配置,可能会增加未来的维护成本。我在下面的评论中指出了这一点,并建议团队注意这个问题以避免未来出现错误。

Comment on lines +40 to 79
"./lib/generate": {
"types": "./es/generate/index.d.ts",
"import": "./es/generate/index.js",
"require": "./lib/generate/index.js"
},
"./lib/generate/*": {
"types": "./es/generate/*.d.ts",
"import": "./es/generate/*.js",
"require": "./lib/generate/*.js"
},
"./lib/interface": {
"types": "./es/interface.d.ts",
"import": "./es/interface.js",
"require": "./lib/interface.js"
},
"./lib/locale/*": {
"types": "./es/locale/*.d.ts",
"import": "./es/locale/*.js",
"require": "./lib/locale/*.js"
},
"./es/generate": {
"types": "./es/generate/index.d.ts",
"import": "./es/generate/index.js",
"require": "./lib/generate/index.js"
},
"./es/generate/*": {
"types": "./es/generate/*.d.ts",
"import": "./es/generate/*.js",
"require": "./lib/generate/*.js"
},
"./es/interface": {
"types": "./es/interface.d.ts",
"import": "./es/interface.js",
"require": "./lib/interface.js"
},
"./es/locale/*": {
"types": "./es/locale/*.d.ts",
"import": "./es/locale/*.js",
"require": "./lib/locale/*.js"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

这些新增的导出项中存在大量重复。例如:

  • ./lib/generate./es/generate 的定义是相同的。
  • ./lib/generate/*./es/generate/* 的定义是相同的。
  • ./lib/interface./es/interface 的定义是相同的。
  • ./lib/locale/*./es/locale/* 的定义是相同的。

此外,这些新增的条目也与 exports 中现有的 ./generate./generate/*./interface./locale/* 条目重复。

虽然为了向后兼容性,这种重复可能是必要的,但这会增加维护成本。将来如果需要修改这些路径,必须在所有重复的地方都进行更新,这很容易出错。建议将此作为技术债务记录下来,或添加注释提醒未来的维护者。

@codecov
Copy link

codecov bot commented Nov 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.80%. Comparing base (7e39aa1) to head (25d1d6c).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #952   +/-   ##
=======================================
  Coverage   98.80%   98.80%           
=======================================
  Files          65       65           
  Lines        2680     2680           
  Branches      739      739           
=======================================
  Hits         2648     2648           
  Misses         29       29           
  Partials        3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zombieJ zombieJ merged commit 8b7f3cd into react-component:master Nov 26, 2025
7 of 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.

2 participants