Skip to content

Revert "fix(type): make the PostCSS plugin type loose (#5364)" #5366

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 1 commit into from
Jun 5, 2025

Conversation

chenjiahan
Copy link
Member

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

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

@Copilot Copilot AI review requested due to automatic review settings June 5, 2025 07:04
Copy link

netlify bot commented Jun 5, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 273b601
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/6841417081bc4f000866dc9f
😎 Deploy Preview https://deploy-preview-5366--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 13 from production)
Accessibility: 97 (no change from production)
Best Practices: 92 (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 reverts the previous loose typing for PostCSS plugins and restores stricter AcceptedPlugin/PostCSSPlugin types throughout the core and plugin code.

  • Changes PostCSSOptions.plugins from unknown[] to AcceptedPlugin[]
  • Narrows the addPlugins callback in ToolsPostCSSLoaderConfig to PostCSSPlugin
  • Updates getPostcssLoaderOptions to use AcceptedPlugin[] for extraPlugins

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 plugins property from unknown[] to AcceptedPlugin[] 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 addPlugins to PostCSSPlugin may 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 extraPlugins warrants adding tests to cover both PluginCreator and raw plugin scenarios via addPlugins to ensure compatibility.
const extraPlugins: AcceptedPlugin[] = [];

@chenjiahan chenjiahan merged commit 8ebfc0e into main Jun 5, 2025
11 of 12 checks passed
@chenjiahan chenjiahan deleted the revert_types_0605 branch June 5, 2025 07:14
@chenjiahan chenjiahan mentioned this pull request Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant