{
  "scripts": {
    "prebuild": [
      "grunt build"
    ]
  },
  "directories": {
    "dist": "dist"
  },
  "dependencies": {},
  "asyncDependencies": {},
  "devDependencies": {},
  "name": "neuron",
  "version": "5.1.0-beta",
  "description": "Neuron is a very simple [CommonJS](http://wiki.commonjs.org) module loader.",
  "main": "dist/neuron",
  "repository": {
    "type": "git",
    "url": "https://github.com/kaelzhang/neuron.git"
  },
  "keywords": [
    "neuron",
    "commonjs",
    "loader",
    "module",
    "web"
  ],
  "author": {
    "name": "kael"
  },
  "license": "MIT",
  "gitHead": "10a7e25845f06b9ec567a223c4f75f6ead3efd4e",
  "readmeFilename": "README.md",
  "readme": "# Neuron [![Build Status](https://travis-ci.org/kaelzhang/neuron.svg?branch=master)](https://travis-ci.org/kaelzhang/neuron)\n\nFirst of all, **neuron is not designed for human developers to use directly**. Most usually, it works together with [cortex](https://github.com/kaelzhang/cortex).\n\nNeuron is a very simple [CommonJS](http://wiki.commonjs.org) module loader which is used by [dianping.com](http://www.dianping.com), and will be more powerful if working with [Cortex](https://github.com/kaelzhang/cortex).\n\n- Implements commonjs [Module/1.0](http://wiki.commonjs.org/wiki/Modules/1.0) standard.\n- Implements [semver](http://semver.org) and [semver ranges](https://github.com/mojombo/semver/issues/113): `~a.b.c` and `^a.b.c`(coming...)\n- Implements `require.resolve()` which is similar to node.js.\n\n> Neurons are the core components of the nervous system. They processes and transmits chemical signals to others as well as javascript modules work with others by passing runtime objects.\n\nWith [Cortex](https://github.com/kaelzhang/cortex) and Neuron, we write web modules **exactly** the same as we work with [node.js](http://nodejs.org), with no [Module/Wrappings](http://wiki.commonjs.org/wiki/Modules/Wrappings), no [AMD](http://wiki.commonjs.org/wiki/Modules/AsynchronousDefinition), etc. \n\nYou could remove all those annoying and noisy things out of your mind, and, just focus on the origin and code your web modules like node.js.\n\nNeuron is designed to run in the background without your concern, **UNLIKE** [RequireJS](https://github.com/jrburke/requirejs) and many other loaders.\n\n> We're trying to return to the origin of commonjs. There should be only ONE standard, that is, Module/1.0.\n\n## Getting Started\n\n### Installation\n\n```bash\nnpm install\ngrunt\n```\n\n### Usage\n\nFrequent configurations, for more, just see `Configuration Hierarchies` section.\n\n```html\n<script src=\"/dist/neuron.js\"></script>\n<script>\nneuron.config({\n\tpath: 'http://localhost/mod'\n});\n</script>\n```\t\n\nFor the example above:\n\nmodule `'abc@0.1.1'` will be located at `'http://localhost/mod/abc/0.1.1/abc.js'`\n\n## Methods\n\n### require(id)\n \n- id `String` module identifier.\n\nTo require modules. See [CommonJS Module/1.0](http://wiki.commonjs.org/wiki/Modules/1.0)\n\n\n### require.async(id, callback)\n\n- id `String` module identifier.\n- callback `function(exports)` callback must be passed, or `require.async` will do nothing.\n\nAsynchronously loads a module by `id`, and then passes the module `exports` to `callback`.\n\nYou should always pass the `callback` parameter because neuron can not make sure the exact time when a module is loaded asynchronously.\n\nIt is **NOT** a good practice if the logic of your code relies on the result of the `require.async()`d module without a callback.\n\n\n### require.resolve(path)\n\n- path `String` the relative path to be resolved according to the current module.\n\nReturns the resolved absolute path of the resource. \n\nReturns `undefined` if `path` is not a relative path.\n\nReturns `undefined` if `path` is even outside the current package.\n\n\n### define()\nWith [cortex](https://github.com/kaelzhang/cortex), you might **NEVER** use this method.\n\n```js\ndefine(identifier, dependencies, factory, options);\n```\n\t\n### facade()\n\n```js\nfacade(identifier);\n\nfacade({\n\tmod: identifier,\n\tdata: data\n});\n```\n\t\nMethod `facade` loads a module. If the `module.exports` has a method named `init`, `facade` method will run the `init` method.\n\nWe call this kind of modules as [facade modules](http://en.wikipedia.org/wiki/Facade_pattern)\n\t\n#### identifier `String`\n\nmodule name with version, seperated with `'@'`. For example: `'async@0.1.0'`\n\n#### data `Object`\n\nIf `data` is defined, data will be passed as the parameter of the `init` method.\n\n\n## Events\n\n### Event: use\n\n- event `Object`\n\t- mod `Object` the module object.\n\t- defined `boolean` whether the module is already `define`()d.\n \nEmitted when a module is provided or `require`() by another module.\n\n```js\nneuron.on('use', function(e){\n\tconsole.log('use', e.mod.id);\n});\n```\n\n### Event: cyclic\n\n- event `Object`\n\t- mod `Object` the module object.\n\nEmitted when neuron find a cyclic dependency.\n\n \n****\n# Developer Guide\n\n**Neuron CORE** supplies no high-level APIs, which means that neuron core only cares about module dependencies and module wrapping while will do nothing about things such as fetching modules from remote server and injecting them into the current document, and never cares about where a specific module should come from.\n\nYou could do all these things in your will (by write your own `lib/load.js` and adjust `Gruntfile.js`). Nevertheless, neuron have a basic configuration file which located at `lib/load.js`.\n\n## Configuration Hierarchies\n\nWe can configure our settings in two places: with `neuron.config()` method, or in cookie, of which the priority is:\n\n```js\ncookie > neuron.config()\n```\n\nSo, neuron has no mode for debugging which you could help yourself by setting the cookies.\n\n### neuron.config(settings)\n\n```js\nneuron.config({\n\tpath: 'http://localhost/mod'\n});\n```\n\n#### path `String`\n\nCommonJS module path, like `NODE_PATH`, default to 'the root directory of neuronjs'.\n\nPay attension that `path` will not be resolved to absolute url. So if you don't want a relative `path`, don't forget `'http://'`.\n\n\n#### loaded `String|Array.<id>`\n\nTo tell neuron loader that those modules are already loaded, and prevent duplicate loading.\n\nIf `String`, we can separate different ids with `'|'` (comma).\n\n```js\nneuron.config({\n\tloaded: ['jquery@1.9.2', 'async@0.2.9']\n});\n```\n\n#### ranges `Object`\n\nDefines the map which describes the explicit verison to each range.\n\nThis config often generates by server-side services.\n\n```js\nneuron.config({\n\tranges: {\n\t\t\"async\": {\n\t\t\t\"latest\": \"0.2.9\"\n\t\t},\n\t\t\"jquery\": {\n\t\t\t\"~1.9.0\": \"1.9.10\"\n\t\t}\n\t}\n});\n```\n\n#### ext `String`\n\nDefines the file extension of the module file, default to `'.js'`.\n\nSometimes you want to load compressed files, then you can set it to `'.min.js'` or something.\n\n\n### Settings in cookie\n\nKey: `'neuron'`\n\nValue syntax: `<setting-key>=<setting-value>,<setting-key>=<setting-value>`.\n\n#### Example\n\n```js\ndocument.cookie = 'neuron=' +\n\tencodeURIComponent(\n\t\t'path=http://localhost,' +\n\t\t'loaded=jquery@1.9.2|async@0.2.9'\n\t);\n```\n\n\nNotice that not all options could take effect using `neuron.config`. And also, `path` and `loaded` could not affect modules which are already loaded.\n\n\n## Related Projects\n\n- [cortex](https://github.com/kaelzhang/cortex)\n- [neocortex-sync](https://github.com/kaelzhang/neocortex-sync)\n\n\n",
  "bugs": {
    "url": "https://github.com/kaelzhang/neuron/issues"
  },
  "homepage": "https://github.com/kaelzhang/neuron",
  "styles": []
}