{"_id":"codependency","_rev":"26-06909d805ea3893f997fc801ed6a486c","name":"codependency","description":"Optional peer dependencies","dist-tags":{"latest":"2.1.0"},"versions":{"0.1.0":{"name":"codependency","keywords":["peer","dependency","dependencies","require","module","semver"],"version":"0.1.0","description":"Optional peer dependencies","main":"index.js","dependencies":{"semver":"2.2.1"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/Wizcorp/codependency.git"},"author":{"name":"Ron Korving","email":"rkorving@wizcorp.jp"},"license":"MIT","bugs":{"url":"https://github.com/Wizcorp/codependency/issues"},"_id":"codependency@0.1.0","dist":{"shasum":"2f907a0cc4fc0ffee0554d8eb3b2190ab166f8f7","tarball":"https://registry.npmjs.org/codependency/-/codependency-0.1.0.tgz","integrity":"sha512-MrvoK16qHqsyKDIsM+OXWq4hZ002aCyoNJEKFmiJ3Tffx7N6kV1dFFUCTcooYvPD0dtAbjuEVfOUWxuO6qjUUg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGxAg6Gnbq1R3vUgFFBgFb4utc+4tCe9vwFfhahNLRP3AiEAy4qQcoJOCDkktCndb2r4GpeWCllqPITFzBNd6ozck0g="}]},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"ronkorving","email":"ron@ronkorving.nl"},"maintainers":[{"name":"ronkorving","email":"ron@ronkorving.nl"}],"directories":{}},"0.1.1":{"name":"codependency","keywords":["peer","dependency","dependencies","require","module","semver"],"version":"0.1.1","description":"Optional peer dependencies","main":"index.js","dependencies":{"semver":"2.2.1"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/Wizcorp/codependency.git"},"author":{"name":"Ron Korving","email":"rkorving@wizcorp.jp"},"license":"MIT","bugs":{"url":"https://github.com/Wizcorp/codependency/issues"},"_id":"codependency@0.1.1","dist":{"shasum":"84fbbe7f92e86a254cc5b2d86e9dbdb8c34cad5f","tarball":"https://registry.npmjs.org/codependency/-/codependency-0.1.1.tgz","integrity":"sha512-pzMmMUDu2x27sBTejTchWjNVkigd7bbSXi5YAdaAEfh3q+l/WPz/GjVeVC2r2kMKM9Eda7h4XRF46tk76WY3fw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDBT8oDCrZXl8b7bkyuDSJXbSPI3PZfnXGVchvjTXcEfwIgIxhumem97sUB7ALu96l5EVbLYkKRO/Z52nQNg/R+2gg="}]},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"ronkorving","email":"ron@ronkorving.nl"},"maintainers":[{"name":"ronkorving","email":"ron@ronkorving.nl"}],"directories":{}},"0.1.2":{"name":"codependency","keywords":["peer","dependency","dependencies","require","module","semver"],"version":"0.1.2","description":"Optional peer dependencies","main":"index.js","dependencies":{"semver":"2.2.1"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/Wizcorp/codependency.git"},"author":{"name":"Ron Korving","email":"rkorving@wizcorp.jp"},"license":"MIT","bugs":{"url":"https://github.com/Wizcorp/codependency/issues"},"_id":"codependency@0.1.2","dist":{"shasum":"015e93c1f201b8d37278cb1dcd623e6ea85ba79e","tarball":"https://registry.npmjs.org/codependency/-/codependency-0.1.2.tgz","integrity":"sha512-ruloNIRfzWDLtqwYLZHbZrAlpx3pTa6FavgmqVgLJjhis3D2048KVeoP2C0y6MlSRlgWGnmkgMQBu5KKEpZ/AA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB0MJmbtARKlVFSLxIFckCdyE2ZupCdZa7YgUPSzx2n3AiEAw/9y36po3lSNHpKmz9mY+GXh5G642GxPqjqVEELm2gM="}]},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"ronkorving","email":"ron@ronkorving.nl"},"maintainers":[{"name":"ronkorving","email":"ron@ronkorving.nl"}],"directories":{}},"0.1.3":{"name":"codependency","keywords":["peer","dependency","dependencies","require","module","semver"],"version":"0.1.3","description":"Optional peer dependencies","main":"index.js","dependencies":{"semver":"2.2.1"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/Wizcorp/codependency.git"},"author":{"name":"Ron Korving","email":"rkorving@wizcorp.jp"},"license":"MIT","bugs":{"url":"https://github.com/Wizcorp/codependency/issues"},"_id":"codependency@0.1.3","dist":{"shasum":"69aed841be6f931829a07273ef8ebbe8407bd1b6","tarball":"https://registry.npmjs.org/codependency/-/codependency-0.1.3.tgz","integrity":"sha512-ZUa3KQ8NGGKZatu6SKNRzsiEtIK406jvMrmwiPSv0hoj/9TtU1GXbjPN8OZaYPMwOT26/qVillkVAEwBF88S+Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEQKd5j/kUFkTgoQ1vidEVWj8/dt9wO9Mp+81hfa8YcrAiAhWJkzZr/ENf/4vx4LKK6dtYjOoFaQxKQL0MPDHWsJ2Q=="}]},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"ronkorving","email":"ron@ronkorving.nl"},"maintainers":[{"name":"ronkorving","email":"ron@ronkorving.nl"}],"directories":{}},"0.1.4":{"name":"codependency","keywords":["peer","dependency","dependencies","require","module","semver"],"version":"0.1.4","description":"Optional peer dependencies","main":"index.js","dependencies":{"semver":"5.0.1"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/Wizcorp/codependency.git"},"author":{"name":"Ron Korving","email":"rkorving@wizcorp.jp"},"license":"MIT","gitHead":"07fb1e799bfd47087ed2bcc9a586b493d307db6c","bugs":{"url":"https://github.com/Wizcorp/codependency/issues"},"homepage":"https://github.com/Wizcorp/codependency#readme","_id":"codependency@0.1.4","_shasum":"d1763ab7264bd70c91d9626e98862d3792bf8d4a","_from":".","_npmVersion":"2.13.3","_nodeVersion":"3.0.0","_npmUser":{"name":"ronkorving","email":"ron@ronkorving.nl"},"maintainers":[{"name":"ronkorving","email":"ron@ronkorving.nl"},{"name":"wizcorp","email":"npm@wizcorp.jp"}],"dist":{"shasum":"d1763ab7264bd70c91d9626e98862d3792bf8d4a","tarball":"https://registry.npmjs.org/codependency/-/codependency-0.1.4.tgz","integrity":"sha512-26yAvd3+17xSfDADtnzpnL5GK+8+x4QeZ3DegekkHyno6LWeHqXuSU7q8w/IrAur7SY6ISPApOWtWTfuIF0Xpg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBhYDhpPgibq82Q6iJyjiDmhZhftutJYVkv3iDgzbxiiAiEA4ALqlr7cIdDW+wO2py6X/674bbKIUUidZZhUycqmlEM="}]},"directories":{}},"1.0.0":{"name":"codependency","keywords":["peer","dependency","dependencies","require","module","semver"],"version":"1.0.0","description":"Optional peer dependencies","main":"index.js","dependencies":{"semver":"^5.3.0"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/Wizcorp/codependency.git"},"author":{"name":"Ron Korving","email":"rkorving@wizcorp.jp"},"license":"MIT","gitHead":"6ff842c96ecc626b8b51b0d7ba589fde052b69c0","bugs":{"url":"https://github.com/Wizcorp/codependency/issues"},"homepage":"https://github.com/Wizcorp/codependency#readme","_id":"codependency@1.0.0","_shasum":"544bc866b99f9cea344f7586127a1863dae369fd","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.9.0","_npmUser":{"name":"ronkorving","email":"ron@ronkorving.nl"},"maintainers":[{"name":"ronkorving","email":"ron@ronkorving.nl"},{"name":"wizcorp","email":"npm@wizcorp.jp"}],"dist":{"shasum":"544bc866b99f9cea344f7586127a1863dae369fd","tarball":"https://registry.npmjs.org/codependency/-/codependency-1.0.0.tgz","integrity":"sha512-hXc3fzo3k/atIgDggUyO376GxzKbMTUP5NDTFzeY9+aJ/5lo85B4OUDvgCeq3IqHVco+yqManmFlbBOfizKotw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDLo6y8hvpQj1jHBggTF2BTy/gXmnlTMxynhktGeCQ5dgIgbZJ5Plz28uDsQUuhRNQBWWI2DbA9VnPgzWuL9XJj1SM="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/codependency-1.0.0.tgz_1492411381552_0.9171071755699813"},"directories":{}},"2.0.0":{"name":"codependency","keywords":["peer","dependency","dependencies","require","module","semver"],"version":"2.0.0","description":"Optional peer dependencies","main":"index.js","dependencies":{"semver":"^5.3.0"},"scripts":{"test":"eslint ."},"repository":{"type":"git","url":"git+https://github.com/Wizcorp/codependency.git"},"author":{"name":"Ron Korving","email":"rkorving@wizcorp.jp"},"license":"MIT","devDependencies":{"eslint":"^3.19.0","pre-commit":"^1.2.2"},"gitHead":"afceedd3b83081c9886190f8491296468cf32f04","bugs":{"url":"https://github.com/Wizcorp/codependency/issues"},"homepage":"https://github.com/Wizcorp/codependency#readme","_id":"codependency@2.0.0","_shasum":"4c7fe7f41596deed3539390463f6bedcf5f77b94","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.9.0","_npmUser":{"name":"ronkorving","email":"ron@ronkorving.nl"},"maintainers":[{"name":"ronkorving","email":"ron@ronkorving.nl"},{"name":"wizcorp","email":"npm@wizcorp.jp"}],"dist":{"shasum":"4c7fe7f41596deed3539390463f6bedcf5f77b94","tarball":"https://registry.npmjs.org/codependency/-/codependency-2.0.0.tgz","integrity":"sha512-7qM10/wFyaJqcBZYmHmKRMO+SiLmdzEJBKNnUywmPHUTn3WrphUfw8G1JpUfymbvxB4Tji5a09vPkDt6GXQy1w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCuxYnu+4TNWVnX7whF1TAlHCeZwFqaVievudBE/BNT4QIhAM8SKDnzUm7WOpjvku3mkqU08REql1lsCmDcT+XpoPON"}]},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/codependency-2.0.0.tgz_1495444623437_0.31070293486118317"},"directories":{}},"2.0.1":{"name":"codependency","keywords":["peer","dependency","dependencies","require","module","semver"],"version":"2.0.1","description":"Optional peer dependencies","main":"index.js","dependencies":{"semver":"^5.3.0"},"scripts":{"test":"eslint ."},"repository":{"type":"git","url":"git+https://github.com/Wizcorp/codependency.git"},"author":{"name":"Ron Korving","email":"rkorving@wizcorp.jp"},"license":"MIT","devDependencies":{"eslint":"^3.19.0","pre-commit":"^1.2.2"},"gitHead":"bac322e41b533f5dc48c227c55649fe5fb06a943","bugs":{"url":"https://github.com/Wizcorp/codependency/issues"},"homepage":"https://github.com/Wizcorp/codependency#readme","_id":"codependency@2.0.1","_shasum":"d153a54a96062a75fde48958c4dc95ff3db3d093","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.9.0","_npmUser":{"name":"ronkorving","email":"ron@ronkorving.nl"},"maintainers":[{"name":"ronkorving","email":"ron@ronkorving.nl"},{"name":"wizcorp","email":"npm@wizcorp.jp"}],"dist":{"shasum":"d153a54a96062a75fde48958c4dc95ff3db3d093","tarball":"https://registry.npmjs.org/codependency/-/codependency-2.0.1.tgz","integrity":"sha512-zWHbbWUuQ3UCaJvVXWCOEhU1fdTkLq0qeQ/Z7hsD7Y6uMjyKyOEUB2ILBdBacdv4BzhgbzP9PXZKIdUVYBKWeA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGAg5MhW9ZKwglS36nWmhKS/6y0heQGK8ZI3L4Rhc43uAiB+Aj4HZwidImFzmYJklSZ2CQTtyYQAhmFER6qpk6BDRw=="}]},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/codependency-2.0.1.tgz_1495445747340_0.7120612915605307"},"directories":{}},"2.1.0":{"name":"codependency","keywords":["peer","dependency","dependencies","require","module","semver"],"version":"2.1.0","description":"Optional peer dependencies","main":"index.js","dependencies":{"semver":"^5.3.0"},"scripts":{"test":"eslint ."},"repository":{"type":"git","url":"git+https://github.com/Wizcorp/codependency.git"},"author":{"name":"Ron Korving","email":"rkorving@wizcorp.jp"},"license":"MIT","devDependencies":{"eslint":"^3.19.0","pre-commit":"^1.2.2"},"gitHead":"88c49210aaf5ecfe7068f927b73d32a062540bb0","bugs":{"url":"https://github.com/Wizcorp/codependency/issues"},"homepage":"https://github.com/Wizcorp/codependency#readme","_id":"codependency@2.1.0","_npmVersion":"5.6.0","_nodeVersion":"9.4.0","_npmUser":{"name":"ronkorving","email":"ron@ronkorving.nl"},"dist":{"integrity":"sha512-JIdmYkE8Z6jwH1OUf4a5H5jk9YShPQkaYPUAiN+ktyChmPP77LGbeKrxWGPqdCnpTmt0hRIn8TXBVu01U3HDhg==","shasum":"597d01ccc6b2704ab8d7a12af5d27ac9b4e27e8a","tarball":"https://registry.npmjs.org/codependency/-/codependency-2.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGkWzoSx0FPvpVZl7B/IiRgB3ryRGxbG7NOvQMhzKGqDAiAkZP61NcWM/IaAbgqElL75TE4G/R2tUuz22dgybaVZhw=="}]},"maintainers":[{"email":"npm@wizcorp.jp","name":"notawizard"},{"email":"ron@ronkorving.nl","name":"ronkorving"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/codependency-2.1.0.tgz_1516679892293_0.050043774768710136"},"directories":{}}},"readme":"# Optional Peer Dependencies for Node.js middleware\n\n## Description\n\nNode's peer dependencies are automatically installed when the middleware that refers to them is\ninstalled. Just because your middleware supports 16 database systems, doesn't mean your end user\nwants to install all those drivers.\n\nFor those cases, you'll want to use `codependency`. Simply add your peer dependencies to your\n`package.json` file, in a field called `\"optionalPeerDependencies\"` and use the `require()`\nfunction from this library. It will give you:\n\n* automatic semver validation.\n* instructive error reporting for your end user.\n* optionality (it won't throw errors if you don't want it to).\n* a developer-friendly environment (allows symlinking to your middleware).\n\n## Installation\n\n```sh\nnpm install codependency\n```\n\n## Usage\n\n### The shortest usage example\n\nMiddleware package.json\n\n```json\n{\n  \"name\": \"mymiddleware\",\n  \"optionalPeerDependencies\": {\n    \"redis\": \"~0.9.0\",\n    \"mysql\": \"~2.0.0\"\n  }\n}\n```\n\nSetting up and using a require-function from the middleware\n\n```javascript\nvar codependency = require('codependency');\nvar requirePeer = codependency.register(module);\n\nvar redis = requirePeer('redis');\n```\n\nFrom another file, you can now easily use the middleware's require function for peers:\n\n```javascript\nvar codependency = require('codependency');\nvar requirePeer = codependency.get('mymiddleware');\n\nvar redis = requirePeer('redis');\n```\n\n## Advanced usage\n\n```javascript\nvar codependency = require('codependency');\nvar requirePeer = codependency.register(module, {\n\tindex: ['optionalPeerDependencies', 'devDependencies']\n});\n\n// require redis, but don't throw an error if the module is not found\n\nvar redis = requirePeer('redis', { optional: true }); // returns undefined\n```\n\n## API\n\n**codependency.register(module, options)**\n\nThe `module` argument must be the root module of the middleware. Its location is the basis for the\nsearch for `package.json`, which is to contain the peer dependencies hashmap. Its parent will be\nused to require from. This allows you to work on middleware development, while symlinking to it\nfrom your end-user project. For example:\n\n\t/home/bob/todolist/node_modules/mymiddleware -> /home/bob/mymiddleware\n\nThe `options` object may contain an `index` property, which defaults to the array\n[\"optionalPeerDependencies\"]. Override it to change which properties of your package.json will be\nused to index.\n\nIf the `module` argument is not the root module you may set the `options.strictCheck` property to `false`\nto search for `package.json` in a parent directory.\n\nThis function returns a `require` function, which has the following signature:\n\n**requirePeer(name, options)**\n\nThe `name` argument is the name of one of your peer dependencies. It will be required and returned.\nThe `options` object may contain one of the following:\n\n* optional: boolean (default: false), in order to not throw an error if the module cannot be found.\n* dontThrow: boolean (default: false), in order to not throw an error if the module's version did\n  not satisfy the requirement or something else went wrong during the require.\n\nIt also has a resolve method which can give you information about a peer dependency before requiring\nit.\n\n**requirePeer.resolve(name)**\n\nThe `name` argument is the name of one of your peer dependencies. The returned object has the\nfollowing signature:\n\n```json\n{\n  \"supportedRange\": \"2.5.1\",\n  \"installedVersion\": \"2.5.1\",\n  \"isInstalled\": true,\n  \"isValid\": true,\n  \"pkgPath\": \"zmq/package.json\"\n}\n```\n\n* `supportedRange` is the range that the middleware explicitly supports.\n* `installedVersion` is the version that is currently installed (null if none).\n* `isInstalled` indicates if the dependency has been installed.\n* `isValid` indicates if the installed version is valid within the supported range.\n* `pkgPath` is a path to package.json of the dependency, used internally by `requirePeer()`.\n\n## Errors\n\nDuring a peer-require, a user may encounter the following exceptions:\n\n* Module \"redis\" required by \"mymiddleware\" not found. Please run: npm install redis@'~0.10.0' --save\n* Module \"mysql\" required by \"mymiddleware\" has no version information in \"mysql/package.json\".\n* Version of module \"couchbase\" required by \"mymiddleware\" is not a string (found instead: number).\n* Version \"2.3.0\" of module \"zmq\" required by \"mymiddleware\" does not satisfy required range \"~2.5.0\".\n\n","maintainers":[{"email":"npm@wizcorp.jp","name":"notawizard"},{"email":"github@almirkadric.com","name":"almirkadric"},{"email":"mtrudel@wizcorp.jp","name":"stelcheck"},{"email":"ron@ronkorving.nl","name":"ronkorving"}],"time":{"modified":"2022-06-13T06:26:42.316Z","created":"2014-01-20T10:59:53.947Z","0.1.0":"2014-01-20T10:59:56.146Z","0.1.1":"2014-01-22T04:54:31.092Z","0.1.2":"2014-01-27T05:56:56.537Z","0.1.3":"2014-04-08T07:55:15.797Z","0.1.4":"2015-08-05T11:58:58.763Z","1.0.0":"2017-04-17T06:43:01.814Z","2.0.0":"2017-05-22T09:17:03.580Z","2.0.1":"2017-05-22T09:35:47.456Z","2.1.0":"2018-01-23T03:58:12.377Z"},"author":{"name":"Ron Korving","email":"rkorving@wizcorp.jp"},"repository":{"type":"git","url":"git+https://github.com/Wizcorp/codependency.git"},"readmeFilename":"Readme.md","keywords":["peer","dependency","dependencies","require","module","semver"],"bugs":{"url":"https://github.com/Wizcorp/codependency/issues"},"license":"MIT","users":{"ronkorving":true,"kparkov":true},"homepage":"https://github.com/Wizcorp/codependency#readme"}