perf!: reduce package size by replacing undici with Node.js built-in proxy support - #436
Merged
Conversation
…proxy support From 844 Kb to 253 Kb. `proxiedFetch` now uses `node:https` with the built-in `proxyEnv` agent option instead of `undici`'s `ProxyAgent`, so `undici` and `proxy-from-env` are no longer bundled. `HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY` keep working as before. BREAKING CHANGE: Node.js >= 24.5.0 is required (previously >= 20.11.0), as the `proxyEnv` agent option was introduced in Node.js 24.5.0.
Octokit now uses the global `fetch` directly, proxy support comes from `http.setGlobalProxyFromEnv(process.env)` at startup, so the custom `proxiedFetch` with its redirect handling is no longer needed. The proxy tests keep the same four scenarios (`http_proxy` set/unset, matching/mismatching `no_proxy`) but now exercise `setGlobalProxyFromEnv` with `fetch`. The test proxy runs in a child process because a global proxy would otherwise route the in-process proxy's own forwarding back through itself. BREAKING CHANGE: Node.js >= 24.14.0 is required (previously >= 24.5.0), as `http.setGlobalProxyFromEnv()` was introduced in Node.js 24.14.0 and 25.4.0.
|
🎉 This PR is included in version 7.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From 671 Kb to 252 Kb.
Octokit now uses the global
fetchdirectly, proxy support comes fromhttp.setGlobalProxyFromEnv(process.env)at startup, soundiciandproxy-from-envare no longer bundled and the customproxiedFetchisremoved.
HTTP_PROXY,HTTPS_PROXYandNO_PROXYkeep working as before.Also:
BREAKING CHANGE: Node.js >= 24.14.0 is required (previously >= 20.11.0), as
http.setGlobalProxyFromEnv()was introduced in Node.js 24.14.0 and 25.4.0.