Modernizes extension: native fetch, ESM, and dependency cleanup#4997
Modernizes extension: native fetch, ESM, and dependency cleanup#4997
Conversation
- Switches out deprecated method
- Replaces `https-proxy-agent` with VS Codes built-in proxy support - Removes the custom `gitlens.proxy` configuration in favor of standard VS Code and OS proxy settings
- Replaces the external iconv-lite library with a delegated decoding mechanism using the workspace's native decoding capabilities
🤖 Augment PR SummarySummary: Modernizes the GitLens extension runtime by moving the Node build to ESM, adopting native Changes:
Technical Notes: Node-side SSL-ignore behavior is now implemented by temporarily toggling 🤖 Was this summary useful? React with 👍 or 👎 |
| const alias = { | ||
| '@env': path.resolve(__dirname, 'src', 'env', target === 'webworker' ? 'browser' : target), | ||
| // Stupid dependency that is used by `http[s]-proxy-agent` | ||
| // Stupid dependency that is used by `http[s]-proxy-agent` (via @gitkraken/provider-apis) |
There was a problem hiding this comment.
esbuild.mjs still aliases debug/tr46/whatwg-url to files under patches/, but those patch files are removed in this PR, so this script will fail to resolve them if it’s used. Consider either keeping the patch shims or removing/updating these aliases consistently.
Severity: medium
Other Locations
scripts/esbuild.tests.mjs:43
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| process.env.NODE_TLS_REJECT_UNAUTHORIZED = previousRejectUnauthorized; | ||
| _forceInsecureSSL--; | ||
| if (_forceInsecureSSL === 0) { | ||
| globalThis.process.env.NODE_TLS_REJECT_UNAUTHORIZED = '1'; |
There was a problem hiding this comment.
wrapForForcedInsecureSSL toggles NODE_TLS_REJECT_UNAUTHORIZED globally for both ignoreSSLErrors === true and 'force', and then forces it back to '1' rather than restoring the prior value. This can leak TLS-verification state outside the wrapped request if it was previously unset or intentionally '0'.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| const encodingExists = (await import(/* webpackChunkName: "lib-encoding" */ 'iconv-lite')).encodingExists; | ||
| return encodingExists(encoding) ? encoding : 'utf8'; | ||
| function getEncoding(uri: Uri): string { | ||
| return configuration.getCore('files.encoding', uri) ?? 'utf8'; |
There was a problem hiding this comment.
getEncoding() now returns whatever files.encoding is set to without checking it’s a supported encoding; downstream workspace.decode(..., { encoding }) may throw for invalid values. Previously this fell back to 'utf8', so it may be worth keeping a guard to avoid breaking git operations on misconfigured settings.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| constructor(public readonly gitUri: GitUri) { | ||
| this.uri = gitUri.documentUri; | ||
|
|
||
| this.encoding = 'utf-8'; |
There was a problem hiding this comment.
EmptyTextDocument sets encoding = 'utf-8', but other code paths treat 'utf8' as the canonical value (and VS Code’s setting value is typically 'utf8'). If callers compare encodings or feed this into decoding logic, the hyphenated form could be treated as non-standard unexpectedly.
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
|
| Metric | Value |
|---|---|
| Status | All commits were dropped during rebase |
| Target | main |
| Source | debt/fetch |
What happened? Git determined that all commits in this PR are already included in the target branch (e.g. due to rename detection). The push was skipped to prevent GitHub from auto-closing this PR.
Generated by Merge Mate at 2026-03-09 17:05:52 UTC
|
Converted to draft as this is not ready yet. |
Closes #4994
Summary
node-fetchto nativefetch, replacinghttps-proxy-agentwith VS Code's built-in proxy support and removing the customgitlens.proxyconfigurationdebug.js,tr46.js,whatwg-url.js)iconv-litedependency, replacing it with a delegated decoding mechanism using the workspace's native decoding capabilitiesTest plan