diff --git a/packages/core/src/h2x/expandProps.js b/packages/core/src/h2x/expandProps.js index 11e26d4b..527b9ab9 100644 --- a/packages/core/src/h2x/expandProps.js +++ b/packages/core/src/h2x/expandProps.js @@ -12,12 +12,13 @@ const expandProps = (position = 'end') => () => ({ props.name = 'props' props.spread = true if (position === 'start') { - path.node.attributes.unshift(props) + path.node.attributes = [props, ...path.node.attributes] + path.replace(path.node) } if (position === 'end') { - path.node.attributes.push(props) + path.node.attributes = [...path.node.attributes, props] + path.replace(path.node) } - path.replace(path.node) } }, }, diff --git a/website/config/settings.js b/website/config/settings.js index bb15942c..9384005b 100644 --- a/website/config/settings.js +++ b/website/config/settings.js @@ -24,13 +24,6 @@ export const settings = [ group: 'global', default: false, }, - { - label: 'Expand props', - name: 'expandProps', - type: 'boolean', - group: 'global', - default: true, - }, { label: 'Ref', name: 'ref', @@ -45,6 +38,15 @@ export const settings = [ group: 'global', default: false, }, + { + label: 'Expand props', + name: 'expandProps', + type: 'enum', + values: ['start', 'end', 'none'], + group: 'global', + default: 'end', + transform: value => value === 'none' ? false : value, + }, { label: 'Replace attributes value', name: 'replaceAttrValues',