@voltro/cli 0.33.0 → 0.35.0

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 (343) hide show
  1. package/CHANGELOG.md +1968 -0
  2. package/bin/nodeEnvironment.d.mts +30 -0
  3. package/bin/nodeEnvironment.mjs +158 -0
  4. package/bin/voltro.mjs +69 -5
  5. package/dist/addCommand-BNeoeSxe.js +124 -0
  6. package/dist/addCommand-aXSQveak.js +2 -0
  7. package/dist/agentsMd-BTchIZku.js +2 -0
  8. package/dist/agentsMd-mhQMF1bx.js +254 -0
  9. package/dist/apiBuild-B8aoJvuw.js +2 -0
  10. package/dist/{apiBuild-h9VHtnlw.js → apiBuild-DYD_ONLD.js} +46 -46
  11. package/dist/{appGraph-gQ_6GkQQ.js → appGraph-KGDPTuTy.js} +1 -1
  12. package/dist/appGraph-zuMGKVYX.js +2 -0
  13. package/dist/appPort-B_HpJ_ck.js +48 -0
  14. package/dist/baselineCommand-C2ClWZN3.js +2 -0
  15. package/dist/baselineCommand-DIttzO8A.js +227 -0
  16. package/dist/bin.js +71 -28
  17. package/dist/build-CD8K4XOr.js +711 -0
  18. package/dist/cacheCommand-DA4OH9xt.js +42 -0
  19. package/dist/capabilitiesCommand-nq_pz5xd.js +123 -0
  20. package/dist/checkCommand-Ct9xkTrS.js +232 -0
  21. package/dist/checkCommand-DKpDLlqu.js +2 -0
  22. package/dist/{cliArgs-qdZSElM3.js → cliArgs-D4p8n7EE.js} +12 -1
  23. package/dist/cliError-BmdYnghb.js +10 -0
  24. package/dist/cliOutput-D1tSBoRM.js +15 -0
  25. package/dist/{cliRuntime-Oh517vCV.js → cliRuntime-Dh7UDinH.js} +20 -20
  26. package/dist/cloudClient-DWL-Hw_T.js +67 -0
  27. package/dist/cloudCmd-Cvv5HGaZ.js +364 -0
  28. package/dist/clusterCmd-D5wsCmA_.js +54 -0
  29. package/dist/codegen-CYM3Zqrf.js +605 -0
  30. package/dist/codegen-ChBi_hVa.js +2 -0
  31. package/dist/codegenCommand-C4YoQIc2.js +30 -0
  32. package/dist/codemodRunner-BnFq3Fgu.js +5384 -0
  33. package/dist/commandRunner-BLAEFLjp.js +47 -0
  34. package/dist/commands-BE8E7zF3.js +816 -0
  35. package/dist/connectionConfig-UFlIEiys.js +66 -0
  36. package/dist/dashboardCommand-D7SgZGaN.js +25 -0
  37. package/dist/dataCommand-BhYwDgg-.js +537 -0
  38. package/dist/dataProfile-dW-PsfLB.js +15 -0
  39. package/dist/dbCommand-DS4b97Is.js +2 -0
  40. package/dist/{dbCommand-DTLKAfbA.js → dbCommand-O8HA63s2.js} +552 -402
  41. package/dist/{dev-C_P8FLSx.js → dev-C7sFZq3m.js} +3670 -3169
  42. package/dist/dev-D2BikO7a.js +3 -0
  43. package/dist/devActivity-Dx_3nnGv.js +100 -0
  44. package/dist/devActivity.js +1 -1
  45. package/dist/dialectDriver-CgXnDfec.js +39 -0
  46. package/dist/discover-C9XKJDco.js +25 -0
  47. package/dist/doctorCommand-CM4Ch9C7.js +2 -0
  48. package/dist/{checkCommand-xGhRFFg2.js → doctorCommand-DnimF5IM.js} +523 -1278
  49. package/dist/dormancyCommand-QewYug_s.js +69 -0
  50. package/dist/e2eCmd-BRabZww-.js +147 -0
  51. package/dist/embeddingsCommand-BfiLS_QI.js +73 -0
  52. package/dist/envCommand-CCGPRQY1.js +60 -0
  53. package/dist/evalCommand-6RUfPen4.js +118 -0
  54. package/dist/evolveCommand-CHsLCtDf.js +281 -0
  55. package/dist/fileTaxonomy-CJfgOllU.js +457 -0
  56. package/dist/frameworkTableAssembly-YyVe32Cb.js +2 -0
  57. package/dist/frameworkTableAssembly-oMPBKqlE.js +511 -0
  58. package/dist/generateCommand-DbgcUpGw.js +147 -0
  59. package/dist/index.d.ts +45 -0
  60. package/dist/index.js +4 -3
  61. package/dist/infoCommand-DwOgK1t6.js +60 -0
  62. package/dist/{inspect-BUUjt773.js → inspect-CjTYzAs_.js} +113 -41
  63. package/dist/inspect-P4pxoMaV.js +2 -0
  64. package/dist/inspectCmd-EHFZ9yYu.js +224 -0
  65. package/dist/inspectFetch-EMuhTG_9.js +151 -0
  66. package/dist/inspectMetrics-CfdKLh6t.js +72 -0
  67. package/dist/loadEnv-D9nEOClM.js +44 -0
  68. package/dist/logFileSink-C_D2wRN1.js +105 -0
  69. package/dist/logsCmd-D36xK7Zu.js +260 -0
  70. package/dist/manifestBuild-COkJoyAr.js +2 -0
  71. package/dist/{manifestBuild-BLrVuSlM.js → manifestBuild-hpPLaGxV.js} +1 -1
  72. package/dist/metaCommands-7MJfZ5cf.js +196 -0
  73. package/dist/migrate-BV7I-ZHZ.js +83 -0
  74. package/dist/mssqlClusterPatch-_4cE_nun.js +44 -0
  75. package/dist/newCommand-COWOJ1_E.js +156 -0
  76. package/dist/nodeEnvironment-cGFAj1J8.js +28 -0
  77. package/dist/packageCommand-Cug_3Ogl.js +271 -0
  78. package/dist/pageConvention-cEiRxdab.js +5 -0
  79. package/dist/privacyCommand-C-Df56U_.js +146 -0
  80. package/dist/probeCommand-CZfaaUOZ.js +122 -0
  81. package/dist/projectScaffold-DmzEKHib.js +2 -0
  82. package/dist/projectScaffold-LMMtaavR.js +814 -0
  83. package/dist/renderModeScan-D7J1B7Kw.js +105 -0
  84. package/dist/renderProfile-1OWWAAtx.js +81 -0
  85. package/dist/runtimeRegistry-DMeKfTHP.js +81 -0
  86. package/dist/runtimeTrace-CH3eUiMw.js +91 -0
  87. package/dist/scheduleCmd-DQRu6BZC.js +149 -0
  88. package/dist/scheduleManifestCmd-D2x0CTTY.js +249 -0
  89. package/dist/schemaIr-UJybUUZW.js +103 -0
  90. package/dist/{sdkgen-C81QIkiL.js → sdkgen-BLkvGRfX.js} +111 -209
  91. package/dist/seedRunner-ZmLSqNe2.js +333 -0
  92. package/dist/serveCommand-CbDHU6l-.js +2 -0
  93. package/dist/serveCommand-iwlUBNS1.js +1766 -0
  94. package/dist/serveEntry.js +5 -5
  95. package/dist/serverlessCommand-CfJZy6dS.js +482 -0
  96. package/dist/start-BgN62boB.js +3 -0
  97. package/dist/start-T4VesWiM.js +1087 -0
  98. package/dist/startEntry.js +2 -2
  99. package/dist/staticCommand-Dr2M6tpU.js +304 -0
  100. package/dist/storageCommand-Co6NfLqN.js +42 -0
  101. package/dist/templates-De8IR5-c.js +102 -0
  102. package/dist/test-CI6iDsYc.js +115 -0
  103. package/dist/tracesCmd-DStmCJPi.js +232 -0
  104. package/dist/tsconfigPaths-BWXBWgcl.js +107 -0
  105. package/dist/tsxLoader-EuXmSJ1K.js +51 -0
  106. package/dist/typecheckCommand-BlsWiCNq.js +61 -0
  107. package/dist/updateCommand-BlMZhWgO.js +2 -0
  108. package/dist/updateCommand-x0pI_x-B.js +585 -0
  109. package/dist/webDev-BcykISYQ2.js +2 -0
  110. package/dist/{inspectMetrics-1xzTKAFx.js → webDev-Dybxew86.js} +988 -1560
  111. package/dist/webhookDiscovery-CrGAfhIG.js +2 -0
  112. package/dist/webhookDiscovery-D7VaeMlz.js +51 -0
  113. package/dist/webhooksCommand-DlAgS2Iw.js +267 -0
  114. package/dist/workflowsCmd-BGF-mRZ5.js +608 -0
  115. package/package.json +209 -17
  116. package/templates/AGENTS.core.md +58 -3
  117. package/templates/AGENTS.md +64 -7
  118. package/templates/agent-docs/_index.md +6 -4
  119. package/templates/agent-docs/_manifest.json +23 -6
  120. package/templates/agent-docs/ai.md +370 -0
  121. package/templates/agent-docs/authentication.md +313 -31
  122. package/templates/agent-docs/caching.md +6 -0
  123. package/templates/agent-docs/cli.md +853 -50
  124. package/templates/agent-docs/data.md +608 -12
  125. package/templates/agent-docs/database/migrations.md +223 -25
  126. package/templates/agent-docs/database/misc.md +156 -40
  127. package/templates/agent-docs/database/querying.md +19 -1
  128. package/templates/agent-docs/database/scaling.md +60 -0
  129. package/templates/agent-docs/database/schema.md +1 -0
  130. package/templates/agent-docs/database/seedsdialects.md +208 -19
  131. package/templates/agent-docs/database/transactions.md +68 -0
  132. package/templates/agent-docs/deployment.md +284 -25
  133. package/templates/agent-docs/introduction.md +88 -17
  134. package/templates/agent-docs/local-first-mobile.md +79 -4
  135. package/templates/agent-docs/multi-tenancy.md +188 -42
  136. package/templates/agent-docs/observability.md +58 -3
  137. package/templates/agent-docs/plugins/ai-flows.md +247 -2
  138. package/templates/agent-docs/plugins/analytics-postgres.md +1 -1
  139. package/templates/agent-docs/plugins/audit.md +37 -1
  140. package/templates/agent-docs/plugins/auth-social.md +143 -0
  141. package/templates/agent-docs/plugins/auth-workos.md +4 -2
  142. package/templates/agent-docs/plugins/auth.md +131 -6
  143. package/templates/agent-docs/plugins/billing.md +132 -15
  144. package/templates/agent-docs/plugins/cdc-out.md +46 -7
  145. package/templates/agent-docs/plugins/clickhouse.md +32 -1
  146. package/templates/agent-docs/plugins/duckdb.md +1 -1
  147. package/templates/agent-docs/plugins/flags.md +132 -0
  148. package/templates/agent-docs/plugins/governance.md +105 -7
  149. package/templates/agent-docs/plugins/multitenancy.md +9 -4
  150. package/templates/agent-docs/plugins/presence.md +13 -2
  151. package/templates/agent-docs/plugins/ratelimit.md +9 -0
  152. package/templates/agent-docs/plugins/search.md +162 -8
  153. package/templates/agent-docs/plugins/sso-saml.md +47 -8
  154. package/templates/agent-docs/plugins/storage.md +11 -0
  155. package/templates/agent-docs/plugins/webhooks.md +105 -0
  156. package/templates/agent-docs/plugins.md +152 -18
  157. package/templates/agent-docs/reference.md +60 -3
  158. package/templates/agent-docs/releases.md +1117 -0
  159. package/templates/agent-docs/routing.md +43 -25
  160. package/templates/agent-docs/scheduling.md +27 -0
  161. package/templates/agent-docs/schema-driven-ui.md +92 -12
  162. package/templates/agent-docs/security.md +426 -0
  163. package/templates/agent-docs/templates/apibackends.md +87 -18
  164. package/templates/agent-docs/templates/appshells.md +32 -14
  165. package/templates/agent-docs/templates/overview.md +13 -8
  166. package/templates/agent-docs/testing.md +211 -14
  167. package/templates/agent-docs/whats-new.md +98 -136
  168. package/templates/agent-docs/workflows.md +231 -14
  169. package/templates/apps/api-ai/actions/summarize.action.ts +11 -0
  170. package/templates/apps/api-ai/package.json +8 -7
  171. package/templates/apps/api-auth/actions/me.action.ts +13 -0
  172. package/templates/apps/api-auth/package.json +9 -8
  173. package/templates/apps/api-backend/mutations/notes.create.mutation.ts +9 -0
  174. package/templates/apps/api-backend/package.json +12 -8
  175. package/templates/apps/api-backend/queries/notes.query.ts +30 -8
  176. package/templates/apps/api-backend-deactivation/actions/users.get.action.ts +14 -0
  177. package/templates/apps/api-backend-deactivation/mutations/users.create.mutation.ts +8 -0
  178. package/templates/apps/api-backend-deactivation/mutations/users.deactivate.mutation.ts +10 -0
  179. package/templates/apps/api-backend-deactivation/package.json +8 -7
  180. package/templates/apps/api-backend-mail/actions/sendWelcome.action.ts +17 -0
  181. package/templates/apps/api-backend-mail/mutations/notes.create.mutation.ts +9 -0
  182. package/templates/apps/api-backend-mail/package.json +9 -8
  183. package/templates/apps/api-backend-mail/queries/notes.query.ts +30 -8
  184. package/templates/apps/api-backend-mariadb/.env.example +14 -0
  185. package/templates/apps/api-backend-mariadb/mutations/notes.create.mutation.ts +9 -0
  186. package/templates/apps/api-backend-mariadb/package.json +10 -9
  187. package/templates/apps/api-backend-mariadb/queries/notes.query.ts +30 -8
  188. package/templates/apps/api-backend-sqlite/.env.example +14 -0
  189. package/templates/apps/api-backend-sqlite/mutations/notes.create.mutation.ts +9 -0
  190. package/templates/apps/api-backend-sqlite/package.json +9 -8
  191. package/templates/apps/api-backend-sqlite/queries/notes.query.ts +30 -8
  192. package/templates/apps/api-backend-storage/actions/uploadAvatar.action.ts +13 -0
  193. package/templates/apps/api-backend-storage/actions/uploadDocument.action.ts +12 -0
  194. package/templates/apps/api-backend-storage/mutations/notes.create.mutation.ts +9 -0
  195. package/templates/apps/api-backend-storage/package.json +9 -8
  196. package/templates/apps/api-backend-storage/queries/notes.query.ts +30 -8
  197. package/templates/apps/api-cms/actions/content.get.action.ts +7 -0
  198. package/templates/apps/api-cms/actions/content.types.action.ts +6 -0
  199. package/templates/apps/api-cms/actions/me.action.ts +13 -0
  200. package/templates/apps/api-cms/app.config.ts +19 -0
  201. package/templates/apps/api-cms/authz.ts +63 -0
  202. package/templates/apps/api-cms/mutations/content.publish.mutation.ts +10 -0
  203. package/templates/apps/api-cms/mutations/content.saveDraft.mutation.ts +10 -0
  204. package/templates/apps/api-cms/mutations/content.unpublish.mutation.ts +5 -0
  205. package/templates/apps/api-cms/package.json +11 -10
  206. package/templates/apps/api-cms/queries/content.list.query.ts +23 -7
  207. package/templates/apps/api-cms/tests/accessDecisions.test.ts +121 -0
  208. package/templates/apps/api-cms/tests/content.descriptors.test.ts +8 -4
  209. package/templates/apps/api-collab/mutations/documents.create.mutation.ts +8 -0
  210. package/templates/apps/api-collab/mutations/documents.setBody.mutation.ts +13 -0
  211. package/templates/apps/api-collab/package.json +9 -8
  212. package/templates/apps/api-collab/queries/documents.query.ts +19 -7
  213. package/templates/apps/api-data-advanced/package.json +9 -8
  214. package/templates/apps/api-data-advanced/queries/authors.withBooks.query.ts +12 -0
  215. package/templates/apps/api-data-advanced/queries/books.search.query.ts +9 -0
  216. package/templates/apps/api-durable/mutations/orders.approve.mutation.ts +17 -0
  217. package/templates/apps/api-durable/mutations/orders.place.mutation.ts +9 -0
  218. package/templates/apps/api-durable/package.json +9 -8
  219. package/templates/apps/api-feature-flags/actions/notes.export.action.ts +16 -0
  220. package/templates/apps/api-feature-flags/mutations/notes.create.mutation.ts +12 -0
  221. package/templates/apps/api-feature-flags/package.json +10 -9
  222. package/templates/apps/api-governance/README.md +30 -8
  223. package/templates/apps/api-governance/actions/profiles.get.action.server.ts +17 -1
  224. package/templates/apps/api-governance/actions/profiles.get.action.ts +29 -4
  225. package/templates/apps/api-governance/database/schema.ts +16 -4
  226. package/templates/apps/api-governance/mutations/profiles.create.mutation.ts +12 -0
  227. package/templates/apps/api-governance/package.json +9 -8
  228. package/templates/apps/api-kv/actions/sync.pull.action.ts +15 -0
  229. package/templates/apps/api-kv/actions/sync.reset.action.ts +13 -0
  230. package/templates/apps/api-kv/actions/sync.status.action.ts +7 -0
  231. package/templates/apps/api-kv/package.json +9 -8
  232. package/templates/apps/api-kv/queries/events.list.query.ts +19 -8
  233. package/templates/apps/api-moderation/mutations/comments.create.mutation.ts +11 -0
  234. package/templates/apps/api-moderation/mutations/posts.create.mutation.ts +13 -0
  235. package/templates/apps/api-moderation/package.json +9 -8
  236. package/templates/apps/api-observability/mutations/notes.create.mutation.ts +8 -0
  237. package/templates/apps/api-observability/package.json +9 -8
  238. package/templates/apps/api-observability/queries/notes.list.query.ts +13 -0
  239. package/templates/apps/api-ratelimit/mutations/notes.create.mutation.ts +14 -0
  240. package/templates/apps/api-ratelimit/package.json +9 -8
  241. package/templates/apps/api-rbac/package.json +9 -8
  242. package/templates/apps/api-rest/package.json +8 -7
  243. package/templates/apps/api-saas/mutations/projects.create.mutation.ts +13 -0
  244. package/templates/apps/api-saas/package.json +12 -11
  245. package/templates/apps/api-saas/queries/projects.list.query.ts +11 -0
  246. package/templates/apps/api-saas-starter/actions/me.action.ts +13 -0
  247. package/templates/apps/api-saas-starter/app.config.ts +19 -0
  248. package/templates/apps/api-saas-starter/authz.ts +75 -0
  249. package/templates/apps/api-saas-starter/mutations/invites.create.mutation.ts +10 -0
  250. package/templates/apps/api-saas-starter/mutations/projects.create.mutation.ts +9 -0
  251. package/templates/apps/api-saas-starter/package.json +15 -11
  252. package/templates/apps/api-saas-starter/queries/invites.list.query.ts +19 -8
  253. package/templates/apps/api-saas-starter/queries/projects.list.query.ts +18 -7
  254. package/templates/apps/api-saas-starter/tests/accessDecisions.test.ts +135 -0
  255. package/templates/apps/api-search/mutations/articles.create.mutation.ts +14 -0
  256. package/templates/apps/api-search/package.json +9 -8
  257. package/templates/apps/api-search/queries/articles.list.query.ts +21 -8
  258. package/templates/apps/api-status/README.md +10 -3
  259. package/templates/apps/api-status/app.config.ts +8 -3
  260. package/templates/apps/api-status/authz.ts +5 -3
  261. package/templates/apps/api-status/package.json +9 -8
  262. package/templates/apps/api-status/queries/components.list.query.ts +14 -6
  263. package/templates/apps/api-status/queries/incidents.live.query.ts +23 -10
  264. package/templates/apps/api-status/queries/updates.list.query.ts +16 -9
  265. package/templates/apps/api-status/tests/status.test.ts +9 -1
  266. package/templates/apps/api-versioning/actions/documents.asOf.action.ts +12 -0
  267. package/templates/apps/api-versioning/actions/documents.history.action.ts +13 -0
  268. package/templates/apps/api-versioning/mutations/documents.create.mutation.ts +9 -0
  269. package/templates/apps/api-versioning/mutations/documents.update.mutation.ts +12 -0
  270. package/templates/apps/api-versioning/package.json +9 -8
  271. package/templates/apps/api-webhooks/mutations/orders.fulfill.mutation.ts +16 -0
  272. package/templates/apps/api-webhooks/package.json +10 -9
  273. package/templates/apps/api-webhooks/queries/orders.list.query.ts +10 -0
  274. package/templates/apps/changelog/package.json +8 -6
  275. package/templates/apps/edge-functions/package.json +2 -2
  276. package/templates/apps/frontend-admin/package.json +10 -8
  277. package/templates/apps/frontend-admin/src/lib/admin.ts +20 -9
  278. package/templates/apps/frontend-admin/src/locales/de.ts +11 -1
  279. package/templates/apps/frontend-admin/src/locales/en.ts +13 -1
  280. package/templates/apps/frontend-admin/src/pages/admin/[entity]/page.tsx +65 -22
  281. package/templates/apps/frontend-admin/src/pages/admin/entity.test.tsx +130 -23
  282. package/templates/apps/frontend-admin/src/pages/admin/layout.tsx +3 -2
  283. package/templates/apps/frontend-admin/src/pages/admin/page.test.tsx +19 -2
  284. package/templates/apps/frontend-admin/src/pages/admin/page.tsx +9 -4
  285. package/templates/apps/frontend-app/app.config.ts +4 -3
  286. package/templates/apps/frontend-app/package.json +11 -8
  287. package/templates/apps/frontend-app/src/lib/api.ts +25 -0
  288. package/templates/apps/frontend-app/src/pages/page.test.tsx +130 -82
  289. package/templates/apps/frontend-app/src/pages/page.tsx +14 -18
  290. package/templates/apps/frontend-auth/package.json +10 -8
  291. package/templates/apps/frontend-blank/package.json +9 -7
  292. package/templates/apps/frontend-cms/package.json +11 -9
  293. package/templates/apps/frontend-collab/package.json +12 -9
  294. package/templates/apps/frontend-collab/src/pages/page.test.tsx +122 -78
  295. package/templates/apps/frontend-contact/package.json +9 -7
  296. package/templates/apps/frontend-dashboard/package.json +9 -7
  297. package/templates/apps/frontend-docs/package.json +9 -7
  298. package/templates/apps/frontend-i18n/package.json +8 -6
  299. package/templates/apps/frontend-landing/package.json +9 -7
  300. package/templates/apps/frontend-portal/package.json +10 -8
  301. package/templates/apps/frontend-saas/app.config.ts +10 -6
  302. package/templates/apps/frontend-saas/package.json +10 -8
  303. package/templates/apps/frontend-saas/src/lib/api.ts +27 -32
  304. package/templates/apps/frontend-saas/src/pages/dashboard/billing/page.tsx +7 -8
  305. package/templates/apps/frontend-saas/src/pages/dashboard/page.test.tsx +27 -3
  306. package/templates/apps/frontend-saas/src/pages/dashboard/page.tsx +4 -4
  307. package/templates/apps/frontend-saas/src/pages/dashboard/team/page.tsx +3 -4
  308. package/templates/apps/frontend-spa/package.json +9 -7
  309. package/templates/apps/frontend-ssr/package.json +9 -7
  310. package/templates/apps/frontend-ssr-api/package.json +10 -8
  311. package/templates/apps/frontend-static-blog/package.json +8 -6
  312. package/templates/apps/frontend-status/package.json +10 -8
  313. package/templates/apps/mobile-app/README.md +1 -0
  314. package/templates/apps/mobile-app/package.json +4 -2
  315. package/templates/apps/mobile-app/src/app/index.tsx +22 -12
  316. package/templates/apps/mobile-app/src/app/orders/[id].tsx +1 -1
  317. package/templates/apps/mobile-app/src/lib/api.ts +34 -0
  318. package/templates/apps/mobile-app/voltro.mobile.ts +4 -2
  319. package/templates/baselines/bare/.env.example +14 -0
  320. package/templates/baselines/bare/baseline.json +4 -4
  321. package/templates/baselines/compose/.env.example +14 -0
  322. package/templates/baselines/compose/README.md +1 -1
  323. package/templates/baselines/compose/baseline.json +5 -5
  324. package/templates/baselines/compose-mariadb/.env.example +14 -0
  325. package/templates/baselines/compose-mariadb/README.md +1 -1
  326. package/templates/baselines/compose-mariadb/baseline.json +5 -5
  327. package/templates/baselines/helm/.env.example +14 -0
  328. package/templates/baselines/helm/baseline.json +4 -4
  329. package/dist/apiBuild-C-x9YacA.js +0 -2
  330. package/dist/appGraph-CvQCte0z.js +0 -2
  331. package/dist/checkCommand-DRovTKza.js +0 -2
  332. package/dist/commands-CJfepbm4.js +0 -11541
  333. package/dist/dbCommand-b1gum4td.js +0 -2
  334. package/dist/dev-iiMtlkfs.js +0 -3
  335. package/dist/devActivity-BhIu6ncs.js +0 -159
  336. package/dist/frameworkTableAssembly-BwIrO5nv.js +0 -638
  337. package/dist/frameworkTableAssembly-D-EebUQX.js +0 -2
  338. package/dist/inspect-mmBuRXmy.js +0 -2
  339. package/dist/manifestBuild-Dj8Jjoto.js +0 -2
  340. package/dist/seedRunner-Bqxgp7HZ.js +0 -230
  341. package/dist/serveCommand-DdaM4Hup.js +0 -1608
  342. package/dist/start-C0koT0UO.js +0 -1084
  343. /package/templates/apps/api-ai/actions/{summarize.action.server.tsx → summarize.action.server.ts} +0 -0
@@ -1,377 +1,39 @@
1
- import { t as e } from "./cliRuntime-Oh517vCV.js";
2
- import { T as t, h as n, m as r } from "./fileConventions-Cof68_BL.js";
3
- import { A as i, E as a, O as o, a as s, k as c, m as l } from "./inspect-BUUjt773.js";
4
- import { basename as u, dirname as d, isAbsolute as f, join as p, relative as m, resolve as h } from "node:path";
5
- import { fileURLToPath as g, pathToFileURL as _ } from "node:url";
6
- import { FileSystem as v } from "@effect/platform";
7
- import { NodeContext as y } from "@effect/platform-node";
8
- import { Effect as b } from "effect";
9
- import { addSink as x, createLogger as S, printReadyBlock as C } from "@voltro/logger";
10
- import { closeSync as w, existsSync as T, mkdirSync as E, openSync as D, promises as O, readFileSync as k, readdirSync as A, statSync as j, unlinkSync as M, unwatchFile as N, watchFile as ee, writeSync as P } from "node:fs";
11
- import { currentTraceContext as F, recordSample as I, resolveSecret as te } from "@voltro/runtime";
12
- import { homedir as L } from "node:os";
1
+ import { t as e } from "./nodeEnvironment-cGFAj1J8.js";
2
+ import { n as t } from "./loadEnv-D9nEOClM.js";
3
+ import { r as n } from "./appPort-B_HpJ_ck.js";
4
+ import { h as r, m as i } from "./fileConventions-Cof68_BL.js";
5
+ import { A as a, D as o, a as s, h as c, j as l, k as u } from "./inspect-CjTYzAs_.js";
6
+ import { n as d } from "./agentsMd-mhQMF1bx.js";
7
+ import { c as f, p, t as m } from "./renderModeScan-D7J1B7Kw.js";
8
+ import { t as h } from "./pageConvention-cEiRxdab.js";
9
+ import { i as g, n as _, r as v, t as y } from "./runtimeRegistry-DMeKfTHP.js";
10
+ import { n as b } from "./logFileSink-C_D2wRN1.js";
11
+ import { basename as x, dirname as S, join as C, relative as w, resolve as T } from "node:path";
12
+ import { existsSync as E, promises as D, readFileSync as O, readdirSync as k, statSync as A, unwatchFile as j, watchFile as M } from "node:fs";
13
+ import { fileURLToPath as N, pathToFileURL as P } from "node:url";
14
+ import { addSink as F, createLogger as I, printReadyBlock as L } from "@voltro/logger";
13
15
  import { createRequire as R } from "node:module";
14
- import { FRAMEWORK_ENV_CATALOG as ne, appEnvEntries as re, checkEnvNaming as z, formatEnvErrors as ie, installEnvSnapshot as B, isEnvContract as ae, pluginEnvEntries as V, renderDotEnvExample as oe, resolveEnv as se } from "@voltro/env";
15
- import { __installPublicEnv as ce } from "@voltro/env/public";
16
- import { mkdir as H, readFile as le, writeFile as ue } from "node:fs/promises";
17
- import { createHash as de } from "node:crypto";
18
- import { spawn as fe } from "node:child_process";
19
- import { createConnection as pe } from "node:net";
20
- import { PassThrough as me } from "node:stream";
21
- //#region src/agentsMd.ts
22
- var U = d(g(import.meta.url)), W = [h(U, "..", "templates"), h(U, "..", "..", "templates")], he = (e) => ({
23
- _tag: "TemplateNotFoundError",
24
- searched: e
25
- }), G = ["AGENTS.md", "CLAUDE.md"], ge = "voltro:agents-md:keep", _e = 2048, ve = "<!-- VOLTRO:INDEX -->", ye = (e) => /^#\s*What's new in\s+(\d+\.\d+\.\d+[^\s]*)\s*$/m.exec(e)?.[1] ?? null, be = (e) => e.templatesVersion !== null && e.installedVersion !== null && e.templatesVersion !== e.installedVersion, K = (e, t) => e.exists(t).pipe(b.orElseSucceed(() => !1)), q = (e, t) => e.readFileString(t).pipe(b.orElseSucceed(() => "")), xe = (e, t) => e.readFileString(t).pipe(b.map((e) => {
26
- try {
27
- return JSON.parse(e).workspaces !== void 0;
28
- } catch {
29
- return !1;
30
- }
31
- }), b.orElseSucceed(() => !1)), Se = (e) => b.gen(function* () {
32
- let t = yield* v.FileSystem, n = h(e);
33
- for (;;) {
34
- if ((yield* K(t, p(n, ".git"))) || (yield* K(t, p(n, "pnpm-workspace.yaml"))) || (yield* xe(t, p(n, "package.json")))) return n;
35
- let r = d(n);
36
- if (r === n) return h(e);
37
- n = r;
38
- }
39
- }), Ce = (e, t, n) => b.gen(function* () {
40
- yield* e.makeDirectory(n, { recursive: !0 }).pipe(b.orElseSucceed(() => void 0));
41
- let r = yield* e.readDirectory(t).pipe(b.orElseSucceed(() => []));
42
- for (let i of r) {
43
- let r = p(t, i), a = p(n, i);
44
- (yield* e.stat(r).pipe(b.orElseSucceed(() => null)))?.type === "Directory" ? yield* Ce(e, r, a) : yield* e.copyFile(r, a).pipe(b.orElseSucceed(() => void 0));
45
- }
46
- }), we = (e) => typeof e?.name == "string" && e.name.length > 0 ? e.name.split("#")[0] : null, Te = (e, t) => b.gen(function* () {
47
- let n = p(t, "app.config.ts");
48
- if (!(yield* K(e, n))) return null;
49
- let r = (yield* b.tryPromise(() => import(_(n).href)).pipe(b.orElseSucceed(() => null)))?.default;
50
- return !r || r.type && r.type !== "api" ? r?.type === "web" ? [] : null : (r.plugins ?? []).map(we).filter((e) => e !== null);
51
- }), Ee = (e, t) => b.gen(function* () {
52
- let n = [], r = [], i = p(t, "apps");
53
- if (!(yield* K(e, i))) return {
54
- apis: n,
55
- webs: r
56
- };
57
- for (let t of yield* e.readDirectory(i).pipe(b.orElseSucceed(() => []))) {
58
- let a = p(i, t);
59
- if ((yield* e.stat(a).pipe(b.orElseSucceed(() => null)))?.type === "Directory") for (let t of yield* e.readDirectory(a).pipe(b.orElseSucceed(() => []))) {
60
- let i = p(a, t), o = p(i, "app.config.ts");
61
- if (!(yield* K(e, o))) continue;
62
- let s = yield* q(e, o);
63
- /type:\s*['"]web['"]/.test(s) ? r.push(i) : n.push(i);
64
- }
65
- }
66
- return {
67
- apis: n,
68
- webs: r
69
- };
70
- }), De = (e) => e.replace(/\|/g, "\\|").replace(/\n/g, " ").trim(), Oe = (e, t, n) => {
71
- let r = [
72
- "<!-- voltro agent-docs index — regenerated at seed time -->",
73
- "## Deep reference (read on demand)",
74
- "",
75
- "Each row is a file to OPEN when you work on that topic — not loaded into",
76
- "context by default. Paths are from the repo root.",
77
- "",
78
- "### Topics",
79
- "",
80
- "| Topic | Open | Summary |",
81
- "|---|---|---|",
82
- ...e.modules.map((e) => `| ${e.title} | \`${n}${e.path}\` | ${De(e.description)} |`),
83
- ""
84
- ], i = new Map(e.plugins.map((e) => [e.pkg, e])), a = (e, t) => e.module === void 0 ? `\`node_modules/${t}/README.md\`` : `\`${n}${e.module}\` (or \`node_modules/${t}/README.md\`)`, o = t === null ? e.plugins.map((e) => `| ${e.slug} | ${a(e, e.pkg)} | ${De(e.description)} |`) : t.map((e) => {
85
- let t = i.get(e);
86
- return t ? `| ${t.slug} | ${a(t, e)} | ${De(t.description)} |` : `| ${e.replace(/^@[^/]+\//, "")} | \`node_modules/${e}/README.md\` | (see plugin README) |`;
87
- });
88
- return r.push(`### Plugins${t === null ? "" : " (installed)"}`, "", "| Plugin | Open | Summary |", "|---|---|---|"), r.push(o.length ? o.join("\n") : "| _(none installed)_ | | |", ""), r.join("\n");
89
- }, ke = (e, t, n) => {
90
- let r = t.templates?.[e] ?? t.templates?.[e.replace(/^frontend-/, "")];
91
- return `\nScaffolded from the \`${e}\` template — see \`${r ? `${n}${r}` : `${n}agent-docs/templates/overview.md`}\`.\n`;
92
- }, Ae = {
93
- api: (e, t, n = "") => `# api — agent notes
94
-
95
- You are in a Voltro **api** app. Server primitives live here: \`queries/\`,
96
- \`mutations/\`, \`actions/\`, \`workflows/\`, \`database/\`, \`schedules/\`.
97
-
98
- - Every RPC primitive is a descriptor + \`*.server.ts\` executor pair. Descriptors
99
- are **browser-loaded** — keep them free of \`node:*\` / \`@voltro/database\` /
100
- server-only imports (transitively too).
101
- - Pick the primitive with the rubric in the repo-root \`AGENTS.md\`.
102
-
103
- Deep reference (paths from the repo root):
104
- - Data primitives → \`${e}agent-docs/data.md\`
105
- - Schema / queries → \`${e}agent-docs/database/schema.md\`, \`${e}agent-docs/database/querying.md\`
106
- - Workflows → \`${e}agent-docs/workflows.md\`
107
- ${t && t.length ? `\nThis api's plugins: ${t.join(", ")} (API in each \`node_modules/<pkg>/README.md\`).` : ""}
108
- ${n}`,
109
- database: (e) => `# database — agent notes
110
-
111
- Schema lives here: one table per \`*.entity.ts\`; \`index.ts\` builds the handle.
112
-
113
- - Mixins compose via \`.with(...)\` and auto-stamp columns; declare \`.index([...])\`
114
- AFTER \`.with(...)\`. Indexes are table-level (no column-level \`.index()\`).
115
- - Don't add tenant filters on \`tenant()\` tables — the runtime does it.
116
-
117
- Deep reference (paths from the repo root): \`${e}agent-docs/database/schema.md\`,
118
- \`${e}agent-docs/database/columntypes.md\`, \`${e}agent-docs/database/querying.md\`,
119
- \`${e}agent-docs/database/migrations.md\`.
120
- `,
121
- web: (e, t = "") => `# web — agent notes
122
-
123
- You are in a Voltro **web** app. File-based routing under \`src/pages/**\`.
124
-
125
- - Use \`useSubscription\` / \`useMutation\` / \`useAction\` from \`@voltro/client\`.
126
- - Never read \`window.location\` (use \`useLocation()\`); never toggle \`dark\` from
127
- \`useEffect\` (set \`theme\` in \`app.config.ts\`).
128
-
129
- Deep reference (paths from the repo root): \`${e}agent-docs/routing.md\`,
130
- \`${e}agent-docs/schema-driven-ui.md\`, \`${e}agent-docs/internationalization.md\`.
131
- ${t}`
132
- }, je = [
133
- {
134
- name: "voltro-schema",
135
- description: "Define or change a Voltro database table/schema (columns, mixins, indexes, relations).",
136
- module: "database/schema.md"
137
- },
138
- {
139
- name: "voltro-data",
140
- description: "Write a Voltro query, mutation, action, or stream (the descriptor + server executor pair).",
141
- module: "data.md"
142
- },
143
- {
144
- name: "voltro-workflows",
145
- description: "Write or debug a durable Voltro workflow (steps, signals, retries).",
146
- module: "workflows.md"
147
- },
148
- {
149
- name: "voltro-routing",
150
- description: "Add or change a Voltro web page, layout, loader, or render mode.",
151
- module: "routing.md"
152
- },
153
- {
154
- name: "voltro-plugins",
155
- description: "Wire a Voltro plugin (storage, mail, billing, auth, rbac, …) into an app.",
156
- module: "plugins.md"
157
- },
158
- {
159
- name: "voltro-data-transfer",
160
- description: "Export/import + backup/restore Voltro data & assets, and copy prod→dev/stage SAFELY with fail-closed masking/anonymization (.sensitive()/.safe()) + referential subsetting. Use for data takeout, seeding lower envs, backups, or cross-dialect moves.",
161
- module: "cli.md"
162
- }
163
- ], Me = (e, t) => `---
164
- name: ${e.name}
165
- description: ${e.description}
166
- ---
167
-
168
- Open the full reference and follow the patterns there:
169
-
170
- \`${t}agent-docs/${e.module}\`
171
-
172
- Also read the repo-root \`AGENTS.md\` for the always-true rules (browser/server
173
- boundary, naming, anti-patterns) before editing.
174
- `, Ne = (e, t, n, r) => b.gen(function* () {
175
- let i = yield* K(e, t);
176
- if (i) {
177
- if ((yield* q(e, t)).slice(0, _e).includes("voltro:agents-md:keep")) return {
178
- path: t,
179
- action: "protected"
180
- };
181
- if (!r) return {
182
- path: t,
183
- action: "present"
184
- };
185
- }
186
- return yield* e.makeDirectory(d(t), { recursive: !0 }).pipe(b.orElseSucceed(() => void 0)), yield* e.writeFileString(t, n).pipe(b.orDie), {
187
- path: t,
188
- action: i ? "overwritten" : "created"
189
- };
190
- }), Pe = (e, t = {}) => b.gen(function* () {
191
- let n = yield* v.FileSystem, r = yield* Se(e), i = null;
192
- for (let e of W) if (yield* K(n, p(e, "AGENTS.core.md"))) {
193
- i = e;
194
- break;
195
- }
196
- if (i === null) {
197
- for (let e of W) if (yield* K(n, p(e, "AGENTS.md"))) {
198
- let i = yield* q(n, p(e, "AGENTS.md")), a = [];
199
- for (let e of G) a.push(yield* Ne(n, p(r, e), i, t.force ?? !1));
200
- return { files: a };
201
- }
202
- return yield* b.fail(he(W.map((e) => p(e, "AGENTS.core.md"))));
203
- }
204
- let a = yield* q(n, p(i, "AGENTS.core.md")), o = yield* q(n, p(i, "agent-docs", "_manifest.json")), s = o ? JSON.parse(o) : {
205
- modules: [],
206
- plugins: []
207
- }, c = (t.preferPointer ?? !1) || (yield* K(n, p(r, "node_modules/@voltro/cli/templates/agent-docs", "_manifest.json"))), l = c ? "node_modules/@voltro/cli/templates/" : "", u = t.force ?? !1, d = (e) => q(n, e).pipe(b.map((e) => {
208
- if (!e) return null;
209
- try {
210
- return JSON.parse(e).version ?? null;
211
- } catch {
212
- return null;
213
- }
214
- })), f = {
215
- templatesVersion: yield* d(p(i, "..", "package.json")),
216
- installedVersion: yield* d(p(r, "node_modules", "@voltro", "cli", "package.json")),
217
- whatsNewVersion: ye(yield* q(n, p(i, "agent-docs", "whats-new.md"))),
218
- copiedIn: !c
219
- }, m = G.map((e) => p(r, e));
220
- if ((yield* b.forEach(m, (e) => q(n, e).pipe(b.map((e) => e.slice(0, _e))))).every((e) => e.includes("voltro:agents-md:keep"))) return {
221
- files: m.map((e) => ({
222
- path: e,
223
- action: "protected"
224
- })),
225
- provenance: f
226
- };
227
- let { apis: g, webs: _ } = yield* Ee(n, r), y = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Set(), S = !1;
228
- for (let e of g) {
229
- let t = yield* Te(n, e);
230
- if (y.set(e, t), t !== null) {
231
- S = !0;
232
- for (let e of t) x.add(e);
233
- }
234
- }
235
- let C = t.plugins ? t.plugins.map(we).filter((e) => e !== null) : S ? [...x] : null, w = a.includes(ve) ? a.replace(ve, Oe(s, C, l)) : a, T = [];
236
- for (let e of m) T.push(yield* Ne(n, e, w, u));
237
- c || (yield* Ce(n, p(i, "agent-docs"), p(r, "agent-docs")));
238
- let E = new Map((t.appTemplates ?? []).map((e) => [h(e.dir), e.template])), D = (e) => {
239
- let t = E.get(h(e));
240
- return t ? ke(t, s, l) : "";
241
- }, O = (e, t) => b.forEach(G, (r) => Ne(n, p(e, r), t, u));
242
- for (let e of g) T.push(...yield* O(e, Ae.api(l, y.get(e) ?? null, D(e)))), (yield* K(n, p(e, "database"))) && T.push(...yield* O(p(e, "database"), Ae.database(l)));
243
- for (let e of _) T.push(...yield* O(e, Ae.web(l, D(e))));
244
- for (let e of je) T.push(yield* Ne(n, p(r, ".claude", "skills", e.name, "SKILL.md"), Me(e, l), u));
245
- return {
246
- files: T,
247
- provenance: f
248
- };
249
- }), Fe = (e, t = {}) => b.runPromise(Pe(e, t).pipe(b.provide(y.layer))), Ie = async (t) => {
250
- let n = t.includes("--force"), r = t.find((e) => !e.startsWith("-")) ?? process.cwd();
251
- return e(b.gen(function* () {
252
- let e = yield* Pe(r, { force: n });
253
- for (let t of e.files) {
254
- let e = t.action === "created" ? "wrote" : t.action === "overwritten" ? "overwrote" : t.action === "protected" ? `protected (hand-maintained — has "${ge}")` : "present (use --force to overwrite)";
255
- yield* b.logInfo(`${t.path.split("/").slice(-2).join("/")} ${e}`, { action: t.action });
256
- }
257
- let t = e.provenance;
258
- return t !== void 0 && (yield* b.logInfo(`seeded from @voltro/cli ${t.templatesVersion ?? "unknown"} (project has ${t.installedVersion ?? "no resolvable @voltro/cli"}; whats-new describes ${t.whatsNewVersion ?? "unknown"}; modules ${t.copiedIn ? "COPIED into ./agent-docs" : "pointed at node_modules"})`, {
259
- templates: t.templatesVersion,
260
- installed: t.installedVersion,
261
- whatsNew: t.whatsNewVersion
262
- }), be(t) && (yield* b.logWarning(`the \`voltro\` binary that ran is ${t.templatesVersion}, but this project installs ${t.installedVersion} — everything just written describes the OLDER version. Run it through the project's own cli (\`pnpm exec voltro agents-md --force\`) so the guide matches what the app boots.`))), 0;
263
- }).pipe(b.catchTag("TemplateNotFoundError", (e) => b.gen(function* () {
264
- return yield* b.logError("AGENTS.md template not found", { searched: e.searched }), 1;
265
- }))), { scope: "voltro:agents-md" });
266
- }, Le = p(L(), ".voltro"), Re = p(Le, "runtime-registry.json"), ze = 3e4, Be = () => {
267
- let e = Math.random().toString(36).slice(2, 10);
268
- return `${Re}.${process.pid}.${Date.now()}.${e}.tmp`;
269
- }, Ve = async () => {
270
- await O.mkdir(Le, { recursive: !0 });
271
- }, He = async () => {
272
- try {
273
- let e = await O.readFile(Re, "utf8"), t = JSON.parse(e);
274
- return t.version !== 1 || !Array.isArray(t.apps) ? {
275
- version: 1,
276
- apps: []
277
- } : t;
278
- } catch {
279
- return {
280
- version: 1,
281
- apps: []
282
- };
283
- }
284
- }, Ue = async (e) => {
285
- await Ve();
286
- let t = Be();
287
- try {
288
- await O.writeFile(t, JSON.stringify(e, null, 2), {
289
- encoding: "utf8",
290
- mode: 384
291
- }), await O.rename(t, Re), await O.chmod(Re, 384).catch(() => {});
292
- } catch (e) {
293
- try {
294
- await O.unlink(t);
295
- } catch {}
296
- throw e;
297
- }
298
- }, We = (e) => {
299
- try {
300
- return process.kill(e, 0), !0;
301
- } catch {
302
- return !1;
303
- }
304
- }, Ge = (e) => {
305
- let t = Date.now();
306
- return e.filter((e) => We(e.pid) ? t - new Date(e.heartbeatAt).getTime() < ze : !1);
307
- }, Ke = async () => {
308
- let e = await He(), t = Ge(e.apps);
309
- if (t.length === e.apps.length) return e;
310
- try {
311
- await Ue({
312
- version: 1,
313
- apps: t
314
- });
315
- } catch {}
316
- return {
317
- version: 1,
318
- apps: t
319
- };
320
- }, qe = async (e) => {
321
- let t = await He(), n = (/* @__PURE__ */ new Date()).toISOString(), r = t.apps.findIndex((t) => t.id === e.id), i = e.inspectToken ?? process.env.VOLTRO_INSPECT_TOKEN, a = {
322
- ...e,
323
- ...i !== void 0 && i !== "" ? { inspectToken: i } : {},
324
- registeredAt: r >= 0 ? t.apps[r].registeredAt : n,
325
- heartbeatAt: n
326
- };
327
- await Ue({
328
- version: 1,
329
- apps: r >= 0 ? t.apps.map((e, t) => t === r ? a : e) : [...t.apps, a]
330
- });
331
- }, Je = async (e) => {
332
- try {
333
- let t = await He(), n = t.apps.filter((t) => t.id !== e);
334
- if (n.length === t.apps.length) return;
335
- await Ue({
336
- version: 1,
337
- apps: n
338
- });
339
- } catch {}
340
- }, Ye = (e, t, n) => `${e}:${t}:${n}`, Xe = (e) => e.replace(/\\"|"(?:[^"\\]|\\.)*"|(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g, (e, t) => t ? "" : e), Ze = (e) => {
341
- try {
342
- let t = p(e, "tsconfig.json");
343
- if (!T(t)) return [];
344
- let n = JSON.parse(Xe(k(t, "utf8"))).compilerOptions ?? {}, r = n.paths ?? {}, i = h(e, n.baseUrl ?? "."), a = [];
345
- for (let [e, t] of Object.entries(r)) {
346
- let n = t[0];
347
- if (!n) continue;
348
- let r = n.replace(/\\/g, "/");
349
- if (!(r.includes("/@types/") || r.endsWith(".d.ts"))) if (e.endsWith("/*") && n.endsWith("/*")) {
350
- let t = e.slice(0, -2).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
351
- a.push({
352
- find: RegExp(`^${t}/(.*)$`),
353
- replacement: `${p(i, n.slice(0, -2))}/$1`
354
- });
355
- } else a.push({
356
- find: e,
357
- replacement: p(i, n)
358
- });
359
- }
360
- return a;
361
- } catch {
362
- return [];
363
- }
364
- }, Qe = (e) => {
16
+ import { homedir as ee } from "node:os";
17
+ import { currentTraceContext as z, resolveSecret as B } from "@voltro/runtime";
18
+ import { FRAMEWORK_ENV_CATALOG as V, appEnvEntries as te, checkEnvNaming as H, formatEnvErrors as ne, installEnvSnapshot as U, isEnvContract as re, pluginEnvEntries as W, renderDotEnvExample as ie, resolveEnv as ae } from "@voltro/env";
19
+ import { __installPublicEnv as oe } from "@voltro/env/public";
20
+ import { mkdir as G, writeFile as K } from "node:fs/promises";
21
+ import { createHash as se } from "node:crypto";
22
+ import { spawn as ce } from "node:child_process";
23
+ import { createConnection as le } from "node:net";
24
+ import { PassThrough as ue } from "node:stream";
25
+ //#region src/buildToolImport.ts
26
+ var de = (e) => {
365
27
  let t = e;
366
28
  return t?.code === "ERR_MODULE_NOT_FOUND" || /Cannot find (package|module)/.test(String(t?.message ?? ""));
367
- }, $e = async (e, t) => {
29
+ }, fe = async (e, t) => {
368
30
  try {
369
31
  return await t();
370
32
  } catch (t) {
371
- throw Qe(t) ? Error(`voltro: the build tool '${e}' is not installed.\n\nIt's an OPTIONAL dependency of @voltro/cli — needed by 'voltro dev' and 'voltro build', but excluded from a serve-only production install (that's how prod images stay lean). If you are building, reinstall WITHOUT '--no-optional' (e.g. 'pnpm install'). A production SERVE container does not need '${e}' — it boots from the precompiled bundle.`) : t;
33
+ throw de(t) ? Error(`voltro: the build tool '${e}' is not installed.\n\nIt's an OPTIONAL dependency of @voltro/cli — needed by 'voltro dev' and 'voltro build', but excluded from a serve-only production install (that's how prod images stay lean). If you are building, reinstall WITHOUT '--no-optional' (e.g. 'pnpm install'). A production SERVE container does not need '${e}' — it boots from the precompiled bundle.`) : t;
372
34
  }
373
- }, et = "// AUTO-GENERATED by Voltro — DO NOT EDIT.\n// Source: app.config.ts `env` (defineEnv). Regenerated on every `voltro dev` boot.\n", tt = (e, t) => t ? `${e} | undefined` : e, nt = (e, t) => Object.entries(e.vars).filter(([, e]) => t(e.access)).map(([e, t]) => `${t.description ? ` /** ${t.description} */\n` : ""} readonly ${e}: ${tt(t.tsType, t.optional)}`).join("\n"), rt = async (e, t) => {
374
- let n = nt(t, () => !0), r = `${et}
35
+ }, pe = "// AUTO-GENERATED by Voltro — DO NOT EDIT.\n// Source: app.config.ts `env` (defineEnv). Regenerated on every `voltro dev` boot.\n", me = (e, t) => t ? `${e} | undefined` : e, q = (e, t) => Object.entries(e.vars).filter(([, e]) => t(e.access)).map(([e, t]) => `${t.description ? ` /** ${t.description} */\n` : ""} readonly ${e}: ${me(t.tsType, t.optional)}`).join("\n"), he = async (e, t) => {
36
+ let n = q(t, () => !0), r = `${pe}
375
37
  import '@voltro/env/server'
376
38
 
377
39
  declare module '@voltro/env/server' {
@@ -380,9 +42,9 @@ ${n.length > 0 ? n : " // (no variables declared)"}
380
42
  }
381
43
  }
382
44
  `;
383
- await ue(p(e, "env.generated.d.ts"), r, "utf8");
384
- }, it = async (e, t) => {
385
- let n = nt(t, (e) => e === "public"), r = `${et}
45
+ await K(C(e, "env.generated.d.ts"), r, "utf8");
46
+ }, ge = async (e, t) => {
47
+ let n = q(t, (e) => e === "public"), r = `${pe}
386
48
  import '@voltro/env/public'
387
49
 
388
50
  declare module '@voltro/env/public' {
@@ -390,10 +52,10 @@ declare module '@voltro/env/public' {
390
52
  ${n.length > 0 ? n : " // (no public variables declared)"}
391
53
  }
392
54
  }
393
- `, i = p(e, "src");
394
- await H(i, { recursive: !0 }), await ue(p(i, "voltro-env.d.ts"), r, "utf8");
395
- }, at = async (e, t) => {
396
- let n = `${et}
55
+ `, i = C(e, "src");
56
+ await G(i, { recursive: !0 }), await K(C(i, "voltro-env.d.ts"), r, "utf8");
57
+ }, J = async (e, t) => {
58
+ let n = `${pe}
397
59
  import { __installPublicEnv } from '@voltro/env/public'
398
60
 
399
61
  export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
@@ -401,14 +63,14 @@ export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
401
63
  // Set the browser/SSR-shared global the \`publicEnv\` accessor reads.
402
64
  __installPublicEnv(publicEnvValues)
403
65
  `;
404
- await H(e, { recursive: !0 }), await ue(p(e, "env.public.ts"), n, "utf8");
405
- }, ot = async (e) => {
406
- let t = ae(e.rawEnv) ? e.rawEnv : void 0, n = await se({
66
+ await G(e, { recursive: !0 }), await K(C(e, "env.public.ts"), n, "utf8");
67
+ }, _e = async (e) => {
68
+ let t = re(e.rawEnv) ? e.rawEnv : void 0, n = await ae({
407
69
  contract: t,
408
- resolveSecret: te
409
- }), r = [...n.errors, ...z(t, e.appType)];
410
- if (r.length > 0) throw Error(ie(r));
411
- B(n.values), e.appType === "web" && ce(n.publicValues);
70
+ resolveSecret: B
71
+ }), r = [...n.errors, ...H(t, e.appType)];
72
+ if (r.length > 0) throw Error(ne(r));
73
+ U(n.values), e.appType === "web" && oe(n.publicValues);
412
74
  let i = t ? Object.keys(t.vars).length : 0;
413
75
  if (i > 0) {
414
76
  let r = Object.keys(n.publicValues).length;
@@ -420,20 +82,20 @@ __installPublicEnv(publicEnvValues)
420
82
  n.length > 0 && e.log.warn(`env: ${n.length} secret var(s) declared on a web app — secrets are reachable only from server-side render code and are NEVER bundled. Prefer declaring secrets on the api.`, { keys: n });
421
83
  }
422
84
  }
423
- return e.generateTypes && t && (e.appType === "api" ? await rt(e.root, t) : await it(e.root, t)), {
85
+ return e.generateTypes && t && (e.appType === "api" ? await he(e.root, t) : await ge(e.root, t)), {
424
86
  resolved: n,
425
87
  contract: t
426
88
  };
427
- }, st = (e) => {
428
- let t = re(e.contract), n = (e.plugins ?? []).flatMap((e) => V(e.name, e.declaredEnv)), r = e.includeFramework === !1 ? [] : ne, i = /* @__PURE__ */ new Set(), a = [];
89
+ }, ve = (e) => {
90
+ let t = te(e.contract), n = (e.plugins ?? []).flatMap((e) => W(e.name, e.declaredEnv)), r = e.includeFramework === !1 ? [] : V, i = /* @__PURE__ */ new Set(), a = [];
429
91
  for (let e of [
430
92
  ...t,
431
93
  ...n,
432
94
  ...r
433
95
  ]) i.has(e.key) || (i.add(e.key), a.push(e));
434
96
  return a;
435
- }, ct = (e, t, n = (e) => process.env[e]) => {
436
- let r = st(t).map((e) => {
97
+ }, ye = (e, t, n = (e) => process.env[e]) => {
98
+ let r = ve(t).map((e) => {
437
99
  let t = n(e.key) !== void 0;
438
100
  return {
439
101
  ...e,
@@ -450,93 +112,56 @@ __installPublicEnv(publicEnvValues)
450
112
  missingRequired: r.filter((e) => e.required && !e.isSet && e.default === void 0).length
451
113
  }
452
114
  };
453
- }, lt = (e, t) => oe(st({
115
+ }, be = (e, t) => ie(ve({
454
116
  ...e,
455
117
  includeFramework: !1
456
118
  }), {
457
119
  includeFramework: e.includeFramework !== !1,
458
120
  ...t ? { header: t } : {}
459
- }), ut = () => {
460
- let e = /* @__PURE__ */ new Map();
461
- return {
462
- get(t) {
463
- return e.get(t);
464
- },
465
- set(t, n) {
466
- e.set(t, n);
467
- },
468
- invalidate(t) {
469
- e.delete(t);
470
- },
471
- invalidateBy(t) {
472
- let n = 0;
473
- for (let r of e.keys()) t(r) && (e.delete(r), n++);
474
- return n;
475
- },
476
- clear() {
477
- e.clear();
478
- },
479
- size() {
480
- return e.size;
481
- },
482
- snapshot() {
483
- return Array.from(e.entries());
484
- }
485
- };
486
- }, J = (e) => {
487
- if (typeof e == "number" && Number.isFinite(e) && e > 0) return e * 1e3;
488
- if (typeof e != "string") return null;
489
- let t = /^\s*(\d+)\s*(s|seconds?|m|minutes?|h|hours?|d|days?)\s*$/i.exec(e);
490
- if (!t) return null;
491
- let n = parseInt(t[1], 10);
492
- if (!Number.isFinite(n) || n <= 0) return null;
493
- let r = t[2].toLowerCase();
494
- return r === "s" || r.startsWith("second") ? n * 1e3 : r === "m" || r.startsWith("minute") ? n * 6e4 : r === "h" || r.startsWith("hour") ? n * 36e5 : r === "d" || r.startsWith("day") ? n * 864e5 : null;
495
- }, dt = (e, t = {}) => {
496
- let n = [e];
497
- return t.tenant !== void 0 && t.tenant !== "" && n.push(`tenant=${t.tenant}`), t.locale !== void 0 && t.locale !== "" && n.push(`lang=${t.locale}`), n.join("|");
498
- }, ft = (e, t) => e.expiresAt > t, pt = (e, t) => e.expiresAt <= t && e.servableUntil > t, mt = S({ scope: "voltro:cli" }), ht = (e, t) => {
499
- if (t?.code !== "EACCES") return "";
500
- if (typeof process.getuid != "function") return " — permission denied";
121
+ }), xe = async (e, t) => {
122
+ let n = e;
123
+ for (;;) {
124
+ let e = C(n, "node_modules", t);
125
+ try {
126
+ if ((await D.stat(e)).isDirectory()) {
127
+ let t = await D.realpath(e);
128
+ return t.includes("/node_modules/") ? null : t;
129
+ }
130
+ } catch {}
131
+ let r = S(n);
132
+ if (r === n) return null;
133
+ n = r;
134
+ }
135
+ }, Se = async (e) => {
136
+ let t;
501
137
  try {
502
- let t = j(e);
503
- return ` — permission denied: the file is owned by uid ${t.uid} (mode ${(t.mode & 511).toString(8)}) and this process is uid ${process.getuid()}. A container running as root with the workspace bind-mounted writes files the host user cannot read; run it as \`--user <your-uid>:<your-gid>\`, or delete the file and let the owning user recreate it.`;
138
+ let n = await D.readFile(C(e, "package.json"), "utf8"), r = JSON.parse(n);
139
+ t = Object.keys({
140
+ ...r.dependencies,
141
+ ...r.devDependencies
142
+ });
504
143
  } catch {
505
- return " — permission denied (and the file could not be stat-ed either)";
144
+ return [];
506
145
  }
507
- }, gt = [], _t = (e) => {
508
- gt.length = 0;
509
- let t = e[1] && !e[1].startsWith("-") ? e[1] : void 0, n = t ? f(t) ? t : h(process.cwd(), t) : process.cwd(), r = [], i = n;
510
- for (;;) {
511
- r.push(i);
512
- let e = d(i);
513
- if (e === i) break;
514
- i = e;
515
- }
516
- for (let e of r) for (let t of [".env.local", ".env"]) {
517
- let n = h(e, t);
518
- if (T(n)) {
519
- gt.push(n);
520
- try {
521
- let e = k(n, "utf8");
522
- for (let t of e.split(/\r?\n/)) {
523
- let e = t.trim();
524
- if (e === "" || e.startsWith("#")) continue;
525
- let n = e.indexOf("=");
526
- if (n < 1) continue;
527
- let r = e.slice(0, n).trim(), i = e.slice(n + 1).trim();
528
- (i.startsWith("\"") && i.endsWith("\"") || i.startsWith("'") && i.endsWith("'")) && (i = i.slice(1, -1)), process.env[r] === void 0 && (process.env[r] = i);
529
- }
530
- } catch (e) {
531
- mt.warn(`failed to load env file (continuing)${ht(n, e)}`, { path: n }, e);
532
- }
146
+ return (await Promise.all(t.map(async (t) => {
147
+ let n = await xe(e, t);
148
+ if (n === null) return null;
149
+ let r = C(n, "src");
150
+ try {
151
+ if (!(await D.stat(r)).isDirectory()) return null;
152
+ } catch {
153
+ return null;
533
154
  }
534
- }
535
- }, vt = 500, yt = (e, t, n = {}) => {
155
+ return {
156
+ pkg: t,
157
+ dir: r
158
+ };
159
+ }))).filter((e) => e !== null);
160
+ }, Ce = 500, we = (e, t, n = {}) => {
536
161
  if (e.length === 0) return () => {};
537
- let r = (e) => n.root ? m(n.root, e) : e, i = !1, a = (e) => {
162
+ let r = (e) => n.root ? w(n.root, e) : e, i = !1, a = (e) => {
538
163
  i || (i = !0, t.warn(`.env changed (${r(e)}) — hard-restarting: process.env is read once at boot, a reload would keep stale values`, { file: r(e) }), Promise.resolve().then(() => n.onBeforeRestart?.()).catch((e) => t.warn(".env restart: onBeforeRestart failed (continuing)", {}, e)).finally(() => {
539
- let e = fe(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
164
+ let e = ce(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
540
165
  stdio: "inherit",
541
166
  env: process.env,
542
167
  cwd: n.cwd ?? process.cwd()
@@ -550,25 +175,25 @@ __installPublicEnv(publicEnvValues)
550
175
  });
551
176
  }));
552
177
  };
553
- for (let t of e) ee(t, { interval: vt }, (e, n) => {
178
+ for (let t of e) M(t, { interval: Ce }, (e, n) => {
554
179
  e.mtimeMs !== n.mtimeMs && a(t);
555
180
  });
556
181
  return t.info("watching .env files for changes", {
557
182
  files: e.map(r),
558
- intervalMs: vt
183
+ intervalMs: Ce
559
184
  }), () => {
560
- for (let t of e) N(t);
185
+ for (let t of e) j(t);
561
186
  };
562
- }, bt = "VoltroBootRefusal", xt = (e) => {
187
+ }, Te = "VoltroBootRefusal", Ee = (e) => {
563
188
  let t = Error(e);
564
- return t.name = bt, t;
565
- }, St = [{
189
+ return t.name = Te, t;
190
+ }, De = [{
566
191
  host: "127.0.0.1",
567
192
  family: "IPv4"
568
193
  }, {
569
194
  host: "::1",
570
195
  family: "IPv6"
571
- }], Ct = (e, t, n) => new Promise((r) => {
196
+ }], Oe = (e, t, n) => new Promise((r) => {
572
197
  let i = !1, a = (e) => {
573
198
  if (!i) {
574
199
  i = !0;
@@ -577,15 +202,15 @@ __installPublicEnv(publicEnvValues)
577
202
  } catch {}
578
203
  r(e);
579
204
  }
580
- }, o = pe({
205
+ }, o = le({
581
206
  host: e,
582
207
  port: t
583
208
  });
584
209
  o.once("connect", () => a(!0)), o.once("error", () => a(!1)), o.setTimeout(n, () => a(!1));
585
- }), wt = async (e, t = 400) => ({ families: (await Promise.all(St.map(async (n) => ({
210
+ }), ke = async (e, t = 400) => ({ families: (await Promise.all(De.map(async (n) => ({
586
211
  family: n.family,
587
- taken: await Ct(n.host, e, t)
588
- })))).filter((e) => e.taken).map((e) => e.family) }), Tt = (e, t, n) => [
212
+ taken: await Oe(n.host, e, t)
213
+ })))).filter((e) => e.taken).map((e) => e.family) }), Ae = (e, t, n) => [
589
214
  `${t}: port ${e} is already being served (${n.join(" + ")}).`,
590
215
  "",
591
216
  " Refusing to start. This is NOT a spurious check — a second listener can",
@@ -600,26 +225,26 @@ __installPublicEnv(publicEnvValues)
600
225
  "",
601
226
  " Then re-run. To use a different port instead, change `port` in",
602
227
  " app.config.ts."
603
- ].join("\n"), Et = async (e, t) => {
604
- let { families: n } = await wt(e);
605
- if (n.length !== 0) throw xt(Tt(e, t, n));
606
- }, Dt = (e) => e === "effect" || e.startsWith("@effect/") || e.startsWith("@voltro/") || e === "react" || e === "react-dom", Ot = /(^|\/)(\.bin|\.cache|\.pnpm-store|dist|build)(\/|$)/, kt = (e) => {
228
+ ].join("\n"), je = async (e, t) => {
229
+ let { families: n } = await ke(e);
230
+ if (n.length !== 0) throw Ee(Ae(e, t, n));
231
+ }, Me = (e) => e === "effect" || e.startsWith("@effect/") || e.startsWith("@voltro/") || e === "react" || e === "react-dom", Ne = /(^|\/)(\.bin|\.cache|\.pnpm-store|dist|build)(\/|$)/, Pe = (e) => {
607
232
  let t = [], n = e;
608
233
  for (let e = 0; e < 12; e++) {
609
- let e = p(n, "node_modules");
610
- T(e) && t.push(e);
611
- let r = d(n);
234
+ let e = C(n, "node_modules");
235
+ E(e) && t.push(e);
236
+ let r = S(n);
612
237
  if (r === n) break;
613
238
  n = r;
614
239
  }
615
240
  return t;
616
- }, At = (e) => {
241
+ }, Fe = (e) => {
617
242
  let t = /* @__PURE__ */ new Set([e]), n = e;
618
243
  for (let e = 0; e < 12; e++) {
619
244
  for (let e of ["pnpm-workspace.yaml", "pnpm-workspace.yml"]) {
620
245
  let r;
621
246
  try {
622
- r = k(p(n, e), "utf8");
247
+ r = O(C(n, e), "utf8");
623
248
  } catch {
624
249
  continue;
625
250
  }
@@ -630,38 +255,38 @@ __installPublicEnv(publicEnvValues)
630
255
  if (i === "" || i.includes("*")) continue;
631
256
  let a;
632
257
  try {
633
- a = A(p(n, i), { withFileTypes: !0 });
258
+ a = k(C(n, i), { withFileTypes: !0 });
634
259
  } catch {
635
260
  continue;
636
261
  }
637
- for (let e of a) e.isDirectory() && t.add(p(n, i, e.name));
262
+ for (let e of a) e.isDirectory() && t.add(C(n, i, e.name));
638
263
  }
639
264
  }
640
265
  for (let e of ["packages", "apps"]) {
641
266
  let r;
642
267
  try {
643
- r = A(p(n, e), { withFileTypes: !0 });
268
+ r = k(C(n, e), { withFileTypes: !0 });
644
269
  } catch {
645
270
  continue;
646
271
  }
647
- for (let i of r) i.isDirectory() && t.add(p(n, e, i.name));
272
+ for (let i of r) i.isDirectory() && t.add(C(n, e, i.name));
648
273
  }
649
- let e = d(n);
274
+ let e = S(n);
650
275
  if (e === n) break;
651
276
  n = e;
652
277
  }
653
278
  return [...t];
654
- }, jt = (e) => {
279
+ }, Y = (e) => {
655
280
  let t = [];
656
- for (let n of At(e)) {
657
- let e = p(n, "node_modules", "@voltro"), r;
281
+ for (let n of Fe(e)) {
282
+ let e = C(n, "node_modules", "@voltro"), r;
658
283
  try {
659
- r = A(e);
284
+ r = k(e);
660
285
  } catch {
661
286
  continue;
662
287
  }
663
288
  for (let n of r) {
664
- let r = p(e, n), i = Mt(r);
289
+ let r = C(e, n), i = Ie(r);
665
290
  i !== void 0 && t.push({
666
291
  pkg: `@voltro/${n}`,
667
292
  version: i,
@@ -670,38 +295,38 @@ __installPublicEnv(publicEnvValues)
670
295
  }
671
296
  }
672
297
  return t;
673
- }, Mt = (e) => {
298
+ }, Ie = (e) => {
674
299
  try {
675
- let t = JSON.parse(k(p(e, "package.json"), "utf8"));
300
+ let t = JSON.parse(O(C(e, "package.json"), "utf8"));
676
301
  return typeof t.version == "string" ? t.version : void 0;
677
302
  } catch {
678
303
  return;
679
304
  }
680
- }, Nt = (e) => {
305
+ }, Le = (e) => {
681
306
  let t = [], n;
682
307
  try {
683
- n = A(e);
308
+ n = k(e);
684
309
  } catch {
685
310
  return t;
686
311
  }
687
312
  for (let r of n) {
688
- if (r.startsWith(".") || Ot.test(r)) continue;
689
- let n = p(e, r);
313
+ if (r.startsWith(".") || Ne.test(r)) continue;
314
+ let n = C(e, r);
690
315
  if (r.startsWith("@")) {
691
316
  let e;
692
317
  try {
693
- e = A(n);
318
+ e = k(n);
694
319
  } catch {
695
320
  continue;
696
321
  }
697
322
  for (let i of e) t.push({
698
323
  pkg: `${r}/${i}`,
699
- dir: p(n, i)
324
+ dir: C(n, i)
700
325
  });
701
326
  continue;
702
327
  }
703
328
  try {
704
- if (!j(n).isDirectory()) continue;
329
+ if (!A(n).isDirectory()) continue;
705
330
  } catch {
706
331
  continue;
707
332
  }
@@ -711,25 +336,25 @@ __installPublicEnv(publicEnvValues)
711
336
  });
712
337
  }
713
338
  return t;
714
- }, Pt = (e) => {
339
+ }, Re = (e) => {
715
340
  let t = /* @__PURE__ */ new Map(), n = (e, n, r) => {
716
- if (!Dt(e)) return;
341
+ if (!Me(e)) return;
717
342
  let i = t.get(e) ?? /* @__PURE__ */ new Map();
718
343
  i.has(n) || i.set(n, r), t.set(e, i);
719
344
  };
720
- for (let t of kt(e)) for (let { pkg: e, dir: r } of Nt(t)) {
721
- let t = Mt(r);
345
+ for (let t of Pe(e)) for (let { pkg: e, dir: r } of Le(t)) {
346
+ let t = Ie(r);
722
347
  t !== void 0 && n(e, t, r);
723
348
  }
724
- for (let { pkg: t, version: r, dir: i } of jt(e)) n(t, r, i);
349
+ for (let { pkg: t, version: r, dir: i } of Y(e)) n(t, r, i);
725
350
  let r = [];
726
351
  for (let [n, i] of t) i.size < 2 || r.push({
727
352
  pkg: n,
728
353
  versions: [...i.keys()].sort(),
729
- paths: [...i.values()].map((t) => m(e, t)).sort()
354
+ paths: [...i.values()].map((t) => w(e, t)).sort()
730
355
  });
731
356
  return r.sort((e, t) => e.pkg.localeCompare(t.pkg));
732
- }, Ft = (e) => {
357
+ }, ze = (e) => {
733
358
  if (e.length !== 0) return [
734
359
  `• ${e.length} package(s) resolved at more than one version:`,
735
360
  ...e.flatMap((e) => [` ${e.pkg} — ${e.versions.join(", ")}`, ...e.paths.map((e) => ` ${e}`)]),
@@ -747,11 +372,11 @@ __installPublicEnv(publicEnvValues)
747
372
  " instrument), then reinstall. Do not silence the generated file — it is where",
748
373
  " a genuine mistake in your own descriptors surfaces."
749
374
  ].join("\n");
750
- }, It = (e) => {
375
+ }, Be = (e) => {
751
376
  let t = /* @__PURE__ */ new Map();
752
- for (let n of kt(e)) for (let { pkg: e, dir: r } of Nt(n)) {
377
+ for (let n of Pe(e)) for (let { pkg: e, dir: r } of Le(n)) {
753
378
  if (!e.startsWith("@voltro/")) continue;
754
- let n = Mt(r);
379
+ let n = Ie(r);
755
380
  n !== void 0 && !t.has(e) && t.set(e, n);
756
381
  }
757
382
  if (t.size < 2) return;
@@ -766,7 +391,7 @@ __installPublicEnv(publicEnvValues)
766
391
  version: t
767
392
  })).sort((e, t) => e.pkg.localeCompare(t.pkg))
768
393
  };
769
- }, Lt = (e) => {
394
+ }, Ve = (e) => {
770
395
  if (e !== void 0) return [
771
396
  `• ${e.behind.length} @voltro/* package(s) are not on ${e.majority}:`,
772
397
  ...e.behind.map((e) => ` ${e.pkg} ${e.version}`),
@@ -784,60 +409,84 @@ __installPublicEnv(publicEnvValues)
784
409
  " its pattern: the one that produced this report was `@voltro/[a-z-]+`,",
785
410
  " which silently skips `@voltro/i18n` because the name contains digits."
786
411
  ].join("\n");
787
- }, Rt = (e, t) => {
788
- let n = It(e);
412
+ }, He = (e, t) => {
413
+ let n = Be(e);
789
414
  n !== void 0 && t.warn?.(`@voltro/* version skew: ${n.behind.length} package(s) are not on ${n.majority}`, {
790
415
  majority: n.majority,
791
416
  behind: n.behind.map((e) => `${e.pkg}@${e.version}`),
792
417
  fix: "the framework ships in lockstep; bump the listed packages and reinstall"
793
418
  });
794
- }, zt = S({ scope: "vite" }), Bt = /\x1b\[[0-9;]*m/g, Vt = /^\s*\[?vite\]?\s*(\([a-z-]+\)\s*)?/, Ht = (e) => e.replace(Bt, "").replace(Vt, "").trim(), Ut = /proxy error/i, Wt = [
419
+ }, Ue = I({ scope: "vite" }), We = /\x1b\[[0-9;]*m/g, Ge = /^\s*\[?vite\]?\s*(\([a-z-]+\)\s*)?/, Ke = (e) => e.replace(We, "").replace(Ge, "").trim(), qe = /proxy error/i, Je = [
795
420
  "ECONNREFUSED",
796
421
  "ECONNRESET",
797
422
  "ECONNABORTED",
798
423
  "EPIPE",
799
424
  "ETIMEDOUT"
800
- ], Gt = (e, t = 0) => {
425
+ ], Ye = (e, t = 0) => {
801
426
  if (e == null || t > 5) return !1;
802
427
  let n = e;
803
- return typeof n.code == "string" && Wt.includes(n.code) || typeof n.message == "string" && Wt.some((e) => n.message.includes(e)) || Array.isArray(n.errors) && n.errors.some((e) => Gt(e, t + 1)) ? !0 : Gt(n.cause, t + 1);
804
- }, Kt = 4e3, qt = () => {
428
+ return typeof n.code == "string" && Je.includes(n.code) || typeof n.message == "string" && Je.some((e) => n.message.includes(e)) || Array.isArray(n.errors) && n.errors.some((e) => Ye(e, t + 1)) ? !0 : Ye(n.cause, t + 1);
429
+ }, Xe = 4e3, Ze = () => {
805
430
  let e = /* @__PURE__ */ new Set(), t = 0, n = {
806
431
  hasWarned: !1,
807
432
  info: (e) => {
808
- let t = Ht(e);
809
- t.length !== 0 && zt.info(t);
433
+ let t = Ke(e);
434
+ t.length !== 0 && Ue.info(t);
810
435
  },
811
436
  warn: (e) => {
812
437
  n.hasWarned = !0;
813
- let t = Ht(e);
814
- t.length !== 0 && zt.warn(t);
438
+ let t = Ke(e);
439
+ t.length !== 0 && Ue.warn(t);
815
440
  },
816
441
  warnOnce: (t) => {
817
- let r = Ht(t);
818
- e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 && zt.warn(r));
442
+ let r = Ke(t);
443
+ e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 && Ue.warn(r));
819
444
  },
820
445
  error: (e, n) => {
821
- let r = Ht(e), i = n?.error;
446
+ let r = Ke(e), i = n?.error;
822
447
  if (r.length !== 0) {
823
- if (Ut.test(r) && Gt(i)) {
448
+ if (qe.test(r) && Ye(i)) {
824
449
  let e = Date.now();
825
- e - t > Kt && (t = e, zt.info("waiting for api — proxy upstream not accepting connections yet (still starting?)"));
450
+ e - t > Xe && (t = e, Ue.info("waiting for api — proxy upstream not accepting connections yet (still starting?)"));
826
451
  return;
827
452
  }
828
- zt.error(r, {}, i);
453
+ Ue.error(r, {}, i);
829
454
  }
830
455
  },
831
456
  clearScreen: () => {},
832
457
  hasErrorLogged: (e) => !1
833
458
  };
834
459
  return n;
835
- }, Jt = (e = process.env) => {
460
+ }, Qe = (e) => e.replace(/\\"|"(?:[^"\\]|\\.)*"|(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g, (e, t) => t ? "" : e), $e = (e) => {
461
+ try {
462
+ let t = C(e, "tsconfig.json");
463
+ if (!E(t)) return [];
464
+ let n = JSON.parse(Qe(O(t, "utf8"))).compilerOptions ?? {}, r = n.paths ?? {}, i = T(e, n.baseUrl ?? "."), a = [];
465
+ for (let [e, t] of Object.entries(r)) {
466
+ let n = t[0];
467
+ if (!n) continue;
468
+ let r = n.replace(/\\/g, "/");
469
+ if (!(r.includes("/@types/") || r.endsWith(".d.ts"))) if (e.endsWith("/*") && n.endsWith("/*")) {
470
+ let t = e.slice(0, -2).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
471
+ a.push({
472
+ find: RegExp(`^${t}/(.*)$`),
473
+ replacement: `${C(i, n.slice(0, -2))}/$1`
474
+ });
475
+ } else a.push({
476
+ find: e,
477
+ replacement: C(i, n)
478
+ });
479
+ }
480
+ return a;
481
+ } catch {
482
+ return [];
483
+ }
484
+ }, et = (e = process.env) => {
836
485
  let t = e.VOLTRO_DEV_SSR_COMPILE_CONCURRENCY;
837
486
  if (t === void 0 || t.trim() === "") return 4;
838
487
  let n = Number(t);
839
488
  return Number.isFinite(n) && n >= 1 ? Math.floor(n) : 4;
840
- }, Yt = (e) => {
489
+ }, tt = (e) => {
841
490
  let t = Math.max(1, Math.floor(e)), n = 0, r = [], i = () => n < t ? (n++, Promise.resolve()) : new Promise((e) => r.push(e)), a = () => {
842
491
  let e = r.shift();
843
492
  e ? e() : n--;
@@ -855,8 +504,8 @@ __installPublicEnv(publicEnvValues)
855
504
  return n;
856
505
  }
857
506
  };
858
- }, Xt = (e) => {
859
- let t = Yt(e.limit), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
507
+ }, nt = (e) => {
508
+ let t = tt(e.limit), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
860
509
  return {
861
510
  load: (i, a) => {
862
511
  if (r.has(i)) return a();
@@ -886,7 +535,7 @@ __installPublicEnv(publicEnvValues)
886
535
  return r.size;
887
536
  }
888
537
  };
889
- }, Zt = (e) => {
538
+ }, rt = (e) => {
890
539
  let t = [];
891
540
  for (let n of e.split("/").filter(Boolean)) n.startsWith("[[...") && n.endsWith("]]") ? t.push({
892
541
  name: n.slice(5, -2),
@@ -902,12 +551,12 @@ __installPublicEnv(publicEnvValues)
902
551
  optional: !1
903
552
  });
904
553
  return t;
905
- }, Qt = (e) => e.replace(/-([a-z0-9])/g, (e, t) => t.toUpperCase()), $t = async (e) => {
906
- let t = h(e);
554
+ }, it = (e) => e.replace(/-([a-z0-9])/g, (e, t) => t.toUpperCase()), at = async (e) => {
555
+ let t = T(e);
907
556
  for (let e = 0; e < 4; e++) {
908
- let e = p(t, "project.json");
909
- if (T(e)) try {
910
- let n = await O.readFile(e, "utf8");
557
+ let e = C(t, "project.json");
558
+ if (E(e)) try {
559
+ let n = await D.readFile(e, "utf8");
911
560
  return {
912
561
  projectDir: t,
913
562
  manifest: JSON.parse(n)
@@ -915,38 +564,38 @@ __installPublicEnv(publicEnvValues)
915
564
  } catch {
916
565
  return null;
917
566
  }
918
- let n = d(t);
567
+ let n = S(t);
919
568
  if (n === t) break;
920
569
  t = n;
921
570
  }
922
571
  return null;
923
- }, en = async (e) => {
924
- let t = await $t(e);
572
+ }, ot = async (e) => {
573
+ let t = await at(e);
925
574
  if (!t) return [];
926
- let { projectDir: n, manifest: r } = t, i = u(e), a = r.apps ?? {}, o = [];
575
+ let { projectDir: n, manifest: r } = t, i = x(e), a = r.apps ?? {}, o = [];
927
576
  for (let [e, t] of Object.entries(a)) {
928
577
  if (e === i || t.kind !== "web" || typeof t.port != "number") continue;
929
- let r = p(p(n, t.path ?? e), "src", "pages");
930
- if (!T(r)) continue;
578
+ let r = C(C(n, t.path ?? e), "src", "pages");
579
+ if (!E(r)) continue;
931
580
  let a;
932
581
  try {
933
582
  let { pages: e } = await $(r);
934
583
  a = e.map((e) => ({
935
584
  pattern: e.pattern,
936
- params: Zt(e.pattern)
585
+ params: rt(e.pattern)
937
586
  }));
938
587
  } catch {
939
588
  continue;
940
589
  }
941
590
  o.push({
942
- key: Qt(e),
591
+ key: it(e),
943
592
  origin: `http://localhost:${t.port}`,
944
593
  ...typeof t.origin == "string" && t.origin.length > 0 ? { prodOrigin: t.origin } : {},
945
594
  routes: a
946
595
  });
947
596
  }
948
597
  return o;
949
- }, tn = (e) => {
598
+ }, st = (e) => {
950
599
  if (e.params.length === 0) return `'${e.pattern}'`;
951
600
  let t = e.pattern;
952
601
  for (let n of e.params) {
@@ -954,21 +603,21 @@ __installPublicEnv(publicEnvValues)
954
603
  t = t.replace(e, r);
955
604
  }
956
605
  return "`" + t + "`";
957
- }, nn = (e) => e.params.length === 0 ? "EmptyParams" : `{ ${e.params.map((e) => {
606
+ }, ct = (e) => e.params.length === 0 ? "EmptyParams" : `{ ${e.params.map((e) => {
958
607
  let t = "string";
959
608
  return e.optional ? `readonly ${e.name}?: ${t}` : `readonly ${e.name}: ${t}`;
960
- }).join("; ")} }`, rn = (e, t, n) => {
961
- let r = nn(e), i = tn(e), a = t ? "VoltroExternalUrl" : "VoltroRouteUrl", o = t && n ? `${n} + ` : "";
609
+ }).join("; ")} }`, lt = (e, t, n) => {
610
+ let r = ct(e), i = st(e), a = t ? "VoltroExternalUrl" : "VoltroRouteUrl", o = t && n ? `${n} + ` : "";
962
611
  return e.params.length === 0 ? `() => (${o}${i}) as ${a}` : `({ ${e.params.map((e) => e.name).join(", ")} }: ${r}) => (${o}${i}) as ${a}`;
963
- }, an = (e) => `{\n${[...e].sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => ` ${JSON.stringify(e.pattern)}: ${rn(e, !1)},`).join("\n")}\n}`, on = (e, t) => {
612
+ }, ut = (e) => `{\n${[...e].sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => ` ${JSON.stringify(e.pattern)}: ${lt(e, !1)},`).join("\n")}\n}`, dt = (e, t) => {
964
613
  if (e.routes.length === 0) return ` ${e.key}: {} as Record<string, never>,`;
965
- let n = [...e.routes].sort((e, t) => e.pattern.localeCompare(t.pattern)), r = t === "prod" && e.prodOrigin ? e.prodOrigin : e.origin, i = JSON.stringify(r), a = n.map((e) => ` ${JSON.stringify(e.pattern)}: ${rn(e, !0, i)},`);
614
+ let n = [...e.routes].sort((e, t) => e.pattern.localeCompare(t.pattern)), r = t === "prod" && e.prodOrigin ? e.prodOrigin : e.origin, i = JSON.stringify(r), a = n.map((e) => ` ${JSON.stringify(e.pattern)}: ${lt(e, !0, i)},`);
966
615
  return ` ${e.key}: {\n${a.join("\n")}\n },`;
967
- }, sn = async (e) => {
616
+ }, ft = async (e) => {
968
617
  let t = e.pages.map((e) => ({
969
618
  pattern: e.pattern,
970
- params: Zt(e.pattern)
971
- })), n = await en(e.appRoot), r = [
619
+ params: rt(e.pattern)
620
+ })), n = await ot(e.appRoot), r = [
972
621
  "// THIS FILE IS GENERATED — DO NOT EDIT BY HAND.",
973
622
  "// Re-emitted by `voltro dev` whenever `src/pages/**` changes.",
974
623
  "// Type-safe route builders consumed by <Link to={...}>.",
@@ -977,50 +626,50 @@ __installPublicEnv(publicEnvValues)
977
626
  "",
978
627
  "type EmptyParams = Record<string, never>",
979
628
  ""
980
- ].join("\n"), i = e.mode ?? "dev", a = `${r}\n${`export const routes = ${an(t)} as const\n`}\n${n.length === 0 ? "export const siblingApps = {} as Record<string, never>\n" : `export const siblingApps = {\n${n.map((e) => on(e, i)).join("\n")}\n} as const\n`}`, o = p(e.appRoot, ".framework", "routes.generated.ts");
981
- await O.mkdir(d(o), { recursive: !0 });
629
+ ].join("\n"), i = e.mode ?? "dev", a = `${r}\n${`export const routes = ${ut(t)} as const\n`}\n${n.length === 0 ? "export const siblingApps = {} as Record<string, never>\n" : `export const siblingApps = {\n${n.map((e) => dt(e, i)).join("\n")}\n} as const\n`}`, o = C(e.appRoot, ".framework", "routes.generated.ts");
630
+ await D.mkdir(S(o), { recursive: !0 });
982
631
  let s = null;
983
632
  try {
984
- s = await O.readFile(o, "utf8");
633
+ s = await D.readFile(o, "utf8");
985
634
  } catch {}
986
635
  return s === a ? {
987
636
  path: o,
988
637
  wrote: !1
989
- } : (await O.writeFile(o, a, "utf8"), {
638
+ } : (await D.writeFile(o, a, "utf8"), {
990
639
  path: o,
991
640
  wrote: !0
992
641
  });
993
- }, cn = (e) => {
642
+ }, pt = (e) => {
994
643
  if (e === "" || e === "/") return "/";
995
644
  let t = e.startsWith("/") ? e : `/${e}`;
996
645
  return t.endsWith("/") ? t.slice(0, -1) : t;
997
- }, ln = (e, t) => {
998
- let n = e.endsWith("/") ? e.slice(0, -1) : e, r = cn(t);
646
+ }, mt = (e, t) => {
647
+ let n = e.endsWith("/") ? e.slice(0, -1) : e, r = pt(t);
999
648
  return r === "/" ? `${n}/` : `${n}${r}`;
1000
- }, un = (e, t, n) => {
1001
- let r = cn(e);
649
+ }, ht = (e, t, n) => {
650
+ let r = pt(e);
1002
651
  return t === n ? r : r === "/" ? `/${t}` : `/${t}${r}`;
1003
- }, dn = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;"), fn = (e) => {
652
+ }, gt = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;"), _t = (e) => {
1004
653
  let { siteUrl: t, entries: n } = e, r = e.locales && e.locales.length > 1 ? e.locales : void 0, i = e.defaultLocale ?? r?.[0] ?? "en", a = r !== void 0, o = /* @__PURE__ */ new Map(), s = (e) => {
1005
654
  if (!r) return "";
1006
- let n = r.map((n) => ` <xhtml:link rel="alternate" hreflang="${dn(n)}" href="${dn(ln(t, un(e, n, i)))}" />`);
1007
- return n.push(` <xhtml:link rel="alternate" hreflang="x-default" href="${dn(ln(t, un(e, i, i)))}" />`), `\n${n.join("\n")}`;
655
+ let n = r.map((n) => ` <xhtml:link rel="alternate" hreflang="${gt(n)}" href="${gt(mt(t, ht(e, n, i)))}" />`);
656
+ return n.push(` <xhtml:link rel="alternate" hreflang="x-default" href="${gt(mt(t, ht(e, i, i)))}" />`), `\n${n.join("\n")}`;
1008
657
  };
1009
658
  for (let e of n) {
1010
659
  let n = r ?? [i];
1011
660
  for (let r of n) {
1012
- let n = ln(t, un(e.path, r, i)), a = e.lastmod ? `\n <lastmod>${dn(e.lastmod)}</lastmod>` : "";
1013
- o.set(n, ` <url>\n <loc>${dn(n)}</loc>${a}${s(e.path)}\n </url>`);
661
+ let n = mt(t, ht(e.path, r, i)), a = e.lastmod ? `\n <lastmod>${gt(e.lastmod)}</lastmod>` : "";
662
+ o.set(n, ` <url>\n <loc>${gt(n)}</loc>${a}${s(e.path)}\n </url>`);
1014
663
  }
1015
664
  }
1016
665
  let c = [...o.keys()].sort().map((e) => o.get(e)).join("\n");
1017
666
  return `<?xml version="1.0" encoding="UTF-8"?>\n<urlset${a ? " xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"" : " xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\""}>\n${c}\n</urlset>\n`;
1018
- }, pn = (e) => {
667
+ }, vt = (e) => {
1019
668
  if (!e.indexable) return "User-agent: *\nDisallow: /\n";
1020
669
  let t = ["User-agent: *", "Allow: /"];
1021
- for (let n of e.disallow ?? []) t.push(`Disallow: ${cn(n)}`);
670
+ for (let n of e.disallow ?? []) t.push(`Disallow: ${pt(n)}`);
1022
671
  return e.sitemapUrl && t.push("", `Sitemap: ${e.sitemapUrl}`), `${t.join("\n")}\n`;
1023
- }, mn = 256, hn = (e = mn) => {
672
+ }, yt = 256, bt = (e = yt) => {
1024
673
  let t = [], n = /* @__PURE__ */ new Set();
1025
674
  return {
1026
675
  emit(r, i) {
@@ -1043,17 +692,17 @@ __installPublicEnv(publicEnvValues)
1043
692
  return t.slice();
1044
693
  }
1045
694
  };
1046
- }, gn = (e) => `event: ${e.channel}\ndata: ${JSON.stringify(e)}\n\n`, _n = () => `: keep-alive ${Date.now()}\n\n`, vn = 8e3, yn = (e, t = vn) => {
1047
- let n = xn(e);
695
+ }, xt = (e) => `event: ${e.channel}\ndata: ${JSON.stringify(e)}\n\n`, St = () => `: keep-alive ${Date.now()}\n\n`, Ct = 8e3, wt = (e, t = Ct) => {
696
+ let n = Et(e);
1048
697
  return n.length <= t ? n : `${n.slice(0, t)}\n… [voltro] truncated at ${t} chars (${n.length} total)`;
1049
- }, bn = 4, xn = (e, t = 0, n = /* @__PURE__ */ new Set()) => {
698
+ }, Tt = 4, Et = (e, t = 0, n = /* @__PURE__ */ new Set()) => {
1050
699
  if (e instanceof Error) {
1051
700
  let r = e.stack ?? `${e.name}: ${e.message}`;
1052
701
  if (n.has(e)) return `${r}\n [cycle]`;
1053
702
  n.add(e);
1054
703
  let i = [];
1055
- if (t < bn) if (e instanceof AggregateError && Array.isArray(e.errors)) for (let [r, a] of e.errors.entries()) i.push(`\n [aggregate ${r}] ${Sn(xn(a, t + 1, n))}`);
1056
- else e.cause !== void 0 && e.cause !== null && i.push(`\n [cause] ${Sn(xn(e.cause, t + 1, n))}`);
704
+ if (t < Tt) if (e instanceof AggregateError && Array.isArray(e.errors)) for (let [r, a] of e.errors.entries()) i.push(`\n [aggregate ${r}] ${Dt(Et(a, t + 1, n))}`);
705
+ else e.cause !== void 0 && e.cause !== null && i.push(`\n [cause] ${Dt(Et(e.cause, t + 1, n))}`);
1057
706
  return r + i.join("");
1058
707
  }
1059
708
  try {
@@ -1061,30 +710,30 @@ __installPublicEnv(publicEnvValues)
1061
710
  } catch {
1062
711
  return "[unstringifiable thrown value]";
1063
712
  }
1064
- }, Sn = (e) => {
713
+ }, Dt = (e) => {
1065
714
  let t = e.split("\n");
1066
715
  return t.length <= 3 ? e : `${t.slice(0, 3).join("\n")}\n …`;
1067
- }, Cn = {
716
+ }, Ot = {
1068
717
  trace: 0,
1069
718
  debug: 1,
1070
719
  info: 2,
1071
720
  warn: 3,
1072
721
  error: 4,
1073
722
  fatal: 5
1074
- }, wn = 2e3, Tn = 200, En = class {
723
+ }, kt = 2e3, At = 200, jt = class {
1075
724
  capacity;
1076
725
  buffer = [];
1077
- constructor(e = wn) {
726
+ constructor(e = kt) {
1078
727
  this.capacity = e;
1079
728
  }
1080
729
  append(e) {
1081
730
  this.buffer.push(e), this.buffer.length > this.capacity && this.buffer.shift();
1082
731
  }
1083
732
  query(e = {}) {
1084
- let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? Tn, this.capacity), i = e.minLevel === void 0 ? Cn.trace : Cn[e.minLevel], a = e.scope?.toLowerCase(), o = e.source, s = e.filter?.toLowerCase(), c = e.traceId, l = [];
733
+ let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? At, this.capacity), i = e.minLevel === void 0 ? Ot.trace : Ot[e.minLevel], a = e.scope?.toLowerCase(), o = e.source, s = e.filter?.toLowerCase(), c = e.traceId, l = [];
1085
734
  for (let e = this.buffer.length - 1; e >= 0 && l.length < r; e--) {
1086
735
  let r = this.buffer[e];
1087
- r.ts < t || r.ts > n || Cn[r.level] < i || o !== void 0 && r.source !== o || a !== void 0 && (r.scope === void 0 || !r.scope.toLowerCase().includes(a)) || s !== void 0 && !r.message.toLowerCase().includes(s) || c !== void 0 && r.fields.traceId !== c || l.push(r);
736
+ r.ts < t || r.ts > n || Ot[r.level] < i || o !== void 0 && r.source !== o || a !== void 0 && (r.scope === void 0 || !r.scope.toLowerCase().includes(a)) || s !== void 0 && !r.message.toLowerCase().includes(s) || c !== void 0 && r.fields.traceId !== c || l.push(r);
1088
737
  }
1089
738
  return l.reverse();
1090
739
  }
@@ -1097,7 +746,7 @@ __installPublicEnv(publicEnvValues)
1097
746
  clear() {
1098
747
  this.buffer = [];
1099
748
  }
1100
- }, Dn = null, On = () => (Dn === null && (Dn = new En()), Dn), kn = (e) => {
749
+ }, Mt = null, Nt = () => (Mt === null && (Mt = new jt()), Mt), Pt = (e) => {
1101
750
  if (typeof e == "string") return e;
1102
751
  if (e instanceof Error) return e.message;
1103
752
  try {
@@ -1105,28 +754,28 @@ __installPublicEnv(publicEnvValues)
1105
754
  } catch {
1106
755
  return String(e);
1107
756
  }
1108
- }, An = 8e3, jn = (e) => typeof e == "string" ? e.length <= An ? e : `${e.slice(0, An)}… [voltro: truncated]` : typeof e != "object" || !e ? e : yn(e, An), Mn = (e, t) => {
757
+ }, Ft = 8e3, It = (e) => typeof e == "string" ? e.length <= Ft ? e : `${e.slice(0, Ft)}… [voltro: truncated]` : typeof e != "object" || !e ? e : wt(e, Ft), Lt = (e, t) => {
1109
758
  try {
1110
759
  e(...t);
1111
760
  } catch (n) {
1112
761
  try {
1113
- e(...t.map(jn)), e(` ↑ [voltro] an argument above was too large for console formatting (${n?.message ?? "inspect failed"}) — printed bounded to ${An} chars per argument.`);
762
+ e(...t.map(It)), e(` ↑ [voltro] an argument above was too large for console formatting (${n?.message ?? "inspect failed"}) — printed bounded to ${Ft} chars per argument.`);
1114
763
  } catch {
1115
764
  e(`[voltro] a console.error argument could not be formatted at all (${t.length} arg(s)).`);
1116
765
  }
1117
766
  }
1118
- }, Nn = (e) => {
767
+ }, Rt = (e) => {
1119
768
  let t = {
1120
769
  log: console.log.bind(console),
1121
770
  info: console.info.bind(console),
1122
771
  warn: console.warn.bind(console),
1123
772
  error: console.error.bind(console),
1124
773
  debug: console.debug.bind(console)
1125
- }, n = On(), r = !1, i = (i) => (...a) => {
1126
- if (Mn(t[i], a), !r) {
774
+ }, n = Nt(), r = !1, i = (i) => (...a) => {
775
+ if (Lt(t[i], a), !r) {
1127
776
  r = !0;
1128
777
  try {
1129
- let t = a.length > 0 ? kn(a[0]) : "", r = t.length > 500 ? t.slice(0, 500) + "…" : t, o = F();
778
+ let t = a.length > 0 ? Pt(a[0]) : "", r = t.length > 500 ? t.slice(0, 500) + "…" : t, o = z();
1130
779
  e.emit("log", {
1131
780
  level: i,
1132
781
  message: r,
@@ -1153,7 +802,7 @@ __installPublicEnv(publicEnvValues)
1153
802
  }
1154
803
  };
1155
804
  console.log = i("log"), console.info = i("info"), console.warn = i("warn"), console.error = i("error"), console.debug = i("debug");
1156
- let a = x((t) => {
805
+ let a = F((t) => {
1157
806
  if (!r) {
1158
807
  r = !0;
1159
808
  try {
@@ -1164,7 +813,7 @@ __installPublicEnv(publicEnvValues)
1164
813
  argsCount: 1,
1165
814
  ...t.scope === void 0 ? {} : { scope: t.scope }
1166
815
  });
1167
- let a = F(), o = a !== void 0 && t.fields.traceId === void 0 ? {
816
+ let a = z(), o = a !== void 0 && t.fields.traceId === void 0 ? {
1168
817
  ...t.fields,
1169
818
  traceId: a.traceId
1170
819
  } : t.fields;
@@ -1184,24 +833,24 @@ __installPublicEnv(publicEnvValues)
1184
833
  return () => {
1185
834
  console.log = t.log, console.info = t.info, console.warn = t.warn, console.error = t.error, console.debug = t.debug, a();
1186
835
  };
1187
- }, Pn = 2e3, Fn = 8, In = 1e3, Ln = 200, Y = (e, t) => e.length > t ? `${e.slice(0, t)}…` : e, Rn = (e) => {
836
+ }, zt = 2e3, Bt = 8, Vt = 1e3, Ht = 200, X = (e, t) => e.length > t ? `${e.slice(0, t)}…` : e, Ut = (e) => {
1188
837
  switch (e) {
1189
838
  case "error": return "error";
1190
839
  case "warn": return "warn";
1191
840
  case "debug": return "debug";
1192
841
  default: return "info";
1193
842
  }
1194
- }, zn = S({ scope: "client" }), Bn = (e, t) => {
843
+ }, Wt = I({ scope: "client" }), Gt = (e, t) => {
1195
844
  let n;
1196
845
  try {
1197
846
  n = JSON.parse(e);
1198
847
  } catch {
1199
- return Vn(400, { error: "invalid JSON body" });
848
+ return Kt(400, { error: "invalid JSON body" });
1200
849
  }
1201
- if (typeof n != "object" || !n) return Vn(400, { error: "body must be a JSON object" });
850
+ if (typeof n != "object" || !n) return Kt(400, { error: "body must be a JSON object" });
1202
851
  let r = n;
1203
- if (!Array.isArray(r.entries)) return Vn(400, { error: "entries must be an array" });
1204
- let i = typeof r.app == "string" ? Y(r.app, 120) : void 0, a = typeof r.page == "string" ? Y(r.page, 200) : void 0, o = typeof r.ua == "string" ? Y(r.ua, 200) : void 0, s = r.entries.slice(0, Ln), c = 0;
852
+ if (!Array.isArray(r.entries)) return Kt(400, { error: "entries must be an array" });
853
+ let i = typeof r.app == "string" ? X(r.app, 120) : void 0, a = typeof r.page == "string" ? X(r.page, 200) : void 0, o = typeof r.ua == "string" ? X(r.ua, 200) : void 0, s = r.entries.slice(0, Ht), c = 0;
1205
854
  for (let e of s) {
1206
855
  if (typeof e != "object" || !e) continue;
1207
856
  let n = e;
@@ -1212,7 +861,7 @@ __installPublicEnv(publicEnvValues)
1212
861
  "warn",
1213
862
  "error",
1214
863
  "debug"
1215
- ].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = Y(n.message, Pn), u = Array.isArray(n.args) ? n.args.slice(0, Fn).filter((e) => typeof e == "string").map((e) => Y(e, In)) : void 0, d = typeof n.stack == "string" ? Y(n.stack, Pn) : void 0;
864
+ ].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = X(n.message, zt), u = Array.isArray(n.args) ? n.args.slice(0, Bt).filter((e) => typeof e == "string").map((e) => X(e, Vt)) : void 0, d = typeof n.stack == "string" ? X(n.stack, zt) : void 0;
1216
865
  t.emit("clientLog", {
1217
866
  ts: s,
1218
867
  level: r,
@@ -1227,36 +876,36 @@ __installPublicEnv(publicEnvValues)
1227
876
  ...i === void 0 ? {} : { app: i },
1228
877
  ...a === void 0 ? {} : { page: a },
1229
878
  ...u !== void 0 && u.length > 0 ? { args: u } : {}
1230
- }, p = Rn(r);
1231
- (p === "error" || p === "warn") && d !== void 0 ? zn[p](l, f, { stack: d }) : zn[p](l, {
879
+ }, p = Ut(r);
880
+ (p === "error" || p === "warn") && d !== void 0 ? Wt[p](l, f, { stack: d }) : Wt[p](l, {
1232
881
  ...f,
1233
882
  ...d === void 0 ? {} : { stack: d }
1234
883
  }), c++;
1235
884
  }
1236
- return Vn(202, {
885
+ return Kt(202, {
1237
886
  accepted: c,
1238
887
  dropped: r.entries.length - c
1239
888
  });
1240
- }, Vn = (e, t) => ({
889
+ }, Kt = (e, t) => ({
1241
890
  status: e,
1242
891
  contentType: "application/json; charset=utf-8",
1243
892
  body: JSON.stringify(t)
1244
- }), Hn = "/_voltro/inspect/clientLog", Un = [
893
+ }), qt = "/_voltro/inspect/clientLog", Jt = [
1245
894
  "trace",
1246
895
  "debug",
1247
896
  "info",
1248
897
  "warn",
1249
898
  "error",
1250
899
  "fatal"
1251
- ], Wn = {
900
+ ], Yt = {
1252
901
  trace: "TRACE",
1253
902
  debug: "DEBUG",
1254
903
  info: "INFO ",
1255
904
  warn: "WARN ",
1256
905
  error: "ERROR",
1257
906
  fatal: "FATAL"
1258
- }, Gn = (e) => Un.includes(e), Kn = (e, t, n = {}) => {
1259
- if (c()) return {
907
+ }, Xt = (e) => Jt.includes(e), Zt = (e, t, n = {}) => {
908
+ if (a()) return {
1260
909
  status: 503,
1261
910
  contentType: "application/json",
1262
911
  body: JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" })
@@ -1270,36 +919,36 @@ __installPublicEnv(publicEnvValues)
1270
919
  reason: r.reason
1271
920
  })
1272
921
  };
1273
- let i = e.indexOf("?"), a = i === -1 ? new URLSearchParams() : new URLSearchParams(e.slice(i + 1)), o = {}, l = a.get("since");
922
+ let i = e.indexOf("?"), o = i === -1 ? new URLSearchParams() : new URLSearchParams(e.slice(i + 1)), c = {}, l = o.get("since");
1274
923
  if (l !== null) {
1275
924
  let e = Number(l);
1276
- Number.isFinite(e) && (o.since = e);
925
+ Number.isFinite(e) && (c.since = e);
1277
926
  }
1278
- let u = a.get("until");
927
+ let u = o.get("until");
1279
928
  if (u !== null) {
1280
929
  let e = Number(u);
1281
- Number.isFinite(e) && (o.until = e);
930
+ Number.isFinite(e) && (c.until = e);
1282
931
  }
1283
- let d = a.get("max");
932
+ let d = o.get("max");
1284
933
  if (d !== null) {
1285
934
  let e = Number(d);
1286
- Number.isFinite(e) && e > 0 && (o.max = Math.floor(e));
1287
- }
1288
- let f = a.get("level");
1289
- f !== null && Gn(f) && (o.minLevel = f);
1290
- let p = a.get("source");
1291
- (p === "server" || p === "client") && (o.source = p);
1292
- let m = a.get("scope");
1293
- m !== null && m.length > 0 && (o.scope = m);
1294
- let h = a.get("filter");
1295
- h !== null && h.length > 0 && (o.filter = h);
1296
- let g = a.get("trace");
1297
- g !== null && g.length > 0 && (o.traceId = g);
1298
- let _ = t.query(o);
1299
- if ((a.get("format") ?? "json") === "text") return {
935
+ Number.isFinite(e) && e > 0 && (c.max = Math.floor(e));
936
+ }
937
+ let f = o.get("level");
938
+ f !== null && Xt(f) && (c.minLevel = f);
939
+ let p = o.get("source");
940
+ (p === "server" || p === "client") && (c.source = p);
941
+ let m = o.get("scope");
942
+ m !== null && m.length > 0 && (c.scope = m);
943
+ let h = o.get("filter");
944
+ h !== null && h.length > 0 && (c.filter = h);
945
+ let g = o.get("trace");
946
+ g !== null && g.length > 0 && (c.traceId = g);
947
+ let _ = t.query(c);
948
+ if ((o.get("format") ?? "json") === "text") return {
1300
949
  status: 200,
1301
950
  contentType: "text/plain; charset=utf-8",
1302
- body: _.map(qn).join("\n") + (_.length > 0 ? "\n" : "")
951
+ body: _.map(Qt).join("\n") + (_.length > 0 ? "\n" : "")
1303
952
  };
1304
953
  let v = {
1305
954
  capturedAt: Date.now(),
@@ -1313,40 +962,40 @@ __installPublicEnv(publicEnvValues)
1313
962
  contentType: "application/json; charset=utf-8",
1314
963
  body: JSON.stringify(v)
1315
964
  };
1316
- }, qn = (e) => {
1317
- let t = new Date(e.ts), n = String(t.getHours()).padStart(2, "0"), r = String(t.getMinutes()).padStart(2, "0"), i = String(t.getSeconds()).padStart(2, "0"), a = String(t.getMilliseconds()).padStart(3, "0"), o = `[${e.scope ?? "?"}/${e.source}]`, s = Yn(e.fields);
1318
- return `${n}:${r}:${i}.${a} ${Wn[e.level]} ${o} ${e.message}${s}`;
1319
- }, Jn = 80, Yn = (e) => {
965
+ }, Qt = (e) => {
966
+ let t = new Date(e.ts), n = String(t.getHours()).padStart(2, "0"), r = String(t.getMinutes()).padStart(2, "0"), i = String(t.getSeconds()).padStart(2, "0"), a = String(t.getMilliseconds()).padStart(3, "0"), o = `[${e.scope ?? "?"}/${e.source}]`, s = en(e.fields);
967
+ return `${n}:${r}:${i}.${a} ${Yt[e.level]} ${o} ${e.message}${s}`;
968
+ }, $t = 80, en = (e) => {
1320
969
  let t = Object.entries(e);
1321
970
  if (t.length === 0) return "";
1322
971
  let n = [];
1323
972
  for (let [e, r] of t) {
1324
973
  if (r === void 0) continue;
1325
- let t = Xn(r);
974
+ let t = tn(r);
1326
975
  n.push(`${e}=${t}`);
1327
976
  }
1328
977
  return n.length > 0 ? " " + n.join(" ") : "";
1329
- }, Xn = (e) => {
978
+ }, tn = (e) => {
1330
979
  if (typeof e == "string") {
1331
- let t = e.length > Jn ? e.slice(0, Jn) + "…" : e;
980
+ let t = e.length > $t ? e.slice(0, $t) + "…" : e;
1332
981
  return /[\s=]/.test(t) ? `"${t.replace(/"/g, "\\\"")}"` : t;
1333
982
  }
1334
983
  if (e === null) return "null";
1335
984
  if (typeof e == "number" || typeof e == "boolean") return String(e);
1336
985
  try {
1337
986
  let t = JSON.stringify(e);
1338
- return t.length > Jn ? t.slice(0, Jn) + "…" : t;
987
+ return t.length > $t ? t.slice(0, $t) + "…" : t;
1339
988
  } catch {
1340
989
  return "[unserialisable]";
1341
990
  }
1342
- }, Zn = "/_voltro/inspect/logs", Qn = (e, t, n) => {
991
+ }, nn = "/_voltro/inspect/logs", rn = (e, t, n) => {
1343
992
  if (t.headers.authorization !== void 0) return !1;
1344
993
  let { token: r } = n;
1345
994
  if (r === void 0 || r === "" || !n.isLoopback(n.target)) return !1;
1346
995
  e.setHeader("authorization", `Bearer ${r}`);
1347
996
  let i = n.writeToken;
1348
997
  return i !== void 0 && i !== "" && t.headers["x-voltro-inspect-write"] === void 0 && e.setHeader("x-voltro-inspect-write", i), !0;
1349
- }, $n = [{
998
+ }, an = [{
1350
999
  match: (e) => typeof e == "string" && e.startsWith("[BABEL] Note: The code generator has deoptimised"),
1351
1000
  handle: (e, t) => {
1352
1001
  let n = e[0], r = n.match(/deoptimised the styling of (.+?) as it exceeds the max of (\d+\w*B)\.?/);
@@ -1358,13 +1007,13 @@ __installPublicEnv(publicEnvValues)
1358
1007
  });
1359
1008
  } else t.info(n);
1360
1009
  }
1361
- }], er = () => {
1010
+ }], on = () => {
1362
1011
  let e = {
1363
1012
  warn: console.warn.bind(console),
1364
1013
  error: console.error.bind(console)
1365
- }, t = S({ scope: "babel" }), n = !1, r = (r) => (...i) => {
1014
+ }, t = I({ scope: "babel" }), n = !1, r = (r) => (...i) => {
1366
1015
  if (!n) {
1367
- for (let e of $n) if (e.match(i[0])) {
1016
+ for (let e of an) if (e.match(i[0])) {
1368
1017
  n = !0;
1369
1018
  try {
1370
1019
  e.handle(i, t);
@@ -1379,7 +1028,7 @@ __installPublicEnv(publicEnvValues)
1379
1028
  return console.warn = r("warn"), console.error = r("error"), () => {
1380
1029
  console.warn = e.warn, console.error = e.error;
1381
1030
  };
1382
- }, tr = {
1031
+ }, sn = {
1383
1032
  loader: "it runs on the server, and the router caches its result per route + params",
1384
1033
  renderMode: "it picks the server render strategy",
1385
1034
  dynamic: "it picks the server render strategy",
@@ -1390,7 +1039,7 @@ __installPublicEnv(publicEnvValues)
1390
1039
  cacheInvalidatesOn: "it wires this page into the ISR cache invalidator",
1391
1040
  interactive: "it decides how much client JS the server ships",
1392
1041
  tenantAware: "it is part of the server-side cache key"
1393
- }, nr = Object.keys(tr), rr = (e) => t.test(e), ir = (e) => e.replace(/page\.tsx$/, "page.test.tsx"), ar = "virtual:voltro-route-refresh", or = `\0${ar}`, sr = /(?:^|&)(raw|url|inline|worker|sharedworker|direct)(?:&|=|$)/, cr = () => `
1042
+ }, cn = Object.keys(sn), ln = "virtual:voltro-route-refresh", un = `\0${ln}`, dn = /(?:^|&)(raw|url|inline|worker|sharedworker|direct)(?:&|=|$)/, fn = () => `
1394
1043
  // GENERATED by @voltro/cli — the \`voltro dev\` route Fast Refresh runtime.
1395
1044
 
1396
1045
  /** Mirrors react-refresh's own \`isLikelyComponentType\` closely enough for the
@@ -1419,11 +1068,11 @@ const stableForm = (value) => {
1419
1068
  * readers (\`build.ts\` prerender, \`webDev.ts\` dev SSR, \`start.ts\`). A change to
1420
1069
  * one of THESE cannot be hot-applied: the server already ran with the old
1421
1070
  * value. Everything else a page exports is plain client-side data. */
1422
- const serverRelevantExports = ${JSON.stringify(nr)}
1071
+ const serverRelevantExports = ${JSON.stringify(cn)}
1423
1072
 
1424
1073
  /** Name → the server step that already consumed it, so the reload message can
1425
1074
  * say WHY rather than just WHAT. Injected from the same single source. */
1426
- const serverExportEffect = ${JSON.stringify(tr)}
1075
+ const serverExportEffect = ${JSON.stringify(sn)}
1427
1076
 
1428
1077
  /** The reason \`name\` forces a reload, for the console line. */
1429
1078
  export const serverEffectOf = (name) =>
@@ -1466,7 +1115,7 @@ export const routeUpdateNeedsReload = (prevExports, nextExports) => {
1466
1115
  const previousHook = globalThis.__getReactRefreshIgnoredExports
1467
1116
  globalThis.__getReactRefreshIgnoredExports = (args) =>
1468
1117
  ignoredExports.get(args.id) ?? previousHook?.(args) ?? []
1469
- `, lr = (e) => `
1118
+ `, pn = (e) => `
1470
1119
  if (import.meta.hot) {
1471
1120
  // Self-import to read our OWN exports, the same technique the react plugin
1472
1121
  // uses; the namespace is only complete after evaluation, hence the promise.
@@ -1493,254 +1142,97 @@ import {
1493
1142
  registerRouteModule as __voltro_registerRouteModule,
1494
1143
  routeUpdateNeedsReload as __voltro_routeUpdateNeedsReload,
1495
1144
  serverEffectOf as __voltro_serverEffect,
1496
- } from '${ar}'
1497
- `, ur = (e) => e.replace(/\\/g, "/"), dr = (e, t) => {
1498
- let [i = "", a] = ur(e).split("?");
1499
- if (!i.endsWith(".tsx") || a !== void 0 && sr.test(a)) return !1;
1500
- let o = ur(t).replace(/\/$/, "");
1501
- return i.startsWith(`${o}/`) ? r.test(i) || n.has(i.slice(i.lastIndexOf("/") + 1)) : !1;
1502
- }, fr = (e, t, n) => dr(t, n) ? `${e}${lr(ur(t).split("?")[0] ?? t)}` : null, pr = (e) => ({
1145
+ } from '${ln}'
1146
+ `, mn = (e) => e.replace(/\\/g, "/"), hn = (e, t) => {
1147
+ let [n = "", a] = mn(e).split("?");
1148
+ if (!n.endsWith(".tsx") || a !== void 0 && dn.test(a)) return !1;
1149
+ let o = mn(t).replace(/\/$/, "");
1150
+ return n.startsWith(`${o}/`) ? i.test(n) || r.has(n.slice(n.lastIndexOf("/") + 1)) : !1;
1151
+ }, gn = (e, t, n) => hn(t, n) ? `${e}${pn(mn(t).split("?")[0] ?? t)}` : null, _n = (e) => ({
1503
1152
  name: "voltro:route-fast-refresh",
1504
1153
  enforce: "pre",
1505
- resolveId: (e) => e === "virtual:voltro-route-refresh" ? or : void 0,
1506
- load: (e) => e === or ? cr() : void 0,
1154
+ resolveId: (e) => e === "virtual:voltro-route-refresh" ? un : void 0,
1155
+ load: (e) => e === un ? fn() : void 0,
1507
1156
  transform: (t, n, r) => {
1508
1157
  if (r?.ssr === !0) return null;
1509
- let i = fr(t, n, e);
1158
+ let i = gn(t, n, e);
1510
1159
  return i === null ? null : {
1511
1160
  code: i,
1512
1161
  map: null
1513
1162
  };
1514
1163
  }
1515
- }), mr = [
1516
- "static",
1517
- "spa",
1518
- "ssr",
1519
- "isr"
1520
- ], hr = (e) => typeof e == "string" && mr.includes(e), gr = mr.map((e) => `'${e}'`).join(" | "), _r = (e, t) => `[voltro] ${e}: unknown renderMode '${t}'.\n Valid values: ${gr}.${t === "client" || t === "csr" || t === "browser" ? "\n A page that renders only in the browser is 'spa': it is skipped by the prerender and mounts on the client. If its route has a layout, that layout still renders server-side as an SSR shell." : t === "server" || t === "dynamic" ? "\n A page rendered per request is 'ssr'." : t === "ssg" || t === "prerender" ? "\n A page rendered once at build time is 'static' (the default)." : ""}`, vr = class extends Error {
1521
- page;
1522
- value;
1523
- name = "InvalidRenderModeError";
1524
- constructor(e, t) {
1525
- super(_r(e, t)), this.page = e, this.value = t;
1526
- }
1527
- }, yr = (e, t = "<page>") => {
1528
- if (e.renderMode !== void 0 && e.renderMode !== null) {
1529
- if (!hr(e.renderMode)) throw new vr(t, String(e.renderMode));
1530
- return e.renderMode;
1531
- }
1532
- return e.dynamic === "force-dynamic" ? "ssr" : (e.dynamic, "static");
1533
- }, br = (e, t = "<page>") => ({
1534
- renderMode: yr(e, t),
1535
- tenantAware: e.tenantAware === !0,
1536
- revalidateMs: J(e.revalidate),
1537
- staleWhileRevalidateMs: J(e.staleWhileRevalidate) ?? 0,
1538
- cacheInvalidatesOn: Array.isArray(e.cacheInvalidatesOn) ? e.cacheInvalidatesOn : [],
1539
- interactive: e.interactive ?? "full",
1540
- hasLoader: typeof e.loader == "function",
1541
- hasMeta: e.meta != null,
1542
- hasGetStaticPaths: typeof e.getStaticPaths == "function"
1543
- }), xr = /export\s+const\s+renderMode\s*(?::[^=]+)?=\s*['"]([^'"]*)['"]/, Sr = (e) => xr.exec(e)?.[1] ?? null, Cr = /export\s*\{([^}]*)\}\s*from\s*['"]([^'"]+)['"]/g, wr = (e) => {
1544
- Cr.lastIndex = 0;
1545
- let t;
1546
- for (; (t = Cr.exec(e)) !== null;) {
1547
- let e = t[2];
1548
- if (e.startsWith(".")) for (let n of t[1].split(",")) {
1549
- let t = n.lastIndexOf(" as ");
1550
- if ((t === -1 ? n : n.slice(t + 4)).trim() === "renderMode") return e;
1551
- }
1552
- }
1553
- return null;
1554
- }, Tr = /export\s*\{([^}]*)\}/g, Er = (e) => {
1555
- if (/export\s+default\b/.test(e)) return !0;
1556
- Tr.lastIndex = 0;
1557
- let t;
1558
- for (; (t = Tr.exec(e)) !== null;) for (let e of t[1].split(",")) {
1559
- let t = e.lastIndexOf(" as ");
1560
- if ((t === -1 ? e : e.slice(t + 4)).trim() === "default") return !0;
1561
- }
1562
- return !1;
1563
- }, Dr = async (e, t) => {
1564
- let n = (await Promise.all(t.map(async (t) => {
1565
- let n;
1566
- try {
1567
- n = await le(p(e, t.file), "utf8");
1568
- } catch {
1569
- return null;
1570
- }
1571
- let r = Sr(n);
1572
- return r !== null && !hr(r) ? _r(p("src", "pages", t.file), r) : Er(n) ? null : `${p("src", "pages", t.file)} is a route (a \`page.tsx\` under src/pages/) but exports no default.\n\n A page's default export IS its component — the router has nothing to render without it,\n and the failure would otherwise surface only in \`voltro build\`'s prerender as\n "SSR received a descriptor with no Component", long after the file was written.\n\n Fix: \`export default function Page() { … }\`, or re-export another page's component\n (\`export { default } from '../page'\`). If this file is NOT a route, rename it —\n only the reserved names route, and anything else under src/pages/ is ordinary code\n that may live beside the page that uses it.`;
1573
- }))).filter((e) => e !== null);
1574
- if (n.length !== 0) throw Error(n.join("\n\n"));
1575
- }, X = p(L(), ".voltro", "logs"), Or = () => {
1576
- let e = Number(process.env.VOLTRO_LOG_FILE_TTL_MS);
1577
- return Number.isFinite(e) && e > 0 ? e : 3600 * 1e3;
1578
- }, kr = !1, Ar = () => {
1579
- if (kr) return;
1580
- kr = !0;
1581
- let e = Date.now() - Or(), t = [];
1582
- try {
1583
- t = A(X);
1584
- } catch {
1585
- return;
1586
- }
1587
- for (let n of t) {
1588
- if (!n.endsWith(".log")) continue;
1589
- let t = p(X, n);
1590
- try {
1591
- j(t).mtimeMs < e && M(t);
1592
- } catch {}
1593
- }
1594
- }, jr = (e) => e.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80), Mr = (e, t) => p(X, `${jr(e)}-${t}.log`), Nr = (e) => {
1595
- let t = jr(e), n = [];
1596
- try {
1597
- n = A(X);
1598
- } catch {
1599
- return;
1600
- }
1601
- let r = n.filter((e) => e.startsWith(`${t}-`) && e.endsWith(".log"));
1602
- if (r.length === 0) return;
1603
- let i, a = -1;
1604
- for (let e of r) {
1605
- let t = p(X, e);
1606
- try {
1607
- let e = j(t);
1608
- e.mtimeMs > a && (a = e.mtimeMs, i = t);
1609
- } catch {}
1610
- }
1611
- return i;
1612
- }, Pr = (e) => {
1613
- try {
1614
- E(X, { recursive: !0 });
1615
- } catch {}
1616
- Ar();
1617
- let t = Mr(e, process.pid), n = D(t, "w"), r = (e) => {
1618
- let t = {
1619
- ts: e.ts.getTime(),
1620
- level: e.level,
1621
- source: e.scope === "client" ? "client" : "server",
1622
- message: e.message,
1623
- fields: e.fields
1624
- };
1625
- e.scope !== void 0 && (t.scope = e.scope);
1626
- try {
1627
- return JSON.stringify(t) + "\n";
1628
- } catch {
1629
- return JSON.stringify({
1630
- ts: e.ts.getTime(),
1631
- level: e.level,
1632
- source: t.source,
1633
- message: e.message,
1634
- fields: {},
1635
- ...e.scope === void 0 ? {} : { scope: e.scope }
1636
- }) + "\n";
1637
- }
1638
- }, i = !1, a = x((e) => {
1639
- if (!i) try {
1640
- P(n, r(e));
1641
- } catch {}
1642
- }), o = () => {
1643
- if (!i) {
1644
- i = !0;
1645
- try {
1646
- w(n);
1647
- } catch {}
1648
- }
1649
- };
1650
- process.once("exit", o);
1651
- let s = () => o();
1652
- return process.on("uncaughtException", s), process.on("unhandledRejection", s), {
1653
- path: t,
1654
- dispose: async () => {
1655
- a(), o(), process.off("exit", o), process.off("uncaughtException", s), process.off("unhandledRejection", s);
1656
- }
1657
- };
1658
- }, Fr = async (e, t) => {
1659
- let n;
1660
- try {
1661
- n = await O.readFile(e, "utf8");
1662
- } catch {
1663
- return [];
1664
- }
1665
- let r = n.split("\n"), i = [], a = t?.since ?? 0;
1666
- for (let e of r) if (e.length !== 0) try {
1667
- let t = JSON.parse(e);
1668
- if (typeof t.ts != "number" || t.ts < a) continue;
1669
- i.push(t);
1670
- } catch {}
1671
- return t?.max !== void 0 && i.length > t.max ? i.slice(i.length - t.max) : i;
1672
- }, Ir = S({ scope: "voltro:dashboard" }), Lr = R(import.meta.url), Rr = 5179, zr = (e) => {
1164
+ }), vn = I({ scope: "voltro:dashboard" }), yn = R(import.meta.url), bn = 5179, xn = (e) => {
1673
1165
  let t = process.env.VOLTRO_DASHBOARD_PATH;
1674
- if (t && T(p(h(t), "app.config.ts"))) return h(t);
1166
+ if (t && E(C(T(t), "app.config.ts"))) return T(t);
1675
1167
  try {
1676
- let e = d(Lr.resolve("@voltro/dashboard/package.json"));
1677
- if (T(p(e, "app.config.ts"))) return e;
1168
+ let e = S(yn.resolve("@voltro/dashboard/package.json"));
1169
+ if (E(C(e, "app.config.ts"))) return e;
1678
1170
  } catch {}
1679
- let n = p("voltro-devtools", "apps", "dashboard"), r = h(e);
1171
+ let n = C("voltro-devtools", "apps", "dashboard"), r = T(e);
1680
1172
  for (let e = 0; e < 10; e++) {
1681
- let e = p(r, n);
1682
- if (T(p(e, "app.config.ts"))) return e;
1683
- let t = d(r);
1173
+ let e = C(r, n);
1174
+ if (E(C(e, "app.config.ts"))) return e;
1175
+ let t = S(r);
1684
1176
  if (t === r) break;
1685
1177
  r = t;
1686
1178
  }
1687
1179
  return null;
1688
- }, Br = "VOLTRO_IS_DASHBOARD", Vr = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
1689
- let i = pe({
1180
+ }, Sn = "VOLTRO_IS_DASHBOARD", Cn = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
1181
+ let i = le({
1690
1182
  port: e,
1691
1183
  host: t
1692
1184
  }), a = !1, o = (e) => {
1693
1185
  a || (a = !0, i.destroy(), r(e));
1694
1186
  };
1695
1187
  i.once("connect", () => o(!0)), i.once("error", () => o(!1)), setTimeout(() => o(!1), n);
1696
- }), Hr = () => !!(process.env.VOLTRO_DASHBOARD === "off" || process.argv.includes("--disable-dashboard")), Ur = () => process.env[Br] === "1", Wr = () => process.stdout.isTTY === !0, Gr = p(L(), ".voltro", "dashboard-launch.lock"), Kr = 1e4, qr = async () => {
1188
+ }), wn = () => !!(process.env.VOLTRO_DASHBOARD === "off" || process.argv.includes("--disable-dashboard")), Tn = () => process.env[Sn] === "1", En = () => process.stdout.isTTY === !0, Dn = C(ee(), ".voltro", "dashboard-launch.lock"), On = 1e4, kn = async () => {
1697
1189
  try {
1698
- await O.mkdir(d(Gr), { recursive: !0 });
1699
- let e = await O.open(Gr, "wx");
1190
+ await D.mkdir(S(Dn), { recursive: !0 });
1191
+ let e = await D.open(Dn, "wx");
1700
1192
  return await e.write(`${process.pid}\n${Date.now()}\n`), await e.close(), !0;
1701
1193
  } catch {
1702
1194
  try {
1703
- let e = await O.stat(Gr);
1704
- if (Date.now() - e.mtimeMs > Kr) return await O.unlink(Gr).catch(() => void 0), qr();
1195
+ let e = await D.stat(Dn);
1196
+ if (Date.now() - e.mtimeMs > On) return await D.unlink(Dn).catch(() => void 0), kn();
1705
1197
  } catch {}
1706
1198
  return !1;
1707
1199
  }
1708
- }, Jr = async () => {
1200
+ }, An = async () => {
1709
1201
  try {
1710
- await O.unlink(Gr);
1202
+ await D.unlink(Dn);
1711
1203
  } catch {}
1712
- }, Yr = async (e) => {
1204
+ }, jn = async (e) => {
1713
1205
  let t = e.port ?? 5179;
1714
- if (Hr()) return {
1206
+ if (wn()) return {
1715
1207
  status: "skipped",
1716
1208
  reason: "disabled by flag/env",
1717
1209
  port: t
1718
1210
  };
1719
- if (Ur()) return {
1211
+ if (Tn()) return {
1720
1212
  status: "skipped",
1721
1213
  reason: "this process IS the dashboard",
1722
1214
  port: t
1723
1215
  };
1724
- if (!Wr()) return {
1216
+ if (!En()) return {
1725
1217
  status: "skipped",
1726
1218
  reason: "stdout is not a TTY (CI/smoke)",
1727
1219
  port: t
1728
1220
  };
1729
- if (!await qr()) return {
1221
+ if (!await kn()) return {
1730
1222
  status: "skipped",
1731
1223
  reason: "another voltro process is currently launching the dashboard",
1732
1224
  port: t
1733
1225
  };
1734
- if (await Vr(t)) return await Jr(), {
1226
+ if (await Cn(t)) return await An(), {
1735
1227
  status: "already-running",
1736
1228
  port: t
1737
1229
  };
1738
1230
  let n = e.voltroBin;
1739
1231
  if (!n) {
1740
1232
  let e = process.argv[1];
1741
- n = e && e.endsWith("/src/bin.ts") ? p(d(e), "..", "bin", "voltro.mjs") : e ?? "voltro";
1233
+ n = e && e.endsWith("/src/bin.ts") ? C(S(e), "..", "bin", "voltro.mjs") : e ?? "voltro";
1742
1234
  }
1743
- let r = T(p(e.dashboardAppPath, ".framework", "dist", "index.html")), i = r ? "start" : "dev", a = fe(process.execPath, [
1235
+ let r = E(C(e.dashboardAppPath, ".framework", "dist", "index.html")), i = r ? "start" : "dev", a = ce(process.execPath, [
1744
1236
  n,
1745
1237
  i,
1746
1238
  e.dashboardAppPath
@@ -1748,7 +1240,7 @@ import {
1748
1240
  stdio: "ignore",
1749
1241
  env: {
1750
1242
  ...process.env,
1751
- [Br]: "1",
1243
+ [Sn]: "1",
1752
1244
  VOLTRO_DASHBOARD_PORT: String(t)
1753
1245
  }
1754
1246
  });
@@ -1756,22 +1248,22 @@ import {
1756
1248
  if (a.exitCode === null && a.signalCode === null) try {
1757
1249
  a.kill("SIGTERM");
1758
1250
  } catch {}
1759
- }), Ir.info(`auto-launching dashboard at http://localhost:${t}`, {
1251
+ }), vn.info(`auto-launching dashboard at http://localhost:${t}`, {
1760
1252
  port: t,
1761
1253
  mode: i,
1762
1254
  prebuilt: r
1763
- }), r || Ir.debug("no pre-built dashboard — running `voltro dev`. Build with `cd voltro-devtools && pnpm build` for a fast prod boot."), Ir.debug("disable via --disable-dashboard or VOLTRO_DASHBOARD=off"), setTimeout(() => {
1764
- Jr();
1255
+ }), r || vn.debug("no pre-built dashboard — running `voltro dev`. Build with `cd voltro-devtools && pnpm build` for a fast prod boot."), vn.debug("disable via --disable-dashboard or VOLTRO_DASHBOARD=off"), setTimeout(() => {
1256
+ An();
1765
1257
  }, 4e3).unref(), {
1766
1258
  status: "launched",
1767
1259
  port: t
1768
1260
  };
1769
- }, Xr = class extends Error {
1261
+ }, Mn = class extends Error {
1770
1262
  _voltroDeferral = !0;
1771
1263
  constructor(e) {
1772
1264
  super(e), this.name = "DeferralNotSupportedError";
1773
1265
  }
1774
- }, Zr = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, Qr = (e) => {
1266
+ }, Nn = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, Pn = (e) => {
1775
1267
  if (!(e instanceof Error)) return;
1776
1268
  let t = e._voltroControl;
1777
1269
  if (t === "redirect") {
@@ -1793,7 +1285,7 @@ import {
1793
1285
  },
1794
1286
  body: "not found"
1795
1287
  };
1796
- }, $r = (e) => {
1288
+ }, Fn = (e) => {
1797
1289
  let { helpers: t } = e, n = t.prepareDeferredLoaderData(e.loaderData, "page"), r = {}, i = {}, a = {};
1798
1290
  for (let [n, o] of Object.entries(e.segmentLoaderData)) {
1799
1291
  let e = Number(n), s = t.prepareDeferredLoaderData(o, e);
@@ -1808,7 +1300,7 @@ import {
1808
1300
  ...e.layoutShell ? { layoutShell: e.layoutShell } : {}
1809
1301
  });
1810
1302
  } catch (e) {
1811
- throw new Xr(e instanceof Error ? e.message : String(e));
1303
+ throw new Mn(e instanceof Error ? e.message : String(e));
1812
1304
  }
1813
1305
  return {
1814
1306
  loaderData: n.renderData,
@@ -1824,8 +1316,8 @@ import {
1824
1316
  ...Object.keys(a).length > 0 ? { deferredSegmentIds: a } : {}
1825
1317
  }
1826
1318
  };
1827
- }, ei = (e) => {
1828
- let { helpers: t, renderInput: n } = e, r = $r({
1319
+ }, In = (e) => {
1320
+ let { helpers: t, renderInput: n } = e, r = Fn({
1829
1321
  helpers: t,
1830
1322
  page: e.page,
1831
1323
  pathname: n.pathname,
@@ -1846,19 +1338,19 @@ import {
1846
1338
  stateScript: t.renderRouterStateScript(r.stateInput),
1847
1339
  hasDeferred: r.hasDeferred
1848
1340
  };
1849
- }, ti = (e) => {
1341
+ }, Ln = (e) => {
1850
1342
  let { html: t, meta: n } = e.helpers.renderPageToHtml(e.prepared.renderInput);
1851
1343
  return {
1852
1344
  body: t,
1853
1345
  meta: n
1854
1346
  };
1855
- }, ni = (e) => [
1347
+ }, Rn = (e) => [
1856
1348
  ...e.extra ?? [],
1857
1349
  e.helpers.renderMetaToHtml(e.meta),
1858
1350
  `<meta name="voltro-interactive" content="${e.interactive}" />`,
1859
1351
  ...e.prepared.hasDeferred ? [e.helpers.renderDeferredRegistryScript()] : [],
1860
1352
  e.prepared.stateScript
1861
- ].filter((e) => e.length > 0).join("\n "), ri = (e) => {
1353
+ ].filter((e) => e.length > 0).join("\n "), zn = (e) => {
1862
1354
  let t = e.indexOf("?");
1863
1355
  return t === -1 ? {
1864
1356
  pathname: e || "/",
@@ -1867,9 +1359,9 @@ import {
1867
1359
  pathname: e.slice(0, t) || "/",
1868
1360
  search: e.slice(t)
1869
1361
  };
1870
- }, ii = /Could not find required `intl` object/, ai = "__voltro_i18n_instances__", oi = (e = globalThis) => {
1362
+ }, Bn = /Could not find required `intl` object/, Vn = "__voltro_i18n_instances__", Hn = (e = globalThis) => {
1871
1363
  try {
1872
- let t = e[ai]?.records;
1364
+ let t = e[Vn]?.records;
1873
1365
  return t === void 0 || t.length === 0 ? void 0 : {
1874
1366
  instances: t.length,
1875
1367
  reactIntlCopies: new Set(t.map((e) => e.intlProvider)).size,
@@ -1878,7 +1370,7 @@ import {
1878
1370
  } catch {
1879
1371
  return;
1880
1372
  }
1881
- }, si = (e, t) => [
1373
+ }, Un = (e, t) => [
1882
1374
  "",
1883
1375
  "── voltro diagnosis ───────────────────────────────────────────────────",
1884
1376
  `${e} DID wrap this render in <I18nProvider>, and this process`,
@@ -1896,7 +1388,7 @@ import {
1896
1388
  " versions on disk; this counts instances in the running process, and one",
1897
1389
  " file loaded down two paths is two instances.",
1898
1390
  "───────────────────────────────────────────────────────────────────────"
1899
- ].join("\n"), ci = (e, t) => [
1391
+ ].join("\n"), Wn = (e, t) => [
1900
1392
  "",
1901
1393
  "── voltro diagnosis ───────────────────────────────────────────────────",
1902
1394
  `${e} DID wrap this render in <I18nProvider>, and this process`,
@@ -1912,7 +1404,7 @@ import {
1912
1404
  " direct import can land on a second copy that this count does not see —",
1913
1405
  " it counts what @voltro/i18n is bound to.",
1914
1406
  "───────────────────────────────────────────────────────────────────────"
1915
- ].join("\n"), li = (e) => [
1407
+ ].join("\n"), Gn = (e) => [
1916
1408
  "",
1917
1409
  "── voltro diagnosis ───────────────────────────────────────────────────",
1918
1410
  `${e} DID wrap this render in <I18nProvider> — the framework`,
@@ -1928,34 +1420,34 @@ import {
1928
1420
  " Do NOT use `pnpm ls` to rule that out: it lists versions on disk, and",
1929
1421
  " the duplication here is of module instances in one process.",
1930
1422
  "───────────────────────────────────────────────────────────────────────"
1931
- ].join("\n"), ui = (e, t, n, r = oi()) => {
1423
+ ].join("\n"), Kn = (e, t, n, r = Hn()) => {
1932
1424
  if (!t) return;
1933
1425
  let i = String(e?.message ?? e);
1934
- if (ii.test(i)) return r === void 0 ? li(n) : r.reactIntlCopies > 1 || r.instances > 1 ? si(n, r) : ci(n, r);
1935
- }, di = "<div id=\"root\"></div>", fi = "<div id=\"root\">", pi = "</div>", mi = /<script\b[^>]*\btype=["']module["'][^>]*><\/script>[ \t]*\n?/gi, hi = /\bsrc=["']([^"']+)["']/i, gi = /<script(?![^>]*\basync\b)([^>]*\btype=["']module["'][^>]*)>/gi, _i = (e) => {
1936
- let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(mi, (e) => {
1937
- let r = hi.exec(e)?.[1];
1426
+ if (Bn.test(i)) return r === void 0 ? Gn(n) : r.reactIntlCopies > 1 || r.instances > 1 ? Un(n, r) : Wn(n, r);
1427
+ }, qn = "<div id=\"root\"></div>", Jn = "<div id=\"root\">", Yn = "</div>", Xn = /<script\b[^>]*\btype=["']module["'][^>]*><\/script>[ \t]*\n?/gi, Zn = /\bsrc=["']([^"']+)["']/i, Qn = /<script(?![^>]*\basync\b)([^>]*\btype=["']module["'][^>]*)>/gi, $n = (e) => {
1428
+ let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(Xn, (e) => {
1429
+ let r = Zn.exec(e)?.[1];
1938
1430
  return r === void 0 || t(r) ? e : (n.push(r), "");
1939
1431
  });
1940
- e.inlineModuleScriptsAsync && (r = r.replace(gi, "<script async$1>"));
1941
- let i = r.indexOf(di);
1942
- if (i === -1) throw Error(`[voltro] the generated shell has no \`${di}\` element, so a streamed response cannot be split around the page body. This is a framework bug unless the app overrode \`.framework/index.html\` by hand.`);
1432
+ e.inlineModuleScriptsAsync && (r = r.replace(Qn, "<script async$1>"));
1433
+ let i = r.indexOf(qn);
1434
+ if (i === -1) throw Error(`[voltro] the generated shell has no \`${qn}\` element, so a streamed response cannot be split around the page body. This is a framework bug unless the app overrode \`.framework/index.html\` by hand.`);
1943
1435
  return {
1944
- head: `${r.slice(0, i)}${fi}`,
1945
- tail: `${pi}${r.slice(i + 21)}`,
1436
+ head: `${r.slice(0, i)}${Jn}`,
1437
+ tail: `${Yn}${r.slice(i + 21)}`,
1946
1438
  bootstrapModules: n
1947
1439
  };
1948
- }, vi = (e, t) => (/<title>/i.test(t) ? e.replace(/[^\S\n]*<title>[\s\S]*?<\/title>\n?/i, "") : e).replace("</head>", ` ${t}\n </head>`), yi = (e) => vi(e.head, e.headInjection).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${e.htmlLang}"`), bi = (e) => {
1440
+ }, er = (e, t) => (/<title>/i.test(t) ? e.replace(/[^\S\n]*<title>[\s\S]*?<\/title>\n?/i, "") : e).replace("</head>", ` ${t}\n </head>`), tr = (e) => er(e.head, e.headInjection).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${e.htmlLang}"`), nr = (e) => {
1949
1441
  let { res: t, shell: n, htmlLang: r, headInjection: i } = e, a = null, o = !1, s = !1, c = () => {
1950
1442
  if (s || !o || a === null) return;
1951
1443
  s = !0, t.statusCode = e.statusCode ?? 200;
1952
1444
  for (let [n, r] of Object.entries(e.headers ?? {})) t.setHeader(n, r);
1953
- t.flushHeaders?.(), t.write(yi({
1445
+ t.flushHeaders?.(), t.write(tr({
1954
1446
  head: n.head,
1955
1447
  headInjection: i(a.meta),
1956
1448
  htmlLang: r
1957
1449
  }));
1958
- let c = new me();
1450
+ let c = new ue();
1959
1451
  c.pipe(t, { end: !1 }), c.on("end", () => {
1960
1452
  t.end(n.tail);
1961
1453
  }), a.stream.pipe(c);
@@ -1980,16 +1472,16 @@ import {
1980
1472
  return;
1981
1473
  }
1982
1474
  c();
1983
- }, xi = (e) => Array.isArray(e.preload) && e.preload.length > 0, Si = (e, t) => typeof e == "string" ? {
1475
+ }, rr = (e) => Array.isArray(e.preload) && e.preload.length > 0, ir = (e, t) => typeof e == "string" ? {
1984
1476
  tag: e,
1985
1477
  input: {}
1986
1478
  } : {
1987
1479
  tag: e.tag,
1988
1480
  input: e.input?.(t) ?? {}
1989
- }, Ci = async (e) => {
1481
+ }, ar = async (e) => {
1990
1482
  let { pageMod: t, params: n, query: r, apiName: i, seed: a, onError: o } = e;
1991
- if (xi(t) && !(r === void 0 || i === void 0)) for (let e of t.preload) {
1992
- let { tag: t, input: s } = Si(e, n);
1483
+ if (rr(t) && !(r === void 0 || i === void 0)) for (let e of t.preload) {
1484
+ let { tag: t, input: s } = ir(e, n);
1993
1485
  try {
1994
1486
  a(i, t, s, await r(t, s));
1995
1487
  } catch (e) {
@@ -1999,23 +1491,23 @@ import {
1999
1491
  }, e);
2000
1492
  }
2001
1493
  }
2002
- }, Z = S({ scope: "voltro:dev:web" }), wi = S({ scope: "vite" }), Ti = await (async () => {
1494
+ }, Z = I({ scope: "voltro:dev:web" }), or = I({ scope: "vite" }), sr = await (async () => {
2003
1495
  try {
2004
- let e = p(d(g(import.meta.url)), "..", "package.json"), t = await O.readFile(e, "utf8");
1496
+ let e = C(S(N(import.meta.url)), "..", "package.json"), t = await D.readFile(e, "utf8");
2005
1497
  return JSON.parse(t).version ?? "0.0.0";
2006
1498
  } catch {
2007
1499
  return "0.0.0";
2008
1500
  }
2009
- })(), Ei = async () => {
1501
+ })(), cr = async () => {
2010
1502
  try {
2011
- let e = d(g(import.meta.url)), t = h(e, "..", "..", "devtools");
2012
- if (T(p(t, "package.json"))) return t;
2013
- let n = h(e, "..", "..", "..", "devtools");
2014
- return T(p(n, "package.json")) ? n : null;
1503
+ let e = S(N(import.meta.url)), t = T(e, "..", "..", "devtools");
1504
+ if (E(C(t, "package.json"))) return t;
1505
+ let n = T(e, "..", "..", "..", "devtools");
1506
+ return E(C(n, "package.json")) ? n : null;
2015
1507
  } catch {
2016
1508
  return null;
2017
1509
  }
2018
- }, Di = (e, t) => e.disableDevtools || !t ? [] : [
1510
+ }, lr = (e, t) => e.disableDevtools || !t ? [] : [
2019
1511
  "",
2020
1512
  "// Dev-only in-page devtools overlay. The `import.meta.env.DEV` guard is a",
2021
1513
  "// compile-time constant, so prod builds strip this whole `if` block — the",
@@ -2025,71 +1517,71 @@ import {
2025
1517
  " await import('@voltro/devtools/styles.css')",
2026
1518
  " Devtools = (await import('@voltro/devtools')).VoltroDevtools",
2027
1519
  "}"
2028
- ], Oi = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], ki = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], Ai = (e) => e.sentry ? [
1520
+ ], ur = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], dr = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], fr = (e) => e.sentry ? [
2029
1521
  "",
2030
1522
  "// Browser-side Sentry (frontend half of the deep integration). Errors +",
2031
1523
  "// browser rpc spans flow to Sentry, sharing the server transactions' trace.",
2032
1524
  `await initSentryBrowser(${JSON.stringify(e.sentry)})`
2033
- ] : [], ji = (e) => e.env ? ["import './env.public'"] : [], Mi = (e) => {
2034
- let t = [], n = h(e);
1525
+ ] : [], pr = (e) => e.env ? ["import './env.public'"] : [], mr = (e) => {
1526
+ let t = [], n = T(e);
2035
1527
  for (;;) {
2036
- T(p(n, "pnpm-workspace.yaml")) && t.push(n);
2037
- let e = d(n);
1528
+ E(C(n, "pnpm-workspace.yaml")) && t.push(n);
1529
+ let e = S(n);
2038
1530
  if (e === n) break;
2039
1531
  n = e;
2040
1532
  }
2041
1533
  return t;
2042
- }, Ni = rr, Pi = (e) => {
1534
+ }, hr = h, gr = (e) => {
2043
1535
  if (/\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:react|react-dom|scheduler)\//.test(e)) return "react";
2044
1536
  let t = /\/([^/]+)\.island\.tsx?$/.exec(e);
2045
1537
  if (t) return `island-${t[1]}`;
2046
- }, Fi = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, Ii = (e) => e.startsWith("(") && e.endsWith(")"), Li = (e) => e.filter((e) => !Ii(e)), Ri = (e) => {
2047
- let t = e.replace(r, "").split("/").filter(Boolean).filter((e) => !Ii(e));
1538
+ }, _r = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, vr = (e) => e.startsWith("(") && e.endsWith(")"), yr = (e) => e.filter((e) => !vr(e)), br = (e) => {
1539
+ let t = e.replace(i, "").split("/").filter(Boolean).filter((e) => !vr(e));
2048
1540
  return t.length === 0 ? "/" : "/" + t.join("/");
2049
- }, zi = (e) => `${e.replace(r, "").split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Index"}Page`, Q = (e, t) => e === "" ? `Root${t}` : `${e.split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Root"}${t}`, $ = async (e) => {
2050
- let t = [], i = [], a = async (e, o) => {
1541
+ }, xr = (e) => `${e.replace(i, "").split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Index"}Page`, Q = (e, t) => e === "" ? `Root${t}` : `${e.split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Root"}${t}`, $ = async (e) => {
1542
+ let t = [], n = [], a = async (e, o) => {
2051
1543
  let s = [];
2052
1544
  try {
2053
- s = await O.readdir(e, { withFileTypes: !0 });
1545
+ s = await D.readdir(e, { withFileTypes: !0 });
2054
1546
  } catch {
2055
1547
  return;
2056
1548
  }
2057
- let c = s.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = s.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !Ni(e.name)).map((e) => e.name).sort(), u = new Set(l), d = o.join("/");
2058
- if (l.some((e) => n.has(e))) {
2059
- let t = u.has("layout.tsx"), r = !1;
1549
+ let c = s.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = s.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !hr(e.name)).map((e) => e.name).sort(), u = new Set(l), d = o.join("/");
1550
+ if (l.some((e) => r.has(e))) {
1551
+ let t = u.has("layout.tsx"), i = !1;
2060
1552
  if (t) try {
2061
- let t = await O.readFile(p(e, "layout.tsx"), "utf8");
2062
- r = Fi.test(t);
1553
+ let t = await D.readFile(C(e, "layout.tsx"), "utf8");
1554
+ i = _r.test(t);
2063
1555
  } catch {}
2064
- i.push({
1556
+ n.push({
2065
1557
  dir: d,
2066
1558
  chain: o,
2067
- contributesToUrl: o.length === 0 || !Ii(o[o.length - 1]),
1559
+ contributesToUrl: o.length === 0 || !vr(o[o.length - 1]),
2068
1560
  hasLayout: t,
2069
- hasLayoutLoader: r,
1561
+ hasLayoutLoader: i,
2070
1562
  hasError: u.has("error.tsx"),
2071
1563
  hasPending: u.has("loading.tsx"),
2072
1564
  hasNotFound: u.has("not-found.tsx"),
2073
- specialFiles: l.filter((e) => n.has(e))
1565
+ specialFiles: l.filter((e) => r.has(e))
2074
1566
  });
2075
1567
  }
2076
1568
  for (let e of l) {
2077
- if (!r.test(e)) continue;
1569
+ if (!i.test(e)) continue;
2078
1570
  let n = d ? `${d}/${e}` : e;
2079
1571
  t.push({
2080
1572
  file: n,
2081
- pattern: Ri(n),
2082
- ident: zi(n),
1573
+ pattern: br(n),
1574
+ ident: xr(n),
2083
1575
  dirChain: o
2084
1576
  });
2085
1577
  }
2086
- for (let t of c) await a(p(e, t), [...o, t]);
1578
+ for (let t of c) await a(C(e, t), [...o, t]);
2087
1579
  };
2088
1580
  await a(e, []), t.sort((e, t) => e.file < t.file ? -1 : 1);
2089
1581
  let o = /* @__PURE__ */ new Set();
2090
1582
  for (let e of t) for (let t = e.dirChain.length; t >= 0; t--) o.add(e.dirChain.slice(0, t).join("/"));
2091
1583
  let s = [], c = [];
2092
- for (let { specialFiles: e, ...t } of i) o.has(t.dir) ? s.push(t) : c.push({
1584
+ for (let { specialFiles: e, ...t } of n) o.has(t.dir) ? s.push(t) : c.push({
2093
1585
  dir: t.dir,
2094
1586
  files: e
2095
1587
  });
@@ -2098,14 +1590,14 @@ import {
2098
1590
  dirs: s,
2099
1591
  orphanedSpecials: c
2100
1592
  };
2101
- }, Bi = (e, t) => {
1593
+ }, Sr = (e, t) => {
2102
1594
  let n = [];
2103
1595
  for (let r = 0; r <= t.length; r++) {
2104
1596
  let i = t.slice(0, r).join("/"), a = e.find((e) => e.dir === i);
2105
1597
  a && n.push(a);
2106
1598
  }
2107
1599
  return n;
2108
- }, Vi = async (e) => {
1600
+ }, Cr = async (e) => {
2109
1601
  let { entries: t, loadLayout: n, loadError: r, loadPending: i, ctx: a } = e, o = {};
2110
1602
  return {
2111
1603
  chain: await Promise.all(t.map(async (e, t) => {
@@ -2128,10 +1620,10 @@ import {
2128
1620
  })),
2129
1621
  segmentLoaderData: o
2130
1622
  };
2131
- }, Hi = (e) => {
2132
- let t = Li(e);
1623
+ }, wr = (e) => {
1624
+ let t = yr(e);
2133
1625
  return t.length === 0 ? "" : "/" + t.join("/");
2134
- }, Ui = [
1626
+ }, Tr = [
2135
1627
  "// Hot-reload bridge: keep SSR-injected <link rel=\"stylesheet\"> tags",
2136
1628
  "// in sync with Vite's CSS HMR. Without this, edits to .css files",
2137
1629
  "// only update the JS-injected <style> overlay; the underlying <link>",
@@ -2224,7 +1716,7 @@ import {
2224
1716
  " _vdtErrorStart('Build error')",
2225
1717
  " })",
2226
1718
  "}"
2227
- ].join("\n"), Wi = (e) => {
1719
+ ].join("\n"), Er = (e) => {
2228
1720
  let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
2229
1721
  for (let e of r) e.startsWith("[[...") && e.endsWith("]]") ? (i.push("(.*)"), t.push(e.slice(5, -2)), n += 2) : e.startsWith("[...") && e.endsWith("]") ? (i.push("(.+)"), t.push(e.slice(4, -1)), n += 3) : e.startsWith("[") && e.endsWith("]") ? (i.push("([^/]+)"), t.push(e.slice(1, -1)), n += 1) : i.push(e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
2230
1722
  let a = i.join("/");
@@ -2233,8 +1725,8 @@ import {
2233
1725
  paramNames: t,
2234
1726
  priority: n
2235
1727
  };
2236
- }, Gi = (e) => e.map((e) => {
2237
- let { regex: t, paramNames: n, priority: r } = Wi(e.pattern);
1728
+ }, Dr = (e) => e.map((e) => {
1729
+ let { regex: t, paramNames: n, priority: r } = Er(e.pattern);
2238
1730
  return {
2239
1731
  pattern: e.pattern,
2240
1732
  file: e.file,
@@ -2243,7 +1735,7 @@ import {
2243
1735
  paramNames: n,
2244
1736
  priority: r
2245
1737
  };
2246
- }).slice().sort((e, t) => e.priority - t.priority), Ki = (e, t) => {
1738
+ }).slice().sort((e, t) => e.priority - t.priority), Or = (e, t) => {
2247
1739
  for (let n of t) {
2248
1740
  let t = n.regex.exec(e);
2249
1741
  if (!t) continue;
@@ -2255,30 +1747,23 @@ import {
2255
1747
  };
2256
1748
  }
2257
1749
  return null;
2258
- }, qi = async (e, t) => {
2259
- let n = e;
2260
- for (;;) {
2261
- let e = p(n, "node_modules", t);
2262
- try {
2263
- if ((await O.stat(e)).isDirectory()) {
2264
- let t = await O.realpath(e);
2265
- return t.includes("/node_modules/") ? null : t;
2266
- }
2267
- } catch {}
2268
- let r = d(n);
2269
- if (r === n) return null;
2270
- n = r;
2271
- }
2272
- }, Ji = async (e) => {
1750
+ }, kr = xe, Ar = async (e) => {
2273
1751
  try {
2274
- let t = await import(_(p(e, "app.config.ts")).href), n = t.default?.port, r = typeof n == "number" ? n : 4e3, i = t.default?.transport?.wsPath, a = typeof i == "string" && i.startsWith("/") ? i : void 0;
2275
- return a ? {
2276
- port: r,
2277
- wsPath: a
2278
- } : { port: r };
1752
+ let t = await import(P(C(e, "app.config.ts")).href), r = t.default?.port, i = n({
1753
+ kind: "api",
1754
+ configPort: typeof r == "number" ? r : void 0,
1755
+ env: {}
1756
+ }).port, a = t.default?.transport?.wsPath, o = typeof a == "string" && a.startsWith("/") ? a : void 0;
1757
+ return o ? {
1758
+ port: i,
1759
+ wsPath: o
1760
+ } : { port: i };
2279
1761
  } catch {}
2280
- return { port: 4e3 };
2281
- }, Yi = (e, t) => ({
1762
+ return { port: n({
1763
+ kind: "api",
1764
+ env: {}
1765
+ }).port };
1766
+ }, jr = (e, t) => ({
2282
1767
  name: e,
2283
1768
  pkg: t.package,
2284
1769
  browserWsUrl: t.url,
@@ -2286,7 +1771,7 @@ import {
2286
1771
  ...t.serverUrl ? { serverOrigin: t.serverUrl } : {},
2287
1772
  ...t.headers ? { headers: t.headers } : {},
2288
1773
  ...t.authHeaders ? { hasAuthHeaders: !0 } : {}
2289
- }), Xi = (e, t, n) => {
1774
+ }), Mr = (e, t, n) => {
2290
1775
  let r = t.transport?.wsPath ?? n.wsPath;
2291
1776
  return {
2292
1777
  name: e,
@@ -2298,7 +1783,7 @@ import {
2298
1783
  ...t.headers ? { headers: t.headers } : {},
2299
1784
  ...t.authHeaders ? { hasAuthHeaders: !0 } : {}
2300
1785
  };
2301
- }, Zi = (e) => {
1786
+ }, Nr = (e) => {
2302
1787
  let t = /* @__PURE__ */ new Map();
2303
1788
  for (let n of e) {
2304
1789
  if (n.proxyTarget === void 0) continue;
@@ -2306,43 +1791,43 @@ import {
2306
1791
  if (e) throw Error(`[voltro] api ${JSON.stringify(n.name)} and ${JSON.stringify(e)} both resolve the same-origin WS path ${JSON.stringify(n.browserWsUrl)}. A custom transport.wsPath must be unique per origin (one api per origin may use a fixed path). Give each a distinct wsPath, or drop the override to use the default /ws/<name>.`);
2307
1792
  t.set(n.browserWsUrl, n.name);
2308
1793
  }
2309
- }, Qi = async (e, t) => {
1794
+ }, Pr = async (e, t) => {
2310
1795
  let n = Object.entries(t.apis ?? {}), r = [];
2311
1796
  for (let [t, i] of n) {
2312
1797
  if (i.url) {
2313
- r.push(Yi(t, i));
1798
+ r.push(jr(t, i));
2314
1799
  continue;
2315
1800
  }
2316
- let n = await qi(e, i.package);
1801
+ let n = await kr(e, i.package);
2317
1802
  if (!n) throw Error(`[voltro dev] api ${JSON.stringify(t)} (package ${JSON.stringify(i.package)}) is not a workspace dep and has no \`url\` set in app.config.ts. External apis need an explicit \`url\` because the framework can't discover their dev port.`);
2318
- r.push(Xi(t, i, await Ji(n)));
1803
+ r.push(Mr(t, i, await Ar(n)));
2319
1804
  }
2320
- return Zi(r), r;
2321
- }, $i = (e) => {
1805
+ return Nr(r), r;
1806
+ }, Fr = (e) => {
2322
1807
  if (!(!/^wss?:\/\//.test(e) && !/^https?:\/\//.test(e))) try {
2323
1808
  let t = new URL(e);
2324
1809
  return t.protocol = t.protocol === "wss:" || t.protocol === "https:" ? "https:" : "http:", `${t.protocol}//${t.host}`;
2325
1810
  } catch {
2326
1811
  return;
2327
1812
  }
2328
- }, ea = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, ta = (e) => process.env[ea(e)] ?? process.env.VOLTRO_API_ORIGIN, na = (e, t) => {
1813
+ }, Ir = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, Lr = (e) => process.env[Ir(e)] ?? process.env.VOLTRO_API_ORIGIN, Rr = (e, t) => {
2329
1814
  if (!e) return;
2330
- let n = ta(e.name) ?? e.serverOrigin;
1815
+ let n = Lr(e.name) ?? e.serverOrigin;
2331
1816
  if (n) {
2332
- let e = $i(n);
1817
+ let e = Fr(n);
2333
1818
  if (e) return e;
2334
1819
  }
2335
1820
  if (t?.allowDevProxy && e.proxyTarget) {
2336
- let t = $i(e.proxyTarget);
1821
+ let t = Fr(e.proxyTarget);
2337
1822
  if (t) return t;
2338
1823
  }
2339
- if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return $i(e.browserWsUrl);
2340
- }, ra = (e, t, n) => {
1824
+ if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return Fr(e.browserWsUrl);
1825
+ }, zr = (e, t, n) => {
2341
1826
  if (!e) {
2342
1827
  if (n?.apiName === void 0) return;
2343
1828
  let e = n.apiName;
2344
1829
  return async () => {
2345
- throw Error(`[loader.query] api '${e}' has no server-side origin for SSR. In a split web/api deployment the web pod reaches the api by internal DNS, not the browser's relative wsPath — set ${ea(e)} (or VOLTRO_API_ORIGIN, or apis.${e}.serverUrl in app.config.ts) to the api's internal origin, e.g. http://api.<namespace>.svc.cluster.local. The browser transport is unaffected.`);
1830
+ throw Error(`[loader.query] api '${e}' has no server-side origin for SSR. In a split web/api deployment the web pod reaches the api by internal DNS, not the browser's relative wsPath — set ${Ir(e)} (or VOLTRO_API_ORIGIN, or apis.${e}.serverUrl in app.config.ts) to the api's internal origin, e.g. http://api.<namespace>.svc.cluster.local. The browser transport is unaffected.`);
2346
1831
  };
2347
1832
  }
2348
1833
  return async (r, i) => {
@@ -2364,12 +1849,24 @@ import {
2364
1849
  });
2365
1850
  } catch (t) {
2366
1851
  let i = t?.cause?.code ?? String(t?.message ?? t);
2367
- throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${ea(n.apiName)} / VOLTRO_API_ORIGIN` : "Set the api server origin"} to the api's SSR-reachable origin (internal cluster DNS in a split deployment).`, { cause: t });
1852
+ throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${Ir(n.apiName)} / VOLTRO_API_ORIGIN` : "Set the api server origin"} to the api's SSR-reachable origin (internal cluster DNS in a split deployment).`, { cause: t });
2368
1853
  }
2369
1854
  if (!o.ok) throw Error(`[loader.query] ${r}: HTTP ${o.status} ${await o.text()}`);
2370
1855
  let s = await o.json();
2371
1856
  if (!Array.isArray(s)) throw Error(`[loader.query] ${r}: unexpected non-array rpc response`);
2372
- let c = (e) => e && typeof e == "object" && "_tag" in e && "data" in e && e._tag === "snapshot" ? e.data : e, l, u = !1;
1857
+ let c = (e) => {
1858
+ if (!e || typeof e != "object" || !("_tag" in e)) return e;
1859
+ let t = e;
1860
+ switch (t._tag) {
1861
+ case "snapshot": return t.data;
1862
+ case "error": {
1863
+ let e = t.error;
1864
+ throw Object.assign(Error(`[loader.query] ${r}: ${e?._tag ?? "error"}${e?.message ? ` — ${e.message}` : ""}`, { cause: t.error }), { voltroError: t.error });
1865
+ }
1866
+ case "delta": throw Error(`[loader.query] ${r}: received a 'delta' as the first event, which should be impossible — a subscription always opens with a snapshot. This is a framework bug.`);
1867
+ default: return e;
1868
+ }
1869
+ }, l, u = !1;
2373
1870
  for (let e of s) {
2374
1871
  if (e._tag === "ClientProtocolError") throw Error(`[loader.query] ${r}: protocol error ${JSON.stringify(e.error)}`);
2375
1872
  if (!(e.requestId !== void 0 && String(e.requestId) !== "0")) {
@@ -2382,8 +1879,8 @@ import {
2382
1879
  }
2383
1880
  if (u) return l;
2384
1881
  };
2385
- }, ia = async (e, t, n, r = {}) => {
2386
- let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o = T(p(e, "node_modules", "@voltro", "devtools", "package.json")) || await Ei() !== null, s = t.theme === "system" ? [
1882
+ }, Br = async (e, t, n, r = {}) => {
1883
+ let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o = E(C(e, "node_modules", "@voltro", "devtools", "package.json")) || await cr() !== null, s = t.theme === "system" ? [
2387
1884
  " <script>",
2388
1885
  " (function () {",
2389
1886
  " var root = document.documentElement",
@@ -2421,13 +1918,13 @@ import {
2421
1918
  " </body>",
2422
1919
  "</html>",
2423
1920
  ""
2424
- ].join("\n"), l = p(e, "src", "pages"), { pages: u, dirs: d, orphanedSpecials: f } = await $(l);
2425
- await Dr(l, u);
1921
+ ].join("\n"), l = C(e, "src", "pages"), { pages: u, dirs: d, orphanedSpecials: f } = await $(l);
1922
+ await m(l, u);
2426
1923
  for (let e of f) Z.warn(`src/pages/${e.dir || "."}/ contains ${e.files.join(", ")} but no page.tsx at or below it — ${e.files.length > 1 ? "those files are" : "that file is"} inert. A layout/error/loading/not-found file only applies to routes in its own directory tree; if this is an ordinary component, rename it so it does not read as a route boundary.`);
2427
- let m = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppGroup`, h = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppDescriptors`, g = n.map((e) => `import { appGroup as ${m(e.name)}, appDescriptors as ${h(e.name)} } from '${e.pkg}/rpcGroup'`);
1924
+ let p = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppGroup`, h = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppDescriptors`, g = n.map((e) => `import { appGroup as ${p(e.name)}, appDescriptors as ${h(e.name)} } from '${e.pkg}/rpcGroup'`);
2428
1925
  n.some((e) => e.hasAuthHeaders) && (g.push("import __voltroAppConfig from '../app.config'"), g.push("const __voltroAuthHeaders = (__voltroAppConfig as { readonly apis?: Record<string, { readonly authHeaders?: () => Record<string, string> | Promise<Record<string, string>> }> }).apis"));
2429
1926
  let _ = n.map((e) => {
2430
- let t = [`group: ${m(e.name)}`];
1927
+ let t = [`group: ${p(e.name)}`];
2431
1928
  return t.push(`descriptors: ${h(e.name)}`), t.push(`wsUrl: ${JSON.stringify(e.browserWsUrl)}`), e.hasAuthHeaders ? t.push(`headers: __voltroAuthHeaders?.[${JSON.stringify(e.name)}]?.authHeaders`) : e.headers && t.push(`headers: ${JSON.stringify(e.headers)}`), ` ${JSON.stringify(e.name)}: { ${t.join(", ")} },`;
2432
1929
  }), v, y, b;
2433
1930
  if (u.length > 0) {
@@ -2437,18 +1934,18 @@ import {
2437
1934
  e.hasLayout && e.hasLayoutLoader ? r.push(`import * as ${Q(e.dir, "Layout")}Mod from '${t}/layout.tsx'`) : e.hasLayout && r.push(`import ${Q(e.dir, "Layout")} from '${t}/layout.tsx'`), e.hasError && r.push(`import ${Q(e.dir, "Error")} from '${t}/error.tsx'`), e.hasPending && r.push(`import ${Q(e.dir, "Pending")} from '${t}/loading.tsx'`), e.hasNotFound && r.push(`import ${Q(e.dir, "NotFound")} from '${t}/not-found.tsx'`);
2438
1935
  }
2439
1936
  let i = u.map((e) => {
2440
- let t = Bi(d, e.dirChain).map((e) => {
1937
+ let t = Sr(d, e.dirChain).map((e) => {
2441
1938
  let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
2442
1939
  return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasLayoutLoader && t.push(`loader: refs.layoutLoaders[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), e.hasPending && t.push(`Pending: refs.pendings[${n}]`), ` { ${t.join(", ")} }`;
2443
1940
  }).join(",\n");
2444
1941
  return ` makePageRoute(${JSON.stringify(e.pattern)}, ${t.length > 0 ? `[\n${t},\n ]` : "undefined"}),`;
2445
1942
  }), a = d.filter((e) => e.hasNotFound).map((e) => {
2446
- let t = Hi(e.chain), n = Bi(d, e.chain).map((e) => {
1943
+ let t = wr(e.chain), n = Sr(d, e.chain).map((e) => {
2447
1944
  let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
2448
1945
  return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), ` { ${t.join(", ")} }`;
2449
1946
  }).join(",\n"), r = n.length > 0 ? `\n chain: [\n${n},\n ],` : "";
2450
1947
  return ` {\n prefix: ${JSON.stringify(t)},\n Component: refs.notFounds[${JSON.stringify(e.dir)}],${r}\n },`;
2451
- }), s = [], c = [], l = [], f = [], m = [], h = [];
1948
+ }), s = [], c = [], l = [], f = [], p = [], m = [];
2452
1949
  for (let e of d) {
2453
1950
  let t = e.dir === "" ? "../src/pages/layout.tsx" : `../src/pages/${e.dir}/layout.tsx`, n = e.dir === "" ? "../src/pages/error.tsx" : `../src/pages/${e.dir}/error.tsx`, r = e.dir === "" ? "../src/pages/loading.tsx" : `../src/pages/${e.dir}/loading.tsx`, i = e.dir === "" ? "../src/pages/not-found.tsx" : `../src/pages/${e.dir}/not-found.tsx`, a = JSON.stringify(e.dir);
2454
1951
  e.hasLayout && e.hasLayoutLoader ? (c.push(` ${a}: ${Q(e.dir, "Layout")}Mod.default,`), l.push(` ${a}: ${Q(e.dir, "Layout")}Mod.loader,`), s.push({
@@ -2463,11 +1960,11 @@ import {
2463
1960
  relPath: n,
2464
1961
  kind: "error",
2465
1962
  slotKey: e.dir
2466
- })), e.hasPending && (m.push(` ${a}: ${Q(e.dir, "Pending")},`), s.push({
1963
+ })), e.hasPending && (p.push(` ${a}: ${Q(e.dir, "Pending")},`), s.push({
2467
1964
  relPath: r,
2468
1965
  kind: "pending",
2469
1966
  slotKey: e.dir
2470
- })), e.hasNotFound && (h.push(` ${a}: ${Q(e.dir, "NotFound")},`), s.push({
1967
+ })), e.hasNotFound && (m.push(` ${a}: ${Q(e.dir, "NotFound")},`), s.push({
2471
1968
  relPath: i,
2472
1969
  kind: "notFound",
2473
1970
  slotKey: e.dir
@@ -2478,16 +1975,16 @@ import {
2478
1975
  kind: "page",
2479
1976
  slotKey: e.pattern
2480
1977
  });
2481
- let x = s.map((e) => ` ${JSON.stringify(e.relPath)},`), S = s.map((e, t) => {
1978
+ let h = s.map((e) => ` ${JSON.stringify(e.relPath)},`), x = s.map((e, t) => {
2482
1979
  let n = JSON.stringify(e.slotKey);
2483
1980
  return e.kind === "page" ? ` if (newMods[${t}] && refs.pages[${n}] !== undefined) { refs.pages[${n}] = newMods[${t}]; changed = true }` : ` if (newMods[${t}]?.default) { refs.${e.kind === "layout" ? "layouts" : e.kind === "error" ? "errors" : e.kind === "pending" ? "pendings" : "notFounds"}[${n}] = newMods[${t}].default;${e.kind === "layout" ? ` refs.layoutLoaders[${n}] = newMods[${t}].loader;` : ""} changed = true }`;
2484
- }), C = t.locales ?? [], w = C.length > 0 && C.every((t) => T(p(e, "src", "locales", `${t}.ts`)) || T(p(e, "src", "locales", `${t}.tsx`))), E = w, D = t.defaultLocale ?? C[0] ?? "en";
2485
- if (C.length > 0 && !w && Z.info(`i18n: locales [${C.join(", ")}] declared with no src/locales/<code>.ts — using them for <html lang> and the resolved locale only. Add the catalogs to get <I18nProvider> wired, or keep your own i18n stack.`), C.length > 0 && !C.includes(D)) throw Error(`[voltro dev] app.config.ts: defaultLocale '${D}' must be one of locales [${C.join(", ")}]`);
2486
- let O = E ? [
1981
+ }), S = t.locales ?? [], w = S.length > 0 && S.every((t) => E(C(e, "src", "locales", `${t}.ts`)) || E(C(e, "src", "locales", `${t}.tsx`))), T = w, D = t.defaultLocale ?? S[0] ?? "en";
1982
+ if (S.length > 0 && !w && Z.info(`i18n: locales [${S.join(", ")}] declared with no src/locales/<code>.ts — using them for <html lang> and the resolved locale only. Add the catalogs to get <I18nProvider> wired, or keep your own i18n stack.`), S.length > 0 && !S.includes(D)) throw Error(`[voltro dev] app.config.ts: defaultLocale '${D}' must be one of locales [${S.join(", ")}]`);
1983
+ let O = T ? [
2487
1984
  "import { I18nProvider } from '@voltro/i18n'",
2488
1985
  "import { resolveLocale } from '@voltro/i18n/server'",
2489
1986
  "import { useServerRequest } from '@voltro/web'",
2490
- ...C.map((e) => `import i18nCatalog_${e} from '../src/locales/${e}'`)
1987
+ ...S.map((e) => `import i18nCatalog_${e} from '../src/locales/${e}'`)
2491
1988
  ] : [];
2492
1989
  y = [
2493
1990
  "// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
@@ -2532,10 +2029,10 @@ import {
2532
2029
  ...f,
2533
2030
  " },",
2534
2031
  " pendings: {",
2535
- ...m,
2032
+ ...p,
2536
2033
  " },",
2537
2034
  " notFounds: {",
2538
- ...h,
2035
+ ...m,
2539
2036
  " },",
2540
2037
  " pages: {},",
2541
2038
  "}",
@@ -2600,11 +2097,11 @@ import {
2600
2097
  "if (import.meta.hot) {",
2601
2098
  " import.meta.hot.accept(",
2602
2099
  " [",
2603
- ...x,
2100
+ ...h,
2604
2101
  " ],",
2605
2102
  " (newMods: Array<Record<string, unknown> | undefined>) => {",
2606
2103
  " let changed = false",
2607
- ...S,
2104
+ ...x,
2608
2105
  " if (changed) bump()",
2609
2106
  " },",
2610
2107
  " )",
@@ -2624,12 +2121,12 @@ import {
2624
2121
  ...O,
2625
2122
  "import { subscribe, getVersion, buildRoutes, buildNotFounds } from './routeTable'",
2626
2123
  "",
2627
- ...E ? [
2628
- `// i18n auto-wiring (config.locales = [${C.map((e) => JSON.stringify(e)).join(", ")}]).`,
2124
+ ...T ? [
2125
+ `// i18n auto-wiring (config.locales = [${S.map((e) => JSON.stringify(e)).join(", ")}]).`,
2629
2126
  "const I18N_CATALOGS: Record<string, import('@voltro/i18n').MessageCatalog> = {",
2630
- ...C.map((e) => ` ${JSON.stringify(e)}: i18nCatalog_${e},`),
2127
+ ...S.map((e) => ` ${JSON.stringify(e)}: i18nCatalog_${e},`),
2631
2128
  "}",
2632
- `const I18N_SUPPORTED: ReadonlyArray<string> = [${C.map((e) => JSON.stringify(e)).join(", ")}]`,
2129
+ `const I18N_SUPPORTED: ReadonlyArray<string> = [${S.map((e) => JSON.stringify(e)).join(", ")}]`,
2633
2130
  `const I18N_DEFAULT = ${JSON.stringify(D)}`,
2634
2131
  "",
2635
2132
  "const pickI18nLocale = (ssr: ReturnType<typeof useServerRequest>): string => {",
@@ -2681,7 +2178,7 @@ import {
2681
2178
  " const v = useSyncExternalStore(subscribe, getVersion, getVersion)",
2682
2179
  " const routes = useMemo(() => buildRoutes(), [v])",
2683
2180
  " const notFounds = useMemo(() => buildNotFounds(), [v])",
2684
- ...E ? [
2181
+ ...T ? [
2685
2182
  " const ssr = useServerRequest()",
2686
2183
  " const locale = pickI18nLocale(ssr)",
2687
2184
  " const messages = I18N_CATALOGS[locale] ?? I18N_CATALOGS[I18N_DEFAULT]!",
@@ -2699,14 +2196,14 @@ import {
2699
2196
  "// resolved apis map. Side-effect only — no local component definitions —",
2700
2197
  "// so downstream invalidations (user page edits) terminate at app.tsx.",
2701
2198
  "",
2702
- ...ji(t),
2199
+ ...pr(t),
2703
2200
  "import { mount } from '@voltro/web'",
2704
2201
  ...g,
2705
2202
  "import { App } from './app'",
2706
2203
  "import { preloadCurrentRoute } from './routeTable'",
2707
- ...ki(t),
2708
- ...Di(t, o),
2709
- ...Ai(t),
2204
+ ...dr(t),
2205
+ ...lr(t, o),
2206
+ ...fr(t),
2710
2207
  "",
2711
2208
  "// Preload the current route's page chunk BEFORE hydration so the first",
2712
2209
  "// client render matches the SSG/SSR-prerendered HTML. Without it, a lazy",
@@ -2723,10 +2220,10 @@ import {
2723
2220
  " apis: {",
2724
2221
  ..._,
2725
2222
  " },",
2726
- ...Oi(t, o),
2223
+ ...ur(t, o),
2727
2224
  "})",
2728
2225
  "",
2729
- Ui
2226
+ Tr
2730
2227
  ].join("\n");
2731
2228
  } else v = "", y = "", b = [
2732
2229
  "// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
@@ -2734,43 +2231,43 @@ import {
2734
2231
  "// and calls mount(). Side-effect only, no component definitions, so the",
2735
2232
  "// user's component file remains the Fast Refresh boundary.",
2736
2233
  "",
2737
- ...ji(t),
2234
+ ...pr(t),
2738
2235
  "import { mount } from '@voltro/web'",
2739
2236
  ...g,
2740
2237
  "import App from '../src/App'",
2741
- ...ki(t),
2742
- ...Di(t, o),
2743
- ...Ai(t),
2238
+ ...dr(t),
2239
+ ...lr(t, o),
2240
+ ...fr(t),
2744
2241
  "",
2745
2242
  "mount(App, {",
2746
2243
  " apis: {",
2747
2244
  ..._,
2748
2245
  " },",
2749
- ...Oi(t, o),
2246
+ ...ur(t, o),
2750
2247
  "})",
2751
2248
  "",
2752
- Ui
2249
+ Tr
2753
2250
  ].join("\n");
2754
- let x = p(e, ".framework");
2755
- await O.mkdir(x, { recursive: !0 }), t.env ? await at(x, r) : await O.rm(p(x, "env.public.ts"), { force: !0 }), await O.writeFile(p(x, "index.html"), c, "utf8"), await O.writeFile(p(x, "main.tsx"), b, "utf8"), v ? (await O.writeFile(p(x, "app.tsx"), v, "utf8"), await O.writeFile(p(x, "routeTable.ts"), y, "utf8")) : (await O.rm(p(x, "app.tsx"), { force: !0 }), await O.rm(p(x, "routeTable.ts"), { force: !0 }));
2756
- let S = p(e, ".gitignore"), C = "";
2251
+ let x = C(e, ".framework");
2252
+ await D.mkdir(x, { recursive: !0 }), t.env ? await J(x, r) : await D.rm(C(x, "env.public.ts"), { force: !0 }), await D.writeFile(C(x, "index.html"), c, "utf8"), await D.writeFile(C(x, "main.tsx"), b, "utf8"), v ? (await D.writeFile(C(x, "app.tsx"), v, "utf8"), await D.writeFile(C(x, "routeTable.ts"), y, "utf8")) : (await D.rm(C(x, "app.tsx"), { force: !0 }), await D.rm(C(x, "routeTable.ts"), { force: !0 }));
2253
+ let S = C(e, ".gitignore"), w = "";
2757
2254
  try {
2758
- C = await O.readFile(S, "utf8");
2255
+ w = await D.readFile(S, "utf8");
2759
2256
  } catch {}
2760
- let w = ["/.framework/"], E = new Set(C.split("\n").map((e) => e.trim())), D = w.filter((e) => !E.has(e));
2761
- if (D.length > 0) {
2762
- let e = C === "" || C.endsWith("\n") ? "" : "\n";
2257
+ let T = ["/.framework/"], O = new Set(w.split("\n").map((e) => e.trim())), k = T.filter((e) => !O.has(e));
2258
+ if (k.length > 0) {
2259
+ let e = w === "" || w.endsWith("\n") ? "" : "\n";
2763
2260
  try {
2764
- await O.appendFile(S, `${e}${D.join("\n")}\n`, "utf8");
2261
+ await D.appendFile(S, `${e}${k.join("\n")}\n`, "utf8");
2765
2262
  } catch (e) {
2766
- Z.warn(`could not add ${D.join(", ")} to ${S} — add it by hand so the generated directory stays out of git. The build is unaffected.`, { reason: e?.message ?? String(e) });
2263
+ Z.warn(`could not add ${k.join(", ")} to ${S} — add it by hand so the generated directory stays out of git. The build is unaffected.`, { reason: e?.message ?? String(e) });
2767
2264
  }
2768
2265
  }
2769
- }, aa = async (e, t) => {
2266
+ }, Vr = async (e, t) => {
2770
2267
  try {
2771
- let n = p(d(e), "project.json");
2772
- if (!T(n)) return;
2773
- let r = await O.readFile(n, "utf8"), i = JSON.parse(r).apps ?? {}, a = e.split("/").filter(Boolean).pop() ?? "", o = [];
2268
+ let n = C(S(e), "project.json");
2269
+ if (!E(n)) return;
2270
+ let r = await D.readFile(n, "utf8"), i = JSON.parse(r).apps ?? {}, a = e.split("/").filter(Boolean).pop() ?? "", o = [];
2774
2271
  for (let [e, n] of Object.entries(i)) e !== a && n.port === t && o.push(e);
2775
2272
  if (o.length === 0) return;
2776
2273
  Z.warn("sibling app(s) claim the same port — only one boots", {
@@ -2779,72 +2276,79 @@ import {
2779
2276
  projectJson: n
2780
2277
  });
2781
2278
  } catch {}
2782
- }, oa = (e) => p(e, ".framework", "dist", "server", "appConfig.js"), sa = async (e, t = {}) => {
2783
- let n = oa(e), r = t.preferSource !== !0 && T(n) ? n : p(e, "app.config.ts");
2279
+ }, Hr = (e) => C(e, ".framework", "dist", "server", "appConfig.js"), Ur = async (e, t = {}) => {
2280
+ let n = Hr(e), r = t.preferSource !== !0 && E(n) ? n : C(e, "app.config.ts");
2784
2281
  try {
2785
- let e = (await import(_(r).href)).default;
2282
+ let e = (await import(P(r).href)).default;
2786
2283
  return typeof e == "object" && e && "type" in e && e.type === "web" ? e : null;
2787
2284
  } catch {
2788
2285
  return null;
2789
2286
  }
2790
- }, ca = async (e) => {
2791
- let t = await sa(e, { preferSource: !0 });
2792
- if (!t) return {
2287
+ }, Wr = async (e) => {
2288
+ let r = await Ur(e, { preferSource: !0 });
2289
+ if (!r) return {
2793
2290
  ran: !1,
2794
2291
  exitCode: 0
2795
2292
  };
2796
- er();
2797
- let n = hn();
2798
- Nn(n), Z.info("booting voltro dev (web)", { app: t.name ?? "(unnamed)" }), Rt(e, Z);
2799
- let r = await Qi(e, t);
2800
- for (let e of r) Z.info("api wired", {
2293
+ on();
2294
+ let i = bt();
2295
+ Rt(i), Z.info("booting voltro dev (web)", { app: r.name ?? "(unnamed)" }), He(e, Z);
2296
+ let m = await Pr(e, r);
2297
+ for (let e of m) Z.info("api wired", {
2801
2298
  name: e.name,
2802
2299
  pkg: e.pkg,
2803
2300
  ...e.proxyTarget ? { proxyTo: e.proxyTarget } : { directWs: e.browserWsUrl }
2804
2301
  });
2805
- Fe(e).then((e) => {
2302
+ d(e).then((e) => {
2806
2303
  for (let t of e.files) if (t.action === "created") {
2807
2304
  let e = t.path.split("/").pop() ?? t.path;
2808
2305
  Z.info(`${e} seeded`, { path: t.path });
2809
2306
  }
2810
2307
  }).catch(() => {});
2811
- let { resolved: d } = await ot({
2812
- rawEnv: t.env,
2308
+ let { resolved: h } = await _e({
2309
+ rawEnv: r.env,
2813
2310
  appType: "web",
2814
2311
  root: e,
2815
2312
  log: Z,
2816
2313
  generateTypes: !0
2817
- }), f = d.publicValues;
2818
- await ia(e, t, r, f), Z.debug("generated framework entry files", { files: [
2314
+ }), S = h.publicValues;
2315
+ await Br(e, r, m, S), Z.debug("generated framework entry files", { files: [
2819
2316
  "index.html",
2820
2317
  ".framework/main.tsx",
2821
- ...t.env ? [".framework/env.public.ts"] : []
2318
+ ...r.env ? [".framework/env.public.ts"] : []
2822
2319
  ] });
2823
- let g = process.env.VOLTRO_IS_DASHBOARD === "1" && process.env.VOLTRO_DASHBOARD_PORT ? Number(process.env.VOLTRO_DASHBOARD_PORT) : t.port ?? 5173, _ = t.name ?? "unnamed", v = Ye("web", _, g), y = Pr(_);
2824
- await qe({
2825
- id: v,
2826
- name: _,
2320
+ let O = n({
2321
+ kind: "web",
2322
+ configPort: r.port,
2323
+ env: process.env,
2324
+ dashboardPin: process.env[Sn] === "1"
2325
+ });
2326
+ for (let e of O.warnings) Z.warn(e);
2327
+ let k = O.port, A = r.name ?? "unnamed", j = y("web", A, k), M = b(A);
2328
+ await g({
2329
+ id: j,
2330
+ name: A,
2827
2331
  kind: "web",
2828
- url: `http://localhost:${g}`,
2332
+ url: `http://localhost:${k}`,
2829
2333
  pid: process.pid,
2830
2334
  status: "booting",
2831
- logFile: y.path
2832
- }).catch(() => {}), await aa(e, g);
2833
- let { pages: b, dirs: x } = await $(p(e, "src", "pages")), S = {
2834
- dirs: x,
2835
- ssrRoutes: Gi(b)
2836
- }, w = x.map((e) => ({
2335
+ logFile: M.path
2336
+ }).catch(() => {}), await Vr(e, k);
2337
+ let { pages: N, dirs: P } = await $(C(e, "src", "pages")), F = {
2338
+ dirs: P,
2339
+ ssrRoutes: Dr(N)
2340
+ }, I = P.map((e) => ({
2837
2341
  dir: e.dir,
2838
2342
  hasLayout: e.hasLayout,
2839
2343
  hasError: e.hasError,
2840
2344
  hasPending: e.hasPending,
2841
2345
  hasNotFound: e.hasNotFound
2842
- })), E = await sn({
2346
+ })), R = await ft({
2843
2347
  appRoot: e,
2844
- pages: b
2348
+ pages: N
2845
2349
  });
2846
- E.wrote && Z.debug("routes codegen wrote", { path: m(e, E.path) });
2847
- let D = await $e("vite", () => import("vite")), k = (await import("@vitejs/plugin-react")).default, A = (await import("@tailwindcss/vite")).default, j = p(e, ".framework"), M = p(e, "src"), N = /* @__PURE__ */ new Set([
2350
+ R.wrote && Z.debug("routes codegen wrote", { path: w(e, R.path) });
2351
+ let ee = await fe("vite", () => import("vite")), z = (await import("@vitejs/plugin-react")).default, B = (await import("@tailwindcss/vite")).default, V = C(e, ".framework"), te = C(e, "src"), H = /* @__PURE__ */ new Set([
2848
2352
  ".framework",
2849
2353
  "node_modules",
2850
2354
  "dist",
@@ -2852,120 +2356,107 @@ import {
2852
2356
  ".vite",
2853
2357
  ".turbo",
2854
2358
  ".cache"
2855
- ]), ee = {
2359
+ ]), ne = {
2856
2360
  name: "framework:watch-app-sources",
2857
2361
  async configureServer(t) {
2858
2362
  try {
2859
- let n = (await O.readdir(e, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !N.has(e.name));
2860
- for (let r of n) t.watcher.add(p(e, r.name));
2861
- n.length === 0 && t.watcher.add(M);
2363
+ let n = (await D.readdir(e, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !H.has(e.name));
2364
+ for (let r of n) t.watcher.add(C(e, r.name));
2365
+ n.length === 0 && t.watcher.add(te);
2862
2366
  } catch {
2863
- t.watcher.add(M);
2367
+ t.watcher.add(te);
2864
2368
  }
2865
- try {
2866
- let n = await O.readFile(p(e, "package.json"), "utf8"), r = JSON.parse(n), i = Object.keys({
2867
- ...r.dependencies,
2868
- ...r.devDependencies
2869
- });
2870
- await Promise.all(i.map(async (n) => {
2871
- let r = await qi(e, n);
2872
- if (!r) return;
2873
- let i = p(r, "src");
2874
- try {
2875
- (await O.stat(i)).isDirectory() && t.watcher.add(i);
2876
- } catch {}
2877
- }));
2878
- } catch {}
2369
+ for (let n of await Se(e)) t.watcher.add(n.dir);
2879
2370
  }
2880
- }, P = p(e, "src", "pages"), F = (e) => e.endsWith(".tsx") && (e === P || e.startsWith(P + "/")), I = (e) => e === P || e.startsWith(P + "/"), te = async (n) => {
2371
+ }, U = C(e, "src", "pages"), W = (e) => e.endsWith(".tsx") && (e === U || e.startsWith(U + "/")), ie = (e) => e === U || e.startsWith(U + "/"), ae = async (t) => {
2881
2372
  try {
2882
- let i = Date.now();
2883
- await ia(e, t, r, f);
2884
- let { pages: a, dirs: o } = await $(P);
2885
- await sn({
2373
+ let n = Date.now();
2374
+ await Br(e, r, m, S);
2375
+ let { pages: i, dirs: a } = await $(U);
2376
+ await ft({
2886
2377
  appRoot: e,
2887
- pages: a
2888
- }), S.dirs = o, S.ssrRoutes = Gi(a), Z.info("page tree regenerated", {
2889
- reason: n,
2890
- ms: Date.now() - i,
2891
- routes: S.ssrRoutes.length
2378
+ pages: i
2379
+ }), F.dirs = a, F.ssrRoutes = Dr(i), Z.info("page tree regenerated", {
2380
+ reason: t,
2381
+ ms: Date.now() - n,
2382
+ routes: F.ssrRoutes.length
2892
2383
  });
2893
2384
  } catch (e) {
2894
- Z.error("page tree regen failed", { reason: n }, e);
2385
+ Z.error("page tree regen failed", { reason: t }, e);
2895
2386
  }
2896
- }, L = {
2387
+ }, oe = {
2897
2388
  name: "framework:regenerate-on-page-tree-change",
2898
2389
  configureServer(t) {
2899
2390
  let n = null, r = [], i = (e) => {
2900
2391
  r.push(e), n && clearTimeout(n), n = setTimeout(() => {
2901
2392
  n = null;
2902
2393
  let e = r.length === 1 ? r[0] : `${r.length} events (${r[0]}, …)`;
2903
- r.length = 0, te(e);
2394
+ r.length = 0, ae(e);
2904
2395
  }, 50);
2905
2396
  };
2906
2397
  t.watcher.on("add", (t) => {
2907
- F(t) && i(`add ${m(e, t)}`);
2398
+ W(t) && i(`add ${w(e, t)}`);
2908
2399
  }), t.watcher.on("unlink", (t) => {
2909
- F(t) && i(`unlink ${m(e, t)}`);
2400
+ W(t) && i(`unlink ${w(e, t)}`);
2910
2401
  }), t.watcher.on("addDir", (t) => {
2911
- I(t) && i(`addDir ${m(e, t)}`);
2402
+ ie(t) && i(`addDir ${w(e, t)}`);
2912
2403
  }), t.watcher.on("unlinkDir", (t) => {
2913
- I(t) && i(`unlinkDir ${m(e, t)}`);
2404
+ ie(t) && i(`unlinkDir ${w(e, t)}`);
2914
2405
  });
2915
2406
  }
2916
- }, R = p(e, "app.config.ts"), ne = (e) => {
2917
- if (!ae(e.env)) return "";
2407
+ }, G = C(e, "app.config.ts"), K = (e) => {
2408
+ if (!re(e.env)) return "";
2918
2409
  let t = Object.entries(e.env.vars).map(([e, t]) => `${e}:${t.access}`).sort();
2919
2410
  return `${String(e.env.publicPrefix)}|${t.join(",")}`;
2920
- }, re = (e, t) => {
2411
+ }, le = (e, t) => {
2921
2412
  let n = [];
2922
- return e.port !== t.port && n.push(`port ${e.port ?? "(default)"} → ${t.port ?? "(default)"}`), JSON.stringify(e.proxies) !== JSON.stringify(t.proxies) && n.push("proxies"), JSON.stringify(e.allowedHosts) !== JSON.stringify(t.allowedHosts) && n.push("allowedHosts"), JSON.stringify(e.apis) !== JSON.stringify(t.apis) && n.push("apis"), ne(e) !== ne(t) && n.push("env"), n;
2923
- }, z = t, ie = h(R), B = {
2413
+ return e.port !== t.port && n.push(`port ${e.port ?? "(default)"} → ${t.port ?? "(default)"}`), JSON.stringify(e.proxies) !== JSON.stringify(t.proxies) && n.push("proxies"), JSON.stringify(e.allowedHosts) !== JSON.stringify(t.allowedHosts) && n.push("allowedHosts"), JSON.stringify(e.apis) !== JSON.stringify(t.apis) && n.push("apis"), K(e) !== K(t) && n.push("env"), n;
2414
+ }, ue = r, de = T(G), pe = {
2924
2415
  name: "framework:watch-app-config",
2925
- async configureServer(t) {
2926
- t.watcher.add(R), Z.info("watching app.config.ts for changes", { path: m(e, R) });
2927
- let n = async () => {
2416
+ async configureServer(n) {
2417
+ n.watcher.add(G), Z.info("watching app.config.ts for changes", { path: w(e, G) });
2418
+ let r = async () => {
2928
2419
  try {
2929
2420
  try {
2930
- let e = t.moduleGraph.getModuleById(R);
2931
- e && t.moduleGraph.invalidateModule(e);
2421
+ let e = n.moduleGraph.getModuleById(G);
2422
+ e && n.moduleGraph.invalidateModule(e);
2932
2423
  } catch {}
2933
- let e = (await t.ssrLoadModule(R, { fixStacktrace: !0 })).default;
2424
+ let e = (await n.ssrLoadModule(G, { fixStacktrace: !0 })).default;
2934
2425
  return typeof e == "object" && e && "type" in e && e.type === "web" ? e : (Z.warn("app.config.ts re-load returned wrong shape", { hasDefault: e !== void 0 }), null);
2935
2426
  } catch (e) {
2936
2427
  return Z.warn("app.config.ts re-load failed — ignoring this change", {}, e), null;
2937
2428
  }
2938
- }, r = null, i = () => {
2939
- r && clearTimeout(r), r = setTimeout(() => {
2940
- r = null, a();
2429
+ }, i = null, a = () => {
2430
+ i && clearTimeout(i), i = setTimeout(() => {
2431
+ i = null, o();
2941
2432
  }, 100);
2942
- }, a = async () => {
2943
- let r = await n();
2944
- if (!r) {
2433
+ }, o = async () => {
2434
+ let t = await r();
2435
+ if (!t) {
2945
2436
  Z.info("app.config.ts onConfigChange: load returned null — skipping");
2946
2437
  return;
2947
2438
  }
2948
2439
  if (Z.info("app.config.ts onConfigChange: loaded", {
2949
- theme: r.theme,
2950
- port: r.port,
2951
- name: r.name
2952
- }), JSON.stringify(r) === JSON.stringify(z)) {
2440
+ theme: t.theme,
2441
+ port: t.port,
2442
+ name: t.name
2443
+ }), JSON.stringify(t) === JSON.stringify(ue)) {
2953
2444
  Z.info("app.config.ts onConfigChange: parsed config unchanged — skipping (no-op edit?)");
2954
2445
  return;
2955
2446
  }
2956
- let i = re(z, r);
2447
+ let i = le(ue, t);
2957
2448
  if (i.length > 0) {
2958
2449
  Z.warn("app.config.ts changed — hard restart required", { fields: i });
2959
2450
  try {
2960
- await t.close();
2451
+ await n.close();
2961
2452
  } catch {}
2962
- let e = fe(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
2453
+ let e = ce(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
2963
2454
  stdio: "inherit",
2964
2455
  env: process.env,
2965
2456
  cwd: process.cwd()
2966
- }), n = (t) => {
2457
+ }), t = (t) => {
2967
2458
  e.kill(t);
2968
- }, r = () => n("SIGINT"), a = () => n("SIGTERM");
2459
+ }, r = () => t("SIGINT"), a = () => t("SIGTERM");
2969
2460
  process.on("SIGINT", r), process.on("SIGTERM", a), e.on("exit", (e, t) => {
2970
2461
  process.off("SIGINT", r), process.off("SIGTERM", a), t ? process.kill(process.pid, t) : process.exit(e ?? 0);
2971
2462
  }), e.on("error", (e) => {
@@ -2974,52 +2465,52 @@ import {
2974
2465
  return;
2975
2466
  }
2976
2467
  try {
2977
- let n = Date.now();
2978
- await ia(e, r, await Qi(e, r)), z = r, t.ws && t.ws.send({
2468
+ let r = Date.now();
2469
+ await Br(e, t, await Pr(e, t)), ue = t, n.ws && n.ws.send({
2979
2470
  type: "full-reload",
2980
2471
  path: "*"
2981
2472
  }), Z.info("app.config.ts soft-regen", {
2982
- ms: Date.now() - n,
2473
+ ms: Date.now() - r,
2983
2474
  reload: "full"
2984
2475
  });
2985
2476
  } catch (e) {
2986
2477
  Z.error("app.config.ts soft-regen failed", {}, e);
2987
2478
  }
2988
- }, o = (e) => u(e) === "app.config.ts" ? e === R || h(e) === ie : !1;
2989
- t.watcher.on("change", (e) => {
2990
- o(e) && (Z.info("app.config.ts change event (chokidar)", { file: e }), i());
2991
- }), t.watcher.on("add", (e) => {
2992
- o(e) && (Z.info("app.config.ts add event (chokidar)", { file: e }), i());
2479
+ }, s = (e) => x(e) === "app.config.ts" ? e === G || T(e) === de : !1;
2480
+ n.watcher.on("change", (e) => {
2481
+ s(e) && (Z.info("app.config.ts change event (chokidar)", { file: e }), a());
2482
+ }), n.watcher.on("add", (e) => {
2483
+ s(e) && (Z.info("app.config.ts add event (chokidar)", { file: e }), a());
2993
2484
  });
2994
2485
  try {
2995
2486
  let { watchFile: e } = await import("node:fs");
2996
- e(R, { interval: 500 }, (e, t) => {
2997
- e.mtimeMs !== t.mtimeMs && (Z.info("app.config.ts change event (poll)", { mtime: e.mtimeMs }), i());
2487
+ e(G, { interval: 500 }, (e, t) => {
2488
+ e.mtimeMs !== t.mtimeMs && (Z.info("app.config.ts change event (poll)", { mtime: e.mtimeMs }), a());
2998
2489
  }), Z.info("app.config.ts polling watcher attached", { intervalMs: 500 });
2999
2490
  } catch (e) {
3000
2491
  Z.warn("app.config.ts polling watcher could not attach", {}, e);
3001
2492
  }
3002
- yt(gt, Z, {
2493
+ we(t, Z, {
3003
2494
  root: e,
3004
- onBeforeRestart: () => t.close()
2495
+ onBeforeRestart: () => n.close()
3005
2496
  });
3006
2497
  }
3007
- }, V = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, oe = 0, se = {
2498
+ }, me = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, q = 0, he = {
3008
2499
  name: "framework:suppress-api-hmr",
3009
2500
  handleHotUpdate(e) {
3010
- if (oe += 1, V.test(e.file)) return [];
2501
+ if (q += 1, me.test(e.file)) return [];
3011
2502
  }
3012
- }, ce = {
2503
+ }, ge = {
3013
2504
  name: "framework:reoptimize-on-rpcgroup-change",
3014
2505
  async configureServer(t) {
3015
2506
  let n = /* @__PURE__ */ new Map();
3016
- for (let i of r) {
3017
- if (!i.proxyTarget) continue;
3018
- let r = await qi(e, i.pkg);
3019
- if (!r) continue;
3020
- let a = p(r, "rpcGroup.generated.ts");
2507
+ for (let r of m) {
2508
+ if (!r.proxyTarget) continue;
2509
+ let i = await kr(e, r.pkg);
2510
+ if (!i) continue;
2511
+ let a = C(i, "rpcGroup.generated.ts");
3021
2512
  try {
3022
- n.set(a, await O.readFile(a, "utf8"));
2513
+ n.set(a, await D.readFile(a, "utf8"));
3023
2514
  } catch {
3024
2515
  n.set(a, "");
3025
2516
  }
@@ -3028,94 +2519,94 @@ import {
3028
2519
  } catch {}
3029
2520
  }
3030
2521
  if (n.size === 0) return;
3031
- let i = null, a = !1, o = async () => {
3032
- if (a) return;
2522
+ let r = null, i = !1, a = async () => {
2523
+ if (i) return;
3033
2524
  let r = null;
3034
2525
  for (let [e, t] of n) {
3035
2526
  let i;
3036
2527
  try {
3037
- i = await O.readFile(e, "utf8");
2528
+ i = await D.readFile(e, "utf8");
3038
2529
  } catch {
3039
2530
  continue;
3040
2531
  }
3041
2532
  i !== t && (n.set(e, i), r = e);
3042
2533
  }
3043
2534
  if (r !== null) {
3044
- a = !0, Z.info(`rpcGroup changed (${m(e, r)}) — re-bundling the api client + reloading (descriptor edits propagate automatically; no manual restart needed)`);
2535
+ i = !0, Z.info(`rpcGroup changed (${w(e, r)}) — re-bundling the api client + reloading (descriptor edits propagate automatically; no manual restart needed)`);
3045
2536
  try {
3046
- await O.rm(p(j, ".vite", "deps"), {
2537
+ await D.rm(C(V, ".vite", "deps"), {
3047
2538
  recursive: !0,
3048
2539
  force: !0
3049
2540
  }), await t.restart(!0);
3050
2541
  } catch (e) {
3051
- a = !1, Z.error("rpcGroup re-optimize failed", {}, e);
2542
+ i = !1, Z.error("rpcGroup re-optimize failed", {}, e);
3052
2543
  }
3053
2544
  }
3054
- }, s = (e) => {
3055
- n.has(h(e)) && (i && clearTimeout(i), i = setTimeout(() => {
3056
- o();
2545
+ }, o = (e) => {
2546
+ n.has(T(e)) && (r && clearTimeout(r), r = setTimeout(() => {
2547
+ a();
3057
2548
  }, 120));
3058
2549
  };
3059
- t.watcher.on("change", s), t.watcher.on("add", s);
2550
+ t.watcher.on("change", o), t.watcher.on("add", o);
3060
2551
  }
3061
- }, H = {}, le = (e) => (t) => {
2552
+ }, J = {}, ve = (e) => (t) => {
3062
2553
  t.on("proxyReq", (t, n) => {
3063
- Qn(t, n, {
2554
+ rn(t, n, {
3064
2555
  target: e,
3065
2556
  token: process.env.VOLTRO_INSPECT_TOKEN,
3066
2557
  writeToken: process.env.VOLTRO_INSPECT_WRITE_TOKEN,
3067
- isLoopback: i
2558
+ isLoopback: l
3068
2559
  });
3069
2560
  });
3070
2561
  };
3071
- for (let e of r) {
2562
+ for (let e of m) {
3072
2563
  if (!e.proxyTarget) continue;
3073
- H[e.browserWsUrl] = {
2564
+ J[e.browserWsUrl] = {
3074
2565
  target: e.proxyTarget,
3075
2566
  ws: !0,
3076
2567
  changeOrigin: !0,
3077
2568
  ...e.wsPath ? {} : { rewrite: () => "/ws" }
3078
2569
  };
3079
2570
  let t = e.proxyTarget.replace(/^ws/, "http");
3080
- H[`/_voltro/api/${e.name}`] = {
2571
+ J[`/_voltro/api/${e.name}`] = {
3081
2572
  target: t,
3082
2573
  changeOrigin: !0,
3083
2574
  rewrite: (t) => t.replace(RegExp(`^/_voltro/api/${e.name}`), ""),
3084
- configure: le(t)
2575
+ configure: ve(t)
3085
2576
  };
3086
2577
  }
3087
- for (let [e, n] of Object.entries(t.proxies ?? {})) {
3088
- if (H[e]) {
2578
+ for (let [e, t] of Object.entries(r.proxies ?? {})) {
2579
+ if (J[e]) {
3089
2580
  Z.warn("user proxy ignored — prefix already claimed by an api ws proxy", { prefix: e });
3090
2581
  continue;
3091
2582
  }
3092
- H[e] = {
3093
- target: n.target,
3094
- changeOrigin: n.changeOrigin ?? !0,
3095
- ...n.rewrite === void 0 ? {} : { rewrite: (t) => t.replace(RegExp(`^${e}`), n.rewrite) }
3096
- }, Z.info(`proxy ${e} → ${n.target}`, {
2583
+ J[e] = {
2584
+ target: t.target,
2585
+ changeOrigin: t.changeOrigin ?? !0,
2586
+ ...t.rewrite === void 0 ? {} : { rewrite: (n) => n.replace(RegExp(`^${e}`), t.rewrite) }
2587
+ }, Z.info(`proxy ${e} → ${t.target}`, {
3097
2588
  prefix: e,
3098
- target: n.target,
3099
- ...n.rewrite === void 0 ? {} : { rewrite: n.rewrite }
2589
+ target: t.target,
2590
+ ...t.rewrite === void 0 ? {} : { rewrite: t.rewrite }
3100
2591
  });
3101
2592
  }
3102
- let ue = {
2593
+ let be = {
3103
2594
  name: "framework:inspect",
3104
- configureServer(r) {
3105
- let u = null, d = async () => {
3106
- if (u !== null) return u;
3107
- let t = [];
3108
- for (let n of b) try {
3109
- let i = await r.ssrLoadModule(p(e, "src", "pages", n.file));
3110
- t.push({
2595
+ configureServer(t) {
2596
+ let n = null, d = async () => {
2597
+ if (n !== null) return n;
2598
+ let r = [];
2599
+ for (let n of N) try {
2600
+ let i = await t.ssrLoadModule(C(e, "src", "pages", n.file));
2601
+ r.push({
3111
2602
  pattern: n.pattern,
3112
2603
  file: n.file,
3113
2604
  dirChain: n.dirChain,
3114
- renderMode: yr(i, p("src", "pages", n.file)),
2605
+ renderMode: f(i, C("src", "pages", n.file)),
3115
2606
  interactive: i.interactive ?? "full",
3116
2607
  tenantAware: i.tenantAware === !0,
3117
- revalidateMs: J(i.revalidate),
3118
- staleWhileRevalidateMs: J(i.staleWhileRevalidate) ?? 0,
2608
+ revalidateMs: p(i.revalidate),
2609
+ staleWhileRevalidateMs: p(i.staleWhileRevalidate) ?? 0,
3119
2610
  cacheInvalidatesOn: Array.isArray(i.cacheInvalidatesOn) ? i.cacheInvalidatesOn : [],
3120
2611
  hasLoader: typeof i.loader == "function",
3121
2612
  hasMeta: i.meta != null,
@@ -3124,83 +2615,83 @@ import {
3124
2615
  } catch (e) {
3125
2616
  Z.warn("inspect: failed to load page metadata", { pattern: n.pattern }, e);
3126
2617
  }
3127
- return u = t, t;
2618
+ return n = r, r;
3128
2619
  };
3129
- r.middlewares.use((e, t, r) => {
3130
- let i = e.url ?? "/";
3131
- if (i.startsWith("/_voltro/inspect") || i.startsWith("/api/dashboard/proxy")) return r();
2620
+ t.middlewares.use((e, t, n) => {
2621
+ let r = e.url ?? "/";
2622
+ if (r.startsWith("/_voltro/inspect") || r.startsWith("/api/dashboard/proxy")) return n();
3132
2623
  let a = Date.now(), o = t.end.bind(t);
3133
2624
  t.end = ((...e) => {
3134
2625
  try {
3135
- n.emit("request", {
3136
- url: i.split("?")[0],
2626
+ i.emit("request", {
2627
+ url: r.split("?")[0],
3137
2628
  status: t.statusCode ?? 0,
3138
2629
  durationMs: Date.now() - a
3139
2630
  });
3140
2631
  } catch {}
3141
2632
  return o(...e);
3142
- }), r();
3143
- }), r.middlewares.use((t, n, r) => {
2633
+ }), n();
2634
+ }), t.middlewares.use((t, n, r) => {
3144
2635
  if (t.method !== "GET" && t.method !== "HEAD") return r();
3145
- let { pathname: i } = ri(t.url ?? "/");
3146
- if (i !== "/robots.txt" || T(p(e, "public", "robots.txt"))) return r();
3147
- n.statusCode = 200, n.setHeader("Content-Type", "text/plain; charset=utf-8"), n.end(pn({ indexable: !1 }));
3148
- }), t.name === "voltroDashboard" && r.middlewares.use(async (e, t, n) => {
3149
- let r = e.url ?? "", a = r.split("?")[0];
3150
- if (a === "/api/dashboard/proxy") {
2636
+ let { pathname: i } = zn(t.url ?? "/");
2637
+ if (i !== "/robots.txt" || E(C(e, "public", "robots.txt"))) return r();
2638
+ n.statusCode = 200, n.setHeader("Content-Type", "text/plain; charset=utf-8"), n.end(vt({ indexable: !1 }));
2639
+ }), r.name === "voltroDashboard" && t.middlewares.use(async (e, t, n) => {
2640
+ let r = e.url ?? "", i = r.split("?")[0];
2641
+ if (i === "/api/dashboard/proxy") {
3151
2642
  let n = new URL(r, "http://x").searchParams.get("target");
3152
2643
  if (!n) {
3153
2644
  t.statusCode = 400, t.end("missing ?target=");
3154
2645
  return;
3155
2646
  }
3156
- if (!o(n)) {
2647
+ if (!u(n)) {
3157
2648
  t.statusCode = 400, t.end("target not allowed: must be loopback or an origin configured in VOLTRO_DASHBOARD_APPS");
3158
2649
  return;
3159
2650
  }
3160
2651
  try {
3161
2652
  let r = { accept: String(e.headers.accept ?? "application/json") };
3162
- e.headers.authorization ? r.authorization = String(e.headers.authorization) : i(n) && process.env.VOLTRO_INSPECT_TOKEN && (r.authorization = `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}`);
3163
- let a;
2653
+ e.headers.authorization ? r.authorization = String(e.headers.authorization) : l(n) && process.env.VOLTRO_INSPECT_TOKEN && (r.authorization = `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}`);
2654
+ let i;
3164
2655
  if (e.method && e.method !== "GET" && e.method !== "HEAD") {
3165
2656
  let t = [];
3166
2657
  for await (let n of e) t.push(n);
3167
- a = Buffer.concat(t);
2658
+ i = Buffer.concat(t);
3168
2659
  let n = e.headers["content-type"];
3169
2660
  n && (r["content-type"] = Array.isArray(n) ? n[0] : String(n));
3170
2661
  }
3171
- let o = await fetch(n, {
2662
+ let a = await fetch(n, {
3172
2663
  redirect: "manual",
3173
2664
  ...e.method ? { method: e.method } : {},
3174
2665
  headers: r,
3175
- ...a && a.length ? { body: new Uint8Array(a.buffer, a.byteOffset, a.byteLength) } : {}
3176
- }), s = Buffer.from(await o.arrayBuffer());
3177
- t.statusCode = o.status, t.setHeader("content-type", o.headers.get("content-type") ?? "application/octet-stream"), t.setHeader("content-length", String(s.length)), t.end(s);
2666
+ ...i && i.length ? { body: new Uint8Array(i.buffer, i.byteOffset, i.byteLength) } : {}
2667
+ }), o = Buffer.from(await a.arrayBuffer());
2668
+ t.statusCode = a.status, t.setHeader("content-type", a.headers.get("content-type") ?? "application/octet-stream"), t.setHeader("content-length", String(o.length)), t.end(o);
3178
2669
  } catch (e) {
3179
2670
  t.statusCode = 502, t.end(`proxy error: ${e.message}`);
3180
2671
  }
3181
2672
  return;
3182
2673
  }
3183
- if (a === "/api/dashboard/proxy/stream") {
2674
+ if (i === "/api/dashboard/proxy/stream") {
3184
2675
  let n = new URL(r, "http://x").searchParams.get("target");
3185
2676
  if (!n) {
3186
2677
  t.statusCode = 400, t.end("missing ?target=");
3187
2678
  return;
3188
2679
  }
3189
- if (!o(n)) {
2680
+ if (!u(n)) {
3190
2681
  t.statusCode = 400, t.end("target not allowed: must be loopback or an origin configured in VOLTRO_DASHBOARD_APPS");
3191
2682
  return;
3192
2683
  }
3193
- let a = new AbortController();
3194
- e.on("close", () => a.abort()), t.on("close", () => a.abort());
2684
+ let i = new AbortController();
2685
+ e.on("close", () => i.abort()), t.on("close", () => i.abort());
3195
2686
  try {
3196
2687
  let r = await fetch(n, {
3197
2688
  redirect: "manual",
3198
2689
  method: "GET",
3199
2690
  headers: {
3200
2691
  accept: "text/event-stream",
3201
- ...e.headers.authorization ? { authorization: String(e.headers.authorization) } : i(n) && process.env.VOLTRO_INSPECT_TOKEN ? { authorization: `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}` } : {}
2692
+ ...e.headers.authorization ? { authorization: String(e.headers.authorization) } : l(n) && process.env.VOLTRO_INSPECT_TOKEN ? { authorization: `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}` } : {}
3202
2693
  },
3203
- signal: a.signal
2694
+ signal: i.signal
3204
2695
  });
3205
2696
  if (!r.ok || !r.body) {
3206
2697
  t.statusCode = r.status, t.end(`upstream ${r.status}`);
@@ -3212,15 +2703,15 @@ import {
3212
2703
  connection: "keep-alive",
3213
2704
  "x-accel-buffering": "no"
3214
2705
  });
3215
- let o = r.body.getReader();
2706
+ let a = r.body.getReader();
3216
2707
  try {
3217
2708
  for (;;) {
3218
- let { done: e, value: n } = await o.read();
2709
+ let { done: e, value: n } = await a.read();
3219
2710
  if (e) break;
3220
2711
  n && t.write(Buffer.from(n));
3221
2712
  }
3222
2713
  } finally {
3223
- o.releaseLock(), t.end();
2714
+ a.releaseLock(), t.end();
3224
2715
  }
3225
2716
  } catch (e) {
3226
2717
  e.name !== "AbortError" && (t.statusCode = 502, t.end(`proxy stream error: ${e.message}`));
@@ -3228,86 +2719,86 @@ import {
3228
2719
  return;
3229
2720
  }
3230
2721
  n();
3231
- }), r.middlewares.use(async (e, r, i) => {
3232
- let o = e.url ?? "";
3233
- if (!o.startsWith("/_voltro/inspect")) return i();
2722
+ }), t.middlewares.use(async (e, t, n) => {
2723
+ let l = e.url ?? "";
2724
+ if (!l.startsWith("/_voltro/inspect")) return n();
3234
2725
  let u = {};
3235
2726
  for (let [t, n] of Object.entries(e.headers ?? {})) n !== void 0 && (u[String(t).toLowerCase()] = Array.isArray(n) ? n.join(", ") : String(n));
3236
- let f = o.split("?")[0];
3237
- if (e.method === "GET" && (f === "/_voltro/inspect/logs" || o.startsWith("/_voltro/inspect/logs?"))) {
3238
- let e = a(u.origin), t = Kn(o, On(), u);
3239
- r.statusCode = t.status, r.setHeader("content-type", t.contentType);
3240
- for (let [t, n] of Object.entries(e)) r.setHeader(t, n);
3241
- r.end(t.body);
2727
+ let f = l.split("?")[0];
2728
+ if (e.method === "GET" && (f === "/_voltro/inspect/logs" || l.startsWith("/_voltro/inspect/logs?"))) {
2729
+ let e = o(u.origin), n = Zt(l, Nt(), u);
2730
+ t.statusCode = n.status, t.setHeader("content-type", n.contentType);
2731
+ for (let [n, r] of Object.entries(e)) t.setHeader(n, r);
2732
+ t.end(n.body);
3242
2733
  return;
3243
2734
  }
3244
2735
  if (e.method === "POST" && f === "/_voltro/inspect/clientLog") {
3245
- let t = a(u.origin);
3246
- if (c()) {
3247
- r.statusCode = 503, r.setHeader("content-type", "application/json");
3248
- for (let [e, n] of Object.entries(t)) r.setHeader(e, n);
3249
- r.end(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }));
2736
+ let n = o(u.origin);
2737
+ if (a()) {
2738
+ t.statusCode = 503, t.setHeader("content-type", "application/json");
2739
+ for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
2740
+ t.end(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }));
3250
2741
  return;
3251
2742
  }
3252
- let i = "";
2743
+ let r = "";
3253
2744
  e.setEncoding("utf-8"), e.on("data", (e) => {
3254
- i += e;
2745
+ r += e;
3255
2746
  }), e.on("end", () => {
3256
- let e = Bn(i, n);
3257
- r.statusCode = e.status, r.setHeader("content-type", e.contentType);
3258
- for (let [e, n] of Object.entries(t)) r.setHeader(e, n);
3259
- r.end(e.body);
2747
+ let e = Gt(r, i);
2748
+ t.statusCode = e.status, t.setHeader("content-type", e.contentType);
2749
+ for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
2750
+ t.end(e.body);
3260
2751
  }), e.on("error", () => {
3261
- r.statusCode = 400, r.setHeader("content-type", "application/json"), r.end(JSON.stringify({ error: "read failed" }));
2752
+ t.statusCode = 400, t.setHeader("content-type", "application/json"), t.end(JSON.stringify({ error: "read failed" }));
3262
2753
  });
3263
2754
  return;
3264
2755
  }
3265
2756
  if (f === "/_voltro/inspect/stream") {
3266
- let t = a(u.origin);
3267
- if (c()) {
3268
- r.statusCode = 503, r.setHeader("content-type", "application/json");
3269
- for (let [e, n] of Object.entries(t)) r.setHeader(e, n);
3270
- r.end(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }));
2757
+ let n = o(u.origin);
2758
+ if (a()) {
2759
+ t.statusCode = 503, t.setHeader("content-type", "application/json");
2760
+ for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
2761
+ t.end(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }));
3271
2762
  return;
3272
2763
  }
3273
- let i = s(u, "GET");
3274
- if (!i.ok) {
3275
- r.statusCode = 401, r.setHeader("content-type", "application/json");
3276
- for (let [e, n] of Object.entries(t)) r.setHeader(e, n);
3277
- r.end(JSON.stringify({
2764
+ let r = s(u, "GET");
2765
+ if (!r.ok) {
2766
+ t.statusCode = 401, t.setHeader("content-type", "application/json");
2767
+ for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
2768
+ t.end(JSON.stringify({
3278
2769
  error: "unauthorized",
3279
- reason: i.reason
2770
+ reason: r.reason
3280
2771
  }));
3281
2772
  return;
3282
2773
  }
3283
- r.statusCode = 200, r.setHeader("content-type", "text/event-stream; charset=utf-8"), r.setHeader("cache-control", "no-cache, no-transform"), r.setHeader("connection", "keep-alive"), r.setHeader("x-accel-buffering", "no");
3284
- for (let [e, n] of Object.entries(t)) r.setHeader(e, n);
3285
- r.flushHeaders?.(), r.write("retry: 5000\n\n");
3286
- let l = o.indexOf("?");
3287
- if (!(l !== -1 && new URLSearchParams(o.slice(l + 1)).get("live") === "1")) for (let e of n.buffered()) r.write(gn(e));
3288
- let d = n.subscribe((e) => {
2774
+ t.statusCode = 200, t.setHeader("content-type", "text/event-stream; charset=utf-8"), t.setHeader("cache-control", "no-cache, no-transform"), t.setHeader("connection", "keep-alive"), t.setHeader("x-accel-buffering", "no");
2775
+ for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
2776
+ t.flushHeaders?.(), t.write("retry: 5000\n\n");
2777
+ let c = l.indexOf("?");
2778
+ if (!(c !== -1 && new URLSearchParams(l.slice(c + 1)).get("live") === "1")) for (let e of i.buffered()) t.write(xt(e));
2779
+ let d = i.subscribe((e) => {
3289
2780
  try {
3290
- r.write(gn(e));
2781
+ t.write(xt(e));
3291
2782
  } catch {}
3292
2783
  }), f = setInterval(() => {
3293
2784
  try {
3294
- r.write(_n());
2785
+ t.write(St());
3295
2786
  } catch {}
3296
2787
  }, 15e3), p = () => {
3297
2788
  clearInterval(f), d();
3298
2789
  };
3299
- e.on("close", p), r.on("close", p);
2790
+ e.on("close", p), t.on("close", p);
3300
2791
  return;
3301
2792
  }
3302
2793
  try {
3303
- let n = l(o, {
2794
+ let i = c(l, {
3304
2795
  kind: "web",
3305
2796
  meta: {
3306
- name: t.name ?? "(unnamed)",
3307
- voltroVersion: Ti,
3308
- port: g,
2797
+ name: r.name ?? "(unnamed)",
2798
+ voltroVersion: sr,
2799
+ port: k,
3309
2800
  mode: "dev",
3310
- apis: Object.entries(t.apis ?? {}).map(([e, t]) => {
2801
+ apis: Object.entries(r.apis ?? {}).map(([e, t]) => {
3311
2802
  let n = {
3312
2803
  name: e,
3313
2804
  package: t.package
@@ -3316,42 +2807,42 @@ import {
3316
2807
  })
3317
2808
  },
3318
2809
  routes: await d(),
3319
- dirs: w,
2810
+ dirs: I,
3320
2811
  cache: () => ({
3321
2812
  backend: "memory",
3322
2813
  size: 0,
3323
2814
  entries: []
3324
2815
  }),
3325
- env: () => ct(t.name ?? "app", { contract: ae(t.env) ? t.env : void 0 })
2816
+ env: () => ye(r.name ?? "app", { contract: re(r.env) ? r.env : void 0 })
3326
2817
  }, u, { method: e.method ?? "GET" });
3327
- if (n === null) return i();
3328
- r.statusCode = n.status, r.setHeader("content-type", n.contentType);
3329
- for (let [e, t] of Object.entries(n.headers ?? {})) r.setHeader(e, t);
3330
- r.end(n.body);
2818
+ if (i === null) return n();
2819
+ t.statusCode = i.status, t.setHeader("content-type", i.contentType);
2820
+ for (let [e, n] of Object.entries(i.headers ?? {})) t.setHeader(e, n);
2821
+ t.end(i.body);
3331
2822
  } catch (e) {
3332
- r.statusCode = 500, r.setHeader("content-type", "text/plain"), r.end(`inspect handler error: ${e.message}`);
2823
+ t.statusCode = 500, t.setHeader("content-type", "text/plain"), t.end(`inspect handler error: ${e.message}`);
3333
2824
  }
3334
2825
  });
3335
2826
  }
3336
- }, pe = t.name === "voltroDashboard" ? {
2827
+ }, xe = r.name === "voltroDashboard" ? {
3337
2828
  name: "framework:dashboard-registry",
3338
2829
  configureServer(e) {
3339
2830
  e.middlewares.use(async (e, t, n) => {
3340
2831
  if (!(e.url ?? "").startsWith("/api/dashboard/registry")) return n();
3341
2832
  try {
3342
- let e = await Ke();
2833
+ let e = await _();
3343
2834
  t.statusCode = 200, t.setHeader("content-type", "application/json; charset=utf-8"), t.end(JSON.stringify(e));
3344
2835
  } catch (e) {
3345
2836
  t.statusCode = 500, t.setHeader("content-type", "text/plain"), t.end(`registry read error: ${e.message}`);
3346
2837
  }
3347
2838
  });
3348
2839
  }
3349
- } : null, me = /* @__PURE__ */ new Set(), U = (e, t, n, r, i, a = !1) => {
3350
- let o = ui(i, a, t) ?? "";
2840
+ } : null, Ce = /* @__PURE__ */ new Set(), Te = (e, t, n, r, i, a = !1) => {
2841
+ let o = Kn(i, a, t) ?? "";
3351
2842
  if (Z.error(`${t} render failed`, {
3352
2843
  pathname: n,
3353
2844
  pattern: r,
3354
- cause: yn(i) + o
2845
+ cause: wt(i) + o
3355
2846
  }), e.headersSent) {
3356
2847
  e.end();
3357
2848
  return;
@@ -3359,12 +2850,12 @@ import {
3359
2850
  e.writeHead(500, {
3360
2851
  "content-type": "text/plain; charset=utf-8",
3361
2852
  "x-voltro-rendered-by": `${t}-failed`,
3362
- "x-voltro-ssr-generation": String(oe)
2853
+ "x-voltro-ssr-generation": String(q)
3363
2854
  });
3364
- let s = oe === 0 ? "" : `\n[voltro] this process has absorbed ${oe} hot update(s) since boot, so its SSR\nmodule graph may not match the files on disk. Before reporting this — to us or to\nyourself — restart \`voltro dev\` and measure once from a fresh boot.\n`;
3365
- e.end(`${t} render failed for ${n}\n\n${yn(i)}\n${o}\n${s}`);
3366
- }, W = Jt(), he = Xt({
3367
- limit: W,
2855
+ let s = q === 0 ? "" : `\n[voltro] this process has absorbed ${q} hot update(s) since boot, so its SSR\nmodule graph may not match the files on disk. Before reporting this — to us or to\nyourself — restart \`voltro dev\` and measure once from a fresh boot.\n`;
2856
+ e.end(`${t} render failed for ${n}\n\n${wt(i)}\n${o}\n${s}`);
2857
+ }, Ee = et(), De = nt({
2858
+ limit: Ee,
3368
2859
  onColdStart: (e) => Z.debug("ssr cold-compile start", { id: e }),
3369
2860
  onColdEnd: (e, { durationMs: t, failed: n }) => Z.debug(`ssr cold-compile ${n ? "FAILED" : "end"} ${t}ms`, {
3370
2861
  id: e,
@@ -3372,85 +2863,85 @@ import {
3372
2863
  ...n ? { failed: !0 } : {}
3373
2864
  })
3374
2865
  });
3375
- Z.debug(`ssr cold-compile concurrency ${W}`, { concurrency: W });
3376
- let G = null, ge = async () => (G === null && (G = await O.readFile(p(e, ".framework", "index.html"), "utf8")), G), _e = {
2866
+ Z.debug(`ssr cold-compile concurrency ${Ee}`, { concurrency: Ee });
2867
+ let Oe = null, ke = async () => (Oe === null && (Oe = await D.readFile(C(e, ".framework", "index.html"), "utf8")), Oe), Ae = {
3377
2868
  name: "framework:ssr",
3378
- configureServer(n) {
3379
- let i = (e) => he.load(e, async () => await n.ssrLoadModule(e)), a, o = !1, s = () => {
3380
- if (a !== void 0) return a;
3381
- let n = t.locales ?? [], r = t.defaultLocale ?? n[0] ?? "en";
3382
- return n.length === 0 ? (a = Promise.resolve(() => void 0), a) : (a = (async () => {
3383
- let [{ makeSsgWrap: t }, { makeSsrI18nResolver: a }] = await Promise.all([i("@voltro/i18n"), i("@voltro/i18n/server")]), s = {};
3384
- for (let a of n) if (T(p(e, "src", "locales", `${a}.ts`))) try {
3385
- let n = (await i(p(e, "src", "locales", `${a}.ts`))).default;
3386
- n !== void 0 && (s[a] = t(a, n, r));
2869
+ configureServer(t) {
2870
+ let n = (e) => De.load(e, async () => await t.ssrLoadModule(e)), i, a = !1, o = () => {
2871
+ if (i !== void 0) return i;
2872
+ let t = r.locales ?? [], o = r.defaultLocale ?? t[0] ?? "en";
2873
+ return t.length === 0 ? (i = Promise.resolve(() => void 0), i) : (i = (async () => {
2874
+ let [{ makeSsgWrap: r }, { makeSsrI18nResolver: i }] = await Promise.all([n("@voltro/i18n"), n("@voltro/i18n/server")]), s = {};
2875
+ for (let i of t) if (E(C(e, "src", "locales", `${i}.ts`))) try {
2876
+ let t = (await n(C(e, "src", "locales", `${i}.ts`))).default;
2877
+ t !== void 0 && (s[i] = r(i, t, o));
3387
2878
  } catch (e) {
3388
- Z.warn("locale catalog failed to load for SSR", { locale: a }, e);
2879
+ Z.warn("locale catalog failed to load for SSR", { locale: i }, e);
3389
2880
  }
3390
- if (o = Object.keys(s).length > 0, Object.keys(s).length === 0) {
3391
- let { resolveLocale: e } = await i("@voltro/i18n/server");
3392
- return (t, i) => ({
2881
+ if (a = Object.keys(s).length > 0, Object.keys(s).length === 0) {
2882
+ let { resolveLocale: e } = await n("@voltro/i18n/server");
2883
+ return (n, r) => ({
3393
2884
  locale: e({
3394
- cookieHeader: t ?? null,
3395
- acceptLanguageHeader: i ?? null,
3396
- supported: n,
3397
- defaultLocale: r
2885
+ cookieHeader: n ?? null,
2886
+ acceptLanguageHeader: r ?? null,
2887
+ supported: t,
2888
+ defaultLocale: o
3398
2889
  }),
3399
2890
  outerWrap: (e) => e
3400
2891
  });
3401
2892
  }
3402
- return a({
2893
+ return i({
3403
2894
  wraps: s,
3404
- supported: n,
3405
- defaultLocale: r
2895
+ supported: t,
2896
+ defaultLocale: o
3406
2897
  });
3407
- })(), a);
2898
+ })(), i);
3408
2899
  };
3409
- n.middlewares.use(async (a, c, l) => {
3410
- if (a.method !== "GET" && a.method !== "HEAD") return l();
3411
- let u = a.url ?? "/";
3412
- u.indexOf("?");
3413
- let { pathname: d, search: f } = ri(u);
3414
- if (d.startsWith("/@") || d.startsWith("/node_modules/") || d.startsWith("/.framework/") || d.startsWith("/_voltro/") || d === "/main.tsx" || d === "/index.html" || d === "/sw.js" || d === "/favicon.ico" || d === "/robots.txt" || /\.[a-z0-9]+$/i.test(d)) return l();
3415
- let m = Ki(d, S.ssrRoutes);
3416
- if (!m) return l();
3417
- let h = !me.has(m.route.pattern), g = Date.now();
3418
- h && Z.info(`ssr compiling ${m.route.pattern}`, {
3419
- pattern: m.route.pattern,
3420
- pathname: d
2900
+ t.middlewares.use(async (i, s, c) => {
2901
+ if (i.method !== "GET" && i.method !== "HEAD") return c();
2902
+ let l = i.url ?? "/";
2903
+ l.indexOf("?");
2904
+ let { pathname: u, search: d } = zn(l);
2905
+ if (u.startsWith("/@") || u.startsWith("/node_modules/") || u.startsWith("/.framework/") || u.startsWith("/_voltro/") || u === "/main.tsx" || u === "/index.html" || u === "/sw.js" || u === "/favicon.ico" || u === "/robots.txt" || /\.[a-z0-9]+$/i.test(u)) return c();
2906
+ let p = Or(u, F.ssrRoutes);
2907
+ if (!p) return c();
2908
+ let h = !Ce.has(p.route.pattern), g = Date.now();
2909
+ h && Z.info(`ssr compiling ${p.route.pattern}`, {
2910
+ pattern: p.route.pattern,
2911
+ pathname: u
3421
2912
  });
3422
2913
  let _ = {}, v = async (e, t) => {
3423
2914
  let n = Date.now(), r = await t();
3424
2915
  return _[e] = (_[e] ?? 0) + (Date.now() - n), r;
3425
- }, y = async (e, t, r) => {
3426
- let i = await n.moduleGraph.getModuleById(e);
3427
- if (!(!i || t.has(e))) {
3428
- if (t.add(e), i.id && /\.(css|sass|scss|less|stylus|pcss|postcss)(\?|$)/.test(i.id)) {
2916
+ }, y = async (e, n, r) => {
2917
+ let i = await t.moduleGraph.getModuleById(e);
2918
+ if (!(!i || n.has(e))) {
2919
+ if (n.add(e), i.id && /\.(css|sass|scss|less|stylus|pcss|postcss)(\?|$)/.test(i.id)) {
3429
2920
  let e = i.url.replace(/\?.*$/, "");
3430
2921
  r.includes(e) || r.push(e);
3431
2922
  return;
3432
2923
  }
3433
- for (let e of i.importedModules ?? []) e.id && await y(e.id, t, r);
2924
+ for (let e of i.importedModules ?? []) e.id && await y(e.id, n, r);
3434
2925
  }
3435
2926
  }, b = !1;
3436
2927
  try {
3437
- let x = await v("loadPage", async () => await i(p(e, "src", "pages", m.route.file))), C = yr(x, p("src", "pages", m.route.file)), w = Bi(S.dirs, m.route.dirChain), T = C === "spa" && w.some((e) => e.hasLayout);
3438
- if (C !== "ssr" && C !== "isr" && !T) return l();
2928
+ let x = await v("loadPage", async () => await n(C(e, "src", "pages", p.route.file))), S = f(x, C("src", "pages", p.route.file)), w = Sr(F.dirs, p.route.dirChain), T = S === "spa" && w.some((e) => e.hasLayout);
2929
+ if (S !== "ssr" && S !== "isr" && !T) return c();
3439
2930
  let E = {};
3440
- for (let [e, t] of Object.entries(a.headers ?? {})) typeof t == "string" ? E[e] = t : Array.isArray(t) && (E[e] = t.join(", "));
3441
- let D = ra(na(r[0], { allowDevProxy: !0 }), E.cookie, { apiName: r[0]?.name }), O = new AbortController(), k = () => O.abort();
3442
- c.once("close", k);
2931
+ for (let [e, t] of Object.entries(i.headers ?? {})) typeof t == "string" ? E[e] = t : Array.isArray(t) && (E[e] = t.join(", "));
2932
+ let D = zr(Rr(m[0], { allowDevProxy: !0 }), E.cookie, { apiName: m[0]?.name }), O = new AbortController(), k = () => O.abort();
2933
+ s.once("close", k);
3443
2934
  let A = null, j = [], M = {};
3444
2935
  try {
3445
- (await i("@voltro/web/ssr")).beginStoreSeeds(), {chain: j, segmentLoaderData: M} = await v("loadChain", () => Vi({
2936
+ (await n("@voltro/web/ssr")).beginStoreSeeds(), {chain: j, segmentLoaderData: M} = await v("loadChain", () => Cr({
3446
2937
  entries: w,
3447
- loadLayout: (t) => i(p(e, "src", "pages", t.dir, "layout.tsx")),
3448
- loadError: (t) => i(p(e, "src", "pages", t.dir, "error.tsx")),
3449
- loadPending: (t) => i(p(e, "src", "pages", t.dir, "loading.tsx")),
2938
+ loadLayout: (t) => n(C(e, "src", "pages", t.dir, "layout.tsx")),
2939
+ loadError: (t) => n(C(e, "src", "pages", t.dir, "error.tsx")),
2940
+ loadPending: (t) => n(C(e, "src", "pages", t.dir, "loading.tsx")),
3450
2941
  ctx: {
3451
- params: m.params,
3452
- pathname: d,
3453
- search: f,
2942
+ params: p.params,
2943
+ pathname: u,
2944
+ search: d,
3454
2945
  signal: O.signal,
3455
2946
  headers: E,
3456
2947
  query: D
@@ -3458,143 +2949,143 @@ import {
3458
2949
  }));
3459
2950
  let t = x.loader;
3460
2951
  typeof t == "function" && !T && (A = await v("loader", () => t({
3461
- params: m.params,
3462
- pathname: d,
3463
- search: f,
2952
+ params: p.params,
2953
+ pathname: u,
2954
+ search: d,
3464
2955
  signal: O.signal,
3465
2956
  headers: E,
3466
2957
  query: D
3467
2958
  })));
3468
2959
  } finally {
3469
- c.off("close", k);
2960
+ s.off("close", k);
3470
2961
  }
3471
- let N = await v("loadSsrHelpers", async () => await i("@voltro/web/ssr"));
3472
- T || await Ci({
2962
+ let N = await v("loadSsrHelpers", async () => await n("@voltro/web/ssr"));
2963
+ T || await ar({
3473
2964
  pageMod: x,
3474
- params: m.params,
2965
+ params: p.params,
3475
2966
  query: D,
3476
- apiName: r[0]?.name,
2967
+ apiName: m[0]?.name,
3477
2968
  seed: N.seedPreloadedSubscription,
3478
2969
  onError: ({ tag: e, apiName: t }, n) => Z.warn("preload seed failed", {
3479
2970
  tag: e,
3480
2971
  apiName: t,
3481
- pathname: d
2972
+ pathname: u
3482
2973
  }, n)
3483
2974
  });
3484
- let ee = {
3485
- pattern: m.route.pattern,
2975
+ let P = {
2976
+ pattern: p.route.pattern,
3486
2977
  Component: x.default,
3487
2978
  meta: x.meta,
3488
2979
  loader: x.loader,
3489
2980
  ErrorBoundary: x.ErrorBoundary,
3490
2981
  Pending: x.Pending,
3491
- renderMode: C,
2982
+ renderMode: S,
3492
2983
  chain: j
3493
- }, P = {
2984
+ }, I = {
3494
2985
  cookies: N.parseCookieHeader(E.cookie),
3495
2986
  headers: E,
3496
- url: u
3497
- }, F = x.interactive ?? "full", I = (await s())(E.cookie, E["accept-language"]);
3498
- b = I !== void 0 && o;
3499
- let te = I ? {
3500
- outerWrap: I.outerWrap,
3501
- locale: I.locale
3502
- } : {}, L = T ? ei({
2987
+ url: l
2988
+ }, L = x.interactive ?? "full", R = (await o())(E.cookie, E["accept-language"]);
2989
+ b = R !== void 0 && a;
2990
+ let ee = R ? {
2991
+ outerWrap: R.outerWrap,
2992
+ locale: R.locale
2993
+ } : {}, z = T ? In({
3503
2994
  helpers: N,
3504
- page: `src/pages/${m.route.file}`,
3505
- interactive: F,
2995
+ page: `src/pages/${p.route.file}`,
2996
+ interactive: L,
3506
2997
  delivery: "stream",
3507
2998
  renderInput: {
3508
- descriptor: ee,
3509
- params: m.params,
3510
- pathname: d,
3511
- search: f,
2999
+ descriptor: P,
3000
+ params: p.params,
3001
+ pathname: u,
3002
+ search: d,
3512
3003
  segmentLoaderData: M,
3513
- requestContext: P,
3514
- ...te
3004
+ requestContext: I,
3005
+ ...ee
3515
3006
  }
3516
- }) : null, R = T ? null : $r({
3007
+ }) : null, B = T ? null : Fn({
3517
3008
  helpers: N,
3518
- page: `src/pages/${m.route.file}`,
3519
- pathname: d,
3520
- renderMode: C,
3521
- interactive: F,
3009
+ page: `src/pages/${p.route.file}`,
3010
+ pathname: u,
3011
+ renderMode: S,
3012
+ interactive: L,
3522
3013
  loaderData: A,
3523
3014
  segmentLoaderData: M,
3524
3015
  pageLoaderRan: typeof x.loader == "function"
3525
- }), ne = [];
3016
+ }), V = [];
3526
3017
  await v("collectCss", async () => {
3527
3018
  let t = /* @__PURE__ */ new Set(), n = [
3528
- p(e, "src", "pages", m.route.file),
3019
+ C(e, "src", "pages", p.route.file),
3529
3020
  ...w.flatMap((t) => [
3530
- ...t.hasLayout ? [p(e, "src", "pages", t.dir, "layout.tsx")] : [],
3531
- ...t.hasError ? [p(e, "src", "pages", t.dir, "error.tsx")] : [],
3532
- ...t.hasPending ? [p(e, "src", "pages", t.dir, "loading.tsx")] : []
3021
+ ...t.hasLayout ? [C(e, "src", "pages", t.dir, "layout.tsx")] : [],
3022
+ ...t.hasError ? [C(e, "src", "pages", t.dir, "error.tsx")] : [],
3023
+ ...t.hasPending ? [C(e, "src", "pages", t.dir, "loading.tsx")] : []
3533
3024
  ]),
3534
- p(e, ".framework", "main.tsx")
3025
+ C(e, ".framework", "main.tsx")
3535
3026
  ];
3536
- for (let e of n) await y(e, t, ne);
3027
+ for (let e of n) await y(e, t, V);
3537
3028
  });
3538
- let re = await v("readShell", ge), z = await v("transformShell", () => n.transformIndexHtml(u, re)), ie = ne.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), B = I?.locale ?? P.cookies["voltro:locale"] ?? t.defaultLocale ?? (t.locales ?? [])[0] ?? "en", ae = Date.now();
3539
- if (L) {
3540
- let e = (e) => ni({
3029
+ let te = await v("readShell", ke), H = await v("transformShell", () => t.transformIndexHtml(l, te)), ne = V.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), U = R?.locale ?? I.cookies["voltro:locale"] ?? r.defaultLocale ?? (r.locales ?? [])[0] ?? "en", re = Date.now();
3030
+ if (z) {
3031
+ let e = (e) => Rn({
3541
3032
  helpers: N,
3542
- prepared: L,
3033
+ prepared: z,
3543
3034
  meta: e,
3544
- interactive: F,
3545
- extra: [ie]
3035
+ interactive: L,
3036
+ extra: [ne]
3546
3037
  });
3547
- if (L.hasDeferred) bi({
3548
- res: c,
3549
- shell: _i({
3550
- shell: z,
3038
+ if (z.hasDeferred) nr({
3039
+ res: s,
3040
+ shell: $n({
3041
+ shell: H,
3551
3042
  inlineModuleScriptsAsync: !0
3552
3043
  }),
3553
- htmlLang: B,
3044
+ htmlLang: U,
3554
3045
  headers: {
3555
3046
  "content-type": "text/html; charset=utf-8",
3556
3047
  "x-voltro-rendered-by": "spa-shell-dev"
3557
3048
  },
3558
3049
  headInjection: e,
3559
3050
  render: (e) => N.renderPageToStream({
3560
- ...L.renderInput,
3051
+ ...z.renderInput,
3561
3052
  ...e
3562
3053
  }),
3563
3054
  onShellError: (e) => {
3564
- U(c, "spa-shell-dev", d, m.route.pattern, e, b);
3055
+ Te(s, "spa-shell-dev", u, p.route.pattern, e, b);
3565
3056
  }
3566
3057
  });
3567
3058
  else {
3568
- let t = ti({
3059
+ let t = Ln({
3569
3060
  helpers: N,
3570
- prepared: L
3571
- }), n = z.replace("<div id=\"root\"></div>", `<div id="root">${t.body}</div>`).replace("</head>", ` ${e(t.meta)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${B}"`);
3572
- c.statusCode = 200, c.setHeader("content-type", "text/html; charset=utf-8"), c.setHeader("x-voltro-rendered-by", "spa-shell-dev"), c.end(n);
3061
+ prepared: z
3062
+ }), n = H.replace("<div id=\"root\"></div>", `<div id="root">${t.body}</div>`).replace("</head>", ` ${e(t.meta)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${U}"`);
3063
+ s.statusCode = 200, s.setHeader("content-type", "text/html; charset=utf-8"), s.setHeader("x-voltro-rendered-by", "spa-shell-dev"), s.end(n);
3573
3064
  }
3574
- } else if (R) {
3065
+ } else if (B) {
3575
3066
  let e = (e) => [
3576
- ie,
3067
+ ne,
3577
3068
  N.renderMetaToHtml(e),
3578
- `<meta name="voltro-interactive" content="${F}" />`,
3579
- ...R.hasDeferred ? [N.renderDeferredRegistryScript()] : [],
3580
- N.renderRouterStateScript(R.stateInput)
3069
+ `<meta name="voltro-interactive" content="${L}" />`,
3070
+ ...B.hasDeferred ? [N.renderDeferredRegistryScript()] : [],
3071
+ N.renderRouterStateScript(B.stateInput)
3581
3072
  ].filter((e) => e.length > 0).join("\n "), t = {
3582
- descriptor: ee,
3583
- params: m.params,
3584
- pathname: d,
3585
- search: f,
3586
- loaderData: R.loaderData,
3587
- segmentLoaderData: R.segmentLoaderData,
3588
- requestContext: P,
3589
- ...te
3073
+ descriptor: P,
3074
+ params: p.params,
3075
+ pathname: u,
3076
+ search: d,
3077
+ loaderData: B.loaderData,
3078
+ segmentLoaderData: B.segmentLoaderData,
3079
+ requestContext: I,
3080
+ ...ee
3590
3081
  };
3591
- if (C === "ssr" && F === "full") bi({
3592
- res: c,
3593
- shell: _i({
3594
- shell: z,
3082
+ if (S === "ssr" && L === "full") nr({
3083
+ res: s,
3084
+ shell: $n({
3085
+ shell: H,
3595
3086
  inlineModuleScriptsAsync: !0
3596
3087
  }),
3597
- htmlLang: B,
3088
+ htmlLang: U,
3598
3089
  headers: {
3599
3090
  "content-type": "text/html; charset=utf-8",
3600
3091
  "x-voltro-rendered-by": "ssr-dev"
@@ -3605,76 +3096,76 @@ import {
3605
3096
  ...e
3606
3097
  }),
3607
3098
  onShellError: (e) => {
3608
- U(c, "ssr-dev", d, m.route.pattern, e, b);
3099
+ Te(s, "ssr-dev", u, p.route.pattern, e, b);
3609
3100
  }
3610
3101
  });
3611
3102
  else {
3612
- let { html: n, meta: r } = N.renderPageToHtml(t), i = z.replace("<div id=\"root\"></div>", `<div id="root">${n}</div>`).replace("</head>", ` ${e(r)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${B}"`);
3613
- c.statusCode = 200, c.setHeader("content-type", "text/html; charset=utf-8"), c.setHeader("x-voltro-rendered-by", "ssr-dev"), c.end(i);
3103
+ let { html: n, meta: r } = N.renderPageToHtml(t), i = H.replace("<div id=\"root\"></div>", `<div id="root">${n}</div>`).replace("</head>", ` ${e(r)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${U}"`);
3104
+ s.statusCode = 200, s.setHeader("content-type", "text/html; charset=utf-8"), s.setHeader("x-voltro-rendered-by", "ssr-dev"), s.end(i);
3614
3105
  }
3615
3106
  }
3616
- _.render = Date.now() - ae;
3617
- let V = Date.now() - g;
3618
- h ? (me.add(m.route.pattern), Z.info(`ssr compiled ${m.route.pattern} in ${V}ms`, {
3619
- pattern: m.route.pattern,
3620
- pathname: d,
3621
- elapsedMs: V,
3107
+ _.render = Date.now() - re;
3108
+ let W = Date.now() - g;
3109
+ h ? (Ce.add(p.route.pattern), Z.info(`ssr compiled ${p.route.pattern} in ${W}ms`, {
3110
+ pattern: p.route.pattern,
3111
+ pathname: u,
3112
+ elapsedMs: W,
3622
3113
  cold: !0,
3623
3114
  phases: _
3624
- })) : V > 200 && Z.info(`ssr rendered ${d} in ${V}ms`, {
3625
- pattern: m.route.pattern,
3626
- pathname: d,
3627
- elapsedMs: V,
3115
+ })) : W > 200 && Z.info(`ssr rendered ${u} in ${W}ms`, {
3116
+ pattern: p.route.pattern,
3117
+ pathname: u,
3118
+ elapsedMs: W,
3628
3119
  cold: !1,
3629
3120
  phases: _
3630
3121
  });
3631
3122
  } catch (e) {
3632
- if (Zr(e)) {
3123
+ if (Nn(e)) {
3633
3124
  Z.error("ssr-dev render refused", {
3634
- pathname: d,
3635
- pattern: m.route.pattern
3636
- }, e), c.statusCode = 500, c.setHeader("content-type", "text/plain; charset=utf-8"), c.end(e.message);
3125
+ pathname: u,
3126
+ pattern: p.route.pattern
3127
+ }, e), s.statusCode = 500, s.setHeader("content-type", "text/plain; charset=utf-8"), s.end(e.message);
3637
3128
  return;
3638
3129
  }
3639
- let t = Qr(e);
3130
+ let t = Pn(e);
3640
3131
  if (t) {
3641
- c.statusCode = t.status;
3642
- for (let [e, n] of Object.entries(t.headers)) c.setHeader(e, String(n));
3643
- c.end(t.body);
3132
+ s.statusCode = t.status;
3133
+ for (let [e, n] of Object.entries(t.headers)) s.setHeader(e, String(n));
3134
+ s.end(t.body);
3644
3135
  return;
3645
3136
  }
3646
- U(c, "ssr-dev", d, m.route.pattern, e, b);
3137
+ Te(s, "ssr-dev", u, p.route.pattern, e, b);
3647
3138
  }
3648
3139
  });
3649
3140
  }
3650
- }, ve = Date.now(), ye = D.version ?? "?", be = await Ei(), K = p(e, "node_modules", "@voltro", "ui-shadcn"), q = T(p(K, "package.json")) ? K : null, xe = [], Se = await (async () => {
3141
+ }, Me = Date.now(), Ne = ee.version ?? "?", Pe = await cr(), Fe = C(e, "node_modules", "@voltro", "ui-shadcn"), Y = E(C(Fe, "package.json")) ? Fe : null, Ie = [], Le = await (async () => {
3651
3142
  let t = [];
3652
- for (let n of r) {
3143
+ for (let n of m) {
3653
3144
  if (!n.proxyTarget) continue;
3654
- let r = await qi(e, n.pkg);
3145
+ let r = await kr(e, n.pkg);
3655
3146
  if (r) try {
3656
- t.push(await O.readFile(p(r, "rpcGroup.generated.ts"), "utf8"));
3147
+ t.push(await D.readFile(C(r, "rpcGroup.generated.ts"), "utf8"));
3657
3148
  } catch {}
3658
3149
  }
3659
3150
  if (t.length === 0) return !1;
3660
- let n = de("sha1").update(t.join("\0")).digest("hex"), i = p(j, ".voltro-rpcgroup-optimize"), a = "";
3151
+ let n = se("sha1").update(t.join("\0")).digest("hex"), r = C(V, ".voltro-rpcgroup-optimize"), i = "";
3661
3152
  try {
3662
- a = (await O.readFile(i, "utf8")).trim();
3153
+ i = (await D.readFile(r, "utf8")).trim();
3663
3154
  } catch {}
3664
- if (a === n) return !1;
3155
+ if (i === n) return !1;
3665
3156
  try {
3666
- await O.writeFile(i, n);
3157
+ await D.writeFile(r, n);
3667
3158
  } catch {}
3668
3159
  return !0;
3669
3160
  })();
3670
- Se && Z.info("rpcGroup changed since last boot — forcing a dep re-optimize so the browser loads the current api client");
3161
+ Le && Z.info("rpcGroup changed since last boot — forcing a dep re-optimize so the browser loads the current api client");
3671
3162
  try {
3672
- await Et(g, "voltro dev (web)");
3163
+ await je(k, "voltro dev (web)");
3673
3164
  } catch (e) {
3674
3165
  Z.error(String(e.message ?? e)), process.exit(1);
3675
3166
  }
3676
- await (await D.createServer({
3677
- root: j,
3167
+ await (await ee.createServer({
3168
+ root: V,
3678
3169
  envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
3679
3170
  ssr: { noExternal: ["react-intl", "@voltro/i18n"] },
3680
3171
  resolve: {
@@ -3685,141 +3176,145 @@ import {
3685
3176
  "@voltro/i18n"
3686
3177
  ],
3687
3178
  alias: [
3688
- ...be ? [{
3179
+ ...Pe ? [{
3689
3180
  find: "@voltro/devtools/styles.css",
3690
- replacement: p(be, "src/styles.css")
3181
+ replacement: C(Pe, "src/styles.css")
3691
3182
  }, {
3692
3183
  find: "@voltro/devtools",
3693
- replacement: p(be, "src/index.ts")
3184
+ replacement: C(Pe, "src/index.ts")
3694
3185
  }] : [],
3695
- ...q ? [
3186
+ ...Y ? [
3696
3187
  {
3697
3188
  find: "@voltro/ui-shadcn/tokens.css",
3698
- replacement: p(q, "src/tokens.css")
3189
+ replacement: C(Y, "src/tokens.css")
3699
3190
  },
3700
3191
  {
3701
3192
  find: "@voltro/ui-shadcn/cn",
3702
- replacement: p(q, "src/cn.ts")
3193
+ replacement: C(Y, "src/cn.ts")
3703
3194
  },
3704
3195
  {
3705
3196
  find: "@voltro/ui-shadcn/brand",
3706
- replacement: p(q, "src/brand/voltroLogo.tsx")
3197
+ replacement: C(Y, "src/brand/voltroLogo.tsx")
3707
3198
  },
3708
3199
  {
3709
3200
  find: "@voltro/ui-shadcn",
3710
- replacement: p(q, "src/index.ts")
3201
+ replacement: C(Y, "src/index.ts")
3711
3202
  }
3712
3203
  ] : [],
3713
- ...Ze(e)
3204
+ ...$e(e)
3714
3205
  ]
3715
3206
  },
3716
3207
  optimizeDeps: {
3717
- include: [...r.map((e) => `${e.pkg}/rpcGroup`), ...xe],
3718
- force: Se
3208
+ include: [...m.map((e) => `${e.pkg}/rpcGroup`), ...Ie],
3209
+ force: Le
3719
3210
  },
3720
- customLogger: qt(),
3211
+ customLogger: Ze(),
3721
3212
  plugins: [
3722
- pr(p(e, "src", "pages")),
3723
- k(),
3724
- A(),
3725
- ee,
3726
- L,
3727
- B,
3728
- se,
3729
- ce,
3730
- ue,
3731
- _e,
3732
- ...pe ? [pe] : []
3213
+ _n(C(e, "src", "pages")),
3214
+ z(),
3215
+ B(),
3216
+ ne,
3217
+ oe,
3218
+ pe,
3219
+ he,
3220
+ ge,
3221
+ be,
3222
+ Ae,
3223
+ ...xe ? [xe] : []
3733
3224
  ],
3734
3225
  server: {
3735
- port: g,
3226
+ port: k,
3736
3227
  strictPort: !0,
3737
3228
  host: !0,
3738
- allowedHosts: t.allowedHosts === !0 || [...t.allowedHosts ?? []],
3739
- proxy: H,
3740
- fs: { allow: [e, ...Mi(e)] }
3229
+ allowedHosts: r.allowedHosts === !0 || [...r.allowedHosts ?? []],
3230
+ proxy: J,
3231
+ fs: { allow: [e, ...mr(e)] }
3741
3232
  },
3742
3233
  appType: "spa",
3743
- cacheDir: p(j, ".vite"),
3744
- publicDir: p(e, "public")
3745
- })).listen(), wi.info(`v${ye} ready in ${Date.now() - ve}ms`, {
3746
- version: ye,
3747
- bootMs: Date.now() - ve
3748
- }), Z.info(`listening on http://localhost:${g}`, {
3749
- port: g,
3750
- app: t.name ?? "(unnamed)"
3234
+ cacheDir: C(V, ".vite"),
3235
+ publicDir: C(e, "public")
3236
+ })).listen(), or.info(`v${Ne} ready in ${Date.now() - Me}ms`, {
3237
+ version: Ne,
3238
+ bootMs: Date.now() - Me
3239
+ }), Z.info(`listening on http://localhost:${k}`, {
3240
+ port: k,
3241
+ app: r.name ?? "(unnamed)"
3751
3242
  });
3752
- for (let e of r) e.proxyTarget && (Z.info(`proxy /ws/${e.name} → ${e.proxyTarget}`, {
3243
+ for (let e of m) e.proxyTarget && (Z.info(`proxy /ws/${e.name} → ${e.proxyTarget}`, {
3753
3244
  api: e.name,
3754
3245
  target: e.proxyTarget
3755
3246
  }), Z.info(`proxy /_voltro/api/${e.name} → ${e.proxyTarget.replace(/^ws/, "http")}/_voltro/inspect`, { api: e.name }));
3756
3247
  try {
3757
- await qe({
3758
- id: v,
3759
- name: _,
3248
+ await g({
3249
+ id: j,
3250
+ name: A,
3760
3251
  kind: "web",
3761
- url: `http://localhost:${g}`,
3252
+ url: `http://localhost:${k}`,
3762
3253
  pid: process.pid,
3763
3254
  status: "live",
3764
- logFile: y.path
3255
+ logFile: M.path
3765
3256
  });
3766
- let t = zr(e);
3257
+ let t = xn(e);
3767
3258
  if (t) {
3768
- let e = await Yr({ dashboardAppPath: t });
3259
+ let e = await jn({ dashboardAppPath: t });
3769
3260
  e.status === "launched" ? Z.info(`dashboard launched at http://localhost:${e.port}`, { port: e.port }) : e.status === "already-running" && Z.debug(`dashboard already running on :${e.port}`, { port: e.port });
3770
3261
  }
3771
3262
  setInterval(() => {
3772
- qe({
3773
- id: v,
3774
- name: _,
3263
+ g({
3264
+ id: j,
3265
+ name: A,
3775
3266
  kind: "web",
3776
- url: `http://localhost:${g}`,
3267
+ url: `http://localhost:${k}`,
3777
3268
  pid: process.pid,
3778
3269
  status: "live",
3779
- logFile: y.path
3270
+ logFile: M.path
3780
3271
  }).catch(() => {});
3781
3272
  }, 1e4).unref();
3782
3273
  let n = () => {
3783
- Je(v), y.dispose();
3274
+ v(j), M.dispose();
3784
3275
  };
3785
3276
  process.on("SIGINT", n), process.on("SIGTERM", n);
3786
3277
  } catch (e) {
3787
3278
  Z.warn("runtime-registry write failed", {}, e);
3788
3279
  }
3789
- return C({
3790
- app: t.name ?? "unnamed",
3280
+ return L({
3281
+ app: r.name ?? "unnamed",
3791
3282
  kind: "web",
3792
- url: `http://localhost:${g}`,
3793
- bootMs: Date.now() - ve
3283
+ url: `http://localhost:${k}`,
3284
+ bootMs: Date.now() - Me
3794
3285
  }), new Promise(() => {});
3795
- }, la = async (e) => {
3796
- process.env.NODE_ENV || (process.env.NODE_ENV = "production");
3797
- let t = await sa(e);
3798
- if (!t) return {
3286
+ }, Gr = async (t) => {
3287
+ e("serve");
3288
+ let r = await Ur(t);
3289
+ if (!r) return {
3799
3290
  ran: !1,
3800
3291
  exitCode: 0
3801
3292
  };
3802
- let n = Date.now(), r = Z.child("serve");
3803
- r.info("booting voltro serve (preview)", { app: t.name ?? "(unnamed)" });
3804
- let i = await Qi(e, t);
3805
- for (let e of i) r.info("api wired", {
3293
+ let i = Date.now(), a = Z.child("serve");
3294
+ a.info("booting voltro serve (preview)", { app: r.name ?? "(unnamed)" });
3295
+ let o = await Pr(t, r);
3296
+ for (let e of o) a.info("api wired", {
3806
3297
  name: e.name,
3807
3298
  pkg: e.pkg
3808
3299
  });
3809
- await ia(e, t, i);
3300
+ await Br(t, r, o);
3810
3301
  {
3811
- let { pages: t } = await $(p(e, "src", "pages"));
3812
- await sn({
3813
- appRoot: e,
3814
- pages: t
3302
+ let { pages: e } = await $(C(t, "src", "pages"));
3303
+ await ft({
3304
+ appRoot: t,
3305
+ pages: e
3815
3306
  });
3816
3307
  }
3817
- let a = t.port ?? 5173, o = await $e("vite", () => import("vite")), s = (await import("@vitejs/plugin-react")).default, c = p(e, ".framework");
3818
- Z.info("running production build"), await o.build({
3819
- root: c,
3308
+ let s = n({
3309
+ kind: "web",
3310
+ configPort: r.port,
3311
+ env: process.env
3312
+ }).port, c = await fe("vite", () => import("vite")), l = (await import("@vitejs/plugin-react")).default, u = C(t, ".framework");
3313
+ Z.info("running production build"), await c.build({
3314
+ root: u,
3820
3315
  envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
3821
- plugins: [s()],
3822
- customLogger: qt(),
3316
+ plugins: [l()],
3317
+ customLogger: Ze(),
3823
3318
  resolve: { dedupe: [
3824
3319
  "react",
3825
3320
  "react-dom",
@@ -3828,93 +3323,26 @@ import {
3828
3323
  ] },
3829
3324
  build: {
3830
3325
  outDir: "dist",
3831
- rollupOptions: { output: { manualChunks: Pi } }
3326
+ rollupOptions: { output: { manualChunks: gr } }
3832
3327
  },
3833
- publicDir: p(e, "public")
3328
+ publicDir: C(t, "public")
3834
3329
  });
3835
- let l = (await o.preview({
3836
- root: c,
3330
+ let d = (await c.preview({
3331
+ root: u,
3837
3332
  envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
3838
- preview: { port: a },
3333
+ preview: { port: s },
3839
3334
  build: { outDir: "dist" }
3840
- })).resolvedUrls, u = l?.local[0] ?? `http://localhost:${a}`, d = l?.local.slice(1).map((e) => ({
3335
+ })).resolvedUrls, f = d?.local[0] ?? `http://localhost:${s}`, p = d?.local.slice(1).map((e) => ({
3841
3336
  label: "Local",
3842
3337
  url: e
3843
3338
  })) ?? [];
3844
- return C({
3845
- app: t.name ?? "unnamed",
3339
+ return L({
3340
+ app: r.name ?? "unnamed",
3846
3341
  kind: "preview",
3847
- url: u,
3848
- extras: d,
3849
- bootMs: Date.now() - n
3342
+ url: f,
3343
+ extras: p,
3344
+ bootMs: Date.now() - i
3850
3345
  }), new Promise(() => {});
3851
- }, ua = 5e3, da = 6e4, fa = (e, t) => {
3852
- if (e.length === 0) return 0;
3853
- if (e.length === 1) return e[0];
3854
- let n = t * (e.length - 1), r = Math.floor(n), i = Math.ceil(n);
3855
- if (r === i) return e[r];
3856
- let a = n - r;
3857
- return e[r] * (1 - a) + e[i] * a;
3858
- }, pa = (e) => {
3859
- if (e.length === 0) return {
3860
- p50: 0,
3861
- p95: 0,
3862
- p99: 0,
3863
- mean: 0,
3864
- min: 0,
3865
- max: 0
3866
- };
3867
- let t = e.slice().sort((e, t) => e - t), n = 0;
3868
- for (let e of t) n += e;
3869
- return {
3870
- p50: fa(t, .5),
3871
- p95: fa(t, .95),
3872
- p99: fa(t, .99),
3873
- mean: n / t.length,
3874
- min: t[0],
3875
- max: t[t.length - 1]
3876
- };
3877
- }, ma = (e = {}) => {
3878
- let t = e.maxSamples ?? ua, n = e.defaultWindowMs ?? da, r = [];
3879
- return {
3880
- record(e) {
3881
- I(e), r.push({
3882
- ...e,
3883
- ts: Date.now()
3884
- }), r.length > t && r.shift();
3885
- },
3886
- snapshot(e) {
3887
- let t = e ?? n, i = Date.now(), a = i - t, o = /* @__PURE__ */ new Map(), s = 0;
3888
- for (let e of r) {
3889
- if (e.ts < a) continue;
3890
- s++;
3891
- let t = `${e.kind}\u0000${e.tag}`, n = o.get(t);
3892
- n || (n = {
3893
- kind: e.kind,
3894
- tag: e.tag,
3895
- samples: []
3896
- }, o.set(t, n)), n.samples.push(e);
3897
- }
3898
- let c = [];
3899
- for (let e of o.values()) {
3900
- let t = e.samples.map((e) => e.durationMs), n = 0;
3901
- for (let t of e.samples) t.status === "error" && n++;
3902
- c.push({
3903
- kind: e.kind,
3904
- tag: e.tag,
3905
- count: e.samples.length,
3906
- errorCount: n,
3907
- latencyMs: pa(t)
3908
- });
3909
- }
3910
- return c.sort((e, t) => t.count - e.count), {
3911
- windowMs: t,
3912
- capturedAt: i,
3913
- totalSamples: s,
3914
- buckets: c
3915
- };
3916
- }
3917
- };
3918
3346
  };
3919
3347
  //#endregion
3920
- export { Jt as $, Fr as A, Zn as B, ri as C, Ke as Ct, zr as D, Ie as Dt, Yr as E, Fe as Et, hr as F, On as G, Hn as H, _r as I, _n as J, gn as K, yr as L, wr as M, mr as N, Nr as O, br as P, Xt as Q, rr as R, ni as S, Ye as St, Rr as T, qe as Tt, Bn as U, Kn as V, Nn as W, fn as X, pn as Y, sn as Z, bi as _, ot as _t, Vi as a, Et as at, ei as b, $e as bt, Qi as c, _t as ct, Pi as d, ft as dt, Pt as et, $ as f, pt as ft, _i as g, lt as gt, vi as h, ct as ht, ra as i, Rt as it, Sr as j, Pr as k, ca as l, gt as lt, Ci as m, J as mt, Fi as n, Ft as nt, Bi as o, xt as ot, ia as p, ut as pt, hn as q, na as r, Lt as rt, sa as s, yt as st, ma as t, It as tt, la as u, dt as ut, Zr as v, it as vt, Br as w, Je as wt, ti as x, Ze as xt, $r as y, rt as yt, ir as z };
3348
+ export { Ve as $, zn as A, Nt as B, $n as C, In as D, Fn as E, nn as F, _t as G, bt as H, Zt as I, et as J, ft as K, qt as L, bn as M, jn as N, Ln as O, xn as P, ze as Q, Gt as R, er as S, Nn as T, St as U, xt as V, vt as W, Re as X, $e as Y, Be as Z, Gr as _, Cr as a, ye as at, Br as b, br as c, ge as ct, Ur as d, He as et, Pr as f, Wr as g, Ir as h, zr as i, Se as it, Sn as j, Rn as k, Q as l, he as lt, Mr as m, Rr as n, Ee as nt, Hr as o, be as ot, jr as p, nt as q, Nr as r, we as rt, Sr as s, _e as st, _r as t, je as tt, xr as u, fe as ut, gr as v, nr as w, ar as x, $ as y, Rt as z };