Skip to content

Conversation

@lyw405
Copy link
Contributor

@lyw405 lyw405 commented Jan 13, 2026

基于 yrom 提起的pr 剥离cli及其其他无关逻辑。close #104

yrom and others added 16 commits December 31, 2025 11:16
remove custom XMLSerializer implementation in favor of native outerHTML
move svgo optimization to CLI level with option
- Add fast fail for syntax errors
- Validate template existence
This commit removes the standalone CLI module and moves examples to internal SSR tests for better integration.
Remove CLI tool documentation and references after CLI module removal, update SSR documentation, and remove teardownDOM function from exports.
Relocate SSR example files from __tests__/ssr/examples to __tests__/unit/ssr/examples and update test file path reference.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

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

此拉取请求为信息图引入了服务端渲染(SSR)能力,使其能够在 Node.js 环境中渲染为 SVG 字符串。它重构了现有代码以支持此新功能,包括 DOM 环境模拟、资源预加载和专用的 SSR API。这些更改还包括全面的测试和更新的文档,以指导用户进行非浏览器渲染。

Highlights

  • 引入服务端渲染 (SSR) 功能: 增加了在 Node.js 环境中将信息图渲染为 SVG 字符串的能力,支持 SSR、SSG 等非浏览器场景。
  • DOM 环境模拟: 使用 linkedom 库在 Node.js 中模拟浏览器 DOM 环境,确保渲染逻辑的兼容性。
  • 资源预加载与优化: 实现了图标和插图资源的预加载机制,并在 SSR 模式下优化了字体加载和文本测量,提高了渲染效率和准确性。
  • API 与文档完善: 提供了 renderToSVG 等 SSR 专用 API,并更新了 README 和新增了详细的非浏览器渲染文档,方便开发者使用。
  • 全面的测试覆盖: 增加了针对 SSR 功能的单元测试,覆盖了多种信息图示例、错误处理、国际化和 SVG 结构验证。
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/build.yml
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.

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 引入了服务端渲染(SSR)功能,这是一项重要且有价值的新特性。实现非常全面,不仅包括在 Node.js 环境中的核心渲染逻辑,还对现有代码库的多个部分(如资源加载、字体处理和文本测量)进行了调整,以同时支持浏览器和服务器环境。值得称赞的是,您添加了 DOM shim(linkedom)、SSR 的专项测试以及详尽的文档。代码质量很高,设计决策也很可靠。

我有一个关于在错误处理路径中提高类型安全性的建议。总的来说,这是一次出色的贡献。

Merged upstream main branch changes with SSR feature development.

Changes merged:
- Skills integration documentation and structure
- Live editor implementation (#105)
- Improved resource loading with caching and load tracking
- Micro-app environment support
- Added 'loaded' event for resource completion
- Various UI/UX improvements

Conflicts resolved:
- README.md: Kept both SSR and Skills sections
- dev/src/Infographic.tsx: Merged remote fetch with caching
- dev/vite.config.ts: Added fs.allow and port config
- src/renderer/renderer.ts: Merged SSR and micro-app support
- src/resource/loader.ts: Merged load tracker logic
- src/runtime/Infographic.tsx: Merged rendered and loaded events
- dev/src/get-asset.ts: Removed (deleted in upstream)
@codecov-commenter
Copy link

codecov-commenter commented Jan 13, 2026

Codecov Report

❌ Patch coverage is 70.44776% with 99 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.71%. Comparing base (827399a) to head (6a6a643).

Files with missing lines Patch % Lines
src/utils/text.ts 34.61% 34 Missing ⚠️
src/ssr/renderer.ts 74.79% 31 Missing ⚠️
src/renderer/renderer.ts 23.33% 23 Missing ⚠️
src/ssr/dom-shim.ts 89.42% 11 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main     #160       +/-   ##
===========================================
+ Coverage   31.10%   44.71%   +13.61%     
===========================================
  Files         321      324        +3     
  Lines       24860    25159      +299     
  Branches     1330     1902      +572     
===========================================
+ Hits         7733    11251     +3518     
+ Misses      17124    13898     -3226     
- Partials        3       10        +7     
Flag Coverage Δ
infographic 44.71% <70.44%> (+13.61%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/index.ts 100.00% <100.00%> (ø)
src/renderer/fonts/loader.ts 13.33% <100.00%> (+3.76%) ⬆️
src/renderer/fonts/registry.ts 44.82% <ø> (ø)
src/resource/loader.ts 85.45% <100.00%> (+77.29%) ⬆️
src/runtime/Infographic.tsx 68.07% <100.00%> (+50.60%) ⬆️
src/ssr/index.ts 100.00% <100.00%> (ø)
src/utils/data.ts 100.00% <100.00%> (ø)
src/utils/measure-text.ts 33.05% <100.00%> (ø)
src/utils/recognizer.ts 73.80% <100.00%> (+1.19%) ⬆️
src/utils/svg.ts 100.00% <ø> (ø)
... and 4 more

... and 58 files with indirect coverage changes

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

Update various project files including configuration, SSR tests, and generated SVG outputs.
@Aarebecca
Copy link
Contributor

@yrom @lyw405 Thanks for your contribution. I’ll continue refining it based on this PR, but it may take some time.

@Aarebecca Aarebecca changed the base branch from main to dev/ssr January 14, 2026 01:59
@Aarebecca Aarebecca merged commit 4ae5e7f into antvis:dev/ssr Jan 14, 2026
Aarebecca added a commit that referenced this pull request Jan 14, 2026
* Server-Side Rendering (#160)

* feat(ssr):  Implement SSR rendering pipeline

* test(ssr): make renderer tests async and use string input format

* refactor: remove unused code

* ci: add CLI build step to workflow

* fix: lint error

* refactor(build): replace custom esm import fixer with tsc-alias

* feat: export resource types

* feat(ssr): add non-browser rendering documentation

* feat(ssr): replace JSDOM with LinkeDOM

* fix: ignore unused error parameter

* test(ssr): remove debug console.log from renderer test

* refactor(ssr): simplify SVG serialization and DOM setup

remove custom XMLSerializer implementation in favor of native outerHTML
move svgo optimization to CLI level with option

* fix(ssr): improve error handling and validation in renderer

- Add fast fail for syntax errors
- Validate template existence

* Refactor: move CLI to internal SSR tests and remove CLI module

This commit removes the standalone CLI module and moves examples to internal SSR tests for better integration.

* Update documentation and remove CLI references

Remove CLI tool documentation and references after CLI module removal, update SSR documentation, and remove teardownDOM function from exports.

* Move SSR examples test files to proper location

Relocate SSR example files from __tests__/ssr/examples to __tests__/unit/ssr/examples and update test file path reference.

* Update project configuration and SSR test outputs

Update various project files including configuration, SSR tests, and generated SVG outputs.

* Add render_error type and improve type safety in SSR renderer

---------

Co-authored-by: Yrom <[email protected]>

* revert: unnecessary changes

* refactor(utils): optimize utils

* refactor(ssr): optimize ssr implement

* test(ssr): update test case and output

* docs: update docs

* refactor: optimize code

* fix: fix cr issues

* docs: remove trailing whitespace in index.en.md

---------

Co-authored-by: YuwangLiu <[email protected]>
Co-authored-by: Yrom <[email protected]>
Co-authored-by: hustcc <[email protected]>
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.

5 participants