{"_id":"grunt-connect-rewrite","_rev":"28-e5412ca65d6dc9abba472bc48615bd60","name":"grunt-connect-rewrite","description":"Provides RewriteRules middleware for the grunt connect and express.","dist-tags":{"latest":"0.2.2"},"versions":{"0.1.0":{"name":"grunt-connect-rewrite","description":"Provides RewriteRules middleware for the grunt connect.","version":"0.1.0","homepage":"https://github.com/viart/grunt-connect-rewrite","author":{"name":"Artem Vitiuk","email":"artem@devart.in.ua"},"repository":{"type":"git","url":"git@github.com:viart/grunt-connect-rewrite.git"},"bugs":{"url":"https://github.com/viart/grunt-connect-rewrite/issues"},"licenses":[{"type":"MIT","url":"https://github.com/viart/grunt-connect-rewrite/blob/master/LICENSE-MIT"}],"main":"Gruntfile.js","engines":{"node":">= 0.8.0"},"scripts":{"test":"grunt test"},"devDependencies":{"grunt-contrib-jshint":"~0.1.1","grunt-contrib-clean":"~0.4.0","grunt-contrib-nodeunit":"~0.1.2","grunt":"~0.4.1"},"peerDependencies":{"grunt":"~0.4.1"},"keywords":["gruntplugin","grunt-contrib-connect","rewrite","route"],"_id":"grunt-connect-rewrite@0.1.0","dist":{"shasum":"3916f201586cc4d882705753f0dcb06782e036c5","tarball":"https://registry.npmjs.org/grunt-connect-rewrite/-/grunt-connect-rewrite-0.1.0.tgz","integrity":"sha512-clTn0O7/rrNyDMcl/Hr/77+SlMxJQ7y4BqwER8ABO6tcF4QPWu1bYSfz1tJ3ZalsYTfFGvgPyt61F3pVFY4VYQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDig1wyhmhbADKrVPRlXzZxKoXZjpI1gIwf+ZHMHNfKngIhAJj5NtouZjOQkrgfkw1FOrgz6bmAOOJTIl2PTa/Axt9j"}]},"_from":".","_npmVersion":"1.2.17","_npmUser":{"name":"viart","email":"artem@devart.in.ua"},"maintainers":[{"name":"viart","email":"artem@devart.in.ua"}],"directories":{}},"0.1.1":{"name":"grunt-connect-rewrite","description":"Provides RewriteRules middleware for the grunt connect and express.","version":"0.1.1","homepage":"https://github.com/viart/grunt-connect-rewrite","author":{"name":"Artem Vitiuk","email":"artem@devart.in.ua"},"repository":{"type":"git","url":"git@github.com:viart/grunt-connect-rewrite.git"},"bugs":{"url":"https://github.com/viart/grunt-connect-rewrite/issues"},"licenses":[{"type":"MIT","url":"https://github.com/viart/grunt-connect-rewrite/blob/master/LICENSE-MIT"}],"main":"Gruntfile.js","engines":{"node":">= 0.8.0"},"scripts":{"test":"grunt test"},"devDependencies":{"grunt-contrib-jshint":"~0.1.1","grunt-contrib-clean":"~0.4.0","grunt-contrib-nodeunit":"~0.1.2","grunt":"~0.4.1"},"peerDependencies":{"grunt":"~0.4.1"},"keywords":["gruntplugin","grunt-contrib-connect","grunt-express","modrewrite","rewriterule","rewrite","route","connect","express"],"_id":"grunt-connect-rewrite@0.1.1","dist":{"shasum":"ac740685507429a74b8707f34faad30c82eee9b3","tarball":"https://registry.npmjs.org/grunt-connect-rewrite/-/grunt-connect-rewrite-0.1.1.tgz","integrity":"sha512-ilFnlr0bxDZctWYUTZ3TXd0/RSqjfwjdK6GAzdzaS2ArUN0R+HG6PJPhbANY1PHjJ51O0WXFU1mySCxL3JcomA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCrK+rtQSkqz1pe5kn+OoMQycjdhXLdxCQcGk5cQ+tETwIgK5H08ozkru40hDNZi9OA99JXUH3qWtVRRIJ27U+Gkuw="}]},"_from":".","_npmVersion":"1.3.2","_npmUser":{"name":"viart","email":"artem@devart.in.ua"},"maintainers":[{"name":"viart","email":"artem@devart.in.ua"}],"directories":{}},"0.2.0":{"name":"grunt-connect-rewrite","description":"Provides RewriteRules middleware for the grunt connect and express.","version":"0.2.0","homepage":"https://github.com/viart/grunt-connect-rewrite","author":{"name":"Artem Vitiuk","email":"artem@devart.in.ua"},"repository":{"type":"git","url":"git@github.com:viart/grunt-connect-rewrite.git"},"bugs":{"url":"https://github.com/viart/grunt-connect-rewrite/issues"},"licenses":[{"type":"MIT","url":"https://github.com/viart/grunt-connect-rewrite/blob/master/LICENSE-MIT"}],"main":"Gruntfile.js","engines":{"node":">= 0.8.0"},"scripts":{"test":"grunt test"},"devDependencies":{"grunt-contrib-jshint":"~0.1.1","grunt-contrib-clean":"~0.4.0","grunt-contrib-nodeunit":"~0.1.2","grunt":"~0.4.1"},"peerDependencies":{"grunt":"~0.4.1"},"keywords":["gruntplugin","grunt-contrib-connect","grunt-express","modrewrite","rewriterule","rewrite","route","connect","express"],"_id":"grunt-connect-rewrite@0.2.0","dist":{"shasum":"1a1c34aa94a0426bad03a9daa84b378ab3928d1a","tarball":"https://registry.npmjs.org/grunt-connect-rewrite/-/grunt-connect-rewrite-0.2.0.tgz","integrity":"sha512-GyojmgHiRlY+jSs6JrHAcNB3m8C3FhHub8GDllHK9VZzOqs3YfD7Yv1EqFRthnJos8O76eHLs4V5qHRkmEPQUw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD/1wLY8qEF2uY+ui9Y8VrehTDkqppKSbQDei6boDZrjQIgS/4cB5bzYtqNH0PVtMWSFE8urcLhxAppFhSXJOmXqaQ="}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"viart","email":"artem@devart.in.ua"},"maintainers":[{"name":"viart","email":"artem@devart.in.ua"}],"directories":{}},"0.2.1":{"name":"grunt-connect-rewrite","description":"Provides RewriteRules middleware for the grunt connect and express.","version":"0.2.1","homepage":"https://github.com/viart/grunt-connect-rewrite","author":{"name":"Artem Vitiuk","email":"artem@devart.in.ua"},"repository":{"type":"git","url":"git@github.com:viart/grunt-connect-rewrite.git"},"bugs":{"url":"https://github.com/viart/grunt-connect-rewrite/issues"},"licenses":[{"type":"MIT","url":"https://github.com/viart/grunt-connect-rewrite/blob/master/LICENSE-MIT"}],"main":"Gruntfile.js","engines":{"node":">= 0.8.0"},"scripts":{"test":"grunt test"},"devDependencies":{"grunt-contrib-jshint":"~0.1.1","grunt-contrib-clean":"~0.4.0","grunt-contrib-nodeunit":"~0.1.2","grunt":"~0.4.1"},"peerDependencies":{"grunt":"~0.4.1"},"keywords":["gruntplugin","grunt-contrib-connect","grunt-express","modrewrite","rewriterule","rewrite","route","connect","express"],"_id":"grunt-connect-rewrite@0.2.1","dist":{"shasum":"ba7e333aed6e679237945e58e1fd19626645b2eb","tarball":"https://registry.npmjs.org/grunt-connect-rewrite/-/grunt-connect-rewrite-0.2.1.tgz","integrity":"sha512-SydGYYPBBk5M+STI9BrrDm4tZuheW1GVQ6tDq78vzfjev7DjLamIkO3j3ZzlsFxWug+kmoSK+l1vYDbT5An5uQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFsYDGUMVmtpuqFuCxtQ/lohjXIO8BARztJjEAo5cTsPAiEA9DX8qiLodV0fDdkbUj9Hu8lzR/0CDapS9XXe/sM8/VQ="}]},"_from":".","_npmVersion":"1.3.25","_npmUser":{"name":"viart","email":"artem@devart.in.ua"},"maintainers":[{"name":"viart","email":"artem@devart.in.ua"}],"directories":{}},"0.2.2":{"name":"grunt-connect-rewrite","description":"Provides RewriteRules middleware for the grunt connect and express.","version":"0.2.2","homepage":"https://github.com/viart/grunt-connect-rewrite","author":{"name":"Artem Vitiuk","email":"artem@devart.in.ua"},"repository":{"type":"git","url":"git+ssh://git@github.com/viart/grunt-connect-rewrite.git"},"bugs":{"url":"https://github.com/viart/grunt-connect-rewrite/issues"},"licenses":[{"type":"MIT","url":"https://github.com/viart/grunt-connect-rewrite/blob/master/LICENSE-MIT"}],"main":"Gruntfile.js","engines":{"node":">=0.8.0"},"scripts":{"test":"grunt test"},"devDependencies":{"grunt-contrib-jshint":"~0.1.1","grunt-contrib-clean":"~0.4.0","grunt-contrib-nodeunit":"~0.1.2","grunt":"~0.4.1"},"peerDependencies":{"grunt":">=0.4.0"},"keywords":["gruntplugin","grunt-contrib-connect","grunt-express","modrewrite","rewriterule","rewrite","route","connect","express"],"gitHead":"ace86f9f5ee1e89d681c09501c897d59bd1f3c06","_id":"grunt-connect-rewrite@0.2.2","_nodeVersion":"12.5.0","_npmVersion":"6.10.0","_npmUser":{"name":"viart","email":"artem@vitiuk.me"},"dist":{"integrity":"sha512-yEIX1/4kUPYrhAunGFCTpwPKqXBCAt3z+lAH7uT4ScYdzJaxlH50VGiMpPB9suZnC+I+se12DQX9Oil57nYt+Q==","shasum":"d78a1eef8104f79243c1e8bfeda4325cb66c8efd","tarball":"https://registry.npmjs.org/grunt-connect-rewrite/-/grunt-connect-rewrite-0.2.2.tgz","fileCount":9,"unpackedSize":17733,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdKwW0CRA9TVsSAnZWagAA/aYQAKGzVlMH+ww7Ix5x1OxJ\nLNxRrlIHRIxrfDSOyOVdYojgIkXuxi0/5gCryKWKU+a/W6bI6IXF/2JX2nTb\nnulVP8CGzIrcTM8TlzgHye7ywmcV5ghOa2bdibS9koROa2ze7CrErkfj6Sap\n73GUTbHPOGgHf4X7hdfqDUBjDO9+reOOMlvTBcXr8TqZ80sY0IV8x8lBtK8E\nOqJWV069NyCsDnoOMPzBddfB8puCG7aG8QNAy0G1zWp5dEw3F1cLAMXw9e/6\nyg+DQ8b38K0lwgWAFyX0MR9Y4yqS7wfTIXuL+kOiB12c48/n9Vki1jPuh45p\nDGA5tqubnlU0CYZj7kPghMY+omcqm153YxmjGGiBI0uYZvXNCuJ0dqYn79YX\njhthedoSkHKTd/e7b512enU09phAbPDQ3B+sXgrF1tFJxLog4k++iqdQ5A/2\n0HAH0EXCnU5UvIL1E4csSELw5THQiIyXYPk0ze79Aow6Z7RIqK8MEaceDSL/\nKUoK+dlRae+Mgm5Y7YmKTRmfa+d3Oiz1QA7dwt4rIh64J2PVRqYkg7qaxMyr\nTnQO4j7V9g1Qfd8ulQOOCEZ+lF8fZ7UdycjZPE86ZMcBCVhS9LoIR26LHieJ\nVmzrEjel1BUKCoFKWlgIzvIucn9f3xA4MaXjcle/LdGXTbNI/aFQPXgfCu0K\nYNTK\r\n=hwMv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC+hN6JxuEb6x63zwx74eOFox2NtBKlU1kr83Ptb6jdMwIgZa/WOuboIhOZofMrSOGSc80jJ2czcXoouqdJ4Aqc7G0="}]},"maintainers":[{"email":"artem@vitiuk.me","name":"viart"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/grunt-connect-rewrite_0.2.2_1563100595740_0.29393566603339827"},"_hasShrinkwrap":false}},"readme":"# grunt-connect-rewrite v0.2.1 [![Build Status](https://travis-ci.org/viart/grunt-connect-rewrite.png?branch=master)](https://travis-ci.org/viart/grunt-connect-rewrite)\n\n> This plugin provides RewriteRules middleware for the Grunt Connect / Express.\n> Which could be used to redirect (rewrite internally or redirect using HTTP codes) User to the specific URL based on RegExp Rules.\n\n## More flexible alternative\nIn case you like this plugin it makes sense to look at [http-rewrite-middleware](https://github.com/viart/http-rewrite-middleware)\nas more flexible alternative.\n\n## Getting Started\nThis plugin requires Grunt `~0.4.1`\n\nIf you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:\n\n```shell\nnpm install grunt-connect-rewrite --save-dev\n```\n\n### Options\n\n##### Rule's format:\n\n`{from: '__from__', to: '__to__'[, redirect: 'permanent'|'temporary']}`\n\nWhere:\n* `__from__` - RegExp string to match.\n* `__to__` - String that replaces matched URL.\n* `redirect` - Optional parameter:\n    * When it is omitted then the Rule will be dispatched as an internal rewrite (aka proxified).\n    * If the value is set then Browser will receive HTTP `Location` Header with value of parsed `__to__` (`permanent` value will give `HTTP 301`, any other value will give `HTTP 302`).\n\n##### rulesProvider\nType: `String`\n\nDefault value: `connect.rules`\n\nYou can specify grunt config section from which Rules will be read, like so:\n\n```js\ngrunt.initConfig({\n    express: {\n        options: {\n            port: 9000\n        },\n        server: {\n            hostname: 'localhost'\n        },\n        rules: [\n            // ... your rules here\n        ]\n    },\n    configureRewriteRules: {\n        options: {\n            rulesProvider: 'express.rules'\n        }\n    }\n})\n```\n\n### Example of usage\nIn your project's Gruntfile:\n* Include the `rewriteRequest` snippet.\n* Add a section named `rules` to your existing Connect or Express definition.\n    **Please note:** unlike options, rules cannot be set per server, so the `rules` attribute must always be nested directly under `connect` or `express`.\n* Add `configureRewriteRules` before the web server task.\n* Don't forget to load the plugin (e.g. `grunt.loadNpmTasks('grunt-connect-rewrite')`).\n\n```js\nvar rewriteRulesSnippet = require('grunt-connect-rewrite/lib/utils').rewriteRequest;\ngrunt.initConfig({\n    connect: {\n        options: {\n            port: 9000,\n            hostname: 'localhost'\n        },\n        rules: [\n            // Internal rewrite\n            {from: '^/index_dev.html$', to: '/src/index.html'},\n            // Internal rewrite\n            {from: '^/js/(.*)$', to: '/src/js/$1'},\n            // 301 Redirect\n            {from: '^/old-stuff/(.*)$', to: '/new-cool-stuff/$1', redirect: 'permanent'},\n            // 302 Redirect\n            {from: '^/stuff/(.*)$', to: '/temporary-stuff/$1', redirect: 'temporary'}\n        ],\n        development: {\n            options: {\n                middleware: function (connect, options) {\n                    var middlewares = [];\n\n                    // RewriteRules support\n                    middlewares.push(rewriteRulesSnippet);\n\n                    if (!Array.isArray(options.base)) {\n                        options.base = [options.base];\n                    }\n\n                    var directory = options.directory || options.base[options.base.length - 1];\n                    options.base.forEach(function (base) {\n                        // Serve static files.\n                        middlewares.push(connect.static(base));\n                    });\n\n                    // Make directory browse-able.\n                    middlewares.push(connect.directory(directory));\n\n                    return middlewares;\n                }\n            }\n        }\n    }\n})\n\ngrunt.loadNpmTasks('grunt-contrib-connect');\ngrunt.loadNpmTasks('grunt-connect-rewrite');\n\n// \"configureRewriteRules\" should be before the \"connect\"/\"express\" task\ngrunt.registerTask('server', function (target) {\n    grunt.task.run([\n        'configureRewriteRules',\n        'connect:development'\n    ]);\n});\n```\n\n### Debugging rules\n\nIn order to debug Rules you need to run grunt with a `--verbose` command-line option this will enable logging of matched rules.\nThe message will explain which `__from__` rule was matched and what was the result of the rewrite.\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).\n\n## Release History\n* 2014.01.29 `v0.2.1` Add logging support\n* 2013.11.21 `v0.2.0` Add support for Browser's redirects (HTTP 301/302)\n* 2013.07.27 `v0.1.1` Add possibility to read settings from custom grunt config path\n* 2013.04.12 `v0.1.0` Initial Release\n","maintainers":[{"email":"artem@vitiuk.me","name":"viart"}],"time":{"modified":"2022-06-18T14:42:11.067Z","created":"2013-04-12T22:58:40.956Z","0.1.0":"2013-04-12T22:58:47.916Z","0.1.1":"2013-07-27T07:12:41.155Z","0.2.0":"2013-11-22T10:47:13.912Z","0.2.1":"2014-01-29T21:23:12.058Z","0.2.2":"2019-07-14T10:36:35.908Z"},"author":{"name":"Artem Vitiuk","email":"artem@devart.in.ua"},"repository":{"type":"git","url":"git+ssh://git@github.com/viart/grunt-connect-rewrite.git"},"readmeFilename":"README.md","users":{"musically-ut":true,"khanhhua":true,"klap-webdevelopment":true},"homepage":"https://github.com/viart/grunt-connect-rewrite","keywords":["gruntplugin","grunt-contrib-connect","grunt-express","modrewrite","rewriterule","rewrite","route","connect","express"],"bugs":{"url":"https://github.com/viart/grunt-connect-rewrite/issues"}}