@socketsecurity/lib 3.0.2 → 3.0.4

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 (261) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/dist/abort.js +60 -1
  3. package/dist/abort.js.map +2 -2
  4. package/dist/agent.js +289 -1
  5. package/dist/agent.js.map +2 -2
  6. package/dist/ansi.js +60 -1
  7. package/dist/ansi.js.map +2 -2
  8. package/dist/argv/flags.js +282 -1
  9. package/dist/argv/flags.js.map +2 -2
  10. package/dist/argv/parse.js +171 -1
  11. package/dist/argv/parse.js.map +2 -2
  12. package/dist/arrays.js +85 -1
  13. package/dist/arrays.js.map +2 -2
  14. package/dist/bin.js +419 -5
  15. package/dist/bin.js.map +2 -2
  16. package/dist/cacache.js +139 -1
  17. package/dist/cacache.js.map +2 -2
  18. package/dist/cache-with-ttl.js +223 -1
  19. package/dist/cache-with-ttl.js.map +2 -2
  20. package/dist/constants/agents.js +126 -1
  21. package/dist/constants/agents.js.map +2 -2
  22. package/dist/constants/core.js +57 -2
  23. package/dist/constants/core.js.map +2 -2
  24. package/dist/constants/encoding.js +48 -1
  25. package/dist/constants/encoding.js.map +2 -2
  26. package/dist/constants/github.js +30 -1
  27. package/dist/constants/github.js.map +2 -2
  28. package/dist/constants/licenses.js +66 -1
  29. package/dist/constants/licenses.js.map +2 -2
  30. package/dist/constants/node.js +185 -1
  31. package/dist/constants/node.js.map +2 -2
  32. package/dist/constants/packages.js +128 -1
  33. package/dist/constants/packages.js.map +2 -2
  34. package/dist/constants/paths.js +150 -1
  35. package/dist/constants/paths.js.map +2 -2
  36. package/dist/constants/platform.js +41 -1
  37. package/dist/constants/platform.js.map +2 -2
  38. package/dist/constants/process.js +52 -1
  39. package/dist/constants/process.js.map +2 -2
  40. package/dist/constants/socket.js +102 -1
  41. package/dist/constants/socket.js.map +2 -2
  42. package/dist/constants/testing.js +36 -1
  43. package/dist/constants/testing.js.map +2 -2
  44. package/dist/constants/time.js +39 -1
  45. package/dist/constants/time.js.map +2 -2
  46. package/dist/constants/typescript.js +54 -1
  47. package/dist/constants/typescript.js.map +2 -2
  48. package/dist/cover/code.js +135 -1
  49. package/dist/cover/code.js.map +2 -2
  50. package/dist/cover/formatters.js +101 -11
  51. package/dist/cover/formatters.js.map +2 -2
  52. package/dist/cover/type.js +63 -1
  53. package/dist/cover/type.js.map +2 -2
  54. package/dist/cover/types.js +15 -1
  55. package/dist/cover/types.js.map +2 -2
  56. package/dist/debug.js +337 -2
  57. package/dist/debug.js.map +2 -2
  58. package/dist/dlx-binary.js +408 -7
  59. package/dist/dlx-binary.js.map +2 -2
  60. package/dist/dlx-package.js +278 -7
  61. package/dist/dlx-package.js.map +2 -2
  62. package/dist/dlx.js +214 -7
  63. package/dist/dlx.js.map +3 -3
  64. package/dist/effects/pulse-frames.js +64 -1
  65. package/dist/effects/pulse-frames.js.map +2 -2
  66. package/dist/effects/text-shimmer.js +174 -1
  67. package/dist/effects/text-shimmer.js.map +2 -2
  68. package/dist/effects/types.js +15 -1
  69. package/dist/effects/types.js.map +2 -2
  70. package/dist/effects/ultra.js +61 -1
  71. package/dist/effects/ultra.js.map +2 -2
  72. package/dist/env/ci.js +31 -1
  73. package/dist/env/ci.js.map +2 -2
  74. package/dist/env/debug.js +30 -1
  75. package/dist/env/debug.js.map +2 -2
  76. package/dist/env/github.js +65 -1
  77. package/dist/env/github.js.map +2 -2
  78. package/dist/env/helpers.js +47 -1
  79. package/dist/env/helpers.js.map +2 -2
  80. package/dist/env/home.js +30 -1
  81. package/dist/env/home.js.map +2 -2
  82. package/dist/env/locale.js +40 -1
  83. package/dist/env/locale.js.map +2 -2
  84. package/dist/env/node-auth-token.js +30 -1
  85. package/dist/env/node-auth-token.js.map +2 -2
  86. package/dist/env/node-env.js +30 -1
  87. package/dist/env/node-env.js.map +2 -2
  88. package/dist/env/npm.js +50 -1
  89. package/dist/env/npm.js.map +2 -2
  90. package/dist/env/package-manager.js +73 -1
  91. package/dist/env/package-manager.js.map +2 -2
  92. package/dist/env/path.js +30 -1
  93. package/dist/env/path.js.map +2 -2
  94. package/dist/env/pre-commit.js +31 -1
  95. package/dist/env/pre-commit.js.map +2 -2
  96. package/dist/env/rewire.js +72 -1
  97. package/dist/env/rewire.js.map +2 -2
  98. package/dist/env/shell.js +30 -1
  99. package/dist/env/shell.js.map +2 -2
  100. package/dist/env/socket-cli-shadow.js +51 -1
  101. package/dist/env/socket-cli-shadow.js.map +2 -2
  102. package/dist/env/socket-cli.js +86 -1
  103. package/dist/env/socket-cli.js.map +2 -2
  104. package/dist/env/socket.js +101 -1
  105. package/dist/env/socket.js.map +2 -2
  106. package/dist/env/temp-dir.js +40 -1
  107. package/dist/env/temp-dir.js.map +2 -2
  108. package/dist/env/term.js +30 -1
  109. package/dist/env/term.js.map +2 -2
  110. package/dist/env/test.js +43 -1
  111. package/dist/env/test.js.map +2 -2
  112. package/dist/env/windows.js +45 -1
  113. package/dist/env/windows.js.map +2 -2
  114. package/dist/env/xdg.js +40 -1
  115. package/dist/env/xdg.js.map +2 -2
  116. package/dist/env.js +170 -1
  117. package/dist/env.js.map +2 -2
  118. package/dist/external/@socketregistry/packageurl-js.js +12 -2
  119. package/dist/fs.js +670 -7
  120. package/dist/fs.js.map +2 -2
  121. package/dist/functions.js +68 -1
  122. package/dist/functions.js.map +2 -2
  123. package/dist/git.js +329 -2
  124. package/dist/git.js.map +2 -2
  125. package/dist/github.js +202 -1
  126. package/dist/github.js.map +2 -2
  127. package/dist/globs.js +149 -1
  128. package/dist/globs.js.map +2 -2
  129. package/dist/http-request.js +335 -3
  130. package/dist/http-request.js.map +2 -2
  131. package/dist/index.js +69 -1
  132. package/dist/index.js.map +2 -2
  133. package/dist/ipc.js +244 -1
  134. package/dist/ipc.js.map +2 -2
  135. package/dist/json.js +73 -1
  136. package/dist/json.js.map +2 -2
  137. package/dist/links/index.js +60 -1
  138. package/dist/links/index.js.map +2 -2
  139. package/dist/logger.js +1383 -6
  140. package/dist/logger.js.map +2 -2
  141. package/dist/maintained-node-versions.js +35 -1
  142. package/dist/maintained-node-versions.js.map +2 -2
  143. package/dist/memoization.js +210 -1
  144. package/dist/memoization.js.map +2 -2
  145. package/dist/objects.js +311 -1
  146. package/dist/objects.js.map +3 -3
  147. package/dist/packages/editable.js +356 -9
  148. package/dist/packages/editable.js.map +2 -2
  149. package/dist/packages/exports.js +162 -1
  150. package/dist/packages/exports.js.map +2 -2
  151. package/dist/packages/isolation.js +187 -1
  152. package/dist/packages/isolation.js.map +2 -2
  153. package/dist/packages/licenses.js +214 -1
  154. package/dist/packages/licenses.js.map +2 -2
  155. package/dist/packages/manifest.js +190 -1
  156. package/dist/packages/manifest.js.map +2 -2
  157. package/dist/packages/normalize.js +132 -1
  158. package/dist/packages/normalize.js.map +2 -2
  159. package/dist/packages/operations.js +320 -1
  160. package/dist/packages/operations.js.map +2 -2
  161. package/dist/packages/paths.js +53 -1
  162. package/dist/packages/paths.js.map +2 -2
  163. package/dist/packages/provenance.js +178 -1
  164. package/dist/packages/provenance.js.map +2 -2
  165. package/dist/packages/specs.js +83 -1
  166. package/dist/packages/specs.js.map +2 -2
  167. package/dist/packages/validation.js +51 -1
  168. package/dist/packages/validation.js.map +2 -2
  169. package/dist/packages.js +129 -1
  170. package/dist/packages.js.map +2 -2
  171. package/dist/path.js +446 -1
  172. package/dist/path.js.map +2 -2
  173. package/dist/paths/rewire.js +79 -1
  174. package/dist/paths/rewire.js.map +2 -2
  175. package/dist/paths.js +190 -1
  176. package/dist/paths.js.map +2 -2
  177. package/dist/performance.js +216 -15
  178. package/dist/performance.js.map +2 -2
  179. package/dist/process-lock.js +287 -8
  180. package/dist/process-lock.js.map +2 -2
  181. package/dist/promise-queue.js +109 -1
  182. package/dist/promise-queue.js.map +2 -2
  183. package/dist/promises.js +267 -1
  184. package/dist/promises.js.map +2 -2
  185. package/dist/prompts/index.js +45 -1
  186. package/dist/prompts/index.js.map +2 -2
  187. package/dist/prompts.js +58 -1
  188. package/dist/prompts.js.map +2 -2
  189. package/dist/regexps.js +30 -1
  190. package/dist/regexps.js.map +2 -2
  191. package/dist/sea.js +44 -1
  192. package/dist/sea.js.map +2 -2
  193. package/dist/shadow.js +58 -1
  194. package/dist/shadow.js.map +2 -2
  195. package/dist/signal-exit.js +248 -1
  196. package/dist/signal-exit.js.map +2 -2
  197. package/dist/sorts.js +94 -1
  198. package/dist/sorts.js.map +2 -2
  199. package/dist/spawn.js +200 -1
  200. package/dist/spawn.js.map +2 -2
  201. package/dist/spinner.js +965 -1
  202. package/dist/spinner.js.map +3 -3
  203. package/dist/ssri.js +71 -1
  204. package/dist/ssri.js.map +2 -2
  205. package/dist/stdio/clear.js +82 -1
  206. package/dist/stdio/clear.js.map +2 -2
  207. package/dist/stdio/divider.js +89 -3
  208. package/dist/stdio/divider.js.map +2 -2
  209. package/dist/stdio/footer.js +94 -2
  210. package/dist/stdio/footer.js.map +2 -2
  211. package/dist/stdio/header.js +100 -2
  212. package/dist/stdio/header.js.map +2 -2
  213. package/dist/stdio/mask.js +207 -5
  214. package/dist/stdio/mask.js.map +2 -2
  215. package/dist/stdio/progress.js +209 -2
  216. package/dist/stdio/progress.js.map +2 -2
  217. package/dist/stdio/prompts.js +88 -1
  218. package/dist/stdio/prompts.js.map +2 -2
  219. package/dist/stdio/stderr.js +89 -2
  220. package/dist/stdio/stderr.js.map +2 -2
  221. package/dist/stdio/stdout.js +103 -2
  222. package/dist/stdio/stdout.js.map +2 -2
  223. package/dist/streams.js +78 -1
  224. package/dist/streams.js.map +2 -2
  225. package/dist/strings.js +251 -3
  226. package/dist/strings.js.map +2 -2
  227. package/dist/suppress-warnings.js +98 -1
  228. package/dist/suppress-warnings.js.map +2 -2
  229. package/dist/tables.js +128 -3
  230. package/dist/tables.js.map +2 -2
  231. package/dist/temporary-executor.js +53 -1
  232. package/dist/temporary-executor.js.map +2 -2
  233. package/dist/themes/context.js +71 -1
  234. package/dist/themes/context.js.map +3 -3
  235. package/dist/themes/index.d.ts +2 -2
  236. package/dist/themes/index.js +57 -1
  237. package/dist/themes/index.js.map +3 -3
  238. package/dist/themes/themes.d.ts +5 -5
  239. package/dist/themes/themes.js +204 -1
  240. package/dist/themes/themes.js.map +3 -3
  241. package/dist/themes/types.js +15 -1
  242. package/dist/themes/types.js.map +2 -2
  243. package/dist/themes/utils.js +116 -1
  244. package/dist/themes/utils.js.map +2 -2
  245. package/dist/types.js +59 -1
  246. package/dist/types.js.map +2 -2
  247. package/dist/url.js +142 -1
  248. package/dist/url.js.map +2 -2
  249. package/dist/utils/get-ipc.js +58 -1
  250. package/dist/utils/get-ipc.js.map +2 -2
  251. package/dist/validation/json-parser.js +127 -1
  252. package/dist/validation/json-parser.js.map +2 -2
  253. package/dist/validation/types.js +15 -1
  254. package/dist/validation/types.js.map +2 -2
  255. package/dist/versions.js +154 -1
  256. package/dist/versions.js.map +2 -2
  257. package/dist/words.js +50 -1
  258. package/dist/words.js.map +2 -2
  259. package/dist/zod.js +27 -1
  260. package/dist/zod.js.map +2 -2
  261. package/package.json +2 -2
@@ -1,4 +1,105 @@
1
1
  /* Socket Lib - Built with esbuild */
2
- var s=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var x=(r,e)=>{for(var i in e)s(r,i,{get:e[i],enumerable:!0})},d=(r,e,i,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of p(e))!T.call(r,n)&&n!==i&&s(r,n,{get:()=>e[n],enumerable:!(c=f(e,n))||c.enumerable});return r};var w=r=>d(s({},"__esModule",{value:!0}),r);var I={};x(I,{clearLine:()=>l,clearScreenDown:()=>S,cursorTo:()=>v,ensureCursorOnExit:()=>h,getColumns:()=>b,getRows:()=>g,hideCursor:()=>C,isTTY:()=>Y,showCursor:()=>t,stdout:()=>o,write:()=>m,writeLine:()=>a});module.exports=w(I);var u=require("tty");const o=process.stdout;function a(r=""){o.write(`${r}
3
- `)}function m(r){o.write(r)}function l(){o.isTTY&&(o.cursorTo(0),o.clearLine(0))}function v(r,e){o.isTTY&&o.cursorTo(r,e)}function S(){o.isTTY&&o.clearScreenDown()}function Y(){return o.isTTY||!1}function b(){return o.columns||80}function g(){return o.rows||24}function C(){o.isTTY&&o instanceof u.WriteStream&&o.write("\x1B[?25l")}function t(){o.isTTY&&o instanceof u.WriteStream&&o.write("\x1B[?25h")}function h(){process.on("exit",t),process.on("SIGINT",()=>{t(),process.exit(130)}),process.on("SIGTERM",()=>{t(),process.exit(143)})}0&&(module.exports={clearLine,clearScreenDown,cursorTo,ensureCursorOnExit,getColumns,getRows,hideCursor,isTTY,showCursor,stdout,write,writeLine});
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var stdout_exports = {};
20
+ __export(stdout_exports, {
21
+ clearLine: () => clearLine,
22
+ clearScreenDown: () => clearScreenDown,
23
+ cursorTo: () => cursorTo,
24
+ ensureCursorOnExit: () => ensureCursorOnExit,
25
+ getColumns: () => getColumns,
26
+ getRows: () => getRows,
27
+ hideCursor: () => hideCursor,
28
+ isTTY: () => isTTY,
29
+ showCursor: () => showCursor,
30
+ stdout: () => stdout,
31
+ write: () => write,
32
+ writeLine: () => writeLine
33
+ });
34
+ module.exports = __toCommonJS(stdout_exports);
35
+ var import_tty = require("tty");
36
+ const stdout = process.stdout;
37
+ function writeLine(text = "") {
38
+ stdout.write(`${text}
39
+ `);
40
+ }
41
+ function write(text) {
42
+ stdout.write(text);
43
+ }
44
+ function clearLine() {
45
+ if (stdout.isTTY) {
46
+ stdout.cursorTo(0);
47
+ stdout.clearLine(0);
48
+ }
49
+ }
50
+ function cursorTo(x, y) {
51
+ if (stdout.isTTY) {
52
+ stdout.cursorTo(x, y);
53
+ }
54
+ }
55
+ function clearScreenDown() {
56
+ if (stdout.isTTY) {
57
+ stdout.clearScreenDown();
58
+ }
59
+ }
60
+ function isTTY() {
61
+ return stdout.isTTY || false;
62
+ }
63
+ function getColumns() {
64
+ return stdout.columns || 80;
65
+ }
66
+ function getRows() {
67
+ return stdout.rows || 24;
68
+ }
69
+ function hideCursor() {
70
+ if (stdout.isTTY && stdout instanceof import_tty.WriteStream) {
71
+ stdout.write("\x1B[?25l");
72
+ }
73
+ }
74
+ function showCursor() {
75
+ if (stdout.isTTY && stdout instanceof import_tty.WriteStream) {
76
+ stdout.write("\x1B[?25h");
77
+ }
78
+ }
79
+ function ensureCursorOnExit() {
80
+ process.on("exit", showCursor);
81
+ process.on("SIGINT", () => {
82
+ showCursor();
83
+ process.exit(130);
84
+ });
85
+ process.on("SIGTERM", () => {
86
+ showCursor();
87
+ process.exit(143);
88
+ });
89
+ }
90
+ // Annotate the CommonJS export names for ESM import in node:
91
+ 0 && (module.exports = {
92
+ clearLine,
93
+ clearScreenDown,
94
+ cursorTo,
95
+ ensureCursorOnExit,
96
+ getColumns,
97
+ getRows,
98
+ hideCursor,
99
+ isTTY,
100
+ showCursor,
101
+ stdout,
102
+ write,
103
+ writeLine
104
+ });
4
105
  //# sourceMappingURL=stdout.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/stdio/stdout.ts"],
4
4
  "sourcesContent": ["/**\n * @fileoverview Standard output stream utilities.\n * Provides utilities for writing to stdout with formatting and control.\n */\n\nimport { WriteStream } from 'tty'\n\n// Get the actual stdout stream\nconst stdout: NodeJS.WriteStream = process.stdout\n\n/**\n * Write a line to stdout with trailing newline.\n *\n * @param text - Text to write\n * @default text ''\n *\n * @example\n * ```ts\n * writeLine('Hello, world!')\n * writeLine() // Write empty line\n * ```\n */\nexport function writeLine(text: string = ''): void {\n stdout.write(`${text}\\n`)\n}\n\n/**\n * Write text to stdout without adding a newline.\n *\n * @param text - Text to write\n *\n * @example\n * ```ts\n * write('Loading...')\n * // Later: clear and update\n * ```\n */\nexport function write(text: string): void {\n stdout.write(text)\n}\n\n/**\n * Clear the current line on stdout.\n * Only works in TTY environments.\n *\n * @example\n * ```ts\n * write('Processing...')\n * clearLine()\n * write('Done!')\n * ```\n */\nexport function clearLine(): void {\n if (stdout.isTTY) {\n stdout.cursorTo(0)\n stdout.clearLine(0)\n }\n}\n\n/**\n * Move cursor to specific position on stdout.\n * Only works in TTY environments.\n *\n * @param x - Column position (0-based)\n * @param y - Row position (0-based, optional)\n *\n * @example\n * ```ts\n * cursorTo(0) // Move to start of line\n * cursorTo(10, 5) // Move to column 10, row 5\n * ```\n */\nexport function cursorTo(x: number, y?: number | undefined): void {\n if (stdout.isTTY) {\n stdout.cursorTo(x, y)\n }\n}\n\n/**\n * Clear screen from cursor position down to bottom.\n * Only works in TTY environments.\n *\n * @example\n * ```ts\n * cursorTo(0, 5)\n * clearScreenDown() // Clear from row 5 to bottom\n * ```\n */\nexport function clearScreenDown(): void {\n if (stdout.isTTY) {\n stdout.clearScreenDown()\n }\n}\n\n/**\n * Check if stdout is connected to a TTY (terminal).\n *\n * @returns `true` if stdout is a TTY, `false` if piped/redirected\n *\n * @example\n * ```ts\n * if (isTTY()) {\n * // Show interactive UI\n * } else {\n * // Use simple text output\n * }\n * ```\n */\nexport function isTTY(): boolean {\n return stdout.isTTY || false\n}\n\n/**\n * Get the number of columns (width) in the terminal.\n *\n * @returns Terminal width in characters\n * @default 80\n *\n * @example\n * ```ts\n * const width = getColumns()\n * console.log(`Terminal is ${width} characters wide`)\n * ```\n */\nexport function getColumns(): number {\n return stdout.columns || 80\n}\n\n/**\n * Get the number of rows (height) in the terminal.\n *\n * @returns Terminal height in lines\n * @default 24\n *\n * @example\n * ```ts\n * const height = getRows()\n * console.log(`Terminal is ${height} lines tall`)\n * ```\n */\nexport function getRows(): number {\n return stdout.rows || 24\n}\n\n/**\n * Hide the cursor on stdout.\n * Useful for cleaner output during animations.\n *\n * @example\n * ```ts\n * hideCursor()\n * // Show animation\n * showCursor()\n * ```\n */\nexport function hideCursor(): void {\n if (stdout.isTTY && stdout instanceof WriteStream) {\n stdout.write('\\u001B[?25l')\n }\n}\n\n/**\n * Show the cursor on stdout.\n * Should be called after `hideCursor()`.\n *\n * @example\n * ```ts\n * hideCursor()\n * // Show animation\n * showCursor()\n * ```\n */\nexport function showCursor(): void {\n if (stdout.isTTY && stdout instanceof WriteStream) {\n stdout.write('\\u001B[?25h')\n }\n}\n\n/**\n * Register handlers to ensure cursor is shown on process exit.\n * Prevents hidden cursor after abnormal termination.\n * Handles SIGINT (Ctrl+C) and SIGTERM signals.\n *\n * @example\n * ```ts\n * ensureCursorOnExit()\n * hideCursor()\n * // Even if process crashes, cursor will be restored\n * ```\n */\nexport function ensureCursorOnExit(): void {\n process.on('exit', showCursor)\n process.on('SIGINT', () => {\n showCursor()\n // eslint-disable-next-line n/no-process-exit\n process.exit(130)\n })\n process.on('SIGTERM', () => {\n showCursor()\n // eslint-disable-next-line n/no-process-exit\n process.exit(143)\n })\n}\n\n// Export the raw stream for advanced usage\nexport { stdout }\n"],
5
- "mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,EAAA,oBAAAC,EAAA,aAAAC,EAAA,uBAAAC,EAAA,eAAAC,EAAA,YAAAC,EAAA,eAAAC,EAAA,UAAAC,EAAA,eAAAC,EAAA,WAAAC,EAAA,UAAAC,EAAA,cAAAC,IAAA,eAAAC,EAAAd,GAKA,IAAAe,EAA4B,eAG5B,MAAMJ,EAA6B,QAAQ,OAcpC,SAASE,EAAUG,EAAe,GAAU,CACjDL,EAAO,MAAM,GAAGK,CAAI;AAAA,CAAI,CAC1B,CAaO,SAASJ,EAAMI,EAAoB,CACxCL,EAAO,MAAMK,CAAI,CACnB,CAaO,SAASd,GAAkB,CAC5BS,EAAO,QACTA,EAAO,SAAS,CAAC,EACjBA,EAAO,UAAU,CAAC,EAEtB,CAeO,SAASP,EAASa,EAAWC,EAA8B,CAC5DP,EAAO,OACTA,EAAO,SAASM,EAAGC,CAAC,CAExB,CAYO,SAASf,GAAwB,CAClCQ,EAAO,OACTA,EAAO,gBAAgB,CAE3B,CAgBO,SAASF,GAAiB,CAC/B,OAAOE,EAAO,OAAS,EACzB,CAcO,SAASL,GAAqB,CACnC,OAAOK,EAAO,SAAW,EAC3B,CAcO,SAASJ,GAAkB,CAChC,OAAOI,EAAO,MAAQ,EACxB,CAaO,SAASH,GAAmB,CAC7BG,EAAO,OAASA,aAAkB,eACpCA,EAAO,MAAM,WAAa,CAE9B,CAaO,SAASD,GAAmB,CAC7BC,EAAO,OAASA,aAAkB,eACpCA,EAAO,MAAM,WAAa,CAE9B,CAcO,SAASN,GAA2B,CACzC,QAAQ,GAAG,OAAQK,CAAU,EAC7B,QAAQ,GAAG,SAAU,IAAM,CACzBA,EAAW,EAEX,QAAQ,KAAK,GAAG,CAClB,CAAC,EACD,QAAQ,GAAG,UAAW,IAAM,CAC1BA,EAAW,EAEX,QAAQ,KAAK,GAAG,CAClB,CAAC,CACH",
6
- "names": ["stdout_exports", "__export", "clearLine", "clearScreenDown", "cursorTo", "ensureCursorOnExit", "getColumns", "getRows", "hideCursor", "isTTY", "showCursor", "stdout", "write", "writeLine", "__toCommonJS", "import_tty", "text", "x", "y"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,iBAA4B;AAG5B,MAAM,SAA6B,QAAQ;AAcpC,SAAS,UAAU,OAAe,IAAU;AACjD,SAAO,MAAM,GAAG,IAAI;AAAA,CAAI;AAC1B;AAaO,SAAS,MAAM,MAAoB;AACxC,SAAO,MAAM,IAAI;AACnB;AAaO,SAAS,YAAkB;AAChC,MAAI,OAAO,OAAO;AAChB,WAAO,SAAS,CAAC;AACjB,WAAO,UAAU,CAAC;AAAA,EACpB;AACF;AAeO,SAAS,SAAS,GAAW,GAA8B;AAChE,MAAI,OAAO,OAAO;AAChB,WAAO,SAAS,GAAG,CAAC;AAAA,EACtB;AACF;AAYO,SAAS,kBAAwB;AACtC,MAAI,OAAO,OAAO;AAChB,WAAO,gBAAgB;AAAA,EACzB;AACF;AAgBO,SAAS,QAAiB;AAC/B,SAAO,OAAO,SAAS;AACzB;AAcO,SAAS,aAAqB;AACnC,SAAO,OAAO,WAAW;AAC3B;AAcO,SAAS,UAAkB;AAChC,SAAO,OAAO,QAAQ;AACxB;AAaO,SAAS,aAAmB;AACjC,MAAI,OAAO,SAAS,kBAAkB,wBAAa;AACjD,WAAO,MAAM,WAAa;AAAA,EAC5B;AACF;AAaO,SAAS,aAAmB;AACjC,MAAI,OAAO,SAAS,kBAAkB,wBAAa;AACjD,WAAO,MAAM,WAAa;AAAA,EAC5B;AACF;AAcO,SAAS,qBAA2B;AACzC,UAAQ,GAAG,QAAQ,UAAU;AAC7B,UAAQ,GAAG,UAAU,MAAM;AACzB,eAAW;AAEX,YAAQ,KAAK,GAAG;AAAA,EAClB,CAAC;AACD,UAAQ,GAAG,WAAW,MAAM;AAC1B,eAAW;AAEX,YAAQ,KAAK,GAAG;AAAA,EAClB,CAAC;AACH;",
6
+ "names": []
7
7
  }
package/dist/streams.js CHANGED
@@ -1,3 +1,80 @@
1
1
  /* Socket Lib - Built with esbuild */
2
- var l=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var U=(r,e)=>{for(var n in e)l(r,n,{get:e[n],enumerable:!0})},f=(r,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of T(e))!y.call(r,t)&&t!==n&&l(r,t,{get:()=>e[t],enumerable:!(a=I(e,t))||a.enumerable});return r};var A=r=>f(l({},"__esModule",{value:!0}),r);var P={};U(P,{parallelEach:()=>g,parallelMap:()=>m,transform:()=>w});module.exports=A(P);var s=require("./promises");let c;function u(){return c===void 0&&(c=require("./external/streaming-iterables")),c}async function g(r,e,n){for await(const a of m(r,e,n));}function m(r,e,n){const a=u(),t=(0,s.normalizeIterationOptions)(n);return a?.parallelMap(t.concurrency,async o=>await(0,s.pRetry)((...i)=>e(i[0]),{...t.retries,args:[o]}),r)}function w(r,e,n){const a=u(),t=(0,s.normalizeIterationOptions)(n);return a?.transform(t.concurrency,async o=>await(0,s.pRetry)((...i)=>e(i[0]),{...t.retries,args:[o]}),r)}0&&(module.exports={parallelEach,parallelMap,transform});
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var streams_exports = {};
20
+ __export(streams_exports, {
21
+ parallelEach: () => parallelEach,
22
+ parallelMap: () => parallelMap,
23
+ transform: () => transform
24
+ });
25
+ module.exports = __toCommonJS(streams_exports);
26
+ var import_promises = require("./promises");
27
+ let _streamingIterables;
28
+ // @__NO_SIDE_EFFECTS__
29
+ function getStreamingIterables() {
30
+ if (_streamingIterables === void 0) {
31
+ _streamingIterables = require("./external/streaming-iterables");
32
+ }
33
+ return _streamingIterables;
34
+ }
35
+ // @__NO_SIDE_EFFECTS__
36
+ async function parallelEach(iterable, func, options) {
37
+ for await (const _ of /* @__PURE__ */ parallelMap(iterable, func, options)) {
38
+ }
39
+ }
40
+ // @__NO_SIDE_EFFECTS__
41
+ function parallelMap(iterable, func, options) {
42
+ const streamingIterables = /* @__PURE__ */ getStreamingIterables();
43
+ const opts = (0, import_promises.normalizeIterationOptions)(options);
44
+ const result = streamingIterables?.parallelMap(
45
+ opts.concurrency,
46
+ async (item) => {
47
+ const result2 = await (0, import_promises.pRetry)((...args) => func(args[0]), {
48
+ ...opts.retries,
49
+ args: [item]
50
+ });
51
+ return result2;
52
+ },
53
+ iterable
54
+ );
55
+ return result;
56
+ }
57
+ // @__NO_SIDE_EFFECTS__
58
+ function transform(iterable, func, options) {
59
+ const streamingIterables = /* @__PURE__ */ getStreamingIterables();
60
+ const opts = (0, import_promises.normalizeIterationOptions)(options);
61
+ const result = streamingIterables?.transform(
62
+ opts.concurrency,
63
+ async (item) => {
64
+ const result2 = await (0, import_promises.pRetry)((...args) => func(args[0]), {
65
+ ...opts.retries,
66
+ args: [item]
67
+ });
68
+ return result2;
69
+ },
70
+ iterable
71
+ );
72
+ return result;
73
+ }
74
+ // Annotate the CommonJS export names for ESM import in node:
75
+ 0 && (module.exports = {
76
+ parallelEach,
77
+ parallelMap,
78
+ transform
79
+ });
3
80
  //# sourceMappingURL=streams.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/streams.ts"],
4
4
  "sourcesContent": ["/**\n * @fileoverview Stream processing utilities with streaming-iterables integration.\n * Provides async stream handling and transformation functions.\n */\n\nimport type { IterationOptions } from './promises'\nimport { normalizeIterationOptions, pRetry } from './promises'\n\nlet _streamingIterables:\n | {\n parallelMap: <T, U>(\n concurrency: number,\n mapper: (item: T) => Promise<U>,\n iterable: Iterable<T> | AsyncIterable<T>,\n ) => AsyncIterable<U>\n transform: <T, U>(\n concurrency: number,\n mapper: (item: T) => Promise<U>,\n iterable: Iterable<T> | AsyncIterable<T>,\n ) => AsyncIterable<U>\n }\n | undefined\n/**\n * Get the streaming-iterables module.\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getStreamingIterables() {\n if (_streamingIterables === undefined) {\n _streamingIterables = /*@__PURE__*/ require('./external/streaming-iterables')\n }\n return _streamingIterables\n}\n\n/**\n * Execute a function for each item in an iterable in parallel.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport async function parallelEach<T>(\n iterable: Iterable<T> | AsyncIterable<T>,\n func: (item: T) => Promise<unknown>,\n options?: number | IterationOptions,\n): Promise<void> {\n for await (const _ of parallelMap(iterable, func, options)) {\n /* empty block */\n }\n}\n\n/**\n * Map over an iterable in parallel with concurrency control.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function parallelMap<T, U>(\n iterable: Iterable<T> | AsyncIterable<T>,\n func: (item: T) => Promise<U>,\n options?: number | IterationOptions,\n): AsyncIterable<U> {\n const streamingIterables = getStreamingIterables()\n const opts = normalizeIterationOptions(options)\n const result = streamingIterables?.parallelMap(\n opts.concurrency,\n async (item: T) => {\n const result = await pRetry((...args: unknown[]) => func(args[0] as T), {\n ...opts.retries,\n args: [item],\n })\n return result as U\n },\n iterable,\n )\n return result as AsyncIterable<U>\n}\n\n/**\n * Transform an iterable with a function.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function transform<T, U>(\n iterable: Iterable<T> | AsyncIterable<T>,\n func: (item: T) => Promise<U>,\n options?: number | IterationOptions,\n): AsyncIterable<U> {\n const streamingIterables = getStreamingIterables()\n const opts = normalizeIterationOptions(options)\n const result = streamingIterables?.transform(\n opts.concurrency,\n async (item: T) => {\n const result = await pRetry((...args: unknown[]) => func(args[0] as T), {\n ...opts.retries,\n args: [item],\n })\n return result as U\n },\n iterable,\n )\n return result as AsyncIterable<U>\n}\n"],
5
- "mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,EAAA,gBAAAC,EAAA,cAAAC,IAAA,eAAAC,EAAAL,GAMA,IAAAM,EAAkD,sBAElD,IAAIC,EAmBJ,SAASC,GAAwB,CAC/B,OAAID,IAAwB,SAC1BA,EAAoC,QAAQ,gCAAgC,GAEvEA,CACT,CAMA,eAAsBL,EACpBO,EACAC,EACAC,EACe,CACf,gBAAiBC,KAAKT,EAAYM,EAAUC,EAAMC,CAAO,EAAG,CAG9D,CAMO,SAASR,EACdM,EACAC,EACAC,EACkB,CAClB,MAAME,EAAqBL,EAAsB,EAC3CM,KAAO,6BAA0BH,CAAO,EAY9C,OAXeE,GAAoB,YACjCC,EAAK,YACL,MAAOC,GACU,QAAM,UAAO,IAAIC,IAAoBN,EAAKM,EAAK,CAAC,CAAM,EAAG,CACtE,GAAGF,EAAK,QACR,KAAM,CAACC,CAAI,CACb,CAAC,EAGHN,CACF,CAEF,CAMO,SAASL,EACdK,EACAC,EACAC,EACkB,CAClB,MAAME,EAAqBL,EAAsB,EAC3CM,KAAO,6BAA0BH,CAAO,EAY9C,OAXeE,GAAoB,UACjCC,EAAK,YACL,MAAOC,GACU,QAAM,UAAO,IAAIC,IAAoBN,EAAKM,EAAK,CAAC,CAAM,EAAG,CACtE,GAAGF,EAAK,QACR,KAAM,CAACC,CAAI,CACb,CAAC,EAGHN,CACF,CAEF",
6
- "names": ["streams_exports", "__export", "parallelEach", "parallelMap", "transform", "__toCommonJS", "import_promises", "_streamingIterables", "getStreamingIterables", "iterable", "func", "options", "_", "streamingIterables", "opts", "item", "args"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,sBAAkD;AAElD,IAAI;AAAA;AAmBJ,SAAS,wBAAwB;AAC/B,MAAI,wBAAwB,QAAW;AACrC,0BAAoC,QAAQ,gCAAgC;AAAA,EAC9E;AACA,SAAO;AACT;AAAA;AAMA,eAAsB,aACpB,UACA,MACA,SACe;AACf,mBAAiB,KAAK,4BAAY,UAAU,MAAM,OAAO,GAAG;AAAA,EAE5D;AACF;AAAA;AAMO,SAAS,YACd,UACA,MACA,SACkB;AAClB,QAAM,qBAAqB,sCAAsB;AACjD,QAAM,WAAO,2CAA0B,OAAO;AAC9C,QAAM,SAAS,oBAAoB;AAAA,IACjC,KAAK;AAAA,IACL,OAAO,SAAY;AACjB,YAAMA,UAAS,UAAM,wBAAO,IAAI,SAAoB,KAAK,KAAK,CAAC,CAAM,GAAG;AAAA,QACtE,GAAG,KAAK;AAAA,QACR,MAAM,CAAC,IAAI;AAAA,MACb,CAAC;AACD,aAAOA;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACA,SAAO;AACT;AAAA;AAMO,SAAS,UACd,UACA,MACA,SACkB;AAClB,QAAM,qBAAqB,sCAAsB;AACjD,QAAM,WAAO,2CAA0B,OAAO;AAC9C,QAAM,SAAS,oBAAoB;AAAA,IACjC,KAAK;AAAA,IACL,OAAO,SAAY;AACjB,YAAMA,UAAS,UAAM,wBAAO,IAAI,SAAoB,KAAK,KAAK,CAAC,CAAM,GAAG;AAAA,QACtE,GAAG,KAAK;AAAA,QACR,MAAM,CAAC,IAAI;AAAA,MACb,CAAC;AACD,aAAOA;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACA,SAAO;AACT;",
6
+ "names": ["result"]
7
7
  }
package/dist/strings.js CHANGED
@@ -1,5 +1,253 @@
1
1
  /* Socket Lib - Built with esbuild */
2
- var f=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var b=(e,n)=>{for(var t in n)f(e,t,{get:n[t],enumerable:!0})},S=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of C(n))!_.call(e,i)&&i!==t&&f(e,i,{get:()=>n[i],enumerable:!(r=m(n,i))||r.enumerable});return e};var A=e=>S(f({},"__esModule",{value:!0}),e);var W={};b(W,{ansiRegex:()=>p.ansiRegex,applyLinePrefix:()=>y,camelToKebab:()=>k,centerText:()=>N,fromCharCode:()=>x,indentString:()=>P,isBlankString:()=>w,isNonEmptyString:()=>E,repeatString:()=>M,search:()=>I,stringWidth:()=>O,stripAnsi:()=>p.stripAnsi,stripBom:()=>$,toKebabCase:()=>R,trimNewlines:()=>L});module.exports=A(W);var p=require("./ansi"),l=require("./external/get-east-asian-width");const x=String.fromCharCode;function y(e,n){const{prefix:t=""}={__proto__:null,...n};return t.length?`${t}${e.includes(`
3
- `)?e.replace(/\n/g,`
4
- ${t}`):e}`:e}function k(e){const{length:n}=e;if(!n)return"";let t="",r=0;for(;r<n;){const i=e[r];if(!i)break;const c=i.charCodeAt(0);if(c>=65&&c<=90)for(t.length>0&&(t+="-");r<n;){const s=e[r];if(!s)break;const a=s.charCodeAt(0);if(a>=65&&a<=90)t+=x(a+32),r+=1;else break}else t+=i,r+=1}return t}function P(e,n){const{count:t=1}={__proto__:null,...n};return e.replace(/^(?!\s*$)/gm," ".repeat(t))}function w(e){return typeof e=="string"&&(!e.length||/^\s+$/.test(e))}function E(e){return typeof e=="string"&&e.length>0}function I(e,n,t){const{fromIndex:r=0}={__proto__:null,...t},{length:i}=e;if(r>=i)return-1;if(r===0)return e.search(n);const c=r<0?Math.max(i+r,0):r,o=e.slice(c).search(n);return o===-1?-1:o+c}function $(e){return e.length>0&&e.charCodeAt(0)===65279?e.slice(1):e}const B=new Intl.Segmenter;let u,d,h;try{u=new RegExp("^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Mark}|\\p{Surrogate})+$","v"),d=new RegExp("^[\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Mark}\\p{Surrogate}]+","v"),h=new RegExp("^\\p{RGI_Emoji}$","v")}catch{u=new RegExp("^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Mark})+$","u"),d=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}]+/u,h=new RegExp("^\\p{Extended_Pictographic}$","u")}function O(e){if(typeof e!="string"||!e.length)return 0;const n=(0,p.stripAnsi)(e);if(!n.length)return 0;let t=0;const r={ambiguousAsWide:!1};for(const{segment:i}of B.segment(n)){if(u.test(i))continue;if(h.test(i)){t+=2;continue}const o=i.replace(d,"").codePointAt(0);if(o!==void 0&&(t+=(0,l.eastAsianWidth)(o,r),i.length>1))for(const s of i.slice(1)){const a=s.charCodeAt(0);if(a>=65280&&a<=65519){const g=s.codePointAt(0);g!==void 0&&(t+=(0,l.eastAsianWidth)(g,r))}}}return t}function R(e){return e.length?e.replace(/([a-z]+[0-9]*)([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase():e}function L(e){const{length:n}=e;if(n===0)return e;const t=e.charCodeAt(0),r=t!==13&&t!==10;if(n===1)return r?e:"";const i=e.charCodeAt(n-1);if(r&&(i!==13&&i!==10))return e;let o=0,s=n;for(;o<s;){const a=e.charCodeAt(o);if(a!==13&&a!==10)break;o+=1}for(;s>o;){const a=e.charCodeAt(s-1);if(a!==13&&a!==10)break;s-=1}return o===0&&s===n?e:e.slice(o,s)}function M(e,n){return n<=0?"":e.repeat(n)}function N(e,n){const t=(0,p.stripAnsi)(e).length;if(t>=n)return e;const r=n-t,i=Math.floor(r/2),c=r-i;return" ".repeat(i)+e+" ".repeat(c)}0&&(module.exports={ansiRegex,applyLinePrefix,camelToKebab,centerText,fromCharCode,indentString,isBlankString,isNonEmptyString,repeatString,search,stringWidth,stripAnsi,stripBom,toKebabCase,trimNewlines});
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var strings_exports = {};
20
+ __export(strings_exports, {
21
+ ansiRegex: () => import_ansi.ansiRegex,
22
+ applyLinePrefix: () => applyLinePrefix,
23
+ camelToKebab: () => camelToKebab,
24
+ centerText: () => centerText,
25
+ fromCharCode: () => fromCharCode,
26
+ indentString: () => indentString,
27
+ isBlankString: () => isBlankString,
28
+ isNonEmptyString: () => isNonEmptyString,
29
+ repeatString: () => repeatString,
30
+ search: () => search,
31
+ stringWidth: () => stringWidth,
32
+ stripAnsi: () => import_ansi.stripAnsi,
33
+ stripBom: () => stripBom,
34
+ toKebabCase: () => toKebabCase,
35
+ trimNewlines: () => trimNewlines
36
+ });
37
+ module.exports = __toCommonJS(strings_exports);
38
+ var import_ansi = require("./ansi");
39
+ var import_get_east_asian_width = require("./external/get-east-asian-width");
40
+ const fromCharCode = String.fromCharCode;
41
+ // @__NO_SIDE_EFFECTS__
42
+ function applyLinePrefix(str, options) {
43
+ const { prefix = "" } = {
44
+ __proto__: null,
45
+ ...options
46
+ };
47
+ return prefix.length ? `${prefix}${str.includes("\n") ? str.replace(/\n/g, `
48
+ ${prefix}`) : str}` : str;
49
+ }
50
+ // @__NO_SIDE_EFFECTS__
51
+ function camelToKebab(str) {
52
+ const { length } = str;
53
+ if (!length) {
54
+ return "";
55
+ }
56
+ let result = "";
57
+ let i = 0;
58
+ while (i < length) {
59
+ const char = str[i];
60
+ if (!char) {
61
+ break;
62
+ }
63
+ const charCode = char.charCodeAt(0);
64
+ const isUpperCase = charCode >= 65 && charCode <= 90;
65
+ if (isUpperCase) {
66
+ if (result.length > 0) {
67
+ result += "-";
68
+ }
69
+ while (i < length) {
70
+ const currChar = str[i];
71
+ if (!currChar) {
72
+ break;
73
+ }
74
+ const currCharCode = currChar.charCodeAt(0);
75
+ const isCurrUpper = currCharCode >= 65 && currCharCode <= 90;
76
+ if (isCurrUpper) {
77
+ result += fromCharCode(
78
+ currCharCode + 32
79
+ /*'a'-'A'*/
80
+ );
81
+ i += 1;
82
+ } else {
83
+ break;
84
+ }
85
+ }
86
+ } else {
87
+ result += char;
88
+ i += 1;
89
+ }
90
+ }
91
+ return result;
92
+ }
93
+ // @__NO_SIDE_EFFECTS__
94
+ function indentString(str, options) {
95
+ const { count = 1 } = { __proto__: null, ...options };
96
+ return str.replace(/^(?!\s*$)/gm, " ".repeat(count));
97
+ }
98
+ // @__NO_SIDE_EFFECTS__
99
+ function isBlankString(value) {
100
+ return typeof value === "string" && (!value.length || /^\s+$/.test(value));
101
+ }
102
+ // @__NO_SIDE_EFFECTS__
103
+ function isNonEmptyString(value) {
104
+ return typeof value === "string" && value.length > 0;
105
+ }
106
+ // @__NO_SIDE_EFFECTS__
107
+ function search(str, regexp, options) {
108
+ const { fromIndex = 0 } = { __proto__: null, ...options };
109
+ const { length } = str;
110
+ if (fromIndex >= length) {
111
+ return -1;
112
+ }
113
+ if (fromIndex === 0) {
114
+ return str.search(regexp);
115
+ }
116
+ const offset = fromIndex < 0 ? Math.max(length + fromIndex, 0) : fromIndex;
117
+ const result = str.slice(offset).search(regexp);
118
+ return result === -1 ? -1 : result + offset;
119
+ }
120
+ // @__NO_SIDE_EFFECTS__
121
+ function stripBom(str) {
122
+ return str.length > 0 && str.charCodeAt(0) === 65279 ? str.slice(1) : str;
123
+ }
124
+ const segmenter = new Intl.Segmenter();
125
+ let zeroWidthClusterRegex;
126
+ let leadingNonPrintingRegex;
127
+ let emojiRegex;
128
+ try {
129
+ zeroWidthClusterRegex = new RegExp("^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Mark}|\\p{Surrogate})+$", "v");
130
+ leadingNonPrintingRegex = new RegExp("^[\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Mark}\\p{Surrogate}]+", "v");
131
+ emojiRegex = new RegExp("^\\p{RGI_Emoji}$", "v");
132
+ } catch {
133
+ zeroWidthClusterRegex = new RegExp("^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Mark})+$", "u");
134
+ leadingNonPrintingRegex = /^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}]+/u;
135
+ emojiRegex = new RegExp("^\\p{Extended_Pictographic}$", "u");
136
+ }
137
+ // @__NO_SIDE_EFFECTS__
138
+ function stringWidth(text) {
139
+ if (typeof text !== "string" || !text.length) {
140
+ return 0;
141
+ }
142
+ const plainText = (0, import_ansi.stripAnsi)(text);
143
+ if (!plainText.length) {
144
+ return 0;
145
+ }
146
+ let width = 0;
147
+ const eastAsianWidthOptions = { ambiguousAsWide: false };
148
+ for (const { segment } of segmenter.segment(plainText)) {
149
+ if (zeroWidthClusterRegex.test(segment)) {
150
+ continue;
151
+ }
152
+ if (emojiRegex.test(segment)) {
153
+ width += 2;
154
+ continue;
155
+ }
156
+ const baseSegment = segment.replace(leadingNonPrintingRegex, "");
157
+ const codePoint = baseSegment.codePointAt(0);
158
+ if (codePoint === void 0) {
159
+ continue;
160
+ }
161
+ width += (0, import_get_east_asian_width.eastAsianWidth)(codePoint, eastAsianWidthOptions);
162
+ if (segment.length > 1) {
163
+ for (const char of segment.slice(1)) {
164
+ const charCode = char.charCodeAt(0);
165
+ if (charCode >= 65280 && charCode <= 65519) {
166
+ const trailingCodePoint = char.codePointAt(0);
167
+ if (trailingCodePoint !== void 0) {
168
+ width += (0, import_get_east_asian_width.eastAsianWidth)(trailingCodePoint, eastAsianWidthOptions);
169
+ }
170
+ }
171
+ }
172
+ }
173
+ }
174
+ return width;
175
+ }
176
+ // @__NO_SIDE_EFFECTS__
177
+ function toKebabCase(str) {
178
+ if (!str.length) {
179
+ return str;
180
+ }
181
+ return str.replace(/([a-z]+[0-9]*)([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
182
+ }
183
+ // @__NO_SIDE_EFFECTS__
184
+ function trimNewlines(str) {
185
+ const { length } = str;
186
+ if (length === 0) {
187
+ return str;
188
+ }
189
+ const first = str.charCodeAt(0);
190
+ const noFirstNewline = first !== 13 && first !== 10;
191
+ if (length === 1) {
192
+ return noFirstNewline ? str : "";
193
+ }
194
+ const last = str.charCodeAt(length - 1);
195
+ const noLastNewline = last !== 13 && last !== 10;
196
+ if (noFirstNewline && noLastNewline) {
197
+ return str;
198
+ }
199
+ let start = 0;
200
+ let end = length;
201
+ while (start < end) {
202
+ const code = str.charCodeAt(start);
203
+ if (code !== 13 && code !== 10) {
204
+ break;
205
+ }
206
+ start += 1;
207
+ }
208
+ while (end > start) {
209
+ const code = str.charCodeAt(end - 1);
210
+ if (code !== 13 && code !== 10) {
211
+ break;
212
+ }
213
+ end -= 1;
214
+ }
215
+ return start === 0 && end === length ? str : str.slice(start, end);
216
+ }
217
+ // @__NO_SIDE_EFFECTS__
218
+ function repeatString(str, count) {
219
+ if (count <= 0) {
220
+ return "";
221
+ }
222
+ return str.repeat(count);
223
+ }
224
+ // @__NO_SIDE_EFFECTS__
225
+ function centerText(text, width) {
226
+ const textLength = (0, import_ansi.stripAnsi)(text).length;
227
+ if (textLength >= width) {
228
+ return text;
229
+ }
230
+ const padding = width - textLength;
231
+ const leftPad = Math.floor(padding / 2);
232
+ const rightPad = padding - leftPad;
233
+ return " ".repeat(leftPad) + text + " ".repeat(rightPad);
234
+ }
235
+ // Annotate the CommonJS export names for ESM import in node:
236
+ 0 && (module.exports = {
237
+ ansiRegex,
238
+ applyLinePrefix,
239
+ camelToKebab,
240
+ centerText,
241
+ fromCharCode,
242
+ indentString,
243
+ isBlankString,
244
+ isNonEmptyString,
245
+ repeatString,
246
+ search,
247
+ stringWidth,
248
+ stripAnsi,
249
+ stripBom,
250
+ toKebabCase,
251
+ trimNewlines
252
+ });
5
253
  //# sourceMappingURL=strings.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/strings.ts"],
4
4
  "sourcesContent": ["/**\n * @fileoverview String manipulation utilities including ANSI code handling.\n * Provides string processing, prefix application, and terminal output utilities.\n */\n\nimport { ansiRegex, stripAnsi } from './ansi'\nimport { eastAsianWidth } from './external/get-east-asian-width'\n// Import get-east-asian-width from external wrapper.\n// This library implements Unicode Standard Annex #11 (East Asian Width).\n// https://www.unicode.org/reports/tr11/\n\n// Re-export ANSI utilities for backward compatibility.\nexport { ansiRegex, stripAnsi }\n\n// Type definitions\ndeclare const BlankStringBrand: unique symbol\nexport type BlankString = string & { [BlankStringBrand]: true }\ndeclare const EmptyStringBrand: unique symbol\nexport type EmptyString = string & { [EmptyStringBrand]: true }\n\n// IMPORTANT: Do not use destructuring here - use direct assignment instead.\n// tsgo has a bug that incorrectly transpiles destructured exports, resulting in\n// `exports.SomeName = void 0;` which causes runtime errors.\n// See: https://github.com/SocketDev/socket-packageurl-js/issues/3\nexport const fromCharCode = String.fromCharCode\n\nexport interface ApplyLinePrefixOptions {\n /**\n * The prefix to add to each line.\n * @default ''\n */\n prefix?: string | undefined\n}\n\n/**\n * Apply a prefix to each line of a string.\n *\n * Prepends the specified prefix to the beginning of each line in the input string.\n * If the string contains newlines, the prefix is added after each newline as well.\n * When no prefix is provided or prefix is empty, returns the original string unchanged.\n *\n * @param str - The string to add prefixes to\n * @param options - Configuration options\n * @returns The string with prefix applied to each line\n *\n * @example\n * ```ts\n * applyLinePrefix('hello\\nworld', { prefix: '> ' })\n * // Returns: '> hello\\n> world'\n *\n * applyLinePrefix('single line', { prefix: ' ' })\n * // Returns: ' single line'\n *\n * applyLinePrefix('no prefix')\n * // Returns: 'no prefix'\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function applyLinePrefix(\n str: string,\n options?: ApplyLinePrefixOptions | undefined,\n): string {\n const { prefix = '' } = {\n __proto__: null,\n ...options,\n } as ApplyLinePrefixOptions\n return prefix.length\n ? `${prefix}${str.includes('\\n') ? str.replace(/\\n/g, `\\n${prefix}`) : str}`\n : str\n}\n\n/**\n * Convert a camelCase string to kebab-case.\n *\n * Transforms camelCase strings by converting uppercase letters to lowercase\n * and inserting hyphens before uppercase sequences. Handles consecutive\n * uppercase letters (like \"XMLHttpRequest\") by treating them as a single word.\n * Returns empty string for empty input.\n *\n * Note: This function only handles camelCase. For mixed formats including\n * snake_case, use `toKebabCase()` instead.\n *\n * @param str - The camelCase string to convert\n * @returns The kebab-case string\n *\n * @example\n * ```ts\n * camelToKebab('helloWorld')\n * // Returns: 'hello-world'\n *\n * camelToKebab('XMLHttpRequest')\n * // Returns: 'xmlhttprequest'\n *\n * camelToKebab('iOS')\n * // Returns: 'ios'\n *\n * camelToKebab('')\n * // Returns: ''\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function camelToKebab(str: string): string {\n const { length } = str\n if (!length) {\n return ''\n }\n let result = ''\n let i = 0\n while (i < length) {\n const char = str[i]\n if (!char) {\n break\n }\n const charCode = char.charCodeAt(0)\n // Check if current character is uppercase letter.\n // A = 65, Z = 90\n const isUpperCase = charCode >= 65 /*'A'*/ && charCode <= 90 /*'Z'*/\n if (isUpperCase) {\n // Add dash before uppercase sequence (except at start).\n if (result.length > 0) {\n result += '-'\n }\n // Collect all consecutive uppercase letters.\n while (i < length) {\n const currChar = str[i]\n if (!currChar) {\n break\n }\n const currCharCode = currChar.charCodeAt(0)\n const isCurrUpper =\n currCharCode >= 65 /*'A'*/ && currCharCode <= 90 /*'Z'*/\n if (isCurrUpper) {\n // Convert uppercase to lowercase: subtract 32 (A=65 -> a=97, diff=32)\n result += fromCharCode(currCharCode + 32 /*'a'-'A'*/)\n i += 1\n } else {\n // Stop when we hit non-uppercase.\n break\n }\n }\n } else {\n // Handle lowercase letters, digits, and other characters.\n result += char\n i += 1\n }\n }\n return result\n}\n\nexport interface IndentStringOptions {\n /**\n * Number of spaces to indent each line.\n * @default 1\n */\n count?: number | undefined\n}\n\n/**\n * Indent each line of a string with spaces.\n *\n * Adds the specified number of spaces to the beginning of each non-empty line\n * in the input string. Empty lines (containing only whitespace) are not indented.\n * Uses a regular expression to efficiently handle multi-line strings.\n *\n * @param str - The string to indent\n * @param options - Configuration options\n * @returns The indented string\n *\n * @example\n * ```ts\n * indentString('hello\\nworld', { count: 2 })\n * // Returns: ' hello\\n world'\n *\n * indentString('line1\\n\\nline3', { count: 4 })\n * // Returns: ' line1\\n\\n line3'\n *\n * indentString('single line')\n * // Returns: ' single line' (default: 1 space)\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function indentString(\n str: string,\n options?: IndentStringOptions | undefined,\n): string {\n const { count = 1 } = { __proto__: null, ...options } as IndentStringOptions\n return str.replace(/^(?!\\s*$)/gm, ' '.repeat(count))\n}\n\n/**\n * Check if a value is a blank string (empty or only whitespace).\n *\n * A blank string is defined as a string that is either:\n * - Completely empty (length 0)\n * - Contains only whitespace characters (spaces, tabs, newlines, etc.)\n *\n * This is useful for validation when you need to ensure user input\n * contains actual content, not just whitespace.\n *\n * @param value - The value to check\n * @returns `true` if the value is a blank string, `false` otherwise\n *\n * @example\n * ```ts\n * isBlankString('')\n * // Returns: true\n *\n * isBlankString(' ')\n * // Returns: true\n *\n * isBlankString('\\n\\t ')\n * // Returns: true\n *\n * isBlankString('hello')\n * // Returns: false\n *\n * isBlankString(null)\n * // Returns: false\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function isBlankString(value: unknown): value is BlankString {\n return typeof value === 'string' && (!value.length || /^\\s+$/.test(value))\n}\n\n/**\n * Check if a value is a non-empty string.\n *\n * Returns `true` only if the value is a string with at least one character.\n * This includes strings containing only whitespace (use `isBlankString()` if\n * you want to exclude those). Type guard ensures TypeScript knows the value\n * is a string after this check.\n *\n * @param value - The value to check\n * @returns `true` if the value is a non-empty string, `false` otherwise\n *\n * @example\n * ```ts\n * isNonEmptyString('hello')\n * // Returns: true\n *\n * isNonEmptyString(' ')\n * // Returns: true (contains whitespace)\n *\n * isNonEmptyString('')\n * // Returns: false\n *\n * isNonEmptyString(null)\n * // Returns: false\n *\n * isNonEmptyString(123)\n * // Returns: false\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function isNonEmptyString(\n value: unknown,\n): value is Exclude<string, EmptyString> {\n return typeof value === 'string' && value.length > 0\n}\n\nexport interface SearchOptions {\n /**\n * The position in the string to begin searching from.\n * Negative values count back from the end of the string.\n * @default 0\n */\n fromIndex?: number | undefined\n}\n\n/**\n * Search for a regular expression in a string starting from an index.\n *\n * Similar to `String.prototype.search()` but allows specifying a starting\n * position. Returns the index of the first match at or after `fromIndex`,\n * or -1 if no match is found. Negative `fromIndex` values count back from\n * the end of the string.\n *\n * This is more efficient than using `str.slice(fromIndex).search()` when\n * you need the absolute position in the original string, as it handles\n * the offset calculation for you.\n *\n * @param str - The string to search in\n * @param regexp - The regular expression to search for\n * @param options - Configuration options\n * @returns The index of the first match, or -1 if not found\n *\n * @example\n * ```ts\n * search('hello world hello', /hello/, { fromIndex: 0 })\n * // Returns: 0 (first 'hello')\n *\n * search('hello world hello', /hello/, { fromIndex: 6 })\n * // Returns: 12 (second 'hello')\n *\n * search('hello world', /goodbye/, { fromIndex: 0 })\n * // Returns: -1 (not found)\n *\n * search('hello world', /hello/, { fromIndex: -5 })\n * // Returns: -1 (starts searching from 'world', no match)\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function search(\n str: string,\n regexp: RegExp,\n options?: SearchOptions | undefined,\n): number {\n const { fromIndex = 0 } = { __proto__: null, ...options } as SearchOptions\n const { length } = str\n if (fromIndex >= length) {\n return -1\n }\n if (fromIndex === 0) {\n return str.search(regexp)\n }\n const offset = fromIndex < 0 ? Math.max(length + fromIndex, 0) : fromIndex\n const result = str.slice(offset).search(regexp)\n return result === -1 ? -1 : result + offset\n}\n\n/**\n * Strip the Byte Order Mark (BOM) from the beginning of a string.\n *\n * The BOM (U+FEFF) is a Unicode character that can appear at the start of\n * a text file to indicate byte order and encoding. In UTF-16 (JavaScript's\n * internal string representation), it appears as 0xFEFF. This function\n * removes it if present, leaving the rest of the string unchanged.\n *\n * Most text processing doesn't need to handle the BOM explicitly, but it\n * can cause issues when parsing JSON, CSV, or other structured data formats\n * that don't expect a leading invisible character.\n *\n * @param str - The string to strip BOM from\n * @returns The string without BOM\n *\n * @example\n * ```ts\n * stripBom('\\uFEFFhello world')\n * // Returns: 'hello world'\n *\n * stripBom('hello world')\n * // Returns: 'hello world' (no BOM to strip)\n *\n * stripBom('')\n * // Returns: ''\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function stripBom(str: string): string {\n // In JavaScript, string data is stored as UTF-16, so BOM is 0xFEFF.\n // https://tc39.es/ecma262/#sec-unicode-format-control-characters\n return str.length > 0 && str.charCodeAt(0) === 0xfe_ff ? str.slice(1) : str\n}\n\n// Initialize Intl.Segmenter for proper grapheme cluster segmentation.\n// Hoisted outside stringWidth() for reuse across multiple calls.\n//\n// A grapheme cluster is what a user perceives as a single character, but may\n// be composed of multiple Unicode code points.\n//\n// Why this matters:\n// - '\uD83D\uDC4D' (thumbs up) is 1 code point but appears as 1 character \u2192 1 grapheme\n// - '\uD83D\uDC4D\uD83C\uDFFD' (thumbs up + skin tone) is 2 code points but appears as 1 character \u2192 1 grapheme\n// - '\uD83D\uDC68\u200D\uD83D\uDC69\u200D\uD83D\uDC67\u200D\uD83D\uDC66' (family) is 7 code points (4 people + 3 ZWJ) but appears as 1 character \u2192 1 grapheme\n// - '\u00E9' can be 1 code point (U+00E9) OR 2 code points (e + \u0301) but appears as 1 character \u2192 1 grapheme\n//\n// Without Intl.Segmenter, simple iteration treats each code point separately,\n// leading to incorrect width calculations for complex sequences.\n//\n// Intl.Segmenter is available in:\n// - Node.js 16.0.0+ (our minimum is 18.0.0, so always available)\n// - All modern browsers\n//\n// Performance: Creating this once and reusing it is more efficient than\n// creating a new Intl.Segmenter instance on every stringWidth() call.\nconst segmenter = new Intl.Segmenter()\n\n// Feature-detect Unicode property escapes support and create regex patterns.\n// Hoisted outside stringWidth() for reuse across multiple calls.\n//\n// Unicode property escapes in regex allow matching characters by their Unicode properties.\n// The 'v' flag (ES2024, Node 20+) provides the most accurate Unicode support including:\n// - \\p{RGI_Emoji} - Matches only emoji recommended for general interchange\n// - Full support for Unicode sets and properties\n//\n// The 'u' flag (ES2015, Node 18+) provides basic Unicode support but:\n// - No \\p{RGI_Emoji} property (must use broader \\p{Extended_Pictographic})\n// - No \\p{Surrogate} property (must omit from patterns)\n// - Less accurate for complex emoji sequences\n//\n// We feature-detect by attempting to create a regex with 'v' flag.\n// If it throws, we fall back to 'u' flag with adjusted patterns.\n//\n// This ensures:\n// - Best accuracy on Node 20+ (our test matrix: 20, 22, 24)\n// - Backward compatibility with Node 18 (our minimum version)\n// - No runtime errors from unsupported regex features\n//\n// Performance: Creating these once and reusing them is more efficient than\n// creating new regex instances on every stringWidth() call.\nlet zeroWidthClusterRegex: RegExp\nlet leadingNonPrintingRegex: RegExp\nlet emojiRegex: RegExp\n\ntry {\n // Try 'v' flag first (Node 20+) for most accurate Unicode property support.\n //\n // ZERO-WIDTH CLUSTER PATTERN:\n // Matches entire clusters that should be invisible (width = 0):\n // - \\p{Default_Ignorable_Code_Point} - Characters like Zero Width Space (U+200B)\n // - \\p{Control} - ASCII control chars (0x00-0x1F, 0x7F-0x9F) like \\t, \\n\n // - \\p{Mark} - Combining marks that modify previous character (accents, diacritics)\n // - \\p{Surrogate} - Lone surrogate halves (invalid UTF-16, should not appear)\n zeroWidthClusterRegex =\n /^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Mark}|\\p{Surrogate})+$/v\n\n // LEADING NON-PRINTING PATTERN:\n // Matches non-printing characters at the start of a cluster.\n // Used to find the \"base\" visible character in a cluster.\n // - \\p{Format} - Formatting characters like Right-to-Left marks\n // Example: In a cluster starting with format chars, we skip them to find the base character.\n leadingNonPrintingRegex =\n /^[\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Mark}\\p{Surrogate}]+/v\n\n // RGI EMOJI PATTERN:\n // \\p{RGI_Emoji} matches emoji in the \"Recommended for General Interchange\" set.\n // This is the most accurate way to detect emoji that should render as double-width.\n //\n // RGI emoji include:\n // - Basic emoji: \uD83D\uDC4D, \uD83D\uDE00, \u26A1\n // - Emoji with modifiers: \uD83D\uDC4D\uD83C\uDFFD (thumbs up + medium skin tone)\n // - ZWJ sequences: \uD83D\uDC68\u200D\uD83D\uDC69\u200D\uD83D\uDC67\u200D\uD83D\uDC66 (family: man, woman, girl, boy)\n // - Keycap sequences: 1\uFE0F\u20E3 (digit + variation selector + combining enclosing keycap)\n //\n // Why RGI? The Unicode Consortium recommends this subset for interchange because:\n // - They have consistent rendering across platforms\n // - They're widely supported\n // - They follow a standardized format\n //\n // Non-RGI emoji might be symbols that look like emoji but render as 1 column.\n emojiRegex = /^\\p{RGI_Emoji}$/v\n} catch {\n // Fall back to 'u' flag (Node 18+) with slightly less accurate patterns.\n //\n // KEY DIFFERENCES from 'v' flag patterns:\n // 1. No \\p{Surrogate} property - omitted from patterns\n // 2. No \\p{RGI_Emoji} property - use \\p{Extended_Pictographic} instead\n //\n // \\p{Extended_Pictographic} is broader than \\p{RGI_Emoji}:\n // - Includes emoji-like symbols that might render as 1 column\n // - Less precise but better than nothing\n // - Defined in Unicode Technical Standard #51\n //\n // The patterns are otherwise identical, just with \\p{Surrogate} removed\n // and \\p{RGI_Emoji} replaced with \\p{Extended_Pictographic}.\n zeroWidthClusterRegex =\n /^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Mark})+$/u\n leadingNonPrintingRegex =\n /^[\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Mark}]+/u\n emojiRegex = /^\\p{Extended_Pictographic}$/u\n}\n\n/**\n * Get the visual width of a string in terminal columns.\n *\n * Calculates how many columns a string will occupy when displayed in a terminal,\n * accounting for:\n * - ANSI escape codes (stripped before calculation)\n * - Wide characters (CJK ideographs, fullwidth forms) that take 2 columns\n * - Emoji (including complex sequences) that take 2 columns\n * - Combining marks and zero-width characters (take 0 columns)\n * - East Asian Width properties (Fullwidth, Wide, Halfwidth, Narrow, etc.)\n *\n * Based on string-width by Sindre Sorhus:\n * https://socket.dev/npm/package/string-width/overview/7.2.0\n * MIT License\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n *\n * Terminal emulators display characters in a grid of cells (columns).\n * Most ASCII characters take 1 column, but some characters (especially\n * emoji and CJK characters) take 2 columns. This function calculates\n * the actual visual width, which is crucial for:\n * - Aligning text properly in tables or columns\n * - Preventing text from jumping when characters change\n * - Calculating padding/spacing for spinners and progress bars\n * - Wrapping text at the correct column width\n *\n * Algorithm Overview:\n * 1. Strip ANSI escape codes (invisible in terminal)\n * 2. Segment into grapheme clusters (user-perceived characters)\n * 3. For each cluster:\n * - Skip zero-width/non-printing clusters (width = 0)\n * - RGI emoji clusters are double-width (width = 2)\n * - Otherwise use East Asian Width of first visible code point\n * - Add width for trailing Halfwidth/Fullwidth Forms\n *\n * East Asian Width Categories (Unicode Standard Annex #11):\n * - F (Fullwidth): 2 columns - e.g., fullwidth Latin letters (\uFF21, \uFF22)\n * - W (Wide): 2 columns - e.g., CJK ideographs (\u6F22\u5B57), emoji (\u26A1, \uD83D\uDE00)\n * - H (Halfwidth): 1 column - e.g., halfwidth Katakana (\uFF71, \uFF72)\n * - Na (Narrow): 1 column - e.g., ASCII (a-z, 0-9)\n * - A (Ambiguous): Context-dependent, treated as 1 column by default\n * - N (Neutral): 1 column - e.g., most symbols (\u2726, \u2727, \u22C6)\n *\n * Why This Matters for Socket:\n * - Lightning bolt (\u26A1) takes 2 columns\n * - Stars (\u2726, \u2727, \u22C6) take 1 column\n * - Without proper width calculation, spinner text jumps between frames\n * - This function enables consistent alignment by calculating padding\n *\n * @param text - The string to measure\n * @returns The visual width in terminal columns\n *\n * @example\n * ```ts\n * stringWidth('hello')\n * // Returns: 5 (5 ASCII chars = 5 columns)\n *\n * stringWidth('\u26A1')\n * // Returns: 2 (lightning bolt is wide)\n *\n * stringWidth('\u2726')\n * // Returns: 1 (star is narrow)\n *\n * stringWidth('\u6F22\u5B57')\n * // Returns: 4 (2 CJK characters \u00D7 2 columns each)\n *\n * stringWidth('\\x1b[31mred\\x1b[0m')\n * // Returns: 3 (ANSI codes stripped, 'red' = 3)\n *\n * stringWidth('\uD83D\uDC4D\uD83C\uDFFD')\n * // Returns: 2 (emoji with skin tone = 1 grapheme cluster = 2 columns)\n *\n * stringWidth('\u00E9')\n * // Returns: 1 (combining accent doesn't add width)\n *\n * stringWidth('')\n * // Returns: 0\n * ```\n *\n * @throws {TypeError} When input is not a string\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function stringWidth(text: string): number {\n if (typeof text !== 'string' || !text.length) {\n return 0\n }\n\n // Strip ANSI escape codes first (colors, bold, italic, etc.).\n // These are invisible and don't contribute to visual width.\n // Example: '\\x1b[31mred\\x1b[0m' becomes 'red'.\n const plainText = stripAnsi(text)\n\n if (!plainText.length) {\n return 0\n }\n\n // KEY IMPROVEMENT #1: Proper Grapheme Cluster Segmentation\n //\n // Use the hoisted Intl.Segmenter instance (defined outside this function).\n // See comments above for detailed explanation of grapheme cluster segmentation.\n\n // KEY IMPROVEMENT #2: Feature Detection for Unicode Property Escapes\n //\n // Use the hoisted regex patterns (defined outside this function).\n // See comments above for detailed explanation of feature detection and fallback patterns.\n\n let width = 0\n\n // Configure East Asian Width calculation.\n // ambiguousAsWide: false - treat ambiguous-width characters as narrow (1 column).\n //\n // Ambiguous width characters (category 'A') include:\n // - Greek letters: \u03B1, \u03B2, \u03B3\n // - Cyrillic letters: \u0410, \u0411, \u0412\n // - Box drawing characters: \u2500, \u2502, \u250C\n //\n // In East Asian contexts, these are often rendered as wide (2 columns).\n // In Western contexts, they're typically narrow (1 column).\n //\n // We choose narrow (false) because:\n // - Socket's primary audience is Western developers\n // - Most terminal emulators default to narrow for ambiguous characters\n // - Consistent with string-width's default behavior\n const eastAsianWidthOptions = { ambiguousAsWide: false }\n\n // KEY IMPROVEMENT #3: Comprehensive Width Calculation\n //\n // Segment the string into grapheme clusters and calculate width for each.\n // This is the core algorithm that handles all the complexity of Unicode text rendering.\n for (const { segment } of segmenter.segment(plainText)) {\n // STEP 1: Skip zero-width / non-printing clusters\n //\n // These clusters contain only invisible characters that take no space.\n // Examples:\n // - '\\t' (tab) - Control character\n // - '\\n' (newline) - Control character\n // - '\\u200B' (zero-width space) - Default ignorable\n // - Combining marks without base character\n //\n // Why skip? Terminals don't allocate columns for these characters.\n // They're either control codes or modify adjacent characters without adding width.\n if (zeroWidthClusterRegex.test(segment)) {\n continue\n }\n\n // STEP 2: Handle emoji (double-width)\n //\n // RGI emoji are always rendered as double-width (2 columns) in terminals.\n // This is true even for complex sequences:\n // - \uD83D\uDC4D (basic emoji) = 2 columns\n // - \uD83D\uDC4D\uD83C\uDFFD (emoji + skin tone modifier) = 2 columns (not 4!)\n // - \uD83D\uDC68\u200D\uD83D\uDC69\u200D\uD83D\uDC67\u200D\uD83D\uDC66 (family ZWJ sequence) = 2 columns (not 14!)\n //\n // Why double-width? Historical reasons:\n // - Emoji originated in Japanese mobile carriers\n // - They were designed to match CJK character width\n // - Terminal emulators inherited this behavior\n //\n // The key insight: The ENTIRE grapheme cluster is 2 columns, regardless\n // of how many code points it contains. That's why we need Intl.Segmenter!\n if (emojiRegex.test(segment)) {\n width += 2\n continue\n }\n\n // STEP 3: Use East Asian Width for everything else\n //\n // For non-emoji clusters, calculate width based on the first visible character.\n //\n // Why first visible character? In a grapheme cluster like \"\u00E9\" (e + combining acute),\n // the base character 'e' determines the width, and the combining mark modifies it\n // without adding width.\n //\n // Strip leading non-printing characters to find the base character.\n // Example: If a cluster starts with format characters, skip them to find\n // the actual visible character that determines width.\n const baseSegment = segment.replace(leadingNonPrintingRegex, '')\n const codePoint = baseSegment.codePointAt(0)\n\n if (codePoint === undefined) {\n // If no visible character remains after stripping non-printing chars, skip.\n // This shouldn't happen if our zero-width regex is correct, but defensive programming.\n continue\n }\n\n // Calculate width using East Asian Width property.\n // This handles:\n // - Narrow (1 column): ASCII a-z, A-Z, 0-9, most symbols\n // - Wide (2 columns): CJK ideographs (\u6F22, \u5B57), fullwidth forms (\uFF21, \uFF22)\n // - Halfwidth (1 column): Halfwidth Katakana (\uFF71, \uFF72, \uFF73)\n // - Ambiguous (1 column per our config): Greek, Cyrillic, box drawing\n width += eastAsianWidth(codePoint, eastAsianWidthOptions)\n\n // STEP 4: Handle trailing Halfwidth and Fullwidth Forms\n //\n // The Halfwidth and Fullwidth Forms Unicode block (U+FF00-U+FFEF) contains\n // compatibility characters for legacy East Asian encodings.\n //\n // Examples:\n // - \uFF9E (U+FF9E) - Halfwidth Katakana voiced sound mark (dakuten)\n // - \uFF9F (U+FF9F) - Halfwidth Katakana semi-voiced sound mark (handakuten)\n // - \uFF70 (U+FF70) - Halfwidth Katakana-Hiragana prolonged sound mark\n //\n // These can appear as TRAILING characters in a grapheme cluster (not leading).\n // When they do, they add their own width to the cluster.\n //\n // Example: A cluster might be [base character][dakuten]\n // - Base character contributes its width (calculated above)\n // - Dakuten contributes its width (calculated here)\n //\n // Why is this necessary? These forms are spacing characters, not combining marks.\n // They occupy their own column(s) even when following another character.\n //\n // Note: We only check trailing characters (segment.slice(1)).\n // The base character width was already calculated above.\n if (segment.length > 1) {\n for (const char of segment.slice(1)) {\n const charCode = char.charCodeAt(0)\n // Check if character is in Halfwidth and Fullwidth Forms range.\n if (charCode >= 0xff_00 && charCode <= 0xff_ef) {\n const trailingCodePoint = char.codePointAt(0)\n if (trailingCodePoint !== undefined) {\n // Add the East Asian Width of this trailing character.\n // Most halfwidth forms contribute 1 column, fullwidth contribute 2.\n width += eastAsianWidth(trailingCodePoint, eastAsianWidthOptions)\n }\n }\n }\n }\n }\n\n return width\n}\n\n/**\n * Convert a string to kebab-case (handles camelCase and snake_case).\n *\n * Transforms strings from camelCase or snake_case to kebab-case by:\n * - Converting uppercase letters to lowercase\n * - Inserting hyphens before uppercase letters (for camelCase)\n * - Replacing underscores with hyphens (for snake_case)\n *\n * This is more comprehensive than `camelToKebab()` as it handles mixed\n * formats including snake_case. Returns empty string for empty input.\n *\n * @param str - The string to convert\n * @returns The kebab-case string\n *\n * @example\n * ```ts\n * toKebabCase('helloWorld')\n * // Returns: 'hello-world'\n *\n * toKebabCase('hello_world')\n * // Returns: 'hello-world'\n *\n * toKebabCase('XMLHttpRequest')\n * // Returns: 'xmlhttp-request'\n *\n * toKebabCase('iOS_Version')\n * // Returns: 'io-s-version'\n *\n * toKebabCase('')\n * // Returns: ''\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function toKebabCase(str: string): string {\n if (!str.length) {\n return str\n }\n return (\n str\n // Convert camelCase to kebab-case\n .replace(/([a-z]+[0-9]*)([A-Z])/g, '$1-$2')\n // Convert underscores to hyphens\n .replace(/_/g, '-')\n .toLowerCase()\n )\n}\n\n/**\n * Trim newlines from the beginning and end of a string.\n *\n * Removes all leading and trailing newline characters (both `\\n` and `\\r`)\n * from a string, while preserving any newlines in the middle. This is similar\n * to `String.prototype.trim()` but specifically targets newlines instead of\n * all whitespace.\n *\n * Optimized for performance by checking the first and last characters before\n * doing any string manipulation. Returns the original string unchanged if no\n * newlines are found at the edges.\n *\n * @param str - The string to trim\n * @returns The string with leading and trailing newlines removed\n *\n * @example\n * ```ts\n * trimNewlines('\\n\\nhello\\n\\n')\n * // Returns: 'hello'\n *\n * trimNewlines('\\r\\nworld\\r\\n')\n * // Returns: 'world'\n *\n * trimNewlines('hello\\nworld')\n * // Returns: 'hello\\nworld' (middle newline preserved)\n *\n * trimNewlines(' hello ')\n * // Returns: ' hello ' (spaces not trimmed, only newlines)\n *\n * trimNewlines('hello')\n * // Returns: 'hello'\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function trimNewlines(str: string): string {\n const { length } = str\n if (length === 0) {\n return str\n }\n const first = str.charCodeAt(0)\n const noFirstNewline = first !== 13 /*'\\r'*/ && first !== 10 /*'\\n'*/\n if (length === 1) {\n return noFirstNewline ? str : ''\n }\n const last = str.charCodeAt(length - 1)\n const noLastNewline = last !== 13 /*'\\r'*/ && last !== 10 /*'\\n'*/\n if (noFirstNewline && noLastNewline) {\n return str\n }\n let start = 0\n let end = length\n while (start < end) {\n const code = str.charCodeAt(start)\n if (code !== 13 /*'\\r'*/ && code !== 10 /*'\\n'*/) {\n break\n }\n start += 1\n }\n while (end > start) {\n const code = str.charCodeAt(end - 1)\n if (code !== 13 /*'\\r'*/ && code !== 10 /*'\\n'*/) {\n break\n }\n end -= 1\n }\n return start === 0 && end === length ? str : str.slice(start, end)\n}\n\n/**\n * Repeat a string n times.\n *\n * Creates a new string by repeating the input string the specified number of times.\n * Returns an empty string if count is zero or negative. This is a simple wrapper\n * around `String.prototype.repeat()` with guard for non-positive counts.\n *\n * @param str - The string to repeat\n * @param count - The number of times to repeat the string\n * @returns The repeated string, or empty string if count <= 0\n *\n * @example\n * ```ts\n * repeatString('hello', 3)\n * // Returns: 'hellohellohello'\n *\n * repeatString('x', 5)\n * // Returns: 'xxxxx'\n *\n * repeatString('hello', 0)\n * // Returns: ''\n *\n * repeatString('hello', -1)\n * // Returns: ''\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function repeatString(str: string, count: number): string {\n if (count <= 0) {\n return ''\n }\n return str.repeat(count)\n}\n\n/**\n * Center text within a given width.\n *\n * Adds spaces before and after the text to center it within the specified width.\n * Distributes padding evenly on both sides. When the padding is odd, the extra\n * space is added to the right side. Strips ANSI codes before calculating text\n * length to ensure accurate centering of colored text.\n *\n * If the text is already wider than or equal to the target width, returns the\n * original text unchanged (no truncation occurs).\n *\n * @param text - The text to center (may include ANSI codes)\n * @param width - The target width in columns\n * @returns The centered text with padding\n *\n * @example\n * ```ts\n * centerText('hello', 11)\n * // Returns: ' hello ' (3 spaces on each side)\n *\n * centerText('hi', 10)\n * // Returns: ' hi ' (4 spaces on each side)\n *\n * centerText('odd', 8)\n * // Returns: ' odd ' (2 left, 3 right)\n *\n * centerText('\\x1b[31mred\\x1b[0m', 7)\n * // Returns: ' \\x1b[31mred\\x1b[0m ' (ANSI codes preserved, 'red' centered)\n *\n * centerText('too long text', 5)\n * // Returns: 'too long text' (no truncation, returned as-is)\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function centerText(text: string, width: number): string {\n const textLength = stripAnsi(text).length\n if (textLength >= width) {\n return text\n }\n\n const padding = width - textLength\n const leftPad = Math.floor(padding / 2)\n const rightPad = padding - leftPad\n\n return ' '.repeat(leftPad) + text + ' '.repeat(rightPad)\n}\n"],
5
- "mappings": ";4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+CAAAE,EAAA,iBAAAC,EAAA,eAAAC,EAAA,iBAAAC,EAAA,iBAAAC,EAAA,kBAAAC,EAAA,qBAAAC,EAAA,iBAAAC,EAAA,WAAAC,EAAA,gBAAAC,EAAA,uCAAAC,EAAA,gBAAAC,EAAA,iBAAAC,IAAA,eAAAC,EAAAf,GAKA,IAAAgB,EAAqC,kBACrCC,EAA+B,2CAkBxB,MAAMC,EAAe,OAAO,aAkC5B,SAASC,EACdC,EACAC,EACQ,CACR,KAAM,CAAE,OAAAC,EAAS,EAAG,EAAI,CACtB,UAAW,KACX,GAAGD,CACL,EACA,OAAOC,EAAO,OACV,GAAGA,CAAM,GAAGF,EAAI,SAAS;AAAA,CAAI,EAAIA,EAAI,QAAQ,MAAO;AAAA,EAAKE,CAAM,EAAE,EAAIF,CAAG,GACxEA,CACN,CAgCO,SAASG,EAAaH,EAAqB,CAChD,KAAM,CAAE,OAAAI,CAAO,EAAIJ,EACnB,GAAI,CAACI,EACH,MAAO,GAET,IAAIC,EAAS,GACTC,EAAI,EACR,KAAOA,EAAIF,GAAQ,CACjB,MAAMG,EAAOP,EAAIM,CAAC,EAClB,GAAI,CAACC,EACH,MAEF,MAAMC,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AAalC,EAAqB,CAChD,KAAM,CAAE,OAAAI,CAAO,EAAIJ,EACnB,GAAII,IAAW,EACb,OAAOJ,EAET,MAAMmC,EAAQnC,EAAI,WAAW,CAAC,EACxBoC,EAAiBD,IAAU,IAAeA,IAAU,GAC1D,GAAI/B,IAAW,EACb,OAAOgC,EAAiBpC,EAAM,GAEhC,MAAMqC,EAAOrC,EAAI,WAAWI,EAAS,CAAC,EAEtC,GAAIgC,IADkBC,IAAS,IAAeA,IAAS,IAErD,OAAOrC,EAET,IAAIsC,EAAQ,EACRC,EAAMnC,EACV,KAAOkC,EAAQC,GAAK,CAClB,MAAMC,EAAOxC,EAAI,WAAWsC,CAAK,EACjC,GAAIE,IAAS,IAAeA,IAAS,GACnC,MAEFF,GAAS,CACX,CACA,KAAOC,EAAMD,GAAO,CAClB,MAAME,EAAOxC,EAAI,WAAWuC,EAAM,CAAC,EACnC,GAAIC,IAAS,IAAeA,IAAS,GACnC,MAEFD,GAAO,CACT,CACA,OAAOD,IAAU,GAAKC,IAAQnC,EAASJ,EAAMA,EAAI,MAAMsC,EAAOC,CAAG,CACnE,CA6BO,SAASE,EAAazC,EAAaY,EAAuB,CAC/D,OAAIA,GAAS,EACJ,GAEFZ,EAAI,OAAOY,CAAK,CACzB,CAoCO,SAAS8B,EAAWhB,EAAcE,EAAuB,CAC9D,MAAMe,KAAa,aAAUjB,CAAI,EAAE,OACnC,GAAIiB,GAAcf,EAChB,OAAOF,EAGT,MAAMkB,EAAUhB,EAAQe,EAClBE,EAAU,KAAK,MAAMD,EAAU,CAAC,EAChCE,EAAWF,EAAUC,EAE3B,MAAO,IAAI,OAAOA,CAAO,EAAInB,EAAO,IAAI,OAAOoB,CAAQ,CACzD",
6
- "names": ["strings_exports", "__export", "applyLinePrefix", "camelToKebab", "centerText", "fromCharCode", "indentString", "isBlankString", "isNonEmptyString", "repeatString", "search", "stringWidth", "stripBom", "toKebabCase", "trimNewlines", "__toCommonJS", "import_ansi", "import_get_east_asian_width", "fromCharCode", "applyLinePrefix", "str", "options", "prefix", "camelToKebab", "length", "result", "i", "char", "charCode", "currChar", "currCharCode", "indentString", "count", "isBlankString", "value", "isNonEmptyString", "search", "regexp", "fromIndex", "offset", "stripBom", "segmenter", "zeroWidthClusterRegex", "leadingNonPrintingRegex", "emojiRegex", "stringWidth", "text", "plainText", "width", "eastAsianWidthOptions", "segment", "codePoint", "trailingCodePoint", "toKebabCase", "trimNewlines", "first", "noFirstNewline", "last", "start", "end", "code", "repeatString", "centerText", "textLength", "padding", "leftPad", "rightPad"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,kBAAqC;AACrC,kCAA+B;AAkBxB,MAAM,eAAe,OAAO;AAAA;AAkC5B,SAAS,gBACd,KACA,SACQ;AACR,QAAM,EAAE,SAAS,GAAG,IAAI;AAAA,IACtB,WAAW;AAAA,IACX,GAAG;AAAA,EACL;AACA,SAAO,OAAO,SACV,GAAG,MAAM,GAAG,IAAI,SAAS,IAAI,IAAI,IAAI,QAAQ,OAAO;AAAA,EAAK,MAAM,EAAE,IAAI,GAAG,KACxE;AACN;AAAA;AAgCO,SAAS,aAAa,KAAqB;AAChD,QAAM,EAAE,OAAO,IAAI;AACnB,MAAI,CAAC,QAAQ;AACX,WAAO;AAAA,EACT;AACA,MAAI,SAAS;AACb,MAAI,IAAI;AACR,SAAO,IAAI,QAAQ;AACjB,UAAM,OAAO,IAAI,CAAC;AAClB,QAAI,CAAC,MAAM;AACT;AAAA,IACF;AACA,UAAM,WAAW,KAAK,WAAW,CAAC;AAGlC,UAAM,cAAc,YAAY,MAAc,YAAY;AAC1D,QAAI,aAAa;AAEf,UAAI,OAAO,SAAS,GAAG;AACrB,kBAAU;AAAA,MACZ;AAEA,aAAO,IAAI,QAAQ;AACjB,cAAM,WAAW,IAAI,CAAC;AACt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