toolcraft-openapi 0.0.116 → 0.0.117

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/dist/composition.json +26 -1
  2. package/node_modules/@poe-code/frontmatter/package.json +0 -3
  3. package/node_modules/fast-string-truncated-width/dist/index.d.ts +4 -0
  4. package/node_modules/fast-string-truncated-width/dist/index.js +111 -0
  5. package/node_modules/fast-string-truncated-width/dist/types.d.ts +19 -0
  6. package/node_modules/fast-string-truncated-width/dist/types.js +2 -0
  7. package/node_modules/fast-string-truncated-width/dist/utils.d.ts +4 -0
  8. package/node_modules/fast-string-truncated-width/dist/utils.js +20 -0
  9. package/node_modules/fast-string-truncated-width/license +21 -0
  10. package/node_modules/fast-string-truncated-width/package.json +35 -0
  11. package/node_modules/fast-string-truncated-width/readme.md +59 -0
  12. package/node_modules/fast-string-width/dist/index.d.ts +4 -0
  13. package/node_modules/fast-string-width/dist/index.js +14 -0
  14. package/node_modules/fast-string-width/license +21 -0
  15. package/node_modules/fast-string-width/package.json +34 -0
  16. package/node_modules/fast-string-width/readme.md +42 -0
  17. package/node_modules/fast-wrap-ansi/LICENSE +23 -0
  18. package/node_modules/fast-wrap-ansi/README.md +26 -0
  19. package/node_modules/fast-wrap-ansi/lib/main.d.ts +6 -0
  20. package/node_modules/fast-wrap-ansi/lib/main.js +218 -0
  21. package/node_modules/fast-wrap-ansi/package.json +51 -0
  22. package/node_modules/sisteransi/license +21 -0
  23. package/node_modules/sisteransi/package.json +34 -0
  24. package/node_modules/sisteransi/readme.md +113 -0
  25. package/node_modules/sisteransi/src/index.js +58 -0
  26. package/node_modules/sisteransi/src/sisteransi.d.ts +35 -0
  27. package/node_modules/toolcraft-design/package.json +0 -5
  28. package/node_modules/yaml/LICENSE +13 -0
  29. package/node_modules/yaml/README.md +172 -0
  30. package/node_modules/yaml/bin.mjs +11 -0
  31. package/node_modules/yaml/browser/dist/compose/compose-collection.js +88 -0
  32. package/node_modules/yaml/browser/dist/compose/compose-doc.js +43 -0
  33. package/node_modules/yaml/browser/dist/compose/compose-node.js +109 -0
  34. package/node_modules/yaml/browser/dist/compose/compose-scalar.js +86 -0
  35. package/node_modules/yaml/browser/dist/compose/composer.js +219 -0
  36. package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +115 -0
  37. package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +198 -0
  38. package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +49 -0
  39. package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
  40. package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +207 -0
  41. package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +225 -0
  42. package/node_modules/yaml/browser/dist/compose/resolve-props.js +146 -0
  43. package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
  44. package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +26 -0
  45. package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
  46. package/node_modules/yaml/browser/dist/compose/util-map-includes.js +13 -0
  47. package/node_modules/yaml/browser/dist/doc/Document.js +335 -0
  48. package/node_modules/yaml/browser/dist/doc/anchors.js +71 -0
  49. package/node_modules/yaml/browser/dist/doc/applyReviver.js +55 -0
  50. package/node_modules/yaml/browser/dist/doc/createNode.js +88 -0
  51. package/node_modules/yaml/browser/dist/doc/directives.js +176 -0
  52. package/node_modules/yaml/browser/dist/errors.js +57 -0
  53. package/node_modules/yaml/browser/dist/index.js +17 -0
  54. package/node_modules/yaml/browser/dist/log.js +11 -0
  55. package/node_modules/yaml/browser/dist/nodes/Alias.js +116 -0
  56. package/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
  57. package/node_modules/yaml/browser/dist/nodes/Node.js +38 -0
  58. package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
  59. package/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
  60. package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +144 -0
  61. package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +113 -0
  62. package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +63 -0
  63. package/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
  64. package/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
  65. package/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
  66. package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
  67. package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
  68. package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
  69. package/node_modules/yaml/browser/dist/parse/lexer.js +721 -0
  70. package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
  71. package/node_modules/yaml/browser/dist/parse/parser.js +975 -0
  72. package/node_modules/yaml/browser/dist/public-api.js +102 -0
  73. package/node_modules/yaml/browser/dist/schema/Schema.js +37 -0
  74. package/node_modules/yaml/browser/dist/schema/common/map.js +17 -0
  75. package/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
  76. package/node_modules/yaml/browser/dist/schema/common/seq.js +17 -0
  77. package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
  78. package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
  79. package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
  80. package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
  81. package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
  82. package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
  83. package/node_modules/yaml/browser/dist/schema/tags.js +96 -0
  84. package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +58 -0
  85. package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
  86. package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
  87. package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
  88. package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +67 -0
  89. package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +74 -0
  90. package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +78 -0
  91. package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +39 -0
  92. package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +93 -0
  93. package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
  94. package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +146 -0
  95. package/node_modules/yaml/browser/dist/stringify/stringify.js +129 -0
  96. package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +153 -0
  97. package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
  98. package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
  99. package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +25 -0
  100. package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
  101. package/node_modules/yaml/browser/dist/stringify/stringifyString.js +336 -0
  102. package/node_modules/yaml/browser/dist/util.js +11 -0
  103. package/node_modules/yaml/browser/dist/visit.js +233 -0
  104. package/node_modules/yaml/browser/index.js +5 -0
  105. package/node_modules/yaml/browser/package.json +3 -0
  106. package/node_modules/yaml/dist/cli.d.ts +8 -0
  107. package/node_modules/yaml/dist/cli.mjs +201 -0
  108. package/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
  109. package/node_modules/yaml/dist/compose/compose-collection.js +90 -0
  110. package/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
  111. package/node_modules/yaml/dist/compose/compose-doc.js +45 -0
  112. package/node_modules/yaml/dist/compose/compose-node.d.ts +29 -0
  113. package/node_modules/yaml/dist/compose/compose-node.js +112 -0
  114. package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
  115. package/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
  116. package/node_modules/yaml/dist/compose/composer.d.ts +63 -0
  117. package/node_modules/yaml/dist/compose/composer.js +224 -0
  118. package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
  119. package/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
  120. package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
  121. package/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
  122. package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
  123. package/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
  124. package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
  125. package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
  126. package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
  127. package/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
  128. package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
  129. package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +227 -0
  130. package/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
  131. package/node_modules/yaml/dist/compose/resolve-props.js +148 -0
  132. package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
  133. package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
  134. package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
  135. package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
  136. package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
  137. package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
  138. package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
  139. package/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
  140. package/node_modules/yaml/dist/doc/Document.d.ts +141 -0
  141. package/node_modules/yaml/dist/doc/Document.js +337 -0
  142. package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
  143. package/node_modules/yaml/dist/doc/anchors.js +76 -0
  144. package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
  145. package/node_modules/yaml/dist/doc/applyReviver.js +57 -0
  146. package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
  147. package/node_modules/yaml/dist/doc/createNode.js +90 -0
  148. package/node_modules/yaml/dist/doc/directives.d.ts +49 -0
  149. package/node_modules/yaml/dist/doc/directives.js +178 -0
  150. package/node_modules/yaml/dist/errors.d.ts +21 -0
  151. package/node_modules/yaml/dist/errors.js +62 -0
  152. package/node_modules/yaml/dist/index.d.ts +25 -0
  153. package/node_modules/yaml/dist/index.js +50 -0
  154. package/node_modules/yaml/dist/log.d.ts +3 -0
  155. package/node_modules/yaml/dist/log.js +19 -0
  156. package/node_modules/yaml/dist/nodes/Alias.d.ts +29 -0
  157. package/node_modules/yaml/dist/nodes/Alias.js +118 -0
  158. package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
  159. package/node_modules/yaml/dist/nodes/Collection.js +151 -0
  160. package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
  161. package/node_modules/yaml/dist/nodes/Node.js +40 -0
  162. package/node_modules/yaml/dist/nodes/Pair.d.ts +22 -0
  163. package/node_modules/yaml/dist/nodes/Pair.js +39 -0
  164. package/node_modules/yaml/dist/nodes/Scalar.d.ts +47 -0
  165. package/node_modules/yaml/dist/nodes/Scalar.js +27 -0
  166. package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
  167. package/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
  168. package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
  169. package/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
  170. package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
  171. package/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
  172. package/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
  173. package/node_modules/yaml/dist/nodes/identity.js +53 -0
  174. package/node_modules/yaml/dist/nodes/toJS.d.ts +29 -0
  175. package/node_modules/yaml/dist/nodes/toJS.js +39 -0
  176. package/node_modules/yaml/dist/options.d.ts +350 -0
  177. package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
  178. package/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
  179. package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
  180. package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
  181. package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
  182. package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
  183. package/node_modules/yaml/dist/parse/cst.d.ts +109 -0
  184. package/node_modules/yaml/dist/parse/cst.js +112 -0
  185. package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
  186. package/node_modules/yaml/dist/parse/lexer.js +723 -0
  187. package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
  188. package/node_modules/yaml/dist/parse/line-counter.js +41 -0
  189. package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
  190. package/node_modules/yaml/dist/parse/parser.js +980 -0
  191. package/node_modules/yaml/dist/public-api.d.ts +44 -0
  192. package/node_modules/yaml/dist/public-api.js +107 -0
  193. package/node_modules/yaml/dist/schema/Schema.d.ts +17 -0
  194. package/node_modules/yaml/dist/schema/Schema.js +39 -0
  195. package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
  196. package/node_modules/yaml/dist/schema/common/map.js +19 -0
  197. package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
  198. package/node_modules/yaml/dist/schema/common/null.js +17 -0
  199. package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
  200. package/node_modules/yaml/dist/schema/common/seq.js +19 -0
  201. package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
  202. package/node_modules/yaml/dist/schema/common/string.js +16 -0
  203. package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
  204. package/node_modules/yaml/dist/schema/core/bool.js +21 -0
  205. package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
  206. package/node_modules/yaml/dist/schema/core/float.js +47 -0
  207. package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
  208. package/node_modules/yaml/dist/schema/core/int.js +42 -0
  209. package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
  210. package/node_modules/yaml/dist/schema/core/schema.js +25 -0
  211. package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
  212. package/node_modules/yaml/dist/schema/json/schema.js +64 -0
  213. package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
  214. package/node_modules/yaml/dist/schema/tags.d.ts +48 -0
  215. package/node_modules/yaml/dist/schema/tags.js +99 -0
  216. package/node_modules/yaml/dist/schema/types.d.ts +92 -0
  217. package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
  218. package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
  219. package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
  220. package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
  221. package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
  222. package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
  223. package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
  224. package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
  225. package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
  226. package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +71 -0
  227. package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +22 -0
  228. package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
  229. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
  230. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
  231. package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
  232. package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
  233. package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
  234. package/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
  235. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
  236. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
  237. package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
  238. package/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
  239. package/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
  240. package/node_modules/yaml/dist/stringify/stringify.js +132 -0
  241. package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
  242. package/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
  243. package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
  244. package/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
  245. package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
  246. package/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
  247. package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
  248. package/node_modules/yaml/dist/stringify/stringifyNumber.js +27 -0
  249. package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
  250. package/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
  251. package/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
  252. package/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
  253. package/node_modules/yaml/dist/test-events.d.ts +4 -0
  254. package/node_modules/yaml/dist/test-events.js +134 -0
  255. package/node_modules/yaml/dist/util.d.ts +16 -0
  256. package/node_modules/yaml/dist/util.js +28 -0
  257. package/node_modules/yaml/dist/visit.d.ts +102 -0
  258. package/node_modules/yaml/dist/visit.js +236 -0
  259. package/node_modules/yaml/package.json +97 -0
  260. package/node_modules/yaml/util.js +2 -0
  261. package/package.json +9 -5
@@ -0,0 +1,218 @@
1
+ import stringWidth from 'fast-string-width';
2
+ const ESC = '\x1B';
3
+ const CSI = '\x9B';
4
+ const END_CODE = 39;
5
+ const ANSI_ESCAPE_BELL = '\u0007';
6
+ const ANSI_CSI = '[';
7
+ const ANSI_OSC = ']';
8
+ const ANSI_SGR_TERMINATOR = 'm';
9
+ const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
10
+ const GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, 'y');
11
+ const getClosingCode = (openingCode) => {
12
+ if (openingCode >= 30 && openingCode <= 37)
13
+ return 39;
14
+ if (openingCode >= 90 && openingCode <= 97)
15
+ return 39;
16
+ if (openingCode >= 40 && openingCode <= 47)
17
+ return 49;
18
+ if (openingCode >= 100 && openingCode <= 107)
19
+ return 49;
20
+ if (openingCode === 1 || openingCode === 2)
21
+ return 22;
22
+ if (openingCode === 3)
23
+ return 23;
24
+ if (openingCode === 4)
25
+ return 24;
26
+ if (openingCode === 7)
27
+ return 27;
28
+ if (openingCode === 8)
29
+ return 28;
30
+ if (openingCode === 9)
31
+ return 29;
32
+ if (openingCode === 0)
33
+ return 0;
34
+ return undefined;
35
+ };
36
+ const wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
37
+ const wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
38
+ const wrapWord = (rows, word, columns) => {
39
+ const characters = word[Symbol.iterator]();
40
+ let isInsideEscape = false;
41
+ let isInsideLinkEscape = false;
42
+ let lastRow = rows.at(-1);
43
+ let visible = lastRow === undefined ? 0 : stringWidth(lastRow);
44
+ let currentCharacter = characters.next();
45
+ let nextCharacter = characters.next();
46
+ let rawCharacterIndex = 0;
47
+ while (!currentCharacter.done) {
48
+ const character = currentCharacter.value;
49
+ const characterLength = stringWidth(character);
50
+ if (visible + characterLength <= columns) {
51
+ rows[rows.length - 1] += character;
52
+ }
53
+ else {
54
+ rows.push(character);
55
+ visible = 0;
56
+ }
57
+ if (character === ESC || character === CSI) {
58
+ isInsideEscape = true;
59
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
60
+ }
61
+ if (isInsideEscape) {
62
+ if (isInsideLinkEscape) {
63
+ if (character === ANSI_ESCAPE_BELL) {
64
+ isInsideEscape = false;
65
+ isInsideLinkEscape = false;
66
+ }
67
+ }
68
+ else if (character === ANSI_SGR_TERMINATOR) {
69
+ isInsideEscape = false;
70
+ }
71
+ }
72
+ else {
73
+ visible += characterLength;
74
+ if (visible === columns && !nextCharacter.done) {
75
+ rows.push('');
76
+ visible = 0;
77
+ }
78
+ }
79
+ currentCharacter = nextCharacter;
80
+ nextCharacter = characters.next();
81
+ rawCharacterIndex += character.length;
82
+ }
83
+ lastRow = rows.at(-1);
84
+ if (!visible && lastRow !== undefined && lastRow.length && rows.length > 1) {
85
+ rows[rows.length - 2] += rows.pop();
86
+ }
87
+ };
88
+ const stringVisibleTrimSpacesRight = (string) => {
89
+ const words = string.split(' ');
90
+ let last = words.length;
91
+ while (last) {
92
+ if (stringWidth(words[last - 1])) {
93
+ break;
94
+ }
95
+ last--;
96
+ }
97
+ if (last === words.length) {
98
+ return string;
99
+ }
100
+ return words.slice(0, last).join(' ') + words.slice(last).join('');
101
+ };
102
+ const exec = (string, columns, options = {}) => {
103
+ if (options.trim !== false && string.trim() === '') {
104
+ return '';
105
+ }
106
+ let returnValue = '';
107
+ let escapeCode;
108
+ let escapeUrl;
109
+ const words = string.split(' ');
110
+ let rows = [''];
111
+ let rowLength = 0;
112
+ for (let index = 0; index < words.length; index++) {
113
+ const word = words[index];
114
+ if (options.trim !== false) {
115
+ const row = rows.at(-1) ?? '';
116
+ const trimmed = row.trimStart();
117
+ if (row.length !== trimmed.length) {
118
+ rows[rows.length - 1] = trimmed;
119
+ rowLength = stringWidth(trimmed);
120
+ }
121
+ }
122
+ if (index !== 0) {
123
+ if (rowLength >= columns &&
124
+ (options.wordWrap === false || options.trim === false)) {
125
+ rows.push('');
126
+ rowLength = 0;
127
+ }
128
+ if (rowLength || options.trim === false) {
129
+ rows[rows.length - 1] += ' ';
130
+ rowLength++;
131
+ }
132
+ }
133
+ const wordLength = stringWidth(word);
134
+ if (options.hard && wordLength > columns) {
135
+ const remainingColumns = columns - rowLength;
136
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
137
+ const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
138
+ if (breaksStartingNextLine < breaksStartingThisLine) {
139
+ rows.push('');
140
+ }
141
+ wrapWord(rows, word, columns);
142
+ rowLength = stringWidth(rows.at(-1) ?? '');
143
+ continue;
144
+ }
145
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
146
+ if (options.wordWrap === false && rowLength < columns) {
147
+ wrapWord(rows, word, columns);
148
+ rowLength = stringWidth(rows.at(-1) ?? '');
149
+ continue;
150
+ }
151
+ rows.push('');
152
+ rowLength = 0;
153
+ }
154
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
155
+ wrapWord(rows, word, columns);
156
+ rowLength = stringWidth(rows.at(-1) ?? '');
157
+ continue;
158
+ }
159
+ rows[rows.length - 1] += word;
160
+ rowLength += wordLength;
161
+ }
162
+ if (options.trim !== false) {
163
+ rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
164
+ }
165
+ const preString = rows.join('\n');
166
+ let inSurrogate = false;
167
+ for (let i = 0; i < preString.length; i++) {
168
+ const character = preString[i];
169
+ returnValue += character;
170
+ if (!inSurrogate) {
171
+ inSurrogate = character >= '\ud800' && character <= '\udbff';
172
+ if (inSurrogate) {
173
+ continue;
174
+ }
175
+ }
176
+ else {
177
+ inSurrogate = false;
178
+ }
179
+ if (character === ESC || character === CSI) {
180
+ GROUP_REGEX.lastIndex = i + 1;
181
+ const groupsResult = GROUP_REGEX.exec(preString);
182
+ const groups = groupsResult?.groups;
183
+ if (groups?.code !== undefined) {
184
+ const code = Number.parseFloat(groups.code);
185
+ escapeCode = code === END_CODE ? undefined : code;
186
+ }
187
+ else if (groups?.uri !== undefined) {
188
+ escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
189
+ }
190
+ }
191
+ if (preString[i + 1] === '\n') {
192
+ if (escapeUrl) {
193
+ returnValue += wrapAnsiHyperlink('');
194
+ }
195
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;
196
+ if (escapeCode && closingCode) {
197
+ returnValue += wrapAnsiCode(closingCode);
198
+ }
199
+ }
200
+ else if (character === '\n') {
201
+ if (escapeCode && getClosingCode(escapeCode)) {
202
+ returnValue += wrapAnsiCode(escapeCode);
203
+ }
204
+ if (escapeUrl) {
205
+ returnValue += wrapAnsiHyperlink(escapeUrl);
206
+ }
207
+ }
208
+ }
209
+ return returnValue;
210
+ };
211
+ const CRLF_OR_LF = /\r?\n/;
212
+ export function wrapAnsi(string, columns, options) {
213
+ return String(string)
214
+ .normalize()
215
+ .split(CRLF_OR_LF)
216
+ .map((line) => exec(line, columns, options))
217
+ .join('\n');
218
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "fast-wrap-ansi",
3
+ "version": "0.2.2",
4
+ "files": [
5
+ "lib"
6
+ ],
7
+ "description": "A tiny and fast text wrap library which takes ANSI escapes into account.",
8
+ "keywords": [
9
+ "wrap",
10
+ "ansi",
11
+ "term",
12
+ "colors"
13
+ ],
14
+ "homepage": "https://github.com/43081j/fast-wrap-ansi#readme",
15
+ "bugs": {
16
+ "url": "https://github.com/43081j/fast-wrap-ansi/issues"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/43081j/fast-wrap-ansi.git"
21
+ },
22
+ "license": "MIT",
23
+ "author": "James Garbutt (https://github.com/43081j)",
24
+ "type": "module",
25
+ "main": "lib/main.js",
26
+ "scripts": {
27
+ "format": "prettier --write src test",
28
+ "lint": "npm run lint:js && npm run lint:format && npm run lint:types",
29
+ "lint:js": "eslint src test",
30
+ "lint:format": "prettier --check src test",
31
+ "lint:types": "npx tsc --noEmit -p tsconfig.test.json",
32
+ "build": "tsc",
33
+ "test": "vitest run"
34
+ },
35
+ "devDependencies": {
36
+ "@eslint/js": "^10.0.1",
37
+ "@types/node": "^25.8.0",
38
+ "eslint": "^10.4.0",
39
+ "fast-wrap-ansi-prod": "npm:fast-wrap-ansi@*",
40
+ "picocolors": "^1.1.1",
41
+ "prettier": "^3.8.3",
42
+ "tinybench": "^6.0.2",
43
+ "typescript": "^6.0.3",
44
+ "typescript-eslint": "^8.59.3",
45
+ "vitest": "^4.1.6",
46
+ "wrap-ansi": "^10.0.0"
47
+ },
48
+ "dependencies": {
49
+ "fast-string-width": "^3.0.2"
50
+ }
51
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Terkel Gjervig Nielsen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "sisteransi",
3
+ "version": "1.0.5",
4
+ "description": "ANSI escape codes for some terminal swag",
5
+ "main": "src/index.js",
6
+ "license": "MIT",
7
+ "author": {
8
+ "name": "Terkel Gjervig",
9
+ "email": "terkel@terkel.com",
10
+ "url": "https://terkel.com"
11
+ },
12
+ "scripts": {
13
+ "test": "tape test/*.js | tap-spec"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/terkelg/sisteransi"
18
+ },
19
+ "files": [
20
+ "src"
21
+ ],
22
+ "types": "./src/sisteransi.d.ts",
23
+ "keywords": [
24
+ "ansi",
25
+ "escape codes",
26
+ "escape",
27
+ "terminal",
28
+ "style"
29
+ ],
30
+ "devDependencies": {
31
+ "tap-spec": "^5.0.0",
32
+ "tape": "^4.13.2"
33
+ }
34
+ }
@@ -0,0 +1,113 @@
1
+ # sister ANSI [![Version](https://img.shields.io/npm/v/sisteransi.svg)](https://www.npmjs.com/package/sisteransi) [![Build Status](https://travis-ci.org/terkelg/sisteransi.svg?branch=master)](https://travis-ci.org/terkelg/sisteransi) [![Downloads](https://img.shields.io/npm/dm/sisteransi.svg)](https://www.npmjs.com/package/sisteransi)
2
+
3
+ > Ansi escape codes faster than you can say "[Bam bam](https://www.youtube.com/watch?v=OcaPu9JPenU)".
4
+
5
+ ## Installation
6
+
7
+ ```
8
+ npm install sisteransi
9
+ ```
10
+
11
+
12
+ ## Usage
13
+
14
+ ```js
15
+ const ansi = require('sisteransi');
16
+ // or const { cursor } = require('sisteransi');
17
+
18
+ const p = str => process.stdout.write(str);
19
+
20
+ // move cursor to 2, 1
21
+ p(ansi.cursor.to(2, 1));
22
+
23
+ // to up, one down
24
+ p(ansi.cursor.up(2)+ansi.cursor.down(1));
25
+ ```
26
+
27
+ ## API
28
+
29
+ ### cursor
30
+
31
+ #### to(x, y)
32
+ Set the absolute position of the cursor. `x0` `y0` is the top left of the screen.
33
+
34
+ #### move(x, y)
35
+ Set the position of the cursor relative to its current position.
36
+
37
+ #### up(count = 1)
38
+ Move cursor up a specific amount of rows. Default is `1`.
39
+
40
+ #### down(count = 1)
41
+ Move cursor down a specific amount of rows. Default is `1`.
42
+
43
+ #### forward(count = 1)
44
+ Move cursor forward a specific amount of rows. Default is `1`.
45
+
46
+ #### backward(count = 1)
47
+ Move cursor backward a specific amount of rows. Default is `1`.
48
+
49
+ #### nextLine(count = 1)
50
+ Move cursor to the next line a specific amount of lines. Default is `1`.
51
+
52
+ #### prevLine(count = 1)
53
+ Move cursor to the previous a specific amount of lines. Default is `1`.
54
+
55
+ #### left
56
+ Move cursor to the left side.
57
+
58
+ #### hide
59
+ Hide cursor.
60
+
61
+ #### show
62
+ Show cursor.
63
+
64
+ #### save
65
+
66
+ Save cursor position.
67
+
68
+ #### restore
69
+
70
+ Restore cursor position.
71
+
72
+
73
+ ### scroll
74
+
75
+ #### up(count = 1)
76
+ Scroll display up a specific amount of lines. Default to `1`.
77
+
78
+ #### down(count = 1)
79
+ Scroll display down a specific amount of lines. Default to `1`.
80
+
81
+
82
+ ### erase
83
+
84
+ #### screen
85
+ Erase the screen and move the cursor the top left position.
86
+
87
+ #### up(count = 1)
88
+ Erase the screen from the current line up to the top of the screen. Default to `1`.
89
+
90
+ #### down(count = 2)
91
+ Erase the screen from the current line down to the bottom of the screen. Default to `1`.
92
+
93
+ #### line
94
+ Erase the entire current line.
95
+
96
+ #### lineEnd
97
+ Erase from the current cursor position to the end of the current line.
98
+
99
+ #### lineStart
100
+ Erase from the current cursor position to the start of the current line.
101
+
102
+ #### lines(count)
103
+ Erase from the current cursor position up the specified amount of rows.
104
+
105
+
106
+ ## Credit
107
+
108
+ This is a fork of [ansi-escapes](https://github.com/sindresorhus/ansi-escapes).
109
+
110
+
111
+ ## License
112
+
113
+ MIT © [Terkel Gjervig](https://terkel.com)
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ const ESC = '\x1B';
4
+ const CSI = `${ESC}[`;
5
+ const beep = '\u0007';
6
+
7
+ const cursor = {
8
+ to(x, y) {
9
+ if (!y) return `${CSI}${x + 1}G`;
10
+ return `${CSI}${y + 1};${x + 1}H`;
11
+ },
12
+ move(x, y) {
13
+ let ret = '';
14
+
15
+ if (x < 0) ret += `${CSI}${-x}D`;
16
+ else if (x > 0) ret += `${CSI}${x}C`;
17
+
18
+ if (y < 0) ret += `${CSI}${-y}A`;
19
+ else if (y > 0) ret += `${CSI}${y}B`;
20
+
21
+ return ret;
22
+ },
23
+ up: (count = 1) => `${CSI}${count}A`,
24
+ down: (count = 1) => `${CSI}${count}B`,
25
+ forward: (count = 1) => `${CSI}${count}C`,
26
+ backward: (count = 1) => `${CSI}${count}D`,
27
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
28
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
29
+ left: `${CSI}G`,
30
+ hide: `${CSI}?25l`,
31
+ show: `${CSI}?25h`,
32
+ save: `${ESC}7`,
33
+ restore: `${ESC}8`
34
+ }
35
+
36
+ const scroll = {
37
+ up: (count = 1) => `${CSI}S`.repeat(count),
38
+ down: (count = 1) => `${CSI}T`.repeat(count)
39
+ }
40
+
41
+ const erase = {
42
+ screen: `${CSI}2J`,
43
+ up: (count = 1) => `${CSI}1J`.repeat(count),
44
+ down: (count = 1) => `${CSI}J`.repeat(count),
45
+ line: `${CSI}2K`,
46
+ lineEnd: `${CSI}K`,
47
+ lineStart: `${CSI}1K`,
48
+ lines(count) {
49
+ let clear = '';
50
+ for (let i = 0; i < count; i++)
51
+ clear += this.line + (i < count - 1 ? cursor.up() : '');
52
+ if (count)
53
+ clear += cursor.left;
54
+ return clear;
55
+ }
56
+ }
57
+
58
+ module.exports = { cursor, scroll, erase, beep };
@@ -0,0 +1,35 @@
1
+ export const beep: string;
2
+ export const clear: string;
3
+
4
+ export namespace cursor {
5
+ export const left: string;
6
+ export const hide: string;
7
+ export const show: string;
8
+ export const save: string;
9
+ export const restore: string;
10
+
11
+ export function to(x: number, y?: number): string;
12
+ export function move(x: number, y: number): string;
13
+ export function up(count?: number): string;
14
+ export function down(count?: number): string;
15
+ export function forward(count?: number): string;
16
+ export function backward(count?: number): string;
17
+ export function nextLine(count?: number): string;
18
+ export function prevLine(count?: number): string;
19
+ }
20
+
21
+ export namespace scroll {
22
+ export function up(count?: number): string;
23
+ export function down(count?: number): string;
24
+ }
25
+
26
+ export namespace erase {
27
+ export const screen: string;
28
+ export const line: string;
29
+ export const lineEnd: string;
30
+ export const lineStart: string;
31
+
32
+ export function up(count?: number): string;
33
+ export function down(count?: number): string;
34
+ export function lines(count: number): string;
35
+ }
@@ -21,11 +21,6 @@
21
21
  "dist",
22
22
  "LICENSE"
23
23
  ],
24
- "dependencies": {
25
- "fast-string-width": "^3.0.2",
26
- "fast-wrap-ansi": "^0.2.0",
27
- "sisteransi": "^1.0.5"
28
- },
29
24
  "exports": {
30
25
  ".": {
31
26
  "types": "./dist/index.d.ts",
@@ -0,0 +1,13 @@
1
+ Copyright Eemeli Aro <eemeli@gmail.com>
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any purpose
4
+ with or without fee is hereby granted, provided that the above copyright notice
5
+ and this permission notice appear in all copies.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
9
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
11
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
12
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
13
+ THIS SOFTWARE.