@mui/codemod 9.0.0-alpha.0 → 9.0.0-alpha.1
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 +46 -0
- package/codemod.js +68 -124
- package/package.json +6 -5
- package/v5.0.0/path-imports.js +0 -5
- package/v5.0.0/top-level-imports.js +1 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 9.0.0-alpha.1
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v9.0.0-alpha.0..master -->
|
|
6
|
+
|
|
7
|
+
_Feb 26, 2026_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
|
|
11
|
+
### @mui/material@9.0.0-alpha.1
|
|
12
|
+
|
|
13
|
+
- [Autocomplete] Prevents Autocomplete menu from opening on right click (#47797) @silviuaavram
|
|
14
|
+
- [Backdrop] Remove aria-hidden by default (#47798) @silviuaavram
|
|
15
|
+
- [ButtonBase] Ensure that onClick propagates when non-native button is clicked (#47800) @silviuaavram
|
|
16
|
+
- [Dialog][Modal] Remove `disableEscapeKeyDown` prop (#47695) @silviuaavram
|
|
17
|
+
- [Grid] Remove system props support (#47846) @siriwatknp
|
|
18
|
+
- [TableCell][theme] Apply `alpha` before color mixing to border bottom color when nativeColor + cssVariables is used (#47762) @ZeeshanTamboli
|
|
19
|
+
- [theme] Remove MuiTouchRipple from theme component types (#47849) @siriwatknp
|
|
20
|
+
- [Tooltip] Fix error is thrown when wrapping an input which is disabled while focused (#47684) @ZeeshanTamboli
|
|
21
|
+
- [useAutocomplete] Improve isOptionEqualToValue value argument type (#47801) @silviuaavram
|
|
22
|
+
|
|
23
|
+
### Docs
|
|
24
|
+
|
|
25
|
+
- [docs] Add updated community theme resource (#47847) @PeterTYLiu
|
|
26
|
+
- [docs] Few copy fixes (#47806) @pavan-sh
|
|
27
|
+
- [docs] Fix IPA reader link in blog post (#47796) @pavan-sh
|
|
28
|
+
- [docs] Fix JSX in Overriding component structure docs (#47799) @ZeeshanTamboli
|
|
29
|
+
- [docs] Fix the keyboard navigation in GroupedMenu example (#47842) @silviuaavram
|
|
30
|
+
- [docs] Fix Theme builder video (#47835) @oliviertassinari
|
|
31
|
+
- [docs] Update pricing sankey as done (#47795) @alexfauquette
|
|
32
|
+
- [docs][system] Update sizing docs to clarify `(0, 1]` behavior. (#47845) @matthias-ccri
|
|
33
|
+
|
|
34
|
+
### Core
|
|
35
|
+
|
|
36
|
+
- [blog] Blogpost for upcoming price changes for MUI X (#47748) @DanailH
|
|
37
|
+
- [code-infra] Detect browser envs that don't support layout (#47813) @Janpot
|
|
38
|
+
- [code-infra] Enable undefined addition to optional properties (#47750) @brijeshb42
|
|
39
|
+
- [code-infra] Exclusively enable test mode in jsdom (#47812) @Janpot
|
|
40
|
+
- [code-infra] Fix console.warn during test (#47802) @Janpot
|
|
41
|
+
- [code-infra] Remove vale as a workspace dependency (#47860) @brijeshb42
|
|
42
|
+
- [code-infra] Setup flat build for packages (#47670) @brijeshb42
|
|
43
|
+
- [code-infra] Upgrade react-docgen to v8 (#47685) @JCQuintas
|
|
44
|
+
- [docs-infra] Reapply Cookie Banner with Design Fixes (#47744) @dav-is
|
|
45
|
+
- [internal] Remove legacy MUI Base API docs (#47804) @ZeeshanTamboli
|
|
46
|
+
|
|
47
|
+
All contributors of this release in alphabetical order: @alexfauquette, @brijeshb42, @DanailH, @dav-is, @Janpot, @JCQuintas, @matthias-ccri, @oliviertassinari, @pavan-sh, @PeterTYLiu, @silviuaavram, @siriwatknp, @ZeeshanTamboli
|
|
48
|
+
|
|
3
49
|
## 9.0.0-alpha.0
|
|
4
50
|
|
|
5
51
|
<!-- generated comparing v7.3.8..master -->
|
package/codemod.js
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
2
3
|
|
|
3
4
|
const childProcess = require('child_process');
|
|
4
|
-
const {
|
|
5
|
+
const {
|
|
6
|
+
promises: fs
|
|
7
|
+
} = require('fs');
|
|
5
8
|
const path = require('path');
|
|
6
9
|
const yargs = require('yargs');
|
|
7
10
|
const jscodeshiftPackage = require('jscodeshift/package.json');
|
|
8
11
|
const postcssCliPackage = require('postcss-cli/package.json');
|
|
9
|
-
|
|
10
12
|
const jscodeshiftDirectory = path.dirname(require.resolve('jscodeshift'));
|
|
11
13
|
const jscodeshiftExecutable = path.join(jscodeshiftDirectory, jscodeshiftPackage.bin.jscodeshift);
|
|
12
|
-
|
|
13
14
|
const postcssCliDirectory = path.dirname(require.resolve('postcss-cli'));
|
|
14
15
|
const postcssExecutable = path.join(postcssCliDirectory, postcssCliPackage.bin.postcss);
|
|
15
|
-
|
|
16
16
|
async function runJscodeshiftTransform(transform, files, flags, codemodFlags) {
|
|
17
|
-
const paths = [
|
|
18
|
-
path.resolve(__dirname, './src', `${transform}/index.js`),
|
|
19
|
-
path.resolve(__dirname, './src', `${transform}.js`),
|
|
20
|
-
path.resolve(__dirname, './', `${transform}/index.js`),
|
|
21
|
-
path.resolve(__dirname, './', `${transform}.js`),
|
|
22
|
-
];
|
|
23
|
-
|
|
17
|
+
const paths = [path.resolve(__dirname, './src', `${transform}/index.js`), path.resolve(__dirname, './src', `${transform}.js`), path.resolve(__dirname, './', `${transform}/index.js`), path.resolve(__dirname, './', `${transform}.js`)];
|
|
24
18
|
let transformerPath;
|
|
25
19
|
let error;
|
|
26
20
|
for (const item of paths) {
|
|
@@ -35,35 +29,15 @@ async function runJscodeshiftTransform(transform, files, flags, codemodFlags) {
|
|
|
35
29
|
continue;
|
|
36
30
|
}
|
|
37
31
|
}
|
|
38
|
-
|
|
39
32
|
if (error) {
|
|
40
33
|
if (error?.code === 'ENOENT') {
|
|
41
|
-
throw new Error(
|
|
42
|
-
`Transform '${transform}' not found. Check out ${path.resolve(
|
|
43
|
-
__dirname,
|
|
44
|
-
'./README.md for a list of available codemods.',
|
|
45
|
-
)}`,
|
|
46
|
-
);
|
|
34
|
+
throw new Error(`Transform '${transform}' not found. Check out ${path.resolve(__dirname, './README.md for a list of available codemods.')}`);
|
|
47
35
|
}
|
|
48
36
|
throw error;
|
|
49
37
|
}
|
|
50
|
-
|
|
51
38
|
const args = [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
'--transform',
|
|
55
|
-
transformerPath,
|
|
56
|
-
...codemodFlags,
|
|
57
|
-
'--extensions',
|
|
58
|
-
'js,ts,jsx,tsx,json',
|
|
59
|
-
'--parser',
|
|
60
|
-
flags.parser || 'tsx',
|
|
61
|
-
'--ignore-pattern',
|
|
62
|
-
'**/node_modules/**',
|
|
63
|
-
'--ignore-pattern',
|
|
64
|
-
'**/*.css',
|
|
65
|
-
];
|
|
66
|
-
|
|
39
|
+
// can't directly spawn `jscodeshiftExecutable` due to https://github.com/facebook/jscodeshift/issues/424
|
|
40
|
+
jscodeshiftExecutable, '--transform', transformerPath, ...codemodFlags, '--extensions', 'js,ts,jsx,tsx,json', '--parser', flags.parser || 'tsx', '--ignore-pattern', '**/node_modules/**', '--ignore-pattern', '**/*.css'];
|
|
67
41
|
if (flags.dry) {
|
|
68
42
|
args.push('--dry');
|
|
69
43
|
}
|
|
@@ -76,43 +50,33 @@ async function runJscodeshiftTransform(transform, files, flags, codemodFlags) {
|
|
|
76
50
|
if (flags.packageName) {
|
|
77
51
|
args.push(`--packageName=${flags.packageName}`);
|
|
78
52
|
}
|
|
79
|
-
|
|
80
53
|
args.push(...files);
|
|
81
54
|
|
|
82
55
|
// eslint-disable-next-line no-console -- debug information
|
|
83
56
|
console.log(`Executing command: jscodeshift ${args.join(' ')}`);
|
|
84
|
-
const jscodeshiftProcess = childProcess.spawnSync('node', args, {
|
|
85
|
-
|
|
57
|
+
const jscodeshiftProcess = childProcess.spawnSync('node', args, {
|
|
58
|
+
stdio: 'inherit'
|
|
59
|
+
});
|
|
86
60
|
if (jscodeshiftProcess.error) {
|
|
87
61
|
throw jscodeshiftProcess.error;
|
|
88
62
|
}
|
|
89
63
|
}
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return null;
|
|
103
|
-
}),
|
|
104
|
-
);
|
|
105
|
-
|
|
64
|
+
const parseCssFilePaths = async files => {
|
|
65
|
+
const cssFiles = await Promise.all(files.map(async filePath => {
|
|
66
|
+
const stat = await fs.stat(filePath);
|
|
67
|
+
if (stat.isDirectory()) {
|
|
68
|
+
return `${filePath}/**/*.css`;
|
|
69
|
+
}
|
|
70
|
+
if (filePath.endsWith('.css')) {
|
|
71
|
+
return filePath;
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}));
|
|
106
75
|
return cssFiles.filter(Boolean);
|
|
107
76
|
};
|
|
108
|
-
|
|
109
77
|
async function runPostcssTransform(transform, files) {
|
|
110
78
|
// local postcss plugins are loaded through config files https://github.com/postcss/postcss-load-config/issues/17#issuecomment-253125559
|
|
111
|
-
const paths = [
|
|
112
|
-
path.resolve(__dirname, './src', `${transform}/postcss.config.js`),
|
|
113
|
-
path.resolve(__dirname, './', `${transform}/postcss.config.js`),
|
|
114
|
-
];
|
|
115
|
-
|
|
79
|
+
const paths = [path.resolve(__dirname, './src', `${transform}/postcss.config.js`), path.resolve(__dirname, './', `${transform}/postcss.config.js`)];
|
|
116
80
|
let configPath;
|
|
117
81
|
let error;
|
|
118
82
|
for (const item of paths) {
|
|
@@ -127,7 +91,6 @@ async function runPostcssTransform(transform, files) {
|
|
|
127
91
|
continue;
|
|
128
92
|
}
|
|
129
93
|
}
|
|
130
|
-
|
|
131
94
|
if (error) {
|
|
132
95
|
// don't throw if the file is not found, postcss transform is optional
|
|
133
96
|
if (error?.code !== 'ENOENT') {
|
|
@@ -135,81 +98,62 @@ async function runPostcssTransform(transform, files) {
|
|
|
135
98
|
}
|
|
136
99
|
} else {
|
|
137
100
|
const cssPaths = await parseCssFilePaths(files);
|
|
138
|
-
|
|
139
101
|
if (cssPaths.length > 0) {
|
|
140
|
-
const args = [
|
|
141
|
-
postcssExecutable,
|
|
142
|
-
...cssPaths,
|
|
143
|
-
'--config',
|
|
144
|
-
configPath,
|
|
145
|
-
'--replace',
|
|
146
|
-
'--verbose',
|
|
147
|
-
];
|
|
102
|
+
const args = [postcssExecutable, ...cssPaths, '--config', configPath, '--replace', '--verbose'];
|
|
148
103
|
|
|
149
104
|
// eslint-disable-next-line no-console -- debug information
|
|
150
105
|
console.log(`Executing command: postcss ${args.join(' ')}`);
|
|
151
|
-
const postcssProcess = childProcess.spawnSync('node', args, {
|
|
152
|
-
|
|
106
|
+
const postcssProcess = childProcess.spawnSync('node', args, {
|
|
107
|
+
stdio: 'inherit'
|
|
108
|
+
});
|
|
153
109
|
if (postcssProcess.error) {
|
|
154
110
|
throw postcssProcess.error;
|
|
155
111
|
}
|
|
156
112
|
}
|
|
157
113
|
}
|
|
158
114
|
}
|
|
159
|
-
|
|
160
115
|
function run(argv) {
|
|
161
|
-
const {
|
|
162
|
-
|
|
163
|
-
|
|
116
|
+
const {
|
|
117
|
+
codemod,
|
|
118
|
+
paths,
|
|
119
|
+
...flags
|
|
120
|
+
} = argv;
|
|
121
|
+
const files = paths.map(filePath => path.resolve(filePath));
|
|
164
122
|
runJscodeshiftTransform(codemod, files, flags, argv._);
|
|
165
123
|
runPostcssTransform(codemod, files);
|
|
166
124
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
})
|
|
203
|
-
.option('packageName', {
|
|
204
|
-
description: 'The package name to look for in the import statements',
|
|
205
|
-
default: '@mui/material',
|
|
206
|
-
type: 'string',
|
|
207
|
-
});
|
|
208
|
-
},
|
|
209
|
-
handler: run,
|
|
210
|
-
})
|
|
211
|
-
.scriptName('npx @mui/codemod')
|
|
212
|
-
.example('$0 v4.0.0/theme-spacing-api src')
|
|
213
|
-
.example('$0 v5.0.0/component-rename-prop src -- --component=Grid --from=prop --to=newProp')
|
|
214
|
-
.help()
|
|
215
|
-
.parse();
|
|
125
|
+
yargs.command({
|
|
126
|
+
command: '$0 <codemod> <paths...>',
|
|
127
|
+
describe: 'Applies a `@mui/codemod` to the specified paths',
|
|
128
|
+
builder: command => {
|
|
129
|
+
return command.positional('codemod', {
|
|
130
|
+
description: 'The name of the codemod',
|
|
131
|
+
type: 'string'
|
|
132
|
+
}).positional('paths', {
|
|
133
|
+
array: true,
|
|
134
|
+
description: 'Paths forwarded to `jscodeshift`',
|
|
135
|
+
type: 'string'
|
|
136
|
+
}).option('dry', {
|
|
137
|
+
description: 'dry run (no changes are made to files)',
|
|
138
|
+
default: false,
|
|
139
|
+
type: 'boolean'
|
|
140
|
+
}).option('parser', {
|
|
141
|
+
description: 'which parser for jscodeshift to use',
|
|
142
|
+
default: 'tsx',
|
|
143
|
+
type: 'string'
|
|
144
|
+
}).option('print', {
|
|
145
|
+
description: 'print transformed files to stdout, useful for development',
|
|
146
|
+
default: false,
|
|
147
|
+
type: 'boolean'
|
|
148
|
+
}).option('jscodeshift', {
|
|
149
|
+
description: '(Advanced) Pass options directly to jscodeshift',
|
|
150
|
+
default: false,
|
|
151
|
+
type: 'string'
|
|
152
|
+
}).option('packageName', {
|
|
153
|
+
description: 'The package name to look for in the import statements',
|
|
154
|
+
default: '@mui/material',
|
|
155
|
+
type: 'string'
|
|
156
|
+
});
|
|
157
|
+
},
|
|
158
|
+
handler: run
|
|
159
|
+
}).scriptName('npx @mui/codemod').example('$0 v4.0.0/theme-spacing-api src').example('$0 v5.0.0/component-rename-prop src -- --component=Grid --from=prop --to=newProp').help().parse();
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/codemod",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.1",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "Codemod scripts for Material UI.",
|
|
6
|
-
"bin": "./codemod.js",
|
|
7
6
|
"keywords": [
|
|
8
7
|
"react",
|
|
9
8
|
"react-component",
|
|
@@ -23,9 +22,10 @@
|
|
|
23
22
|
"url": "https://opencollective.com/mui-org"
|
|
24
23
|
},
|
|
25
24
|
"dependencies": {
|
|
26
|
-
"@babel/core": "^7.
|
|
25
|
+
"@babel/core": "^7.29.0",
|
|
27
26
|
"@babel/runtime": "^7.28.6",
|
|
28
|
-
"@babel/traverse": "^7.
|
|
27
|
+
"@babel/traverse": "^7.29.0",
|
|
28
|
+
"@mui/material-v5": "npm:@mui/material@5.18.0",
|
|
29
29
|
"jscodeshift": "^17.1.2",
|
|
30
30
|
"jscodeshift-add-imports": "^1.0.11",
|
|
31
31
|
"postcss": "^8.5.6",
|
|
@@ -42,5 +42,6 @@
|
|
|
42
42
|
"type": "commonjs",
|
|
43
43
|
"exports": {
|
|
44
44
|
"./package.json": "./package.json"
|
|
45
|
-
}
|
|
45
|
+
},
|
|
46
|
+
"bin": "./codemod.js"
|
|
46
47
|
}
|
package/v5.0.0/path-imports.js
CHANGED
|
@@ -6,11 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = transformer;
|
|
8
8
|
var _jscodeshiftAddImports = _interopRequireDefault(require("jscodeshift-add-imports"));
|
|
9
|
-
// istanbul ignore next
|
|
10
|
-
if (globalThis.MUI_TEST_ENV) {
|
|
11
|
-
const resolve = require.resolve;
|
|
12
|
-
require.resolve = source => resolve(source.replace(/^@mui\/material\/modern/, '../../../mui-material/src'));
|
|
13
|
-
}
|
|
14
9
|
const barrelImportsToTransform = {
|
|
15
10
|
material: {},
|
|
16
11
|
'icons-material': {}
|
|
@@ -12,11 +12,7 @@ function transformer(fileInfo, api, options) {
|
|
|
12
12
|
const j = api.jscodeshift;
|
|
13
13
|
const importModule = options.importModule || '@mui/material';
|
|
14
14
|
const targetModule = options.targetModule || '@mui/material';
|
|
15
|
-
|
|
16
|
-
if (globalThis.MUI_TEST_ENV) {
|
|
17
|
-
resolveModule = resolveModule.replace(/^@mui\/material/, '@mui/material-v5');
|
|
18
|
-
}
|
|
19
|
-
const whitelist = (0, _getJSExports.default)(require.resolve(`${resolveModule}/modern`, {
|
|
15
|
+
const whitelist = (0, _getJSExports.default)(require.resolve(`@mui/material-v5/modern`, {
|
|
20
16
|
paths: [(0, _path.dirname)(fileInfo.path)]
|
|
21
17
|
}));
|
|
22
18
|
const printOptions = options.printOptions || {
|