Commit dd4e37c
authored
feat: Add NPM proxy support (#3695)
Add a `useNpmProxy` flag to the NPM location options. When enabled, this
proxy URL is used instead of the main NPM registry URL. The
implementation assumes that the proxy returns identical content and
respects the same headers.
This flag is enabled only for updating preinstalled Snaps.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds a `useNpmProxy` option to NPM locations and routes automatic
preinstalled Snap updates through the MetaMask NPM proxy.
>
> - **Snaps Controller**
(`packages/snaps-controllers/src/snaps/SnapController.ts`):
> - Use `detectSnapLocation(..., { useNpmProxy: true })` when
auto-updating preinstalled Snaps during `updateRegistry`.
> - **NPM Location**
(`packages/snaps-controllers/src/snaps/location/npm.ts`):
> - Add `NPM_REGISTRY_PROXY` and new `NpmOptions.useNpmProxy` flag.
> - Default registry selection now uses proxy when `useNpmProxy` is
true.
> - Update `isNPM` to treat proxy URL as NPM.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
4dda778. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 0b412ce commit dd4e37c
File tree
2 files changed
+15
-2
lines changed- packages/snaps-controllers/src/snaps
- location
2 files changed
+15
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1516 | 1516 | | |
1517 | 1517 | | |
1518 | 1518 | | |
| 1519 | + | |
1519 | 1520 | | |
1520 | 1521 | | |
1521 | 1522 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
51 | 59 | | |
52 | 60 | | |
53 | 61 | | |
| |||
74 | 82 | | |
75 | 83 | | |
76 | 84 | | |
77 | | - | |
| 85 | + | |
78 | 86 | | |
79 | 87 | | |
80 | 88 | | |
| |||
341 | 349 | | |
342 | 350 | | |
343 | 351 | | |
344 | | - | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
345 | 357 | | |
346 | 358 | | |
347 | 359 | | |
| |||
0 commit comments