From 66057ae3f6b4bac91d89717eb4f016b2cd7d3e59 Mon Sep 17 00:00:00 2001 From: yoshi-taka Date: Sat, 8 Nov 2025 16:50:42 +0900 Subject: [PATCH] chore(deps): upgrade http(s)-proxy-agent --- package.json | 4 ++-- source/api/_tests/fetch.test.ts | 8 ++++---- source/api/fetch.ts | 6 +++--- .../bitbucket_cloud/BitBucketCloudAPI.ts | 4 ++-- .../bitbucket_server/BitBucketServerAPI.ts | 4 ++-- yarn.lock | 20 +++---------------- 6 files changed, 16 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index 12802676b..0faf1b61f 100644 --- a/package.json +++ b/package.json @@ -152,8 +152,8 @@ "core-js": "^3.8.2", "debug": "^4.1.1", "fast-json-patch": "^3.0.0-1", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.1", + "http-proxy-agent": "^7.0.2", + "https-proxy-agent": "^7.0.2", "hyperlinker": "^1.0.0", "ini": "^5.0.0", "json5": "^2.2.3", diff --git a/source/api/_tests/fetch.test.ts b/source/api/_tests/fetch.test.ts index 2cda92580..5a6fa8294 100644 --- a/source/api/_tests/fetch.test.ts +++ b/source/api/_tests/fetch.test.ts @@ -133,7 +133,7 @@ describe("fetch", () => { let options: node_fetch.RequestInit = { agent: undefined } await api(url, options, true, { HTTPS_PROXY: proxyUrl }) - let agent = options.agent as HttpsProxyAgent + let agent = options.agent as HttpsProxyAgent expect(agent["proxy"].href).toBe(proxyUrl) }) @@ -145,7 +145,7 @@ describe("fetch", () => { let options: node_fetch.RequestInit = { agent: undefined } await api(url, options, true, { https_proxy: proxyUrl }) - let agent = options.agent as HttpsProxyAgent + let agent = options.agent as HttpsProxyAgent expect(agent["proxy"].href).toBe(proxyUrl) }) @@ -157,7 +157,7 @@ describe("fetch", () => { let options: node_fetch.RequestInit = { agent: undefined } await api(url, options, true, { HTTP_PROXY: proxyUrl }) - let agent = options.agent as HttpProxyAgent + let agent = options.agent as HttpProxyAgent expect(agent["proxy"].href).toBe(proxyUrl) }) @@ -169,7 +169,7 @@ describe("fetch", () => { let options: node_fetch.RequestInit = { agent: undefined } await api(url, options, true, { http_proxy: proxyUrl }) - let agent = options.agent as HttpProxyAgent + let agent = options.agent as HttpProxyAgent expect(agent["proxy"].href).toBe(proxyUrl) }) }) diff --git a/source/api/fetch.ts b/source/api/fetch.ts index de393d89c..7913d85d6 100644 --- a/source/api/fetch.ts +++ b/source/api/fetch.ts @@ -1,8 +1,8 @@ import { debug } from "../debug" import * as node_fetch from "node-fetch" -import HttpProxyAgent from "http-proxy-agent" -import HttpsProxyAgent from "https-proxy-agent" +import { HttpProxyAgent } from "http-proxy-agent" +import { HttpsProxyAgent } from "https-proxy-agent" import AsyncRetry from "async-retry" @@ -113,7 +113,7 @@ export function api( if (!agent && proxy) { let secure = url.toString().startsWith("https") - init.agent = secure ? HttpsProxyAgent(proxy) : HttpProxyAgent(proxy) + init.agent = secure ? new HttpsProxyAgent(proxy) : new HttpProxyAgent(proxy) } return retryableFetch(url, init).then(async (response: node_fetch.Response) => { diff --git a/source/platforms/bitbucket_cloud/BitBucketCloudAPI.ts b/source/platforms/bitbucket_cloud/BitBucketCloudAPI.ts index 41c2fdeba..648dea442 100644 --- a/source/platforms/bitbucket_cloud/BitBucketCloudAPI.ts +++ b/source/platforms/bitbucket_cloud/BitBucketCloudAPI.ts @@ -1,7 +1,7 @@ import { debug } from "../../debug" import * as node_fetch from "node-fetch" import { Agent } from "http" -import HttpsProxyAgent from "https-proxy-agent" +import { HttpsProxyAgent } from "https-proxy-agent" import { URLSearchParams } from "url" import { Env } from "../../ci_source/ci_source" @@ -391,7 +391,7 @@ export class BitBucketCloudAPI implements BitBucketCloudAPIDSL { let agent: Agent | undefined = undefined let proxy = process.env.http_proxy || process.env.https_proxy if (proxy) { - agent = HttpsProxyAgent(proxy) + agent = new HttpsProxyAgent(proxy) } return this.fetch( diff --git a/source/platforms/bitbucket_server/BitBucketServerAPI.ts b/source/platforms/bitbucket_server/BitBucketServerAPI.ts index 42d57b61d..948e23874 100644 --- a/source/platforms/bitbucket_server/BitBucketServerAPI.ts +++ b/source/platforms/bitbucket_server/BitBucketServerAPI.ts @@ -1,7 +1,7 @@ import { debug } from "../../debug" import * as node_fetch from "node-fetch" import { Agent } from "http" -import HttpsProxyAgent from "https-proxy-agent" +import { HttpsProxyAgent } from "https-proxy-agent" import { BitBucketServerPRDSL, @@ -354,7 +354,7 @@ export class BitBucketServerAPI implements BitBucketServerAPIDSL { let agent: Agent | undefined = undefined let proxy = process.env.http_proxy || process.env.https_proxy if (proxy) { - agent = HttpsProxyAgent(proxy) + agent = new HttpsProxyAgent(proxy) } return this.fetch( diff --git a/yarn.lock b/yarn.lock index b6366c999..b7385f826 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1677,11 +1677,6 @@ dependencies: "@sinonjs/commons" "^1.7.0" -"@tootallnate/once@2": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" - integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== - "@tootallnate/quickjs-emscripten@^0.23.0": version "0.23.0" resolved "https://registry.yarnpkg.com/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz#db4ecfd499a9765ab24002c3b696d02e6d32a12c" @@ -4066,16 +4061,7 @@ html-escaper@^2.0.0: resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== -http-proxy-agent@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz#5129800203520d434f142bc78ff3c170800f2b43" - integrity sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w== - dependencies: - "@tootallnate/once" "2" - agent-base "6" - debug "4" - -http-proxy-agent@^7.0.0, http-proxy-agent@^7.0.1: +http-proxy-agent@^7.0.0, http-proxy-agent@^7.0.1, http-proxy-agent@^7.0.2: version "7.0.2" resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz#9a8b1f246866c028509486585f62b8f2c18c270e" integrity sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig== @@ -4083,7 +4069,7 @@ http-proxy-agent@^7.0.0, http-proxy-agent@^7.0.1: agent-base "^7.1.0" debug "^4.3.4" -https-proxy-agent@^5.0.0, https-proxy-agent@^5.0.1: +https-proxy-agent@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== @@ -4091,7 +4077,7 @@ https-proxy-agent@^5.0.0, https-proxy-agent@^5.0.1: agent-base "6" debug "4" -https-proxy-agent@^7.0.6: +https-proxy-agent@^7.0.2, https-proxy-agent@^7.0.6: version "7.0.6" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz#da8dfeac7da130b05c2ba4b59c9b6cd66611a6b9" integrity sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==