{"name":"react-helmet-async","version":"0.3.0-beta.0","description":"Thread-safe Helmet for React 16+ and friends","main":"lib/index.js","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","typings":"index.d.ts","dependencies":{"invariant":"2.2.4","prop-types":"15.6.2","react-fast-compare":"2.0.4","shallowequal":"1.1.0"},"devDependencies":{"@babel/cli":"7.2.3","@babel/core":"7.2.2","@babel/plugin-proposal-class-properties":"7.2.3","@babel/preset-env":"7.2.3","@babel/preset-react":"7.0.0","babel-core":"7.0.0-bridge.0","babel-eslint":"10.0.1","babel-jest":"23.6.0","babel-plugin-transform-react-remove-prop-types":"0.4.21","enzyme":"3.8.0","enzyme-adapter-react-16":"1.7.1","eslint":"5.10.0","eslint-config-airbnb":"17.1.0","eslint-config-prettier":"3.3.0","eslint-plugin-import":"2.14.0","eslint-plugin-jest":"22.1.2","eslint-plugin-json":"1.3.2","eslint-plugin-jsx-a11y":"6.1.2","eslint-plugin-prettier":"3.0.0","eslint-plugin-react":"7.11.1","jest":"23.6.0","jsdom":"13.1.0","prettier":"1.15.3","prettier-eslint":"8.8.2","prettier-eslint-cli":"4.7.1","raf":"3.4.1","react":"16.7.0","react-dom":"16.7.0"},"peerDependencies":{"react":"^16.7.0","react-dom":"^16.7.0"},"scripts":{"lint":"eslint .","lint-fix":"eslint . --fix","test":"jest --no-cache","test-watch":"npm run test -- --watch","test-update":"npm run test -- -u","compile":"NODE_ENV=production npm run compile:commonjs && npm run compile:es","compile:commonjs":"babel src --out-dir lib","compile:es":"babel src --out-dir es","prepare":"npm run compile"},"jest":{"setupTestFrameworkScriptFile":"<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\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":"f7c26c927d4b6fa66132bb5d965672276345195c","bugs":{"url":"https://github.com/NYTimes/react-helmet-async/issues"},"homepage":"https://github.com/NYTimes/react-helmet-async#readme","_id":"react-helmet-async@0.3.0-beta.0","_npmVersion":"6.4.1","_nodeVersion":"10.10.0","_npmUser":{"name":"wonderboymusic","email":"scott.c.taylor@mac.com"},"dist":{"integrity":"sha512-pGwIBvgWPnvzE1zPL1a9EH3L9YJiWs5HfazqgbNnjDC/jiupsl+mvC1uf1udRk+fZCcWmuaelwg3d2YKnxq1iQ==","shasum":"e3e4344962acb39fdb64ba8a7e69801cb4f9dce7","tarball":"http://registry-npm.ywwl.com/react-helmet-async/download/react-helmet-async-0.3.0-beta.0.tgz","fileCount":24,"unpackedSize":116916,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcHsEKCRA9TVsSAnZWagAAo+oP/3XB/NL8THcewNHlctGe\nVR5X66NFSSo7IZSHNtuTDApSd+1xWaA0LLAy2Ax1aMmk4aqvM5kQ6gljrD21\nad8OtiJUk8erhjHNFBZROgva0yTx+RZ8XYc4oDcKO2mHEdFTZJrwlxpX96L4\nTGPAkdjkLQNTstDBtatsHMRdOEhAf0hcvA3PE4H/qXE3l2g3/bnfr7SmzP3Q\nQ+pCowebS/pHSJUa3pl1J13tJXvqbUzGrQ7DD2toRRNL87Z4lpkc/8Oz4hEM\nyJKif8vsFOSPCzMHqzr0XMvhCwQAdKE9ABNwesYlnqCdZEsf4qmXjEHdXBYJ\nkBTJnjkXmaYDdlK3UXTrFcN3BzvcvaU16dE7xhc1ALVd/eRDo1GNWgKD513l\nwpB8TUWMXM8KX0UdcepFdir91EIKvSjP90/lFl7fEb9xaBqnBTYt+rDyZF/l\nQuboF1Gm2NLhgbRHFD9qO9z7PBZoD/6U+vwg7ouGO2ftG3oLozCpzAESx9hu\nqH1N6Fur2EB/N9PcLxV/YCb+92hO4aEmA4o68bXn63yU9q53Nm1RTljsOVol\nl7dTK8qxHPucj2+mH/pOgunfyfsI+vrhY+70uWkvvkPeKmUxJgrk6gg/GguW\ni/ZFKE3EnNXyfVFj0BXJ3CZ27CFDp5GlFyPLco2ovqMeGGF98Ei4fi0Wc9hc\nPVT8\r\n=muMC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCDagBOMCL2C5x3AfkdyBEueDftJM0cGDY1SPPlLbU+hgIhAKkhrX6NzSvZn/hP7NvHvARgvDONPk5nVeJrNrgedz6Q"}],"size":25073,"noattachment":false,"key":"/react-helmet-async/-/react-helmet-async-0.3.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_0.3.0-beta.0_1545519370064_0.18851046186370657"},"_hasShrinkwrap":false,"publish_time":1545519370187,"_cnpm_publish_time":1545519370187,"dist-tags":{"alpha":"2.0.5-alpha","beta":"2.0.5-beta","latest":"3.1.0","next":"2.0.5-next"}}