@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,12 @@
1
+ /**
2
+ * @fileoverview Common flag utilities for Socket CLI applications.
3
+ * Provides consistent flag checking (quiet, silent, verbose, debug, dry-run,
4
+ * etc.) across Socket projects, accepting either parsed flag objects or raw
5
+ * argv arrays.
6
+ */
7
+ /**
8
+ * Flag values object from parsed arguments.
9
+ */
1
10
  export interface FlagValues {
2
11
  [key: string]: unknown;
3
12
  quiet?: boolean;
@@ -22,6 +31,97 @@ export interface FlagValues {
22
31
  * Can be parsed flag values, process.argv array, or undefined (uses process.argv).
23
32
  */
24
33
  export type FlagInput = FlagValues | string[] | readonly string[] | undefined;
34
+ /**
35
+ * Common flag definitions for parseArgs configuration.
36
+ * Can be spread into parseArgs options for consistency.
37
+ */
38
+ export declare const COMMON_FLAGS: {
39
+ all: {
40
+ type: 'boolean';
41
+ default: boolean;
42
+ description: string;
43
+ };
44
+ changed: {
45
+ type: 'boolean';
46
+ default: boolean;
47
+ description: string;
48
+ };
49
+ coverage: {
50
+ type: 'boolean';
51
+ default: boolean;
52
+ description: string;
53
+ };
54
+ cover: {
55
+ type: 'boolean';
56
+ default: boolean;
57
+ description: string;
58
+ };
59
+ debug: {
60
+ type: 'boolean';
61
+ default: boolean;
62
+ description: string;
63
+ };
64
+ 'dry-run': {
65
+ type: 'boolean';
66
+ default: boolean;
67
+ description: string;
68
+ };
69
+ fix: {
70
+ type: 'boolean';
71
+ default: boolean;
72
+ description: string;
73
+ };
74
+ force: {
75
+ type: 'boolean';
76
+ default: boolean;
77
+ description: string;
78
+ };
79
+ help: {
80
+ type: 'boolean';
81
+ default: boolean;
82
+ short: string;
83
+ description: string;
84
+ };
85
+ json: {
86
+ type: 'boolean';
87
+ default: boolean;
88
+ description: string;
89
+ };
90
+ quiet: {
91
+ type: 'boolean';
92
+ default: boolean;
93
+ short: string;
94
+ description: string;
95
+ };
96
+ silent: {
97
+ type: 'boolean';
98
+ default: boolean;
99
+ description: string;
100
+ };
101
+ staged: {
102
+ type: 'boolean';
103
+ default: boolean;
104
+ description: string;
105
+ };
106
+ update: {
107
+ type: 'boolean';
108
+ default: boolean;
109
+ short: string;
110
+ description: string;
111
+ };
112
+ verbose: {
113
+ type: 'boolean';
114
+ default: boolean;
115
+ short: string;
116
+ description: string;
117
+ };
118
+ watch: {
119
+ type: 'boolean';
120
+ default: boolean;
121
+ short: string;
122
+ description: string;
123
+ };
124
+ };
25
125
  /**
26
126
  * Get the appropriate log level based on flags.
27
127
  * Returns 'silent', 'error', 'warn', 'info', 'verbose', or 'debug'.
@@ -190,94 +290,3 @@ export declare function isVerbose(input?: FlagInput): boolean;
190
290
  * ```
191
291
  */
192
292
  export declare function isWatch(input?: FlagInput): boolean;
193
- /**
194
- * Common flag definitions for parseArgs configuration.
195
- * Can be spread into parseArgs options for consistency.
196
- */
197
- export declare const COMMON_FLAGS: {
198
- all: {
199
- type: "boolean";
200
- default: boolean;
201
- description: string;
202
- };
203
- changed: {
204
- type: "boolean";
205
- default: boolean;
206
- description: string;
207
- };
208
- coverage: {
209
- type: "boolean";
210
- default: boolean;
211
- description: string;
212
- };
213
- cover: {
214
- type: "boolean";
215
- default: boolean;
216
- description: string;
217
- };
218
- debug: {
219
- type: "boolean";
220
- default: boolean;
221
- description: string;
222
- };
223
- "dry-run": {
224
- type: "boolean";
225
- default: boolean;
226
- description: string;
227
- };
228
- fix: {
229
- type: "boolean";
230
- default: boolean;
231
- description: string;
232
- };
233
- force: {
234
- type: "boolean";
235
- default: boolean;
236
- description: string;
237
- };
238
- help: {
239
- type: "boolean";
240
- default: boolean;
241
- short: string;
242
- description: string;
243
- };
244
- json: {
245
- type: "boolean";
246
- default: boolean;
247
- description: string;
248
- };
249
- quiet: {
250
- type: "boolean";
251
- default: boolean;
252
- short: string;
253
- description: string;
254
- };
255
- silent: {
256
- type: "boolean";
257
- default: boolean;
258
- description: string;
259
- };
260
- staged: {
261
- type: "boolean";
262
- default: boolean;
263
- description: string;
264
- };
265
- update: {
266
- type: "boolean";
267
- default: boolean;
268
- short: string;
269
- description: string;
270
- };
271
- verbose: {
272
- type: "boolean";
273
- default: boolean;
274
- short: string;
275
- description: string;
276
- };
277
- watch: {
278
- type: "boolean";
279
- default: boolean;
280
- short: string;
281
- description: string;
282
- };
283
- };
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ "use strict";
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -49,6 +50,93 @@ __export(flags_exports, {
49
50
  module.exports = __toCommonJS(flags_exports);
50
51
  var import_node_process = __toESM(require("node:process"));
51
52
  const processArg = [...import_node_process.default.argv];
53
+ const COMMON_FLAGS = {
54
+ all: {
55
+ type: "boolean",
56
+ default: false,
57
+ description: "Target all files"
58
+ },
59
+ changed: {
60
+ type: "boolean",
61
+ default: false,
62
+ description: "Target changed files"
63
+ },
64
+ coverage: {
65
+ type: "boolean",
66
+ default: false,
67
+ description: "Run with coverage"
68
+ },
69
+ cover: {
70
+ type: "boolean",
71
+ default: false,
72
+ description: "Run with coverage (alias)"
73
+ },
74
+ debug: {
75
+ type: "boolean",
76
+ default: false,
77
+ description: "Enable debug output"
78
+ },
79
+ "dry-run": {
80
+ type: "boolean",
81
+ default: false,
82
+ description: "Perform a dry run"
83
+ },
84
+ fix: {
85
+ type: "boolean",
86
+ default: false,
87
+ description: "Automatically fix issues"
88
+ },
89
+ force: {
90
+ type: "boolean",
91
+ default: false,
92
+ description: "Force the operation"
93
+ },
94
+ help: {
95
+ type: "boolean",
96
+ default: false,
97
+ short: "h",
98
+ description: "Show help"
99
+ },
100
+ json: {
101
+ type: "boolean",
102
+ default: false,
103
+ description: "Output as JSON"
104
+ },
105
+ quiet: {
106
+ type: "boolean",
107
+ default: false,
108
+ short: "q",
109
+ description: "Suppress output"
110
+ },
111
+ silent: {
112
+ type: "boolean",
113
+ default: false,
114
+ description: "Suppress all output"
115
+ },
116
+ staged: {
117
+ type: "boolean",
118
+ default: false,
119
+ description: "Target staged files"
120
+ },
121
+ update: {
122
+ type: "boolean",
123
+ default: false,
124
+ short: "u",
125
+ description: "Update snapshots/deps"
126
+ },
127
+ verbose: {
128
+ type: "boolean",
129
+ default: false,
130
+ short: "v",
131
+ description: "Verbose output"
132
+ },
133
+ watch: {
134
+ type: "boolean",
135
+ default: false,
136
+ short: "w",
137
+ description: "Watch mode"
138
+ }
139
+ };
52
140
  function getLogLevel(input) {
53
141
  if (isQuiet(input)) {
54
142
  return "silent";
@@ -187,93 +275,6 @@ function isWatch(input) {
187
275
  }
188
276
  return !!input.watch;
189
277
  }
190
- const COMMON_FLAGS = {
191
- all: {
192
- type: "boolean",
193
- default: false,
194
- description: "Target all files"
195
- },
196
- changed: {
197
- type: "boolean",
198
- default: false,
199
- description: "Target changed files"
200
- },
201
- coverage: {
202
- type: "boolean",
203
- default: false,
204
- description: "Run with coverage"
205
- },
206
- cover: {
207
- type: "boolean",
208
- default: false,
209
- description: "Run with coverage (alias)"
210
- },
211
- debug: {
212
- type: "boolean",
213
- default: false,
214
- description: "Enable debug output"
215
- },
216
- "dry-run": {
217
- type: "boolean",
218
- default: false,
219
- description: "Perform a dry run"
220
- },
221
- fix: {
222
- type: "boolean",
223
- default: false,
224
- description: "Automatically fix issues"
225
- },
226
- force: {
227
- type: "boolean",
228
- default: false,
229
- description: "Force the operation"
230
- },
231
- help: {
232
- type: "boolean",
233
- default: false,
234
- short: "h",
235
- description: "Show help"
236
- },
237
- json: {
238
- type: "boolean",
239
- default: false,
240
- description: "Output as JSON"
241
- },
242
- quiet: {
243
- type: "boolean",
244
- default: false,
245
- short: "q",
246
- description: "Suppress output"
247
- },
248
- silent: {
249
- type: "boolean",
250
- default: false,
251
- description: "Suppress all output"
252
- },
253
- staged: {
254
- type: "boolean",
255
- default: false,
256
- description: "Target staged files"
257
- },
258
- update: {
259
- type: "boolean",
260
- default: false,
261
- short: "u",
262
- description: "Update snapshots/deps"
263
- },
264
- verbose: {
265
- type: "boolean",
266
- default: false,
267
- short: "v",
268
- description: "Verbose output"
269
- },
270
- watch: {
271
- type: "boolean",
272
- default: false,
273
- short: "w",
274
- description: "Watch mode"
275
- }
276
- };
277
278
  // Annotate the CommonJS export names for ESM import in node:
278
279
  0 && (module.exports = {
279
280
  COMMON_FLAGS,
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @fileoverview Argument parsing utilities for CLI applications.
3
+ * Wraps the vendored yargs-parser with a Node.js parseArgs-compatible surface
4
+ * for booleans, strings, arrays, aliases, defaults, and coercion.
5
+ */
1
6
  /**
2
7
  * Yargs parser result interface.
3
8
  */
@@ -9,47 +14,57 @@ interface YargsArguments extends Record<string, unknown> {
9
14
  * Options for configuring argument parsing, similar to Node.js util.parseArgs.
10
15
  */
11
16
  export interface ParseArgsOptionsConfig {
12
- // Whether the option accepts multiple values (array).
13
17
  multiple?: boolean | undefined;
14
- // Short alias for the option (single character).
15
18
  short?: string | undefined;
16
- // Type of the option value.
17
19
  type?: 'boolean' | 'string' | undefined;
18
- // Default value for the option.
19
20
  default?: unknown | undefined;
20
- // Transform function to coerce parsed values.
21
21
  coerce?: (value: unknown) => unknown | undefined;
22
22
  }
23
23
  /**
24
24
  * Configuration object for parseArgs function, similar to Node.js util.parseArgs.
25
25
  */
26
26
  export interface ParseArgsConfig {
27
- // Command-line arguments to parse (defaults to process.argv.slice(2)).
28
27
  args?: readonly string[] | undefined;
29
- // Options configuration object.
30
28
  options?: Record<string, ParseArgsOptionsConfig> | undefined;
31
- // Whether to throw on unknown options (default: true).
32
29
  strict?: boolean | undefined;
33
- // Whether to populate tokens array (not implemented, for API compatibility).
34
30
  tokens?: boolean | undefined;
35
- // Whether to allow positional arguments after options.
36
31
  allowPositionals?: boolean | undefined;
37
- // Whether to allow negative numbers as option values.
38
32
  allowNegative?: boolean | undefined;
39
- // Advanced yargs-parser configuration passthrough.
40
33
  configuration?: Record<string, boolean | string> | undefined;
41
34
  }
42
35
  /**
43
36
  * Result of parsing command-line arguments.
44
37
  */
45
38
  export interface ParsedArgs<T = Record<string, unknown>> {
46
- // Parsed option values.
47
39
  values: T;
48
- // Positional arguments (non-option arguments).
49
40
  positionals: string[];
50
- // Raw parsed arguments object from yargs-parser.
51
41
  raw: YargsArguments;
52
42
  }
43
+ /**
44
+ * Common parseArgs configuration for Socket registry scripts.
45
+ */
46
+ export declare const commonParseArgsConfig: ParseArgsConfig;
47
+ /**
48
+ * Extract positional arguments from process.argv.
49
+ * Useful for commands that accept file paths or other positional parameters.
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * // process.argv = ["node", "script.js", "src", "lib", "--verbose"]
54
+ * getPositionalArgs() // ["src", "lib"]
55
+ * ```
56
+ */
57
+ export declare function getPositionalArgs(startIndex?: number): string[];
58
+ /**
59
+ * Check if a specific flag is present in argv.
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * hasFlag('verbose') // true if --verbose is in process.argv
64
+ * hasFlag('force', ['--force', '--quiet']) // true
65
+ * ```
66
+ */
67
+ export declare function hasFlag(flag: string, argv?: string[]): boolean;
53
68
  /**
54
69
  * Parse command-line arguments with a Node.js parseArgs-compatible API.
55
70
  * Uses yargs-parser internally for robust argument parsing.
@@ -79,29 +94,4 @@ export declare function parseArgs<T = Record<string, unknown>>(config?: ParseArg
79
94
  * ```
80
95
  */
81
96
  export declare function parseArgsWithDefaults<T = Record<string, unknown>>(config?: ParseArgsConfig): ParsedArgs<T>;
82
- /**
83
- * Common parseArgs configuration for Socket registry scripts.
84
- */
85
- export declare const commonParseArgsConfig: ParseArgsConfig;
86
- /**
87
- * Extract positional arguments from process.argv.
88
- * Useful for commands that accept file paths or other positional parameters.
89
- *
90
- * @example
91
- * ```typescript
92
- * // process.argv = ["node", "script.js", "src", "lib", "--verbose"]
93
- * getPositionalArgs() // ["src", "lib"]
94
- * ```
95
- */
96
- export declare function getPositionalArgs(startIndex?: number): string[];
97
- /**
98
- * Check if a specific flag is present in argv.
99
- *
100
- * @example
101
- * ```typescript
102
- * hasFlag('verbose') // true if --verbose is in process.argv
103
- * hasFlag('force', ['--force', '--quiet']) // true
104
- * ```
105
- */
106
- export declare function hasFlag(flag: string, argv?: string[]): boolean;
107
97
  export {};
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with esbuild */
3
+ "use strict";
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -38,6 +39,38 @@ __export(parse_exports, {
38
39
  module.exports = __toCommonJS(parse_exports);
39
40
  var import_node_process = __toESM(require("node:process"));
40
41
  var import_yargs_parser = __toESM(require("../external/yargs-parser"));
42
+ const commonParseArgsConfig = {
43
+ options: {
44
+ force: {
45
+ type: "boolean",
46
+ short: "f",
47
+ default: false
48
+ },
49
+ quiet: {
50
+ type: "boolean",
51
+ short: "q",
52
+ default: false
53
+ }
54
+ },
55
+ strict: false
56
+ };
57
+ function getPositionalArgs(startIndex = 2) {
58
+ const args = import_node_process.default.argv.slice(startIndex);
59
+ const positionals = [];
60
+ let i = 0;
61
+ while (i < args.length) {
62
+ const arg = args[i];
63
+ if (arg.startsWith("-")) {
64
+ break;
65
+ }
66
+ positionals.push(arg);
67
+ i++;
68
+ }
69
+ return positionals;
70
+ }
71
+ function hasFlag(flag, argv = import_node_process.default.argv) {
72
+ return argv.includes(`--${flag}`);
73
+ }
41
74
  function parseArgs(config = {}) {
42
75
  const {
43
76
  allowNegative = false,
@@ -127,38 +160,6 @@ function parseArgsWithDefaults(config = {}) {
127
160
  ...config
128
161
  });
129
162
  }
130
- const commonParseArgsConfig = {
131
- options: {
132
- force: {
133
- type: "boolean",
134
- short: "f",
135
- default: false
136
- },
137
- quiet: {
138
- type: "boolean",
139
- short: "q",
140
- default: false
141
- }
142
- },
143
- strict: false
144
- };
145
- function getPositionalArgs(startIndex = 2) {
146
- const args = import_node_process.default.argv.slice(startIndex);
147
- const positionals = [];
148
- let i = 0;
149
- while (i < args.length) {
150
- const arg = args[i];
151
- if (arg.startsWith("-")) {
152
- break;
153
- }
154
- positionals.push(arg);
155
- i++;
156
- }
157
- return positionals;
158
- }
159
- function hasFlag(flag, argv = import_node_process.default.argv) {
160
- return argv.includes(`--${flag}`);
161
- }
162
163
  // Annotate the CommonJS export names for ESM import in node:
163
164
  0 && (module.exports = {
164
165
  commonParseArgsConfig,
package/dist/arrays.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @fileoverview Array utility functions for formatting lists and collections.
3
+ * Provides conjunction and disjunction formatters using Intl.ListFormat.
4
+ */
1
5
  /**
2
6
  * Split an array into chunks of a specified size.
3
7
  *
@@ -27,7 +31,6 @@
27
31
  * // Returns: [[1, 2], [3]]
28
32
  * ```
29
33
  */
30
- /*@__NO_SIDE_EFFECTS__*/
31
34
  export declare function arrayChunk<T>(arr: T[] | readonly T[], size?: number | undefined): T[][];
32
35
  /**
33
36
  * Get unique values from an array.
@@ -59,12 +62,7 @@ export declare function arrayChunk<T>(arr: T[] | readonly T[], size?: number | u
59
62
  * // Returns: []
60
63
  * ```
61
64
  */
62
- /*@__NO_SIDE_EFFECTS__*/
63
65
  export declare function arrayUnique<T>(arr: T[] | readonly T[]): T[];
64
- // IMPORTANT: Do not use destructuring here - use direct assignment instead.
65
- // tsgo has a bug that incorrectly transpiles destructured exports, resulting in
66
- // `exports.SomeName = void 0;` which causes runtime errors.
67
- // See: https://github.com/SocketDev/socket-packageurl-js/issues/3
68
66
  /**
69
67
  * Alias for native Array.isArray.
70
68
  * Determines whether the passed value is an array.
@@ -132,7 +130,6 @@ export declare const isArray: (arg: any) => arg is any[];
132
130
  * // Outputs: "You can choose React, Vue, and Angular"
133
131
  * ```
134
132
  */
135
- /*@__NO_SIDE_EFFECTS__*/
136
133
  export declare function joinAnd(arr: string[] | readonly string[]): string;
137
134
  /**
138
135
  * Join array elements with proper "or" disjunction formatting.
@@ -168,5 +165,4 @@ export declare function joinAnd(arr: string[] | readonly string[]): string;
168
165
  * // Outputs: "Choose a package manager: npm, yarn, or pnpm"
169
166
  * ```
170
167
  */
171
- /*@__NO_SIDE_EFFECTS__*/
172
168
  export declare function joinOr(arr: string[] | readonly string[]): string;
package/dist/arrays.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/bin.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @fileoverview Binary path resolution and execution utilities for package managers.
3
+ * Provides cross-platform bin path lookup, command execution, and path normalization.
4
+ */
1
5
  /**
2
6
  * Options for the which function.
3
7
  */
@@ -24,14 +28,13 @@ export interface WhichOptions {
24
28
  * await execBin('/usr/local/bin/node', ['script.js'], { cwd: '/tmp' })
25
29
  * ```
26
30
  */
27
- /*@__NO_SIDE_EFFECTS__*/
28
31
  export declare function execBin(binPath: string, args?: string[], options?: import('./spawn').SpawnOptions): Promise<{
29
32
  cmd: string;
30
33
  args: string[] | readonly string[];
31
34
  code: number;
32
- signal: NodeJS.Signals;
33
- stdout: string | Buffer<ArrayBufferLike>;
34
- stderr: string | Buffer<ArrayBufferLike>;
35
+ signal: NodeJS.Signals | null;
36
+ stdout: string | Buffer;
37
+ stderr: string | Buffer;
35
38
  }>;
36
39
  /**
37
40
  * Find the real executable for a binary, bypassing shadow bins.
@@ -83,7 +86,6 @@ export declare function findRealYarn(): string;
83
86
  * ```
84
87
  */
85
88
  export declare function isShadowBinPath(dirPath: string | undefined): boolean;
86
- /*@__NO_SIDE_EFFECTS__*/
87
89
  /**
88
90
  * Resolve a binary path to the real underlying script file.
89
91
  * Handles Windows .cmd wrappers and Unix shell scripts, resolving them to the actual .js files they execute.