@mui/codemod 6.1.9 → 6.2.0

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
@@ -1107,6 +1107,32 @@ npx @mui/codemod@latest deprecations/form-control-label-props <path>
1107
1107
  npx @mui/codemod@latest deprecations/list-item-props <path>
1108
1108
  ```
1109
1109
 
1110
+ #### `list-item-text-props`
1111
+
1112
+ ```diff
1113
+ <ListItemText
1114
+ - primaryTypographyProps={primaryTypographyProps}
1115
+ + slotProps={{ primary: primaryTypographyProps }}
1116
+ - secondaryTypographyProps={secondaryTypographyProps}
1117
+ + slotProps={{ secondary: secondaryTypographyProps }}
1118
+ />
1119
+ ```
1120
+
1121
+ ```diff
1122
+ MuiListItemText: {
1123
+ defaultProps: {
1124
+ - primaryTypographyProps:primaryTypographyProps
1125
+ + slotProps:{ primary: primaryTypographyProps }
1126
+ - secondaryTypographyProps:secondaryTypographyProps
1127
+ + slotProps:{ secondary: secondaryTypographyProps }
1128
+ },
1129
+ },
1130
+ ```
1131
+
1132
+ ```bash
1133
+ npx @mui/codemod@latest deprecations/list-item-text-props <path>
1134
+ ```
1135
+
1110
1136
  #### `image-list-item-bar-classes`
1111
1137
 
1112
1138
  JS transforms:
@@ -22,6 +22,7 @@ var _formControlLabelProps = _interopRequireDefault(require("../form-control-lab
22
22
  var _imageListItemBarClasses = _interopRequireDefault(require("../image-list-item-bar-classes"));
23
23
  var _inputBaseProps = _interopRequireDefault(require("../input-base-props"));
24
24
  var _inputProps = _interopRequireDefault(require("../input-props"));
25
+ var _listItemTextProps = _interopRequireDefault(require("../list-item-text-props"));
25
26
  var _modalProps = _interopRequireDefault(require("../modal-props"));
26
27
  var _outlinedInputProps = _interopRequireDefault(require("../outlined-input-props"));
27
28
  var _paginationItemClasses = _interopRequireDefault(require("../pagination-item-classes"));
@@ -55,6 +56,7 @@ function deprecationsAll(file, api, options) {
55
56
  file.source = (0, _imageListItemBarClasses.default)(file, api, options);
56
57
  file.source = (0, _inputBaseProps.default)(file, api, options);
57
58
  file.source = (0, _inputProps.default)(file, api, options);
59
+ file.source = (0, _listItemTextProps.default)(file, api, options);
58
60
  file.source = (0, _modalProps.default)(file, api, options);
59
61
  file.source = (0, _outlinedInputProps.default)(file, api, options);
60
62
  file.source = (0, _paginationItemClasses.default)(file, api, options);
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "default", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _listItemTextProps.default;
11
+ }
12
+ });
13
+ var _listItemTextProps = _interopRequireDefault(require("./list-item-text-props"));
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = transformer;
8
+ var _replaceComponentsWithSlots = _interopRequireDefault(require("../utils/replaceComponentsWithSlots"));
9
+ var _movePropIntoSlotProps = _interopRequireDefault(require("../utils/movePropIntoSlotProps"));
10
+ /**
11
+ * @param {import('jscodeshift').FileInfo} file
12
+ * @param {import('jscodeshift').API} api
13
+ */
14
+ function transformer(file, api, options) {
15
+ const j = api.jscodeshift;
16
+ const root = j(file.source);
17
+ const printOptions = options.printOptions;
18
+ (0, _replaceComponentsWithSlots.default)(j, {
19
+ root,
20
+ componentName: 'ListItemText'
21
+ });
22
+ (0, _movePropIntoSlotProps.default)(j, {
23
+ root,
24
+ componentName: 'ListItemText',
25
+ propName: 'primaryTypographyProps',
26
+ slotName: 'primary'
27
+ });
28
+ (0, _movePropIntoSlotProps.default)(j, {
29
+ root,
30
+ componentName: 'ListItemText',
31
+ propName: 'secondaryTypographyProps',
32
+ slotName: 'secondary'
33
+ });
34
+ return root.toSource(printOptions);
35
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _ListItemText = _interopRequireDefault(require("@mui/material/ListItemText"));
5
+ var _jsxRuntime = require("react/jsx-runtime");
6
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
7
+ secondaryTypographyProps: secondaryTypographyProps
8
+ });
9
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
10
+ primaryTypographyProps: primaryTypographyProps
11
+ });
12
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
13
+ primaryTypographyProps: primaryTypographyProps,
14
+ secondaryTypographyProps: secondaryTypographyProps
15
+ });
16
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
17
+ slotProps: {
18
+ primary: primarySlotProps
19
+ },
20
+ secondaryTypographyProps: secondaryTypographyProps
21
+ });
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _ListItemText = _interopRequireDefault(require("@mui/material/ListItemText"));
5
+ var _jsxRuntime = require("react/jsx-runtime");
6
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
7
+ slotProps: {
8
+ secondary: secondaryTypographyProps
9
+ }
10
+ });
11
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
12
+ slotProps: {
13
+ primary: primaryTypographyProps
14
+ }
15
+ });
16
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
17
+ slotProps: {
18
+ primary: primaryTypographyProps,
19
+ secondary: secondaryTypographyProps
20
+ }
21
+ });
22
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
23
+ slotProps: {
24
+ primary: primarySlotProps,
25
+ secondary: secondaryTypographyProps
26
+ }
27
+ });
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ fn({
4
+ MuiListItemText: {
5
+ defaultProps: {
6
+ primaryTypographyProps: primaryTypographyProps
7
+ }
8
+ }
9
+ });
10
+ fn({
11
+ MuiListItemText: {
12
+ defaultProps: {
13
+ secondaryTypographyProps: secondaryTypographyProps
14
+ }
15
+ }
16
+ });
17
+ fn({
18
+ MuiListItemText: {
19
+ defaultProps: {
20
+ primaryTypographyProps: primaryTypographyProps,
21
+ secondaryTypographyProps: secondaryTypographyProps
22
+ }
23
+ }
24
+ });
25
+ fn({
26
+ MuiListItemText: {
27
+ defaultProps: {
28
+ slotProps: {
29
+ primary: primarySlotProps
30
+ },
31
+ secondaryTypographyProps: secondaryTypographyProps
32
+ }
33
+ }
34
+ });
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ fn({
4
+ MuiListItemText: {
5
+ defaultProps: {
6
+ slotProps: {
7
+ primary: primaryTypographyProps
8
+ }
9
+ }
10
+ }
11
+ });
12
+ fn({
13
+ MuiListItemText: {
14
+ defaultProps: {
15
+ slotProps: {
16
+ secondary: secondaryTypographyProps
17
+ }
18
+ }
19
+ }
20
+ });
21
+ fn({
22
+ MuiListItemText: {
23
+ defaultProps: {
24
+ slotProps: {
25
+ primary: primaryTypographyProps,
26
+ secondary: secondaryTypographyProps
27
+ }
28
+ }
29
+ }
30
+ });
31
+ fn({
32
+ MuiListItemText: {
33
+ defaultProps: {
34
+ slotProps: {
35
+ primary: primarySlotProps,
36
+ secondary: secondaryTypographyProps
37
+ }
38
+ }
39
+ }
40
+ });
@@ -8,5 +8,7 @@ exports.default = transformer;
8
8
  * @param {import('jscodeshift').FileInfo} file
9
9
  */
10
10
  function transformer(file) {
11
- return file.source.replace(/\n?import.*core\/RootRef['"];?/gm, '').replace(/\n?import {\s?RootRef\s?} from ['"]@material-ui\/core\/?['"];?/gm, '').replace(/({.*)(RootRef,?)(.*})/gm, '$1$3').replace(/<RootRef.*>/gm, '<>').replace(/<\/RootRef>/gm, '</>');
11
+ // The regexes below have a negative lookahead to prevent ReDoS
12
+ // See https://github.com/mui/material-ui/issues/44078
13
+ return file.source.replace(/\n?import(?!import).*core\/RootRef['"];?/gm, '').replace(/\n?import {\s?RootRef\s?} from ['"]@material-ui\/core\/?['"];?/gm, '').replace(/({.*)(RootRef,?)(.*})/gm, '$1$3').replace(/<RootRef(?!<RootRef).*>/gm, '<>').replace(/<\/RootRef>/gm, '</>');
12
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/codemod",
3
- "version": "6.1.9",
3
+ "version": "6.2.0",
4
4
  "bin": "./codemod.js",
5
5
  "private": false,
6
6
  "author": "MUI Team",