{"name":"react-helmet-async","version":"0.3.0-beta.3","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\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":"299ad97dca6ec50b21382ad1cc277d750360eb8c","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.3","_npmVersion":"6.4.1","_nodeVersion":"10.10.0","_npmUser":{"name":"wonderboymusic","email":"scott.c.taylor@mac.com"},"dist":{"integrity":"sha512-izQxXAi6Hfv82DtQR0M60yjD1UjWzt9iv75/+pJCGgSYSwXZSy1CHz4Dik//xe022aegtKAyGKqYxE2Okd4piQ==","shasum":"2cc0e7b22a700dc8b3e48a17cf50fd7652829abd","tarball":"http://registry-npm.ywwl.com/react-helmet-async/download/react-helmet-async-0.3.0-beta.3.tgz","fileCount":10,"unpackedSize":186983,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJchuFSCRA9TVsSAnZWagAA/xsP/2G2YfaosJT7SoS9gLgx\nIlfPO/PXCXCxlwmOLSaQOb0etpYhsYjdM9gV9wecVaelJMYGUWpujuOPM2lp\nNYHlZeLF97xBN6u7xLDjLpjdf3mqNZGRimQ1HgySwiayiHbZZW5LBadd9Znm\nlDgP7b4/P63gSi/Z3UgAl6ZaN0rYozPxkJR5nhp/Gmg+iPdFvi9EsnTUdsIQ\nzX8r5rdGP3ZHknyufqgyvcI1yo/WEx+l30yBFncEcfoWxL2118YriTnFU/Mz\nm9IHrtQA32PMWyiWJbN4pwTOtu+KGNf9a/vv7YYIHhEq5Cic3HbsGQC9Gv07\nMwaEnyaJCsEgmayrgZIZ1PdC6td2rYGknoXC+1SprNIGPml3gT9vs8gnMmcf\n5OUqF6rjqs3xxQSjCHsTkp6GDCX2Xy4bdO9dwGcZ15doGf5hAnKyvph4Gouq\nvC9argFbubEWIHLETtisehewANLDRkdPjdm+pXLgbivU2ywtErRGTUOZHWrD\nsPTL9dhecFHkTn4rM7wwa5XB2Kz2jv5cM9J/Njp/vj1KmO4JXcM+Bam4gHwb\nMP7M5AT9vxzfeZdf+1EiW0zfu+2HP+mk5cGyMVLO0E/nMg0MmBirg2dO2oq5\nbLwL1QIcYIHWT2xVI2EpGo8OGqJTkXDOVgYub7FJxpBQGwNdncDIBB0dmwV/\nVXtV\r\n=ssDC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIClbG9wuqp+8IHY6fovRrT07wXamBu4uzcrD5a/Qq1XAAiEAngpNhl9roJxX6UqTkPTaa/4Dp+wfJtAZzE/D98kjUWk="}],"size":55483,"noattachment":false,"key":"/react-helmet-async/-/react-helmet-async-0.3.0-beta.3.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.3_1552343378118_0.2717167730987222"},"_hasShrinkwrap":false,"publish_time":1552343378317,"_cnpm_publish_time":1552343378317,"dist-tags":{"alpha":"2.0.5-alpha","beta":"2.0.5-beta","latest":"3.1.0","next":"2.0.5-next"}}