@mui/codemod 5.5.3 → 5.6.4
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 +59 -51
- package/codemod.js +0 -0
- package/node/v5.0.0/date-pickers-moved-to-x.js +209 -0
- package/node/v5.0.0/date-pickers-moved-to-x.test/actual-root-community.js +3 -0
- package/node/v5.0.0/date-pickers-moved-to-x.test/actual-root-pro.js +3 -0
- package/node/v5.0.0/date-pickers-moved-to-x.test/actual-sub-module.js +65 -0
- package/node/v5.0.0/date-pickers-moved-to-x.test/expected-root-community.js +5 -0
- package/node/v5.0.0/date-pickers-moved-to-x.test/expected-root-pro.js +5 -0
- package/node/v5.0.0/date-pickers-moved-to-x.test/expected-sub-module.js +61 -0
- package/node/v5.0.0/modal-props.js +1 -1
- package/node/v5.0.0/modal-props.test/expected.js +1 -1
- package/node/v5.0.0/moved-lab-modules.js +3 -3
- package/node/v5.0.0/theme-breakpoints.js +10 -2
- package/node/v5.0.0/theme-breakpoints.test/actual.js +1 -0
- package/node/v5.0.0/theme-breakpoints.test/expected.js +1 -0
- package/node/v5.0.0/theme-spacing.js +1 -1
- package/node/v5.0.0/theme-spacing.test/actual.js +1 -1
- package/node/v5.0.0/theme-spacing.test/expected.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -62,6 +62,14 @@ npx @mui/codemod <transform> <path> --jscodeshift="--printOptions='{\"quote\":\"
|
|
|
62
62
|
|
|
63
63
|
### v5.0.0
|
|
64
64
|
|
|
65
|
+
#### `date-pickers-moved-to-x`
|
|
66
|
+
|
|
67
|
+
Rename the imports of date and time pickers from `@mui/lab` to `@mui/x-date-pickers` and `@mui/x-date-pickers-pro`.
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
npx @mui/codemod v5.0.0/date-pickers-moved-to-x <path>
|
|
71
|
+
```
|
|
72
|
+
|
|
65
73
|
#### 🚀 `preset-safe`
|
|
66
74
|
|
|
67
75
|
A combination of all important transformers for migrating v4 to v5. ⚠️ This codemod should be run only once.
|
|
@@ -137,7 +145,7 @@ Imports and inserts `adaptV4Theme` into `createTheme` (or `createMuiTheme`)
|
|
|
137
145
|
npx @mui/codemod v5.0.0/adapter-v4 <path>
|
|
138
146
|
```
|
|
139
147
|
|
|
140
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#theme).
|
|
148
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#theme).
|
|
141
149
|
|
|
142
150
|
#### `autocomplete-rename-closeicon`
|
|
143
151
|
|
|
@@ -154,7 +162,7 @@ Renames `Autocomplete`'s `closeIcon` prop to `clearIcon`.
|
|
|
154
162
|
npx @mui/codemod v5.0.0/autocomplete-rename-closeicon <path>
|
|
155
163
|
```
|
|
156
164
|
|
|
157
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#autocomplete).
|
|
165
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#autocomplete).
|
|
158
166
|
|
|
159
167
|
#### `autocomplete-rename-option`
|
|
160
168
|
|
|
@@ -173,7 +181,7 @@ Renames `Autocomplete`'s `getOptionSelected` to `isOptionEqualToValue`.
|
|
|
173
181
|
npx @mui/codemod v5.0.0/autocomplete-rename-option <path>
|
|
174
182
|
```
|
|
175
183
|
|
|
176
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#autocomplete).
|
|
184
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#autocomplete).
|
|
177
185
|
|
|
178
186
|
#### `avatar-circle-circular`
|
|
179
187
|
|
|
@@ -192,7 +200,7 @@ Updates the `Avatar`'s `variant` value and `classes` key from 'circle' to 'circu
|
|
|
192
200
|
npx @mui/codemod v5.0.0/avatar-circle-circular <path>
|
|
193
201
|
```
|
|
194
202
|
|
|
195
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#avatar).
|
|
203
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#avatar).
|
|
196
204
|
|
|
197
205
|
#### `badge-overlap-value`
|
|
198
206
|
|
|
@@ -227,7 +235,7 @@ Renames the badge's props.
|
|
|
227
235
|
npx @mui/codemod v5.0.0/badge-overlap-value <path>
|
|
228
236
|
```
|
|
229
237
|
|
|
230
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#badge).
|
|
238
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#badge).
|
|
231
239
|
|
|
232
240
|
#### `box-borderradius-values`
|
|
233
241
|
|
|
@@ -246,7 +254,7 @@ Updates the Box API from separate system props to `sx`.
|
|
|
246
254
|
npx @mui/codemod v5.0.0/box-borderradius-values <path>
|
|
247
255
|
```
|
|
248
256
|
|
|
249
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#box).
|
|
257
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#box).
|
|
250
258
|
|
|
251
259
|
#### `box-rename-css`
|
|
252
260
|
|
|
@@ -261,7 +269,7 @@ Renames the Box `css` prop to `sx`
|
|
|
261
269
|
npx @mui/codemod v5.0.0/box-rename-css <path>
|
|
262
270
|
```
|
|
263
271
|
|
|
264
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#box).
|
|
272
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#box).
|
|
265
273
|
|
|
266
274
|
#### `box-rename-gap`
|
|
267
275
|
|
|
@@ -282,7 +290,7 @@ Renames the Box `grid*Gap` props.
|
|
|
282
290
|
npx @mui/codemod v5.0.0/box-rename-gap <path>
|
|
283
291
|
```
|
|
284
292
|
|
|
285
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#box).
|
|
293
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#box).
|
|
286
294
|
|
|
287
295
|
#### `button-color-prop`
|
|
288
296
|
|
|
@@ -299,7 +307,7 @@ Removes the outdated `color` prop values.
|
|
|
299
307
|
npx @mui/codemod v5.0.0/button-color-prop <path>
|
|
300
308
|
```
|
|
301
309
|
|
|
302
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#button).
|
|
310
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#button).
|
|
303
311
|
|
|
304
312
|
#### `chip-variant-prop`
|
|
305
313
|
|
|
@@ -316,7 +324,7 @@ Removes the Chip `variant` prop if the value is `"default"`.
|
|
|
316
324
|
npx @mui/codemod v5.0.0/chip-variant-prop <path>
|
|
317
325
|
```
|
|
318
326
|
|
|
319
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#chip).
|
|
327
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#chip).
|
|
320
328
|
|
|
321
329
|
#### `circularprogress-variant`
|
|
322
330
|
|
|
@@ -333,7 +341,7 @@ Renames the CircularProgress `static` variant to `determinate`.
|
|
|
333
341
|
npx @mui/codemod v5.0.0/circularprogress-variant <path>
|
|
334
342
|
```
|
|
335
343
|
|
|
336
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#circularprogress).
|
|
344
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#circularprogress).
|
|
337
345
|
|
|
338
346
|
#### `collapse-rename-collapsedheight`
|
|
339
347
|
|
|
@@ -352,7 +360,7 @@ Renames `Collapse`'s `collapsedHeight` prop to `collapsedSize`.
|
|
|
352
360
|
npx @mui/codemod v5.0.0/collapse-rename-collapsedheight <path>
|
|
353
361
|
```
|
|
354
362
|
|
|
355
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#collapse).
|
|
363
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#collapse).
|
|
356
364
|
|
|
357
365
|
#### `component-rename-prop`
|
|
358
366
|
|
|
@@ -410,7 +418,7 @@ Remove `disableBackdropClick` prop from `<Dialog>`
|
|
|
410
418
|
npx @mui/codemod v5.0.0/dialog-props <path>
|
|
411
419
|
```
|
|
412
420
|
|
|
413
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#dialog).
|
|
421
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#dialog).
|
|
414
422
|
|
|
415
423
|
#### `dialog-title-props`
|
|
416
424
|
|
|
@@ -425,7 +433,7 @@ Remove `disableTypography` prop from `<DialogTitle>`
|
|
|
425
433
|
npx @mui/codemod v5.0.0/dialog-title-props <path>
|
|
426
434
|
```
|
|
427
435
|
|
|
428
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#dialog).
|
|
436
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#dialog).
|
|
429
437
|
|
|
430
438
|
#### `emotion-prepend-cache`
|
|
431
439
|
|
|
@@ -450,7 +458,7 @@ Renames `ExpansionPanel*` to `Accordion*`
|
|
|
450
458
|
npx @mui/codemod v5.0.0/expansion-panel-component <path>
|
|
451
459
|
```
|
|
452
460
|
|
|
453
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#expansionpanel).
|
|
461
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#expansionpanel).
|
|
454
462
|
|
|
455
463
|
#### `fab-variant`
|
|
456
464
|
|
|
@@ -463,7 +471,7 @@ You can find more details about this breaking change in [the migration guide](ht
|
|
|
463
471
|
npx @mui/codemod v5.0.0/fab-variant <path>
|
|
464
472
|
```
|
|
465
473
|
|
|
466
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#fab).
|
|
474
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#fab).
|
|
467
475
|
|
|
468
476
|
#### `fade-rename-alpha`
|
|
469
477
|
|
|
@@ -483,7 +491,7 @@ Renames the `fade` style utility import and calls to `alpha`.
|
|
|
483
491
|
npx @mui/codemod v5.0.0/fade-rename-alpha <path>
|
|
484
492
|
```
|
|
485
493
|
|
|
486
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#styles).
|
|
494
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#styles).
|
|
487
495
|
|
|
488
496
|
#### `grid-justify-justifycontent`
|
|
489
497
|
|
|
@@ -500,7 +508,7 @@ Renames `Grid`'s `justify` prop to `justifyContent`.
|
|
|
500
508
|
npx @mui/codemod v5.0.0/grid-justify-justifycontent <path>
|
|
501
509
|
```
|
|
502
510
|
|
|
503
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#grid).
|
|
511
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#grid).
|
|
504
512
|
|
|
505
513
|
#### `grid-list-component`
|
|
506
514
|
|
|
@@ -510,7 +518,7 @@ Renames `GridList*` to `ImageList*`
|
|
|
510
518
|
npx @mui/codemod v5.0.0/grid-list-component <path>
|
|
511
519
|
```
|
|
512
520
|
|
|
513
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#gridlist).
|
|
521
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#gridlist).
|
|
514
522
|
|
|
515
523
|
#### `icon-button-size`
|
|
516
524
|
|
|
@@ -527,7 +535,7 @@ Adds `size="large"` if `size` is not defined to get the same appearance as v4.
|
|
|
527
535
|
npx @mui/codemod v5.0.0/icon-button-size <path>
|
|
528
536
|
```
|
|
529
537
|
|
|
530
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#iconbutton).
|
|
538
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#iconbutton).
|
|
531
539
|
|
|
532
540
|
#### `jss-to-styled`
|
|
533
541
|
|
|
@@ -592,10 +600,10 @@ export const MyCard = () => {
|
|
|
592
600
|
npx @mui/codemod v5.0.0/jss-to-styled <path>
|
|
593
601
|
```
|
|
594
602
|
|
|
595
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#1-use-styled-or-sx-api).
|
|
603
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#1-use-styled-or-sx-api).
|
|
596
604
|
|
|
597
605
|
> **Note:** This approach converts the first element in the return statement into styled component but also increases CSS specificity to override nested children.
|
|
598
|
-
> This codemod should be adopted after handling all breaking changes, [check out the migration documentation](https://mui.com/guides/migration-v4/)
|
|
606
|
+
> This codemod should be adopted after handling all breaking changes, [check out the migration documentation](https://mui.com/material-ui/guides/migration-v4/)
|
|
599
607
|
|
|
600
608
|
#### `link-underline-hover`
|
|
601
609
|
|
|
@@ -610,7 +618,7 @@ Apply `underline="hover"` to `<Link />` that does not define `underline` prop (t
|
|
|
610
618
|
npx @mui/codemod v5.0.0/icon-button-size <path>
|
|
611
619
|
```
|
|
612
620
|
|
|
613
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#link).
|
|
621
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#link).
|
|
614
622
|
|
|
615
623
|
#### `material-ui-styles`
|
|
616
624
|
|
|
@@ -661,7 +669,7 @@ Renames `Omit` import from `@material-ui/types` to `DistributiveOmit`
|
|
|
661
669
|
npx @mui/codemod v5.0.0/material-ui-types <path>
|
|
662
670
|
```
|
|
663
671
|
|
|
664
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#material-ui-types).
|
|
672
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#material-ui-types).
|
|
665
673
|
|
|
666
674
|
#### `modal-props`
|
|
667
675
|
|
|
@@ -678,7 +686,7 @@ Removes `disableBackdropClick` and `onEscapeKeyDown` from `<Modal>`
|
|
|
678
686
|
npx @mui/codemod v5.0.0/modal-props <path>
|
|
679
687
|
```
|
|
680
688
|
|
|
681
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#modal).
|
|
689
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#modal).
|
|
682
690
|
|
|
683
691
|
#### `moved-lab-modules`
|
|
684
692
|
|
|
@@ -704,13 +712,13 @@ npx @mui/codemod v5.0.0/moved-lab-modules <path>
|
|
|
704
712
|
|
|
705
713
|
You can find more details about this breaking change in the migration guide.
|
|
706
714
|
|
|
707
|
-
- [Alert](https://mui.com/guides/migration-v4/#alert)
|
|
708
|
-
- [Autocomplete](https://mui.com/guides/migration-v4/#autocomplete)
|
|
709
|
-
- [AvatarGroup](https://mui.com/guides/migration-v4/#avatar)
|
|
710
|
-
- [Pagination](https://mui.com/guides/migration-v4/#pagination)
|
|
711
|
-
- [Skeleton](https://mui.com/guides/migration-v4/#skeleton)
|
|
712
|
-
- [SpeedDial](https://mui.com/guides/migration-v4/#speeddial)
|
|
713
|
-
- [ToggleButton](https://mui.com/guides/migration-v4/#togglebutton)
|
|
715
|
+
- [Alert](https://mui.com/material-ui/guides/migration-v4/#alert)
|
|
716
|
+
- [Autocomplete](https://mui.com/material-ui/guides/migration-v4/#autocomplete)
|
|
717
|
+
- [AvatarGroup](https://mui.com/material-ui/guides/migration-v4/#avatar)
|
|
718
|
+
- [Pagination](https://mui.com/material-ui/guides/migration-v4/#pagination)
|
|
719
|
+
- [Skeleton](https://mui.com/material-ui/guides/migration-v4/#skeleton)
|
|
720
|
+
- [SpeedDial](https://mui.com/material-ui/guides/migration-v4/#speeddial)
|
|
721
|
+
- [ToggleButton](https://mui.com/material-ui/guides/migration-v4/#togglebutton)
|
|
714
722
|
|
|
715
723
|
#### `pagination-round-circular`
|
|
716
724
|
|
|
@@ -727,7 +735,7 @@ Renames `Pagination*`'s `shape` values from 'round' to 'circular'.
|
|
|
727
735
|
npx @mui/codemod v5.0.0/pagination-round-circular <path>
|
|
728
736
|
```
|
|
729
737
|
|
|
730
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#pagination).
|
|
738
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#pagination).
|
|
731
739
|
|
|
732
740
|
#### `optimal-imports`
|
|
733
741
|
|
|
@@ -754,7 +762,7 @@ Removes `RootRef` from the codebase.
|
|
|
754
762
|
npx @mui/codemod v5.0.0/root-ref <path>
|
|
755
763
|
```
|
|
756
764
|
|
|
757
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#rootref).
|
|
765
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#rootref).
|
|
758
766
|
|
|
759
767
|
#### `skeleton-variant`
|
|
760
768
|
|
|
@@ -769,7 +777,7 @@ You can find more details about this breaking change in [the migration guide](ht
|
|
|
769
777
|
npx @mui/codemod v5.0.0/skeleton-variant <path>
|
|
770
778
|
```
|
|
771
779
|
|
|
772
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#skeleton).
|
|
780
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#skeleton).
|
|
773
781
|
|
|
774
782
|
#### `styled-engine-provider`
|
|
775
783
|
|
|
@@ -779,7 +787,7 @@ Applies `StyledEngineProvider` to the files that contains `ThemeProvider`.
|
|
|
779
787
|
npx @mui/codemod v5.0.0/styled-engine-provider <path>
|
|
780
788
|
```
|
|
781
789
|
|
|
782
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#style-library).
|
|
790
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#style-library).
|
|
783
791
|
|
|
784
792
|
#### `table-props`
|
|
785
793
|
|
|
@@ -805,7 +813,7 @@ Renames props in `Table*` components.
|
|
|
805
813
|
npx @mui/codemod v5.0.0/table-props <path>
|
|
806
814
|
```
|
|
807
815
|
|
|
808
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#table).
|
|
816
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#table).
|
|
809
817
|
|
|
810
818
|
#### `tabs-scroll-buttons`
|
|
811
819
|
|
|
@@ -824,7 +832,7 @@ Renames the `Tabs`'s `scrollButtons` prop values.
|
|
|
824
832
|
npx @mui/codemod v5.0.0/tabs-scroll-buttons <path>
|
|
825
833
|
```
|
|
826
834
|
|
|
827
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#tabs).
|
|
835
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#tabs).
|
|
828
836
|
|
|
829
837
|
#### `textarea-minmax-rows`
|
|
830
838
|
|
|
@@ -845,8 +853,8 @@ npx @mui/codemod v5.0.0/textarea-minmax-rows <path>
|
|
|
845
853
|
|
|
846
854
|
You can find more details about this breaking change in the migration guide.
|
|
847
855
|
|
|
848
|
-
- [TextareaAutosize](https://mui.com/guides/migration-v4/#textareaautoresize)
|
|
849
|
-
- [TextField](https://mui.com/guides/migration-v4/#textfield)
|
|
856
|
+
- [TextareaAutosize](https://mui.com/material-ui/guides/migration-v4/#textareaautoresize)
|
|
857
|
+
- [TextField](https://mui.com/material-ui/guides/migration-v4/#textfield)
|
|
850
858
|
|
|
851
859
|
#### `theme-augment`
|
|
852
860
|
|
|
@@ -856,7 +864,7 @@ Adds `DefaultTheme` module augmentation to typescript projects.
|
|
|
856
864
|
npx @mui/codemod v5.0.0/theme-augment <path>
|
|
857
865
|
```
|
|
858
866
|
|
|
859
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#material-ui-styles).
|
|
867
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#material-ui-styles).
|
|
860
868
|
|
|
861
869
|
#### `theme-breakpoints`
|
|
862
870
|
|
|
@@ -875,7 +883,7 @@ Updates breakpoint values to match new logic. ⚠️ This mod is not idempotent,
|
|
|
875
883
|
npx @mui/codemod v5.0.0/theme-breakpoints <path>
|
|
876
884
|
```
|
|
877
885
|
|
|
878
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#theme).
|
|
886
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#theme).
|
|
879
887
|
|
|
880
888
|
#### `theme-breakpoints-width`
|
|
881
889
|
|
|
@@ -885,7 +893,7 @@ Renames `theme.breakpoints.width('md')` to `theme.breakpoints.values.md`.
|
|
|
885
893
|
npx @mui/codemod v5.0.0/theme-breakpoints-width <path>
|
|
886
894
|
```
|
|
887
895
|
|
|
888
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#theme).
|
|
896
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#theme).
|
|
889
897
|
|
|
890
898
|
#### `theme-options`
|
|
891
899
|
|
|
@@ -913,7 +921,7 @@ Renames `type` to `mode`.
|
|
|
913
921
|
npx @mui/codemod v5.0.0/theme-palette-mode <path>
|
|
914
922
|
```
|
|
915
923
|
|
|
916
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#theme).
|
|
924
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#theme).
|
|
917
925
|
|
|
918
926
|
#### `theme-provider`
|
|
919
927
|
|
|
@@ -923,7 +931,7 @@ Renames `MuiThemeProvider` to `ThemeProvider`.
|
|
|
923
931
|
npx @mui/codemod v5.0.0/theme-provider <path>
|
|
924
932
|
```
|
|
925
933
|
|
|
926
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#material-ui-core-styles).
|
|
934
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#material-ui-core-styles).
|
|
927
935
|
|
|
928
936
|
#### `theme-spacing`
|
|
929
937
|
|
|
@@ -942,7 +950,7 @@ Removes the 'px' suffix from some template strings.
|
|
|
942
950
|
npx @mui/codemod v5.0.0/theme-spacing <path>
|
|
943
951
|
```
|
|
944
952
|
|
|
945
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#theme).
|
|
953
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#theme).
|
|
946
954
|
|
|
947
955
|
#### `theme-typography-round`
|
|
948
956
|
|
|
@@ -957,7 +965,7 @@ Renames `theme.typography.round($number)` to `Math.round($number * 1e5) / 1e5`.
|
|
|
957
965
|
npx @mui/codemod v5.0.0/theme-typography-round <path>
|
|
958
966
|
```
|
|
959
967
|
|
|
960
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#theme).
|
|
968
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#theme).
|
|
961
969
|
|
|
962
970
|
#### `top-level-imports`
|
|
963
971
|
|
|
@@ -1027,7 +1035,7 @@ Updates Dialog, Menu, Popover, and Snackbar to use the `TransitionProps` prop to
|
|
|
1027
1035
|
npx @mui/codemod v5.0.0/use-transitionprops <path>
|
|
1028
1036
|
```
|
|
1029
1037
|
|
|
1030
|
-
You can find more details about this breaking change in [the migration guide](/guides/migration-v4/#dialog).
|
|
1038
|
+
You can find more details about this breaking change in [the migration guide](/material-ui/guides/migration-v4/#dialog).
|
|
1031
1039
|
|
|
1032
1040
|
#### `variant-prop`
|
|
1033
1041
|
|
|
@@ -1071,7 +1079,7 @@ Removes imported `withMobileDialog`, and inserts hardcoded version to prevent ap
|
|
|
1071
1079
|
npx @mui/codemod v5.0.0/with-mobile-dialog <path>
|
|
1072
1080
|
```
|
|
1073
1081
|
|
|
1074
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#dialog).
|
|
1082
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#dialog).
|
|
1075
1083
|
|
|
1076
1084
|
#### `with-width`
|
|
1077
1085
|
|
|
@@ -1087,7 +1095,7 @@ Removes `withWidth` import, and inserts hardcoded version to prevent application
|
|
|
1087
1095
|
npx @mui/codemod v5.0.0/with-width <path>
|
|
1088
1096
|
```
|
|
1089
1097
|
|
|
1090
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#material-ui-core-styles).
|
|
1098
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#material-ui-core-styles).
|
|
1091
1099
|
|
|
1092
1100
|
#### `mui-replace`
|
|
1093
1101
|
|
|
@@ -1148,7 +1156,7 @@ Replace every occurrence of `material-ui` related package with the new package n
|
|
|
1148
1156
|
npx @mui/codemod v5.0.0/mui-replace <path>
|
|
1149
1157
|
```
|
|
1150
1158
|
|
|
1151
|
-
You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#update-material-ui-version).
|
|
1159
|
+
You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#update-material-ui-version).
|
|
1152
1160
|
|
|
1153
1161
|
### v4.0.0
|
|
1154
1162
|
|
package/codemod.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = transformer;
|
|
7
|
+
const _exports = {
|
|
8
|
+
AdapterDateFns: {
|
|
9
|
+
default: 'AdapterDateFns',
|
|
10
|
+
named: []
|
|
11
|
+
},
|
|
12
|
+
AdapterDayjs: {
|
|
13
|
+
default: 'AdapterDayjs',
|
|
14
|
+
named: []
|
|
15
|
+
},
|
|
16
|
+
AdapterLuxon: {
|
|
17
|
+
default: 'AdapterLuxon',
|
|
18
|
+
named: []
|
|
19
|
+
},
|
|
20
|
+
AdapterMoment: {
|
|
21
|
+
default: 'AdapterMoment',
|
|
22
|
+
named: []
|
|
23
|
+
},
|
|
24
|
+
CalendarPicker: {
|
|
25
|
+
default: 'CalendarPicker',
|
|
26
|
+
named: ['calendarPickerClasses', 'CalendarPickerClasses', 'CalendarPickerClassKey', 'CalendarPickerProps', 'CalendarPickerView']
|
|
27
|
+
},
|
|
28
|
+
CalendarPickerSkeleton: {
|
|
29
|
+
default: 'CalendarPickerSkeleton',
|
|
30
|
+
named: ['calendarPickerSkeletonClasses', 'CalendarPickerSkeletonClassKey', 'CalendarPickerSkeletonProps', 'getCalendarPickerSkeletonUtilityClass']
|
|
31
|
+
},
|
|
32
|
+
ClockPicker: {
|
|
33
|
+
default: 'ClockPicker',
|
|
34
|
+
named: ['clockPickerClasses', 'ClockPickerClasses', 'ClockPickerClassKey', 'ClockPickerProps', 'ClockPickerView']
|
|
35
|
+
},
|
|
36
|
+
DatePicker: {
|
|
37
|
+
default: 'DatePicker',
|
|
38
|
+
named: ['DatePickerProps']
|
|
39
|
+
},
|
|
40
|
+
DateRangePicker: {
|
|
41
|
+
default: 'DateRangePicker',
|
|
42
|
+
named: ['DateRange', 'DateRangePickerProps'],
|
|
43
|
+
isPro: true
|
|
44
|
+
},
|
|
45
|
+
DateRangePickerDay: {
|
|
46
|
+
default: 'DateRangePickerDay',
|
|
47
|
+
named: ['dateRangePickerDayClasses', 'DateRangePickerDayClasses', 'DateRangePickerDayClassKey', 'DateRangePickerDayProps', 'getDateRangePickerDayUtilityClass'],
|
|
48
|
+
isPro: true
|
|
49
|
+
},
|
|
50
|
+
DateTimePicker: {
|
|
51
|
+
default: 'DateTimePicker',
|
|
52
|
+
named: ['DateTimePickerProps']
|
|
53
|
+
},
|
|
54
|
+
DesktopDatePicker: {
|
|
55
|
+
default: 'DesktopDatePicker',
|
|
56
|
+
named: ['DesktopDatePickerProps']
|
|
57
|
+
},
|
|
58
|
+
DesktopDateRangePicker: {
|
|
59
|
+
default: 'DesktopDateRangePicker',
|
|
60
|
+
named: ['DesktopDateRangePickerProps'],
|
|
61
|
+
isPro: true
|
|
62
|
+
},
|
|
63
|
+
DesktopDateTimePicker: {
|
|
64
|
+
default: 'DesktopDateTimePicker',
|
|
65
|
+
named: ['DesktopDateTimePickerProps']
|
|
66
|
+
},
|
|
67
|
+
DesktopTimePicker: {
|
|
68
|
+
default: 'DesktopTimePicker',
|
|
69
|
+
named: ['DesktopTimePickerProps']
|
|
70
|
+
},
|
|
71
|
+
LocalizationProvider: {
|
|
72
|
+
default: 'LocalizationProvider',
|
|
73
|
+
named: ['LocalizationProviderProps', 'MuiPickersAdapter', 'MuiPickersAdapterContext', 'MuiPickersAdapterContextValue']
|
|
74
|
+
},
|
|
75
|
+
MobileDatePicker: {
|
|
76
|
+
default: 'MobileDatePicker',
|
|
77
|
+
named: ['MobileDatePickerProps']
|
|
78
|
+
},
|
|
79
|
+
MobileDateRangePicker: {
|
|
80
|
+
default: 'MobileDateRangePicker',
|
|
81
|
+
named: ['MobileDateRangePickerProps'],
|
|
82
|
+
isPro: true
|
|
83
|
+
},
|
|
84
|
+
MobileDateTimePicker: {
|
|
85
|
+
default: 'MobileDateTimePicker',
|
|
86
|
+
named: ['MobileDateTimePickerProps']
|
|
87
|
+
},
|
|
88
|
+
MobileTimePicker: {
|
|
89
|
+
default: 'MobileTimePicker',
|
|
90
|
+
named: ['MobileTimePickerProps']
|
|
91
|
+
},
|
|
92
|
+
MonthPicker: {
|
|
93
|
+
default: 'MonthPicker',
|
|
94
|
+
named: ['monthPickerClasses', 'getMonthPickerUtilityClass', 'MonthPickerClassKey', 'MonthPickerProps']
|
|
95
|
+
},
|
|
96
|
+
PickersDay: {
|
|
97
|
+
default: 'PickersDay',
|
|
98
|
+
named: ['pickersDayClasses', 'getPickersDayUtilityClass', 'PickersDayClassKey', 'PickersDayProps']
|
|
99
|
+
},
|
|
100
|
+
StaticDatePicker: {
|
|
101
|
+
default: 'StaticDatePicker',
|
|
102
|
+
named: ['StaticDatePickerProps']
|
|
103
|
+
},
|
|
104
|
+
StaticDateRangePicker: {
|
|
105
|
+
default: 'StaticDateRangePicker',
|
|
106
|
+
named: ['StaticDateRangePickerProps'],
|
|
107
|
+
isPro: true
|
|
108
|
+
},
|
|
109
|
+
StaticDateTimePicker: {
|
|
110
|
+
default: 'StaticDateTimePicker',
|
|
111
|
+
named: ['StaticDateTimePickerProps']
|
|
112
|
+
},
|
|
113
|
+
StaticTimePicker: {
|
|
114
|
+
default: 'StaticTimePicker',
|
|
115
|
+
named: ['StaticTimePickerProps']
|
|
116
|
+
},
|
|
117
|
+
TimePicker: {
|
|
118
|
+
default: 'TimePicker',
|
|
119
|
+
named: ['TimePickerProps']
|
|
120
|
+
},
|
|
121
|
+
YearPicker: {
|
|
122
|
+
default: 'YearPicker',
|
|
123
|
+
named: ['yearPickerClasses', 'getYearPickerUtilityClass', 'YearPickerClassKey', 'YearPickerProps']
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const buildLookup = () => {
|
|
128
|
+
return Object.fromEntries(Object.entries(_exports).flatMap(([entryPoint, entryPointData]) => [entryPointData.default, ...entryPointData.named].map(exportName => [exportName, {
|
|
129
|
+
entryPoint,
|
|
130
|
+
isPro: entryPointData.isPro
|
|
131
|
+
}])));
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
135
|
+
* @param {import('jscodeshift').API} api
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
function transformer(fileInfo, api, options) {
|
|
140
|
+
const j = api.jscodeshift;
|
|
141
|
+
const printOptions = options.printOptions || {
|
|
142
|
+
quote: 'single'
|
|
143
|
+
};
|
|
144
|
+
const lookup = buildLookup();
|
|
145
|
+
const root = j(fileInfo.source);
|
|
146
|
+
root.find(j.ImportDeclaration).forEach(path => {
|
|
147
|
+
const importSource = path.node.source.value;
|
|
148
|
+
const subPackageImportMatch = importSource.match(/@mui\/lab\/(.*)/);
|
|
149
|
+
|
|
150
|
+
if (subPackageImportMatch !== null) {
|
|
151
|
+
const subModule = subPackageImportMatch[1];
|
|
152
|
+
|
|
153
|
+
if (subModule.startsWith('internal')) {
|
|
154
|
+
console.warn('Imports from `@mui/lab/internal` are not supported');
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (_exports[subModule]) {
|
|
159
|
+
/**
|
|
160
|
+
* @type {import('jscodeshift').ASTPath}
|
|
161
|
+
*/
|
|
162
|
+
const sourcePath = path.get('source');
|
|
163
|
+
const targetPackage = _exports[subModule].isPro ? '@mui/x-date-pickers-pro' : '@mui/x-date-pickers';
|
|
164
|
+
const targetImportPath = `${targetPackage}/${subModule}`;
|
|
165
|
+
sourcePath.replace(j.stringLiteral(targetImportPath));
|
|
166
|
+
const importDeclaration = path.value;
|
|
167
|
+
importDeclaration.specifiers = importDeclaration.specifiers.map(specifier => {
|
|
168
|
+
if (specifier.type === 'ImportDefaultSpecifier') {
|
|
169
|
+
const localName = specifier.local.name;
|
|
170
|
+
return j.importSpecifier(j.identifier(subModule), j.identifier(localName));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return specifier;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
} else if (importSource === '@mui/lab') {
|
|
177
|
+
// Sieve import specifiers into /core and /lab
|
|
178
|
+
const xImportSpecifiers = [];
|
|
179
|
+
const labImportSpecifiers = [];
|
|
180
|
+
let isPro = false;
|
|
181
|
+
path.node.specifiers.forEach(specifier => {
|
|
182
|
+
if (specifier.type === 'ImportSpecifier') {
|
|
183
|
+
const lookupValue = lookup[specifier.imported.name];
|
|
184
|
+
|
|
185
|
+
if (lookupValue) {
|
|
186
|
+
xImportSpecifiers.push(specifier);
|
|
187
|
+
|
|
188
|
+
if (lookupValue.isPro) {
|
|
189
|
+
isPro = true;
|
|
190
|
+
}
|
|
191
|
+
} else {
|
|
192
|
+
labImportSpecifiers.push(specifier);
|
|
193
|
+
}
|
|
194
|
+
} else {
|
|
195
|
+
// `import Lab from '@material-ui/lab'`
|
|
196
|
+
// `import * as Lab from '@material-ui/lab'`
|
|
197
|
+
// These imports would require scope analysis.
|
|
198
|
+
console.warn(`Can't handle ${specifier.type}`);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
if (xImportSpecifiers.length > 0) {
|
|
203
|
+
const targetPackage = isPro ? '@mui/x-date-pickers-pro' : '@mui/x-date-pickers';
|
|
204
|
+
path.replace(j.importDeclaration(xImportSpecifiers, j.stringLiteral(targetPackage)), j.importDeclaration(labImportSpecifiers, j.stringLiteral('@mui/lab')));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}).toSource(printOptions);
|
|
208
|
+
return root.toSource(printOptions);
|
|
209
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _CalendarPicker = _interopRequireWildcard(require("@mui/lab/CalendarPicker"));
|
|
6
|
+
|
|
7
|
+
var _CalendarPickerSkeleton = _interopRequireWildcard(require("@mui/lab/CalendarPickerSkeleton"));
|
|
8
|
+
|
|
9
|
+
var _ClockPicker = _interopRequireWildcard(require("@mui/lab/ClockPicker"));
|
|
10
|
+
|
|
11
|
+
var _DatePicker = _interopRequireWildcard(require("@mui/lab/DatePicker"));
|
|
12
|
+
|
|
13
|
+
var _DateRangePicker = _interopRequireWildcard(require("@mui/lab/DateRangePicker"));
|
|
14
|
+
|
|
15
|
+
var _DateRangePickerDay = _interopRequireWildcard(require("@mui/lab/DateRangePickerDay"));
|
|
16
|
+
|
|
17
|
+
var _DateTimePicker = _interopRequireWildcard(require("@mui/lab/DateTimePicker"));
|
|
18
|
+
|
|
19
|
+
var _DesktopDatePicker = _interopRequireWildcard(require("@mui/lab/DesktopDatePicker"));
|
|
20
|
+
|
|
21
|
+
var _DesktopDateRangePicker = _interopRequireWildcard(require("@mui/lab/DesktopDateRangePicker"));
|
|
22
|
+
|
|
23
|
+
var _DesktopDateTimePicker = _interopRequireWildcard(require("@mui/lab/DesktopDateTimePicker"));
|
|
24
|
+
|
|
25
|
+
var _DesktopTimePicker = _interopRequireWildcard(require("@mui/lab/DesktopTimePicker"));
|
|
26
|
+
|
|
27
|
+
var _LocalizationProvider = _interopRequireWildcard(require("@mui/lab/LocalizationProvider"));
|
|
28
|
+
|
|
29
|
+
var _MobileDatePicker = _interopRequireWildcard(require("@mui/lab/MobileDatePicker"));
|
|
30
|
+
|
|
31
|
+
var _MobileDateRangePicker = _interopRequireWildcard(require("@mui/lab/MobileDateRangePicker"));
|
|
32
|
+
|
|
33
|
+
var _MobileDateTimePicker = _interopRequireWildcard(require("@mui/lab/MobileDateTimePicker"));
|
|
34
|
+
|
|
35
|
+
var _MobileTimePicker = _interopRequireWildcard(require("@mui/lab/MobileTimePicker"));
|
|
36
|
+
|
|
37
|
+
var _MonthPicker = _interopRequireWildcard(require("@mui/lab/MonthPicker"));
|
|
38
|
+
|
|
39
|
+
var _PickersDay = _interopRequireWildcard(require("@mui/lab/PickersDay"));
|
|
40
|
+
|
|
41
|
+
var _StaticDatePicker = _interopRequireWildcard(require("@mui/lab/StaticDatePicker"));
|
|
42
|
+
|
|
43
|
+
var _StaticDateRangePicker = _interopRequireWildcard(require("@mui/lab/StaticDateRangePicker"));
|
|
44
|
+
|
|
45
|
+
var _StaticDateTimePicker = _interopRequireWildcard(require("@mui/lab/StaticDateTimePicker"));
|
|
46
|
+
|
|
47
|
+
var _StaticTimePicker = _interopRequireWildcard(require("@mui/lab/StaticTimePicker"));
|
|
48
|
+
|
|
49
|
+
var _TimePicker = _interopRequireWildcard(require("@mui/lab/TimePicker"));
|
|
50
|
+
|
|
51
|
+
var _YearPicker = _interopRequireWildcard(require("@mui/lab/YearPicker"));
|
|
52
|
+
|
|
53
|
+
var _AdapterDateFns = _interopRequireDefault(require("@mui/lab/AdapterDateFns"));
|
|
54
|
+
|
|
55
|
+
var _AdapterDayjs = _interopRequireDefault(require("@mui/lab/AdapterDayjs"));
|
|
56
|
+
|
|
57
|
+
var _AdapterLuxon = _interopRequireDefault(require("@mui/lab/AdapterLuxon"));
|
|
58
|
+
|
|
59
|
+
var _AdapterMoment = _interopRequireDefault(require("@mui/lab/AdapterMoment"));
|
|
60
|
+
|
|
61
|
+
var _Timeline = _interopRequireDefault(require("@mui/lab/Timeline"));
|
|
62
|
+
|
|
63
|
+
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); }
|
|
64
|
+
|
|
65
|
+
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; }
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _CalendarPicker = require("@mui/x-date-pickers/CalendarPicker");
|
|
6
|
+
|
|
7
|
+
var _CalendarPickerSkeleton = require("@mui/x-date-pickers/CalendarPickerSkeleton");
|
|
8
|
+
|
|
9
|
+
var _ClockPicker = require("@mui/x-date-pickers/ClockPicker");
|
|
10
|
+
|
|
11
|
+
var _DatePicker = require("@mui/x-date-pickers/DatePicker");
|
|
12
|
+
|
|
13
|
+
var _DateRangePicker = require("@mui/x-date-pickers-pro/DateRangePicker");
|
|
14
|
+
|
|
15
|
+
var _DateRangePickerDay = require("@mui/x-date-pickers-pro/DateRangePickerDay");
|
|
16
|
+
|
|
17
|
+
var _DateTimePicker = require("@mui/x-date-pickers/DateTimePicker");
|
|
18
|
+
|
|
19
|
+
var _DesktopDatePicker = require("@mui/x-date-pickers/DesktopDatePicker");
|
|
20
|
+
|
|
21
|
+
var _DesktopDateRangePicker = require("@mui/x-date-pickers-pro/DesktopDateRangePicker");
|
|
22
|
+
|
|
23
|
+
var _DesktopDateTimePicker = require("@mui/x-date-pickers/DesktopDateTimePicker");
|
|
24
|
+
|
|
25
|
+
var _DesktopTimePicker = require("@mui/x-date-pickers/DesktopTimePicker");
|
|
26
|
+
|
|
27
|
+
var _LocalizationProvider = require("@mui/x-date-pickers/LocalizationProvider");
|
|
28
|
+
|
|
29
|
+
var _MobileDatePicker = require("@mui/x-date-pickers/MobileDatePicker");
|
|
30
|
+
|
|
31
|
+
var _MobileDateRangePicker = require("@mui/x-date-pickers-pro/MobileDateRangePicker");
|
|
32
|
+
|
|
33
|
+
var _MobileDateTimePicker = require("@mui/x-date-pickers/MobileDateTimePicker");
|
|
34
|
+
|
|
35
|
+
var _MobileTimePicker = require("@mui/x-date-pickers/MobileTimePicker");
|
|
36
|
+
|
|
37
|
+
var _MonthPicker = require("@mui/x-date-pickers/MonthPicker");
|
|
38
|
+
|
|
39
|
+
var _PickersDay = require("@mui/x-date-pickers/PickersDay");
|
|
40
|
+
|
|
41
|
+
var _StaticDatePicker = require("@mui/x-date-pickers/StaticDatePicker");
|
|
42
|
+
|
|
43
|
+
var _StaticDateRangePicker = require("@mui/x-date-pickers-pro/StaticDateRangePicker");
|
|
44
|
+
|
|
45
|
+
var _StaticDateTimePicker = require("@mui/x-date-pickers/StaticDateTimePicker");
|
|
46
|
+
|
|
47
|
+
var _StaticTimePicker = require("@mui/x-date-pickers/StaticTimePicker");
|
|
48
|
+
|
|
49
|
+
var _TimePicker = require("@mui/x-date-pickers/TimePicker");
|
|
50
|
+
|
|
51
|
+
var _YearPicker = require("@mui/x-date-pickers/YearPicker");
|
|
52
|
+
|
|
53
|
+
var _AdapterDateFns = require("@mui/x-date-pickers/AdapterDateFns");
|
|
54
|
+
|
|
55
|
+
var _AdapterDayjs = require("@mui/x-date-pickers/AdapterDayjs");
|
|
56
|
+
|
|
57
|
+
var _AdapterLuxon = require("@mui/x-date-pickers/AdapterLuxon");
|
|
58
|
+
|
|
59
|
+
var _AdapterMoment = require("@mui/x-date-pickers/AdapterMoment");
|
|
60
|
+
|
|
61
|
+
var _Timeline = _interopRequireDefault(require("@mui/lab/Timeline"));
|
|
@@ -34,7 +34,7 @@ function transformer(file, api, options) {
|
|
|
34
34
|
}).toSource(printOptions);
|
|
35
35
|
|
|
36
36
|
if (hasDisableBackdropClick || hasDisableBackdropClick) {
|
|
37
|
-
source = source.replace(/(<Modal)([\s\S]*>)/gm, `$1// You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#modal)${_os.EOL}$2`);
|
|
37
|
+
source = source.replace(/(<Modal)([\s\S]*>)/gm, `$1// You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#modal)${_os.EOL}$2`);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
if (hasDisableBackdropClick) {
|
|
@@ -5,7 +5,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
5
5
|
/*#__PURE__*/
|
|
6
6
|
(0, _jsxRuntime.jsx)(Modal // `handleOnEscapeKeyDown` is removed by codemod.
|
|
7
7
|
// `disableBackdropClick` is removed by codemod.
|
|
8
|
-
// You can find more details about this breaking change in [the migration guide](https://mui.com/guides/migration-v4/#modal)
|
|
8
|
+
// You can find more details about this breaking change in [the migration guide](https://mui.com/material-ui/guides/migration-v4/#modal)
|
|
9
9
|
, {
|
|
10
10
|
onClose: handleClose
|
|
11
11
|
});
|
|
@@ -16,8 +16,8 @@ function transformer(file, api, options) {
|
|
|
16
16
|
quote: 'single'
|
|
17
17
|
};
|
|
18
18
|
return j(file.source).find(j.ImportDeclaration).forEach(path => {
|
|
19
|
-
const
|
|
20
|
-
const subPackageImportMatch =
|
|
19
|
+
const importSource = path.node.source.value;
|
|
20
|
+
const subPackageImportMatch = importSource.match(/@material-ui\/lab\/(.*)/);
|
|
21
21
|
|
|
22
22
|
if (subPackageImportMatch !== null) {
|
|
23
23
|
const componentName = subPackageImportMatch[1];
|
|
@@ -29,7 +29,7 @@ function transformer(file, api, options) {
|
|
|
29
29
|
const sourcePath = path.get('source');
|
|
30
30
|
sourcePath.replace(j.stringLiteral(`@material-ui/core/${componentName}`));
|
|
31
31
|
}
|
|
32
|
-
} else if (
|
|
32
|
+
} else if (importSource === '@material-ui/lab') {
|
|
33
33
|
// Sieve import specifiers into /core and /lab
|
|
34
34
|
const labImportSpecifiers = [];
|
|
35
35
|
const coreImportSpecifiers = [];
|
|
@@ -37,7 +37,11 @@ function transformer(file, api, options) {
|
|
|
37
37
|
}
|
|
38
38
|
}).forEach(path => {
|
|
39
39
|
path.node.arguments.forEach(node => {
|
|
40
|
-
|
|
40
|
+
const replacementValue = map[node.value];
|
|
41
|
+
|
|
42
|
+
if (replacementValue !== undefined) {
|
|
43
|
+
node.value = replacementValue;
|
|
44
|
+
}
|
|
41
45
|
});
|
|
42
46
|
});
|
|
43
47
|
root.find(j.CallExpression, {
|
|
@@ -55,7 +59,11 @@ function transformer(file, api, options) {
|
|
|
55
59
|
}
|
|
56
60
|
}).forEach(path => {
|
|
57
61
|
const node = path.node.arguments[1];
|
|
58
|
-
|
|
62
|
+
const replacementValue = map[node.value];
|
|
63
|
+
|
|
64
|
+
if (replacementValue !== undefined) {
|
|
65
|
+
node.value = replacementValue;
|
|
66
|
+
}
|
|
59
67
|
});
|
|
60
68
|
return root.toSource(printOptions);
|
|
61
69
|
}
|
|
@@ -11,7 +11,7 @@ exports.default = transformer;
|
|
|
11
11
|
function transformer(file) {
|
|
12
12
|
return file.source // `${theme.spacing(2)}px` -> theme.spacing(2)
|
|
13
13
|
.replace(/`(-?)\${(-?)(theme\.spacing|spacing)\(([^{}]*)\)}px`/gm, '$3($1$2$4)') // `${theme.spacing(2)}px ${theme.spacing(4)}px` -> `${theme.spacing(2)} ${theme.spacing(4)}`
|
|
14
|
-
.replace(/(?<={(theme\.spacing|spacing)\(
|
|
14
|
+
.replace(/(?<={(theme\.spacing|spacing)\([^]*.*[^]*\)})px/gm, '').replace(/((theme\.spacing|spacing)\(.*\))\s*\+\s*'px'/gm, '$1').replace(/\${(theme.spacing|spacing)(\(.*\))\s*([+-])\s*([\d.]+)\s*}px/gm, // eslint-disable-next-line no-template-curly-in-string
|
|
15
15
|
'calc(${$1$2} $3 $4px)').replace(/\${(theme.spacing|spacing)(\(.*\))\s*([*/])\s*([\d.]+)\s*}px/gm, // eslint-disable-next-line no-template-curly-in-string
|
|
16
16
|
'calc(${$1$2} $3 $4)');
|
|
17
17
|
}
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
theme.spacing(gap) + 'px';
|
|
5
5
|
spacing(gap) + 'px'`calc(100% - ${spacing(itemHorzPadding * 2)}px)``calc(100% - ${theme.spacing(itemHorzPadding * 2)}px)`;
|
|
6
6
|
|
|
7
|
-
padding: `${theme.spacing(2) - 1}px 0``calc(100% - ${theme.spacing(itemHorzPadding) * 0.3}px)``${-theme.spacing(1)}px``-${theme.spacing(1)}px`;
|
|
7
|
+
padding: `${theme.spacing(2) - 1}px 0``calc(100% - ${theme.spacing(itemHorzPadding) * 0.3}px)``${-theme.spacing(1)}px``-${theme.spacing(1)}px``${theme.spacing(2)}px ${theme.spacing(1)}px ${theme.spacing(2)}px ${theme.spacing(2)}px`;
|
|
@@ -10,4 +10,4 @@ spacing(gap)`calc(100% - ${spacing(itemHorzPadding * 2)})``calc(100% - ${theme.s
|
|
|
10
10
|
padding: `calc(${theme.spacing(2)} - 1px) 0``calc(100% - calc(${theme.spacing(itemHorzPadding)} * 0.3))`;
|
|
11
11
|
|
|
12
12
|
theme.spacing(-1);
|
|
13
|
-
theme.spacing(-1)
|
|
13
|
+
theme.spacing(-1)`${theme.spacing(2)} ${theme.spacing(1)} ${theme.spacing(2)} ${theme.spacing(2)}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/codemod",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.4",
|
|
4
4
|
"bin": "./codemod.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "MUI Team",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"@babel/traverse": "^7.17.3",
|
|
36
36
|
"jscodeshift": "^0.13.1",
|
|
37
37
|
"jscodeshift-add-imports": "^1.0.10",
|
|
38
|
-
"yargs": "^17.
|
|
38
|
+
"yargs": "^17.4.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@types/jscodeshift": "0.11.
|
|
41
|
+
"@types/jscodeshift": "0.11.4"
|
|
42
42
|
},
|
|
43
43
|
"sideEffects": false,
|
|
44
44
|
"publishConfig": {
|