Skip to content

feat: add metadata field to tag object#5586

Merged
chenjiahan merged 1 commit intomainfrom
tag_metadata_0712
Jul 12, 2025
Merged

feat: add metadata field to tag object#5586
chenjiahan merged 1 commit intomainfrom
tag_metadata_0712

Conversation

@chenjiahan
Copy link
Member

Summary

This PR adda a new metadata field to the tag object:

See the added documentation to learn more.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings July 12, 2025 08:13
@netlify
Copy link

netlify bot commented Jul 12, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 085e1ea
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/6872191b8174130008fa5835
😎 Deploy Preview https://deploy-preview-5586--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 73 (🔴 down 1 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 metadata to type definitions and serialization logic in the core
  • Updates RsbuildHtmlPlugin to propagate metadata between 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 metadata field in the modifyHTMLTags hook.
  metadata?: Record<string, any>;

@chenjiahan chenjiahan merged commit a95cd91 into main Jul 12, 2025
13 checks passed
@chenjiahan chenjiahan deleted the tag_metadata_0712 branch July 12, 2025 23:59
@chenjiahan chenjiahan mentioned this pull request Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant