Skip to content

refactor: simplify plugin environment handling #5616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 17, 2025

Conversation

chenjiahan
Copy link
Member

Summary

Improve code readability and simplify plugin environment handling by removing the RSBUILD_ALL_ENVIRONMENT_SYMBOL variable.

Checklist

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

@Copilot Copilot AI review requested due to automatic review settings July 17, 2025 08:51
Copy link

netlify bot commented Jul 17, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 0958f6f
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/6878dee2086a0b000868cff3
😎 Deploy Preview https://deploy-preview-5616--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: 76 (🟢 up 2 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 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 refactors the plugin environment handling system by removing the RSBUILD_ALL_ENVIRONMENT_SYMBOL constant and simplifying the logic for matching plugins to environments. The key changes include making environment specifications optional and changing the matching logic to be more explicit.

  • Removed RSBUILD_ALL_ENVIRONMENT_SYMBOL constant and related logic
  • Modified PluginMeta.environment to be optional, with undefined meaning "all environments"
  • Simplified environment matching logic with a new isEnvironmentMatch function
  • Refactored plugin removal tracking to use Sets instead of arrays

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/core/src/types/plugin.ts Made environment property optional in PluginMeta type with documentation
packages/core/src/pluginManager.ts Replaced symbol-based logic with optional environment handling and simplified matching
packages/core/src/initPlugins.ts Updated function calls to use new environment matching function
packages/core/src/hooks.ts Updated function calls to use new environment matching function

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@chenjiahan chenjiahan merged commit c76a72c into main Jul 17, 2025
12 checks passed
@chenjiahan chenjiahan deleted the plugin_environment_0717 branch July 17, 2025 11:37
@chenjiahan chenjiahan mentioned this pull request Jul 19, 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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy