first commit

This commit is contained in:
Frank John Begornia
2025-12-23 01:51:15 +08:00
commit c926590e1d
4137 changed files with 613038 additions and 0 deletions

60
node_modules/proxy-agent/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,60 @@
/// <reference types="node" />
import * as http from 'http';
import LRUCache from 'lru-cache';
import { Agent, AgentConnectOpts } from 'agent-base';
import { PacProxyAgentOptions } from 'pac-proxy-agent';
import { HttpProxyAgentOptions } from 'http-proxy-agent';
import { HttpsProxyAgentOptions } from 'https-proxy-agent';
import { SocksProxyAgentOptions } from 'socks-proxy-agent';
declare const PROTOCOLS: readonly ["http", "https", "socks", "socks4", "socks4a", "socks5", "socks5h", ...("pac+http" | "pac+https" | "pac+data" | "pac+file" | "pac+ftp")[]];
type ValidProtocol = (typeof PROTOCOLS)[number];
type AgentConstructor = new (...args: never[]) => Agent;
type GetProxyForUrlCallback = (url: string) => string;
/**
* Supported proxy types.
*/
export declare const proxies: {
[P in ValidProtocol]: [AgentConstructor, AgentConstructor];
};
export type ProxyAgentOptions = HttpProxyAgentOptions<''> & HttpsProxyAgentOptions<''> & SocksProxyAgentOptions & PacProxyAgentOptions<''> & {
/**
* Default `http.Agent` instance to use when no proxy is
* configured for a request. Defaults to a new `http.Agent()`
* instance with the proxy agent options passed in.
*/
httpAgent?: http.Agent;
/**
* Default `http.Agent` instance to use when no proxy is
* configured for a request. Defaults to a new `https.Agent()`
* instance with the proxy agent options passed in.
*/
httpsAgent?: http.Agent;
/**
* A callback for dynamic provision of proxy for url.
* Defaults to standard proxy environment variables,
* see https://www.npmjs.com/package/proxy-from-env for details
*/
getProxyForUrl?: GetProxyForUrlCallback;
};
/**
* Uses the appropriate `Agent` subclass based off of the "proxy"
* environment variables that are currently set.
*
* An LRU cache is used, to prevent unnecessary creation of proxy
* `http.Agent` instances.
*/
export declare class ProxyAgent extends Agent {
/**
* Cache for `Agent` instances.
*/
cache: LRUCache<string, Agent>;
connectOpts?: ProxyAgentOptions;
httpAgent: http.Agent;
httpsAgent: http.Agent;
getProxyForUrl: GetProxyForUrlCallback;
constructor(opts?: ProxyAgentOptions);
connect(req: http.ClientRequest, opts: AgentConnectOpts): Promise<http.Agent>;
destroy(): void;
}
export {};
//# sourceMappingURL=index.d.ts.map

1
node_modules/proxy-agent/dist/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGrD,OAAO,EAAiB,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAkB,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAmB,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAmB,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAI5E,QAAA,MAAM,SAAS,sJAIL,CAAC;AAEX,KAAK,aAAa,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhD,KAAK,gBAAgB,GAAG,KAAK,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC;AAExD,KAAK,sBAAsB,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE;KACpB,CAAC,IAAI,aAAa,GAAG,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;CAc1D,CAAC;AAMF,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,EAAE,CAAC,GACxD,sBAAsB,CAAC,EAAE,CAAC,GAC1B,sBAAsB,GACtB,oBAAoB,CAAC,EAAE,CAAC,GAAG;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC;IACvB;;;;OAIG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC;IACxB;;;;OAIG;IACH,cAAc,CAAC,EAAE,sBAAsB,CAAC;CACxC,CAAC;AAEH;;;;;;GAMG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACpC;;OAEG;IACH,KAAK,0BAA4C;IAEjD,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC;IACtB,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC;IACvB,cAAc,EAAE,sBAAsB,CAAC;gBAE3B,IAAI,CAAC,EAAE,iBAAiB;IAU9B,OAAO,CACZ,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,IAAI,EAAE,gBAAgB,GACpB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;IA2CtB,OAAO,IAAI,IAAI;CAMf"}

134
node_modules/proxy-agent/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,134 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProxyAgent = exports.proxies = void 0;
const http = __importStar(require("http"));
const https = __importStar(require("https"));
const url_1 = require("url");
const lru_cache_1 = __importDefault(require("lru-cache"));
const agent_base_1 = require("agent-base");
const debug_1 = __importDefault(require("debug"));
const proxy_from_env_1 = require("proxy-from-env");
const pac_proxy_agent_1 = require("pac-proxy-agent");
const http_proxy_agent_1 = require("http-proxy-agent");
const https_proxy_agent_1 = require("https-proxy-agent");
const socks_proxy_agent_1 = require("socks-proxy-agent");
const debug = (0, debug_1.default)('proxy-agent');
const PROTOCOLS = [
...http_proxy_agent_1.HttpProxyAgent.protocols,
...socks_proxy_agent_1.SocksProxyAgent.protocols,
...pac_proxy_agent_1.PacProxyAgent.protocols,
];
/**
* Supported proxy types.
*/
exports.proxies = {
http: [http_proxy_agent_1.HttpProxyAgent, https_proxy_agent_1.HttpsProxyAgent],
https: [http_proxy_agent_1.HttpProxyAgent, https_proxy_agent_1.HttpsProxyAgent],
socks: [socks_proxy_agent_1.SocksProxyAgent, socks_proxy_agent_1.SocksProxyAgent],
socks4: [socks_proxy_agent_1.SocksProxyAgent, socks_proxy_agent_1.SocksProxyAgent],
socks4a: [socks_proxy_agent_1.SocksProxyAgent, socks_proxy_agent_1.SocksProxyAgent],
socks5: [socks_proxy_agent_1.SocksProxyAgent, socks_proxy_agent_1.SocksProxyAgent],
socks5h: [socks_proxy_agent_1.SocksProxyAgent, socks_proxy_agent_1.SocksProxyAgent],
'pac+data': [pac_proxy_agent_1.PacProxyAgent, pac_proxy_agent_1.PacProxyAgent],
'pac+file': [pac_proxy_agent_1.PacProxyAgent, pac_proxy_agent_1.PacProxyAgent],
'pac+ftp': [pac_proxy_agent_1.PacProxyAgent, pac_proxy_agent_1.PacProxyAgent],
'pac+http': [pac_proxy_agent_1.PacProxyAgent, pac_proxy_agent_1.PacProxyAgent],
'pac+https': [pac_proxy_agent_1.PacProxyAgent, pac_proxy_agent_1.PacProxyAgent],
};
function isValidProtocol(v) {
return PROTOCOLS.includes(v);
}
/**
* Uses the appropriate `Agent` subclass based off of the "proxy"
* environment variables that are currently set.
*
* An LRU cache is used, to prevent unnecessary creation of proxy
* `http.Agent` instances.
*/
class ProxyAgent extends agent_base_1.Agent {
constructor(opts) {
super(opts);
/**
* Cache for `Agent` instances.
*/
this.cache = new lru_cache_1.default({ max: 20 });
debug('Creating new ProxyAgent instance: %o', opts);
this.connectOpts = opts;
this.httpAgent = opts?.httpAgent || new http.Agent(opts);
this.httpsAgent =
opts?.httpsAgent || new https.Agent(opts);
this.getProxyForUrl = opts?.getProxyForUrl || proxy_from_env_1.getProxyForUrl;
}
async connect(req, opts) {
const { secureEndpoint } = opts;
const isWebSocket = req.getHeader('upgrade') === 'websocket';
const protocol = secureEndpoint
? isWebSocket
? 'wss:'
: 'https:'
: isWebSocket
? 'ws:'
: 'http:';
const host = req.getHeader('host');
const url = new url_1.URL(req.path, `${protocol}//${host}`).href;
const proxy = this.getProxyForUrl(url);
if (!proxy) {
debug('Proxy not enabled for URL: %o', url);
return secureEndpoint ? this.httpsAgent : this.httpAgent;
}
debug('Request URL: %o', url);
debug('Proxy URL: %o', proxy);
// attempt to get a cached `http.Agent` instance first
const cacheKey = `${protocol}+${proxy}`;
let agent = this.cache.get(cacheKey);
if (!agent) {
const proxyUrl = new url_1.URL(proxy);
const proxyProto = proxyUrl.protocol.replace(':', '');
if (!isValidProtocol(proxyProto)) {
throw new Error(`Unsupported protocol for proxy URL: ${proxy}`);
}
const ctor = exports.proxies[proxyProto][secureEndpoint || isWebSocket ? 1 : 0];
// @ts-expect-error meh…
agent = new ctor(proxy, this.connectOpts);
this.cache.set(cacheKey, agent);
}
else {
debug('Cache hit for proxy URL: %o', proxy);
}
return agent;
}
destroy() {
for (const agent of this.cache.values()) {
agent.destroy();
}
super.destroy();
}
}
exports.ProxyAgent = ProxyAgent;
//# sourceMappingURL=index.js.map

1
node_modules/proxy-agent/dist/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sour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