@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,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
  });
@@ -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,
@@ -1,42 +1,31 @@
1
- // Get the actual stdout stream
2
- declare const stdout: NodeJS.WriteStream;
3
1
  /**
4
- * Write a line to stdout with trailing newline.
5
- *
6
- * @param text - Text to write
7
- * @default text ''
8
- *
9
- * @example
10
- * ```ts
11
- * writeLine('Hello, world!')
12
- * writeLine() // Write empty line
13
- * ```
2
+ * @fileoverview Standard output stream utilities.
3
+ * Provides utilities for writing to stdout with formatting and control.
14
4
  */
15
- export declare function writeLine(text?: string): void;
5
+ declare const stdout: NodeJS.WriteStream;
16
6
  /**
17
- * Write text to stdout without adding a newline.
18
- *
19
- * @param text - Text to write
7
+ * Clear the current line on stdout.
8
+ * Only works in TTY environments.
20
9
  *
21
10
  * @example
22
11
  * ```ts
23
- * write('Loading...')
24
- * // Later: clear and update
12
+ * write('Processing...')
13
+ * clearLine()
14
+ * write('Done!')
25
15
  * ```
26
16
  */
27
- export declare function write(text: string): void;
17
+ export declare function clearLine(): void;
28
18
  /**
29
- * Clear the current line on stdout.
19
+ * Clear screen from cursor position down to bottom.
30
20
  * Only works in TTY environments.
31
21
  *
32
22
  * @example
33
23
  * ```ts
34
- * write('Processing...')
35
- * clearLine()
36
- * write('Done!')
24
+ * cursorTo(0, 5)
25
+ * clearScreenDown() // Clear from row 5 to bottom
37
26
  * ```
38
27
  */
39
- export declare function clearLine(): void;
28
+ export declare function clearScreenDown(): void;
40
29
  /**
41
30
  * Move cursor to specific position on stdout.
42
31
  * Only works in TTY environments.
@@ -52,31 +41,18 @@ export declare function clearLine(): void;
52
41
  */
53
42
  export declare function cursorTo(x: number, y?: number | undefined): void;
54
43
  /**
55
- * Clear screen from cursor position down to bottom.
56
- * Only works in TTY environments.
57
- *
58
- * @example
59
- * ```ts
60
- * cursorTo(0, 5)
61
- * clearScreenDown() // Clear from row 5 to bottom
62
- * ```
63
- */
64
- export declare function clearScreenDown(): void;
65
- /**
66
- * Check if stdout is connected to a TTY (terminal).
67
- *
68
- * @returns `true` if stdout is a TTY, `false` if piped/redirected
44
+ * Register handlers to ensure cursor is shown on process exit.
45
+ * Prevents hidden cursor after abnormal termination.
46
+ * Handles SIGINT (Ctrl+C) and SIGTERM signals.
69
47
  *
70
48
  * @example
71
49
  * ```ts
72
- * if (isTTY()) {
73
- * // Show interactive UI
74
- * } else {
75
- * // Use simple text output
76
- * }
50
+ * ensureCursorOnExit()
51
+ * hideCursor()
52
+ * // Even if process crashes, cursor will be restored
77
53
  * ```
78
54
  */
79
- export declare function isTTY(): boolean;
55
+ export declare function ensureCursorOnExit(): void;
80
56
  /**
81
57
  * Get the number of columns (width) in the terminal.
82
58
  *
@@ -115,6 +91,21 @@ export declare function getRows(): number;
115
91
  * ```
116
92
  */
117
93
  export declare function hideCursor(): void;
94
+ /**
95
+ * Check if stdout is connected to a TTY (terminal).
96
+ *
97
+ * @returns `true` if stdout is a TTY, `false` if piped/redirected
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * if (isTTY()) {
102
+ * // Show interactive UI
103
+ * } else {
104
+ * // Use simple text output
105
+ * }
106
+ * ```
107
+ */
108
+ export declare function isTTY(): boolean;
118
109
  /**
119
110
  * Show the cursor on stdout.
120
111
  * Should be called after `hideCursor()`.
@@ -128,17 +119,28 @@ export declare function hideCursor(): void;
128
119
  */
129
120
  export declare function showCursor(): void;
130
121
  /**
131
- * Register handlers to ensure cursor is shown on process exit.
132
- * Prevents hidden cursor after abnormal termination.
133
- * Handles SIGINT (Ctrl+C) and SIGTERM signals.
122
+ * Write text to stdout without adding a newline.
123
+ *
124
+ * @param text - Text to write
134
125
  *
135
126
  * @example
136
127
  * ```ts
137
- * ensureCursorOnExit()
138
- * hideCursor()
139
- * // Even if process crashes, cursor will be restored
128
+ * write('Loading...')
129
+ * // Later: clear and update
140
130
  * ```
141
131
  */
142
- export declare function ensureCursorOnExit(): void;
143
- // Export the raw stream for advanced usage
132
+ export declare function write(text: string): void;
133
+ /**
134
+ * Write a line to stdout with trailing newline.
135
+ *
136
+ * @param text - Text to write
137
+ * @default text ''
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * writeLine('Hello, world!')
142
+ * writeLine() // Write empty line
143
+ * ```
144
+ */
145
+ export declare function writeLine(text?: string): void;
144
146
  export { stdout };
@@ -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;
@@ -44,60 +45,61 @@ __export(stdout_exports, {
44
45
  });
45
46
  module.exports = __toCommonJS(stdout_exports);
46
47
  var import_node_process = __toESM(require("node:process"));
47
- var import_tty = require("tty");
48
+ var import_node_tty = require("node:tty");
49
+ var import_stream = require("./_stream");
48
50
  const stdout = import_node_process.default.stdout;
49
- function writeLine(text = "") {
50
- stdout.write(`${text}
51
- `);
52
- }
53
- function write(text) {
54
- stdout.write(text);
55
- }
51
+ let _cursorExitRegistered = false;
56
52
  function clearLine() {
57
- if (stdout.isTTY) {
58
- stdout.cursorTo(0);
59
- stdout.clearLine(0);
60
- }
61
- }
62
- function cursorTo(x, y) {
63
- if (stdout.isTTY) {
64
- stdout.cursorTo(x, y);
65
- }
53
+ (0, import_stream.clearLineOn)(stdout);
66
54
  }
67
55
  function clearScreenDown() {
68
56
  if (stdout.isTTY) {
69
57
  stdout.clearScreenDown();
70
58
  }
71
59
  }
72
- function isTTY() {
73
- return stdout.isTTY || false;
60
+ function cursorTo(x, y) {
61
+ (0, import_stream.cursorToOn)(stdout, x, y);
62
+ }
63
+ function ensureCursorOnExit() {
64
+ if (_cursorExitRegistered) {
65
+ return;
66
+ }
67
+ _cursorExitRegistered = true;
68
+ import_node_process.default.on("exit", showCursor);
69
+ import_node_process.default.on("SIGINT", () => {
70
+ showCursor();
71
+ import_node_process.default.exit(130);
72
+ });
73
+ import_node_process.default.on("SIGTERM", () => {
74
+ showCursor();
75
+ import_node_process.default.exit(143);
76
+ });
74
77
  }
75
78
  function getColumns() {
76
- return stdout.columns || 80;
79
+ return (0, import_stream.getColumnsOf)(stdout);
77
80
  }
78
81
  function getRows() {
79
- return stdout.rows || 24;
82
+ return (0, import_stream.getRowsOf)(stdout);
80
83
  }
81
84
  function hideCursor() {
82
- if (stdout.isTTY && stdout instanceof import_tty.WriteStream) {
85
+ if (stdout.isTTY && stdout instanceof import_node_tty.WriteStream) {
83
86
  stdout.write("\x1B[?25l");
84
87
  }
85
88
  }
89
+ function isTTY() {
90
+ return (0, import_stream.isTTYOf)(stdout);
91
+ }
86
92
  function showCursor() {
87
- if (stdout.isTTY && stdout instanceof import_tty.WriteStream) {
93
+ if (stdout.isTTY && stdout instanceof import_node_tty.WriteStream) {
88
94
  stdout.write("\x1B[?25h");
89
95
  }
90
96
  }
91
- function ensureCursorOnExit() {
92
- import_node_process.default.on("exit", showCursor);
93
- import_node_process.default.on("SIGINT", () => {
94
- showCursor();
95
- import_node_process.default.exit(130);
96
- });
97
- import_node_process.default.on("SIGTERM", () => {
98
- showCursor();
99
- import_node_process.default.exit(143);
100
- });
97
+ function write(text) {
98
+ stdout.write(text);
99
+ }
100
+ function writeLine(text = "") {
101
+ stdout.write(`${text}
102
+ `);
101
103
  }
102
104
  // Annotate the CommonJS export names for ESM import in node:
103
105
  0 && (module.exports = {
package/dist/streams.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @fileoverview Stream processing utilities with streaming-iterables integration.
3
+ * Provides async stream handling and transformation functions.
4
+ */
1
5
  import type { IterationOptions } from './promises';
2
6
  /**
3
7
  * Execute a function for each item in an iterable in parallel.
@@ -10,7 +14,6 @@ import type { IterationOptions } from './promises';
10
14
  * }, { concurrency: 4 })
11
15
  * ```
12
16
  */
13
- /*@__NO_SIDE_EFFECTS__*/
14
17
  export declare function parallelEach<T>(iterable: Iterable<T> | AsyncIterable<T>, func: (item: T) => Promise<unknown>, options?: number | IterationOptions): Promise<void>;
15
18
  /**
16
19
  * Map over an iterable in parallel with concurrency control.
@@ -25,7 +28,6 @@ export declare function parallelEach<T>(iterable: Iterable<T> | AsyncIterable<T>
25
28
  * }
26
29
  * ```
27
30
  */
28
- /*@__NO_SIDE_EFFECTS__*/
29
31
  export declare function parallelMap<T, U>(iterable: Iterable<T> | AsyncIterable<T>, func: (item: T) => Promise<U>, options?: number | IterationOptions): AsyncIterable<U>;
30
32
  /**
31
33
  * Transform an iterable with a function.
@@ -40,5 +42,4 @@ export declare function parallelMap<T, U>(iterable: Iterable<T> | AsyncIterable<
40
42
  * }
41
43
  * ```
42
44
  */
43
- /*@__NO_SIDE_EFFECTS__*/
44
45
  export declare function transform<T, U>(iterable: Iterable<T> | AsyncIterable<T>, func: (item: T) => Promise<U>, options?: number | IterationOptions): AsyncIterable<U>;
package/dist/streams.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;