@mui/x-codemod 9.0.0-alpha.0 → 9.0.0-alpha.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 +236 -0
- package/README.md +65 -1
- package/codemod.js +24 -16
- package/package.json +4 -4
- package/util/renameImports.js +1 -1
- package/v6.0.0/data-grid/column-menu-components-rename/index.js +1 -1
- package/v7.0.0/pickers/rename-slots-types/index.js +1 -1
- package/v8.0.0/charts/rename-label-and-tick-font-size/index.js +1 -1
- package/v8.0.0/charts/rename-legend-to-slots-legend/index.js +1 -1
- package/v8.0.0/charts/replace-legend-direction-values/index.js +1 -1
- package/v8.0.0/charts/replace-legend-hidden-slot-prop/index.js +1 -1
- package/v8.0.0/charts/replace-legend-position-values/index.js +1 -1
- package/v8.0.0/data-grid/add-showToolbar-prop/index.js +2 -2
- package/v9.0.0/charts/preset-safe/index.js +6 -1
- package/v9.0.0/charts/rename-chart-api-import/index.js +7 -0
- package/v9.0.0/charts/rename-chart-container/index.js +78 -0
- package/v9.0.0/charts/rename-chart-data-provider/index.js +78 -0
- package/v9.0.0/charts/rename-chart-zoom-slider/index.js +49 -0
- package/v9.0.0/charts/rename-sankey-chart/index.js +40 -0
- package/v9.0.0/charts/replace-show-mark-default/index.js +93 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,241 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 9.0.0-alpha.2
|
|
4
|
+
|
|
5
|
+
_Mar 5, 2026_
|
|
6
|
+
|
|
7
|
+
We'd like to extend a big thank you to the 12 contributors who made this release possible. Here are some highlights ✨:
|
|
8
|
+
|
|
9
|
+
- ✅ Stabilize Sankey chart
|
|
10
|
+
- 🐞 Bugfixes and internal improvements
|
|
11
|
+
|
|
12
|
+
The following team members contributed to this release:
|
|
13
|
+
@aemartos, @alelthomas, @alexfauquette, @arminmeh, @bernardobelchior, @brijeshb42, @Janpot, @JCQuintas, @mapache-salvaje, @michelengelen, @mj12albert, @sai6855, @siriwatknp
|
|
14
|
+
|
|
15
|
+
### Data Grid
|
|
16
|
+
|
|
17
|
+
#### `@mui/x-data-grid@9.0.0-alpha.2`
|
|
18
|
+
|
|
19
|
+
- [dataGrid] Fix keyboard nav with single-row checkbox selection (#21149) @mj12albert
|
|
20
|
+
- [DataGrid] Add `checkboxColDef` prop to customize the selection column (#21331) @michelengelen
|
|
21
|
+
- [DataGrid] Format pagination numbers by default (#21117) @siriwatknp
|
|
22
|
+
- [DataGrid] Prevent unnecessary row selection checkbox rerendering (#21570) @arminmeh
|
|
23
|
+
- [DataGrid] Make GridScrollArea overrides resolver dynamic (#21532) @sai6855
|
|
24
|
+
|
|
25
|
+
#### `@mui/x-data-grid-pro@9.0.0-alpha.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
26
|
+
|
|
27
|
+
Same changes as in `@mui/x-data-grid@9.0.0-alpha.2`, plus:
|
|
28
|
+
|
|
29
|
+
- [DataGridPro] Use `getRowId` prop to calculate the tree data row update (#21540) @arminmeh
|
|
30
|
+
|
|
31
|
+
#### `@mui/x-data-grid-premium@9.0.0-alpha.2` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
32
|
+
|
|
33
|
+
Same changes as in `@mui/x-data-grid-pro@9.0.0-alpha.2`.
|
|
34
|
+
|
|
35
|
+
### Date and Time Pickers
|
|
36
|
+
|
|
37
|
+
#### `@mui/x-date-pickers@9.0.0-alpha.2`
|
|
38
|
+
|
|
39
|
+
- [pickers] Add `keepOpenDuringFieldFocus` prop (#20782) @michelengelen
|
|
40
|
+
|
|
41
|
+
#### `@mui/x-date-pickers-pro@9.0.0-alpha.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
42
|
+
|
|
43
|
+
Same changes as in `@mui/x-date-pickers@9.0.0-alpha.2`.
|
|
44
|
+
|
|
45
|
+
### Charts
|
|
46
|
+
|
|
47
|
+
#### `@mui/x-charts@9.0.0-alpha.2`
|
|
48
|
+
|
|
49
|
+
- [charts] Add `ChartsLayerContainer` component (#21264) @bernardobelchior
|
|
50
|
+
- [charts] Add codemod for `ChartsContainer` rename (#21504) @JCQuintas
|
|
51
|
+
- [charts] Add codemod for `ChartsDataProvider` rename (#21552) @JCQuintas
|
|
52
|
+
- [charts] Add codemod for `ChartsZoomSlider` rename (#21597) @JCQuintas
|
|
53
|
+
- [charts] Base the highlight items on the item identifiers (#21161) @alexfauquette
|
|
54
|
+
- [charts] Deprecate `ChartDataProvider` in favour of `ChartsDataProvider` (#21191) @JCQuintas
|
|
55
|
+
- [charts] Deprecate `highlighted` and `faded` classes (#21476) @alexfauquette
|
|
56
|
+
- [charts] Migrate to latest v8 warning (#21518) @JCQuintas
|
|
57
|
+
- [charts] Rename `ChartZoomSlider` to `ChartsZoomSlider` (#21553) @JCQuintas
|
|
58
|
+
- [charts] Rename `WebGl` to `WebGL` (#21524) @JCQuintas
|
|
59
|
+
- [charts] Rename `useSvgRef()` by `useChartsLayerContainerRef()` (#21494) @alexfauquette
|
|
60
|
+
- [charts] Restore focus on last focused item (#21522) @alexfauquette
|
|
61
|
+
- [charts] Warn users when controlled tooltip state does not match the trigger (#21520) @Copilot
|
|
62
|
+
- [charts] Fix controlled tooltip position (#21603) @bernardobelchior
|
|
63
|
+
|
|
64
|
+
#### `@mui/x-charts-pro@9.0.0-alpha.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
65
|
+
|
|
66
|
+
Same changes as in `@mui/x-charts@9.0.0-alpha.2`, plus:
|
|
67
|
+
|
|
68
|
+
- [charts-pro] Center the watermark (#21550) @alexfauquette
|
|
69
|
+
- [charts-pro] Stabilize `SankeyChart` API (#21133) @Copilot
|
|
70
|
+
|
|
71
|
+
#### `@mui/x-charts-premium@9.0.0-alpha.2` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
72
|
+
|
|
73
|
+
Same changes as in `@mui/x-charts-pro@9.0.0-alpha.2`.
|
|
74
|
+
|
|
75
|
+
### Tree View
|
|
76
|
+
|
|
77
|
+
#### `@mui/x-tree-view@9.0.0-alpha.2`
|
|
78
|
+
|
|
79
|
+
Internal changes.
|
|
80
|
+
|
|
81
|
+
#### `@mui/x-tree-view-pro@9.0.0-alpha.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
82
|
+
|
|
83
|
+
Same changes as in `@mui/x-tree-view@9.0.0-alpha.2`.
|
|
84
|
+
|
|
85
|
+
### Codemod
|
|
86
|
+
|
|
87
|
+
#### `@mui/x-codemod@9.0.0-alpha.2`
|
|
88
|
+
|
|
89
|
+
Internal changes.
|
|
90
|
+
|
|
91
|
+
### Docs
|
|
92
|
+
|
|
93
|
+
- [docs] Add backticks and parentheses to all functions and hooks (DX-173) (#21496) @mapache-salvaje
|
|
94
|
+
- [docs] Remove mentions of `mySvgRef` (#21559) @bernardobelchior
|
|
95
|
+
- [docs] Update Roadmap section in the docs (#20892) @alelthomas
|
|
96
|
+
- [docs] Add tutorial and example app for aggregation with row grouping (DX-162) (#21102) @mapache-salvaje
|
|
97
|
+
- [docs] Fix missing codemod docs (#21604) @JCQuintas
|
|
98
|
+
|
|
99
|
+
### Core
|
|
100
|
+
|
|
101
|
+
- [code-infra] Add eslint rule to prevent `Math.random` in docs (#21505) @JCQuintas
|
|
102
|
+
- [code-infra] Avoid static props for pageContent (#21038) @Janpot
|
|
103
|
+
- [code-infra] Isolate `date-pickers-pro` in the browser tests (#21383) @Janpot
|
|
104
|
+
- [code-infra] Remove `--coverage` (#21410) @Janpot
|
|
105
|
+
- [code-infra] Remove unneeded `skipIf`s (#21569) @JCQuintas
|
|
106
|
+
- [code-infra] Remove vale as a workspace dependency (#21489) @brijeshb42
|
|
107
|
+
- [code-infra] Remove x-charts-vendor from nextjs processing (#21534) @brijeshb42
|
|
108
|
+
- [code-infra] Set BASE_BRANCH env var in CircleCI config (#21548) @brijeshb42
|
|
109
|
+
- [code-infra] Setup error code extraction (#21469) @brijeshb42
|
|
110
|
+
- [code-infra] Setup flat build for packages (#21029) @brijeshb42
|
|
111
|
+
- [code-infra] Upgrade test_unit to large resource class (#21558) @Janpot
|
|
112
|
+
- [code-infra] Removed getTeamMembers function and usage from release script (#21605) @michelengelen
|
|
113
|
+
|
|
114
|
+
### Miscellaneous
|
|
115
|
+
|
|
116
|
+
- [x-license] Add Q1-2026 plan version with quantity and appType support (#21574) @aemartos
|
|
117
|
+
- [x-license] Add v3 key format support, centralize test keys, and trim public API (#21485) @aemartos
|
|
118
|
+
- [x-telemetry] telemetry opt-out by default, remove conf dependency (#21470) @aemartos
|
|
119
|
+
- [x-telemetry] test: mock context module directly in sender tests (#21546) @aemartos
|
|
120
|
+
|
|
121
|
+
## 9.0.0-alpha.1
|
|
122
|
+
|
|
123
|
+
_Feb 26, 2026_
|
|
124
|
+
|
|
125
|
+
We'd like to extend a big thank you to the 18 contributors who made this release possible. Here are some highlights ✨:
|
|
126
|
+
|
|
127
|
+
- ⚡️ Improved dynamic data support and cache invalidation in lazy loading for Data Grid Pro
|
|
128
|
+
- ⌨️ Keyboard support for selecting day, month, and year in Date Pickers
|
|
129
|
+
- 📊 Axis tooltip sorting and control improvements in Charts
|
|
130
|
+
- 🐞 Bugfixes and internal improvements
|
|
131
|
+
|
|
132
|
+
Special thanks go out to these community members for their valuable contributions:
|
|
133
|
+
@EllGree, @lion1963
|
|
134
|
+
|
|
135
|
+
The following team members contributed to this release:
|
|
136
|
+
@alexfauquette, @arminmeh, @brijeshb42, @cherniavskii, @dav-is, @flaviendelangle, @Janpot, @JCQuintas, @mapache-salvaje, @MBilalShafi, @michelengelen, @noraleonte, @rita-codes, @sai6855, @siriwatknp, @ZeeshanTamboli
|
|
137
|
+
|
|
138
|
+
### Data Grid
|
|
139
|
+
|
|
140
|
+
#### `@mui/x-data-grid@9.0.0-alpha.1`
|
|
141
|
+
|
|
142
|
+
- [DataGrid] Forward rest props in `GridFilterInputMultipleValue` (#21407) @siriwatknp
|
|
143
|
+
- [DataGrid] Preserve key input during row edit when using `rowModesModel` (#20759) @michelengelen
|
|
144
|
+
- [DataGrid] Remove double rtl inversion logic for columns pinning (#21371) @siriwatknp
|
|
145
|
+
|
|
146
|
+
#### `@mui/x-data-grid-pro@9.0.0-alpha.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
147
|
+
|
|
148
|
+
Same changes as in `@mui/x-data-grid@9.0.0-alpha.1`, plus:
|
|
149
|
+
|
|
150
|
+
- [DataGridPro] Fix number input visibility in header filters (#21328) @michelengelen
|
|
151
|
+
- [DataGridPro] Improve dynamic data support and cache invalidation in lazy loading (#21282) @MBilalShafi
|
|
152
|
+
|
|
153
|
+
#### `@mui/x-data-grid-premium@9.0.0-alpha.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
154
|
+
|
|
155
|
+
Same changes as in `@mui/x-data-grid-pro@9.0.0-alpha.1`.
|
|
156
|
+
|
|
157
|
+
### Date and Time Pickers
|
|
158
|
+
|
|
159
|
+
#### `@mui/x-date-pickers@9.0.0-alpha.1`
|
|
160
|
+
|
|
161
|
+
- [DatePicker] Add keyboard support for selecting day, month, and year (#20859) @michelengelen
|
|
162
|
+
|
|
163
|
+
#### `@mui/x-date-pickers-pro@9.0.0-alpha.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
164
|
+
|
|
165
|
+
Same changes as in `@mui/x-date-pickers@9.0.0-alpha.1`, plus:
|
|
166
|
+
|
|
167
|
+
- [DateRangePicker] Fix timezone update issue leading to `invalidRange` error (#20863) @michelengelen
|
|
168
|
+
|
|
169
|
+
### Charts
|
|
170
|
+
|
|
171
|
+
#### `@mui/x-charts@9.0.0-alpha.1`
|
|
172
|
+
|
|
173
|
+
- [charts] Add `sort` props to the axis tooltip (#21293) @alexfauquette
|
|
174
|
+
- [charts] Controll axis tooltip (#21351) @alexfauquette
|
|
175
|
+
- [charts] De duplicate keyboard focus handler function (#21267) @sai6855
|
|
176
|
+
- [charts] Make `type` optional in identifiers (#21311) @alexfauquette
|
|
177
|
+
- [charts] Move ref to the root component (#21396) @alexfauquette
|
|
178
|
+
- [charts] Refactor loading and no data overlays to use a shared OverlayText component (#21414) @sai6855
|
|
179
|
+
- [charts] Require series ids to be unique (#21330) @alexfauquette
|
|
180
|
+
- [charts] Set `showMark` as `false` by default (#21373) @alexfauquette
|
|
181
|
+
- [charts] Use `createGetNextIndexFocusedItem()` util in Funnel and RangeBar charts (#21390) @sai6855
|
|
182
|
+
- [charts] Remove unnecessary string concatenation (#21418) @sai6855
|
|
183
|
+
|
|
184
|
+
#### `@mui/x-charts-pro@9.0.0-alpha.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
185
|
+
|
|
186
|
+
Same changes as in `@mui/x-charts@9.0.0-alpha.1`.
|
|
187
|
+
|
|
188
|
+
#### `@mui/x-charts-premium@9.0.0-alpha.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
189
|
+
|
|
190
|
+
Same changes as in `@mui/x-charts-pro@9.0.0-alpha.1`.
|
|
191
|
+
|
|
192
|
+
### Tree View
|
|
193
|
+
|
|
194
|
+
#### `@mui/x-tree-view@9.0.0-alpha.1`
|
|
195
|
+
|
|
196
|
+
- [tree view] Focus item sibling on unmount instead of the 1st item (#21254) @flaviendelangle
|
|
197
|
+
|
|
198
|
+
#### `@mui/x-tree-view-pro@9.0.0-alpha.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
199
|
+
|
|
200
|
+
Same changes as in `@mui/x-tree-view@9.0.0-alpha.1`.
|
|
201
|
+
|
|
202
|
+
### Codemod
|
|
203
|
+
|
|
204
|
+
#### `@mui/x-codemod@9.0.0-alpha.1`
|
|
205
|
+
|
|
206
|
+
Internal changes.
|
|
207
|
+
|
|
208
|
+
### Docs
|
|
209
|
+
|
|
210
|
+
- [docs] Fix external 301s (#21377) @Janpot
|
|
211
|
+
- [docs] Show premium in the overview (#21343) @alexfauquette
|
|
212
|
+
- [docs][charts] Revise the useLegend hook doc (#21352) @mapache-salvaje
|
|
213
|
+
- [docs][charts] Revise the axis hooks doc (#21317) @mapache-salvaje
|
|
214
|
+
- [docs][charts] Revise the scale hooks doc (#21316) @mapache-salvaje
|
|
215
|
+
- [docs][charts] Revise the series hooks doc (#21353) @mapache-salvaje
|
|
216
|
+
- [docs][charts] Revise the useDataset doc (#21336) @mapache-salvaje
|
|
217
|
+
- [docs][charts] Revise the useDrawingArea doc (#21333) @mapache-salvaje
|
|
218
|
+
|
|
219
|
+
### Core
|
|
220
|
+
|
|
221
|
+
- [core] Update docs deploy script to the `docs-next` branch (#21341) @siriwatknp
|
|
222
|
+
- [code-infra] Cleanup unused babel plugins (#21453) @brijeshb42
|
|
223
|
+
- [code-infra] Do not append `x` to the last version for the compare API (#21408) @arminmeh
|
|
224
|
+
- [code-infra] Upgrade react-docgen to v8 X (#21155) @JCQuintas
|
|
225
|
+
- [code-infra] Modernize codemod (#21096) @JCQuintas
|
|
226
|
+
- [docs-infra] Fix current version detection logic (#21417) @cherniavskii
|
|
227
|
+
- [docs-infra] Reapply Cookie Banner (#21281) @dav-is
|
|
228
|
+
- [internal] Headless filtering plugin (#21302) @arminmeh
|
|
229
|
+
- [internal] Headless pagination plugin (#21183) @arminmeh
|
|
230
|
+
- [internal] Headless virtualization followups (#21327) @cherniavskii
|
|
231
|
+
- [internal] Keep cached data for disabled pipe processors (#21348) @arminmeh
|
|
232
|
+
- [internal] Remove autoprefixer package (#21440) @ZeeshanTamboli
|
|
233
|
+
|
|
234
|
+
### Miscellaneous
|
|
235
|
+
|
|
236
|
+
- [l10n] Fix Czech (csCZ) locale: sort/filter labels are swapped (#21400) @EllGree
|
|
237
|
+
- [l10n] Improve Ukrainian (uk-UA) locale (#21366) @lion1963
|
|
238
|
+
|
|
3
239
|
## 9.0.0-alpha.0
|
|
4
240
|
|
|
5
241
|
_Feb 16, 2026_
|
package/README.md
CHANGED
|
@@ -95,8 +95,13 @@ npx @mui/x-codemod@next v9.0.0/charts/preset-safe <path|folder>
|
|
|
95
95
|
The list includes these transformers
|
|
96
96
|
|
|
97
97
|
- [`replace-heatmap-hide-legend-false`](#replace-heatmap-hide-legend-false)
|
|
98
|
-
- [`
|
|
98
|
+
- [`replace-show-mark-default`](#replace-show-mark-default)
|
|
99
99
|
- [`rename-id-to-series-id`](#rename-id-to-series-id)
|
|
100
|
+
- [`rename-chart-api-import`](#rename-chart-api-import)
|
|
101
|
+
- [`rename-sankey-chart`](#rename-sankey-chart)
|
|
102
|
+
- [`rename-chart-container`](#rename-chart-container)
|
|
103
|
+
- [`rename-chart-data-provider`](#rename-chart-data-provider)
|
|
104
|
+
- [`rename-chart-zoom-slider`](#rename-chart-zoom-slider)
|
|
100
105
|
|
|
101
106
|
### `replace-heatmap-hide-legend-false`
|
|
102
107
|
|
|
@@ -165,6 +170,65 @@ Here is the list of slots and components that are impacted by the renaming:
|
|
|
165
170
|
| mark | MarkElement |
|
|
166
171
|
| lineHighlight | LineHighlightElement |
|
|
167
172
|
|
|
173
|
+
#### `replace-show-mark-default`
|
|
174
|
+
|
|
175
|
+
Add `showMark: true` to line series when not defined to keep the same default behavior.
|
|
176
|
+
|
|
177
|
+
```diff
|
|
178
|
+
- <LineChart series={[{ data: [/* ... */] }]} />
|
|
179
|
+
+ <LineChart series={[{ data: [/* ... */] showMark: true }]} />
|
|
180
|
+
- <ChartDataProvider series={[{ type: 'line', data: [/* ... */] }]} />
|
|
181
|
+
+ <ChartDataProvider series={[{ type: 'line', data: [/* ... */] showMark: true }]} />
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
#### `rename-chart-zoom-slider`
|
|
185
|
+
|
|
186
|
+
Renames the `ChartZoomSlider` component and related exports to `ChartsZoomSlider` (with an S) to align with other components.
|
|
187
|
+
|
|
188
|
+
```diff
|
|
189
|
+
-import { ChartZoomSlider } from '@mui/x-charts-pro';
|
|
190
|
+
+import { ChartsZoomSlider } from '@mui/x-charts-pro';
|
|
191
|
+
|
|
192
|
+
-import { ChartZoomSlider } from '@mui/x-charts-pro/ChartZoomSlider';
|
|
193
|
+
+import { ChartsZoomSlider } from '@mui/x-charts-pro/ChartsZoomSlider';
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
#### `rename-sankey-chart`
|
|
197
|
+
|
|
198
|
+
Stabilizes the `Unstable_SankeyChart` export by renaming it to `SankeyChart`.
|
|
199
|
+
|
|
200
|
+
```diff
|
|
201
|
+
-import { Unstable_SankeyChart } from '@mui/x-charts-pro';
|
|
202
|
+
+import { SankeyChart } from '@mui/x-charts-pro';
|
|
203
|
+
|
|
204
|
+
-import { Unstable_SankeyChart } from '@mui/x-charts-pro/SankeyChart';
|
|
205
|
+
+import { SankeyChart } from '@mui/x-charts-pro/SankeyChart';
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
#### `rename-chart-container`
|
|
209
|
+
|
|
210
|
+
Renames the `ChartContainer` component and related exports to `ChartsContainer` (with an S) to align with other components.
|
|
211
|
+
|
|
212
|
+
```diff
|
|
213
|
+
-import { ChartContainer } from '@mui/x-charts/ChartContainer';
|
|
214
|
+
+import { ChartsContainer } from '@mui/x-charts/ChartsContainer';
|
|
215
|
+
|
|
216
|
+
-import { ChartContainerPro } from '@mui/x-charts-pro/ChartContainerPro';
|
|
217
|
+
+import { ChartsContainerPro } from '@mui/x-charts-pro/ChartsContainerPro';
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
#### `rename-chart-data-provider`
|
|
221
|
+
|
|
222
|
+
Renames the `ChartDataProvider` component and related exports to `ChartsDataProvider` (with an S) to align with other components.
|
|
223
|
+
|
|
224
|
+
```diff
|
|
225
|
+
-import { ChartDataProvider } from '@mui/x-charts/ChartDataProvider';
|
|
226
|
+
+import { ChartsDataProvider } from '@mui/x-charts/ChartsDataProvider';
|
|
227
|
+
|
|
228
|
+
-import { ChartDataProviderPro } from '@mui/x-charts-pro/ChartDataProviderPro';
|
|
229
|
+
+import { ChartsDataProviderPro } from '@mui/x-charts-pro/ChartsDataProviderPro';
|
|
230
|
+
```
|
|
231
|
+
|
|
168
232
|
## v8.0.0
|
|
169
233
|
|
|
170
234
|
### 🚀 `preset-safe` for v8.0.0
|
package/codemod.js
CHANGED
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
-
var
|
|
5
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
6
6
|
var _fs = require("fs");
|
|
7
7
|
var _path = _interopRequireDefault(require("path"));
|
|
8
8
|
var _yargs = _interopRequireDefault(require("yargs"));
|
|
9
|
-
|
|
10
|
-
const jscodeshiftDirectory = _path.default.dirname(require.resolve('jscodeshift'));
|
|
11
|
-
const jscodeshiftExecutable = _path.default.join(jscodeshiftDirectory, jscodeshiftPackage.bin.jscodeshift);
|
|
9
|
+
var _Runner = require("jscodeshift/src/Runner");
|
|
12
10
|
async function runTransform(transform, files, flags, codemodFlags) {
|
|
13
11
|
const transformerSrcPath = _path.default.resolve(__dirname, './src', transform);
|
|
14
12
|
const transformerBuildPath = _path.default.resolve(__dirname, transform);
|
|
@@ -22,18 +20,30 @@ async function runTransform(transform, files, flags, codemodFlags) {
|
|
|
22
20
|
transformerPath = transformerBuildPath;
|
|
23
21
|
} catch (buildPathError) {
|
|
24
22
|
if (buildPathError.code === 'ENOENT') {
|
|
25
|
-
throw new Error(`Transform '${transform}' not found. Check out ${_path.default.resolve(__dirname, './README.md for a list of available codemods.')}`);
|
|
23
|
+
throw /* FIXME (minify-errors-in-prod): Unminified error message in production build! */new Error(`Transform '${transform}' not found. Check out ${_path.default.resolve(__dirname, './README.md for a list of available codemods.')}`);
|
|
26
24
|
}
|
|
27
25
|
throw buildPathError;
|
|
28
26
|
}
|
|
29
27
|
}
|
|
30
|
-
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
|
|
29
|
+
// Parse additional jscodeshift options from flags
|
|
30
|
+
const additionalOptions = {};
|
|
31
|
+
[...codemodFlags, ...flags.jscodeshift].forEach(flag => {
|
|
32
|
+
const match = flag.match(/^--([^=]+)(?:=(.*))?$/);
|
|
33
|
+
if (match) {
|
|
34
|
+
const [, key, value] = match;
|
|
35
|
+
additionalOptions[key] = value ?? true;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
const options = (0, _extends2.default)({
|
|
39
|
+
extensions: 'js,ts,jsx,tsx',
|
|
40
|
+
parser: flags.parser || 'tsx',
|
|
41
|
+
ignorePattern: ['**/node_modules/**', ...(additionalOptions.ignorePattern || [])],
|
|
42
|
+
verbose: 2
|
|
43
|
+
}, additionalOptions);
|
|
34
44
|
|
|
35
45
|
// eslint-disable-next-line no-console -- debug information
|
|
36
|
-
console.log(`
|
|
46
|
+
console.log(`Running jscodeshift with transform: ${transformerPath}`);
|
|
37
47
|
console.warn(`
|
|
38
48
|
====================================
|
|
39
49
|
IMPORTANT NOTICE ABOUT CODEMOD USAGE
|
|
@@ -42,14 +52,12 @@ Not all use cases are covered by codemods. In some scenarios, like props spreadi
|
|
|
42
52
|
|
|
43
53
|
For example, if a codemod tries to rename a prop, but this prop is hidden with the spread operator, it won't be transformed as expected.
|
|
44
54
|
<DatePicker {...pickerProps} />
|
|
45
|
-
|
|
55
|
+
|
|
46
56
|
After running the codemods, make sure to test your application and that you don't have any formatting or console errors.
|
|
47
57
|
`);
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (jscodeshiftProcess.error) {
|
|
52
|
-
throw jscodeshiftProcess.error;
|
|
58
|
+
const result = await (0, _Runner.run)(transformerPath, files, options);
|
|
59
|
+
if (result.error > 0) {
|
|
60
|
+
process.exit(1);
|
|
53
61
|
}
|
|
54
62
|
}
|
|
55
63
|
function run(argv) {
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-codemod",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.2",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "Codemod scripts for MUI X.",
|
|
6
|
-
"bin": "./codemod.js",
|
|
7
6
|
"keywords": [
|
|
8
7
|
"react",
|
|
9
8
|
"react-component",
|
|
@@ -29,7 +28,7 @@
|
|
|
29
28
|
"@babel/traverse": "^7.29.0",
|
|
30
29
|
"jscodeshift": "17.3.0",
|
|
31
30
|
"yargs": "^18.0.0",
|
|
32
|
-
"@mui/x-internals": "9.0.0-alpha.
|
|
31
|
+
"@mui/x-internals": "9.0.0-alpha.2"
|
|
33
32
|
},
|
|
34
33
|
"sideEffects": false,
|
|
35
34
|
"publishConfig": {
|
|
@@ -41,5 +40,6 @@
|
|
|
41
40
|
"type": "commonjs",
|
|
42
41
|
"exports": {
|
|
43
42
|
"./package.json": "./package.json"
|
|
44
|
-
}
|
|
43
|
+
},
|
|
44
|
+
"bin": "./codemod.js"
|
|
45
45
|
}
|
package/util/renameImports.js
CHANGED
|
@@ -23,7 +23,7 @@ const getMatchingNestedImport = (path, parameters) => {
|
|
|
23
23
|
};
|
|
24
24
|
const getMatchingRootImport = (path, parameters) => {
|
|
25
25
|
return parameters.imports.find(importConfig => {
|
|
26
|
-
return importConfig.importsMapping.hasOwnProperty(path.node.imported.name);
|
|
26
|
+
return importConfig.importsMapping.hasOwnProperty(path.node.imported.name.toString());
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
|
|
@@ -29,7 +29,7 @@ function transformer(file, api, options) {
|
|
|
29
29
|
// Rename the import specifiers
|
|
30
30
|
// - import { GridFilterMenuItem } from '@mui/x-data-grid'
|
|
31
31
|
// + import { GridColumnMenuFilterItem } from '@mui/x-data-grid'
|
|
32
|
-
matchingImports.find(j.ImportSpecifier).filter(path => VARIABLES.hasOwnProperty(path.node.imported.name)).replaceWith(path => j.importSpecifier(j.identifier(VARIABLES[path.node.imported.name])));
|
|
32
|
+
matchingImports.find(j.ImportSpecifier).filter(path => VARIABLES.hasOwnProperty(path.node.imported.name.toString())).replaceWith(path => j.importSpecifier(j.identifier(VARIABLES[path.node.imported.name.toString()])));
|
|
33
33
|
|
|
34
34
|
// Rename the import usage
|
|
35
35
|
// - <GridFilterMenuItem />
|
|
@@ -124,7 +124,7 @@ function transformer(file, api, options) {
|
|
|
124
124
|
// Rename the import specifiers
|
|
125
125
|
// - import { DayCalendarSlotsComponent } from '@mui/x-date-pickers'
|
|
126
126
|
// + import { DayCalendarSlots } from '@mui/x-date-pickers'
|
|
127
|
-
matchingImports.find(j.ImportSpecifier).filter(path => Object.keys(rename).includes(path.node.imported.name)).replaceWith(path => j.importSpecifier(j.identifier(rename[path.node.imported.name]), path.value.local));
|
|
127
|
+
matchingImports.find(j.ImportSpecifier).filter(path => Object.keys(rename).includes(path.node.imported.name.toString())).replaceWith(path => j.importSpecifier(j.identifier(rename[path.node.imported.name.toString()]), path.value.local));
|
|
128
128
|
|
|
129
129
|
// Rename the import usage
|
|
130
130
|
// - DayCalendarSlotsComponent
|
|
@@ -19,7 +19,7 @@ function transformer(file, api, options) {
|
|
|
19
19
|
return typeof node.source.value === 'string' && node.source.value.startsWith('@mui/x-charts');
|
|
20
20
|
}).forEach(path => {
|
|
21
21
|
path.node.specifiers?.forEach(node => {
|
|
22
|
-
root.findJSXElements(node.local?.name).forEach(elementPath => {
|
|
22
|
+
root.findJSXElements(node.local?.name.toString()).forEach(elementPath => {
|
|
23
23
|
if (elementPath.node.type !== 'JSXElement') {
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
@@ -19,7 +19,7 @@ function transformer(file, api, options) {
|
|
|
19
19
|
return typeof node.source.value === 'string' && node.source.value.startsWith('@mui/x-charts');
|
|
20
20
|
}).forEach(path => {
|
|
21
21
|
path.node.specifiers?.forEach(node => {
|
|
22
|
-
root.findJSXElements(node.local?.name).forEach(elementPath => {
|
|
22
|
+
root.findJSXElements(node.local?.name.toString()).forEach(elementPath => {
|
|
23
23
|
if (elementPath.node.type !== 'JSXElement') {
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
@@ -19,7 +19,7 @@ function transformer(file, api, options) {
|
|
|
19
19
|
return typeof node.source.value === 'string' && node.source.value.startsWith('@mui/x-charts');
|
|
20
20
|
}).forEach(path => {
|
|
21
21
|
path.node.specifiers?.forEach(node => {
|
|
22
|
-
root.findJSXElements(node.local?.name).forEach(elementPath => {
|
|
22
|
+
root.findJSXElements(node.local?.name.toString()).forEach(elementPath => {
|
|
23
23
|
if (elementPath.node.type !== 'JSXElement') {
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
@@ -18,7 +18,7 @@ function transformer(file, api, options) {
|
|
|
18
18
|
return typeof node.source.value === 'string' && node.source.value.startsWith('@mui/x-charts');
|
|
19
19
|
}).forEach(path => {
|
|
20
20
|
path.node.specifiers?.forEach(node => {
|
|
21
|
-
root.findJSXElements(node.local?.name).forEach(elementPath => {
|
|
21
|
+
root.findJSXElements(node.local?.name.toString()).forEach(elementPath => {
|
|
22
22
|
if (elementPath.node.type !== 'JSXElement') {
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
@@ -19,7 +19,7 @@ function transformer(file, api, options) {
|
|
|
19
19
|
return typeof node.source.value === 'string' && node.source.value.startsWith('@mui/x-charts');
|
|
20
20
|
}).forEach(path => {
|
|
21
21
|
path.node.specifiers?.forEach(node => {
|
|
22
|
-
root.findJSXElements(node.local?.name).forEach(elementPath => {
|
|
22
|
+
root.findJSXElements(node.local?.name.toString()).forEach(elementPath => {
|
|
23
23
|
if (elementPath.node.type !== 'JSXElement') {
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
@@ -16,9 +16,9 @@ function transformer(file, api, options) {
|
|
|
16
16
|
// Find relevant DataGrid imports
|
|
17
17
|
const importedDataGrids = new Set();
|
|
18
18
|
root.find(j.ImportDeclaration).forEach(path => {
|
|
19
|
-
if (dataGridSources.has(path.node.source.value)) {
|
|
19
|
+
if (dataGridSources.has(path.node.source.value?.toString() ?? '')) {
|
|
20
20
|
path.node.specifiers?.forEach(specifier => {
|
|
21
|
-
if (specifier.type === 'ImportSpecifier' && dataGridComponents.has(specifier.imported.name)) {
|
|
21
|
+
if (specifier.type === 'ImportSpecifier' && dataGridComponents.has(specifier.imported.name.toString())) {
|
|
22
22
|
const localName = specifier.local?.name;
|
|
23
23
|
if (localName) {
|
|
24
24
|
importedDataGrids.add(localName);
|
|
@@ -8,10 +8,15 @@ exports.default = transformer;
|
|
|
8
8
|
exports.testConfig = void 0;
|
|
9
9
|
var renameIdToSeriesId = _interopRequireWildcard(require("../rename-id-to-series-id"));
|
|
10
10
|
var renameChartApiImport = _interopRequireWildcard(require("../rename-chart-api-import"));
|
|
11
|
+
var renameChartContainer = _interopRequireWildcard(require("../rename-chart-container"));
|
|
12
|
+
var renameChartDataProvider = _interopRequireWildcard(require("../rename-chart-data-provider"));
|
|
13
|
+
var renameChartZoomSlider = _interopRequireWildcard(require("../rename-chart-zoom-slider"));
|
|
11
14
|
var replaceHeatmapHideLegend = _interopRequireWildcard(require("../replace-heatmap-hide-legend-false"));
|
|
15
|
+
var renameSankeyChart = _interopRequireWildcard(require("../rename-sankey-chart"));
|
|
16
|
+
var replaceShowMarkDefault = _interopRequireWildcard(require("../replace-show-mark-default"));
|
|
12
17
|
const allModules = [
|
|
13
18
|
// Add other transforms here as they are created
|
|
14
|
-
replaceHeatmapHideLegend, renameIdToSeriesId, renameChartApiImport];
|
|
19
|
+
replaceHeatmapHideLegend, replaceShowMarkDefault, renameIdToSeriesId, renameChartApiImport, renameSankeyChart, renameChartContainer, renameChartDataProvider, renameChartZoomSlider];
|
|
15
20
|
function transformer(file, api, options) {
|
|
16
21
|
allModules.forEach(module => {
|
|
17
22
|
file.source = module.default(file, api, options);
|
|
@@ -27,6 +27,13 @@ function transformer(file, api, options) {
|
|
|
27
27
|
ChartApi: 'ChartApi'
|
|
28
28
|
},
|
|
29
29
|
splitUnmatchedSpecifiers: true
|
|
30
|
+
}, {
|
|
31
|
+
oldEndpoint: 'ChartsContainer',
|
|
32
|
+
newEndpoint: 'context',
|
|
33
|
+
importsMapping: {
|
|
34
|
+
ChartApi: 'ChartApi'
|
|
35
|
+
},
|
|
36
|
+
splitUnmatchedSpecifiers: true
|
|
30
37
|
}]
|
|
31
38
|
});
|
|
32
39
|
return root.toSource(printOptions);
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
exports.testConfig = void 0;
|
|
9
|
+
var _path = _interopRequireDefault(require("path"));
|
|
10
|
+
var _readFile = _interopRequireDefault(require("../../../util/readFile"));
|
|
11
|
+
var _renameImports = require("../../../util/renameImports");
|
|
12
|
+
function transformer(file, api, options) {
|
|
13
|
+
const j = api.jscodeshift;
|
|
14
|
+
const root = j(file.source);
|
|
15
|
+
const printOptions = options.printOptions || {
|
|
16
|
+
quote: 'single',
|
|
17
|
+
trailingComma: true
|
|
18
|
+
};
|
|
19
|
+
(0, _renameImports.renameImports)({
|
|
20
|
+
j,
|
|
21
|
+
root,
|
|
22
|
+
packageNames: ['@mui/x-charts', '@mui/x-charts-pro', '@mui/x-charts-premium'],
|
|
23
|
+
imports: [
|
|
24
|
+
// ChartContainer → ChartsContainer
|
|
25
|
+
{
|
|
26
|
+
oldEndpoint: 'ChartContainer',
|
|
27
|
+
newEndpoint: 'ChartsContainer',
|
|
28
|
+
importsMapping: {
|
|
29
|
+
ChartContainer: 'ChartsContainer',
|
|
30
|
+
ChartContainerProps: 'ChartsContainerProps',
|
|
31
|
+
ChartContainerSlots: 'ChartsContainerSlots',
|
|
32
|
+
ChartContainerSlotProps: 'ChartsContainerSlotProps'
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
// ChartContainerPro → ChartsContainerPro
|
|
36
|
+
{
|
|
37
|
+
oldEndpoint: 'ChartContainerPro',
|
|
38
|
+
newEndpoint: 'ChartsContainerPro',
|
|
39
|
+
importsMapping: {
|
|
40
|
+
ChartContainerPro: 'ChartsContainerPro',
|
|
41
|
+
ChartContainerProProps: 'ChartsContainerProProps',
|
|
42
|
+
ChartContainerProSlots: 'ChartsContainerProSlots',
|
|
43
|
+
ChartContainerProSlotProps: 'ChartsContainerProSlotProps'
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
// ChartContainerPremium → ChartsContainerPremium
|
|
47
|
+
{
|
|
48
|
+
oldEndpoint: 'ChartContainerPremium',
|
|
49
|
+
newEndpoint: 'ChartsContainerPremium',
|
|
50
|
+
importsMapping: {
|
|
51
|
+
ChartContainerPremium: 'ChartsContainerPremium',
|
|
52
|
+
ChartContainerPremiumProps: 'ChartsContainerPremiumProps',
|
|
53
|
+
ChartContainerPremiumSlots: 'ChartsContainerPremiumSlots',
|
|
54
|
+
ChartContainerPremiumSlotProps: 'ChartsContainerPremiumSlotProps'
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
// Hooks from internals
|
|
58
|
+
{
|
|
59
|
+
oldEndpoint: 'internals',
|
|
60
|
+
importsMapping: {
|
|
61
|
+
useChartContainerProps: 'useChartsContainerProps',
|
|
62
|
+
UseChartContainerPropsReturnValue: 'UseChartsContainerPropsReturnValue',
|
|
63
|
+
useChartContainerProProps: 'useChartsContainerProProps',
|
|
64
|
+
UseChartContainerProPropsReturnValue: 'UseChartsContainerProPropsReturnValue'
|
|
65
|
+
}
|
|
66
|
+
}]
|
|
67
|
+
});
|
|
68
|
+
return root.toSource(printOptions);
|
|
69
|
+
}
|
|
70
|
+
const testConfig = () => ({
|
|
71
|
+
name: 'rename-chart-container',
|
|
72
|
+
specFiles: [{
|
|
73
|
+
name: 'imports',
|
|
74
|
+
actual: (0, _readFile.default)(_path.default.join(__dirname, 'actual-imports.spec.tsx')),
|
|
75
|
+
expected: (0, _readFile.default)(_path.default.join(__dirname, 'expected-imports.spec.tsx'))
|
|
76
|
+
}]
|
|
77
|
+
});
|
|
78
|
+
exports.testConfig = testConfig;
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
exports.testConfig = void 0;
|
|
9
|
+
var _path = _interopRequireDefault(require("path"));
|
|
10
|
+
var _readFile = _interopRequireDefault(require("../../../util/readFile"));
|
|
11
|
+
var _renameImports = require("../../../util/renameImports");
|
|
12
|
+
function transformer(file, api, options) {
|
|
13
|
+
const j = api.jscodeshift;
|
|
14
|
+
const root = j(file.source);
|
|
15
|
+
const printOptions = options.printOptions || {
|
|
16
|
+
quote: 'single',
|
|
17
|
+
trailingComma: true
|
|
18
|
+
};
|
|
19
|
+
(0, _renameImports.renameImports)({
|
|
20
|
+
j,
|
|
21
|
+
root,
|
|
22
|
+
packageNames: ['@mui/x-charts', '@mui/x-charts-pro', '@mui/x-charts-premium'],
|
|
23
|
+
imports: [{
|
|
24
|
+
oldEndpoint: 'ChartDataProvider',
|
|
25
|
+
newEndpoint: 'ChartsDataProvider',
|
|
26
|
+
importsMapping: {
|
|
27
|
+
ChartDataProvider: 'ChartsDataProvider',
|
|
28
|
+
ChartDataProviderProps: 'ChartsDataProviderProps',
|
|
29
|
+
ChartDataProviderSlots: 'ChartsDataProviderSlots',
|
|
30
|
+
ChartDataProviderSlotProps: 'ChartsDataProviderSlotProps'
|
|
31
|
+
}
|
|
32
|
+
}]
|
|
33
|
+
});
|
|
34
|
+
(0, _renameImports.renameImports)({
|
|
35
|
+
j,
|
|
36
|
+
root,
|
|
37
|
+
packageNames: ['@mui/x-charts-pro', '@mui/x-charts-premium'],
|
|
38
|
+
imports: [{
|
|
39
|
+
oldEndpoint: 'ChartDataProviderPro',
|
|
40
|
+
newEndpoint: 'ChartsDataProviderPro',
|
|
41
|
+
importsMapping: {
|
|
42
|
+
ChartDataProviderPro: 'ChartsDataProviderPro',
|
|
43
|
+
ChartDataProviderProProps: 'ChartsDataProviderProProps',
|
|
44
|
+
ChartDataProviderProSlots: 'ChartsDataProviderProSlots',
|
|
45
|
+
ChartDataProviderProSlotProps: 'ChartsDataProviderProSlotProps'
|
|
46
|
+
}
|
|
47
|
+
}]
|
|
48
|
+
});
|
|
49
|
+
(0, _renameImports.renameImports)({
|
|
50
|
+
j,
|
|
51
|
+
root,
|
|
52
|
+
packageNames: ['@mui/x-charts-premium'],
|
|
53
|
+
imports: [{
|
|
54
|
+
oldEndpoint: 'ChartDataProviderPremium',
|
|
55
|
+
newEndpoint: 'ChartsDataProviderPremium',
|
|
56
|
+
importsMapping: {
|
|
57
|
+
ChartDataProviderPremium: 'ChartsDataProviderPremium',
|
|
58
|
+
ChartDataProviderPremiumProps: 'ChartsDataProviderPremiumProps',
|
|
59
|
+
ChartDataProviderPremiumSlots: 'ChartsDataProviderPremiumSlots',
|
|
60
|
+
ChartDataProviderPremiumSlotProps: 'ChartsDataProviderPremiumSlotProps'
|
|
61
|
+
}
|
|
62
|
+
}]
|
|
63
|
+
});
|
|
64
|
+
return root.toSource(printOptions);
|
|
65
|
+
}
|
|
66
|
+
const testConfig = () => ({
|
|
67
|
+
name: 'rename-chart-data-provider',
|
|
68
|
+
specFiles: [{
|
|
69
|
+
name: 'nested-imports',
|
|
70
|
+
actual: (0, _readFile.default)(_path.default.join(__dirname, 'actual-nested-imports.spec.tsx')),
|
|
71
|
+
expected: (0, _readFile.default)(_path.default.join(__dirname, 'expected-nested-imports.spec.tsx'))
|
|
72
|
+
}, {
|
|
73
|
+
name: 'root-imports',
|
|
74
|
+
actual: (0, _readFile.default)(_path.default.join(__dirname, 'actual-root-imports.spec.tsx')),
|
|
75
|
+
expected: (0, _readFile.default)(_path.default.join(__dirname, 'expected-root-imports.spec.tsx'))
|
|
76
|
+
}]
|
|
77
|
+
});
|
|
78
|
+
exports.testConfig = testConfig;
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
exports.testConfig = void 0;
|
|
9
|
+
var _path = _interopRequireDefault(require("path"));
|
|
10
|
+
var _readFile = _interopRequireDefault(require("../../../util/readFile"));
|
|
11
|
+
var _renameImports = require("../../../util/renameImports");
|
|
12
|
+
function transformer(file, api, options) {
|
|
13
|
+
const j = api.jscodeshift;
|
|
14
|
+
const root = j(file.source);
|
|
15
|
+
const printOptions = options.printOptions || {
|
|
16
|
+
quote: 'single',
|
|
17
|
+
trailingComma: true
|
|
18
|
+
};
|
|
19
|
+
(0, _renameImports.renameImports)({
|
|
20
|
+
j,
|
|
21
|
+
root,
|
|
22
|
+
packageNames: ['@mui/x-charts-pro', '@mui/x-charts-premium'],
|
|
23
|
+
imports: [
|
|
24
|
+
// ChartZoomSlider → ChartsZoomSlider
|
|
25
|
+
{
|
|
26
|
+
oldEndpoint: 'ChartZoomSlider',
|
|
27
|
+
newEndpoint: 'ChartsZoomSlider',
|
|
28
|
+
importsMapping: {
|
|
29
|
+
ChartZoomSlider: 'ChartsZoomSlider',
|
|
30
|
+
ChartAxisZoomSliderThumbClasses: 'ChartsAxisZoomSliderThumbClasses',
|
|
31
|
+
ChartAxisZoomSliderThumbClassKey: 'ChartsAxisZoomSliderThumbClassKey',
|
|
32
|
+
chartAxisZoomSliderThumbClasses: 'chartsAxisZoomSliderThumbClasses',
|
|
33
|
+
ChartAxisZoomSliderTrackClasses: 'ChartsAxisZoomSliderTrackClasses',
|
|
34
|
+
ChartAxisZoomSliderTrackClassKey: 'ChartsAxisZoomSliderTrackClassKey',
|
|
35
|
+
chartAxisZoomSliderTrackClasses: 'chartsAxisZoomSliderTrackClasses'
|
|
36
|
+
}
|
|
37
|
+
}]
|
|
38
|
+
});
|
|
39
|
+
return root.toSource(printOptions);
|
|
40
|
+
}
|
|
41
|
+
const testConfig = () => ({
|
|
42
|
+
name: 'rename-chart-zoom-slider',
|
|
43
|
+
specFiles: [{
|
|
44
|
+
name: 'imports',
|
|
45
|
+
actual: (0, _readFile.default)(_path.default.join(__dirname, 'actual-imports.spec.tsx')),
|
|
46
|
+
expected: (0, _readFile.default)(_path.default.join(__dirname, 'expected-imports.spec.tsx'))
|
|
47
|
+
}]
|
|
48
|
+
});
|
|
49
|
+
exports.testConfig = testConfig;
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
exports.testConfig = void 0;
|
|
9
|
+
var _path = _interopRequireDefault(require("path"));
|
|
10
|
+
var _readFile = _interopRequireDefault(require("../../../util/readFile"));
|
|
11
|
+
var _renameImports = require("../../../util/renameImports");
|
|
12
|
+
function transformer(file, api, options) {
|
|
13
|
+
const j = api.jscodeshift;
|
|
14
|
+
const root = j(file.source);
|
|
15
|
+
const printOptions = options.printOptions || {
|
|
16
|
+
quote: 'single',
|
|
17
|
+
trailingComma: true
|
|
18
|
+
};
|
|
19
|
+
(0, _renameImports.renameImports)({
|
|
20
|
+
j,
|
|
21
|
+
root,
|
|
22
|
+
packageNames: ['@mui/x-charts-pro', '@mui/x-charts-premium'],
|
|
23
|
+
imports: [{
|
|
24
|
+
oldEndpoint: 'SankeyChart',
|
|
25
|
+
importsMapping: {
|
|
26
|
+
Unstable_SankeyChart: 'SankeyChart'
|
|
27
|
+
}
|
|
28
|
+
}]
|
|
29
|
+
});
|
|
30
|
+
return root.toSource(printOptions);
|
|
31
|
+
}
|
|
32
|
+
const testConfig = () => ({
|
|
33
|
+
name: 'rename-sankey-chart',
|
|
34
|
+
specFiles: [{
|
|
35
|
+
name: 'imports',
|
|
36
|
+
actual: (0, _readFile.default)(_path.default.join(__dirname, 'actual-imports.spec.tsx')),
|
|
37
|
+
expected: (0, _readFile.default)(_path.default.join(__dirname, 'expected-imports.spec.tsx'))
|
|
38
|
+
}]
|
|
39
|
+
});
|
|
40
|
+
exports.testConfig = testConfig;
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
exports.testConfig = void 0;
|
|
9
|
+
var _path = _interopRequireDefault(require("path"));
|
|
10
|
+
var _readFile = _interopRequireDefault(require("../../../util/readFile"));
|
|
11
|
+
const COMPONENT_NAMES = ['LineChart', 'LineChartPro', 'LineChartPremium'];
|
|
12
|
+
const PROVIDER_NAMES = ['ChartDataProvider', 'ChartDataProviderPro', 'ChartDataProviderPremium',
|
|
13
|
+
// With the new naming to be sure codemod order does not matter
|
|
14
|
+
'ChartsDataProvider', 'ChartsDataProviderPro', 'ChartsDataProviderPremium',
|
|
15
|
+
// The component that includes the data provider.
|
|
16
|
+
'ChartsContainer', 'ChartsContainerPro', 'ChartsContainerPremium',
|
|
17
|
+
// Old naming to be sure codemod order does not matter
|
|
18
|
+
'ChartContainer', 'ChartContainerPro', 'ChartContainerPremium'];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Codemod for v9.0.0: Updates line series objects to preserve v8 behavior after the `showMark` default changes from true to false.
|
|
22
|
+
*
|
|
23
|
+
* If `showMark` is not defined, adds `showMark: true` to preserve v8 behavior.
|
|
24
|
+
*
|
|
25
|
+
* The `showMark: false` cases are left unchanged to stay idempotent.
|
|
26
|
+
*
|
|
27
|
+
* This codemod applies on LineChart components and providers when series type is set to 'line'.
|
|
28
|
+
*/
|
|
29
|
+
function transformer(file, api, options) {
|
|
30
|
+
const j = api.jscodeshift;
|
|
31
|
+
const root = j(file.source);
|
|
32
|
+
const printOptions = options.printOptions || {
|
|
33
|
+
quote: 'single',
|
|
34
|
+
trailingComma: true
|
|
35
|
+
};
|
|
36
|
+
root.find(j.JSXElement).filter(p => COMPONENT_NAMES.includes(p.value.openingElement.name.name)).forEach(p => {
|
|
37
|
+
const seriesAttr = p.value.openingElement.attributes?.find(attr => attr.type === 'JSXAttribute' && attr.name.name === 'series');
|
|
38
|
+
if (!seriesAttr || seriesAttr.type !== 'JSXAttribute') {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const seriesValue = seriesAttr.value;
|
|
42
|
+
if (!seriesValue || seriesValue.type !== 'JSXExpressionContainer') {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const expr = seriesValue.expression;
|
|
46
|
+
if (expr.type !== 'ArrayExpression') {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
expr.elements.forEach(element => {
|
|
50
|
+
if (!element || element.type !== 'ObjectExpression') {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const hasShowMark = element.properties.some(prop => prop.type === 'ObjectProperty' && prop.key.type === 'Identifier' && prop.key.name === 'showMark');
|
|
54
|
+
if (!hasShowMark) {
|
|
55
|
+
element.properties.push(j.objectProperty(j.identifier('showMark'), j.booleanLiteral(true)));
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
root.find(j.JSXElement).filter(p => PROVIDER_NAMES.includes(p.value.openingElement.name.name)).forEach(p => {
|
|
60
|
+
const seriesAttr = p.value.openingElement.attributes?.find(attr => attr.type === 'JSXAttribute' && attr.name.name === 'series');
|
|
61
|
+
if (!seriesAttr || seriesAttr.type !== 'JSXAttribute') {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const seriesValue = seriesAttr.value;
|
|
65
|
+
if (!seriesValue || seriesValue.type !== 'JSXExpressionContainer') {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const expr = seriesValue.expression;
|
|
69
|
+
if (expr.type !== 'ArrayExpression') {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
expr.elements.forEach(element => {
|
|
73
|
+
if (!element || element.type !== 'ObjectExpression') {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const lineSeriesType = element.properties.some(prop => prop.type === 'ObjectProperty' && prop.key.type === 'Identifier' && prop.key.name === 'type' && prop.value.type === 'StringLiteral' && prop.value.value === 'line');
|
|
77
|
+
const hasShowMark = element.properties.some(prop => prop.type === 'ObjectProperty' && prop.key.type === 'Identifier' && prop.key.name === 'showMark');
|
|
78
|
+
if (lineSeriesType && !hasShowMark) {
|
|
79
|
+
element.properties.push(j.objectProperty(j.identifier('showMark'), j.booleanLiteral(true)));
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
return root.toSource(printOptions);
|
|
84
|
+
}
|
|
85
|
+
const testConfig = () => ({
|
|
86
|
+
name: 'replace-show-mark-default',
|
|
87
|
+
specFiles: [{
|
|
88
|
+
name: 'imports',
|
|
89
|
+
actual: (0, _readFile.default)(_path.default.join(__dirname, 'actual.spec.tsx')),
|
|
90
|
+
expected: (0, _readFile.default)(_path.default.join(__dirname, 'expected.spec.tsx'))
|
|
91
|
+
}]
|
|
92
|
+
});
|
|
93
|
+
exports.testConfig = testConfig;
|