@socketsecurity/lib 5.18.2 → 5.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +6 -5
  3. package/dist/abort.d.ts +3 -0
  4. package/dist/abort.js +1 -0
  5. package/dist/agent.d.ts +66 -49
  6. package/dist/agent.js +51 -50
  7. package/dist/ansi.d.ts +2 -5
  8. package/dist/ansi.js +3 -2
  9. package/dist/archives.d.ts +25 -21
  10. package/dist/archives.js +35 -34
  11. package/dist/argv/flags.d.ts +100 -91
  12. package/dist/argv/flags.js +88 -87
  13. package/dist/argv/parse.d.ts +30 -40
  14. package/dist/argv/parse.js +33 -32
  15. package/dist/arrays.d.ts +4 -8
  16. package/dist/arrays.js +1 -0
  17. package/dist/bin.d.ts +7 -5
  18. package/dist/bin.js +52 -29
  19. package/dist/cacache.d.ts +13 -12
  20. package/dist/cacache.js +9 -8
  21. package/dist/cache-with-ttl.d.ts +53 -35
  22. package/dist/cache-with-ttl.js +1 -0
  23. package/dist/colors.d.ts +5 -5
  24. package/dist/colors.js +1 -0
  25. package/dist/constants/agents.d.ts +5 -9
  26. package/dist/constants/agents.js +3 -2
  27. package/dist/constants/core.d.ts +5 -10
  28. package/dist/constants/core.js +2 -1
  29. package/dist/constants/encoding.d.ts +3 -3
  30. package/dist/constants/encoding.js +1 -0
  31. package/dist/constants/github.d.ts +3 -3
  32. package/dist/constants/github.js +1 -0
  33. package/dist/constants/licenses.d.ts +9 -2
  34. package/dist/constants/licenses.js +1 -0
  35. package/dist/constants/lifecycle-script-names.js +1 -0
  36. package/dist/constants/maintained-node-versions.d.ts +3 -0
  37. package/dist/constants/maintained-node-versions.js +1 -0
  38. package/dist/constants/node.d.ts +125 -16
  39. package/dist/constants/node.js +74 -73
  40. package/dist/constants/package-default-node-range.d.ts +3 -1
  41. package/dist/constants/package-default-node-range.js +2 -1
  42. package/dist/constants/package-default-socket-categories.d.ts +0 -1
  43. package/dist/constants/package-default-socket-categories.js +1 -0
  44. package/dist/constants/packages.d.ts +12 -17
  45. package/dist/constants/packages.js +31 -16
  46. package/dist/constants/platform.d.ts +1 -2
  47. package/dist/constants/platform.js +2 -1
  48. package/dist/constants/process.d.ts +18 -0
  49. package/dist/constants/process.js +1 -0
  50. package/dist/constants/socket.d.ts +4 -10
  51. package/dist/constants/socket.js +2 -1
  52. package/dist/constants/testing.d.ts +3 -3
  53. package/dist/constants/testing.js +1 -0
  54. package/dist/constants/time.d.ts +3 -4
  55. package/dist/constants/time.js +1 -0
  56. package/dist/constants/typescript.d.ts +10 -3
  57. package/dist/constants/typescript.js +5 -4
  58. package/dist/cover/code.d.ts +3 -0
  59. package/dist/cover/code.js +12 -12
  60. package/dist/cover/formatters.d.ts +12 -9
  61. package/dist/cover/formatters.js +19 -18
  62. package/dist/cover/type.d.ts +3 -0
  63. package/dist/cover/type.js +1 -0
  64. package/dist/cover/types.js +1 -0
  65. package/dist/debug.d.ts +32 -47
  66. package/dist/debug.js +97 -96
  67. package/dist/dlx/arborist.d.ts +134 -0
  68. package/dist/dlx/arborist.js +177 -0
  69. package/dist/dlx/binary.d.ts +25 -9
  70. package/dist/dlx/binary.js +34 -12
  71. package/dist/dlx/cache.d.ts +1 -0
  72. package/dist/dlx/cache.js +2 -1
  73. package/dist/dlx/detect.d.ts +15 -0
  74. package/dist/dlx/detect.js +28 -20
  75. package/dist/dlx/dir.d.ts +1 -11
  76. package/dist/dlx/dir.js +2 -12
  77. package/dist/dlx/integrity.d.ts +86 -0
  78. package/dist/dlx/integrity.js +112 -0
  79. package/dist/dlx/lockfile.d.ts +115 -0
  80. package/dist/dlx/lockfile.js +139 -0
  81. package/dist/dlx/manifest.d.ts +26 -1
  82. package/dist/dlx/manifest.js +9 -6
  83. package/dist/dlx/package.d.ts +58 -3
  84. package/dist/dlx/package.js +101 -74
  85. package/dist/dlx/packages.d.ts +1 -11
  86. package/dist/dlx/packages.js +3 -14
  87. package/dist/dlx/paths.d.ts +1 -0
  88. package/dist/dlx/paths.js +2 -1
  89. package/dist/effects/pulse-frames.js +1 -0
  90. package/dist/effects/text-shimmer.d.ts +13 -2
  91. package/dist/effects/text-shimmer.js +50 -46
  92. package/dist/effects/types.js +1 -0
  93. package/dist/effects/ultra.js +1 -0
  94. package/dist/env/ci.d.ts +6 -1
  95. package/dist/env/ci.js +1 -0
  96. package/dist/env/debug.d.ts +5 -1
  97. package/dist/env/debug.js +1 -0
  98. package/dist/env/github.d.ts +19 -23
  99. package/dist/env/github.js +5 -4
  100. package/dist/env/helpers.d.ts +21 -9
  101. package/dist/env/helpers.js +5 -11
  102. package/dist/env/home.d.ts +17 -4
  103. package/dist/env/home.js +2 -1
  104. package/dist/env/locale.d.ts +4 -3
  105. package/dist/env/locale.js +1 -0
  106. package/dist/env/node-auth-token.d.ts +5 -1
  107. package/dist/env/node-auth-token.js +1 -0
  108. package/dist/env/node-env.d.ts +5 -1
  109. package/dist/env/node-env.js +1 -0
  110. package/dist/env/npm.d.ts +4 -5
  111. package/dist/env/npm.js +1 -0
  112. package/dist/env/package-manager.d.ts +4 -3
  113. package/dist/env/package-manager.js +2 -1
  114. package/dist/env/path.d.ts +5 -1
  115. package/dist/env/path.js +1 -0
  116. package/dist/env/pre-commit.d.ts +5 -1
  117. package/dist/env/pre-commit.js +1 -0
  118. package/dist/env/rewire.d.ts +10 -0
  119. package/dist/env/rewire.js +7 -5
  120. package/dist/env/shell.d.ts +5 -1
  121. package/dist/env/shell.js +1 -0
  122. package/dist/env/socket-cli-shadow.d.ts +4 -5
  123. package/dist/env/socket-cli-shadow.js +1 -0
  124. package/dist/env/socket-cli.d.ts +4 -14
  125. package/dist/env/socket-cli.js +1 -0
  126. package/dist/env/socket.d.ts +6 -18
  127. package/dist/env/socket.js +4 -3
  128. package/dist/env/temp-dir.d.ts +4 -3
  129. package/dist/env/temp-dir.js +1 -0
  130. package/dist/env/term.d.ts +5 -1
  131. package/dist/env/term.js +1 -0
  132. package/dist/env/test.d.ts +4 -3
  133. package/dist/env/test.js +1 -0
  134. package/dist/env/windows.d.ts +4 -4
  135. package/dist/env/windows.js +1 -0
  136. package/dist/env/xdg.d.ts +4 -3
  137. package/dist/env/xdg.js +1 -0
  138. package/dist/env.d.ts +83 -23
  139. package/dist/env.js +112 -80
  140. package/dist/errors.js +1 -0
  141. package/dist/external/@npmcli/package-json.js +9 -3968
  142. package/dist/external/@socketregistry/packageurl-js.js +2 -2
  143. package/dist/external/debug.js +162 -328
  144. package/dist/external/external-pack.js +3 -2835
  145. package/dist/external/npm-pack.js +13939 -33342
  146. package/dist/external/zod.js +160 -7558
  147. package/dist/fs.d.ts +92 -113
  148. package/dist/fs.js +35 -35
  149. package/dist/git.d.ts +170 -164
  150. package/dist/git.js +113 -87
  151. package/dist/github.d.ts +249 -227
  152. package/dist/github.js +82 -81
  153. package/dist/globs.d.ts +31 -17
  154. package/dist/globs.js +51 -58
  155. package/dist/http-request.d.ts +99 -99
  156. package/dist/http-request.js +182 -156
  157. package/dist/ipc-cli.d.ts +28 -0
  158. package/dist/{utils/get-ipc.js → ipc-cli.js} +4 -3
  159. package/dist/ipc.d.ts +9 -299
  160. package/dist/ipc.js +18 -204
  161. package/dist/json/edit.d.ts +3 -1
  162. package/dist/json/edit.js +30 -30
  163. package/dist/json/format.d.ts +36 -36
  164. package/dist/json/format.js +22 -21
  165. package/dist/json/parse.d.ts +4 -2
  166. package/dist/json/parse.js +1 -0
  167. package/dist/json/types.js +1 -0
  168. package/dist/{links/index.d.ts → links.d.ts} +6 -2
  169. package/dist/{links/index.js → links.js} +5 -4
  170. package/dist/logger.d.ts +4 -6
  171. package/dist/logger.js +61 -53
  172. package/dist/memoization.d.ts +52 -49
  173. package/dist/memoization.js +55 -33
  174. package/dist/objects.d.ts +25 -44
  175. package/dist/objects.js +2 -1
  176. package/dist/package-extensions.d.ts +6 -0
  177. package/dist/package-extensions.js +2 -1
  178. package/dist/packages/edit.d.ts +3 -5
  179. package/dist/packages/edit.js +4 -3
  180. package/dist/packages/exports.d.ts +11 -14
  181. package/dist/packages/exports.js +11 -10
  182. package/dist/packages/isolation.d.ts +4 -0
  183. package/dist/packages/isolation.js +20 -19
  184. package/dist/packages/licenses.d.ts +3 -10
  185. package/dist/packages/licenses.js +2 -1
  186. package/dist/packages/manifest.d.ts +3 -3
  187. package/dist/packages/manifest.js +1 -0
  188. package/dist/packages/normalize.d.ts +3 -4
  189. package/dist/packages/normalize.js +1 -0
  190. package/dist/packages/operations.d.ts +3 -10
  191. package/dist/packages/operations.js +1 -0
  192. package/dist/packages/provenance.d.ts +10 -8
  193. package/dist/packages/provenance.js +55 -54
  194. package/dist/packages/specs.d.ts +3 -5
  195. package/dist/packages/specs.js +1 -0
  196. package/dist/packages/validation.d.ts +3 -3
  197. package/dist/packages/validation.js +1 -0
  198. package/dist/packages.d.ts +2 -17
  199. package/dist/packages.js +2 -1
  200. package/dist/paths/dirnames.d.ts +0 -2
  201. package/dist/paths/dirnames.js +1 -0
  202. package/dist/paths/exts.d.ts +0 -1
  203. package/dist/paths/exts.js +1 -0
  204. package/dist/paths/filenames.d.ts +0 -1
  205. package/dist/paths/filenames.js +1 -0
  206. package/dist/paths/globs.d.ts +0 -1
  207. package/dist/paths/globs.js +1 -0
  208. package/dist/paths/normalize.d.ts +115 -123
  209. package/dist/paths/normalize.js +128 -127
  210. package/dist/paths/packages.d.ts +3 -2
  211. package/dist/paths/packages.js +2 -1
  212. package/dist/paths/rewire.d.ts +9 -0
  213. package/dist/paths/rewire.js +5 -3
  214. package/dist/paths/socket.d.ts +37 -23
  215. package/dist/paths/socket.js +26 -25
  216. package/dist/performance.d.ts +87 -84
  217. package/dist/performance.js +97 -96
  218. package/dist/process-lock.d.ts +41 -1
  219. package/dist/process-lock.js +24 -17
  220. package/dist/promise-queue.d.ts +6 -0
  221. package/dist/promise-queue.js +1 -0
  222. package/dist/promises.d.ts +40 -55
  223. package/dist/promises.js +12 -11
  224. package/dist/regexps.d.ts +0 -5
  225. package/dist/regexps.js +1 -0
  226. package/dist/releases/github.d.ts +59 -63
  227. package/dist/releases/github.js +95 -100
  228. package/dist/releases/socket-btm.d.ts +9 -2
  229. package/dist/releases/socket-btm.js +32 -25
  230. package/dist/sea.d.ts +5 -0
  231. package/dist/sea.js +1 -0
  232. package/dist/shadow.d.ts +4 -0
  233. package/dist/shadow.js +1 -0
  234. package/dist/signal-exit.d.ts +7 -7
  235. package/dist/signal-exit.js +46 -45
  236. package/dist/sorts.d.ts +5 -7
  237. package/dist/sorts.js +11 -10
  238. package/dist/spawn.d.ts +96 -77
  239. package/dist/spawn.js +39 -38
  240. package/dist/spinner.d.ts +21 -22
  241. package/dist/spinner.js +15 -11
  242. package/dist/ssri.d.ts +31 -36
  243. package/dist/ssri.js +15 -14
  244. package/dist/stdio/_stream.d.ts +31 -0
  245. package/dist/stdio/_stream.js +57 -0
  246. package/dist/stdio/divider.d.ts +40 -36
  247. package/dist/stdio/divider.js +10 -9
  248. package/dist/stdio/footer.d.ts +20 -0
  249. package/dist/stdio/footer.js +12 -2
  250. package/dist/stdio/header.d.ts +4 -16
  251. package/dist/stdio/header.js +1 -9
  252. package/dist/stdio/stderr.d.ts +51 -39
  253. package/dist/stdio/stderr.js +19 -22
  254. package/dist/stdio/stdout.d.ts +54 -52
  255. package/dist/stdio/stdout.js +35 -33
  256. package/dist/streams.d.ts +4 -3
  257. package/dist/streams.js +1 -0
  258. package/dist/strings.d.ts +31 -85
  259. package/dist/strings.js +5 -49
  260. package/dist/suppress-warnings.d.ts +32 -15
  261. package/dist/suppress-warnings.js +14 -13
  262. package/dist/tables.d.ts +30 -26
  263. package/dist/tables.js +24 -23
  264. package/dist/temporary-executor.d.ts +4 -0
  265. package/dist/temporary-executor.js +1 -0
  266. package/dist/themes/context.d.ts +30 -26
  267. package/dist/themes/context.js +19 -18
  268. package/dist/themes/index.d.ts +0 -4
  269. package/dist/themes/index.js +1 -0
  270. package/dist/themes/themes.d.ts +1 -1
  271. package/dist/themes/themes.js +1 -0
  272. package/dist/themes/types.js +1 -0
  273. package/dist/themes/utils.d.ts +46 -43
  274. package/dist/themes/utils.js +45 -44
  275. package/dist/types.d.ts +48 -52
  276. package/dist/types.js +35 -35
  277. package/dist/url.d.ts +48 -53
  278. package/dist/url.js +38 -37
  279. package/dist/validation/json-parser.d.ts +19 -190
  280. package/dist/validation/json-parser.js +5 -69
  281. package/dist/validation/types.d.ts +9 -33
  282. package/dist/validation/types.js +1 -0
  283. package/dist/versions.d.ts +1 -0
  284. package/dist/versions.js +2 -1
  285. package/dist/words.d.ts +3 -6
  286. package/dist/words.js +1 -0
  287. package/dist/zod.js +1 -0
  288. package/package.json +34 -66
  289. package/dist/external/@inquirer/checkbox.js +0 -5
  290. package/dist/external/@inquirer/confirm.js +0 -5
  291. package/dist/external/@inquirer/input.js +0 -5
  292. package/dist/external/@inquirer/password.js +0 -5
  293. package/dist/external/@inquirer/search.js +0 -5
  294. package/dist/external/@inquirer/select.js +0 -5
  295. package/dist/functions.d.ts +0 -57
  296. package/dist/functions.js +0 -70
  297. package/dist/stdio/clear.d.ts +0 -140
  298. package/dist/stdio/clear.js +0 -95
  299. package/dist/stdio/mask.d.ts +0 -151
  300. package/dist/stdio/mask.js +0 -224
  301. package/dist/stdio/progress.d.ts +0 -148
  302. package/dist/stdio/progress.js +0 -212
  303. package/dist/stdio/prompts.d.ts +0 -195
  304. package/dist/stdio/prompts.js +0 -176
  305. package/dist/utils/get-ipc.d.ts +0 -15
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @fileoverview Socket Security environment variable getters.
3
+ */
1
4
  /**
2
5
  * SOCKET_ACCEPT_RISKS environment variable getter.
3
6
  * Whether to accept all Socket Security risks.
@@ -13,7 +16,6 @@
13
16
  * }
14
17
  * ```
15
18
  */
16
- /*@__NO_SIDE_EFFECTS__*/
17
19
  export declare function getSocketAcceptRisks(): boolean;
18
20
  /**
19
21
  * SOCKET_API_BASE_URL environment variable getter.
@@ -29,7 +31,6 @@ export declare function getSocketAcceptRisks(): boolean;
29
31
  * // e.g. 'https://api.socket.dev' or undefined
30
32
  * ```
31
33
  */
32
- /*@__NO_SIDE_EFFECTS__*/
33
34
  export declare function getSocketApiBaseUrl(): string | undefined;
34
35
  /**
35
36
  * SOCKET_API_PROXY environment variable getter.
@@ -45,7 +46,6 @@ export declare function getSocketApiBaseUrl(): string | undefined;
45
46
  * // e.g. 'http://proxy.example.com:8080' or undefined
46
47
  * ```
47
48
  */
48
- /*@__NO_SIDE_EFFECTS__*/
49
49
  export declare function getSocketApiProxy(): string | undefined;
50
50
  /**
51
51
  * SOCKET_API_TIMEOUT environment variable getter.
@@ -61,7 +61,6 @@ export declare function getSocketApiProxy(): string | undefined;
61
61
  * // e.g. 30000 or 0 if not set
62
62
  * ```
63
63
  */
64
- /*@__NO_SIDE_EFFECTS__*/
65
64
  export declare function getSocketApiTimeout(): number;
66
65
  /**
67
66
  * SOCKET_API_TOKEN environment variable getter.
@@ -77,7 +76,6 @@ export declare function getSocketApiTimeout(): number;
77
76
  * // e.g. a Socket API token string or undefined
78
77
  * ```
79
78
  */
80
- /*@__NO_SIDE_EFFECTS__*/
81
79
  export declare function getSocketApiToken(): string | undefined;
82
80
  /**
83
81
  * SOCKET_CACACHE_DIR environment variable getter.
@@ -87,14 +85,13 @@ export declare function getSocketApiToken(): string | undefined;
87
85
  *
88
86
  * @example
89
87
  * ```typescript
90
- * import { getSocketCacacheDir } from '@socketsecurity/lib/env/socket'
88
+ * import { getSocketCacacheDirEnv } from '@socketsecurity/lib/env/socket'
91
89
  *
92
- * const dir = getSocketCacacheDir()
90
+ * const dir = getSocketCacacheDirEnv()
93
91
  * // e.g. '/tmp/.socket-cache' or undefined
94
92
  * ```
95
93
  */
96
- /*@__NO_SIDE_EFFECTS__*/
97
- export declare function getSocketCacacheDir(): string | undefined;
94
+ export declare function getSocketCacacheDirEnv(): string | undefined;
98
95
  /**
99
96
  * SOCKET_CONFIG environment variable getter.
100
97
  * Socket Security configuration file path.
@@ -109,7 +106,6 @@ export declare function getSocketCacacheDir(): string | undefined;
109
106
  * // e.g. '/tmp/project/socket.yml' or undefined
110
107
  * ```
111
108
  */
112
- /*@__NO_SIDE_EFFECTS__*/
113
109
  export declare function getSocketConfig(): string | undefined;
114
110
  /**
115
111
  * SOCKET_DEBUG environment variable getter.
@@ -125,7 +121,6 @@ export declare function getSocketConfig(): string | undefined;
125
121
  * // e.g. '*' or 'api' or undefined
126
122
  * ```
127
123
  */
128
- /*@__NO_SIDE_EFFECTS__*/
129
124
  export declare function getSocketDebug(): string | undefined;
130
125
  /**
131
126
  * SOCKET_DLX_DIR environment variable getter.
@@ -141,7 +136,6 @@ export declare function getSocketDebug(): string | undefined;
141
136
  * // e.g. '/tmp/.socket-dlx' or undefined
142
137
  * ```
143
138
  */
144
- /*@__NO_SIDE_EFFECTS__*/
145
139
  export declare function getSocketDlxDirEnv(): string | undefined;
146
140
  /**
147
141
  * SOCKET_HOME environment variable getter.
@@ -157,7 +151,6 @@ export declare function getSocketDlxDirEnv(): string | undefined;
157
151
  * // e.g. '/tmp/.socket' or undefined
158
152
  * ```
159
153
  */
160
- /*@__NO_SIDE_EFFECTS__*/
161
154
  export declare function getSocketHome(): string | undefined;
162
155
  /**
163
156
  * SOCKET_NO_API_TOKEN environment variable getter.
@@ -174,7 +167,6 @@ export declare function getSocketHome(): string | undefined;
174
167
  * }
175
168
  * ```
176
169
  */
177
- /*@__NO_SIDE_EFFECTS__*/
178
170
  export declare function getSocketNoApiToken(): boolean;
179
171
  /**
180
172
  * SOCKET_NPM_REGISTRY environment variable getter.
@@ -190,7 +182,6 @@ export declare function getSocketNoApiToken(): boolean;
190
182
  * // e.g. 'https://npm.socket.dev/' or undefined
191
183
  * ```
192
184
  */
193
- /*@__NO_SIDE_EFFECTS__*/
194
185
  export declare function getSocketNpmRegistry(): string | undefined;
195
186
  /**
196
187
  * SOCKET_ORG_SLUG environment variable getter.
@@ -206,7 +197,6 @@ export declare function getSocketNpmRegistry(): string | undefined;
206
197
  * // e.g. 'my-org' or undefined
207
198
  * ```
208
199
  */
209
- /*@__NO_SIDE_EFFECTS__*/
210
200
  export declare function getSocketOrgSlug(): string | undefined;
211
201
  /**
212
202
  * SOCKET_REGISTRY_URL environment variable getter.
@@ -222,7 +212,6 @@ export declare function getSocketOrgSlug(): string | undefined;
222
212
  * // e.g. 'https://registry.socket.dev/' or undefined
223
213
  * ```
224
214
  */
225
- /*@__NO_SIDE_EFFECTS__*/
226
215
  export declare function getSocketRegistryUrl(): string | undefined;
227
216
  /**
228
217
  * SOCKET_VIEW_ALL_RISKS environment variable getter.
@@ -239,5 +228,4 @@ export declare function getSocketRegistryUrl(): string | undefined;
239
228
  * }
240
229
  * ```
241
230
  */
242
- /*@__NO_SIDE_EFFECTS__*/
243
231
  export declare function getSocketViewAllRisks(): boolean;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ "use strict";
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -24,7 +25,7 @@ __export(socket_exports, {
24
25
  getSocketApiProxy: () => getSocketApiProxy,
25
26
  getSocketApiTimeout: () => getSocketApiTimeout,
26
27
  getSocketApiToken: () => getSocketApiToken,
27
- getSocketCacacheDir: () => getSocketCacacheDir,
28
+ getSocketCacacheDirEnv: () => getSocketCacacheDirEnv,
28
29
  getSocketConfig: () => getSocketConfig,
29
30
  getSocketDebug: () => getSocketDebug,
30
31
  getSocketDlxDirEnv: () => getSocketDlxDirEnv,
@@ -59,7 +60,7 @@ function getSocketApiToken() {
59
60
  return (0, import_rewire.getEnvValue)("SOCKET_API_TOKEN");
60
61
  }
61
62
  // @__NO_SIDE_EFFECTS__
62
- function getSocketCacacheDir() {
63
+ function getSocketCacacheDirEnv() {
63
64
  return (0, import_rewire.getEnvValue)("SOCKET_CACACHE_DIR");
64
65
  }
65
66
  // @__NO_SIDE_EFFECTS__
@@ -105,7 +106,7 @@ function getSocketViewAllRisks() {
105
106
  getSocketApiProxy,
106
107
  getSocketApiTimeout,
107
108
  getSocketApiToken,
108
- getSocketCacacheDir,
109
+ getSocketCacacheDirEnv,
109
110
  getSocketConfig,
110
111
  getSocketDebug,
111
112
  getSocketDlxDirEnv,
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @fileoverview Temporary directory environment variable getters.
3
+ * Different platforms use different environment variables for temp directories.
4
+ */
1
5
  /**
2
6
  * TEMP environment variable.
3
7
  * Windows temporary directory path.
@@ -12,7 +16,6 @@
12
16
  * // e.g. 'C:\\Windows\\Temp' or undefined
13
17
  * ```
14
18
  */
15
- /*@__NO_SIDE_EFFECTS__*/
16
19
  export declare function getTemp(): string | undefined;
17
20
  /**
18
21
  * TMP environment variable.
@@ -28,7 +31,6 @@ export declare function getTemp(): string | undefined;
28
31
  * // e.g. '/tmp' or undefined
29
32
  * ```
30
33
  */
31
- /*@__NO_SIDE_EFFECTS__*/
32
34
  export declare function getTmp(): string | undefined;
33
35
  /**
34
36
  * TMPDIR environment variable.
@@ -44,5 +46,4 @@ export declare function getTmp(): string | undefined;
44
46
  * // e.g. '/tmp' or undefined
45
47
  * ```
46
48
  */
47
- /*@__NO_SIDE_EFFECTS__*/
48
49
  export declare function getTmpdir(): string | undefined;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ "use strict";
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @fileoverview TERM environment variable getter.
3
+ * Exports `getTerm()`, returning the `TERM` terminal type identifier (for
4
+ * example `xterm-256color`) or `undefined` when unset.
5
+ */
1
6
  /**
2
7
  * Returns the value of the TERM environment variable.
3
8
  *
@@ -11,5 +16,4 @@
11
16
  * // e.g. 'xterm-256color' or undefined
12
17
  * ```
13
18
  */
14
- /*@__NO_SIDE_EFFECTS__*/
15
19
  export declare function getTerm(): string | undefined;
package/dist/env/term.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ "use strict";
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @fileoverview Test environment variable getters and detection.
3
+ * Provides access to test framework environment variables and utilities.
4
+ */
1
5
  /**
2
6
  * JEST_WORKER_ID environment variable.
3
7
  * Set when running tests with Jest.
@@ -12,7 +16,6 @@
12
16
  * // e.g. '1' when running in Jest, or ''
13
17
  * ```
14
18
  */
15
- /*@__NO_SIDE_EFFECTS__*/
16
19
  export declare function getJestWorkerId(): string;
17
20
  /**
18
21
  * VITEST environment variable.
@@ -29,7 +32,6 @@ export declare function getJestWorkerId(): string;
29
32
  * }
30
33
  * ```
31
34
  */
32
- /*@__NO_SIDE_EFFECTS__*/
33
35
  export declare function getVitest(): boolean;
34
36
  /**
35
37
  * Check if code is running in a test environment.
@@ -46,5 +48,4 @@ export declare function getVitest(): boolean;
46
48
  * }
47
49
  * ```
48
50
  */
49
- /*@__NO_SIDE_EFFECTS__*/
50
51
  export declare function isTest(): boolean;
package/dist/env/test.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ "use strict";
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @fileoverview Windows environment variable getters.
3
+ * Provides access to Windows-specific user directory paths.
4
+ */
1
5
  /**
2
6
  * APPDATA environment variable.
3
7
  * Points to the Application Data directory on Windows.
@@ -12,7 +16,6 @@
12
16
  * // e.g. 'C:\\Users\\Public\\AppData\\Roaming' or undefined
13
17
  * ```
14
18
  */
15
- /*@__NO_SIDE_EFFECTS__*/
16
19
  export declare function getAppdata(): string | undefined;
17
20
  /**
18
21
  * COMSPEC environment variable.
@@ -28,7 +31,6 @@ export declare function getAppdata(): string | undefined;
28
31
  * // e.g. 'C:\\Windows\\system32\\cmd.exe' or undefined
29
32
  * ```
30
33
  */
31
- /*@__NO_SIDE_EFFECTS__*/
32
34
  export declare function getComspec(): string | undefined;
33
35
  /**
34
36
  * LOCALAPPDATA environment variable.
@@ -44,7 +46,6 @@ export declare function getComspec(): string | undefined;
44
46
  * // e.g. 'C:\\Users\\Public\\AppData\\Local' or undefined
45
47
  * ```
46
48
  */
47
- /*@__NO_SIDE_EFFECTS__*/
48
49
  export declare function getLocalappdata(): string | undefined;
49
50
  /**
50
51
  * USERPROFILE environment variable.
@@ -60,5 +61,4 @@ export declare function getLocalappdata(): string | undefined;
60
61
  * // e.g. 'C:\\Users\\Public' or undefined
61
62
  * ```
62
63
  */
63
- /*@__NO_SIDE_EFFECTS__*/
64
64
  export declare function getUserprofile(): string | undefined;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ "use strict";
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
package/dist/env/xdg.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @fileoverview XDG Base Directory Specification environment variable getters.
3
+ * Provides access to XDG user directories on Unix systems.
4
+ */
1
5
  /**
2
6
  * XDG_CACHE_HOME environment variable.
3
7
  * XDG Base Directory specification cache directory.
@@ -12,7 +16,6 @@
12
16
  * // e.g. '/tmp/.cache' or undefined
13
17
  * ```
14
18
  */
15
- /*@__NO_SIDE_EFFECTS__*/
16
19
  export declare function getXdgCacheHome(): string | undefined;
17
20
  /**
18
21
  * XDG_CONFIG_HOME environment variable.
@@ -28,7 +31,6 @@ export declare function getXdgCacheHome(): string | undefined;
28
31
  * // e.g. '/tmp/.config' or undefined
29
32
  * ```
30
33
  */
31
- /*@__NO_SIDE_EFFECTS__*/
32
34
  export declare function getXdgConfigHome(): string | undefined;
33
35
  /**
34
36
  * XDG_DATA_HOME environment variable.
@@ -44,5 +46,4 @@ export declare function getXdgConfigHome(): string | undefined;
44
46
  * // e.g. '/tmp/.local/share' or undefined
45
47
  * ```
46
48
  */
47
- /*@__NO_SIDE_EFFECTS__*/
48
49
  export declare function getXdgDataHome(): string | undefined;
package/dist/env/xdg.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ "use strict";
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
package/dist/env.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @fileoverview Environment variable parsing and conversion utilities.
3
+ * Provides type-safe conversion functions for boolean, number, and string values.
4
+ */
1
5
  /**
2
6
  * Create a case-insensitive environment variable Proxy for Windows compatibility.
3
7
  * On Windows, environment variables are case-insensitive (PATH vs Path vs path).
@@ -33,61 +37,117 @@
33
37
  * })
34
38
  */
35
39
  export declare function createEnvProxy(base: NodeJS.ProcessEnv, overrides?: Record<string, string | undefined>): NodeJS.ProcessEnv;
40
+ /**
41
+ * Options for `envAsBoolean`.
42
+ */
43
+ export interface EnvAsBooleanOptions {
44
+ /** Default when value is null/undefined. @default false */
45
+ defaultValue?: boolean | undefined;
46
+ /**
47
+ * Whether to trim whitespace from string values before matching. When
48
+ * `false`, `' true '` is NOT recognised as truthy — only exact matches.
49
+ * @default true
50
+ */
51
+ trim?: boolean | undefined;
52
+ }
36
53
  /**
37
54
  * Convert an environment variable value to a boolean.
38
55
  *
56
+ * Back-compat overload: passing a bare boolean as the second argument is
57
+ * equivalent to `{ defaultValue: B }`.
58
+ *
39
59
  * @param value - The value to convert
40
- * @param defaultValue - Default when value is null/undefined (default: `false`)
41
- * @returns `true` if value is '1' or 'true' (case-insensitive), `false` otherwise
60
+ * @param defaultValueOrOptions - Default (boolean) or options object
61
+ * @returns `true` if value is '1', 'true', or 'yes' (case-insensitive), `false` otherwise
42
62
  *
43
63
  * @example
44
64
  * ```typescript
45
65
  * import { envAsBoolean } from '@socketsecurity/lib/env'
46
66
  *
47
- * envAsBoolean('true') // true
48
- * envAsBoolean('1') // true
49
- * envAsBoolean('false') // false
50
- * envAsBoolean(undefined) // false
67
+ * envAsBoolean('true') // true
68
+ * envAsBoolean('1') // true
69
+ * envAsBoolean('yes') // true
70
+ * envAsBoolean(' true ') // true (trimmed)
71
+ * envAsBoolean(' true ', { trim: false }) // false (strict)
72
+ * envAsBoolean(undefined) // false
73
+ * envAsBoolean(undefined, true) // true (legacy positional default)
51
74
  * ```
52
75
  */
53
- /*@__NO_SIDE_EFFECTS__*/
54
- export declare function envAsBoolean(value: unknown, defaultValue?: boolean): boolean;
76
+ export declare function envAsBoolean(value: unknown, defaultValueOrOptions?: boolean | EnvAsBooleanOptions | undefined): boolean;
77
+ /**
78
+ * Options for `envAsNumber`.
79
+ */
80
+ export interface EnvAsNumberOptions {
81
+ /**
82
+ * Whether to return `±Infinity` when input parses to infinity. When
83
+ * `false` (default), infinities and NaN are coerced to `defaultValue`.
84
+ * @default false
85
+ */
86
+ allowInfinity?: boolean | undefined;
87
+ /** Default when value is not a finite number. @default 0 */
88
+ defaultValue?: number | undefined;
89
+ /**
90
+ * Parse mode. `'int'` (default) uses `parseInt(_, 10)` — integer only.
91
+ * `'float'` uses `Number()` — decimals preserved.
92
+ * @default 'int'
93
+ */
94
+ mode?: 'int' | 'float' | undefined;
95
+ }
55
96
  /**
56
97
  * Convert an environment variable value to a number.
57
98
  *
99
+ * Back-compat overload: passing a bare number as the second argument is
100
+ * equivalent to `{ defaultValue: N }`.
101
+ *
58
102
  * @param value - The value to convert
59
- * @param defaultValue - Default when value is not a finite number (default: `0`)
60
- * @returns The parsed integer, or the default value if parsing fails
103
+ * @param defaultValueOrOptions - Default (number) or options object
104
+ * @returns The parsed number, or the default value if parsing fails
61
105
  *
62
106
  * @example
63
107
  * ```typescript
64
108
  * import { envAsNumber } from '@socketsecurity/lib/env'
65
109
  *
66
- * envAsNumber('3000') // 3000
67
- * envAsNumber('abc') // 0
68
- * envAsNumber(undefined) // 0
110
+ * envAsNumber('3000') // 3000 (int mode)
111
+ * envAsNumber('3.14', { mode: 'float' }) // 3.14
112
+ * envAsNumber('abc') // 0
113
+ * envAsNumber(undefined, 42) // 42 (legacy positional default)
69
114
  * ```
70
115
  */
71
- /*@__NO_SIDE_EFFECTS__*/
72
- export declare function envAsNumber(value: unknown, defaultValue?: number): number;
116
+ export declare function envAsNumber(value: unknown, defaultValueOrOptions?: number | EnvAsNumberOptions | undefined): number;
73
117
  /**
74
- * Convert an environment variable value to a trimmed string.
118
+ * Options for `envAsString`.
119
+ */
120
+ export interface EnvAsStringOptions {
121
+ /** Default when value is null/undefined. @default '' */
122
+ defaultValue?: string | undefined;
123
+ /**
124
+ * Whether to trim whitespace from string values. `true` (default) trims.
125
+ * Set `false` to preserve whitespace (helpers.envAsString semantics).
126
+ * @default true
127
+ */
128
+ trim?: boolean | undefined;
129
+ }
130
+ /**
131
+ * Convert an environment variable value to a string.
132
+ *
133
+ * Back-compat overload: passing a bare string as the second argument is
134
+ * equivalent to `{ defaultValue: S }`.
75
135
  *
76
136
  * @param value - The value to convert
77
- * @param defaultValue - Default when value is null/undefined (default: `''`)
78
- * @returns The trimmed string value, or the default value
137
+ * @param defaultValueOrOptions - Default (string) or options object
138
+ * @returns The string value, or the default value
79
139
  *
80
140
  * @example
81
141
  * ```typescript
82
142
  * import { envAsString } from '@socketsecurity/lib/env'
83
143
  *
84
- * envAsString(' hello ') // 'hello'
85
- * envAsString(undefined) // ''
86
- * envAsString(null, 'n/a') // 'n/a'
144
+ * envAsString(' hello ') // 'hello' (trimmed)
145
+ * envAsString(' hello ', { trim: false }) // ' hello '
146
+ * envAsString(undefined) // ''
147
+ * envAsString(null, 'n/a') // 'n/a' (legacy positional)
87
148
  * ```
88
149
  */
89
- /*@__NO_SIDE_EFFECTS__*/
90
- export declare function envAsString(value: unknown, defaultValue?: string): string;
150
+ export declare function envAsString(value: unknown, defaultValueOrOptions?: string | EnvAsStringOptions | undefined): string;
91
151
  /**
92
152
  * Find a case-insensitive environment variable key match.
93
153
  * Searches for an environment variable key that matches the given uppercase name,