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
+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;
}