{
  "name": "browser-resolve",
  "version": "1.1.3",
  "description": "resolve which handles browser field support in package.json",
  "main": "index.js",
  "scripts": {
    "test": "mocha test/*.js"
  },
  "repository": {
    "type": "git",
    "url": "git://github.com/shtylman/node-browser-resolve.git"
  },
  "keywords": [
    "resolve",
    "browser"
  ],
  "author": {
    "name": "Roman Shtylman",
    "email": "shtylman@gmail.com"
  },
  "license": "MIT",
  "dependencies": {
    "resolve": "0.4.2"
  },
  "devDependencies": {
    "mocha": "1.12.0"
  },
  "readme": "# browser-resolve [![Build Status](https://travis-ci.org/shtylman/node-browser-resolve.png?branch=master)](https://travis-ci.org/shtylman/node-browser-resolve)\n\nnode.js resolve algorithm with [browser](https://gist.github.com/shtylman/4339901) field support.\n\n## api\n\n### resolve(pkg, opts={}, cb)\n\nResolve a module path and call `cb(err, path)`\n\nOptions:\n\n* filename - the calling filename where the require call originated (in the source)\n* paths - require.paths array to use if nothing is found on the normal node_modules recursive walk\n* packageFilter - transform the parsed package.json contents before looking at the \"main\" field\n* modules - object with module id/name -> path mappings to consult before doing manual resolution (use to provide core modules)\n\n## basic usage\n\nyou can resolve files like `require.resolve()`:\n``` js\nvar resolve = require('browser-resolve');\nresolve('../', { filename: __filename }, function(err, path) {\n    console.log(path);\n});\n```\n\n```\n$ node example/resolve.js\n/home/substack/projects/node-browser-resolve/index.js\n```\n\n## core modules\n\nBy default, core modules (http, dgram, etc) will return their same name as the path. If you want to have specific paths returned, specify a `modules` property in the options object.\n\n``` js\nvar shims = {\n    http: '/your/path/to/http.js'\n};\n\nvar resolve = require('browser-resolve');\nresolve('fs', { modules: shims }, function(err, path) {\n    console.log(path);\n});\n```\n\n```\n$ node example/builtin.js\n/home/substack/projects/node-browser-resolve/builtin/fs.js\n```\n\n## browser field\nbrowser-specific versions of modules\n\n``` js\n{\n  \"name\": \"custom\",\n  \"version\": \"0.0.0\",\n  \"browser\": {\n    \"./main.js\": \"custom.js\"\n  }\n}\n```\n\n``` js\nvar resolve = require('browser-resolve');\nvar parent = { filename: __dirname + '/custom/file.js' };\nresolve('./main.js', parent, function(err, path) {\n    console.log(path);\n});\n```\n\n```\n$ node example/custom.js\n/home/substack/projects/node-browser-resolve/example/custom/custom.js\n```\n\n## skip\n\nYou can skip over dependencies by setting a\n[browser field](https://gist.github.com/shtylman/4339901)\nvalue to `false`:\n\n``` json\n{\n  \"name\": \"skip\",\n  \"version\": \"0.0.0\",\n  \"browser\": {\n    \"tar\": false\n  }\n}\n```\n\nThis is handy if you have code like:\n\n``` js\nvar tar = require('tar');\n\nexports.add = function (a, b) {\n    return a + b;\n};\n\nexports.parse = function () {\n    return tar.Parse();\n};\n```\n\nso that `require('tar')` will just return `{}` in the browser because you don't\nintend to support the `.parse()` export in a browser environment.\n\n``` js\nvar resolve = require('browser-resolve');\nvar parent = { filename: __dirname + '/skip/main.js' };\nresolve('tar', parent, function(err, path) {\n    console.log(path);\n});\n```\n\n```\n$ node example/skip.js\n/home/substack/projects/node-browser-resolve/empty.js\n```\n\n# license\n\nMIT\n\n# upgrade notes\n\nPrior to v1.x this library provided shims for node core modules. These have since been removed. If you want to have alternative core modules provided, use the `modules` option when calling resolve.\n\nThis was done to allow package managers to choose which shims they want to use without browser-resolve being the central point of update.\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/shtylman/node-browser-resolve/issues"
  },
  "_id": "browser-resolve@1.1.3",
  "_from": "browser-resolve@~1.1.0"
}
