-
-
Notifications
You must be signed in to change notification settings - Fork 336
feat: add additional exports to package.json for backwards compatibility #952
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
feat: add additional exports to package.json for backwards compatibility #952
Conversation
|
@guoyunhe is attempting to deploy a commit to the React Component Team on Vercel. A member of the Team first needs to authorize it. |
Summary of ChangesHello @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 Highlights
Using Gemini Code AssistThe 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
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 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
|
Walkthroughpackage.json 中的导出映射得到扩展,新增了针对 Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ 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)
🔇 Additional comments (2)
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. Comment |
There was a problem hiding this 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/ 导入路径。这些更改看起来是正确的,并且可以实现预期的功能。然而,这也引入了大量的重复配置,可能会增加未来的维护成本。我在下面的评论中指出了这一点,并建议团队注意这个问题以避免未来出现错误。
| "./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" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些新增的导出项中存在大量重复。例如:
./lib/generate和./es/generate的定义是相同的。./lib/generate/*和./es/generate/*的定义是相同的。./lib/interface和./es/interface的定义是相同的。./lib/locale/*和./es/locale/*的定义是相同的。
此外,这些新增的条目也与 exports 中现有的 ./generate、./generate/*、./interface 和 ./locale/* 条目重复。
虽然为了向后兼容性,这种重复可能是必要的,但这会增加维护成本。将来如果需要修改这些路径,必须在所有重复的地方都进行更新,这很容易出错。建议将此作为技术债务记录下来,或添加注释提醒未来的维护者。
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
兼容旧的
/lib/和/es/import 用法Summary by CodeRabbit
发布说明
✏️ Tip: You can customize this high-level summary in your review settings.