@mui/codemod 5.12.2 → 5.12.3
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/codemod.js +0 -0
- package/node/v5.0.0/grid-list-component.test/actual.js +0 -1
- package/node/v5.0.0/grid-list-component.test/expected.js +0 -1
- package/node/v5.0.0/jss-to-tss-react.test/actual-from-material-ui-core-styles.js +0 -1
- package/node/v5.0.0/jss-to-tss-react.test/actual-from-material-ui-core.js +7 -0
- package/node/v5.0.0/jss-to-tss-react.test/actual-todo-comments.js +7 -0
- package/node/v5.0.0/jss-to-tss-react.test/actual-typescript.js +1 -3
- package/node/v5.0.0/jss-to-tss-react.test/expected-from-material-ui-core-styles.js +0 -1
- package/node/v5.0.0/jss-to-tss-react.test/expected-from-material-ui-core.js +3 -0
- package/node/v5.0.0/jss-to-tss-react.test/expected-todo-comments.js +8 -1
- package/node/v5.0.0/mui-replace.test/actual.js +7 -1
- package/node/v5.0.0/mui-replace.test/expected.js +7 -1
- package/node/v5.0.0/preset-safe.test/expected.js +1 -2
- package/node/v5.0.0/root-ref.test/actual.js +1 -3
- package/package.json +3 -3
package/codemod.js
CHANGED
|
File without changes
|
|
@@ -7,7 +7,6 @@ var _other = _interopRequireDefault(require("./other"));
|
|
|
7
7
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
8
|
// import GridList from '@material-ui/core/GridList';
|
|
9
9
|
// import GridListTile from '@material-ui/core/GridListTile';
|
|
10
|
-
|
|
11
10
|
/*#__PURE__*/(0, _jsxRuntime.jsxs)(_core.GridList, {
|
|
12
11
|
cellHeight: "auto",
|
|
13
12
|
cols: numOfCols,
|
|
@@ -7,7 +7,6 @@ var _other = _interopRequireDefault(require("./other"));
|
|
|
7
7
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
8
|
// import ImageList from '@material-ui/core/ImageList';
|
|
9
9
|
// import ImageListItem from '@material-ui/core/ImageListItem';
|
|
10
|
-
|
|
11
10
|
/*#__PURE__*/(0, _jsxRuntime.jsxs)(_core.ImageList, {
|
|
12
11
|
cellHeight: "auto",
|
|
13
12
|
cols: numOfCols,
|
|
@@ -14,7 +14,6 @@ Sandboxes for verifying correct behavior:
|
|
|
14
14
|
JSS - https://codesandbox.io/s/case1-jss-dedp2f?file=/src/App.js
|
|
15
15
|
TSS - https://codesandbox.io/s/case1-tss-s0z7tx?file=/src/App.js
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
17
|
const useStyles = (0, _styles.makeStyles)({
|
|
19
18
|
test: {
|
|
20
19
|
backgroundColor: "purple",
|
|
@@ -10,6 +10,13 @@ var _core = require("@material-ui/core");
|
|
|
10
10
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
var _InnerComponent;
|
|
13
|
+
/*
|
|
14
|
+
Test makeStyles comment
|
|
15
|
+
*/
|
|
16
|
+
/*
|
|
17
|
+
clsx comment that will not be preserved since the import is being removed (not just replaced)
|
|
18
|
+
and is not at the beginning of the file.
|
|
19
|
+
*/
|
|
13
20
|
const useStyles = (0, _core.makeStyles)(() => ({
|
|
14
21
|
test: {
|
|
15
22
|
backgroundColor: "purple",
|
|
@@ -10,6 +10,13 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _core = require("@material-ui/core");
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
var _InnerComponent;
|
|
13
|
+
/*
|
|
14
|
+
Comments to be preserved when clsx import is removed. These comments should come before
|
|
15
|
+
any comments that they get combined with.
|
|
16
|
+
*/
|
|
17
|
+
/*
|
|
18
|
+
Comments that should not be lost when the clsx import comments are preserved.
|
|
19
|
+
*/
|
|
13
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
22
|
const useStyles = (0, _core.makeStyles)(() => ({
|
|
@@ -14,9 +14,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
14
14
|
Sandboxes for verifying correct behavior:
|
|
15
15
|
JSS - https://codesandbox.io/s/typescript-case-bt065c?file=/demo.tsx
|
|
16
16
|
TSS - https://codesandbox.io/s/typescript-case-7jwpms?file=/demo.tsx
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
const useStyles = (0, _styles.makeStyles)(theme => (0, _styles.createStyles)({
|
|
17
|
+
*/const useStyles = (0, _styles.makeStyles)(theme => (0, _styles.createStyles)({
|
|
20
18
|
test: {
|
|
21
19
|
backgroundColor: "purple",
|
|
22
20
|
color: "white",
|
|
@@ -9,6 +9,9 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _mui = require("tss-react/mui");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
var _InnerComponent;
|
|
12
|
+
/*
|
|
13
|
+
Test makeStyles comment
|
|
14
|
+
*/
|
|
12
15
|
const useStyles = (0, _mui.makeStyles)()((_theme, _params, classes) => ({
|
|
13
16
|
test: {
|
|
14
17
|
backgroundColor: "purple",
|
|
@@ -8,9 +8,16 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _mui = require("tss-react/mui");
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
10
|
var _InnerComponent;
|
|
11
|
+
/*
|
|
12
|
+
Comments to be preserved when clsx import is removed. These comments should come before
|
|
13
|
+
any comments that they get combined with.
|
|
14
|
+
*/
|
|
15
|
+
/*
|
|
16
|
+
Comments that should not be lost when the clsx import comments are preserved.
|
|
17
|
+
*/
|
|
18
|
+
// TODO jss-to-tss-react codemod: Unable to handle style definition reliably. ArrowFunctionExpression in CSS prop.
|
|
11
19
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
-
// TODO jss-to-tss-react codemod: Unable to handle style definition reliably. ArrowFunctionExpression in CSS prop.
|
|
14
21
|
const useStyles = (0, _mui.makeStyles)()((_theme, _params, classes) => ({
|
|
15
22
|
test: {
|
|
16
23
|
backgroundColor: "purple",
|
|
@@ -31,8 +31,7 @@ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
|
31
31
|
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
32
32
|
var _colors = require("@mui/material/colors");
|
|
33
33
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
34
|
-
var _Box, _Box2, _CssBaseline, _Header, _Box3, _Grid, _DialogTitle, _DialogContent;
|
|
35
|
-
// FIXME checkout https://mui.com/components/use-media-query/#migrating-from-withwidth
|
|
34
|
+
var _Box, _Box2, _CssBaseline, _Header, _Box3, _Grid, _DialogTitle, _DialogContent; // FIXME checkout https://mui.com/components/use-media-query/#migrating-from-withwidth
|
|
36
35
|
const withWidth = () => WrappedComponent => props => /*#__PURE__*/(0, _jsxRuntime.jsx)(WrappedComponent, (0, _extends2.default)({}, props, {
|
|
37
36
|
width: "xs"
|
|
38
37
|
}));
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
var _RootRef = _interopRequireDefault(require("@material-ui/core/RootRef"));
|
|
5
5
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
|
-
var _Typography, _CssBaseline;
|
|
7
|
-
// import { RootRef } from '@material-ui/core';
|
|
6
|
+
var _Typography, _CssBaseline; // import { RootRef } from '@material-ui/core';
|
|
8
7
|
// import { RootRef, Button } from '@material-ui/core';
|
|
9
8
|
// import { Tooltip, RootRef, Button } from '@material-ui/core';
|
|
10
|
-
|
|
11
9
|
function App() {
|
|
12
10
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_RootRef.default, {
|
|
13
11
|
rootRef: this.container,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/codemod",
|
|
3
|
-
"version": "5.12.
|
|
3
|
+
"version": "5.12.3",
|
|
4
4
|
"bin": "./codemod.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "MUI Team",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"url": "https://opencollective.com/mui"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@babel/core": "^7.21.
|
|
33
|
+
"@babel/core": "^7.21.4",
|
|
34
34
|
"@babel/runtime": "^7.21.0",
|
|
35
|
-
"@babel/traverse": "^7.21.
|
|
35
|
+
"@babel/traverse": "^7.21.4",
|
|
36
36
|
"jscodeshift": "^0.13.1",
|
|
37
37
|
"jscodeshift-add-imports": "^1.0.10",
|
|
38
38
|
"yargs": "^17.7.1"
|