veryfront 0.0.84 → 0.0.88

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 (442) hide show
  1. package/README.md +18 -44
  2. package/esm/deno.d.ts +0 -1
  3. package/esm/deno.js +8 -9
  4. package/esm/deps/esm.sh/react-dom@19.1.1/client.d.ts +2 -0
  5. package/esm/deps/esm.sh/react-dom@19.1.1/client.d.ts.map +1 -0
  6. package/esm/deps/esm.sh/react-dom@19.1.1/client.js +5 -0
  7. package/esm/deps/esm.sh/react-dom@19.1.1/server.d.ts +2 -0
  8. package/esm/deps/esm.sh/react-dom@19.1.1/server.d.ts.map +1 -0
  9. package/esm/deps/esm.sh/react-dom@19.1.1/server.js +5 -0
  10. package/esm/deps/esm.sh/react@19.1.1/jsx-runtime.d.ts +2 -0
  11. package/esm/deps/esm.sh/react@19.1.1/jsx-runtime.d.ts.map +1 -0
  12. package/esm/deps/esm.sh/react@19.1.1/jsx-runtime.js +3 -0
  13. package/esm/deps/esm.sh/react@19.1.1.d.ts +2 -0
  14. package/esm/deps/esm.sh/react@19.1.1.d.ts.map +1 -0
  15. package/esm/deps/esm.sh/react@19.1.1.js +3 -0
  16. package/esm/deps/esm.sh/scheduler@^0.26.0.d.ts +2 -0
  17. package/esm/deps/esm.sh/scheduler@^0.26.0.d.ts.map +1 -0
  18. package/esm/deps/esm.sh/scheduler@^0.26.0.js +3 -0
  19. package/esm/proxy/main.d.ts +2 -0
  20. package/esm/proxy/main.d.ts.map +1 -0
  21. package/esm/proxy/main.js +400 -0
  22. package/esm/src/agent/react/use-agent.js +1 -1
  23. package/esm/src/agent/react/use-chat/use-chat.js +1 -1
  24. package/esm/src/agent/react/use-completion.js +1 -1
  25. package/esm/src/agent/react/use-streaming.js +1 -1
  26. package/esm/src/agent/react/use-voice-input.js +1 -1
  27. package/esm/src/cli/app/components/list-select.js +2 -2
  28. package/esm/src/cli/app/index.d.ts +1 -1
  29. package/esm/src/cli/app/index.d.ts.map +1 -1
  30. package/esm/src/cli/app/index.js +26 -33
  31. package/esm/src/cli/app/state.d.ts +3 -0
  32. package/esm/src/cli/app/state.d.ts.map +1 -1
  33. package/esm/src/cli/app/state.js +4 -0
  34. package/esm/src/cli/app/views/dashboard.d.ts.map +1 -1
  35. package/esm/src/cli/app/views/dashboard.js +45 -57
  36. package/esm/src/cli/app/views/startup.d.ts +39 -0
  37. package/esm/src/cli/app/views/startup.d.ts.map +1 -0
  38. package/esm/src/cli/app/views/startup.js +103 -0
  39. package/esm/src/cli/commands/init/config-generator.js +1 -1
  40. package/esm/src/cli/index/arg-parser.d.ts.map +1 -1
  41. package/esm/src/cli/index/arg-parser.js +1 -0
  42. package/esm/src/cli/index/command-router.d.ts.map +1 -1
  43. package/esm/src/cli/index/command-router.js +54 -39
  44. package/esm/src/cli/index/types.d.ts +4 -0
  45. package/esm/src/cli/index/types.d.ts.map +1 -1
  46. package/esm/src/cli/mcp/advanced-tools.d.ts +2 -2
  47. package/esm/src/cli/ui/colors.d.ts +8 -0
  48. package/esm/src/cli/ui/colors.d.ts.map +1 -1
  49. package/esm/src/cli/ui/colors.js +34 -0
  50. package/esm/src/cli/ui/dot-matrix.d.ts +8 -0
  51. package/esm/src/cli/ui/dot-matrix.d.ts.map +1 -1
  52. package/esm/src/cli/ui/dot-matrix.js +67 -2
  53. package/esm/src/config/loader.d.ts.map +1 -1
  54. package/esm/src/config/loader.js +5 -4
  55. package/esm/src/html/utils.js +2 -2
  56. package/esm/src/modules/component-registry/registry.d.ts +1 -1
  57. package/esm/src/modules/component-registry/registry.d.ts.map +1 -1
  58. package/esm/src/modules/import-map/default-import-map.d.ts +1 -11
  59. package/esm/src/modules/import-map/default-import-map.d.ts.map +1 -1
  60. package/esm/src/modules/import-map/default-import-map.js +3 -20
  61. package/esm/src/modules/import-map/loader.d.ts.map +1 -1
  62. package/esm/src/modules/import-map/loader.js +7 -22
  63. package/esm/src/modules/import-map/resolver.d.ts.map +1 -1
  64. package/esm/src/modules/import-map/resolver.js +12 -8
  65. package/esm/src/modules/react-loader/component-loader.d.ts +1 -1
  66. package/esm/src/modules/react-loader/component-loader.d.ts.map +1 -1
  67. package/esm/src/modules/react-loader/component-loader.js +2 -0
  68. package/esm/src/modules/react-loader/extract-component.d.ts +1 -1
  69. package/esm/src/modules/react-loader/extract-component.d.ts.map +1 -1
  70. package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts +2 -7
  71. package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts.map +1 -1
  72. package/esm/src/modules/react-loader/ssr-module-loader/loader.js +68 -38
  73. package/esm/src/modules/react-loader/ssr-module-loader/types.d.ts +2 -0
  74. package/esm/src/modules/react-loader/ssr-module-loader/types.d.ts.map +1 -1
  75. package/esm/src/modules/react-loader/types.d.ts +3 -1
  76. package/esm/src/modules/react-loader/types.d.ts.map +1 -1
  77. package/esm/src/modules/react-loader/unified-loader.d.ts.map +1 -1
  78. package/esm/src/modules/react-loader/unified-loader.js +7 -4
  79. package/esm/src/modules/server/module-batch-handler.d.ts +2 -0
  80. package/esm/src/modules/server/module-batch-handler.d.ts.map +1 -1
  81. package/esm/src/modules/server/module-batch-handler.js +3 -1
  82. package/esm/src/modules/server/module-server.d.ts +2 -0
  83. package/esm/src/modules/server/module-server.d.ts.map +1 -1
  84. package/esm/src/modules/server/module-server.js +4 -2
  85. package/esm/src/modules/server/ssr-import-rewriter.d.ts.map +1 -1
  86. package/esm/src/modules/server/ssr-import-rewriter.js +9 -17
  87. package/esm/src/react/compat/hooks-adapter.d.ts +1 -1
  88. package/esm/src/react/compat/hooks-adapter.d.ts.map +1 -1
  89. package/esm/src/react/compat/hooks-adapter.js +1 -1
  90. package/esm/src/react/compat/ssr-adapter/response-builder.d.ts +1 -1
  91. package/esm/src/react/compat/ssr-adapter/response-builder.d.ts.map +1 -1
  92. package/esm/src/react/compat/ssr-adapter/server-loader.d.ts +5 -5
  93. package/esm/src/react/compat/ssr-adapter/server-loader.d.ts.map +1 -1
  94. package/esm/src/react/compat/ssr-adapter/server-loader.js +2 -2
  95. package/esm/src/react/compat/ssr-adapter/stream-renderer.d.ts +1 -1
  96. package/esm/src/react/compat/ssr-adapter/stream-renderer.d.ts.map +1 -1
  97. package/esm/src/react/compat/ssr-adapter/string-renderer.d.ts +1 -1
  98. package/esm/src/react/compat/ssr-adapter/string-renderer.d.ts.map +1 -1
  99. package/esm/src/react/compat/ssr-adapter/string-renderer.js +1 -1
  100. package/esm/src/react/compat/version-detector/feature-detector.js +1 -1
  101. package/esm/src/react/components/AppWrapper.d.ts +1 -1
  102. package/esm/src/react/components/AppWrapper.d.ts.map +1 -1
  103. package/esm/src/react/components/AppWrapper.js +1 -1
  104. package/esm/src/react/components/Head.d.ts +1 -1
  105. package/esm/src/react/components/Head.d.ts.map +1 -1
  106. package/esm/src/react/components/Head.js +7 -3
  107. package/esm/src/react/components/LayoutComponent.d.ts +1 -1
  108. package/esm/src/react/components/LayoutComponent.d.ts.map +1 -1
  109. package/esm/src/react/components/LayoutComponent.js +1 -1
  110. package/esm/src/react/components/Link.d.ts +1 -1
  111. package/esm/src/react/components/Link.d.ts.map +1 -1
  112. package/esm/src/react/components/Link.js +1 -1
  113. package/esm/src/react/components/MDXProvider.d.ts +1 -1
  114. package/esm/src/react/components/MDXProvider.d.ts.map +1 -1
  115. package/esm/src/react/components/MDXProvider.js +2 -2
  116. package/esm/src/react/components/ProviderComponent.d.ts +1 -1
  117. package/esm/src/react/components/ProviderComponent.d.ts.map +1 -1
  118. package/esm/src/react/components/ProviderComponent.js +1 -1
  119. package/esm/src/react/components/ai/agent-card.d.ts +2 -2
  120. package/esm/src/react/components/ai/agent-card.d.ts.map +1 -1
  121. package/esm/src/react/components/ai/agent-card.js +1 -1
  122. package/esm/src/react/components/ai/chat/components/animations.d.ts +1 -1
  123. package/esm/src/react/components/ai/chat/components/animations.d.ts.map +1 -1
  124. package/esm/src/react/components/ai/chat/components/animations.js +1 -1
  125. package/esm/src/react/components/ai/chat/components/empty-state.d.ts +1 -1
  126. package/esm/src/react/components/ai/chat/components/empty-state.d.ts.map +1 -1
  127. package/esm/src/react/components/ai/chat/components/empty-state.js +1 -1
  128. package/esm/src/react/components/ai/chat/components/message-actions.d.ts +1 -1
  129. package/esm/src/react/components/ai/chat/components/message-actions.d.ts.map +1 -1
  130. package/esm/src/react/components/ai/chat/components/message-actions.js +1 -1
  131. package/esm/src/react/components/ai/chat/components/reasoning.d.ts +1 -1
  132. package/esm/src/react/components/ai/chat/components/reasoning.d.ts.map +1 -1
  133. package/esm/src/react/components/ai/chat/components/reasoning.js +1 -1
  134. package/esm/src/react/components/ai/chat/components/tool-ui.d.ts +1 -1
  135. package/esm/src/react/components/ai/chat/components/tool-ui.d.ts.map +1 -1
  136. package/esm/src/react/components/ai/chat/components/tool-ui.js +1 -1
  137. package/esm/src/react/components/ai/chat/composition/api.d.ts +5 -4
  138. package/esm/src/react/components/ai/chat/composition/api.d.ts.map +1 -1
  139. package/esm/src/react/components/ai/chat/composition/api.js +1 -1
  140. package/esm/src/react/components/ai/chat/index.d.ts +8 -3
  141. package/esm/src/react/components/ai/chat/index.d.ts.map +1 -1
  142. package/esm/src/react/components/ai/chat/index.js +1 -1
  143. package/esm/src/react/components/ai/error-boundary.d.ts +1 -1
  144. package/esm/src/react/components/ai/error-boundary.d.ts.map +1 -1
  145. package/esm/src/react/components/ai/error-boundary.js +1 -1
  146. package/esm/src/react/components/ai/icons/index.d.ts +1 -1
  147. package/esm/src/react/components/ai/icons/index.d.ts.map +1 -1
  148. package/esm/src/react/components/ai/icons/index.js +1 -1
  149. package/esm/src/react/components/ai/markdown.d.ts +1 -1
  150. package/esm/src/react/components/ai/markdown.d.ts.map +1 -1
  151. package/esm/src/react/components/ai/markdown.js +1 -1
  152. package/esm/src/react/components/ai/message.d.ts +3 -3
  153. package/esm/src/react/components/ai/message.d.ts.map +1 -1
  154. package/esm/src/react/components/ai/message.js +1 -1
  155. package/esm/src/react/components/optimized-image/OptimizedBackgroundImage.d.ts +1 -1
  156. package/esm/src/react/components/optimized-image/OptimizedBackgroundImage.d.ts.map +1 -1
  157. package/esm/src/react/components/optimized-image/OptimizedBackgroundImage.js +1 -1
  158. package/esm/src/react/components/optimized-image/OptimizedImage.d.ts +1 -1
  159. package/esm/src/react/components/optimized-image/OptimizedImage.d.ts.map +1 -1
  160. package/esm/src/react/components/optimized-image/OptimizedImage.js +1 -1
  161. package/esm/src/react/components/optimized-image/SimpleOptimizedImage.d.ts +1 -1
  162. package/esm/src/react/components/optimized-image/SimpleOptimizedImage.d.ts.map +1 -1
  163. package/esm/src/react/components/optimized-image/utils.d.ts +1 -1
  164. package/esm/src/react/components/optimized-image/utils.d.ts.map +1 -1
  165. package/esm/src/react/components/optimized-image/utils.js +1 -1
  166. package/esm/src/react/context/index.d.ts +1 -1
  167. package/esm/src/react/context/index.d.ts.map +1 -1
  168. package/esm/src/react/context/index.js +1 -1
  169. package/esm/src/react/fonts/index.d.ts +1 -1
  170. package/esm/src/react/fonts/index.d.ts.map +1 -1
  171. package/esm/src/react/fonts/index.js +1 -1
  172. package/esm/src/react/primitives/agent-primitives.d.ts +4 -4
  173. package/esm/src/react/primitives/agent-primitives.d.ts.map +1 -1
  174. package/esm/src/react/primitives/agent-primitives.js +1 -1
  175. package/esm/src/react/primitives/chat-container.d.ts +2 -2
  176. package/esm/src/react/primitives/chat-container.d.ts.map +1 -1
  177. package/esm/src/react/primitives/chat-container.js +1 -1
  178. package/esm/src/react/primitives/input-box.d.ts +4 -4
  179. package/esm/src/react/primitives/input-box.d.ts.map +1 -1
  180. package/esm/src/react/primitives/input-box.js +7 -3
  181. package/esm/src/react/primitives/message-list.d.ts +5 -5
  182. package/esm/src/react/primitives/message-list.d.ts.map +1 -1
  183. package/esm/src/react/primitives/message-list.js +1 -1
  184. package/esm/src/react/primitives/tool-primitives.d.ts +4 -4
  185. package/esm/src/react/primitives/tool-primitives.d.ts.map +1 -1
  186. package/esm/src/react/primitives/tool-primitives.js +1 -1
  187. package/esm/src/react/router/index.d.ts +1 -1
  188. package/esm/src/react/router/index.d.ts.map +1 -1
  189. package/esm/src/react/router/index.js +1 -1
  190. package/esm/src/rendering/app-reserved.d.ts +1 -1
  191. package/esm/src/rendering/app-reserved.d.ts.map +1 -1
  192. package/esm/src/rendering/app-reserved.js +1 -1
  193. package/esm/src/rendering/client/router.js +1 -1
  194. package/esm/src/rendering/client/state-bridge.d.ts +1 -1
  195. package/esm/src/rendering/client/state-bridge.d.ts.map +1 -1
  196. package/esm/src/rendering/client/state-bridge.js +1 -1
  197. package/esm/src/rendering/component-handling.d.ts +3 -1
  198. package/esm/src/rendering/component-handling.d.ts.map +1 -1
  199. package/esm/src/rendering/component-handling.js +4 -2
  200. package/esm/src/rendering/element-validator/element-normalizer.d.ts +1 -1
  201. package/esm/src/rendering/element-validator/element-normalizer.d.ts.map +1 -1
  202. package/esm/src/rendering/element-validator/element-normalizer.js +1 -1
  203. package/esm/src/rendering/element-validator/primitive-checks.d.ts +1 -1
  204. package/esm/src/rendering/element-validator/primitive-checks.d.ts.map +1 -1
  205. package/esm/src/rendering/element-validator/primitive-checks.js +1 -1
  206. package/esm/src/rendering/element-validator/validator-core.d.ts +1 -1
  207. package/esm/src/rendering/element-validator/validator-core.d.ts.map +1 -1
  208. package/esm/src/rendering/layouts/layout-applicator.d.ts +1 -1
  209. package/esm/src/rendering/layouts/layout-applicator.d.ts.map +1 -1
  210. package/esm/src/rendering/layouts/layout-applicator.js +2 -0
  211. package/esm/src/rendering/layouts/utils/applicator.d.ts +1 -1
  212. package/esm/src/rendering/layouts/utils/applicator.d.ts.map +1 -1
  213. package/esm/src/rendering/layouts/utils/component-loader.d.ts +1 -1
  214. package/esm/src/rendering/layouts/utils/component-loader.d.ts.map +1 -1
  215. package/esm/src/rendering/layouts/utils/ensure-valid-child.d.ts +1 -1
  216. package/esm/src/rendering/layouts/utils/ensure-valid-child.d.ts.map +1 -1
  217. package/esm/src/rendering/orchestrator/layout.d.ts +1 -1
  218. package/esm/src/rendering/orchestrator/layout.d.ts.map +1 -1
  219. package/esm/src/rendering/orchestrator/module-loader/index.d.ts +3 -0
  220. package/esm/src/rendering/orchestrator/module-loader/index.d.ts.map +1 -1
  221. package/esm/src/rendering/orchestrator/module-loader/index.js +74 -19
  222. package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
  223. package/esm/src/rendering/orchestrator/pipeline.js +2 -0
  224. package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts +1 -1
  225. package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts.map +1 -1
  226. package/esm/src/rendering/page-renderer.d.ts +1 -1
  227. package/esm/src/rendering/page-renderer.d.ts.map +1 -1
  228. package/esm/src/rendering/page-rendering.d.ts +1 -1
  229. package/esm/src/rendering/page-rendering.d.ts.map +1 -1
  230. package/esm/src/rendering/rsc/server-renderer/component-detector.d.ts +1 -1
  231. package/esm/src/rendering/rsc/server-renderer/component-detector.d.ts.map +1 -1
  232. package/esm/src/rendering/rsc/server-renderer/rsc-renderer.d.ts +1 -1
  233. package/esm/src/rendering/rsc/server-renderer/rsc-renderer.d.ts.map +1 -1
  234. package/esm/src/rendering/rsc/server-renderer/tree-processor.d.ts +1 -1
  235. package/esm/src/rendering/rsc/server-renderer/tree-processor.d.ts.map +1 -1
  236. package/esm/src/rendering/rsc/server-renderer/tree-processor.js +4 -2
  237. package/esm/src/rendering/snippet-renderer.js +2 -2
  238. package/esm/src/rendering/ssr/component-registry.d.ts +1 -1
  239. package/esm/src/rendering/ssr/component-registry.d.ts.map +1 -1
  240. package/esm/src/rendering/ssr/component-registry.js +1 -1
  241. package/esm/src/rendering/ssr-renderer.d.ts +1 -1
  242. package/esm/src/rendering/ssr-renderer.d.ts.map +1 -1
  243. package/esm/src/rendering/utils/react-helpers.d.ts +1 -1
  244. package/esm/src/rendering/utils/react-helpers.d.ts.map +1 -1
  245. package/esm/src/rendering/utils/react-helpers.js +1 -1
  246. package/esm/src/server/handlers/request/ssr/error-page-fallback.js +1 -1
  247. package/esm/src/server/handlers/request/ssr/not-found-fallback.js +1 -1
  248. package/esm/src/transforms/esm/http-bundler.d.ts +15 -4
  249. package/esm/src/transforms/esm/http-bundler.d.ts.map +1 -1
  250. package/esm/src/transforms/esm/http-bundler.js +105 -12
  251. package/esm/src/transforms/esm/http-cache.d.ts.map +1 -1
  252. package/esm/src/transforms/esm/http-cache.js +51 -44
  253. package/esm/src/transforms/esm/import-rewriter.d.ts.map +1 -1
  254. package/esm/src/transforms/esm/import-rewriter.js +3 -3
  255. package/esm/src/transforms/esm/package-registry.d.ts +15 -13
  256. package/esm/src/transforms/esm/package-registry.d.ts.map +1 -1
  257. package/esm/src/transforms/esm/package-registry.js +45 -32
  258. package/esm/src/transforms/esm/react-imports.d.ts.map +1 -1
  259. package/esm/src/transforms/esm/react-imports.js +3 -7
  260. package/esm/src/transforms/esm/types.d.ts +2 -0
  261. package/esm/src/transforms/esm/types.d.ts.map +1 -1
  262. package/esm/src/transforms/mdx/esm-module-loader/cache/index.d.ts +14 -0
  263. package/esm/src/transforms/mdx/esm-module-loader/cache/index.d.ts.map +1 -1
  264. package/esm/src/transforms/mdx/esm-module-loader/cache/index.js +67 -0
  265. package/esm/src/transforms/mdx/esm-module-loader/loader.d.ts.map +1 -1
  266. package/esm/src/transforms/mdx/esm-module-loader/loader.js +1 -1
  267. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.d.ts +1 -0
  268. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.d.ts.map +1 -1
  269. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.js +1 -0
  270. package/esm/src/transforms/mdx/esm-module-loader/types.d.ts +4 -0
  271. package/esm/src/transforms/mdx/esm-module-loader/types.d.ts.map +1 -1
  272. package/esm/src/transforms/mdx/index.d.ts +1 -1
  273. package/esm/src/transforms/mdx/index.d.ts.map +1 -1
  274. package/esm/src/transforms/mdx/index.js +1 -1
  275. package/esm/src/transforms/mdx/mdx-cache-adapter.js +1 -1
  276. package/esm/src/transforms/mdx/module-loader/types.d.ts +1 -1
  277. package/esm/src/transforms/mdx/module-loader/types.d.ts.map +1 -1
  278. package/esm/src/transforms/mdx/types.d.ts +2 -2
  279. package/esm/src/transforms/mdx/types.d.ts.map +1 -1
  280. package/esm/src/transforms/pipeline/context.d.ts.map +1 -1
  281. package/esm/src/transforms/pipeline/context.js +7 -15
  282. package/esm/src/transforms/pipeline/stages/finalize.d.ts.map +1 -1
  283. package/esm/src/transforms/pipeline/stages/finalize.js +1 -1
  284. package/esm/src/types/app.d.ts +1 -1
  285. package/esm/src/types/app.d.ts.map +1 -1
  286. package/esm/src/types/global-guards.d.ts +1 -1
  287. package/esm/src/types/global-guards.d.ts.map +1 -1
  288. package/esm/src/types/index.d.ts +1 -1
  289. package/esm/src/types/index.d.ts.map +1 -1
  290. package/esm/src/utils/constants/cdn.d.ts.map +1 -1
  291. package/esm/src/utils/constants/cdn.js +22 -11
  292. package/esm/src/utils/hash-utils.d.ts +2 -0
  293. package/esm/src/utils/hash-utils.d.ts.map +1 -1
  294. package/esm/src/utils/hash-utils.js +4 -0
  295. package/esm/src/workflow/react/use-approval.js +1 -1
  296. package/esm/src/workflow/react/use-workflow-list.js +1 -1
  297. package/esm/src/workflow/react/use-workflow-start.js +1 -1
  298. package/esm/src/workflow/react/use-workflow.js +1 -1
  299. package/package.json +2 -1
  300. package/src/deno.js +8 -9
  301. package/src/deps/esm.sh/@types/react-dom@19.1.11/X-ZGNzc3R5cGVAMy4yLjMKZXJlYWN0/client.d.ts +105 -0
  302. package/src/deps/esm.sh/@types/react-dom@19.1.11/X-ZGNzc3R5cGVAMy4yLjMKZXJlYWN0/server.d.ts +162 -0
  303. package/src/deps/esm.sh/@types/react@19.1.17/X-ZGNzc3R5cGVAMy4yLjM/global.d.ts +165 -0
  304. package/src/deps/esm.sh/@types/react@19.1.17/X-ZGNzc3R5cGVAMy4yLjM/index.d.ts +4267 -0
  305. package/src/deps/esm.sh/@types/react@19.1.17/X-ZGNzc3R5cGVAMy4yLjMKZXJlYWN0/global.d.ts +165 -0
  306. package/src/deps/esm.sh/@types/react@19.1.17/X-ZGNzc3R5cGVAMy4yLjMKZXJlYWN0/index.d.ts +4267 -0
  307. package/src/deps/esm.sh/@types/react@19.1.17/X-ZGNzc3R5cGVAMy4yLjMKZXJlYWN0/jsx-runtime.d.ts +36 -0
  308. package/src/deps/esm.sh/@types/scheduler@0.26.0/index.d.ts +30 -0
  309. package/src/deps/esm.sh/csstype@3.2.3/index.d.ts +22569 -0
  310. package/src/deps/esm.sh/react-dom@19.1.1/client.d.ts +105 -0
  311. package/src/deps/esm.sh/react-dom@19.1.1/client.js +5 -0
  312. package/src/deps/esm.sh/react-dom@19.1.1/server.d.ts +162 -0
  313. package/src/deps/esm.sh/react-dom@19.1.1/server.js +5 -0
  314. package/src/deps/esm.sh/react@19.1.1/jsx-runtime.d.ts +36 -0
  315. package/src/deps/esm.sh/react@19.1.1/jsx-runtime.js +3 -0
  316. package/src/deps/esm.sh/react@19.1.1.d.ts +4267 -0
  317. package/src/deps/esm.sh/react@19.1.1.js +3 -0
  318. package/src/deps/esm.sh/scheduler@^0.26.0.d.ts +30 -0
  319. package/src/deps/esm.sh/scheduler@^0.26.0.js +3 -0
  320. package/src/proxy/main.ts +471 -0
  321. package/src/src/agent/react/use-agent.ts +1 -1
  322. package/src/src/agent/react/use-chat/use-chat.ts +1 -1
  323. package/src/src/agent/react/use-completion.ts +1 -1
  324. package/src/src/agent/react/use-streaming.ts +1 -1
  325. package/src/src/agent/react/use-voice-input.ts +1 -1
  326. package/src/src/cli/app/components/list-select.ts +2 -2
  327. package/src/src/cli/app/index.ts +34 -35
  328. package/src/src/cli/app/state.ts +7 -0
  329. package/src/src/cli/app/views/dashboard.ts +46 -60
  330. package/src/src/cli/app/views/startup.ts +132 -0
  331. package/src/src/cli/commands/init/config-generator.ts +1 -1
  332. package/src/src/cli/index/arg-parser.ts +1 -0
  333. package/src/src/cli/index/command-router.ts +57 -40
  334. package/src/src/cli/index/types.ts +5 -0
  335. package/src/src/cli/ui/colors.ts +37 -0
  336. package/src/src/cli/ui/dot-matrix.ts +77 -1
  337. package/src/src/config/loader.ts +5 -4
  338. package/src/src/html/utils.ts +2 -2
  339. package/src/src/modules/component-registry/registry.ts +1 -1
  340. package/src/src/modules/import-map/default-import-map.ts +3 -25
  341. package/src/src/modules/import-map/loader.ts +7 -23
  342. package/src/src/modules/import-map/resolver.ts +13 -8
  343. package/src/src/modules/react-loader/component-loader.ts +3 -1
  344. package/src/src/modules/react-loader/extract-component.ts +1 -1
  345. package/src/src/modules/react-loader/ssr-module-loader/loader.ts +95 -68
  346. package/src/src/modules/react-loader/ssr-module-loader/types.ts +2 -0
  347. package/src/src/modules/react-loader/types.ts +3 -1
  348. package/src/src/modules/react-loader/unified-loader.ts +7 -4
  349. package/src/src/modules/server/module-batch-handler.ts +7 -0
  350. package/src/src/modules/server/module-server.ts +6 -1
  351. package/src/src/modules/server/ssr-import-rewriter.ts +9 -17
  352. package/src/src/react/compat/hooks-adapter.ts +1 -1
  353. package/src/src/react/compat/ssr-adapter/response-builder.ts +1 -1
  354. package/src/src/react/compat/ssr-adapter/server-loader.ts +10 -10
  355. package/src/src/react/compat/ssr-adapter/stream-renderer.ts +2 -2
  356. package/src/src/react/compat/ssr-adapter/string-renderer.ts +3 -3
  357. package/src/src/react/compat/version-detector/feature-detector.ts +1 -1
  358. package/src/src/react/components/AppWrapper.tsx +1 -1
  359. package/src/src/react/components/Head.tsx +7 -3
  360. package/src/src/react/components/LayoutComponent.tsx +2 -2
  361. package/src/src/react/components/Link.tsx +1 -1
  362. package/src/src/react/components/MDXProvider.tsx +2 -2
  363. package/src/src/react/components/ProviderComponent.tsx +2 -2
  364. package/src/src/react/components/ai/agent-card.tsx +1 -1
  365. package/src/src/react/components/ai/chat/components/animations.tsx +1 -1
  366. package/src/src/react/components/ai/chat/components/empty-state.tsx +1 -1
  367. package/src/src/react/components/ai/chat/components/message-actions.tsx +1 -1
  368. package/src/src/react/components/ai/chat/components/reasoning.tsx +1 -1
  369. package/src/src/react/components/ai/chat/components/tool-ui.tsx +1 -1
  370. package/src/src/react/components/ai/chat/composition/api.tsx +1 -1
  371. package/src/src/react/components/ai/chat/index.tsx +1 -1
  372. package/src/src/react/components/ai/error-boundary.tsx +1 -1
  373. package/src/src/react/components/ai/icons/index.ts +1 -1
  374. package/src/src/react/components/ai/markdown.tsx +1 -1
  375. package/src/src/react/components/ai/message.tsx +1 -1
  376. package/src/src/react/components/optimized-image/OptimizedBackgroundImage.tsx +1 -1
  377. package/src/src/react/components/optimized-image/OptimizedImage.tsx +1 -1
  378. package/src/src/react/components/optimized-image/SimpleOptimizedImage.tsx +1 -1
  379. package/src/src/react/components/optimized-image/utils.tsx +1 -1
  380. package/src/src/react/context/index.ts +1 -1
  381. package/src/src/react/fonts/index.ts +1 -1
  382. package/src/src/react/primitives/agent-primitives.tsx +1 -1
  383. package/src/src/react/primitives/chat-container.tsx +1 -1
  384. package/src/src/react/primitives/input-box.tsx +5 -3
  385. package/src/src/react/primitives/message-list.tsx +1 -1
  386. package/src/src/react/primitives/tool-primitives.tsx +1 -1
  387. package/src/src/react/router/index.ts +1 -1
  388. package/src/src/rendering/app-reserved.ts +1 -1
  389. package/src/src/rendering/client/router.ts +2 -2
  390. package/src/src/rendering/client/state-bridge.ts +2 -2
  391. package/src/src/rendering/component-handling.ts +7 -1
  392. package/src/src/rendering/element-validator/element-inspector.ts +1 -1
  393. package/src/src/rendering/element-validator/element-normalizer.ts +1 -1
  394. package/src/src/rendering/element-validator/primitive-checks.ts +1 -1
  395. package/src/src/rendering/element-validator/validator-core.ts +1 -1
  396. package/src/src/rendering/layouts/layout-applicator.ts +5 -6
  397. package/src/src/rendering/layouts/utils/applicator.ts +1 -1
  398. package/src/src/rendering/layouts/utils/component-loader.ts +1 -1
  399. package/src/src/rendering/layouts/utils/ensure-valid-child.ts +1 -1
  400. package/src/src/rendering/orchestrator/layout.ts +1 -1
  401. package/src/src/rendering/orchestrator/module-loader/index.ts +91 -20
  402. package/src/src/rendering/orchestrator/pipeline.ts +2 -0
  403. package/src/src/rendering/orchestrator/ssr-orchestrator.ts +2 -2
  404. package/src/src/rendering/page-renderer.ts +1 -1
  405. package/src/src/rendering/page-rendering.ts +1 -1
  406. package/src/src/rendering/rsc/server-renderer/component-detector.ts +1 -1
  407. package/src/src/rendering/rsc/server-renderer/rsc-renderer.ts +1 -1
  408. package/src/src/rendering/rsc/server-renderer/tree-processor.ts +14 -4
  409. package/src/src/rendering/snippet-renderer.ts +2 -2
  410. package/src/src/rendering/ssr/component-registry.ts +1 -1
  411. package/src/src/rendering/ssr-renderer.ts +1 -1
  412. package/src/src/rendering/utils/react-helpers.ts +1 -1
  413. package/src/src/server/build-app-route-renderer.ts +2 -2
  414. package/src/src/server/handlers/request/rsc/handlers/render-handler.ts +1 -1
  415. package/src/src/server/handlers/request/ssr/error-page-fallback.ts +2 -2
  416. package/src/src/server/handlers/request/ssr/not-found-fallback.ts +1 -1
  417. package/src/src/transforms/esm/http-bundler.ts +101 -11
  418. package/src/src/transforms/esm/http-cache.ts +53 -45
  419. package/src/src/transforms/esm/import-rewriter.ts +5 -3
  420. package/src/src/transforms/esm/package-registry.ts +46 -32
  421. package/src/src/transforms/esm/react-imports.ts +3 -7
  422. package/src/src/transforms/esm/types.ts +2 -0
  423. package/src/src/transforms/mdx/esm-module-loader/cache/index.ts +84 -0
  424. package/src/src/transforms/mdx/esm-module-loader/loader.ts +2 -1
  425. package/src/src/transforms/mdx/esm-module-loader/module-fetcher/index.ts +2 -1
  426. package/src/src/transforms/mdx/esm-module-loader/types.ts +4 -0
  427. package/src/src/transforms/mdx/index.ts +1 -1
  428. package/src/src/transforms/mdx/mdx-cache-adapter.ts +1 -1
  429. package/src/src/transforms/mdx/module-loader/types.ts +1 -1
  430. package/src/src/transforms/mdx/types.ts +2 -2
  431. package/src/src/transforms/pipeline/context.ts +7 -18
  432. package/src/src/transforms/pipeline/stages/finalize.ts +6 -1
  433. package/src/src/transforms/plugins/babel-node-positions.ts +2 -2
  434. package/src/src/types/app.ts +1 -1
  435. package/src/src/types/global-guards.ts +1 -1
  436. package/src/src/types/index.ts +1 -1
  437. package/src/src/utils/constants/cdn.ts +21 -12
  438. package/src/src/utils/hash-utils.ts +5 -0
  439. package/src/src/workflow/react/use-approval.ts +1 -1
  440. package/src/src/workflow/react/use-workflow-list.ts +1 -1
  441. package/src/src/workflow/react/use-workflow-start.ts +1 -1
  442. package/src/src/workflow/react/use-workflow.ts +1 -1
@@ -134,40 +134,133 @@ export function createHTTPPlugin() {
134
134
  };
135
135
  }
136
136
  /**
137
- * Ensure esm.sh URLs have ?external=react for SSR.
138
- * This makes them import React as a bare specifier, which deno.json resolves.
137
+ * Ensure esm.sh URLs have external=react,react-dom for SSR.
138
+ * This makes them import React as bare specifiers, which the import map resolves.
139
139
  *
140
140
  * Uses two esm.sh features:
141
- * - `external=react` - Don't bundle React, let import map resolve it
141
+ * - `external=react,react-dom` - Don't bundle React/ReactDOM, let import map resolve them
142
142
  * - `deps=react@X,react-dom@X` - Pin dependency versions to prevent mismatches
143
+ *
144
+ * Logic for external handling:
145
+ * 1. If no `external=` param → add `external=react,react-dom`
146
+ * 2. If `external=X` exists but no `react` → append `,react,react-dom`
147
+ * 3. If has `react` but no `react-dom` → append `,react-dom`
148
+ * 4. If has both `react` AND `react-dom` → leave alone
149
+ *
150
+ * @param code - Source code to process
151
+ * @param _cacheDir - Unused (kept for API compatibility)
152
+ * @param hash - Hash for logging
153
+ * @param reactVersion - React version for deps param (defaults to REACT_VERSION)
143
154
  */
144
- export function bundleHttpImports(code, _cacheDir, hash) {
155
+ export function bundleHttpImports(code, _cacheDir, hash, reactVersion) {
145
156
  const has = hasHttpImports(code);
146
157
  logger.debug(`${LOG_PREFIX} Check: hasHttp=${has}, hash=${hash.slice(0, 8)}`);
147
158
  if (!has)
148
159
  return code;
160
+ const version = reactVersion ?? REACT_VERSION;
149
161
  return replaceSpecifiers(code, (specifier) => {
162
+ // Handle relative esm.sh paths like "/react-dom?target=es2022" or "/hoist-non-react-statics@..."
163
+ // These are returned by esm.sh stub modules and need to be converted to full URLs
164
+ if (specifier.startsWith("/") && !specifier.startsWith("//")) {
165
+ const fullUrl = `https://esm.sh${specifier}`;
166
+ // Recursively process as full URL (will add external params if needed)
167
+ const isReactPackage = /^\/react(-dom)?(@|\/|\?|$)/.test(specifier);
168
+ if (isReactPackage) {
169
+ // React packages - just ensure target and return full URL
170
+ if (!specifier.includes("target=")) {
171
+ const joiner = specifier.includes("?") ? "&" : "?";
172
+ return `${fullUrl}${joiner}target=es2022`;
173
+ }
174
+ return fullUrl;
175
+ }
176
+ // Non-React packages - add external params
177
+ const params = [];
178
+ if (!specifier.includes("target="))
179
+ params.push("target=es2022");
180
+ if (!specifier.includes("external="))
181
+ params.push("external=react,react-dom");
182
+ if (!specifier.includes("deps="))
183
+ params.push(`deps=react@${version},react-dom@${version}`);
184
+ if (params.length === 0)
185
+ return fullUrl;
186
+ const joiner = specifier.includes("?") ? "&" : "?";
187
+ return `${fullUrl}${joiner}${params.join("&")}`;
188
+ }
150
189
  const isEsmSh = specifier.startsWith("https://esm.sh/") ||
151
190
  specifier.startsWith("http://esm.sh/");
152
191
  const isVfEsm = specifier.startsWith("https://esm.veryfront.com/");
153
192
  if (!isEsmSh && !isVfEsm)
154
193
  return null;
194
+ // Don't modify React/ReactDOM package URLs themselves
155
195
  const isReactPackage = /\/react(-dom)?(@|\/|$)/.test(specifier);
196
+ if (isReactPackage) {
197
+ // Just ensure target is set for React packages
198
+ if (!specifier.includes("target=")) {
199
+ const joiner = specifier.includes("?") ? "&" : "?";
200
+ return `${specifier}${joiner}target=es2022`;
201
+ }
202
+ return null;
203
+ }
204
+ // For non-React packages: ensure external=react,react-dom and deps
156
205
  const params = [];
157
206
  if (!specifier.includes("target=")) {
158
207
  params.push("target=es2022");
159
208
  }
160
- // Only add external and deps to non-React packages
161
- // Use external=react to not bundle React (let import map resolve it)
162
- // Use deps=react@X,react-dom@X to pin dependency versions
163
- if (!isReactPackage) {
164
- if (!specifier.includes("external=react")) {
165
- params.push("external=react");
209
+ // Handle external param - ensure both react AND react-dom are externalized
210
+ const hasExternal = specifier.includes("external=");
211
+ const hasReactExternal = specifier.includes("external=react") ||
212
+ /external=[^&]*\breact\b/.test(specifier);
213
+ const hasReactDomExternal = /external=[^&]*react-dom/.test(specifier);
214
+ if (!hasExternal) {
215
+ // No external param - add both
216
+ params.push("external=react,react-dom");
217
+ }
218
+ else if (!hasReactExternal) {
219
+ // Has external but no react - append react,react-dom
220
+ // This requires modifying existing param, so we'll use URL parsing
221
+ try {
222
+ const url = new URL(specifier);
223
+ const existing = url.searchParams.get("external") || "";
224
+ url.searchParams.set("external", `${existing},react,react-dom`);
225
+ // Return full modified URL and skip other param additions
226
+ if (!specifier.includes("target=")) {
227
+ url.searchParams.set("target", "es2022");
228
+ }
229
+ if (!specifier.includes("deps=")) {
230
+ url.searchParams.set("deps", `react@${version},react-dom@${version}`);
231
+ }
232
+ logger.debug(`${LOG_PREFIX} ${specifier} -> ${url.toString()}`);
233
+ return url.toString();
234
+ }
235
+ catch {
236
+ // Fallback: just add as new param (may create duplicate)
237
+ params.push("external=react,react-dom");
238
+ }
239
+ }
240
+ else if (!hasReactDomExternal) {
241
+ // Has react but not react-dom - append react-dom
242
+ try {
243
+ const url = new URL(specifier);
244
+ const existing = url.searchParams.get("external") || "";
245
+ url.searchParams.set("external", `${existing},react-dom`);
246
+ if (!specifier.includes("target=")) {
247
+ url.searchParams.set("target", "es2022");
248
+ }
249
+ if (!specifier.includes("deps=")) {
250
+ url.searchParams.set("deps", `react@${version},react-dom@${version}`);
251
+ }
252
+ logger.debug(`${LOG_PREFIX} ${specifier} -> ${url.toString()}`);
253
+ return url.toString();
166
254
  }
167
- if (!specifier.includes("deps=")) {
168
- params.push(`deps=react@${REACT_VERSION},react-dom@${REACT_VERSION}`);
255
+ catch {
256
+ // Fallback
257
+ params.push("external=react-dom");
169
258
  }
170
259
  }
260
+ // else: has both react and react-dom - no external changes needed
261
+ if (!specifier.includes("deps=")) {
262
+ params.push(`deps=react@${version},react-dom@${version}`);
263
+ }
171
264
  if (params.length === 0)
172
265
  return null;
173
266
  const joiner = specifier.includes("?") ? "&" : "?";
@@ -1 +1 @@
1
- {"version":3,"file":"http-cache.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/http-cache.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAmBzE,KAAK,YAAY,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,eAAe,CAAC;IAC3B,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAyUF;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,MAAM,CAAC,CAOjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOvF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA8D9F;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAClD,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,EAAE,CAAC,CAiInB"}
1
+ {"version":3,"file":"http-cache.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/http-cache.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAezE,KAAK,YAAY,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,eAAe,CAAC;IAC3B,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAoVF;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,MAAM,CAAC,CAOjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOvF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA8D9F;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAClD,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,EAAE,CAAC,CAiInB"}
@@ -10,23 +10,26 @@ import * as dntShim from "../../../_dnt.shims.js";
10
10
  import { createFileSystem, exists } from "../../platform/compat/fs.js";
11
11
  import { isAbsolute, join } from "../../platform/compat/path/index.js";
12
12
  import { cwd } from "../../platform/compat/process.js";
13
+ import { isDeno } from "../../platform/compat/runtime.js";
13
14
  import { rendererLogger as logger } from "../../utils/index.js";
14
15
  import { simpleHash } from "../../utils/hash-utils.js";
15
16
  import { LRUCache } from "../../utils/lru-wrapper.js";
16
17
  import { withSpan } from "../../observability/tracing/otlp-setup.js";
17
18
  import { SpanNames } from "../../observability/tracing/span-names.js";
18
19
  import { resolveImport } from "../../modules/import-map/resolver.js";
19
- import { isDeno } from "../../platform/compat/runtime.js";
20
- import { getDenoNpmReactMap, getReactImportMap, REACT_VERSION } from "./package-registry.js";
20
+ import { getReactImportMap, REACT_VERSION } from "./package-registry.js";
21
21
  import { parseImports, replaceSpecifiers } from "./lexer.js";
22
22
  import { CacheBackends, createDistributedCacheAccessor } from "../../cache/backend.js";
23
23
  import { HTTP_MODULE_CACHE_MAX_ENTRIES, HTTP_MODULE_DISTRIBUTED_TTL_SEC, } from "../../utils/constants/cache.js";
24
24
  /** Lazy-loaded distributed cache backend for cross-pod sharing */
25
25
  const getDistributedCache = createDistributedCacheAccessor(() => CacheBackends.httpModule(), "HTTP-CACHE");
26
- /** TTL for cached modules in distributed cache (uses centralized config) */
27
- const DISTRIBUTED_CACHE_TTL_SECONDS = HTTP_MODULE_DISTRIBUTED_TTL_SEC;
28
26
  const cachedPaths = new LRUCache({ maxEntries: HTTP_MODULE_CACHE_MAX_ENTRIES });
29
27
  const processingStack = new Set();
28
+ /** Tracks last TTL refresh per hash. Refresh every 4h to keep 20h+ remaining (24h total). */
29
+ const lastDistributedRefresh = new LRUCache({
30
+ maxEntries: HTTP_MODULE_CACHE_MAX_ENTRIES,
31
+ });
32
+ const DISTRIBUTED_REFRESH_INTERVAL_MS = 4 * 60 * 60 * 1000;
30
33
  function ensureAbsoluteDir(path) {
31
34
  return isAbsolute(path) ? path : join(cwd(), path);
32
35
  }
@@ -36,13 +39,24 @@ function isHttpUrl(specifier) {
36
39
  /**
37
40
  * Check if a URL is for React core packages.
38
41
  *
39
- * Previously, React modules were NOT cached to prevent multiple React instances.
40
- * Now with npm: specifiers for Deno (which auto-deduplicate) and consistent
41
- * esm.sh URLs with external=react for other runtimes, all code uses the same
42
- * React instance.
42
+ * React core modules (react, react-dom) must NOT be cached/bundled.
43
+ * Instead, all packages use external=react and import from the same esm.sh URL.
44
+ * This prevents multiple React instances which causes "useContext is null" errors.
43
45
  */
44
- function isReactCoreUrl(_url) {
45
- return false;
46
+ function isReactCoreUrl(url) {
47
+ try {
48
+ const parsed = new URL(url);
49
+ if (!parsed.hostname.includes("esm.sh"))
50
+ return false;
51
+ // Extract package name from esm.sh pathname
52
+ // Formats: /react@version, /v150/react@version, /stable/react@version
53
+ const pathname = parsed.pathname.replace(/^\/(v\d+|stable)\//, "/");
54
+ const match = pathname.match(/^\/(react|react-dom)(@[\d.]+)?(?:\/|$|\?)/);
55
+ return match !== null;
56
+ }
57
+ catch {
58
+ return false;
59
+ }
46
60
  }
47
61
  function isExternalScheme(specifier) {
48
62
  return specifier.startsWith("node:") ||
@@ -98,25 +112,8 @@ function toEsmShUrlFromNpm(specifier) {
98
112
  return `https://esm.sh/${specifier.slice(4)}`;
99
113
  }
100
114
  function resolveBareSpecifier(specifier, importMap, reactVersion = REACT_VERSION) {
101
- // For Deno SSR: Resolve React to npm: specifiers for automatic deduplication.
102
- // Deno's native npm resolution ensures all modules share the same React instance.
103
- // See: https://deno.com/blog/not-using-npm-specifiers-doing-it-wrong
104
- if (isDeno) {
105
- const denoReactMap = getDenoNpmReactMap(reactVersion);
106
- const denoMatch = denoReactMap[specifier];
107
- if (denoMatch)
108
- return denoMatch;
109
- // For unknown react/* or react-dom/* subpaths, construct npm: specifiers
110
- if (specifier.startsWith("react/") && !specifier.startsWith("react-dom")) {
111
- const subpath = specifier.slice("react/".length);
112
- return `npm:react@${reactVersion}/${subpath}`;
113
- }
114
- if (specifier.startsWith("react-dom/")) {
115
- const subpath = specifier.slice("react-dom/".length);
116
- return `npm:react-dom@${reactVersion}/${subpath}`;
117
- }
118
- }
119
- // For non-Deno runtimes: Use esm.sh URLs with consistent versioning.
115
+ // Use esm.sh URLs for React - NO npm: specifiers per plan requirements.
116
+ // All packages use external=react to share the same React instance.
120
117
  const reactMap = getReactImportMap(reactVersion);
121
118
  const reactMapped = reactMap[specifier];
122
119
  if (reactMapped)
@@ -151,23 +148,28 @@ async function cacheHttpModule(url, options) {
151
148
  const fs = createFileSystem();
152
149
  if (await exists(cachePath)) {
153
150
  cachedPaths.set(cacheKey, cachePath);
154
- // Synchronously ensure code:{hash} exists in distributed cache for cross-pod recovery
155
- // This backfills bundles created before code:{hash} storage was added
156
- // Synchronous to guarantee data is stored before other pods need it
151
+ // Refresh distributed cache TTL so bundles outlive transforms that reference them.
152
+ // Without this, bundles expire (24h) while SSR transforms (6h) are still valid.
157
153
  const distributed = await getDistributedCache();
158
154
  if (distributed) {
159
155
  const hash = simpleHash(normalizedUrl);
160
- try {
161
- const hasCode = await distributed.get(`code:${hash}`);
162
- if (!hasCode) {
156
+ const hashStr = String(hash);
157
+ const now = Date.now();
158
+ const lastRefresh = lastDistributedRefresh.get(hashStr);
159
+ const needsRefresh = !lastRefresh || (now - lastRefresh > DISTRIBUTED_REFRESH_INTERVAL_MS);
160
+ if (needsRefresh) {
161
+ try {
163
162
  const code = await fs.readTextFile(cachePath);
164
- await distributed.set(`code:${hash}`, code, DISTRIBUTED_CACHE_TTL_SECONDS);
165
- logger.info("[HTTP-CACHE] Backfilled code:{hash} for existing bundle", { hash });
163
+ await Promise.all([
164
+ distributed.set(`code:${hash}`, code, HTTP_MODULE_DISTRIBUTED_TTL_SEC),
165
+ distributed.set(`hash:${hash}`, normalizedUrl, HTTP_MODULE_DISTRIBUTED_TTL_SEC),
166
+ ]);
167
+ lastDistributedRefresh.set(hashStr, now);
168
+ logger.debug("[HTTP-CACHE] Refreshed distributed cache TTL", { hash });
169
+ }
170
+ catch (error) {
171
+ logger.debug("[HTTP-CACHE] Distributed cache refresh failed", { hash, error });
166
172
  }
167
- }
168
- catch (error) {
169
- // Log but don't fail - backfill is best-effort
170
- logger.debug("[HTTP-CACHE] Backfill failed, continuing", { hash, error });
171
173
  }
172
174
  }
173
175
  return cachePath;
@@ -232,9 +234,9 @@ async function cacheHttpModule(url, options) {
232
234
  const hash = simpleHash(normalizedUrl);
233
235
  try {
234
236
  await Promise.all([
235
- distributed.set(normalizedUrl, code, DISTRIBUTED_CACHE_TTL_SECONDS),
236
- distributed.set(`code:${hash}`, code, DISTRIBUTED_CACHE_TTL_SECONDS),
237
- distributed.set(`hash:${hash}`, normalizedUrl, DISTRIBUTED_CACHE_TTL_SECONDS),
237
+ distributed.set(normalizedUrl, code, HTTP_MODULE_DISTRIBUTED_TTL_SEC),
238
+ distributed.set(`code:${hash}`, code, HTTP_MODULE_DISTRIBUTED_TTL_SEC),
239
+ distributed.set(`hash:${hash}`, normalizedUrl, HTTP_MODULE_DISTRIBUTED_TTL_SEC),
238
240
  ]);
239
241
  }
240
242
  catch (error) {
@@ -264,6 +266,11 @@ async function resolveSpecifier(specifier, baseUrl, options) {
264
266
  if (!baseUrl || !isHttpUrl(baseUrl))
265
267
  return null;
266
268
  const resolved = new URL(specifier, baseUrl).toString();
269
+ // For React core URLs: return the full esm.sh URL (not cached, to prevent multiple instances)
270
+ // This transforms relative paths like "/react-dom?..." to "https://esm.sh/react-dom?..."
271
+ if (isReactCoreUrl(resolved)) {
272
+ return normalizeHttpUrl(resolved);
273
+ }
267
274
  const cached = await cacheHttpModule(resolved, options);
268
275
  return cached ? `file://${cached}` : null;
269
276
  }
@@ -1 +1 @@
1
- {"version":3,"file":"import-rewriter.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/import-rewriter.ts"],"names":[],"mappings":"AAKA,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAmB1F;AAkDD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAuB3F;AAWD,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAgEjB"}
1
+ {"version":3,"file":"import-rewriter.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/import-rewriter.ts"],"names":[],"mappings":"AAKA,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAmB1F;AAoDD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAuB3F;AAWD,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAgEjB"}
@@ -40,9 +40,9 @@ function normalizeVersionedSpecifier(specifier) {
40
40
  }
41
41
  const REACT_IMPORT_MAP = {
42
42
  react: `https://esm.sh/react@${REACT_DEFAULT_VERSION}?target=es2022`,
43
- "react-dom": `https://esm.sh/react-dom@${REACT_DEFAULT_VERSION}?target=es2022`,
44
- "react-dom/client": `https://esm.sh/react-dom@${REACT_DEFAULT_VERSION}/client?target=es2022`,
45
- "react-dom/server": `https://esm.sh/react-dom@${REACT_DEFAULT_VERSION}/server?target=es2022`,
43
+ "react-dom": `https://esm.sh/react-dom@${REACT_DEFAULT_VERSION}?external=react&target=es2022`,
44
+ "react-dom/client": `https://esm.sh/react-dom@${REACT_DEFAULT_VERSION}/client?external=react&target=es2022`,
45
+ "react-dom/server": `https://esm.sh/react-dom@${REACT_DEFAULT_VERSION}/server?external=react&target=es2022`,
46
46
  "react/jsx-runtime": `https://esm.sh/react@${REACT_DEFAULT_VERSION}/jsx-runtime?target=es2022`,
47
47
  "react/jsx-dev-runtime": `https://esm.sh/react@${REACT_DEFAULT_VERSION}/jsx-dev-runtime?target=es2022`,
48
48
  };
@@ -8,13 +8,20 @@
8
8
  export declare const DEFAULT_REACT_VERSION = "19.1.1";
9
9
  export declare const TAILWIND_VERSION = "4.1.8";
10
10
  /**
11
- * Set the React version from project configuration.
12
- * Call this during project initialization if a custom version is specified.
11
+ * Validate React version format (semver: X.Y.Z).
12
+ * Returns true if valid, false otherwise.
13
13
  */
14
- export declare function setReactVersion(version: string): void;
14
+ export declare function isValidReactVersion(version: string): boolean;
15
15
  /**
16
- * Get the current React version.
17
- * Returns configured version if set, otherwise the default.
16
+ * Validate and normalize React version.
17
+ * Returns the version if valid, or DEFAULT_REACT_VERSION if invalid.
18
+ * Logs a warning if the version is invalid.
19
+ */
20
+ export declare function normalizeReactVersion(version: string | undefined): string;
21
+ /**
22
+ * @deprecated Global React version is no longer supported.
23
+ * Use config.react.version passed through TransformOptions instead.
24
+ * This function now always returns DEFAULT_REACT_VERSION.
18
25
  */
19
26
  export declare function getReactVersion(): string;
20
27
  /** @deprecated Use DEFAULT_REACT_VERSION or getReactVersion() */
@@ -66,14 +73,9 @@ export declare function getReactUrls(version?: string): Record<string, string>;
66
73
  */
67
74
  export declare function getReactImportMap(version?: string): Record<string, string>;
68
75
  /**
69
- * Get React npm specifiers for Deno SSR.
70
- * Uses npm: protocol which Deno handles natively with automatic deduplication.
71
- * See: https://deno.com/blog/not-using-npm-specifiers-doing-it-wrong
72
- *
73
- * Benefits over esm.sh:
74
- * - Automatic semantic version deduplication (like Node's node_modules)
75
- * - No manual external= flags or shared-*.ts wrapper files needed
76
- * - Native support in Deno 2+
76
+ * Get React esm.sh URLs for Deno SSR.
77
+ * Uses esm.sh for both SSR and browser to ensure identical React instances.
78
+ * All sub-packages use external=react to share the same React instance.
77
79
  *
78
80
  * @param version - React version to use (defaults to REACT_VERSION)
79
81
  */
@@ -1 +1 @@
1
- {"version":3,"file":"package-registry.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/package-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wEAAwE;AACxE,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAKxC;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAErD;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,iEAAiE;AACjE,eAAO,MAAM,aAAa,WAAwB,CAAC;AAEnD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAM1C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAI9F;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUrE;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAO1E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAU3E"}
1
+ {"version":3,"file":"package-registry.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/package-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wEAAwE;AACxE,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAOzE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,iEAAiE;AACjE,eAAO,MAAM,aAAa,WAAwB,CAAC;AAEnD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAa1C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAI9F;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUrE;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAO1E;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAU3E"}
@@ -7,21 +7,33 @@
7
7
  /** Default React version - used when not specified in project config */
8
8
  export const DEFAULT_REACT_VERSION = "19.1.1";
9
9
  export const TAILWIND_VERSION = "4.1.8";
10
- /** Cached React version from project config */
11
- let configuredReactVersion = null;
12
10
  /**
13
- * Set the React version from project configuration.
14
- * Call this during project initialization if a custom version is specified.
11
+ * Validate React version format (semver: X.Y.Z).
12
+ * Returns true if valid, false otherwise.
15
13
  */
16
- export function setReactVersion(version) {
17
- configuredReactVersion = version;
14
+ export function isValidReactVersion(version) {
15
+ return /^\d+\.\d+\.\d+$/.test(version);
18
16
  }
19
17
  /**
20
- * Get the current React version.
21
- * Returns configured version if set, otherwise the default.
18
+ * Validate and normalize React version.
19
+ * Returns the version if valid, or DEFAULT_REACT_VERSION if invalid.
20
+ * Logs a warning if the version is invalid.
21
+ */
22
+ export function normalizeReactVersion(version) {
23
+ if (!version)
24
+ return DEFAULT_REACT_VERSION;
25
+ if (isValidReactVersion(version))
26
+ return version;
27
+ console.warn(`[VERYFRONT] Invalid React version format "${version}" (expected X.Y.Z). Using default: ${DEFAULT_REACT_VERSION}`);
28
+ return DEFAULT_REACT_VERSION;
29
+ }
30
+ /**
31
+ * @deprecated Global React version is no longer supported.
32
+ * Use config.react.version passed through TransformOptions instead.
33
+ * This function now always returns DEFAULT_REACT_VERSION.
22
34
  */
23
35
  export function getReactVersion() {
24
- return configuredReactVersion ?? DEFAULT_REACT_VERSION;
36
+ return DEFAULT_REACT_VERSION;
25
37
  }
26
38
  /** @deprecated Use DEFAULT_REACT_VERSION or getReactVersion() */
27
39
  export const REACT_VERSION = DEFAULT_REACT_VERSION;
@@ -43,8 +55,14 @@ export const REACT_VERSION = DEFAULT_REACT_VERSION;
43
55
  * v12: Store HTTP bundle code by hash for direct recovery (code:{hash})
44
56
  */
45
57
  export const TRANSFORM_CACHE_VERSION = 12;
46
- function esmSh(pkg, version, path = "", query = "target=es2022") {
47
- return `https://esm.sh/${pkg}@${version}${path}?${query}`;
58
+ /** csstype version - must match deno.json for type consistency */
59
+ const CSSTYPE_VERSION = "3.2.3";
60
+ /** Build esm.sh URL with deps=csstype for React packages (ensures type consistency) */
61
+ function esmShReact(pkg, version, path = "", external = false) {
62
+ const params = external
63
+ ? [`external=react`, `target=es2022`, `deps=csstype@${CSSTYPE_VERSION}`]
64
+ : [`target=es2022`, `deps=csstype@${CSSTYPE_VERSION}`];
65
+ return `https://esm.sh/${pkg}@${version}${path}?${params.join("&")}`;
48
66
  }
49
67
  /**
50
68
  * Generate esm.sh URL for browser.
@@ -70,12 +88,12 @@ export function getEsmShUrl(pkg, version, external) {
70
88
  export function getReactUrls(version) {
71
89
  const v = version ?? getReactVersion();
72
90
  return {
73
- react: esmSh("react", v),
74
- "react-dom": esmSh("react-dom", v, "", "external=react&target=es2022"),
75
- "react-dom/client": esmSh("react-dom", v, "/client", "external=react&target=es2022"),
76
- "react-dom/server": esmSh("react-dom", v, "/server", "external=react&target=es2022"),
77
- "react/jsx-runtime": esmSh("react", v, "/jsx-runtime", "external=react&target=es2022"),
78
- "react/jsx-dev-runtime": esmSh("react", v, "/jsx-dev-runtime", "external=react&target=es2022"),
91
+ react: esmShReact("react", v),
92
+ "react-dom": esmShReact("react-dom", v, "", true),
93
+ "react-dom/client": esmShReact("react-dom", v, "/client", true),
94
+ "react-dom/server": esmShReact("react-dom", v, "/server", true),
95
+ "react/jsx-runtime": esmShReact("react", v, "/jsx-runtime", true),
96
+ "react/jsx-dev-runtime": esmShReact("react", v, "/jsx-dev-runtime", true),
79
97
  };
80
98
  }
81
99
  /**
@@ -93,29 +111,24 @@ export function getReactImportMap(version) {
93
111
  return {
94
112
  ...getReactUrls(v),
95
113
  // Prefix match for any react/* subpath imports
96
- "react/": esmSh("react", v, "/", "external=react&target=es2022"),
114
+ "react/": esmShReact("react", v, "/", true),
97
115
  };
98
116
  }
99
117
  /**
100
- * Get React npm specifiers for Deno SSR.
101
- * Uses npm: protocol which Deno handles natively with automatic deduplication.
102
- * See: https://deno.com/blog/not-using-npm-specifiers-doing-it-wrong
103
- *
104
- * Benefits over esm.sh:
105
- * - Automatic semantic version deduplication (like Node's node_modules)
106
- * - No manual external= flags or shared-*.ts wrapper files needed
107
- * - Native support in Deno 2+
118
+ * Get React esm.sh URLs for Deno SSR.
119
+ * Uses esm.sh for both SSR and browser to ensure identical React instances.
120
+ * All sub-packages use external=react to share the same React instance.
108
121
  *
109
122
  * @param version - React version to use (defaults to REACT_VERSION)
110
123
  */
111
124
  export function getDenoNpmReactMap(version) {
112
125
  const v = version ?? getReactVersion();
113
126
  return {
114
- "react": `npm:react@${v}`,
115
- "react-dom": `npm:react-dom@${v}`,
116
- "react-dom/client": `npm:react-dom@${v}/client`,
117
- "react-dom/server": `npm:react-dom@${v}/server`,
118
- "react/jsx-runtime": `npm:react@${v}/jsx-runtime`,
119
- "react/jsx-dev-runtime": `npm:react@${v}/jsx-dev-runtime`,
127
+ "react": esmShReact("react", v),
128
+ "react-dom": esmShReact("react-dom", v, "", true),
129
+ "react-dom/client": esmShReact("react-dom", v, "/client", true),
130
+ "react-dom/server": esmShReact("react-dom", v, "/server", true),
131
+ "react/jsx-runtime": esmShReact("react", v, "/jsx-runtime", true),
132
+ "react/jsx-dev-runtime": esmShReact("react", v, "/jsx-dev-runtime", true),
120
133
  };
121
134
  }
@@ -1 +1 @@
1
- {"version":3,"file":"react-imports.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/react-imports.ts"],"names":[],"mappings":"AAmBA,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,OAAe,EACvB,YAAY,GAAE,MAAsB,GACnC,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,OAAe,EACxB,YAAY,GAAE,MAAsB,GACnC,OAAO,CAAC,MAAM,CAAC,CASjB"}
1
+ {"version":3,"file":"react-imports.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/react-imports.ts"],"names":[],"mappings":"AAiBA,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,OAAe,EACvB,YAAY,GAAE,MAAsB,GACnC,OAAO,CAAC,MAAM,CAAC,CAcjB;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,OAAe,EACxB,YAAY,GAAE,MAAsB,GACnC,OAAO,CAAC,MAAM,CAAC,CASjB"}
@@ -1,7 +1,5 @@
1
1
  import { replaceSpecifiers } from "./lexer.js";
2
- import { getDenoNpmReactMap, getReactImportMap, REACT_VERSION } from "./package-registry.js";
3
- import { isDeno } from "../../platform/compat/runtime.js";
4
- import { getLocalReactPaths } from "../../platform/compat/react-paths.js";
2
+ import { getReactImportMap, REACT_VERSION } from "./package-registry.js";
5
3
  const srcDir = new URL(".", globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).url).pathname.replace(/\/(build|src)\/transforms\/esm\/?$/, "");
6
4
  function getVeryfrontModulePaths() {
7
5
  return {
@@ -16,12 +14,10 @@ export async function resolveReactImports(code, forSSR = false, reactVersion = R
16
14
  if (!forSSR) {
17
15
  return replaceSpecifiers(code, (specifier) => reactImports[specifier] ?? null);
18
16
  }
19
- // For Deno SSR: Use npm: specifiers (auto-deduplicated by Deno's npm cache)
20
- // For Node/Bun SSR: Use local node_modules paths (auto-deduplicated by Node)
21
- // See: https://deno.com/blog/not-using-npm-specifiers-doing-it-wrong
17
+ // For SSR: Use esm.sh URLs consistently (NO npm: specifiers per plan requirements)
22
18
  const ssrImports = {
23
19
  ...getVeryfrontModulePaths(),
24
- ...(isDeno ? getDenoNpmReactMap(reactVersion) : getLocalReactPaths()),
20
+ ...reactImports,
25
21
  };
26
22
  return replaceSpecifiers(code, (specifier) => ssrImports[specifier] ?? null);
27
23
  }
@@ -8,6 +8,8 @@ export interface TransformOptions {
8
8
  ssr?: boolean;
9
9
  apiBaseUrl?: string;
10
10
  studioEmbed?: boolean;
11
+ /** React version for transforms (from project config, defaults to DEFAULT_REACT_VERSION) */
12
+ reactVersion?: string;
11
13
  }
12
14
  export interface TransformContext {
13
15
  source: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,gBAAgB,CAAC;CAC3B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,4FAA4F;IAC5F,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,gBAAgB,CAAC;CAC3B"}
@@ -35,4 +35,18 @@ export declare function invalidateModulePaths(changedPaths: string[]): void;
35
35
  * Called when files are updated via Studio to ensure fresh content is served.
36
36
  */
37
37
  export declare function clearESMDiskCache(): Promise<void>;
38
+ /**
39
+ * Look up a module in the MDX-ESM cache.
40
+ *
41
+ * This allows other loaders (like SSR loader) to reuse modules that
42
+ * MDX-ESM has already transformed and cached, preventing duplicate
43
+ * module instances (which breaks React context, etc.).
44
+ *
45
+ * @param filePath - Project-relative file path like "lib/ChatContext.tsx"
46
+ * @param cacheDir - The MDX-ESM cache directory for this project/contentSource
47
+ * @param projectDir - Project directory to strip from absolute paths
48
+ * @param contentHash - Optional content hash to validate cached file freshness
49
+ * @returns The cached file path if found and valid, null otherwise
50
+ */
51
+ export declare function lookupMdxEsmCache(filePath: string, cacheDir: string, projectDir?: string, contentHash?: string): Promise<string | null>;
38
52
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/mdx/esm-module-loader/cache/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAEL,KAAK,UAAU,EAEhB,MAAM,mCAAmC,CAAC;AAO3C;;GAEG;AACH,wBAAgB,UAAU,IAAI,UAAU,CAGvC;AAOD;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAsBvF;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAezE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAI3C;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI,CAgClE;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAevD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/mdx/esm-module-loader/cache/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAEL,KAAK,UAAU,EAEhB,MAAM,mCAAmC,CAAC;AAQ3C;;GAEG;AACH,wBAAgB,UAAU,IAAI,UAAU,CAGvC;AAOD;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAsBvF;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAezE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAI3C;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI,CAgClE;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAevD;AAyBD;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAwCxB"}