Commit 32d5779
authored
feat: add proxy support for managed networks (#338)
* feat(config): add undici dependency and --proxy config option
Add `undici` as a production dependency (needed for proxy-aware fetch
dispatcher in a follow-up change). Add `--proxy` CLI flag and support
for FIGMA_PROXY, HTTPS_PROXY, and HTTP_PROXY env vars with a
4-source fallback chain. The proxy URL is included in startup config
logging.
* feat(proxy): set global fetch dispatcher at startup
Route all fetch() calls through the configured proxy by setting
undici's global dispatcher after config resolution. Uses ProxyAgent
for explicit --proxy values and EnvHttpProxyAgent as the default to
automatically respect HTTP_PROXY/HTTPS_PROXY/NO_PROXY env vars.
* refactor: replace curl fallback with proxy-aware error messaging
Remove the curl subprocess fallback from fetchWithRetry and replace it
with connection error detection that guides users toward proxy
configuration when they encounter network failures.
* refactor: address review findings
- Rename fetchWithRetry → fetchJSON (and file) since it no longer retries
- Narrow proxy config to only --proxy/FIGMA_PROXY; let EnvHttpProxyAgent
handle HTTPS_PROXY/HTTP_PROXY/NO_PROXY correctly at the dispatcher level
- Mask proxy URL in startup logs (show "configured" vs "none")
* fix: downgrade undici to 6.x for Node 18+ compatibility
undici 8.x requires Node >= 22.19, but the project supports Node >= 18.
undici 6.x supports Node 18+, is actively maintained through the Node
20/22 LTS cycle, and provides all the APIs we need (ProxyAgent,
EnvHttpProxyAgent, setGlobalDispatcher).
* fix: use 'network proxy' wording instead of 'corporate'1 parent 966d0f7 commit 32d5779
7 files changed
Lines changed: 80 additions & 102 deletions
File tree
- src
- services
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
93 | 98 | | |
94 | 99 | | |
95 | 100 | | |
| |||
121 | 126 | | |
122 | 127 | | |
123 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
124 | 134 | | |
125 | 135 | | |
126 | 136 | | |
| |||
151 | 161 | | |
152 | 162 | | |
153 | 163 | | |
| 164 | + | |
154 | 165 | | |
155 | 166 | | |
156 | 167 | | |
| |||
172 | 183 | | |
173 | 184 | | |
174 | 185 | | |
| 186 | + | |
175 | 187 | | |
176 | 188 | | |
177 | 189 | | |
| |||
184 | 196 | | |
185 | 197 | | |
186 | 198 | | |
| 199 | + | |
187 | 200 | | |
188 | 201 | | |
189 | 202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
26 | 35 | | |
27 | 36 | | |
28 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
This file was deleted.
0 commit comments