{"_id":"@atomcorp/babel-plugin-react-intl","_rev":"1-a9fadfea89b05b7f588b81558c6ab465","name":"@atomcorp/babel-plugin-react-intl","dist-tags":{"latest":"3.0.2"},"versions":{"3.0.2":{"name":"@atomcorp/babel-plugin-react-intl","version":"3.0.2","description":"Extracts string messages for translation from modules that use React Intl.","repository":{"type":"git","url":"git+https://github.com/atomcorp/babel-plugin-react-intl.git"},"license":"BSD-3-Clause","main":"lib/index.js","author":{"name":"Eric Ferraiuolo","email":"edf@ericf.me"},"dependencies":{"@babel/runtime":"^7.3.1","intl-messageformat-parser":"^1.4.0","mkdirp":"^0.5.1"},"devDependencies":{"@babel/cli":"^7.2.3","@babel/core":"^7.2.2","@babel/node":"^7.2.2","@babel/plugin-proposal-object-rest-spread":"^7.3.1","@babel/plugin-transform-runtime":"^7.2.0","@babel/preset-env":"^7.3.1","@babel/preset-react":"^7.0.0","@babel/register":"^7.0.0","babel-plugin-espower":"^3.0.1","cross-env":"^5.2.0","eslint":"^5.12.1","eslint-plugin-react":"^7.12.4","mocha":"^5.2.0","power-assert":"^1.6.1","rimraf":"^2.6.3","uuid":"^3.3.2"},"scripts":{"lint":"eslint src/","clean":"rimraf lib/","test":"cross-env NODE_ENV=test mocha --compilers js:@babel/register","build":"babel src/ --out-dir lib/","build:fixtures":"babel-node ./scripts/build-fixtures.js","preversion":"npm run lint && npm run clean && npm run build","prepublish":"npm run clean && npm run build"},"keywords":["babel-plugin","react-intl"],"bugs":{"url":"https://github.com/yahoo/babel-plugin-react-intl/issues"},"homepage":"https://github.com/yahoo/babel-plugin-react-intl#readme","gitHead":"ecfcc9e84f48072b804212ca869c799dc529eadc","_id":"@atomcorp/babel-plugin-react-intl@3.0.2","_nodeVersion":"11.13.0","_npmVersion":"6.7.0","dist":{"integrity":"sha512-cMcojhVaKkSuc2p4bLw1wtCS+qxD02h0nzytd/C6oXE5brwr4/xFuQDT5HPyALf3kHhDH/SUOjBrKmZHgn3vAg==","shasum":"39fa7ebefd76c0b341441b4c6a770423161f18cc","tarball":"https://registry.npmjs.org/@atomcorp/babel-plugin-react-intl/-/babel-plugin-react-intl-3.0.2.tgz","fileCount":10,"unpackedSize":171451,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcyy7uCRA9TVsSAnZWagAARugP/2xQQzZcnok6HIrgjGII\nzRU7EvPeAtzaTwfjK8Y4m/1EiURNWUX6jYpToLDBCAZnlj2z/SIIQjfxTdbp\njYbNUgm3z/t4kbv+/uFTwP59tfwbM/0SYvpDQzBDCW2b9k3bmkOlD6IC4FEp\nBZCbFKlmV3WZNfRxWRk2Tv3XtU5N9MDagha1k6agh0IGUMkEoC663xp4nXU7\n7ixrUWdUjxRrzoVbTgYWkkCkSu0V4ESM2MMtdOuooLVxV7hjBIsNu58OBfu+\nGTUIiiImOvNsYMX+lNlkXt1W+5v65NYHVNMLWbQWxymtvmo5WvJAaZyfBjAr\nFhLsbh4YQnbw6f+fe0GvzCwERAmA5lwbVP3qP4IuRR/ZHSOUGcrMplrgsRVI\nEenGqv1Tk/exUpqJHQq2FiyYNY6it+lxLc9wH8XPcqOMcEMA1Fy2GEnTVXnX\nKcNNOAySIHpGEYi/X1jqvZtBbJFXCYbjB4gUDeWKqFNrYHFLtcTg3mBCfcMa\nEpbX3OkOkw8lI8qw+mTxvWIfUzflK9YOHKLiuNw4p3Vll2tnV6sm2AOKdeCf\neuIBSuf/HrI9uA4eDp1a1iplcBTIHpGuuSCDGb6pyOT2s0QNGvCvsvJRYidR\nSfqyymZmBD+wS/fDSlwiZFWaINEOQLF4JUxts1K7/cuUR768EmfqftWz3hEF\nPg8v\r\n=Nqoz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID8tMe3QzITSvnEdOS+IUgUH+XeA7E+EC/ZjczxGgYcFAiAUX1whsbozD1y/IGakfVsSWLhnRs6ccTIRz7Hf/22sQA=="}]},"maintainers":[{"name":"atomcorp","email":"faotms+npm@gmail.com"}],"_npmUser":{"name":"atomcorp","email":"faotms+npm@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-react-intl_3.0.2_1556819693467_0.18918495912545086"},"_hasShrinkwrap":false}},"time":{"created":"2019-05-02T17:54:53.441Z","3.0.2":"2019-05-02T17:54:53.678Z","modified":"2022-04-04T16:14:34.120Z"},"maintainers":[{"name":"atomcorp","email":"faotms+npm@gmail.com"}],"description":"Extracts string messages for translation from modules that use React Intl.","homepage":"https://github.com/yahoo/babel-plugin-react-intl#readme","keywords":["babel-plugin","react-intl"],"repository":{"type":"git","url":"git+https://github.com/atomcorp/babel-plugin-react-intl.git"},"author":{"name":"Eric Ferraiuolo","email":"edf@ericf.me"},"bugs":{"url":"https://github.com/yahoo/babel-plugin-react-intl/issues"},"license":"BSD-3-Clause","readme":"# babel-plugin-react-intl\n\n\\_https://github.com/yahoo/babel-plugin-react-intl/pull/165 has been added, so it scrapes intl.formatMessage\n\n_This has been forked off from [`babel-plugin-react-intl`](https://github.com/yahoo/babel-plugin-react-intl) with some additional options_\n\nExtracts string messages for translation from modules that use [React Intl][].\n\n## Dependencies\n\n### React Intl\n\nThis Babel plugin works with React Intl v2.x\n\n### Babel\n\n- **3.x** of this plugin works with Babel 7\n- **2.x** works with Babel 6\n- **1.x** works with Babel 5\n\n## Installation\n\n```sh\n$ yarn add --dev @allthings/babel-plugin-react-intl\n```\n\n## Usage\n\n**This Babel plugin only visits ES6 modules which `import` React Intl.**\n\nThe default message descriptors for the app's default language will be extracted from: `defineMessages()`, `<FormattedMessage>`, and `<FormattedHTMLMessage>`; all of which are named exports of the React Intl package.\n\nIf a message descriptor has a `description`, it'll be removed from the source after it's extracted to save bytes since it isn't used at runtime.\n\n### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\n    [\n      \"react-intl\",\n      {\n        \"messagesDir\": \"./build/messages/\"\n      }\n    ]\n  ]\n}\n```\n\n#### Options\n\n- **`messagesDir`**: The target location where the plugin will output a `.json` file corresponding to each component from which React Intl messages were extracted. If not provided, the extracted message descriptors will only be accessible via Babel's API.\n\n- **`enforceDescriptions`**: Whether message declarations _must_ contain a `description` to provide context to translators. Defaults to: `false`.\n\n- **`extractSourceLocation`**: Whether the metadata about the location of the message in the source file should be extracted. If `true`, then `file`, `start`, and `end` fields will exist for each extracted message descriptors. Defaults to `false`.\n\n- **`moduleSourceName`**: The ES6 module source name of the React Intl package. Defaults to: `\"react-intl\"`, but can be changed to another name/path to React Intl.\n\n- **`additionalComponentNames`**: To visit more than the components and `defineMessages` provided by `react-intl` set this option to the following format:\n\n  ```\n  \"additionalComponentNames\": {\n    \"react-lingo\": [\"default\", \"LingoFormattedMessage\"]\n  }\n  ```\n\n### Via Node API\n\nThe extract message descriptors are available via the `metadata` property on the object returned from Babel's `transform()` API:\n\n```javascript\nrequire(\"@babel/core\").transform(\"code\", {\n  plugins: [\"react-intl\"]\n}); // => { code, map, ast, metadata['react-intl'].messages };\n```\n\n[react intl]: http://formatjs.io/react/\n","readmeFilename":"README.md"}