Skip to content

[codemod] Add packageName support to the v9 system props codemod#48253

Merged
ZeeshanTamboli merged 5 commits intomui:masterfrom
franco-dias:fix/system-props-v9-codemod-package-name
Apr 15, 2026
Merged

[codemod] Add packageName support to the v9 system props codemod#48253
ZeeshanTamboli merged 5 commits intomui:masterfrom
franco-dias:fix/system-props-v9-codemod-package-name

Conversation

@franco-dias
Copy link
Copy Markdown
Contributor

Summary

The v9.0.0/system-props codemod ignores the --packageName CLI option. The import matching is hardcoded to only match @mui:

root.find(j.ImportDeclaration, decl => decl.source.value.includes('@mui'))

The CLI (codemod.js) accepts --packageName and passes it through to jscodeshift as options.packageName, but removeSystemProps.js never reads it. This means the option documented in the README has no effect for this codemod.

This is a problem for design systems that re-export MUI components under a custom package name. Those usages are silently skipped.

Fix

Read options.packageName and include it in the import declaration filter. When not provided, behavior is unchanged -- only @mui imports are matched.

const packageName = options.packageName;
root.find(j.ImportDeclaration, decl =>
  decl.source.value.includes('@mui') ||
  (packageName && decl.source.value.includes(packageName))
)

Add unit tests to cover the behavior changes when the packageName option is provided.

@mui-bot
Copy link
Copy Markdown

mui-bot commented Apr 9, 2026

Netlify deploy preview

https://deploy-preview-48253--material-ui.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 9ae7708

@franco-dias franco-dias changed the title [codemod] Adds packageName support to the v9 system props codemod [codemod] Add packageName support to the v9 system props codemod Apr 9, 2026
@zannager zannager added the package: codemod Specific to codemod. label Apr 13, 2026
@zannager zannager requested a review from siriwatknp April 13, 2026 13:04
@code-infra-dashboard
Copy link
Copy Markdown

code-infra-dashboard bot commented Apr 15, 2026

Bundle size

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Deploy preview

https://deploy-preview-48253--material-ui.netlify.app/


Check out the code infra dashboard for more information about this PR.

@ZeeshanTamboli ZeeshanTamboli added the type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. label Apr 15, 2026
Copy link
Copy Markdown
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

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

I updated the logic to make sure it does not match unrelated imports like @acme/ui-icons or foo/@acme/ui/bar for example for --packageName=@acme/ui. Also added the relevant test.

Thanks for the PR.

@ZeeshanTamboli ZeeshanTamboli merged commit c8b72bc into mui:master Apr 15, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: codemod Specific to codemod. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants