Skip to content

Conversation

Div627
Copy link

@Div627 Div627 commented Sep 12, 2025

中文版模板 / Chinese template

🤔 This is a ...

  • 🆕 New feature
  • 🐞 Bug fix
  • 📝 Site / documentation improvement
  • 📽️ Demo improvement
  • 💄 Component style improvement
  • 🤖 TypeScript definition improvement
  • 📦 Bundle size optimization
  • ⚡️ Performance optimization
  • ⭐️ Feature enhancement
  • 🌐 Internationalization
  • 🛠 Refactoring
  • 🎨 Code style optimization
  • ✅ Test Case
  • 🔀 Branch merge
  • ⏩ Workflow
  • ⌨️ Accessibility improvement
  • ❓ Other (about what?)

🔗 Related Issues

  • Describe the source of related requirements, such as links to relevant issue discussions.
  • For example: close #xxxx, fix #xxxx

💡 Background and Solution

  • The specific problem to be addressed.
  • List the final API implementation and usage if needed.
  • If there are UI/interaction changes, consider providing screenshots or GIFs.

📝 Change Log

Language Changelog
🇺🇸 English
🇨🇳 Chinese

Summary by CodeRabbit

  • Refactor
    • 移除 Actions、Attachments.FileList、Bubble(含列表/打字)、Conversations、Sender、ThoughtChain、useXAgent 等组件/Hook 及其样式、类型与导出;同步下线相关示例与演示页(可能影响依赖页面)。
  • Documentation
    • 重写中英文 README,聚焦 monorepo 与本地研发流程;批量移除上述组件/Hook 的文档与示例。
  • Chores
    • CI 从 Bun 迁移至 npm,内联测试与预览/站点构建,调整制品路径与权限;更新 .gitignore、Biome 规则;新增 Husky commit-msg 模板(占位)。

Copy link
Contributor

coderabbitai bot commented Sep 12, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

本次变更大规模删除多类组件与文档(Actions、Attachments.FileList、Bubble、Conversations、Sender、ThoughtChain、use-x-agent 及其样式、测试、示例、文档),重写顶层 README(中英),清理 dumi 页与 PeterCat 入口,更新仓库配置(gitignore、biome、husky),并将 CI/CD 工作流由 Bun 迁移至 npm。

Changes

Cohort / File(s) Summary
CI/CD 工作流(Bun → npm)
.github/workflows/main.yml, .github/workflows/preview-build.yml, .github/workflows/preview-deploy.yml, .github/workflows/site-deploy.yml, .github/workflows/size-limit.yml
内联测试任务、设置最小权限;预览/站点构建与发布从 Bun 改为 npm(含工作空间路径调整与产物目录变更);size-limit 使用 npm;字符与目录小幅修订。
仓库配置与钩子
biome.json, .gitignore, .husky/commit-msg
扩展 Biome 配置与包级覆盖;忽略规则改为包级/通配更广谱;新增空的 commit-msg 钩子注释。
顶层文档重构
README.md, README-zh_CN.md
以 monorepo/工具链与 SDK 引导为中心改写结构与内容,更新变更日志链接与使用姿势,强调 @ant-design/x-sdk 与 @ant-design/x-markdown。
dumi 页面与主题入口
.dumi/pages/theme-editor/*, .dumi/theme/common/PeterCat.tsx
移除主题编辑页与 PeterCat 组件入口。
聚合导出删除
components/index.ts
移除所有对组件与 Hook 的再导出入口。
Actions 组件移除
components/actions/*
删除组件实现、菜单、类型、样式、文档、示例与测试。
Attachments.FileList 移除
components/attachments/FileList/*, components/attachments/style/fileCard.ts, components/attachments/demo/*
删除文件卡片与列表实现、预设图标、样式与示例。
Bubble 组件与子模块移除
components/bubble/*
删除组件、列表、hooks、样式、文档、示例与测试。
Conversations 组件移除
components/conversations/*
删除组件、分组 Hook、样式、文档、示例与 GroupTitle。
Sender 组件移除
components/sender/*
删除组件实现、文档与示例。
ThoughtChain 组件移除
components/thought-chain/*
删除节点实现、样式、文档与示例。
use-x-agent 移除
components/use-x-agent/*
删除 Hook、类型、演示与测试及文档。

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant GH as GitHub Actions
  participant Node as Setup Node
  participant NPM as npm
  participant Codecov as Codecov

  Dev->>GH: push / PR
  GH->>GH: permissions: contents=read
  GH->>Node: setup node (ubuntu-latest)
  GH->>NPM: npm ci / npm run prestart
  GH->>NPM: npm run lint / tsc / compile / test
  GH-->>Codecov: Upload coverage (token)
  Note over GH,NPM: 流程由 Bun 迁移至 npm 执行
Loading
sequenceDiagram
  autonumber
  actor Dev as Developer
  participant GH as GitHub Actions (Preview/Site)
  participant WS as Workspace packages/x
  participant NPM as npm
  participant Pages as GitHub Pages/Surge

  Dev->>GH: workflow_run (Preview Build)
  GH->>NPM: npm run prestart --workspaces
  GH->>NPM: npm run site --workspace packages/x
  GH->>GH: Upload artifact from packages/x/_site
  Note over GH,WS: 产物路径改为 packages/x/_site

  Dev->>GH: Site Deploy
  GH->>NPM: npm run predeploy --workspace packages/x
  GH->>NPM: npm run compile --workspace packages/x
  GH->>Pages: Publish ./packages/x/_site
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

bug, documentation

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning PR 标题“Fix(XMarkdown):Mermaid 切换时渲染异常”暗示这是修复 XMarkdown 中 Mermaid 渲染问题的补丁,但变更摘要显示的是大规模的组件、示例、文档删除与 CI/构建脚本迁移等改动,并未看到与 Mermaid 渲染修复直接相关的代码、测试或说明,因此标题与实际变更不匹配且可能误导审阅者和变更历史。 请将 PR 标题修改为能准确概括本次变更的简短句子(例如 "chore: migrate build to npm and remove deprecated components/demos" 或 "refactor: cleanup docs and CI workflows"),或者如果确实要提交 Mermaid 渲染修复,请在 PR 描述中列出受影响文件、重现步骤和关联 issue 并把清理/迁移与实际的 bug 修复拆成独立 PR 以便审查。
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

小兔敲锣把仓清,
旧枝裁去更分明。
Bun 与 npm换了形,
文档翻新路标清。
轻装再发跃三城,
=(^.^)= 出发!🚀

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning PR 标题“Fix(XMarkdown):Mermaid 切换时渲染异常”暗示这是修复 XMarkdown 中 Mermaid 渲染问题的补丁,但变更摘要显示的是大规模的组件、示例、文档删除与 CI/构建脚本迁移等改动,并未看到与 Mermaid 渲染修复直接相关的代码、测试或说明,因此标题与实际变更不匹配且可能误导审阅者和变更历史。 请将 PR 标题修改为能准确概括本次变更的简短句子(例如 "chore: migrate build to npm and remove deprecated components/demos" 或 "refactor: cleanup docs and CI workflows"),或者如果确实要提交 Mermaid 渲染修复,请在 PR 描述中列出受影响文件、重现步骤和关联 issue 并把清理/迁移与实际的 bug 修复拆成独立 PR 以便审查。
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

小兔敲锣把仓清,
旧枝裁去更分明。
Bun 与 npm换了形,
文档翻新路标清。
轻装再发跃三城,
=(^.^)= 出发!🚀

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning PR 标题“Fix(XMarkdown):Mermaid 切换时渲染异常”暗示这是修复 XMarkdown 中 Mermaid 渲染问题的补丁,但变更摘要显示的是大规模的组件、示例、文档删除与 CI/构建脚本迁移等改动,并未看到与 Mermaid 渲染修复直接相关的代码、测试或说明,因此标题与实际变更不匹配且可能误导审阅者和变更历史。 请将 PR 标题修改为能准确概括本次变更的简短句子(例如 "chore: migrate build to npm and remove deprecated components/demos" 或 "refactor: cleanup docs and CI workflows"),或者如果确实要提交 Mermaid 渲染修复,请在 PR 描述中列出受影响文件、重现步骤和关联 issue 并把清理/迁移与实际的 bug 修复拆成独立 PR 以便审查。
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

小兔敲锣把仓清,
旧枝裁去更分明。
Bun 与 npm换了形,
文档翻新路标清。
轻装再发跃三城,
=(^.^)= 出发!🚀

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning PR 标题“Fix(XMarkdown):Mermaid 切换时渲染异常”暗示这是修复 XMarkdown 中 Mermaid 渲染问题的补丁,但变更摘要显示的是大规模的组件、示例、文档删除与 CI/构建脚本迁移等改动,并未看到与 Mermaid 渲染修复直接相关的代码、测试或说明,因此标题与实际变更不匹配且可能误导审阅者和变更历史。 请将 PR 标题修改为能准确概括本次变更的简短句子(例如 "chore: migrate build to npm and remove deprecated components/demos" 或 "refactor: cleanup docs and CI workflows"),或者如果确实要提交 Mermaid 渲染修复,请在 PR 描述中列出受影响文件、重现步骤和关联 issue 并把清理/迁移与实际的 bug 修复拆成独立 PR 以便审查。
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

小兔敲锣把仓清,
旧枝裁去更分明。
Bun 与 npm换了形,
文档翻新路标清。
轻装再发跃三城,
=(^.^)= 出发!🚀

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning PR 标题“Fix(XMarkdown):Mermaid 切换时渲染异常”暗示这是修复 XMarkdown 中 Mermaid 渲染问题的补丁,但变更摘要显示的是大规模的组件、示例、文档删除与 CI/构建脚本迁移等改动,并未看到与 Mermaid 渲染修复直接相关的代码、测试或说明,因此标题与实际变更不匹配且可能误导审阅者和变更历史。 请将 PR 标题修改为能准确概括本次变更的简短句子(例如 "chore: migrate build to npm and remove deprecated components/demos" 或 "refactor: cleanup docs and CI workflows"),或者如果确实要提交 Mermaid 渲染修复,请在 PR 描述中列出受影响文件、重现步骤和关联 issue 并把清理/迁移与实际的 bug 修复拆成独立 PR 以便审查。
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

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

github-actions bot commented Sep 12, 2025

Preview is ready

@Div627 Div627 changed the base branch from main to next September 12, 2025 09:23
@dosubot dosubot bot added the bug Something isn't working label Sep 12, 2025
Copy link

cloudflare-workers-and-pages bot commented Sep 12, 2025

Deploying ant-design-x with  Cloudflare Pages  Cloudflare Pages

Latest commit: b595e74
Status: ✅  Deploy successful!
Preview URL: https://2da80284.ant-design-x.pages.dev
Branch Preview URL: https://feature-markdown.ant-design-x.pages.dev

View logs

Copy link

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

Summary of Changes

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

此拉取请求旨在解决 XMarkdown 中 Mermaid 图表渲染的特定问题,同时对项目结构进行了大规模的重构。通过将现有组件和功能拆分为独立的 npm 包(@ant-design/x@ant-design/x-sdk@ant-design/x-markdown),提升了项目的模块化、可维护性和可扩展性。此次变更也更新了开发工具配置和文档,以适应新的多包工作流。

Highlights

  • 项目结构重构: 项目已进行重大重构,从扁平化的 components 目录结构迁移至多包(monorepo)架构,新增了 packages/xpackages/x-markdownpackages/x-sdk 等独立包。
  • 核心组件迁移与移除: 原 components 目录下的 ActionsAttachmentsBubbleConversationsSenderThoughtChain 组件及其相关的 hooks (useXAgentuseXChat) 已被移除。这些组件已迁移至新的独立包中,以实现更好的模块化和维护性。
  • 构建与配置更新: .gitignorebiome.json 文件已更新,以适应新的多包项目结构,并调整了 linting 规则,包括启用新的代码风格检查和更新忽略路径。
  • 文档与开发流程更新: 中英文 README.md 文件已全面更新,反映了新的项目结构、核心包的职责划分以及本地开发环境的设置(推荐使用 utoonpm-workspace)。此外,新增了 Husky commit-msg 钩子,用于 commitlint 检查提交信息规范。
  • XMarkdown Mermaid 渲染问题修复: 根据 PR 标题,此 PR 修复了 XMarkdown 中 Mermaid 图表切换时的渲染异常问题。此修复是 x-markdown 包重构的一部分。
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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

Copy link

@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

本次 PR 主要通过 useMemoReact.memoXMarkdown 组件进行了性能优化,避免了不必要的重复渲染和计算,这是一个很好的改进。同时,修复了 Mermaid 插件在视图切换时渲染异常的问题,并通过将 securityLevel 设置为 strict 增强了安全性。代码整体质量不错,我发现了一些可以改进的小地方,主要涉及移除调试代码和优化性能测试中的实现方式。请查看具体的审查评论。


try {
const isValid = await mermaid.parse(children, { suppressErrors: true });
if (!isValid) throw new Error('Invalid Mermaid syntax');

console.log('renderDiagram');

Choose a reason for hiding this comment

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

medium

这行 console.log 看起来是用于调试的,建议在合并前移除,以保持生产代码的整洁。

Comment on lines 167 to 169
while (performance.now() < waitUntil) {
// busy wait 来模拟真实渲染时间
}

Choose a reason for hiding this comment

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

medium

在性能测试中使用 while 循环进行忙等待(busy-wait)来模拟渲染延迟会阻塞浏览器的主线程,导致 UI 卡顿,这可能会影响测试页面的用户体验。虽然这是一个演示,但最好避免使用这种模式。

建议使用异步方式实现非阻塞的延迟,例如:

const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));

// 在 runPerformanceTest 中
// ...
const actualDelay = ...;
await sleep(actualDelay);
// ...

这需要将 runPerformanceTest 函数以及内部的循环改为 async。这样既能模拟耗时操作,又不会冻结页面。

Copy link

codecov bot commented Sep 12, 2025

Bundle Report

Bundle size has no change ✅

Copy link
Contributor

github-actions bot commented Sep 12, 2025

size-limit report 📦

Path Size
packages/x/dist/antdx.min.js 65.98 KB
packages/x-sdk/dist/x-sdk.min.js 7.16 KB
packages/x-markdown/dist/x-markdown.min.js 56.58 KB
packages/x-markdown/dist/plugins/code-high-light.min.js 276.29 KB
packages/x-markdown/dist/plugins/latex.min.js 62.01 KB
packages/x-markdown/dist/plugins/mermaid.min.js 848.12 KB (+355 B 🔺)

@Div627 Div627 requested a review from kimteayon September 14, 2025 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants