Commit 8afcb45
committed
refactor(dlx): use shared generateCacheKey from @socketsecurity/lib
Replace local generateCacheKey implementation with the shared function from
@socketsecurity/lib/dlx to eliminate code duplication and ensure consistent
cache key generation across the Socket ecosystem.
Changes:
- Import generateCacheKey from @socketsecurity/lib/dlx
- Update call site to use url:name spec format
- Use getSocketDlxDir() for correct cache path (~/.socket/_dlx)
- Update tests to expect correct cache path
- Remove local generateCacheKey function (10 lines)
The shared function uses SHA-512 truncated to 16 chars (aligning with npm/npx)
and accepts a spec string in the format "url:binaryName" for binary downloads.1 parent 272817f commit 8afcb45
2 files changed
+14
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | 81 | | |
87 | 82 | | |
88 | 83 | | |
| |||
281 | 276 | | |
282 | 277 | | |
283 | 278 | | |
284 | | - | |
285 | | - | |
286 | 279 | | |
287 | 280 | | |
288 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
289 | 286 | | |
290 | 287 | | |
291 | 288 | | |
| |||
339 | 336 | | |
340 | 337 | | |
341 | 338 | | |
| 339 | + | |
342 | 340 | | |
343 | 341 | | |
344 | | - | |
| 342 | + | |
345 | 343 | | |
346 | 344 | | |
347 | 345 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| |||
0 commit comments