@mui/codemod 5.10.12 → 5.10.16
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/util/getJSExports.js +0 -6
- package/node/util/memoize.js +0 -4
- package/node/util/propsToObject.js +0 -6
- package/node/util/readFile.js +0 -6
- package/node/util/renameClassKey.js +0 -2
- package/node/util/renameProps.js +0 -1
- package/node/v0.15.0/import-path.js +0 -6
- package/node/v0.15.0/import-path.test/actual.js +0 -5
- package/node/v0.15.0/import-path.test/expected.js +0 -5
- package/node/v1.0.0/color-imports.js +12 -17
- package/node/v1.0.0/color-imports.test/actual.js +0 -3
- package/node/v1.0.0/color-imports.test/expected.js +0 -9
- package/node/v1.0.0/import-path.js +4 -8
- package/node/v1.0.0/import-path.test/actual.js +0 -28
- package/node/v1.0.0/import-path.test/expected.js +0 -61
- package/node/v1.0.0/menu-item-primary-text.js +0 -2
- package/node/v1.0.0/menu-item-primary-text.test/actual.js +1 -3
- package/node/v1.0.0/menu-item-primary-text.test/expected.js +1 -3
- package/node/v1.0.0/svg-icon-imports.js +6 -7
- package/node/v1.0.0/svg-icon-imports.test/actual.js +0 -4
- package/node/v1.0.0/svg-icon-imports.test/expected.js +0 -4
- package/node/v4.0.0/optimal-imports.js +0 -26
- package/node/v4.0.0/optimal-imports.test/actual.js +0 -64
- package/node/v4.0.0/optimal-imports.test/expected.js +0 -62
- package/node/v4.0.0/theme-spacing-api.js +7 -19
- package/node/v4.0.0/theme-spacing-api.test/actual.js +0 -11
- package/node/v4.0.0/theme-spacing-api.test/actual_destructured.js +0 -9
- package/node/v4.0.0/theme-spacing-api.test/expected.js +0 -11
- package/node/v4.0.0/theme-spacing-api.test/expected_destructured.js +0 -9
- package/node/v4.0.0/top-level-imports.js +2 -22
- package/node/v4.0.0/top-level-imports.test/actual.js +0 -58
- package/node/v4.0.0/top-level-imports.test/expected.js +0 -3
- package/node/v5.0.0/adapter-v4.js +3 -11
- package/node/v5.0.0/adapter-v4.test/actual.js +0 -1
- package/node/v5.0.0/adapter-v4.test/core-import.actual.js +0 -2
- package/node/v5.0.0/adapter-v4.test/core-import.expected.js +0 -2
- package/node/v5.0.0/adapter-v4.test/expected.js +0 -1
- package/node/v5.0.0/adapter-v4.test/no-styles-import.actual.js +0 -2
- package/node/v5.0.0/adapter-v4.test/no-styles-import.expected.js +0 -3
- package/node/v5.0.0/autocomplete-rename-closeicon.js +0 -3
- package/node/v5.0.0/autocomplete-rename-closeicon.test/actual.js +1 -3
- package/node/v5.0.0/autocomplete-rename-closeicon.test/expected.js +1 -3
- package/node/v5.0.0/autocomplete-rename-option.js +0 -3
- package/node/v5.0.0/autocomplete-rename-option.test/actual.js +1 -3
- package/node/v5.0.0/autocomplete-rename-option.test/expected.js +1 -3
- package/node/v5.0.0/avatar-circle-circular.js +0 -4
- package/node/v5.0.0/avatar-circle-circular.test/actual.js +1 -3
- package/node/v5.0.0/avatar-circle-circular.test/expected.js +1 -3
- package/node/v5.0.0/badge-overlap-value.js +0 -6
- package/node/v5.0.0/badge-overlap-value.test/actual.js +1 -5
- package/node/v5.0.0/badge-overlap-value.test/expected.js +1 -5
- package/node/v5.0.0/base-rename-components-to-slots.js +1 -11
- package/node/v5.0.0/base-rename-components-to-slots.test/actual.js +3 -9
- package/node/v5.0.0/base-rename-components-to-slots.test/expected.js +3 -9
- package/node/v5.0.0/box-borderradius-values.js +2 -2
- package/node/v5.0.0/box-borderradius-values.test/actual.js +1 -3
- package/node/v5.0.0/box-borderradius-values.test/expected.js +1 -3
- package/node/v5.0.0/box-rename-css.js +0 -3
- package/node/v5.0.0/box-rename-css.test/actual.js +1 -3
- package/node/v5.0.0/box-rename-css.test/expected.js +1 -3
- package/node/v5.0.0/box-rename-gap.js +0 -3
- package/node/v5.0.0/box-rename-gap.test/actual.js +1 -3
- package/node/v5.0.0/box-rename-gap.test/expected.js +1 -3
- package/node/v5.0.0/box-sx-prop.js +1 -5
- package/node/v5.0.0/box-sx-prop.test/actual.js +0 -10
- package/node/v5.0.0/box-sx-prop.test/alias-actual.js +0 -5
- package/node/v5.0.0/box-sx-prop.test/alias-expected.js +0 -4
- package/node/v5.0.0/box-sx-prop.test/expected.js +0 -10
- package/node/v5.0.0/button-color-prop.js +0 -2
- package/node/v5.0.0/button-color-prop.test/actual.js +1 -3
- package/node/v5.0.0/button-color-prop.test/expected.js +1 -3
- package/node/v5.0.0/chip-variant-prop.js +0 -2
- package/node/v5.0.0/chip-variant-prop.test/actual.js +1 -3
- package/node/v5.0.0/chip-variant-prop.test/expected.js +1 -3
- package/node/v5.0.0/circularprogress-variant.js +0 -4
- package/node/v5.0.0/circularprogress-variant.test/actual.js +1 -3
- package/node/v5.0.0/circularprogress-variant.test/expected.js +1 -3
- package/node/v5.0.0/collapse-rename-collapsedheight.js +0 -4
- package/node/v5.0.0/collapse-rename-collapsedheight.test/actual.js +1 -3
- package/node/v5.0.0/collapse-rename-collapsedheight.test/expected.js +1 -3
- package/node/v5.0.0/component-rename-prop.js +0 -3
- package/node/v5.0.0/component-rename-prop.test/actual.js +1 -3
- package/node/v5.0.0/component-rename-prop.test/expected.js +1 -3
- package/node/v5.0.0/core-styles-import.js +0 -3
- package/node/v5.0.0/core-styles-import.test/actual.js +0 -4
- package/node/v5.0.0/create-theme.js +0 -5
- package/node/v5.0.0/create-theme.test/actual.js +0 -2
- package/node/v5.0.0/create-theme.test/core-import.actual.js +0 -1
- package/node/v5.0.0/create-theme.test/core-import.expected.js +0 -1
- package/node/v5.0.0/create-theme.test/custom-fn.actual.js +0 -6
- package/node/v5.0.0/create-theme.test/custom-fn.expected.js +0 -6
- package/node/v5.0.0/create-theme.test/expected.js +0 -2
- package/node/v5.0.0/date-pickers-moved-to-x.js +1 -10
- package/node/v5.0.0/date-pickers-moved-to-x.test/actual-sub-module.js +0 -31
- package/node/v5.0.0/date-pickers-moved-to-x.test/expected-root-community.js +0 -1
- package/node/v5.0.0/date-pickers-moved-to-x.test/expected-root-pro.js +0 -1
- package/node/v5.0.0/date-pickers-moved-to-x.test/expected-sub-module.js +0 -29
- package/node/v5.0.0/dialog-props.js +0 -1
- package/node/v5.0.0/dialog-props.test/actual.js +1 -3
- package/node/v5.0.0/dialog-props.test/expected.js +1 -3
- package/node/v5.0.0/dialog-title-props.js +0 -1
- package/node/v5.0.0/dialog-title-props.test/actual.js +1 -3
- package/node/v5.0.0/dialog-title-props.test/expected.js +1 -3
- package/node/v5.0.0/emotion-prepend-cache.js +0 -3
- package/node/v5.0.0/emotion-prepend-cache.test/custom-naming.actual.js +0 -2
- package/node/v5.0.0/emotion-prepend-cache.test/custom-naming.expected.js +0 -2
- package/node/v5.0.0/emotion-prepend-cache.test/default-naming.actual.js +0 -2
- package/node/v5.0.0/emotion-prepend-cache.test/default-naming.expected.js +0 -2
- package/node/v5.0.0/emotion-prepend-cache.test/replace-existing-prepend.actual.js +0 -2
- package/node/v5.0.0/emotion-prepend-cache.test/replace-existing-prepend.expected.js +0 -2
- package/node/v5.0.0/expansion-panel-component.js +0 -1
- package/node/v5.0.0/expansion-panel-component.test/actual.js +1 -8
- package/node/v5.0.0/expansion-panel-component.test/expected.js +1 -8
- package/node/v5.0.0/fab-variant.js +0 -4
- package/node/v5.0.0/fab-variant.test/actual.js +1 -3
- package/node/v5.0.0/fab-variant.test/expected.js +1 -3
- package/node/v5.0.0/fade-rename-alpha.js +0 -3
- package/node/v5.0.0/fade-rename-alpha.test/actual.js +0 -2
- package/node/v5.0.0/fade-rename-alpha.test/expected.js +0 -2
- package/node/v5.0.0/grid-justify-justifycontent.js +0 -3
- package/node/v5.0.0/grid-justify-justifycontent.test/actual.js +1 -3
- package/node/v5.0.0/grid-justify-justifycontent.test/expected.js +1 -3
- package/node/v5.0.0/grid-list-component.js +0 -1
- package/node/v5.0.0/grid-list-component.test/actual.js +1 -7
- package/node/v5.0.0/grid-list-component.test/expected.js +1 -7
- package/node/v5.0.0/hidden-down-props.js +0 -3
- package/node/v5.0.0/icon-button-size.js +0 -2
- package/node/v5.0.0/icon-button-size.test/actual.js +1 -3
- package/node/v5.0.0/icon-button-size.test/expected.js +1 -3
- package/node/v5.0.0/jss-to-styled.js +20 -102
- package/node/v5.0.0/jss-to-styled.test/Anonymous.actual.js +0 -9
- package/node/v5.0.0/jss-to-styled.test/Anonymous.expected.js +0 -8
- package/node/v5.0.0/jss-to-styled.test/eighth.actual.js +0 -30
- package/node/v5.0.0/jss-to-styled.test/eighth.expected.js +2 -31
- package/node/v5.0.0/jss-to-styled.test/eleventh.actual.js +0 -7
- package/node/v5.0.0/jss-to-styled.test/eleventh.expected.js +0 -7
- package/node/v5.0.0/jss-to-styled.test/exportClass.actual.js +0 -8
- package/node/v5.0.0/jss-to-styled.test/exportClass.expected.js +0 -10
- package/node/v5.0.0/jss-to-styled.test/exportFunction.actual.js +0 -8
- package/node/v5.0.0/jss-to-styled.test/exportFunction.expected.js +0 -9
- package/node/v5.0.0/jss-to-styled.test/fifth.actual.js +0 -12
- package/node/v5.0.0/jss-to-styled.test/fifth.expected.js +0 -12
- package/node/v5.0.0/jss-to-styled.test/first.actual.js +1 -32
- package/node/v5.0.0/jss-to-styled.test/first.expected.js +1 -32
- package/node/v5.0.0/jss-to-styled.test/fourth.actual.js +0 -11
- package/node/v5.0.0/jss-to-styled.test/fourth.expected.js +0 -12
- package/node/v5.0.0/jss-to-styled.test/multipleWithStyles.actual.js +0 -9
- package/node/v5.0.0/jss-to-styled.test/multipleWithStyles.expected.js +2 -9
- package/node/v5.0.0/jss-to-styled.test/nineth.actual.js +0 -8
- package/node/v5.0.0/jss-to-styled.test/nineth.expected.js +2 -8
- package/node/v5.0.0/jss-to-styled.test/second.actual.js +0 -13
- package/node/v5.0.0/jss-to-styled.test/second.expected.js +0 -13
- package/node/v5.0.0/jss-to-styled.test/seventh.actual.js +3 -27
- package/node/v5.0.0/jss-to-styled.test/seventh.expected.js +3 -26
- package/node/v5.0.0/jss-to-styled.test/sixth.actual.js +2 -23
- package/node/v5.0.0/jss-to-styled.test/sixth.expected.js +2 -22
- package/node/v5.0.0/jss-to-styled.test/tenth.actual.js +0 -6
- package/node/v5.0.0/jss-to-styled.test/tenth.expected.js +2 -7
- package/node/v5.0.0/jss-to-styled.test/third.actual.js +0 -11
- package/node/v5.0.0/jss-to-styled.test/third.expected.js +0 -12
- package/node/v5.0.0/jss-to-styled.test/twelfth.actual.js +0 -7
- package/node/v5.0.0/jss-to-styled.test/withCreateStyles.actual.js +0 -11
- package/node/v5.0.0/jss-to-styled.test/withCreateStyles.expected.js +0 -10
- package/node/v5.0.0/jss-to-styled.test/withCreateStyles1.actual.js +0 -12
- package/node/v5.0.0/jss-to-styled.test/withCreateStyles1.expected.js +0 -10
- package/node/v5.0.0/jss-to-styled.test/withCreateStyles2.actual.js +0 -12
- package/node/v5.0.0/jss-to-styled.test/withCreateStyles2.expected.js +0 -10
- package/node/v5.0.0/jss-to-styled.test/withCreateStyles3.actual.js +0 -11
- package/node/v5.0.0/jss-to-styled.test/withCreateStyles3.expected.js +0 -10
- package/node/v5.0.0/jss-to-tss-react.js +0 -70
- package/node/v5.0.0/jss-to-tss-react.test/actual-from-material-ui-core-styles.js +1 -8
- package/node/v5.0.0/jss-to-tss-react.test/actual-from-material-ui-core.js +0 -9
- package/node/v5.0.0/jss-to-tss-react.test/actual-from-mui-styles-makeStyles.js +0 -8
- package/node/v5.0.0/jss-to-tss-react.test/actual-from-mui-styles.js +0 -8
- package/node/v5.0.0/jss-to-tss-react.test/actual-mixins-pattern.js +1 -10
- package/node/v5.0.0/jss-to-tss-react.test/actual-todo-comments.js +0 -12
- package/node/v5.0.0/jss-to-tss-react.test/actual-typescript-docs-example-params.js +0 -7
- package/node/v5.0.0/jss-to-tss-react.test/actual-typescript-docs-example.js +0 -10
- package/node/v5.0.0/jss-to-tss-react.test/actual-typescript.js +1 -9
- package/node/v5.0.0/jss-to-tss-react.test/actual-withStyles.js +0 -16
- package/node/v5.0.0/jss-to-tss-react.test/expected-from-material-ui-core-styles.js +1 -8
- package/node/v5.0.0/jss-to-tss-react.test/expected-from-material-ui-core.js +0 -8
- package/node/v5.0.0/jss-to-tss-react.test/expected-from-mui-styles-makeStyles.js +0 -8
- package/node/v5.0.0/jss-to-tss-react.test/expected-from-mui-styles.js +0 -8
- package/node/v5.0.0/jss-to-tss-react.test/expected-mixins-pattern.js +1 -9
- package/node/v5.0.0/jss-to-tss-react.test/expected-todo-comments.js +13 -18
- package/node/v5.0.0/jss-to-tss-react.test/expected-typescript-docs-example-params.js +0 -5
- package/node/v5.0.0/jss-to-tss-react.test/expected-typescript-docs-example.js +0 -8
- package/node/v5.0.0/jss-to-tss-react.test/expected-typescript.js +1 -9
- package/node/v5.0.0/jss-to-tss-react.test/expected-withStyles.js +0 -17
- package/node/v5.0.0/link-underline-hover.js +1 -4
- package/node/v5.0.0/link-underline-hover.test/actual.js +1 -7
- package/node/v5.0.0/link-underline-hover.test/expected.js +1 -7
- package/node/v5.0.0/material-ui-styles.js +7 -11
- package/node/v5.0.0/material-ui-styles.test/core-import.actual.js +0 -1
- package/node/v5.0.0/material-ui-styles.test/core-import.expected.js +0 -12
- package/node/v5.0.0/material-ui-styles.test/expected.js +0 -12
- package/node/v5.0.0/material-ui-styles.test/single-import.expected.js +0 -1
- package/node/v5.0.0/material-ui-styles.test/types-import.actual.js +0 -1
- package/node/v5.0.0/material-ui-styles.test/types-import.expected.js +0 -2
- package/node/v5.0.0/material-ui-types.js +0 -5
- package/node/v5.0.0/modal-props.js +0 -7
- package/node/v5.0.0/modal-props.test/actual.js +1 -3
- package/node/v5.0.0/modal-props.test/expected.js +2 -3
- package/node/v5.0.0/moved-lab-modules.js +1 -4
- package/node/v5.0.0/moved-lab-modules.test/actual.js +0 -3
- package/node/v5.0.0/moved-lab-modules.test/expected.js +0 -3
- package/node/v5.0.0/mui-replace.js +0 -1
- package/node/v5.0.0/mui-replace.test/actual.js +12 -24
- package/node/v5.0.0/mui-replace.test/expected.js +12 -24
- package/node/v5.0.0/optimal-imports.js +0 -28
- package/node/v5.0.0/optimal-imports.test/actual.js +0 -11
- package/node/v5.0.0/optimal-imports.test/expected.js +0 -8
- package/node/v5.0.0/pagination-round-circular.js +0 -5
- package/node/v5.0.0/pagination-round-circular.test/actual.js +1 -3
- package/node/v5.0.0/pagination-round-circular.test/expected.js +1 -3
- package/node/v5.0.0/preset-safe.js +2 -53
- package/node/v5.0.0/preset-safe.test/actual.js +0 -41
- package/node/v5.0.0/preset-safe.test/expected.js +0 -43
- package/node/v5.0.0/root-ref.js +0 -1
- package/node/v5.0.0/root-ref.test/actual.js +1 -4
- package/node/v5.0.0/root-ref.test/expected.js +1 -2
- package/node/v5.0.0/skeleton-variant.js +0 -6
- package/node/v5.0.0/skeleton-variant.test/actual.js +1 -3
- package/node/v5.0.0/skeleton-variant.test/expected.js +1 -3
- package/node/v5.0.0/styled-engine-provider.js +1 -8
- package/node/v5.0.0/styled-engine-provider.test/mui-theme-provider.actual.js +0 -9
- package/node/v5.0.0/styled-engine-provider.test/mui-theme-provider.expected.js +0 -9
- package/node/v5.0.0/styled-engine-provider.test/theme-provider.actual.js +0 -9
- package/node/v5.0.0/styled-engine-provider.test/theme-provider.expected.js +0 -9
- package/node/v5.0.0/table-props.js +0 -6
- package/node/v5.0.0/table-props.test/actual.js +1 -5
- package/node/v5.0.0/table-props.test/expected.js +1 -5
- package/node/v5.0.0/tabs-scroll-buttons.js +0 -4
- package/node/v5.0.0/tabs-scroll-buttons.test/actual.js +1 -3
- package/node/v5.0.0/tabs-scroll-buttons.test/expected.js +1 -3
- package/node/v5.0.0/textarea-minmax-rows.js +0 -3
- package/node/v5.0.0/textarea-minmax-rows.test/actual.js +1 -3
- package/node/v5.0.0/textarea-minmax-rows.test/expected.js +1 -3
- package/node/v5.0.0/theme-augment.js +1 -8
- package/node/v5.0.0/theme-breakpoints-width.js +0 -1
- package/node/v5.0.0/theme-breakpoints.js +1 -3
- package/node/v5.0.0/theme-options.js +0 -1
- package/node/v5.0.0/theme-options.test/actual.js +0 -1
- package/node/v5.0.0/theme-options.test/expected.js +0 -1
- package/node/v5.0.0/theme-palette-mode.js +0 -1
- package/node/v5.0.0/theme-provider.js +0 -4
- package/node/v5.0.0/theme-provider.test/actual.js +0 -3
- package/node/v5.0.0/theme-provider.test/core-import.actual.js +0 -3
- package/node/v5.0.0/theme-provider.test/core-import.expected.js +0 -3
- package/node/v5.0.0/theme-provider.test/expected.js +0 -3
- package/node/v5.0.0/theme-spacing.js +12 -8
- package/node/v5.0.0/theme-spacing.test/actual.js +0 -1
- package/node/v5.0.0/theme-spacing.test/expected.js +0 -2
- package/node/v5.0.0/theme-spacing.test/large-actual.js +5 -56
- package/node/v5.0.0/theme-spacing.test/large-expected.js +5 -56
- package/node/v5.0.0/theme-typography-round.js +0 -1
- package/node/v5.0.0/top-level-imports.js +0 -22
- package/node/v5.0.0/top-level-imports.test/actual.js +0 -60
- package/node/v5.0.0/top-level-imports.test/expected.js +0 -4
- package/node/v5.0.0/transitions.js +0 -6
- package/node/v5.0.0/transitions.test/actual.js +1 -4
- package/node/v5.0.0/transitions.test/expected.js +2 -4
- package/node/v5.0.0/use-autocomplete.js +0 -3
- package/node/v5.0.0/use-autocomplete.test/actual.js +0 -1
- package/node/v5.0.0/use-autocomplete.test/expected.js +0 -3
- package/node/v5.0.0/use-transitionprops.js +1 -4
- package/node/v5.0.0/use-transitionprops.test/actual.js +1 -3
- package/node/v5.0.0/use-transitionprops.test/expected.js +1 -3
- package/node/v5.0.0/variant-prop.js +0 -4
- package/node/v5.0.0/variant-prop.test/actual.js +0 -15
- package/node/v5.0.0/variant-prop.test/expected.js +0 -15
- package/node/v5.0.0/with-mobile-dialog.js +0 -5
- package/node/v5.0.0/with-mobile-dialog.test/actual.js +0 -9
- package/node/v5.0.0/with-mobile-dialog.test/expected.js +2 -11
- package/node/v5.0.0/with-width.js +0 -4
- package/node/v5.0.0/with-width.test/actual.js +0 -9
- package/node/v5.0.0/with-width.test/expected.js +2 -11
- package/package.json +6 -6
|
@@ -5,27 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = transformer;
|
|
7
7
|
const ruleEndRegEx = /[^a-zA-Z0-9_]+/;
|
|
8
|
-
|
|
9
8
|
function transformNestedKeys(j, comments, propValueNode, ruleRegEx, nestedKeys) {
|
|
10
9
|
propValueNode.properties.forEach(prop => {
|
|
11
10
|
var _prop$value, _prop$value2;
|
|
12
|
-
|
|
13
11
|
if (((_prop$value = prop.value) == null ? void 0 : _prop$value.type) === 'ObjectExpression') {
|
|
14
12
|
if (typeof prop.key.value === 'string' && ruleRegEx !== null) {
|
|
15
13
|
let ruleIndex = prop.key.value.search(ruleRegEx);
|
|
16
14
|
let searchStartIndex = 0;
|
|
17
15
|
const elements = [];
|
|
18
16
|
const identifiers = [];
|
|
19
|
-
|
|
20
17
|
while (ruleIndex >= 0) {
|
|
21
18
|
const valueStartingAtRuleName = prop.key.value.substring(ruleIndex + 1);
|
|
22
19
|
const ruleEndIndex = valueStartingAtRuleName.search(ruleEndRegEx);
|
|
23
20
|
const ruleName = ruleEndIndex >= 0 ? prop.key.value.substring(ruleIndex + 1, ruleIndex + 1 + ruleEndIndex) : valueStartingAtRuleName;
|
|
24
|
-
|
|
25
21
|
if (!nestedKeys.includes(ruleName)) {
|
|
26
22
|
nestedKeys.push(ruleName);
|
|
27
23
|
}
|
|
28
|
-
|
|
29
24
|
const before = prop.key.value.substring(searchStartIndex, ruleIndex);
|
|
30
25
|
elements.push(j.templateElement({
|
|
31
26
|
raw: `${before}.`,
|
|
@@ -35,7 +30,6 @@ function transformNestedKeys(j, comments, propValueNode, ruleRegEx, nestedKeys)
|
|
|
35
30
|
searchStartIndex = ruleIndex + ruleName.length + 1;
|
|
36
31
|
const after = prop.key.value.substring(searchStartIndex);
|
|
37
32
|
ruleIndex = after.search(ruleRegEx);
|
|
38
|
-
|
|
39
33
|
if (ruleIndex >= 0) {
|
|
40
34
|
ruleIndex += searchStartIndex;
|
|
41
35
|
} else {
|
|
@@ -45,31 +39,26 @@ function transformNestedKeys(j, comments, propValueNode, ruleRegEx, nestedKeys)
|
|
|
45
39
|
}, false));
|
|
46
40
|
}
|
|
47
41
|
}
|
|
48
|
-
|
|
49
42
|
if (identifiers.length > 0) {
|
|
50
43
|
prop.key = j.templateLiteral(elements, identifiers);
|
|
51
44
|
prop.computed = true;
|
|
52
45
|
}
|
|
53
46
|
}
|
|
54
|
-
|
|
55
47
|
transformNestedKeys(j, comments, prop.value, ruleRegEx, nestedKeys);
|
|
56
48
|
} else if (((_prop$value2 = prop.value) == null ? void 0 : _prop$value2.type) === 'ArrowFunctionExpression') {
|
|
57
49
|
comments.push(j.commentLine(' TODO jss-to-tss-react codemod: Unable to handle style definition reliably. ArrowFunctionExpression in CSS prop.', true));
|
|
58
50
|
}
|
|
59
51
|
});
|
|
60
52
|
}
|
|
61
|
-
|
|
62
53
|
function transformStylesExpression(j, comments, stylesExpression, nestedKeys, setStylesExpression) {
|
|
63
54
|
const ruleNames = [];
|
|
64
55
|
const paramNames = [];
|
|
65
56
|
let objectExpression;
|
|
66
|
-
|
|
67
57
|
if (stylesExpression.type === 'ObjectExpression') {
|
|
68
58
|
objectExpression = stylesExpression;
|
|
69
59
|
} else if (stylesExpression.type === 'ArrowFunctionExpression') {
|
|
70
60
|
if (stylesExpression.body.type === 'BlockStatement') {
|
|
71
61
|
const returnStatement = stylesExpression.body.body.find(b => b.type === 'ReturnStatement');
|
|
72
|
-
|
|
73
62
|
if (returnStatement.argument.type === 'ObjectExpression') {
|
|
74
63
|
objectExpression = returnStatement.argument;
|
|
75
64
|
}
|
|
@@ -77,11 +66,9 @@ function transformStylesExpression(j, comments, stylesExpression, nestedKeys, se
|
|
|
77
66
|
objectExpression = stylesExpression.body;
|
|
78
67
|
}
|
|
79
68
|
}
|
|
80
|
-
|
|
81
69
|
if (objectExpression !== undefined) {
|
|
82
70
|
objectExpression.properties.forEach(prop => {
|
|
83
71
|
var _prop$key, _prop$key2;
|
|
84
|
-
|
|
85
72
|
if ((_prop$key = prop.key) != null && _prop$key.name) {
|
|
86
73
|
ruleNames.push(prop.key.name);
|
|
87
74
|
} else if (((_prop$key2 = prop.key) == null ? void 0 : _prop$key2.value) === '@global') {
|
|
@@ -94,7 +81,6 @@ function transformStylesExpression(j, comments, stylesExpression, nestedKeys, se
|
|
|
94
81
|
if (index > 0) {
|
|
95
82
|
ruleRegExString += '|';
|
|
96
83
|
}
|
|
97
|
-
|
|
98
84
|
ruleRegExString += `\\$${ruleName}`;
|
|
99
85
|
});
|
|
100
86
|
ruleRegExString += ')';
|
|
@@ -105,7 +91,6 @@ function transformStylesExpression(j, comments, stylesExpression, nestedKeys, se
|
|
|
105
91
|
if (prop.value.type === 'ArrowFunctionExpression' && prop.value.body.type === 'ObjectExpression' && prop.value.params[0].type === 'ObjectPattern') {
|
|
106
92
|
prop.value.params[0].properties.forEach(property => {
|
|
107
93
|
const name = property.key.name;
|
|
108
|
-
|
|
109
94
|
if (!paramNames.includes(name)) {
|
|
110
95
|
paramNames.push(name);
|
|
111
96
|
}
|
|
@@ -113,57 +98,44 @@ function transformStylesExpression(j, comments, stylesExpression, nestedKeys, se
|
|
|
113
98
|
prop.value = prop.value.body;
|
|
114
99
|
} else {
|
|
115
100
|
let extraComment = `Unexpected value type of ${prop.value.type}.`;
|
|
116
|
-
|
|
117
101
|
if (prop.value.type === 'ArrowFunctionExpression') {
|
|
118
102
|
if (prop.value.body.type === 'ObjectExpression') {
|
|
119
103
|
let example = '';
|
|
120
|
-
|
|
121
104
|
if (prop.value.params[0].type === 'Identifier') {
|
|
122
105
|
example = ' (e.g. `(props) => ({...})` instead of `({color}) => ({...})`)';
|
|
123
106
|
}
|
|
124
|
-
|
|
125
107
|
extraComment = ` Arrow function has parameter type of ${prop.value.params[0].type} instead of ObjectPattern${example}.`;
|
|
126
108
|
} else {
|
|
127
109
|
extraComment = ` Arrow function has body type of ${prop.value.body.type} instead of ObjectExpression.`;
|
|
128
110
|
}
|
|
129
111
|
}
|
|
130
|
-
|
|
131
112
|
comments.push(j.commentLine(` TODO jss-to-tss-react codemod: Unable to handle style definition reliably. Unsupported arrow function syntax.`, true));
|
|
132
113
|
comments.push(j.commentLine(extraComment, true));
|
|
133
114
|
return;
|
|
134
115
|
}
|
|
135
116
|
}
|
|
136
|
-
|
|
137
117
|
transformNestedKeys(j, comments, prop.value, ruleRegEx, nestedKeys);
|
|
138
118
|
}
|
|
139
119
|
});
|
|
140
|
-
|
|
141
120
|
if (paramNames.length > 0 || nestedKeys.length > 0) {
|
|
142
121
|
let arrowFunction;
|
|
143
|
-
|
|
144
122
|
if (stylesExpression.type === 'ArrowFunctionExpression') {
|
|
145
123
|
arrowFunction = stylesExpression;
|
|
146
124
|
} else {
|
|
147
125
|
arrowFunction = j.arrowFunctionExpression([], objectExpression);
|
|
148
126
|
setStylesExpression(arrowFunction);
|
|
149
127
|
}
|
|
150
|
-
|
|
151
128
|
if (arrowFunction.params.length === 0) {
|
|
152
129
|
arrowFunction.params.push(j.identifier('_theme'));
|
|
153
130
|
}
|
|
154
|
-
|
|
155
131
|
let paramsString = '_params';
|
|
156
|
-
|
|
157
132
|
if (paramNames.length > 0) {
|
|
158
133
|
paramsString = `{ ${paramNames.join(', ')} }`;
|
|
159
134
|
}
|
|
160
|
-
|
|
161
135
|
arrowFunction.params.push(j.identifier(paramsString));
|
|
162
|
-
|
|
163
136
|
if (nestedKeys.length > 0) {
|
|
164
137
|
arrowFunction.params.push(j.identifier('classes'));
|
|
165
138
|
}
|
|
166
|
-
|
|
167
139
|
if (arrowFunction.body.type === 'ObjectExpression') {
|
|
168
140
|
// In some cases, some needed parentheses were being lost without this.
|
|
169
141
|
arrowFunction.body = j.parenthesizedExpression(objectExpression);
|
|
@@ -171,35 +143,28 @@ function transformStylesExpression(j, comments, stylesExpression, nestedKeys, se
|
|
|
171
143
|
}
|
|
172
144
|
}
|
|
173
145
|
}
|
|
174
|
-
|
|
175
146
|
function addCommentsToNode(node, commentsToAdd, addToBeginning = false) {
|
|
176
147
|
if (!node.comments) {
|
|
177
148
|
node.comments = [];
|
|
178
149
|
}
|
|
179
|
-
|
|
180
150
|
if (addToBeginning) {
|
|
181
151
|
node.comments.unshift(...commentsToAdd);
|
|
182
152
|
} else {
|
|
183
153
|
node.comments.push(...commentsToAdd);
|
|
184
154
|
}
|
|
185
155
|
}
|
|
186
|
-
|
|
187
156
|
function addCommentsToDeclaration(declaration, commentsToAdd) {
|
|
188
157
|
let commentsPath = declaration;
|
|
189
|
-
|
|
190
158
|
if (declaration.parentPath.node.type === 'ExportNamedDeclaration') {
|
|
191
159
|
commentsPath = declaration.parentPath;
|
|
192
160
|
}
|
|
193
|
-
|
|
194
161
|
addCommentsToNode(commentsPath.node, commentsToAdd);
|
|
195
162
|
}
|
|
196
|
-
|
|
197
163
|
function addCommentsToClosestDeclaration(j, path, commentsToAdd) {
|
|
198
164
|
j(path).closest(j.VariableDeclaration).forEach(declaration => {
|
|
199
165
|
addCommentsToDeclaration(declaration, commentsToAdd);
|
|
200
166
|
});
|
|
201
167
|
}
|
|
202
|
-
|
|
203
168
|
function getFirstNode(j, root) {
|
|
204
169
|
return root.find(j.Program).get('body', 0).node;
|
|
205
170
|
}
|
|
@@ -207,8 +172,6 @@ function getFirstNode(j, root) {
|
|
|
207
172
|
* @param {import('jscodeshift').FileInfo} file
|
|
208
173
|
* @param {import('jscodeshift').API} api
|
|
209
174
|
*/
|
|
210
|
-
|
|
211
|
-
|
|
212
175
|
function transformer(file, api, options) {
|
|
213
176
|
const j = api.jscodeshift;
|
|
214
177
|
const root = j(file.source);
|
|
@@ -223,11 +186,9 @@ function transformer(file, api, options) {
|
|
|
223
186
|
/**
|
|
224
187
|
* transform imports
|
|
225
188
|
*/
|
|
226
|
-
|
|
227
189
|
root.find(j.ImportDeclaration).forEach(path => {
|
|
228
190
|
const importSource = path.node.source.value;
|
|
229
191
|
const originalComments = path.node.comments;
|
|
230
|
-
|
|
231
192
|
if (importSource === '@material-ui/core/styles' || importSource === '@material-ui/core' || importSource === '@mui/styles') {
|
|
232
193
|
const specifiersToMove = [];
|
|
233
194
|
const specifiersToStay = [];
|
|
@@ -246,7 +207,6 @@ function transformer(file, api, options) {
|
|
|
246
207
|
}
|
|
247
208
|
}
|
|
248
209
|
});
|
|
249
|
-
|
|
250
210
|
if (specifiersToMove.length > 0) {
|
|
251
211
|
path.replace(j.importDeclaration(specifiersToMove, j.stringLiteral('tss-react/mui')), specifiersToStay.length > 0 ? j.importDeclaration(specifiersToStay, j.stringLiteral(importSource)) : undefined);
|
|
252
212
|
importsChanged = true;
|
|
@@ -260,21 +220,16 @@ function transformer(file, api, options) {
|
|
|
260
220
|
path.replace(j.importDeclaration([j.importSpecifier(j.identifier('withStyles'))], j.stringLiteral('tss-react/mui')));
|
|
261
221
|
importsChanged = true;
|
|
262
222
|
}
|
|
263
|
-
|
|
264
223
|
path.node.comments = originalComments;
|
|
265
224
|
});
|
|
266
|
-
|
|
267
225
|
if (!importsChanged) {
|
|
268
226
|
return file.source;
|
|
269
227
|
}
|
|
270
|
-
|
|
271
228
|
const isTypeScript = file.path.endsWith('.tsx') || file.path.endsWith('.ts');
|
|
272
|
-
|
|
273
229
|
if (foundMakeStyles) {
|
|
274
230
|
let clsxOrClassnamesName = null;
|
|
275
231
|
root.find(j.ImportDeclaration).forEach(path => {
|
|
276
232
|
const importSource = path.node.source.value;
|
|
277
|
-
|
|
278
233
|
if (importSource === 'clsx' || importSource === 'classnames') {
|
|
279
234
|
path.node.specifiers.forEach(specifier => {
|
|
280
235
|
if (specifier.type === 'ImportDefaultSpecifier') {
|
|
@@ -282,15 +237,12 @@ function transformer(file, api, options) {
|
|
|
282
237
|
}
|
|
283
238
|
});
|
|
284
239
|
let commentsToPreserve = null;
|
|
285
|
-
|
|
286
240
|
if (originalFirstNode === path.node) {
|
|
287
241
|
// For a removed import, only preserve the comments if it is the first node in the file,
|
|
288
242
|
// otherwise the comments are probably about the removed import and no longer relevant.
|
|
289
243
|
commentsToPreserve = path.node.comments;
|
|
290
244
|
}
|
|
291
|
-
|
|
292
245
|
j(path).remove();
|
|
293
|
-
|
|
294
246
|
if (commentsToPreserve) {
|
|
295
247
|
addCommentsToNode(getFirstNode(j, root), commentsToPreserve, true);
|
|
296
248
|
}
|
|
@@ -299,7 +251,6 @@ function transformer(file, api, options) {
|
|
|
299
251
|
/**
|
|
300
252
|
* Convert makeStyles syntax
|
|
301
253
|
*/
|
|
302
|
-
|
|
303
254
|
const styleHooks = [];
|
|
304
255
|
root.find(j.CallExpression, {
|
|
305
256
|
callee: {
|
|
@@ -307,7 +258,6 @@ function transformer(file, api, options) {
|
|
|
307
258
|
}
|
|
308
259
|
}).forEach(path => {
|
|
309
260
|
let paramsTypes = null;
|
|
310
|
-
|
|
311
261
|
if (foundCreateStyles) {
|
|
312
262
|
j(path).find(j.CallExpression, {
|
|
313
263
|
callee: {
|
|
@@ -317,18 +267,14 @@ function transformer(file, api, options) {
|
|
|
317
267
|
if (isTypeScript && createStylesPath.node.typeParameters && createStylesPath.node.typeParameters.params.length > 1) {
|
|
318
268
|
paramsTypes = createStylesPath.node.typeParameters.params[1];
|
|
319
269
|
}
|
|
320
|
-
|
|
321
270
|
return createStylesPath.node.arguments[0];
|
|
322
271
|
});
|
|
323
272
|
}
|
|
324
|
-
|
|
325
273
|
const nestedKeys = [];
|
|
326
274
|
let makeStylesOptions = null;
|
|
327
|
-
|
|
328
275
|
if (path.node.arguments.length > 1) {
|
|
329
276
|
makeStylesOptions = path.node.arguments[1];
|
|
330
277
|
}
|
|
331
|
-
|
|
332
278
|
let stylesExpression = path.node.arguments[0];
|
|
333
279
|
const commentsToAdd = [];
|
|
334
280
|
transformStylesExpression(j, commentsToAdd, path.node.arguments[0], nestedKeys, newStylesExpression => {
|
|
@@ -336,24 +282,18 @@ function transformer(file, api, options) {
|
|
|
336
282
|
});
|
|
337
283
|
addCommentsToClosestDeclaration(j, path, commentsToAdd);
|
|
338
284
|
let makeStylesIdentifier = 'makeStyles';
|
|
339
|
-
|
|
340
285
|
if (isTypeScript && (nestedKeys.length > 0 || paramsTypes !== null)) {
|
|
341
286
|
let paramsTypeString = 'void';
|
|
342
|
-
|
|
343
287
|
if (paramsTypes !== null) {
|
|
344
288
|
paramsTypeString = j(paramsTypes).toSource(printOptions);
|
|
345
289
|
}
|
|
346
|
-
|
|
347
290
|
let nestedKeysString = '';
|
|
348
|
-
|
|
349
291
|
if (nestedKeys.length > 0) {
|
|
350
292
|
const nestedKeysUnion = nestedKeys.join("' | '");
|
|
351
293
|
nestedKeysString = `, '${nestedKeysUnion}'`;
|
|
352
294
|
}
|
|
353
|
-
|
|
354
295
|
makeStylesIdentifier += `<${paramsTypeString}${nestedKeysString}>`;
|
|
355
296
|
}
|
|
356
|
-
|
|
357
297
|
j(path).replaceWith(j.callExpression(j.callExpression(j.identifier(makeStylesIdentifier), makeStylesOptions === null ? [] : [makeStylesOptions]), [stylesExpression]));
|
|
358
298
|
}).closest(j.VariableDeclarator).forEach(path => {
|
|
359
299
|
styleHooks.push(path.node.id.name);
|
|
@@ -366,7 +306,6 @@ function transformer(file, api, options) {
|
|
|
366
306
|
* Convert classes assignment syntax in calls to the hook (e.g. useStyles) and
|
|
367
307
|
* convert usages of clsx or classnames to cx.
|
|
368
308
|
*/
|
|
369
|
-
|
|
370
309
|
styleHooks.forEach(hookName => {
|
|
371
310
|
root.find(j.CallExpression, {
|
|
372
311
|
callee: {
|
|
@@ -375,7 +314,6 @@ function transformer(file, api, options) {
|
|
|
375
314
|
}).forEach(hookCall => {
|
|
376
315
|
if (hookCall.node.arguments.length === 1) {
|
|
377
316
|
const hookArg = hookCall.node.arguments[0];
|
|
378
|
-
|
|
379
317
|
if (hookArg.type === 'Identifier') {
|
|
380
318
|
const secondArg = j.objectExpression([]);
|
|
381
319
|
secondArg.properties.push(j.objectProperty(j.identifier('props'), j.identifier(hookArg.name)));
|
|
@@ -390,14 +328,12 @@ function transformer(file, api, options) {
|
|
|
390
328
|
hookArgPropsMinusClasses.push(hookProp);
|
|
391
329
|
}
|
|
392
330
|
});
|
|
393
|
-
|
|
394
331
|
if (classesProp !== null) {
|
|
395
332
|
if (hookArgPropsMinusClasses.length === 0) {
|
|
396
333
|
hookCall.node.arguments[0] = j.identifier('undefined');
|
|
397
334
|
} else {
|
|
398
335
|
hookArg.properties = hookArgPropsMinusClasses;
|
|
399
336
|
}
|
|
400
|
-
|
|
401
337
|
const secondArg = j.objectExpression([]);
|
|
402
338
|
secondArg.properties.push(j.objectProperty(j.identifier('props'), j.objectExpression([j.objectProperty(j.identifier('classes'), classesProp.value)])));
|
|
403
339
|
hookCall.node.arguments.push(secondArg);
|
|
@@ -408,7 +344,6 @@ function transformer(file, api, options) {
|
|
|
408
344
|
let foundClsxOrClassnamesUsage = false;
|
|
409
345
|
const classesName = path.node.id.name;
|
|
410
346
|
const classesAssign = classesName === 'classes' ? 'classes' : `classes: ${classesName}`;
|
|
411
|
-
|
|
412
347
|
if (clsxOrClassnamesName !== null) {
|
|
413
348
|
j(path).closestScope().find(j.CallExpression, {
|
|
414
349
|
callee: {
|
|
@@ -419,7 +354,6 @@ function transformer(file, api, options) {
|
|
|
419
354
|
foundClsxOrClassnamesUsage = true;
|
|
420
355
|
});
|
|
421
356
|
}
|
|
422
|
-
|
|
423
357
|
if (foundClsxOrClassnamesUsage) {
|
|
424
358
|
path.node.id.name = `{ ${classesAssign}, cx }`;
|
|
425
359
|
} else {
|
|
@@ -436,7 +370,6 @@ function transformer(file, api, options) {
|
|
|
436
370
|
});
|
|
437
371
|
});
|
|
438
372
|
}
|
|
439
|
-
|
|
440
373
|
if (foundWithStyles) {
|
|
441
374
|
/**
|
|
442
375
|
* Convert withStyles syntax
|
|
@@ -452,7 +385,6 @@ function transformer(file, api, options) {
|
|
|
452
385
|
}).replaceWith(path => {
|
|
453
386
|
const withStylesCall = path.node.callee;
|
|
454
387
|
const styles = path.node.callee.arguments[0];
|
|
455
|
-
|
|
456
388
|
if (styles.type === 'Identifier') {
|
|
457
389
|
styleVariables.push(styles.name);
|
|
458
390
|
} else {
|
|
@@ -463,7 +395,6 @@ function transformer(file, api, options) {
|
|
|
463
395
|
});
|
|
464
396
|
addCommentsToClosestDeclaration(j, path, commentsToAdd);
|
|
465
397
|
}
|
|
466
|
-
|
|
467
398
|
const component = path.node.arguments[0];
|
|
468
399
|
withStylesCall.arguments.unshift(component);
|
|
469
400
|
return withStylesCall;
|
|
@@ -483,6 +414,5 @@ function transformer(file, api, options) {
|
|
|
483
414
|
});
|
|
484
415
|
});
|
|
485
416
|
}
|
|
486
|
-
|
|
487
417
|
return root.toSource(printOptions);
|
|
488
418
|
}
|
|
@@ -1,25 +1,20 @@
|
|
|
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 = ComponentUsingStyles;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _styles = require("@material-ui/core/styles");
|
|
13
|
-
|
|
14
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
|
|
16
11
|
var _InnerComponent;
|
|
17
|
-
|
|
18
12
|
/*
|
|
19
13
|
Sandboxes for verifying correct behavior:
|
|
20
14
|
JSS - https://codesandbox.io/s/case1-jss-dedp2f?file=/src/App.js
|
|
21
15
|
TSS - https://codesandbox.io/s/case1-tss-s0z7tx?file=/src/App.js
|
|
22
16
|
*/
|
|
17
|
+
|
|
23
18
|
const useStyles = (0, _styles.makeStyles)({
|
|
24
19
|
test: {
|
|
25
20
|
backgroundColor: "purple",
|
|
@@ -34,7 +29,6 @@ const useStyles2 = (0, _styles.makeStyles)(() => ({
|
|
|
34
29
|
color: "lime"
|
|
35
30
|
}
|
|
36
31
|
}));
|
|
37
|
-
|
|
38
32
|
function InnerComponent() {
|
|
39
33
|
const classes = useStyles2();
|
|
40
34
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -42,7 +36,6 @@ function InnerComponent() {
|
|
|
42
36
|
children: "Inner Test"
|
|
43
37
|
});
|
|
44
38
|
}
|
|
45
|
-
|
|
46
39
|
function ComponentUsingStyles(props) {
|
|
47
40
|
const classes = useStyles();
|
|
48
41
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
@@ -1,22 +1,15 @@
|
|
|
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 = ComponentUsingStyles;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _core = require("@material-ui/core");
|
|
13
|
-
|
|
14
10
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
15
|
-
|
|
16
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
|
|
18
12
|
var _InnerComponent;
|
|
19
|
-
|
|
20
13
|
const useStyles = (0, _core.makeStyles)(() => ({
|
|
21
14
|
test: {
|
|
22
15
|
backgroundColor: "purple",
|
|
@@ -46,7 +39,6 @@ const useStyles2 = (0, _core.makeStyles)({
|
|
|
46
39
|
color: "lime"
|
|
47
40
|
}
|
|
48
41
|
});
|
|
49
|
-
|
|
50
42
|
function InnerComponent() {
|
|
51
43
|
const classes = useStyles2();
|
|
52
44
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -54,7 +46,6 @@ function InnerComponent() {
|
|
|
54
46
|
children: "Inner Test"
|
|
55
47
|
});
|
|
56
48
|
}
|
|
57
|
-
|
|
58
49
|
function ComponentUsingStyles(props) {
|
|
59
50
|
const classes = useStyles(props);
|
|
60
51
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
@@ -1,20 +1,14 @@
|
|
|
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 = ComponentUsingStyles;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _makeStyles = _interopRequireDefault(require("@mui/styles/makeStyles"));
|
|
13
|
-
|
|
14
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
|
|
16
11
|
var _InnerComponent;
|
|
17
|
-
|
|
18
12
|
const useStyles = (0, _makeStyles.default)({
|
|
19
13
|
test: {
|
|
20
14
|
backgroundColor: "purple",
|
|
@@ -35,7 +29,6 @@ const useStyles2 = (0, _makeStyles.default)({
|
|
|
35
29
|
color: "lime"
|
|
36
30
|
}
|
|
37
31
|
});
|
|
38
|
-
|
|
39
32
|
function InnerComponent() {
|
|
40
33
|
const classes = useStyles2();
|
|
41
34
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -43,7 +36,6 @@ function InnerComponent() {
|
|
|
43
36
|
children: "Inner Test"
|
|
44
37
|
});
|
|
45
38
|
}
|
|
46
|
-
|
|
47
39
|
function ComponentUsingStyles(props) {
|
|
48
40
|
const classes = useStyles();
|
|
49
41
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
@@ -1,20 +1,14 @@
|
|
|
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 = ComponentUsingStyles;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _styles = require("@mui/styles");
|
|
13
|
-
|
|
14
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
|
|
16
11
|
var _InnerComponent;
|
|
17
|
-
|
|
18
12
|
const useStyles = (0, _styles.makeStyles)({
|
|
19
13
|
test: {
|
|
20
14
|
backgroundColor: "purple",
|
|
@@ -35,7 +29,6 @@ const useStyles2 = (0, _styles.makeStyles)({
|
|
|
35
29
|
color: "lime"
|
|
36
30
|
}
|
|
37
31
|
});
|
|
38
|
-
|
|
39
32
|
function InnerComponent() {
|
|
40
33
|
const classes = useStyles2();
|
|
41
34
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -43,7 +36,6 @@ function InnerComponent() {
|
|
|
43
36
|
children: "Inner Test"
|
|
44
37
|
});
|
|
45
38
|
}
|
|
46
|
-
|
|
47
39
|
function ComponentUsingStyles(props) {
|
|
48
40
|
const classes = useStyles();
|
|
49
41
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
@@ -1,23 +1,17 @@
|
|
|
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 = ComponentUsingStyles;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
|
-
|
|
14
10
|
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
|
|
16
11
|
var _styles = require("@material-ui/core/styles");
|
|
17
|
-
|
|
18
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
|
|
20
13
|
// Comment on first node where the first node will be removed and we should preserve this comment.
|
|
14
|
+
|
|
21
15
|
function mixins() {
|
|
22
16
|
return {
|
|
23
17
|
test: {
|
|
@@ -26,13 +20,11 @@ function mixins() {
|
|
|
26
20
|
}
|
|
27
21
|
};
|
|
28
22
|
}
|
|
29
|
-
|
|
30
23
|
function cssProps() {
|
|
31
24
|
return {
|
|
32
25
|
paddingLeft: "8px"
|
|
33
26
|
};
|
|
34
27
|
}
|
|
35
|
-
|
|
36
28
|
const useStyles = (0, _styles.makeStyles)(theme => {
|
|
37
29
|
return mixins();
|
|
38
30
|
});
|
|
@@ -41,7 +33,6 @@ const useStyles2 = (0, _styles.makeStyles)(theme => (0, _extends2.default)({}, m
|
|
|
41
33
|
color: "red"
|
|
42
34
|
}, cssProps())
|
|
43
35
|
}));
|
|
44
|
-
|
|
45
36
|
function ComponentUsingStyles(props) {
|
|
46
37
|
const classes = useStyles();
|
|
47
38
|
const classes2 = useStyles2();
|
|
@@ -1,26 +1,17 @@
|
|
|
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.useExportedStyles = exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
|
-
|
|
12
9
|
var React = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _core = require("@material-ui/core");
|
|
15
|
-
|
|
16
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
|
|
18
12
|
var _InnerComponent;
|
|
19
|
-
|
|
20
13
|
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); }
|
|
21
|
-
|
|
22
14
|
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; }
|
|
23
|
-
|
|
24
15
|
const useStyles = (0, _core.makeStyles)(() => ({
|
|
25
16
|
test: {
|
|
26
17
|
backgroundColor: "purple",
|
|
@@ -60,7 +51,6 @@ const useGlobalStyles = (0, _core.makeStyles)(() => ({
|
|
|
60
51
|
}
|
|
61
52
|
}
|
|
62
53
|
}));
|
|
63
|
-
|
|
64
54
|
function InnerComponent() {
|
|
65
55
|
const classes = useStyles2();
|
|
66
56
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -68,7 +58,6 @@ function InnerComponent() {
|
|
|
68
58
|
children: "Inner Test"
|
|
69
59
|
});
|
|
70
60
|
}
|
|
71
|
-
|
|
72
61
|
function ComponentUsingStyles(props) {
|
|
73
62
|
const classes = useStyles(props);
|
|
74
63
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
@@ -81,6 +70,5 @@ function ComponentUsingStyles(props) {
|
|
|
81
70
|
})]
|
|
82
71
|
});
|
|
83
72
|
}
|
|
84
|
-
|
|
85
73
|
var _default = useStyles3;
|
|
86
74
|
exports.default = _default;
|
|
@@ -1,18 +1,13 @@
|
|
|
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 _clsx = _interopRequireDefault(require("clsx"));
|
|
11
|
-
|
|
12
9
|
var _styles = require("@material-ui/core/styles");
|
|
13
|
-
|
|
14
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
|
|
16
11
|
const useStyles = (0, _styles.makeStyles)(theme => (0, _styles.createStyles)({
|
|
17
12
|
root: ({
|
|
18
13
|
color,
|
|
@@ -34,7 +29,6 @@ const useStyles = (0, _styles.makeStyles)(theme => (0, _styles.createStyles)({
|
|
|
34
29
|
}), {
|
|
35
30
|
name: 'App'
|
|
36
31
|
});
|
|
37
|
-
|
|
38
32
|
function App({
|
|
39
33
|
classes: classesProp
|
|
40
34
|
}) {
|
|
@@ -54,6 +48,5 @@ function App({
|
|
|
54
48
|
})]
|
|
55
49
|
});
|
|
56
50
|
}
|
|
57
|
-
|
|
58
51
|
var _default = App;
|
|
59
52
|
exports.default = _default;
|