structured-outputs 0.1.0-beta.20 → 0.1.0-beta.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (371) hide show
  1. package/README.md +46 -40
  2. package/esm/ResponseFormat.d.ts +21 -0
  3. package/esm/ResponseFormat.d.ts.map +1 -0
  4. package/esm/ResponseFormat.js +43 -19
  5. package/esm/ResponseFormat.js.map +1 -1
  6. package/{types → esm}/Tool.d.ts +1 -0
  7. package/esm/Tool.d.ts.map +1 -0
  8. package/esm/Tool.js +1 -0
  9. package/esm/Tool.js.map +1 -1
  10. package/esm/oai.d.ts +5 -0
  11. package/esm/oai.d.ts.map +1 -0
  12. package/esm/oai.js +2 -0
  13. package/esm/oai.js.map +1 -0
  14. package/esm/types/Ref.d.ts.map +1 -0
  15. package/esm/types/Ref.js +6 -3
  16. package/esm/types/Ref.js.map +1 -1
  17. package/esm/types/RootTy.d.ts +8 -0
  18. package/esm/types/RootTy.d.ts.map +1 -0
  19. package/esm/types/RootTy.js +5 -7
  20. package/esm/types/RootTy.js.map +1 -1
  21. package/esm/types/Ty.d.ts +23 -0
  22. package/esm/types/Ty.d.ts.map +1 -0
  23. package/esm/types/Ty.js +5 -9
  24. package/esm/types/Ty.js.map +1 -1
  25. package/{types → esm}/types/array.d.ts +1 -1
  26. package/{types → esm}/types/array.d.ts.map +1 -1
  27. package/esm/types/array.js +1 -2
  28. package/esm/types/array.js.map +1 -1
  29. package/{types → esm}/types/constant.d.ts.map +1 -1
  30. package/esm/types/constant.js +1 -2
  31. package/esm/types/constant.js.map +1 -1
  32. package/{types → esm}/types/constantUnion.d.ts.map +1 -1
  33. package/esm/types/constantUnion.js +16 -19
  34. package/esm/types/constantUnion.js.map +1 -1
  35. package/{types → esm}/types/mod.d.ts +3 -3
  36. package/esm/types/mod.d.ts.map +1 -0
  37. package/esm/types/mod.js +3 -3
  38. package/esm/types/mod.js.map +1 -1
  39. package/{types → esm}/types/object.d.ts +2 -2
  40. package/{types → esm}/types/object.d.ts.map +1 -1
  41. package/esm/types/object.js +1 -2
  42. package/esm/types/object.js.map +1 -1
  43. package/{types/types/leaves.d.ts → esm/types/primitives.d.ts} +1 -1
  44. package/esm/types/primitives.d.ts.map +1 -0
  45. package/esm/types/primitives.js +14 -0
  46. package/esm/types/primitives.js.map +1 -0
  47. package/esm/types/std/Option.js +1 -1
  48. package/esm/types/std/Option.js.map +1 -1
  49. package/{types → esm}/types/std/Wrapper.d.ts +0 -1
  50. package/esm/types/std/Wrapper.d.ts.map +1 -0
  51. package/esm/types/std/Wrapper.js.map +1 -1
  52. package/{types → esm}/types/taggedUnion.d.ts +2 -2
  53. package/{types → esm}/types/taggedUnion.d.ts.map +1 -1
  54. package/esm/types/taggedUnion.js +1 -2
  55. package/esm/types/taggedUnion.js.map +1 -1
  56. package/package.json +6 -11
  57. package/src/ResponseFormat.ts +48 -41
  58. package/src/Tool.ts +1 -0
  59. package/src/oai.ts +5 -0
  60. package/src/types/Ref.ts +7 -4
  61. package/src/types/RootTy.ts +11 -13
  62. package/src/types/Ty.ts +23 -30
  63. package/src/types/array.ts +2 -3
  64. package/src/types/constant.ts +1 -2
  65. package/src/types/constantUnion.ts +16 -19
  66. package/src/types/mod.ts +3 -3
  67. package/src/types/object.ts +4 -6
  68. package/src/types/primitives.ts +17 -0
  69. package/src/types/std/Option.ts +1 -1
  70. package/src/types/std/Wrapper.ts +0 -2
  71. package/src/types/taggedUnion.ts +3 -4
  72. package/esm/_dnt.shims.js +0 -58
  73. package/esm/_dnt.shims.js.map +0 -1
  74. package/esm/deps/jsr.io/@std/assert/1.0.8/almost_equals.js +0 -47
  75. package/esm/deps/jsr.io/@std/assert/1.0.8/almost_equals.js.map +0 -1
  76. package/esm/deps/jsr.io/@std/assert/1.0.8/array_includes.js +0 -47
  77. package/esm/deps/jsr.io/@std/assert/1.0.8/array_includes.js.map +0 -1
  78. package/esm/deps/jsr.io/@std/assert/1.0.8/assert.js +0 -23
  79. package/esm/deps/jsr.io/@std/assert/1.0.8/assert.js.map +0 -1
  80. package/esm/deps/jsr.io/@std/assert/1.0.8/assertion_error.js +0 -31
  81. package/esm/deps/jsr.io/@std/assert/1.0.8/assertion_error.js.map +0 -1
  82. package/esm/deps/jsr.io/@std/assert/1.0.8/equal.js +0 -184
  83. package/esm/deps/jsr.io/@std/assert/1.0.8/equal.js.map +0 -1
  84. package/esm/deps/jsr.io/@std/assert/1.0.8/equals.js +0 -46
  85. package/esm/deps/jsr.io/@std/assert/1.0.8/equals.js.map +0 -1
  86. package/esm/deps/jsr.io/@std/assert/1.0.8/exists.js +0 -28
  87. package/esm/deps/jsr.io/@std/assert/1.0.8/exists.js.map +0 -1
  88. package/esm/deps/jsr.io/@std/assert/1.0.8/fail.js +0 -21
  89. package/esm/deps/jsr.io/@std/assert/1.0.8/fail.js.map +0 -1
  90. package/esm/deps/jsr.io/@std/assert/1.0.8/false.js +0 -23
  91. package/esm/deps/jsr.io/@std/assert/1.0.8/false.js.map +0 -1
  92. package/esm/deps/jsr.io/@std/assert/1.0.8/greater.js +0 -30
  93. package/esm/deps/jsr.io/@std/assert/1.0.8/greater.js.map +0 -1
  94. package/esm/deps/jsr.io/@std/assert/1.0.8/greater_or_equal.js +0 -30
  95. package/esm/deps/jsr.io/@std/assert/1.0.8/greater_or_equal.js.map +0 -1
  96. package/esm/deps/jsr.io/@std/assert/1.0.8/instance_of.js +0 -53
  97. package/esm/deps/jsr.io/@std/assert/1.0.8/instance_of.js.map +0 -1
  98. package/esm/deps/jsr.io/@std/assert/1.0.8/is_error.js +0 -54
  99. package/esm/deps/jsr.io/@std/assert/1.0.8/is_error.js.map +0 -1
  100. package/esm/deps/jsr.io/@std/assert/1.0.8/less.js +0 -29
  101. package/esm/deps/jsr.io/@std/assert/1.0.8/less.js.map +0 -1
  102. package/esm/deps/jsr.io/@std/assert/1.0.8/less_or_equal.js +0 -30
  103. package/esm/deps/jsr.io/@std/assert/1.0.8/less_or_equal.js.map +0 -1
  104. package/esm/deps/jsr.io/@std/assert/1.0.8/match.js +0 -27
  105. package/esm/deps/jsr.io/@std/assert/1.0.8/match.js.map +0 -1
  106. package/esm/deps/jsr.io/@std/assert/1.0.8/mod.js +0 -46
  107. package/esm/deps/jsr.io/@std/assert/1.0.8/mod.js.map +0 -1
  108. package/esm/deps/jsr.io/@std/assert/1.0.8/not_equals.js +0 -33
  109. package/esm/deps/jsr.io/@std/assert/1.0.8/not_equals.js.map +0 -1
  110. package/esm/deps/jsr.io/@std/assert/1.0.8/not_instance_of.js +0 -30
  111. package/esm/deps/jsr.io/@std/assert/1.0.8/not_instance_of.js.map +0 -1
  112. package/esm/deps/jsr.io/@std/assert/1.0.8/not_match.js +0 -27
  113. package/esm/deps/jsr.io/@std/assert/1.0.8/not_match.js.map +0 -1
  114. package/esm/deps/jsr.io/@std/assert/1.0.8/not_strict_equals.js +0 -33
  115. package/esm/deps/jsr.io/@std/assert/1.0.8/not_strict_equals.js.map +0 -1
  116. package/esm/deps/jsr.io/@std/assert/1.0.8/object_match.js +0 -160
  117. package/esm/deps/jsr.io/@std/assert/1.0.8/object_match.js.map +0 -1
  118. package/esm/deps/jsr.io/@std/assert/1.0.8/rejects.js +0 -54
  119. package/esm/deps/jsr.io/@std/assert/1.0.8/rejects.js.map +0 -1
  120. package/esm/deps/jsr.io/@std/assert/1.0.8/strict_equals.js +0 -58
  121. package/esm/deps/jsr.io/@std/assert/1.0.8/strict_equals.js.map +0 -1
  122. package/esm/deps/jsr.io/@std/assert/1.0.8/string_includes.js +0 -27
  123. package/esm/deps/jsr.io/@std/assert/1.0.8/string_includes.js.map +0 -1
  124. package/esm/deps/jsr.io/@std/assert/1.0.8/throws.js +0 -45
  125. package/esm/deps/jsr.io/@std/assert/1.0.8/throws.js.map +0 -1
  126. package/esm/deps/jsr.io/@std/assert/1.0.8/unimplemented.js +0 -21
  127. package/esm/deps/jsr.io/@std/assert/1.0.8/unimplemented.js.map +0 -1
  128. package/esm/deps/jsr.io/@std/assert/1.0.8/unreachable.js +0 -21
  129. package/esm/deps/jsr.io/@std/assert/1.0.8/unreachable.js.map +0 -1
  130. package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.js +0 -111
  131. package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.js.map +0 -1
  132. package/esm/deps/jsr.io/@std/internal/1.0.5/diff.js +0 -277
  133. package/esm/deps/jsr.io/@std/internal/1.0.5/diff.js.map +0 -1
  134. package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.js +0 -180
  135. package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.js.map +0 -1
  136. package/esm/deps/jsr.io/@std/internal/1.0.5/format.js +0 -38
  137. package/esm/deps/jsr.io/@std/internal/1.0.5/format.js.map +0 -1
  138. package/esm/deps/jsr.io/@std/internal/1.0.5/styles.js +0 -208
  139. package/esm/deps/jsr.io/@std/internal/1.0.5/styles.js.map +0 -1
  140. package/esm/deps/jsr.io/@std/internal/1.0.5/types.js +0 -3
  141. package/esm/deps/jsr.io/@std/internal/1.0.5/types.js.map +0 -1
  142. package/esm/types/leaves.js +0 -18
  143. package/esm/types/leaves.js.map +0 -1
  144. package/src/_dnt.shims.ts +0 -60
  145. package/src/deps/jsr.io/@std/assert/1.0.8/almost_equals.ts +0 -55
  146. package/src/deps/jsr.io/@std/assert/1.0.8/array_includes.ts +0 -57
  147. package/src/deps/jsr.io/@std/assert/1.0.8/assert.ts +0 -23
  148. package/src/deps/jsr.io/@std/assert/1.0.8/assertion_error.ts +0 -31
  149. package/src/deps/jsr.io/@std/assert/1.0.8/equal.ts +0 -210
  150. package/src/deps/jsr.io/@std/assert/1.0.8/equals.ts +0 -52
  151. package/src/deps/jsr.io/@std/assert/1.0.8/exists.ts +0 -31
  152. package/src/deps/jsr.io/@std/assert/1.0.8/fail.ts +0 -21
  153. package/src/deps/jsr.io/@std/assert/1.0.8/false.ts +0 -26
  154. package/src/deps/jsr.io/@std/assert/1.0.8/greater.ts +0 -30
  155. package/src/deps/jsr.io/@std/assert/1.0.8/greater_or_equal.ts +0 -36
  156. package/src/deps/jsr.io/@std/assert/1.0.8/instance_of.ts +0 -64
  157. package/src/deps/jsr.io/@std/assert/1.0.8/is_error.ts +0 -65
  158. package/src/deps/jsr.io/@std/assert/1.0.8/less.ts +0 -29
  159. package/src/deps/jsr.io/@std/assert/1.0.8/less_or_equal.ts +0 -36
  160. package/src/deps/jsr.io/@std/assert/1.0.8/match.ts +0 -30
  161. package/src/deps/jsr.io/@std/assert/1.0.8/mod.ts +0 -47
  162. package/src/deps/jsr.io/@std/assert/1.0.8/not_equals.ts +0 -36
  163. package/src/deps/jsr.io/@std/assert/1.0.8/not_instance_of.ts +0 -33
  164. package/src/deps/jsr.io/@std/assert/1.0.8/not_match.ts +0 -30
  165. package/src/deps/jsr.io/@std/assert/1.0.8/not_strict_equals.ts +0 -42
  166. package/src/deps/jsr.io/@std/assert/1.0.8/object_match.ts +0 -202
  167. package/src/deps/jsr.io/@std/assert/1.0.8/rejects.ts +0 -123
  168. package/src/deps/jsr.io/@std/assert/1.0.8/strict_equals.ts +0 -67
  169. package/src/deps/jsr.io/@std/assert/1.0.8/string_includes.ts +0 -30
  170. package/src/deps/jsr.io/@std/assert/1.0.8/throws.ts +0 -111
  171. package/src/deps/jsr.io/@std/assert/1.0.8/unimplemented.ts +0 -21
  172. package/src/deps/jsr.io/@std/assert/1.0.8/unreachable.ts +0 -21
  173. package/src/deps/jsr.io/@std/internal/1.0.5/build_message.ts +0 -134
  174. package/src/deps/jsr.io/@std/internal/1.0.5/diff.ts +0 -317
  175. package/src/deps/jsr.io/@std/internal/1.0.5/diff_str.ts +0 -204
  176. package/src/deps/jsr.io/@std/internal/1.0.5/format.ts +0 -39
  177. package/src/deps/jsr.io/@std/internal/1.0.5/styles.ts +0 -233
  178. package/src/deps/jsr.io/@std/internal/1.0.5/types.ts +0 -18
  179. package/src/types/leaves.ts +0 -21
  180. package/types/ResponseFormat.d.ts +0 -26
  181. package/types/ResponseFormat.d.ts.map +0 -1
  182. package/types/Tool.d.ts.map +0 -1
  183. package/types/_dnt.shims.d.ts +0 -2
  184. package/types/_dnt.shims.d.ts.map +0 -1
  185. package/types/deps/jsr.io/@std/assert/1.0.8/almost_equals.d.ts +0 -29
  186. package/types/deps/jsr.io/@std/assert/1.0.8/almost_equals.d.ts.map +0 -1
  187. package/types/deps/jsr.io/@std/assert/1.0.8/array_includes.d.ts +0 -24
  188. package/types/deps/jsr.io/@std/assert/1.0.8/array_includes.d.ts.map +0 -1
  189. package/types/deps/jsr.io/@std/assert/1.0.8/assert.d.ts +0 -16
  190. package/types/deps/jsr.io/@std/assert/1.0.8/assert.d.ts.map +0 -1
  191. package/types/deps/jsr.io/@std/assert/1.0.8/assertion_error.d.ts +0 -26
  192. package/types/deps/jsr.io/@std/assert/1.0.8/assertion_error.d.ts.map +0 -1
  193. package/types/deps/jsr.io/@std/assert/1.0.8/equal.d.ts +0 -17
  194. package/types/deps/jsr.io/@std/assert/1.0.8/equal.d.ts.map +0 -1
  195. package/types/deps/jsr.io/@std/assert/1.0.8/equals.d.ts +0 -22
  196. package/types/deps/jsr.io/@std/assert/1.0.8/equals.d.ts.map +0 -1
  197. package/types/deps/jsr.io/@std/assert/1.0.8/exists.d.ts +0 -18
  198. package/types/deps/jsr.io/@std/assert/1.0.8/exists.d.ts.map +0 -1
  199. package/types/deps/jsr.io/@std/assert/1.0.8/fail.d.ts +0 -15
  200. package/types/deps/jsr.io/@std/assert/1.0.8/fail.d.ts.map +0 -1
  201. package/types/deps/jsr.io/@std/assert/1.0.8/false.d.ts +0 -18
  202. package/types/deps/jsr.io/@std/assert/1.0.8/false.d.ts.map +0 -1
  203. package/types/deps/jsr.io/@std/assert/1.0.8/greater.d.ts +0 -20
  204. package/types/deps/jsr.io/@std/assert/1.0.8/greater.d.ts.map +0 -1
  205. package/types/deps/jsr.io/@std/assert/1.0.8/greater_or_equal.d.ts +0 -20
  206. package/types/deps/jsr.io/@std/assert/1.0.8/greater_or_equal.d.ts.map +0 -1
  207. package/types/deps/jsr.io/@std/assert/1.0.8/instance_of.d.ts +0 -23
  208. package/types/deps/jsr.io/@std/assert/1.0.8/instance_of.d.ts.map +0 -1
  209. package/types/deps/jsr.io/@std/assert/1.0.8/is_error.d.ts +0 -25
  210. package/types/deps/jsr.io/@std/assert/1.0.8/is_error.d.ts.map +0 -1
  211. package/types/deps/jsr.io/@std/assert/1.0.8/less.d.ts +0 -19
  212. package/types/deps/jsr.io/@std/assert/1.0.8/less.d.ts.map +0 -1
  213. package/types/deps/jsr.io/@std/assert/1.0.8/less_or_equal.d.ts +0 -20
  214. package/types/deps/jsr.io/@std/assert/1.0.8/less_or_equal.d.ts.map +0 -1
  215. package/types/deps/jsr.io/@std/assert/1.0.8/match.d.ts +0 -18
  216. package/types/deps/jsr.io/@std/assert/1.0.8/match.d.ts.map +0 -1
  217. package/types/deps/jsr.io/@std/assert/1.0.8/mod.d.ts +0 -44
  218. package/types/deps/jsr.io/@std/assert/1.0.8/mod.d.ts.map +0 -1
  219. package/types/deps/jsr.io/@std/assert/1.0.8/not_equals.d.ts +0 -21
  220. package/types/deps/jsr.io/@std/assert/1.0.8/not_equals.d.ts.map +0 -1
  221. package/types/deps/jsr.io/@std/assert/1.0.8/not_instance_of.d.ts +0 -20
  222. package/types/deps/jsr.io/@std/assert/1.0.8/not_instance_of.d.ts.map +0 -1
  223. package/types/deps/jsr.io/@std/assert/1.0.8/not_match.d.ts +0 -18
  224. package/types/deps/jsr.io/@std/assert/1.0.8/not_match.d.ts.map +0 -1
  225. package/types/deps/jsr.io/@std/assert/1.0.8/not_strict_equals.d.ts +0 -23
  226. package/types/deps/jsr.io/@std/assert/1.0.8/not_strict_equals.d.ts.map +0 -1
  227. package/types/deps/jsr.io/@std/assert/1.0.8/object_match.d.ts +0 -28
  228. package/types/deps/jsr.io/@std/assert/1.0.8/object_match.d.ts.map +0 -1
  229. package/types/deps/jsr.io/@std/assert/1.0.8/rejects.d.ts +0 -42
  230. package/types/deps/jsr.io/@std/assert/1.0.8/rejects.d.ts.map +0 -1
  231. package/types/deps/jsr.io/@std/assert/1.0.8/strict_equals.d.ts +0 -24
  232. package/types/deps/jsr.io/@std/assert/1.0.8/strict_equals.d.ts.map +0 -1
  233. package/types/deps/jsr.io/@std/assert/1.0.8/string_includes.d.ts +0 -18
  234. package/types/deps/jsr.io/@std/assert/1.0.8/string_includes.d.ts.map +0 -1
  235. package/types/deps/jsr.io/@std/assert/1.0.8/throws.d.ts +0 -45
  236. package/types/deps/jsr.io/@std/assert/1.0.8/throws.d.ts.map +0 -1
  237. package/types/deps/jsr.io/@std/assert/1.0.8/unimplemented.d.ts +0 -15
  238. package/types/deps/jsr.io/@std/assert/1.0.8/unimplemented.d.ts.map +0 -1
  239. package/types/deps/jsr.io/@std/assert/1.0.8/unreachable.d.ts +0 -15
  240. package/types/deps/jsr.io/@std/assert/1.0.8/unreachable.d.ts.map +0 -1
  241. package/types/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts +0 -82
  242. package/types/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +0 -1
  243. package/types/deps/jsr.io/@std/internal/1.0.5/diff.d.ts +0 -140
  244. package/types/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +0 -1
  245. package/types/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts +0 -99
  246. package/types/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +0 -1
  247. package/types/deps/jsr.io/@std/internal/1.0.5/format.d.ts +0 -2
  248. package/types/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +0 -1
  249. package/types/deps/jsr.io/@std/internal/1.0.5/styles.d.ts +0 -159
  250. package/types/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +0 -1
  251. package/types/deps/jsr.io/@std/internal/1.0.5/types.d.ts +0 -16
  252. package/types/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +0 -1
  253. package/types/types/Ref.d.ts.map +0 -1
  254. package/types/types/RootTy.d.ts +0 -8
  255. package/types/types/RootTy.d.ts.map +0 -1
  256. package/types/types/Ty.d.ts +0 -27
  257. package/types/types/Ty.d.ts.map +0 -1
  258. package/types/types/leaves.d.ts.map +0 -1
  259. package/types/types/mod.d.ts.map +0 -1
  260. package/types/types/std/Wrapper.d.ts.map +0 -1
  261. /package/{types → esm}/_dnt.polyfills.d.ts +0 -0
  262. /package/{types → esm}/_dnt.polyfills.d.ts.map +0 -0
  263. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/_utils.d.ts +0 -0
  264. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/_utils.d.ts.map +0 -0
  265. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/aggregate_groups.d.ts +0 -0
  266. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/aggregate_groups.d.ts.map +0 -0
  267. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/associate_by.d.ts +0 -0
  268. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/associate_by.d.ts.map +0 -0
  269. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/associate_with.d.ts +0 -0
  270. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/associate_with.d.ts.map +0 -0
  271. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/chunk.d.ts +0 -0
  272. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/chunk.d.ts.map +0 -0
  273. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/deep_merge.d.ts +0 -0
  274. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/deep_merge.d.ts.map +0 -0
  275. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/distinct.d.ts +0 -0
  276. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/distinct.d.ts.map +0 -0
  277. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/distinct_by.d.ts +0 -0
  278. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/distinct_by.d.ts.map +0 -0
  279. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/drop_last_while.d.ts +0 -0
  280. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/drop_last_while.d.ts.map +0 -0
  281. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/drop_while.d.ts +0 -0
  282. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/drop_while.d.ts.map +0 -0
  283. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/filter_entries.d.ts +0 -0
  284. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/filter_entries.d.ts.map +0 -0
  285. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/filter_keys.d.ts +0 -0
  286. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/filter_keys.d.ts.map +0 -0
  287. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/filter_values.d.ts +0 -0
  288. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/filter_values.d.ts.map +0 -0
  289. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/find_single.d.ts +0 -0
  290. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/find_single.d.ts.map +0 -0
  291. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/first_not_nullish_of.d.ts +0 -0
  292. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/first_not_nullish_of.d.ts.map +0 -0
  293. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/includes_value.d.ts +0 -0
  294. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/includes_value.d.ts.map +0 -0
  295. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/intersect.d.ts +0 -0
  296. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/intersect.d.ts.map +0 -0
  297. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/invert.d.ts +0 -0
  298. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/invert.d.ts.map +0 -0
  299. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/invert_by.d.ts +0 -0
  300. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/invert_by.d.ts.map +0 -0
  301. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/join_to_string.d.ts +0 -0
  302. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/join_to_string.d.ts.map +0 -0
  303. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/map_entries.d.ts +0 -0
  304. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/map_entries.d.ts.map +0 -0
  305. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/map_keys.d.ts +0 -0
  306. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/map_keys.d.ts.map +0 -0
  307. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/map_not_nullish.d.ts +0 -0
  308. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/map_not_nullish.d.ts.map +0 -0
  309. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/map_values.d.ts +0 -0
  310. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/map_values.d.ts.map +0 -0
  311. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/max_by.d.ts +0 -0
  312. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/max_by.d.ts.map +0 -0
  313. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/max_of.d.ts +0 -0
  314. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/max_of.d.ts.map +0 -0
  315. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/max_with.d.ts +0 -0
  316. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/max_with.d.ts.map +0 -0
  317. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/min_by.d.ts +0 -0
  318. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/min_by.d.ts.map +0 -0
  319. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/min_of.d.ts +0 -0
  320. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/min_of.d.ts.map +0 -0
  321. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/min_with.d.ts +0 -0
  322. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/min_with.d.ts.map +0 -0
  323. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/mod.d.ts +0 -0
  324. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/mod.d.ts.map +0 -0
  325. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/omit.d.ts +0 -0
  326. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/omit.d.ts.map +0 -0
  327. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/partition.d.ts +0 -0
  328. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/partition.d.ts.map +0 -0
  329. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/partition_entries.d.ts +0 -0
  330. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/partition_entries.d.ts.map +0 -0
  331. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/permutations.d.ts +0 -0
  332. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/permutations.d.ts.map +0 -0
  333. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/pick.d.ts +0 -0
  334. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/pick.d.ts.map +0 -0
  335. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/reduce_groups.d.ts +0 -0
  336. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/reduce_groups.d.ts.map +0 -0
  337. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/running_reduce.d.ts +0 -0
  338. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/running_reduce.d.ts.map +0 -0
  339. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/sample.d.ts +0 -0
  340. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/sample.d.ts.map +0 -0
  341. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/sliding_windows.d.ts +0 -0
  342. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/sliding_windows.d.ts.map +0 -0
  343. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/sort_by.d.ts +0 -0
  344. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/sort_by.d.ts.map +0 -0
  345. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/sum_of.d.ts +0 -0
  346. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/sum_of.d.ts.map +0 -0
  347. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/take_last_while.d.ts +0 -0
  348. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/take_last_while.d.ts.map +0 -0
  349. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/take_while.d.ts +0 -0
  350. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/take_while.d.ts.map +0 -0
  351. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/union.d.ts +0 -0
  352. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/union.d.ts.map +0 -0
  353. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/unzip.d.ts +0 -0
  354. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/unzip.d.ts.map +0 -0
  355. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/without_all.d.ts +0 -0
  356. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/without_all.d.ts.map +0 -0
  357. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/zip.d.ts +0 -0
  358. /package/{types → esm}/deps/jsr.io/@std/collections/1.0.9/zip.d.ts.map +0 -0
  359. /package/{types → esm}/mod.d.ts +0 -0
  360. /package/{types → esm}/mod.d.ts.map +0 -0
  361. /package/{types → esm}/types/Ref.d.ts +0 -0
  362. /package/{types → esm}/types/constant.d.ts +0 -0
  363. /package/{types → esm}/types/constantUnion.d.ts +0 -0
  364. /package/{types → esm}/types/std/Option.d.ts +0 -0
  365. /package/{types → esm}/types/std/Option.d.ts.map +0 -0
  366. /package/{types → esm}/types/std/mod.d.ts +0 -0
  367. /package/{types → esm}/types/std/mod.d.ts.map +0 -0
  368. /package/{types → esm}/util/phantoms.d.ts +0 -0
  369. /package/{types → esm}/util/phantoms.d.ts.map +0 -0
  370. /package/{types → esm}/util/recombineTaggedTemplateArgs.d.ts +0 -0
  371. /package/{types → esm}/util/recombineTaggedTemplateArgs.d.ts.map +0 -0
@@ -1,180 +0,0 @@
1
- import { diff } from "./diff.js";
2
- /**
3
- * Unescape invisible characters.
4
- *
5
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#escape_sequences}
6
- *
7
- * @param string String to unescape.
8
- *
9
- * @returns Unescaped string.
10
- *
11
- * @example Usage
12
- * ```ts
13
- * import { unescape } from "@std/internal/diff-str";
14
- * import { assertEquals } from "@std/assert";
15
- *
16
- * assertEquals(unescape("Hello\nWorld"), "Hello\\n\nWorld");
17
- * ```
18
- */
19
- export function unescape(string) {
20
- return string
21
- .replaceAll("\b", "\\b")
22
- .replaceAll("\f", "\\f")
23
- .replaceAll("\t", "\\t")
24
- .replaceAll("\v", "\\v")
25
- // This does not remove line breaks
26
- .replaceAll(/\r\n|\r|\n/g, (str) => str === "\r" ? "\\r" : str === "\n" ? "\\n\n" : "\\r\\n\r\n");
27
- }
28
- const WHITESPACE_SYMBOLS = /([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/;
29
- /**
30
- * Tokenizes a string into an array of tokens.
31
- *
32
- * @param string The string to tokenize.
33
- * @param wordDiff If true, performs word-based tokenization. Default is false.
34
- *
35
- * @returns An array of tokens.
36
- *
37
- * @example Usage
38
- * ```ts
39
- * import { tokenize } from "@std/internal/diff-str";
40
- * import { assertEquals } from "@std/assert";
41
- *
42
- * assertEquals(tokenize("Hello\nWorld"), ["Hello\n", "World"]);
43
- * ```
44
- */
45
- export function tokenize(string, wordDiff = false) {
46
- if (wordDiff) {
47
- return string
48
- .split(WHITESPACE_SYMBOLS)
49
- .filter((token) => token);
50
- }
51
- const tokens = [];
52
- const lines = string.split(/(\n|\r\n)/).filter((line) => line);
53
- for (const [i, line] of lines.entries()) {
54
- if (i % 2) {
55
- tokens[tokens.length - 1] += line;
56
- }
57
- else {
58
- tokens.push(line);
59
- }
60
- }
61
- return tokens;
62
- }
63
- /**
64
- * Create details by filtering relevant word-diff for current line and merge
65
- * "space-diff" if surrounded by word-diff for cleaner displays.
66
- *
67
- * @param line Current line
68
- * @param tokens Word-diff tokens
69
- *
70
- * @returns Array of diff results.
71
- *
72
- * @example Usage
73
- * ```ts
74
- * import { createDetails } from "@std/internal/diff-str";
75
- * import { assertEquals } from "@std/assert";
76
- *
77
- * const tokens = [
78
- * { type: "added", value: "a" },
79
- * { type: "removed", value: "b" },
80
- * { type: "common", value: "c" },
81
- * ] as const;
82
- * assertEquals(
83
- * createDetails({ type: "added", value: "a" }, [...tokens]),
84
- * [{ type: "added", value: "a" }, { type: "common", value: "c" }]
85
- * );
86
- * ```
87
- */
88
- export function createDetails(line, tokens) {
89
- return tokens.filter(({ type }) => type === line.type || type === "common")
90
- .map((result, i, t) => {
91
- const token = t[i - 1];
92
- if ((result.type === "common") && token &&
93
- (token.type === t[i + 1]?.type) && /\s+/.test(result.value)) {
94
- return {
95
- ...result,
96
- type: token.type,
97
- };
98
- }
99
- return result;
100
- });
101
- }
102
- const NON_WHITESPACE_REGEXP = /\S/;
103
- /**
104
- * Renders the differences between the actual and expected strings. Partially
105
- * inspired from {@link https://github.com/kpdecker/jsdiff}.
106
- *
107
- * @param A Actual string
108
- * @param B Expected string
109
- *
110
- * @returns Array of diff results.
111
- *
112
- * @example Usage
113
- * ```ts
114
- * import { diffStr } from "@std/internal/diff-str";
115
- * import { assertEquals } from "@std/assert";
116
- *
117
- * assertEquals(diffStr("Hello!", "Hello"), [
118
- * {
119
- * type: "removed",
120
- * value: "Hello!\n",
121
- * details: [
122
- * { type: "common", value: "Hello" },
123
- * { type: "removed", value: "!" },
124
- * { type: "common", value: "\n" }
125
- * ]
126
- * },
127
- * {
128
- * type: "added",
129
- * value: "Hello\n",
130
- * details: [
131
- * { type: "common", value: "Hello" },
132
- * { type: "common", value: "\n" }
133
- * ]
134
- * }
135
- * ]);
136
- * ```
137
- */
138
- export function diffStr(A, B) {
139
- // Compute multi-line diff
140
- const diffResult = diff(tokenize(`${unescape(A)}\n`), tokenize(`${unescape(B)}\n`));
141
- const added = [];
142
- const removed = [];
143
- for (const result of diffResult) {
144
- if (result.type === "added") {
145
- added.push(result);
146
- }
147
- if (result.type === "removed") {
148
- removed.push(result);
149
- }
150
- }
151
- // Compute word-diff
152
- const hasMoreRemovedLines = added.length < removed.length;
153
- const aLines = hasMoreRemovedLines ? added : removed;
154
- const bLines = hasMoreRemovedLines ? removed : added;
155
- for (const a of aLines) {
156
- let tokens = [];
157
- let b;
158
- // Search another diff line with at least one common token
159
- while (bLines.length) {
160
- b = bLines.shift();
161
- const tokenized = [
162
- tokenize(a.value, true),
163
- tokenize(b.value, true),
164
- ];
165
- if (hasMoreRemovedLines)
166
- tokenized.reverse();
167
- tokens = diff(tokenized[0], tokenized[1]);
168
- if (tokens.some(({ type, value }) => type === "common" && NON_WHITESPACE_REGEXP.test(value))) {
169
- break;
170
- }
171
- }
172
- // Register word-diff details
173
- a.details = createDetails(a, tokens);
174
- if (b) {
175
- b.details = createDetails(b, tokens);
176
- }
177
- }
178
- return diffResult;
179
- }
180
- //# sourceMappingURL=diff_str.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"diff_str.js","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.5/diff_str.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAc;IACrC,OAAO,MAAM;SACV,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC;SACvB,UAAU,CAA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,MAAM,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -1,38 +0,0 @@
1
- // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2
- // This module is browser compatible.
3
- /**
4
- * Converts the input into a string. Objects, Sets and Maps are sorted so as to
5
- * make tests less flaky.
6
- *
7
- * @param v Value to be formatted
8
- *
9
- * @returns The formatted string
10
- *
11
- * @example Usage
12
- * ```ts
13
- * import { format } from "@std/internal/format";
14
- * import { assertEquals } from "@std/assert";
15
- *
16
- * assertEquals(format({ a: 1, b: 2 }), "{\n a: 1,\n b: 2,\n}");
17
- * assertEquals(format(new Set([1, 2])), "Set(2) {\n 1,\n 2,\n}");
18
- * assertEquals(format(new Map([[1, 2]])), "Map(1) {\n 1 => 2,\n}");
19
- * ```
20
- */
21
- import * as dntShim from "../../../../../_dnt.shims.js";
22
- export function format(v) {
23
- // deno-lint-ignore no-explicit-any
24
- const { Deno } = dntShim.dntGlobalThis;
25
- return typeof Deno?.inspect === "function"
26
- ? Deno.inspect(v, {
27
- depth: Infinity,
28
- sorted: true,
29
- trailingComma: true,
30
- compact: false,
31
- iterableLimit: Infinity,
32
- // getters should be true in assertEquals.
33
- getters: true,
34
- strAbbreviateSize: Infinity,
35
- })
36
- : `"${String(v).replace(/(?=["\\])/g, "\\")}"`;
37
- }
38
- //# sourceMappingURL=format.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"format.js","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.5/format.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qCAAqC;AAErC;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAC;AAExD,MAAM,UAAU,MAAM,CAAC,CAAU;IAC/B,mCAAmC;IACnC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,aAAoB,CAAC;IAC9C,OAAO,OAAO,IAAI,EAAE,OAAO,KAAK,UAAU;QACxC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE;YAChB,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,IAAI;YACZ,aAAa,EAAE,IAAI;YACnB,OAAO,EAAE,KAAK;YACd,aAAa,EAAE,QAAQ;YACvB,0CAA0C;YAC1C,OAAO,EAAE,IAAI;YACb,iBAAiB,EAAE,QAAQ;SAC5B,CAAC;QACF,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC;AACnD,CAAC"}
@@ -1,208 +0,0 @@
1
- // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2
- // This module is browser compatible.
3
- // A module to print ANSI terminal colors. Inspired by chalk, kleur, and colors
4
- // on npm.
5
- // This code is vendored from `fmt/colors.ts`.
6
- // deno-lint-ignore no-explicit-any
7
- import * as dntShim from "../../../../../_dnt.shims.js";
8
- const { Deno } = dntShim.dntGlobalThis;
9
- const noColor = typeof Deno?.noColor === "boolean"
10
- ? Deno.noColor
11
- : false;
12
- const enabled = !noColor;
13
- function code(open, close) {
14
- return {
15
- open: `\x1b[${open.join(";")}m`,
16
- close: `\x1b[${close}m`,
17
- regexp: new RegExp(`\\x1b\\[${close}m`, "g"),
18
- };
19
- }
20
- function run(str, code) {
21
- return enabled
22
- ? `${code.open}${str.replace(code.regexp, code.open)}${code.close}`
23
- : str;
24
- }
25
- /**
26
- * Sets the style of text to be printed to bold.
27
- *
28
- * Disable by setting the `NO_COLOR` environmental variable.
29
- *
30
- * @param str Text to make bold
31
- *
32
- * @returns Bold text for printing
33
- *
34
- * @example Usage
35
- * ```ts no-assert
36
- * import { bold } from "@std/internal/styles";
37
- *
38
- * console.log(bold("Hello, world!")); // Prints "Hello, world!" in bold
39
- * ```
40
- */
41
- export function bold(str) {
42
- return run(str, code([1], 22));
43
- }
44
- /**
45
- * Sets the color of text to be printed to red.
46
- *
47
- * Disable by setting the `NO_COLOR` environmental variable.
48
- *
49
- * @param str Text to make red
50
- *
51
- * @returns Red text for printing
52
- *
53
- * @example Usage
54
- * ```ts no-assert
55
- * import { red } from "@std/internal/styles";
56
- *
57
- * console.log(red("Hello, world!")); // Prints "Hello, world!" in red
58
- * ```
59
- */
60
- export function red(str) {
61
- return run(str, code([31], 39));
62
- }
63
- /**
64
- * Sets the color of text to be printed to green.
65
- *
66
- * Disable by setting the `NO_COLOR` environmental variable.
67
- *
68
- * @param str Text to make green
69
- *
70
- * @returns Green text for print
71
- *
72
- * @example Usage
73
- * ```ts no-assert
74
- * import { green } from "@std/internal/styles";
75
- *
76
- * console.log(green("Hello, world!")); // Prints "Hello, world!" in green
77
- * ```
78
- */
79
- export function green(str) {
80
- return run(str, code([32], 39));
81
- }
82
- /**
83
- * Sets the color of text to be printed to yellow.
84
- *
85
- * Disable by setting the `NO_COLOR` environmental variable.
86
- *
87
- * @param str Text to make yellow
88
- *
89
- * @returns Yellow text for print
90
- *
91
- * @example Usage
92
- * ```ts no-assert
93
- * import { yellow } from "@std/internal/styles";
94
- *
95
- * console.log(yellow("Hello, world!")); // Prints "Hello, world!" in yellow
96
- * ```
97
- */
98
- export function yellow(str) {
99
- return run(str, code([33], 39));
100
- }
101
- /**
102
- * Sets the color of text to be printed to white.
103
- *
104
- * @param str Text to make white
105
- *
106
- * @returns White text for print
107
- *
108
- * @example Usage
109
- * ```ts no-assert
110
- * import { white } from "@std/internal/styles";
111
- *
112
- * console.log(white("Hello, world!")); // Prints "Hello, world!" in white
113
- * ```
114
- */
115
- export function white(str) {
116
- return run(str, code([37], 39));
117
- }
118
- /**
119
- * Sets the color of text to be printed to gray.
120
- *
121
- * @param str Text to make gray
122
- *
123
- * @returns Gray text for print
124
- *
125
- * @example Usage
126
- * ```ts no-assert
127
- * import { gray } from "@std/internal/styles";
128
- *
129
- * console.log(gray("Hello, world!")); // Prints "Hello, world!" in gray
130
- * ```
131
- */
132
- export function gray(str) {
133
- return brightBlack(str);
134
- }
135
- /**
136
- * Sets the color of text to be printed to bright-black.
137
- *
138
- * @param str Text to make bright-black
139
- *
140
- * @returns Bright-black text for print
141
- *
142
- * @example Usage
143
- * ```ts no-assert
144
- * import { brightBlack } from "@std/internal/styles";
145
- *
146
- * console.log(brightBlack("Hello, world!")); // Prints "Hello, world!" in bright-black
147
- * ```
148
- */
149
- export function brightBlack(str) {
150
- return run(str, code([90], 39));
151
- }
152
- /**
153
- * Sets the background color of text to be printed to red.
154
- *
155
- * @param str Text to make its background red
156
- *
157
- * @returns Red background text for print
158
- *
159
- * @example Usage
160
- * ```ts no-assert
161
- * import { bgRed } from "@std/internal/styles";
162
- *
163
- * console.log(bgRed("Hello, world!")); // Prints "Hello, world!" with red background
164
- * ```
165
- */
166
- export function bgRed(str) {
167
- return run(str, code([41], 49));
168
- }
169
- /**
170
- * Sets the background color of text to be printed to green.
171
- *
172
- * @param str Text to make its background green
173
- *
174
- * @returns Green background text for print
175
- *
176
- * @example Usage
177
- * ```ts no-assert
178
- * import { bgGreen } from "@std/internal/styles";
179
- *
180
- * console.log(bgGreen("Hello, world!")); // Prints "Hello, world!" with green background
181
- * ```
182
- */
183
- export function bgGreen(str) {
184
- return run(str, code([42], 49));
185
- }
186
- // https://github.com/chalk/ansi-regex/blob/02fa893d619d3da85411acc8fd4e2eea0e95a9d9/index.js
187
- const ANSI_PATTERN = new RegExp([
188
- "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
189
- "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TXZcf-nq-uy=><~]))",
190
- ].join("|"), "g");
191
- /**
192
- * Remove ANSI escape codes from the string.
193
- *
194
- * @param string Text to remove ANSI escape codes from
195
- *
196
- * @returns Text without ANSI escape codes
197
- *
198
- * @example Usage
199
- * ```ts no-assert
200
- * import { red, stripAnsiCode } from "@std/internal/styles";
201
- *
202
- * console.log(stripAnsiCode(red("Hello, world!"))); // Prints "Hello, world!"
203
- * ```
204
- */
205
- export function stripAnsiCode(string) {
206
- return string.replace(ANSI_PATTERN, "");
207
- }
208
- //# sourceMappingURL=styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.5/styles.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qCAAqC;AACrC,+EAA+E;AAC/E,UAAU;AAEV,8CAA8C;AAE9C,mCAAmC;AACnC,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAC;AAExD,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,aAAoB,CAAC;AAC9C,MAAM,OAAO,GAAG,OAAO,IAAI,EAAE,OAAO,KAAK,SAAS;IAChD,CAAC,CAAC,IAAI,CAAC,OAAkB;IACzB,CAAC,CAAC,KAAK,CAAC;AAQV,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC;AAEzB,SAAS,IAAI,CAAC,IAAc,EAAE,KAAa;IACzC,OAAO;QACL,IAAI,EAAE,QAAQ,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG;QAC/B,KAAK,EAAE,QAAQ,KAAK,GAAG;QACvB,MAAM,EAAE,IAAI,MAAM,CAAC,WAAW,KAAK,GAAG,EAAE,GAAG,CAAC;KAC7C,CAAC;AACJ,CAAC;AAED,SAAS,GAAG,CAAC,GAAW,EAAE,IAAU;IAClC,OAAO,OAAO;QACZ,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE;QACnE,CAAC,CAAC,GAAG,CAAC;AACV,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,IAAI,CAAC,GAAW;IAC9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AAClC,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,OAAO,CAAC,GAAW;IACjC,OAAO,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAClC,CAAC;AAED,6FAA6F;AAC7F,MAAM,YAAY,GAAG,IAAI,MAAM,CAC7B;IACE,8HAA8H;IAC9H,2DAA2D;CAC5D,CAAC,IAAI,CAAC,GAAG,CAAC,EACX,GAAG,CACJ,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,OAAO,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAC1C,CAAC"}
@@ -1,3 +0,0 @@
1
- // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2
- export {};
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.5/types.ts"],"names":[],"mappings":"AAAA,0EAA0E"}
@@ -1,18 +0,0 @@
1
- import { Ty } from "./Ty.js";
2
- export const none = Ty((description) => ({
3
- type: "null",
4
- description,
5
- }));
6
- export const boolean = Ty((description) => ({
7
- type: "boolean",
8
- description,
9
- }));
10
- export const number = Ty((description) => ({
11
- type: "number",
12
- description,
13
- }));
14
- export const string = Ty((description) => ({
15
- type: "string",
16
- description,
17
- }));
18
- //# sourceMappingURL=leaves.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"leaves.js","sourceRoot":"","sources":["../../src/types/leaves.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B,MAAM,CAAC,MAAM,IAAI,GAAoB,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACxD,IAAI,EAAE,MAAM;IACZ,WAAW;CACZ,CAAC,CAAC,CAAA;AAEH,MAAM,CAAC,MAAM,OAAO,GAAuB,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC9D,IAAI,EAAE,SAAS;IACf,WAAW;CACZ,CAAC,CAAC,CAAA;AAEH,MAAM,CAAC,MAAM,MAAM,GAAsB,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC5D,IAAI,EAAE,QAAQ;IACd,WAAW;CACZ,CAAC,CAAC,CAAA;AAEH,MAAM,CAAC,MAAM,MAAM,GAAsB,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC5D,IAAI,EAAE,QAAQ;IACd,WAAW;CACZ,CAAC,CAAC,CAAA"}
package/src/_dnt.shims.ts DELETED
@@ -1,60 +0,0 @@
1
- const dntGlobals = {
2
- };
3
- export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
4
-
5
- function createMergeProxy<T extends object, U extends object>(
6
- baseObj: T,
7
- extObj: U,
8
- ): Omit<T, keyof U> & U {
9
- return new Proxy(baseObj, {
10
- get(_target, prop, _receiver) {
11
- if (prop in extObj) {
12
- return (extObj as any)[prop];
13
- } else {
14
- return (baseObj as any)[prop];
15
- }
16
- },
17
- set(_target, prop, value) {
18
- if (prop in extObj) {
19
- delete (extObj as any)[prop];
20
- }
21
- (baseObj as any)[prop] = value;
22
- return true;
23
- },
24
- deleteProperty(_target, prop) {
25
- let success = false;
26
- if (prop in extObj) {
27
- delete (extObj as any)[prop];
28
- success = true;
29
- }
30
- if (prop in baseObj) {
31
- delete (baseObj as any)[prop];
32
- success = true;
33
- }
34
- return success;
35
- },
36
- ownKeys(_target) {
37
- const baseKeys = Reflect.ownKeys(baseObj);
38
- const extKeys = Reflect.ownKeys(extObj);
39
- const extKeysSet = new Set(extKeys);
40
- return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
41
- },
42
- defineProperty(_target, prop, desc) {
43
- if (prop in extObj) {
44
- delete (extObj as any)[prop];
45
- }
46
- Reflect.defineProperty(baseObj, prop, desc);
47
- return true;
48
- },
49
- getOwnPropertyDescriptor(_target, prop) {
50
- if (prop in extObj) {
51
- return Reflect.getOwnPropertyDescriptor(extObj, prop);
52
- } else {
53
- return Reflect.getOwnPropertyDescriptor(baseObj, prop);
54
- }
55
- },
56
- has(_target, prop) {
57
- return prop in extObj || prop in baseObj;
58
- },
59
- }) as any;
60
- }
@@ -1,55 +0,0 @@
1
- // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2
- // This module is browser compatible.
3
- import { AssertionError } from "./assertion_error.js";
4
-
5
- /**
6
- * Make an assertion that `actual` and `expected` are almost equal numbers
7
- * through a given tolerance. It can be used to take into account IEEE-754
8
- * double-precision floating-point representation limitations. If the values
9
- * are not almost equal then throw.
10
- *
11
- * The default tolerance is one hundred thousandth of a percent of the
12
- * expected value.
13
- *
14
- * @example Usage
15
- * ```ts ignore
16
- * import { assertAlmostEquals } from "@std/assert";
17
- *
18
- * assertAlmostEquals(0.01, 0.02); // Throws
19
- * assertAlmostEquals(1e-8, 1e-9); // Throws
20
- * assertAlmostEquals(1.000000001e-8, 1.000000002e-8); // Doesn't throw
21
- * assertAlmostEquals(0.01, 0.02, 0.1); // Doesn't throw
22
- * assertAlmostEquals(0.1 + 0.2, 0.3, 1e-16); // Doesn't throw
23
- * assertAlmostEquals(0.1 + 0.2, 0.3, 1e-17); // Throws
24
- * ```
25
- *
26
- * @param actual The actual value to compare.
27
- * @param expected The expected value to compare.
28
- * @param tolerance The tolerance to consider the values almost equal. The
29
- * default is one hundred thousandth of a percent of the expected value.
30
- * @param msg The optional message to include in the error.
31
- */
32
- export function assertAlmostEquals(
33
- actual: number,
34
- expected: number,
35
- tolerance?: number,
36
- msg?: string,
37
- ) {
38
- if (Object.is(actual, expected)) {
39
- return;
40
- }
41
- const delta = Math.abs(expected - actual);
42
- if (tolerance === undefined) {
43
- tolerance = isFinite(expected) ? Math.abs(expected * 1e-7) : 1e-7;
44
- }
45
- if (delta <= tolerance) {
46
- return;
47
- }
48
-
49
- const msgSuffix = msg ? `: ${msg}` : ".";
50
- const f = (n: number) => Number.isInteger(n) ? n : n.toExponential();
51
- throw new AssertionError(
52
- `Expected actual: "${f(actual)}" to be close to "${f(expected)}": \
53
- delta "${f(delta)}" is greater than "${f(tolerance)}"${msgSuffix}`,
54
- );
55
- }
@@ -1,57 +0,0 @@
1
- // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2
- // This module is browser compatible.
3
- import { equal } from "./equal.js";
4
- import { format } from "../../internal/1.0.5/format.js";
5
- import { AssertionError } from "./assertion_error.js";
6
-
7
- /** An array-like object (`Array`, `Uint8Array`, `NodeList`, etc.) that is not a string */
8
- export type ArrayLikeArg<T> = ArrayLike<T> & object;
9
-
10
- /**
11
- * Make an assertion that `actual` includes the `expected` values. If not then
12
- * an error will be thrown.
13
- *
14
- * Type parameter can be specified to ensure values under comparison have the
15
- * same type.
16
- *
17
- * @example Usage
18
- * ```ts ignore
19
- * import { assertArrayIncludes } from "@std/assert";
20
- *
21
- * assertArrayIncludes([1, 2], [2]); // Doesn't throw
22
- * assertArrayIncludes([1, 2], [3]); // Throws
23
- * ```
24
- *
25
- * @typeParam T The type of the elements in the array to compare.
26
- * @param actual The array-like object to check for.
27
- * @param expected The array-like object to check for.
28
- * @param msg The optional message to display if the assertion fails.
29
- */
30
- export function assertArrayIncludes<T>(
31
- actual: ArrayLikeArg<T>,
32
- expected: ArrayLikeArg<T>,
33
- msg?: string,
34
- ) {
35
- const missing: unknown[] = [];
36
- for (let i = 0; i < expected.length; i++) {
37
- let found = false;
38
- for (let j = 0; j < actual.length; j++) {
39
- if (equal(expected[i], actual[j])) {
40
- found = true;
41
- break;
42
- }
43
- }
44
- if (!found) {
45
- missing.push(expected[i]);
46
- }
47
- }
48
- if (missing.length === 0) {
49
- return;
50
- }
51
-
52
- const msgSuffix = msg ? `: ${msg}` : ".";
53
- msg = `Expected actual: "${format(actual)}" to include: "${
54
- format(expected)
55
- }"${msgSuffix}\nmissing: ${format(missing)}`;
56
- throw new AssertionError(msg);
57
- }
@@ -1,23 +0,0 @@
1
- // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2
- // This module is browser compatible.
3
- import { AssertionError } from "./assertion_error.js";
4
-
5
- /**
6
- * Make an assertion, error will be thrown if `expr` does not have truthy value.
7
- *
8
- * @example Usage
9
- * ```ts ignore
10
- * import { assert } from "@std/assert";
11
- *
12
- * assert("hello".includes("ello")); // Doesn't throw
13
- * assert("hello".includes("world")); // Throws
14
- * ```
15
- *
16
- * @param expr The expression to test.
17
- * @param msg The optional message to display if the assertion fails.
18
- */
19
- export function assert(expr: unknown, msg = ""): asserts expr {
20
- if (!expr) {
21
- throw new AssertionError(msg);
22
- }
23
- }