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);
}
+8 -4
View File
@@ -1,8 +1,12 @@
'use strict';
var $Error = require('es-errors');
module.exports = function () {
// see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
var origPrepareStackTrace = Error.prepareStackTrace;
Error.prepareStackTrace = function (_, stack) { return stack; };
var stack = (new Error()).stack;
Error.prepareStackTrace = origPrepareStackTrace;
var origPrepareStackTrace = $Error.prepareStackTrace;
$Error.prepareStackTrace = function (_, stack) { return stack; };
var stack = (new $Error()).stack;
$Error.prepareStackTrace = origPrepareStackTrace;
return stack[2].getFileName();
};
+8 -1
View File
@@ -9,7 +9,14 @@ module.exports = os.homedir || function homedir() {
var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
if (process.platform === 'win32') {
return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || home || null;
return process.env.USERPROFILE
|| (
process.env.HOMEDRIVE
&& process.env.HOMEPATH
&& (process.env.HOMEDRIVE + process.env.HOMEPATH)
)
|| home
|| null;
}
if (process.platform === 'darwin') {
+2 -2
View File
@@ -4,7 +4,7 @@ var parse = path.parse || require('path-parse'); // eslint-disable-line global-r
var driveLetterRegex = /^([A-Za-z]:)/;
var uncPathRegex = /^\\\\/;
var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) {
function getNodeModulesDirs(absoluteStart, modules) {
var prefix = '/';
if (driveLetterRegex.test(absoluteStart)) {
prefix = '';
@@ -24,7 +24,7 @@ var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) {
return path.resolve(prefix, aPath, moduleDir);
}));
}, []);
};
}
module.exports = function nodeModulesPaths(start, opts, request) {
var modules = opts && opts.moduleDirectory
+16 -12
View File
@@ -1,6 +1,9 @@
var isCore = require('is-core-module');
var fs = require('fs');
var path = require('path');
var $Error = require('es-errors');
var $TypeError = require('es-errors/type');
var getHomedir = require('./homedir');
var caller = require('./caller');
var nodeModulesPaths = require('./node-modules-paths');
@@ -13,12 +16,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) {
try {
@@ -51,32 +55,32 @@ var defaultRealpathSync = function realpathSync(x) {
return x;
};
var maybeRealpathSync = function maybeRealpathSync(realpathSync, x, opts) {
function maybeRealpathSync(realpathSync, x, opts) {
if (opts && opts.preserveSymlinks === false) {
return realpathSync(x);
}
return x;
};
}
var defaultReadPackageSync = function defaultReadPackageSync(readFileSync, pkgfile) {
function defaultReadPackageSync(readFileSync, pkgfile) {
var body = readFileSync(pkgfile);
try {
var pkg = JSON.parse(body);
return pkg;
} catch (jsonErr) {}
};
}
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 resolveSync(x, options) {
if (typeof x !== 'string') {
throw new TypeError('Path must be a string.');
throw new $TypeError('Path must be a string.');
}
var opts = normalizeOptions(x, options);
@@ -86,7 +90,7 @@ module.exports = function resolveSync(x, options) {
var realpathSync = opts.realpathSync || defaultRealpathSync;
var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
if (opts.readFileSync && opts.readPackageSync) {
throw new TypeError('`readFileSync` and `readPackageSync` are mutually exclusive.');
throw new $TypeError('`readFileSync` and `readPackageSync` are mutually exclusive.');
}
var packageIterator = opts.packageIterator;
@@ -112,7 +116,7 @@ module.exports = function resolveSync(x, options) {
if (n) return maybeRealpathSync(realpathSync, n, opts);
}
var err = new Error("Cannot find module '" + x + "' from '" + parent + "'");
var err = new $Error("Cannot find module '" + x + "' from '" + parent + "'");
err.code = 'MODULE_NOT_FOUND';
throw err;
@@ -176,7 +180,7 @@ module.exports = function resolveSync(x, options) {
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';
throw mainError;
}