@mui/x-codemod 9.0.0-alpha.3 → 9.0.0-alpha.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/CHANGELOG.md CHANGED
@@ -1,5 +1,128 @@
1
1
  # Changelog
2
2
 
3
+ ## 9.0.0-alpha.4
4
+
5
+ _Mar 19, 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
+ - 🐞 Bugfixes and internal improvements
10
+
11
+ The following team members contributed to this release:
12
+ @aemartos, @alexfauquette, @bernardobelchior, @Janpot, @JCQuintas, @LukasTy, @mapache-salvaje, @michelengelen, @noraleonte, @rita-codes, @sai6855, @siriwatknp
13
+
14
+ ### Data Grid
15
+
16
+ #### `@mui/x-data-grid@9.0.0-alpha.4`
17
+
18
+ - [DataGrid] Mark charts integration as stable (#21764) @JCQuintas
19
+ - [DataGrid] Move `elementOverrides` to constants and remove duplicates (#21618) @sai6855
20
+ - [DataGrid] Migrate from deprecated Material UI APIs (#21682) @siriwatknp
21
+
22
+ #### `@mui/x-data-grid-pro@9.0.0-alpha.4` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
23
+
24
+ Same changes as in `@mui/x-data-grid@9.0.0-alpha.4`.
25
+
26
+ #### `@mui/x-data-grid-premium@9.0.0-alpha.4` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
27
+
28
+ Same changes as in `@mui/x-data-grid-pro@9.0.0-alpha.4`.
29
+
30
+ ### Date and Time Pickers
31
+
32
+ #### `@mui/x-date-pickers@9.0.0-alpha.4`
33
+
34
+ - [pickers] Avoid stealing focus on click away (#13434) @LukasTy
35
+ - [pickers] Promote `fieldRef` to stable and add `clearValue` method (#21655) @michelengelen
36
+
37
+ #### `@mui/x-date-pickers-pro@9.0.0-alpha.4` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
38
+
39
+ Same changes as in `@mui/x-date-pickers@9.0.0-alpha.4`.
40
+
41
+ ### Charts
42
+
43
+ #### `@mui/x-charts@9.0.0-alpha.4`
44
+
45
+ - [charts] Add v9 chart series types and helper functions migration (#21009) @bernardobelchior
46
+ - [charts] Extract event listener to the layer container (#21751) @alexfauquette
47
+ - [charts] Fix WebGL print export canvas stretching (#21738) @JCQuintas
48
+ - [charts] Improve deprecation warnings (#21760) @alexfauquette
49
+ - [charts] Improve type safety in `identifierCleaner` (#21719) @bernardobelchior
50
+ - [charts] Make `preferStrictDomainInLineCharts` the default (#21744) @JCQuintas
51
+ - [charts] Move title and description to the layer container (#21757) @alexfauquette
52
+ - [charts] Refactor `FunnelChart` classes structure (#21652) @JCQuintas
53
+ - [charts] Refactor `Heatmap` classes structure (#21653) @JCQuintas
54
+ - [charts] Refactor `RadarChart` classes structure (#21650) @JCQuintas
55
+ - [charts] Refactor `SankeyChart` classes structure (#21654) @JCQuintas
56
+ - [charts] Refactor legend getters to use utility functions (#21628) @sai6855
57
+ - [charts] Remove deprecated `ChartContainer` and `ChartDataProvider` (#21777) @alexfauquette
58
+ - [charts] Remove deprecated `itemId` from `SeriesLegendItemContext` (#21788) @alexfauquette
59
+ - [charts] Remove deprecated `useMouseTracker()` (#21787) @alexfauquette
60
+ - [charts] Remove deprecated classes (#21775) @alexfauquette
61
+ - [charts] Remove deprecated props from PieArcLabel animation (#21789) @alexfauquette
62
+ - [charts] Remove get*UtilityClass from public exports (#21769) @JCQuintas
63
+ - [charts] Remove the deprecated `disableHover` property (#21785) @alexfauquette
64
+ - [charts] Remove the deprecated `message` prop (#21784) @alexfauquette
65
+ - [charts] Remove deprecated props about voronoi (#21796) @alexfauquette
66
+ - [charts] Remove deprecated pieArcClasses (#21795) @alexfauquette
67
+ - [charts] Rename `data-series-id` by `data-series` (#21761) @alexfauquette
68
+ - [charts] Rename `voronoiMaxRadius`/`disableVoronoi` to `hitAreaRadius`/`disableHitArea` (#21750) @bernardobelchior
69
+ - [charts] Update pt-PT locale (#21296) @bernardobelchior
70
+ - [charts] Use different shape per series by default (#21713) @alexfauquette
71
+ - [charts] Add className prop to Radar components (#21794) @JCQuintas
72
+ - [charts] Add className prop to shared chart components (#21792) @JCQuintas
73
+ - [charts] Add className prop to BarPlot (#21791) @JCQuintas
74
+ - [charts] Portal tooltip into ChartsLayerContainer (#21801) @JCQuintas
75
+
76
+ #### `@mui/x-charts-pro@9.0.0-alpha.4` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
77
+
78
+ Same changes as in `@mui/x-charts@9.0.0-alpha.4`, plus:
79
+
80
+ - [charts-pro] Allow `brush` interaction to accept `requiredKeys/pointerMode` (#21716) @JCQuintas
81
+ - [charts-pro] Remove deprecated `onAxisClick` for Heatmap (#21786) @alexfauquette
82
+
83
+ #### `@mui/x-charts-premium@9.0.0-alpha.4` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
84
+
85
+ Same changes as in `@mui/x-charts-pro@9.0.0-alpha.4`, plus:
86
+
87
+ - [charts-premium] Add candlestick chart (#21129) @bernardobelchior
88
+
89
+ ### Tree View
90
+
91
+ #### `@mui/x-tree-view@9.0.0-alpha.4`
92
+
93
+ Internal changes.
94
+
95
+ #### `@mui/x-tree-view-pro@9.0.0-alpha.4` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
96
+
97
+ Same changes as in `@mui/x-tree-view@9.0.0-alpha.4`.
98
+
99
+ ### Codemod
100
+
101
+ #### `@mui/x-codemod@9.0.0-alpha.4`
102
+
103
+ Internal changes.
104
+
105
+ ### Docs
106
+
107
+ - [docs-infra] Exclude `ServerSideLazyLoadingRevalidation` from argos (#21734) @sai6855
108
+ - [docs] Update charts v9 migration guide to include premium package (#21743) @bernardobelchior
109
+ - [docs] Update v9 migration guides to install next tag (#21741) @bernardobelchior
110
+ - [docs] Revise the Pie chart docs (#21565) @mapache-salvaje
111
+ - [docs] Revise the Bar Chart docs (#21482) @mapache-salvaje
112
+ - [docs] Removed a `console.log` from an aggregation demo (#21698) @michelengelen
113
+
114
+ ### Core
115
+
116
+ - [code-infra] Add pkg-pr-new as dev dependency (#21754) @Janpot
117
+ - [code-infra] Prevent `combiner` to have default parameters (#21707) @JCQuintas
118
+ - [code-infra] Remove CI coverage collection and upload to Codecov (#21671) @Janpot
119
+ - [internal] Remove @bernardobelchior from Charts CODEOWNERS (#21776) @Copilot
120
+
121
+ ### Miscellaneous
122
+
123
+ - [x-license] Fix process.env.MUI_VERSION not being replaced during build (#21727) @aemartos
124
+ - [x-license] Add new watermark license status message (#21720) @aemartos
125
+
3
126
  ## 9.0.0-alpha.3
4
127
 
5
128
  _Mar 12, 2026_
package/README.md CHANGED
@@ -80,6 +80,26 @@ The corresponding sub-sections are listed below
80
80
 
81
81
  - [`preset-safe-for-charts`](#preset-safe-for-charts-v900)
82
82
 
83
+ ### Data Grid codemods
84
+
85
+ #### `remove-stabilized-experimentalFeatures`
86
+
87
+ Removes the `charts` property from the `experimentalFeatures` prop of `DataGridPremium`.
88
+ If `charts` is the only property, the entire `experimentalFeatures` prop is removed.
89
+
90
+ <!-- #npm-tag-reference -->
91
+
92
+ ```bash
93
+ npx @mui/x-codemod@next v9.0.0/data-grid/remove-stabilized-experimentalFeatures <path|folder>
94
+ ```
95
+
96
+ ```diff
97
+ <DataGridPremium
98
+ - experimentalFeatures={{ charts: true }}
99
+ chartsIntegration
100
+ />
101
+ ```
102
+
83
103
  ### Charts codemods
84
104
 
85
105
  #### 🚀 `preset-safe` for Charts v9.0.0
@@ -103,6 +123,9 @@ The list includes these transformers
103
123
  - [`rename-chart-data-provider`](#rename-chart-data-provider)
104
124
  - [`rename-chart-zoom-slider`](#rename-chart-zoom-slider)
105
125
  - [`remove-enable-keyboard-navigation`](#remove-enable-keyboard-navigation)
126
+ - [`remove-stabilized-experimentalFeatures`](#remove-stabilized-experimentalfeatures)
127
+ - [`remove-deprecated-series-types`](#remove-deprecated-series-types)
128
+ - [`remove-is-bar-series-helpers`](#remove-is-bar-series-helpers)
106
129
 
107
130
  #### `replace-heatmap-hide-legend-false`
108
131
 
@@ -240,6 +263,54 @@ Removes the `enableKeyboardNavigation` props set to `true` since it's now the de
240
263
  />
241
264
  ```
242
265
 
266
+ #### `remove-stabilized-experimentalFeatures`
267
+
268
+ Removes the `preferStrictDomainInLineCharts` property from the `experimentalFeatures` prop since it's now the default behavior.
269
+ If `preferStrictDomainInLineCharts` is the only property in the object, the entire `experimentalFeatures` prop is removed.
270
+
271
+ ```diff
272
+ <LineChart
273
+ - experimentalFeatures={{ preferStrictDomainInLineCharts: true }}
274
+ series={[]}
275
+ />
276
+ ```
277
+
278
+ #### `remove-deprecated-series-types`
279
+
280
+ Replaces deprecated series type aliases (`CartesianSeriesType`, `DefaultizedCartesianSeriesType`, `StackableSeriesType`) with their new equivalents using generic types.
281
+
282
+ ```diff
283
+ -import { CartesianSeriesType, DefaultizedCartesianSeriesType, StackableSeriesType } from '@mui/x-charts';
284
+ +import { AllSeriesType, DefaultizedSeriesType, CartesianChartSeriesType, StackableChartSeriesType } from '@mui/x-charts';
285
+
286
+ -function processCartesian(series: CartesianSeriesType) {}
287
+ +function processCartesian(series: AllSeriesType<CartesianChartSeriesType>) {}
288
+
289
+ -function processDefaultizedCartesian(series: DefaultizedCartesianSeriesType) {}
290
+ +function processDefaultizedCartesian(series: DefaultizedSeriesType<CartesianChartSeriesType>) {}
291
+
292
+ -function processStackable(series: StackableSeriesType) {}
293
+ +function processStackable(series: DefaultizedSeriesType<StackableChartSeriesType>) {}
294
+ ```
295
+
296
+ #### `remove-is-bar-series-helpers`
297
+
298
+ Replaces the deprecated `isBarSeries()` and `isDefaultizedBarSeries()` helper functions with direct `series.type === 'bar'` checks and removes the corresponding imports.
299
+
300
+ ```diff
301
+ -import { isBarSeries, isDefaultizedBarSeries } from '@mui/x-charts';
302
+ -
303
+ -if (isBarSeries(series)) {
304
+ +if (series.type === 'bar') {
305
+ console.log('bar series');
306
+ }
307
+
308
+ -if (isDefaultizedBarSeries(series)) {
309
+ +if (series.type === 'bar') {
310
+ console.log('defaultized bar series');
311
+ }
312
+ ```
313
+
243
314
  ## v8.0.0
244
315
 
245
316
  ### 🚀 `preset-safe` for v8.0.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-codemod",
3
- "version": "9.0.0-alpha.3",
3
+ "version": "9.0.0-alpha.4",
4
4
  "author": "MUI Team",
5
5
  "description": "Codemod scripts for MUI X.",
6
6
  "keywords": [
@@ -28,7 +28,7 @@
28
28
  "@babel/traverse": "^7.29.0",
29
29
  "jscodeshift": "17.3.0",
30
30
  "yargs": "^18.0.0",
31
- "@mui/x-internals": "9.0.0-alpha.2"
31
+ "@mui/x-internals": "9.0.0-alpha.4"
32
32
  },
33
33
  "sideEffects": false,
34
34
  "publishConfig": {
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.renameClasses = renameClasses;
7
+ /**
8
+ * Renames classes objects and their properties.
9
+ *
10
+ * Handles:
11
+ * - Root imports: `import { lineElementClasses } from '@mui/x-charts'`
12
+ * - Nested imports: `import { lineElementClasses } from '@mui/x-charts/LineChart'`
13
+ * - Aliases: `import { lineElementClasses as lec } from '@mui/x-charts'`
14
+ * (renames imported name but keeps alias, still renames properties on aliased usage)
15
+ * - Member expression property renaming: `lineElementClasses.root` → `lineClasses.elementRoot`
16
+ */
17
+ function renameClasses(parameters) {
18
+ const {
19
+ j,
20
+ root,
21
+ packageNames
22
+ } = parameters;
23
+ const packageRegExp = new RegExp(`^(${packageNames.join('|')})(/.*)?$`);
24
+
25
+ // Track local names → old class name, so we can rename properties on aliased usages
26
+ const localNameToOldClassName = {};
27
+ // Track non-aliased identifiers that need renaming
28
+ const renamedIdentifiersMap = {};
29
+ // Track name already added to the file
30
+ const alreadyAvailableIdentifiersMap = new Set();
31
+ const importDeclarations = root.find(j.ImportDeclaration).filter(path => {
32
+ const pathStr = path.node.source.value?.toString() ?? '';
33
+ return !!pathStr.match(packageRegExp);
34
+ });
35
+
36
+ // Rename import specifiers and collect local names for property renaming
37
+ importDeclarations.find(j.ImportSpecifier).filter(path => parameters.classes.hasOwnProperty(path.node.imported.name)).forEach(path => {
38
+ const oldName = path.node.imported.name;
39
+ const config = parameters.classes[oldName];
40
+ const localName = path.node.local?.name;
41
+ const hasAlias = localName !== oldName;
42
+
43
+ // Track the local name for property renaming
44
+ localNameToOldClassName[hasAlias ? localName : oldName] = oldName;
45
+ renamedIdentifiersMap[oldName] = config.newClassName;
46
+ if (!hasAlias && alreadyAvailableIdentifiersMap.has(config.newClassName)) {
47
+ path.prune();
48
+ return;
49
+ }
50
+ alreadyAvailableIdentifiersMap.add(config.newClassName);
51
+ if (hasAlias) {
52
+ // Keep the alias, only rename the imported name
53
+ path.replace(j.importSpecifier(j.identifier(config.newClassName), j.identifier(localName)));
54
+ } else {
55
+ path.replace(j.importSpecifier(j.identifier(config.newClassName)));
56
+ }
57
+ });
58
+
59
+ // Rename member expression properties (e.g., lineElementClasses.root → lineClasses.elementRoot)
60
+ root.find(j.MemberExpression).filter(path => {
61
+ if (path.node.object.type !== 'Identifier') {
62
+ return false;
63
+ }
64
+ const objectName = path.node.object.name;
65
+ if (!localNameToOldClassName.hasOwnProperty(objectName)) {
66
+ return false;
67
+ }
68
+ if (path.node.property.type !== 'Identifier') {
69
+ return false;
70
+ }
71
+ const oldClassName = localNameToOldClassName[objectName];
72
+ return parameters.classes[oldClassName].properties.hasOwnProperty(path.node.property.name);
73
+ }).replaceWith(path => {
74
+ const objectName = path.node.object.name;
75
+ const oldPropertyName = path.node.property.name;
76
+ const oldClassName = localNameToOldClassName[objectName];
77
+ const newPropertyName = parameters.classes[oldClassName].properties[oldPropertyName];
78
+ return j.memberExpression(path.node.object, j.identifier(newPropertyName));
79
+ });
80
+
81
+ // Rename identifier usages (non-aliased)
82
+ root.find(j.Identifier).filter(path => renamedIdentifiersMap.hasOwnProperty(path.node.name)).replaceWith(path => {
83
+ return j.identifier(renamedIdentifiersMap[path.node.name]);
84
+ });
85
+ return root;
86
+ }
@@ -15,9 +15,13 @@ var replaceHeatmapHideLegend = _interopRequireWildcard(require("../replace-heatm
15
15
  var renameSankeyChart = _interopRequireWildcard(require("../rename-sankey-chart"));
16
16
  var replaceShowMarkDefault = _interopRequireWildcard(require("../replace-show-mark-default"));
17
17
  var removeEnableKeyboardNavigation = _interopRequireWildcard(require("../remove-enable-keyboard-navigation"));
18
+ var removeStabilizedExperimentalFeatures = _interopRequireWildcard(require("../remove-stabilized-experimentalFeatures"));
19
+ var renameVoronoiMaxRadius = _interopRequireWildcard(require("../rename-voronoi-max-radius"));
20
+ var removeDeprecatedSeriesTypes = _interopRequireWildcard(require("../remove-deprecated-series-types"));
21
+ var removeIsBarSeriesHelpers = _interopRequireWildcard(require("../remove-is-bar-series-helpers"));
18
22
  const allModules = [
19
23
  // Add other transforms here as they are created
20
- replaceHeatmapHideLegend, replaceShowMarkDefault, removeEnableKeyboardNavigation, renameIdToSeriesId, renameChartApiImport, renameSankeyChart, renameChartContainer, renameChartDataProvider, renameChartZoomSlider];
24
+ replaceHeatmapHideLegend, replaceShowMarkDefault, removeEnableKeyboardNavigation, removeStabilizedExperimentalFeatures, renameIdToSeriesId, renameChartApiImport, renameSankeyChart, renameChartContainer, renameChartDataProvider, renameChartZoomSlider, renameVoronoiMaxRadius, removeDeprecatedSeriesTypes, removeIsBarSeriesHelpers];
21
25
  function transformer(file, api, options) {
22
26
  allModules.forEach(module => {
23
27
  file.source = module.default(file, api, options);
@@ -0,0 +1,206 @@
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 _nodePath = _interopRequireDefault(require("node:path"));
10
+ var _readFile = _interopRequireDefault(require("../../../util/readFile"));
11
+ // Maps from removed type to the replacement info
12
+ const REMOVED_TYPES = {
13
+ CartesianSeriesType: {
14
+ baseType: 'AllSeriesType',
15
+ genericType: 'CartesianChartSeriesType'
16
+ },
17
+ DefaultizedCartesianSeriesType: {
18
+ baseType: 'DefaultizedSeriesType',
19
+ genericType: 'CartesianChartSeriesType'
20
+ },
21
+ StackableSeriesType: {
22
+ baseType: 'DefaultizedSeriesType',
23
+ genericType: 'StackableChartSeriesType'
24
+ }
25
+ };
26
+ const REMOVED_TYPE_NAMES = Object.keys(REMOVED_TYPES);
27
+ function transformer(file, api, options) {
28
+ const j = api.jscodeshift;
29
+ const root = j(file.source);
30
+ const printOptions = options.printOptions || {
31
+ quote: 'single',
32
+ trailingComma: true,
33
+ wrapColumn: 40
34
+ };
35
+
36
+ // Track local names for removed types and the source they came from
37
+ const removedTypeLocalNames = {};
38
+ let originalImportSource = null;
39
+
40
+ // Find and remove imports of deprecated types
41
+ const packageRegex = /^@mui\/x-charts(-pro|-premium)?(\/(models|internals))?$/;
42
+ root.find(j.ImportDeclaration).forEach(astPath => {
43
+ const source = astPath.node.source.value?.toString() ?? '';
44
+ if (!packageRegex.test(source)) {
45
+ return;
46
+ }
47
+ const specifiers = astPath.node.specifiers || [];
48
+ const remainingSpecifiers = [];
49
+ specifiers.forEach(specifier => {
50
+ if (specifier.type === 'ImportSpecifier') {
51
+ const importedName = specifier.imported.name.toString();
52
+ if (REMOVED_TYPE_NAMES.includes(importedName)) {
53
+ // Track the local name used for this import
54
+ const localName = specifier.local?.name.toString() || importedName;
55
+ removedTypeLocalNames[localName] = importedName;
56
+ // Track the original import source (use the first one found)
57
+ if (!originalImportSource) {
58
+ originalImportSource = source;
59
+ }
60
+ } else {
61
+ remainingSpecifiers.push(specifier);
62
+ }
63
+ } else {
64
+ remainingSpecifiers.push(specifier);
65
+ }
66
+ });
67
+ if (remainingSpecifiers.length === 0) {
68
+ // Remove the entire import declaration if no specifiers remain
69
+ j(astPath).remove();
70
+ } else if (remainingSpecifiers.length !== specifiers.length) {
71
+ // Update the import declaration with remaining specifiers
72
+ astPath.node.specifiers = remainingSpecifiers;
73
+ }
74
+ });
75
+
76
+ // If no relevant imports were found, return the source unchanged to avoid reformatting
77
+ if (Object.keys(removedTypeLocalNames).length === 0) {
78
+ return file.source;
79
+ }
80
+
81
+ // Replace type references with the new types
82
+ // We need to add the necessary imports if they're not already present
83
+ const typesToImport = new Set();
84
+ const genericTypesToImport = new Set();
85
+ Object.entries(removedTypeLocalNames).forEach(([localName, originalName]) => {
86
+ const replacementInfo = REMOVED_TYPES[originalName];
87
+ if (!replacementInfo) {
88
+ return;
89
+ }
90
+
91
+ // Find all usages of the type as a type reference
92
+ root.find(j.TSTypeReference).forEach(astPath => {
93
+ if (astPath.node.typeName.type === 'Identifier' && astPath.node.typeName.name === localName) {
94
+ typesToImport.add(replacementInfo.baseType);
95
+ genericTypesToImport.add(replacementInfo.genericType);
96
+
97
+ // Replace with the generic type: e.g., AllSeriesType<CartesianChartSeriesType>
98
+ const newTypeReference = j.tsTypeReference(j.identifier(replacementInfo.baseType), j.tsTypeParameterInstantiation([j.tsTypeReference(j.identifier(replacementInfo.genericType))]));
99
+ j(astPath).replaceWith(newTypeReference);
100
+ }
101
+ });
102
+ });
103
+
104
+ // Helper to check if a type is already imported from a given package pattern
105
+ const isAlreadyImported = (typeName, sourcePattern) => {
106
+ return root.find(j.ImportSpecifier, {
107
+ imported: {
108
+ name: typeName
109
+ }
110
+ }).filter(specPath => {
111
+ const importDecl = specPath.parentPath.parentPath;
112
+ const source = importDecl.node.source.value?.toString() ?? '';
113
+ return sourcePattern.test(source);
114
+ }).size() > 0;
115
+ };
116
+
117
+ // Collect all types that need to be added to imports
118
+ const allTypesToAdd = new Set([...typesToImport, ...genericTypesToImport]);
119
+ const typesToAdd = Array.from(allTypesToAdd).filter(typeName => !isAlreadyImported(typeName, packageRegex));
120
+
121
+ // Determine where to add types - use original source or default to same pattern
122
+ // If original was '@mui/x-charts', add to '@mui/x-charts'
123
+ // If original was '@mui/x-charts/models', add to '@mui/x-charts/models'
124
+ const importSource = originalImportSource || '@mui/x-charts/models';
125
+
126
+ // Merge duplicate import declarations from the same source before adding new types.
127
+ // Previous codemods may have split imports, leaving multiple declarations from the same source.
128
+ const importsBySource = new Map();
129
+ root.find(j.ImportDeclaration).forEach(astPath => {
130
+ const source = astPath.node.source.value?.toString() ?? '';
131
+ if (!packageRegex.test(source)) {
132
+ return;
133
+ }
134
+ if (!importsBySource.has(source)) {
135
+ importsBySource.set(source, []);
136
+ }
137
+ importsBySource.get(source).push(astPath);
138
+ });
139
+ importsBySource.forEach(paths => {
140
+ if (paths.length <= 1) {
141
+ return;
142
+ }
143
+
144
+ // Collect all specifiers from all declarations, deduplicating by name
145
+ const allSpecifiers = [];
146
+ const seenNames = new Set();
147
+ paths.forEach(importPath => {
148
+ (importPath.node.specifiers || []).forEach(specifier => {
149
+ if (specifier.type === 'ImportSpecifier') {
150
+ const name = specifier.imported.name.toString();
151
+ if (!seenNames.has(name)) {
152
+ seenNames.add(name);
153
+ allSpecifiers.push(specifier);
154
+ }
155
+ } else {
156
+ allSpecifiers.push(specifier);
157
+ }
158
+ });
159
+ });
160
+
161
+ // Keep the first declaration with all specifiers, remove the rest
162
+ paths[0].node.specifiers = allSpecifiers;
163
+ for (let i = 1; i < paths.length; i += 1) {
164
+ j(paths[i]).remove();
165
+ }
166
+ });
167
+
168
+ // Add all replacement types to the same import source as the original
169
+ if (typesToAdd.length > 0) {
170
+ const existingImport = root.find(j.ImportDeclaration, {
171
+ source: {
172
+ value: importSource
173
+ }
174
+ });
175
+ if (existingImport.size() > 0) {
176
+ // Add to the existing import
177
+ const specifiers = existingImport.at(0).get().node.specifiers || [];
178
+ typesToAdd.forEach(typeName => {
179
+ specifiers.push(j.importSpecifier(j.identifier(typeName)));
180
+ });
181
+ } else {
182
+ // Create new import
183
+ const newImport = j.importDeclaration(typesToAdd.map(typeName => j.importSpecifier(j.identifier(typeName))), j.stringLiteral(importSource));
184
+ const firstImport = root.find(j.ImportDeclaration).at(0);
185
+ if (firstImport.size() > 0) {
186
+ firstImport.insertBefore(newImport);
187
+ } else {
188
+ root.get().node.program.body.unshift(newImport);
189
+ }
190
+ }
191
+ }
192
+ return root.toSource(printOptions);
193
+ }
194
+ const testConfig = () => ({
195
+ name: 'remove-deprecated-series-types',
196
+ specFiles: [{
197
+ name: 'root-imports',
198
+ actual: (0, _readFile.default)(_nodePath.default.join(__dirname, 'actual-root-imports.spec.tsx')),
199
+ expected: (0, _readFile.default)(_nodePath.default.join(__dirname, 'expected-root-imports.spec.tsx'))
200
+ }, {
201
+ name: 'nested-imports',
202
+ actual: (0, _readFile.default)(_nodePath.default.join(__dirname, 'actual-nested-imports.spec.tsx')),
203
+ expected: (0, _readFile.default)(_nodePath.default.join(__dirname, 'expected-nested-imports.spec.tsx'))
204
+ }]
205
+ });
206
+ exports.testConfig = testConfig;
@@ -0,0 +1,98 @@
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 _nodePath = _interopRequireDefault(require("node:path"));
10
+ var _readFile = _interopRequireDefault(require("../../../util/readFile"));
11
+ const REMOVED_FUNCTIONS = ['isBarSeries', 'isDefaultizedBarSeries'];
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
+ wrapColumn: 40
19
+ };
20
+ const importedFunctions = {};
21
+
22
+ // Find and remove imports of isBarSeries and isDefaultizedBarSeries
23
+ const packageRegex = /^@mui\/x-charts(-pro|-premium)?(\/(models|internals))?$/;
24
+ root.find(j.ImportDeclaration).forEach(astPath => {
25
+ const source = astPath.node.source.value?.toString() ?? '';
26
+ if (!packageRegex.test(source)) {
27
+ return;
28
+ }
29
+ const specifiers = astPath.node.specifiers || [];
30
+ const remainingSpecifiers = [];
31
+ specifiers.forEach(specifier => {
32
+ if (specifier.type === 'ImportSpecifier') {
33
+ const importedName = specifier.imported.name.toString();
34
+ if (REMOVED_FUNCTIONS.includes(importedName)) {
35
+ // Track the local name used for this import
36
+ const localName = specifier.local?.name.toString() || importedName;
37
+ importedFunctions[localName] = importedName;
38
+ } else {
39
+ remainingSpecifiers.push(specifier);
40
+ }
41
+ } else {
42
+ remainingSpecifiers.push(specifier);
43
+ }
44
+ });
45
+ if (remainingSpecifiers.length === 0) {
46
+ // Remove the entire import declaration if no specifiers remain
47
+ j(astPath).remove();
48
+ } else if (remainingSpecifiers.length !== specifiers.length) {
49
+ // Update the import declaration with remaining specifiers
50
+ astPath.node.specifiers = remainingSpecifiers;
51
+ }
52
+ });
53
+
54
+ // If no relevant imports were found, return the source unchanged to avoid reformatting
55
+ if (Object.keys(importedFunctions).length === 0) {
56
+ return file.source;
57
+ }
58
+
59
+ // Replace function calls with series.type === 'bar'
60
+ // isBarSeries(series) -> series.type === 'bar'
61
+ // isDefaultizedBarSeries(series) -> series.type === 'bar'
62
+ Object.keys(importedFunctions).forEach(localName => {
63
+ root.find(j.CallExpression, {
64
+ callee: {
65
+ type: 'Identifier',
66
+ name: localName
67
+ }
68
+ }).replaceWith(astPath => {
69
+ const args = astPath.node.arguments;
70
+ if (args.length !== 1) {
71
+ // If not exactly 1 argument, keep as-is (shouldn't happen)
72
+ return astPath.node;
73
+ }
74
+ const arg = args[0];
75
+ if (arg.type === 'SpreadElement') {
76
+ // Can't handle spread elements
77
+ return astPath.node;
78
+ }
79
+
80
+ // Create: arg.type === 'bar'
81
+ return j.binaryExpression('===', j.memberExpression(arg, j.identifier('type')), j.stringLiteral('bar'));
82
+ });
83
+ });
84
+ return root.toSource(printOptions);
85
+ }
86
+ const testConfig = () => ({
87
+ name: 'remove-is-bar-series-helpers',
88
+ specFiles: [{
89
+ name: 'root-imports',
90
+ actual: (0, _readFile.default)(_nodePath.default.join(__dirname, 'actual-root-imports.spec.tsx')),
91
+ expected: (0, _readFile.default)(_nodePath.default.join(__dirname, 'expected-root-imports.spec.tsx'))
92
+ }, {
93
+ name: 'nested-imports',
94
+ actual: (0, _readFile.default)(_nodePath.default.join(__dirname, 'actual-nested-imports.spec.tsx')),
95
+ expected: (0, _readFile.default)(_nodePath.default.join(__dirname, 'expected-nested-imports.spec.tsx'))
96
+ }]
97
+ });
98
+ exports.testConfig = testConfig;
@@ -0,0 +1,41 @@
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 _removeObjectProperty = _interopRequireDefault(require("../../../util/removeObjectProperty"));
11
+ var _readFile = _interopRequireDefault(require("../../../util/readFile"));
12
+ const componentsNames = ['BarChart', 'LineChart', 'PieChart', 'ScatterChart', 'SparkLineChart', 'RadarChart', 'ChartsContainer', 'ChartsDataProvider', 'BarChartPro', 'LineChartPro', 'PieChartPro', 'ScatterChartPro', 'RadarChartPro', 'FunnelChart', 'Heatmap', 'SankeyChart', 'BarChartPremium', 'HeatmapPremium', 'ChartDataProvider', 'ChartDataProviderPro', 'ChartDataProviderPremium', 'ChartsDataProviderPro', 'ChartsDataProviderPremium'];
13
+ const propName = 'experimentalFeatures';
14
+ const propKeys = ['preferStrictDomainInLineCharts'];
15
+ function transformer(file, api, options) {
16
+ const j = api.jscodeshift;
17
+ const root = j(file.source);
18
+ const printOptions = options.printOptions || {
19
+ quote: 'single',
20
+ trailingComma: true
21
+ };
22
+ propKeys.forEach(propKey => {
23
+ (0, _removeObjectProperty.default)({
24
+ root,
25
+ j,
26
+ propName,
27
+ componentsNames,
28
+ propKey
29
+ });
30
+ });
31
+ return root.toSource(printOptions);
32
+ }
33
+ const testConfig = () => ({
34
+ name: 'remove-stabilized-experimentalFeatures',
35
+ specFiles: [{
36
+ name: 'remove preferStrictDomainInLineCharts from experimentalFeatures',
37
+ actual: (0, _readFile.default)(_path.default.join(__dirname, 'actual.spec.tsx')),
38
+ expected: (0, _readFile.default)(_path.default.join(__dirname, 'expected.spec.tsx'))
39
+ }]
40
+ });
41
+ exports.testConfig = testConfig;
@@ -0,0 +1,148 @@
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 _renameClasses = require("../../../util/renameClasses");
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, _renameClasses.renameClasses)({
20
+ j,
21
+ root,
22
+ packageNames: ['@mui/x-charts', '@mui/x-charts-pro', '@mui/x-charts-premium'],
23
+ classes: {
24
+ barElementClasses: {
25
+ newClassName: 'barClasses',
26
+ properties: {
27
+ root: 'element'
28
+ }
29
+ },
30
+ barLabelClasses: {
31
+ newClassName: 'barClasses',
32
+ properties: {
33
+ root: 'label',
34
+ animate: 'labelAnimate'
35
+ }
36
+ },
37
+ pieArcClasses: {
38
+ newClassName: 'pieClasses',
39
+ properties: {
40
+ root: 'arc'
41
+ }
42
+ },
43
+ pieArcLabelClasses: {
44
+ newClassName: 'pieClasses',
45
+ properties: {
46
+ root: 'arcLabel'
47
+ }
48
+ },
49
+ radarSeriesPlotClasses: {
50
+ newClassName: 'radarClasses',
51
+ properties: {
52
+ root: 'seriesRoot',
53
+ area: 'seriesArea',
54
+ mark: 'seriesMark'
55
+ }
56
+ },
57
+ areaElementClasses: {
58
+ newClassName: 'lineClasses',
59
+ properties: {
60
+ root: 'area'
61
+ }
62
+ },
63
+ lineElementClasses: {
64
+ newClassName: 'lineClasses',
65
+ properties: {
66
+ root: 'line'
67
+ }
68
+ },
69
+ markElementClasses: {
70
+ newClassName: 'lineClasses',
71
+ properties: {
72
+ root: 'mark',
73
+ animate: 'markAnimate'
74
+ }
75
+ },
76
+ lineHighlightElementClasses: {
77
+ newClassName: 'lineClasses',
78
+ properties: {
79
+ root: 'highlight'
80
+ }
81
+ },
82
+ funnelSectionClasses: {
83
+ newClassName: 'funnelClasses',
84
+ properties: {
85
+ root: 'section',
86
+ filled: 'sectionFilled',
87
+ outlined: 'sectionOutlined',
88
+ label: 'sectionLabel'
89
+ }
90
+ },
91
+ sankeyPlotClasses: {
92
+ newClassName: 'sankeyClasses',
93
+ properties: {}
94
+ }
95
+ }
96
+ });
97
+
98
+ // Classes that had same name as cartesian classes but only for radar charts.
99
+ (0, _renameClasses.renameClasses)({
100
+ j,
101
+ root,
102
+ packageNames: ['@mui/x-charts/RadarChart', '@mui/x-charts-pro/RadarChart', '@mui/x-charts-premium/RadarChart'],
103
+ classes: {
104
+ chartsAxisHighlightClasses: {
105
+ newClassName: 'radarClasses',
106
+ properties: {
107
+ root: 'axisHighlightRoot',
108
+ line: 'axisHighlightLine',
109
+ dot: 'axisHighlightDot'
110
+ }
111
+ },
112
+ chartsAxisClasses: {
113
+ newClassName: 'radarClasses',
114
+ properties: {
115
+ root: 'axisRoot',
116
+ line: 'axisLine',
117
+ label: 'axisLabel'
118
+ }
119
+ },
120
+ chartsGridClasses: {
121
+ newClassName: 'radarClasses',
122
+ properties: {
123
+ radial: 'gridRadial',
124
+ divider: 'gridDivider',
125
+ stripe: 'gridStripe'
126
+ }
127
+ }
128
+ }
129
+ });
130
+ return root.toSource(printOptions);
131
+ }
132
+ const testConfig = () => ({
133
+ name: 'rename-classes',
134
+ specFiles: [{
135
+ name: 'rename barElementClasses to barClasses',
136
+ actual: (0, _readFile.default)(_path.default.join(__dirname, 'actual-imports.spec.tsx')),
137
+ expected: (0, _readFile.default)(_path.default.join(__dirname, 'expected-imports.spec.tsx'))
138
+ }, {
139
+ name: 'rename radar-specific classes only when imported from RadarChart',
140
+ actual: (0, _readFile.default)(_path.default.join(__dirname, 'actual-radar-imports.spec.tsx')),
141
+ expected: (0, _readFile.default)(_path.default.join(__dirname, 'expected-radar-imports.spec.tsx'))
142
+ }, {
143
+ name: 'do not rename radar-specific classes when imported from root package',
144
+ actual: (0, _readFile.default)(_path.default.join(__dirname, 'actual-not-radar-imports.spec.tsx')),
145
+ expected: (0, _readFile.default)(_path.default.join(__dirname, 'expected-not-radar-imports.spec.tsx'))
146
+ }]
147
+ });
148
+ exports.testConfig = testConfig;
@@ -0,0 +1,38 @@
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 _renameProps = _interopRequireDefault(require("../../../util/renameProps"));
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, _renameProps.default)({
20
+ j,
21
+ root,
22
+ componentNames: ['ScatterChart', 'ScatterChartPro', 'SparkLineChart', 'ChartsContainer', 'ChartContainer', 'ChartDataProvider', 'ChartsDataProvider', 'ChartDataProviderPro', 'ChartsDataProviderPro', 'ChartDataProviderPremium', 'ChartsDataProviderPremium'],
23
+ props: {
24
+ voronoiMaxRadius: 'hitAreaRadius',
25
+ disableVoronoi: 'disableHitArea'
26
+ }
27
+ });
28
+ return root.toSource(printOptions);
29
+ }
30
+ const testConfig = () => ({
31
+ name: 'rename-voronoi-max-radius',
32
+ specFiles: [{
33
+ name: 'rename voronoiMaxRadius to hitAreaRadius and disableVoronoi to disableHitArea',
34
+ actual: (0, _readFile.default)(_path.default.join(__dirname, 'actual-imports.spec.tsx')),
35
+ expected: (0, _readFile.default)(_path.default.join(__dirname, 'expected-imports.spec.tsx'))
36
+ }]
37
+ });
38
+ exports.testConfig = testConfig;
@@ -0,0 +1,41 @@
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 _removeObjectProperty = _interopRequireDefault(require("../../../util/removeObjectProperty"));
11
+ var _readFile = _interopRequireDefault(require("../../../util/readFile"));
12
+ const componentsNames = ['DataGridPremium'];
13
+ const propName = 'experimentalFeatures';
14
+ const propKeys = ['charts'];
15
+ function transformer(file, api, options) {
16
+ const j = api.jscodeshift;
17
+ const root = j(file.source);
18
+ const printOptions = options.printOptions || {
19
+ quote: 'single',
20
+ trailingComma: true
21
+ };
22
+ propKeys.forEach(propKey => {
23
+ (0, _removeObjectProperty.default)({
24
+ root,
25
+ j,
26
+ propName,
27
+ componentsNames,
28
+ propKey
29
+ });
30
+ });
31
+ return root.toSource(printOptions);
32
+ }
33
+ const testConfig = () => ({
34
+ name: 'remove-stabilized-experimentalFeatures',
35
+ specFiles: [{
36
+ name: 'remove charts from experimentalFeatures',
37
+ actual: (0, _readFile.default)(_path.default.join(__dirname, 'actual.spec.tsx')),
38
+ expected: (0, _readFile.default)(_path.default.join(__dirname, 'expected.spec.tsx'))
39
+ }]
40
+ });
41
+ exports.testConfig = testConfig;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = transformer;
8
+ var _renameFieldRef = _interopRequireDefault(require("../rename-field-ref"));
9
+ function transformer(file, api, options) {
10
+ [_renameFieldRef.default].forEach(transform => {
11
+ file.source = transform(file, api, options);
12
+ });
13
+ return file.source;
14
+ }
@@ -0,0 +1,94 @@
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 _renameProps = _interopRequireDefault(require("../../../util/renameProps"));
11
+ var _readFile = _interopRequireDefault(require("../../../util/readFile"));
12
+ const fieldNames = ['DateField', 'DateTimeField', 'TimeField', 'DateRangeField', 'DateTimeRangeField', 'TimeRangeField', 'MultiInputDateRangeField', 'MultiInputDateTimeRangeField', 'MultiInputTimeRangeField', 'SingleInputDateRangeField', 'SingleInputDateTimeRangeField', 'SingleInputTimeRangeField'];
13
+ const pickerNames = ['DatePicker', 'DesktopDatePicker', 'MobileDatePicker', 'StaticDatePicker', 'DateTimePicker', 'DesktopDateTimePicker', 'MobileDateTimePicker', 'StaticDateTimePicker', 'TimePicker', 'DesktopTimePicker', 'MobileTimePicker', 'StaticTimePicker', 'DateRangePicker', 'DesktopDateRangePicker', 'MobileDateRangePicker', 'StaticDateRangePicker', 'DateTimeRangePicker', 'DesktopDateTimeRangePicker', 'MobileDateTimeRangePicker', 'TimeRangePicker', 'DesktopTimeRangePicker', 'MobileTimeRangePicker'];
14
+ const props = {
15
+ unstableFieldRef: 'fieldRef',
16
+ unstableStartFieldRef: 'startFieldRef',
17
+ unstableEndFieldRef: 'endFieldRef'
18
+ };
19
+ function transformer(file, api, options) {
20
+ const j = api.jscodeshift;
21
+ const root = j(file.source);
22
+ const printOptions = options.printOptions || {
23
+ quote: 'single',
24
+ trailingComma: true
25
+ };
26
+ (0, _renameProps.default)({
27
+ root,
28
+ j,
29
+ props,
30
+ componentNames: fieldNames
31
+ });
32
+ pickerNames.forEach(componentName => {
33
+ root.find(j.JSXElement, {
34
+ openingElement: {
35
+ name: {
36
+ name: componentName
37
+ }
38
+ }
39
+ }).forEach(elementPath => {
40
+ j(elementPath).find(j.JSXAttribute, {
41
+ name: {
42
+ name: 'slotProps'
43
+ }
44
+ }).forEach(slotPropsAttr => {
45
+ const value = slotPropsAttr.node.value;
46
+ if (value?.type === 'JSXExpressionContainer' && value.expression.type === 'ObjectExpression') {
47
+ const fieldProp = value.expression.properties.find(p => p.key.name === 'field' || p.key.value === 'field');
48
+ if (fieldProp && fieldProp.value.type === 'ObjectExpression') {
49
+ const unstableFieldRefProp = fieldProp.value.properties.find(p => p.key.name === 'unstableFieldRef' || p.key.value === 'unstableFieldRef');
50
+ if (unstableFieldRefProp) {
51
+ unstableFieldRefProp.key.name = 'fieldRef';
52
+ }
53
+ }
54
+ }
55
+ });
56
+ j(elementPath).find(j.JSXAttribute).filter(attrPath => ['fieldRef', 'unstableFieldRef'].includes(attrPath.value.name.name)).forEach(attr => {
57
+ const value = attr.node.value;
58
+ const slotPropsAttr = j(elementPath).find(j.JSXAttribute, {
59
+ name: {
60
+ name: 'slotProps'
61
+ }
62
+ }).at(0);
63
+ const fieldRefProperty = j.objectProperty(j.identifier('fieldRef'), value?.type === 'JSXExpressionContainer' ? value.expression : value);
64
+ if (slotPropsAttr.size() > 0) {
65
+ const slotPropsValue = slotPropsAttr.get().node.value;
66
+ if (slotPropsValue.type === 'JSXExpressionContainer') {
67
+ const expression = slotPropsValue.expression;
68
+ if (expression.type === 'ObjectExpression') {
69
+ const fieldProp = expression.properties.find(p => p.key.name === 'field' || p.key.value === 'field');
70
+ if (fieldProp && fieldProp.value.type === 'ObjectExpression') {
71
+ fieldProp.value.properties.push(fieldRefProperty);
72
+ } else {
73
+ expression.properties.push(j.objectProperty(j.identifier('field'), j.objectExpression([fieldRefProperty])));
74
+ }
75
+ }
76
+ }
77
+ } else {
78
+ elementPath.value.openingElement.attributes?.push(j.jsxAttribute(j.jsxIdentifier('slotProps'), j.jsxExpressionContainer(j.objectExpression([j.objectProperty(j.identifier('field'), j.objectExpression([fieldRefProperty]))]))));
79
+ }
80
+ j(attr).remove();
81
+ });
82
+ });
83
+ });
84
+ return root.toSource(printOptions);
85
+ }
86
+ const testConfig = () => ({
87
+ name: 'rename-field-ref',
88
+ specFiles: [{
89
+ name: 'rename unstable field refs to stable ones',
90
+ actual: (0, _readFile.default)(_path.default.join(__dirname, 'actual.spec.tsx')),
91
+ expected: (0, _readFile.default)(_path.default.join(__dirname, 'expected.spec.tsx'))
92
+ }]
93
+ });
94
+ exports.testConfig = testConfig;
@@ -6,10 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = transformer;
8
8
  var _presetSafe = _interopRequireDefault(require("../charts/preset-safe"));
9
+ var _presetSafe2 = _interopRequireDefault(require("../pickers/preset-safe"));
9
10
  function transformer(file, api, options) {
10
11
  [
11
12
  // Add others here as they are created
12
- _presetSafe.default].forEach(transform => {
13
+ _presetSafe.default, _presetSafe2.default].forEach(transform => {
13
14
  file.source = transform(file, api, options);
14
15
  });
15
16
  return file.source;