@mui/codemod 6.1.5 → 6.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2136,7 +2136,7 @@ The list includes these transformers
2136
2136
 
2137
2137
  #### `adapter-v4`
2138
2138
 
2139
- Imports and inserts `adaptV4Theme` into `createTheme` (or `createMuiTheme`)
2139
+ Imports and inserts `adaptV4Theme` into `createTheme()` (or `createMuiTheme`)
2140
2140
 
2141
2141
  ```diff
2142
2142
  +import { adaptV4Theme } from '@material-ui/core/styles';
@@ -2422,7 +2422,7 @@ npx @mui/codemod@latest v5.0.0/core-styles-import <path>
2422
2422
 
2423
2423
  #### `create-theme`
2424
2424
 
2425
- Renames the function `createMuiTheme` to `createTheme`
2425
+ Renames the function `createMuiTheme()` to `createTheme()`
2426
2426
 
2427
2427
  ```diff
2428
2428
  -import { createMuiTheme } from '@material-ui/core/styles';
@@ -2503,7 +2503,7 @@ You can find more details about this breaking change in [the migration guide](ht
2503
2503
 
2504
2504
  #### `fade-rename-alpha`
2505
2505
 
2506
- Renames the `fade` style utility import and calls to `alpha`.
2506
+ Renames the `fade` style utility import and calls to `alpha()`.
2507
2507
 
2508
2508
  ```diff
2509
2509
  -import { fade, lighten } from '@material-ui/core/styles';
@@ -143,7 +143,7 @@ function removeSystemProps(file, api, options) {
143
143
  const deprecatedElements = [];
144
144
  const customReplacement = {
145
145
  Typography: {
146
- matcher: (key, val) => key !== 'color' || val.value?.includes('.') && val.value !== 'inherit' || val.value === 'divider'
146
+ matcher: (key, val) => key !== 'color' || val.value?.includes('.') && val.value !== 'inherit' || val.value === 'divider' || val.value.startsWith('#') || val.value.match(/\(.*\)/)
147
147
  },
148
148
  Link: {
149
149
  matcher: key => key !== 'color'
@@ -153,8 +153,12 @@ function removeSystemProps(file, api, options) {
153
153
  root.find(j.ImportDeclaration, decl => decl.source.value.includes('@mui')).forEach(decl => {
154
154
  decl.node.specifiers.forEach(spec => {
155
155
  if (spec.type === 'ImportSpecifier') {
156
- if (components.includes(spec.imported.name)) {
156
+ const name = spec.imported.name;
157
+ if (components.includes(name)) {
157
158
  deprecatedElements.push(spec.local.name);
159
+ if (customReplacement[name]) {
160
+ elementReplacement[spec.local.name] = customReplacement[name];
161
+ }
158
162
  }
159
163
  }
160
164
  if (spec.type === 'ImportDefaultSpecifier') {
@@ -27,6 +27,14 @@ const sx = {
27
27
  display: 'flex'
28
28
  };
29
29
  const ml = 2;
30
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
31
+ color: "#fff",
32
+ mb: 5
33
+ });
34
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
35
+ color: "hsl(200 30% 30%)",
36
+ mb: 5
37
+ });
30
38
  /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
31
39
  variant: "body1",
32
40
  color: "primary.main",
@@ -33,6 +33,18 @@ const sx = {
33
33
  display: 'flex'
34
34
  };
35
35
  const ml = 2;
36
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
37
+ sx: {
38
+ color: "#fff",
39
+ mb: 5
40
+ }
41
+ });
42
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
43
+ sx: {
44
+ color: "hsl(200 30% 30%)",
45
+ mb: 5
46
+ }
47
+ });
36
48
  /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
37
49
  variant: "body1",
38
50
  sx: [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/codemod",
3
- "version": "6.1.5",
3
+ "version": "6.1.7",
4
4
  "bin": "./codemod.js",
5
5
  "private": false,
6
6
  "author": "MUI Team",
@@ -24,10 +24,10 @@
24
24
  "url": "https://opencollective.com/mui-org"
25
25
  },
26
26
  "dependencies": {
27
- "@babel/core": "^7.25.8",
28
- "@babel/runtime": "^7.25.7",
29
- "@babel/traverse": "^7.25.7",
30
- "jscodeshift": "^0.16.1",
27
+ "@babel/core": "^7.26.0",
28
+ "@babel/runtime": "^7.26.0",
29
+ "@babel/traverse": "^7.25.9",
30
+ "jscodeshift": "^17.1.1",
31
31
  "jscodeshift-add-imports": "^1.0.11",
32
32
  "postcss": "^8.4.47",
33
33
  "postcss-cli": "^11.0.0",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/chai": "^4.3.20",
38
- "@types/jscodeshift": "0.11.11",
38
+ "@types/jscodeshift": "0.12.0",
39
39
  "chai": "^4.5.0"
40
40
  },
41
41
  "sideEffects": false,