{"bin":{"enhanced-require":"bin/enhanced-require.js","enhanced-require-hot-watch":"bin/hot-watch.js"},"dist":{"shasum":"3656c110cd5d0bc0ddecec58c89bb4c0680af207","tarball":"https://registry.npmjs.org/enhanced-require/-/enhanced-require-0.4.2.tgz","integrity":"sha512-UH5r0DygJ4VzZg91C2mUuIhV0evi9YHKdH9u1wh1LfbX9wH3JB4vajjRHMJfZnJXlAzZFmB2+/eBwg5lGYavyw==","signatures":[{"sig":"MEQCIEyTWtDSehruAoqnqBO7KDy36KCbIBgJGQb5tSNkyRKRAiAw3oFnk3rzJ7Go4p7AQpfiIH2+0VAxMTWME4FqnjVS5w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/require","name":"enhanced-require","author":{"name":"Tobias Koppers @sokra"},"readme":"# enhanced-require\n\nMore features for node.js require.\n\n* [loader support](https://github.com/sokra/modules-webpack/wiki/Loader-Specification)\n* `require.ensure`\n* AMD `require`, `define` (from require.js)\n* `require.context`\n* [Hot Code Replacement](https://github.com/webpack/enhanced-require/wiki/HCR-Spec)\n* module substitutions for mocking\n\nAsynchron require functions are **really** async. They do not use the sync node.js require, but use a async resolving and async readFile.\n\n## Create a enhanced require function\n\n``` javascript\nvar myRequire = require(\"enhanced-require\")(module, {\n\t// options\n\trecursive: true // enable for all modules recursivly\n\t// This replaces the original require function in loaded modules\n});\n\n// startup your application\nmyRequire(\"./startup\");\n```\n\n## Usage\n\nThan you can use them:\n\n``` javascript\n// use loaders\nvar fileContent = require(\"raw!\"+__filename);\n\n// use loaders automatically\nvar template = require(\"./my-template.jade\");\n\nvar html = template({content: fileContent});\n\n// use require.context\nvar directoryRequire = require.context(\"raw!./subdir\");\nvar txtFile = directoryRequire(\"./aFile.txt\");\n\n// use require.ensure\nrequire.ensure([\"./someFile.js\"], function(require) {\n\tvar someFile = require(\"./someFile.js\");\n});\n\n// use AMD define\nrequire.define([\"./aDep\"], function(aDep) {\n\taDep.run();\n});\n\n// use AMD require\nrequire([\"./bDep\"], function(bDep) {\n\tbDep.doSomething();\n});\n```\n\n## Hot Code Replacement\n\n``` javascript\nrequire(\"enhanced-require\")(module, {\n\trecursive: true, // enable for all modules\n\thot: true, // enable hot code replacement\n\twatch: true // watch for changes\n})(\"./startup\");\n```\n\nFor hot code reloading you need to follow the [hot code reloading spec](https://github.com/webpack/enhanced-require/wiki/HCR-Spec).\n\n## Testing/Mocking\n\n``` javascript\nvar er = require(\"enhanced-require\");\nit(\"should read the config option\", function(done) {\n\tvar subject = er(module, {\n\t\trecursive: true,\n\t\tsubstitutions: {\n\t\t\t// specify the exports of a module directly\n\t\t\t\"../lib/config.json\": {\n\t\t\t\t\"test-option\": { value: 1234 }\n\t\t\t}\n\t\t},\n\t\tsubstitutionFactories: {\n\t\t\t// specify lazy generated exports of a module\n\t\t\t\"../lib/otherConfig.json\": function(require) {\n\t\t\t\t// export the same object as \"config.json\"\n\t\t\t\treturn require(\"../lib/config.json\");\n\t\t\t}\n\t\t}\n\t})(\"../lib/subject\");\n\n\tvar result = subject.getConfigOption(\"test-option\");\n\tshould.exist(result);\n\tresult.should.be.eql({ value: 1234 });\n});\n```\n\n## Options\n\n``` javascript\n{\n\trecursive: false,\n\t// replace require function in required modules with enhanced require method\n\n\tresolve: {\n\t\t// ...\n\t\t// see enhanced-resolve\n\t\t// https://github.com/webpack/enhanced-resolve\n\t},\n\t\n\tsubstitutions: {},\n\tsubstitutionFactories: {},\n\t// See above\n\t// Replace modules with mocks\n\t// keys are resolved and have to exist\n\n\tamd: {},\n\t// The require.amd object\n\n\tenhanced: {},\n\t// The require.enhanced object\n\n\tloader: {},\n\t// additional stuff in the loaderContext\n\n\thot: false,\n\t// enable hot code replacement\n\n\twatch: false,\n\t// Watch for file changes and issue hot replacement\n\n\twatchDelay: 400,\n\t// Time to summarize changes for watching\n}\n```\n\n## Future Plans\n\n* cli tool\n\n## License\n\nCopyright (c) 2012 Tobias Koppers\n\nMIT (http://www.opensource.org/licenses/mit-license.php)","engines":{"node":">=0.6"},"license":"MIT","scripts":{"test":"node node_modules/mocha/bin/_mocha --reporter spec"},"_npmUser":{"name":"sokra","email":"tobias.koppers@googlemail.com"},"homepage":"http://github.com/webpack/enhanced-require","licenses":[{"url":"http://www.opensource.org/licenses/mit-license.php","type":"MIT"}],"_npmVersion":"1.1.65","description":"Enhance the require function in node.js with support for loaders which preprocess files and really async require (AMD). Enables Hot Code Replacement.","maintainers":[{"name":"sokra","email":"tobias.koppers@googlemail.com"}],"dependencies":{"clone":"0.0.x","buffer-equal":"0.0.x","enhanced-resolve":"0.4.x"},"readmeFilename":"README.md","devDependencies":{"mocha":"1.3.x","should":"1.1.x","raw-loader":"0.2.x","jade-loader":"0.2.x"},"_id":"enhanced-require@0.4.2","version":"0.4.2"}