{"name":"react-helmet-async","version":"0.3.0-beta.1","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","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":"f26b10cc45b58dba48fcd01673351ad14c4b758a","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.1","_npmVersion":"6.4.1","_nodeVersion":"10.10.0","_npmUser":{"name":"wonderboymusic","email":"scott.c.taylor@mac.com"},"dist":{"integrity":"sha512-71Fo5mRC8VhAAhGoLYvlmuLcx0aCVIMaFzLUFXsCjXXoUk+4OqqBXesCWC2BVKDoNKov/URWWp4LyCiUzGgghA==","shasum":"3ad9c63ae794e26106b2dd19744b94da39b06fe0","tarball":"http://registry-npm.ywwl.com/react-helmet-async/download/react-helmet-async-0.3.0-beta.1.tgz","fileCount":10,"unpackedSize":186261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJchtqjCRA9TVsSAnZWagAAK5YP/A0eGx2IAUqO2ZbmcoaF\nr4orM+UXXccixSHO2AbkZOOvYDFZtfVh5vyCHeU0XAusvyXaEzXkoHFx+tyG\nZF0hQlFWpdiC418DwHTJj6tC2HDfRzXOWlHD8YAgXxSAqK8neR21KbcSawT5\nMMtw/P2fEZuyzhV7+478BKuhDDR8gk7FLHgUrS3Ne/nJ2JmpQ1ru/QntglsF\nNQ5iUP1bd4Z6IimxrrSiO/COyD0QMQ21nzVQdOOX3B1s9GFbTFB1urTzImY4\nV8HajW1wU8bQ2HZil8RyUbUqT7qef6CoTbMxgwKRXTlhGmEoW30dJycL87WX\nEDaSnyZ1uLRTM/k4SzrFzZ14FDy0D3aVy7NmP+tq09OuSYYiTx148lTiBghV\n6zP633h7Es2f2yjOONiAB0Sop9LAWHyMGsG9g8dhSkVuzD+FP3MGdok3VGly\nT0IMPRqlbAyn2McWClacrl7xMpK1Fu7zoBTQharesatlSAS7vw8dWZx4QG0A\nmtI346x4zZEOHPc0xNEDpDCHn8LcnnQBX6gkrSoMEz90RgBdfs3bF0oGpFLc\nXrOh3ybEtw5JAw8kQOjHt0z5jelj61h9iPVNCfOBrmmeJMEBDxgYopdMYXBg\nSs0no43VOeuWbqGWZV5S9HVRwXssAUUypQt10BBy9VJwRgE5vtE4zcwf7e5p\nB5m4\r\n=Wt2/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB6djrAZ6DDUHEuz3642t3xgYv39M/dtx0TzBFhta/B8AiEAi/Oy/fVK4osPgDws4pmyey0xpI4fGioALgeQZj5vExU="}],"size":55295,"noattachment":false,"key":"/react-helmet-async/-/react-helmet-async-0.3.0-beta.1.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.1_1552341667218_0.9372259079008682"},"_hasShrinkwrap":false,"publish_time":1552341667391,"_cnpm_publish_time":1552341667391,"dist-tags":{"alpha":"2.0.5-alpha","beta":"2.0.5-beta","latest":"3.1.0","next":"2.0.5-next"}}