node-query/node_modules/grunt-cli/node_modules/resolve/package.json

37 lines
3.8 KiB
JSON

{
"name": "resolve",
"description": "resolve like require.resolve() on behalf of files asynchronously and synchronously",
"version": "0.3.1",
"repository": {
"type": "git",
"url": "git://github.com/substack/node-resolve.git"
},
"main": "index.js",
"keywords": [
"resolve",
"require",
"node",
"module"
],
"scripts": {
"test": "tap test/*.js"
},
"devDependencies": {
"tap": "~0.4.0"
},
"license": "MIT",
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"readme": "# resolve\n\nimplements the [node `require.resolve()`\nalgorithm](http://nodejs.org/docs/v0.4.8/api/all.html#all_Together...)\nsuch that you can `require.resolve()` on behalf of a file asynchronously and\nsynchronously\n\n[![build status](https://secure.travis-ci.org/substack/node-resolve.png)](http://travis-ci.org/substack/node-resolve)\n\n# example\n\nasynchronously resolve:\n\n``` js\nvar resolve = require('resolve');\nresolve('tap', { basedir: __dirname }, function (err, res) {\n if (err) console.error(err)\n else console.log(res)\n});\n```\n\n```\n$ node example/async.js\n/home/substack/projects/node-resolve/node_modules/tap/lib/main.js\n```\n\nsynchronously resolve:\n\n``` js\nvar resolve = require('resolve');\nvar res = resolve.sync('tap', { basedir: __dirname });\nconsole.log(res);\n```\n\n```\n$ node example/sync.js\n/home/substack/projects/node-resolve/node_modules/tap/lib/main.js\n```\n\n# methods\n\n``` js\nvar resolve = require('resolve')\n```\n\n## resolve(pkg, opts={}, cb)\n\nAsynchronously resolve the module path string `pkg` into `cb(err, res)`.\n\noptions are:\n\n* opts.basedir - directory to begin resolving from\n\n* opts.extensions - array of file extensions to search in order\n\n* opts.readFile - how to read files asynchronously\n\n* opts.isFile - function to asynchronously test whether a file exists\n\n* opts.packageFilter - transform the parsed package.json contents before looking\nat the \"main\" field\n\n* opts.paths - require.paths array to use if nothing is found on the normal\nnode_modules recursive walk (probably don't use this)\n\ndefault `opts` values:\n\n``` javascript\n{\n paths: [],\n basedir: __dirname,\n extensions: [ '.js' ],\n readFile: fs.readFile,\n isFile: function (file, cb) {\n fs.stat(file, function (err, stat) {\n if (err && err.code === 'ENOENT') cb(null, false)\n else if (err) cb(err)\n else cb(null, stat.isFile())\n });\n }\n}\n```\n\n## resolve.sync(pkg, opts)\n\nSynchronously resolve the module path string `pkg`, returning the result and\nthrowing an error when `pkg` can't be resolved.\n\noptions are:\n\n* opts.basedir - directory to begin resolving from\n\n* opts.extensions - array of file extensions to search in order\n\n* opts.readFile - how to read files synchronously\n\n* opts.isFile - function to synchronously test whether a file exists\n\n* opts.packageFilter - transform the parsed package.json contents before looking\nat the \"main\" field\n\n* opts.paths - require.paths array to use if nothing is found on the normal\nnode_modules recursive walk (probably don't use this)\n\ndefault `opts` values:\n\n``` javascript\n{\n paths: [],\n basedir: __dirname,\n extensions: [ '.js' ],\n readFileSync: fs.readFileSync,\n isFile: function (file) {\n try { return fs.statSync(file).isFile() }\n catch (e) { return false }\n }\n}\n````\n\n## resolve.isCore(pkg)\n\nReturn whether a package is in core.\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install resolve\n```\n\n# license\n\nMIT\n",
"readmeFilename": "readme.markdown",
"bugs": {
"url": "https://github.com/substack/node-resolve/issues"
},
"homepage": "https://github.com/substack/node-resolve",
"_id": "resolve@0.3.1",
"_from": "resolve@0.3.1"
}