@mui/codemod 5.10.11 → 5.10.14

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.
Files changed (280) hide show
  1. package/codemod.js +0 -0
  2. package/node/util/getJSExports.js +0 -6
  3. package/node/util/memoize.js +0 -4
  4. package/node/util/propsToObject.js +0 -6
  5. package/node/util/readFile.js +0 -6
  6. package/node/util/renameClassKey.js +0 -2
  7. package/node/util/renameProps.js +0 -1
  8. package/node/v0.15.0/import-path.js +0 -6
  9. package/node/v0.15.0/import-path.test/actual.js +0 -5
  10. package/node/v0.15.0/import-path.test/expected.js +0 -5
  11. package/node/v1.0.0/color-imports.js +12 -17
  12. package/node/v1.0.0/color-imports.test/actual.js +0 -3
  13. package/node/v1.0.0/color-imports.test/expected.js +0 -9
  14. package/node/v1.0.0/import-path.js +4 -8
  15. package/node/v1.0.0/import-path.test/actual.js +0 -28
  16. package/node/v1.0.0/import-path.test/expected.js +0 -61
  17. package/node/v1.0.0/menu-item-primary-text.js +0 -2
  18. package/node/v1.0.0/menu-item-primary-text.test/actual.js +1 -3
  19. package/node/v1.0.0/menu-item-primary-text.test/expected.js +1 -3
  20. package/node/v1.0.0/svg-icon-imports.js +6 -7
  21. package/node/v1.0.0/svg-icon-imports.test/actual.js +0 -4
  22. package/node/v1.0.0/svg-icon-imports.test/expected.js +0 -4
  23. package/node/v4.0.0/optimal-imports.js +0 -26
  24. package/node/v4.0.0/optimal-imports.test/actual.js +0 -64
  25. package/node/v4.0.0/optimal-imports.test/expected.js +0 -62
  26. package/node/v4.0.0/theme-spacing-api.js +7 -19
  27. package/node/v4.0.0/theme-spacing-api.test/actual.js +0 -11
  28. package/node/v4.0.0/theme-spacing-api.test/actual_destructured.js +0 -9
  29. package/node/v4.0.0/theme-spacing-api.test/expected.js +0 -11
  30. package/node/v4.0.0/theme-spacing-api.test/expected_destructured.js +0 -9
  31. package/node/v4.0.0/top-level-imports.js +2 -22
  32. package/node/v4.0.0/top-level-imports.test/actual.js +0 -58
  33. package/node/v4.0.0/top-level-imports.test/expected.js +0 -3
  34. package/node/v5.0.0/adapter-v4.js +3 -11
  35. package/node/v5.0.0/adapter-v4.test/actual.js +0 -1
  36. package/node/v5.0.0/adapter-v4.test/core-import.actual.js +0 -2
  37. package/node/v5.0.0/adapter-v4.test/core-import.expected.js +0 -2
  38. package/node/v5.0.0/adapter-v4.test/expected.js +0 -1
  39. package/node/v5.0.0/adapter-v4.test/no-styles-import.actual.js +0 -2
  40. package/node/v5.0.0/adapter-v4.test/no-styles-import.expected.js +0 -3
  41. package/node/v5.0.0/autocomplete-rename-closeicon.js +0 -3
  42. package/node/v5.0.0/autocomplete-rename-closeicon.test/actual.js +1 -3
  43. package/node/v5.0.0/autocomplete-rename-closeicon.test/expected.js +1 -3
  44. package/node/v5.0.0/autocomplete-rename-option.js +0 -3
  45. package/node/v5.0.0/autocomplete-rename-option.test/actual.js +1 -3
  46. package/node/v5.0.0/autocomplete-rename-option.test/expected.js +1 -3
  47. package/node/v5.0.0/avatar-circle-circular.js +0 -4
  48. package/node/v5.0.0/avatar-circle-circular.test/actual.js +1 -3
  49. package/node/v5.0.0/avatar-circle-circular.test/expected.js +1 -3
  50. package/node/v5.0.0/badge-overlap-value.js +0 -6
  51. package/node/v5.0.0/badge-overlap-value.test/actual.js +1 -5
  52. package/node/v5.0.0/badge-overlap-value.test/expected.js +1 -5
  53. package/node/v5.0.0/base-rename-components-to-slots.js +1 -11
  54. package/node/v5.0.0/base-rename-components-to-slots.test/actual.js +3 -9
  55. package/node/v5.0.0/base-rename-components-to-slots.test/expected.js +3 -9
  56. package/node/v5.0.0/box-borderradius-values.js +2 -2
  57. package/node/v5.0.0/box-borderradius-values.test/actual.js +1 -3
  58. package/node/v5.0.0/box-borderradius-values.test/expected.js +1 -3
  59. package/node/v5.0.0/box-rename-css.js +0 -3
  60. package/node/v5.0.0/box-rename-css.test/actual.js +1 -3
  61. package/node/v5.0.0/box-rename-css.test/expected.js +1 -3
  62. package/node/v5.0.0/box-rename-gap.js +0 -3
  63. package/node/v5.0.0/box-rename-gap.test/actual.js +1 -3
  64. package/node/v5.0.0/box-rename-gap.test/expected.js +1 -3
  65. package/node/v5.0.0/box-sx-prop.js +1 -5
  66. package/node/v5.0.0/box-sx-prop.test/actual.js +0 -10
  67. package/node/v5.0.0/box-sx-prop.test/alias-actual.js +0 -5
  68. package/node/v5.0.0/box-sx-prop.test/alias-expected.js +0 -4
  69. package/node/v5.0.0/box-sx-prop.test/expected.js +0 -10
  70. package/node/v5.0.0/button-color-prop.js +0 -2
  71. package/node/v5.0.0/button-color-prop.test/actual.js +1 -3
  72. package/node/v5.0.0/button-color-prop.test/expected.js +1 -3
  73. package/node/v5.0.0/chip-variant-prop.js +0 -2
  74. package/node/v5.0.0/chip-variant-prop.test/actual.js +1 -3
  75. package/node/v5.0.0/chip-variant-prop.test/expected.js +1 -3
  76. package/node/v5.0.0/circularprogress-variant.js +0 -4
  77. package/node/v5.0.0/circularprogress-variant.test/actual.js +1 -3
  78. package/node/v5.0.0/circularprogress-variant.test/expected.js +1 -3
  79. package/node/v5.0.0/collapse-rename-collapsedheight.js +0 -4
  80. package/node/v5.0.0/collapse-rename-collapsedheight.test/actual.js +1 -3
  81. package/node/v5.0.0/collapse-rename-collapsedheight.test/expected.js +1 -3
  82. package/node/v5.0.0/component-rename-prop.js +0 -3
  83. package/node/v5.0.0/component-rename-prop.test/actual.js +1 -3
  84. package/node/v5.0.0/component-rename-prop.test/expected.js +1 -3
  85. package/node/v5.0.0/core-styles-import.js +0 -3
  86. package/node/v5.0.0/core-styles-import.test/actual.js +0 -4
  87. package/node/v5.0.0/create-theme.js +0 -5
  88. package/node/v5.0.0/create-theme.test/actual.js +0 -2
  89. package/node/v5.0.0/create-theme.test/core-import.actual.js +0 -1
  90. package/node/v5.0.0/create-theme.test/core-import.expected.js +0 -1
  91. package/node/v5.0.0/create-theme.test/custom-fn.actual.js +0 -6
  92. package/node/v5.0.0/create-theme.test/custom-fn.expected.js +0 -6
  93. package/node/v5.0.0/create-theme.test/expected.js +0 -2
  94. package/node/v5.0.0/date-pickers-moved-to-x.js +1 -10
  95. package/node/v5.0.0/date-pickers-moved-to-x.test/actual-sub-module.js +0 -31
  96. package/node/v5.0.0/date-pickers-moved-to-x.test/expected-root-community.js +0 -1
  97. package/node/v5.0.0/date-pickers-moved-to-x.test/expected-root-pro.js +0 -1
  98. package/node/v5.0.0/date-pickers-moved-to-x.test/expected-sub-module.js +0 -29
  99. package/node/v5.0.0/dialog-props.js +0 -1
  100. package/node/v5.0.0/dialog-props.test/actual.js +1 -3
  101. package/node/v5.0.0/dialog-props.test/expected.js +1 -3
  102. package/node/v5.0.0/dialog-title-props.js +0 -1
  103. package/node/v5.0.0/dialog-title-props.test/actual.js +1 -3
  104. package/node/v5.0.0/dialog-title-props.test/expected.js +1 -3
  105. package/node/v5.0.0/emotion-prepend-cache.js +0 -3
  106. package/node/v5.0.0/emotion-prepend-cache.test/custom-naming.actual.js +0 -2
  107. package/node/v5.0.0/emotion-prepend-cache.test/custom-naming.expected.js +0 -2
  108. package/node/v5.0.0/emotion-prepend-cache.test/default-naming.actual.js +0 -2
  109. package/node/v5.0.0/emotion-prepend-cache.test/default-naming.expected.js +0 -2
  110. package/node/v5.0.0/emotion-prepend-cache.test/replace-existing-prepend.actual.js +0 -2
  111. package/node/v5.0.0/emotion-prepend-cache.test/replace-existing-prepend.expected.js +0 -2
  112. package/node/v5.0.0/expansion-panel-component.js +0 -1
  113. package/node/v5.0.0/expansion-panel-component.test/actual.js +1 -8
  114. package/node/v5.0.0/expansion-panel-component.test/expected.js +1 -8
  115. package/node/v5.0.0/fab-variant.js +0 -4
  116. package/node/v5.0.0/fab-variant.test/actual.js +1 -3
  117. package/node/v5.0.0/fab-variant.test/expected.js +1 -3
  118. package/node/v5.0.0/fade-rename-alpha.js +0 -3
  119. package/node/v5.0.0/fade-rename-alpha.test/actual.js +0 -2
  120. package/node/v5.0.0/fade-rename-alpha.test/expected.js +0 -2
  121. package/node/v5.0.0/grid-justify-justifycontent.js +0 -3
  122. package/node/v5.0.0/grid-justify-justifycontent.test/actual.js +1 -3
  123. package/node/v5.0.0/grid-justify-justifycontent.test/expected.js +1 -3
  124. package/node/v5.0.0/grid-list-component.js +0 -1
  125. package/node/v5.0.0/grid-list-component.test/actual.js +1 -7
  126. package/node/v5.0.0/grid-list-component.test/expected.js +1 -7
  127. package/node/v5.0.0/hidden-down-props.js +0 -3
  128. package/node/v5.0.0/icon-button-size.js +0 -2
  129. package/node/v5.0.0/icon-button-size.test/actual.js +1 -3
  130. package/node/v5.0.0/icon-button-size.test/expected.js +1 -3
  131. package/node/v5.0.0/jss-to-styled.js +21 -103
  132. package/node/v5.0.0/jss-to-styled.test/Anonymous.actual.js +0 -9
  133. package/node/v5.0.0/jss-to-styled.test/Anonymous.expected.js +0 -8
  134. package/node/v5.0.0/jss-to-styled.test/eighth.actual.js +0 -30
  135. package/node/v5.0.0/jss-to-styled.test/eighth.expected.js +2 -31
  136. package/node/v5.0.0/jss-to-styled.test/eleventh.actual.js +0 -7
  137. package/node/v5.0.0/jss-to-styled.test/eleventh.expected.js +0 -7
  138. package/node/v5.0.0/jss-to-styled.test/exportClass.actual.js +0 -8
  139. package/node/v5.0.0/jss-to-styled.test/exportClass.expected.js +0 -10
  140. package/node/v5.0.0/jss-to-styled.test/exportFunction.actual.js +0 -8
  141. package/node/v5.0.0/jss-to-styled.test/exportFunction.expected.js +0 -9
  142. package/node/v5.0.0/jss-to-styled.test/fifth.actual.js +0 -12
  143. package/node/v5.0.0/jss-to-styled.test/fifth.expected.js +0 -12
  144. package/node/v5.0.0/jss-to-styled.test/first.actual.js +1 -32
  145. package/node/v5.0.0/jss-to-styled.test/first.expected.js +1 -32
  146. package/node/v5.0.0/jss-to-styled.test/fourth.actual.js +0 -11
  147. package/node/v5.0.0/jss-to-styled.test/fourth.expected.js +0 -12
  148. package/node/v5.0.0/jss-to-styled.test/multipleWithStyles.actual.js +0 -9
  149. package/node/v5.0.0/jss-to-styled.test/multipleWithStyles.expected.js +2 -9
  150. package/node/v5.0.0/jss-to-styled.test/nineth.actual.js +0 -8
  151. package/node/v5.0.0/jss-to-styled.test/nineth.expected.js +2 -8
  152. package/node/v5.0.0/jss-to-styled.test/second.actual.js +0 -13
  153. package/node/v5.0.0/jss-to-styled.test/second.expected.js +0 -13
  154. package/node/v5.0.0/jss-to-styled.test/seventh.actual.js +3 -27
  155. package/node/v5.0.0/jss-to-styled.test/seventh.expected.js +3 -26
  156. package/node/v5.0.0/jss-to-styled.test/sixth.actual.js +2 -23
  157. package/node/v5.0.0/jss-to-styled.test/sixth.expected.js +2 -22
  158. package/node/v5.0.0/jss-to-styled.test/tenth.actual.js +0 -6
  159. package/node/v5.0.0/jss-to-styled.test/tenth.expected.js +2 -7
  160. package/node/v5.0.0/jss-to-styled.test/third.actual.js +0 -11
  161. package/node/v5.0.0/jss-to-styled.test/third.expected.js +0 -12
  162. package/node/v5.0.0/jss-to-styled.test/twelfth.actual.js +0 -7
  163. package/node/v5.0.0/jss-to-styled.test/withCreateStyles.actual.js +0 -11
  164. package/node/v5.0.0/jss-to-styled.test/withCreateStyles.expected.js +0 -10
  165. package/node/v5.0.0/jss-to-styled.test/withCreateStyles1.actual.js +0 -12
  166. package/node/v5.0.0/jss-to-styled.test/withCreateStyles1.expected.js +0 -10
  167. package/node/v5.0.0/jss-to-styled.test/withCreateStyles2.actual.js +0 -12
  168. package/node/v5.0.0/jss-to-styled.test/withCreateStyles2.expected.js +0 -10
  169. package/node/v5.0.0/jss-to-styled.test/withCreateStyles3.actual.js +0 -11
  170. package/node/v5.0.0/jss-to-styled.test/withCreateStyles3.expected.js +0 -10
  171. package/node/v5.0.0/jss-to-tss-react.js +0 -70
  172. package/node/v5.0.0/jss-to-tss-react.test/actual-from-material-ui-core-styles.js +1 -8
  173. package/node/v5.0.0/jss-to-tss-react.test/actual-from-material-ui-core.js +0 -9
  174. package/node/v5.0.0/jss-to-tss-react.test/actual-from-mui-styles-makeStyles.js +0 -8
  175. package/node/v5.0.0/jss-to-tss-react.test/actual-from-mui-styles.js +0 -8
  176. package/node/v5.0.0/jss-to-tss-react.test/actual-mixins-pattern.js +1 -10
  177. package/node/v5.0.0/jss-to-tss-react.test/actual-todo-comments.js +3 -11
  178. package/node/v5.0.0/jss-to-tss-react.test/actual-typescript-docs-example-params.js +0 -7
  179. package/node/v5.0.0/jss-to-tss-react.test/actual-typescript-docs-example.js +0 -10
  180. package/node/v5.0.0/jss-to-tss-react.test/actual-typescript.js +1 -9
  181. package/node/v5.0.0/jss-to-tss-react.test/actual-withStyles.js +0 -16
  182. package/node/v5.0.0/jss-to-tss-react.test/expected-from-material-ui-core-styles.js +1 -8
  183. package/node/v5.0.0/jss-to-tss-react.test/expected-from-material-ui-core.js +0 -8
  184. package/node/v5.0.0/jss-to-tss-react.test/expected-from-mui-styles-makeStyles.js +0 -8
  185. package/node/v5.0.0/jss-to-tss-react.test/expected-from-mui-styles.js +0 -8
  186. package/node/v5.0.0/jss-to-tss-react.test/expected-mixins-pattern.js +1 -9
  187. package/node/v5.0.0/jss-to-tss-react.test/expected-todo-comments.js +16 -19
  188. package/node/v5.0.0/jss-to-tss-react.test/expected-typescript-docs-example-params.js +0 -5
  189. package/node/v5.0.0/jss-to-tss-react.test/expected-typescript-docs-example.js +0 -8
  190. package/node/v5.0.0/jss-to-tss-react.test/expected-typescript.js +1 -9
  191. package/node/v5.0.0/jss-to-tss-react.test/expected-withStyles.js +0 -17
  192. package/node/v5.0.0/link-underline-hover.js +1 -4
  193. package/node/v5.0.0/link-underline-hover.test/actual.js +1 -7
  194. package/node/v5.0.0/link-underline-hover.test/expected.js +1 -7
  195. package/node/v5.0.0/material-ui-styles.js +7 -11
  196. package/node/v5.0.0/material-ui-styles.test/core-import.actual.js +0 -1
  197. package/node/v5.0.0/material-ui-styles.test/core-import.expected.js +0 -12
  198. package/node/v5.0.0/material-ui-styles.test/expected.js +0 -12
  199. package/node/v5.0.0/material-ui-styles.test/single-import.expected.js +0 -1
  200. package/node/v5.0.0/material-ui-styles.test/types-import.actual.js +0 -1
  201. package/node/v5.0.0/material-ui-styles.test/types-import.expected.js +0 -2
  202. package/node/v5.0.0/material-ui-types.js +0 -5
  203. package/node/v5.0.0/modal-props.js +0 -7
  204. package/node/v5.0.0/modal-props.test/actual.js +1 -3
  205. package/node/v5.0.0/modal-props.test/expected.js +2 -3
  206. package/node/v5.0.0/moved-lab-modules.js +1 -4
  207. package/node/v5.0.0/moved-lab-modules.test/actual.js +0 -3
  208. package/node/v5.0.0/moved-lab-modules.test/expected.js +0 -3
  209. package/node/v5.0.0/mui-replace.js +0 -1
  210. package/node/v5.0.0/mui-replace.test/actual.js +12 -24
  211. package/node/v5.0.0/mui-replace.test/expected.js +12 -24
  212. package/node/v5.0.0/optimal-imports.js +0 -28
  213. package/node/v5.0.0/optimal-imports.test/actual.js +0 -11
  214. package/node/v5.0.0/optimal-imports.test/expected.js +0 -8
  215. package/node/v5.0.0/pagination-round-circular.js +0 -5
  216. package/node/v5.0.0/pagination-round-circular.test/actual.js +1 -3
  217. package/node/v5.0.0/pagination-round-circular.test/expected.js +1 -3
  218. package/node/v5.0.0/preset-safe.js +2 -53
  219. package/node/v5.0.0/preset-safe.test/actual.js +0 -41
  220. package/node/v5.0.0/preset-safe.test/expected.js +0 -43
  221. package/node/v5.0.0/root-ref.js +0 -1
  222. package/node/v5.0.0/root-ref.test/actual.js +1 -4
  223. package/node/v5.0.0/root-ref.test/expected.js +1 -2
  224. package/node/v5.0.0/skeleton-variant.js +0 -6
  225. package/node/v5.0.0/skeleton-variant.test/actual.js +1 -3
  226. package/node/v5.0.0/skeleton-variant.test/expected.js +1 -3
  227. package/node/v5.0.0/styled-engine-provider.js +1 -8
  228. package/node/v5.0.0/styled-engine-provider.test/mui-theme-provider.actual.js +0 -9
  229. package/node/v5.0.0/styled-engine-provider.test/mui-theme-provider.expected.js +0 -9
  230. package/node/v5.0.0/styled-engine-provider.test/theme-provider.actual.js +0 -9
  231. package/node/v5.0.0/styled-engine-provider.test/theme-provider.expected.js +0 -9
  232. package/node/v5.0.0/table-props.js +0 -6
  233. package/node/v5.0.0/table-props.test/actual.js +1 -5
  234. package/node/v5.0.0/table-props.test/expected.js +1 -5
  235. package/node/v5.0.0/tabs-scroll-buttons.js +0 -4
  236. package/node/v5.0.0/tabs-scroll-buttons.test/actual.js +1 -3
  237. package/node/v5.0.0/tabs-scroll-buttons.test/expected.js +1 -3
  238. package/node/v5.0.0/textarea-minmax-rows.js +0 -3
  239. package/node/v5.0.0/textarea-minmax-rows.test/actual.js +1 -3
  240. package/node/v5.0.0/textarea-minmax-rows.test/expected.js +1 -3
  241. package/node/v5.0.0/theme-augment.js +1 -8
  242. package/node/v5.0.0/theme-breakpoints-width.js +0 -1
  243. package/node/v5.0.0/theme-breakpoints.js +1 -3
  244. package/node/v5.0.0/theme-options.js +0 -1
  245. package/node/v5.0.0/theme-options.test/actual.js +0 -1
  246. package/node/v5.0.0/theme-options.test/expected.js +0 -1
  247. package/node/v5.0.0/theme-palette-mode.js +0 -1
  248. package/node/v5.0.0/theme-provider.js +0 -4
  249. package/node/v5.0.0/theme-provider.test/actual.js +0 -3
  250. package/node/v5.0.0/theme-provider.test/core-import.actual.js +0 -3
  251. package/node/v5.0.0/theme-provider.test/core-import.expected.js +0 -3
  252. package/node/v5.0.0/theme-provider.test/expected.js +0 -3
  253. package/node/v5.0.0/theme-spacing.js +12 -8
  254. package/node/v5.0.0/theme-spacing.test/actual.js +0 -1
  255. package/node/v5.0.0/theme-spacing.test/expected.js +0 -2
  256. package/node/v5.0.0/theme-spacing.test/large-actual.js +5 -56
  257. package/node/v5.0.0/theme-spacing.test/large-expected.js +5 -56
  258. package/node/v5.0.0/theme-typography-round.js +0 -1
  259. package/node/v5.0.0/top-level-imports.js +0 -22
  260. package/node/v5.0.0/top-level-imports.test/actual.js +0 -60
  261. package/node/v5.0.0/top-level-imports.test/expected.js +0 -4
  262. package/node/v5.0.0/transitions.js +0 -6
  263. package/node/v5.0.0/transitions.test/actual.js +1 -4
  264. package/node/v5.0.0/transitions.test/expected.js +2 -4
  265. package/node/v5.0.0/use-autocomplete.js +0 -3
  266. package/node/v5.0.0/use-autocomplete.test/actual.js +0 -1
  267. package/node/v5.0.0/use-autocomplete.test/expected.js +0 -3
  268. package/node/v5.0.0/use-transitionprops.js +1 -4
  269. package/node/v5.0.0/use-transitionprops.test/actual.js +1 -3
  270. package/node/v5.0.0/use-transitionprops.test/expected.js +1 -3
  271. package/node/v5.0.0/variant-prop.js +0 -4
  272. package/node/v5.0.0/variant-prop.test/actual.js +0 -15
  273. package/node/v5.0.0/variant-prop.test/expected.js +0 -15
  274. package/node/v5.0.0/with-mobile-dialog.js +0 -5
  275. package/node/v5.0.0/with-mobile-dialog.test/actual.js +0 -9
  276. package/node/v5.0.0/with-mobile-dialog.test/expected.js +2 -11
  277. package/node/v5.0.0/with-width.js +0 -4
  278. package/node/v5.0.0/with-width.test/actual.js +0 -9
  279. package/node/v5.0.0/with-width.test/expected.js +2 -11
  280. package/package.json +6 -6
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _core = require("@material-ui/core");
6
-
7
5
  var _GridListTileBar = _interopRequireDefault(require("@material-ui/core/GridListTileBar"));
8
-
9
6
  var _other = _interopRequireDefault(require("./other"));
10
-
11
7
  var _jsxRuntime = require("react/jsx-runtime");
12
-
13
8
  // import GridList from '@material-ui/core/GridList';
14
9
  // import GridListTile from '@material-ui/core/GridListTile';
15
10
 
16
- /*#__PURE__*/
17
- (0, _jsxRuntime.jsxs)(_core.GridList, {
11
+ /*#__PURE__*/(0, _jsxRuntime.jsxs)(_core.GridList, {
18
12
  cellHeight: "auto",
19
13
  cols: numOfCols,
20
14
  children: [items.map(({
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _core = require("@material-ui/core");
6
-
7
5
  var _ImageListItemBar = _interopRequireDefault(require("@material-ui/core/ImageListItemBar"));
8
-
9
6
  var _other = _interopRequireDefault(require("./other"));
10
-
11
7
  var _jsxRuntime = require("react/jsx-runtime");
12
-
13
8
  // import ImageList from '@material-ui/core/ImageList';
14
9
  // import ImageListItem from '@material-ui/core/ImageListItem';
15
10
 
16
- /*#__PURE__*/
17
- (0, _jsxRuntime.jsxs)(_core.ImageList, {
11
+ /*#__PURE__*/(0, _jsxRuntime.jsxs)(_core.ImageList, {
18
12
  cellHeight: "auto",
19
13
  cols: numOfCols,
20
14
  children: [items.map(({
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = transformer;
9
-
10
8
  var _renameProps = _interopRequireDefault(require("../util/renameProps"));
11
-
12
9
  /**
13
10
  * @param {import('jscodeshift').FileInfo} file
14
11
  * @param {import('jscodeshift').API} api
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = transformer;
7
-
8
7
  /**
9
8
  * @param {import('jscodeshift').FileInfo} file
10
9
  * @param {import('jscodeshift').API} api
@@ -16,7 +15,6 @@ function transformer(file, api, options) {
16
15
  const hasSizeAttribute = path.node.openingElement.attributes.some(node => {
17
16
  return node.type === 'JSXAttribute' && node.name.name === 'size';
18
17
  });
19
-
20
18
  if (!hasSizeAttribute) {
21
19
  path.node.openingElement.attributes.push(j.jsxAttribute(j.jsxIdentifier('size'), j.literal('large')));
22
20
  }
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _jsxRuntime = require("react/jsx-runtime");
4
-
5
- /*#__PURE__*/
6
- (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
4
+ /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
7
5
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(IconButton, {
8
6
  size: "small"
9
7
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(IconButton, {
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _jsxRuntime = require("react/jsx-runtime");
4
-
5
- /*#__PURE__*/
6
- (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
4
+ /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
7
5
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(IconButton, {
8
6
  size: "small"
9
7
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(IconButton, {
@@ -4,109 +4,94 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = transformer;
7
-
8
7
  const nodePath = require('path');
8
+
9
9
  /**
10
10
  * @param {import('jscodeshift').FileInfo} file
11
11
  * @param {import('jscodeshift').API} api
12
12
  */
13
-
14
-
15
13
  function transformer(file, api, options) {
16
14
  const j = api.jscodeshift;
17
15
  const root = j(file.source);
16
+
18
17
  /**
19
18
  * @param {string} filePath
20
19
  * @example computePrefixFromPath('/a/b/c/Anonymous.tsx') === 'Anonymous'
21
20
  * @example computePrefixFromPath('/a/b/c/Anonymous.server.tsx') === 'Anonymous'
22
21
  */
23
-
24
22
  function computePrefixFromPath(filePath) {
25
23
  return nodePath.basename(filePath, nodePath.extname(filePath)).split('.')[0];
26
24
  }
25
+
27
26
  /**
28
27
  *
29
28
  * @param {import('jscodeshift').CallExpression} withStylesCall
30
29
  */
31
-
32
-
33
30
  function getPrefix(withStylesCall) {
34
- let prefix; // 1. check from withStylesFn
31
+ let prefix;
35
32
 
33
+ // 1. check from withStylesFn
36
34
  if (withStylesCall && withStylesCall.arguments[1] && withStylesCall.arguments[1].properties) {
37
35
  const name = withStylesCall.arguments[1].properties.find(prop => prop.key.name === 'name');
38
36
  prefix = name.value.value;
39
37
  }
40
-
41
38
  if (!prefix) {
42
39
  // 2. check name from export default
43
40
  root.find(j.ExportDefaultDeclaration).forEach(path => {
44
41
  prefix = path.node.declaration.name;
45
42
  });
46
43
  }
47
-
48
44
  if (!prefix) {
49
45
  // 3. use name export that is Capitalize
50
46
  root.find(j.ExportNamedDeclaration).forEach(path => {
51
47
  if (path.node.declaration.type !== 'VariableDeclaration') {
52
48
  return;
53
49
  }
54
-
55
50
  const name = path.node.declaration.declarations[0].id.name;
56
-
57
51
  if (!prefix && name.match(/^[A-Z]/)) {
58
52
  prefix = name;
59
53
  }
60
54
  });
61
55
  }
62
-
63
56
  if (!prefix) {
64
57
  prefix = computePrefixFromPath(file.path);
65
58
  }
66
-
67
59
  return prefix;
68
60
  }
69
-
70
61
  function getFirstJsxName() {
71
62
  const matches = file.source.match(/<\/?(\w*)[\s\S]*?>/gm);
72
-
73
63
  if (matches) {
74
- const closingTag = matches.slice(-1)[0]; // Self closing tag
64
+ const closingTag = matches.slice(-1)[0];
75
65
 
66
+ // Self closing tag
76
67
  if (closingTag.endsWith('/>') && closingTag !== '</>') {
77
68
  const end = closingTag.indexOf(' ') > 0 ? closingTag.indexOf(' ') : closingTag.length - 1;
78
69
  return closingTag.substring(1, end);
79
70
  }
80
-
81
71
  return closingTag.substring(2, closingTag.length - 1);
82
72
  }
83
-
84
73
  return null;
85
74
  }
86
-
87
75
  function getRootClassKeys() {
88
76
  const name = getFirstJsxName();
89
-
90
77
  if (name) {
91
78
  const rootClassKeys = [];
92
79
  root.findJSXElements(name).at(0).forEach(path => {
93
80
  const existingClassName = path.node.openingElement.attributes.find(attr => attr.name && attr.name.name === 'className');
94
-
95
81
  if (existingClassName) {
96
- if (existingClassName.value.type === 'StringLiteral') {// className="string"
82
+ if (existingClassName.value.type === 'StringLiteral') {
83
+ // className="string"
97
84
  }
98
-
99
85
  if (existingClassName.value.type === 'JSXExpressionContainer') {
100
- if (existingClassName.value.expression.type === 'StringLiteral') {// className={'string'}
86
+ if (existingClassName.value.expression.type === 'StringLiteral') {
87
+ // className={'string'}
101
88
  }
102
-
103
89
  if (existingClassName.value.expression.type === 'MemberExpression') {
104
90
  // className={classes.root}
105
91
  if (existingClassName.value.expression.object.name === 'classes') {
106
92
  rootClassKeys.push(existingClassName.value.expression.property.name);
107
93
  }
108
94
  }
109
-
110
95
  if (existingClassName.value.expression.type === 'CallExpression') {
111
96
  // className={clsx(classes.root)}
112
97
  existingClassName.value.expression.arguments.forEach(arg => {
@@ -115,7 +100,6 @@ function transformer(file, api, options) {
115
100
  rootClassKeys.push(arg.property.name);
116
101
  }
117
102
  }
118
-
119
103
  if (arg.type === 'ObjectExpression') {
120
104
  arg.properties.forEach(prop => {
121
105
  if (prop.key.object && prop.key.object.name === 'classes') {
@@ -130,22 +114,17 @@ function transformer(file, api, options) {
130
114
  });
131
115
  return rootClassKeys;
132
116
  }
133
-
134
117
  return [];
135
118
  }
136
-
137
119
  function isTagNameFragment(tagName) {
138
120
  return tagName === 'React.Fragment' || tagName === 'Fragment' || tagName === '';
139
121
  }
140
-
141
122
  function isTagNameSuspense(tagName) {
142
123
  return tagName === 'React.Suspense' || tagName === 'Suspense';
143
124
  }
144
-
145
125
  function createStyledComponent(componentName, styledComponentName, stylesFn) {
146
126
  let styleArg = null;
147
127
  const rootIsFragment = isTagNameFragment(componentName);
148
-
149
128
  if (rootIsFragment) {
150
129
  // The root is React.Fragment
151
130
  styleArg = j.stringLiteral('div');
@@ -155,23 +134,18 @@ function transformer(file, api, options) {
155
134
  } else {
156
135
  styleArg = j.stringLiteral(componentName);
157
136
  }
158
-
159
137
  const declaration = j.variableDeclaration('const', [j.variableDeclarator(j.identifier(styledComponentName), j.callExpression(j.callExpression(j.identifier('styled'), [styleArg]), [stylesFn]))]);
160
-
161
138
  if (rootIsFragment) {
162
139
  declaration.comments = [j.commentLine(' TODO jss-to-styled codemod: The Fragment root was replaced by div. Change the tag if needed.')];
163
140
  }
164
-
165
141
  return declaration;
166
142
  }
167
-
168
143
  const classesCount = {};
169
144
  /**
170
145
  *
171
146
  * @param {import('jscodeshift').ObjectExpression} objExpression
172
147
  * @param {import('jscodeshift').ObjectExpression} prevObj
173
148
  */
174
-
175
149
  function createClasses(objExpression, prevObj) {
176
150
  const classes = prevObj || j.objectExpression([]);
177
151
  objExpression.properties.forEach(prop => {
@@ -180,7 +154,6 @@ function transformer(file, api, options) {
180
154
  } else {
181
155
  classesCount[prop.key.name] += 1;
182
156
  }
183
-
184
157
  const resolvedKey = classesCount[prop.key.name] === 1 ? prop.key.name : `${prop.key.name}${classesCount[prop.key.name]}`;
185
158
  classes.properties.push(j.objectProperty(j.identifier(resolvedKey), j.templateLiteral([j.templateElement({
186
159
  raw: '',
@@ -192,80 +165,66 @@ function transformer(file, api, options) {
192
165
  });
193
166
  return classes;
194
167
  }
168
+
195
169
  /**
196
170
  *
197
171
  * @param {import('jscodeshift').ArrowFunctionExpression | import('jscodeshift').FunctionDeclaration} functionExpression
198
172
  */
199
-
200
-
201
173
  function getReturnStatement(functionExpression) {
202
174
  if (functionExpression.type === 'ObjectExpression') {
203
175
  return functionExpression;
204
176
  }
205
-
206
177
  if (functionExpression.type === 'ArrowFunctionExpression') {
207
178
  if (functionExpression.body.type === 'BlockStatement') {
208
179
  const returnStatement = functionExpression.body.body.find(b => b.type === 'ReturnStatement');
209
180
  return returnStatement.argument;
210
181
  }
211
-
212
182
  if (functionExpression.body.type === 'ObjectExpression') {
213
183
  return functionExpression.body;
214
184
  }
215
-
216
185
  if (functionExpression.body.type === 'CallExpression') {
217
186
  if (functionExpression.body.callee.name === 'createStyles') {
218
187
  return functionExpression.body.arguments[0];
219
188
  }
220
189
  }
221
190
  }
222
-
223
191
  if (functionExpression.type === 'FunctionDeclaration') {
224
192
  const returnStatement = functionExpression.body.body.find(b => b.type === 'ReturnStatement');
225
193
  return returnStatement.argument;
226
194
  }
227
-
228
195
  if (functionExpression.type === 'CallExpression') {
229
196
  if (functionExpression.callee.name === 'createStyles') {
230
197
  return functionExpression.arguments[0];
231
198
  }
232
199
  }
233
-
234
200
  return null;
235
201
  }
202
+
236
203
  /**
237
204
  * @param {import('jscodeshift').ObjectExpression | import('jscodeshift').ArrowFunctionExpression | import('jscodeshift').FunctionDeclaration} expression
238
205
  */
239
-
240
-
241
206
  function getObjectExpression(expression) {
242
207
  let objectExpression;
243
-
244
208
  if (expression.type === 'ObjectExpression') {
245
209
  objectExpression = expression;
246
210
  }
247
-
248
211
  if (expression.type === 'ArrowFunctionExpression') {
249
212
  if (expression.body.type === 'BlockStatement') {
250
213
  const returnStatement = expression.body.body.find(b => b.type === 'ReturnStatement');
251
214
  objectExpression = returnStatement.argument;
252
215
  }
253
-
254
216
  if (expression.body.type === 'ObjectExpression') {
255
217
  expression.body.extra.parenthesized = false;
256
218
  objectExpression = expression.body;
257
219
  }
258
220
  }
259
-
260
221
  if (expression.type === 'FunctionDeclaration') {
261
222
  expression.type = 'FunctionExpression';
262
223
  const returnStatement = expression.body.body.find(b => b.type === 'ReturnStatement');
263
224
  objectExpression = returnStatement.argument;
264
225
  }
265
-
266
226
  return objectExpression;
267
227
  }
268
-
269
228
  const stylesCount = {};
270
229
  /**
271
230
  *
@@ -273,10 +232,8 @@ function transformer(file, api, options) {
273
232
  * @param {string[]} rootKeys
274
233
  * @param {import('jscodeshift').ObjectExpression | import('jscodeshift').ArrowFunctionExpression | import('jscodeshift').FunctionDeclaration} prevStyleArg
275
234
  */
276
-
277
- function convertToStyledArg(functionExpression, rootKeys = [], prevStyleArg) {
235
+ function convertToStyledArg(functionExpression, rootKeys, prevStyleArg) {
278
236
  const objectExpression = getObjectExpression(functionExpression);
279
-
280
237
  if (objectExpression) {
281
238
  objectExpression.properties.forEach(prop => {
282
239
  if (!stylesCount[prop.key.name]) {
@@ -284,7 +241,6 @@ function transformer(file, api, options) {
284
241
  } else {
285
242
  stylesCount[prop.key.name] += 1;
286
243
  }
287
-
288
244
  const resolvedKey = stylesCount[prop.key.name] === 1 ? prop.key.name : `${prop.key.name}${stylesCount[prop.key.name]}`;
289
245
  const selector = rootKeys.includes(resolvedKey) ? '&.' : '& .';
290
246
  prop.key = j.templateLiteral([j.templateElement({
@@ -298,41 +254,34 @@ function transformer(file, api, options) {
298
254
  return prop;
299
255
  });
300
256
  }
301
-
302
257
  if (functionExpression.params) {
303
258
  functionExpression.params = functionExpression.params.map(param => {
304
259
  if (param.type === 'ObjectPattern') {
305
260
  return j.objectPattern([j.objectProperty(j.identifier('theme'), param)]);
306
261
  }
307
-
308
262
  const prop = j.objectProperty(param, param);
309
263
  prop.shorthand = true;
310
264
  return j.objectPattern([prop]);
311
265
  });
312
266
  }
313
-
314
267
  if (prevStyleArg) {
315
268
  const prevObjectExpression = getObjectExpression(prevStyleArg);
316
-
317
269
  if (objectExpression) {
318
270
  // merge object
319
271
  prevObjectExpression.properties = [...prevObjectExpression.properties, ...objectExpression.properties];
320
272
  }
321
-
322
273
  if (functionExpression.params && prevStyleArg.type === 'ObjectExpression') {
323
274
  // turn prevStyleArg to ArrowFunction
324
275
  prevStyleArg = j.arrowFunctionExpression(functionExpression.params, prevStyleArg);
325
276
  }
326
-
327
277
  return prevStyleArg;
328
278
  }
329
-
330
279
  return functionExpression;
331
280
  }
332
-
333
281
  const printOptions = options.printOptions || {
334
282
  quote: 'single'
335
283
  };
284
+
336
285
  /**
337
286
  * find withStyles, makeStyles arg variable
338
287
  * ex. withStyles(styles, options)
@@ -356,24 +305,19 @@ function transformer(file, api, options) {
356
305
  name: 'makeStyles'
357
306
  }
358
307
  }).nodes()[0];
359
-
360
308
  if (!withStylesCall && !makeStylesCall) {
361
309
  return file.source;
362
310
  }
363
-
364
311
  const rootJsxName = getFirstJsxName();
365
-
366
312
  if (isTagNameSuspense(rootJsxName)) {
367
313
  return file.source;
368
314
  }
369
-
370
315
  const styledComponentName = rootJsxName.match(/^[A-Z]/) && !isTagNameFragment(rootJsxName) ? `Styled${rootJsxName}`.replace('.', '') : 'Root';
371
316
  const prefix = getPrefix(withStylesCall || makeStylesCall);
372
317
  const rootClassKeys = getRootClassKeys();
373
318
  const result = {};
374
319
  const componentClassesCount = {};
375
320
  const withStylesComponents = [];
376
-
377
321
  if (withStylesCall) {
378
322
  let stylesFnName;
379
323
  root.find(j.CallExpression, {
@@ -382,13 +326,10 @@ function transformer(file, api, options) {
382
326
  }
383
327
  }).forEach(path => {
384
328
  const arg = path.node.arguments[0];
385
-
386
329
  if (arg.type === 'Identifier') {
387
330
  stylesFnName = arg.name;
388
331
  }
389
-
390
332
  const objectExpression = getReturnStatement(arg);
391
-
392
333
  if (objectExpression) {
393
334
  // do this first, because objectExpression will be mutated in `createClasses` below.
394
335
  if (path.parent.parent && path.parent.parent.node.id) {
@@ -401,13 +342,11 @@ function transformer(file, api, options) {
401
342
  } else {
402
343
  componentClassesCount[prop.key.name] += 1;
403
344
  }
404
-
405
345
  const resolvedKey = componentClassesCount[prop.key.name] === 1 ? prop.key.name : `${prop.key.name}${componentClassesCount[prop.key.name]}`;
406
346
  return j.property('init', j.identifier(prop.key.name), j.memberExpression(j.identifier('classes'), j.identifier(resolvedKey)));
407
347
  }))
408
348
  });
409
349
  }
410
-
411
350
  result.classes = createClasses(objectExpression, result.classes);
412
351
  result.styledArg = convertToStyledArg(arg, rootClassKeys, result.styledArg);
413
352
  }
@@ -419,7 +358,6 @@ function transformer(file, api, options) {
419
358
  }).forEach(path => {
420
359
  let fnArg = path.node.init;
421
360
  const objectExpression = getReturnStatement(fnArg);
422
-
423
361
  if (fnArg.type === 'ArrowFunctionExpression') {
424
362
  if (fnArg.body.type === 'CallExpression') {
425
363
  if (fnArg.body.callee.name === 'createStyles') {
@@ -427,13 +365,11 @@ function transformer(file, api, options) {
427
365
  }
428
366
  }
429
367
  }
430
-
431
368
  if (fnArg.type === 'CallExpression') {
432
369
  if (fnArg.callee.name === 'createStyles') {
433
370
  fnArg = fnArg.arguments[0];
434
371
  }
435
372
  }
436
-
437
373
  if (objectExpression) {
438
374
  result.classes = createClasses(objectExpression, result.classes);
439
375
  result.styledArg = convertToStyledArg(fnArg, rootClassKeys);
@@ -449,7 +385,6 @@ function transformer(file, api, options) {
449
385
  result.styledArg = convertToStyledArg(path.node, rootClassKeys);
450
386
  }).remove();
451
387
  }
452
-
453
388
  if (makeStylesCall) {
454
389
  let stylesFnName;
455
390
  root.find(j.CallExpression, {
@@ -458,13 +393,10 @@ function transformer(file, api, options) {
458
393
  }
459
394
  }).at(0).forEach(path => {
460
395
  let arg = path.node.arguments[0];
461
-
462
396
  if (arg.type === 'Identifier') {
463
397
  stylesFnName = arg.name;
464
398
  }
465
-
466
399
  const objectExpression = getReturnStatement(arg);
467
-
468
400
  if (arg.type === 'ArrowFunctionExpression') {
469
401
  if (arg.body.type === 'CallExpression') {
470
402
  if (arg.body.callee.name === 'createStyles') {
@@ -472,13 +404,11 @@ function transformer(file, api, options) {
472
404
  }
473
405
  }
474
406
  }
475
-
476
407
  if (arg.type === 'CallExpression') {
477
408
  if (arg.callee.name === 'createStyles') {
478
409
  arg = arg.arguments[0];
479
410
  }
480
411
  }
481
-
482
412
  if (objectExpression) {
483
413
  result.classes = createClasses(objectExpression, result.classes);
484
414
  result.styledArg = convertToStyledArg(arg, rootClassKeys);
@@ -490,7 +420,6 @@ function transformer(file, api, options) {
490
420
  }
491
421
  }).at(0).forEach(path => {
492
422
  const objectExpression = getReturnStatement(path.node.init);
493
-
494
423
  if (objectExpression) {
495
424
  result.classes = createClasses(objectExpression, result.classes);
496
425
  result.styledArg = convertToStyledArg(path.node.init, rootClassKeys);
@@ -507,16 +436,14 @@ function transformer(file, api, options) {
507
436
  }).remove();
508
437
  root.find(j.VariableDeclaration).filter(path => path.node.declarations.some(d => d.id.name === 'useStyles')).remove();
509
438
  }
439
+
510
440
  /**
511
441
  * create `classes`
512
442
  * create styled `Root`
513
443
  */
514
-
515
-
516
444
  root.find(j.ImportDeclaration).at(-1).forEach(path => {
517
445
  path.insertAfter(j.variableDeclaration('const', [j.variableDeclarator(j.identifier('PREFIX'), j.stringLiteral(prefix))]), j.variableDeclaration('const', [j.variableDeclarator(j.identifier('classes'), result.classes)]), createStyledComponent(rootJsxName, styledComponentName, result.styledArg));
518
446
  });
519
-
520
447
  function transformJsxRootToStyledComponent(path) {
521
448
  if (path.node.openingFragment) {
522
449
  path.node.type = 'JSXElement';
@@ -530,23 +457,20 @@ function transformer(file, api, options) {
530
457
  };
531
458
  } else if (path.node.openingElement && path.node.openingElement.name && path.node.openingElement.name.name === undefined) {
532
459
  path.node.openingElement.name = styledComponentName;
533
-
534
460
  if (path.node.closingElement) {
535
461
  path.node.closingElement.name = styledComponentName;
536
462
  }
537
463
  } else {
538
464
  path.node.openingElement.name.name = styledComponentName;
539
-
540
465
  if (path.node.closingElement) {
541
466
  path.node.closingElement.name.name = styledComponentName;
542
467
  }
543
468
  }
544
469
  }
470
+
545
471
  /**
546
472
  * apply <StyledComponent />
547
473
  */
548
-
549
-
550
474
  if (rootJsxName === '') {
551
475
  root.find(j.JSXFragment).at(0).forEach(transformJsxRootToStyledComponent);
552
476
  } else if (rootJsxName.indexOf('.') > 0) {
@@ -554,7 +478,6 @@ function transformer(file, api, options) {
554
478
  root.find(j.JSXElement).forEach(path => {
555
479
  if (!converted && path.node.openingElement.name.type === 'JSXMemberExpression') {
556
480
  const tagName = `${path.node.openingElement.name.object.name}.${path.node.openingElement.name.property.name}`;
557
-
558
481
  if (tagName === rootJsxName) {
559
482
  converted = true;
560
483
  transformJsxRootToStyledComponent(path);
@@ -564,12 +487,11 @@ function transformer(file, api, options) {
564
487
  } else {
565
488
  root.findJSXElements(rootJsxName).at(0).forEach(transformJsxRootToStyledComponent);
566
489
  }
490
+
567
491
  /**
568
492
  * Attach classes to components created by withStyles
569
493
  * ex. const Button1 = withStyles(...)(Button)
570
494
  */
571
-
572
-
573
495
  withStylesComponents.forEach(data => {
574
496
  root.find(j.JSXOpeningElement, {
575
497
  name: {
@@ -579,41 +501,37 @@ function transformer(file, api, options) {
579
501
  if (!path.node.attributes) {
580
502
  path.node.attributes = [];
581
503
  }
582
-
583
504
  path.node.attributes.push(j.jsxAttribute(j.jsxIdentifier('classes'), j.jsxExpressionContainer(data.classes)));
584
505
  });
585
506
  });
507
+
586
508
  /**
587
509
  * import styled if not exist
588
510
  */
589
-
590
511
  const imports = root.find(j.ImportDeclaration).filter(({
591
512
  node
592
513
  }) => node.source.value.match(/^@material-ui\/core\/styles$/)).forEach(({
593
514
  node
594
515
  }) => {
595
516
  const existed = node.specifiers.find(s => s.imported.name === 'styled');
596
-
597
517
  if (!existed) {
598
518
  node.specifiers.push(j.importSpecifier(j.identifier('styled')));
599
519
  }
600
520
  });
601
-
602
521
  if (!imports.size()) {
603
522
  root.find(j.ImportDeclaration).at(0).forEach(path => path.insertAfter(j.importDeclaration([j.importSpecifier(j.identifier('styled'))], j.literal('@mui/material/styles'))));
604
523
  }
524
+
605
525
  /**
606
526
  * remove import
607
527
  */
608
-
609
-
610
528
  root.find(j.ImportDeclaration).filter(path => path.node.source.value.match(/^(@material-ui|@mui)\/styles\/?(withStyles|makeStyles|createStyles)?$/)).forEach(path => {
611
529
  path.node.specifiers = path.node.specifiers.filter(s => s.local.name !== 'withStyles' && s.local.name !== 'makeStyles' && s.local.name !== 'createStyles');
612
530
  }).filter(path => !path.node.specifiers.length).remove();
531
+
613
532
  /**
614
533
  * remove withStyles calls that create new component
615
534
  */
616
-
617
535
  root.find(j.CallExpression, {
618
536
  callee: {
619
537
  name: 'withStyles'
@@ -1,26 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var _withStyles = _interopRequireDefault(require("@material-ui/styles/withStyles"));
13
-
14
10
  var _jsxRuntime = require("react/jsx-runtime");
15
-
16
11
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
-
18
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
-
20
13
  const styles = {
21
14
  root: {}
22
15
  };
23
-
24
16
  var _default = (0, _withStyles.default)(styles)(props => {
25
17
  const {
26
18
  classes
@@ -30,5 +22,4 @@ var _default = (0, _withStyles.default)(styles)(props => {
30
22
  children: "Anonymous"
31
23
  });
32
24
  });
33
-
34
25
  exports.default = _default;