You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
12 KiB
JavaScript

9 months ago
"use strict";
/*
* ATTENTION: An "eval-source-map" devtool has been used.
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
exports.id = "vendor-chunks/proxy-from-env";
exports.ids = ["vendor-chunks/proxy-from-env"];
exports.modules = {
/***/ "(ssr)/./node_modules/proxy-from-env/index.js":
/*!**********************************************!*\
!*** ./node_modules/proxy-from-env/index.js ***!
\**********************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
eval("\nvar parseUrl = (__webpack_require__(/*! url */ \"url\").parse);\nvar DEFAULT_PORTS = {\n ftp: 21,\n gopher: 70,\n http: 80,\n https: 443,\n ws: 80,\n wss: 443\n};\nvar stringEndsWith = String.prototype.endsWith || function(s) {\n return s.length <= this.length && this.indexOf(s, this.length - s.length) !== -1;\n};\n/**\n * @param {string|object} url - The URL, or the result from url.parse.\n * @return {string} The URL of the proxy that should handle the request to the\n * given URL. If no proxy is set, this will be an empty string.\n */ function getProxyForUrl(url) {\n var parsedUrl = typeof url === \"string\" ? parseUrl(url) : url || {};\n var proto = parsedUrl.protocol;\n var hostname = parsedUrl.host;\n var port = parsedUrl.port;\n if (typeof hostname !== \"string\" || !hostname || typeof proto !== \"string\") {\n return \"\"; // Don't proxy URLs without a valid scheme or host.\n }\n proto = proto.split(\":\", 1)[0];\n // Stripping ports in this way instead of using parsedUrl.hostname to make\n // sure that the brackets around IPv6 addresses are kept.\n hostname = hostname.replace(/:\\d*$/, \"\");\n port = parseInt(port) || DEFAULT_PORTS[proto] || 0;\n if (!shouldProxy(hostname, port)) {\n return \"\"; // Don't proxy URLs that match NO_PROXY.\n }\n var proxy = getEnv(\"npm_config_\" + proto + \"_proxy\") || getEnv(proto + \"_proxy\") || getEnv(\"npm_config_proxy\") || getEnv(\"all_proxy\");\n if (proxy && proxy.indexOf(\"://\") === -1) {\n // Missing scheme in proxy, default to the requested URL's scheme.\n proxy = proto + \"://\" + proxy;\n }\n return proxy;\n}\n/**\n * Determines whether a given URL should be proxied.\n *\n * @param {string} hostname - The host name of the URL.\n * @param {number} port - The effective port of the URL.\n * @returns {boolean} Whether the given URL should be proxied.\n * @private\n */ function shouldProxy(hostname, port) {\n var NO_PROXY = (getEnv(\"npm_config_no_proxy\") || getEnv(\"no_proxy\")).toLowerCase();\n if (!NO_PROXY) {\n return true; // Always proxy if NO_PROXY is not set.\n }\n if (NO_PROXY === \"*\") {\n return false; // Never proxy if wildcard is set.\n }\n return NO_PROXY.split(/[,\\s]/).every(function(proxy) {\n if (!proxy) {\n return true; // Skip zero-length hosts.\n }\n var parsedProxy = proxy.match(/^(.+):(\\d+)$/);\n var parsedProxyHostname = parsedProxy ? parsedProxy[1] : proxy;\n var parsedProxyPort = parsedProxy ? parseInt(parsedProxy[2]) : 0;\n if (parsedProxyPort && parsedProxyPort !== port) {\n return true; // Skip if ports don't match.\n }\n if (!/^[.*]/.test(parsedProxyHostname)) {\n // No wildcards, so stop proxying if there is an exact match.\n return hostname !== parsedProxyHostname;\n }\n if (parsedProxyHostname.charAt(0) === \"*\") {\n // Remove leading wildcard.\n parsedProxyHostname = parsedProxyHostname.slice(1);\n }\n // Stop proxying if the hostname ends with the no_proxy host.\n return !stringEndsWith.call(hostname, parsedProxyHostname);\n });\n}\n/**\n * Get the value for an environment variable.\n *\n * @param {string} key - The name of the environment variable.\n * @return {string} The value of the environment variable.\n * @private\n */ function getEnv(key) {\n return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || \"\";\n}\nexports.getProxyForUrl = getProxyForUrl;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiKHNzcikvLi9ub2RlX21vZHVsZXMvcHJveHktZnJvbS1lbnYvaW5kZXguanMiLCJtYXBwaW5ncyI6IkFBQUE7QUFFQSxJQUFJQSxXQUFXQyw2Q0FBb0I7QUFFbkMsSUFBSUUsZ0JBQWdCO0lBQ2xCQyxLQUFLO0lBQ0xDLFFBQVE7SUFDUkMsTUFBTTtJQUNOQyxPQUFPO0lBQ1BDLElBQUk7SUFDSkMsS0FBSztBQUNQO0FBRUEsSUFBSUMsaUJBQWlCQyxPQUFPQyxTQUFTLENBQUNDLFFBQVEsSUFBSSxTQUFTQyxDQUFDO0lBQzFELE9BQU9BLEVBQUVDLE1BQU0sSUFBSS
/***/ })
};
;