{"name":"react-helmet-async","version":"1.0.0-beta.0","description":"Thread-safe Helmet for React 16+ and friends","main":"lib/index.js","umd:main":"lib/index.umd.js","module":"lib/index.mjs","source":"src/index.js","types":"index.d.ts","repository":{"type":"git","url":"git+ssh://git@github.com/NYTimes/react-helmet-async.git"},"author":{"name":"Scott Taylor","email":"scott.c.taylor@mac.com"},"license":"Apache-2.0","dependencies":{"@babel/runtime":"7.3.4","invariant":"2.2.4","prop-types":"15.7.2","react-fast-compare":"2.0.4","shallowequal":"1.1.0"},"devDependencies":{"@babel/cli":"7.2.3","@babel/core":"7.3.4","@babel/plugin-proposal-class-properties":"7.3.4","babel-eslint":"10.0.1","babel-preset-kyt-react":"1.0.0-alpha.365f23ad","enzyme":"3.9.0","enzyme-adapter-react-16":"1.10.0","enzyme-to-json":"3.3.5","eslint":"5.15.1","eslint-config-airbnb":"17.1.0","eslint-config-kyt":"1.0.0-alpha.365f23ad","eslint-config-prettier":"4.1.0","eslint-plugin-import":"2.16.0","eslint-plugin-jest":"22.3.0","eslint-plugin-json":"1.4.0","eslint-plugin-jsx-a11y":"6.2.1","eslint-plugin-kyt":"1.0.0-alpha.365f23ad","eslint-plugin-prettier":"3.0.1","eslint-plugin-react":"7.12.4","jest":"24.3.1","jsdom":"11.12.0","microbundle":"^0.11.0","prettier":"1.16.4","raf":"3.4.1","react":"16.8.4","react-dom":"16.8.4","rimraf":"^2.6.3"},"peerDependencies":{"react":"^16.6.0","react-dom":"^16.6.0"},"scripts":{"clean":"rimraf lib","lint":"eslint .","lint-fix":"eslint . --fix","test":"KYT_ENV_TYPE=test jest --no-cache","test-watch":"npm run test -- --watch","test-update":"npm run test -- -u","compile":"npm run clean && KYT_ENV_TYPE=client NODE_ENV=production microbundle --jsx React.createElement","prepare":"npm run compile"},"jest":{"setupFilesAfterEnv":["<rootDir>/jest.setup.js"],"testEnvironment":"node","testMatch":["**/__tests__/**/*.test.js"],"testPathIgnorePatterns":["/node_modules/","/src/","/lib/","/es/"]},"readme":"# react-helmet-async\n\n[![CircleCI](https://circleci.com/gh/staylor/react-helmet-async.svg?style=svg)](https://circleci.com/gh/staylor/react-helmet-async)\n\n[Announcement post on Times Open blog](https://open.nytimes.com/the-future-of-meta-tag-management-for-modern-react-development-ec26a7dc9183)\n\nThis package is a fork of [React Helmet](https://github.com/nfl/react-helmet).\n`<Helmet>` usage is synonymous, but server and client now requires `<HelmetProvider>` to encapsulate state per request.\n\n`react-helmet` relies on `react-side-effect`, which is not thread-safe. If you are doing anything asynchronous on the server, you need Helmet to encapsulate data on a per-request basis, this package does just that.\n\n## Usage\n\n**New is 1.0.0:** No more default export! `import { Helmet } from 'react-helmet-async'`\n\nThe main way that this package differs from `react-helmet` is that it requires using a Provider to encapsulate Helmet state for your React tree. If you use libraries like Redux or Apollo, you are already familiar with this paradigm:\n\n```javascript\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { Helmet, HelmetProvider } from 'react-helmet-async';\n\nconst app = (\n  <HelmetProvider>\n    <App>\n      <Helmet>\n        <title>Hello World</title>\n        <link rel=\"canonical\" href=\"https://www.tacobell.com/\" />\n      </Helmet>\n      <h1>Hello World</h1>\n    </App>\n  </HelmetProvider>\n);\n\nReactDOM.hydrate(\n  app,\n  document.getElementById(‘app’)\n);\n```\n\nOn the server, we will no longer use static methods to extract state. `react-side-effect`\nexposed a `.rewind()` method, which Helmet used when calling `Helmet.renderStatic()`. Instead, we are going\nto pass a `context` prop to `HelmetProvider`, which will hold our state specific to each request.\n\n```javascript\nimport React from 'react';\nimport { renderToString } from 'react-dom/server';\nimport { Helmet, HelmetProvider } from 'react-helmet-async';\n\nconst helmetContext = {};\n\nconst app = (\n  <HelmetProvider context={helmetContext}>\n    <App>\n      <Helmet>\n        <title>Hello World</title>\n        <link rel=\"canonical\" href=\"https://www.tacobell.com/\" />\n      </Helmet>\n      <h1>Hello World</h1>\n    </App>\n  </HelmetProvider>\n);\n\nconst html = renderToString(app);\n\nconst { helmet } = helmetContext;\n\n// helmet.title.toString() etc…\n```\n\n## Streams\n\nThis package only works with streaming if your `<head>` data is output outside of `renderToNodeStream()`.\nThis is possible if your data hydration method already parses your React tree. Example:\n\n```javascript\nimport through from 'through';\nimport { renderToNodeStream } from 'react-dom/server';\nimport { getDataFromTree } from 'react-apollo';\nimport { Helmet, HelmetProvider } from 'react-helmet-async';\nimport template from 'server/template';\n\nconst helmetContext = {};\n\nconst app = (\n  <HelmetProvider context={helmetContext}>\n    <App>\n      <Helmet>\n        <title>Hello World</title>\n        <link rel=\"canonical\" href=\"https://www.tacobell.com/\" />\n      </Helmet>\n      <h1>Hello World</h1>\n    </App>\n  </HelmetProvider>\n);\n\nawait getDataFromTree(app);\n\nconst [header, footer] = template({\n  helmet: helmetContext.helmet,\n});\n\nres.status(200);\nres.write(header);\nrenderToNodeStream(app)\n  .pipe(\n    through(\n      function write(data) {\n        this.queue(data);\n      },\n      function end() {\n        this.queue(footer);\n        this.queue(null);\n      }\n    )\n  )\n  .pipe(res);\n```\n\n## License\n\nLicensed under the Apache 2.0 License, Copyright © 2018 Scott Taylor\n","readmeFilename":"README.md","gitHead":"d5703b73fd6559a46f1e58df7c47768e2750b5e2","bugs":{"url":"https://github.com/NYTimes/react-helmet-async/issues"},"homepage":"https://github.com/NYTimes/react-helmet-async#readme","_id":"react-helmet-async@1.0.0-beta.0","_npmVersion":"6.4.1","_nodeVersion":"10.10.0","_npmUser":{"name":"wonderboymusic","email":"scott.c.taylor@mac.com"},"dist":{"integrity":"sha512-scL8PIrlfont8W3+H9KhnprqRm3YLlhbj4rQEi6urEPOHn7UqDmxSnCjFzw4QKd5U1jBIOFNhfCYaZQm4JP/6Q==","shasum":"4f1dd02ab016c7d9d3bbd1207163848c00c5f0de","tarball":"http://registry-npm.ywwl.com/react-helmet-async/download/react-helmet-async-1.0.0-beta.0.tgz","fileCount":10,"unpackedSize":187040,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJchuQnCRA9TVsSAnZWagAAWAIQAITcAfs1g0udFPoV9ZVk\nznNlSAjm6PKoKhqnZ4E3VX3SrjQ3riIJypbFUDfncIgDnb0SZiVAKM0r4Kc2\noZMMxkWF1CO1pouHKByLT4b32CdrcoBuRxtC2PHpsXDx5RiUaeQyC8M4qWi5\n8nVFahZOYQWaaEHx8SPRYGWjtGLHEDY4NDErWa3BU6Ibuvul1hpBbl2iVTej\nAJZbBG/sHRrnoemsKwVggH9S+dBiFsPzycQLQw/KbDljeJKd4utlnM5+YgBg\nEuM59DPEB/yfzen5xMem6NSOpzWHkseMzu5WKQmRsrC2RDfkI3j+rz6md32f\nnKxpGnL6a7ZqYc0bmfLDI417T5obo0kI3kTByYy9I8jlIfYqAg4BmCXSDlXZ\nB0X5vLeFFFzy+/yQgzeNQUXeHPtQ2t2Zuqe3/EJxEcajq4wsCr5Yo2cG6VvI\nBhQD+DJ5k4db7dS0Uwqm69i+6eWmeqHPHI1y0HHGWOfoZaXE3x0uNisc3rpX\nz20wtI0+nQHDZRu1mPnVpQvl7Ec9sC/TkPh0h24G80ygZN65HqO0lqjKKzUA\nqbkCyo/l8CEg6292cXUSL82EYFBFjwfpa9naEoe+sZYRV9QnmuV69P/y55li\nQjbvLod9OWbdAp0tYY/tUk+krHtTaZlU58qQJj5wzjcW2SrvpsrF//a8eqBT\nlCYu\r\n=/o4n\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC/HCbyUQ2q2CAnFfr/xMhKtQzbpKrzr3I4y7uxNS2HFAiEAtszNKbK7rxpCXIZ4zorxWlkkULpmhXHFFr2DT8JK0k0="}],"size":55526,"noattachment":false,"key":"/react-helmet-async/-/react-helmet-async-1.0.0-beta.0.tgz"},"maintainers":[{"name":"wonderboymusic","email":"scott.c.taylor@mac.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-helmet-async_1.0.0-beta.0_1552344102811_0.5915248838725438"},"_hasShrinkwrap":false,"publish_time":1552344102924,"_cnpm_publish_time":1552344102924,"dist-tags":{"alpha":"2.0.5-alpha","beta":"2.0.5-beta","latest":"3.1.0","next":"2.0.5-next"}}