@mui/codemod 6.0.2 → 6.1.1-dev.20240919-130050-82a6448768
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 +0 -13
- package/node/deprecations/all/deprecations-all.js +0 -2
- package/node/v1.0.0/color-imports.js +2 -2
- package/node/v5.0.0/theme-spacing.test/large-actual.js +3 -3
- package/node/v5.0.0/theme-spacing.test/large-expected.js +3 -3
- package/node/v6.0.0/grid-v2-props/grid-v2-props.js +4 -0
- package/node/v6.0.0/grid-v2-props/test-cases/actual.js +9 -0
- package/node/v6.0.0/grid-v2-props/test-cases/expected.js +3 -0
- package/node/v6.0.0/list-item-button-prop/list-item-button-prop.js +2 -2
- package/node/v6.0.0/styled/test-cases/ObjectMap.actual.js +0 -2
- package/node/v6.0.0/styled/test-cases/ObjectMap.expected.js +0 -2
- package/package.json +5 -5
- package/node/deprecations/grid-props/grid-props.js +0 -51
- package/node/deprecations/grid-props/index.js +0 -13
- package/node/deprecations/grid-props/test-cases/actual.js +0 -25
- package/node/deprecations/grid-props/test-cases/expected.js +0 -23
- package/node/deprecations/grid-props/test-cases/theme.actual.js +0 -24
- package/node/deprecations/grid-props/test-cases/theme.expected.js +0 -23
package/README.md
CHANGED
|
@@ -1103,19 +1103,6 @@ npx @mui/codemod@latest deprecations/form-control-label-props <path>
|
|
|
1103
1103
|
npx @mui/codemod@latest deprecations/list-item-props <path>
|
|
1104
1104
|
```
|
|
1105
1105
|
|
|
1106
|
-
#### `grid-props`
|
|
1107
|
-
|
|
1108
|
-
```diff
|
|
1109
|
-
<Grid
|
|
1110
|
-
- wrap="nowrap"
|
|
1111
|
-
+ flexWrap="nowrap"
|
|
1112
|
-
/>
|
|
1113
|
-
```
|
|
1114
|
-
|
|
1115
|
-
```bash
|
|
1116
|
-
npx @mui/codemod@latest deprecations/grid-props <path>
|
|
1117
|
-
```
|
|
1118
|
-
|
|
1119
1106
|
#### `image-list-item-bar-classes`
|
|
1120
1107
|
|
|
1121
1108
|
JS transforms:
|
|
@@ -17,7 +17,6 @@ var _circularProgressClasses = _interopRequireDefault(require("../circular-progr
|
|
|
17
17
|
var _dividerProps = _interopRequireDefault(require("../divider-props"));
|
|
18
18
|
var _filledInputProps = _interopRequireDefault(require("../filled-input-props"));
|
|
19
19
|
var _formControlLabelProps = _interopRequireDefault(require("../form-control-label-props"));
|
|
20
|
-
var _gridProps = _interopRequireDefault(require("../grid-props"));
|
|
21
20
|
var _imageListItemBarClasses = _interopRequireDefault(require("../image-list-item-bar-classes"));
|
|
22
21
|
var _inputBaseProps = _interopRequireDefault(require("../input-base-props"));
|
|
23
22
|
var _inputProps = _interopRequireDefault(require("../input-props"));
|
|
@@ -47,7 +46,6 @@ function deprecationsAll(file, api, options) {
|
|
|
47
46
|
file.source = (0, _dividerProps.default)(file, api, options);
|
|
48
47
|
file.source = (0, _filledInputProps.default)(file, api, options);
|
|
49
48
|
file.source = (0, _formControlLabelProps.default)(file, api, options);
|
|
50
|
-
file.source = (0, _gridProps.default)(file, api, options);
|
|
51
49
|
file.source = (0, _imageListItemBarClasses.default)(file, api, options);
|
|
52
50
|
file.source = (0, _inputBaseProps.default)(file, api, options);
|
|
53
51
|
file.source = (0, _inputProps.default)(file, api, options);
|
|
@@ -24,7 +24,7 @@ function colorAccent(colorIdentifier) {
|
|
|
24
24
|
* @param {string} colorPalette
|
|
25
25
|
*/
|
|
26
26
|
function colorImportPath(colorPalette) {
|
|
27
|
-
return commonColors.
|
|
27
|
+
return commonColors.includes(colorPalette) ? 'common' : colorPalette;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -81,7 +81,7 @@ function transformMemberImports(j, root, importPath, targetPath) {
|
|
|
81
81
|
const colorIdentifier = j.identifier(colorModuleName);
|
|
82
82
|
|
|
83
83
|
// import color module (if not already imported)
|
|
84
|
-
if (importDeclarations.map(p => p.source.value).
|
|
84
|
+
if (!importDeclarations.map(p => p.source.value).includes(modulePath)) {
|
|
85
85
|
importDeclarations.push(j.importDeclaration([j.importDefaultSpecifier(colorIdentifier)], j.literal(modulePath)));
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -248,8 +248,8 @@ function AppSearch() {
|
|
|
248
248
|
const searchButtonRef = React.useRef(null);
|
|
249
249
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
250
250
|
const [initialQuery, setInitialQuery] = React.useState(undefined);
|
|
251
|
-
const facetFilterLanguage = _config.LANGUAGES_SSR.
|
|
252
|
-
const macOS = window.navigator.platform.toUpperCase().
|
|
251
|
+
const facetFilterLanguage = _config.LANGUAGES_SSR.includes(userLanguage) ? `language:${userLanguage}` : `language:en`;
|
|
252
|
+
const macOS = window.navigator.platform.toUpperCase().includes('MAC');
|
|
253
253
|
const onOpen = React.useCallback(() => {
|
|
254
254
|
setIsOpen(true);
|
|
255
255
|
}, [setIsOpen]);
|
|
@@ -328,7 +328,7 @@ function AppSearch() {
|
|
|
328
328
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(Shortcut, {
|
|
329
329
|
children: [macOS ? '⌘' : 'Ctrl+', "K"]
|
|
330
330
|
})]
|
|
331
|
-
}), isOpen && /*#__PURE__*/(0, _reactDom.createPortal)(
|
|
331
|
+
}), isOpen && /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.DocSearchModal, {
|
|
332
332
|
initialQuery: initialQuery,
|
|
333
333
|
appId: 'TZGZ85B9TB',
|
|
334
334
|
apiKey: '8177dfb3e2be72b241ffb8c5abafa899',
|
|
@@ -248,8 +248,8 @@ function AppSearch() {
|
|
|
248
248
|
const searchButtonRef = React.useRef(null);
|
|
249
249
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
250
250
|
const [initialQuery, setInitialQuery] = React.useState(undefined);
|
|
251
|
-
const facetFilterLanguage = _config.LANGUAGES_SSR.
|
|
252
|
-
const macOS = window.navigator.platform.toUpperCase().
|
|
251
|
+
const facetFilterLanguage = _config.LANGUAGES_SSR.includes(userLanguage) ? `language:${userLanguage}` : `language:en`;
|
|
252
|
+
const macOS = window.navigator.platform.toUpperCase().includes('MAC');
|
|
253
253
|
const onOpen = React.useCallback(() => {
|
|
254
254
|
setIsOpen(true);
|
|
255
255
|
}, [setIsOpen]);
|
|
@@ -328,7 +328,7 @@ function AppSearch() {
|
|
|
328
328
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(Shortcut, {
|
|
329
329
|
children: [macOS ? '⌘' : 'Ctrl+', "K"]
|
|
330
330
|
})]
|
|
331
|
-
}), isOpen && /*#__PURE__*/(0, _reactDom.createPortal)(
|
|
331
|
+
}), isOpen && /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.DocSearchModal, {
|
|
332
332
|
initialQuery: initialQuery,
|
|
333
333
|
appId: 'TZGZ85B9TB',
|
|
334
334
|
apiKey: '8177dfb3e2be72b241ffb8c5abafa899',
|
|
@@ -137,6 +137,10 @@ function gridV2Props(file, api, options) {
|
|
|
137
137
|
}
|
|
138
138
|
el.node.openingElement.attributes = el.node.openingElement.attributes.filter(attr => !breakpoints.includes(attr?.name?.name.replace('Offset', '')));
|
|
139
139
|
el.node.openingElement.attributes = el.node.openingElement.attributes.filter(attr => !attributesToPrune.includes(attr));
|
|
140
|
+
const itemProp = el.node.openingElement.attributes.find(attr => attr.type === 'JSXAttribute' && attr.name.name === 'item');
|
|
141
|
+
if (itemProp) {
|
|
142
|
+
el.node.openingElement.attributes = el.node.openingElement.attributes.filter(attr => attr.type === 'JSXAttribute' && attr.name.name !== 'item');
|
|
143
|
+
}
|
|
140
144
|
});
|
|
141
145
|
return root.toSource(printOptions);
|
|
142
146
|
}
|
|
@@ -28,6 +28,15 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
28
28
|
/*#__PURE__*/(0, _jsxRuntime.jsx)(_joy.Grid, {
|
|
29
29
|
xs: 2
|
|
30
30
|
});
|
|
31
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
32
|
+
item: true
|
|
33
|
+
});
|
|
34
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
35
|
+
item: true
|
|
36
|
+
});
|
|
37
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
38
|
+
item: false
|
|
39
|
+
});
|
|
31
40
|
|
|
32
41
|
// Transforms responsive sizes
|
|
33
42
|
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
@@ -28,6 +28,9 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
28
28
|
/*#__PURE__*/(0, _jsxRuntime.jsx)(_joy.Grid, {
|
|
29
29
|
size: 2
|
|
30
30
|
});
|
|
31
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
32
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
33
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
31
34
|
|
|
32
35
|
// Transforms responsive sizes
|
|
33
36
|
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
@@ -62,7 +62,7 @@ function transformer(file, api, options) {
|
|
|
62
62
|
root.find(j.ImportDeclaration).filter(path => path.node.source.value === '@mui/material/ListItem').filter(path => {
|
|
63
63
|
path.node.specifiers.forEach(specifier => {
|
|
64
64
|
if (specifier.type === 'ImportDefaultSpecifier') {
|
|
65
|
-
if (importsToRemove.
|
|
65
|
+
if (importsToRemove.includes(specifier.local.name)) {
|
|
66
66
|
path.node.specifiers = path.node.specifiers.filter(spec => spec !== specifier);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -74,7 +74,7 @@ function transformer(file, api, options) {
|
|
|
74
74
|
}).remove();
|
|
75
75
|
root.find(j.ImportDeclaration).filter(path => path.node.source.value === '@mui/material').filter(path => {
|
|
76
76
|
path.node.specifiers.forEach(specifier => {
|
|
77
|
-
if (specifier.type === 'ImportSpecifier' && specifier.imported.name === 'ListItem' && importsToRemove.
|
|
77
|
+
if (specifier.type === 'ImportSpecifier' && specifier.imported.name === 'ListItem' && importsToRemove.includes(specifier.local.name)) {
|
|
78
78
|
path.node.specifiers = path.node.specifiers.filter(spec => spec !== specifier);
|
|
79
79
|
}
|
|
80
80
|
});
|
|
@@ -7,8 +7,6 @@ const IconRoot = styled('span')(({
|
|
|
7
7
|
userSelect: 'none',
|
|
8
8
|
width: '1em',
|
|
9
9
|
height: '1em',
|
|
10
|
-
// Chrome fix for https://bugs.chromium.org/p/chromium/issues/detail?id=820541
|
|
11
|
-
// To remove at some point.
|
|
12
10
|
overflow: 'hidden',
|
|
13
11
|
display: 'inline-block',
|
|
14
12
|
// allow overflow hidden to take action
|
|
@@ -6,8 +6,6 @@ const IconRoot = styled('span')(({
|
|
|
6
6
|
userSelect: 'none',
|
|
7
7
|
width: '1em',
|
|
8
8
|
height: '1em',
|
|
9
|
-
// Chrome fix for https://bugs.chromium.org/p/chromium/issues/detail?id=820541
|
|
10
|
-
// To remove at some point.
|
|
11
9
|
overflow: 'hidden',
|
|
12
10
|
// allow overflow hidden to take action
|
|
13
11
|
display: 'inline-block',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/codemod",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.1-dev.20240919-130050-82a6448768",
|
|
4
4
|
"bin": "./codemod.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "MUI Team",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "https://github.com/mui/material-ui.git",
|
|
17
|
+
"url": "git+https://github.com/mui/material-ui.git",
|
|
18
18
|
"directory": "packages/mui-codemod"
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/core": "^7.25.2",
|
|
28
|
-
"@babel/runtime": "^7.25.
|
|
29
|
-
"@babel/traverse": "^7.25.
|
|
28
|
+
"@babel/runtime": "^7.25.6",
|
|
29
|
+
"@babel/traverse": "^7.25.6",
|
|
30
30
|
"jscodeshift": "^0.16.1",
|
|
31
31
|
"jscodeshift-add-imports": "^1.0.11",
|
|
32
|
-
"postcss": "^8.4.
|
|
32
|
+
"postcss": "^8.4.47",
|
|
33
33
|
"postcss-cli": "^11.0.0",
|
|
34
34
|
"yargs": "^17.7.2"
|
|
35
35
|
},
|
|
@@ -1,51 +0,0 @@
|
|
|
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 _findComponentJSX = _interopRequireDefault(require("../../util/findComponentJSX"));
|
|
9
|
-
/**
|
|
10
|
-
* @param {import('jscodeshift').FileInfo} file
|
|
11
|
-
* @param {import('jscodeshift').API} api
|
|
12
|
-
*/
|
|
13
|
-
function transformer(file, api, options) {
|
|
14
|
-
const j = api.jscodeshift;
|
|
15
|
-
const root = j(file.source);
|
|
16
|
-
const printOptions = options.printOptions;
|
|
17
|
-
const filterJSXAttr = (attr, name) => attr.type === 'JSXAttribute' && attr.name.name === name;
|
|
18
|
-
(0, _findComponentJSX.default)(j, {
|
|
19
|
-
root,
|
|
20
|
-
componentName: 'Grid'
|
|
21
|
-
}, gridElement => {
|
|
22
|
-
const attrs = gridElement.node.openingElement.attributes;
|
|
23
|
-
const wrapPropIndex = attrs.findIndex(attr => filterJSXAttr(attr, 'wrap'));
|
|
24
|
-
if (wrapPropIndex !== -1) {
|
|
25
|
-
if (attrs.findIndex(attr => filterJSXAttr(attr, 'flexWrap')) !== -1) {
|
|
26
|
-
attrs.splice(wrapPropIndex, 1);
|
|
27
|
-
} else {
|
|
28
|
-
attrs[wrapPropIndex].name.name = 'flexWrap';
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
root.find(j.ObjectProperty, {
|
|
33
|
-
key: {
|
|
34
|
-
name: 'MuiGrid'
|
|
35
|
-
}
|
|
36
|
-
}).forEach(path => {
|
|
37
|
-
const defaultProps = path.value.value.properties.find(({
|
|
38
|
-
key
|
|
39
|
-
}) => key.name === 'defaultProps');
|
|
40
|
-
const props = defaultProps.value.properties;
|
|
41
|
-
const wrapPropIndex = props.findIndex(prop => prop.key.name === 'wrap');
|
|
42
|
-
if (wrapPropIndex !== -1) {
|
|
43
|
-
if (props.findIndex(prop => prop.key.name === 'flexWrap') !== -1) {
|
|
44
|
-
props.splice(wrapPropIndex, 1);
|
|
45
|
-
} else {
|
|
46
|
-
props[wrapPropIndex].key.name = 'flexWrap';
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
return root.toSource(printOptions);
|
|
51
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
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 _gridProps.default;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
var _gridProps = _interopRequireDefault(require("./grid-props"));
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
|
|
5
|
-
var _material = require("@mui/material");
|
|
6
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
-
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
8
|
-
wrap: "wrap-reverse"
|
|
9
|
-
});
|
|
10
|
-
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
11
|
-
wrap: "wrap-reverse"
|
|
12
|
-
});
|
|
13
|
-
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
14
|
-
wrap: "wrap-reverse",
|
|
15
|
-
flexWrap: "wrap"
|
|
16
|
-
});
|
|
17
|
-
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
18
|
-
wrap: "wrap-reverse",
|
|
19
|
-
flexWrap: "wrap"
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
// should skip non MUI components
|
|
23
|
-
/*#__PURE__*/(0, _jsxRuntime.jsx)(NonMuiGrid, {
|
|
24
|
-
wrap: "wrap-reverse"
|
|
25
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
|
|
5
|
-
var _material = require("@mui/material");
|
|
6
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
-
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
8
|
-
flexWrap: "wrap-reverse"
|
|
9
|
-
});
|
|
10
|
-
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
11
|
-
flexWrap: "wrap-reverse"
|
|
12
|
-
});
|
|
13
|
-
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
14
|
-
flexWrap: "wrap"
|
|
15
|
-
});
|
|
16
|
-
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
17
|
-
flexWrap: "wrap"
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// should skip non MUI components
|
|
21
|
-
/*#__PURE__*/(0, _jsxRuntime.jsx)(NonMuiGrid, {
|
|
22
|
-
wrap: "wrap-reverse"
|
|
23
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
fn({
|
|
4
|
-
MuiGrid: {
|
|
5
|
-
defaultProps: {
|
|
6
|
-
wrap: 'wrap'
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
fn({
|
|
11
|
-
MuiGrid: {
|
|
12
|
-
defaultProps: {
|
|
13
|
-
wrap: 'wrap-reverse'
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
fn({
|
|
18
|
-
MuiGrid: {
|
|
19
|
-
defaultProps: {
|
|
20
|
-
wrap: 'wrap-reverse',
|
|
21
|
-
flexWrap: 'wrap'
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
fn({
|
|
4
|
-
MuiGrid: {
|
|
5
|
-
defaultProps: {
|
|
6
|
-
flexWrap: 'wrap'
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
fn({
|
|
11
|
-
MuiGrid: {
|
|
12
|
-
defaultProps: {
|
|
13
|
-
flexWrap: 'wrap-reverse'
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
fn({
|
|
18
|
-
MuiGrid: {
|
|
19
|
-
defaultProps: {
|
|
20
|
-
flexWrap: 'wrap'
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
});
|