-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
38 lines (38 loc) · 4.34 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{
"name": "resolve",
"description": "resolve like require.resolve() on behalf of files asynchronously and synchronously",
"version": "0.7.4",
"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.package - package from which module is being loaded\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\n* opts.moduleDirectory - directory (or directories) to recursively look for modules in. default:\n`\"node_modules\"`\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 moduleDirectory: 'node_modules'\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\n* opts.moduleDirectory - directory (or directories) to recursively look for modules in. default:\n`\"node_modules\"`\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 moduleDirectory: 'node_modules'\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.7.4",
"_shasum": "395a9ef9e873fbfe12bd14408bd91bb936003d69",
"_resolved": "https://registry.npmjs.org/resolve/-/resolve-0.7.4.tgz",
"_from": "resolve@>=0.7.0 <0.8.0"
}