@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,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;
package/dist/strings.d.ts CHANGED
@@ -3,12 +3,7 @@
3
3
  * Provides string processing, prefix application, and terminal output utilities.
4
4
  */
5
5
  import { ansiRegex, stripAnsi } from './ansi';
6
- // Import get-east-asian-width from external wrapper.
7
- // This library implements Unicode Standard Annex #11 (East Asian Width).
8
- // https://www.unicode.org/reports/tr11/
9
- // Re-export ANSI utilities for backward compatibility.
10
6
  export { ansiRegex, stripAnsi };
11
- // Type definitions
12
7
  declare const BlankStringBrand: unique symbol;
13
8
  export type BlankString = string & {
14
9
  [BlankStringBrand]: true;
@@ -17,10 +12,6 @@ declare const EmptyStringBrand: unique symbol;
17
12
  export type EmptyString = string & {
18
13
  [EmptyStringBrand]: true;
19
14
  };
20
- // IMPORTANT: Do not use destructuring here - use direct assignment instead.
21
- // tsgo has a bug that incorrectly transpiles destructured exports, resulting in
22
- // `exports.SomeName = void 0;` which causes runtime errors.
23
- // See: https://github.com/SocketDev/socket-packageurl-js/issues/3
24
15
  export declare const fromCharCode: (...codes: number[]) => string;
25
16
  export interface ApplyLinePrefixOptions {
26
17
  /**
@@ -52,39 +43,7 @@ export interface ApplyLinePrefixOptions {
52
43
  * // Returns: 'no prefix'
53
44
  * ```
54
45
  */
55
- /*@__NO_SIDE_EFFECTS__*/
56
46
  export declare function applyLinePrefix(str: string, options?: ApplyLinePrefixOptions | undefined): string;
57
- /**
58
- * Convert a camelCase string to kebab-case.
59
- *
60
- * Transforms camelCase strings by converting uppercase letters to lowercase
61
- * and inserting hyphens before uppercase sequences. Handles consecutive
62
- * uppercase letters (like "XMLHttpRequest") by treating them as a single word.
63
- * Returns empty string for empty input.
64
- *
65
- * Note: This function only handles camelCase. For mixed formats including
66
- * snake_case, use `toKebabCase()` instead.
67
- *
68
- * @param str - The camelCase string to convert
69
- * @returns The kebab-case string
70
- *
71
- * @example
72
- * ```ts
73
- * camelToKebab('helloWorld')
74
- * // Returns: 'hello-world'
75
- *
76
- * camelToKebab('XMLHttpRequest')
77
- * // Returns: 'xmlhttprequest'
78
- *
79
- * camelToKebab('iOS')
80
- * // Returns: 'ios'
81
- *
82
- * camelToKebab('')
83
- * // Returns: ''
84
- * ```
85
- */
86
- /*@__NO_SIDE_EFFECTS__*/
87
- export declare function camelToKebab(str: string): string;
88
47
  /**
89
48
  * Center text within a given width.
90
49
  *
@@ -118,7 +77,6 @@ export declare function camelToKebab(str: string): string;
118
77
  * // Returns: 'too long text' (no truncation, returned as-is)
119
78
  * ```
120
79
  */
121
- /*@__NO_SIDE_EFFECTS__*/
122
80
  export declare function centerText(text: string, width: number): string;
123
81
  export interface IndentStringOptions {
124
82
  /**
@@ -150,7 +108,6 @@ export interface IndentStringOptions {
150
108
  * // Returns: ' single line' (default: 1 space)
151
109
  * ```
152
110
  */
153
- /*@__NO_SIDE_EFFECTS__*/
154
111
  export declare function indentString(str: string, options?: IndentStringOptions | undefined): string;
155
112
  /**
156
113
  * Check if a value is a blank string (empty or only whitespace).
@@ -183,7 +140,6 @@ export declare function indentString(str: string, options?: IndentStringOptions
183
140
  * // Returns: false
184
141
  * ```
185
142
  */
186
- /*@__NO_SIDE_EFFECTS__*/
187
143
  export declare function isBlankString(value: unknown): value is BlankString;
188
144
  /**
189
145
  * Check if a value is a non-empty string.
@@ -214,7 +170,6 @@ export declare function isBlankString(value: unknown): value is BlankString;
214
170
  * // Returns: false
215
171
  * ```
216
172
  */
217
- /*@__NO_SIDE_EFFECTS__*/
218
173
  export declare function isNonEmptyString(value: unknown): value is Exclude<string, EmptyString>;
219
174
  /**
220
175
  * Repeat a string a specified number of times.
@@ -241,7 +196,6 @@ export declare function isNonEmptyString(value: unknown): value is Exclude<strin
241
196
  * // Returns: ''
242
197
  * ```
243
198
  */
244
- /*@__NO_SIDE_EFFECTS__*/
245
199
  export declare function repeatString(str: string, count: number): string;
246
200
  export interface SearchOptions {
247
201
  /**
@@ -283,38 +237,7 @@ export interface SearchOptions {
283
237
  * // Returns: -1 (starts searching from 'world', no match)
284
238
  * ```
285
239
  */
286
- /*@__NO_SIDE_EFFECTS__*/
287
240
  export declare function search(str: string, regexp: RegExp, options?: SearchOptions | undefined): number;
288
- /**
289
- * Strip the Byte Order Mark (BOM) from the beginning of a string.
290
- *
291
- * The BOM (U+FEFF) is a Unicode character that can appear at the start of
292
- * a text file to indicate byte order and encoding. In UTF-16 (JavaScript's
293
- * internal string representation), it appears as 0xFEFF. This function
294
- * removes it if present, leaving the rest of the string unchanged.
295
- *
296
- * Most text processing doesn't need to handle the BOM explicitly, but it
297
- * can cause issues when parsing JSON, CSV, or other structured data formats
298
- * that don't expect a leading invisible character.
299
- *
300
- * @param str - The string to strip BOM from
301
- * @returns The string without BOM
302
- *
303
- * @example
304
- * ```ts
305
- * stripBom('\uFEFFhello world')
306
- * // Returns: 'hello world'
307
- *
308
- * stripBom('hello world')
309
- * // Returns: 'hello world' (no BOM to strip)
310
- *
311
- * stripBom('')
312
- * // Returns: ''
313
- * ```
314
- */
315
- /*@__NO_SIDE_EFFECTS__*/
316
- export declare function stripBom(str: string): string;
317
- /* c8 ignore stop */
318
241
  /**
319
242
  * Get the visual width of a string in terminal columns.
320
243
  *
@@ -392,11 +315,36 @@ export declare function stripBom(str: string): string;
392
315
  * stringWidth('')
393
316
  * // Returns: 0
394
317
  * ```
395
- *
396
- * @throws {TypeError} When input is not a string
397
318
  */
398
- /*@__NO_SIDE_EFFECTS__*/
399
319
  export declare function stringWidth(text: string): number;
320
+ /**
321
+ * Strip the Byte Order Mark (BOM) from the beginning of a string.
322
+ *
323
+ * The BOM (U+FEFF) is a Unicode character that can appear at the start of
324
+ * a text file to indicate byte order and encoding. In UTF-16 (JavaScript's
325
+ * internal string representation), it appears as 0xFEFF. This function
326
+ * removes it if present, leaving the rest of the string unchanged.
327
+ *
328
+ * Most text processing doesn't need to handle the BOM explicitly, but it
329
+ * can cause issues when parsing JSON, CSV, or other structured data formats
330
+ * that don't expect a leading invisible character.
331
+ *
332
+ * @param str - The string to strip BOM from
333
+ * @returns The string without BOM
334
+ *
335
+ * @example
336
+ * ```ts
337
+ * stripBom('\uFEFFhello world')
338
+ * // Returns: 'hello world'
339
+ *
340
+ * stripBom('hello world')
341
+ * // Returns: 'hello world' (no BOM to strip)
342
+ *
343
+ * stripBom('')
344
+ * // Returns: ''
345
+ * ```
346
+ */
347
+ export declare function stripBom(str: string): string;
400
348
  /**
401
349
  * Convert a string to kebab-case (handles camelCase and snake_case).
402
350
  *
@@ -405,8 +353,8 @@ export declare function stringWidth(text: string): number;
405
353
  * - Inserting hyphens before uppercase letters (for camelCase)
406
354
  * - Replacing underscores with hyphens (for snake_case)
407
355
  *
408
- * This is more comprehensive than `camelToKebab()` as it handles mixed
409
- * formats including snake_case. Returns empty string for empty input.
356
+ * Handles mixed formats (camelCase, snake_case, acronyms) in one pass.
357
+ * Returns empty string for empty input.
410
358
  *
411
359
  * @param str - The string to convert
412
360
  * @returns The kebab-case string
@@ -423,13 +371,12 @@ export declare function stringWidth(text: string): number;
423
371
  * // Returns: 'xmlhttp-request'
424
372
  *
425
373
  * toKebabCase('iOS_Version')
426
- * // Returns: 'io-s-version'
374
+ * // Returns: 'i-os-version'
427
375
  *
428
376
  * toKebabCase('')
429
377
  * // Returns: ''
430
378
  * ```
431
379
  */
432
- /*@__NO_SIDE_EFFECTS__*/
433
380
  export declare function toKebabCase(str: string): string;
434
381
  /**
435
382
  * Trim newlines from the beginning and end of a string.
@@ -464,5 +411,4 @@ export declare function toKebabCase(str: string): string;
464
411
  * // Returns: 'hello'
465
412
  * ```
466
413
  */
467
- /*@__NO_SIDE_EFFECTS__*/
468
414
  export declare function trimNewlines(str: string): string;
package/dist/strings.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;
@@ -21,7 +22,6 @@ var strings_exports = {};
21
22
  __export(strings_exports, {
22
23
  ansiRegex: () => import_ansi.ansiRegex,
23
24
  applyLinePrefix: () => applyLinePrefix,
24
- camelToKebab: () => camelToKebab,
25
25
  centerText: () => centerText,
26
26
  fromCharCode: () => fromCharCode,
27
27
  indentString: () => indentString,
@@ -56,49 +56,6 @@ function applyLinePrefix(str, options) {
56
56
  ${prefix}`) : str}` : str;
57
57
  }
58
58
  // @__NO_SIDE_EFFECTS__
59
- function camelToKebab(str) {
60
- const { length } = str;
61
- if (!length) {
62
- return "";
63
- }
64
- let result = "";
65
- let i = 0;
66
- while (i < length) {
67
- const char = str[i];
68
- if (!char) {
69
- break;
70
- }
71
- const charCode = char.charCodeAt(0);
72
- const isUpperCase = charCode >= 65 && charCode <= 90;
73
- if (isUpperCase) {
74
- if (result.length > 0) {
75
- result += "-";
76
- }
77
- while (i < length) {
78
- const currChar = str[i];
79
- if (!currChar) {
80
- break;
81
- }
82
- const currCharCode = currChar.charCodeAt(0);
83
- const isCurrUpper = currCharCode >= 65 && currCharCode <= 90;
84
- if (isCurrUpper) {
85
- result += fromCharCode(
86
- currCharCode + 32
87
- /*'a'-'A'*/
88
- );
89
- i += 1;
90
- } else {
91
- break;
92
- }
93
- }
94
- } else {
95
- result += char;
96
- i += 1;
97
- }
98
- }
99
- return result;
100
- }
101
- // @__NO_SIDE_EFFECTS__
102
59
  function centerText(text, width) {
103
60
  const textLength = (0, import_ansi.stripAnsi)(text).length;
104
61
  if (textLength >= width) {
@@ -143,10 +100,6 @@ function search(str, regexp, options) {
143
100
  const result = str.slice(offset).search(regexp);
144
101
  return result === -1 ? -1 : result + offset;
145
102
  }
146
- // @__NO_SIDE_EFFECTS__
147
- function stripBom(str) {
148
- return str.length > 0 && str.charCodeAt(0) === 65279 ? str.slice(1) : str;
149
- }
150
103
  const segmenter = new Intl.Segmenter();
151
104
  let zeroWidthClusterRegex;
152
105
  let leadingNonPrintingRegex;
@@ -201,6 +154,10 @@ function stringWidth(text) {
201
154
  return width;
202
155
  }
203
156
  // @__NO_SIDE_EFFECTS__
157
+ function stripBom(str) {
158
+ return str.length > 0 && str.charCodeAt(0) === 65279 ? str.slice(1) : str;
159
+ }
160
+ // @__NO_SIDE_EFFECTS__
204
161
  function toKebabCase(str) {
205
162
  if (!str.length) {
206
163
  return str;
@@ -245,7 +202,6 @@ function trimNewlines(str) {
245
202
  0 && (module.exports = {
246
203
  ansiRegex,
247
204
  applyLinePrefix,
248
- camelToKebab,
249
205
  centerText,
250
206
  fromCharCode,
251
207
  indentString,
@@ -1,15 +1,18 @@
1
- export declare function suppressMaxListenersWarning(): void;
2
1
  /**
3
- * Suppress all process warnings of a specific type.
4
- *
5
- * @param warningType - The warning type to suppress (e.g., 'DeprecationWarning', 'ExperimentalWarning')
2
+ * @fileoverview Utilities to suppress specific process warnings.
3
+ */
4
+ /**
5
+ * Restore the original process.emitWarning function.
6
+ * Call this to re-enable all warnings after suppressing them.
6
7
  *
7
8
  * @example
8
- * import { suppressWarningType } from '@socketsecurity/lib/suppress-warnings'
9
- *
10
- * suppressWarningType('ExperimentalWarning')
9
+ * ```typescript
10
+ * suppressMaxListenersWarning()
11
+ * // ... do work ...
12
+ * restoreWarnings() // Re-enable all warnings
13
+ * ```
11
14
  */
12
- export declare function suppressWarningType(warningType: string): void;
15
+ export declare function restoreWarnings(): void;
13
16
  /**
14
17
  * Set max listeners on an EventTarget (like AbortSignal) to avoid TypeError.
15
18
  *
@@ -35,17 +38,31 @@ export declare function suppressWarningType(warningType: string): void;
35
38
  */
36
39
  export declare function setMaxEventTargetListeners(target: EventTarget | AbortSignal | undefined, maxListeners?: number): void;
37
40
  /**
38
- * Restore the original process.emitWarning function.
39
- * Call this to re-enable all warnings after suppressing them.
41
+ * Suppress MaxListenersExceededWarning messages.
42
+ * This is useful in tests or scripts where multiple listeners are expected.
40
43
  *
41
44
  * @example
42
- * ```typescript
45
+ * import { suppressMaxListenersWarning } from '@socketsecurity/lib/suppress-warnings'
46
+ *
43
47
  * suppressMaxListenersWarning()
44
- * // ... do work ...
45
- * restoreWarnings() // Re-enable all warnings
46
- * ```
47
48
  */
48
- export declare function restoreWarnings(): void;
49
+ /**
50
+ * Silence `MaxListenersExceededWarning` messages from `process.emitWarning`.
51
+ * Installs a single shared wrapper around `process.emitWarning` on first call
52
+ * so repeat invocations are cheap.
53
+ */
54
+ export declare function suppressMaxListenersWarning(): void;
55
+ /**
56
+ * Suppress all process warnings of a specific type.
57
+ *
58
+ * @param warningType - The warning type to suppress (e.g., 'DeprecationWarning', 'ExperimentalWarning')
59
+ *
60
+ * @example
61
+ * import { suppressWarningType } from '@socketsecurity/lib/suppress-warnings'
62
+ *
63
+ * suppressWarningType('ExperimentalWarning')
64
+ */
65
+ export declare function suppressWarningType(warningType: string): void;
49
66
  /**
50
67
  * Suppress warnings temporarily within a callback.
51
68
  *