{"name":"babel-plugin-jsx-pragmatic","version":"0.1.1","main":"jsx-pragmatic.js","license":"MIT","author":{"name":"Jesse McCarthy","url":"http://software.jessemccarthy.net/"},"homepage":"https://github.com/jmm/babel-plugin-jsx-pragmatic","repository":{"type":"git","url":"git+https://github.com/jmm/babel-plugin-jsx-pragmatic.git"},"devDependencies":{"babel-core":"^5.0.0"},"files":["jsx-pragmatic.js","package.json","README.md","LICENSE"],"keywords":["babel-plugin","jsx","react"],"gitHead":"47f284b2835a3e73bb61a81dc8ee62d486439d14","description":"babel / babelify has a `jsxPragma` option that will be used when transforming JSX to function calls instead of the default function `React.createElement`.","bugs":{"url":"https://github.com/jmm/babel-plugin-jsx-pragmatic/issues"},"_id":"babel-plugin-jsx-pragmatic@0.1.1","scripts":{},"_shasum":"557a24f74b086dbdc8e682840de129440595cb98","_from":".","_npmVersion":"2.9.0","_nodeVersion":"0.10.32","_npmUser":{"name":"jmm","email":"npm-public@jessemccarthy.net"},"maintainers":[{"name":"jmm","email":"npm-public@jessemccarthy.net"}],"dist":{"shasum":"557a24f74b086dbdc8e682840de129440595cb98","tarball":"http://registry-npm.ywwl.com/babel-plugin-jsx-pragmatic/download/babel-plugin-jsx-pragmatic-0.1.1.tgz","integrity":"sha512-9vTmKjJnx2Mc1yaBbTEl3NabISaoWpwJC7uCa+ME71Q0mcfmTfgxrqV8FtLagB9brvIzXsKEsT/034R4iOze2Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCyaAZsL1/0sYjcq3/VOrTk6h0gcdIeeWdnILbHYgJjFQIgdOqupAHFkS0o7TRDDUvOSETCQk0CpYJPho1fYSQWyEs="}],"size":2787,"noattachment":false,"key":"/babel-plugin-jsx-pragmatic/-/babel-plugin-jsx-pragmatic-0.1.1.tgz"},"directories":{},"readme":"# About\n\n[babel-plugin-transform-react-jsx](https://www.npmjs.com/package/babel-plugin-transform-react-jsx) has a `pragma` option that's used when transforming JSX to function calls instead of the default function `React.createElement`.\n\nThis Babel plugin is a companion to that feature that allows you to dynamically load a module associated with the `pragma` value.\n\nFrom v1.0.0 this works with the Babel v6 plugin API, not v5.\n\nExample:\n\nGiven this file:\n\n```js\n<Some jsx=\"element\" />\n```\n\nbabel would normally transform the JSX to:\n\n```js\nReact.createElement(Some, { jsx: \"element\" });\n```\n\nBy setting the `pragma` option like this:\n\n```js\nbabel.transform(code, {\n  plugins: [\n    [\"babel-plugin-transform-react-jsx\", {\n      pragma: \"whatever\",\n    }],\n  ]\n})\n```\n\nIt would instead transform it to:\n\n```js\nwhatever(Some, { jsx: \"element\" });\n```\n\nHowever, you might need to load a module corresponding to `whatever` in each module containing JSX:\n\n```js\nimport whatever from \"whatever\";\n// or\nvar whatever = require(\"whatever\");\n```\n\nThis plugin allows you to make that part dynamic as well:\n\n```js\nbabel.transform(code, {\n  plugins: [\n    [\"babel-plugin-transform-react-jsx\", {\n      pragma: \"whatever\",\n    }],\n\n    [\"babel-plugin-jsx-pragmatic\", {\n      module: \"/something/whatever\",\n      import: \"whatever\"\n    }],\n  ]\n})\n```\n\nResults in:\n\n```js\nimport {default as whatever} from \"/something/whatever\";\n```\n\n## Options\n\n### `module`\n\nString. Module ID or pathname. The value of the `ModuleSpecifier` of an import. Required.\n\n### `import`\n\nString. The identifier that you want to import the `module` with. This should correspond to the root identifier of the `pragma` value. Required. Examples:\n\n```js\n{\n  plugins: [\n    [\"babel-plugin-transform-react-jsx\", {\n      pragma: \"x\",\n    }],\n\n    [\"babel-plugin-jsx-pragmatic\", {\n      module: \"/something/whatever\",\n      import: \"x\"\n    }],\n  ]\n}\n\n{\n  plugins: [\n    [\"babel-plugin-transform-react-jsx\", {\n      pragma: \"x.y\",\n    }],\n\n    [\"babel-plugin-jsx-pragmatic\", {\n      module: \"/something/whatever\",\n      import: \"x\"\n    }],\n  ]\n}\n```\n\n### `export`\n\nString. The export that you want to import as `import` from `module`. Default value is `default` (the default export). Examples:\n\n```js\n// Will import the default export (`default`)\n{\n  module: \"whatever\",\n  import: \"x\"\n}\n// import {default as x} from \"whatever\"\n\n\n// Will import the default export (`default`)\n{\n  module: \"whatever\",\n  import: \"x\",\n  export: \"default\",\n}\n// import {default as x} from \"whatever\"\n\n\n// Will import the export named `something`\n{\n  module: \"whatever\",\n  import: \"x\",\n  export: \"something\",\n}\n// import {something as x} from \"whatever\"\n```\n\n# Known Issues\n\n* Doesn't do anything special in the case that the file being transformed\n  already imports or declares an identifier with the same name as `import`.\n\n* Doesn't take into account when a file actually contains a JSX pragma comment.\n","publish_time":1434746118288,"_cnpm_publish_time":1434746118288,"dist-tags":{"latest":"1.0.2"}}