Skip to content

Avoid util deep imports#706

Open
QDyanbing wants to merge 2 commits into
react-component:masterfrom
QDyanbing:avoid-deep-imports
Open

Avoid util deep imports#706
QDyanbing wants to merge 2 commits into
react-component:masterfrom
QDyanbing:avoid-deep-imports

Conversation

@QDyanbing
Copy link
Copy Markdown

@QDyanbing QDyanbing commented May 20, 2026

变更内容

  • 升级 @rc-component/util 到当前 latest ^1.11.1
  • 升级 @rc-component/father-plugin^2.2.0,交由插件统一处理 rc 深路径 import 限制。
  • 将源码和测试中对 @rc-component/util/lib/* 的引用改为从 @rc-component/util 根入口导入。
  • 从根入口补充导出 AcceptConfigRcFileUploadRequestOption 等上传相关类型。

背景

配合 rc 包统一避免依赖其他 rc 包的 es / lib 构建产物内部路径,改为使用公开根入口 API。

验证

  • git diff --check
  • 此前批量调整中已跑通 npm run compilenpm run lintnpm test

Summary by CodeRabbit

发布说明

  • Chores

    • 升级内部依赖版本以保持稳定性和兼容性(涉及若干构建/工具包相关依赖)。
  • 其他改进

    • 扩展并重新导出更多公开类型,便于在项目中直接访问更完整的类型定义。
    • 优化若干模块的导入方式与测试引入,改善代码组织和维护体验。

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 20, 2026

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

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5f413eb7-cbe3-438c-a229-649beafc748a

📥 Commits

Reviewing files that changed from the base of the PR and between 43f8c0e and f5c3f95.

📒 Files selected for processing (1)
  • src/index.ts

Walkthrough

升级 @rc-component/util@rc-component/father-plugin 版本;将源码与测试中对 pickAttrs / resetWarned 的导入改为包根命名导出;并在 src/index.ts 中扩展了对外导出的类型集合。

变更

依赖升级与 API 对齐

层 / 文件(s) 摘要
依赖版本升级
package.json
@rc-component/util^1.3.0 升级至 ^1.11.1@rc-component/father-plugin^2.0.2 升级至 ^2.2.0
源码与测试导入路径更新
src/AjaxUploader.tsx, tests/uploader.spec.tsx
pickAttrsresetWarned 的导入从内部子路径(如 @rc-component/util/lib/...)改为从 @rc-component/util 的命名导入。
公开类型重导出扩展
src/index.ts
扩展 type-only 导入与重导出:加入 AcceptConfigBeforeUploadFileTypeCustomUploadRequestOptionRcFileUploadProgressEventUploadRequestErrorUploadRequestOption(保留 UploadProps)。

预计代码审查工作量

🎯 2 (简单) | ⏱️ ~8 分钟

可能相关的 PR

建议审查者

  • zombieJ

🐰 路径一换更敞亮,
版本更新步伐忙,
导出类型并排站,
测试引入也改装,
小兔祝贺改动香。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 拉取请求标题"Avoid util deep imports"与变更集的主要目标完全相关,清晰地总结了核心变更意图:将@rc-component/util包的深层路径导入替换为公共根入口导入。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Copy Markdown

@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

This pull request updates dependencies and refactors imports from @rc-component/util to use named exports instead of deep paths. It also expands the types exported from the main entry point. The reviewer suggested further expanding the exported types to include BeforeUploadFileType, UploadProgressEvent, and others to ensure a complete public API and avoid deep path imports for users.

Comment thread src/index.ts
Comment thread src/index.ts Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.58%. Comparing base (799024c) to head (43f8c0e).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #706   +/-   ##
=======================================
  Coverage   89.58%   89.58%           
=======================================
  Files           6        6           
  Lines         317      317           
  Branches       90       94    +4     
=======================================
  Hits          284      284           
  Misses         33       33           

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

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