Skip to content

Render helper improvements#756

Merged
feruzm merged 3 commits intodevelopfrom
xml
Apr 13, 2026
Merged

Render helper improvements#756
feruzm merged 3 commits intodevelopfrom
xml

Conversation

@feruzm
Copy link
Copy Markdown
Member

@feruzm feruzm commented Apr 13, 2026

Summary by CodeRabbit

  • Refactor
    • DOM parsing and serialization now prefer native browser APIs when available, with robust fallbacks for legacy or server environments.
  • Chores
    • Package version bumped and changelog updated to document render helper improvements.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 13, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 495b5246-dbcc-4132-8351-629118362b2c

📥 Commits

Reviewing files that changed from the base of the PR and between de8685d and 8e7c6fa.

⛔ Files ignored due to path filters (6)
  • packages/render-helper/dist/browser/index.js is excluded by !**/dist/**
  • packages/render-helper/dist/browser/index.js.map is excluded by !**/dist/**, !**/*.map
  • packages/render-helper/dist/node/index.cjs is excluded by !**/dist/**
  • packages/render-helper/dist/node/index.cjs.map is excluded by !**/dist/**, !**/*.map
  • packages/render-helper/dist/node/index.mjs is excluded by !**/dist/**
  • packages/render-helper/dist/node/index.mjs.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (3)
  • packages/render-helper/CHANGELOG.md
  • packages/render-helper/package.json
  • packages/render-helper/src/consts/dom-parser.const.ts

📝 Walkthrough

Walkthrough

This PR removes a custom xmldom browser shim and updates render-helper to prefer native DOMParser/XMLSerializer when available, falling back to @xmldom/xmldom in non-browser environments; imports were consolidated accordingly and package version/changelog updated.

Changes

Cohort / File(s) Summary
Shim Removal
apps/self-hosted/rsbuild.config.ts, apps/self-hosted/src/shims/xmldom.ts
Removed the Rspack alias for @xmldom/xmldom and deleted the custom browser shim that provided DOMParser and XMLSerializer.
DOM Parser Configuration
packages/render-helper/src/consts/dom-parser.const.ts
Added runtime detection to use native globalThis.DOMParser/XMLSerializer when present; otherwise instantiate @xmldom/xmldom implementations with a lenient error handler. Exported XMLSerializer.
Import Consolidation
packages/render-helper/src/methods/get-inner-html.method.ts, packages/render-helper/src/methods/markdown-to-html.method.ts
Repointed imports to use centralized ../consts for DOMParser/XMLSerializer and ENTITY_REGEX, removing direct imports from @xmldom/xmldom.
Packaging / Changelog
packages/render-helper/CHANGELOG.md, packages/render-helper/package.json
Bumped package version to 2.4.32 and added a changelog entry for the patch release.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Render helper update #643: Modifies render-helper's DOM parsing utilities and error handling, overlapping changes in dom-parser.const.ts.
  • SEO context for Quality #646: Adjusts render-helper imports and markdown-to-html logic, related to import consolidation here.
  • Dom parser improvement #753: Changes parse error handling and DOM parsing behavior in render-helper, potentially interacting with the new fallback/error-handler approach.

Poem

🐰 Hop, I tossed the shim away,

Native parsers lead the play,
Fallbacks cozy in the shade,
Imports neat, no duplicate braid,
A carrot cheer for tidy code today 🥕

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Render helper improvements' is vague and overly broad. While the PR does involve render-helper changes, the title doesn't convey the main technical change: removing custom xmldom shims and using native browser APIs with fallbacks. Consider a more specific title that captures the primary change, such as 'Replace custom xmldom shims with native browser APIs' or 'Use native DOMParser and XMLSerializer with xmldom fallback'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch xml

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.

coderabbitai[bot]

This comment was marked as resolved.

@feruzm feruzm added the patch Bug fixes and patches (1.0.0 → 1.0.1), add this only if any packages/ have patch changes in PR label Apr 13, 2026
@feruzm feruzm merged commit 19713e1 into develop Apr 13, 2026
1 check was pending
@feruzm feruzm deleted the xml branch April 13, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Bug fixes and patches (1.0.0 → 1.0.1), add this only if any packages/ have patch changes in PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant