veryfront 0.1.324 → 0.1.327

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 (277) hide show
  1. package/esm/cli/commands/extension/init-command.js +2 -2
  2. package/esm/cli/commands/extension/validate-command.js +1 -1
  3. package/esm/deno.d.ts +7 -0
  4. package/esm/deno.js +8 -1
  5. package/esm/deps/esm.sh/react-dom@19.2.4/client.d.ts +2 -0
  6. package/esm/deps/esm.sh/react-dom@19.2.4/client.d.ts.map +1 -0
  7. package/esm/deps/esm.sh/react-dom@19.2.4/client.js +5 -0
  8. package/esm/deps/esm.sh/scheduler@^0.27.0.d.ts +2 -0
  9. package/esm/deps/esm.sh/scheduler@^0.27.0.d.ts.map +1 -0
  10. package/esm/deps/esm.sh/scheduler@^0.27.0.js +3 -0
  11. package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.d.ts +30 -0
  12. package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.d.ts.map +1 -0
  13. package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.js +47 -0
  14. package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.d.ts +29 -0
  15. package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.d.ts.map +1 -0
  16. package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.js +65 -0
  17. package/esm/deps/jsr.io/@std/assert/1.0.19/assert.d.ts +17 -0
  18. package/esm/deps/jsr.io/@std/assert/1.0.19/assert.d.ts.map +1 -0
  19. package/esm/deps/jsr.io/@std/assert/1.0.19/assert.js +23 -0
  20. package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.d.ts +26 -0
  21. package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.d.ts.map +1 -0
  22. package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.js +30 -0
  23. package/esm/deps/jsr.io/@std/assert/1.0.19/equal.d.ts +25 -0
  24. package/esm/deps/jsr.io/@std/assert/1.0.19/equal.d.ts.map +1 -0
  25. package/esm/deps/jsr.io/@std/assert/1.0.19/equal.js +194 -0
  26. package/esm/deps/jsr.io/@std/assert/1.0.19/equals.d.ts +37 -0
  27. package/esm/deps/jsr.io/@std/assert/1.0.19/equals.d.ts.map +1 -0
  28. package/esm/deps/jsr.io/@std/assert/1.0.19/equals.js +61 -0
  29. package/esm/deps/jsr.io/@std/assert/1.0.19/exists.d.ts +18 -0
  30. package/esm/deps/jsr.io/@std/assert/1.0.19/exists.d.ts.map +1 -0
  31. package/esm/deps/jsr.io/@std/assert/1.0.19/exists.js +27 -0
  32. package/esm/deps/jsr.io/@std/assert/1.0.19/fail.d.ts +15 -0
  33. package/esm/deps/jsr.io/@std/assert/1.0.19/fail.d.ts.map +1 -0
  34. package/esm/deps/jsr.io/@std/assert/1.0.19/fail.js +20 -0
  35. package/esm/deps/jsr.io/@std/assert/1.0.19/false.d.ts +19 -0
  36. package/esm/deps/jsr.io/@std/assert/1.0.19/false.d.ts.map +1 -0
  37. package/esm/deps/jsr.io/@std/assert/1.0.19/false.js +23 -0
  38. package/esm/deps/jsr.io/@std/assert/1.0.19/greater.d.ts +20 -0
  39. package/esm/deps/jsr.io/@std/assert/1.0.19/greater.d.ts.map +1 -0
  40. package/esm/deps/jsr.io/@std/assert/1.0.19/greater.js +29 -0
  41. package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.d.ts +20 -0
  42. package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.d.ts.map +1 -0
  43. package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.js +29 -0
  44. package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.d.ts +23 -0
  45. package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.d.ts.map +1 -0
  46. package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.js +52 -0
  47. package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.d.ts +25 -0
  48. package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.d.ts.map +1 -0
  49. package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.js +53 -0
  50. package/esm/deps/jsr.io/@std/assert/1.0.19/less.d.ts +19 -0
  51. package/esm/deps/jsr.io/@std/assert/1.0.19/less.d.ts.map +1 -0
  52. package/esm/deps/jsr.io/@std/assert/1.0.19/less.js +28 -0
  53. package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.d.ts +20 -0
  54. package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.d.ts.map +1 -0
  55. package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.js +29 -0
  56. package/esm/deps/jsr.io/@std/assert/1.0.19/match.d.ts +18 -0
  57. package/esm/deps/jsr.io/@std/assert/1.0.19/match.d.ts.map +1 -0
  58. package/esm/deps/jsr.io/@std/assert/1.0.19/match.js +26 -0
  59. package/esm/deps/jsr.io/@std/assert/1.0.19/mod.d.ts +44 -0
  60. package/esm/deps/jsr.io/@std/assert/1.0.19/mod.d.ts.map +1 -0
  61. package/esm/deps/jsr.io/@std/assert/1.0.19/mod.js +45 -0
  62. package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.d.ts +27 -0
  63. package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.d.ts.map +1 -0
  64. package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.js +39 -0
  65. package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.d.ts +20 -0
  66. package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.d.ts.map +1 -0
  67. package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.js +29 -0
  68. package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.d.ts +18 -0
  69. package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.d.ts.map +1 -0
  70. package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.js +26 -0
  71. package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.d.ts +23 -0
  72. package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.d.ts.map +1 -0
  73. package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.js +32 -0
  74. package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.d.ts +29 -0
  75. package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.d.ts.map +1 -0
  76. package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.js +177 -0
  77. package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.d.ts +42 -0
  78. package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.d.ts.map +1 -0
  79. package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.js +53 -0
  80. package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.d.ts +24 -0
  81. package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.d.ts.map +1 -0
  82. package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.js +58 -0
  83. package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.d.ts +18 -0
  84. package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.d.ts.map +1 -0
  85. package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.js +26 -0
  86. package/esm/deps/jsr.io/@std/assert/1.0.19/throws.d.ts +45 -0
  87. package/esm/deps/jsr.io/@std/assert/1.0.19/throws.d.ts.map +1 -0
  88. package/esm/deps/jsr.io/@std/assert/1.0.19/throws.js +44 -0
  89. package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.d.ts +15 -0
  90. package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.d.ts.map +1 -0
  91. package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.js +20 -0
  92. package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.d.ts +15 -0
  93. package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.d.ts.map +1 -0
  94. package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.js +20 -0
  95. package/esm/deps/jsr.io/@std/internal/1.0.13/assertion_state.d.ts +150 -0
  96. package/esm/deps/jsr.io/@std/internal/1.0.13/assertion_state.d.ts.map +1 -0
  97. package/esm/deps/jsr.io/@std/internal/1.0.13/assertion_state.js +224 -0
  98. package/esm/deps/jsr.io/@std/internal/1.0.13/build_message.d.ts +80 -0
  99. package/esm/deps/jsr.io/@std/internal/1.0.13/build_message.d.ts.map +1 -0
  100. package/esm/deps/jsr.io/@std/internal/1.0.13/build_message.js +116 -0
  101. package/esm/deps/jsr.io/@std/internal/1.0.13/diff.d.ts +140 -0
  102. package/esm/deps/jsr.io/@std/internal/1.0.13/diff.d.ts.map +1 -0
  103. package/esm/deps/jsr.io/@std/internal/1.0.13/diff.js +276 -0
  104. package/esm/deps/jsr.io/@std/internal/1.0.13/diff_str.d.ts +99 -0
  105. package/esm/deps/jsr.io/@std/internal/1.0.13/diff_str.d.ts.map +1 -0
  106. package/esm/deps/jsr.io/@std/internal/1.0.13/diff_str.js +182 -0
  107. package/esm/deps/jsr.io/@std/internal/1.0.13/format.d.ts +29 -0
  108. package/esm/deps/jsr.io/@std/internal/1.0.13/format.d.ts.map +1 -0
  109. package/esm/deps/jsr.io/@std/internal/1.0.13/format.js +70 -0
  110. package/esm/deps/jsr.io/@std/internal/1.0.13/styles.d.ts +159 -0
  111. package/esm/deps/jsr.io/@std/internal/1.0.13/styles.d.ts.map +1 -0
  112. package/esm/deps/jsr.io/@std/internal/1.0.13/styles.js +207 -0
  113. package/esm/deps/jsr.io/@std/internal/1.0.13/types.d.ts +25 -0
  114. package/esm/deps/jsr.io/@std/internal/1.0.13/types.d.ts.map +1 -0
  115. package/esm/deps/jsr.io/@std/internal/1.0.13/types.js +3 -0
  116. package/esm/deps/jsr.io/@std/testing/1.0.18/_test_suite.d.ts +80 -0
  117. package/esm/deps/jsr.io/@std/testing/1.0.18/_test_suite.d.ts.map +1 -0
  118. package/esm/deps/jsr.io/@std/testing/1.0.18/_test_suite.js +348 -0
  119. package/esm/deps/jsr.io/@std/testing/1.0.18/bdd.d.ts +738 -0
  120. package/esm/deps/jsr.io/@std/testing/1.0.18/bdd.d.ts.map +1 -0
  121. package/esm/deps/jsr.io/@std/testing/1.0.18/bdd.js +656 -0
  122. package/esm/src/agent/fork-runtime-stream.d.ts +143 -0
  123. package/esm/src/agent/fork-runtime-stream.d.ts.map +1 -0
  124. package/esm/src/agent/fork-runtime-stream.js +505 -0
  125. package/esm/src/agent/hosted-child-fork-stream-execution.d.ts +130 -0
  126. package/esm/src/agent/hosted-child-fork-stream-execution.d.ts.map +1 -0
  127. package/esm/src/agent/hosted-child-fork-stream-execution.js +391 -0
  128. package/esm/src/agent/index.d.ts +2 -0
  129. package/esm/src/agent/index.d.ts.map +1 -1
  130. package/esm/src/agent/index.js +2 -0
  131. package/esm/src/chat/conversation.d.ts +5 -5
  132. package/esm/src/chat/final-step-fallback.js +2 -2
  133. package/esm/src/modules/index.d.ts +12 -0
  134. package/esm/src/modules/index.d.ts.map +1 -0
  135. package/esm/src/modules/index.js +10 -0
  136. package/esm/src/modules/module-resolver.d.ts +28 -0
  137. package/esm/src/modules/module-resolver.d.ts.map +1 -0
  138. package/esm/src/modules/module-resolver.js +106 -0
  139. package/esm/src/rendering/cleanup.d.ts +7 -0
  140. package/esm/src/rendering/cleanup.d.ts.map +1 -0
  141. package/esm/src/rendering/cleanup.js +22 -0
  142. package/esm/src/rendering/ssr/index.d.ts +10 -0
  143. package/esm/src/rendering/ssr/index.d.ts.map +1 -0
  144. package/esm/src/rendering/ssr/index.js +8 -0
  145. package/esm/src/rendering/ssr/mdx-module-loader.d.ts +5 -0
  146. package/esm/src/rendering/ssr/mdx-module-loader.d.ts.map +1 -0
  147. package/esm/src/rendering/ssr/mdx-module-loader.js +150 -0
  148. package/esm/src/rendering/ssr/mdx-renderer.d.ts +4 -0
  149. package/esm/src/rendering/ssr/mdx-renderer.d.ts.map +1 -0
  150. package/esm/src/rendering/ssr/mdx-renderer.js +44 -0
  151. package/esm/src/rendering/ssr/types.d.ts +13 -0
  152. package/esm/src/rendering/ssr/types.d.ts.map +1 -0
  153. package/esm/src/rendering/ssr/types.js +1 -0
  154. package/esm/src/sandbox/index.d.ts +1 -0
  155. package/esm/src/sandbox/index.d.ts.map +1 -1
  156. package/esm/src/sandbox/index.js +1 -0
  157. package/esm/src/sandbox/shell-tools.d.ts +39 -0
  158. package/esm/src/sandbox/shell-tools.d.ts.map +1 -0
  159. package/esm/src/sandbox/shell-tools.js +177 -0
  160. package/esm/src/server/shared/index.d.ts +7 -0
  161. package/esm/src/server/shared/index.d.ts.map +1 -0
  162. package/esm/src/server/shared/index.js +6 -0
  163. package/esm/src/testing/assert.d.ts +22 -0
  164. package/esm/src/testing/assert.d.ts.map +1 -0
  165. package/esm/src/testing/assert.js +217 -0
  166. package/esm/src/testing/bdd.d.ts +67 -0
  167. package/esm/src/testing/bdd.d.ts.map +1 -0
  168. package/esm/src/testing/bdd.js +401 -0
  169. package/esm/src/testing/deno-compat.d.ts +26 -0
  170. package/esm/src/testing/deno-compat.d.ts.map +1 -0
  171. package/esm/src/testing/deno-compat.js +146 -0
  172. package/esm/src/testing/index.d.ts +28 -0
  173. package/esm/src/testing/index.d.ts.map +1 -0
  174. package/esm/src/testing/index.js +27 -0
  175. package/esm/src/testing/init.d.ts +2 -0
  176. package/esm/src/testing/init.d.ts.map +1 -0
  177. package/esm/src/testing/init.js +18 -0
  178. package/esm/src/testing/isolation.d.ts +30 -0
  179. package/esm/src/testing/isolation.d.ts.map +1 -0
  180. package/esm/src/testing/isolation.js +151 -0
  181. package/esm/src/testing/timing.d.ts +4 -0
  182. package/esm/src/testing/timing.d.ts.map +1 -0
  183. package/esm/src/testing/timing.js +22 -0
  184. package/esm/src/testing/utils.d.ts +6 -0
  185. package/esm/src/testing/utils.d.ts.map +1 -0
  186. package/esm/src/testing/utils.js +49 -0
  187. package/esm/src/types/global-guards.d.ts +11 -0
  188. package/esm/src/types/global-guards.d.ts.map +1 -0
  189. package/esm/src/types/global-guards.js +12 -0
  190. package/esm/src/utils/cache/keys/namespace.d.ts +3 -0
  191. package/esm/src/utils/cache/keys/namespace.d.ts.map +1 -0
  192. package/esm/src/utils/cache/keys/namespace.js +19 -0
  193. package/esm/src/utils/clsx.d.ts +3 -3
  194. package/esm/src/utils/clsx.d.ts.map +1 -1
  195. package/esm/src/utils/clsx.js +2 -3
  196. package/esm/src/utils/mime-types.d.ts +0 -6
  197. package/esm/src/utils/mime-types.d.ts.map +1 -1
  198. package/esm/src/utils/mime-types.js +0 -1
  199. package/esm/src/utils/version-constant.d.ts +1 -1
  200. package/esm/src/utils/version-constant.js +1 -1
  201. package/package.json +14 -1
  202. package/src/cli/commands/extension/init-command.ts +2 -2
  203. package/src/cli/commands/extension/validate-command.ts +1 -1
  204. package/src/deno.js +8 -1
  205. package/src/deps/esm.sh/@types/react-dom@19.2.3/client.d.ts +105 -0
  206. package/src/deps/esm.sh/@types/react@19.2.14/global.d.ts +166 -0
  207. package/src/deps/esm.sh/@types/react@19.2.14/index.d.ts +4370 -0
  208. package/src/deps/esm.sh/@types/scheduler@0.26.0/index.d.ts +30 -0
  209. package/src/deps/esm.sh/csstype@3.2.3/index.d.ts +22569 -0
  210. package/src/deps/esm.sh/react-dom@19.2.4/client.d.ts +105 -0
  211. package/src/deps/esm.sh/react-dom@19.2.4/client.js +5 -0
  212. package/src/deps/esm.sh/scheduler@^0.27.0.d.ts +30 -0
  213. package/src/deps/esm.sh/scheduler@^0.27.0.js +3 -0
  214. package/src/deps/jsr.io/@std/assert/1.0.19/almost_equals.ts +56 -0
  215. package/src/deps/jsr.io/@std/assert/1.0.19/array_includes.ts +76 -0
  216. package/src/deps/jsr.io/@std/assert/1.0.19/assert.ts +24 -0
  217. package/src/deps/jsr.io/@std/assert/1.0.19/assertion_error.ts +31 -0
  218. package/src/deps/jsr.io/@std/assert/1.0.19/equal.ts +226 -0
  219. package/src/deps/jsr.io/@std/assert/1.0.19/equals.ts +68 -0
  220. package/src/deps/jsr.io/@std/assert/1.0.19/exists.ts +31 -0
  221. package/src/deps/jsr.io/@std/assert/1.0.19/fail.ts +21 -0
  222. package/src/deps/jsr.io/@std/assert/1.0.19/false.ts +27 -0
  223. package/src/deps/jsr.io/@std/assert/1.0.19/greater.ts +30 -0
  224. package/src/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.ts +36 -0
  225. package/src/deps/jsr.io/@std/assert/1.0.19/instance_of.ts +64 -0
  226. package/src/deps/jsr.io/@std/assert/1.0.19/is_error.ts +65 -0
  227. package/src/deps/jsr.io/@std/assert/1.0.19/less.ts +29 -0
  228. package/src/deps/jsr.io/@std/assert/1.0.19/less_or_equal.ts +36 -0
  229. package/src/deps/jsr.io/@std/assert/1.0.19/match.ts +30 -0
  230. package/src/deps/jsr.io/@std/assert/1.0.19/mod.ts +47 -0
  231. package/src/deps/jsr.io/@std/assert/1.0.19/not_equals.ts +43 -0
  232. package/src/deps/jsr.io/@std/assert/1.0.19/not_instance_of.ts +33 -0
  233. package/src/deps/jsr.io/@std/assert/1.0.19/not_match.ts +30 -0
  234. package/src/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.ts +42 -0
  235. package/src/deps/jsr.io/@std/assert/1.0.19/object_match.ts +224 -0
  236. package/src/deps/jsr.io/@std/assert/1.0.19/rejects.ts +123 -0
  237. package/src/deps/jsr.io/@std/assert/1.0.19/strict_equals.ts +68 -0
  238. package/src/deps/jsr.io/@std/assert/1.0.19/string_includes.ts +30 -0
  239. package/src/deps/jsr.io/@std/assert/1.0.19/throws.ts +111 -0
  240. package/src/deps/jsr.io/@std/assert/1.0.19/unimplemented.ts +21 -0
  241. package/src/deps/jsr.io/@std/assert/1.0.19/unreachable.ts +21 -0
  242. package/src/deps/jsr.io/@std/internal/1.0.13/assertion_state.ts +248 -0
  243. package/src/deps/jsr.io/@std/internal/1.0.13/build_message.ts +147 -0
  244. package/src/deps/jsr.io/@std/internal/1.0.13/diff.ts +317 -0
  245. package/src/deps/jsr.io/@std/internal/1.0.13/diff_str.ts +208 -0
  246. package/src/deps/jsr.io/@std/internal/1.0.13/format.ts +89 -0
  247. package/src/deps/jsr.io/@std/internal/1.0.13/styles.ts +233 -0
  248. package/src/deps/jsr.io/@std/internal/1.0.13/types.ts +30 -0
  249. package/src/deps/jsr.io/@std/testing/1.0.18/_test_suite.ts +461 -0
  250. package/src/deps/jsr.io/@std/testing/1.0.18/bdd.ts +1294 -0
  251. package/src/src/agent/fork-runtime-stream.ts +780 -0
  252. package/src/src/agent/hosted-child-fork-stream-execution.ts +579 -0
  253. package/src/src/agent/index.ts +26 -0
  254. package/src/src/chat/final-step-fallback.ts +2 -2
  255. package/src/src/modules/index.ts +43 -0
  256. package/src/src/modules/module-resolver.ts +145 -0
  257. package/src/src/rendering/cleanup.ts +27 -0
  258. package/src/src/rendering/ssr/index.ts +10 -0
  259. package/src/src/rendering/ssr/mdx-module-loader.ts +185 -0
  260. package/src/src/rendering/ssr/mdx-renderer.ts +66 -0
  261. package/src/src/rendering/ssr/types.ts +14 -0
  262. package/src/src/sandbox/index.ts +9 -0
  263. package/src/src/sandbox/shell-tools.ts +242 -0
  264. package/src/src/server/shared/index.ts +12 -0
  265. package/src/src/testing/assert.ts +352 -0
  266. package/src/src/testing/bdd.ts +618 -0
  267. package/src/src/testing/deno-compat.ts +206 -0
  268. package/src/src/testing/index.ts +92 -0
  269. package/src/src/testing/init.ts +21 -0
  270. package/src/src/testing/isolation.ts +177 -0
  271. package/src/src/testing/timing.ts +27 -0
  272. package/src/src/testing/utils.ts +44 -0
  273. package/src/src/types/global-guards.ts +21 -0
  274. package/src/src/utils/cache/keys/namespace.ts +25 -0
  275. package/src/src/utils/clsx.ts +2 -4
  276. package/src/src/utils/mime-types.ts +0 -2
  277. package/src/src/utils/version-constant.ts +1 -1
@@ -0,0 +1,208 @@
1
+ // Copyright 2018-2026 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+
4
+ import type { ChangedDiffResult, DiffResult } from "./types.js";
5
+ import { diff } from "./diff.js";
6
+
7
+ /**
8
+ * Unescape invisible characters.
9
+ *
10
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#escape_sequences}
11
+ *
12
+ * @param string String to unescape.
13
+ *
14
+ * @returns Unescaped string.
15
+ *
16
+ * @example Usage
17
+ * ```ts
18
+ * import { unescape } from "@std/internal/diff-str";
19
+ * import { assertEquals } from "@std/assert";
20
+ *
21
+ * assertEquals(unescape("Hello\nWorld"), "Hello\\n\nWorld");
22
+ * ```
23
+ */
24
+ export function unescape(string: string): string {
25
+ return string
26
+ .replaceAll("\\", "\\\\")
27
+ .replaceAll("\b", "\\b")
28
+ .replaceAll("\f", "\\f")
29
+ .replaceAll("\t", "\\t")
30
+ .replaceAll("\v", "\\v")
31
+ // This does not remove line breaks
32
+ .replaceAll(
33
+ /\r\n|\r|\n/g,
34
+ (str) => str === "\r" ? "\\r" : str === "\n" ? "\\n\n" : "\\r\\n\r\n",
35
+ );
36
+ }
37
+
38
+ const WHITESPACE_SYMBOLS_REGEXP =
39
+ /((?:\\[bftv]|[^\S\r\n])+|\\[rn\\]|[()[\]{}'"\r\n]|\b)/;
40
+
41
+ /**
42
+ * Tokenizes a string into an array of tokens.
43
+ *
44
+ * @param string The string to tokenize.
45
+ * @param wordDiff If true, performs word-based tokenization. Default is false.
46
+ *
47
+ * @returns An array of tokens.
48
+ *
49
+ * @example Usage
50
+ * ```ts
51
+ * import { tokenize } from "@std/internal/diff-str";
52
+ * import { assertEquals } from "@std/assert";
53
+ *
54
+ * assertEquals(tokenize("Hello\nWorld"), ["Hello\n", "World"]);
55
+ * ```
56
+ */
57
+ export function tokenize(string: string, wordDiff = false): string[] {
58
+ if (wordDiff) {
59
+ return string
60
+ .split(WHITESPACE_SYMBOLS_REGEXP)
61
+ .filter((token) => token);
62
+ }
63
+ const tokens: string[] = [];
64
+ const lines = string.split(/(\n|\r\n)/).filter((line) => line);
65
+
66
+ for (const [i, line] of lines.entries()) {
67
+ if (i % 2) {
68
+ tokens[tokens.length - 1] += line;
69
+ } else {
70
+ tokens.push(line);
71
+ }
72
+ }
73
+ return tokens;
74
+ }
75
+
76
+ /**
77
+ * Create details by filtering relevant word-diff for current line and merge
78
+ * "space-diff" if surrounded by word-diff for cleaner displays.
79
+ *
80
+ * @param line Current line
81
+ * @param tokens Word-diff tokens
82
+ *
83
+ * @returns Array of diff results.
84
+ *
85
+ * @example Usage
86
+ * ```ts
87
+ * import { createDetails } from "@std/internal/diff-str";
88
+ * import { assertEquals } from "@std/assert";
89
+ *
90
+ * const tokens = [
91
+ * { type: "added", value: "a" },
92
+ * { type: "removed", value: "b" },
93
+ * { type: "common", value: "c" },
94
+ * ] as const;
95
+ * assertEquals(
96
+ * createDetails({ type: "added", value: "a" }, [...tokens]),
97
+ * [{ type: "added", value: "a" }, { type: "common", value: "c" }]
98
+ * );
99
+ * ```
100
+ */
101
+ export function createDetails(
102
+ line: DiffResult<string>,
103
+ tokens: DiffResult<string>[],
104
+ ): DiffResult<string>[] {
105
+ return tokens.filter(({ type }) => type === line.type || type === "common")
106
+ .map((result, i, t) => {
107
+ const token = t[i - 1];
108
+ if (
109
+ (result.type === "common") && token &&
110
+ (token.type === t[i + 1]?.type) && /\s+/.test(result.value)
111
+ ) {
112
+ return {
113
+ ...result,
114
+ type: token.type,
115
+ };
116
+ }
117
+ return result;
118
+ });
119
+ }
120
+
121
+ const NON_WHITESPACE_REGEXP = /\S/;
122
+
123
+ /**
124
+ * Renders the differences between the actual and expected strings. Partially
125
+ * inspired from {@link https://github.com/kpdecker/jsdiff}.
126
+ *
127
+ * @param A Actual string
128
+ * @param B Expected string
129
+ *
130
+ * @returns Array of diff results.
131
+ *
132
+ * @example Usage
133
+ * ```ts
134
+ * import { diffStr } from "@std/internal/diff-str";
135
+ * import { assertEquals } from "@std/assert";
136
+ *
137
+ * assertEquals(diffStr("Hello!", "Hello"), [
138
+ * {
139
+ * type: "removed",
140
+ * value: "Hello!\n",
141
+ * details: [
142
+ * { type: "common", value: "Hello" },
143
+ * { type: "removed", value: "!" },
144
+ * { type: "common", value: "\n" }
145
+ * ]
146
+ * },
147
+ * {
148
+ * type: "added",
149
+ * value: "Hello\n",
150
+ * details: [
151
+ * { type: "common", value: "Hello" },
152
+ * { type: "common", value: "\n" }
153
+ * ]
154
+ * }
155
+ * ]);
156
+ * ```
157
+ */
158
+ export function diffStr(A: string, B: string): DiffResult<string>[] {
159
+ // Compute multi-line diff
160
+ const diffResult = diff(
161
+ tokenize(`${unescape(A)}\n`),
162
+ tokenize(`${unescape(B)}\n`),
163
+ );
164
+
165
+ const added = [];
166
+ const removed = [];
167
+ for (const result of diffResult) {
168
+ if (result.type === "added") {
169
+ added.push(result);
170
+ }
171
+ if (result.type === "removed") {
172
+ removed.push(result);
173
+ }
174
+ }
175
+
176
+ // Compute word-diff
177
+ const hasMoreRemovedLines = added.length < removed.length;
178
+ const aLines = hasMoreRemovedLines ? added : removed;
179
+ const bLines = hasMoreRemovedLines ? removed : added;
180
+ for (const a of aLines) {
181
+ let tokens = [] as Array<DiffResult<string>>;
182
+ let b: undefined | ChangedDiffResult<string>;
183
+ // Search another diff line with at least one common token
184
+ while (bLines.length) {
185
+ b = bLines.shift();
186
+ const tokenized = [
187
+ tokenize(a.value, true),
188
+ tokenize(b!.value, true),
189
+ ] as [string[], string[]];
190
+ if (hasMoreRemovedLines) tokenized.reverse();
191
+ tokens = diff(tokenized[0], tokenized[1]);
192
+ if (
193
+ tokens.some(({ type, value }) =>
194
+ type === "common" && NON_WHITESPACE_REGEXP.test(value)
195
+ )
196
+ ) {
197
+ break;
198
+ }
199
+ }
200
+ // Register word-diff details
201
+ a.details = createDetails(a, tokens);
202
+ if (b) {
203
+ b.details = createDetails(b, tokens);
204
+ }
205
+ }
206
+
207
+ return diffResult;
208
+ }
@@ -0,0 +1,89 @@
1
+ // Copyright 2018-2026 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+
4
+ /** An inspect function conforming to the shape of `Deno.inspect` and `node:util`'s `inspect` */
5
+ import * as dntShim from "../../../../../_dnt.shims.js";
6
+
7
+ export type InspectFn = (
8
+ v: unknown,
9
+ options: {
10
+ depth: number;
11
+ sorted: boolean;
12
+ trailingComma: boolean;
13
+ compact: boolean;
14
+ iterableLimit: number;
15
+ getters: boolean;
16
+ strAbbreviateSize: number;
17
+ },
18
+ ) => string;
19
+
20
+ /**
21
+ * Converts the input into a string. Objects, Sets and Maps are sorted so as to
22
+ * make tests less flaky.
23
+ *
24
+ * @param v Value to be formatted
25
+ *
26
+ * @returns The formatted string
27
+ *
28
+ * @example Usage
29
+ * ```ts
30
+ * import { format } from "@std/internal/format";
31
+ * import { assertEquals } from "@std/assert";
32
+ *
33
+ * assertEquals(format({ a: 1, b: 2 }), "{\n a: 1,\n b: 2,\n}");
34
+ * assertEquals(format(new Set([1, 2])), "Set(2) {\n 1,\n 2,\n}");
35
+ * assertEquals(format(new Map([[1, 2]])), "Map(1) {\n 1 => 2,\n}");
36
+ * ```
37
+ */
38
+ export function format(v: unknown): string {
39
+ // deno-lint-ignore no-explicit-any
40
+ const { Deno, process } = dntShim.dntGlobalThis as any;
41
+
42
+ const inspect: InspectFn | undefined = Deno?.inspect ??
43
+ process?.getBuiltinModule?.("node:util")?.inspect;
44
+
45
+ return typeof inspect === "function"
46
+ ? inspect(v, {
47
+ depth: Infinity,
48
+ sorted: true,
49
+ trailingComma: true,
50
+ compact: false,
51
+ iterableLimit: Infinity,
52
+ // getters should be true in assertEquals.
53
+ getters: true,
54
+ strAbbreviateSize: Infinity,
55
+ })
56
+ : basicInspect(v);
57
+ }
58
+
59
+ const formatters: ((v: unknown) => string | undefined)[] = [
60
+ (v) => {
61
+ if (typeof v === "undefined") return "undefined";
62
+ if (typeof v === "bigint") return `${v}n`;
63
+
64
+ if (
65
+ typeof v === "string" ||
66
+ typeof v === "number" ||
67
+ typeof v === "boolean" ||
68
+ v === null ||
69
+ Array.isArray(v) ||
70
+ [null, Object.prototype].includes(Object.getPrototypeOf(v))
71
+ ) {
72
+ return JSON.stringify(v, null, 2);
73
+ }
74
+ },
75
+ (v) => String(v),
76
+ (v) => Object.prototype.toString.call(v),
77
+ ];
78
+
79
+ // for environments lacking both `Deno.inspect` and `process.inspect`
80
+ function basicInspect(v: unknown): string {
81
+ for (const fmt of formatters) {
82
+ try {
83
+ const result = fmt(v);
84
+ if (typeof result === "string") return result;
85
+ } catch { /* try the next one */ }
86
+ }
87
+
88
+ return "[[Unable to format value]]";
89
+ }
@@ -0,0 +1,233 @@
1
+ // Copyright 2018-2026 the Deno authors. 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
+
6
+ // This code is vendored from `fmt/colors.ts`.
7
+
8
+ // deno-lint-ignore no-explicit-any
9
+ import * as dntShim from "../../../../../_dnt.shims.js";
10
+
11
+ const { Deno } = dntShim.dntGlobalThis as any;
12
+ const noColor = typeof Deno?.noColor === "boolean"
13
+ ? Deno.noColor as boolean
14
+ : false;
15
+
16
+ interface Code {
17
+ open: string;
18
+ close: string;
19
+ regexp: RegExp;
20
+ }
21
+
22
+ const enabled = !noColor;
23
+
24
+ function code(open: number[], close: number): Code {
25
+ return {
26
+ open: `\x1b[${open.join(";")}m`,
27
+ close: `\x1b[${close}m`,
28
+ regexp: new RegExp(`\\x1b\\[${close}m`, "g"),
29
+ };
30
+ }
31
+
32
+ function run(str: string, code: Code): string {
33
+ return enabled
34
+ ? `${code.open}${str.replace(code.regexp, code.open)}${code.close}`
35
+ : str;
36
+ }
37
+
38
+ /**
39
+ * Sets the style of text to be printed to bold.
40
+ *
41
+ * Disable by setting the `NO_COLOR` environmental variable.
42
+ *
43
+ * @param str Text to make bold
44
+ *
45
+ * @returns Bold text for printing
46
+ *
47
+ * @example Usage
48
+ * ```ts no-assert
49
+ * import { bold } from "@std/internal/styles";
50
+ *
51
+ * console.log(bold("Hello, world!")); // Prints "Hello, world!" in bold
52
+ * ```
53
+ */
54
+ export function bold(str: string): string {
55
+ return run(str, code([1], 22));
56
+ }
57
+
58
+ /**
59
+ * Sets the color of text to be printed to red.
60
+ *
61
+ * Disable by setting the `NO_COLOR` environmental variable.
62
+ *
63
+ * @param str Text to make red
64
+ *
65
+ * @returns Red text for printing
66
+ *
67
+ * @example Usage
68
+ * ```ts no-assert
69
+ * import { red } from "@std/internal/styles";
70
+ *
71
+ * console.log(red("Hello, world!")); // Prints "Hello, world!" in red
72
+ * ```
73
+ */
74
+ export function red(str: string): string {
75
+ return run(str, code([31], 39));
76
+ }
77
+
78
+ /**
79
+ * Sets the color of text to be printed to green.
80
+ *
81
+ * Disable by setting the `NO_COLOR` environmental variable.
82
+ *
83
+ * @param str Text to make green
84
+ *
85
+ * @returns Green text for print
86
+ *
87
+ * @example Usage
88
+ * ```ts no-assert
89
+ * import { green } from "@std/internal/styles";
90
+ *
91
+ * console.log(green("Hello, world!")); // Prints "Hello, world!" in green
92
+ * ```
93
+ */
94
+ export function green(str: string): string {
95
+ return run(str, code([32], 39));
96
+ }
97
+
98
+ /**
99
+ * Sets the color of text to be printed to yellow.
100
+ *
101
+ * Disable by setting the `NO_COLOR` environmental variable.
102
+ *
103
+ * @param str Text to make yellow
104
+ *
105
+ * @returns Yellow text for print
106
+ *
107
+ * @example Usage
108
+ * ```ts no-assert
109
+ * import { yellow } from "@std/internal/styles";
110
+ *
111
+ * console.log(yellow("Hello, world!")); // Prints "Hello, world!" in yellow
112
+ * ```
113
+ */
114
+ export function yellow(str: string): string {
115
+ return run(str, code([33], 39));
116
+ }
117
+
118
+ /**
119
+ * Sets the color of text to be printed to white.
120
+ *
121
+ * @param str Text to make white
122
+ *
123
+ * @returns White text for print
124
+ *
125
+ * @example Usage
126
+ * ```ts no-assert
127
+ * import { white } from "@std/internal/styles";
128
+ *
129
+ * console.log(white("Hello, world!")); // Prints "Hello, world!" in white
130
+ * ```
131
+ */
132
+ export function white(str: string): string {
133
+ return run(str, code([37], 39));
134
+ }
135
+
136
+ /**
137
+ * Sets the color of text to be printed to gray.
138
+ *
139
+ * @param str Text to make gray
140
+ *
141
+ * @returns Gray text for print
142
+ *
143
+ * @example Usage
144
+ * ```ts no-assert
145
+ * import { gray } from "@std/internal/styles";
146
+ *
147
+ * console.log(gray("Hello, world!")); // Prints "Hello, world!" in gray
148
+ * ```
149
+ */
150
+ export function gray(str: string): string {
151
+ return brightBlack(str);
152
+ }
153
+
154
+ /**
155
+ * Sets the color of text to be printed to bright-black.
156
+ *
157
+ * @param str Text to make bright-black
158
+ *
159
+ * @returns Bright-black text for print
160
+ *
161
+ * @example Usage
162
+ * ```ts no-assert
163
+ * import { brightBlack } from "@std/internal/styles";
164
+ *
165
+ * console.log(brightBlack("Hello, world!")); // Prints "Hello, world!" in bright-black
166
+ * ```
167
+ */
168
+ export function brightBlack(str: string): string {
169
+ return run(str, code([90], 39));
170
+ }
171
+
172
+ /**
173
+ * Sets the background color of text to be printed to red.
174
+ *
175
+ * @param str Text to make its background red
176
+ *
177
+ * @returns Red background text for print
178
+ *
179
+ * @example Usage
180
+ * ```ts no-assert
181
+ * import { bgRed } from "@std/internal/styles";
182
+ *
183
+ * console.log(bgRed("Hello, world!")); // Prints "Hello, world!" with red background
184
+ * ```
185
+ */
186
+ export function bgRed(str: string): string {
187
+ return run(str, code([41], 49));
188
+ }
189
+
190
+ /**
191
+ * Sets the background color of text to be printed to green.
192
+ *
193
+ * @param str Text to make its background green
194
+ *
195
+ * @returns Green background text for print
196
+ *
197
+ * @example Usage
198
+ * ```ts no-assert
199
+ * import { bgGreen } from "@std/internal/styles";
200
+ *
201
+ * console.log(bgGreen("Hello, world!")); // Prints "Hello, world!" with green background
202
+ * ```
203
+ */
204
+ export function bgGreen(str: string): string {
205
+ return run(str, code([42], 49));
206
+ }
207
+
208
+ // https://github.com/chalk/ansi-regex/blob/02fa893d619d3da85411acc8fd4e2eea0e95a9d9/index.js
209
+ const ANSI_REGEXP = new RegExp(
210
+ [
211
+ "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
212
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TXZcf-nq-uy=><~]))",
213
+ ].join("|"),
214
+ "g",
215
+ );
216
+
217
+ /**
218
+ * Remove ANSI escape codes from the string.
219
+ *
220
+ * @param string Text to remove ANSI escape codes from
221
+ *
222
+ * @returns Text without ANSI escape codes
223
+ *
224
+ * @example Usage
225
+ * ```ts no-assert
226
+ * import { red, stripAnsiCode } from "@std/internal/styles";
227
+ *
228
+ * console.log(stripAnsiCode(red("Hello, world!"))); // Prints "Hello, world!"
229
+ * ```
230
+ */
231
+ export function stripAnsiCode(string: string): string {
232
+ return string.replace(ANSI_REGEXP, "");
233
+ }
@@ -0,0 +1,30 @@
1
+ // Copyright 2018-2026 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+
4
+ /** Ways that lines in a diff can be different. */
5
+ export type DiffType = DiffResult<unknown>["type"];
6
+
7
+ /**
8
+ * Represents the result of a diff operation.
9
+ * @typeParam T The type of the value in the diff result.
10
+ */
11
+ export type DiffResult<T> = ChangedDiffResult<T> | CommonDiffResult<T>;
12
+
13
+ /**
14
+ * Represents the result of a common diff operation.
15
+ * @typeParam T The type of the value in the diff result.
16
+ */
17
+ export type CommonDiffResult<T> = {
18
+ type: "common" | "truncation";
19
+ value: T;
20
+ };
21
+
22
+ /**
23
+ * Represents the result of a changed diff operation.
24
+ * @typeParam T The type of the value in the diff result.
25
+ */
26
+ export type ChangedDiffResult<T> = {
27
+ type: "removed" | "added";
28
+ value: T;
29
+ details?: DiffResult<T>[];
30
+ };