@mui/x-codemod 8.0.0-alpha.12 → 8.0.0-alpha.13
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 +61 -4
- package/package.json +2 -2
- package/v8.0.0/data-grid/preset-safe/index.js +4 -0
- package/v8.0.0/data-grid/remove-props/index.js +24 -0
- package/v8.0.0/data-grid/rename-props/index.js +26 -0
- package/v8.0.0/pickers/preset-safe/index.js +2 -2
- package/v8.0.0/pickers/rename-type-imports/index.js +50 -0
- package/v8.0.0/pickers/rename-and-move-field-value-type/index.js +0 -27
package/README.md
CHANGED
|
@@ -324,6 +324,8 @@ npx @mui/x-codemod@next v8.0.0/data-grid/preset-safe <path|folder>
|
|
|
324
324
|
The list includes these transformers
|
|
325
325
|
|
|
326
326
|
- [`remove-stabilized-v8-experimentalFeatures`](#remove-stabilized-v8-experimentalFeatures)
|
|
327
|
+
- [`remove-props`](#remove-props)
|
|
328
|
+
- [`rename-props`](#rename-props)
|
|
327
329
|
|
|
328
330
|
#### `remove-stabilized-v8-experimentalFeatures`
|
|
329
331
|
|
|
@@ -343,6 +345,49 @@ Remove feature flags for stabilized `experimentalFeatures`.
|
|
|
343
345
|
npx @mui/x-codemod@next v8.0.0/data-grid/remove-stabilized-experimentalFeatures <path>
|
|
344
346
|
```
|
|
345
347
|
|
|
348
|
+
#### `remove-props`
|
|
349
|
+
|
|
350
|
+
Remove props that are no longer supported.
|
|
351
|
+
|
|
352
|
+
The list includes these props:
|
|
353
|
+
|
|
354
|
+
- `indeterminateCheckboxAction`
|
|
355
|
+
- `rowPositionsDebounceMs`
|
|
356
|
+
|
|
357
|
+
```diff
|
|
358
|
+
<DataGrid
|
|
359
|
+
- indeterminateCheckboxAction="deselect"
|
|
360
|
+
- rowPositionsDebounceMs={100}
|
|
361
|
+
/>
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
<!-- #default-branch-switch -->
|
|
365
|
+
|
|
366
|
+
```bash
|
|
367
|
+
npx @mui/x-codemod@next v8.0.0/data-grid/remove-props <path>
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
#### `rename-props`
|
|
371
|
+
|
|
372
|
+
Rename props to the new ones.
|
|
373
|
+
|
|
374
|
+
The list includes these props:
|
|
375
|
+
|
|
376
|
+
- `unstable_rowSpanning` to `rowSpanning`
|
|
377
|
+
|
|
378
|
+
```diff
|
|
379
|
+
<DataGrid
|
|
380
|
+
- unstable_rowSpanning
|
|
381
|
+
+ rowSpanning
|
|
382
|
+
/>
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
<!-- #default-branch-switch -->
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
npx @mui/x-codemod@next v8.0.0/data-grid/rename-props <path>
|
|
389
|
+
```
|
|
390
|
+
|
|
346
391
|
### Pickers codemods
|
|
347
392
|
|
|
348
393
|
#### `preset-safe` for Pickers v8.0.0
|
|
@@ -358,7 +403,7 @@ npx @mui/x-codemod@next v8.0.0/pickers/preset-safe <path|folder>
|
|
|
358
403
|
The list includes these transformers
|
|
359
404
|
|
|
360
405
|
- [`rename-adapter-date-fns-imports`](#rename-adapter-date-fns-imports)
|
|
361
|
-
- [`rename-
|
|
406
|
+
- [`rename-type-imports`](#rename-type-imports)
|
|
362
407
|
|
|
363
408
|
#### `rename-adapter-date-fns-imports`
|
|
364
409
|
|
|
@@ -390,13 +435,25 @@ The list includes these transformers
|
|
|
390
435
|
npx @mui/x-codemod@next v8.0.0/pickers/rename-adapter-date-fns-imports <path>
|
|
391
436
|
```
|
|
392
437
|
|
|
393
|
-
#### `rename-
|
|
438
|
+
#### `rename-type-imports`
|
|
439
|
+
|
|
440
|
+
Renames:
|
|
394
441
|
|
|
395
|
-
|
|
442
|
+
- `usePickersTranslations` to `usePickerTranslations`
|
|
443
|
+
- `usePickersContext` to `usePickerContext`
|
|
444
|
+
- `FieldValueType` to `PickerValueType`
|
|
445
|
+
- `RangeFieldSection` to `FieldRangeSection`
|
|
446
|
+
- `PickerShortcutChangeImportance` to `PickerChangeImportance`
|
|
396
447
|
|
|
397
448
|
```diff
|
|
449
|
+
-import { usePickersTranslations, usePickersContext } from '@mui/x-date-pickers/hooks';
|
|
450
|
+
+import { usePickerTranslations, usePickerContext } from '@mui/x-date-pickers/hooks';
|
|
398
451
|
-import { FieldValueType } from '@mui/x-date-pickers';
|
|
399
452
|
+import { PickerValueType } from '@mui/x-date-pickers';
|
|
453
|
+
-import { RangeFieldSection } from '@mui/x-date-pickers-pro/models';
|
|
454
|
+
+import { FieldRangeSection } from '@mui/x-date-pickers-pro/models';
|
|
455
|
+
-import { PickerShortcutChangeImportance } from '@mui/x-date-pickers/PickersShortcuts';
|
|
456
|
+
+import { PickerChangeImportance } from '@mui/x-date-pickers/models';
|
|
400
457
|
|
|
401
458
|
interface MyComponentProps {
|
|
402
459
|
- valueType: FieldValueType;
|
|
@@ -409,7 +466,7 @@ Renames `FieldValueType` to `PickerValueType`.
|
|
|
409
466
|
<!-- #default-branch-switch -->
|
|
410
467
|
|
|
411
468
|
```bash
|
|
412
|
-
npx @mui/x-codemod@next v8.0.0/pickers/rename-
|
|
469
|
+
npx @mui/x-codemod@next v8.0.0/pickers/rename-type-imports <path>
|
|
413
470
|
```
|
|
414
471
|
|
|
415
472
|
## v7.0.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-codemod",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.13",
|
|
4
4
|
"bin": "./codemod.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "MUI Team",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@babel/traverse": "^7.26.9",
|
|
31
31
|
"jscodeshift": "17.1.2",
|
|
32
32
|
"yargs": "^17.7.2",
|
|
33
|
-
"@mui/x-internals": "8.0.0-alpha.
|
|
33
|
+
"@mui/x-internals": "8.0.0-alpha.13"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/jscodeshift": "^0.12.0",
|
|
@@ -6,7 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = transformer;
|
|
8
8
|
var _removeStabilizedExperimentalFeatures = _interopRequireDefault(require("../remove-stabilized-experimentalFeatures"));
|
|
9
|
+
var _removeProps = _interopRequireDefault(require("../remove-props"));
|
|
10
|
+
var _renameProps = _interopRequireDefault(require("../rename-props"));
|
|
9
11
|
function transformer(file, api, options) {
|
|
10
12
|
file.source = (0, _removeStabilizedExperimentalFeatures.default)(file, api, options);
|
|
13
|
+
file.source = (0, _renameProps.default)(file, api, options);
|
|
14
|
+
file.source = (0, _removeProps.default)(file, api, options);
|
|
11
15
|
return file.source;
|
|
12
16
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 _removeProps = _interopRequireDefault(require("../../../util/removeProps"));
|
|
9
|
+
const componentNames = ['DataGrid', 'DataGridPro', 'DataGridPremium'];
|
|
10
|
+
const props = ['indeterminateCheckboxAction', 'rowPositionsDebounceMs'];
|
|
11
|
+
function transformer(file, api, options) {
|
|
12
|
+
const j = api.jscodeshift;
|
|
13
|
+
const root = j(file.source);
|
|
14
|
+
const printOptions = options.printOptions || {
|
|
15
|
+
quote: 'single',
|
|
16
|
+
trailingComma: true
|
|
17
|
+
};
|
|
18
|
+
return (0, _removeProps.default)({
|
|
19
|
+
root,
|
|
20
|
+
j,
|
|
21
|
+
props,
|
|
22
|
+
componentNames
|
|
23
|
+
}).toSource(printOptions);
|
|
24
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 _renameProps = _interopRequireDefault(require("../../../util/renameProps"));
|
|
9
|
+
const componentNames = ['DataGrid', 'DataGridPro', 'DataGridPremium'];
|
|
10
|
+
const props = {
|
|
11
|
+
unstable_rowSpanning: 'rowSpanning'
|
|
12
|
+
};
|
|
13
|
+
function transformer(file, api, options) {
|
|
14
|
+
const j = api.jscodeshift;
|
|
15
|
+
const root = j(file.source);
|
|
16
|
+
const printOptions = options.printOptions || {
|
|
17
|
+
quote: 'single',
|
|
18
|
+
trailingComma: true
|
|
19
|
+
};
|
|
20
|
+
return (0, _renameProps.default)({
|
|
21
|
+
root,
|
|
22
|
+
j,
|
|
23
|
+
props,
|
|
24
|
+
componentNames
|
|
25
|
+
}).toSource(printOptions);
|
|
26
|
+
}
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = transformer;
|
|
8
8
|
var _renameAdapterDateFnsImports = _interopRequireDefault(require("../rename-adapter-date-fns-imports"));
|
|
9
|
-
var
|
|
9
|
+
var _renameTypeImports = _interopRequireDefault(require("../rename-type-imports"));
|
|
10
10
|
function transformer(file, api, options) {
|
|
11
11
|
file.source = (0, _renameAdapterDateFnsImports.default)(file, api, options);
|
|
12
|
-
file.source = (0,
|
|
12
|
+
file.source = (0, _renameTypeImports.default)(file, api, options);
|
|
13
13
|
return file.source;
|
|
14
14
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = transformer;
|
|
7
|
+
var _renameImports = require("../../../util/renameImports");
|
|
8
|
+
function transformer(file, api, options) {
|
|
9
|
+
const j = api.jscodeshift;
|
|
10
|
+
let root = j(file.source);
|
|
11
|
+
const printOptions = options.printOptions || {
|
|
12
|
+
quote: 'single',
|
|
13
|
+
trailingComma: true
|
|
14
|
+
};
|
|
15
|
+
root = (0, _renameImports.renameImports)({
|
|
16
|
+
j,
|
|
17
|
+
root,
|
|
18
|
+
packageNames: ['@mui/x-date-pickers', '@mui/x-date-pickers-pro'],
|
|
19
|
+
imports: [{
|
|
20
|
+
oldEndpoint: 'hooks',
|
|
21
|
+
importsMapping: {
|
|
22
|
+
usePickersTranslations: 'usePickerTranslations',
|
|
23
|
+
usePickersContext: 'usePickerContext'
|
|
24
|
+
}
|
|
25
|
+
}, {
|
|
26
|
+
oldEndpoint: 'models',
|
|
27
|
+
importsMapping: {
|
|
28
|
+
FieldValueType: 'PickerValueType'
|
|
29
|
+
}
|
|
30
|
+
}, {
|
|
31
|
+
oldEndpoint: 'PickersShortcuts',
|
|
32
|
+
newEndpoint: 'models',
|
|
33
|
+
importsMapping: {
|
|
34
|
+
PickerShortcutChangeImportance: 'PickerChangeImportance'
|
|
35
|
+
}
|
|
36
|
+
}]
|
|
37
|
+
});
|
|
38
|
+
root = (0, _renameImports.renameImports)({
|
|
39
|
+
j,
|
|
40
|
+
root,
|
|
41
|
+
packageNames: ['@mui/x-date-pickers-pro'],
|
|
42
|
+
imports: [{
|
|
43
|
+
oldEndpoint: 'models',
|
|
44
|
+
importsMapping: {
|
|
45
|
+
RangeFieldSection: 'FieldRangeSection'
|
|
46
|
+
}
|
|
47
|
+
}]
|
|
48
|
+
});
|
|
49
|
+
return root.toSource(printOptions);
|
|
50
|
+
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = transformer;
|
|
7
|
-
var _renameImports = require("../../../util/renameImports");
|
|
8
|
-
function transformer(file, api, options) {
|
|
9
|
-
const j = api.jscodeshift;
|
|
10
|
-
const root = j(file.source);
|
|
11
|
-
const printOptions = options.printOptions || {
|
|
12
|
-
quote: 'single',
|
|
13
|
-
trailingComma: true
|
|
14
|
-
};
|
|
15
|
-
(0, _renameImports.renameImports)({
|
|
16
|
-
j,
|
|
17
|
-
root,
|
|
18
|
-
packageNames: ['@mui/x-date-pickers', '@mui/x-date-pickers-pro'],
|
|
19
|
-
imports: [{
|
|
20
|
-
oldEndpoint: 'models',
|
|
21
|
-
importsMapping: {
|
|
22
|
-
FieldValueType: 'PickerValueType'
|
|
23
|
-
}
|
|
24
|
-
}]
|
|
25
|
-
});
|
|
26
|
-
return root.toSource(printOptions);
|
|
27
|
-
}
|