{"name":"@vue/babel-plugin-transform-vue-jsx","version":"1.2.1","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,"publishConfig":{"access":"public"},"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.2.0","@babel/core":"^7.2.0","@babel/preset-env":"^7.2.0","@vue/test-utils":"^1.0.0-beta.26","ava":"^0.25.0","jsdom":"^13.0.0","jsdom-global":"^3.0.2","nyc":"^12.0.2","rollup":"^0.67.4","rollup-plugin-babel":"4.0.3","rollup-plugin-babel-minify":"^6.2.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","@babel/plugin-syntax-jsx":"^7.2.0","@vue/babel-helper-vue-jsx-merge-props":"^1.2.1","html-tags":"^2.0.0","lodash.kebabcase":"^4.1.1","svg-tags":"^1.0.0"},"peerDependencies":{"@babel/core":"^7.0.0-0"},"nyc":{"exclude":["dist","test"]},"gitHead":"ebe50c0f20b991fca6588cab93965629ffbcf64f","_id":"@vue/babel-plugin-transform-vue-jsx@1.2.1","_nodeVersion":"14.13.1","_npmVersion":"lerna/3.20.2/node@v14.13.1+x64 (darwin)","_npmUser":{"name":"soda","email":"haoqunjiang+npm@gmail.com"},"dist":{"integrity":"sha512-HJuqwACYehQwh1fNT8f4kyzqlNMpBuUK4rSiSES5D4QsYncv5fxFsLyrxFPG2ksO7t5WP+Vgix6tt6yKClwPzA==","shasum":"646046c652c2f0242727f34519d917b064041ed7","tarball":"http://registry-npm.ywwl.com/@vue/babel-plugin-transform-vue-jsx/download/@vue/babel-plugin-transform-vue-jsx-1.2.1.tgz","fileCount":3,"unpackedSize":13248,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfiZgXCRA9TVsSAnZWagAANfYP/jn0AqYPdAsfeJnMKwGo\nZYfamgaMhJiSDp7b2YXNWwRxFCaWkbA7ddaSsIPa10LdhKbD5x3hHvLpXzb8\n5jEF2lenv7OtX75u0dv8qy/0we6S20ipQnDujtmZIHAv5XMWmEM7iQHdyAN0\nRfhGa8agNNjPYNyaPVnoPeyXb9jejpu6/mcf0TZUFtvsNjJFmgwcjmhFoIym\nlyaJsmm0KH6r7B7RSWXTaO3HyWqbx1mL3AS5bXLziv5vJB3e1b1I4BENnUpl\nAdJkqDikUfYtoI6ZMP/I84lROxLtlN5JQ62pJPQ0SyAtAFELAg3fsRA399Jt\nEd353b0Y/ImMGzB7cN4stZ+Lhf4j4uLMX0FAoYtQ9aJJwni6JBVRJvHRNyDf\nPPzMjN9d7BRW7VjRW5y6RHgxpragQMaz3SLpeBZKmg1KRqHLjoMIIB/Ts+yP\n4UoV181V1jd4ppFO6wD3e4Np5JhOx3Lqc8I2UGdkRVawpEXO4QAS0I09JAq8\nz+0bWvatIHepmpEcYZlqUX8i7erptBC9xZ3vsQq1eeG88epHzzkCWjJfbz8l\nOmnviH6OTpVeMWQ4kONVP7LwVN8WEUyHBltM7nK8vumZnZL4DZOqBgiE5kpq\nu29HnLzYu62at1Jo9/nIfEfLyD6K1xpVLQQPi3GD6oP1cZ/FUF0YGX1Ik51e\nasaq\r\n=fmat\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFtY65LBpl+tMfyjcE04OmeIydCLubMaTddzDWLnO+PJAiBE34rNb0/r1dfbCeRBVviNf5qG/4eUP/rBbG5wWwnDmQ=="}],"size":5072,"noattachment":false,"key":"/@vue/babel-plugin-transform-vue-jsx/-/@vue/babel-plugin-transform-vue-jsx-1.2.1.tgz"},"maintainers":[{"name":"yyx990803","email":"yyx990803@gmail.com"},{"name":"soda","email":"haoqunjiang+npm@gmail.com"},{"name":"nickmessing","email":"dot.nick.dot.messing@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-vue-jsx_1.2.1_1602852887146_0.7986910550425566"},"_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":1602852887263,"_cnpm_publish_time":1602852887263,"dist-tags":{"latest":"1.4.0"}}