@socketsecurity/lib 5.18.2 → 5.19.1

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 (296) hide show
  1. package/CHANGELOG.md +57 -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/@socketregistry/packageurl-js.js +2 -2
  142. package/dist/external/external-pack.js +1562 -1673
  143. package/dist/external/npm-pack.js +5 -1
  144. package/dist/fs.d.ts +92 -113
  145. package/dist/fs.js +35 -35
  146. package/dist/git.d.ts +170 -164
  147. package/dist/git.js +113 -87
  148. package/dist/github.d.ts +249 -227
  149. package/dist/github.js +82 -81
  150. package/dist/globs.d.ts +31 -17
  151. package/dist/globs.js +51 -58
  152. package/dist/http-request.d.ts +99 -99
  153. package/dist/http-request.js +182 -156
  154. package/dist/ipc-cli.d.ts +28 -0
  155. package/dist/{utils/get-ipc.js → ipc-cli.js} +4 -3
  156. package/dist/ipc.d.ts +9 -299
  157. package/dist/ipc.js +18 -204
  158. package/dist/json/edit.d.ts +3 -1
  159. package/dist/json/edit.js +30 -30
  160. package/dist/json/format.d.ts +36 -36
  161. package/dist/json/format.js +22 -21
  162. package/dist/json/parse.d.ts +4 -2
  163. package/dist/json/parse.js +1 -0
  164. package/dist/json/types.js +1 -0
  165. package/dist/{links/index.d.ts → links.d.ts} +6 -2
  166. package/dist/{links/index.js → links.js} +5 -4
  167. package/dist/logger.d.ts +4 -6
  168. package/dist/logger.js +61 -53
  169. package/dist/memoization.d.ts +52 -49
  170. package/dist/memoization.js +55 -33
  171. package/dist/objects.d.ts +25 -44
  172. package/dist/objects.js +2 -1
  173. package/dist/package-extensions.d.ts +6 -0
  174. package/dist/package-extensions.js +2 -1
  175. package/dist/packages/edit.d.ts +3 -5
  176. package/dist/packages/edit.js +4 -3
  177. package/dist/packages/exports.d.ts +11 -14
  178. package/dist/packages/exports.js +11 -10
  179. package/dist/packages/isolation.d.ts +4 -0
  180. package/dist/packages/isolation.js +20 -19
  181. package/dist/packages/licenses.d.ts +3 -10
  182. package/dist/packages/licenses.js +2 -1
  183. package/dist/packages/manifest.d.ts +3 -3
  184. package/dist/packages/manifest.js +1 -0
  185. package/dist/packages/normalize.d.ts +3 -4
  186. package/dist/packages/normalize.js +1 -0
  187. package/dist/packages/operations.d.ts +3 -10
  188. package/dist/packages/operations.js +1 -0
  189. package/dist/packages/provenance.d.ts +10 -8
  190. package/dist/packages/provenance.js +55 -54
  191. package/dist/packages/specs.d.ts +3 -5
  192. package/dist/packages/specs.js +1 -0
  193. package/dist/packages/validation.d.ts +3 -3
  194. package/dist/packages/validation.js +1 -0
  195. package/dist/packages.d.ts +2 -17
  196. package/dist/packages.js +2 -1
  197. package/dist/paths/dirnames.d.ts +0 -2
  198. package/dist/paths/dirnames.js +1 -0
  199. package/dist/paths/exts.d.ts +0 -1
  200. package/dist/paths/exts.js +1 -0
  201. package/dist/paths/filenames.d.ts +0 -1
  202. package/dist/paths/filenames.js +1 -0
  203. package/dist/paths/globs.d.ts +0 -1
  204. package/dist/paths/globs.js +1 -0
  205. package/dist/paths/normalize.d.ts +115 -123
  206. package/dist/paths/normalize.js +128 -127
  207. package/dist/paths/packages.d.ts +3 -2
  208. package/dist/paths/packages.js +2 -1
  209. package/dist/paths/rewire.d.ts +9 -0
  210. package/dist/paths/rewire.js +5 -3
  211. package/dist/paths/socket.d.ts +37 -23
  212. package/dist/paths/socket.js +26 -25
  213. package/dist/performance.d.ts +87 -84
  214. package/dist/performance.js +97 -96
  215. package/dist/process-lock.d.ts +41 -1
  216. package/dist/process-lock.js +24 -17
  217. package/dist/promise-queue.d.ts +6 -0
  218. package/dist/promise-queue.js +1 -0
  219. package/dist/promises.d.ts +40 -55
  220. package/dist/promises.js +12 -11
  221. package/dist/regexps.d.ts +0 -5
  222. package/dist/regexps.js +1 -0
  223. package/dist/releases/github.d.ts +59 -63
  224. package/dist/releases/github.js +95 -100
  225. package/dist/releases/socket-btm.d.ts +9 -2
  226. package/dist/releases/socket-btm.js +32 -25
  227. package/dist/sea.d.ts +5 -0
  228. package/dist/sea.js +1 -0
  229. package/dist/shadow.d.ts +4 -0
  230. package/dist/shadow.js +1 -0
  231. package/dist/signal-exit.d.ts +7 -7
  232. package/dist/signal-exit.js +46 -45
  233. package/dist/sorts.d.ts +5 -7
  234. package/dist/sorts.js +11 -10
  235. package/dist/spawn.d.ts +96 -77
  236. package/dist/spawn.js +39 -38
  237. package/dist/spinner.d.ts +21 -22
  238. package/dist/spinner.js +15 -11
  239. package/dist/ssri.d.ts +31 -36
  240. package/dist/ssri.js +15 -14
  241. package/dist/stdio/_stream.d.ts +31 -0
  242. package/dist/stdio/_stream.js +57 -0
  243. package/dist/stdio/clear.d.ts +38 -15
  244. package/dist/stdio/clear.js +5 -4
  245. package/dist/stdio/divider.d.ts +40 -36
  246. package/dist/stdio/divider.js +10 -9
  247. package/dist/stdio/footer.d.ts +20 -0
  248. package/dist/stdio/footer.js +12 -2
  249. package/dist/stdio/header.d.ts +4 -16
  250. package/dist/stdio/header.js +1 -9
  251. package/dist/stdio/progress.d.ts +4 -0
  252. package/dist/stdio/progress.js +13 -8
  253. package/dist/stdio/prompts.d.ts +24 -23
  254. package/dist/stdio/prompts.js +10 -9
  255. package/dist/stdio/stderr.d.ts +51 -39
  256. package/dist/stdio/stderr.js +19 -22
  257. package/dist/stdio/stdout.d.ts +54 -52
  258. package/dist/stdio/stdout.js +35 -33
  259. package/dist/streams.d.ts +4 -3
  260. package/dist/streams.js +1 -0
  261. package/dist/strings.d.ts +31 -85
  262. package/dist/strings.js +5 -49
  263. package/dist/suppress-warnings.d.ts +32 -15
  264. package/dist/suppress-warnings.js +14 -13
  265. package/dist/tables.d.ts +30 -26
  266. package/dist/tables.js +24 -23
  267. package/dist/temporary-executor.d.ts +4 -0
  268. package/dist/temporary-executor.js +1 -0
  269. package/dist/themes/context.d.ts +30 -26
  270. package/dist/themes/context.js +19 -18
  271. package/dist/themes/index.d.ts +0 -4
  272. package/dist/themes/index.js +1 -0
  273. package/dist/themes/themes.d.ts +1 -1
  274. package/dist/themes/themes.js +1 -0
  275. package/dist/themes/types.js +1 -0
  276. package/dist/themes/utils.d.ts +46 -43
  277. package/dist/themes/utils.js +45 -44
  278. package/dist/types.d.ts +48 -52
  279. package/dist/types.js +35 -35
  280. package/dist/url.d.ts +48 -53
  281. package/dist/url.js +38 -37
  282. package/dist/validation/json-parser.d.ts +19 -190
  283. package/dist/validation/json-parser.js +5 -69
  284. package/dist/validation/types.d.ts +9 -33
  285. package/dist/validation/types.js +1 -0
  286. package/dist/versions.d.ts +1 -0
  287. package/dist/versions.js +2 -1
  288. package/dist/words.d.ts +3 -6
  289. package/dist/words.js +1 -0
  290. package/dist/zod.js +1 -0
  291. package/package.json +40 -54
  292. package/dist/functions.d.ts +0 -57
  293. package/dist/functions.js +0 -70
  294. package/dist/stdio/mask.d.ts +0 -151
  295. package/dist/stdio/mask.js +0 -224
  296. package/dist/utils/get-ipc.d.ts +0 -15
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @fileoverview Console divider and separator utilities.
3
+ * Provides various line styles for visual separation in CLI output.
4
+ */
1
5
  export interface DividerOptions {
2
6
  /**
3
7
  * Width of the divider line in characters.
@@ -30,18 +34,6 @@ export interface DividerOptions {
30
34
  * ```
31
35
  */
32
36
  export declare function divider(options?: DividerOptions): string;
33
- /**
34
- * Print a divider line directly to console.
35
- *
36
- * @param options - Divider formatting options
37
- *
38
- * @example
39
- * ```ts
40
- * printDivider() // Prints default divider
41
- * printDivider({ char: '─', width: 60 })
42
- * ```
43
- */
44
- export declare function printDivider(options?: DividerOptions): void;
45
37
  /**
46
38
  * Common divider style presets.
47
39
  * Provides quick access to popular divider styles.
@@ -75,6 +67,42 @@ export declare const dividers: {
75
67
  /** Arrow divider using `→` */
76
68
  readonly arrow: () => string;
77
69
  };
70
+ /**
71
+ * Print a divider line directly to console.
72
+ *
73
+ * @param options - Divider formatting options
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * printDivider() // Prints default divider
78
+ * printDivider({ char: '─', width: 60 })
79
+ * ```
80
+ */
81
+ export declare function printDivider(options?: DividerOptions): void;
82
+ /**
83
+ * Print a dotted divider line.
84
+ * Convenience function using `·` character.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * printDottedDivider()
89
+ * // ·······················································
90
+ * ```
91
+ */
92
+ export declare function printDottedDivider(): void;
93
+ /**
94
+ * Print a section break with spacing directly to console.
95
+ *
96
+ * @param options - Divider formatting options
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * console.log('Previous section')
101
+ * printSectionBreak()
102
+ * console.log('Next section')
103
+ * ```
104
+ */
105
+ export declare function printSectionBreak(options?: DividerOptions): void;
78
106
  /**
79
107
  * Print a thick divider line (default style).
80
108
  * Convenience function using `═` character.
@@ -97,17 +125,6 @@ export declare function printThickDivider(): void;
97
125
  * ```
98
126
  */
99
127
  export declare function printThinDivider(): void;
100
- /**
101
- * Print a dotted divider line.
102
- * Convenience function using `·` character.
103
- *
104
- * @example
105
- * ```ts
106
- * printDottedDivider()
107
- * // ·······················································
108
- * ```
109
- */
110
- export declare function printDottedDivider(): void;
111
128
  /**
112
129
  * Create a section break with blank lines before and after the divider.
113
130
  * Useful for creating visual separation between major sections.
@@ -129,16 +146,3 @@ export declare function printDottedDivider(): void;
129
146
  * ```
130
147
  */
131
148
  export declare function sectionBreak(options?: DividerOptions): string;
132
- /**
133
- * Print a section break with spacing directly to console.
134
- *
135
- * @param options - Divider formatting options
136
- *
137
- * @example
138
- * ```ts
139
- * console.log('Previous section')
140
- * printSectionBreak()
141
- * console.log('Next section')
142
- * ```
143
- */
144
- export declare function printSectionBreak(options?: DividerOptions): void;
@@ -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;
@@ -35,9 +36,6 @@ function divider(options) {
35
36
  const { char = "\u2550", width = 55 } = opts;
36
37
  return (0, import_strings.repeatString)(char, width);
37
38
  }
38
- function printDivider(options) {
39
- console.log(divider(options));
40
- }
41
39
  const dividers = {
42
40
  /** Thick double-line divider using `═` */
43
41
  thick: () => divider({ char: "\u2550" }),
@@ -60,24 +58,27 @@ const dividers = {
60
58
  /** Arrow divider using `→` */
61
59
  arrow: () => divider({ char: "\u2192" })
62
60
  };
61
+ function printDivider(options) {
62
+ console.log(divider(options));
63
+ }
64
+ function printDottedDivider() {
65
+ printDivider({ char: "\xB7" });
66
+ }
67
+ function printSectionBreak(options) {
68
+ console.log(sectionBreak(options));
69
+ }
63
70
  function printThickDivider() {
64
71
  printDivider({ char: "\u2550" });
65
72
  }
66
73
  function printThinDivider() {
67
74
  printDivider({ char: "\u2500" });
68
75
  }
69
- function printDottedDivider() {
70
- printDivider({ char: "\xB7" });
71
- }
72
76
  function sectionBreak(options) {
73
77
  const div = divider(options);
74
78
  return `
75
79
  ${div}
76
80
  `;
77
81
  }
78
- function printSectionBreak(options) {
79
- console.log(sectionBreak(options));
80
- }
81
82
  // Annotate the CommonJS export names for ESM import in node:
82
83
  0 && (module.exports = {
83
84
  divider,
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @fileoverview Console footer/summary formatting utilities.
3
+ * Provides consistent footer and summary formatting for CLI applications.
4
+ */
1
5
  export interface FooterOptions {
2
6
  /**
3
7
  * Width of the footer border in characters.
@@ -90,3 +94,19 @@ export declare function createFooter(message?: string | undefined, options?: Foo
90
94
  * ```
91
95
  */
92
96
  export declare function createSummaryFooter(stats: SummaryStats, options?: FooterOptions): string;
97
+ /**
98
+ * Print a footer with optional success message.
99
+ * Uses `─` border character for a lighter appearance.
100
+ * Fixed width of 55 characters to match `printHeader()`.
101
+ *
102
+ * @param message - Optional message to display (shown in green)
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * printFooter('Analysis complete')
107
+ * // Output:
108
+ * // ───────────────────────────────────────────────────
109
+ * // Analysis complete (in green)
110
+ * ```
111
+ */
112
+ export declare function printFooter(message?: string | undefined): void;
@@ -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;
@@ -30,7 +31,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
31
  var footer_exports = {};
31
32
  __export(footer_exports, {
32
33
  createFooter: () => createFooter,
33
- createSummaryFooter: () => createSummaryFooter
34
+ createSummaryFooter: () => createSummaryFooter,
35
+ printFooter: () => printFooter
34
36
  });
35
37
  module.exports = __toCommonJS(footer_exports);
36
38
  var import_yoctocolors_cjs = __toESM(require("../external/yoctocolors-cjs"));
@@ -89,8 +91,16 @@ function createSummaryFooter(stats, options) {
89
91
  ...stats.duration !== void 0 && { startTime: stats.duration }
90
92
  });
91
93
  }
94
+ function printFooter(message) {
95
+ const border = (0, import_strings.repeatString)("\u2500", 55);
96
+ console.log(border);
97
+ if (message) {
98
+ console.log(import_yoctocolors_cjs.default.green(message));
99
+ }
100
+ }
92
101
  // Annotate the CommonJS export names for ESM import in node:
93
102
  0 && (module.exports = {
94
103
  createFooter,
95
- createSummaryFooter
104
+ createSummaryFooter,
105
+ printFooter
96
106
  });
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @fileoverview Console header/banner formatting utilities.
3
+ * Provides consistent header formatting for CLI applications.
4
+ */
1
5
  export interface HeaderOptions {
2
6
  /**
3
7
  * Width of the header in characters.
@@ -88,19 +92,3 @@ export declare function createSectionHeader(title: string, options?: HeaderOptio
88
92
  * ```
89
93
  */
90
94
  export declare function printHeader(title: string): void;
91
- /**
92
- * Print a footer with optional success message.
93
- * Uses `─` border character for a lighter appearance.
94
- * Fixed width of 55 characters to match `printHeader()`.
95
- *
96
- * @param message - Optional message to display (shown in green)
97
- *
98
- * @example
99
- * ```ts
100
- * printFooter('Analysis complete')
101
- * // Output:
102
- * // ───────────────────────────────────────────────────
103
- * // Analysis complete (in green)
104
- * ```
105
- */
106
- export declare function printFooter(message?: string | undefined): void;
@@ -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;
@@ -31,7 +32,6 @@ var header_exports = {};
31
32
  __export(header_exports, {
32
33
  createHeader: () => createHeader,
33
34
  createSectionHeader: () => createSectionHeader,
34
- printFooter: () => printFooter,
35
35
  printHeader: () => printHeader
36
36
  });
37
37
  module.exports = __toCommonJS(header_exports);
@@ -86,17 +86,9 @@ function printHeader(title) {
86
86
  console.log(` ${title}`);
87
87
  console.log(border);
88
88
  }
89
- function printFooter(message) {
90
- const border = (0, import_strings.repeatString)("\u2500", 55);
91
- console.log(border);
92
- if (message) {
93
- console.log(import_yoctocolors_cjs.default.green(message));
94
- }
95
- }
96
89
  // Annotate the CommonJS export names for ESM import in node:
97
90
  0 && (module.exports = {
98
91
  createHeader,
99
92
  createSectionHeader,
100
- printFooter,
101
93
  printHeader
102
94
  });
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @fileoverview Progress bar utilities for CLI applications.
3
+ * Provides various progress indicators including bars, percentages, and spinners.
4
+ */
1
5
  export interface ProgressBarOptions {
2
6
  /**
3
7
  * Width of the progress bar in characters.
@@ -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;
@@ -97,7 +98,7 @@ class ProgressBar {
97
98
  }
98
99
  this.current = Math.min(current, this.total);
99
100
  const now = Date.now();
100
- if (now - this.lastRender < this.options.renderThrottle && this.current < this.total) {
101
+ if (now - this.lastRender < (this.options.renderThrottle ?? 16) && this.current < this.total) {
101
102
  return;
102
103
  }
103
104
  this.lastRender = now;
@@ -128,17 +129,21 @@ class ProgressBar {
128
129
  * Render the progress bar.
129
130
  */
130
131
  render(tokens) {
131
- const colorFn = import_yoctocolors_cjs.default[this.options.color] || ((s) => s);
132
+ const colorName = this.options.color ?? "cyan";
133
+ const colorFn = import_yoctocolors_cjs.default[colorName] || ((s) => s);
132
134
  const percent = this.total === 0 ? 0 : Math.floor(this.current / this.total * 100);
133
135
  const elapsed = Date.now() - this.startTime;
134
136
  const eta = this.current === 0 ? 0 : elapsed / this.current * (this.total - this.current);
135
- const availableWidth = this.options.width;
136
- const filledWidth = this.total === 0 ? 0 : Math.floor(this.current / this.total * availableWidth);
137
- const emptyWidth = availableWidth - filledWidth;
138
- const filled = (0, import_strings.repeatString)(this.options.complete, filledWidth);
139
- const empty = (0, import_strings.repeatString)(this.options.incomplete, emptyWidth);
137
+ const availableWidth = this.options.width ?? 40;
138
+ const filledWidth = this.total === 0 ? 0 : Math.min(
139
+ availableWidth,
140
+ Math.floor(this.current / this.total * availableWidth)
141
+ );
142
+ const emptyWidth = Math.max(0, availableWidth - filledWidth);
143
+ const filled = (0, import_strings.repeatString)(this.options.complete ?? "\u2588", filledWidth);
144
+ const empty = (0, import_strings.repeatString)(this.options.incomplete ?? "\u2591", emptyWidth);
140
145
  const bar = colorFn(filled) + empty;
141
- let output = this.options.format;
146
+ let output = this.options.format ?? ":bar :percent :current/:total";
142
147
  output = output.replace(":bar", bar);
143
148
  output = output.replace(":percent", `${percent}%`);
144
149
  output = output.replace(":current", String(this.current));
@@ -1,14 +1,16 @@
1
+ /**
2
+ * @fileoverview User prompt utilities for interactive scripts.
3
+ * Provides inquirer.js integration with spinner support, context handling, and theming.
4
+ */
1
5
  import checkboxRaw from '../external/@inquirer/checkbox';
2
6
  import confirmRaw from '../external/@inquirer/confirm';
3
7
  import inputRaw from '../external/@inquirer/input';
4
8
  import passwordRaw from '../external/@inquirer/password';
5
9
  import { type ThemeName } from '../themes/themes';
6
10
  import type { Theme } from '../themes/types';
7
- // Modules imported at the top - extract default and Separator
8
11
  declare const searchRaw: any;
9
12
  declare const selectRaw: any;
10
13
  declare const ActualSeparator: any;
11
- // Type definitions
12
14
  /**
13
15
  * Choice option for select and search prompts.
14
16
  *
@@ -91,6 +93,26 @@ export type Separator = SeparatorType;
91
93
  * ```
92
94
  */
93
95
  export declare function createInquirerTheme(theme: Theme | ThemeName | unknown): Record<string, unknown>;
96
+ /**
97
+ * Create a separator for select prompts.
98
+ * Creates a visual separator line in choice lists.
99
+ *
100
+ * @param text - Optional separator text (defaults to '───────')
101
+ * @returns Separator instance
102
+ *
103
+ * @example
104
+ * import { select, createSeparator } from '@socketsecurity/lib/stdio/prompts'
105
+ *
106
+ * const choice = await select({
107
+ * message: 'Choose an option:',
108
+ * choices: [
109
+ * { name: 'Option 1', value: 1 },
110
+ * createSeparator(),
111
+ * { name: 'Option 2', value: 2 }
112
+ * ]
113
+ * })
114
+ */
115
+ export declare function createSeparator(text?: string): InstanceType<typeof ActualSeparator>;
94
116
  /**
95
117
  * Wrap an inquirer prompt with spinner handling, theme injection, and signal injection.
96
118
  * Automatically stops/starts spinners during prompt display, injects the current theme,
@@ -104,7 +126,6 @@ export declare function createInquirerTheme(theme: Theme | ThemeName | unknown):
104
126
  * const myPrompt = wrapPrompt(rawInquirerPrompt)
105
127
  * const result = await myPrompt({ message: 'Enter name:' })
106
128
  */
107
- /*@__NO_SIDE_EFFECTS__*/
108
129
  export declare function wrapPrompt<T = unknown>(inquirerPrompt: (...args: unknown[]) => Promise<T>): (...args: unknown[]) => Promise<T | undefined>;
109
130
  /**
110
131
  * Prompt to select multiple items from a list of choices.
@@ -173,23 +194,3 @@ export declare const search: typeof searchRaw;
173
194
  */
174
195
  export declare const select: typeof selectRaw;
175
196
  export { ActualSeparator as Separator };
176
- /**
177
- * Create a separator for select prompts.
178
- * Creates a visual separator line in choice lists.
179
- *
180
- * @param text - Optional separator text (defaults to '───────')
181
- * @returns Separator instance
182
- *
183
- * @example
184
- * import { select, createSeparator } from '@socketsecurity/lib/stdio/prompts'
185
- *
186
- * const choice = await select({
187
- * message: 'Choose an option:',
188
- * choices: [
189
- * { name: 'Option 1', value: 1 },
190
- * createSeparator(),
191
- * { name: 'Option 2', value: 2 }
192
- * ]
193
- * })
194
- */
195
- export declare function createSeparator(text?: string): InstanceType<typeof ActualSeparator>;
@@ -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;
@@ -66,12 +67,12 @@ function applyColor(text, color) {
66
67
  const { 0: r, 1: g, 2: b } = color;
67
68
  return `\x1B[38;2;${r};${g};${b}m${text}\x1B[39m`;
68
69
  }
69
- function resolveTheme(theme) {
70
- return typeof theme === "string" ? import_themes.THEMES[theme] : theme;
71
- }
72
70
  function isSocketTheme(value) {
73
71
  return typeof value === "object" && value !== null && "name" in value && "colors" in value;
74
72
  }
73
+ function resolveTheme(theme) {
74
+ return typeof theme === "string" ? import_themes.THEMES[theme] ?? import_themes.THEMES.socket : theme;
75
+ }
75
76
  function createInquirerTheme(theme) {
76
77
  if (typeof theme === "string" || isSocketTheme(theme)) {
77
78
  const socketTheme = resolveTheme(theme);
@@ -113,6 +114,9 @@ function createInquirerTheme(theme) {
113
114
  }
114
115
  return theme;
115
116
  }
117
+ function createSeparator(text) {
118
+ return new ActualSeparator(text);
119
+ }
116
120
  // @__NO_SIDE_EFFECTS__
117
121
  function wrapPrompt(inquirerPrompt) {
118
122
  return async (...args) => {
@@ -122,10 +126,10 @@ function wrapPrompt(inquirerPrompt) {
122
126
  const signal = abortSignal;
123
127
  const config = args[0];
124
128
  if (config && typeof config === "object") {
125
- if (!config.theme) {
126
- config.theme = createInquirerTheme((0, import_context.getTheme)());
129
+ if (!config["theme"]) {
130
+ config["theme"] = createInquirerTheme((0, import_context.getTheme)());
127
131
  } else {
128
- config.theme = createInquirerTheme(config.theme);
132
+ config["theme"] = createInquirerTheme(config["theme"]);
129
133
  }
130
134
  }
131
135
  if (origContext) {
@@ -158,9 +162,6 @@ const input = /* @__PURE__ */ wrapPrompt(import_input.default);
158
162
  const password = /* @__PURE__ */ wrapPrompt(import_password.default);
159
163
  const search = /* @__PURE__ */ wrapPrompt(searchRaw);
160
164
  const select = /* @__PURE__ */ wrapPrompt(selectRaw);
161
- function createSeparator(text) {
162
- return new ActualSeparator(text);
163
- }
164
165
  // Annotate the CommonJS export names for ESM import in node:
165
166
  0 && (module.exports = {
166
167
  Separator,
@@ -2,21 +2,7 @@
2
2
  * @fileoverview Standard error stream utilities.
3
3
  * Provides utilities for writing to stderr with formatting and control.
4
4
  */
5
- // Get the actual stderr stream
6
5
  declare const stderr: NodeJS.WriteStream;
7
- export declare function writeErrorLine(text?: string): void;
8
- /**
9
- * Write text to stderr without adding a newline.
10
- *
11
- * @param text - Text to write
12
- *
13
- * @example
14
- * ```ts
15
- * writeError('Downloading...')
16
- * // Later update progress
17
- * ```
18
- */
19
- export declare function writeError(text: string): void;
20
6
  /**
21
7
  * Clear the current line on stderr.
22
8
  * Only works in TTY environments.
@@ -43,21 +29,6 @@ export declare function clearLine(): void;
43
29
  * ```
44
30
  */
45
31
  export declare function cursorTo(x: number, y?: number | undefined): void;
46
- /**
47
- * Check if stderr is connected to a TTY (terminal).
48
- *
49
- * @returns `true` if stderr is a TTY, `false` if piped/redirected
50
- *
51
- * @example
52
- * ```ts
53
- * if (isTTY()) {
54
- * // Show colored error messages
55
- * } else {
56
- * // Use plain text
57
- * }
58
- * ```
59
- */
60
- export declare function isTTY(): boolean;
61
32
  /**
62
33
  * Get the number of columns (width) in the terminal.
63
34
  *
@@ -85,22 +56,32 @@ export declare function getColumns(): number;
85
56
  */
86
57
  export declare function getRows(): number;
87
58
  /**
88
- * Write a formatted warning message to stderr.
59
+ * Check if stderr is connected to a TTY (terminal).
89
60
  *
90
- * @param message - Warning message text
91
- * @param prefix - Prefix label for the warning
92
- * @default prefix 'Warning'
61
+ * @returns `true` if stderr is a TTY, `false` if piped/redirected
93
62
  *
94
63
  * @example
95
64
  * ```ts
96
- * writeWarning('Deprecated API usage')
97
- * // Output: 'Warning: Deprecated API usage'
65
+ * if (isTTY()) {
66
+ * // Show colored error messages
67
+ * } else {
68
+ * // Use plain text
69
+ * }
70
+ * ```
71
+ */
72
+ export declare function isTTY(): boolean;
73
+ /**
74
+ * Write text to stderr without adding a newline.
98
75
  *
99
- * writeWarning('Invalid config', 'Config')
100
- * // Output: 'Config: Invalid config'
76
+ * @param text - Text to write
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * writeError('Downloading...')
81
+ * // Later update progress
101
82
  * ```
102
83
  */
103
- export declare function writeWarning(message: string, prefix?: string): void;
84
+ export declare function writeError(text: string): void;
104
85
  /**
105
86
  * Write a formatted error message to stderr.
106
87
  *
@@ -118,6 +99,21 @@ export declare function writeWarning(message: string, prefix?: string): void;
118
99
  * ```
119
100
  */
120
101
  export declare function writeErrorFormatted(message: string, prefix?: string): void;
102
+ /**
103
+ * Write a line to stderr with trailing newline.
104
+ * Used for error messages, warnings, and diagnostic output.
105
+ * Passing no argument writes an empty line.
106
+ *
107
+ * @param text - Text to write (defaults to the empty string)
108
+ * @default text ''
109
+ *
110
+ * @example
111
+ * ```ts
112
+ * writeErrorLine('Error: File not found')
113
+ * writeErrorLine() // Write empty line
114
+ * ```
115
+ */
116
+ export declare function writeErrorLine(text?: string): void;
121
117
  /**
122
118
  * Write an error's stack trace to stderr.
123
119
  * Falls back to formatted error message if no stack is available.
@@ -134,5 +130,21 @@ export declare function writeErrorFormatted(message: string, prefix?: string): v
134
130
  * ```
135
131
  */
136
132
  export declare function writeStackTrace(error: Error): void;
137
- // Export the raw stream for advanced usage
133
+ /**
134
+ * Write a formatted warning message to stderr.
135
+ *
136
+ * @param message - Warning message text
137
+ * @param prefix - Prefix label for the warning
138
+ * @default prefix 'Warning'
139
+ *
140
+ * @example
141
+ * ```ts
142
+ * writeWarning('Deprecated API usage')
143
+ * // Output: 'Warning: Deprecated API usage'
144
+ *
145
+ * writeWarning('Invalid config', 'Config')
146
+ * // Output: 'Config: Invalid config'
147
+ * ```
148
+ */
149
+ export declare function writeWarning(message: string, prefix?: string): void;
138
150
  export { stderr };
@@ -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;
@@ -43,42 +44,34 @@ __export(stderr_exports, {
43
44
  });
44
45
  module.exports = __toCommonJS(stderr_exports);
45
46
  var import_node_process = __toESM(require("node:process"));
47
+ var import_stream = require("./_stream");
46
48
  const stderr = import_node_process.default.stderr;
47
- function writeErrorLine(text = "") {
48
- stderr.write(`${text}
49
- `);
50
- }
51
- function writeError(text) {
52
- stderr.write(text);
53
- }
54
49
  function clearLine() {
55
- if (stderr.isTTY) {
56
- stderr.cursorTo(0);
57
- stderr.clearLine(0);
58
- }
50
+ (0, import_stream.clearLineOn)(stderr);
59
51
  }
60
52
  function cursorTo(x, y) {
61
- if (stderr.isTTY) {
62
- stderr.cursorTo(x, y);
63
- }
64
- }
65
- function isTTY() {
66
- return stderr.isTTY || false;
53
+ (0, import_stream.cursorToOn)(stderr, x, y);
67
54
  }
68
55
  function getColumns() {
69
- return stderr.columns || 80;
56
+ return (0, import_stream.getColumnsOf)(stderr);
70
57
  }
71
58
  function getRows() {
72
- return stderr.rows || 24;
59
+ return (0, import_stream.getRowsOf)(stderr);
73
60
  }
74
- function writeWarning(message, prefix = "Warning") {
75
- const formatted = `${prefix}: ${message}`;
76
- writeErrorLine(formatted);
61
+ function isTTY() {
62
+ return (0, import_stream.isTTYOf)(stderr);
63
+ }
64
+ function writeError(text) {
65
+ stderr.write(text);
77
66
  }
78
67
  function writeErrorFormatted(message, prefix = "Error") {
79
68
  const formatted = `${prefix}: ${message}`;
80
69
  writeErrorLine(formatted);
81
70
  }
71
+ function writeErrorLine(text = "") {
72
+ stderr.write(`${text}
73
+ `);
74
+ }
82
75
  function writeStackTrace(error) {
83
76
  if (error.stack) {
84
77
  writeErrorLine(error.stack);
@@ -86,6 +79,10 @@ function writeStackTrace(error) {
86
79
  writeErrorFormatted(error.message);
87
80
  }
88
81
  }
82
+ function writeWarning(message, prefix = "Warning") {
83
+ const formatted = `${prefix}: ${message}`;
84
+ writeErrorLine(formatted);
85
+ }
89
86
  // Annotate the CommonJS export names for ESM import in node:
90
87
  0 && (module.exports = {
91
88
  clearLine,