@mui/codemod 6.1.0 → 6.1.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/node/v1.0.0/color-imports.js +2 -2
- package/node/v5.0.0/theme-spacing.test/large-actual.js +2 -2
- package/node/v5.0.0/theme-spacing.test/large-expected.js +2 -2
- package/node/v6.0.0/grid-v2-props/grid-v2-props.js +4 -0
- package/node/v6.0.0/grid-v2-props/test-cases/actual.js +9 -0
- package/node/v6.0.0/grid-v2-props/test-cases/expected.js +3 -0
- package/node/v6.0.0/list-item-button-prop/list-item-button-prop.js +2 -2
- package/package.json +3 -3
|
@@ -24,7 +24,7 @@ function colorAccent(colorIdentifier) {
|
|
|
24
24
|
* @param {string} colorPalette
|
|
25
25
|
*/
|
|
26
26
|
function colorImportPath(colorPalette) {
|
|
27
|
-
return commonColors.
|
|
27
|
+
return commonColors.includes(colorPalette) ? 'common' : colorPalette;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -81,7 +81,7 @@ function transformMemberImports(j, root, importPath, targetPath) {
|
|
|
81
81
|
const colorIdentifier = j.identifier(colorModuleName);
|
|
82
82
|
|
|
83
83
|
// import color module (if not already imported)
|
|
84
|
-
if (importDeclarations.map(p => p.source.value).
|
|
84
|
+
if (!importDeclarations.map(p => p.source.value).includes(modulePath)) {
|
|
85
85
|
importDeclarations.push(j.importDeclaration([j.importDefaultSpecifier(colorIdentifier)], j.literal(modulePath)));
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -248,8 +248,8 @@ function AppSearch() {
|
|
|
248
248
|
const searchButtonRef = React.useRef(null);
|
|
249
249
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
250
250
|
const [initialQuery, setInitialQuery] = React.useState(undefined);
|
|
251
|
-
const facetFilterLanguage = _config.LANGUAGES_SSR.
|
|
252
|
-
const macOS = window.navigator.platform.toUpperCase().
|
|
251
|
+
const facetFilterLanguage = _config.LANGUAGES_SSR.includes(userLanguage) ? `language:${userLanguage}` : `language:en`;
|
|
252
|
+
const macOS = window.navigator.platform.toUpperCase().includes('MAC');
|
|
253
253
|
const onOpen = React.useCallback(() => {
|
|
254
254
|
setIsOpen(true);
|
|
255
255
|
}, [setIsOpen]);
|
|
@@ -248,8 +248,8 @@ function AppSearch() {
|
|
|
248
248
|
const searchButtonRef = React.useRef(null);
|
|
249
249
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
250
250
|
const [initialQuery, setInitialQuery] = React.useState(undefined);
|
|
251
|
-
const facetFilterLanguage = _config.LANGUAGES_SSR.
|
|
252
|
-
const macOS = window.navigator.platform.toUpperCase().
|
|
251
|
+
const facetFilterLanguage = _config.LANGUAGES_SSR.includes(userLanguage) ? `language:${userLanguage}` : `language:en`;
|
|
252
|
+
const macOS = window.navigator.platform.toUpperCase().includes('MAC');
|
|
253
253
|
const onOpen = React.useCallback(() => {
|
|
254
254
|
setIsOpen(true);
|
|
255
255
|
}, [setIsOpen]);
|
|
@@ -137,6 +137,10 @@ function gridV2Props(file, api, options) {
|
|
|
137
137
|
}
|
|
138
138
|
el.node.openingElement.attributes = el.node.openingElement.attributes.filter(attr => !breakpoints.includes(attr?.name?.name.replace('Offset', '')));
|
|
139
139
|
el.node.openingElement.attributes = el.node.openingElement.attributes.filter(attr => !attributesToPrune.includes(attr));
|
|
140
|
+
const itemProp = el.node.openingElement.attributes.find(attr => attr.type === 'JSXAttribute' && attr.name.name === 'item');
|
|
141
|
+
if (itemProp) {
|
|
142
|
+
el.node.openingElement.attributes = el.node.openingElement.attributes.filter(attr => attr.type === 'JSXAttribute' && attr.name.name !== 'item');
|
|
143
|
+
}
|
|
140
144
|
});
|
|
141
145
|
return root.toSource(printOptions);
|
|
142
146
|
}
|
|
@@ -28,6 +28,15 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
28
28
|
/*#__PURE__*/(0, _jsxRuntime.jsx)(_joy.Grid, {
|
|
29
29
|
xs: 2
|
|
30
30
|
});
|
|
31
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
32
|
+
item: true
|
|
33
|
+
});
|
|
34
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
35
|
+
item: true
|
|
36
|
+
});
|
|
37
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
38
|
+
item: false
|
|
39
|
+
});
|
|
31
40
|
|
|
32
41
|
// Transforms responsive sizes
|
|
33
42
|
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
@@ -28,6 +28,9 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
28
28
|
/*#__PURE__*/(0, _jsxRuntime.jsx)(_joy.Grid, {
|
|
29
29
|
size: 2
|
|
30
30
|
});
|
|
31
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
32
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
33
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
31
34
|
|
|
32
35
|
// Transforms responsive sizes
|
|
33
36
|
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
@@ -62,7 +62,7 @@ function transformer(file, api, options) {
|
|
|
62
62
|
root.find(j.ImportDeclaration).filter(path => path.node.source.value === '@mui/material/ListItem').filter(path => {
|
|
63
63
|
path.node.specifiers.forEach(specifier => {
|
|
64
64
|
if (specifier.type === 'ImportDefaultSpecifier') {
|
|
65
|
-
if (importsToRemove.
|
|
65
|
+
if (importsToRemove.includes(specifier.local.name)) {
|
|
66
66
|
path.node.specifiers = path.node.specifiers.filter(spec => spec !== specifier);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -74,7 +74,7 @@ function transformer(file, api, options) {
|
|
|
74
74
|
}).remove();
|
|
75
75
|
root.find(j.ImportDeclaration).filter(path => path.node.source.value === '@mui/material').filter(path => {
|
|
76
76
|
path.node.specifiers.forEach(specifier => {
|
|
77
|
-
if (specifier.type === 'ImportSpecifier' && specifier.imported.name === 'ListItem' && importsToRemove.
|
|
77
|
+
if (specifier.type === 'ImportSpecifier' && specifier.imported.name === 'ListItem' && importsToRemove.includes(specifier.local.name)) {
|
|
78
78
|
path.node.specifiers = path.node.specifiers.filter(spec => spec !== specifier);
|
|
79
79
|
}
|
|
80
80
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/codemod",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"bin": "./codemod.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "MUI Team",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "https://github.com/mui/material-ui.git",
|
|
17
|
+
"url": "git+https://github.com/mui/material-ui.git",
|
|
18
18
|
"directory": "packages/mui-codemod"
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@babel/traverse": "^7.25.6",
|
|
30
30
|
"jscodeshift": "^0.16.1",
|
|
31
31
|
"jscodeshift-add-imports": "^1.0.11",
|
|
32
|
-
"postcss": "^8.4.
|
|
32
|
+
"postcss": "^8.4.47",
|
|
33
33
|
"postcss-cli": "^11.0.0",
|
|
34
34
|
"yargs": "^17.7.2"
|
|
35
35
|
},
|