{"_id":"@amperio/gatsby-plugin-react-redux-providers","_rev":"2-093c0d6ad99c5877262a8bb11a82dc84","name":"@amperio/gatsby-plugin-react-redux-providers","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@amperio/gatsby-plugin-react-redux-providers","version":"1.0.0","description":"Gatsby plugin for React-Redux with built-in server-side rendering support, redux-persist and other providers usability","keywords":["gatsby","gatsby-plugin","react","redux","react-redux"],"main":"index.js","scripts":{"build":"babel src --out-dir . --ignore **/__tests__","prepare":"cross-env NODE_ENV=production npm run build","prepublishOnly":"npm run lint","format":"prettier --write {src,examples}/**/*.{js,jsx}","lint":"eslint ./src"},"author":{"name":"Amperio sp. z o.o"},"license":"MIT","dependencies":{"serialize-javascript":"^5.0.1"},"peerDependencies":{"react":"*","react-redux":"*","redux-persist":"^6.0.0"},"devDependencies":{"@babel/cli":"^7.11.6","@babel/core":"^7.11.6","@babel/plugin-proposal-nullish-coalescing-operator":"^7.10.4","babel-eslint":"^10.1.0","babel-preset-gatsby-package":"^0.5.3","cross-env":"^7.0.2","eslint":"^7.9.0","eslint-config-prettier":"^6.11.0","eslint-config-react-app":"^5.2.1","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-jsx-a11y":"^6.3.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react":"^7.20.6","eslint-plugin-react-hooks":"^4.1.2","jest":"^26.4.2","prettier":"^2.1.2","react":"^16.8.6","react-dom":"^16.13.1","react-redux":"^7.0.3","redux":"^4.0.5"},"homepage":"https://github.com/amperio-com/gatsby-plugin-react-redux-providers","repository":{"type":"git","url":"git+https://github.com/amperio-com/gatsby-plugin-react-redux-providers.git"},"bugs":{"url":"https://github.com/amperio-com/gatsby-plugin-react-redux-providers/issues"},"jest":{"roots":["<rootDir>/src"]},"gitHead":"7f6d6da966aa5f6892a90819d27de5b597163499","_id":"@amperio/gatsby-plugin-react-redux-providers@1.0.0","_nodeVersion":"14.15.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-Qra+X2eXfU1SsCDDYSUlYeXSkzvwO1hUnOYugDv7MDip2ahEP/gDBhVia1vsg+rzIjjKGqkE/YEYy5Z5Oz6iRg==","shasum":"f998bb7e33517251a528c084137cd9144592c486","tarball":"https://registry.npmjs.org/@amperio/gatsby-plugin-react-redux-providers/-/gatsby-plugin-react-redux-providers-1.0.0.tgz","fileCount":8,"unpackedSize":13837,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzFQwCRA9TVsSAnZWagAADUQP/37g1Od5+DqpCD3iOT9t\ne9K47uDSpQmczrUPqsxgpe1Uz5n0oT1Yrqfftk0/iyndL91Hyv2XuF0GWGt4\nEcnujPIQAaz97N/T21iPpQ6PCy9pVazOr0BACoiR2U5tuB2ThQMn2FbtSwiA\n4xCnisoJNNMJQMf3pro7oRmh95dFiwM8yEH18XnIqbqzA2Q/2jJbx+GYX/mw\nMrZBBOvPM/lYlkOmqPvPPnL44ixkVGikJ10eItEXCPUHOoE3/fw5XmOCM3E4\nVio8dzg1jQXnJocJcQ4hOsiq5XAY8zXFrTQ/2fS0g5K6xS4dg09+K9TZVias\n2RE3bTlrHwvfMj68lUS8GckV+qwwSFfD5nQUsvUpKJECxMuQyE4YOvGo+c+D\njT7ED0FjzVp5ajm0I0f//PGshSxjwN1yKB5u/w4qtTVejVDC57IxT2NCJ4EI\nzmP22xFXIDclK4BeTwnben43mHo5UsDau6ea48RhsROhR1pUrehcUjcNgfyu\nH4HOOY8QNk3uRTsf0kULS4Y+ZzlYI9PC2ciPwC4wlUpFXdRryBj+iLEatWIw\nHU2Gib8h2b3bcz+y8rg2Lj5UZo0u4kr1aaeiTeD/GJREuRvHLl0PrP4R7sVr\n+f37qEDzafsaNIUN55IB4N6YNXSIZ4TCBaCmEwMCY8QQiwhn7lwqABgOULcF\nFk18\r\n=/QoY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCeRF4RX8F5T+VYWlv/54wSg2q4K9b+BZ7hkCDXqtae/AIhAOQZ89rn7HOkdNYgxXalMQO3V/mXLJVFxLA572Rm92gV"}]},"_npmUser":{"name":"amperio","email":"it@amperio.com"},"directories":{},"maintainers":[{"name":"amperio","email":"it@amperio.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/gatsby-plugin-react-redux-providers_1.0.0_1634834223755_0.591384343686526"},"_hasShrinkwrap":false}},"time":{"created":"2021-10-21T16:37:03.711Z","1.0.0":"2021-10-21T16:37:03.875Z","modified":"2022-04-04T13:51:30.747Z"},"maintainers":[{"name":"amperio","email":"it@amperio.com"}],"description":"Gatsby plugin for React-Redux with built-in server-side rendering support, redux-persist and other providers usability","homepage":"https://github.com/amperio-com/gatsby-plugin-react-redux-providers","keywords":["gatsby","gatsby-plugin","react","redux","react-redux"],"repository":{"type":"git","url":"git+https://github.com/amperio-com/gatsby-plugin-react-redux-providers.git"},"author":{"name":"Amperio sp. z o.o"},"bugs":{"url":"https://github.com/amperio-com/gatsby-plugin-react-redux-providers/issues"},"license":"MIT","readme":"# @amperio/gatsby-plugin-react-redux-providers\r\n\r\n> A [Gatsby](https://github.com/gatsbyjs/gatsby) plugin for\r\n> [react-redux](https://github.com/reduxjs/react-redux) with\r\n> built-in server-side rendering support, redux persistance store and adding more providers to existing ones.\r\n\r\n## Install\r\n\r\n`npm install --save @amperio/gatsby-plugin-react-redux-providers react-redux redux-persist redux`\r\n\r\n## How to use\r\n\r\n`./src/state/createStore.js` // same path you provided in gatsby-config\r\n`./src/providers/index.js` // same path you provided in gatsby-config\r\n\r\n```javascript\r\nimport { combineReducers, configureStore, StateFromReducersMapObject } from '@reduxjs/toolkit';\r\nimport { persistStore, persistReducer } from 'redux-persist';\r\nimport sessionStorage from 'redux-persist/es/storage/session';\r\n\r\nconst reducers = {\r\n  ...\r\n};\r\n\r\nconst persistConfig = {\r\n  key: 'root',\r\n  storage: sessionStorage,\r\n};\r\n\r\nconst persistedReducer = persistReducer(persistConfig, combineReducers(reducers));\r\nconst store = configureStore({\r\n  reducer: persistedReducer,\r\n  preloadedState: {},\r\n  devTools: process.env.NODE_ENV === 'development',\r\n});\r\n\r\nexport type Dispatch = typeof store.dispatch;\r\nexport type IRootState = StateFromReducersMapObject<typeof reducers>;\r\n\r\nexport default () => {\r\n  const persistor = persistStore(store);\r\n  return { store, persistor };\r\n};\r\n```\r\n\r\n`./gatsby-config.js`\r\n\r\n```javascript\r\nmodule.exports = {\r\n  plugins: [\r\n    {\r\n      resolve: `@amperio/gatsby-plugin-react-redux-providers`,\r\n      options: {\r\n        // [required] - path to your createStore module\r\n        pathToCreateStoreModule: './src/store/index',\r\n        pathToCreateProviders: './src/providers/index',\r\n        // [optional] - options passed to `serialize-javascript`\r\n        // info: https://github.com/yahoo/serialize-javascript#options\r\n        // will be merged with these defaults:\r\n        serialize: {\r\n          space: 0,\r\n          // if `isJSON` is set to `false`, `eval` is used to deserialize redux state,\r\n          // otherwise `JSON.parse` is used\r\n          isJSON: true,\r\n          unsafe: false,\r\n          ignoreFunction: true,\r\n        },\r\n        // [optional] - if true will clean up after itself on the client, default:\r\n        cleanupOnClient: true,\r\n        // [optional] - name of key on `window` where serialized state will be stored, default:\r\n        windowKey: '__PRELOADED_STATE__',\r\n      },\r\n    },\r\n  ],\r\n};\r\n```\r\n\r\n## Thanks\r\n\r\nThanks to [Leonid Nikiforenko](https://github.com/le0nik/) for original [plugin](https://github.com/le0nik/gatsby-plugin-react-redux/)\r\nand [Andrea Valla](https://github.com/avalla/) for improving it with her version of [plugin](https://github.com/avalla/gatsby-plugin-react-redux-persist/) adding redux-persist package.\r\n\r\n## License\r\n\r\nMIT\r\n","readmeFilename":"README.md"}