{"_id":"@bravadoco/nuxt-redirect","_rev":"7-fd3fae712cf5dc8a667990569b5d7d53","name":"@bravadoco/nuxt-redirect","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@bravadoco/nuxt-redirect","version":"1.0.0","description":"Nuxt module to dynamically redirect initial requests","keywords":["nuxtjs","nuxt","redirect","seo","permanent","temporary"],"license":"MIT","contributors":[{"name":"Artur Kornakov","email":"artur@bravado.co"},{"name":"Alexander Lichter","email":"npm@lichter.io"}],"main":"lib/module.js","repository":{"type":"git","url":"git+https://github.com/Bravado-network/nuxt-redirects.git"},"publishConfig":{"access":"public"},"scripts":{"dev":"nuxt test/fixture","lint":"eslint lib test","test":"jest","release":"yarn test && standard-version && git push --follow-tags && npm publish"},"devDependencies":{"@babel/core":"^7.16.11","@babel/eslint-parser":"^7.17.0","@babel/preset-env":"^7.16.11","@commitlint/cli":"^8.1.0","@commitlint/config-conventional":"^8.1.0","@nuxtjs/eslint-config":"^1.1.2","babel-eslint":"^10.0.3","babel-jest":"^27.5.1","codecov":"^3.5.0","consola":"^2.10.1","eslint":"^6.2.2","get-port":"^5.0.0","husky":"^3.0.4","jest":"^27.5.1","nuxt-edge":"^2.16.0-27358576.777a4b7f","request":"latest","request-promise-native":"^1.0.7","standard-version":"^7.0.0"},"dependencies":{"path-to-regexp":"^6.2.0"},"gitHead":"ef1dd2106cefd8398b8fcc16ae6a8df089939eb1","bugs":{"url":"https://github.com/Bravado-network/nuxt-redirects/issues"},"homepage":"https://github.com/Bravado-network/nuxt-redirects#readme","_id":"@bravadoco/nuxt-redirect@1.0.0","_nodeVersion":"14.19.1","_npmVersion":"6.14.16","dist":{"integrity":"sha512-3RsSBhDcTddeM4awfC9/wMHM682Cz4tfZ9fL9hcUQZh/JNRUvtSEEugi7PVjOPTpWfEkhpxADTYC3Lz0Gv+9TA==","shasum":"6139c34a7eb6a12be200d5935ec855c0a5d242de","tarball":"https://registry.npmjs.org/@bravadoco/nuxt-redirect/-/nuxt-redirect-1.0.0.tgz","fileCount":6,"unpackedSize":13350,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGbX399cwHqjoz6ywcWsA3RFhI2hdwJjJkYxgm+BwXffAiEAhAfMYmek4Y/vp9cXP3ykiTZ29PUdFhrP6BLDRoNCddo="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiTpHNACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrH1w//fVPkbSMRDqa/dIKTD8oe5kjlZIWDg1PtB6rBgFJepp268Q+u\r\nvyFianszQFiYXPUEvcnUo4t/f/XfPmK2/x86rjI3MdUItnQMsfEykqw+1/Ct\r\nt3+Pke529qfAap8w7/m2586iDTeUQK6QtAVkCEEOLXW92W/wFHpZ0UNxWUq2\r\nDZ5SLamcVah57QOy50Ub/+JoVca/7Q8sCApy52aRwqW8XygitCbWPwehbEpR\r\nbR846DMi4v+GTndhTeatPOUmA1IOnzFwtC7OEY/y+BBvsSPgEU8Bn1+YdFiz\r\n79zxXC0Qi/gXc4BWo6p7mmyznCO73gmmxKu9GrCxpgVU/amTj+/31NSimsd4\r\nZeKAqSlvxMQ84sjfs6xEjM16nCMF+SQhiaV5o/G8lLYbZv5fMHOAMtrBH+46\r\nmOlqg6CE2oYbOcPzBki4ikvb1nm3sbGN56NllMsKOcxIkz8mbZ85UgzQ3T5p\r\naKb762xypUk8uaku9Fs8JGhlhxaAnVWbGlSMSXVAy0uIATNRq3ZQwUl9tlhm\r\ndl3584Pot0GHsEGJDR3REkR/rkUd5Cton2USMVxfoniaS9HIb5mdhvrEn7Nj\r\nrRhLc34qmeUgpse/MxvEPhlELU8Skkk7GW6iwjph2d5Uawx0CSKGGW5hJUHO\r\n6R5PR+ZlrELOLuccKOLHc47U56lTWGCJIaU=\r\n=bczS\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"fliptheweb","email":"itisshortemailaddress@gmail.com"},"directories":{},"maintainers":[{"name":"fliptheweb","email":"itisshortemailaddress@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nuxt-redirect_1.0.0_1649316301290_0.12484616621385802"},"_hasShrinkwrap":false},"1.0.1":{"name":"@bravadoco/nuxt-redirect","version":"1.0.1","description":"Nuxt module to dynamically redirect initial requests","keywords":["nuxtjs","nuxt","redirect","seo","permanent","temporary"],"license":"MIT","contributors":[{"name":"Artur Kornakov","email":"artur@bravado.co"},{"name":"Alexander Lichter","email":"npm@lichter.io"}],"main":"lib/module.js","repository":{"type":"git","url":"git+https://github.com/Bravado-network/nuxt-redirects.git"},"publishConfig":{"access":"public"},"scripts":{"dev":"nuxt test/fixture","lint":"eslint lib test","test":"jest","release":"yarn test && standard-version && git push --follow-tags && npm publish"},"devDependencies":{"@babel/core":"^7.16.11","@babel/eslint-parser":"^7.17.0","@babel/preset-env":"^7.16.11","@commitlint/cli":"^8.1.0","@commitlint/config-conventional":"^8.1.0","@nuxtjs/eslint-config":"^1.1.2","babel-eslint":"^10.0.3","babel-jest":"^27.5.1","codecov":"^3.5.0","consola":"^2.10.1","eslint":"^6.2.2","get-port":"^5.0.0","husky":"^3.0.4","jest":"^27.5.1","nuxt-edge":"^2.16.0-27358576.777a4b7f","request":"latest","request-promise-native":"^1.0.7","standard-version":"^7.0.0"},"dependencies":{"path-to-regexp":"^6.2.0"},"gitHead":"4f97f5d4b4dcd68cbff0b66b839be948f4cc4528","bugs":{"url":"https://github.com/Bravado-network/nuxt-redirects/issues"},"homepage":"https://github.com/Bravado-network/nuxt-redirects#readme","_id":"@bravadoco/nuxt-redirect@1.0.1","_nodeVersion":"14.19.1","_npmVersion":"6.14.16","dist":{"integrity":"sha512-oldJPp1zSEC9PARyeqQyCfbkuYn1xI/T7SRhZav2PE2BJUfl7iiNF738/U0XKNEriPVmJ0kvYLmMz1WiaeD25g==","shasum":"e7349a3c732036b2531a2cb4ac0e23fac63230f1","tarball":"https://registry.npmjs.org/@bravadoco/nuxt-redirect/-/nuxt-redirect-1.0.1.tgz","fileCount":6,"unpackedSize":13382,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICUAN2f7xfHlYS1cdQ8ChM0P+DiNRiGUWz1IEA7oGuQ0AiEA9b9xk5bC1W4qKTw6O3ozpsMw9HSVMecq6+oLszSDy3M="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiTpwFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqpaw//YER1JE5tifk8R981wMHdT7Ea+whjHvXUPKhMYbvMcogY15p5\r\nv9u9162CM8C8HV9O/WmQHomzvFs6CZ4SQ//XDVp35CJOAMZJq69FYaxHpfwP\r\ndA71HiEumEM2I74RoNn+R0IL5KqK415Qgs7St+qf6xBzzDQYxsVvNtnik7Gr\r\n0IBqJrNWoKs/i8oO3s/k+cQ3WJtNDk2g9KoSUcY8rsKEN4Ue4XjngLYhcbsm\r\nSHoBUdD9DMH6OmsRw7LirbzK6ZFg7sBOB1Y6vfj7GWfYl3MLuWScDh4+4z0C\r\niALjvYr2lkanfy2N5jbkY+6ADjloKUfvcRtI1OL4cn2jn0kN7m6NJdCDJ9Br\r\nO04cfZmz2wmsFhlK50Ac+Zqiy+AzmiB9Onl5Amfo4hEbNUj8c6UIDuYH4xWw\r\nEKY5P+pQEuo1Da6BwWCp8Tg16DpvRDtLMesoJoTh2pkIBlkoaKRFDSQmODL0\r\nRohLjSWcoTvR/ySUbBxBIUomtsnXe/k5qtE96O+IxNvyQ/AY8xYtQ2G9LCQ7\r\nOpL2azv8nbbTF7v7iscCvYajLpogrnIfqp30S7Ox5s30SL7pCfz5l0PKzvRE\r\nhf/4TF2HTd0C/32uOXSsTyt4Vb/afFUEufgstAn8yPn6sMTwS+aBbDuMHwRt\r\nVPUfQmQpFW0g9DPT82Hctq5/GD4jMyXkbFE=\r\n=6GF9\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"fliptheweb","email":"itisshortemailaddress@gmail.com"},"directories":{},"maintainers":[{"name":"fliptheweb","email":"itisshortemailaddress@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nuxt-redirect_1.0.1_1649318917584_0.7983866693636983"},"_hasShrinkwrap":false},"1.0.2":{"name":"@bravadoco/nuxt-redirect","version":"1.0.2","description":"Nuxt module to dynamically redirect initial requests","keywords":["nuxtjs","nuxt","redirect","seo","permanent","temporary"],"license":"MIT","contributors":[{"name":"Artur Kornakov","email":"artur@bravado.co"},{"name":"Alexander Lichter","email":"npm@lichter.io"}],"main":"lib/module.js","repository":{"type":"git","url":"git+https://github.com/Bravado-network/nuxt-redirects.git"},"publishConfig":{"access":"public"},"scripts":{"dev":"nuxt test/fixture","lint":"eslint lib test","test":"jest","release":"yarn test && standard-version && git push --follow-tags && npm publish"},"devDependencies":{"@babel/core":"^7.16.11","@babel/eslint-parser":"^7.17.0","@babel/preset-env":"^7.16.11","@commitlint/cli":"^8.1.0","@commitlint/config-conventional":"^8.1.0","@nuxtjs/eslint-config":"^1.1.2","babel-eslint":"^10.0.3","babel-jest":"^27.5.1","codecov":"^3.5.0","consola":"^2.10.1","eslint":"^6.2.2","get-port":"^5.0.0","husky":"^3.0.4","jest":"^27.5.1","nuxt-edge":"^2.16.0-27358576.777a4b7f","request":"latest","request-promise-native":"^1.0.7","standard-version":"^7.0.0"},"dependencies":{"path-to-regexp":"^6.2.0"},"gitHead":"d55e63d2f5a55045a95d26dd9d2d1b0cdbb47ca4","bugs":{"url":"https://github.com/Bravado-network/nuxt-redirects/issues"},"homepage":"https://github.com/Bravado-network/nuxt-redirects#readme","_id":"@bravadoco/nuxt-redirect@1.0.2","_nodeVersion":"14.19.1","_npmVersion":"6.14.16","dist":{"integrity":"sha512-9yPaS9dYLslk8D50rXmhpEa4crzW4sA0EYnI+mliiq6gDsAcLOSUH8XMpopQ9IgWIaXCfLoc0cqfYPdI0+AwGw==","shasum":"ffee4bf0979b92d9f76b70de50a83dfdbc62c294","tarball":"https://registry.npmjs.org/@bravadoco/nuxt-redirect/-/nuxt-redirect-1.0.2.tgz","fileCount":6,"unpackedSize":13597,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA7ZmZoTJEho3cdq7aAYstB0j/G7tHqg7BF7lmXOfIGxAiAVsTg3yRINjUg/Yelx+5j/qx+Q2x6yKheil9E7MrroFQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiTq+bACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo6FA/8D2w76zTk2o4Hn5KkQg0XBTqDJstWWw2PqStmMxlXcmO/aqFq\r\nyEl7w0EdpdRYy2tAZGAZcSRhoEcjjcdf09hSGzjuTQxVCw+ejpu9DtZBtUWl\r\nvWWrLudwom/d7dKAcLtY6pLl8tqpl/bnqYI4K2UnXt46rhAE0mW9gsn7MchX\r\n/RoRQCnmY8i6rQAUWEp+/bAbeHYAEIo8JU9iSwU/TBUth88p95fDiYY+Dl8J\r\nM0nLzqa3TM8G+qPA7P72zqQcBdzmoFQ0TO6XuuG/c3fUCdWM7ZVZknhkVpKx\r\nOAC+W1RzR+gz6yrEiq52TujMZRFg2MsF7RFRx1Uc0QjcKngDBmE/whXNnSTV\r\ngQBBerZZF6Sc01NRRTeP1OdaZwvlEy/kmoQ69T9HfQjsuohJiqWP6uJw88fp\r\n/DCRKkigl/M3EtVsMClEe0nxYyJJgynKivyuJ2J+Rf601yuVRzPp/f6vI8zG\r\nifbnjo1Uvpa75x35kJmwsRZ6Or4LWm4bkuHz1vkpwNOA1oFhlnMtA9sDPh0Y\r\nIvJVpk8TtjN4UDSBxFjXFXuYNmoT/NE/N2LmFls26WCQ9sNY7moh8oaFMWaM\r\nZGqgoYXyt2+zzvknb/0bfz1lXoVOTjPth99a3h/qufcCfh1jNouUVbB2mKxo\r\nk+SgZ1TVKJYh4BXz0t3rNfmCo7HlDdqLgHw=\r\n=pIhg\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"fliptheweb","email":"itisshortemailaddress@gmail.com"},"directories":{},"maintainers":[{"name":"fliptheweb","email":"itisshortemailaddress@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nuxt-redirect_1.0.2_1649323931690_0.41356350860796387"},"_hasShrinkwrap":false}},"time":{"created":"2022-04-07T07:25:01.226Z","1.0.0":"2022-04-07T07:25:01.460Z","modified":"2023-12-19T13:00:29.383Z","1.0.1":"2022-04-07T08:08:37.790Z","1.0.2":"2022-04-07T09:32:11.820Z"},"maintainers":[{"email":"apps@bravado.co","name":"appsbravado"},{"email":"pedrolages@bravado.co","name":"pedro-bravado"},{"email":"diego@bravado.co","name":"diego-bravadoco"},{"email":"itisshortemailaddress@gmail.com","name":"fliptheweb"}],"description":"Nuxt module to dynamically redirect initial requests","homepage":"https://github.com/Bravado-network/nuxt-redirects#readme","keywords":["nuxtjs","nuxt","redirect","seo","permanent","temporary"],"repository":{"type":"git","url":"git+https://github.com/Bravado-network/nuxt-redirects.git"},"contributors":[{"name":"Artur Kornakov","email":"artur@bravado.co"},{"name":"Alexander Lichter","email":"npm@lichter.io"}],"bugs":{"url":"https://github.com/Bravado-network/nuxt-redirects/issues"},"license":"MIT","readme":"As original [`@nuxtjs/redirect-module`](https://github.com/nuxt-community/redirect-module) seems abandoned, I created that repo with support of:\n- client redirects with `vue-router` (thanks @ricardogobbosouza);\n- `permanent: true` instead of 301/302 status code (like in [next.js redirects](https://nextjs.org/docs/api-reference/next.config.js/redirects)) to avoid confusion and mistakes;\n- [path-to-regexp](https://github.com/pillarjs/path-to-regexp) instead of 2 different scheme for client and server;\n- redirect to external urls;\n\nTodo:\n- [ ] `to` as async function for `vue-router`;\n- [ ] fill params for external url;\n\n# Redirect Module 🔀\n\n<!-- [![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![Circle CI][circle-ci-src]][circle-ci-href]\n[![Codecov][codecov-src]][codecov-href]\n[![Dependencies][david-dm-src]][david-dm-href]\n[![Standard JS][standard-js-src]][standard-js-href] -->\n\n> Nuxt module to dynamically redirect initial requests\n\n<!-- [📖 **Release Notes**](./CHANGELOG.md) -->\n\n## Features\n\nRedirecting URLs is an often discussed topic, especially when it comes to\nSEO. Previously it was hard to create a \"real\" redirect without performance\nloss or incorrect handling. But this time is over!\n\n## Setup\n\n1. Add the `@bravadoco/nuxt-redirect` dependency with `yarn` or `npm` to your project\n2. Add `@bravadoco/nuxt-redirect` to the `modules` section of `nuxt.config.js`:\n3. Configure it:\n\n```js\n{\n  modules: [\n    ['@bravadoco/nuxt-redirect', {\n      // Redirect option here\n    }]\n  ]\n}\n```\n\n### Using top level options\n\n```js\n{\n  modules: [\n    '@bravadoco/nuxt-redirect'\n  ],\n  redirect: [\n    // Redirect options here\n  ]\n}\n```\n\n## Options\n\n### `rules`\n\n- Default: `[]`\n\nRules of your redirects.\n\n### `onDecode`\n\n- Default: `(req, res, next) => decodeURI(req.url)`\n\nYou can set decode.\n\n### `onDecodeError`\n\n- Default: `(error, req, res, next) => next(error)`\n\nYou can set callback when there is an error in the decode.\n\n### `statusCode`\n\n- Default: `302`\n\nYou can set the default statusCode which gets used when no statusCode is defined on the rule itself.\n\n## Usage\n\nSimply add the links you want to redirect as objects to the module option array:\n\n```js\nredirect: [\n  { from: '/myoldurl', to: '/mynewurl' },\n  { from: '/anotherurl', to: 'https://google.com' }\n]\n```\n\nYou can set up a custom status code as well. By default, it's *302*!\n\n```js\nredirect: [\n  { from: '/myoldurl', to: '/mynewurl', statusCode: 301 }\n]\n```\n\nYou could use `permanent: true` for 301 redirect. Result the same as above.\n\n```js\nredirect: [\n  { from: '/myoldurl', to: '/mynewurl', permanent: true }\n]\n```\n\nWe use [path-to-regexp](https://github.com/pillarjs/path-to-regexp) under the hood, so feel free to use `(.*)` and named params.\n\n```js\nredirect: [\n  { from: '/myoldurl/(.*)', to: '/comeallhere' }, // Many urls to one\n  { from: '/anotherold/:slug', to: '/new/:slug' } // One to one mapping\n  { from: '/onemoreold/:category/:slug', to: '/new/:slug' } // Get rid of param\n]\n```\n\nFurthermore you can use a function to create your `to` url as well :+1:\nThe requested `url` will be provided as arguments from middleware.\nFunction will be executed while navigation in server middleware and in client's `vue-router`.\n\n```js\nredirect: [\n  {\n    from: '/someUrlHere/(.*)',\n    to: (url) => {\n      const param = url.match(/someUrlHere\\/(.*)$/)[1]\n      return `/posts/${param}`\n    }\n  }\n]\n```\n\n<!-- And if you really need more power... okay! You can also use a factory function\nto generate your redirects:\n\n```js\nredirect: async () => {\n  const someThings = await axios.get(\"/myApi\") // It'll wait!\n  return someThings.map(coolTransformFunction)\n}\n```\n\nNow, if you want to customize your redirects, how your decode is done\nor when there is some error in the decode, you can also:\n\n```js\nredirect: {\n  rules: [\n    { from: '/myoldurl', to: '/mynewurl' }\n  ],\n  onDecode: (req, res, next) => decodeURI(req.url),\n  onDecodeError: (error, req, res, next) => next(error)\n}\n```\n\n**ATTENTION**: The factory function **must** return an array with redirect\nobjects (as seen above). -->\n\n## Gotchas\n\nDue to inconsistency of server middleware and vue-router you can't use async functions for `to`.\nIf you want to send a PR with that feature - feel free!\n\n## Development\n\n1. Clone this repository\n2. Install dependencies using `yarn install` or `npm install`\n3. Start development server using `npm run dev`\n\n## License\n\n[MIT License](./LICENSE)\n\nCopyright (c) Alexander Lichter <npm@lichter.io>\n\nCopyright (c) Artur Kornakov <artur@bravado.co>\n\n<!-- Badges -->\n[npm-version-src]: https://img.shields.io/npm/dt/@nuxtjs/redirect-module.svg?style=flat-square\n[npm-version-href]: https://npmjs.com/package/@nuxtjs/redirect-module\n[npm-downloads-src]: https://img.shields.io/npm/v/@nuxtjs/redirect-module/latest.svg?style=flat-square\n[npm-downloads-href]: https://npmjs.com/package/@nuxtjs/redirect-module\n[circle-ci-src]: https://img.shields.io/circleci/project/github/nuxt-community/redirect-module.svg?style=flat-square\n[circle-ci-href]: https://circleci.com/gh/nuxt-community/redirect-module\n[codecov-src]: https://img.shields.io/codecov/c/github/nuxt-community/redirect-module.svg?style=flat-square\n[codecov-href]: https://codecov.io/gh/nuxt-community/redirect-module\n[david-dm-src]: https://david-dm.org/nuxt-community/redirect-module/status.svg?style=flat-square\n[david-dm-href]: https://david-dm.org/nuxt-community/redirect-module\n[standard-js-src]: https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square\n[standard-js-href]: https://standardjs.com\n","readmeFilename":"README.md"}