Skip to content
Newer
Older
100644 42 lines (30 sloc) 1004 Bytes
7885443 @substack readme before any code
authored Jun 18, 2011
1 resolve
2 =======
3
4 Implements the [node `require.resolve()`
5 algorithm](http://nodejs.org/docs/v0.4.8/api/all.html#all_Together...)
6 except you can pass in the file to compute paths relatively to along with your
7 own `require.paths` without updating the global copy (which doesn't even work in
8 node `>=0.5`).
9
10 methods
11 =======
12
5218f01 @substack implementation seems to work but no tests yet
authored Jun 18, 2011
13 var resolve = require('resolve');
14
2ad8287 @substack bump and a note in the docs for extensions
authored Jun 20, 2011
15 resolve.sync(pkg, opts)
16 -----------------------
7885443 @substack readme before any code
authored Jun 18, 2011
17
5218f01 @substack implementation seems to work but no tests yet
authored Jun 18, 2011
18 Synchronously search for the package/filename string `pkg`
7885443 @substack readme before any code
authored Jun 18, 2011
19 according to the [`require.resolve()`
20 algorithm](http://nodejs.org/docs/v0.4.8/api/all.html#all_Together...)
78010b1 @substack opts.path => opts.basedir, more descriptive I think
authored Jun 18, 2011
21 for `X=pkg` and `Y=opts.basedir`.
7885443 @substack readme before any code
authored Jun 18, 2011
22
2ad8287 @substack bump and a note in the docs for extensions
authored Jun 20, 2011
23 Default values for `opts`:
24
25 ````javascript
9fbb632 @substack bump for packageFilter and a note in the docs
authored Jun 20, 2011
26 {
27 paths : [],
28 basedir : __dirname,
29 extensions : [ '.js' ],
30 }
2ad8287 @substack bump and a note in the docs for extensions
authored Jun 20, 2011
31 ````
32
9fbb632 @substack bump for packageFilter and a note in the docs
authored Jun 21, 2011
33 Optionally you can specify a `opts.packageFilter` function to map the contents
34 of `JSON.parse()`'d package.json files.
35
78010b1 @substack opts.path => opts.basedir, more descriptive I think
authored Jun 18, 2011
36 If nothing is found, all of the directories in `opts.paths` are searched.
a9ef081 @substack new resolve.{core,isCore} with tests and documentation, bump to 0.0.1
authored Jun 18, 2011
37
38 resolve.isCore(pkg)
39 -------------------
40
41 Return whether a package is in core.
Something went wrong with that request. Please try again.