@mui/codemod 7.3.0 → 7.3.2

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 CHANGED
@@ -1,5 +1,108 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 7.3.2
4
+
5
+ <!-- generated comparing v7.3.1..master -->
6
+
7
+ _Sep 1, 2025_
8
+
9
+ A big thanks to the 16 contributors who made this release possible.
10
+
11
+ ### `@mui/material@7.3.2`
12
+
13
+ - [Chip] Remove unnecessary optional chaining from key event handlers (#46752) @ZeeshanTamboli
14
+ - [Drawer] Add dialog role and aria-modal for `temporary` variant (#46690) @Yashkanekar
15
+ - [PaginationItem] Add slot descriptions and default components in API documentation (#46677) @sai6855
16
+ - [utils] Remove duplicate isHostComponent function (#46721) @frontman-git
17
+
18
+ ### `@mui/codemod@7.3.2`
19
+
20
+ - Add codemod to convert top-level to path imports (#46657) @neemski
21
+
22
+ ### Docs
23
+
24
+ - Remove outdated Next.js lint command (#46847) @oliviertassinari
25
+ - Add `View as Markdown` to component link header (#46835) @siriwatknp
26
+ - Add a link to open `llms.txt` (#46832) @siriwatknp
27
+ - Fix typos in Material UI API docs (#46787) @noritaka1166
28
+ - Fix typo extra "to" word (#46783) @danpeleg4
29
+ - Remove past employees from about page (#46780) @Janpot
30
+ - Fix typos in `docs/pages` folder (#46761) @noritaka1166
31
+ - Add clarification on `react-is` resolution with Material UI v6 and v7 for React 18 and below (#46633) @alisasanib
32
+ - Fix typos in `joy` and `utils` package (#46713) @noritaka1166
33
+ - [autocomplete] Fix console in unstyled demo (#46804) @oliviertassinari
34
+ - [autocomplete] Fix Google Maps brand attribution (#46803) @oliviertassinari
35
+ - [autocomplete] Fix header sentence case (#46805) @oliviertassinari
36
+ - [autocomplete] Fix Google Maps demo (#46793) @oliviertassinari
37
+ - [Select] Fix labeling issues in grouped select demo (#46722) @mj12albert
38
+ - [table] Remove outdated unstyled section (#46786) @mj12albert
39
+ - [TextField] Add note about removal of `sizeMedium` class from InputLabel in v7 upgrade guide (#46693) @checcoux
40
+
41
+ ### Core
42
+
43
+ - Update `cipher-base` transitive dependency (#46800) @Janpot
44
+ - [charts] Marked Treemap chart as Pro (#46691) @prakhargupta1
45
+ - [code-infra] Remove some csbci references (#46797) @Janpot
46
+ - [code-infra] update build tool (#46801) @Janpot
47
+ - [code-infra] Align pkg.pr.new with other projects (#46467) @Janpot
48
+ - [code-infra] Prepare for incoming `execa` update (#46781) @Janpot
49
+ - [code-infra] Remove `@mui/internal-babel-plugin-resolve-imports` override config (#46754) @ZeeshanTamboli
50
+ - [core] Fix typo in `docs/mui-vale` folder (#46760) @noritaka1166
51
+ - [core] Fix typos in `docs/data/material` folder (#46757) @noritaka1166
52
+ - [core] Fix typos in `netlify` folder (#46756) @noritaka1166
53
+ - [core] Upgrade brace-expansion (#46747) @oliviertassinari
54
+ - [core] Fix typos in Joy UI docs and `test` folder (#46738) @noritaka1166
55
+ - [core] Upgrade KaTeX (#46731) @oliviertassinari
56
+ - [core] Avoid Polynomial regex backtracking (#46732) @oliviertassinari
57
+ - [core] Remove dead @toolpad/core dependency (#46730) @oliviertassinari
58
+ - [core] Fix typos in `markdown` and `system` packages (#46720) @noritaka1166
59
+ - [core] Fix typos in `api-docs-builder` package (#46719) @noritaka1166
60
+ - [core] Fix typos in `codemod` package (#46715) @noritaka1166
61
+ - [core] pnpm prettier:all (#46685) @oliviertassinari
62
+ - [docs-infra] Set origin to generated `llms.txt` (#46833) @siriwatknp
63
+ - [docs-infra] Fix AbortController error (#46408) @oliviertassinari
64
+ - [docs-infra] Block than more feedback submissions (#46824) @oliviertassinari
65
+ - [docs-infra] Fix ESLint references (#46680) @oliviertassinari
66
+ - [infra] Migrate away from airbnb's eslint config (#46794) @brijeshb42
67
+ - [infra] Remove `fs-extra` from docs scripts (#46749) @bernardobelchior
68
+ - [infra] Remove dependency on `react-spring` (but keep `@react-spring/web`) (#46748) @bernardobelchior
69
+ - [infra] Remove `fs-extra` from `mui-icons-material` (#46745) @bernardobelchior
70
+ - [infra] Remove `api-docs-builder` dependency on `fs-extra` (#46742) @bernardobelchior
71
+ - [infra] Migrate build command to code-infra (#46614) @brijeshb42
72
+ - [infra] move testBuiltTypes step (#46735) @Janpot
73
+ - [infra] Remove `fs-extra` from `netlify-plugin-cache-docs` (#46740) @bernardobelchior
74
+ - [infra] Supply `document` to `userEvent.setup()` (#46714) @Janpot
75
+ - [infra] Remove useless test step (#46679) @Janpot
76
+ - [infra] Stagger daily cron jobs to avoid browserstack timeouts (#46676) @Janpot
77
+ - [internal] Improve useControlled() strict mode handling (#46807) @oliviertassinari
78
+ - [internal] Sentence case (55a9d8f) @oliviertassinari
79
+ - [internal] Fix typos in code comments (#46784) @noritaka1166
80
+ - [internal] Fix console regression in dev mode (925f02b) @oliviertassinari
81
+ - [internal] Prettier all if dependencies changes (1f63b03) @oliviertassinari
82
+ - [internal] Fix renovate.json (84be632) @oliviertassinari
83
+ - [internal] Polish renovate schedule (#46727) @oliviertassinari
84
+ - [internal] Update link to GitHub labels (8ab4813) @oliviertassinari
85
+ - [internal] Bump brace-expansion (06de338) @oliviertassinari
86
+ - [internal] Normalize Action description (4a2fbcb) @oliviertassinari
87
+ - [toolpad] Remove it from website and docs (#46595) @prakhargupta1
88
+
89
+ All contributors of this release in alphabetical order: @alisasanib, @bernardobelchior, @brijeshb42, @checcoux, @danpeleg4, @frontman-git, @Janpot, @mj12albert, @neemski, @noritaka1166, @oliviertassinari, @prakhargupta1, @sai6855, @siriwatknp, @Yashkanekar, @ZeeshanTamboli
90
+
91
+ ## 7.3.1
92
+
93
+ <!-- generated comparing v7.3.0..master -->
94
+
95
+ _Aug 6, 2025_
96
+
97
+ A big thanks to the 2 contributors who made this release possible.
98
+
99
+ ### `@mui/material@7.3.1`
100
+
101
+ - [PaginationItem] Fix inheritance of component (#46666) @sai6855
102
+ - [Select] Revert - Implement pointer cancellation PR 45789 (#46672) @ZeeshanTamboli
103
+
104
+ All contributors of this release in alphabetical order: @sai6855, @ZeeshanTamboli
105
+
3
106
  ## 7.3.0
4
107
 
5
108
  <!-- generated comparing v7.2.0..master -->
@@ -56,7 +159,7 @@ A big thanks to the 24 contributors who made this release possible. Here are som
56
159
  - Fix unpinned version regression (#46438) @oliviertassinari
57
160
  - [code-infra] Accomodate build requirements from mui-x (#46551) @brijeshb42
58
161
  - [code-infra] Extend renovate preset from infra repo (#46483) @brijeshb42
59
- - [code-infra] Use flat eslint config (#46258) @brijeshb42
162
+ - [code-infra] Use flat ESLint config (#46258) @brijeshb42
60
163
  - [docs-infra] Remove comment saving in G-sheet option (#46617) @alexfauquette
61
164
  - [docs-infra] Move `Open in MUI Chat` to Demo toolbar and adjust styles (#46579) @siriwatknp
62
165
  - [docs-infra] Fix codeblock issues (#46323) @atharva3333
@@ -128,11 +231,11 @@ A big thanks to the 17 contributors who made this release possible. Here are the
128
231
  ### Core
129
232
 
130
233
  - pnpm docs:sync-team (3641a0b) @oliviertassinari
131
- - Add cross-env to eslint script (#46358) @ZeeshanTamboli
234
+ - Add cross-env to ESLint script (#46358) @ZeeshanTamboli
132
235
  - Support merging of className and style from theme (#45975) @sai6855
133
236
  - [code-infra] Create bundle size package (#45911) @Janpot
134
237
  - [docs-infra] Add a script to generate Material UI `llms.txt` and docs markdown. (#46308) @siriwatknp
135
- - [docs-infra] Fix stackblitz for js projects (#46220) @Janpot
238
+ - [docs-infra] Fix StackBlitz for js projects (#46220) @Janpot
136
239
  - [infra] Add emotion as external for bundle monitor (#46372) @Janpot
137
240
  - [infra] Create update PR on every canary publish for internal packages (#46367) @Janpot
138
241
  - [infra] Remove deprecated esmExternals (#46365) @Janpot
@@ -210,7 +313,7 @@ A big thanks to the 15 contributors who made this release possible.
210
313
  ### Core
211
314
 
212
315
  - [code-infra] Add plugin to check for index file access (#46178) @Janpot
213
- - [code-infra] Bump eslint to v9 (#46222) @brijeshb42
316
+ - [code-infra] Bump ESLint to v9 (#46222) @brijeshb42
214
317
  - [code-infra] Move packages to mui/mui-public (#46155) @Janpot
215
318
  - [code-infra] Move `chai` to peerDep (#46227) @JCQuintas
216
319
  - [code-infra] Avoid loading barrel file during type checking (#46177) @Janpot
package/README.md CHANGED
@@ -3466,6 +3466,26 @@ npx @mui/codemod@latest v5.0.0/pagination-round-circular <path>
3466
3466
 
3467
3467
  You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/migration/v5-component-changes/#pagination).
3468
3468
 
3469
+ #### `path-imports`
3470
+
3471
+ Converts all `@mui/material` & `@mui/icons-material` top-level imports to path imports (essentially the reverse of `top-level-imports`, with the addition of `@mui/icons-material`):
3472
+
3473
+ ```diff
3474
+ -import { List, Grid } from '@mui/material';
3475
+ +import List from '@mui/material/List';
3476
+ +import Grid from '@mui/material/Grid';
3477
+
3478
+ -import { Delete, People as PeopleIcon } from '@mui/icons-material';
3479
+ +import Delete from '@mui/icons-material/Delete';
3480
+ +import PeopleIcon from '@mui/icons-material/People';
3481
+ ```
3482
+
3483
+ ```bash
3484
+ npx @mui/codemod@latest v5.0.0/path-imports <path>
3485
+ ```
3486
+
3487
+ Head to https://mui.com/material-ui/guides/minimizing-bundle-size/ to understand when it's useful.
3488
+
3469
3489
  #### `optimal-imports`
3470
3490
 
3471
3491
  Fix private import paths.
@@ -3719,7 +3739,7 @@ Converts all `@mui/material` submodule imports to the root module:
3719
3739
  npx @mui/codemod@latest v5.0.0/top-level-imports <path>
3720
3740
  ```
3721
3741
 
3722
- Head to https://mui.com/guides/minimizing-bundle-size/ to understand when it's useful.
3742
+ Head to https://mui.com/material-ui/guides/minimizing-bundle-size/ to understand when it's useful.
3723
3743
 
3724
3744
  #### `transitions`
3725
3745
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/codemod",
3
- "version": "7.3.0",
3
+ "version": "7.3.2",
4
4
  "author": "MUI Team",
5
5
  "description": "Codemod scripts for Material UI.",
6
6
  "bin": "./codemod.js",
@@ -23,9 +23,9 @@
23
23
  "url": "https://opencollective.com/mui-org"
24
24
  },
25
25
  "dependencies": {
26
- "@babel/core": "^7.28.0",
27
- "@babel/runtime": "^7.28.2",
28
- "@babel/traverse": "^7.28.0",
26
+ "@babel/core": "^7.28.3",
27
+ "@babel/runtime": "^7.28.3",
28
+ "@babel/traverse": "^7.28.3",
29
29
  "jscodeshift": "^17.1.2",
30
30
  "jscodeshift-add-imports": "^1.0.11",
31
31
  "postcss": "^8.5.6",
@@ -39,30 +39,8 @@
39
39
  "engines": {
40
40
  "node": ">=14.0.0"
41
41
  },
42
- "private": false,
42
+ "type": "commonjs",
43
43
  "exports": {
44
- "./package.json": "./package.json",
45
- ".": {
46
- "require": {
47
- "types": "./index.d.ts",
48
- "default": "./index.js"
49
- },
50
- "import": {
51
- "types": "./esm/index.d.ts",
52
- "default": "./esm/index.js"
53
- }
54
- },
55
- "./*": {
56
- "require": {
57
- "types": "./*/index.d.ts",
58
- "default": "./*/index.js"
59
- },
60
- "import": {
61
- "types": "./esm/*/index.d.ts",
62
- "default": "./esm/*/index.js"
63
- }
64
- },
65
- "./esm": null,
66
- "./modern": null
44
+ "./package.json": "./package.json"
67
45
  }
68
46
  }
@@ -121,9 +121,9 @@ const getObjectToArrowFunction = j => {
121
121
  /**
122
122
  *
123
123
  * @param {import('jscodeshift').ObjectExpression} objectExpression
124
- * @param {import('jscodeshift').BinaryExpression} addtional
124
+ * @param {import('jscodeshift').BinaryExpression} additional
125
125
  */
126
- function objectToArrowFunction(objectExpression, addtional) {
126
+ function objectToArrowFunction(objectExpression, additional) {
127
127
  const paramKeys = new Set();
128
128
  let left;
129
129
  objectExpression.properties.forEach((prop, index) => {
@@ -135,10 +135,10 @@ const getObjectToArrowFunction = j => {
135
135
  left = j.logicalExpression('&&', left, result);
136
136
  }
137
137
  });
138
- if (addtional) {
139
- paramKeys.add(getObjectKey(addtional.left).name);
138
+ if (additional) {
139
+ paramKeys.add(getObjectKey(additional.left).name);
140
140
  }
141
- return buildArrowFunctionAST(paramKeys, addtional ? j.logicalExpression('&&', left, addtional) : left);
141
+ return buildArrowFunctionAST(paramKeys, additional ? j.logicalExpression('&&', left, additional) : left);
142
142
  }
143
143
  );
144
144
  };
@@ -30,7 +30,7 @@ function colorImportPath(colorPalette) {
30
30
  /**
31
31
  * Replace all expressions that use identifier to access color palettes.
32
32
  * e.g. colors.amber100 -> colors.amber['100']
33
- * @param {sting} identifier
33
+ * @param {string} identifier
34
34
  * @param {jscodeshift_api_object} j
35
35
  * @param {jscodeshift_ast_object} root
36
36
  */
@@ -164,7 +164,9 @@ class AppAppBar extends React.Component {
164
164
  essential: essential,
165
165
  position: position,
166
166
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
167
- className: (0, _clsx.default)(classes.wrap, menuOpen && classes.wrapOpened),
167
+ className: (0, _clsx.default)(classes.wrap, {
168
+ [classes.wrapOpened]: menuOpen
169
+ }),
168
170
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Link.default, {
169
171
  to: "/",
170
172
  "aria-label": "Back to homepage",
@@ -173,7 +175,10 @@ class AppAppBar extends React.Component {
173
175
  color: menuOpen ? 'inherit' : 'textPrimary'
174
176
  })
175
177
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
176
- className: (0, _clsx.default)(classes.content, menuOpen && [classes.contentOpened, 'mui-fixed']),
178
+ className: (0, _clsx.default)(classes.content, {
179
+ [classes.contentOpened]: menuOpen,
180
+ 'mui-fixed': menuOpen
181
+ }),
177
182
  children: [children || /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
178
183
  className: classes.grow
179
184
  }), essential ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
@@ -197,9 +202,13 @@ class AppAppBar extends React.Component {
197
202
  href: "#",
198
203
  onClick: this.handleToggleMenu,
199
204
  children: menuOpen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Close.default, {
200
- className: (0, _clsx.default)(classes.menuIcon, classes.closeIcon, classes.white, menuOpen && classes.hide)
205
+ className: (0, _clsx.default)(classes.menuIcon, classes.closeIcon, classes.white, {
206
+ [classes.hide]: menuOpen
207
+ })
201
208
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Menu.default, {
202
- className: (0, _clsx.default)(classes.menuIcon, classes.burgerIcon, menuOpen && classes.hide)
209
+ className: (0, _clsx.default)(classes.menuIcon, classes.burgerIcon, {
210
+ [classes.hide]: menuOpen
211
+ })
203
212
  })
204
213
  })
205
214
  })]
@@ -207,13 +216,13 @@ class AppAppBar extends React.Component {
207
216
  });
208
217
  }
209
218
  }
210
- process.env.NODE_ENV !== "production" ? AppAppBar.propTypes = {
219
+ AppAppBar.propTypes = {
211
220
  children: _propTypes.default.node,
212
221
  classes: _propTypes.default.object.isRequired,
213
222
  essential: _propTypes.default.bool,
214
223
  position: _propTypes.default.string,
215
224
  user: _propTypes.default.object
216
- } : void 0;
225
+ };
217
226
  var _default = exports.default = (0, _recompose.compose)((0, _withStyles.default)(styles, {
218
227
  name: 'AppAppBar'
219
228
  }), (0, _reactRedux.connect)(state => ({
@@ -179,7 +179,9 @@ class AppAppBar extends React.Component {
179
179
  essential: essential,
180
180
  position: position,
181
181
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
182
- className: (0, _clsx.default)(classes.wrap, menuOpen && classes.wrapOpened),
182
+ className: (0, _clsx.default)(classes.wrap, {
183
+ [classes.wrapOpened]: menuOpen
184
+ }),
183
185
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Link.default, {
184
186
  to: "/",
185
187
  "aria-label": "Back to homepage",
@@ -188,7 +190,10 @@ class AppAppBar extends React.Component {
188
190
  color: menuOpen ? 'inherit' : 'textPrimary'
189
191
  })
190
192
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
191
- className: (0, _clsx.default)(classes.content, menuOpen && [classes.contentOpened, 'mui-fixed']),
193
+ className: (0, _clsx.default)(classes.content, {
194
+ [classes.contentOpened]: menuOpen,
195
+ 'mui-fixed': menuOpen
196
+ }),
192
197
  children: [children || /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
193
198
  className: classes.grow
194
199
  }), essential ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
@@ -212,9 +217,13 @@ class AppAppBar extends React.Component {
212
217
  href: "#",
213
218
  onClick: this.handleToggleMenu,
214
219
  children: menuOpen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Close.default, {
215
- className: (0, _clsx.default)(classes.menuIcon, classes.closeIcon, classes.white, menuOpen && classes.hide)
220
+ className: (0, _clsx.default)(classes.menuIcon, classes.closeIcon, classes.white, {
221
+ [classes.hide]: menuOpen
222
+ })
216
223
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Menu.default, {
217
- className: (0, _clsx.default)(classes.menuIcon, classes.burgerIcon, menuOpen && classes.hide)
224
+ className: (0, _clsx.default)(classes.menuIcon, classes.burgerIcon, {
225
+ [classes.hide]: menuOpen
226
+ })
218
227
  })
219
228
  })
220
229
  })]
@@ -222,13 +231,13 @@ class AppAppBar extends React.Component {
222
231
  });
223
232
  }
224
233
  }
225
- process.env.NODE_ENV !== "production" ? AppAppBar.propTypes = {
234
+ AppAppBar.propTypes = {
226
235
  children: _propTypes.default.node,
227
236
  classes: _propTypes.default.object.isRequired,
228
237
  essential: _propTypes.default.bool,
229
238
  position: _propTypes.default.string,
230
239
  user: _propTypes.default.object
231
- } : void 0;
240
+ };
232
241
  var _default = exports.default = (0, _recompose.compose)((0, _reactRedux.connect)(state => ({
233
242
  user: state.data.user
234
243
  })))(AppAppBar);
@@ -68,7 +68,9 @@ function AppAppBarCart(props) {
68
68
  }), count > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Badge.default, {
69
69
  color: "primary",
70
70
  classes: {
71
- badge: (0, _clsx.default)(classes.badge, transparent && classes.transparentBadge)
71
+ badge: (0, _clsx.default)(classes.badge, {
72
+ [classes.transparentBadge]: transparent
73
+ })
72
74
  },
73
75
  badgeContent: count > 9 ? '+9' : count,
74
76
  children: ''
@@ -76,12 +78,12 @@ function AppAppBarCart(props) {
76
78
  });
77
79
  }
78
80
  AppAppBarCart.displayName = 'AppAppBarCart';
79
- process.env.NODE_ENV !== "production" ? AppAppBarCart.propTypes = {
81
+ AppAppBarCart.propTypes = {
80
82
  classes: _propTypes.default.object.isRequired,
81
83
  className: _propTypes.default.string,
82
84
  variant: _propTypes.default.oneOf(['text', 'icon']),
83
85
  transparent: _propTypes.default.bool
84
- } : void 0;
86
+ };
85
87
  AppAppBarCart.defaultProps = {
86
88
  variant: 'icon'
87
89
  };
@@ -76,7 +76,9 @@ function AppAppBarCart(props) {
76
76
  }), count > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Badge.default, {
77
77
  color: "primary",
78
78
  classes: {
79
- badge: (0, _clsx.default)(classes.badge, transparent && classes.transparentBadge)
79
+ badge: (0, _clsx.default)(classes.badge, {
80
+ [classes.transparentBadge]: transparent
81
+ })
80
82
  },
81
83
  badgeContent: count > 9 ? '+9' : count,
82
84
  children: ''
@@ -84,12 +86,12 @@ function AppAppBarCart(props) {
84
86
  });
85
87
  }
86
88
  AppAppBarCart.displayName = 'AppAppBarCart';
87
- process.env.NODE_ENV !== "production" ? AppAppBarCart.propTypes = {
89
+ AppAppBarCart.propTypes = {
88
90
  classes: _propTypes.default.object.isRequired,
89
91
  className: _propTypes.default.string,
90
92
  variant: _propTypes.default.oneOf(['text', 'icon']),
91
93
  transparent: _propTypes.default.bool
92
- } : void 0;
94
+ };
93
95
  AppAppBarCart.defaultProps = {
94
96
  variant: 'icon'
95
97
  };
@@ -0,0 +1,90 @@
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 _jscodeshiftAddImports = _interopRequireDefault(require("jscodeshift-add-imports"));
9
+ // istanbul ignore next
10
+ if (process.env.NODE_ENV === 'test') {
11
+ const resolve = require.resolve;
12
+ require.resolve = source => resolve(source.replace(/^@mui\/material\/modern/, '../../../mui-material/src'));
13
+ }
14
+ const barrelImportsToTransform = {
15
+ material: {},
16
+ 'icons-material': {}
17
+ };
18
+ const muiImportRegExp = /^@mui\/([^/]+)$/;
19
+ function transformer(fileInfo, api, options) {
20
+ const j = api.jscodeshift;
21
+ const printOptions = options.printOptions || {
22
+ quote: 'single',
23
+ trailingComma: true
24
+ };
25
+ const root = j(fileInfo.source);
26
+ root.find(j.ImportDeclaration).forEach(path => {
27
+ if (!path.node.specifiers.length) {
28
+ return;
29
+ }
30
+ if (path.value.importKind && path.value.importKind !== 'value') {
31
+ return;
32
+ }
33
+ const importPath = path.value.source.value;
34
+ const match = importPath.match(muiImportRegExp);
35
+ if (!match) {
36
+ return;
37
+ }
38
+ const moduleName = match[1];
39
+ const importsToAdd = barrelImportsToTransform[moduleName];
40
+ if (!importsToAdd) {
41
+ return;
42
+ }
43
+ const indexesToPrune = [];
44
+ path.node.specifiers.forEach((specifier, index) => {
45
+ if (specifier.importKind && specifier.importKind !== 'value') {
46
+ return;
47
+ }
48
+ if (specifier.type === 'ImportNamespaceSpecifier') {
49
+ return;
50
+ }
51
+ if (specifier.type === 'ImportSpecifier') {
52
+ const name = specifier.imported.name;
53
+ if (moduleName === 'material') {
54
+ if (name === 'ThemeProvider' || name === 'createTheme') {
55
+ importsToAdd.styles ?? (importsToAdd.styles = []);
56
+ importsToAdd.styles.push(specifier);
57
+ indexesToPrune.push(index);
58
+ return;
59
+ }
60
+ if (name.endsWith('Classes')) {
61
+ const base = name.replace(/Classes$/, '');
62
+ const componentName = base.charAt(0).toUpperCase() + base.slice(1); // autocomplete → Autocomplete
63
+ importsToAdd[componentName] ?? (importsToAdd[componentName] = []);
64
+ importsToAdd[componentName].push(j.importSpecifier(specifier.imported, specifier.local));
65
+ indexesToPrune.push(index);
66
+ return;
67
+ }
68
+ }
69
+ importsToAdd[name] ?? (importsToAdd[name] = []);
70
+ importsToAdd[name].push(j.importDefaultSpecifier(specifier.local));
71
+ indexesToPrune.push(index);
72
+ }
73
+ });
74
+
75
+ // We prune imports starting with the highest index as otherwise subsequent indexes would become
76
+ // invalid once an index that comes before it gets pruned.
77
+ indexesToPrune.sort((a, b) => a - b).reverse();
78
+ indexesToPrune.forEach(index => path.get('specifiers', index).prune());
79
+ if (!path.node.specifiers.length) {
80
+ path.prune();
81
+ }
82
+ });
83
+ Object.entries(barrelImportsToTransform).forEach(([moduleName, importsToAdd]) => {
84
+ Object.entries(importsToAdd).forEach(([module, specifiers]) => {
85
+ const fullTargetModule = `@mui/${moduleName}/${module}`;
86
+ (0, _jscodeshiftAddImports.default)(root, j.importDeclaration(specifiers, j.stringLiteral(fullTargetModule)));
87
+ });
88
+ });
89
+ return root.toSource(printOptions);
90
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ var React = _interopRequireWildcard(require("react"));
5
+ var _styles = require("@mui/styles");
6
+ var _colors = require("@mui/material/colors");
7
+ var _material = require("@mui/material");
8
+ var _iconsMaterial = require("@mui/icons-material");
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ var React = _interopRequireWildcard(require("react"));
6
+ var _styles = require("@mui/styles");
7
+ var _colors = require("@mui/material/colors");
8
+ var _styles2 = require("@mui/material/styles");
9
+ var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
10
+ var _Tab = _interopRequireDefault(require("@mui/material/Tab"));
11
+ var _Tabs = _interopRequireDefault(require("@mui/material/Tabs"));
12
+ var _Autocomplete = require("@mui/material/Autocomplete");
13
+ var _BottomNavigationAction = _interopRequireDefault(require("@mui/material/BottomNavigationAction"));
14
+ var _BottomNavigation = _interopRequireDefault(require("@mui/material/BottomNavigation"));
15
+ var _CardContent = _interopRequireDefault(require("@mui/material/CardContent"));
16
+ var _CardActions = _interopRequireDefault(require("@mui/material/CardActions"));
17
+ var _Card = _interopRequireDefault(require("@mui/material/Card"));
18
+ var _CardMedia = _interopRequireDefault(require("@mui/material/CardMedia"));
19
+ var _CardHeader = _interopRequireDefault(require("@mui/material/CardHeader"));
20
+ var _Collapse = _interopRequireDefault(require("@mui/material/Collapse"));
21
+ var _ListItemSecondaryAction = _interopRequireDefault(require("@mui/material/ListItemSecondaryAction"));
22
+ var _ListItemText = _interopRequireDefault(require("@mui/material/ListItemText"));
23
+ var _ListItemAvatar = _interopRequireDefault(require("@mui/material/ListItemAvatar"));
24
+ var _ListItem = _interopRequireDefault(require("@mui/material/ListItem"));
25
+ var _ListItemIcon = _interopRequireDefault(require("@mui/material/ListItemIcon"));
26
+ var _List = _interopRequireDefault(require("@mui/material/List"));
27
+ var _DialogTitle = _interopRequireDefault(require("@mui/material/DialogTitle"));
28
+ var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
29
+ var _DialogContentText = _interopRequireDefault(require("@mui/material/DialogContentText"));
30
+ var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
31
+ var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
32
+ var _Slide = _interopRequireDefault(require("@mui/material/Slide"));
33
+ var _RadioGroup = _interopRequireDefault(require("@mui/material/RadioGroup"));
34
+ var _Radio = _interopRequireDefault(require("@mui/material/Radio"));
35
+ var _FormControlLabel = _interopRequireDefault(require("@mui/material/FormControlLabel"));
36
+ var _AccordionActions = _interopRequireDefault(require("@mui/material/AccordionActions"));
37
+ var _AccordionDetails = _interopRequireDefault(require("@mui/material/AccordionDetails"));
38
+ var _AccordionSummary = _interopRequireDefault(require("@mui/material/AccordionSummary"));
39
+ var _Accordion = _interopRequireDefault(require("@mui/material/Accordion"));
40
+ var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
41
+ var _LinearProgress = _interopRequireDefault(require("@mui/material/LinearProgress"));
42
+ var _FormHelperText = _interopRequireDefault(require("@mui/material/FormHelperText"));
43
+ var _FormGroup = _interopRequireDefault(require("@mui/material/FormGroup"));
44
+ var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
45
+ var _FormLabel = _interopRequireDefault(require("@mui/material/FormLabel"));
46
+ var _Fade = _interopRequireDefault(require("@mui/material/Fade"));
47
+ var _StepContent = _interopRequireDefault(require("@mui/material/StepContent"));
48
+ var _StepButton = _interopRequireDefault(require("@mui/material/StepButton"));
49
+ var _Step = _interopRequireDefault(require("@mui/material/Step"));
50
+ var _Stepper = _interopRequireDefault(require("@mui/material/Stepper"));
51
+ var _TableRow = _interopRequireDefault(require("@mui/material/TableRow"));
52
+ var _TablePagination = _interopRequireDefault(require("@mui/material/TablePagination"));
53
+ var _TableCell = _interopRequireDefault(require("@mui/material/TableCell"));
54
+ var _TableBody = _interopRequireDefault(require("@mui/material/TableBody"));
55
+ var _Table = _interopRequireDefault(require("@mui/material/Table"));
56
+ var _TableHead = _interopRequireDefault(require("@mui/material/TableHead"));
57
+ var _Tooltip = require("@mui/material/Tooltip");
58
+ var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
59
+ var _Input = _interopRequireDefault(require("@mui/material/Input"));
60
+ var _Grow = _interopRequireDefault(require("@mui/material/Grow"));
61
+ var _TableFooter = _interopRequireDefault(require("@mui/material/TableFooter"));
62
+ var _Zoom = _interopRequireDefault(require("@mui/material/Zoom"));
63
+ var _ClickAwayListener = _interopRequireDefault(require("@mui/material/ClickAwayListener"));
64
+ var _ListSubheader = _interopRequireDefault(require("@mui/material/ListSubheader"));
65
+ var _Delete = _interopRequireDefault(require("@mui/icons-material/Delete"));
66
+ var _People = _interopRequireDefault(require("@mui/icons-material/People"));
@@ -236,10 +236,10 @@ function DocSearchHit(props) {
236
236
  children: children
237
237
  });
238
238
  }
239
- process.env.NODE_ENV !== "production" ? DocSearchHit.propTypes = {
239
+ DocSearchHit.propTypes = {
240
240
  children: _propTypes.default.node,
241
241
  hit: _propTypes.default.object.isRequired
242
- } : void 0;
242
+ };
243
243
  function AppSearch() {
244
244
  (0, _useLazyCSS.default)('https://cdn.jsdelivr.net/npm/@docsearch/css@3.0.0-alpha.40/dist/style.min.css', '#app-search');
245
245
  const FADE_DURATION = 100; // ms
@@ -236,10 +236,10 @@ function DocSearchHit(props) {
236
236
  children: children
237
237
  });
238
238
  }
239
- process.env.NODE_ENV !== "production" ? DocSearchHit.propTypes = {
239
+ DocSearchHit.propTypes = {
240
240
  children: _propTypes.default.node,
241
241
  hit: _propTypes.default.object.isRequired
242
- } : void 0;
242
+ };
243
243
  function AppSearch() {
244
244
  (0, _useLazyCSS.default)('https://cdn.jsdelivr.net/npm/@docsearch/css@3.0.0-alpha.40/dist/style.min.css', '#app-search');
245
245
  const FADE_DURATION = 100; // ms
@@ -29,7 +29,7 @@ function styledV6(file, api, options) {
29
29
  args = path.node.arguments;
30
30
  }
31
31
 
32
- // 1. collecting styles that should be tranformed
32
+ // 1. collecting styles that should be transformed
33
33
  args.forEach(arg => {
34
34
  if (arg.type === 'ArrowFunctionExpression' && arg.params[0] && arg.params[0].type === 'ObjectPattern') {
35
35
  styles.push(arg);
@@ -23,7 +23,7 @@ function themeV6(file, api, options) {
23
23
  args = [path.node];
24
24
  }
25
25
 
26
- // 1. collecting styles that should be tranformed
26
+ // 1. collecting styles that should be transformed
27
27
  args.forEach(arg => {
28
28
  if (arg.type === 'ArrowFunctionExpression' && arg.params[0] && arg.params[0].type === 'ObjectPattern') {
29
29
  styles.push(arg);