{"name":"browserify-optional","version":"1.0.0","description":"A browserify transform that allows optional dependencies in try..catch blocks","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git://github.com/devongovett/browserify-optional.git"},"keywords":["browserify","transform","optional"],"author":{"name":"Devon Govett","email":"devongovett@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/devongovett/browserify-optional/issues"},"homepage":"https://github.com/devongovett/browserify-optional","devDependencies":{"concat-stream":"^1.4.7","mocha":"^2.2.1"},"dependencies":{"ast-transform":"0.0.0","ast-types":"^0.7.0","browser-resolve":"^1.8.1"},"gitHead":"8f7b7776c06d1bcc875c9bf2e166a73b20622024","_id":"browserify-optional@1.0.0","_shasum":"20cf7ab1e7bf014cbf63782d35d75b62dab4b6f1","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"devongovett","email":"devongovett@gmail.com"},"maintainers":[{"name":"devongovett","email":"devongovett@gmail.com"}],"dist":{"shasum":"20cf7ab1e7bf014cbf63782d35d75b62dab4b6f1","tarball":"http://registry-npm.ywwl.com/browserify-optional/download/browserify-optional-1.0.0.tgz","integrity":"sha512-6dMI6nrnukmCXc69qsZmmhzGGp4jETCptC8YXDMFdfBTKHtih6b83rYIU+mdGXAtVsio7YZ+viRAEbZqROAN5w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCtuxtTYm3gb8QwEdgXDZc5NaEoiS8omUoZbmVU1dt1kwIgfzAs7DG7TBoWV3QfoBWIIPc6Jw2Ig3ANcG//T2mIaZk="}],"size":1987,"noattachment":false,"key":"/browserify-optional/-/browserify-optional-1.0.0.tgz"},"directories":{},"readme":"# browserify-optional\n\nIt is a common pattern in Node to support optional dependencies via requires in try..catch blocks.\nBrowserify doesn't support this by default and throws a compile time error when it cannot find a \nmodule. You can solve the problem by using browserify's exclude option, but this works globally\ninstead of at a per-module level. This transform fixes the problem by moving the compile time \nerror to a runtime error for requires of missing modules inside try..catch blocks.\n\n## Example\n\nThe transform would transform the following code such that requiring `missing-module` would throw\na runtime error instead of a compile time error, making the code work as expected.\n\n```javascript\ntry {\n  var x = require('missing-module');\n} catch (e) {\n  var x = require('replacement-module');\n}\n```\n\nTo set it up in browserify, add this to your package.json:\n\n```json\n\"browserify\": {\n  \"transform\": [\"browserify-optional\"]\n}\n```\n\n## License\n\nMIT\n","publish_time":1427086473099,"_cnpm_publish_time":1427086473099,"dist-tags":{"latest":"1.0.1"}}