nav tabs on admin dashboard
This commit is contained in:
43
node_modules/resolve/lib/node-modules-paths.js
generated
vendored
43
node_modules/resolve/lib/node-modules-paths.js
generated
vendored
@@ -1,30 +1,11 @@
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var parse = path.parse || require('path-parse');
|
||||
|
||||
module.exports = function nodeModulesPaths(start, opts) {
|
||||
var modules = opts && opts.moduleDirectory
|
||||
? [].concat(opts.moduleDirectory)
|
||||
: ['node_modules'];
|
||||
|
||||
// ensure that `start` is an absolute path at this point,
|
||||
// resolving against the process' current working directory
|
||||
var absoluteStart = path.resolve(start);
|
||||
|
||||
if (opts && opts.preserveSymlinks === false) {
|
||||
try {
|
||||
absoluteStart = fs.realpathSync(absoluteStart);
|
||||
} catch (err) {
|
||||
if (err.code !== 'ENOENT') {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) {
|
||||
var prefix = '/';
|
||||
if (/^([A-Za-z]:)/.test(absoluteStart)) {
|
||||
if ((/^([A-Za-z]:)/).test(absoluteStart)) {
|
||||
prefix = '';
|
||||
} else if (/^\\\\/.test(absoluteStart)) {
|
||||
} else if ((/^\\\\/).test(absoluteStart)) {
|
||||
prefix = '\\\\';
|
||||
}
|
||||
|
||||
@@ -35,11 +16,27 @@ module.exports = function nodeModulesPaths(start, opts) {
|
||||
parsed = parse(parsed.dir);
|
||||
}
|
||||
|
||||
var dirs = paths.reduce(function (dirs, aPath) {
|
||||
return paths.reduce(function (dirs, aPath) {
|
||||
return dirs.concat(modules.map(function (moduleDir) {
|
||||
return path.join(prefix, aPath, moduleDir);
|
||||
}));
|
||||
}, []);
|
||||
};
|
||||
|
||||
module.exports = function nodeModulesPaths(start, opts, request) {
|
||||
var modules = opts && opts.moduleDirectory
|
||||
? [].concat(opts.moduleDirectory)
|
||||
: ['node_modules'];
|
||||
|
||||
if (opts && typeof opts.paths === 'function') {
|
||||
return opts.paths(
|
||||
request,
|
||||
start,
|
||||
function () { return getNodeModulesDirs(start, modules); },
|
||||
opts
|
||||
);
|
||||
}
|
||||
|
||||
var dirs = getNodeModulesDirs(start, modules);
|
||||
return opts && opts.paths ? dirs.concat(opts.paths) : dirs;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user