{"name":"@vue/babel-plugin-transform-vue-jsx","version":"0.1.0","description":"Babel plugin for Vue 2.0 JSX","main":"dist/plugin.js","repository":{"type":"git","url":"https://github.com/vuejs/jsx/tree/master/packages/babel-plugin-transform-vue-jsx"},"author":{"name":"Evan You"},"license":"MIT","private":false,"scripts":{"pretest:snapshot":"yarn build:test","test:snapshot":"nyc --reporter=html --reporter=text-summary ava -v test/snapshot.js","pretest:functional":"yarn build:test && nyc --reporter=html --reporter=text-summary babel test/functional.js --plugins ./dist/plugin.testing.js --out-file test/functional-compiled.js","test:functional":"ava -v test/functional-compiled.js","build":"rollup -c","build:test":"rollup -c rollup.config.testing.js","test":"rm -rf coverage* && yarn test:snapshot && mv coverage coverage-snapshot && yarn test:functional && mv coverage coverage-functional","prepublish":"yarn build"},"devDependencies":{"@babel/cli":"^7.0.0-rc.3","@babel/core":"^7.0.0-rc.3","@babel/preset-env":"^7.0.0-rc.3","@vue/test-utils":"^1.0.0-beta.24","ava":"^0.25.0","jsdom":"^12.0.0","jsdom-global":"^3.0.2","nyc":"^12.0.2","rollup":"^0.65.0","rollup-plugin-babel":"4.0.0-beta.8","rollup-plugin-babel-minify":"^5.0.0","rollup-plugin-istanbul":"^2.0.1","vue":"^2.5.17","vue-template-compiler":"^2.5.17"},"dependencies":{"@babel/helper-module-imports":"^7.0.0-rc.3","@babel/plugin-syntax-jsx":"^7.0.0-rc.3","@vue/babel-helper-vue-jsx-merge-props":"^0.1.0","lodash.kebabcase":"^4.1.1"},"peerDependencies":{"@vue/babel-helper-vue-jsx-merge-props":"^0.1.0"},"nyc":{"exclude":["dist","test"]},"_id":"@vue/babel-plugin-transform-vue-jsx@0.1.0","_npmVersion":"6.2.0","_nodeVersion":"8.11.3","_npmUser":{"name":"yyx990803","email":"yyx990803@gmail.com"},"dist":{"integrity":"sha512-Zb8lxLN35uM2+qQoyZAtruqZ4kfoYn2N/Lx4k8fF3A+k2ympjimHaxS90CXVGsElR9Bp357in/+y6E4HTVNeYg==","shasum":"e2cc807ef2d7af7c30458a3ef8b8a7e365f2402e","tarball":"http://registry-npm.ywwl.com/@vue/babel-plugin-transform-vue-jsx/download/@vue/babel-plugin-transform-vue-jsx-0.1.0.tgz","fileCount":11,"unpackedSize":359779,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbhA1ZCRA9TVsSAnZWagAAc/wQAIL9xuDvm/FO67X8C2zN\nKfVo7MpwXOCADDw6xYPapT6gX/hsodmNMzEj8kd8u2/Pku0PyAcmjJxZuVA2\n/LBWVN9EvnCi83M689E1Ue98tEyFuM7kJTE17bVZxLjYRPztIiqqG0gkI155\n/jclrruJRs/3ilOGlbZ/oFs0QtMS/o2o3bONV+YXIE61gB1eTZPAjAc3hRzb\nj1HyweLScCLHG2X9/2bRJRTSsNrUaVD4d0zyyiJq3pjtXn+39wPrio5BzAsK\nsbnch2aSJGJazr+e3Ice58R12CmJBjFATbiZkgcAQRijxRuaBGBZzr1zcMru\nhiRkP+3ZikpddmmzFZbLQAuCxEdmGeYKQZ2B0rcNXNX9MkQGDQsr4HgN0Kze\nJ5BMvDlJ3bg5h1jpf2gvh6UCjHIVt51mIjWeU2OIrjq45pw+D4bUnumTv1lD\nWduwhxcZAHo84xqFsJ2LX1VzG3/7uwH6eVFOz+FvlVQHFKX8TOJg7RpNATSZ\nB7dS4zX8hhunaqe+kEM7RRQPeIfGLykA9GVolPzMDltlZpKycVnt/8ugmC4p\n992wnk5SKK+WhaCQBqcNU0eM7KIPHwE5omxB9XAJCVheOSL9bJyggPdRmCVH\nwfaAc6BuDEAeST19k1We/7iwqc8I9iXkuz1Kw/d/9mwW2xRDRF+CIHv7SBo7\n9uqC\r\n=tRL0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHx4n2i1N2D+0SnzM0Y4Z7r1qoW+dnK/NAQHmvP/pzaIAiEA+qkYhWu5sE4N1NBoKlJ8QniRE0WGz0fIbY0O3llt/P0="}],"size":137329,"noattachment":false,"key":"/@vue/babel-plugin-transform-vue-jsx/-/@vue/babel-plugin-transform-vue-jsx-0.1.0.tgz"},"maintainers":[{"name":"akryum","email":"guillaume.b.chau@gmail.com"},{"name":"chrisvfritz","email":"chrisvfritz@gmail.com"},{"name":"eddyerburgh","email":"edward.yerburgh@gmail.com"},{"name":"ktsn","email":"ktsn55@gmail.com"},{"name":"michalsnik","email":"msajnog93@gmail.com"},{"name":"mysticatea","email":"star.ctor@gmail.com"},{"name":"nickmessing","email":"dot.nick.dot.messing@gmail.com"},{"name":"yyx990803","email":"yyx990803@gmail.com"},{"name":"znck","email":"rahulkdn@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-vue-jsx_0.1.0_1535380825157_0.5865616658739745"},"_hasShrinkwrap":false,"readme":"## @vue/babel-plugin-transform-vue-jsx\n\n> Babel plugin for Vue 2.0 JSX\n\n### Babel Compatibility Notes\n\n- This repo is only compatible with Babel 7.x, for 6.x please use [vuejs/babel-plugin-transform-vue-jsx](https://github.com/vuejs/babel-plugin-transform-vue-jsx)\n\n### Requirements\n\n- 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.\n\n- This is mutually exclusive with `babel-plugin-transform-react-jsx`.\n\n### Usage\n\n```bash\nnpm install @vue/babel-plugin-transform-vue-jsx --save-dev\nnpm install @vue/babel-helper-vue-jsx-merge-props --save\n```\n\nIn your `.babelrc`:\n\n```json\n{\n  \"plugins\": [\"transform-vue-jsx\"]\n}\n```\n\nHowever it is recommended to use the [configurable preset](../babel-preset-jsx/README.md) instead.\n\n### Details\n\nThe plugin transpiles the following JSX:\n\n```jsx\n<div id=\"foo\">{this.text}</div>\n```\n\nTo the following JavaScript:\n\n```js\nh(\n  'div',\n  {\n    attrs: {\n      id: 'foo',\n    },\n  },\n  [this.text],\n)\n```\n\nNote the `h` function, which is a shorthand for a Vue instance's `$createElement` method, must be in the scope where the JSX is. Since this method is passed to component render functions as the first argument, in most cases you'd do this:\n\n```js\nVue.component('jsx-example', {\n  render(h) {\n    // <-- h must be in scope\n    return <div id=\"foo\">bar</div>\n  },\n})\n```\n\n### Difference from React JSX\n\nFirst, Vue 2.0's vnode format is different from React's. The second argument to the `createElement` call is a \"data object\" that accepts nested objects. Each nested object will be then processed by corresponding modules:\n\n```js\nrender (h) {\n  return h('div', {\n    // Component props\n    props: {\n      msg: 'hi'\n    },\n    // Normal HTML attributes\n    attrs: {\n      id: 'foo'\n    },\n    // DOM props\n    domProps: {\n      innerHTML: 'bar'\n    },\n    // Event handlers are nested under \"on\", though\n    // modifiers such as in v-on:keyup.enter are not\n    // supported. You'll have to manually check the\n    // keyCode in the handler instead.\n    on: {\n      click: this.clickHandler\n    },\n    // For components only. Allows you to listen to\n    // native events, rather than events emitted from\n    // the component using vm.$emit.\n    nativeOn: {\n      click: this.nativeClickHandler\n    },\n    // Class is a special module, same API as `v-bind:class`\n    class: {\n      foo: true,\n      bar: false\n    },\n    // Style is also same as `v-bind:style`\n    style: {\n      color: 'red',\n      fontSize: '14px'\n    },\n    // Other special top-level properties\n    key: 'key',\n    ref: 'ref',\n    // Assign the `ref` is used on elements/components with v-for\n    refInFor: true,\n    slot: 'slot'\n  })\n}\n```\n\nThe equivalent of the above in Vue 2.0 JSX is:\n\n```jsx\nrender (h) {\n  return (\n    <div\n      // Component props\n      propsMsg=\"hi\"\n      // Normal attributes or component props.\n      id=\"foo\"\n      // DOM properties are prefixed with `domProps`\n      domPropsInnerHTML=\"bar\"\n      // event listeners are prefixed with `on` or `nativeOn`\n      onClick={this.clickHandler}\n      nativeOnClick={this.nativeClickHandler}\n      // other special top-level properties\n      class={{ foo: true, bar: false }}\n      style={{ color: 'red', fontSize: '14px' }}\n      key=\"key\"\n      ref=\"ref\"\n      // assign the `ref` is used on elements/components with v-for\n      refInFor\n      slot=\"slot\">\n    </div>\n  )\n}\n```\n\n### Component Tip\n\nIf a custom element starts with lowercase, it will be treated as a string id and used to lookup a registered component. If it starts with uppercase, it will be treated as an identifier, which allows you to do:\n\n```js\nimport Todo from './Todo.js'\n\nexport default {\n  render(h) {\n    return <Todo /> // no need to register Todo via components option\n  },\n}\n```\n\n### JSX Spread\n\nJSX spread is supported, and this plugin will intelligently merge nested data properties. For example:\n\n```jsx\nconst data = {\n  class: ['b', 'c'],\n}\nconst vnode = <div class=\"a\" {...data} />\n```\n\nThe merged data will be:\n\n```js\n{ class: ['a', 'b', 'c'] }\n```\n\n### Vue directives\n\nVue directives are usable the same way as in template with a few key differences:\n\n1.  You can use directives camelCased instead of kebab-cased (vMyDirective is treated as `v-my-directive`)\n2.  You have to use underscore sign instead of dots for modifiers because of JSXIdentifier limitation.\n3.  Only runtime directives work (only v-show and custom directives), compile-time directives are out of this project's scope.\n\nA full example would be: `<MyComponent vMyDirective:argument_modifier1_modifier2={someExpression} />`\n","publish_time":1535380825261,"_cnpm_publish_time":1535380825261,"dist-tags":{"latest":"1.4.0"}}