Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function loadModules(root, depType, options) {
tryRequire.cache.reset(); // reset the package cache on re-run
let opt = _.clone(options || {});
let pkgRoot = root;
if (opt.file) {
let pathInfo = path.parse(opt.file);
pkgRoot = path.resolve(pkgRoot, pathInfo.dir);
opt.file = pathInfo.base;
}
return loadModulesInternal(
pkgRoot,
depType || null,
null,
opt,
).then(function (tree) {