feat: add metadata field to tag object#5586
Merged
chenjiahan merged 1 commit intomainfrom Jul 12, 2025
Merged
Conversation
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new metadata field on HTML tag objects so plugins can attach arbitrary data without affecting the generated HTML.
- Adds
metadatato type definitions and serialization logic in the core - Updates RsbuildHtmlPlugin to propagate
metadatabetween internal and public tag formats - Extends docs in both languages and adds an end-to-end test case for metadata handling
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| website/docs/zh/plugins/dev/hooks.mdx | Added metadata property to HtmlBasicTag type in Chinese docs |
| website/docs/en/plugins/dev/hooks.mdx | Added metadata property to HtmlBasicTag type in English docs |
| website/docs/zh/config/html/tags.mdx | Documented new metadata option in HTML tags config (Chinese) |
| website/docs/en/config/html/tags.mdx | Documented new metadata option in HTML tags config (English) |
| packages/core/src/types/config.ts | Added metadata to HtmlBasicTag TypeScript definition |
| packages/core/src/rspack/RsbuildHtmlPlugin.ts | Updated formatBasicTag and fromBasicTag to handle metadata |
| e2e/cases/plugin-api/plugin-modify-tags-meta/... | Added example plugin, config, and test to verify metadata usage |
| e2e/cases/plugin-api/plugin-modify-tags-meta/src/index.js | Placeholder entry file for the e2e test |
Comments suppressed due to low confidence (1)
website/docs/en/plugins/dev/hooks.mdx:545
- [nitpick] It may be helpful to include a brief example or note here explaining how plugins can leverage the
metadatafield in themodifyHTMLTagshook.
metadata?: Record<string, any>;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
This PR adda a new
metadatafield to the tag object:See the added documentation to learn more.
Checklist