veryfront 0.1.1047 → 0.1.1049

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 (910) hide show
  1. package/esm/cli/auth/login.d.ts +5 -5
  2. package/esm/cli/auth/login.d.ts.map +1 -1
  3. package/esm/cli/auth/login.js +28 -28
  4. package/esm/cli/auth/provider-store.d.ts +5 -4
  5. package/esm/cli/auth/provider-store.d.ts.map +1 -1
  6. package/esm/cli/auth/provider-store.js +17 -13
  7. package/esm/cli/commands/build/command.d.ts +2 -0
  8. package/esm/cli/commands/build/command.d.ts.map +1 -1
  9. package/esm/cli/commands/build/command.js +46 -20
  10. package/esm/cli/commands/build/handler.d.ts +6 -0
  11. package/esm/cli/commands/build/handler.d.ts.map +1 -1
  12. package/esm/cli/commands/build/handler.js +9 -5
  13. package/esm/cli/commands/deploy/command-help.d.ts.map +1 -1
  14. package/esm/cli/commands/deploy/command-help.js +2 -1
  15. package/esm/cli/commands/deploy/command.d.ts +83 -14
  16. package/esm/cli/commands/deploy/command.d.ts.map +1 -1
  17. package/esm/cli/commands/deploy/command.js +317 -23
  18. package/esm/cli/commands/deploy/index.d.ts +2 -2
  19. package/esm/cli/commands/deploy/index.d.ts.map +1 -1
  20. package/esm/cli/commands/deploy/index.js +1 -1
  21. package/esm/cli/commands/dev/command.d.ts +1 -0
  22. package/esm/cli/commands/dev/command.d.ts.map +1 -1
  23. package/esm/cli/commands/dev/command.js +10 -1
  24. package/esm/cli/commands/dev/handler.d.ts +2 -0
  25. package/esm/cli/commands/dev/handler.d.ts.map +1 -1
  26. package/esm/cli/commands/dev/handler.js +6 -1
  27. package/esm/cli/commands/doctor/command-help.d.ts.map +1 -1
  28. package/esm/cli/commands/doctor/command-help.js +5 -1
  29. package/esm/cli/commands/doctor/handler.d.ts +1 -0
  30. package/esm/cli/commands/doctor/handler.d.ts.map +1 -1
  31. package/esm/cli/commands/doctor/handler.js +2 -0
  32. package/esm/cli/commands/doctor/index.d.ts +7 -0
  33. package/esm/cli/commands/doctor/index.d.ts.map +1 -1
  34. package/esm/cli/commands/doctor/index.js +67 -15
  35. package/esm/cli/commands/doctor/server-checks.d.ts +2 -2
  36. package/esm/cli/commands/doctor/server-checks.d.ts.map +1 -1
  37. package/esm/cli/commands/doctor/server-checks.js +5 -4
  38. package/esm/cli/commands/init/init-command.js +4 -4
  39. package/esm/cli/commands/init/types.d.ts +2 -0
  40. package/esm/cli/commands/init/types.d.ts.map +1 -1
  41. package/esm/cli/commands/push/command.d.ts +10 -1
  42. package/esm/cli/commands/push/command.d.ts.map +1 -1
  43. package/esm/cli/commands/push/command.js +135 -14
  44. package/esm/cli/commands/skills/create.d.ts +1 -1
  45. package/esm/cli/commands/skills/create.d.ts.map +1 -1
  46. package/esm/cli/commands/skills/create.js +1 -2
  47. package/esm/cli/mcp/server.d.ts.map +1 -1
  48. package/esm/cli/mcp/server.js +33 -7
  49. package/esm/cli/mcp/tools/catalog-tools.d.ts +6 -1
  50. package/esm/cli/mcp/tools/catalog-tools.d.ts.map +1 -1
  51. package/esm/cli/mcp/tools/catalog-tools.js +9 -5
  52. package/esm/cli/mcp/tools/deploy-tool.d.ts +11 -1
  53. package/esm/cli/mcp/tools/deploy-tool.d.ts.map +1 -1
  54. package/esm/cli/mcp/tools/deploy-tool.js +55 -10
  55. package/esm/cli/shared/args.d.ts.map +1 -1
  56. package/esm/cli/shared/args.js +29 -2
  57. package/esm/cli/shared/config.d.ts +24 -0
  58. package/esm/cli/shared/config.d.ts.map +1 -1
  59. package/esm/cli/shared/config.js +62 -16
  60. package/esm/cli/shared/deployment-provenance.d.ts +47 -0
  61. package/esm/cli/shared/deployment-provenance.d.ts.map +1 -0
  62. package/esm/cli/shared/deployment-provenance.js +214 -0
  63. package/esm/cli/shared/json-output.d.ts.map +1 -1
  64. package/esm/cli/shared/json-output.js +16 -0
  65. package/esm/cli/shared/reserve-slug.d.ts +8 -1
  66. package/esm/cli/shared/reserve-slug.d.ts.map +1 -1
  67. package/esm/cli/shared/reserve-slug.js +15 -4
  68. package/esm/cli/skills/core-skills.d.ts.map +1 -1
  69. package/esm/cli/skills/core-skills.js +6 -3
  70. package/esm/cli/templates/manifest.js +3 -3
  71. package/esm/cli/utils/index.d.ts.map +1 -1
  72. package/esm/cli/utils/index.js +3 -0
  73. package/esm/deno.d.ts +3 -0
  74. package/esm/deno.js +11 -7
  75. package/esm/src/agent/react/use-agent-metadata.js +1 -1
  76. package/esm/src/agent/react/use-agent.js +1 -1
  77. package/esm/src/agent/react/use-agents.js +1 -1
  78. package/esm/src/agent/react/use-chat/types.d.ts +0 -6
  79. package/esm/src/agent/react/use-chat/types.d.ts.map +1 -1
  80. package/esm/src/agent/react/use-chat/use-chat.d.ts +5 -0
  81. package/esm/src/agent/react/use-chat/use-chat.d.ts.map +1 -1
  82. package/esm/src/agent/react/use-chat/use-chat.js +87 -34
  83. package/esm/src/agent/react/use-completion.js +1 -1
  84. package/esm/src/agent/react/use-streaming.js +1 -1
  85. package/esm/src/agent/react/use-voice-input.js +1 -1
  86. package/esm/src/build/bundler/code-splitter/splitter.d.ts +3 -0
  87. package/esm/src/build/bundler/code-splitter/splitter.d.ts.map +1 -1
  88. package/esm/src/build/bundler/code-splitter/splitter.js +21 -2
  89. package/esm/src/build/embedded/preset.d.ts +3 -2
  90. package/esm/src/build/embedded/preset.d.ts.map +1 -1
  91. package/esm/src/build/embedded/preset.js +120 -97
  92. package/esm/src/build/production-build/build/build-cleanup.d.ts.map +1 -1
  93. package/esm/src/build/production-build/build/build-cleanup.js +6 -1
  94. package/esm/src/build/production-build/build/build-orchestrator.d.ts.map +1 -1
  95. package/esm/src/build/production-build/build/build-orchestrator.js +55 -49
  96. package/esm/src/build/production-build/build/output-generator.d.ts +2 -0
  97. package/esm/src/build/production-build/build/output-generator.d.ts.map +1 -1
  98. package/esm/src/build/production-build/build/output-generator.js +2 -1
  99. package/esm/src/build/production-build/build/route-collector.d.ts +2 -1
  100. package/esm/src/build/production-build/build/route-collector.d.ts.map +1 -1
  101. package/esm/src/build/production-build/build/route-collector.js +3 -3
  102. package/esm/src/build/production-build/client-runtime.d.ts +4 -0
  103. package/esm/src/build/production-build/client-runtime.d.ts.map +1 -1
  104. package/esm/src/build/production-build/client-runtime.js +5 -8
  105. package/esm/src/build/production-build/local-release-assets.d.ts +2 -0
  106. package/esm/src/build/production-build/local-release-assets.d.ts.map +1 -1
  107. package/esm/src/build/production-build/local-release-assets.js +4 -1
  108. package/esm/src/build/production-build/manifest.d.ts.map +1 -1
  109. package/esm/src/build/production-build/manifest.js +9 -2
  110. package/esm/src/build/production-build/static-generation.d.ts.map +1 -1
  111. package/esm/src/build/production-build/static-generation.js +15 -3
  112. package/esm/src/build/production-build/templates.d.ts.map +1 -1
  113. package/esm/src/build/production-build/templates.js +1 -1
  114. package/esm/src/cache/backends/api.d.ts.map +1 -1
  115. package/esm/src/cache/backends/api.js +10 -7
  116. package/esm/src/chat/index.d.ts +8 -15
  117. package/esm/src/chat/index.d.ts.map +1 -1
  118. package/esm/src/chat/index.js +7 -16
  119. package/esm/src/config/config-files.d.ts +3 -0
  120. package/esm/src/config/config-files.d.ts.map +1 -0
  121. package/esm/src/config/config-files.js +6 -0
  122. package/esm/src/config/loader.d.ts.map +1 -1
  123. package/esm/src/config/loader.js +12 -9
  124. package/esm/src/extensions/parser/code-parser.d.ts +14 -0
  125. package/esm/src/extensions/parser/code-parser.d.ts.map +1 -1
  126. package/esm/src/extensions/parser/index.d.ts +1 -1
  127. package/esm/src/extensions/parser/index.d.ts.map +1 -1
  128. package/esm/src/html/html-injection.d.ts.map +1 -1
  129. package/esm/src/html/html-injection.js +2 -2
  130. package/esm/src/html/html-shell-generator.d.ts.map +1 -1
  131. package/esm/src/html/html-shell-generator.js +16 -9
  132. package/esm/src/html/hydration-script-builder/dev-component-manifest.d.ts.map +1 -1
  133. package/esm/src/html/hydration-script-builder/dev-component-manifest.js +2 -1
  134. package/esm/src/html/hydration-script-builder/hydration-data-generator.d.ts.map +1 -1
  135. package/esm/src/html/hydration-script-builder/hydration-data-generator.js +15 -4
  136. package/esm/src/html/hydration-script-builder/prod-hydration.d.ts.map +1 -1
  137. package/esm/src/html/hydration-script-builder/prod-hydration.js +4 -2
  138. package/esm/src/html/hydration-script-builder/templates/renderer.d.ts.map +1 -1
  139. package/esm/src/html/hydration-script-builder/templates/renderer.js +37 -7
  140. package/esm/src/html/hydration-script-builder/templates/router.d.ts.map +1 -1
  141. package/esm/src/html/hydration-script-builder/templates/router.js +22 -4
  142. package/esm/src/html/hydration-script-builder/types.d.ts +4 -0
  143. package/esm/src/html/hydration-script-builder/types.d.ts.map +1 -1
  144. package/esm/src/html/schemas/html.schema.d.ts +10 -0
  145. package/esm/src/html/schemas/html.schema.d.ts.map +1 -1
  146. package/esm/src/html/schemas/html.schema.js +5 -0
  147. package/esm/src/html/utils.d.ts.map +1 -1
  148. package/esm/src/html/utils.js +10 -10
  149. package/esm/src/modules/component-registry/registry.d.ts +1 -1
  150. package/esm/src/modules/component-registry/registry.d.ts.map +1 -1
  151. package/esm/src/modules/react-loader/component-loader.d.ts +1 -1
  152. package/esm/src/modules/react-loader/component-loader.d.ts.map +1 -1
  153. package/esm/src/modules/react-loader/extract-component.d.ts +1 -1
  154. package/esm/src/modules/react-loader/extract-component.d.ts.map +1 -1
  155. package/esm/src/modules/react-loader/ssr-module-loader/http-bundle-helpers.d.ts.map +1 -1
  156. package/esm/src/modules/react-loader/ssr-module-loader/http-bundle-helpers.js +2 -3
  157. package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts +1 -1
  158. package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts.map +1 -1
  159. package/esm/src/modules/react-loader/types.d.ts +1 -1
  160. package/esm/src/modules/react-loader/types.d.ts.map +1 -1
  161. package/esm/src/modules/server/module-batch-handler.d.ts.map +1 -1
  162. package/esm/src/modules/server/module-batch-handler.js +3 -10
  163. package/esm/src/platform/adapters/fs/veryfront/adapter.d.ts +1 -0
  164. package/esm/src/platform/adapters/fs/veryfront/adapter.d.ts.map +1 -1
  165. package/esm/src/platform/adapters/fs/veryfront/adapter.js +4 -0
  166. package/esm/src/platform/adapters/fs/veryfront/multi-project-adapter.d.ts +4 -1
  167. package/esm/src/platform/adapters/fs/veryfront/multi-project-adapter.d.ts.map +1 -1
  168. package/esm/src/platform/adapters/fs/veryfront/multi-project-adapter.js +6 -0
  169. package/esm/src/platform/adapters/fs/veryfront/read-operations.d.ts +1 -0
  170. package/esm/src/platform/adapters/fs/veryfront/read-operations.d.ts.map +1 -1
  171. package/esm/src/platform/adapters/fs/veryfront/read-operations.js +8 -0
  172. package/esm/src/platform/adapters/fs/veryfront/request-context.d.ts +4 -0
  173. package/esm/src/platform/adapters/fs/veryfront/request-context.d.ts.map +1 -1
  174. package/esm/src/platform/adapters/fs/veryfront/request-context.js +1 -0
  175. package/esm/src/platform/adapters/mock.d.ts.map +1 -1
  176. package/esm/src/platform/adapters/mock.js +3 -2
  177. package/esm/src/platform/adapters/veryfront-api-client/client.d.ts +4 -1
  178. package/esm/src/platform/adapters/veryfront-api-client/client.d.ts.map +1 -1
  179. package/esm/src/platform/adapters/veryfront-api-client/client.js +8 -4
  180. package/esm/src/platform/adapters/veryfront-api-client/operations.d.ts +7 -3
  181. package/esm/src/platform/adapters/veryfront-api-client/operations.d.ts.map +1 -1
  182. package/esm/src/platform/adapters/veryfront-api-client/operations.js +6 -6
  183. package/esm/src/platform/adapters/veryfront-api-client/retry-handler.d.ts +2 -0
  184. package/esm/src/platform/adapters/veryfront-api-client/retry-handler.d.ts.map +1 -1
  185. package/esm/src/platform/adapters/veryfront-api-client/retry-handler.js +4 -1
  186. package/esm/src/platform/compat/framework-source-resolver.d.ts +7 -1
  187. package/esm/src/platform/compat/framework-source-resolver.d.ts.map +1 -1
  188. package/esm/src/platform/compat/framework-source-resolver.js +32 -13
  189. package/esm/src/platform/compat/fs.d.ts +4 -0
  190. package/esm/src/platform/compat/fs.d.ts.map +1 -1
  191. package/esm/src/platform/compat/fs.js +34 -2
  192. package/esm/src/platform/compat/http/request-adapter.js +18 -1
  193. package/esm/src/platform/compat/path/runtime.d.ts.map +1 -1
  194. package/esm/src/platform/compat/path/runtime.js +1 -1
  195. package/esm/src/platform/compat/process/command.d.ts +2 -0
  196. package/esm/src/platform/compat/process/command.d.ts.map +1 -1
  197. package/esm/src/platform/compat/process/command.js +4 -3
  198. package/esm/src/platform/compat/runtime.d.ts +1 -1
  199. package/esm/src/platform/compat/runtime.d.ts.map +1 -1
  200. package/esm/src/platform/compat/runtime.js +5 -2
  201. package/esm/src/platform/index.d.ts +1 -1
  202. package/esm/src/platform/index.d.ts.map +1 -1
  203. package/esm/src/platform/index.js +1 -1
  204. package/esm/src/proxy/local-project-resolver.d.ts.map +1 -1
  205. package/esm/src/proxy/local-project-resolver.js +4 -2
  206. package/esm/src/proxy/main.js +17 -15
  207. package/esm/src/proxy/retry.d.ts +18 -0
  208. package/esm/src/proxy/retry.d.ts.map +1 -1
  209. package/esm/src/proxy/retry.js +89 -0
  210. package/esm/src/proxy/websocket-bridge.d.ts +10 -0
  211. package/esm/src/proxy/websocket-bridge.d.ts.map +1 -1
  212. package/esm/src/proxy/websocket-bridge.js +4 -0
  213. package/esm/src/react/compat/hooks-adapter.d.ts +1 -1
  214. package/esm/src/react/compat/hooks-adapter.d.ts.map +1 -1
  215. package/esm/src/react/compat/hooks-adapter.js +1 -1
  216. package/esm/src/react/compat/ssr-adapter/response-builder.d.ts +1 -1
  217. package/esm/src/react/compat/ssr-adapter/response-builder.d.ts.map +1 -1
  218. package/esm/src/react/compat/ssr-adapter/response-builder.js +1 -1
  219. package/esm/src/react/compat/ssr-adapter/server-loader.d.ts +10 -7
  220. package/esm/src/react/compat/ssr-adapter/server-loader.d.ts.map +1 -1
  221. package/esm/src/react/compat/ssr-adapter/server-loader.js +49 -32
  222. package/esm/src/react/compat/ssr-adapter/stream-renderer.d.ts +1 -1
  223. package/esm/src/react/compat/ssr-adapter/stream-renderer.d.ts.map +1 -1
  224. package/esm/src/react/compat/ssr-adapter/stream-renderer.js +5 -5
  225. package/esm/src/react/compat/ssr-adapter/string-renderer.d.ts +1 -1
  226. package/esm/src/react/compat/ssr-adapter/string-renderer.d.ts.map +1 -1
  227. package/esm/src/react/compat/ssr-adapter/string-renderer.js +2 -2
  228. package/esm/src/react/compat/ssr-adapter/types.d.ts +2 -0
  229. package/esm/src/react/compat/ssr-adapter/types.d.ts.map +1 -1
  230. package/esm/src/react/compat/version-detector/feature-detector.js +1 -1
  231. package/esm/src/react/components/AppWrapper.d.ts +1 -1
  232. package/esm/src/react/components/AppWrapper.d.ts.map +1 -1
  233. package/esm/src/react/components/AppWrapper.js +1 -1
  234. package/esm/src/react/components/LayoutComponent.d.ts +1 -1
  235. package/esm/src/react/components/LayoutComponent.d.ts.map +1 -1
  236. package/esm/src/react/components/LayoutComponent.js +1 -1
  237. package/esm/src/react/components/MDXProvider.d.ts +1 -1
  238. package/esm/src/react/components/MDXProvider.d.ts.map +1 -1
  239. package/esm/src/react/components/MDXProvider.js +1 -1
  240. package/esm/src/react/components/ProviderComponent.d.ts +1 -1
  241. package/esm/src/react/components/ProviderComponent.d.ts.map +1 -1
  242. package/esm/src/react/components/ProviderComponent.js +1 -1
  243. package/esm/src/react/components/chat/agent-card.d.ts +15 -7
  244. package/esm/src/react/components/chat/agent-card.d.ts.map +1 -1
  245. package/esm/src/react/components/chat/agent-card.js +9 -10
  246. package/esm/src/react/components/chat/agent-picker-actions.d.ts +20 -0
  247. package/esm/src/react/components/chat/agent-picker-actions.d.ts.map +1 -0
  248. package/esm/src/react/components/chat/agent-picker-actions.js +24 -0
  249. package/esm/src/react/components/chat/agent-picker-context.d.ts +19 -0
  250. package/esm/src/react/components/chat/agent-picker-context.d.ts.map +1 -0
  251. package/esm/src/react/components/chat/agent-picker-context.js +13 -0
  252. package/esm/src/react/components/chat/agent-picker.d.ts +35 -42
  253. package/esm/src/react/components/chat/agent-picker.d.ts.map +1 -1
  254. package/esm/src/react/components/chat/agent-picker.js +59 -50
  255. package/esm/src/react/components/chat/chat/app-mode-chat.d.ts +14 -0
  256. package/esm/src/react/components/chat/chat/app-mode-chat.d.ts.map +1 -0
  257. package/esm/src/react/components/chat/chat/app-mode-chat.js +137 -0
  258. package/esm/src/react/components/chat/chat/chat-attachments.d.ts +7 -0
  259. package/esm/src/react/components/chat/chat/chat-attachments.d.ts.map +1 -0
  260. package/esm/src/react/components/chat/chat/chat-attachments.js +16 -0
  261. package/esm/src/react/components/chat/chat/chat-component.d.ts +21 -0
  262. package/esm/src/react/components/chat/chat/chat-component.d.ts.map +1 -0
  263. package/esm/src/react/components/chat/chat/chat-component.js +1 -0
  264. package/esm/src/react/components/chat/chat/chat-props.d.ts +114 -0
  265. package/esm/src/react/components/chat/chat/chat-props.d.ts.map +1 -0
  266. package/esm/src/react/components/chat/chat/chat-props.js +1 -0
  267. package/esm/src/react/components/chat/chat/components/animations.d.ts +1 -1
  268. package/esm/src/react/components/chat/chat/components/animations.d.ts.map +1 -1
  269. package/esm/src/react/components/chat/chat/components/animations.js +1 -1
  270. package/esm/src/react/components/chat/chat/components/attachment-pill.d.ts +18 -18
  271. package/esm/src/react/components/chat/chat/components/attachment-pill.d.ts.map +1 -1
  272. package/esm/src/react/components/chat/chat/components/attachment-pill.js +11 -15
  273. package/esm/src/react/components/chat/chat/components/attachments-panel.d.ts +14 -3
  274. package/esm/src/react/components/chat/chat/components/attachments-panel.d.ts.map +1 -1
  275. package/esm/src/react/components/chat/chat/components/attachments-panel.js +3 -3
  276. package/esm/src/react/components/chat/chat/components/branch-picker.d.ts +44 -14
  277. package/esm/src/react/components/chat/chat/components/branch-picker.d.ts.map +1 -1
  278. package/esm/src/react/components/chat/chat/components/branch-picker.js +55 -12
  279. package/esm/src/react/components/chat/chat/components/chat-messages-skeleton.d.ts +1 -1
  280. package/esm/src/react/components/chat/chat/components/chat-messages-skeleton.d.ts.map +1 -1
  281. package/esm/src/react/components/chat/chat/components/chat-messages-skeleton.js +1 -1
  282. package/esm/src/react/components/chat/chat/components/code-block.d.ts +7 -2
  283. package/esm/src/react/components/chat/chat/components/code-block.d.ts.map +1 -1
  284. package/esm/src/react/components/chat/chat/components/code-block.js +3 -3
  285. package/esm/src/react/components/chat/chat/components/drop-zone.d.ts +1 -1
  286. package/esm/src/react/components/chat/chat/components/drop-zone.d.ts.map +1 -1
  287. package/esm/src/react/components/chat/chat/components/drop-zone.js +1 -1
  288. package/esm/src/react/components/chat/chat/components/empty-state.d.ts +1 -1
  289. package/esm/src/react/components/chat/chat/components/empty-state.d.ts.map +1 -1
  290. package/esm/src/react/components/chat/chat/components/empty-state.js +1 -1
  291. package/esm/src/react/components/chat/chat/components/inference-badge.d.ts +1 -1
  292. package/esm/src/react/components/chat/chat/components/inference-badge.d.ts.map +1 -1
  293. package/esm/src/react/components/chat/chat/components/inference-badge.js +1 -1
  294. package/esm/src/react/components/chat/chat/components/inline-citation.d.ts +33 -10
  295. package/esm/src/react/components/chat/chat/components/inline-citation.d.ts.map +1 -1
  296. package/esm/src/react/components/chat/chat/components/inline-citation.js +145 -51
  297. package/esm/src/react/components/chat/chat/components/message-actions.d.ts +49 -20
  298. package/esm/src/react/components/chat/chat/components/message-actions.d.ts.map +1 -1
  299. package/esm/src/react/components/chat/chat/components/message-actions.js +72 -18
  300. package/esm/src/react/components/chat/chat/components/message-edit-form.d.ts +1 -1
  301. package/esm/src/react/components/chat/chat/components/message-edit-form.d.ts.map +1 -1
  302. package/esm/src/react/components/chat/chat/components/message-edit-form.js +1 -1
  303. package/esm/src/react/components/chat/chat/components/message-feedback.d.ts +34 -14
  304. package/esm/src/react/components/chat/chat/components/message-feedback.d.ts.map +1 -1
  305. package/esm/src/react/components/chat/chat/components/message-feedback.js +54 -15
  306. package/esm/src/react/components/chat/chat/components/quick-actions.d.ts +1 -1
  307. package/esm/src/react/components/chat/chat/components/quick-actions.d.ts.map +1 -1
  308. package/esm/src/react/components/chat/chat/components/quick-actions.js +1 -1
  309. package/esm/src/react/components/chat/chat/components/reasoning.d.ts +14 -6
  310. package/esm/src/react/components/chat/chat/components/reasoning.d.ts.map +1 -1
  311. package/esm/src/react/components/chat/chat/components/reasoning.js +3 -5
  312. package/esm/src/react/components/chat/chat/components/sidebar.d.ts +70 -16
  313. package/esm/src/react/components/chat/chat/components/sidebar.d.ts.map +1 -1
  314. package/esm/src/react/components/chat/chat/components/sidebar.js +72 -23
  315. package/esm/src/react/components/chat/chat/components/skill-badge.d.ts +1 -1
  316. package/esm/src/react/components/chat/chat/components/skill-badge.d.ts.map +1 -1
  317. package/esm/src/react/components/chat/chat/components/skill-badge.js +1 -1
  318. package/esm/src/react/components/chat/chat/components/skill-tool.d.ts +1 -1
  319. package/esm/src/react/components/chat/chat/components/skill-tool.d.ts.map +1 -1
  320. package/esm/src/react/components/chat/chat/components/skill-tool.js +1 -1
  321. package/esm/src/react/components/chat/chat/components/sources.d.ts +25 -15
  322. package/esm/src/react/components/chat/chat/components/sources.d.ts.map +1 -1
  323. package/esm/src/react/components/chat/chat/components/sources.js +7 -7
  324. package/esm/src/react/components/chat/chat/components/step-indicator.d.ts +14 -3
  325. package/esm/src/react/components/chat/chat/components/step-indicator.d.ts.map +1 -1
  326. package/esm/src/react/components/chat/chat/components/step-indicator.js +3 -3
  327. package/esm/src/react/components/chat/chat/components/tab-switcher.d.ts +1 -1
  328. package/esm/src/react/components/chat/chat/components/tab-switcher.d.ts.map +1 -1
  329. package/esm/src/react/components/chat/chat/components/tab-switcher.js +1 -1
  330. package/esm/src/react/components/chat/chat/components/tool-ui.d.ts +16 -9
  331. package/esm/src/react/components/chat/chat/components/tool-ui.d.ts.map +1 -1
  332. package/esm/src/react/components/chat/chat/components/tool-ui.js +10 -14
  333. package/esm/src/react/components/chat/chat/composition/agent-avatar.d.ts +1 -1
  334. package/esm/src/react/components/chat/chat/composition/agent-avatar.d.ts.map +1 -1
  335. package/esm/src/react/components/chat/chat/composition/agent-avatar.js +1 -1
  336. package/esm/src/react/components/chat/chat/composition/api.d.ts +3 -3
  337. package/esm/src/react/components/chat/chat/composition/api.d.ts.map +1 -1
  338. package/esm/src/react/components/chat/chat/composition/api.js +2 -2
  339. package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts +72 -29
  340. package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts.map +1 -1
  341. package/esm/src/react/components/chat/chat/composition/chat-composer.js +92 -82
  342. package/esm/src/react/components/chat/chat/composition/chat-empty-state.d.ts +1 -1
  343. package/esm/src/react/components/chat/chat/composition/chat-empty-state.d.ts.map +1 -1
  344. package/esm/src/react/components/chat/chat/composition/chat-empty-state.js +1 -1
  345. package/esm/src/react/components/chat/chat/composition/chat-empty.d.ts +7 -2
  346. package/esm/src/react/components/chat/chat/composition/chat-empty.d.ts.map +1 -1
  347. package/esm/src/react/components/chat/chat/composition/chat-empty.js +3 -3
  348. package/esm/src/react/components/chat/chat/composition/chat-if.d.ts +1 -1
  349. package/esm/src/react/components/chat/chat/composition/chat-if.d.ts.map +1 -1
  350. package/esm/src/react/components/chat/chat/composition/chat-message-list.d.ts +25 -11
  351. package/esm/src/react/components/chat/chat/composition/chat-message-list.d.ts.map +1 -1
  352. package/esm/src/react/components/chat/chat/composition/chat-message-list.js +67 -29
  353. package/esm/src/react/components/chat/chat/composition/chat-root.d.ts +7 -3
  354. package/esm/src/react/components/chat/chat/composition/chat-root.d.ts.map +1 -1
  355. package/esm/src/react/components/chat/chat/composition/chat-root.js +3 -5
  356. package/esm/src/react/components/chat/chat/composition/error-banner.d.ts +7 -2
  357. package/esm/src/react/components/chat/chat/composition/error-banner.d.ts.map +1 -1
  358. package/esm/src/react/components/chat/chat/composition/error-banner.js +3 -3
  359. package/esm/src/react/components/chat/chat/composition/message.d.ts +85 -34
  360. package/esm/src/react/components/chat/chat/composition/message.d.ts.map +1 -1
  361. package/esm/src/react/components/chat/chat/composition/message.js +146 -122
  362. package/esm/src/react/components/chat/chat/composition/model-avatar.d.ts +1 -1
  363. package/esm/src/react/components/chat/chat/composition/model-avatar.d.ts.map +1 -1
  364. package/esm/src/react/components/chat/chat/composition/model-avatar.js +1 -1
  365. package/esm/src/react/components/chat/chat/composition/pending-message.d.ts +1 -1
  366. package/esm/src/react/components/chat/chat/composition/pending-message.d.ts.map +1 -1
  367. package/esm/src/react/components/chat/chat/composition/pending-message.js +1 -1
  368. package/esm/src/react/components/chat/chat/contexts/chat-context.d.ts +2 -3
  369. package/esm/src/react/components/chat/chat/contexts/chat-context.d.ts.map +1 -1
  370. package/esm/src/react/components/chat/chat/contexts/chat-context.js +1 -1
  371. package/esm/src/react/components/chat/chat/contexts/composer-context.d.ts +2 -2
  372. package/esm/src/react/components/chat/chat/contexts/composer-context.d.ts.map +1 -1
  373. package/esm/src/react/components/chat/chat/contexts/composer-context.js +1 -1
  374. package/esm/src/react/components/chat/chat/contexts/conversations-context.d.ts +2 -2
  375. package/esm/src/react/components/chat/chat/contexts/conversations-context.d.ts.map +1 -1
  376. package/esm/src/react/components/chat/chat/contexts/conversations-context.js +1 -1
  377. package/esm/src/react/components/chat/chat/contexts/index.d.ts +1 -1
  378. package/esm/src/react/components/chat/chat/contexts/index.d.ts.map +1 -1
  379. package/esm/src/react/components/chat/chat/contexts/index.js +1 -1
  380. package/esm/src/react/components/chat/chat/contexts/message-context.d.ts +15 -2
  381. package/esm/src/react/components/chat/chat/contexts/message-context.d.ts.map +1 -1
  382. package/esm/src/react/components/chat/chat/contexts/message-context.js +11 -1
  383. package/esm/src/react/components/chat/chat/controlled-chat.d.ts +15 -0
  384. package/esm/src/react/components/chat/chat/controlled-chat.d.ts.map +1 -0
  385. package/esm/src/react/components/chat/chat/controlled-chat.js +97 -0
  386. package/esm/src/react/components/chat/chat/hooks/use-clipboard.js +1 -1
  387. package/esm/src/react/components/chat/chat/hooks/use-conversation-chat.d.ts +54 -0
  388. package/esm/src/react/components/chat/chat/hooks/use-conversation-chat.d.ts.map +1 -0
  389. package/esm/src/react/components/chat/chat/hooks/use-conversation-chat.js +179 -0
  390. package/esm/src/react/components/chat/chat/hooks/use-conversation.js +1 -1
  391. package/esm/src/react/components/chat/chat/hooks/use-conversations.d.ts.map +1 -1
  392. package/esm/src/react/components/chat/chat/hooks/use-conversations.js +3 -6
  393. package/esm/src/react/components/chat/chat/hooks/use-drop-zone.d.ts +8 -5
  394. package/esm/src/react/components/chat/chat/hooks/use-drop-zone.d.ts.map +1 -1
  395. package/esm/src/react/components/chat/chat/hooks/use-drop-zone.js +6 -6
  396. package/esm/src/react/components/chat/chat/hooks/use-stick-to-bottom.d.ts +1 -1
  397. package/esm/src/react/components/chat/chat/hooks/use-stick-to-bottom.d.ts.map +1 -1
  398. package/esm/src/react/components/chat/chat/hooks/use-stick-to-bottom.js +1 -1
  399. package/esm/src/react/components/chat/chat/hooks/use-upload.js +1 -1
  400. package/esm/src/react/components/chat/chat/hooks/use-uploads-registry.js +1 -1
  401. package/esm/src/react/components/chat/chat/index.d.ts +13 -230
  402. package/esm/src/react/components/chat/chat/index.d.ts.map +1 -1
  403. package/esm/src/react/components/chat/chat/index.js +27 -383
  404. package/esm/src/react/components/chat/chat-actions.d.ts +1 -1
  405. package/esm/src/react/components/chat/chat-actions.d.ts.map +1 -1
  406. package/esm/src/react/components/chat/chat-actions.js +1 -1
  407. package/esm/src/react/components/chat/chat-agent-picker.d.ts +1 -1
  408. package/esm/src/react/components/chat/chat-agent-picker.d.ts.map +1 -1
  409. package/esm/src/react/components/chat/chat-agent-picker.js +1 -1
  410. package/esm/src/react/components/chat/chat-theme-scope.d.ts +1 -1
  411. package/esm/src/react/components/chat/chat-theme-scope.d.ts.map +1 -1
  412. package/esm/src/react/components/chat/chat-theme-scope.js +1 -1
  413. package/esm/src/react/components/chat/chat.d.ts +6 -6
  414. package/esm/src/react/components/chat/chat.d.ts.map +1 -1
  415. package/esm/src/react/components/chat/chat.js +4 -4
  416. package/esm/src/react/components/chat/error-boundary.d.ts +1 -1
  417. package/esm/src/react/components/chat/error-boundary.d.ts.map +1 -1
  418. package/esm/src/react/components/chat/error-boundary.js +1 -1
  419. package/esm/src/react/components/chat/markdown.d.ts +3 -4
  420. package/esm/src/react/components/chat/markdown.d.ts.map +1 -1
  421. package/esm/src/react/components/chat/markdown.js +8 -74
  422. package/esm/src/react/components/chat/model-selector.d.ts +21 -27
  423. package/esm/src/react/components/chat/model-selector.d.ts.map +1 -1
  424. package/esm/src/react/components/chat/model-selector.js +26 -31
  425. package/esm/src/react/components/optimized-image/OptimizedBackgroundImage.d.ts +1 -1
  426. package/esm/src/react/components/optimized-image/OptimizedBackgroundImage.d.ts.map +1 -1
  427. package/esm/src/react/components/optimized-image/OptimizedBackgroundImage.js +1 -1
  428. package/esm/src/react/components/optimized-image/OptimizedImage.d.ts +1 -1
  429. package/esm/src/react/components/optimized-image/OptimizedImage.d.ts.map +1 -1
  430. package/esm/src/react/components/optimized-image/OptimizedImage.js +1 -1
  431. package/esm/src/react/components/optimized-image/SimpleOptimizedImage.d.ts +1 -1
  432. package/esm/src/react/components/optimized-image/SimpleOptimizedImage.d.ts.map +1 -1
  433. package/esm/src/react/components/optimized-image/utils.d.ts +1 -1
  434. package/esm/src/react/components/optimized-image/utils.d.ts.map +1 -1
  435. package/esm/src/react/components/optimized-image/utils.js +1 -1
  436. package/esm/src/react/components/ui/alert.d.ts +1 -1
  437. package/esm/src/react/components/ui/alert.d.ts.map +1 -1
  438. package/esm/src/react/components/ui/alert.js +1 -1
  439. package/esm/src/react/components/ui/app-shell.d.ts +1 -1
  440. package/esm/src/react/components/ui/app-shell.d.ts.map +1 -1
  441. package/esm/src/react/components/ui/app-shell.js +1 -1
  442. package/esm/src/react/components/ui/avatar.d.ts +1 -1
  443. package/esm/src/react/components/ui/avatar.d.ts.map +1 -1
  444. package/esm/src/react/components/ui/avatar.js +1 -1
  445. package/esm/src/react/components/ui/badge.d.ts +1 -1
  446. package/esm/src/react/components/ui/badge.d.ts.map +1 -1
  447. package/esm/src/react/components/ui/badge.js +1 -1
  448. package/esm/src/react/components/ui/button.d.ts +1 -1
  449. package/esm/src/react/components/ui/button.d.ts.map +1 -1
  450. package/esm/src/react/components/ui/button.js +1 -1
  451. package/esm/src/react/components/ui/card.d.ts +1 -1
  452. package/esm/src/react/components/ui/card.d.ts.map +1 -1
  453. package/esm/src/react/components/ui/card.js +1 -1
  454. package/esm/src/react/components/ui/checkbox.d.ts +1 -1
  455. package/esm/src/react/components/ui/checkbox.d.ts.map +1 -1
  456. package/esm/src/react/components/ui/checkbox.js +1 -1
  457. package/esm/src/react/components/ui/code-block.d.ts +1 -1
  458. package/esm/src/react/components/ui/code-block.d.ts.map +1 -1
  459. package/esm/src/react/components/ui/code-block.js +1 -1
  460. package/esm/src/react/components/ui/collapsible.d.ts +1 -1
  461. package/esm/src/react/components/ui/collapsible.d.ts.map +1 -1
  462. package/esm/src/react/components/ui/collapsible.js +1 -1
  463. package/esm/src/react/components/ui/color-mode.d.ts +2 -2
  464. package/esm/src/react/components/ui/color-mode.d.ts.map +1 -1
  465. package/esm/src/react/components/ui/color-mode.js +1 -1
  466. package/esm/src/react/components/ui/command.d.ts +1 -1
  467. package/esm/src/react/components/ui/command.d.ts.map +1 -1
  468. package/esm/src/react/components/ui/command.js +1 -1
  469. package/esm/src/react/components/ui/dialog.d.ts +1 -1
  470. package/esm/src/react/components/ui/dialog.d.ts.map +1 -1
  471. package/esm/src/react/components/ui/dialog.js +1 -1
  472. package/esm/src/react/components/ui/drawer.d.ts +1 -1
  473. package/esm/src/react/components/ui/drawer.d.ts.map +1 -1
  474. package/esm/src/react/components/ui/drawer.js +1 -1
  475. package/esm/src/react/components/ui/dropdown-menu.d.ts +1 -1
  476. package/esm/src/react/components/ui/dropdown-menu.d.ts.map +1 -1
  477. package/esm/src/react/components/ui/dropdown-menu.js +1 -1
  478. package/esm/src/react/components/ui/file-type.d.ts +1 -1
  479. package/esm/src/react/components/ui/file-type.d.ts.map +1 -1
  480. package/esm/src/react/components/ui/file-type.js +1 -1
  481. package/esm/src/react/components/ui/floating.d.ts +1 -1
  482. package/esm/src/react/components/ui/floating.d.ts.map +1 -1
  483. package/esm/src/react/components/ui/floating.js +2 -2
  484. package/esm/src/react/components/ui/icon-button.d.ts +1 -1
  485. package/esm/src/react/components/ui/icon-button.d.ts.map +1 -1
  486. package/esm/src/react/components/ui/icon-button.js +1 -1
  487. package/esm/src/react/components/ui/icons/index.d.ts +1 -1
  488. package/esm/src/react/components/ui/icons/index.d.ts.map +1 -1
  489. package/esm/src/react/components/ui/icons/index.js +1 -1
  490. package/esm/src/react/components/ui/input.d.ts +1 -1
  491. package/esm/src/react/components/ui/input.d.ts.map +1 -1
  492. package/esm/src/react/components/ui/input.js +1 -1
  493. package/esm/src/react/components/ui/label.d.ts +1 -1
  494. package/esm/src/react/components/ui/label.d.ts.map +1 -1
  495. package/esm/src/react/components/ui/label.js +1 -1
  496. package/esm/src/react/components/ui/list.d.ts +1 -1
  497. package/esm/src/react/components/ui/list.d.ts.map +1 -1
  498. package/esm/src/react/components/ui/list.js +1 -1
  499. package/esm/src/react/components/ui/pill.d.ts +1 -1
  500. package/esm/src/react/components/ui/pill.d.ts.map +1 -1
  501. package/esm/src/react/components/ui/pill.js +1 -1
  502. package/esm/src/react/components/ui/popover.d.ts +1 -1
  503. package/esm/src/react/components/ui/popover.d.ts.map +1 -1
  504. package/esm/src/react/components/ui/popover.js +1 -1
  505. package/esm/src/react/components/ui/progress-bar.d.ts +1 -1
  506. package/esm/src/react/components/ui/progress-bar.d.ts.map +1 -1
  507. package/esm/src/react/components/ui/progress-bar.js +1 -1
  508. package/esm/src/react/components/ui/radio.d.ts +1 -1
  509. package/esm/src/react/components/ui/radio.d.ts.map +1 -1
  510. package/esm/src/react/components/ui/radio.js +1 -1
  511. package/esm/src/react/components/ui/scroll-fade.d.ts +1 -1
  512. package/esm/src/react/components/ui/scroll-fade.d.ts.map +1 -1
  513. package/esm/src/react/components/ui/scroll-fade.js +1 -1
  514. package/esm/src/react/components/ui/select.d.ts +1 -1
  515. package/esm/src/react/components/ui/select.d.ts.map +1 -1
  516. package/esm/src/react/components/ui/select.js +1 -1
  517. package/esm/src/react/components/ui/shimmer.d.ts +1 -1
  518. package/esm/src/react/components/ui/shimmer.d.ts.map +1 -1
  519. package/esm/src/react/components/ui/shimmer.js +1 -1
  520. package/esm/src/react/components/ui/skeleton.d.ts +1 -1
  521. package/esm/src/react/components/ui/skeleton.d.ts.map +1 -1
  522. package/esm/src/react/components/ui/skeleton.js +1 -1
  523. package/esm/src/react/components/ui/slot.d.ts +1 -1
  524. package/esm/src/react/components/ui/slot.d.ts.map +1 -1
  525. package/esm/src/react/components/ui/slot.js +1 -1
  526. package/esm/src/react/components/ui/status.d.ts +1 -1
  527. package/esm/src/react/components/ui/status.d.ts.map +1 -1
  528. package/esm/src/react/components/ui/status.js +1 -1
  529. package/esm/src/react/components/ui/switch.d.ts +1 -1
  530. package/esm/src/react/components/ui/switch.d.ts.map +1 -1
  531. package/esm/src/react/components/ui/switch.js +1 -1
  532. package/esm/src/react/components/ui/tabs.d.ts +3 -3
  533. package/esm/src/react/components/ui/tabs.d.ts.map +1 -1
  534. package/esm/src/react/components/ui/tabs.js +1 -1
  535. package/esm/src/react/components/ui/tag.d.ts +1 -1
  536. package/esm/src/react/components/ui/tag.d.ts.map +1 -1
  537. package/esm/src/react/components/ui/tag.js +1 -1
  538. package/esm/src/react/components/ui/textarea.d.ts +1 -1
  539. package/esm/src/react/components/ui/textarea.d.ts.map +1 -1
  540. package/esm/src/react/components/ui/textarea.js +1 -1
  541. package/esm/src/react/components/ui/tokens.d.ts +1 -1
  542. package/esm/src/react/components/ui/tokens.d.ts.map +1 -1
  543. package/esm/src/react/components/ui/tokens.js +1 -1
  544. package/esm/src/react/components/ui/tooltip.d.ts +1 -1
  545. package/esm/src/react/components/ui/tooltip.d.ts.map +1 -1
  546. package/esm/src/react/components/ui/tooltip.js +2 -2
  547. package/esm/src/react/fonts/index.d.ts +1 -1
  548. package/esm/src/react/fonts/index.d.ts.map +1 -1
  549. package/esm/src/react/fonts/index.js +1 -1
  550. package/esm/src/react/primitives/agent-primitives.d.ts +4 -4
  551. package/esm/src/react/primitives/agent-primitives.d.ts.map +1 -1
  552. package/esm/src/react/primitives/agent-primitives.js +1 -1
  553. package/esm/src/react/primitives/chat-container.d.ts +2 -2
  554. package/esm/src/react/primitives/chat-container.d.ts.map +1 -1
  555. package/esm/src/react/primitives/chat-container.js +1 -1
  556. package/esm/src/react/primitives/input-box.d.ts +4 -4
  557. package/esm/src/react/primitives/input-box.d.ts.map +1 -1
  558. package/esm/src/react/primitives/input-box.js +1 -1
  559. package/esm/src/react/primitives/message-list.d.ts +5 -5
  560. package/esm/src/react/primitives/message-list.d.ts.map +1 -1
  561. package/esm/src/react/primitives/message-list.js +1 -1
  562. package/esm/src/react/primitives/tool-primitives.d.ts +4 -4
  563. package/esm/src/react/primitives/tool-primitives.d.ts.map +1 -1
  564. package/esm/src/react/primitives/tool-primitives.js +1 -1
  565. package/esm/src/react/runtime/core.d.ts +1 -1
  566. package/esm/src/react/runtime/core.d.ts.map +1 -1
  567. package/esm/src/react/runtime/core.js +1 -1
  568. package/esm/src/rendering/app-reserved.d.ts +2 -2
  569. package/esm/src/rendering/app-reserved.d.ts.map +1 -1
  570. package/esm/src/rendering/app-reserved.js +3 -2
  571. package/esm/src/rendering/component-handling.d.ts +1 -1
  572. package/esm/src/rendering/component-handling.d.ts.map +1 -1
  573. package/esm/src/rendering/component-handling.js +1 -1
  574. package/esm/src/rendering/context/render-context.d.ts +2 -0
  575. package/esm/src/rendering/context/render-context.d.ts.map +1 -1
  576. package/esm/src/rendering/context/render-context.js +2 -0
  577. package/esm/src/rendering/element-validator/element-normalizer.d.ts +1 -1
  578. package/esm/src/rendering/element-validator/element-normalizer.d.ts.map +1 -1
  579. package/esm/src/rendering/element-validator/element-normalizer.js +1 -1
  580. package/esm/src/rendering/element-validator/primitive-checks.d.ts +1 -1
  581. package/esm/src/rendering/element-validator/primitive-checks.d.ts.map +1 -1
  582. package/esm/src/rendering/element-validator/primitive-checks.js +1 -1
  583. package/esm/src/rendering/element-validator/validator-core.d.ts +1 -1
  584. package/esm/src/rendering/element-validator/validator-core.d.ts.map +1 -1
  585. package/esm/src/rendering/factories/service-factories.js +1 -1
  586. package/esm/src/rendering/layouts/layout-applicator.d.ts +8 -2
  587. package/esm/src/rendering/layouts/layout-applicator.d.ts.map +1 -1
  588. package/esm/src/rendering/layouts/layout-applicator.js +39 -11
  589. package/esm/src/rendering/layouts/layout-collector.d.ts +1 -0
  590. package/esm/src/rendering/layouts/layout-collector.d.ts.map +1 -1
  591. package/esm/src/rendering/layouts/layout-collector.js +7 -1
  592. package/esm/src/rendering/layouts/utils/applicator.d.ts +3 -3
  593. package/esm/src/rendering/layouts/utils/applicator.d.ts.map +1 -1
  594. package/esm/src/rendering/layouts/utils/applicator.js +7 -7
  595. package/esm/src/rendering/layouts/utils/component-loader.d.ts +7 -7
  596. package/esm/src/rendering/layouts/utils/component-loader.d.ts.map +1 -1
  597. package/esm/src/rendering/layouts/utils/component-loader.js +21 -14
  598. package/esm/src/rendering/layouts/utils/ensure-valid-child.d.ts +1 -1
  599. package/esm/src/rendering/layouts/utils/ensure-valid-child.d.ts.map +1 -1
  600. package/esm/src/rendering/orchestrator/html-types.d.ts +2 -0
  601. package/esm/src/rendering/orchestrator/html-types.d.ts.map +1 -1
  602. package/esm/src/rendering/orchestrator/html.d.ts.map +1 -1
  603. package/esm/src/rendering/orchestrator/html.js +16 -5
  604. package/esm/src/rendering/orchestrator/layout.d.ts +6 -2
  605. package/esm/src/rendering/orchestrator/layout.d.ts.map +1 -1
  606. package/esm/src/rendering/orchestrator/layout.js +16 -4
  607. package/esm/src/rendering/orchestrator/lifecycle.js +1 -1
  608. package/esm/src/rendering/orchestrator/module-loader/index.d.ts.map +1 -1
  609. package/esm/src/rendering/orchestrator/module-loader/index.js +2 -2
  610. package/esm/src/rendering/orchestrator/module-loader/module-cache-lookup.d.ts +1 -1
  611. package/esm/src/rendering/orchestrator/module-loader/module-cache-lookup.d.ts.map +1 -1
  612. package/esm/src/rendering/orchestrator/module-loader/module-cache-lookup.js +9 -2
  613. package/esm/src/rendering/orchestrator/module-loader/module-transform-cache.d.ts.map +1 -1
  614. package/esm/src/rendering/orchestrator/module-loader/module-transform-cache.js +9 -2
  615. package/esm/src/rendering/orchestrator/pipeline-helpers.d.ts +1 -1
  616. package/esm/src/rendering/orchestrator/pipeline-helpers.d.ts.map +1 -1
  617. package/esm/src/rendering/orchestrator/pipeline-helpers.js +3 -2
  618. package/esm/src/rendering/orchestrator/pipeline.d.ts +21 -0
  619. package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
  620. package/esm/src/rendering/orchestrator/pipeline.js +88 -22
  621. package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts +1 -1
  622. package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts.map +1 -1
  623. package/esm/src/rendering/orchestrator/ssr.d.ts +1 -0
  624. package/esm/src/rendering/orchestrator/ssr.d.ts.map +1 -1
  625. package/esm/src/rendering/orchestrator/ssr.js +8 -0
  626. package/esm/src/rendering/orchestrator/types.d.ts +13 -0
  627. package/esm/src/rendering/orchestrator/types.d.ts.map +1 -1
  628. package/esm/src/rendering/page-renderer.d.ts +3 -1
  629. package/esm/src/rendering/page-renderer.d.ts.map +1 -1
  630. package/esm/src/rendering/page-renderer.js +13 -1
  631. package/esm/src/rendering/page-rendering.d.ts +3 -1
  632. package/esm/src/rendering/page-rendering.d.ts.map +1 -1
  633. package/esm/src/rendering/page-rendering.js +2 -2
  634. package/esm/src/rendering/page-resolution/page-resolver.d.ts.map +1 -1
  635. package/esm/src/rendering/page-resolution/page-resolver.js +4 -3
  636. package/esm/src/rendering/renderer.d.ts.map +1 -1
  637. package/esm/src/rendering/renderer.js +6 -0
  638. package/esm/src/rendering/rsc/client-boot.ts +5 -1
  639. package/esm/src/rendering/rsc/client-boundary-payload.d.ts +10 -0
  640. package/esm/src/rendering/rsc/client-boundary-payload.d.ts.map +1 -0
  641. package/esm/src/rendering/rsc/client-boundary-payload.js +71 -0
  642. package/esm/src/rendering/rsc/client-module-strategy.d.ts +5 -1
  643. package/esm/src/rendering/rsc/client-module-strategy.d.ts.map +1 -1
  644. package/esm/src/rendering/rsc/client-module-strategy.js +9 -3
  645. package/esm/src/rendering/rsc/component-analyzer.d.ts.map +1 -1
  646. package/esm/src/rendering/rsc/component-analyzer.js +18 -7
  647. package/esm/src/rendering/rsc/hydrate-client.ts +133 -26
  648. package/esm/src/rendering/rsc/page-island.d.ts +32 -0
  649. package/esm/src/rendering/rsc/page-island.d.ts.map +1 -0
  650. package/esm/src/rendering/rsc/page-island.js +191 -0
  651. package/esm/src/rendering/rsc/server-renderer/component-detector.d.ts +1 -1
  652. package/esm/src/rendering/rsc/server-renderer/component-detector.d.ts.map +1 -1
  653. package/esm/src/rendering/rsc/server-renderer/html-generator.d.ts +2 -2
  654. package/esm/src/rendering/rsc/server-renderer/html-generator.d.ts.map +1 -1
  655. package/esm/src/rendering/rsc/server-renderer/html-generator.js +34 -6
  656. package/esm/src/rendering/rsc/server-renderer/prop-serializer.d.ts +1 -0
  657. package/esm/src/rendering/rsc/server-renderer/prop-serializer.d.ts.map +1 -1
  658. package/esm/src/rendering/rsc/server-renderer/prop-serializer.js +17 -0
  659. package/esm/src/rendering/rsc/server-renderer/rsc-renderer.d.ts +4 -2
  660. package/esm/src/rendering/rsc/server-renderer/rsc-renderer.d.ts.map +1 -1
  661. package/esm/src/rendering/rsc/server-renderer/rsc-renderer.js +41 -6
  662. package/esm/src/rendering/rsc/server-renderer/tree-processor.d.ts +4 -4
  663. package/esm/src/rendering/rsc/server-renderer/tree-processor.d.ts.map +1 -1
  664. package/esm/src/rendering/rsc/server-renderer/tree-processor.js +65 -14
  665. package/esm/src/rendering/rsc/types.d.ts +1 -1
  666. package/esm/src/rendering/rsc/types.d.ts.map +1 -1
  667. package/esm/src/rendering/snippet-renderer.js +2 -2
  668. package/esm/src/rendering/ssr/component-registry.d.ts +1 -1
  669. package/esm/src/rendering/ssr/component-registry.d.ts.map +1 -1
  670. package/esm/src/rendering/ssr/component-registry.js +1 -1
  671. package/esm/src/rendering/ssr/mdx-renderer.d.ts +1 -1
  672. package/esm/src/rendering/ssr/mdx-renderer.d.ts.map +1 -1
  673. package/esm/src/rendering/ssr/mdx-renderer.js +1 -1
  674. package/esm/src/rendering/ssr/types.d.ts +1 -1
  675. package/esm/src/rendering/ssr/types.d.ts.map +1 -1
  676. package/esm/src/rendering/ssr-renderer.d.ts +7 -6
  677. package/esm/src/rendering/ssr-renderer.d.ts.map +1 -1
  678. package/esm/src/rendering/ssr-renderer.js +37 -30
  679. package/esm/src/rendering/utils/react-helpers.d.ts +1 -1
  680. package/esm/src/rendering/utils/react-helpers.d.ts.map +1 -1
  681. package/esm/src/rendering/utils/react-helpers.js +1 -1
  682. package/esm/src/routing/api/api-route-matcher.d.ts.map +1 -1
  683. package/esm/src/routing/api/api-route-matcher.js +6 -33
  684. package/esm/src/routing/api/module-loader/esbuild-plugin.d.ts.map +1 -1
  685. package/esm/src/routing/api/module-loader/esbuild-plugin.js +5 -1
  686. package/esm/src/routing/client/navigation-handlers.d.ts.map +1 -1
  687. package/esm/src/routing/client/navigation-handlers.js +2 -1
  688. package/esm/src/routing/client/page-loader.d.ts.map +1 -1
  689. package/esm/src/routing/client/page-loader.js +8 -3
  690. package/esm/src/routing/matchers/route-parser.d.ts.map +1 -1
  691. package/esm/src/routing/matchers/route-parser.js +27 -13
  692. package/esm/src/security/client/html-sanitizer.d.ts +1 -0
  693. package/esm/src/security/client/html-sanitizer.d.ts.map +1 -1
  694. package/esm/src/security/client/html-sanitizer.js +5 -2
  695. package/esm/src/security/http/base-handler.d.ts +2 -0
  696. package/esm/src/security/http/base-handler.d.ts.map +1 -1
  697. package/esm/src/security/http/base-handler.js +1 -0
  698. package/esm/src/security/http/config.d.ts.map +1 -1
  699. package/esm/src/security/http/config.js +12 -13
  700. package/esm/src/server/build-app-route-renderer.d.ts +2 -0
  701. package/esm/src/server/build-app-route-renderer.d.ts.map +1 -1
  702. package/esm/src/server/build-app-route-renderer.js +99 -39
  703. package/esm/src/server/build-routes.d.ts +2 -2
  704. package/esm/src/server/build-routes.d.ts.map +1 -1
  705. package/esm/src/server/build-routes.js +45 -54
  706. package/esm/src/server/dev-server/request-handler.d.ts.map +1 -1
  707. package/esm/src/server/dev-server/request-handler.js +2 -0
  708. package/esm/src/server/dev-server/route-discovery.d.ts.map +1 -1
  709. package/esm/src/server/dev-server/route-discovery.js +16 -11
  710. package/esm/src/server/handlers/dev/files/esbuild-plugins.d.ts +6 -1
  711. package/esm/src/server/handlers/dev/files/esbuild-plugins.d.ts.map +1 -1
  712. package/esm/src/server/handlers/dev/files/esbuild-plugins.js +138 -16
  713. package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
  714. package/esm/src/server/handlers/dev/framework-candidates.generated.js +845 -599
  715. package/esm/src/server/handlers/request/agent-stream.handler.d.ts.map +1 -1
  716. package/esm/src/server/handlers/request/agent-stream.handler.js +4 -1
  717. package/esm/src/server/handlers/request/api/app-router-resolver.js +1 -1
  718. package/esm/src/server/handlers/request/project-run-execute.handler.d.ts.map +1 -1
  719. package/esm/src/server/handlers/request/project-run-execute.handler.js +17 -2
  720. package/esm/src/server/handlers/request/rsc/index.d.ts.map +1 -1
  721. package/esm/src/server/handlers/request/rsc/index.js +9 -0
  722. package/esm/src/server/handlers/request/ssr/error-page-fallback.d.ts.map +1 -1
  723. package/esm/src/server/handlers/request/ssr/error-page-fallback.js +23 -15
  724. package/esm/src/server/handlers/request/ssr/not-found-fallback.d.ts.map +1 -1
  725. package/esm/src/server/handlers/request/ssr/not-found-fallback.js +10 -5
  726. package/esm/src/server/runtime-handler/local-project-discovery.d.ts.map +1 -1
  727. package/esm/src/server/runtime-handler/local-project-discovery.js +13 -2
  728. package/esm/src/server/services/rsc/endpoints/action-handler.d.ts +11 -1
  729. package/esm/src/server/services/rsc/endpoints/action-handler.d.ts.map +1 -1
  730. package/esm/src/server/services/rsc/endpoints/action-handler.js +83 -16
  731. package/esm/src/server/services/rsc/endpoints/endpoint-router.d.ts +9 -1
  732. package/esm/src/server/services/rsc/endpoints/endpoint-router.d.ts.map +1 -1
  733. package/esm/src/server/services/rsc/endpoints/endpoint-router.js +244 -73
  734. package/esm/src/server/services/rsc/endpoints/handler-registry.d.ts +4 -1
  735. package/esm/src/server/services/rsc/endpoints/handler-registry.d.ts.map +1 -1
  736. package/esm/src/server/services/rsc/endpoints/handler-registry.js +33 -3
  737. package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.d.ts.map +1 -1
  738. package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +1 -1
  739. package/esm/src/server/services/rsc/endpoints/script-handlers.d.ts.map +1 -1
  740. package/esm/src/server/services/rsc/endpoints/script-handlers.js +5 -11
  741. package/esm/src/server/services/rsc/endpoints/types.d.ts +9 -0
  742. package/esm/src/server/services/rsc/endpoints/types.d.ts.map +1 -1
  743. package/esm/src/server/services/rsc/orchestrators/component-resolver.d.ts +1 -1
  744. package/esm/src/server/services/rsc/orchestrators/component-resolver.d.ts.map +1 -1
  745. package/esm/src/server/services/rsc/orchestrators/component-resolver.js +9 -25
  746. package/esm/src/server/services/rsc/orchestrators/handler.d.ts +25 -3
  747. package/esm/src/server/services/rsc/orchestrators/handler.d.ts.map +1 -1
  748. package/esm/src/server/services/rsc/orchestrators/handler.js +74 -9
  749. package/esm/src/server/services/rsc/orchestrators/manifest-handler.d.ts +16 -0
  750. package/esm/src/server/services/rsc/orchestrators/manifest-handler.d.ts.map +1 -1
  751. package/esm/src/server/services/rsc/orchestrators/manifest-handler.js +124 -14
  752. package/esm/src/server/services/rsc/orchestrators/page-handler.d.ts +5 -0
  753. package/esm/src/server/services/rsc/orchestrators/page-handler.d.ts.map +1 -1
  754. package/esm/src/server/services/rsc/orchestrators/page-handler.js +16 -2
  755. package/esm/src/server/services/rsc/orchestrators/render-handler.d.ts +14 -2
  756. package/esm/src/server/services/rsc/orchestrators/render-handler.d.ts.map +1 -1
  757. package/esm/src/server/services/rsc/orchestrators/render-handler.js +42 -7
  758. package/esm/src/server/services/rsc/orchestrators/types.d.ts +19 -0
  759. package/esm/src/server/services/rsc/orchestrators/types.d.ts.map +1 -1
  760. package/esm/src/server/shared/browser-module-availability.d.ts +38 -0
  761. package/esm/src/server/shared/browser-module-availability.d.ts.map +1 -0
  762. package/esm/src/server/shared/browser-module-availability.js +140 -0
  763. package/esm/src/server/shared/browser-module-boundary.d.ts +18 -0
  764. package/esm/src/server/shared/browser-module-boundary.d.ts.map +1 -0
  765. package/esm/src/server/shared/browser-module-boundary.js +43 -0
  766. package/esm/src/server/shared/browser-module-bundler.d.ts +19 -0
  767. package/esm/src/server/shared/browser-module-bundler.d.ts.map +1 -1
  768. package/esm/src/server/shared/browser-module-bundler.js +123 -8
  769. package/esm/src/server/utils/domain-lookup.d.ts.map +1 -1
  770. package/esm/src/testing/bdd.d.ts.map +1 -1
  771. package/esm/src/testing/bdd.js +43 -10
  772. package/esm/src/transforms/esm/bundle-deps-validator.js +3 -3
  773. package/esm/src/transforms/esm/bundle-recovery.d.ts +3 -3
  774. package/esm/src/transforms/esm/bundle-recovery.d.ts.map +1 -1
  775. package/esm/src/transforms/esm/bundle-recovery.js +68 -29
  776. package/esm/src/transforms/esm/http-cache-helpers.d.ts +40 -0
  777. package/esm/src/transforms/esm/http-cache-helpers.d.ts.map +1 -1
  778. package/esm/src/transforms/esm/http-cache-helpers.js +143 -0
  779. package/esm/src/transforms/esm/http-cache-invariants.d.ts.map +1 -1
  780. package/esm/src/transforms/esm/http-cache-invariants.js +4 -3
  781. package/esm/src/transforms/esm/http-cache-wrapper.d.ts +4 -1
  782. package/esm/src/transforms/esm/http-cache-wrapper.d.ts.map +1 -1
  783. package/esm/src/transforms/esm/http-cache-wrapper.js +111 -3
  784. package/esm/src/transforms/esm/http-cache.d.ts +4 -4
  785. package/esm/src/transforms/esm/http-cache.d.ts.map +1 -1
  786. package/esm/src/transforms/esm/http-cache.js +24 -19
  787. package/esm/src/transforms/esm/in-flight-manager.d.ts +3 -3
  788. package/esm/src/transforms/esm/in-flight-manager.d.ts.map +1 -1
  789. package/esm/src/transforms/esm/in-flight-manager.js +2 -2
  790. package/esm/src/transforms/esm/package-registry.d.ts +4 -3
  791. package/esm/src/transforms/esm/package-registry.d.ts.map +1 -1
  792. package/esm/src/transforms/esm/package-registry.js +12 -6
  793. package/esm/src/transforms/esm/specifier-resolver.d.ts.map +1 -1
  794. package/esm/src/transforms/esm/specifier-resolver.js +7 -2
  795. package/esm/src/transforms/mdx/esm-module-loader/components/resolver.d.ts +1 -1
  796. package/esm/src/transforms/mdx/esm-module-loader/components/resolver.d.ts.map +1 -1
  797. package/esm/src/transforms/mdx/esm-module-loader/jsx/runtime-loader.js +1 -1
  798. package/esm/src/transforms/mdx/esm-module-loader/module-writer.d.ts.map +1 -1
  799. package/esm/src/transforms/mdx/esm-module-loader/module-writer.js +9 -5
  800. package/esm/src/transforms/mdx/index.d.ts +2 -2
  801. package/esm/src/transforms/mdx/index.d.ts.map +1 -1
  802. package/esm/src/transforms/mdx/index.js +3 -2
  803. package/esm/src/transforms/mdx/mdx-cache-adapter.js +1 -1
  804. package/esm/src/transforms/mdx/module-loader/types.d.ts +1 -1
  805. package/esm/src/transforms/mdx/module-loader/types.d.ts.map +1 -1
  806. package/esm/src/transforms/mdx/types.d.ts +2 -2
  807. package/esm/src/transforms/mdx/types.d.ts.map +1 -1
  808. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/constants.d.ts +22 -1
  809. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/constants.d.ts.map +1 -1
  810. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/constants.js +36 -13
  811. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/index.d.ts +1 -1
  812. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/index.d.ts.map +1 -1
  813. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/index.js +6 -4
  814. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.d.ts +2 -3
  815. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.d.ts.map +1 -1
  816. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.js +14 -12
  817. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/transform.d.ts.map +1 -1
  818. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/transform.js +73 -63
  819. package/esm/src/types/app.d.ts +1 -1
  820. package/esm/src/types/app.d.ts.map +1 -1
  821. package/esm/src/types/entities/getEntityInfo.d.ts +1 -1
  822. package/esm/src/types/entities/getEntityInfo.d.ts.map +1 -1
  823. package/esm/src/types/entities/getEntityInfo.js +25 -16
  824. package/esm/src/types/entities.js +1 -1
  825. package/esm/src/types/global-guards.d.ts +1 -1
  826. package/esm/src/types/global-guards.d.ts.map +1 -1
  827. package/esm/src/types/index.d.ts +2 -2
  828. package/esm/src/types/index.d.ts.map +1 -1
  829. package/esm/src/types/rsc.d.ts +16 -0
  830. package/esm/src/types/rsc.d.ts.map +1 -1
  831. package/esm/src/utils/id.d.ts +7 -0
  832. package/esm/src/utils/id.d.ts.map +1 -1
  833. package/esm/src/utils/id.js +22 -0
  834. package/esm/src/utils/platform.d.ts.map +1 -1
  835. package/esm/src/utils/platform.js +2 -11
  836. package/esm/src/utils/route-path-utils.d.ts +6 -2
  837. package/esm/src/utils/route-path-utils.d.ts.map +1 -1
  838. package/esm/src/utils/route-path-utils.js +18 -9
  839. package/esm/src/utils/version-constant.d.ts +1 -1
  840. package/esm/src/utils/version-constant.js +1 -1
  841. package/esm/src/workflow/claude-code/react/use-claude-code-stream.js +1 -1
  842. package/esm/src/workflow/claude-code/react/use-claude-code-websocket.js +1 -1
  843. package/esm/src/workflow/executor/dag/composite-node-execution.d.ts +11 -0
  844. package/esm/src/workflow/executor/dag/composite-node-execution.d.ts.map +1 -0
  845. package/esm/src/workflow/executor/dag/composite-node-execution.js +147 -0
  846. package/esm/src/workflow/executor/dag/graph.js +1 -1
  847. package/esm/src/workflow/executor/dag/index.d.ts +1 -1
  848. package/esm/src/workflow/executor/dag/index.d.ts.map +1 -1
  849. package/esm/src/workflow/executor/dag/index.js +78 -34
  850. package/esm/src/workflow/executor/dag/loop-node-strategy.d.ts.map +1 -1
  851. package/esm/src/workflow/executor/dag/loop-node-strategy.js +10 -2
  852. package/esm/src/workflow/executor/dag/map-node-strategy.d.ts.map +1 -1
  853. package/esm/src/workflow/executor/dag/map-node-strategy.js +3 -0
  854. package/esm/src/workflow/executor/dag/node-strategy-types.d.ts +1 -0
  855. package/esm/src/workflow/executor/dag/node-strategy-types.d.ts.map +1 -1
  856. package/esm/src/workflow/executor/dag/types.d.ts +2 -0
  857. package/esm/src/workflow/executor/dag/types.d.ts.map +1 -1
  858. package/esm/src/workflow/executor/dag/utils.d.ts +1 -1
  859. package/esm/src/workflow/executor/dag/utils.d.ts.map +1 -1
  860. package/esm/src/workflow/executor/dag/utils.js +13 -3
  861. package/esm/src/workflow/executor/step-executor.d.ts +5 -1
  862. package/esm/src/workflow/executor/step-executor.d.ts.map +1 -1
  863. package/esm/src/workflow/executor/step-executor.js +71 -16
  864. package/esm/src/workflow/executor/workflow-executor.d.ts +7 -4
  865. package/esm/src/workflow/executor/workflow-executor.d.ts.map +1 -1
  866. package/esm/src/workflow/executor/workflow-executor.js +181 -100
  867. package/esm/src/workflow/react/use-approval.js +1 -1
  868. package/esm/src/workflow/react/use-workflow-list.js +1 -1
  869. package/esm/src/workflow/react/use-workflow-start.js +1 -1
  870. package/esm/src/workflow/react/use-workflow.js +1 -1
  871. package/package.json +4 -5
  872. package/esm/deps/esm.sh/react-dom@19.2.4/client.d.ts +0 -3
  873. package/esm/deps/esm.sh/react-dom@19.2.4/client.d.ts.map +0 -1
  874. package/esm/deps/esm.sh/react-dom@19.2.4/client.js +0 -3
  875. package/esm/deps/esm.sh/react-dom@19.2.4/server.d.ts +0 -3
  876. package/esm/deps/esm.sh/react-dom@19.2.4/server.d.ts.map +0 -1
  877. package/esm/deps/esm.sh/react-dom@19.2.4/server.js +0 -3
  878. package/esm/deps/esm.sh/react-dom@19.2.4.d.ts +0 -3
  879. package/esm/deps/esm.sh/react-dom@19.2.4.d.ts.map +0 -1
  880. package/esm/deps/esm.sh/react-dom@19.2.4.js +0 -3
  881. package/esm/deps/esm.sh/react@19.2.4/jsx-dev-runtime.d.ts +0 -3
  882. package/esm/deps/esm.sh/react@19.2.4/jsx-dev-runtime.d.ts.map +0 -1
  883. package/esm/deps/esm.sh/react@19.2.4/jsx-dev-runtime.js +0 -3
  884. package/esm/deps/esm.sh/react@19.2.4/jsx-runtime.d.ts +0 -3
  885. package/esm/deps/esm.sh/react@19.2.4/jsx-runtime.d.ts.map +0 -1
  886. package/esm/deps/esm.sh/react@19.2.4/jsx-runtime.js +0 -3
  887. package/esm/deps/esm.sh/react@19.2.4.d.ts +0 -3
  888. package/esm/deps/esm.sh/react@19.2.4.d.ts.map +0 -1
  889. package/esm/deps/esm.sh/react@19.2.4.js +0 -3
  890. package/esm/deps/esm.sh/scheduler@^0.27.0.d.ts +0 -3
  891. package/esm/deps/esm.sh/scheduler@^0.27.0.d.ts.map +0 -1
  892. package/esm/deps/esm.sh/scheduler@^0.27.0.js +0 -3
  893. package/esm/react/jsx-dev-runtime.d.ts +0 -2
  894. package/esm/react/jsx-dev-runtime.d.ts.map +0 -1
  895. package/esm/react/jsx-dev-runtime.js +0 -1
  896. package/esm/react/jsx-runtime.d.ts +0 -2
  897. package/esm/react/jsx-runtime.d.ts.map +0 -1
  898. package/esm/react/jsx-runtime.js +0 -1
  899. package/esm/react/react-dom-client.d.ts +0 -3
  900. package/esm/react/react-dom-client.d.ts.map +0 -1
  901. package/esm/react/react-dom-client.js +0 -2
  902. package/esm/react/react-dom-server.d.ts +0 -3
  903. package/esm/react/react-dom-server.d.ts.map +0 -1
  904. package/esm/react/react-dom-server.js +0 -2
  905. package/esm/react/react-dom.d.ts +0 -3
  906. package/esm/react/react-dom.d.ts.map +0 -1
  907. package/esm/react/react-dom.js +0 -2
  908. package/esm/react/react.d.ts +0 -6
  909. package/esm/react/react.d.ts.map +0 -1
  910. package/esm/react/react.js +0 -7
@@ -11,6 +11,7 @@ import { cacheCSSAsync, extractCandidatesFromFiles, generateTailwindCSS, hashCSS
11
11
  import { DEFAULT_STYLESHEET } from "../../html/styles-builder/css-hash-cache.js";
12
12
  import { FRAMEWORK_CANDIDATES } from "../../server/handlers/dev/framework-candidates.generated.js";
13
13
  import { jsonForInlineScript } from "../../security/client/html-sanitizer.js";
14
+ import { SSG_GENERATION_ERROR } from "../../errors/index.js";
14
15
  function getOutputPath(outputDir, slug) {
15
16
  if (slug === "index")
16
17
  return join(outputDir, "index.html");
@@ -175,9 +176,6 @@ ${clientStyles}
175
176
  continue;
176
177
  }
177
178
  await traceStep(`write:${route.slug}`, () => adapter.fs.writeFile(outputPath, enhancedHtml));
178
- stats.pages++;
179
- stats.totalSize += getByteLength(enhancedHtml);
180
- stats.ssgPaths.push(route.path);
181
179
  const pageData = {
182
180
  slug: route.slug,
183
181
  path: route.path,
@@ -194,10 +192,18 @@ ${clientStyles}
194
192
  await adapter.fs.mkdir(dirname(modulePath), { recursive: true });
195
193
  await traceStep(`module:${route.slug}`, () => adapter.fs.writeFile(modulePath, moduleCode));
196
194
  }
195
+ stats.pages++;
196
+ stats.totalSize += getByteLength(enhancedHtml);
197
+ stats.ssgPaths.push(route.path);
197
198
  logger.debug(`Built page: ${route.slug}`);
198
199
  }
199
200
  catch (error) {
200
201
  logger.error(`Failed to build ${route.slug}:`, error);
202
+ throw SSG_GENERATION_ERROR.create({
203
+ detail: `Failed to build page ${route.path}`,
204
+ cause: error,
205
+ context: { route: route.path },
206
+ });
201
207
  }
202
208
  }
203
209
  return stats;
@@ -218,6 +224,7 @@ export async function buildAppRoutes(appRoutes, options) {
218
224
  pageFile: route.pageFile,
219
225
  contentSourceId,
220
226
  reactVersion,
227
+ config: options.config,
221
228
  releaseAssetManifest: options.releaseAssetManifest,
222
229
  stylesheetHref,
223
230
  includePreviewStylesheet: false,
@@ -233,6 +240,11 @@ export async function buildAppRoutes(appRoutes, options) {
233
240
  }
234
241
  catch (error) {
235
242
  logger.error(`Failed to build app route ${route.path}:`, error);
243
+ throw SSG_GENERATION_ERROR.create({
244
+ detail: `Failed to build app route ${route.path}`,
245
+ cause: error,
246
+ context: { route: route.path },
247
+ });
236
248
  }
237
249
  }
238
250
  return stats;
@@ -1 +1 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../../src/src/build/production-build/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,aAAa,8KACmJ,CAAC;AAE9K,eAAO,MAAM,oBAAoB,EAAE,MAAM,GAAG,SAC8z8B,CAAC;AAE328B,eAAO,MAAM,sBAAsB,EAAE,MAAM,GAAG,SAC630B,CAAC"}
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../../src/src/build/production-build/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,aAAa,8KACmJ,CAAC;AAE9K,eAAO,MAAM,oBAAoB,EAAE,MAAM,GAAG,SACqy/B,CAAC;AAEl1/B,eAAO,MAAM,sBAAsB,EAAE,MAAM,GAAG,SAC630B,CAAC"}
@@ -7,5 +7,5 @@
7
7
  * @module
8
8
  */
9
9
  export const CLIENT_STYLES = ".error-container {\n max-width: 600px;\n margin: 2rem auto;\n padding: 2rem;\n background: #fee;\n border: 1px solid #fcc;\n border-radius: 8px;\n color: #c00;\n}";
10
- export const CLIENT_ROUTER_BUNDLE = 'var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);\n\n// src/rendering/client/browser-stubs/logger.ts\nfunction noop() {\n}\nvar logger = {\n debug: noop,\n info: console.log.bind(console),\n warn: console.warn.bind(console),\n error: console.error.bind(console),\n component: () => logger\n};\nvar rendererLogger = logger;\nvar PREFETCH_MAX_SIZE_BYTES = 200 * 1024;\n\n// src/rendering/client/navigation-store.ts\nvar STORE_KEY = /* @__PURE__ */ Symbol.for("veryfront.navigation.store.v1");\nfunction getNavigationStore() {\n const holder = globalThis;\n const existing = holder[STORE_KEY];\n if (existing) return existing;\n const listeners = /* @__PURE__ */ new Set();\n let navigator = null;\n const store = {\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n getHref() {\n const loc = globalThis.location;\n return loc ? `${loc.pathname}${loc.search}${loc.hash}` : "/";\n },\n notify() {\n for (const listener of [...listeners]) {\n try {\n listener();\n } catch {\n }\n }\n },\n navigate(href, options) {\n if (navigator) return navigator(href, options);\n globalThis.location?.assign(href);\n return Promise.resolve();\n },\n setNavigator(next) {\n navigator = next;\n }\n };\n holder[STORE_KEY] = store;\n return store;\n}\n\n// src/rendering/client/router.ts\nimport ReactDOM from "react-dom/client";\n\n// src/routing/client/dom-utils.ts\nvar logger2 = rendererLogger.component("veryfront");\nfunction isInternalLink(target) {\n const href = target.getAttribute("href");\n if (!href) return false;\n if (href.startsWith("http") || href.startsWith("mailto:") || href.startsWith("#")) return false;\n const linkTarget = target.getAttribute("target");\n if (linkTarget === "_blank" || target.hasAttribute("download")) return false;\n return true;\n}\nfunction findAnchorElement(element) {\n let current = element;\n while (current && current.tagName !== "A") {\n current = current.parentElement;\n }\n return current instanceof HTMLAnchorElement ? current : null;\n}\nfunction updateMetaTags(frontmatter) {\n if (frontmatter.description) {\n updateMetaTag(\'meta[name="description"]\', "name", "description", frontmatter.description);\n }\n if (frontmatter.ogTitle) {\n updateMetaTag(\'meta[property="og:title"]\', "property", "og:title", frontmatter.ogTitle);\n }\n}\nfunction updateMetaTag(selector, attributeName, attributeValue, content) {\n let metaTag = document.querySelector(selector);\n if (!metaTag) {\n metaTag = document.createElement("meta");\n metaTag.setAttribute(attributeName, attributeValue);\n document.head.appendChild(metaTag);\n }\n metaTag.setAttribute("content", content);\n}\nfunction executeScripts(container) {\n for (const oldScript of container.querySelectorAll("script")) {\n const newScript = document.createElement("script");\n for (const { name, value } of oldScript.attributes) {\n newScript.setAttribute(name, value);\n }\n newScript.textContent = oldScript.textContent;\n oldScript.parentNode?.replaceChild(newScript, oldScript);\n }\n}\nfunction applyHeadDirectives(container) {\n const nodes = container.querySelectorAll(\'[data-veryfront-head="1"], vf-head\');\n if (!nodes.length) return;\n cleanManagedHeadTags();\n for (const wrapper of nodes) {\n const contentSource = typeof HTMLTemplateElement !== "undefined" && wrapper instanceof HTMLTemplateElement ? wrapper.content : wrapper;\n processHeadWrapper(contentSource);\n wrapper.parentElement?.removeChild(wrapper);\n }\n}\nfunction cleanManagedHeadTags() {\n for (const element of document.head.querySelectorAll(\'[data-veryfront-managed="1"]\')) {\n element.parentElement?.removeChild(element);\n }\n}\nfunction processHeadWrapper(wrapper) {\n for (const node of wrapper.childNodes) {\n if (!(node instanceof Element)) continue;\n const tagName = node.tagName.toLowerCase();\n if (tagName === "title") {\n document.title = node.textContent || document.title;\n continue;\n }\n const clone = document.createElement(tagName);\n for (const { name, value } of node.attributes) {\n clone.setAttribute(name, value);\n }\n if (node.textContent && !clone.hasAttribute("src")) {\n clone.textContent = node.textContent;\n }\n clone.setAttribute("data-veryfront-managed", "1");\n document.head.appendChild(clone);\n }\n}\nfunction manageFocus(container) {\n try {\n const focusElement = container.querySelector("[data-router-focus]") || container.querySelector("main") || container.querySelector("h1");\n focusElement?.focus?.({ preventScroll: true });\n } catch (error) {\n logger2.warn("focus management failed", error);\n }\n}\nfunction extractPageDataFromScript() {\n const pageDataScript = document.querySelector("script[data-veryfront-page]");\n if (!pageDataScript) return null;\n try {\n const content = pageDataScript.textContent;\n if (!content) {\n logger2.warn("Page data script has no content");\n return {};\n }\n return JSON.parse(content);\n } catch (error) {\n logger2.error("Failed to parse page data:", error);\n return null;\n }\n}\nfunction parsePageDataFromHTML(html) {\n const doc = new DOMParser().parseFromString(html, "text/html");\n const root = doc.getElementById("root");\n if (!root) logger2.warn("[Veryfront] No root element found in HTML");\n const content = root?.innerHTML ?? "";\n const pageDataScript = doc.querySelector("script[data-veryfront-page]");\n let pageData = {};\n if (pageDataScript) {\n try {\n const scriptContent = pageDataScript.textContent;\n if (!scriptContent) {\n logger2.warn("Page data script in HTML has no content");\n } else {\n pageData = JSON.parse(scriptContent);\n }\n } catch (error) {\n logger2.error("Failed to parse page data from HTML:", error);\n }\n }\n return { content, pageData };\n}\n\n// src/rendering/client/browser-stubs/config.ts\nvar DEFAULT_PREFETCH_DELAY_MS = 100;\nvar PAGE_TRANSITION_DELAY_MS = 150;\n\n// src/routing/client/navigation-handlers.ts\nvar logger3 = rendererLogger.component("veryfront");\nvar MAX_SCROLL_POSITIONS = 100;\nvar NavigationHandlers = class {\n constructor(prefetchDelay = DEFAULT_PREFETCH_DELAY_MS, prefetchOptions = {}) {\n __publicField(this, "prefetchQueue", /* @__PURE__ */ new Set());\n __publicField(this, "pendingTimeouts", /* @__PURE__ */ new Map());\n __publicField(this, "scrollPositions", /* @__PURE__ */ new Map());\n __publicField(this, "isPopStateNav", false);\n __publicField(this, "prefetchDelay");\n __publicField(this, "prefetchOptions");\n this.prefetchDelay = prefetchDelay;\n this.prefetchOptions = prefetchOptions;\n }\n createClickHandler(callbacks) {\n return (event) => {\n if (!(event.target instanceof HTMLElement)) return;\n const anchor = findAnchorElement(event.target);\n if (!anchor || !isInternalLink(anchor)) return;\n const href = anchor.getAttribute("href");\n if (!href) return;\n event.preventDefault();\n callbacks.onNavigate(href);\n };\n }\n createPopStateHandler(callbacks) {\n return (_event) => {\n this.isPopStateNav = true;\n callbacks.onNavigate(globalThis.location.pathname);\n };\n }\n createMouseOverHandler(callbacks) {\n return (event) => {\n if (!(event.target instanceof HTMLElement)) return;\n if (event.target.tagName !== "A") return;\n const href = event.target.getAttribute("href");\n if (!href || href.startsWith("http") || href.startsWith("#")) return;\n if (!this.shouldPrefetchOnHover(event.target)) return;\n if (this.prefetchQueue.has(href)) return;\n this.prefetchQueue.add(href);\n const timeoutId = setTimeout(() => {\n callbacks.onPrefetch(href);\n this.prefetchQueue.delete(href);\n this.pendingTimeouts.delete(href);\n }, this.prefetchDelay);\n this.pendingTimeouts.set(href, timeoutId);\n };\n }\n shouldPrefetchOnHover(target) {\n const prefetchAttribute = target.getAttribute("data-prefetch");\n if (prefetchAttribute === "false") return false;\n if (prefetchAttribute === "true") return true;\n return Boolean(this.prefetchOptions.hover);\n }\n saveScrollPosition(path) {\n try {\n if (this.scrollPositions.size >= MAX_SCROLL_POSITIONS) {\n const oldest = this.scrollPositions.keys().next().value;\n if (oldest) this.scrollPositions.delete(oldest);\n }\n const scrollY = globalThis.scrollY;\n if (typeof scrollY !== "number") {\n logger3.debug("No valid scrollY value available");\n this.scrollPositions.set(path, 0);\n return;\n }\n this.scrollPositions.set(path, scrollY);\n } catch (error) {\n logger3.warn("failed to record scroll position", error);\n }\n }\n getScrollPosition(path) {\n const position = this.scrollPositions.get(path);\n if (position === void 0) {\n logger3.debug(`No scroll position stored for ${path}`);\n return 0;\n }\n return position;\n }\n isPopState() {\n return this.isPopStateNav;\n }\n clearPopStateFlag() {\n this.isPopStateNav = false;\n }\n clear() {\n for (const timeoutId of this.pendingTimeouts.values()) clearTimeout(timeoutId);\n this.pendingTimeouts.clear();\n this.prefetchQueue.clear();\n this.scrollPositions.clear();\n this.isPopStateNav = false;\n }\n};\n\n// src/rendering/client/browser-stubs/error-registry.ts\nfunction createBrowserError(name, fallbackMessage) {\n return {\n create(options = {}) {\n const error = new Error(options.detail ?? fallbackMessage);\n error.name = name;\n Object.assign(error, {\n status: options.status,\n context: options.context\n });\n return error;\n }\n };\n}\nvar NETWORK_ERROR = createBrowserError("NetworkError", "Network request failed");\nvar SECURITY_VIOLATION = createBrowserError("SecurityViolation", "Security violation");\n\n// src/routing/client/page-loader.ts\nvar logger4 = rendererLogger.component("veryfront");\nvar MAX_CACHE_SIZE = 50;\nvar PageLoader = class {\n constructor() {\n __publicField(this, "cache", /* @__PURE__ */ new Map());\n __publicField(this, "spaCache", /* @__PURE__ */ new Map());\n __publicField(this, "pendingRequests", /* @__PURE__ */ new Map());\n __publicField(this, "pendingSpaRequests", /* @__PURE__ */ new Map());\n }\n evictIfFull(map) {\n if (map.size < MAX_CACHE_SIZE) return;\n const oldest = map.keys().next().value;\n if (oldest) map.delete(oldest);\n }\n getCached(path) {\n return this.cache.get(path);\n }\n isCached(path) {\n return this.cache.has(path);\n }\n setCache(path, data) {\n this.evictIfFull(this.cache);\n this.cache.set(path, data);\n }\n clearCache() {\n this.cache.clear();\n this.spaCache.clear();\n this.pendingRequests.clear();\n this.pendingSpaRequests.clear();\n }\n getSpaCached(path) {\n return this.spaCache.get(path);\n }\n isSpaDataCached(path) {\n return this.spaCache.has(path);\n }\n setSpaCache(path, data) {\n this.evictIfFull(this.spaCache);\n this.spaCache.set(path, data);\n }\n async fetchPageData(path) {\n return await this.tryFetchJSON(path) ?? this.fetchAndParseHTML(path);\n }\n async tryFetchJSON(path) {\n try {\n const response = await fetch(`/_veryfront/data${path}.json`, {\n headers: { "X-Veryfront-Navigation": "client" }\n });\n if (!response.ok) return null;\n return await response.json();\n } catch (error) {\n logger4.debug(`JSON fetch failed for ${path}, falling back to HTML:`, error);\n return null;\n }\n }\n async fetchAndParseHTML(path) {\n const response = await fetch(path, {\n headers: { "X-Veryfront-Navigation": "client" }\n });\n if (!response.ok) {\n throw NETWORK_ERROR.create({\n detail: `Failed to fetch ${path}`,\n status: response.status,\n context: { path }\n });\n }\n const html = await response.text();\n const { content, pageData } = parsePageDataFromHTML(html);\n return { html: content, ...pageData };\n }\n loadPage(path) {\n const cachedData = this.getCached(path);\n if (cachedData) {\n logger4.debug(`Loading ${path} from cache`);\n return Promise.resolve(cachedData);\n }\n const pending = this.pendingRequests.get(path);\n if (pending) {\n logger4.debug(`Reusing pending request for ${path}`);\n return pending;\n }\n logger4.debug(`Creating pending request for ${path}`);\n return this.createPendingRequest(path, this.pendingRequests, async () => {\n const data = await this.fetchPageData(path);\n this.setCache(path, data);\n return data;\n });\n }\n async prefetch(path) {\n if (this.isCached(path)) return;\n logger4.debug(`Prefetching ${path}`);\n try {\n await this.loadPage(path);\n } catch (error) {\n logger4.warn(\n `[Veryfront] Failed to prefetch ${path}`,\n error instanceof Error ? error : new Error(String(error))\n );\n }\n }\n async fetchSpaPageData(path) {\n const normalizedPath = path === "/" ? "" : path.replace(/^\\//, "");\n const endpoint = `/_veryfront/page-data/${normalizedPath}.json`;\n logger4.debug(`Fetching SPA page data from ${endpoint}`);\n const response = await fetch(endpoint, {\n headers: { "X-Veryfront-Navigation": "spa" }\n });\n if (!response.ok) {\n throw NETWORK_ERROR.create({\n detail: `Failed to fetch SPA page data for ${path}`,\n status: response.status,\n context: { path }\n });\n }\n return response.json();\n }\n loadSpaPageData(path) {\n const cachedData = this.getSpaCached(path);\n if (cachedData) {\n logger4.debug(`Loading SPA data for ${path} from cache`);\n return Promise.resolve(cachedData);\n }\n const pending = this.pendingSpaRequests.get(path);\n if (pending) {\n logger4.debug(`Reusing pending SPA request for ${path}`);\n return pending;\n }\n logger4.debug(`Creating pending SPA request for ${path}`);\n return this.createPendingRequest(path, this.pendingSpaRequests, async () => {\n const data = await this.fetchSpaPageData(path);\n this.setSpaCache(path, data);\n return data;\n });\n }\n async prefetchSpaPageData(path) {\n if (this.isSpaDataCached(path)) return;\n logger4.debug(`Prefetching SPA page data for ${path}`);\n try {\n await this.loadSpaPageData(path);\n } catch (error) {\n logger4.warn(\n `[Veryfront] Failed to prefetch SPA data for ${path}`,\n error instanceof Error ? error : new Error(String(error))\n );\n }\n }\n createPendingRequest(path, pendingMap, fetcher) {\n const request = (async () => {\n try {\n return await fetcher();\n } finally {\n pendingMap.delete(path);\n }\n })();\n pendingMap.set(path, request);\n return request;\n }\n};\n\n// src/security/client/html-sanitizer.ts\nvar SUSPICIOUS_PATTERN_SPECS = [\n { source: String.raw`<script[^>]*>[\\s\\S]*?<\\/script>`, flags: "gi", name: "inline script" },\n { source: String.raw`javascript:`, flags: "gi", name: "javascript: URL" },\n { source: String.raw`\\bon\\w+\\s*=`, flags: "gi", name: "event handler attribute" },\n { source: String.raw`data:\\s*text\\/html`, flags: "gi", name: "data: HTML URL" }\n];\nfunction createSuspiciousPatterns() {\n return SUSPICIOUS_PATTERN_SPECS.map(({ source, flags, name }) => ({\n pattern: new RegExp(source, flags),\n name\n }));\n}\nfunction isDevMode() {\n const g = globalThis;\n return g.__VERYFRONT_DEV__ === true || g.Deno?.env?.get?.("VERYFRONT_ENV") === "development";\n}\nfunction validateTrustedHtml(html, options = {}) {\n const { allowInlineScripts = false, strict = false, warn = true } = options;\n for (const { pattern, name } of createSuspiciousPatterns()) {\n if (allowInlineScripts && name === "inline script") continue;\n pattern.lastIndex = 0;\n if (!pattern.test(html)) continue;\n if (warn) console.warn(`[Security] Suspicious ${name} detected in server HTML`);\n if (strict || !isDevMode()) {\n throw SECURITY_VIOLATION.create({ detail: `Potentially unsafe HTML: ${name} detected` });\n }\n }\n return html;\n}\n\n// src/routing/client/page-transition.ts\nvar logger5 = rendererLogger.component("veryfront");\nvar PageTransition = class {\n constructor(setupViewportPrefetch) {\n __publicField(this, "setupViewportPrefetch", setupViewportPrefetch);\n __publicField(this, "pendingTransitionTimeout");\n }\n destroy() {\n if (this.pendingTransitionTimeout === void 0) return;\n clearTimeout(this.pendingTransitionTimeout);\n this.pendingTransitionTimeout = void 0;\n }\n updatePage(data, isPopState, scrollY) {\n const title = data.frontmatter?.title;\n if (title) document.title = title;\n updateMetaTags(data.frontmatter ?? {});\n const rootElement = document.getElementById("root");\n if (!rootElement || !data.html) return;\n this.performTransition(rootElement, data, isPopState, scrollY);\n }\n performTransition(rootElement, data, isPopState, scrollY) {\n if (this.pendingTransitionTimeout !== void 0) {\n clearTimeout(this.pendingTransitionTimeout);\n this.pendingTransitionTimeout = void 0;\n }\n rootElement.style.opacity = "0";\n this.pendingTransitionTimeout = setTimeout(() => {\n this.pendingTransitionTimeout = void 0;\n rootElement.innerHTML = validateTrustedHtml(String(data.html), { allowInlineScripts: true });\n rootElement.style.opacity = "1";\n executeScripts(rootElement);\n applyHeadDirectives(rootElement);\n this.setupViewportPrefetch(rootElement);\n manageFocus(rootElement);\n this.handleScroll(isPopState, scrollY);\n }, PAGE_TRANSITION_DELAY_MS);\n }\n handleScroll(isPopState, scrollY) {\n try {\n globalThis.scrollTo(0, isPopState ? scrollY : 0);\n } catch (error) {\n logger5.warn("scroll handling failed", error);\n }\n }\n showError(error) {\n const rootElement = document.getElementById("root");\n if (!rootElement) return;\n const errorDiv = document.createElement("div");\n errorDiv.className = "veryfront-error-page";\n const heading = document.createElement("h1");\n heading.textContent = "Oops! Something went wrong";\n const message = document.createElement("p");\n message.textContent = error.message;\n const button = document.createElement("button");\n button.type = "button";\n button.textContent = "Reload Page";\n button.onclick = () => globalThis.location.reload();\n errorDiv.append(heading, message, button);\n rootElement.innerHTML = "";\n rootElement.appendChild(errorDiv);\n }\n setLoadingState(loading) {\n const indicator = document.getElementById("veryfront-loading");\n if (indicator) indicator.style.display = loading ? "block" : "none";\n document.body.classList.toggle("veryfront-loading", loading);\n }\n};\n\n// src/routing/client/viewport-prefetch.ts\nvar logger6 = rendererLogger.component("veryfront");\nvar ViewportPrefetch = class {\n constructor(prefetchCallback, prefetchOptions = {}) {\n __publicField(this, "observer", null);\n __publicField(this, "prefetchCallback");\n __publicField(this, "prefetchOptions");\n this.prefetchCallback = prefetchCallback;\n this.prefetchOptions = prefetchOptions;\n }\n setup(root) {\n try {\n if (!("IntersectionObserver" in globalThis)) return;\n this.observer?.disconnect();\n this.createObserver();\n this.observeLinks(root);\n } catch (error) {\n logger6.debug("setupViewportPrefetch failed", error);\n }\n }\n createObserver() {\n this.observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n if (!entry.isIntersecting) continue;\n if (!(entry.target instanceof HTMLAnchorElement)) continue;\n const href = entry.target.getAttribute("href");\n if (href) this.prefetchCallback(href);\n this.observer?.unobserve(entry.target);\n }\n },\n { rootMargin: "200px" }\n );\n }\n observeLinks(root) {\n const anchors = root.querySelectorAll(\'a[href]:not([target="_blank"])\');\n const isViewportEnabled = Boolean(this.prefetchOptions.viewport);\n for (const anchor of anchors) {\n if (!this.shouldObserveAnchor(anchor, isViewportEnabled)) continue;\n this.observer?.observe(anchor);\n }\n }\n shouldObserveAnchor(anchor, isViewportEnabled) {\n const href = anchor.getAttribute("href");\n if (!href) return false;\n if (href.startsWith("http") || href.startsWith("#")) return false;\n if (anchor.getAttribute("download")) return false;\n const prefetchAttribute = anchor.getAttribute("data-prefetch");\n if (prefetchAttribute === "false") return false;\n return prefetchAttribute === "viewport" || isViewportEnabled;\n }\n disconnect() {\n if (!this.observer) return;\n try {\n this.observer.disconnect();\n } catch (error) {\n logger6.warn("prefetchObserver.disconnect failed", error);\n } finally {\n this.observer = null;\n }\n }\n};\n\n// src/rendering/client/router.ts\nvar logger7 = rendererLogger.component("veryfront");\nfunction toHistoryMode(options) {\n if (typeof options === "boolean") return options ? "push" : "none";\n return options?.history ?? "push";\n}\nvar VeryfrontRouter = class {\n constructor(options = {}) {\n __publicField(this, "baseUrl");\n __publicField(this, "currentPath");\n __publicField(this, "root", null);\n __publicField(this, "options");\n __publicField(this, "spaMode");\n __publicField(this, "spaNavigationHandler", null);\n __publicField(this, "pageLoader");\n __publicField(this, "navigationHandlers");\n __publicField(this, "pageTransition");\n __publicField(this, "viewportPrefetch");\n __publicField(this, "handleClick");\n __publicField(this, "handlePopState");\n __publicField(this, "handleMouseOver");\n const globalOptions = this.loadGlobalOptions();\n this.options = { ...globalOptions, ...options };\n this.baseUrl = this.options.baseUrl || globalThis.location.origin;\n this.currentPath = globalThis.location.pathname;\n this.spaMode = this.options.spaMode ?? globalThis.__VERYFRONT_SPA_MODE__ ?? false;\n this.pageLoader = new PageLoader();\n this.navigationHandlers = new NavigationHandlers(\n this.options.prefetchDelay,\n this.options.prefetch\n );\n this.pageTransition = new PageTransition((root) => this.viewportPrefetch.setup(root));\n this.viewportPrefetch = new ViewportPrefetch(\n (path) => this.prefetch(path),\n this.options.prefetch\n );\n this.handleClick = this.navigationHandlers.createClickHandler({\n onNavigate: (url) => this.navigate(url),\n onPrefetch: (url) => this.prefetch(url)\n });\n this.handlePopState = this.navigationHandlers.createPopStateHandler({\n // The browser already updated the URL for a popstate, so don\'t touch history.\n onNavigate: (url) => this.navigate(url, { history: "none" }),\n onPrefetch: (url) => this.prefetch(url)\n });\n this.handleMouseOver = this.navigationHandlers.createMouseOverHandler({\n onNavigate: (url) => this.navigate(url),\n onPrefetch: (url) => this.prefetch(url)\n });\n getNavigationStore().setNavigator((href, options2) => this.navigate(href, options2));\n }\n registerNavigationHandler(handler) {\n logger7.debug("Registering SPA navigation handler");\n this.spaNavigationHandler = handler;\n this.spaMode = true;\n }\n /**\n * Notify React (and any other) subscribers that a navigation completed —\n * after full page loads, soft same-route changes, and popstate. Delegates to\n * the shared navigation store, the single subscription surface both bundles\n * share.\n */\n notify() {\n getNavigationStore().notify();\n }\n pathnameOf(url) {\n try {\n return new URL(url, this.baseUrl).pathname;\n } catch {\n return url.split("?")[0]?.split("#")[0] || this.currentPath;\n }\n }\n loadGlobalOptions() {\n try {\n const options = globalThis.__VERYFRONT_ROUTER_OPTS__;\n if (!options) {\n logger7.debug("No global options configured");\n return {};\n }\n return options;\n } catch (error) {\n logger7.error("Failed to read global options:", error);\n return {};\n }\n }\n init() {\n logger7.debug("Initializing client-side router");\n const rootElement = document.getElementById("root");\n if (!rootElement) {\n logger7.error("Root element not found");\n return;\n }\n const ReactDOMToUse = globalThis.ReactDOM ?? ReactDOM;\n this.root = ReactDOMToUse.createRoot(rootElement);\n document.addEventListener("click", this.handleClick);\n globalThis.addEventListener("popstate", this.handlePopState);\n document.addEventListener("mouseover", this.handleMouseOver);\n this.viewportPrefetch.setup(document);\n this.cacheCurrentPage();\n }\n cacheCurrentPage() {\n const pageData = extractPageDataFromScript();\n if (pageData) this.pageLoader.setCache(this.currentPath, pageData);\n }\n /**\n * Navigate to a URL. `options` selects the history behaviour: `{ history:\n * "push" }` (default), `"replace"`, or `"none"` (the URL already reflects the\n * target, as after popstate). A boolean is accepted for backward\n * compatibility — `true` pushes, `false` maps to `"none"`.\n */\n async navigate(url, options) {\n logger7.debug(`Navigating to ${url} (SPA mode: ${this.spaMode})`);\n const history = toHistoryMode(options);\n const sameRoute = this.pathnameOf(url) === this.pathnameOf(this.currentPath);\n this.navigationHandlers.saveScrollPosition(this.currentPath);\n this.options.onStart?.(url);\n if (history === "replace") globalThis.history.replaceState({}, "", url);\n else if (history === "push") globalThis.history.pushState({}, "", url);\n if (sameRoute && !this.shouldRevalidate(url, sameRoute)) {\n this.currentPath = url;\n this.notify();\n this.options.onComplete?.(url);\n this.options.onNavigate?.(url);\n return;\n }\n if (this.spaMode && this.spaNavigationHandler) {\n await this.loadSpaPage(url);\n } else {\n await this.loadPage(url);\n }\n this.notify();\n this.options.onNavigate?.(url);\n }\n /**\n * Whether a navigation should refetch page data. A route change always does;\n * a same-route (query/hash-only) change consults `options.shouldRevalidate`,\n * defaulting to `true` so server data is never shown stale.\n */\n shouldRevalidate(nextUrl, sameRoute) {\n const policy = this.options.shouldRevalidate;\n if (!policy) return true;\n return policy({ currentHref: this.currentPath, nextHref: nextUrl, sameRoute });\n }\n async loadSpaPage(path) {\n logger7.debug(`Loading SPA page: ${path}`);\n try {\n const spaData = await this.pageLoader.loadSpaPageData(path);\n await this.spaNavigationHandler?.(spaData);\n this.currentPath = path;\n this.handleScrollAfterNavigation();\n this.options.onComplete?.(path);\n } catch (error) {\n const normalizedError = error instanceof Error ? error : new Error(String(error));\n logger7.error(`Failed to load SPA page ${path}`, normalizedError);\n this.options.onError?.(normalizedError);\n this.pageTransition.showError(normalizedError);\n }\n }\n handleScrollAfterNavigation() {\n const isPopState = this.navigationHandlers.isPopState();\n const scrollY = this.navigationHandlers.getScrollPosition(this.currentPath);\n try {\n globalThis.scrollTo(0, isPopState ? scrollY : 0);\n } catch (error) {\n logger7.warn("scroll handling failed", error);\n }\n this.navigationHandlers.clearPopStateFlag();\n }\n async loadPage(path, updateUI = true) {\n if (this.pageLoader.isCached(path)) {\n logger7.debug(`Loading ${path} from cache`);\n const data = this.pageLoader.getCached(path);\n if (data) {\n if (updateUI) this.updatePage(data);\n return;\n }\n logger7.warn(`Cache entry for ${path} was unexpectedly null, fetching fresh data`);\n }\n this.pageTransition.setLoadingState(true);\n try {\n const data = await this.pageLoader.loadPage(path);\n if (updateUI) this.updatePage(data);\n this.currentPath = path;\n this.options.onComplete?.(path);\n } catch (error) {\n const normalizedError = error instanceof Error ? error : new Error(String(error));\n logger7.error(`Failed to load ${path}`, normalizedError);\n this.options.onError?.(normalizedError);\n this.pageTransition.showError(normalizedError);\n } finally {\n this.pageTransition.setLoadingState(false);\n }\n }\n async prefetch(path) {\n if (this.spaMode) {\n await this.pageLoader.prefetchSpaPageData(path);\n return;\n }\n await this.pageLoader.prefetch(path);\n }\n updatePage(data) {\n if (!this.root) return;\n const isPopState = this.navigationHandlers.isPopState();\n const scrollY = this.navigationHandlers.getScrollPosition(this.currentPath);\n this.pageTransition.updatePage(data, isPopState, scrollY);\n this.navigationHandlers.clearPopStateFlag();\n }\n destroy() {\n document.removeEventListener("click", this.handleClick);\n globalThis.removeEventListener("popstate", this.handlePopState);\n document.removeEventListener("mouseover", this.handleMouseOver);\n this.viewportPrefetch.disconnect();\n this.pageLoader.clearCache();\n this.navigationHandlers.clear();\n this.pageTransition.destroy();\n }\n};\nfunction boot(options = {}) {\n if (typeof window === "undefined" || !globalThis.document) return null;\n const globalWithRouter = globalThis;\n if (globalWithRouter.veryFrontRouter) return globalWithRouter.veryFrontRouter;\n const { slug: _slug, ...routerOptions } = options;\n const router = new VeryfrontRouter(routerOptions);\n if (document.readyState === "loading") {\n document.addEventListener("DOMContentLoaded", () => router.init(), { once: true });\n } else {\n router.init();\n }\n globalWithRouter.veryFrontRouter = router;\n return router;\n}\nif (typeof window !== "undefined" && globalThis.document) {\n boot();\n}\nexport {\n VeryfrontRouter,\n boot\n};\n';
10
+ export const CLIENT_ROUTER_BUNDLE = 'var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);\n\n// src/rendering/client/browser-stubs/logger.ts\nfunction noop() {\n}\nvar logger = {\n debug: noop,\n info: console.log.bind(console),\n warn: console.warn.bind(console),\n error: console.error.bind(console),\n component: () => logger\n};\nvar rendererLogger = logger;\nvar PREFETCH_MAX_SIZE_BYTES = 200 * 1024;\n\n// src/rendering/client/navigation-store.ts\nvar STORE_KEY = /* @__PURE__ */ Symbol.for("veryfront.navigation.store.v1");\nfunction getNavigationStore() {\n const holder = globalThis;\n const existing = holder[STORE_KEY];\n if (existing) return existing;\n const listeners = /* @__PURE__ */ new Set();\n let navigator = null;\n const store = {\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n getHref() {\n const loc = globalThis.location;\n return loc ? `${loc.pathname}${loc.search}${loc.hash}` : "/";\n },\n notify() {\n for (const listener of [...listeners]) {\n try {\n listener();\n } catch {\n }\n }\n },\n navigate(href, options) {\n if (navigator) return navigator(href, options);\n globalThis.location?.assign(href);\n return Promise.resolve();\n },\n setNavigator(next) {\n navigator = next;\n }\n };\n holder[STORE_KEY] = store;\n return store;\n}\n\n// src/rendering/client/router.ts\nimport ReactDOM from "react-dom/client";\n\n// src/routing/client/dom-utils.ts\nvar logger2 = rendererLogger.component("veryfront");\nfunction isInternalLink(target) {\n const href = target.getAttribute("href");\n if (!href) return false;\n if (href.startsWith("http") || href.startsWith("mailto:") || href.startsWith("#")) return false;\n const linkTarget = target.getAttribute("target");\n if (linkTarget === "_blank" || target.hasAttribute("download")) return false;\n return true;\n}\nfunction findAnchorElement(element) {\n let current = element;\n while (current && current.tagName !== "A") {\n current = current.parentElement;\n }\n return current instanceof HTMLAnchorElement ? current : null;\n}\nfunction updateMetaTags(frontmatter) {\n if (frontmatter.description) {\n updateMetaTag(\'meta[name="description"]\', "name", "description", frontmatter.description);\n }\n if (frontmatter.ogTitle) {\n updateMetaTag(\'meta[property="og:title"]\', "property", "og:title", frontmatter.ogTitle);\n }\n}\nfunction updateMetaTag(selector, attributeName, attributeValue, content) {\n let metaTag = document.querySelector(selector);\n if (!metaTag) {\n metaTag = document.createElement("meta");\n metaTag.setAttribute(attributeName, attributeValue);\n document.head.appendChild(metaTag);\n }\n metaTag.setAttribute("content", content);\n}\nfunction executeScripts(container) {\n for (const oldScript of container.querySelectorAll("script")) {\n const newScript = document.createElement("script");\n for (const { name, value } of oldScript.attributes) {\n newScript.setAttribute(name, value);\n }\n newScript.textContent = oldScript.textContent;\n oldScript.parentNode?.replaceChild(newScript, oldScript);\n }\n}\nfunction applyHeadDirectives(container) {\n const nodes = container.querySelectorAll(\'[data-veryfront-head="1"], vf-head\');\n if (!nodes.length) return;\n cleanManagedHeadTags();\n for (const wrapper of nodes) {\n const contentSource = typeof HTMLTemplateElement !== "undefined" && wrapper instanceof HTMLTemplateElement ? wrapper.content : wrapper;\n processHeadWrapper(contentSource);\n wrapper.parentElement?.removeChild(wrapper);\n }\n}\nfunction cleanManagedHeadTags() {\n for (const element of document.head.querySelectorAll(\'[data-veryfront-managed="1"]\')) {\n element.parentElement?.removeChild(element);\n }\n}\nfunction processHeadWrapper(wrapper) {\n for (const node of wrapper.childNodes) {\n if (!(node instanceof Element)) continue;\n const tagName = node.tagName.toLowerCase();\n if (tagName === "title") {\n document.title = node.textContent || document.title;\n continue;\n }\n const clone = document.createElement(tagName);\n for (const { name, value } of node.attributes) {\n clone.setAttribute(name, value);\n }\n if (node.textContent && !clone.hasAttribute("src")) {\n clone.textContent = node.textContent;\n }\n clone.setAttribute("data-veryfront-managed", "1");\n document.head.appendChild(clone);\n }\n}\nfunction manageFocus(container) {\n try {\n const focusElement = container.querySelector("[data-router-focus]") || container.querySelector("main") || container.querySelector("h1");\n focusElement?.focus?.({ preventScroll: true });\n } catch (error) {\n logger2.warn("focus management failed", error);\n }\n}\nfunction extractPageDataFromScript() {\n const pageDataScript = document.querySelector("script[data-veryfront-page]");\n if (!pageDataScript) return null;\n try {\n const content = pageDataScript.textContent;\n if (!content) {\n logger2.warn("Page data script has no content");\n return {};\n }\n return JSON.parse(content);\n } catch (error) {\n logger2.error("Failed to parse page data:", error);\n return null;\n }\n}\nfunction parsePageDataFromHTML(html) {\n const doc = new DOMParser().parseFromString(html, "text/html");\n const root = doc.getElementById("root");\n if (!root) logger2.warn("[Veryfront] No root element found in HTML");\n const content = root?.innerHTML ?? "";\n const pageDataScript = doc.querySelector("script[data-veryfront-page]");\n let pageData = {};\n if (pageDataScript) {\n try {\n const scriptContent = pageDataScript.textContent;\n if (!scriptContent) {\n logger2.warn("Page data script in HTML has no content");\n } else {\n pageData = JSON.parse(scriptContent);\n }\n } catch (error) {\n logger2.error("Failed to parse page data from HTML:", error);\n }\n }\n return { content, pageData };\n}\n\n// src/rendering/client/browser-stubs/config.ts\nvar DEFAULT_PREFETCH_DELAY_MS = 100;\nvar PAGE_TRANSITION_DELAY_MS = 150;\n\n// src/routing/client/navigation-handlers.ts\nvar logger3 = rendererLogger.component("veryfront");\nvar MAX_SCROLL_POSITIONS = 100;\nvar NavigationHandlers = class {\n constructor(prefetchDelay = DEFAULT_PREFETCH_DELAY_MS, prefetchOptions = {}) {\n __publicField(this, "prefetchQueue", /* @__PURE__ */ new Set());\n __publicField(this, "pendingTimeouts", /* @__PURE__ */ new Map());\n __publicField(this, "scrollPositions", /* @__PURE__ */ new Map());\n __publicField(this, "isPopStateNav", false);\n __publicField(this, "prefetchDelay");\n __publicField(this, "prefetchOptions");\n this.prefetchDelay = prefetchDelay;\n this.prefetchOptions = prefetchOptions;\n }\n createClickHandler(callbacks) {\n return (event) => {\n if (!(event.target instanceof HTMLElement)) return;\n const anchor = findAnchorElement(event.target);\n if (!anchor || !isInternalLink(anchor)) return;\n const href = anchor.getAttribute("href");\n if (!href) return;\n event.preventDefault();\n callbacks.onNavigate(href);\n };\n }\n createPopStateHandler(callbacks) {\n return (_event) => {\n this.isPopStateNav = true;\n const { pathname, search, hash } = globalThis.location;\n callbacks.onNavigate(`${pathname}${search}${hash}`);\n };\n }\n createMouseOverHandler(callbacks) {\n return (event) => {\n if (!(event.target instanceof HTMLElement)) return;\n if (event.target.tagName !== "A") return;\n const href = event.target.getAttribute("href");\n if (!href || href.startsWith("http") || href.startsWith("#")) return;\n if (!this.shouldPrefetchOnHover(event.target)) return;\n if (this.prefetchQueue.has(href)) return;\n this.prefetchQueue.add(href);\n const timeoutId = setTimeout(() => {\n callbacks.onPrefetch(href);\n this.prefetchQueue.delete(href);\n this.pendingTimeouts.delete(href);\n }, this.prefetchDelay);\n this.pendingTimeouts.set(href, timeoutId);\n };\n }\n shouldPrefetchOnHover(target) {\n const prefetchAttribute = target.getAttribute("data-prefetch");\n if (prefetchAttribute === "false") return false;\n if (prefetchAttribute === "true") return true;\n return Boolean(this.prefetchOptions.hover);\n }\n saveScrollPosition(path) {\n try {\n if (this.scrollPositions.size >= MAX_SCROLL_POSITIONS) {\n const oldest = this.scrollPositions.keys().next().value;\n if (oldest) this.scrollPositions.delete(oldest);\n }\n const scrollY = globalThis.scrollY;\n if (typeof scrollY !== "number") {\n logger3.debug("No valid scrollY value available");\n this.scrollPositions.set(path, 0);\n return;\n }\n this.scrollPositions.set(path, scrollY);\n } catch (error) {\n logger3.warn("failed to record scroll position", error);\n }\n }\n getScrollPosition(path) {\n const position = this.scrollPositions.get(path);\n if (position === void 0) {\n logger3.debug(`No scroll position stored for ${path}`);\n return 0;\n }\n return position;\n }\n isPopState() {\n return this.isPopStateNav;\n }\n clearPopStateFlag() {\n this.isPopStateNav = false;\n }\n clear() {\n for (const timeoutId of this.pendingTimeouts.values()) clearTimeout(timeoutId);\n this.pendingTimeouts.clear();\n this.prefetchQueue.clear();\n this.scrollPositions.clear();\n this.isPopStateNav = false;\n }\n};\n\n// src/rendering/client/browser-stubs/error-registry.ts\nfunction createBrowserError(name, fallbackMessage) {\n return {\n create(options = {}) {\n const error = new Error(options.detail ?? fallbackMessage);\n error.name = name;\n Object.assign(error, {\n status: options.status,\n context: options.context\n });\n return error;\n }\n };\n}\nvar NETWORK_ERROR = createBrowserError("NetworkError", "Network request failed");\nvar SECURITY_VIOLATION = createBrowserError("SecurityViolation", "Security violation");\n\n// src/routing/client/page-loader.ts\nvar logger4 = rendererLogger.component("veryfront");\nvar MAX_CACHE_SIZE = 50;\nvar PageLoader = class {\n constructor() {\n __publicField(this, "cache", /* @__PURE__ */ new Map());\n __publicField(this, "spaCache", /* @__PURE__ */ new Map());\n __publicField(this, "pendingRequests", /* @__PURE__ */ new Map());\n __publicField(this, "pendingSpaRequests", /* @__PURE__ */ new Map());\n }\n evictIfFull(map) {\n if (map.size < MAX_CACHE_SIZE) return;\n const oldest = map.keys().next().value;\n if (oldest) map.delete(oldest);\n }\n getCached(path) {\n return this.cache.get(path);\n }\n isCached(path) {\n return this.cache.has(path);\n }\n setCache(path, data) {\n this.evictIfFull(this.cache);\n this.cache.set(path, data);\n }\n clearCache() {\n this.cache.clear();\n this.spaCache.clear();\n this.pendingRequests.clear();\n this.pendingSpaRequests.clear();\n }\n getSpaCached(path) {\n return this.spaCache.get(path);\n }\n isSpaDataCached(path) {\n return this.spaCache.has(path);\n }\n setSpaCache(path, data) {\n this.evictIfFull(this.spaCache);\n this.spaCache.set(path, data);\n }\n async fetchPageData(path) {\n return await this.tryFetchJSON(path) ?? this.fetchAndParseHTML(path);\n }\n async tryFetchJSON(path) {\n try {\n const navigationUrl = new URL(path, "http://veryfront.local");\n const dataPath = navigationUrl.pathname === "/" ? "/index" : navigationUrl.pathname;\n const response = await fetch(`/_veryfront/data${dataPath}.json${navigationUrl.search}`, {\n headers: { "X-Veryfront-Navigation": "client" }\n });\n if (!response.ok) return null;\n return await response.json();\n } catch (error) {\n logger4.debug(`JSON fetch failed for ${path}, falling back to HTML:`, error);\n return null;\n }\n }\n async fetchAndParseHTML(path) {\n const response = await fetch(path, {\n headers: { "X-Veryfront-Navigation": "client" }\n });\n if (!response.ok) {\n throw NETWORK_ERROR.create({\n detail: `Failed to fetch ${path}`,\n status: response.status,\n context: { path }\n });\n }\n const html = await response.text();\n const { content, pageData } = parsePageDataFromHTML(html);\n return { html: content, ...pageData };\n }\n loadPage(path) {\n const cachedData = this.getCached(path);\n if (cachedData) {\n logger4.debug(`Loading ${path} from cache`);\n return Promise.resolve(cachedData);\n }\n const pending = this.pendingRequests.get(path);\n if (pending) {\n logger4.debug(`Reusing pending request for ${path}`);\n return pending;\n }\n logger4.debug(`Creating pending request for ${path}`);\n return this.createPendingRequest(path, this.pendingRequests, async () => {\n const data = await this.fetchPageData(path);\n this.setCache(path, data);\n return data;\n });\n }\n async prefetch(path) {\n if (this.isCached(path)) return;\n logger4.debug(`Prefetching ${path}`);\n try {\n await this.loadPage(path);\n } catch (error) {\n logger4.warn(\n `[Veryfront] Failed to prefetch ${path}`,\n error instanceof Error ? error : new Error(String(error))\n );\n }\n }\n async fetchSpaPageData(path) {\n const navigationUrl = new URL(path, "http://veryfront.local");\n const normalizedPath = navigationUrl.pathname === "/" ? "index" : navigationUrl.pathname.replace(/^\\//, "");\n const endpoint = `/_veryfront/page-data/${normalizedPath}.json${navigationUrl.search}`;\n logger4.debug(`Fetching SPA page data from ${endpoint}`);\n const response = await fetch(endpoint, {\n headers: { "X-Veryfront-Navigation": "spa" }\n });\n if (!response.ok) {\n throw NETWORK_ERROR.create({\n detail: `Failed to fetch SPA page data for ${path}`,\n status: response.status,\n context: { path }\n });\n }\n return response.json();\n }\n loadSpaPageData(path) {\n const cachedData = this.getSpaCached(path);\n if (cachedData) {\n logger4.debug(`Loading SPA data for ${path} from cache`);\n return Promise.resolve(cachedData);\n }\n const pending = this.pendingSpaRequests.get(path);\n if (pending) {\n logger4.debug(`Reusing pending SPA request for ${path}`);\n return pending;\n }\n logger4.debug(`Creating pending SPA request for ${path}`);\n return this.createPendingRequest(path, this.pendingSpaRequests, async () => {\n const data = await this.fetchSpaPageData(path);\n this.setSpaCache(path, data);\n return data;\n });\n }\n async prefetchSpaPageData(path) {\n if (this.isSpaDataCached(path)) return;\n logger4.debug(`Prefetching SPA page data for ${path}`);\n try {\n await this.loadSpaPageData(path);\n } catch (error) {\n logger4.warn(\n `[Veryfront] Failed to prefetch SPA data for ${path}`,\n error instanceof Error ? error : new Error(String(error))\n );\n }\n }\n createPendingRequest(path, pendingMap, fetcher) {\n const request = (async () => {\n try {\n return await fetcher();\n } finally {\n pendingMap.delete(path);\n }\n })();\n pendingMap.set(path, request);\n return request;\n }\n};\n\n// src/security/client/html-sanitizer.ts\nvar SUSPICIOUS_PATTERN_SPECS = [\n { source: String.raw`<script[^>]*>[\\s\\S]*?<\\/script>`, flags: "gi", name: "inline script" },\n { source: String.raw`javascript:`, flags: "gi", name: "javascript: URL" },\n { source: String.raw`\\bon\\w+\\s*=`, flags: "gi", name: "event handler attribute" },\n { source: String.raw`data:\\s*text\\/html`, flags: "gi", name: "data: HTML URL" }\n];\nfunction createSuspiciousPatterns() {\n return SUSPICIOUS_PATTERN_SPECS.map(({ source, flags, name }) => ({\n pattern: new RegExp(source, flags),\n name\n }));\n}\nfunction isDevMode() {\n const g = globalThis;\n return g.__VERYFRONT_DEV__ === true || g.Deno?.env?.get?.("VERYFRONT_ENV") === "development";\n}\nfunction validateTrustedHtml(html, options = {}) {\n const { allowInlineScripts = false, strict = false, warn = true } = options;\n for (const { pattern, name } of createSuspiciousPatterns()) {\n if (allowInlineScripts && name === "inline script") continue;\n pattern.lastIndex = 0;\n if (!pattern.test(html)) continue;\n if (warn) console.warn(`[Security] Suspicious ${name} detected in server HTML`);\n if (strict || !isDevMode()) {\n throw SECURITY_VIOLATION.create({ detail: `Potentially unsafe HTML: ${name} detected` });\n }\n }\n return html;\n}\n\n// src/routing/client/page-transition.ts\nvar logger5 = rendererLogger.component("veryfront");\nvar PageTransition = class {\n constructor(setupViewportPrefetch) {\n __publicField(this, "setupViewportPrefetch", setupViewportPrefetch);\n __publicField(this, "pendingTransitionTimeout");\n }\n destroy() {\n if (this.pendingTransitionTimeout === void 0) return;\n clearTimeout(this.pendingTransitionTimeout);\n this.pendingTransitionTimeout = void 0;\n }\n updatePage(data, isPopState, scrollY) {\n const title = data.frontmatter?.title;\n if (title) document.title = title;\n updateMetaTags(data.frontmatter ?? {});\n const rootElement = document.getElementById("root");\n if (!rootElement || !data.html) return;\n this.performTransition(rootElement, data, isPopState, scrollY);\n }\n performTransition(rootElement, data, isPopState, scrollY) {\n if (this.pendingTransitionTimeout !== void 0) {\n clearTimeout(this.pendingTransitionTimeout);\n this.pendingTransitionTimeout = void 0;\n }\n rootElement.style.opacity = "0";\n this.pendingTransitionTimeout = setTimeout(() => {\n this.pendingTransitionTimeout = void 0;\n rootElement.innerHTML = validateTrustedHtml(String(data.html), { allowInlineScripts: true });\n rootElement.style.opacity = "1";\n executeScripts(rootElement);\n applyHeadDirectives(rootElement);\n this.setupViewportPrefetch(rootElement);\n manageFocus(rootElement);\n this.handleScroll(isPopState, scrollY);\n }, PAGE_TRANSITION_DELAY_MS);\n }\n handleScroll(isPopState, scrollY) {\n try {\n globalThis.scrollTo(0, isPopState ? scrollY : 0);\n } catch (error) {\n logger5.warn("scroll handling failed", error);\n }\n }\n showError(error) {\n const rootElement = document.getElementById("root");\n if (!rootElement) return;\n const errorDiv = document.createElement("div");\n errorDiv.className = "veryfront-error-page";\n const heading = document.createElement("h1");\n heading.textContent = "Oops! Something went wrong";\n const message = document.createElement("p");\n message.textContent = error.message;\n const button = document.createElement("button");\n button.type = "button";\n button.textContent = "Reload Page";\n button.onclick = () => globalThis.location.reload();\n errorDiv.append(heading, message, button);\n rootElement.innerHTML = "";\n rootElement.appendChild(errorDiv);\n }\n setLoadingState(loading) {\n const indicator = document.getElementById("veryfront-loading");\n if (indicator) indicator.style.display = loading ? "block" : "none";\n document.body.classList.toggle("veryfront-loading", loading);\n }\n};\n\n// src/routing/client/viewport-prefetch.ts\nvar logger6 = rendererLogger.component("veryfront");\nvar ViewportPrefetch = class {\n constructor(prefetchCallback, prefetchOptions = {}) {\n __publicField(this, "observer", null);\n __publicField(this, "prefetchCallback");\n __publicField(this, "prefetchOptions");\n this.prefetchCallback = prefetchCallback;\n this.prefetchOptions = prefetchOptions;\n }\n setup(root) {\n try {\n if (!("IntersectionObserver" in globalThis)) return;\n this.observer?.disconnect();\n this.createObserver();\n this.observeLinks(root);\n } catch (error) {\n logger6.debug("setupViewportPrefetch failed", error);\n }\n }\n createObserver() {\n this.observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n if (!entry.isIntersecting) continue;\n if (!(entry.target instanceof HTMLAnchorElement)) continue;\n const href = entry.target.getAttribute("href");\n if (href) this.prefetchCallback(href);\n this.observer?.unobserve(entry.target);\n }\n },\n { rootMargin: "200px" }\n );\n }\n observeLinks(root) {\n const anchors = root.querySelectorAll(\'a[href]:not([target="_blank"])\');\n const isViewportEnabled = Boolean(this.prefetchOptions.viewport);\n for (const anchor of anchors) {\n if (!this.shouldObserveAnchor(anchor, isViewportEnabled)) continue;\n this.observer?.observe(anchor);\n }\n }\n shouldObserveAnchor(anchor, isViewportEnabled) {\n const href = anchor.getAttribute("href");\n if (!href) return false;\n if (href.startsWith("http") || href.startsWith("#")) return false;\n if (anchor.getAttribute("download")) return false;\n const prefetchAttribute = anchor.getAttribute("data-prefetch");\n if (prefetchAttribute === "false") return false;\n return prefetchAttribute === "viewport" || isViewportEnabled;\n }\n disconnect() {\n if (!this.observer) return;\n try {\n this.observer.disconnect();\n } catch (error) {\n logger6.warn("prefetchObserver.disconnect failed", error);\n } finally {\n this.observer = null;\n }\n }\n};\n\n// src/rendering/client/router.ts\nvar logger7 = rendererLogger.component("veryfront");\nfunction toHistoryMode(options) {\n if (typeof options === "boolean") return options ? "push" : "none";\n return options?.history ?? "push";\n}\nvar VeryfrontRouter = class {\n constructor(options = {}) {\n __publicField(this, "baseUrl");\n __publicField(this, "currentPath");\n __publicField(this, "root", null);\n __publicField(this, "options");\n __publicField(this, "spaMode");\n __publicField(this, "spaNavigationHandler", null);\n __publicField(this, "navigationSequence", 0);\n __publicField(this, "pageLoader");\n __publicField(this, "navigationHandlers");\n __publicField(this, "pageTransition");\n __publicField(this, "viewportPrefetch");\n __publicField(this, "handleClick");\n __publicField(this, "handlePopState");\n __publicField(this, "handleMouseOver");\n const globalOptions = this.loadGlobalOptions();\n this.options = { ...globalOptions, ...options };\n this.baseUrl = this.options.baseUrl || globalThis.location.origin;\n this.currentPath = `${globalThis.location.pathname}${globalThis.location.search}${globalThis.location.hash}`;\n this.spaMode = this.options.spaMode ?? globalThis.__VERYFRONT_SPA_MODE__ ?? false;\n this.pageLoader = new PageLoader();\n this.navigationHandlers = new NavigationHandlers(\n this.options.prefetchDelay,\n this.options.prefetch\n );\n this.pageTransition = new PageTransition((root) => this.viewportPrefetch.setup(root));\n this.viewportPrefetch = new ViewportPrefetch(\n (path) => this.prefetch(path),\n this.options.prefetch\n );\n this.handleClick = this.navigationHandlers.createClickHandler({\n onNavigate: (url) => this.navigate(url),\n onPrefetch: (url) => this.prefetch(url)\n });\n this.handlePopState = this.navigationHandlers.createPopStateHandler({\n // The browser already updated the URL for a popstate, so don\'t touch history.\n onNavigate: (url) => this.navigate(url, { history: "none" }),\n onPrefetch: (url) => this.prefetch(url)\n });\n this.handleMouseOver = this.navigationHandlers.createMouseOverHandler({\n onNavigate: (url) => this.navigate(url),\n onPrefetch: (url) => this.prefetch(url)\n });\n getNavigationStore().setNavigator((href, options2) => this.navigate(href, options2));\n }\n registerNavigationHandler(handler) {\n logger7.debug("Registering SPA navigation handler");\n this.spaNavigationHandler = handler;\n this.spaMode = true;\n }\n /**\n * Notify React (and any other) subscribers that a navigation completed —\n * after full page loads, soft same-route changes, and popstate. Delegates to\n * the shared navigation store, the single subscription surface both bundles\n * share.\n */\n notify() {\n getNavigationStore().notify();\n }\n pathnameOf(url) {\n try {\n return new URL(url, this.baseUrl).pathname;\n } catch {\n return url.split("?")[0]?.split("#")[0] || this.currentPath;\n }\n }\n loadGlobalOptions() {\n try {\n const options = globalThis.__VERYFRONT_ROUTER_OPTS__;\n if (!options) {\n logger7.debug("No global options configured");\n return {};\n }\n return options;\n } catch (error) {\n logger7.error("Failed to read global options:", error);\n return {};\n }\n }\n init() {\n logger7.debug("Initializing client-side router");\n const rootElement = document.getElementById("root");\n if (!rootElement) {\n logger7.error("Root element not found");\n return;\n }\n const ReactDOMToUse = globalThis.ReactDOM ?? ReactDOM;\n this.root = ReactDOMToUse.createRoot(rootElement);\n document.addEventListener("click", this.handleClick);\n globalThis.addEventListener("popstate", this.handlePopState);\n document.addEventListener("mouseover", this.handleMouseOver);\n this.viewportPrefetch.setup(document);\n this.cacheCurrentPage();\n }\n cacheCurrentPage() {\n const pageData = extractPageDataFromScript();\n if (pageData) this.pageLoader.setCache(this.currentPath, pageData);\n }\n /**\n * Navigate to a URL. `options` selects the history behaviour: `{ history:\n * "push" }` (default), `"replace"`, or `"none"` (the URL already reflects the\n * target, as after popstate). A boolean is accepted for backward\n * compatibility — `true` pushes, `false` maps to `"none"`.\n */\n async navigate(url, options) {\n logger7.debug(`Navigating to ${url} (SPA mode: ${this.spaMode})`);\n const navigationId = ++this.navigationSequence;\n this.pageTransition.setLoadingState(false);\n const history = toHistoryMode(options);\n const sameRoute = this.pathnameOf(url) === this.pathnameOf(this.currentPath);\n this.navigationHandlers.saveScrollPosition(this.currentPath);\n this.options.onStart?.(url);\n if (history === "replace") globalThis.history.replaceState({}, "", url);\n else if (history === "push") globalThis.history.pushState({}, "", url);\n if (sameRoute && !this.shouldRevalidate(url, sameRoute)) {\n if (!this.isCurrentNavigation(navigationId)) return;\n this.currentPath = url;\n this.notify();\n this.options.onComplete?.(url);\n this.options.onNavigate?.(url);\n return;\n }\n if (this.spaMode && this.spaNavigationHandler) {\n await this.loadSpaPage(url, navigationId);\n } else {\n await this.loadPage(url, true, navigationId);\n }\n if (!this.isCurrentNavigation(navigationId)) return;\n this.notify();\n this.options.onNavigate?.(url);\n }\n isCurrentNavigation(navigationId) {\n return navigationId === this.navigationSequence;\n }\n /**\n * Whether a navigation should refetch page data. A route change always does;\n * a same-route (query/hash-only) change consults `options.shouldRevalidate`,\n * defaulting to `true` so server data is never shown stale.\n */\n shouldRevalidate(nextUrl, sameRoute) {\n const policy = this.options.shouldRevalidate;\n if (!policy) return true;\n return policy({ currentHref: this.currentPath, nextHref: nextUrl, sameRoute });\n }\n async loadSpaPage(path, navigationId) {\n logger7.debug(`Loading SPA page: ${path}`);\n try {\n const spaData = await this.pageLoader.loadSpaPageData(path);\n if (!this.isCurrentNavigation(navigationId)) return;\n await this.spaNavigationHandler?.(spaData);\n if (!this.isCurrentNavigation(navigationId)) return;\n this.currentPath = path;\n this.handleScrollAfterNavigation();\n this.options.onComplete?.(path);\n } catch (error) {\n if (!this.isCurrentNavigation(navigationId)) return;\n const normalizedError = error instanceof Error ? error : new Error(String(error));\n logger7.error(`Failed to load SPA page ${path}`, normalizedError);\n this.options.onError?.(normalizedError);\n this.pageTransition.showError(normalizedError);\n }\n }\n handleScrollAfterNavigation() {\n const isPopState = this.navigationHandlers.isPopState();\n const scrollY = this.navigationHandlers.getScrollPosition(this.currentPath);\n try {\n globalThis.scrollTo(0, isPopState ? scrollY : 0);\n } catch (error) {\n logger7.warn("scroll handling failed", error);\n }\n this.navigationHandlers.clearPopStateFlag();\n }\n async loadPage(path, updateUI = true, navigationId) {\n if (this.pageLoader.isCached(path)) {\n logger7.debug(`Loading ${path} from cache`);\n const data = this.pageLoader.getCached(path);\n if (data) {\n if (!this.isCurrentNavigation(navigationId)) return;\n if (updateUI) this.updatePage(data, path);\n this.currentPath = path;\n this.pageTransition.setLoadingState(false);\n this.options.onComplete?.(path);\n return;\n }\n logger7.warn(`Cache entry for ${path} was unexpectedly null, fetching fresh data`);\n }\n this.pageTransition.setLoadingState(true);\n try {\n const data = await this.pageLoader.loadPage(path);\n if (!this.isCurrentNavigation(navigationId)) return;\n if (updateUI) this.updatePage(data, path);\n this.currentPath = path;\n this.options.onComplete?.(path);\n } catch (error) {\n if (!this.isCurrentNavigation(navigationId)) return;\n const normalizedError = error instanceof Error ? error : new Error(String(error));\n logger7.error(`Failed to load ${path}`, normalizedError);\n this.options.onError?.(normalizedError);\n this.pageTransition.showError(normalizedError);\n } finally {\n if (this.isCurrentNavigation(navigationId)) this.pageTransition.setLoadingState(false);\n }\n }\n async prefetch(path) {\n if (this.spaMode) {\n await this.pageLoader.prefetchSpaPageData(path);\n return;\n }\n await this.pageLoader.prefetch(path);\n }\n updatePage(data, targetPath) {\n if (!this.root) return;\n const isPopState = this.navigationHandlers.isPopState();\n const scrollY = this.navigationHandlers.getScrollPosition(targetPath);\n this.pageTransition.updatePage(data, isPopState, scrollY);\n this.navigationHandlers.clearPopStateFlag();\n }\n destroy() {\n this.navigationSequence++;\n this.pageTransition.setLoadingState(false);\n document.removeEventListener("click", this.handleClick);\n globalThis.removeEventListener("popstate", this.handlePopState);\n document.removeEventListener("mouseover", this.handleMouseOver);\n this.viewportPrefetch.disconnect();\n this.pageLoader.clearCache();\n this.navigationHandlers.clear();\n this.pageTransition.destroy();\n }\n};\nfunction boot(options = {}) {\n if (typeof window === "undefined" || !globalThis.document) return null;\n const globalWithRouter = globalThis;\n if (globalWithRouter.veryFrontRouter) return globalWithRouter.veryFrontRouter;\n const { slug: _slug, ...routerOptions } = options;\n const router = new VeryfrontRouter(routerOptions);\n if (document.readyState === "loading") {\n document.addEventListener("DOMContentLoaded", () => router.init(), { once: true });\n } else {\n router.init();\n }\n globalWithRouter.veryFrontRouter = router;\n return router;\n}\nif (typeof window !== "undefined" && globalThis.document) {\n boot();\n}\nexport {\n VeryfrontRouter,\n boot\n};\n';
11
11
  export const CLIENT_PREFETCH_BUNDLE = 'var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);\n\n// src/rendering/client/browser-logger.ts\nvar ConditionalBrowserLogger = class {\n constructor(prefix, level) {\n __publicField(this, "prefix", prefix);\n __publicField(this, "level", level);\n }\n log(minLevel, fn, message, ...args) {\n if (this.level > minLevel) return;\n fn?.(message, ...args);\n }\n debug(message, ...args) {\n this.log(\n 0 /* DEBUG */,\n console.debug,\n `[${this.prefix}] DEBUG: ${message}`,\n ...args\n );\n }\n info(message, ...args) {\n this.log(1 /* INFO */, console.log, `[${this.prefix}] ${message}`, ...args);\n }\n warn(message, ...args) {\n this.log(\n 2 /* WARN */,\n console.warn,\n `[${this.prefix}] WARN: ${message}`,\n ...args\n );\n }\n error(message, ...args) {\n this.log(\n 3 /* ERROR */,\n console.error,\n `[${this.prefix}] ERROR: ${message}`,\n ...args\n );\n }\n};\nfunction getBrowserLogLevel() {\n if (typeof window === "undefined") return 2 /* WARN */;\n const g = globalThis;\n const isDevelopment = g.__VERYFRONT_DEV__ || g.__RSC_DEV__;\n if (!isDevelopment) return 2 /* WARN */;\n const isDebugEnabled2 = g.__VERYFRONT_DEBUG__ || g.__RSC_DEBUG__;\n return isDebugEnabled2 ? 0 /* DEBUG */ : 1 /* INFO */;\n}\nvar defaultLevel = getBrowserLogLevel();\nvar rscLogger = new ConditionalBrowserLogger("RSC", defaultLevel);\nvar prefetchLogger = new ConditionalBrowserLogger("PREFETCH", defaultLevel);\nvar hydrateLogger = new ConditionalBrowserLogger("HYDRATE", defaultLevel);\nvar browserLogger = new ConditionalBrowserLogger("VERYFRONT", defaultLevel);\n\n// src/rendering/client/prefetch/link-observer.ts\nfunction isAnchorElement(element) {\n return typeof HTMLAnchorElement !== "undefined" ? element instanceof HTMLAnchorElement : element.tagName === "A";\n}\nvar LinkObserver = class {\n constructor(options, prefetchedUrls) {\n __publicField(this, "options");\n __publicField(this, "intersectionObserver", null);\n __publicField(this, "mutationObserver", null);\n __publicField(this, "prefetchedUrls");\n __publicField(this, "pendingTimeouts", /* @__PURE__ */ new Map());\n __publicField(this, "elementTimeoutMap", /* @__PURE__ */ new WeakMap());\n __publicField(this, "timeoutCounter", 0);\n this.options = options;\n this.prefetchedUrls = prefetchedUrls;\n }\n init() {\n this.createIntersectionObserver();\n this.observeLinks();\n this.setupMutationObserver();\n }\n createIntersectionObserver() {\n this.intersectionObserver = new IntersectionObserver(\n (entries) => this.handleIntersection(entries),\n { rootMargin: this.options.rootMargin }\n );\n }\n handleIntersection(entries) {\n for (const entry of entries) {\n if (!entry.isIntersecting) continue;\n if (!isAnchorElement(entry.target)) continue;\n const link = entry.target;\n if (this.timeoutCounter > 1e6) this.timeoutCounter = 0;\n const timeoutKey = this.timeoutCounter++;\n const timeoutId = setTimeout(() => {\n this.pendingTimeouts.delete(timeoutKey);\n this.elementTimeoutMap.delete(link);\n this.options.onLinkVisible(link);\n }, this.options.delay);\n this.pendingTimeouts.set(timeoutKey, timeoutId);\n this.elementTimeoutMap.set(link, timeoutKey);\n }\n }\n observeLinks() {\n this.observeAnchors(document.querySelectorAll(\'a[href^="/"], a[href^="./"]\'));\n }\n setupMutationObserver() {\n this.mutationObserver = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type !== "childList") continue;\n for (const node of mutation.addedNodes) {\n if (node.nodeType !== Node.ELEMENT_NODE) continue;\n this.observeElement(node);\n }\n for (const node of mutation.removedNodes) {\n if (node.nodeType !== Node.ELEMENT_NODE) continue;\n this.clearElementTimeouts(node);\n }\n }\n });\n this.mutationObserver.observe(document.body, { childList: true, subtree: true });\n }\n clearTimeoutForElement(element) {\n const timeoutKey = this.elementTimeoutMap.get(element);\n if (timeoutKey === void 0) return;\n const timeoutId = this.pendingTimeouts.get(timeoutKey);\n if (timeoutId !== void 0) {\n clearTimeout(timeoutId);\n this.pendingTimeouts.delete(timeoutKey);\n }\n this.elementTimeoutMap.delete(element);\n }\n clearElementTimeouts(element) {\n if (isAnchorElement(element)) this.clearTimeoutForElement(element);\n for (const link of element.querySelectorAll("a")) {\n this.clearTimeoutForElement(link);\n }\n }\n observeElement(element) {\n if (isAnchorElement(element) && this.isValidLink(element)) {\n this.intersectionObserver?.observe(element);\n }\n this.observeAnchors(element.querySelectorAll(\'a[href^="/"], a[href^="./"]\'));\n }\n observeAnchors(links) {\n for (const link of links) {\n if (!isAnchorElement(link)) continue;\n if (!this.isValidLink(link)) continue;\n this.intersectionObserver?.observe(link);\n }\n }\n isValidLink(link) {\n if (link.hostname !== globalThis.location.hostname) return false;\n if (link.hasAttribute("download")) return false;\n if (link.target === "_blank") return false;\n const url = link.href;\n if (this.prefetchedUrls.has(url)) return false;\n if (url === globalThis.location.href) return false;\n if (link.hash && link.pathname === globalThis.location.pathname) return false;\n if (link.dataset.noPrefetch) return false;\n return true;\n }\n destroy() {\n for (const timeoutId of this.pendingTimeouts.values()) {\n clearTimeout(timeoutId);\n }\n this.pendingTimeouts.clear();\n this.timeoutCounter = 0;\n this.intersectionObserver?.disconnect();\n this.intersectionObserver = null;\n this.mutationObserver?.disconnect();\n this.mutationObserver = null;\n }\n};\n\n// src/rendering/client/prefetch/network-utils.ts\nvar NetworkUtils = class {\n constructor(allowedNetworks = ["4g", "wifi", "ethernet"]) {\n __publicField(this, "networkInfo");\n __publicField(this, "allowedNetworks");\n this.allowedNetworks = allowedNetworks;\n this.networkInfo = this.getNetworkConnection();\n }\n getNavigatorWithConnection() {\n if (typeof globalThis.navigator === "undefined") return null;\n return globalThis.navigator;\n }\n getNetworkConnection() {\n const nav = this.getNavigatorWithConnection();\n return nav?.connection ?? nav?.mozConnection ?? nav?.webkitConnection ?? null;\n }\n shouldPrefetch() {\n if (this.networkInfo?.saveData) return false;\n const effectiveType = this.networkInfo?.effectiveType;\n if (effectiveType != null && !this.allowedNetworks.includes(effectiveType)) return false;\n return true;\n }\n onNetworkChange(callback) {\n this.networkInfo?.addEventListener?.("change", callback);\n }\n getNetworkInfo() {\n return this.networkInfo;\n }\n};\n\n// src/utils/constants/buffers.ts\nvar DEFAULT_MAX_BODY_SIZE_BYTES = 1024 * 1024;\nvar DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;\nvar PREFETCH_QUEUE_MAX_SIZE_BYTES = DEFAULT_MAX_BODY_SIZE_BYTES;\nvar MAX_BUNDLE_CHUNK_SIZE_BYTES = 4096 * 1024;\n\n// src/utils/constants/cache.ts\nvar SECONDS_PER_MINUTE = 60;\nvar MINUTES_PER_HOUR = 60;\nvar HOURS_PER_DAY = 24;\nvar MS_PER_SECOND = 1e3;\nvar MS_PER_MINUTE = SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar MS_PER_HOUR = MINUTES_PER_HOUR * MS_PER_MINUTE;\nvar ONE_DAY_MS = HOURS_PER_DAY * MS_PER_HOUR;\nfunction getEnvString(key) {\n const g = globalThis;\n try {\n return g.Deno?.env?.get?.(key) ?? g.process?.env?.[key];\n } catch (_) {\n return void 0;\n }\n}\nfunction getEnvNumber(key, fallback) {\n const value = getEnvString(key);\n if (value == null) return fallback;\n const parsed = Number.parseInt(value, 10);\n if (Number.isNaN(parsed)) return fallback;\n return parsed;\n}\nvar DEFAULT_LRU_MAX_ENTRIES = getEnvNumber("LRU_DEFAULT_MAX_ENTRIES", 100);\nvar COMPONENT_LOADER_MAX_ENTRIES = getEnvNumber("COMPONENT_LOADER_MAX_ENTRIES", 200);\nvar COMPONENT_LOADER_TTL_MS = 10 * MS_PER_MINUTE;\nvar MDX_RENDERER_MAX_ENTRIES = getEnvNumber("MDX_RENDERER_MAX_ENTRIES", 500);\nvar MDX_RENDERER_TTL_MS = 10 * MS_PER_MINUTE;\nvar RENDERER_CORE_MAX_ENTRIES = getEnvNumber("RENDERER_CORE_MAX_ENTRIES", 200);\nvar RENDERER_CORE_TTL_MS = 5 * MS_PER_MINUTE;\nvar TSX_LAYOUT_MAX_ENTRIES = getEnvNumber("TSX_LAYOUT_MAX_ENTRIES", 100);\nvar TSX_LAYOUT_TTL_MS = 10 * MS_PER_MINUTE;\nvar TSX_LAYOUT_PER_PROJECT_MAX_ENTRIES = getEnvNumber(\n "TSX_LAYOUT_PER_PROJECT_MAX_ENTRIES",\n Math.ceil(TSX_LAYOUT_MAX_ENTRIES / 10)\n);\nvar DATA_FETCHING_MAX_ENTRIES = getEnvNumber("DATA_FETCHING_MAX_ENTRIES", 500);\nvar DATA_FETCHING_TTL_MS = 10 * MS_PER_MINUTE;\nvar MDX_CACHE_TTL_DEVELOPMENT_MS = 5 * MS_PER_MINUTE;\nvar BUNDLE_CACHE_TTL_DEVELOPMENT_MS = 5 * MS_PER_MINUTE;\nvar BUNDLE_MANIFEST_PROD_TTL_MS = 7 * ONE_DAY_MS;\nvar SERVER_ACTION_DEFAULT_TTL_SEC = MINUTES_PER_HOUR * SECONDS_PER_MINUTE;\nvar DISTRIBUTED_SSR_MODULE_TTL_PRODUCTION_SEC = getEnvNumber(\n "DISTRIBUTED_SSR_MODULE_TTL_SEC",\n 6 * MINUTES_PER_HOUR * SECONDS_PER_MINUTE\n);\nvar DISTRIBUTED_SSR_MODULE_TTL_PREVIEW_SEC = getEnvNumber(\n "DISTRIBUTED_SSR_MODULE_TTL_PREVIEW_SEC",\n 10 * SECONDS_PER_MINUTE\n);\nvar DISTRIBUTED_TRANSFORM_TTL_PRODUCTION_SEC = getEnvNumber(\n "DISTRIBUTED_TRANSFORM_TTL_SEC",\n 6 * MINUTES_PER_HOUR * SECONDS_PER_MINUTE\n);\nvar DISTRIBUTED_TRANSFORM_TTL_PREVIEW_SEC = getEnvNumber(\n "DISTRIBUTED_TRANSFORM_TTL_PREVIEW_SEC",\n 10 * SECONDS_PER_MINUTE\n);\nvar DISTRIBUTED_FILE_TTL_PRODUCTION_SEC = getEnvNumber(\n "DISTRIBUTED_FILE_TTL_SEC",\n MINUTES_PER_HOUR * SECONDS_PER_MINUTE\n);\nvar DISTRIBUTED_FILE_TTL_PREVIEW_SEC = getEnvNumber(\n "DISTRIBUTED_FILE_TTL_PREVIEW_SEC",\n 5 * SECONDS_PER_MINUTE\n);\nvar DISTRIBUTED_CSS_TTL_PRODUCTION_SEC = getEnvNumber(\n "DISTRIBUTED_CSS_TTL_SEC",\n 6 * MINUTES_PER_HOUR * SECONDS_PER_MINUTE\n);\nvar DISTRIBUTED_CSS_TTL_PREVIEW_SEC = getEnvNumber(\n "DISTRIBUTED_CSS_TTL_PREVIEW_SEC",\n 10 * SECONDS_PER_MINUTE\n);\nvar LRU_DEFAULT_MAX_ENTRIES_V2 = getEnvNumber("LRU_MAX_ENTRIES", 2e3);\nvar LRU_DEFAULT_MAX_SIZE_BYTES = getEnvNumber("LRU_MAX_SIZE_MB", 200) * 1024 * 1024;\nvar MEMORY_CACHE_MAX_ENTRIES = getEnvNumber("MEMORY_CACHE_MAX_ENTRIES", 2e3);\nvar MEMORY_CACHE_MAX_SIZE_BYTES = getEnvNumber("MEMORY_CACHE_MAX_SIZE_MB", 50) * 1024 * 1024;\nvar FILE_CACHE_MAX_ENTRIES = getEnvNumber("FILE_CACHE_MAX_ENTRIES", 1e3);\nvar FILE_CACHE_MAX_SIZE_MB = getEnvNumber("FILE_CACHE_MAX_SIZE_MB", 100);\nvar MAX_CONCURRENT_REVALIDATIONS = getEnvNumber("MAX_CONCURRENT_REVALIDATIONS", 32);\nvar MAX_CONCURRENT_HTTP_FETCHES = getEnvNumber("MAX_CONCURRENT_HTTP_FETCHES", 50);\nvar REVALIDATION_TIMEOUT_MS = getEnvNumber("REVALIDATION_TIMEOUT_MS", 15e3);\nvar REVALIDATION_PER_PROJECT_LIMIT = getEnvNumber(\n "REVALIDATION_PER_PROJECT_LIMIT",\n Math.ceil(MAX_CONCURRENT_REVALIDATIONS / 3)\n);\nvar BUNDLE_MANIFEST_DISTRIBUTED_TTL_SEC = getEnvNumber(\n "BUNDLE_MANIFEST_DISTRIBUTED_TTL_SEC",\n HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE\n // 24 hours (86400)\n);\nvar BUNDLE_MANIFEST_LRU_MAX_ENTRIES = getEnvNumber(\n "BUNDLE_MANIFEST_LRU_MAX_ENTRIES",\n 5e3\n);\nvar HTTP_MODULE_CACHE_MAX_ENTRIES = getEnvNumber("HTTP_MODULE_CACHE_MAX_ENTRIES", 2e3);\nvar HTTP_MODULE_DISTRIBUTED_TTL_SEC = getEnvNumber(\n "HTTP_MODULE_DISTRIBUTED_TTL_SEC",\n HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE\n // 24 hours (86400)\n);\nvar TRANSFORM_DISTRIBUTED_TTL_SEC = getEnvNumber(\n "TRANSFORM_DISTRIBUTED_TTL_SEC",\n 6 * MINUTES_PER_HOUR * SECONDS_PER_MINUTE\n // 6 hours (21600)\n);\nvar MODULE_CACHE_MAX_ENTRIES = getEnvNumber("MODULE_CACHE_MAX_ENTRIES", 1e4);\nvar MODULE_CACHE_TTL_MS = getEnvNumber(\n "MODULE_CACHE_TTL_MS",\n 5 * MS_PER_MINUTE\n // 5 minutes - short enough to pick up changes, long enough to cache\n);\nvar ESM_CACHE_MAX_ENTRIES = getEnvNumber("ESM_CACHE_MAX_ENTRIES", 5e3);\nvar ESM_CACHE_TTL_MS = getEnvNumber(\n "ESM_CACHE_TTL_MS",\n 10 * MS_PER_MINUTE\n // 10 minutes - external modules change less frequently\n);\n\n// src/utils/constants/http.ts\nvar KB_IN_BYTES = 1024;\nvar PREFETCH_MAX_SIZE_BYTES = 200 * KB_IN_BYTES;\n\n// src/utils/constants/hmr.ts\nvar HMR_MAX_MESSAGE_SIZE_BYTES = 1024 * KB_IN_BYTES;\n\n// src/utils/constants/network.ts\nvar BYTES_PER_KB = 1024;\nvar BYTES_PER_MB = BYTES_PER_KB * BYTES_PER_KB;\n\n// src/utils/constants/server.ts\nvar INTERNAL_PREFIX = "/_veryfront";\nvar INTERNAL_PATH_PREFIXES = {\n /** React Server Components endpoints */\n RSC: `${INTERNAL_PREFIX}/rsc/`,\n /** File system access endpoints (base64 encoded paths) */\n FS: `${INTERNAL_PREFIX}/fs/`,\n /** Virtual module system */\n MODULES: `${INTERNAL_PREFIX}/modules/`,\n /** Generated page modules */\n PAGES: `${INTERNAL_PREFIX}/pages/`,\n /** Data JSON endpoints */\n DATA: `${INTERNAL_PREFIX}/data/`,\n /** Library modules and large vendor surfaces */\n LIB: `${INTERNAL_PREFIX}/lib/`,\n /** Chunk assets */\n CHUNKS: `${INTERNAL_PREFIX}/chunks/`,\n /** Client component modules */\n CLIENT: `${INTERNAL_PREFIX}/client/`\n};\nvar INTERNAL_ENDPOINTS = {\n // Development endpoints\n HMR_RUNTIME: `${INTERNAL_PREFIX}/hmr-runtime.js`,\n HMR: `${INTERNAL_PREFIX}/hmr.js`,\n ERROR_OVERLAY: `${INTERNAL_PREFIX}/error-overlay.js`,\n // Legacy endpoint retained for backward compatibility (no active handler).\n DEV_LOADER: `${INTERNAL_PREFIX}/dev-loader.js`,\n CLIENT_LOG: `${INTERNAL_PREFIX}/log`,\n // Production endpoints\n CLIENT_JS: `${INTERNAL_PREFIX}/client.js`,\n ROUTER_JS: `${INTERNAL_PREFIX}/router.js`,\n PREFETCH_JS: `${INTERNAL_PREFIX}/prefetch.js`,\n MANIFEST_JSON: `${INTERNAL_PREFIX}/manifest.json`,\n APP_JS: `${INTERNAL_PREFIX}/app.js`,\n // RSC endpoints\n RSC_CLIENT: `${INTERNAL_PREFIX}/rsc/client.js`,\n RSC_MANIFEST: `${INTERNAL_PREFIX}/rsc/manifest`,\n RSC_STREAM: `${INTERNAL_PREFIX}/rsc/stream`,\n RSC_PAYLOAD: `${INTERNAL_PREFIX}/rsc/payload`,\n RSC_RENDER: `${INTERNAL_PREFIX}/rsc/render`,\n RSC_PAGE: `${INTERNAL_PREFIX}/rsc/page`,\n RSC_MODULE: `${INTERNAL_PREFIX}/rsc/module`,\n RSC_DOM: `${INTERNAL_PREFIX}/rsc/dom.js`,\n // Library module endpoints\n LIB_CHAT_REACT: `${INTERNAL_PREFIX}/lib/chat/react.js`,\n LIB_CHAT_COMPONENTS: `${INTERNAL_PREFIX}/lib/chat/components.js`,\n LIB_CHAT_PRIMITIVES: `${INTERNAL_PREFIX}/lib/chat/primitives.js`\n};\nvar PROJECT_DIRS = {\n /** Base veryfront internal directory */\n ROOT: ".veryfront",\n /** Cache directory for build artifacts, transforms, etc. */\n CACHE: ".veryfront/cache",\n /** KV store directory */\n KV: ".veryfront/kv",\n /** Log files directory */\n LOGS: ".veryfront/logs",\n /** Temporary files directory */\n TMP: ".veryfront/tmp"\n};\nvar DEFAULT_CACHE_DIR = PROJECT_DIRS.CACHE;\nvar DEV_SERVER_ENDPOINTS = {\n HMR_RUNTIME: INTERNAL_ENDPOINTS.HMR_RUNTIME,\n ERROR_OVERLAY: INTERNAL_ENDPOINTS.ERROR_OVERLAY\n};\n\n// src/rendering/client/prefetch/prefetch-queue.ts\nvar DEFAULT_OPTIONS = {\n maxConcurrent: 4,\n maxSize: PREFETCH_QUEUE_MAX_SIZE_BYTES,\n timeout: 5e3\n};\nfunction isAbortError(error) {\n if (typeof error !== "object" || error === null) return false;\n if (!("name" in error)) return false;\n return error.name === "AbortError";\n}\nvar PrefetchQueue = class {\n constructor(options = {}, prefetchedUrls) {\n __publicField(this, "options");\n __publicField(this, "controllers", /* @__PURE__ */ new Map());\n __publicField(this, "prefetchedUrls");\n __publicField(this, "concurrent", 0);\n __publicField(this, "stopped", false);\n __publicField(this, "onResourcesFetched");\n this.options = { ...DEFAULT_OPTIONS, ...options };\n this.prefetchedUrls = prefetchedUrls ?? /* @__PURE__ */ new Set();\n }\n setResourceCallback(callback) {\n this.onResourcesFetched = callback;\n }\n enqueue(url) {\n void this.prefetch(url);\n }\n has(url) {\n return this.prefetchedUrls.has(url) || this.controllers.has(url);\n }\n get size() {\n return this.controllers.size;\n }\n clear() {\n this.stopAll();\n this.prefetchedUrls.clear();\n }\n start() {\n this.stopped = false;\n }\n stop() {\n this.stopped = true;\n this.stopAll();\n }\n getQueueSize() {\n return this.controllers.size;\n }\n getConcurrentCount() {\n return this.concurrent;\n }\n async prefetchLink(link) {\n if (this.stopped) return;\n const url = link.href;\n if (!url || this.controllers.has(url) || this.prefetchedUrls.has(url)) return;\n if (this.concurrent >= this.options.maxConcurrent) {\n prefetchLogger.debug?.(`Prefetch queue full, skipping ${url}`);\n return;\n }\n let parsedUrl;\n try {\n parsedUrl = new URL(url);\n } catch (_) {\n prefetchLogger.debug?.(`Invalid prefetch URL ${url}`);\n return;\n }\n const controller = new AbortController();\n this.controllers.set(url, controller);\n this.concurrent += 1;\n const timeoutId = this.options.timeout > 0 ? setTimeout(() => controller.abort(), this.options.timeout) : void 0;\n try {\n const response = await fetch(parsedUrl.toString(), {\n method: "GET",\n signal: controller.signal,\n headers: { "X-Veryfront-Prefetch": "1" }\n });\n if (!response.ok) return;\n if (this.isResponseTooLarge(response)) {\n prefetchLogger.debug?.(`Prefetch too large, skipping ${url}`);\n return;\n }\n this.prefetchedUrls.add(url);\n if (!this.onResourcesFetched) return;\n try {\n await this.onResourcesFetched(response, url);\n } catch (callbackError) {\n prefetchLogger.error?.(`Prefetch callback failed for ${url}`, callbackError);\n }\n } catch (error) {\n if (!isAbortError(error)) {\n prefetchLogger.error?.(`Failed to prefetch ${url}`, error);\n }\n } finally {\n if (timeoutId !== void 0) clearTimeout(timeoutId);\n this.controllers.delete(url);\n this.concurrent = Math.max(0, this.concurrent - 1);\n }\n }\n async prefetch(url) {\n const link = typeof document !== "undefined" ? document.createElement("a") : { href: url };\n link.href = url;\n await this.prefetchLink(link);\n }\n stopAll() {\n for (const controller of this.controllers.values()) {\n controller.abort();\n }\n this.controllers.clear();\n this.concurrent = 0;\n }\n isResponseTooLarge(response) {\n const rawLength = response.headers.get("content-length");\n if (rawLength === null) return false;\n const size = Number.parseInt(rawLength, 10);\n if (!Number.isFinite(size)) return false;\n return size > this.options.maxSize;\n }\n};\nvar prefetchQueue = new PrefetchQueue();\n\n// src/rendering/client/prefetch/resource-hints.ts\nvar ResourceHintsManager = class {\n constructor() {\n __publicField(this, "appliedHints", /* @__PURE__ */ new Set());\n }\n applyResourceHints(hints) {\n for (const hint of hints) {\n const key = `${hint.type}:${hint.href}`;\n if (this.appliedHints.has(key)) continue;\n const existing = document.querySelector(\n `link[rel="${hint.type}"][href="${hint.href}"]`\n );\n if (existing) {\n this.appliedHints.add(key);\n continue;\n }\n this.createAndAppendHint(hint);\n this.appliedHints.add(key);\n prefetchLogger.debug(`Added resource hint: ${hint.type} ${hint.href}`);\n }\n }\n createAndAppendHint(hint) {\n if (!document.head) {\n prefetchLogger.warn("document.head is not available, skipping resource hint");\n return;\n }\n const link = document.createElement("link");\n link.rel = hint.type;\n link.href = hint.href;\n if (hint.as) link.setAttribute("as", hint.as);\n if (hint.crossOrigin) link.setAttribute("crossorigin", hint.crossOrigin);\n if (hint.media) link.setAttribute("media", hint.media);\n document.head.appendChild(link);\n }\n extractResourceHints(html, prefetchedUrls) {\n try {\n const doc = new DOMParser().parseFromString(html, "text/html");\n const hints = [];\n this.extractPreloadLinks(doc, prefetchedUrls, hints);\n this.extractScripts(doc, prefetchedUrls, hints);\n this.extractStylesheets(doc, prefetchedUrls, hints);\n return hints;\n } catch (error) {\n prefetchLogger.error("Failed to parse prefetched page", error);\n return [];\n }\n }\n isValidResourceHintType(rel) {\n switch (rel) {\n case "prefetch":\n case "preload":\n case "preconnect":\n case "dns-prefetch":\n return true;\n default:\n return false;\n }\n }\n extractPreloadLinks(doc, prefetchedUrls, hints) {\n const links = doc.querySelectorAll(\n \'link[rel="preload"], link[rel="prefetch"]\'\n );\n for (const link of links) {\n const href = link.href;\n if (!href) continue;\n if (prefetchedUrls.has(href)) continue;\n if (!this.isValidResourceHintType(link.rel)) continue;\n hints.push({\n type: link.rel,\n href,\n as: link.getAttribute("as") ?? void 0\n });\n }\n }\n extractScripts(doc, prefetchedUrls, hints) {\n for (const script of doc.querySelectorAll("script[src]")) {\n const src = script.src;\n if (!src || prefetchedUrls.has(src)) continue;\n hints.push({ type: "prefetch", href: src, as: "script" });\n }\n }\n extractStylesheets(doc, prefetchedUrls, hints) {\n for (const link of doc.querySelectorAll(\'link[rel="stylesheet"]\')) {\n const href = link.href;\n if (!href || prefetchedUrls.has(href)) continue;\n hints.push({ type: "prefetch", href, as: "style" });\n }\n }\n static generateResourceHints(_route, assets) {\n const hints = [\n \'<link rel="dns-prefetch" href="https://cdn.jsdelivr.net">\',\n \'<link rel="dns-prefetch" href="https://esm.sh">\',\n \'<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>\'\n ];\n for (const asset of assets) {\n if (asset.endsWith(".js")) {\n hints.push(`<link rel="modulepreload" href="${asset}">`);\n continue;\n }\n if (asset.endsWith(".css")) {\n hints.push(`<link rel="preload" as="style" href="${asset}">`);\n continue;\n }\n if (/\\.(woff2?|ttf|otf)$/.test(asset)) {\n hints.push(`<link rel="preload" as="font" href="${asset}" crossorigin>`);\n }\n }\n return hints.join("\\n");\n }\n};\n\n// src/rendering/client/browser-stubs/logger.ts\nfunction noop() {\n}\nvar logger = {\n debug: noop,\n info: console.log.bind(console),\n warn: console.warn.bind(console),\n error: console.error.bind(console),\n component: () => logger\n};\nvar PREFETCH_MAX_SIZE_BYTES2 = 200 * 1024;\nvar PREFETCH_DEFAULT_TIMEOUT_MS2 = 1e4;\nvar PREFETCH_DEFAULT_DELAY_MS2 = 200;\n\n// src/rendering/client/prefetch.ts\nvar PrefetchManager = class {\n constructor(options = {}) {\n __publicField(this, "options");\n __publicField(this, "prefetchedUrls", /* @__PURE__ */ new Set());\n __publicField(this, "networkUtils");\n __publicField(this, "linkObserver", null);\n __publicField(this, "resourceHintsManager");\n __publicField(this, "prefetchQueue");\n this.options = {\n rootMargin: options.rootMargin ?? "50px",\n delay: options.delay ?? PREFETCH_DEFAULT_DELAY_MS2,\n maxConcurrent: options.maxConcurrent ?? 2,\n allowedNetworks: options.allowedNetworks ?? ["4g", "wifi", "ethernet"],\n maxSize: options.maxSize ?? PREFETCH_MAX_SIZE_BYTES2,\n timeout: options.timeout ?? PREFETCH_DEFAULT_TIMEOUT_MS2\n };\n this.networkUtils = new NetworkUtils(this.options.allowedNetworks);\n this.resourceHintsManager = new ResourceHintsManager();\n this.prefetchQueue = new PrefetchQueue(\n {\n maxConcurrent: this.options.maxConcurrent,\n maxSize: this.options.maxSize,\n timeout: this.options.timeout\n },\n this.prefetchedUrls\n );\n this.prefetchQueue.setResourceCallback(\n (response, url) => this.prefetchPageResources(response, url)\n );\n }\n init() {\n prefetchLogger.info("Initializing prefetch manager");\n if (!this.networkUtils.shouldPrefetch()) {\n prefetchLogger.info("Prefetching disabled due to network conditions");\n return;\n }\n this.linkObserver = new LinkObserver(\n {\n rootMargin: this.options.rootMargin,\n delay: this.options.delay,\n onLinkVisible: (link) => this.prefetchQueue.prefetchLink(link)\n },\n this.prefetchedUrls\n );\n this.linkObserver.init();\n this.networkUtils.onNetworkChange(() => {\n if (!this.networkUtils.shouldPrefetch()) this.prefetchQueue.stopAll();\n });\n }\n async prefetchPageResources(response, _pageUrl) {\n const html = await response.text();\n const hints = this.resourceHintsManager.extractResourceHints(html, this.prefetchedUrls);\n this.resourceHintsManager.applyResourceHints(hints);\n }\n applyResourceHints(hints) {\n this.resourceHintsManager.applyResourceHints(hints);\n }\n async prefetch(url) {\n await this.prefetchQueue.prefetch(url);\n }\n static generateResourceHints(route, assets) {\n return ResourceHintsManager.generateResourceHints(route, assets);\n }\n destroy() {\n this.linkObserver?.destroy();\n this.prefetchQueue.stopAll();\n this.prefetchedUrls.clear();\n }\n};\nfunction initPrefetch(options) {\n const prefetchManager = new PrefetchManager(options);\n if (document.readyState === "loading") {\n document.addEventListener("DOMContentLoaded", () => prefetchManager.init(), { once: true });\n } else {\n prefetchManager.init();\n }\n globalThis.veryFrontPrefetch = prefetchManager;\n return prefetchManager;\n}\nfunction resolveAutoInitOptions() {\n const setting = globalThis.__VERYFRONT_PREFETCH__;\n if (!setting) return null;\n if (setting === true) return {};\n if (typeof setting === "object") return setting;\n return null;\n}\nfunction shouldAutoInitPrefetch(options) {\n if (!options) return false;\n if (typeof window === "undefined" || typeof document === "undefined") return false;\n const win = window;\n const doc = document;\n if (win.__veryfrontSSRStub || doc.__veryfrontSSRStub) return false;\n if (typeof IntersectionObserver === "undefined") return false;\n if (typeof MutationObserver === "undefined") return false;\n return true;\n}\nvar autoInitOptions = resolveAutoInitOptions();\nif (shouldAutoInitPrefetch(autoInitOptions)) initPrefetch(autoInitOptions);\nexport {\n PrefetchManager,\n initPrefetch\n};\n';
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/src/cache/backends/api.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAqDhD,qBAAa,eAAgB,YAAW,YAAY;IAClD,QAAQ,CAAC,IAAI,EAAG,KAAK,CAAU;IAC/B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,cAAc,CAAC;gBAGrB,OAAO,GAAE;QACP,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;KACxB;IAiBR,OAAO,CAAC,SAAS;YAIH,OAAO;IAsGf,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAQxC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;YAuBrD,eAAe;IAKvB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,SAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQhE,QAAQ,C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,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAYrF,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/B,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAMrD"}
@@ -66,13 +66,16 @@ export class ApiCacheBackend {
66
66
  const reqCtx = getCurrentRequestContext();
67
67
  const hostToken = getHostEnv("VERYFRONT_API_TOKEN");
68
68
  const envToken = getEnvValue("VERYFRONT_API_TOKEN");
69
- // Cache API calls are framework-owned operations; use the host token when
70
- // available so project/request-scoped credentials cannot shadow it.
71
- const token = hostToken || reqCtx?.token || envToken || null;
72
- const tokenSource = hostToken
73
- ? "host-env"
74
- : reqCtx?.token
75
- ? "request"
69
+ const verifiedRequestToken = reqCtx?.tokenTrust === "verified-control-plane"
70
+ ? reqCtx.token
71
+ : undefined;
72
+ // Ordinary proxy headers are not cache credentials. Only a request token
73
+ // explicitly marked after control-plane verification may override the host.
74
+ const token = verifiedRequestToken || hostToken || envToken || null;
75
+ const tokenSource = verifiedRequestToken
76
+ ? "verified-control-plane"
77
+ : hostToken
78
+ ? "host-env"
76
79
  : envToken
77
80
  ? "env"
78
81
  : "none";
@@ -9,14 +9,7 @@
9
9
  *
10
10
  * export default function Page() {
11
11
  * const chat = useChat();
12
- * return (
13
- * <Chat
14
- * messages={chat.messages}
15
- * input={chat.input}
16
- * onChange={chat.handleInputChange}
17
- * onSubmit={chat.handleSubmit}
18
- * />
19
- * );
12
+ * return <Chat chat={chat} />;
20
13
  * }
21
14
  * ```
22
15
  *
@@ -47,17 +40,17 @@
47
40
  * </Message.Root>
48
41
  * ```
49
42
  */
50
- export { Chat, ChatComponents, type ChatProps } from "../react/components/chat/chat.js";
51
- export { ChatEmpty, type ChatEmptyProps, ChatEmptyState, type ChatEmptyStateAvatarProps, type ChatEmptyStateHeadingProps, type ChatEmptyStateRootProps, type ChatEmptyStateSuggestionProps, type ChatEmptyStateSuggestionsProps, ChatIf, type ChatIfProps, ChatMessageList, type ChatMessageListProps, ChatRoot, type ChatRootProps, ErrorBanner, type ErrorBannerProps, Message, type MessageProps, type MessageRootProps, ModelAvatar, type ModelAvatarProps, } from "../react/components/chat/chat.js";
52
- export { ChatContextProvider, type ChatContextValue, ComposerContextProvider, type ComposerContextValue, MessageContextProvider, type MessageContextValue, useChatContext, useChatContextOptional, useComposerContext, useComposerContextOptional, useMessageContext, useMessageContextOptional, } from "../react/components/chat/chat.js";
53
- export { AgentAvatar, type AgentAvatarProps, type AttachmentInfo, AttachmentsPanel, type AttachmentsPanelActionProps, type AttachmentsPanelContextValue, type AttachmentsPanelEmptyProps, type AttachmentsPanelItemProps, type AttachmentsPanelListProps, type AttachmentsPanelLoadingProps, type AttachmentsPanelProps, BranchPicker, type BranchPickerProps, ChatMessagesSkeleton, type ChatMessagesSkeletonProps, ChatSidebar, type ChatSidebarComponent, type ChatSidebarEmptyProps, type ChatSidebarGroupProps, type ChatSidebarIcons, type ChatSidebarItemProps, type ChatSidebarListProps, type ChatSidebarNewButtonProps, type ChatSidebarProps, type ChatSidebarRootProps, type ChatTab, type CodeBlockProps, ConversationEmptyState, type ConversationEmptyStateProps, ConversationScrollButton, type ConversationScrollButtonProps, downloadMarkdown, DropZoneOverlay, type DropZoneOverlayProps, exportAsMarkdown, extractSourcesFromParts, FadeIn, type FeedbackValue, getTextContent, groupPartsInOrder, InferenceBadge, type InferenceBadgeProps, InlineCitation, type InlineCitationProps, isReasoningPart, isSkillToolPart, isToolPart, Loader, MessageActionBar, type MessageActionBarProps, MessageEditForm, type MessageEditFormProps, MessageFeedback, type MessageFeedbackProps, type ModelOption, ModelSelector, type ModelSelectorContentProps, type ModelSelectorContextValue, type ModelSelectorItemProps, type ModelSelectorProps, type ModelSelectorTriggerProps, type PartGroup, type QuickAction, QuickActions, type QuickActionsProps, ReasoningCard, RichCodeBlock, Shimmer, SkillBadge, type SkillBadgeProps, type Source, SourcePill, type SourcePillProps, Sources, type SourcesContextValue, type SourcesListProps, type SourcesProps, StepIndicator, type StepIndicatorContextValue, type StepIndicatorProps, Suggestion, type SuggestionProps, Suggestions, type SuggestionsProps, TabSwitcher, type TabSwitcherProps, ToolCallCard, ToolStatusBadge, type UploadedFile, useAttachmentsPanel, useModelSelector, useSources, useStepIndicator, useStickToBottom, type UseStickToBottomOptions, type UseStickToBottomResult, useUpload, type UseUploadOptions, type UseUploadResult, useUploadsRegistry, type UseUploadsRegistryOptions, type UseUploadsRegistryResult, } from "../react/components/chat/chat.js";
54
- export { type Conversation, type ConversationPatch, ConversationsContextProvider, ConversationsProvider, type ConversationsProviderProps, type ConversationStore, type ConversationSummary, localConversationStore, memoryConversationStore, type StorageLike, useConversation, type UseConversationOptions, type UseConversationResult, useConversations, useConversationsContext, useConversationsContextOptional, type UseConversationsOptions, type UseConversationsResult, } from "../react/components/chat/chat.js";
55
- export { AttachmentPill, AttachmentPill as Attachment, type AttachmentPillContextValue, type AttachmentPillProps, type AttachmentPillProps as AttachmentProps, AttachmentsPanel as UploadsPanel, type AttachmentsPanelProps as UploadsPanelProps, ChatInput, ChatInput as ChatComposer, type ChatInputProps, type ChatInputProps as ChatComposerProps, Message as StandaloneMessage, Message as StreamingMessage, MessageActionBar as MessageActions, type MessageActionBarProps as MessageActionsProps, type MessageProps as StandaloneMessageProps, type MessageProps as StreamingMessageProps, Reasoning, type ReasoningContextValue, type ReasoningProps, type ReasoningTriggerProps, ToolCall, type ToolCallContextValue, type ToolCallProps, type ToolCallTriggerProps, useAttachmentPill, useReasoning, useToolCall, } from "../react/components/chat/chat.js";
43
+ export { Chat, type ChatAgentInfo, type ChatProps, } from "../react/components/chat/chat.js";
44
+ export { ChatEmpty, type ChatEmptyProps, ChatEmptyState, type ChatEmptyStateAvatarProps, type ChatEmptyStateHeadingProps, type ChatEmptyStateRootProps, type ChatEmptyStateSuggestionProps, type ChatEmptyStateSuggestionsProps, ChatIf, type ChatIfProps, ChatMessageList, type ChatMessageListContentProps, type ChatMessageListProps, ChatRoot, type ChatRootProps, ErrorBanner, type ErrorBannerProps, Message, type MessageProps, type MessageRootProps, type MessageTokensProps, ModelAvatar, type ModelAvatarProps, type TokenRowProps, } from "../react/components/chat/chat.js";
45
+ export { ChatContextProvider, type ChatContextValue, ComposerContextProvider, type ComposerContextValue, MessageContextProvider, type MessageContextValue, type MessagePartsData, useChatContext, useChatContextOptional, useComposerContext, useComposerContextOptional, useMessageContext, useMessageContextOptional, useMessageParts, } from "../react/components/chat/chat.js";
46
+ export { AgentAvatar, type AgentAvatarProps, type AttachmentInfo, AttachmentsPanel, type AttachmentsPanelActionProps, type AttachmentsPanelContextValue, type AttachmentsPanelEmptyProps, type AttachmentsPanelItemProps, type AttachmentsPanelListProps, type AttachmentsPanelLoadingProps, type AttachmentsPanelProps, BranchPicker, type BranchPickerActionProps, type BranchPickerCountProps, type BranchPickerProps, ChatMessagesSkeleton, type ChatMessagesSkeletonProps, ChatSidebar, type ChatSidebarComponent, type ChatSidebarEmptyProps, type ChatSidebarGroupProps, type ChatSidebarItemProps, type ChatSidebarListProps, type ChatSidebarNewButtonProps, type ChatSidebarProps, type ChatSidebarRootProps, type ChatTab, type CodeBlockProps, ConversationEmptyState, type ConversationEmptyStateProps, ConversationScrollButton, type ConversationScrollButtonProps, downloadMarkdown, DropZoneOverlay, type DropZoneOverlayProps, exportAsMarkdown, extractSourcesFromParts, FadeIn, type FeedbackValue, getTextContent, groupPartsInOrder, InferenceBadge, type InferenceBadgeProps, InlineCitation, type InlineCitationCardProps, type InlineCitationProps, type InlineCitationTriggerProps, isReasoningPart, isSkillToolPart, isToolPart, Loader, MessageActionBar, type MessageActionBarActionProps, type MessageActionBarProps, MessageEditForm, type MessageEditFormProps, MessageFeedback, type MessageFeedbackActionProps, type MessageFeedbackProps, type ModelOption, ModelSelector, type ModelSelectorContentProps, type ModelSelectorContextValue, type ModelSelectorItemProps, type ModelSelectorProps, type ModelSelectorSearchProps, type ModelSelectorTriggerProps, type PartGroup, type QuickAction, QuickActions, type QuickActionsProps, RichCodeBlock, Shimmer, SkillBadge, type SkillBadgeProps, type Source, SourcePill, type SourcePillProps, Sources, type SourcesContextValue, type SourcesListProps, type SourcesProps, StepIndicator, type StepIndicatorContextValue, type StepIndicatorProps, Suggestion, type SuggestionProps, Suggestions, type SuggestionsProps, TabSwitcher, type TabSwitcherProps, ToolStatusBadge, type UploadedFile, useAttachmentsPanel, useModelSelector, useSources, useStepIndicator, useStickToBottom, type UseStickToBottomOptions, type UseStickToBottomResult, useUpload, type UseUploadOptions, type UseUploadResult, useUploadsRegistry, type UseUploadsRegistryOptions, type UseUploadsRegistryResult, } from "../react/components/chat/chat.js";
47
+ export { type Conversation, type ConversationPatch, ConversationsContextProvider, ConversationsProvider, type ConversationsProviderProps, type ConversationStore, type ConversationSummary, localConversationStore, memoryConversationStore, type StorageLike, useConversation, useConversationChat, type UseConversationChatOptions, type UseConversationChatResult, type UseConversationOptions, type UseConversationResult, useConversations, useConversationsContext, useConversationsContextOptional, type UseConversationsOptions, type UseConversationsResult, } from "../react/components/chat/chat.js";
48
+ export { AttachmentPill, type AttachmentPillContextValue, type AttachmentPillProps, ChatInput, type ChatInputExportProps, type ChatInputProps, Reasoning, type ReasoningContextValue, type ReasoningProps, type ReasoningTriggerProps, ToolCall, type ToolCallContextValue, type ToolCallProps, type ToolCallTriggerProps, useAttachmentPill, useReasoning, useToolCall, } from "../react/components/chat/chat.js";
56
49
  export { Markdown, type MarkdownProps } from "../react/components/chat/markdown.js";
57
50
  export { AppShell, type AppShellHeaderProps, type AppShellOpenState, type AppShellProps, type AppShellSide, type AppShellSidebarProps, type AppShellTriggerProps, useAppShell, } from "../react/components/ui/app-shell.js";
58
51
  export { Tabs, TabsItem, type TabsItemProps, type TabsProps, } from "../react/components/ui/tabs.js";
59
52
  export { ChatThemeScope, type ChatThemeScopeProps, } from "../react/components/chat/chat-theme-scope.js";
60
- export { type AgentOption, AgentPicker, type AgentPickerContentProps, type AgentPickerContextValue, type AgentPickerItemProps, type AgentPickerProps, type AgentPickerSection, type AgentPickerTriggerProps, useAgentPicker, } from "../react/components/chat/agent-picker.js";
53
+ export { type AgentOption, AgentPicker, type AgentPickerActionProps, type AgentPickerContentProps, type AgentPickerContextValue, type AgentPickerItemProps, type AgentPickerProps, type AgentPickerSearchProps, type AgentPickerSection, type AgentPickerTriggerProps, useAgentPicker, } from "../react/components/chat/agent-picker.js";
61
54
  export { agentsToPickerOptions, ChatAgentPicker, type ChatAgentPickerProps, } from "../react/components/chat/chat-agent-picker.js";
62
55
  export { type ChatActionItem, ChatActions, type ChatActionsContentProps, type ChatActionsContextValue, type ChatActionsItemProps, type ChatActionsProps, type ChatActionsSettings, type ChatActionsTriggerProps, useChatActions, } from "../react/components/chat/chat-actions.js";
63
56
  export { CodeBlock, CodeSurface, type CodeSurfaceProps, CopyButton, type CopyButtonProps, useClipboard, type UseClipboardResult, } from "../react/components/ui/code-block.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/chat/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,OAAO,yBAAyB,CAAC;AAGjC,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAExF,OAAO,EACL,SAAS,EACT,KAAK,cAAc,EACnB,cAAc,EACd,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACnC,MAAM,EACN,KAAK,WAAW,EAChB,eAAe,EACf,KAAK,oBAAoB,EACzB,QAAQ,EACR,KAAK,aAAa,EAClB,WAAW,EACX,KAAK,gBAAgB,EACrB,OAAO,EACP,KAAK,YAAY,EACjB,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EAC1B,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,wBAAwB,EACxB,6BAA6B,EAC7B,mCAAmC,EACnC,2CAA2C,EAC3C,8BAA8B,EAC9B,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,sBAAsB,CAAC"}
@@ -9,14 +9,7 @@
9
9
  *
10
10
  * export default function Page() {
11
11
  * const chat = useChat();
12
- * return (
13
- * <Chat
14
- * messages={chat.messages}
15
- * input={chat.input}
16
- * onChange={chat.handleInputChange}
17
- * onSubmit={chat.handleSubmit}
18
- * />
19
- * );
12
+ * return <Chat chat={chat} />;
20
13
  * }
21
14
  * ```
22
15
  *
@@ -47,19 +40,17 @@
47
40
  * </Message.Root>
48
41
  * ```
49
42
  */
50
- export { Chat, ChatComponents } from "../react/components/chat/chat.js";
43
+ export { Chat, } from "../react/components/chat/chat.js";
51
44
  export { ChatEmpty, ChatEmptyState, ChatIf, ChatMessageList, ChatRoot, ErrorBanner, Message, ModelAvatar, } from "../react/components/chat/chat.js";
52
- export { ChatContextProvider, ComposerContextProvider, MessageContextProvider, useChatContext, useChatContextOptional, useComposerContext, useComposerContextOptional, useMessageContext, useMessageContextOptional, } from "../react/components/chat/chat.js";
53
- export { AgentAvatar, AttachmentsPanel, BranchPicker, ChatMessagesSkeleton, ChatSidebar, ConversationEmptyState, ConversationScrollButton, downloadMarkdown, DropZoneOverlay, exportAsMarkdown, extractSourcesFromParts, FadeIn, getTextContent, groupPartsInOrder, InferenceBadge, InlineCitation, isReasoningPart, isSkillToolPart, isToolPart, Loader, MessageActionBar, MessageEditForm, MessageFeedback, ModelSelector, QuickActions, ReasoningCard, RichCodeBlock, Shimmer, SkillBadge, SourcePill, Sources, StepIndicator, Suggestion, Suggestions, TabSwitcher, ToolCallCard, ToolStatusBadge, useAttachmentsPanel, useModelSelector, useSources, useStepIndicator, useStickToBottom, useUpload, useUploadsRegistry, } from "../react/components/chat/chat.js";
45
+ export { ChatContextProvider, ComposerContextProvider, MessageContextProvider, useChatContext, useChatContextOptional, useComposerContext, useComposerContextOptional, useMessageContext, useMessageContextOptional, useMessageParts, } from "../react/components/chat/chat.js";
46
+ export { AgentAvatar, AttachmentsPanel, BranchPicker, ChatMessagesSkeleton, ChatSidebar, ConversationEmptyState, ConversationScrollButton, downloadMarkdown, DropZoneOverlay, exportAsMarkdown, extractSourcesFromParts, FadeIn, getTextContent, groupPartsInOrder, InferenceBadge, InlineCitation, isReasoningPart, isSkillToolPart, isToolPart, Loader, MessageActionBar, MessageEditForm, MessageFeedback, ModelSelector, QuickActions, RichCodeBlock, Shimmer, SkillBadge, SourcePill, Sources, StepIndicator, Suggestion, Suggestions, TabSwitcher, ToolStatusBadge, useAttachmentsPanel, useModelSelector, useSources, useStepIndicator, useStickToBottom, useUpload, useUploadsRegistry, } from "../react/components/chat/chat.js";
54
47
  // Conversation persistence adapters — swappable async stores behind the
55
48
  // (upcoming) `useConversations` hook. localStorage default; idb/api are follow-ups.
56
- export { ConversationsContextProvider, ConversationsProvider, localConversationStore, memoryConversationStore, useConversation, useConversations, useConversationsContext, useConversationsContextOptional, } from "../react/components/chat/chat.js";
49
+ export { ConversationsContextProvider, ConversationsProvider, localConversationStore, memoryConversationStore, useConversation, useConversationChat, useConversations, useConversationsContext, useConversationsContextOptional, } from "../react/components/chat/chat.js";
57
50
  // ---------------------------------------------------------------------------
58
- // Target component names. This chat surface intentionally completes the
59
- // migration away from the old Thread, Composer, and standalone message exports.
60
- // Use these names for new code and see the chat UI guide for migration notes.
51
+ // Canonical component names.
61
52
  // ---------------------------------------------------------------------------
62
- export { AttachmentPill, AttachmentPill as Attachment, AttachmentsPanel as UploadsPanel, ChatInput, ChatInput as ChatComposer, Message as StandaloneMessage, Message as StreamingMessage, MessageActionBar as MessageActions, Reasoning, ToolCall, useAttachmentPill, useReasoning, useToolCall, } from "../react/components/chat/chat.js";
53
+ export { AttachmentPill, ChatInput, Reasoning, ToolCall, useAttachmentPill, useReasoning, useToolCall, } from "../react/components/chat/chat.js";
63
54
  export { Markdown } from "../react/components/chat/markdown.js";
64
55
  // Layout primitives — chat-independent, re-exported from the `veryfront/ui`
65
56
  // package (their home) so consuming apps can compose their own shell (sidebar
@@ -0,0 +1,3 @@
1
+ /** Config filenames recognized by the Veryfront project loader. */
2
+ export declare const VERYFRONT_CONFIG_FILES: readonly ["veryfront.config.js", "veryfront.config.ts", "veryfront.config.mjs"];
3
+ //# sourceMappingURL=config-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-files.d.ts","sourceRoot":"","sources":["../../../src/src/config/config-files.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,eAAO,MAAM,sBAAsB,iFAIzB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /** Config filenames recognized by the Veryfront project loader. */
2
+ export const VERYFRONT_CONFIG_FILES = [
3
+ "veryfront.config.js",
4
+ "veryfront.config.ts",
5
+ "veryfront.config.mjs",
6
+ ];
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/src/config/loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAiCnE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAsJ1D,sGAAsG;AACtG,wBAAgB,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAuFlF;AA0DD,gBAAgB;AAChB,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CAUjB;AA4FD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,SAAS,CACvB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,eAAe,CAAC,CAkF1B;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAGvC;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAI9E"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/src/config/loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAiCnE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAsJ1D,sGAAsG;AACtG,wBAAgB,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAuFlF;AA6DD,gBAAgB;AAChB,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CAUjB;AA4FD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,SAAS,CACvB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,eAAe,CAAC,CAmF1B;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAGvC;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAI9E"}
@@ -9,14 +9,14 @@ import { DEFAULT_CACHE_DIR } from "../utils/constants/server.js";
9
9
  import { buildConfigCacheKey } from "../cache/keys.js";
10
10
  import { DEFAULT_PORT } from "./defaults.js";
11
11
  import { createFileSystem } from "../platform/compat/fs.js";
12
- import { getErrorMessage } from "../errors/veryfront-error.js";
13
- import { CONFIG_VALIDATION_FAILED } from "../errors/error-registry.js";
12
+ import { CONFIG_PARSE_ERROR, CONFIG_VALIDATION_FAILED } from "../errors/error-registry.js";
14
13
  import { VeryfrontError } from "../errors/types.js";
15
14
  import { withSpan } from "../observability/tracing/otlp-setup.js";
16
15
  import { SpanNames } from "../observability/tracing/span-names.js";
17
16
  import { getEnv } from "../platform/compat/process.js";
18
17
  import { LRUCache } from "../utils/lru-wrapper.js";
19
18
  import { registerLRUCache } from "../cache/registry.js";
19
+ import { VERYFRONT_CONFIG_FILES } from "./config-files.js";
20
20
  const logger = serverLogger.component("config");
21
21
  /** Cache TTL for veryfront-api filesystem in proxy mode */
22
22
  const DEFAULT_FS_CACHE_TTL_MS = 60_000;
@@ -271,7 +271,8 @@ function isConfigError(error) {
271
271
  // Prefer the structured slug check. The message-prefix check is only a fallback
272
272
  // for errors thrown before they were migrated to the VeryfrontError registry;
273
273
  // it is intentionally narrow to avoid misclassifying third-party errors.
274
- if (error instanceof VeryfrontError && error.slug === "config-validation-failed")
274
+ if (error instanceof VeryfrontError &&
275
+ (error.slug === "config-validation-failed" || error.slug === "config-parse-error"))
275
276
  return true;
276
277
  return error instanceof Error && error.message.startsWith("Invalid veryfront.config");
277
278
  }
@@ -396,10 +397,9 @@ export function getConfig(projectDir, adapter, options) {
396
397
  cacheKey: effectiveCacheKey,
397
398
  isVirtualFS,
398
399
  });
399
- const configFiles = ["veryfront.config.js", "veryfront.config.ts", "veryfront.config.mjs"];
400
400
  // For virtual filesystem, config is at project root ("/"), not the local projectDir
401
401
  const configBaseDir = isVirtualFS ? "/" : projectDir;
402
- for (const configFile of configFiles) {
402
+ for (const configFile of VERYFRONT_CONFIG_FILES) {
403
403
  const configPath = join(configBaseDir, configFile);
404
404
  const exists = await adapter.fs.exists(configPath);
405
405
  logger.debug("Checking config file", { configPath, exists, isVirtualFS });
@@ -416,11 +416,14 @@ export function getConfig(projectDir, adapter, options) {
416
416
  return merged;
417
417
  }
418
418
  catch (error) {
419
- logger.warn(`Failed to load ${configFile}, trying next:`, {
420
- error: getErrorMessage(error),
421
- });
422
419
  if (isConfigError(error))
423
420
  throw error;
421
+ logger.warn("Failed to load config file", { configFile });
422
+ throw CONFIG_PARSE_ERROR.create({
423
+ detail: `Failed to load ${configFile}`,
424
+ cause: error,
425
+ context: { configFile },
426
+ });
424
427
  }
425
428
  }
426
429
  logger.debug("No config file found, using defaults", {
@@ -450,7 +453,7 @@ export function clearConfigCache() {
450
453
  * @returns Cached config if valid, null if not cached or stale
451
454
  */
452
455
  export function getCachedConfigSync(projectDir) {
453
- const cached = configCacheByProject.get(projectDir);
456
+ const cached = configCacheByProject.get(buildConfigCacheKey(projectDir, false));
454
457
  if (!cached || cached.revision !== cacheRevision)
455
458
  return null;
456
459
  return cached.config;
@@ -43,6 +43,11 @@ export interface ParseOptions {
43
43
  /** Additional parser-specific options. */
44
44
  [key: string]: unknown;
45
45
  }
46
+ /** Options for a parser-owned function directive check. */
47
+ export interface FunctionDirectiveOptions extends ParseOptions {
48
+ /** Exact directive value to find in function-body directive prologues. */
49
+ directive: string;
50
+ }
46
51
  /** Options passed to {@link CodeParser.generate}. */
47
52
  export interface GenerateOptions {
48
53
  /** Include source maps in the output. */
@@ -78,6 +83,15 @@ export interface CodeParser {
78
83
  traverse(ast: ASTNode, visitor: TraverseVisitor): void;
79
84
  /** Generate source code from an AST. */
80
85
  generate(ast: ASTNode, options?: GenerateOptions): Promise<GenerateResult>;
86
+ /**
87
+ * Determine whether any function body declares the requested directive.
88
+ *
89
+ * This capability is optional for backward compatibility. Implementations
90
+ * that provide it must use their own AST semantics, reject invalid source,
91
+ * and ignore directive-like strings outside function directive prologues.
92
+ * Security-sensitive callers fail closed when the capability is absent.
93
+ */
94
+ hasFunctionDirective?(options: FunctionDirectiveOptions): Promise<boolean>;
81
95
  /**
82
96
  * Inject `data-node-*` attributes into every JSX element in the source,
83
97
  * enabling Studio Navigator to map rendered elements back to their
@@ -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C,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,2CAA2C;AAC3C,MAAM,WAAW,UAAU;IACzB,sDAAsD;IACtD,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,sEAAsE;IACtE,QAAQ,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;IACvD,wCAAwC;IACxC,QAAQ,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3E;;;;;;;OAOG;IACH,oBAAoB,CAAC,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3E;;;;OAIG;IACH,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,6BAA6B,GAAG,MAAM,CAAC;CACxF"}
@@ -4,5 +4,5 @@
4
4
  * @module extensions/parser
5
5
  */
6
6
  import "../../../_dnt.polyfills.js";
7
- export type { ASTNode, CodeParser, GenerateOptions, GenerateResult, InjectJsxNodePositionsOptions, NodePath, ParseOptions, TraverseVisitor, } from "./code-parser.js";
7
+ export type { ASTNode, CodeParser, FunctionDirectiveOptions, GenerateOptions, GenerateResult, InjectJsxNodePositionsOptions, NodePath, ParseOptions, TraverseVisitor, } from "./code-parser.js";
8
8
  //# sourceMappingURL=index.d.ts.map