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,145 @@
1
+ import { serverLogger as logger } from "../utils/index.js";
2
+ import { dirname, isAbsolute, join, normalize, relative } from "../platform/compat/path/index.js";
3
+ import type { RuntimeAdapter } from "../platform/adapters/base.js";
4
+ import { buildModuleResolveCacheKey } from "../cache/keys.js";
5
+ import { withSpan } from "../observability/tracing/otlp-setup.js";
6
+ import { LRUCache } from "../utils/lru-wrapper.js";
7
+ import { registerLRUCache } from "../cache/index.js";
8
+ import { CACHE_MAX_ENTRIES_LARGE } from "../utils/constants/limits.js";
9
+
10
+ export interface ResolvedModule {
11
+ path: string;
12
+ type: "file" | "virtual" | "external" | "npm";
13
+ content?: string;
14
+ transformed?: boolean;
15
+ }
16
+
17
+ export interface ModuleResolverOptions {
18
+ projectDir: string;
19
+ importMap?: Record<string, string>;
20
+ virtualModules?: Map<string, string>;
21
+ adapter: RuntimeAdapter;
22
+ cacheSize?: number;
23
+ }
24
+
25
+ const MODULE_EXTENSIONS = ["", ".ts", ".tsx", ".js", ".jsx", ".mjs"];
26
+
27
+ export class ModuleResolver {
28
+ private importMap: Record<string, string>;
29
+ private virtualModules: Map<string, string>;
30
+ private cache: LRUCache<string, ResolvedModule>;
31
+ private adapter: RuntimeAdapter;
32
+
33
+ constructor(private options: ModuleResolverOptions) {
34
+ this.adapter = options.adapter;
35
+ this.importMap = options.importMap ?? {};
36
+ this.virtualModules = options.virtualModules ?? new Map();
37
+ this.cache = new LRUCache<string, ResolvedModule>({
38
+ maxEntries: options.cacheSize ?? CACHE_MAX_ENTRIES_LARGE,
39
+ });
40
+
41
+ // Register cache for monitoring
42
+ registerLRUCache(`module-resolver:${options.projectDir}`, this.cache);
43
+ }
44
+
45
+ private cacheAndReturn(cacheKey: string, resolved: ResolvedModule): ResolvedModule {
46
+ this.cache.set(cacheKey, resolved);
47
+ return resolved;
48
+ }
49
+
50
+ resolve(specifier: string, referrer?: string): Promise<ResolvedModule | null> {
51
+ return withSpan(
52
+ "modules.resolver.resolve",
53
+ async () => {
54
+ const cacheKey = buildModuleResolveCacheKey(specifier, referrer);
55
+ const cached = this.cache.get(cacheKey);
56
+ if (cached) return cached;
57
+
58
+ logger.debug(`Resolving module: ${specifier} from ${referrer ?? "root"}`);
59
+
60
+ const virtualContent = this.virtualModules.get(specifier);
61
+ if (virtualContent !== undefined) {
62
+ return this.cacheAndReturn(cacheKey, {
63
+ path: specifier,
64
+ type: "virtual",
65
+ content: virtualContent,
66
+ transformed: true,
67
+ });
68
+ }
69
+
70
+ const mapped = this.importMap[specifier];
71
+ if (mapped) {
72
+ if (mapped.startsWith("http://") || mapped.startsWith("https://")) {
73
+ return this.cacheAndReturn(cacheKey, { path: mapped, type: "external" });
74
+ }
75
+ specifier = mapped;
76
+ }
77
+
78
+ if (specifier.startsWith("./") || specifier.startsWith("../")) {
79
+ const refPath = referrer
80
+ ? isAbsolute(referrer) ? referrer : join(this.options.projectDir, referrer)
81
+ : undefined;
82
+
83
+ const basePath = refPath ? dirname(refPath) : this.options.projectDir;
84
+ const fullPath = normalize(join(basePath, specifier));
85
+
86
+ for (const ext of MODULE_EXTENSIONS) {
87
+ const pathWithExt = fullPath + ext;
88
+ if (await this.adapter.fs.exists(pathWithExt)) {
89
+ return this.cacheAndReturn(cacheKey, { path: pathWithExt, type: "file" });
90
+ }
91
+ }
92
+
93
+ return null;
94
+ }
95
+
96
+ if (specifier.startsWith("/")) {
97
+ const fullPath = join(this.options.projectDir, specifier);
98
+ const relativePath = relative(this.options.projectDir, fullPath);
99
+
100
+ if (relativePath.startsWith("..") || isAbsolute(relativePath)) {
101
+ logger.warn(`Path traversal attempt blocked: ${specifier}`);
102
+ return null;
103
+ }
104
+
105
+ if (await this.adapter.fs.exists(fullPath)) {
106
+ return this.cacheAndReturn(cacheKey, { path: fullPath, type: "file" });
107
+ }
108
+
109
+ return null;
110
+ }
111
+
112
+ if (!specifier.startsWith(".")) {
113
+ return this.cacheAndReturn(cacheKey, {
114
+ path: `https://esm.sh/${specifier}`,
115
+ type: "npm",
116
+ });
117
+ }
118
+
119
+ return null;
120
+ },
121
+ { "resolver.specifier": specifier, "resolver.referrer": referrer ?? "root" },
122
+ );
123
+ }
124
+
125
+ clearCache(pattern?: string): void {
126
+ if (!pattern) {
127
+ this.cache.clear();
128
+ return;
129
+ }
130
+
131
+ for (const key of [...this.cache.keys()]) {
132
+ if (key.includes(pattern)) this.cache.delete(key);
133
+ }
134
+ }
135
+
136
+ addVirtualModule(path: string, content: string): void {
137
+ this.virtualModules.set(path, content);
138
+ this.clearCache(path);
139
+ }
140
+
141
+ removeVirtualModule(path: string): void {
142
+ this.virtualModules.delete(path);
143
+ this.clearCache(path);
144
+ }
145
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Cleanup bundler and related caches
3
+ *
4
+ * Clears renderer caches and handlers for test and runtime cleanup.
5
+ */
6
+ export async function cleanupBundler(): Promise<void> {
7
+ const { clearMDXRendererCache } = await import("../transforms/mdx/index.js");
8
+ clearMDXRendererCache();
9
+
10
+ const { clearMDXModuleCache } = await import("./ssr/index.js");
11
+ clearMDXModuleCache();
12
+
13
+ const { clearSSRModuleCache } = await import("../modules/index.js");
14
+ clearSSRModuleCache();
15
+
16
+ const { destroyRendererAdapter } = await import("../server/shared/index.js");
17
+ await destroyRendererAdapter();
18
+
19
+ try {
20
+ const { __destroyRSCHandlerForTests } = await import(
21
+ "../server/services/rsc/endpoints/handler-registry.js"
22
+ );
23
+ __destroyRSCHandlerForTests();
24
+ } catch (_) {
25
+ /* expected: RSC handler registry might not be loaded */
26
+ }
27
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Rendering Ssr
3
+ *
4
+ * @module rendering/ssr
5
+ */
6
+
7
+ export type { MDXModule, MDXRenderOptions } from "./types.js";
8
+ export { clearMDXModuleCache, loadMDXModule } from "./mdx-module-loader.js";
9
+ export { renderMDXToReactAsync } from "./mdx-renderer.js";
10
+ export { ComponentRegistry } from "./component-registry.js";
@@ -0,0 +1,185 @@
1
+ import * as dntShim from "../../../_dnt.shims.js";
2
+ import { getCacheNamespace } from "../../utils/cache/keys/namespace.js";
3
+ import { COMPILATION_ERROR, wrapWithContext } from "../../errors/index.js";
4
+ // Direct import from registry.ts to avoid circular dependency through barrel
5
+ import { getLocalAdapter, runtime } from "../../platform/adapters/registry.js";
6
+ import { rendererLogger } from "../../utils/index.js";
7
+ import { LRUCache } from "../../utils/lru-wrapper.js";
8
+ import { registerCache } from "../../utils/memory/index.js";
9
+ import { MDX_RENDERER_MAX_ENTRIES, MDX_RENDERER_TTL_MS } from "../../utils/constants/cache.js";
10
+ import { isBrowserEnvironment } from "../../platform/compat/runtime.js";
11
+ import type { MDXModule } from "./types.js";
12
+
13
+ const logger = rendererLogger.component("mdx");
14
+
15
+ const MDX_CACHE_CLEANUP_INTERVAL_MS = 60_000;
16
+
17
+ const mdxModuleCache = new LRUCache<string, MDXModule>({
18
+ maxEntries: MDX_RENDERER_MAX_ENTRIES,
19
+ ttlMs: MDX_RENDERER_TTL_MS,
20
+ cleanupIntervalMs: MDX_CACHE_CLEANUP_INTERVAL_MS,
21
+ });
22
+
23
+ registerCache("mdx-module-cache", () => ({
24
+ name: "mdx-module-cache",
25
+ entries: mdxModuleCache.size,
26
+ maxEntries: MDX_RENDERER_MAX_ENTRIES,
27
+ }));
28
+
29
+ export function clearMDXModuleCache(): void {
30
+ mdxModuleCache.clear();
31
+ }
32
+
33
+ function validateMDXModule(module: MDXModule, context: Record<string, unknown>): void {
34
+ const MDXContent = module.default || module.MDXContent;
35
+ if (MDXContent) return;
36
+ throw COMPILATION_ERROR.create({
37
+ detail: "No default export found in MDX module",
38
+ context,
39
+ });
40
+ }
41
+
42
+ function getNamespacedKey(suffix: string): string {
43
+ return `${getCacheNamespace() ?? "default"}:${suffix}`;
44
+ }
45
+
46
+ export async function loadMDXModule(modulePath: string): Promise<MDXModule> {
47
+ try {
48
+ const key = getNamespacedKey(modulePath);
49
+ const cached = mdxModuleCache.get(key);
50
+ if (cached) return cached;
51
+
52
+ const module = (await import(modulePath)) as MDXModule;
53
+ validateMDXModule(module, { modulePath });
54
+ mdxModuleCache.set(key, module);
55
+
56
+ return module;
57
+ } catch (error) {
58
+ throw wrapWithContext(error, `Failed to load MDX module: ${modulePath}`, { modulePath });
59
+ }
60
+ }
61
+
62
+ export async function loadCompiledMDXModule(
63
+ compiledCode: string,
64
+ cacheKey: string,
65
+ ): Promise<MDXModule> {
66
+ try {
67
+ const key = getNamespacedKey(`compiled:${cacheKey}`);
68
+ const cached = mdxModuleCache.get(key);
69
+ if (cached) return cached;
70
+
71
+ if (isBrowserEnvironment()) {
72
+ return await loadViaBlobURL(compiledCode, cacheKey, key);
73
+ }
74
+
75
+ return await loadViaTempFile(compiledCode, cacheKey, key);
76
+ } catch (error) {
77
+ throw wrapWithContext(error, "Failed to load compiled MDX module", { cacheKey });
78
+ }
79
+ }
80
+
81
+ async function loadAndCacheModule(
82
+ modulePath: string,
83
+ key: string,
84
+ context: Record<string, unknown>,
85
+ ): Promise<MDXModule> {
86
+ const module = (await import(modulePath)) as MDXModule;
87
+ validateMDXModule(module, context);
88
+ mdxModuleCache.set(key, module);
89
+ return module;
90
+ }
91
+
92
+ async function loadViaTempFile(
93
+ compiledCode: string,
94
+ cacheKey: string,
95
+ key: string,
96
+ ): Promise<MDXModule> {
97
+ const tempModulePath = await writeTempMDXModule(compiledCode, cacheKey);
98
+
99
+ try {
100
+ return await loadAndCacheModule(tempModulePath, key, {
101
+ cacheKey,
102
+ codePreview: compiledCode.substring(0, 200),
103
+ });
104
+ } finally {
105
+ cleanupTempModule(tempModulePath).catch((error) =>
106
+ logger.debug("Failed to cleanup temp module:", error)
107
+ );
108
+ }
109
+ }
110
+
111
+ async function loadViaBlobURL(
112
+ compiledCode: string,
113
+ cacheKey: string,
114
+ key: string,
115
+ ): Promise<MDXModule> {
116
+ const moduleCode = wrapAsESMModule(compiledCode);
117
+ const blob = new Blob([moduleCode], { type: "application/javascript" });
118
+ const blobURL = URL.createObjectURL(blob);
119
+
120
+ try {
121
+ return await loadAndCacheModule(blobURL, key, {
122
+ cacheKey,
123
+ codePreview: compiledCode.substring(0, 200),
124
+ });
125
+ } finally {
126
+ URL.revokeObjectURL(blobURL);
127
+ }
128
+ }
129
+
130
+ async function writeTempMDXModule(compiledCode: string, cacheKey: string): Promise<string> {
131
+ const tempDir = await ensureTempDir();
132
+
133
+ const safeKey = cacheKey.replace(/[^a-zA-Z0-9-_]/g, "_").substring(0, 50);
134
+ const uniqueId = dntShim.crypto.randomUUID().slice(0, 8);
135
+ const filename = `mdx-${safeKey}-${uniqueId}.mjs`;
136
+ const modulePath = `${tempDir}/${filename}`;
137
+ const moduleCode = wrapAsESMModule(compiledCode);
138
+
139
+ const localAdapter = await getLocalAdapter();
140
+ await localAdapter.fs.writeFile(modulePath, moduleCode);
141
+
142
+ return modulePath;
143
+ }
144
+
145
+ function wrapAsESMModule(compiledCode: string): string {
146
+ const imports = `
147
+ import * as React from 'react';
148
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
149
+
150
+ const _jsx = jsx;
151
+ const _jsxs = jsxs;
152
+ const _jsxDEV = jsx;
153
+ const _Fragment = Fragment;
154
+ `.trim();
155
+
156
+ return `${imports}\n\n${compiledCode}`;
157
+ }
158
+
159
+ async function ensureTempDir(): Promise<string> {
160
+ const adapter = await runtime.get();
161
+ const { cwd } = await import("../../platform/compat/process.js");
162
+ const tempDir = `${cwd()}/.veryfront/temp/mdx-modules`;
163
+
164
+ try {
165
+ if (await adapter.fs.exists(tempDir)) return tempDir;
166
+ await adapter.fs.mkdir(tempDir, { recursive: true });
167
+ return tempDir;
168
+ } catch (error) {
169
+ logger.warn("Failed to create temp directory, using system temp:", error);
170
+ const os = await import("node:os");
171
+ const path = await import("node:path");
172
+ const systemTempDir = path.join(os.tmpdir(), `veryfront-mdx-${Date.now()}`);
173
+ await adapter.fs.mkdir(systemTempDir, { recursive: true });
174
+ return systemTempDir;
175
+ }
176
+ }
177
+
178
+ async function cleanupTempModule(modulePath: string): Promise<void> {
179
+ try {
180
+ const adapter = await runtime.get();
181
+ await adapter.fs.remove(modulePath);
182
+ } catch (_) {
183
+ /* expected: best-effort cleanup of temp module */
184
+ }
185
+ }
@@ -0,0 +1,66 @@
1
+ import { COMPILATION_ERROR } from "../../errors/index.js";
2
+ import { withSpan } from "../../observability/tracing/otlp-setup.js";
3
+ import { computeHash, rendererLogger } from "../../utils/index.js";
4
+ import * as React from "react";
5
+ import { loadCompiledMDXModule } from "./mdx-module-loader.js";
6
+ import type { MDXRenderOptions } from "./types.js";
7
+
8
+ const logger = rendererLogger.component("mdx");
9
+
10
+ export function renderMDXToReactAsync(
11
+ compiledCode: string,
12
+ options: MDXRenderOptions = {},
13
+ ): Promise<React.ReactElement> {
14
+ return withSpan(
15
+ "mdx.renderToReact",
16
+ async (): Promise<React.ReactElement> => {
17
+ try {
18
+ const cacheKey = (await computeHash(compiledCode)).slice(0, 16);
19
+ const module = await loadCompiledMDXModule(compiledCode, cacheKey);
20
+
21
+ const MDXContent = module.default ?? module.MDXContent;
22
+ if (!MDXContent) {
23
+ throw COMPILATION_ERROR.create({ detail: "No MDXContent found in compiled module" });
24
+ }
25
+
26
+ if (React.isValidElement(MDXContent)) {
27
+ return MDXContent;
28
+ }
29
+
30
+ const mergedProps: Record<string, unknown> = {
31
+ ...options,
32
+ frontmatter: {
33
+ ...(module.frontmatter ?? {}),
34
+ ...(options.frontmatter ?? {}),
35
+ },
36
+ };
37
+
38
+ return React.createElement(
39
+ MDXContent as React.ComponentType<Record<string, unknown>>,
40
+ mergedProps,
41
+ );
42
+ } catch (error) {
43
+ logger.error("Render error:", error);
44
+ return createErrorElement(error);
45
+ }
46
+ },
47
+ {},
48
+ );
49
+ }
50
+
51
+ function createErrorElement(error: unknown): React.ReactElement {
52
+ return React.createElement(
53
+ "div",
54
+ {
55
+ style: {
56
+ padding: "1rem",
57
+ backgroundColor: "#fef2f2",
58
+ border: "1px solid #fecaca",
59
+ borderRadius: "0.375rem",
60
+ color: "#dc2626",
61
+ },
62
+ },
63
+ React.createElement("strong", {}, "MDX Render Error: "),
64
+ error instanceof Error ? error.message : String(error),
65
+ );
66
+ }
@@ -0,0 +1,14 @@
1
+ import type * as React from "react";
2
+
3
+ export interface MDXRenderOptions {
4
+ frontmatter?: Record<string, unknown>;
5
+ components?: Record<string, React.ComponentType<unknown>>;
6
+ globals?: Record<string, unknown>;
7
+ pageConfig?: Record<string, unknown>;
8
+ }
9
+
10
+ export interface MDXModule {
11
+ default?: React.ComponentType<unknown>;
12
+ MDXContent?: React.ComponentType<unknown>;
13
+ frontmatter?: Record<string, unknown>;
14
+ }
@@ -39,3 +39,12 @@ export {
39
39
  type LazySandboxOptions,
40
40
  resolveDefaultSandboxRuntimeEndpoint,
41
41
  } from "./lazy-sandbox.js";
42
+ export {
43
+ type BashToolSandboxLike,
44
+ type CreateSandboxBashTool,
45
+ createSandboxShellTools,
46
+ normalizeBashToolSet,
47
+ renameSandboxFileTools,
48
+ type SandboxShellToolDefinition,
49
+ type SandboxShellToolSet,
50
+ } from "./shell-tools.js";