@mui/codemod 5.6.1 → 5.6.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/codemod.js CHANGED
File without changes
@@ -37,7 +37,11 @@ function transformer(file, api, options) {
37
37
  }
38
38
  }).forEach(path => {
39
39
  path.node.arguments.forEach(node => {
40
- node.value = map[node.value];
40
+ const replacementValue = map[node.value];
41
+
42
+ if (replacementValue !== undefined) {
43
+ node.value = replacementValue;
44
+ }
41
45
  });
42
46
  });
43
47
  root.find(j.CallExpression, {
@@ -55,7 +59,11 @@ function transformer(file, api, options) {
55
59
  }
56
60
  }).forEach(path => {
57
61
  const node = path.node.arguments[1];
58
- node.value = map[node.value];
62
+ const replacementValue = map[node.value];
63
+
64
+ if (replacementValue !== undefined) {
65
+ node.value = replacementValue;
66
+ }
59
67
  });
60
68
  return root.toSource(printOptions);
61
69
  }
@@ -2,5 +2,6 @@
2
2
 
3
3
  theme.breakpoints.down('sm');
4
4
  theme.breakpoints.down('xl');
5
+ theme.breakpoints.down(360);
5
6
  theme.breakpoints.between('sm', 'md');
6
7
  theme.breakpoints.between('sm', 'xl');
@@ -2,5 +2,6 @@
2
2
 
3
3
  theme.breakpoints.down('md');
4
4
  theme.breakpoints.down('xl');
5
+ theme.breakpoints.down(360);
5
6
  theme.breakpoints.between('sm', 'lg');
6
7
  theme.breakpoints.between('sm', 'xl');
@@ -11,7 +11,7 @@ exports.default = transformer;
11
11
  function transformer(file) {
12
12
  return file.source // `${theme.spacing(2)}px` -> theme.spacing(2)
13
13
  .replace(/`(-?)\${(-?)(theme\.spacing|spacing)\(([^{}]*)\)}px`/gm, '$3($1$2$4)') // `${theme.spacing(2)}px ${theme.spacing(4)}px` -> `${theme.spacing(2)} ${theme.spacing(4)}`
14
- .replace(/(?<={(theme\.spacing|spacing)\(.*\)})px/gm, '').replace(/((theme\.spacing|spacing)\(.*\))\s*\+\s*'px'/gm, '$1').replace(/\${(theme.spacing|spacing)(\(.*\))\s*([+-])\s*([\d.]+)\s*}px/gm, // eslint-disable-next-line no-template-curly-in-string
14
+ .replace(/(?<={(theme\.spacing|spacing)\([^]*.*[^]*\)})px/gm, '').replace(/((theme\.spacing|spacing)\(.*\))\s*\+\s*'px'/gm, '$1').replace(/\${(theme.spacing|spacing)(\(.*\))\s*([+-])\s*([\d.]+)\s*}px/gm, // eslint-disable-next-line no-template-curly-in-string
15
15
  'calc(${$1$2} $3 $4px)').replace(/\${(theme.spacing|spacing)(\(.*\))\s*([*/])\s*([\d.]+)\s*}px/gm, // eslint-disable-next-line no-template-curly-in-string
16
16
  'calc(${$1$2} $3 $4)');
17
17
  }
@@ -4,4 +4,4 @@
4
4
  theme.spacing(gap) + 'px';
5
5
  spacing(gap) + 'px'`calc(100% - ${spacing(itemHorzPadding * 2)}px)``calc(100% - ${theme.spacing(itemHorzPadding * 2)}px)`;
6
6
 
7
- padding: `${theme.spacing(2) - 1}px 0``calc(100% - ${theme.spacing(itemHorzPadding) * 0.3}px)``${-theme.spacing(1)}px``-${theme.spacing(1)}px`;
7
+ padding: `${theme.spacing(2) - 1}px 0``calc(100% - ${theme.spacing(itemHorzPadding) * 0.3}px)``${-theme.spacing(1)}px``-${theme.spacing(1)}px``${theme.spacing(2)}px ${theme.spacing(1)}px ${theme.spacing(2)}px ${theme.spacing(2)}px`;
@@ -10,4 +10,4 @@ spacing(gap)`calc(100% - ${spacing(itemHorzPadding * 2)})``calc(100% - ${theme.s
10
10
  padding: `calc(${theme.spacing(2)} - 1px) 0``calc(100% - calc(${theme.spacing(itemHorzPadding)} * 0.3))`;
11
11
 
12
12
  theme.spacing(-1);
13
- theme.spacing(-1);
13
+ theme.spacing(-1)`${theme.spacing(2)} ${theme.spacing(1)} ${theme.spacing(2)} ${theme.spacing(2)}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/codemod",
3
- "version": "5.6.1",
3
+ "version": "5.6.4",
4
4
  "bin": "./codemod.js",
5
5
  "private": false,
6
6
  "author": "MUI Team",