Updating NPM dependencies
This commit is contained in:
41
node_modules/resolve/lib/async.js
generated
vendored
41
node_modules/resolve/lib/async.js
generated
vendored
@@ -1,9 +1,11 @@
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var caller = require('./caller.js');
|
||||
var nodeModulesPaths = require('./node-modules-paths.js');
|
||||
var normalizeOptions = require('./normalize-options.js');
|
||||
var isCore = require('./is-core');
|
||||
var caller = require('./caller');
|
||||
var nodeModulesPaths = require('./node-modules-paths');
|
||||
var normalizeOptions = require('./normalize-options');
|
||||
var isCore = require('is-core-module');
|
||||
|
||||
var realpathFS = fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath;
|
||||
|
||||
var defaultIsFile = function isFile(file, cb) {
|
||||
fs.stat(file, function (err, stat) {
|
||||
@@ -25,12 +27,16 @@ var defaultIsDir = function isDirectory(dir, cb) {
|
||||
});
|
||||
};
|
||||
|
||||
var maybeUnwrapSymlink = function maybeUnwrapSymlink(x, opts, cb) {
|
||||
var defaultRealpath = function realpath(x, cb) {
|
||||
realpathFS(x, function (realpathErr, realPath) {
|
||||
if (realpathErr && realpathErr.code !== 'ENOENT') cb(realpathErr);
|
||||
else cb(null, realpathErr ? x : realPath);
|
||||
});
|
||||
};
|
||||
|
||||
var maybeRealpath = function maybeRealpath(realpath, x, opts, cb) {
|
||||
if (opts && opts.preserveSymlinks === false) {
|
||||
fs.realpath(x, function (realPathErr, realPath) {
|
||||
if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr);
|
||||
else cb(null, realPathErr ? x : realPath);
|
||||
});
|
||||
realpath(x, cb);
|
||||
} else {
|
||||
cb(null, x);
|
||||
}
|
||||
@@ -63,9 +69,11 @@ module.exports = function resolve(x, options, callback) {
|
||||
var isFile = opts.isFile || defaultIsFile;
|
||||
var isDirectory = opts.isDirectory || defaultIsDir;
|
||||
var readFile = opts.readFile || fs.readFile;
|
||||
var realpath = opts.realpath || defaultRealpath;
|
||||
var packageIterator = opts.packageIterator;
|
||||
|
||||
var extensions = opts.extensions || ['.js'];
|
||||
var includeCoreModules = opts.includeCoreModules !== false;
|
||||
var basedir = opts.basedir || path.dirname(caller());
|
||||
var parent = opts.filename || basedir;
|
||||
|
||||
@@ -74,7 +82,8 @@ module.exports = function resolve(x, options, callback) {
|
||||
// ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory
|
||||
var absoluteStart = path.resolve(basedir);
|
||||
|
||||
maybeUnwrapSymlink(
|
||||
maybeRealpath(
|
||||
realpath,
|
||||
absoluteStart,
|
||||
opts,
|
||||
function (err, realStart) {
|
||||
@@ -87,16 +96,16 @@ module.exports = function resolve(x, options, callback) {
|
||||
function init(basedir) {
|
||||
if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) {
|
||||
res = path.resolve(basedir, x);
|
||||
if (x === '..' || x.slice(-1) === '/') res += '/';
|
||||
if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/';
|
||||
if ((/\/$/).test(x) && res === basedir) {
|
||||
loadAsDirectory(res, opts.package, onfile);
|
||||
} else loadAsFile(res, opts.package, onfile);
|
||||
} else if (isCore(x)) {
|
||||
} else if (includeCoreModules && isCore(x)) {
|
||||
return cb(null, x);
|
||||
} else loadNodeModules(x, basedir, function (err, n, pkg) {
|
||||
if (err) cb(err);
|
||||
else if (n) {
|
||||
return maybeUnwrapSymlink(n, opts, function (err, realN) {
|
||||
return maybeRealpath(realpath, n, opts, function (err, realN) {
|
||||
if (err) {
|
||||
cb(err);
|
||||
} else {
|
||||
@@ -117,7 +126,7 @@ module.exports = function resolve(x, options, callback) {
|
||||
else loadAsDirectory(res, function (err, d, pkg) {
|
||||
if (err) cb(err);
|
||||
else if (d) {
|
||||
maybeUnwrapSymlink(d, opts, function (err, realD) {
|
||||
maybeRealpath(realpath, d, opts, function (err, realD) {
|
||||
if (err) {
|
||||
cb(err);
|
||||
} else {
|
||||
@@ -181,7 +190,7 @@ module.exports = function resolve(x, options, callback) {
|
||||
}
|
||||
if ((/[/\\]node_modules[/\\]*$/).test(dir)) return cb(null);
|
||||
|
||||
maybeUnwrapSymlink(dir, opts, function (unwrapErr, pkgdir) {
|
||||
maybeRealpath(realpath, dir, opts, function (unwrapErr, pkgdir) {
|
||||
if (unwrapErr) return loadpkg(path.dirname(dir), cb);
|
||||
var pkgfile = path.join(pkgdir, 'package.json');
|
||||
isFile(pkgfile, function (err, ex) {
|
||||
@@ -209,7 +218,7 @@ module.exports = function resolve(x, options, callback) {
|
||||
fpkg = opts.package;
|
||||
}
|
||||
|
||||
maybeUnwrapSymlink(x, opts, function (unwrapErr, pkgdir) {
|
||||
maybeRealpath(realpath, x, opts, function (unwrapErr, pkgdir) {
|
||||
if (unwrapErr) return cb(unwrapErr);
|
||||
var pkgfile = path.join(pkgdir, 'package.json');
|
||||
isFile(pkgfile, function (err, ex) {
|
||||
|
||||
Reference in New Issue
Block a user