stuff
This commit is contained in:
62
buildfiles/node_modules/global-agent/dist/utilities/bindHttpMethod.js
generated
vendored
Normal file
62
buildfiles/node_modules/global-agent/dist/utilities/bindHttpMethod.js
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _http = _interopRequireDefault(require("http"));
|
||||
|
||||
var _https = _interopRequireDefault(require("https"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// eslint-disable-next-line flowtype/no-weak-types
|
||||
const bindHttpMethod = (originalMethod, agent, forceGlobalAgent) => {
|
||||
// eslint-disable-next-line unicorn/prevent-abbreviations
|
||||
return (...args) => {
|
||||
let url;
|
||||
let options;
|
||||
let callback;
|
||||
|
||||
if (typeof args[0] === 'string' || args[0] instanceof URL) {
|
||||
url = args[0];
|
||||
|
||||
if (typeof args[1] === 'function') {
|
||||
options = {};
|
||||
callback = args[1];
|
||||
} else {
|
||||
options = { ...args[1]
|
||||
};
|
||||
callback = args[2];
|
||||
}
|
||||
} else {
|
||||
options = { ...args[0]
|
||||
};
|
||||
callback = args[1];
|
||||
}
|
||||
|
||||
if (forceGlobalAgent) {
|
||||
options.agent = agent;
|
||||
} else {
|
||||
if (!options.agent) {
|
||||
options.agent = agent;
|
||||
}
|
||||
|
||||
if (options.agent === _http.default.globalAgent || options.agent === _https.default.globalAgent) {
|
||||
options.agent = agent;
|
||||
}
|
||||
}
|
||||
|
||||
if (url) {
|
||||
// $FlowFixMe
|
||||
return originalMethod(url, options, callback);
|
||||
} else {
|
||||
return originalMethod(options, callback);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var _default = bindHttpMethod;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=bindHttpMethod.js.map
|
54
buildfiles/node_modules/global-agent/dist/utilities/bindHttpMethod.js.flow
generated
vendored
Normal file
54
buildfiles/node_modules/global-agent/dist/utilities/bindHttpMethod.js.flow
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
// @flow
|
||||
|
||||
import http from 'http';
|
||||
import https from 'https';
|
||||
|
||||
type AgentType = http.Agent | https.Agent;
|
||||
|
||||
// eslint-disable-next-line flowtype/no-weak-types
|
||||
export default (originalMethod: Function, agent: AgentType, forceGlobalAgent: boolean) => {
|
||||
// eslint-disable-next-line unicorn/prevent-abbreviations
|
||||
return (...args: *) => {
|
||||
let url;
|
||||
let options;
|
||||
let callback;
|
||||
|
||||
if (typeof args[0] === 'string' || args[0] instanceof URL) {
|
||||
url = args[0];
|
||||
|
||||
if (typeof args[1] === 'function') {
|
||||
options = {};
|
||||
callback = args[1];
|
||||
} else {
|
||||
options = {
|
||||
...args[1],
|
||||
};
|
||||
callback = args[2];
|
||||
}
|
||||
} else {
|
||||
options = {
|
||||
...args[0],
|
||||
};
|
||||
callback = args[1];
|
||||
}
|
||||
|
||||
if (forceGlobalAgent) {
|
||||
options.agent = agent;
|
||||
} else {
|
||||
if (!options.agent) {
|
||||
options.agent = agent;
|
||||
}
|
||||
|
||||
if (options.agent === http.globalAgent || options.agent === https.globalAgent) {
|
||||
options.agent = agent;
|
||||
}
|
||||
}
|
||||
|
||||
if (url) {
|
||||
// $FlowFixMe
|
||||
return originalMethod(url, options, callback);
|
||||
} else {
|
||||
return originalMethod(options, callback);
|
||||
}
|
||||
};
|
||||
};
|
1
buildfiles/node_modules/global-agent/dist/utilities/bindHttpMethod.js.map
generated
vendored
Normal file
1
buildfiles/node_modules/global-agent/dist/utilities/bindHttpMethod.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/utilities/bindHttpMethod.js"],"names":["originalMethod","agent","forceGlobalAgent","args","url","options","callback","URL","http","globalAgent","https"],"mappings":";;;;;;;AAEA;;AACA;;;;AAIA;wBACgBA,c,EAA0BC,K,EAAkBC,gB,KAA8B;AACxF;AACA,SAAO,CAAC,GAAGC,IAAJ,KAAgB;AACrB,QAAIC,GAAJ;AACA,QAAIC,OAAJ;AACA,QAAIC,QAAJ;;AAEA,QAAI,OAAOH,IAAI,CAAC,CAAD,CAAX,KAAmB,QAAnB,IAA+BA,IAAI,CAAC,CAAD,CAAJ,YAAmBI,GAAtD,EAA2D;AACzDH,MAAAA,GAAG,GAAGD,IAAI,CAAC,CAAD,CAAV;;AAEA,UAAI,OAAOA,IAAI,CAAC,CAAD,CAAX,KAAmB,UAAvB,EAAmC;AACjCE,QAAAA,OAAO,GAAG,EAAV;AACAC,QAAAA,QAAQ,GAAGH,IAAI,CAAC,CAAD,CAAf;AACD,OAHD,MAGO;AACLE,QAAAA,OAAO,GAAG,EACR,GAAGF,IAAI,CAAC,CAAD;AADC,SAAV;AAGAG,QAAAA,QAAQ,GAAGH,IAAI,CAAC,CAAD,CAAf;AACD;AACF,KAZD,MAYO;AACLE,MAAAA,OAAO,GAAG,EACR,GAAGF,IAAI,CAAC,CAAD;AADC,OAAV;AAGAG,MAAAA,QAAQ,GAAGH,IAAI,CAAC,CAAD,CAAf;AACD;;AAED,QAAID,gBAAJ,EAAsB;AACpBG,MAAAA,OAAO,CAACJ,KAAR,GAAgBA,KAAhB;AACD,KAFD,MAEO;AACL,UAAI,CAACI,OAAO,CAACJ,KAAb,EAAoB;AAClBI,QAAAA,OAAO,CAACJ,KAAR,GAAgBA,KAAhB;AACD;;AAED,UAAII,OAAO,CAACJ,KAAR,KAAkBO,cAAKC,WAAvB,IAAsCJ,OAAO,CAACJ,KAAR,KAAkBS,eAAMD,WAAlE,EAA+E;AAC7EJ,QAAAA,OAAO,CAACJ,KAAR,GAAgBA,KAAhB;AACD;AACF;;AAED,QAAIG,GAAJ,EAAS;AACP;AACA,aAAOJ,cAAc,CAACI,GAAD,EAAMC,OAAN,EAAeC,QAAf,CAArB;AACD,KAHD,MAGO;AACL,aAAON,cAAc,CAACK,OAAD,EAAUC,QAAV,CAArB;AACD;AACF,GA1CD;AA2CD,C","sourcesContent":["// @flow\n\nimport http from 'http';\nimport https from 'https';\n\ntype AgentType = http.Agent | https.Agent;\n\n// eslint-disable-next-line flowtype/no-weak-types\nexport default (originalMethod: Function, agent: AgentType, forceGlobalAgent: boolean) => {\n // eslint-disable-next-line unicorn/prevent-abbreviations\n return (...args: *) => {\n let url;\n let options;\n let callback;\n\n if (typeof args[0] === 'string' || args[0] instanceof URL) {\n url = args[0];\n\n if (typeof args[1] === 'function') {\n options = {};\n callback = args[1];\n } else {\n options = {\n ...args[1],\n };\n callback = args[2];\n }\n } else {\n options = {\n ...args[0],\n };\n callback = args[1];\n }\n\n if (forceGlobalAgent) {\n options.agent = agent;\n } else {\n if (!options.agent) {\n options.agent = agent;\n }\n\n if (options.agent === http.globalAgent || options.agent === https.globalAgent) {\n options.agent = agent;\n }\n }\n\n if (url) {\n // $FlowFixMe\n return originalMethod(url, options, callback);\n } else {\n return originalMethod(options, callback);\n }\n };\n};\n"],"file":"bindHttpMethod.js"}
|
32
buildfiles/node_modules/global-agent/dist/utilities/index.js
generated
vendored
Normal file
32
buildfiles/node_modules/global-agent/dist/utilities/index.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "bindHttpMethod", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _bindHttpMethod.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isUrlMatchingNoProxy", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _isUrlMatchingNoProxy.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "parseProxyUrl", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _parseProxyUrl.default;
|
||||
}
|
||||
});
|
||||
|
||||
var _bindHttpMethod = _interopRequireDefault(require("./bindHttpMethod"));
|
||||
|
||||
var _isUrlMatchingNoProxy = _interopRequireDefault(require("./isUrlMatchingNoProxy"));
|
||||
|
||||
var _parseProxyUrl = _interopRequireDefault(require("./parseProxyUrl"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
//# sourceMappingURL=index.js.map
|
5
buildfiles/node_modules/global-agent/dist/utilities/index.js.flow
generated
vendored
Normal file
5
buildfiles/node_modules/global-agent/dist/utilities/index.js.flow
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
// @flow
|
||||
|
||||
export {default as bindHttpMethod} from './bindHttpMethod';
|
||||
export {default as isUrlMatchingNoProxy} from './isUrlMatchingNoProxy';
|
||||
export {default as parseProxyUrl} from './parseProxyUrl';
|
1
buildfiles/node_modules/global-agent/dist/utilities/index.js.map
generated
vendored
Normal file
1
buildfiles/node_modules/global-agent/dist/utilities/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/utilities/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AACA;;AACA","sourcesContent":["// @flow\n\nexport {default as bindHttpMethod} from './bindHttpMethod';\nexport {default as isUrlMatchingNoProxy} from './isUrlMatchingNoProxy';\nexport {default as parseProxyUrl} from './parseProxyUrl';\n"],"file":"index.js"}
|
43
buildfiles/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js
generated
vendored
Normal file
43
buildfiles/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _url = require("url");
|
||||
|
||||
var _matcher = _interopRequireDefault(require("matcher"));
|
||||
|
||||
var _errors = require("../errors");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const isUrlMatchingNoProxy = (subjectUrl, noProxy) => {
|
||||
const subjectUrlTokens = (0, _url.parse)(subjectUrl);
|
||||
const rules = noProxy.split(/[\s,]/);
|
||||
|
||||
for (const rule of rules) {
|
||||
const ruleMatch = rule.replace(/^(?<leadingDot>\.)/, '*').match(/^(?<hostname>.+?)(?::(?<port>\d+))?$/);
|
||||
|
||||
if (!ruleMatch || !ruleMatch.groups) {
|
||||
throw new _errors.UnexpectedStateError('Invalid NO_PROXY pattern.');
|
||||
}
|
||||
|
||||
if (!ruleMatch.groups.hostname) {
|
||||
throw new _errors.UnexpectedStateError('NO_PROXY entry pattern must include hostname. Use * to match any hostname.');
|
||||
}
|
||||
|
||||
const hostnameIsMatch = _matcher.default.isMatch(subjectUrlTokens.hostname, ruleMatch.groups.hostname);
|
||||
|
||||
if (hostnameIsMatch && (!ruleMatch.groups || !ruleMatch.groups.port || subjectUrlTokens.port && subjectUrlTokens.port === ruleMatch.groups.port)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
var _default = isUrlMatchingNoProxy;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=isUrlMatchingNoProxy.js.map
|
37
buildfiles/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js.flow
generated
vendored
Normal file
37
buildfiles/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js.flow
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
// @flow
|
||||
|
||||
import {
|
||||
parse as parseUrl,
|
||||
} from 'url';
|
||||
import matcher from 'matcher';
|
||||
import {
|
||||
UnexpectedStateError,
|
||||
} from '../errors';
|
||||
|
||||
export default (subjectUrl: string, noProxy: string) => {
|
||||
const subjectUrlTokens = parseUrl(subjectUrl);
|
||||
|
||||
const rules = noProxy.split(/[\s,]/);
|
||||
|
||||
for (const rule of rules) {
|
||||
const ruleMatch = rule
|
||||
.replace(/^(?<leadingDot>\.)/, '*')
|
||||
.match(/^(?<hostname>.+?)(?::(?<port>\d+))?$/);
|
||||
|
||||
if (!ruleMatch || !ruleMatch.groups) {
|
||||
throw new UnexpectedStateError('Invalid NO_PROXY pattern.');
|
||||
}
|
||||
|
||||
if (!ruleMatch.groups.hostname) {
|
||||
throw new UnexpectedStateError('NO_PROXY entry pattern must include hostname. Use * to match any hostname.');
|
||||
}
|
||||
|
||||
const hostnameIsMatch = matcher.isMatch(subjectUrlTokens.hostname, ruleMatch.groups.hostname);
|
||||
|
||||
if (hostnameIsMatch && (!ruleMatch.groups || !ruleMatch.groups.port || subjectUrlTokens.port && subjectUrlTokens.port === ruleMatch.groups.port)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
1
buildfiles/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js.map
generated
vendored
Normal file
1
buildfiles/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/utilities/isUrlMatchingNoProxy.js"],"names":["subjectUrl","noProxy","subjectUrlTokens","rules","split","rule","ruleMatch","replace","match","groups","UnexpectedStateError","hostname","hostnameIsMatch","matcher","isMatch","port"],"mappings":";;;;;;;AAEA;;AAGA;;AACA;;;;8BAIgBA,U,EAAoBC,O,KAAoB;AACtD,QAAMC,gBAAgB,GAAG,gBAASF,UAAT,CAAzB;AAEA,QAAMG,KAAK,GAAGF,OAAO,CAACG,KAAR,CAAc,OAAd,CAAd;;AAEA,OAAK,MAAMC,IAAX,IAAmBF,KAAnB,EAA0B;AACxB,UAAMG,SAAS,GAAGD,IAAI,CACnBE,OADe,CACP,oBADO,EACe,GADf,EAEfC,KAFe,CAET,sCAFS,CAAlB;;AAIA,QAAI,CAACF,SAAD,IAAc,CAACA,SAAS,CAACG,MAA7B,EAAqC;AACnC,YAAM,IAAIC,4BAAJ,CAAyB,2BAAzB,CAAN;AACD;;AAED,QAAI,CAACJ,SAAS,CAACG,MAAV,CAAiBE,QAAtB,EAAgC;AAC9B,YAAM,IAAID,4BAAJ,CAAyB,4EAAzB,CAAN;AACD;;AAED,UAAME,eAAe,GAAGC,iBAAQC,OAAR,CAAgBZ,gBAAgB,CAACS,QAAjC,EAA2CL,SAAS,CAACG,MAAV,CAAiBE,QAA5D,CAAxB;;AAEA,QAAIC,eAAe,KAAK,CAACN,SAAS,CAACG,MAAX,IAAqB,CAACH,SAAS,CAACG,MAAV,CAAiBM,IAAvC,IAA+Cb,gBAAgB,CAACa,IAAjB,IAAyBb,gBAAgB,CAACa,IAAjB,KAA0BT,SAAS,CAACG,MAAV,CAAiBM,IAAxH,CAAnB,EAAkJ;AAChJ,aAAO,IAAP;AACD;AACF;;AAED,SAAO,KAAP;AACD,C","sourcesContent":["// @flow\n\nimport {\n parse as parseUrl,\n} from 'url';\nimport matcher from 'matcher';\nimport {\n UnexpectedStateError,\n} from '../errors';\n\nexport default (subjectUrl: string, noProxy: string) => {\n const subjectUrlTokens = parseUrl(subjectUrl);\n\n const rules = noProxy.split(/[\\s,]/);\n\n for (const rule of rules) {\n const ruleMatch = rule\n .replace(/^(?<leadingDot>\\.)/, '*')\n .match(/^(?<hostname>.+?)(?::(?<port>\\d+))?$/);\n\n if (!ruleMatch || !ruleMatch.groups) {\n throw new UnexpectedStateError('Invalid NO_PROXY pattern.');\n }\n\n if (!ruleMatch.groups.hostname) {\n throw new UnexpectedStateError('NO_PROXY entry pattern must include hostname. Use * to match any hostname.');\n }\n\n const hostnameIsMatch = matcher.isMatch(subjectUrlTokens.hostname, ruleMatch.groups.hostname);\n\n if (hostnameIsMatch && (!ruleMatch.groups || !ruleMatch.groups.port || subjectUrlTokens.port && subjectUrlTokens.port === ruleMatch.groups.port)) {\n return true;\n }\n }\n\n return false;\n};\n"],"file":"isUrlMatchingNoProxy.js"}
|
42
buildfiles/node_modules/global-agent/dist/utilities/parseProxyUrl.js
generated
vendored
Normal file
42
buildfiles/node_modules/global-agent/dist/utilities/parseProxyUrl.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _url = require("url");
|
||||
|
||||
var _errors = require("../errors");
|
||||
|
||||
const parseProxyUrl = url => {
|
||||
const urlTokens = (0, _url.parse)(url);
|
||||
|
||||
if (urlTokens.query !== null) {
|
||||
throw new _errors.UnexpectedStateError('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL must not have query.');
|
||||
}
|
||||
|
||||
if (urlTokens.hash !== null) {
|
||||
throw new _errors.UnexpectedStateError('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL must not have hash.');
|
||||
}
|
||||
|
||||
if (urlTokens.protocol !== 'http:') {
|
||||
throw new _errors.UnexpectedStateError('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL protocol must be "http:".');
|
||||
}
|
||||
|
||||
let port = 80;
|
||||
|
||||
if (urlTokens.port) {
|
||||
port = Number.parseInt(urlTokens.port, 10);
|
||||
}
|
||||
|
||||
return {
|
||||
authorization: urlTokens.auth || null,
|
||||
hostname: urlTokens.hostname,
|
||||
port
|
||||
};
|
||||
};
|
||||
|
||||
var _default = parseProxyUrl;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=parseProxyUrl.js.map
|
36
buildfiles/node_modules/global-agent/dist/utilities/parseProxyUrl.js.flow
generated
vendored
Normal file
36
buildfiles/node_modules/global-agent/dist/utilities/parseProxyUrl.js.flow
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
// @flow
|
||||
|
||||
import {
|
||||
parse as parseUrl,
|
||||
} from 'url';
|
||||
import {
|
||||
UnexpectedStateError,
|
||||
} from '../errors';
|
||||
|
||||
export default (url: string) => {
|
||||
const urlTokens = parseUrl(url);
|
||||
|
||||
if (urlTokens.query !== null) {
|
||||
throw new UnexpectedStateError('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL must not have query.');
|
||||
}
|
||||
|
||||
if (urlTokens.hash !== null) {
|
||||
throw new UnexpectedStateError('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL must not have hash.');
|
||||
}
|
||||
|
||||
if (urlTokens.protocol !== 'http:') {
|
||||
throw new UnexpectedStateError('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL protocol must be "http:".');
|
||||
}
|
||||
|
||||
let port = 80;
|
||||
|
||||
if (urlTokens.port) {
|
||||
port = Number.parseInt(urlTokens.port, 10);
|
||||
}
|
||||
|
||||
return {
|
||||
authorization: urlTokens.auth || null,
|
||||
hostname: urlTokens.hostname,
|
||||
port,
|
||||
};
|
||||
};
|
1
buildfiles/node_modules/global-agent/dist/utilities/parseProxyUrl.js.map
generated
vendored
Normal file
1
buildfiles/node_modules/global-agent/dist/utilities/parseProxyUrl.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/utilities/parseProxyUrl.js"],"names":["url","urlTokens","query","UnexpectedStateError","hash","protocol","port","Number","parseInt","authorization","auth","hostname"],"mappings":";;;;;;;AAEA;;AAGA;;sBAIgBA,G,IAAgB;AAC9B,QAAMC,SAAS,GAAG,gBAASD,GAAT,CAAlB;;AAEA,MAAIC,SAAS,CAACC,KAAV,KAAoB,IAAxB,EAA8B;AAC5B,UAAM,IAAIC,4BAAJ,CAAyB,qFAAzB,CAAN;AACD;;AAED,MAAIF,SAAS,CAACG,IAAV,KAAmB,IAAvB,EAA6B;AAC3B,UAAM,IAAID,4BAAJ,CAAyB,oFAAzB,CAAN;AACD;;AAED,MAAIF,SAAS,CAACI,QAAV,KAAuB,OAA3B,EAAoC;AAClC,UAAM,IAAIF,4BAAJ,CAAyB,0FAAzB,CAAN;AACD;;AAED,MAAIG,IAAI,GAAG,EAAX;;AAEA,MAAIL,SAAS,CAACK,IAAd,EAAoB;AAClBA,IAAAA,IAAI,GAAGC,MAAM,CAACC,QAAP,CAAgBP,SAAS,CAACK,IAA1B,EAAgC,EAAhC,CAAP;AACD;;AAED,SAAO;AACLG,IAAAA,aAAa,EAAER,SAAS,CAACS,IAAV,IAAkB,IAD5B;AAELC,IAAAA,QAAQ,EAAEV,SAAS,CAACU,QAFf;AAGLL,IAAAA;AAHK,GAAP;AAKD,C","sourcesContent":["// @flow\n\nimport {\n parse as parseUrl,\n} from 'url';\nimport {\n UnexpectedStateError,\n} from '../errors';\n\nexport default (url: string) => {\n const urlTokens = parseUrl(url);\n\n if (urlTokens.query !== null) {\n throw new UnexpectedStateError('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL must not have query.');\n }\n\n if (urlTokens.hash !== null) {\n throw new UnexpectedStateError('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL must not have hash.');\n }\n\n if (urlTokens.protocol !== 'http:') {\n throw new UnexpectedStateError('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL protocol must be \"http:\".');\n }\n\n let port = 80;\n\n if (urlTokens.port) {\n port = Number.parseInt(urlTokens.port, 10);\n }\n\n return {\n authorization: urlTokens.auth || null,\n hostname: urlTokens.hostname,\n port,\n };\n};\n"],"file":"parseProxyUrl.js"}
|
Reference in New Issue
Block a user