relativePath - the path relative from the package.json location
returns - a relative path that will be joined from the package.json location
opts.paths - require.paths array to use if nothing is found on the normal node_modules recursive walk (probably don't use this)
For advanced users, paths can also be a opts.paths(request, start, opts) function
request - the import specifier being resolved
start - lookup path
getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard node_modules resolution
opts - the resolution options
opts.packageIterator(request, start, opts) - return the list of candidate paths where the packages sources may be found (probably don't use this)
request - the import specifier being resolved
start - lookup path
getPackageCandidates - a thunk (no-argument function) that returns the paths using standard node_modules resolution
opts - the resolution options
opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: "node_modules"
opts.preserveSymlinks - if true, doesn't resolve basedir to real path before resolving.
This is the way Node resolves dependencies when executed with the --preserve-symlinks flag.
Note: this property is currently true by default but it will be changed to
false in the next major version because Node's resolution algorithm does not preserve symlinks by default.
if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr);
else cb(null, realPathErr ? file : realPath);
});
},
readPackage: function defaultReadPackage(readFile, pkgfile, cb) {
readFile(pkgfile, function (readFileErr, body) {
if (readFileErr) cb(readFileErr);
else {
try {
var pkg = JSON.parse(body);
cb(null, pkg);
} catch (jsonErr) {
cb(null);
}
}
});
},
moduleDirectory: 'node_modules',
preserveSymlinks: true
}
opts.paths - require.paths array to use if nothing is found on the normal node_modules recursive walk (probably don't use this)
For advanced users, paths can also be a opts.paths(request, start, opts) function
request - the import specifier being resolved
start - lookup path
getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard node_modules resolution
opts - the resolution options
opts.packageIterator(request, start, opts) - return the list of candidate paths where the packages sources may be found (probably don't use this)
request - the import specifier being resolved
start - lookup path
getPackageCandidates - a thunk (no-argument function) that returns the paths using standard node_modules resolution
opts - the resolution options
opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: "node_modules"
opts.preserveSymlinks - if true, doesn't resolve basedir to real path before resolving.
This is the way Node resolves dependencies when executed with the --preserve-symlinks flag.
Note: this property is currently true by default but it will be changed to
false in the next major version because Node's resolution algorithm does not preserve symlinks by default.
();
},
isDirectory: function isDirectory(dir) {
try {
var stat = fs.statSync(dir);
} catch (e) {
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;