Skip to content

Conversation

@chenjiahan
Copy link
Member

@chenjiahan chenjiahan commented Jun 21, 2025

Summary

While we already export the logger from @rsbuild/core, providing the api.logger will make it easier and more intuitive for plugin authors (and AI) to use the logger.

Checklist

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

Copilot AI review requested due to automatic review settings June 21, 2025 13:11
@netlify
Copy link

netlify bot commented Jun 21, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit f852870
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/6856b386ba54f30008e635a7
😎 Deploy Preview https://deploy-preview-5462--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: 85 (🟢 up 8 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 exposes a unified logger instance on the plugin API, making it easier for plugin authors to log messages consistently.

  • Add logger: Logger to the RsbuildPluginAPI type and initialization logic
  • Update core exports to include the Logger type and logger instance
  • Document api.logger in both plugin and core API guides, and add an e2e test for the new API

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
website/docs/zh/plugins/dev/core.mdx Document api.logger usage in Chinese plugin development guide
website/docs/zh/api/javascript-api/core.mdx Clarify logger description in Chinese core API reference
website/docs/en/plugins/dev/core.mdx Document api.logger usage in English plugin development guide
website/docs/en/api/javascript-api/core.mdx Clarify logger description in English core API reference
packages/core/src/types/plugin.ts Add logger: Logger to RsbuildPluginAPI
packages/core/src/initPlugins.ts Expose logger on the built plugin API object
packages/core/src/index.ts Export Logger type alongside logger
e2e/cases/plugin-api/logger/src/index.js Scaffold plugin entry file for e2e test
e2e/cases/plugin-api/logger/index.test.ts Add e2e test verifying api.logger
Comments suppressed due to low confidence (1)

e2e/cases/plugin-api/logger/index.test.ts:5

  • [nitpick] The test description mentions "custom resolver" but this case is about the logger API—consider renaming it to something like "should expose logger in plugin API".
test('should allow plugin to custom resolver', async () => {

@chenjiahan chenjiahan merged commit 0a1d8d4 into main Jun 21, 2025
11 checks passed
@chenjiahan chenjiahan deleted the plugin_api_logger_0621 branch June 21, 2025 23:39
This was referenced Jun 23, 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