Migrate hpagent to https-proxy-agent
ProprietaryReplaces the unmaintained hpagent package with https-proxy-agent. Both of hpagent's agent classes tunnel through the proxy with CONNECT, which is what https-proxy-agent does, upgrading the tunnel to TLS only for an https: target — so HttpProxyAgent and HttpsProxyAgent both become https-proxy-agent's HttpsProxyAgent. The proxy URL moves from the proxy option to the constructor's first argument, proxyRequestOptions members move up into the options object, and the dependency is swapped in each package.json that declares it, with the lock file updated to match.
Two things do not carry over, and both are reported in the HpagentManualMigrationSteps data table rather than rewritten. A TLS option set at the top level of hpagent's HttpsProxyAgent (ca, rejectUnauthorized, cert, ...) configured the handshake with the destination, because that class extends https.Agent; https-proxy-agent spends its constructor options on the connection to the proxy and takes the destination's TLS options from each request, so such an option has to move to the request or the client library. Agent options that aren't written as an object literal can't be split into the new two-argument form either. The dependency is swapped regardless, so migrate every reported site before building.
org. openrewrite. node. migrate. hpagent. migrate-hpagent-to-https-proxy-agentOptional
The version range to declare for https-proxy-agent. The default keeps hpagent's Node 14 floor; https-proxy-agent 9 and later require Node 20.
Also migrate options that spread another object, as in {...shared, proxy: url}. Off by default, since the spread may carry a proxyRequestOptions or a destination TLS option that has to move rather than be passed through.
mod run . --recipe= org. openrewrite. node. migrate. hpagent. migrate-hpagent-to-https-proxy-agentInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.
Recipe list
It runs these recipes, in this order.