Revert "fix(type): make the PostCSS plugin type loose (#5364)"#5366
Merged
chenjiahan merged 1 commit intomainfrom Jun 5, 2025
Merged
Revert "fix(type): make the PostCSS plugin type loose (#5364)"#5366chenjiahan merged 1 commit intomainfrom
chenjiahan merged 1 commit intomainfrom
Conversation
This reverts commit 8772871.
✅ 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 reverts the previous loose typing for PostCSS plugins and restores stricter AcceptedPlugin/PostCSSPlugin types throughout the core and plugin code.
- Changes
PostCSSOptions.pluginsfromunknown[]toAcceptedPlugin[] - Narrows the
addPluginscallback inToolsPostCSSLoaderConfigtoPostCSSPlugin - Updates
getPostcssLoaderOptionsto useAcceptedPlugin[]forextraPlugins
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/core/src/types/thirdParty.ts | Restored plugins property to use AcceptedPlugin[] |
| packages/core/src/types/config.ts | Updated addPlugins signature to accept PostCSSPlugin |
| packages/core/src/plugins/css.ts | Changed extraPlugins and related logic to AcceptedPlugin |
Comments suppressed due to low confidence (3)
packages/core/src/types/thirdParty.ts:22
- Restricting the
pluginsproperty fromunknown[]toAcceptedPlugin[]is a breaking change for existing consumers. Consider bumping the major version or documenting this change in the migration guide.
plugins?: AcceptedPlugin[];
packages/core/src/types/config.ts:64
- Narrowing
addPluginstoPostCSSPluginmay break existing callback usage. Make sure to update public API docs and communicate this change in release notes.
{ addPlugins: (plugins: PostCSSPlugin | PostCSSPlugin[]) => void }
packages/core/src/plugins/css.ts:147
- This stricter typing for
extraPluginswarrants adding tests to cover bothPluginCreatorand raw plugin scenarios viaaddPluginsto ensure compatibility.
const extraPlugins: AcceptedPlugin[] = [];
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.

This reverts commit 8772871.
Summary
Revert #5364
This change does not fix the ecosystem CI. And considering that PostCSS types do not change frequently, it may be a better approach to let users upgrade the PostCSS version.
Checklist