{"name":"react-helmet-async","version":"1.0.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 --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":"e3388df6c60c5e5db3eecb0c6ad48d7e5b96a74b","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.1","_npmVersion":"6.4.1","_nodeVersion":"10.10.0","_npmUser":{"name":"wonderboymusic","email":"scott.c.taylor@mac.com"},"dist":{"integrity":"sha512-j/LrS1u0gCfTqJRGN7vs4OwgQ5V5XNFc13xkbsT9lY+5A9b3c0K/OiXSR2wOhIYVhtkgHoVZ1eGRJuPRvlNMug==","shasum":"eada52c96ef884289fb7b75cc259d48579521ac9","tarball":"http://registry-npm.ywwl.com/react-helmet-async/download/react-helmet-async-1.0.0-beta.1.tgz","fileCount":17,"unpackedSize":216324,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJchuYgCRA9TVsSAnZWagAASMsQAJBagtxY8Qh0ByMwEFpw\nhhBXNqiUruk6mCz4k0pYu6wHGCbl1PWAv9wXlCwMTYxOj9AjJOc1BrVVl/NY\n7Bj0lrgGUvzy97xvbv4oFJOgqCImpSqA1fVHGNfnhbbhnv1QcL7hXF89rLEb\n+0NbjooAA0RqJ9Y3xYW8oMOCUm3dET0Rzl78RQp1eUO4uR4FIwqsZPW9iKcA\nll8GItrrJ8xI3j8ZwF8QwSjMVVU/7iMMVjKrjkI/+OlYYDZXtbyk5lYUBbkD\n6fnG+tZ09RNtwUMw9L+mj+6UcWQv5f5/x38Bf6Jw+NazjYpzQYZYLZec411R\njKRZtmduMtlzYWP4+dJF0u/DPUbHhTj5eNXk2IJa76SPkL41kL8KPVwQ+TbU\nDek5XECjUGNVnW/E/RQpGravFTkQyy76szN0TkeuLphK1vgRkLv6J9UiHms+\nS0FmURtOkMG2a8s5bTbiBi2wcun+uoXCvZLDeZjWFKsWi2MBcCjTOSeVPEvi\nEM35Vj6Ma4ytV4jA43ad8LHdkIw+MolHbS8WxU6JXZSjRdnSbDr+r3rupzwb\nRESfxevl45TF5E4VizWO+XCf+qn+mQTn16uM0ufwFHW/lUH0R4zeWcHgn7zK\nxElTBSn3q4BXp/pcmauk6ALUepfTdjUhL7KqmVCqbMgbWcVbuHd1WOabrirw\nlagS\r\n=Mz1u\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCwpX17QOG8mtwYRNtJUmXq+Afcc81b7mXRu47FpcYAYQIhAJ3G9OIL2kLv9u0ctEmaag0VoXnITlMaSDj7PWJT/7oi"}],"size":60969,"noattachment":false,"key":"/react-helmet-async/-/react-helmet-async-1.0.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_1.0.0-beta.1_1552344607908_0.7557493902300982"},"_hasShrinkwrap":false,"publish_time":1552344608102,"_cnpm_publish_time":1552344608102,"dist-tags":{"alpha":"2.0.5-alpha","beta":"2.0.5-beta","latest":"3.1.0","next":"2.0.5-next"}}