UEA-PRODEM

This commit is contained in:
2026-06-10 12:14:46 -03:00
parent f54126b9d8
commit 9947565694
5319 changed files with 148520 additions and 129332 deletions
+18 -15
View File
@@ -5,6 +5,8 @@ var caller = require('./caller');
var nodeModulesPaths = require('./node-modules-paths');
var normalizeOptions = require('./normalize-options');
var isCore = require('is-core-module');
var $Error = require('es-errors');
var $TypeError = require('es-errors/type');
var realpathFS = process.platform !== 'win32' && fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath;
@@ -13,12 +15,13 @@ var windowsDriveRegex = /^\w:[/\\]*$/;
var nodeModulesRegex = /[/\\]node_modules[/\\]*$/;
var homedir = getHomedir();
var defaultPaths = function () {
function defaultPaths() {
if (!homedir) return [];
return [
path.join(homedir, '.node_modules'),
path.join(homedir, '.node_libraries')
];
};
}
var defaultIsFile = function isFile(file, cb) {
fs.stat(file, function (err, stat) {
@@ -47,15 +50,15 @@ var defaultRealpath = function realpath(x, cb) {
});
};
var maybeRealpath = function maybeRealpath(realpath, x, opts, cb) {
function maybeRealpath(realpath, x, opts, cb) {
if (opts && opts.preserveSymlinks === false) {
realpath(x, cb);
} else {
cb(null, x);
}
};
}
var defaultReadPackage = function defaultReadPackage(readFile, pkgfile, cb) {
function defaultReadPackage(readFile, pkgfile, cb) {
readFile(pkgfile, function (readFileErr, body) {
if (readFileErr) cb(readFileErr);
else {
@@ -67,15 +70,15 @@ var defaultReadPackage = function defaultReadPackage(readFile, pkgfile, cb) {
}
}
});
};
}
var getPackageCandidates = function getPackageCandidates(x, start, opts) {
function getPackageCandidates(x, start, opts) {
var dirs = nodeModulesPaths(start, opts, x);
for (var i = 0; i < dirs.length; i++) {
dirs[i] = path.join(dirs[i], x);
}
return dirs;
};
}
module.exports = function resolve(x, options, callback) {
var cb = callback;
@@ -85,7 +88,7 @@ module.exports = function resolve(x, options, callback) {
opts = {};
}
if (typeof x !== 'string') {
var err = new TypeError('Path must be a string.');
var err = new $TypeError('Path must be a string.');
return process.nextTick(function () {
cb(err);
});
@@ -99,7 +102,7 @@ module.exports = function resolve(x, options, callback) {
var realpath = opts.realpath || defaultRealpath;
var readPackage = opts.readPackage || defaultReadPackage;
if (opts.readFile && opts.readPackage) {
var conflictErr = new TypeError('`readFile` and `readPackage` are mutually exclusive.');
var conflictErr = new $TypeError('`readFile` and `readPackage` are mutually exclusive.');
return process.nextTick(function () {
cb(conflictErr);
});
@@ -147,7 +150,7 @@ module.exports = function resolve(x, options, callback) {
}
});
} else {
var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
var moduleError = new $Error("Cannot find module '" + x + "' from '" + parent + "'");
moduleError.code = 'MODULE_NOT_FOUND';
cb(moduleError);
}
@@ -168,7 +171,7 @@ module.exports = function resolve(x, options, callback) {
}
});
} else {
var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
var moduleError = new $Error("Cannot find module '" + x + "' from '" + parent + "'");
moduleError.code = 'MODULE_NOT_FOUND';
cb(moduleError);
}
@@ -202,7 +205,7 @@ module.exports = function resolve(x, options, callback) {
var rel = rfile.slice(0, rfile.length - exts[0].length);
var r = opts.pathFilter(pkg, x, rel);
if (r) return load(
[''].concat(extensions.slice()),
[''].concat(extensions),
path.resolve(dir, r),
pkg
);
@@ -232,7 +235,7 @@ module.exports = function resolve(x, options, callback) {
if (!ex) return loadpkg(path.dirname(dir), cb);
readPackage(readFile, pkgfile, function (err, pkgParam) {
if (err) cb(err);
if (err) { return cb(err); }
var pkg = pkgParam;
@@ -271,7 +274,7 @@ module.exports = function resolve(x, options, callback) {
if (pkg && pkg.main) {
if (typeof pkg.main !== 'string') {
var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string');
var mainError = new $TypeError('package “' + pkg.name + '” `main` must be a string');
mainError.code = 'INVALID_PACKAGE_MAIN';
return cb(mainError);
}