@mui/codemod 5.12.2 → 5.13.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/README.md CHANGED
@@ -62,6 +62,19 @@ npx @mui/codemod <transform> <path> --jscodeshift="--printOptions='{\"quote\":\"
62
62
 
63
63
  ### v5.0.0
64
64
 
65
+ ### `base-remove-unstyled-suffix`
66
+
67
+ The `Unstyled` suffix has been removed from all Base UI component names, including names of types and other related identifiers.
68
+
69
+ ```diff
70
+ - <Input component='a' href='url' />;
71
+ + <Input slots={{ root: 'a' }} href='url' />;
72
+ ```
73
+
74
+ ```sh
75
+ npx @mui/codemod v5.0.0/base-remove-unstyled-suffix <path>
76
+ ```
77
+
65
78
  #### `base-remove-component-prop`
66
79
 
67
80
  Remove `component` prop from all Base UI components by transferring its value into `slots.root`.
@@ -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",
@@ -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, _mui.makeStyles)({
19
18
  name: "TestName"
20
19
  })({
@@ -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",
@@ -55,4 +55,10 @@ const tsconfig = {
55
55
  }
56
56
  };
57
57
 
58
- // types
58
+ // types
59
+
60
+ // private-theming
61
+
62
+ // Pickers does not change
63
+
64
+ // DataGrid does not change
@@ -55,4 +55,10 @@ const tsconfig = {
55
55
  }
56
56
  };
57
57
 
58
- // types
58
+ // types
59
+
60
+ // private-theming
61
+
62
+ // Pickers does not change
63
+
64
+ // DataGrid does not change
@@ -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.2",
3
+ "version": "5.13.3",
4
4
  "bin": "./codemod.js",
5
5
  "private": false,
6
6
  "author": "MUI Team",
@@ -30,12 +30,12 @@
30
30
  "url": "https://opencollective.com/mui"
31
31
  },
32
32
  "dependencies": {
33
- "@babel/core": "^7.21.3",
33
+ "@babel/core": "^7.21.4",
34
34
  "@babel/runtime": "^7.21.0",
35
- "@babel/traverse": "^7.21.3",
35
+ "@babel/traverse": "^7.21.4",
36
36
  "jscodeshift": "^0.13.1",
37
37
  "jscodeshift-add-imports": "^1.0.10",
38
- "yargs": "^17.7.1"
38
+ "yargs": "^17.7.2"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/jscodeshift": "0.11.5"