@mui/codemod 9.0.0-beta.0 → 9.0.1
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/CHANGELOG.md +208 -1245
- package/README.md +163 -156
- package/package.json +3 -3
- package/v5.0.0/jss-to-styled.test/fifth.actual.js +1 -1
- package/v5.0.0/jss-to-styled.test/fifth.expected.js +1 -1
- package/v5.0.0/jss-to-styled.test/second.actual.js +1 -1
- package/v5.0.0/jss-to-styled.test/second.expected.js +1 -1
- package/v5.0.0/theme-spacing.test/large-actual.js +1 -1
- package/v5.0.0/theme-spacing.test/large-expected.js +1 -1
- package/v6.0.0/styled/test-cases/NestedSpread.actual.js +1 -1
- package/v6.0.0/styled/test-cases/NestedSpread.expected.js +1 -1
- package/v9.0.0/system-props/removeSystemProps.js +18 -1
- package/v9.0.0/system-props/test-cases/system-props-jsx-custom.actual.js +18 -0
- package/v9.0.0/system-props/test-cases/system-props-jsx-custom.expected.js +24 -0
- package/v9.0.0/system-props/test-cases/system-props-jsx.actual.js +32 -0
- package/v9.0.0/system-props/test-cases/system-props-jsx.expected.js +41 -0
- package/v9.0.0/system-props/test-cases/system-props-package-name-similar.actual.js +15 -0
- package/v9.0.0/system-props/test-cases/system-props-package-name-similar.expected.js +15 -0
- package/v9.0.0/system-props/test-cases/system-props-package-name.actual.js +20 -0
- package/v9.0.0/system-props/test-cases/system-props-package-name.expected.js +26 -0
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/codemod",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "Codemod scripts for Material UI.",
|
|
6
|
+
"license": "MIT",
|
|
6
7
|
"keywords": [
|
|
7
8
|
"react",
|
|
8
9
|
"react-component",
|
|
@@ -15,7 +16,6 @@
|
|
|
15
16
|
"url": "git+https://github.com/mui/material-ui.git",
|
|
16
17
|
"directory": "packages/mui-codemod"
|
|
17
18
|
},
|
|
18
|
-
"license": "MIT",
|
|
19
19
|
"homepage": "https://github.com/mui/material-ui/tree/master/packages/mui-codemod",
|
|
20
20
|
"funding": {
|
|
21
21
|
"type": "opencollective",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@mui/material-v5": "npm:@mui/material@5.18.0",
|
|
29
29
|
"jscodeshift": "^17.1.2",
|
|
30
30
|
"jscodeshift-add-imports": "^1.0.11",
|
|
31
|
-
"postcss": "^8.5.
|
|
31
|
+
"postcss": "^8.5.13",
|
|
32
32
|
"postcss-cli": "^11.0.1",
|
|
33
33
|
"yargs": "^17.7.2"
|
|
34
34
|
},
|
|
@@ -25,7 +25,7 @@ var _GlobalStyles = _interopRequireDefault(require("@mui/material/GlobalStyles")
|
|
|
25
25
|
var _styles = require("@mui/material/styles");
|
|
26
26
|
var _config = require("docs/config");
|
|
27
27
|
var _Link = _interopRequireDefault(require("docs/src/modules/components/Link"));
|
|
28
|
-
var _i18n = require("@mui/docs/i18n");
|
|
28
|
+
var _i18n = require("@mui/internal-core-docs/i18n");
|
|
29
29
|
var _useLazyCSS = _interopRequireDefault(require("docs/src/modules/utils/useLazyCSS"));
|
|
30
30
|
var _getUrlProduct = _interopRequireDefault(require("docs/src/modules/utils/getUrlProduct"));
|
|
31
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -25,7 +25,7 @@ var _GlobalStyles = _interopRequireDefault(require("@mui/material/GlobalStyles")
|
|
|
25
25
|
var _styles = require("@mui/material/styles");
|
|
26
26
|
var _config = require("docs/config");
|
|
27
27
|
var _Link = _interopRequireDefault(require("docs/src/modules/components/Link"));
|
|
28
|
-
var _i18n = require("@mui/docs/i18n");
|
|
28
|
+
var _i18n = require("@mui/internal-core-docs/i18n");
|
|
29
29
|
var _useLazyCSS = _interopRequireDefault(require("docs/src/modules/utils/useLazyCSS"));
|
|
30
30
|
var _getUrlProduct = _interopRequireDefault(require("docs/src/modules/utils/getUrlProduct"));
|
|
31
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -7,7 +7,7 @@ const Component = styled('div')(({
|
|
|
7
7
|
const palette = (theme.vars || theme).palette?.[ownerState.color];
|
|
8
8
|
return {
|
|
9
9
|
overflow: 'visible',
|
|
10
|
-
// Explicitly set the default value to solve a bug on
|
|
10
|
+
// Explicitly set the default value to solve a bug on IE 11.
|
|
11
11
|
color: (theme.vars || theme).palette.action.active,
|
|
12
12
|
transition: theme.transitions.create('background-color', {
|
|
13
13
|
duration: theme.transitions.duration.shortest
|
|
@@ -5,7 +5,7 @@ const Component = styled('div')(({
|
|
|
5
5
|
}) => {
|
|
6
6
|
const palette = (theme.vars || theme).palette?.[ownerState.color];
|
|
7
7
|
return {
|
|
8
|
-
// Explicitly set the default value to solve a bug on
|
|
8
|
+
// Explicitly set the default value to solve a bug on IE 11.
|
|
9
9
|
overflow: 'visible',
|
|
10
10
|
color: (theme.vars || theme).palette.action.active,
|
|
11
11
|
transition: theme.transitions.create('background-color', {
|
|
@@ -156,7 +156,24 @@ function removeSystemProps(file, api, options) {
|
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
158
|
const elementReplacement = {};
|
|
159
|
-
|
|
159
|
+
if (options.jsx) {
|
|
160
|
+
options.jsx.split(',').forEach(name => {
|
|
161
|
+
const trimmed = name.trim();
|
|
162
|
+
if (!trimmed) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
deprecatedElements.push(trimmed);
|
|
166
|
+
if (customReplacement[trimmed]) {
|
|
167
|
+
elementReplacement[trimmed] = customReplacement[trimmed];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
const packageName = options.packageName;
|
|
172
|
+
const importSources = ['@mui'];
|
|
173
|
+
if (packageName) {
|
|
174
|
+
importSources.push(packageName);
|
|
175
|
+
}
|
|
176
|
+
root.find(j.ImportDeclaration, decl => typeof decl.source.value === 'string' && importSources.some(source => decl.source.value === source || decl.source.value.startsWith(`${source}/`))).forEach(decl => {
|
|
160
177
|
decl.node.specifiers.forEach(spec => {
|
|
161
178
|
if (spec.type === 'ImportSpecifier') {
|
|
162
179
|
const name = spec.imported.name;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
// --jsx accepts arbitrary component names (e.g. DialogTitle, Skeleton, SvgIcon)
|
|
5
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(DialogTitle, {
|
|
6
|
+
display: "flex",
|
|
7
|
+
alignItems: "center",
|
|
8
|
+
children: "Title"
|
|
9
|
+
});
|
|
10
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(Skeleton, {
|
|
11
|
+
height: 60,
|
|
12
|
+
width: 100,
|
|
13
|
+
mb: 2
|
|
14
|
+
});
|
|
15
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(SvgIcon, {
|
|
16
|
+
width: "1rem",
|
|
17
|
+
height: "1rem"
|
|
18
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
// --jsx accepts arbitrary component names (e.g. DialogTitle, Skeleton, SvgIcon)
|
|
5
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(DialogTitle, {
|
|
6
|
+
sx: {
|
|
7
|
+
display: "flex",
|
|
8
|
+
alignItems: "center"
|
|
9
|
+
},
|
|
10
|
+
children: "Title"
|
|
11
|
+
});
|
|
12
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(Skeleton, {
|
|
13
|
+
sx: {
|
|
14
|
+
height: 60,
|
|
15
|
+
width: 100,
|
|
16
|
+
mb: 2
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(SvgIcon, {
|
|
20
|
+
sx: {
|
|
21
|
+
width: "1rem",
|
|
22
|
+
height: "1rem"
|
|
23
|
+
}
|
|
24
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
// No import statements — components are auto-imported
|
|
5
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(Box, {
|
|
6
|
+
display: "flex",
|
|
7
|
+
gap: 2,
|
|
8
|
+
p: 3,
|
|
9
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Typography, {
|
|
10
|
+
fontSize: 14,
|
|
11
|
+
fontWeight: 600,
|
|
12
|
+
children: "Hello"
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(Stack, {
|
|
16
|
+
direction: "row",
|
|
17
|
+
spacing: 2,
|
|
18
|
+
mt: 1
|
|
19
|
+
});
|
|
20
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(Link, {
|
|
21
|
+
color: "inherit",
|
|
22
|
+
href: "https://mui.com/",
|
|
23
|
+
mb: 2,
|
|
24
|
+
children: "MUI"
|
|
25
|
+
});
|
|
26
|
+
const sx = {
|
|
27
|
+
display: 'flex'
|
|
28
|
+
};
|
|
29
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(Box, {
|
|
30
|
+
m: 2,
|
|
31
|
+
sx: sx
|
|
32
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
// No import statements — components are auto-imported
|
|
5
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(Box, {
|
|
6
|
+
sx: {
|
|
7
|
+
display: "flex",
|
|
8
|
+
gap: 2,
|
|
9
|
+
p: 3
|
|
10
|
+
},
|
|
11
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Typography, {
|
|
12
|
+
sx: {
|
|
13
|
+
fontSize: 14,
|
|
14
|
+
fontWeight: 600
|
|
15
|
+
},
|
|
16
|
+
children: "Hello"
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(Stack, {
|
|
20
|
+
direction: "row",
|
|
21
|
+
spacing: 2,
|
|
22
|
+
sx: {
|
|
23
|
+
mt: 1
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(Link, {
|
|
27
|
+
color: "inherit",
|
|
28
|
+
href: "https://mui.com/",
|
|
29
|
+
sx: {
|
|
30
|
+
mb: 2
|
|
31
|
+
},
|
|
32
|
+
children: "MUI"
|
|
33
|
+
});
|
|
34
|
+
const sx = {
|
|
35
|
+
display: 'flex'
|
|
36
|
+
};
|
|
37
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(Box, {
|
|
38
|
+
sx: [{
|
|
39
|
+
m: 2
|
|
40
|
+
}, ...(Array.isArray(sx) ? sx : [sx])]
|
|
41
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _uiIcons = require("@acme/ui-icons");
|
|
5
|
+
var _Typography = _interopRequireDefault(require("@acme/ui-icons/Typography"));
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_uiIcons.Box, {
|
|
8
|
+
mt: 2,
|
|
9
|
+
p: 1
|
|
10
|
+
});
|
|
11
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
12
|
+
color: "text.secondary",
|
|
13
|
+
fontSize: "xl4",
|
|
14
|
+
children: "Hello"
|
|
15
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _uiIcons = require("@acme/ui-icons");
|
|
5
|
+
var _Typography = _interopRequireDefault(require("@acme/ui-icons/Typography"));
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_uiIcons.Box, {
|
|
8
|
+
mt: 2,
|
|
9
|
+
p: 1
|
|
10
|
+
});
|
|
11
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
12
|
+
color: "text.secondary",
|
|
13
|
+
fontSize: "xl4",
|
|
14
|
+
children: "Hello"
|
|
15
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _ui = require("@acme/ui");
|
|
5
|
+
var _components = require("@acme/ui/components");
|
|
6
|
+
var _Typography = _interopRequireDefault(require("@acme/ui/Typography"));
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Box, {
|
|
9
|
+
mt: 2,
|
|
10
|
+
p: 1
|
|
11
|
+
});
|
|
12
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Stack, {
|
|
13
|
+
flex: "1",
|
|
14
|
+
mb: 3
|
|
15
|
+
});
|
|
16
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
17
|
+
color: "text.secondary",
|
|
18
|
+
fontSize: "xl4",
|
|
19
|
+
children: "Hello"
|
|
20
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _ui = require("@acme/ui");
|
|
5
|
+
var _components = require("@acme/ui/components");
|
|
6
|
+
var _Typography = _interopRequireDefault(require("@acme/ui/Typography"));
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Box, {
|
|
9
|
+
sx: {
|
|
10
|
+
mt: 2,
|
|
11
|
+
p: 1
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Stack, {
|
|
15
|
+
sx: {
|
|
16
|
+
flex: "1",
|
|
17
|
+
mb: 3
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
21
|
+
sx: {
|
|
22
|
+
color: "text.secondary",
|
|
23
|
+
fontSize: "xl4"
|
|
24
|
+
},
|
|
25
|
+
children: "Hello"
|
|
26
|
+
});
|