Updating NPM dependencies

This commit is contained in:
Drew Heavner
2020-11-11 13:30:52 +00:00
committed by GitHub
parent 7a6fb66c63
commit bd487ef324
9068 changed files with 1400893 additions and 587661 deletions

67
node_modules/locate-path/index.js generated vendored
View File

@@ -1,24 +1,65 @@
'use strict';
const path = require('path');
const pathExists = require('path-exists');
const fs = require('fs');
const {promisify} = require('util');
const pLocate = require('p-locate');
module.exports = (iterable, options) => {
options = Object.assign({
cwd: process.cwd()
}, options);
const fsStat = promisify(fs.stat);
const fsLStat = promisify(fs.lstat);
return pLocate(iterable, el => pathExists(path.resolve(options.cwd, el)), options);
const typeMappings = {
directory: 'isDirectory',
file: 'isFile'
};
module.exports.sync = (iterable, options) => {
options = Object.assign({
cwd: process.cwd()
}, options);
function checkType({type}) {
if (type in typeMappings) {
return;
}
for (const el of iterable) {
if (pathExists.sync(path.resolve(options.cwd, el))) {
return el;
throw new Error(`Invalid type specified: ${type}`);
}
const matchType = (type, stat) => type === undefined || stat[typeMappings[type]]();
module.exports = async (paths, options) => {
options = {
cwd: process.cwd(),
type: 'file',
allowSymlinks: true,
...options
};
checkType(options);
const statFn = options.allowSymlinks ? fsStat : fsLStat;
return pLocate(paths, async path_ => {
try {
const stat = await statFn(path.resolve(options.cwd, path_));
return matchType(options.type, stat);
} catch (_) {
return false;
}
}, options);
};
module.exports.sync = (paths, options) => {
options = {
cwd: process.cwd(),
allowSymlinks: true,
type: 'file',
...options
};
checkType(options);
const statFn = options.allowSymlinks ? fs.statSync : fs.lstatSync;
for (const path_ of paths) {
try {
const stat = statFn(path.resolve(options.cwd, path_));
if (matchType(options.type, stat)) {
return path_;
}
} catch (_) {
}
}
};