{"_id":"node-ensure","_rev":"6-1f092eb7efdc62a17a3eca56d604830e","name":"node-ensure","description":"Async module-loading library and protocol for bundlers/loaders targeting isomorphic apps and Node.js.","dist-tags":{"latest":"0.0.0"},"versions":{"0.0.0":{"name":"node-ensure","version":"0.0.0","description":"Async module-loading library and protocol for bundlers/loaders targeting isomorphic apps and Node.js.","main":"index.js","browser":{"./index.js":"./browser.js"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["require","ensure","dynamic","module","loader","bundler","async"],"author":{"name":"Carl A. Bauer"},"repository":{"type":"git","url":"https://github.com/bauerca/node-ensure.git"},"bugs":{"url":"https://github.com/bauerca/node-ensure/issues"},"homepage":"https://github.com/bauerca/node-ensure","license":"MIT","gitHead":"a695c69765a5773b638c4e700c7db9d7ae193e13","_id":"node-ensure@0.0.0","_shasum":"ecae764150de99861ec5c810fd5d096b183932a7","_from":".","_npmVersion":"1.4.13","_npmUser":{"name":"bauerca","email":"carl.a.bauer@gmail.com"},"maintainers":[{"name":"bauerca","email":"carl.a.bauer@gmail.com"}],"dist":{"shasum":"ecae764150de99861ec5c810fd5d096b183932a7","tarball":"https://registry.npmjs.org/node-ensure/-/node-ensure-0.0.0.tgz","integrity":"sha512-DRI60hzo2oKN1ma0ckc6nQWlHU69RH6xN0sjQTjMpChPfTYvKZdcQFfdYK2RWbJcKyUizSIy/l8OTGxMAM1QDw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDuHDmtAEb015I6nx+jqqQcHbrcVgVYsu3LUkk110Xc3wIhAN/66VMVBTE0soIpc5XqKJLL/LMuDzsWykj1NNfAlmlj"}]}}},"readme":"# node-ensure\n\nA simple library that shims asynchronous module loading into Node.js to help\nwith building module bundlers and client-side loaders for isomorphic apps.\nThis library is super slim (read the source) and mainly represents an agreement\nbetween developers and users of a particular bundler/loader.\n\nNOTE: This module is *not* compatible with Browserify. It is for developers that\nwant to split their bundles for the client. For example, see\n[dynapack](https://github.com/bauerca/dynapack).\n\n*Syntax is inspired by the CommonJS\n[Modules/Async/A](http://wiki.commonjs.org/wiki/Modules/Async/A) proposal.*\n\n\n## Installation\n\n```\nnpm install node-ensure\n```\n\n## Example\n\n```js\nvar ensure = require('node-ensure');\n\nensure(['superagent', 'react'], function(err) {\n var request = require('superagent');\n var React = require('react');\n\n // Do the coolest of things.\n});\n```\n\nIf your bundler needs `require.ensure`, do this instead:\n\n```js\nrequire.ensure = require('node-ensure');\n\nrequire.ensure(['superagent', 'react'], function(err) {\n var request = require('superagent');\n var React = require('react');\n\n // Do the coolest of things.\n});\n```\n\n## Usage\n\nThe returned function takes an array of strings and a callback, in that\norder (see the example above). The callback takes a single error argument, which\nusually indicates a network problem or other client-side loader-specific runtime\nerror (it should never receive an error when used in Node.js).\n\nWithin the ensure callback, load modules with standard require calls.\n\n## Bundlers/Loaders\n\nThis library primarily constitutes an agreement between users and developers of\nmodule bundlers and (client-side) loaders. The users agree to the usage instructions\nsupplied above.\n\nBundlers and/or loaders must adhere to the following:\n\n- The bundler/loader uses the package.json `\"browser\"` property for replacing\n server-only modules with browser-ready counterparts (a la Browserify).\n- The `require` function passed to a module must have a `require.ensure`\n function.\n- Each `require.ensure` must accept the same arguments as described in [Usage](#usage).\n- Each `require.ensure` must not access variables via closure unless those variables\n are shared by **all** `require.ensure` functions.\n- Each `require.ensure` may access properties\n on `this`. However, this assumes users have attached node-ensure to `require` via\n `require.ensure = require('node-ensure')`.\n\nHappy loading!\n\n# License\n\nMIT\n","maintainers":[{"name":"bauerca","email":"carl.a.bauer@gmail.com"}],"time":{"modified":"2022-06-21T14:12:17.870Z","created":"2015-02-28T12:46:37.532Z","0.0.0":"2015-02-28T12:46:37.532Z"},"homepage":"https://github.com/bauerca/node-ensure","keywords":["require","ensure","dynamic","module","loader","bundler","async"],"repository":{"type":"git","url":"https://github.com/bauerca/node-ensure.git"},"author":{"name":"Carl A. Bauer"},"bugs":{"url":"https://github.com/bauerca/node-ensure/issues"},"license":"MIT","readmeFilename":"README.md","users":{"iori20091101":true,"dickeylth":true}}