diff options
author | RaindropsSys <raindrops@equestria.dev> | 2023-10-24 17:43:37 +0200 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2023-10-24 17:43:37 +0200 |
commit | ae187b6d75c8079da0be1dc288613bad8466fe61 (patch) | |
tree | 5ea0d34185a2270f29ffaa65e1f5258028d7d5d0 /desktop/node_modules/global-agent/dist/utilities | |
download | mist-ae187b6d75c8079da0be1dc288613bad8466fe61.tar.gz mist-ae187b6d75c8079da0be1dc288613bad8466fe61.tar.bz2 mist-ae187b6d75c8079da0be1dc288613bad8466fe61.zip |
Initial commit
Diffstat (limited to 'desktop/node_modules/global-agent/dist/utilities')
12 files changed, 315 insertions, 0 deletions
diff --git a/desktop/node_modules/global-agent/dist/utilities/bindHttpMethod.js b/desktop/node_modules/global-agent/dist/utilities/bindHttpMethod.js new file mode 100644 index 0000000..4ce571a --- /dev/null +++ b/desktop/node_modules/global-agent/dist/utilities/bindHttpMethod.js @@ -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
\ No newline at end of file diff --git a/desktop/node_modules/global-agent/dist/utilities/bindHttpMethod.js.flow b/desktop/node_modules/global-agent/dist/utilities/bindHttpMethod.js.flow new file mode 100644 index 0000000..f8859b5 --- /dev/null +++ b/desktop/node_modules/global-agent/dist/utilities/bindHttpMethod.js.flow @@ -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); + } + }; +}; diff --git a/desktop/node_modules/global-agent/dist/utilities/bindHttpMethod.js.map b/desktop/node_modules/global-agent/dist/utilities/bindHttpMethod.js.map new file mode 100644 index 0000000..0d49171 --- /dev/null +++ b/desktop/node_modules/global-agent/dist/utilities/bindHttpMethod.js.map @@ -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"}
\ No newline at end of file diff --git a/desktop/node_modules/global-agent/dist/utilities/index.js b/desktop/node_modules/global-agent/dist/utilities/index.js new file mode 100644 index 0000000..5b9ff43 --- /dev/null +++ b/desktop/node_modules/global-agent/dist/utilities/index.js @@ -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
\ No newline at end of file diff --git a/desktop/node_modules/global-agent/dist/utilities/index.js.flow b/desktop/node_modules/global-agent/dist/utilities/index.js.flow new file mode 100644 index 0000000..3412387 --- /dev/null +++ b/desktop/node_modules/global-agent/dist/utilities/index.js.flow @@ -0,0 +1,5 @@ +// @flow + +export {default as bindHttpMethod} from './bindHttpMethod'; +export {default as isUrlMatchingNoProxy} from './isUrlMatchingNoProxy'; +export {default as parseProxyUrl} from './parseProxyUrl'; diff --git a/desktop/node_modules/global-agent/dist/utilities/index.js.map b/desktop/node_modules/global-agent/dist/utilities/index.js.map new file mode 100644 index 0000000..6861a5a --- /dev/null +++ b/desktop/node_modules/global-agent/dist/utilities/index.js.map @@ -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"}
\ No newline at end of file diff --git a/desktop/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js b/desktop/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js new file mode 100644 index 0000000..92a3436 --- /dev/null +++ b/desktop/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js @@ -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
\ No newline at end of file diff --git a/desktop/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js.flow b/desktop/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js.flow new file mode 100644 index 0000000..f2de584 --- /dev/null +++ b/desktop/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js.flow @@ -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; +}; diff --git a/desktop/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js.map b/desktop/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js.map new file mode 100644 index 0000000..9f60970 --- /dev/null +++ b/desktop/node_modules/global-agent/dist/utilities/isUrlMatchingNoProxy.js.map @@ -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,QAAd,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"}
\ No newline at end of file diff --git a/desktop/node_modules/global-agent/dist/utilities/parseProxyUrl.js b/desktop/node_modules/global-agent/dist/utilities/parseProxyUrl.js new file mode 100644 index 0000000..e4f1185 --- /dev/null +++ b/desktop/node_modules/global-agent/dist/utilities/parseProxyUrl.js @@ -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
\ No newline at end of file diff --git a/desktop/node_modules/global-agent/dist/utilities/parseProxyUrl.js.flow b/desktop/node_modules/global-agent/dist/utilities/parseProxyUrl.js.flow new file mode 100644 index 0000000..e2e9a6b --- /dev/null +++ b/desktop/node_modules/global-agent/dist/utilities/parseProxyUrl.js.flow @@ -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, + }; +}; diff --git a/desktop/node_modules/global-agent/dist/utilities/parseProxyUrl.js.map b/desktop/node_modules/global-agent/dist/utilities/parseProxyUrl.js.map new file mode 100644 index 0000000..4457f10 --- /dev/null +++ b/desktop/node_modules/global-agent/dist/utilities/parseProxyUrl.js.map @@ -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"}
\ No newline at end of file |