├── .babelrc ├── .circleci └── config.yml ├── .eslintrc ├── .gitignore ├── README.md ├── example ├── example.js ├── index.html └── webpack.config.js ├── index.js ├── lib ├── group-props.js ├── make-map.js └── must-use-prop.js ├── package.json ├── test ├── .babelrc └── test.js ├── webpack.config.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env"], 3 | "ignore": ["node_modules"] 4 | } 5 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | docker: 5 | - image: circleci/node:8 6 | working_directory: ~/repository 7 | steps: 8 | - checkout 9 | - run: yarn 10 | - run: yarn lint 11 | - run: yarn test 12 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "extends": "plugin:vue-libs/recommended" 4 | } 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | example/example.build.js 4 | dist 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # babel-plugin-transform-vue-jsx [](https://circleci.com/gh/vuejs/babel-plugin-transform-vue-jsx) 2 | 3 | > Babel plugin for Vue 2.0 JSX 4 | 5 | ### Babel Compatibility Notes 6 | 7 | - If using Babel 7, use 4.x 8 | - If using Babel 6, use 3.x 9 | 10 | ### Requirements 11 | 12 | - Assumes you are using Babel with a module bundler e.g. Webpack, because the spread merge helper is imported as a module to avoid duplication. 13 | 14 | - This is mutually exclusive with `babel-plugin-transform-react-jsx`. 15 | 16 | ### Usage 17 | 18 | ``` bash 19 | npm install\ 20 | babel-plugin-syntax-jsx\ 21 | babel-plugin-transform-vue-jsx\ 22 | babel-helper-vue-jsx-merge-props\ 23 | babel-preset-env\ 24 | --save-dev 25 | ``` 26 | 27 | In your `.babelrc`: 28 | 29 | ``` json 30 | { 31 | "presets": ["env"], 32 | "plugins": ["transform-vue-jsx"] 33 | } 34 | ``` 35 | 36 | The plugin transpiles the following JSX: 37 | 38 | ``` jsx 39 |
hi
') 76 | expect(vnode.data.hook.insert).to.equal(noop) 77 | }) 78 | 79 | it('should handle nested properties (camelCase)', () => { 80 | const noop = _ => _ 81 | const vnode = render(h => ( 82 |hi
') 94 | expect(vnode.data.hook.insert).to.equal(noop) 95 | }) 96 | 97 | it('should support data attributes', () => { 98 | const vnode = render(h => ( 99 | 100 | )) 101 | expect(vnode.data.attrs['data-id']).to.equal('1') 102 | }) 103 | 104 | it('should handle identifier tag name as components', () => { 105 | const Test = {} 106 | const vnode = render(h =>