@voltro/cli 0.33.0 → 0.34.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 (337) hide show
  1. package/CHANGELOG.md +1801 -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-BICVGnEC.js +2 -0
  10. package/dist/{apiBuild-h9VHtnlw.js → apiBuild-DZF_f0_I.js} +46 -46
  11. package/dist/appPort-B_HpJ_ck.js +48 -0
  12. package/dist/baselineCommand-C2ClWZN3.js +2 -0
  13. package/dist/baselineCommand-DIttzO8A.js +227 -0
  14. package/dist/bin.js +71 -28
  15. package/dist/build-CE7Ca9gm.js +711 -0
  16. package/dist/cacheCommand-DA4OH9xt.js +42 -0
  17. package/dist/capabilitiesCommand-nq_pz5xd.js +123 -0
  18. package/dist/checkCommand-Dv8r9tGO.js +231 -0
  19. package/dist/checkCommand-YZDmkAGd.js +2 -0
  20. package/dist/{cliArgs-qdZSElM3.js → cliArgs-D4p8n7EE.js} +12 -1
  21. package/dist/cliError-BmdYnghb.js +10 -0
  22. package/dist/cliOutput-D1tSBoRM.js +15 -0
  23. package/dist/{cliRuntime-Oh517vCV.js → cliRuntime-Dh7UDinH.js} +20 -20
  24. package/dist/cloudClient-DWL-Hw_T.js +67 -0
  25. package/dist/cloudCmd-Cvv5HGaZ.js +364 -0
  26. package/dist/clusterCmd-CNXKlcvD.js +54 -0
  27. package/dist/codegen-CYM3Zqrf.js +605 -0
  28. package/dist/codegen-ChBi_hVa.js +2 -0
  29. package/dist/codegenCommand-DC6w2tNZ.js +30 -0
  30. package/dist/codemodRunner-DRRqXR74.js +5243 -0
  31. package/dist/commandRunner-BLAEFLjp.js +47 -0
  32. package/dist/commands-gutsz-Ac.js +808 -0
  33. package/dist/connectionConfig-UFlIEiys.js +66 -0
  34. package/dist/dashboardCommand-3YG8p-UA.js +25 -0
  35. package/dist/dataCommand-qL0r7fPO.js +535 -0
  36. package/dist/dataProfile-dW-PsfLB.js +15 -0
  37. package/dist/{dbCommand-DTLKAfbA.js → dbCommand-B6X0FZbq.js} +551 -401
  38. package/dist/dbCommand-CpdKLeQq.js +2 -0
  39. package/dist/{dev-C_P8FLSx.js → dev-CerMd0mW.js} +3122 -3129
  40. package/dist/dev-CoG-ZPx8.js +3 -0
  41. package/dist/devActivity-Dx_3nnGv.js +100 -0
  42. package/dist/devActivity.js +1 -1
  43. package/dist/dialectDriver-CgXnDfec.js +39 -0
  44. package/dist/discover-C9XKJDco.js +25 -0
  45. package/dist/doctorCommand-BvqGBwNG.js +2 -0
  46. package/dist/{checkCommand-xGhRFFg2.js → doctorCommand-CnDXQxfa.js} +520 -1278
  47. package/dist/dormancyCommand-Dszo57d6.js +69 -0
  48. package/dist/e2eCmd-BRabZww-.js +147 -0
  49. package/dist/embeddingsCommand-C0sKVRo1.js +73 -0
  50. package/dist/envCommand-DPgdV1Bq.js +60 -0
  51. package/dist/evalCommand-6RUfPen4.js +118 -0
  52. package/dist/evolveCommand-DHpkgjgH.js +281 -0
  53. package/dist/fileTaxonomy-CJfgOllU.js +457 -0
  54. package/dist/frameworkTableAssembly-BGHmck-x.js +2 -0
  55. package/dist/{frameworkTableAssembly-BwIrO5nv.js → frameworkTableAssembly-DkkP6BgC.js} +184 -148
  56. package/dist/generateCommand-oibemh97.js +147 -0
  57. package/dist/index.d.ts +45 -0
  58. package/dist/index.js +4 -3
  59. package/dist/infoCommand-BJw9nLUR.js +60 -0
  60. package/dist/{inspect-BUUjt773.js → inspect-CBqFtAKA.js} +82 -40
  61. package/dist/inspect-C_T_WGvl.js +2 -0
  62. package/dist/inspectCmd-Bppy-GGw.js +224 -0
  63. package/dist/inspectFetch-Cm8_wVvp.js +151 -0
  64. package/dist/inspectMetrics-CfdKLh6t.js +72 -0
  65. package/dist/loadEnv-D9nEOClM.js +44 -0
  66. package/dist/logFileSink-C_D2wRN1.js +105 -0
  67. package/dist/logsCmd-CCca3KRZ.js +260 -0
  68. package/dist/manifestBuild-ChsKAhmn.js +2 -0
  69. package/dist/{manifestBuild-BLrVuSlM.js → manifestBuild-sxpwdKY1.js} +1 -1
  70. package/dist/metaCommands-7MJfZ5cf.js +196 -0
  71. package/dist/migrate-CBwOt_iV.js +83 -0
  72. package/dist/mssqlClusterPatch-_4cE_nun.js +44 -0
  73. package/dist/newCommand-COWOJ1_E.js +156 -0
  74. package/dist/nodeEnvironment-cGFAj1J8.js +28 -0
  75. package/dist/packageCommand-Cug_3Ogl.js +271 -0
  76. package/dist/pageConvention-cEiRxdab.js +5 -0
  77. package/dist/privacyCommand-C-Df56U_.js +146 -0
  78. package/dist/projectScaffold-DmzEKHib.js +2 -0
  79. package/dist/projectScaffold-LMMtaavR.js +814 -0
  80. package/dist/renderModeScan-D7J1B7Kw.js +105 -0
  81. package/dist/renderProfile-1OWWAAtx.js +81 -0
  82. package/dist/runtimeRegistry-DMeKfTHP.js +81 -0
  83. package/dist/runtimeTrace-CRxalXTs.js +91 -0
  84. package/dist/scheduleCmd--jksTrf6.js +69 -0
  85. package/dist/scheduleManifestCmd-D2x0CTTY.js +249 -0
  86. package/dist/schemaIr-UJybUUZW.js +103 -0
  87. package/dist/{sdkgen-C81QIkiL.js → sdkgen-CYJscZC7.js} +111 -209
  88. package/dist/seedRunner-TFHHiToI.js +329 -0
  89. package/dist/serveCommand-B_isw7q4.js +1647 -0
  90. package/dist/serveCommand-DOvbgRnQ.js +2 -0
  91. package/dist/serveEntry.js +5 -5
  92. package/dist/serverlessCommand-CfJZy6dS.js +482 -0
  93. package/dist/start-9LiUOfES.js +1087 -0
  94. package/dist/start-B-9Nsp-S.js +3 -0
  95. package/dist/startEntry.js +2 -2
  96. package/dist/staticCommand-Dr2M6tpU.js +304 -0
  97. package/dist/storageCommand-Co6NfLqN.js +42 -0
  98. package/dist/templates-De8IR5-c.js +102 -0
  99. package/dist/test-CI6iDsYc.js +115 -0
  100. package/dist/tracesCmd-CkEZQrtt.js +232 -0
  101. package/dist/tsconfigPaths-BWXBWgcl.js +107 -0
  102. package/dist/tsxLoader-EuXmSJ1K.js +51 -0
  103. package/dist/typecheckCommand-BlsWiCNq.js +61 -0
  104. package/dist/updateCommand-Bkptutss.js +585 -0
  105. package/dist/updateCommand-us1_hdIC.js +2 -0
  106. package/dist/{inspectMetrics-1xzTKAFx.js → webDev-CBYvPqQr.js} +975 -1559
  107. package/dist/webDev-Cg-fFiyd2.js +2 -0
  108. package/dist/webhookDiscovery-CrGAfhIG.js +2 -0
  109. package/dist/webhookDiscovery-D7VaeMlz.js +51 -0
  110. package/dist/webhooksCommand-CID96Rga.js +267 -0
  111. package/dist/workflowsCmd-D1VTmLMY.js +608 -0
  112. package/package.json +179 -17
  113. package/templates/AGENTS.core.md +58 -3
  114. package/templates/AGENTS.md +64 -7
  115. package/templates/agent-docs/_index.md +6 -4
  116. package/templates/agent-docs/_manifest.json +22 -5
  117. package/templates/agent-docs/ai.md +370 -0
  118. package/templates/agent-docs/authentication.md +265 -31
  119. package/templates/agent-docs/caching.md +6 -0
  120. package/templates/agent-docs/cli.md +794 -50
  121. package/templates/agent-docs/data.md +550 -11
  122. package/templates/agent-docs/database/migrations.md +174 -25
  123. package/templates/agent-docs/database/misc.md +156 -40
  124. package/templates/agent-docs/database/querying.md +19 -1
  125. package/templates/agent-docs/database/scaling.md +60 -0
  126. package/templates/agent-docs/database/schema.md +1 -0
  127. package/templates/agent-docs/database/seedsdialects.md +208 -19
  128. package/templates/agent-docs/database/transactions.md +68 -0
  129. package/templates/agent-docs/deployment.md +69 -3
  130. package/templates/agent-docs/introduction.md +87 -16
  131. package/templates/agent-docs/local-first-mobile.md +79 -4
  132. package/templates/agent-docs/multi-tenancy.md +95 -20
  133. package/templates/agent-docs/observability.md +58 -3
  134. package/templates/agent-docs/plugins/ai-flows.md +161 -2
  135. package/templates/agent-docs/plugins/analytics-postgres.md +1 -1
  136. package/templates/agent-docs/plugins/audit.md +37 -1
  137. package/templates/agent-docs/plugins/auth-social.md +143 -0
  138. package/templates/agent-docs/plugins/auth-workos.md +4 -2
  139. package/templates/agent-docs/plugins/auth.md +131 -6
  140. package/templates/agent-docs/plugins/billing.md +132 -15
  141. package/templates/agent-docs/plugins/cdc-out.md +46 -7
  142. package/templates/agent-docs/plugins/clickhouse.md +1 -1
  143. package/templates/agent-docs/plugins/duckdb.md +1 -1
  144. package/templates/agent-docs/plugins/flags.md +132 -0
  145. package/templates/agent-docs/plugins/governance.md +105 -7
  146. package/templates/agent-docs/plugins/multitenancy.md +9 -4
  147. package/templates/agent-docs/plugins/presence.md +13 -2
  148. package/templates/agent-docs/plugins/ratelimit.md +9 -0
  149. package/templates/agent-docs/plugins/search.md +157 -6
  150. package/templates/agent-docs/plugins/sso-saml.md +47 -8
  151. package/templates/agent-docs/plugins/webhooks.md +105 -0
  152. package/templates/agent-docs/plugins.md +150 -18
  153. package/templates/agent-docs/reference.md +60 -3
  154. package/templates/agent-docs/releases.md +1117 -0
  155. package/templates/agent-docs/routing.md +43 -25
  156. package/templates/agent-docs/scheduling.md +10 -0
  157. package/templates/agent-docs/schema-driven-ui.md +92 -12
  158. package/templates/agent-docs/security.md +426 -0
  159. package/templates/agent-docs/templates/apibackends.md +87 -18
  160. package/templates/agent-docs/templates/appshells.md +32 -14
  161. package/templates/agent-docs/templates/overview.md +13 -8
  162. package/templates/agent-docs/testing.md +211 -14
  163. package/templates/agent-docs/whats-new.md +1700 -104
  164. package/templates/agent-docs/workflows.md +130 -14
  165. package/templates/apps/api-ai/actions/summarize.action.ts +11 -0
  166. package/templates/apps/api-ai/package.json +8 -7
  167. package/templates/apps/api-auth/actions/me.action.ts +13 -0
  168. package/templates/apps/api-auth/package.json +9 -8
  169. package/templates/apps/api-backend/mutations/notes.create.mutation.ts +9 -0
  170. package/templates/apps/api-backend/package.json +12 -8
  171. package/templates/apps/api-backend/queries/notes.query.ts +30 -8
  172. package/templates/apps/api-backend-deactivation/actions/users.get.action.ts +14 -0
  173. package/templates/apps/api-backend-deactivation/mutations/users.create.mutation.ts +8 -0
  174. package/templates/apps/api-backend-deactivation/mutations/users.deactivate.mutation.ts +10 -0
  175. package/templates/apps/api-backend-deactivation/package.json +8 -7
  176. package/templates/apps/api-backend-mail/actions/sendWelcome.action.ts +17 -0
  177. package/templates/apps/api-backend-mail/mutations/notes.create.mutation.ts +9 -0
  178. package/templates/apps/api-backend-mail/package.json +9 -8
  179. package/templates/apps/api-backend-mail/queries/notes.query.ts +30 -8
  180. package/templates/apps/api-backend-mariadb/.env.example +14 -0
  181. package/templates/apps/api-backend-mariadb/mutations/notes.create.mutation.ts +9 -0
  182. package/templates/apps/api-backend-mariadb/package.json +10 -9
  183. package/templates/apps/api-backend-mariadb/queries/notes.query.ts +30 -8
  184. package/templates/apps/api-backend-sqlite/.env.example +14 -0
  185. package/templates/apps/api-backend-sqlite/mutations/notes.create.mutation.ts +9 -0
  186. package/templates/apps/api-backend-sqlite/package.json +9 -8
  187. package/templates/apps/api-backend-sqlite/queries/notes.query.ts +30 -8
  188. package/templates/apps/api-backend-storage/actions/uploadAvatar.action.ts +13 -0
  189. package/templates/apps/api-backend-storage/actions/uploadDocument.action.ts +12 -0
  190. package/templates/apps/api-backend-storage/mutations/notes.create.mutation.ts +9 -0
  191. package/templates/apps/api-backend-storage/package.json +9 -8
  192. package/templates/apps/api-backend-storage/queries/notes.query.ts +30 -8
  193. package/templates/apps/api-cms/actions/content.get.action.ts +7 -0
  194. package/templates/apps/api-cms/actions/content.types.action.ts +6 -0
  195. package/templates/apps/api-cms/actions/me.action.ts +13 -0
  196. package/templates/apps/api-cms/app.config.ts +19 -0
  197. package/templates/apps/api-cms/authz.ts +63 -0
  198. package/templates/apps/api-cms/mutations/content.publish.mutation.ts +10 -0
  199. package/templates/apps/api-cms/mutations/content.saveDraft.mutation.ts +10 -0
  200. package/templates/apps/api-cms/mutations/content.unpublish.mutation.ts +5 -0
  201. package/templates/apps/api-cms/package.json +11 -10
  202. package/templates/apps/api-cms/queries/content.list.query.ts +23 -7
  203. package/templates/apps/api-cms/tests/accessDecisions.test.ts +121 -0
  204. package/templates/apps/api-cms/tests/content.descriptors.test.ts +8 -4
  205. package/templates/apps/api-collab/mutations/documents.create.mutation.ts +8 -0
  206. package/templates/apps/api-collab/mutations/documents.setBody.mutation.ts +13 -0
  207. package/templates/apps/api-collab/package.json +9 -8
  208. package/templates/apps/api-collab/queries/documents.query.ts +19 -7
  209. package/templates/apps/api-data-advanced/package.json +9 -8
  210. package/templates/apps/api-data-advanced/queries/authors.withBooks.query.ts +12 -0
  211. package/templates/apps/api-data-advanced/queries/books.search.query.ts +9 -0
  212. package/templates/apps/api-durable/mutations/orders.approve.mutation.ts +17 -0
  213. package/templates/apps/api-durable/mutations/orders.place.mutation.ts +9 -0
  214. package/templates/apps/api-durable/package.json +9 -8
  215. package/templates/apps/api-feature-flags/actions/notes.export.action.ts +16 -0
  216. package/templates/apps/api-feature-flags/mutations/notes.create.mutation.ts +12 -0
  217. package/templates/apps/api-feature-flags/package.json +10 -9
  218. package/templates/apps/api-governance/README.md +30 -8
  219. package/templates/apps/api-governance/actions/profiles.get.action.server.ts +17 -1
  220. package/templates/apps/api-governance/actions/profiles.get.action.ts +29 -4
  221. package/templates/apps/api-governance/database/schema.ts +16 -4
  222. package/templates/apps/api-governance/mutations/profiles.create.mutation.ts +12 -0
  223. package/templates/apps/api-governance/package.json +9 -8
  224. package/templates/apps/api-kv/actions/sync.pull.action.ts +15 -0
  225. package/templates/apps/api-kv/actions/sync.reset.action.ts +13 -0
  226. package/templates/apps/api-kv/actions/sync.status.action.ts +7 -0
  227. package/templates/apps/api-kv/package.json +9 -8
  228. package/templates/apps/api-kv/queries/events.list.query.ts +19 -8
  229. package/templates/apps/api-moderation/mutations/comments.create.mutation.ts +11 -0
  230. package/templates/apps/api-moderation/mutations/posts.create.mutation.ts +13 -0
  231. package/templates/apps/api-moderation/package.json +9 -8
  232. package/templates/apps/api-observability/mutations/notes.create.mutation.ts +8 -0
  233. package/templates/apps/api-observability/package.json +9 -8
  234. package/templates/apps/api-observability/queries/notes.list.query.ts +13 -0
  235. package/templates/apps/api-ratelimit/mutations/notes.create.mutation.ts +14 -0
  236. package/templates/apps/api-ratelimit/package.json +9 -8
  237. package/templates/apps/api-rbac/package.json +9 -8
  238. package/templates/apps/api-rest/package.json +8 -7
  239. package/templates/apps/api-saas/mutations/projects.create.mutation.ts +13 -0
  240. package/templates/apps/api-saas/package.json +12 -11
  241. package/templates/apps/api-saas/queries/projects.list.query.ts +11 -0
  242. package/templates/apps/api-saas-starter/actions/me.action.ts +13 -0
  243. package/templates/apps/api-saas-starter/app.config.ts +19 -0
  244. package/templates/apps/api-saas-starter/authz.ts +75 -0
  245. package/templates/apps/api-saas-starter/mutations/invites.create.mutation.ts +10 -0
  246. package/templates/apps/api-saas-starter/mutations/projects.create.mutation.ts +9 -0
  247. package/templates/apps/api-saas-starter/package.json +15 -11
  248. package/templates/apps/api-saas-starter/queries/invites.list.query.ts +19 -8
  249. package/templates/apps/api-saas-starter/queries/projects.list.query.ts +18 -7
  250. package/templates/apps/api-saas-starter/tests/accessDecisions.test.ts +135 -0
  251. package/templates/apps/api-search/mutations/articles.create.mutation.ts +14 -0
  252. package/templates/apps/api-search/package.json +9 -8
  253. package/templates/apps/api-search/queries/articles.list.query.ts +21 -8
  254. package/templates/apps/api-status/README.md +10 -3
  255. package/templates/apps/api-status/app.config.ts +8 -3
  256. package/templates/apps/api-status/authz.ts +5 -3
  257. package/templates/apps/api-status/package.json +9 -8
  258. package/templates/apps/api-status/queries/components.list.query.ts +14 -6
  259. package/templates/apps/api-status/queries/incidents.live.query.ts +23 -10
  260. package/templates/apps/api-status/queries/updates.list.query.ts +16 -9
  261. package/templates/apps/api-status/tests/status.test.ts +9 -1
  262. package/templates/apps/api-versioning/actions/documents.asOf.action.ts +12 -0
  263. package/templates/apps/api-versioning/actions/documents.history.action.ts +13 -0
  264. package/templates/apps/api-versioning/mutations/documents.create.mutation.ts +9 -0
  265. package/templates/apps/api-versioning/mutations/documents.update.mutation.ts +12 -0
  266. package/templates/apps/api-versioning/package.json +9 -8
  267. package/templates/apps/api-webhooks/mutations/orders.fulfill.mutation.ts +16 -0
  268. package/templates/apps/api-webhooks/package.json +10 -9
  269. package/templates/apps/api-webhooks/queries/orders.list.query.ts +10 -0
  270. package/templates/apps/changelog/package.json +8 -6
  271. package/templates/apps/edge-functions/package.json +2 -2
  272. package/templates/apps/frontend-admin/package.json +10 -8
  273. package/templates/apps/frontend-admin/src/lib/admin.ts +20 -9
  274. package/templates/apps/frontend-admin/src/locales/de.ts +11 -1
  275. package/templates/apps/frontend-admin/src/locales/en.ts +13 -1
  276. package/templates/apps/frontend-admin/src/pages/admin/[entity]/page.tsx +65 -22
  277. package/templates/apps/frontend-admin/src/pages/admin/entity.test.tsx +130 -23
  278. package/templates/apps/frontend-admin/src/pages/admin/layout.tsx +3 -2
  279. package/templates/apps/frontend-admin/src/pages/admin/page.test.tsx +19 -2
  280. package/templates/apps/frontend-admin/src/pages/admin/page.tsx +9 -4
  281. package/templates/apps/frontend-app/app.config.ts +4 -3
  282. package/templates/apps/frontend-app/package.json +11 -8
  283. package/templates/apps/frontend-app/src/lib/api.ts +25 -0
  284. package/templates/apps/frontend-app/src/pages/page.test.tsx +130 -82
  285. package/templates/apps/frontend-app/src/pages/page.tsx +14 -18
  286. package/templates/apps/frontend-auth/package.json +10 -8
  287. package/templates/apps/frontend-blank/package.json +9 -7
  288. package/templates/apps/frontend-cms/package.json +11 -9
  289. package/templates/apps/frontend-collab/package.json +12 -9
  290. package/templates/apps/frontend-collab/src/pages/page.test.tsx +122 -78
  291. package/templates/apps/frontend-contact/package.json +9 -7
  292. package/templates/apps/frontend-dashboard/package.json +9 -7
  293. package/templates/apps/frontend-docs/package.json +9 -7
  294. package/templates/apps/frontend-i18n/package.json +8 -6
  295. package/templates/apps/frontend-landing/package.json +9 -7
  296. package/templates/apps/frontend-portal/package.json +10 -8
  297. package/templates/apps/frontend-saas/app.config.ts +10 -6
  298. package/templates/apps/frontend-saas/package.json +10 -8
  299. package/templates/apps/frontend-saas/src/lib/api.ts +27 -32
  300. package/templates/apps/frontend-saas/src/pages/dashboard/billing/page.tsx +7 -8
  301. package/templates/apps/frontend-saas/src/pages/dashboard/page.test.tsx +27 -3
  302. package/templates/apps/frontend-saas/src/pages/dashboard/page.tsx +4 -4
  303. package/templates/apps/frontend-saas/src/pages/dashboard/team/page.tsx +3 -4
  304. package/templates/apps/frontend-spa/package.json +9 -7
  305. package/templates/apps/frontend-ssr/package.json +9 -7
  306. package/templates/apps/frontend-ssr-api/package.json +10 -8
  307. package/templates/apps/frontend-static-blog/package.json +8 -6
  308. package/templates/apps/frontend-status/package.json +10 -8
  309. package/templates/apps/mobile-app/README.md +1 -0
  310. package/templates/apps/mobile-app/package.json +4 -2
  311. package/templates/apps/mobile-app/src/app/index.tsx +22 -12
  312. package/templates/apps/mobile-app/src/app/orders/[id].tsx +1 -1
  313. package/templates/apps/mobile-app/src/lib/api.ts +34 -0
  314. package/templates/apps/mobile-app/voltro.mobile.ts +4 -2
  315. package/templates/baselines/bare/.env.example +14 -0
  316. package/templates/baselines/bare/baseline.json +4 -4
  317. package/templates/baselines/compose/.env.example +14 -0
  318. package/templates/baselines/compose/README.md +1 -1
  319. package/templates/baselines/compose/baseline.json +5 -5
  320. package/templates/baselines/compose-mariadb/.env.example +14 -0
  321. package/templates/baselines/compose-mariadb/README.md +1 -1
  322. package/templates/baselines/compose-mariadb/baseline.json +5 -5
  323. package/templates/baselines/helm/.env.example +14 -0
  324. package/templates/baselines/helm/baseline.json +4 -4
  325. package/dist/apiBuild-C-x9YacA.js +0 -2
  326. package/dist/checkCommand-DRovTKza.js +0 -2
  327. package/dist/commands-CJfepbm4.js +0 -11541
  328. package/dist/dbCommand-b1gum4td.js +0 -2
  329. package/dist/dev-iiMtlkfs.js +0 -3
  330. package/dist/devActivity-BhIu6ncs.js +0 -159
  331. package/dist/frameworkTableAssembly-D-EebUQX.js +0 -2
  332. package/dist/inspect-mmBuRXmy.js +0 -2
  333. package/dist/manifestBuild-Dj8Jjoto.js +0 -2
  334. package/dist/seedRunner-Bqxgp7HZ.js +0 -230
  335. package/dist/serveCommand-DdaM4Hup.js +0 -1608
  336. package/dist/start-C0koT0UO.js +0 -1084
  337. /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-CBqFtAKA.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,7 +1849,7 @@ 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();
@@ -2382,8 +1867,8 @@ import {
2382
1867
  }
2383
1868
  if (u) return l;
2384
1869
  };
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" ? [
1870
+ }, Br = async (e, t, n, r = {}) => {
1871
+ 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
1872
  " <script>",
2388
1873
  " (function () {",
2389
1874
  " var root = document.documentElement",
@@ -2421,13 +1906,13 @@ import {
2421
1906
  " </body>",
2422
1907
  "</html>",
2423
1908
  ""
2424
- ].join("\n"), l = p(e, "src", "pages"), { pages: u, dirs: d, orphanedSpecials: f } = await $(l);
2425
- await Dr(l, u);
1909
+ ].join("\n"), l = C(e, "src", "pages"), { pages: u, dirs: d, orphanedSpecials: f } = await $(l);
1910
+ await m(l, u);
2426
1911
  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'`);
1912
+ 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
1913
  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
1914
  let _ = n.map((e) => {
2430
- let t = [`group: ${m(e.name)}`];
1915
+ let t = [`group: ${p(e.name)}`];
2431
1916
  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
1917
  }), v, y, b;
2433
1918
  if (u.length > 0) {
@@ -2437,18 +1922,18 @@ import {
2437
1922
  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
1923
  }
2439
1924
  let i = u.map((e) => {
2440
- let t = Bi(d, e.dirChain).map((e) => {
1925
+ let t = Sr(d, e.dirChain).map((e) => {
2441
1926
  let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
2442
1927
  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
1928
  }).join(",\n");
2444
1929
  return ` makePageRoute(${JSON.stringify(e.pattern)}, ${t.length > 0 ? `[\n${t},\n ]` : "undefined"}),`;
2445
1930
  }), a = d.filter((e) => e.hasNotFound).map((e) => {
2446
- let t = Hi(e.chain), n = Bi(d, e.chain).map((e) => {
1931
+ let t = wr(e.chain), n = Sr(d, e.chain).map((e) => {
2447
1932
  let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
2448
1933
  return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), ` { ${t.join(", ")} }`;
2449
1934
  }).join(",\n"), r = n.length > 0 ? `\n chain: [\n${n},\n ],` : "";
2450
1935
  return ` {\n prefix: ${JSON.stringify(t)},\n Component: refs.notFounds[${JSON.stringify(e.dir)}],${r}\n },`;
2451
- }), s = [], c = [], l = [], f = [], m = [], h = [];
1936
+ }), s = [], c = [], l = [], f = [], p = [], m = [];
2452
1937
  for (let e of d) {
2453
1938
  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
1939
  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 +1948,11 @@ import {
2463
1948
  relPath: n,
2464
1949
  kind: "error",
2465
1950
  slotKey: e.dir
2466
- })), e.hasPending && (m.push(` ${a}: ${Q(e.dir, "Pending")},`), s.push({
1951
+ })), e.hasPending && (p.push(` ${a}: ${Q(e.dir, "Pending")},`), s.push({
2467
1952
  relPath: r,
2468
1953
  kind: "pending",
2469
1954
  slotKey: e.dir
2470
- })), e.hasNotFound && (h.push(` ${a}: ${Q(e.dir, "NotFound")},`), s.push({
1955
+ })), e.hasNotFound && (m.push(` ${a}: ${Q(e.dir, "NotFound")},`), s.push({
2471
1956
  relPath: i,
2472
1957
  kind: "notFound",
2473
1958
  slotKey: e.dir
@@ -2478,16 +1963,16 @@ import {
2478
1963
  kind: "page",
2479
1964
  slotKey: e.pattern
2480
1965
  });
2481
- let x = s.map((e) => ` ${JSON.stringify(e.relPath)},`), S = s.map((e, t) => {
1966
+ let h = s.map((e) => ` ${JSON.stringify(e.relPath)},`), x = s.map((e, t) => {
2482
1967
  let n = JSON.stringify(e.slotKey);
2483
1968
  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 ? [
1969
+ }), 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";
1970
+ 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(", ")}]`);
1971
+ let O = T ? [
2487
1972
  "import { I18nProvider } from '@voltro/i18n'",
2488
1973
  "import { resolveLocale } from '@voltro/i18n/server'",
2489
1974
  "import { useServerRequest } from '@voltro/web'",
2490
- ...C.map((e) => `import i18nCatalog_${e} from '../src/locales/${e}'`)
1975
+ ...S.map((e) => `import i18nCatalog_${e} from '../src/locales/${e}'`)
2491
1976
  ] : [];
2492
1977
  y = [
2493
1978
  "// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
@@ -2532,10 +2017,10 @@ import {
2532
2017
  ...f,
2533
2018
  " },",
2534
2019
  " pendings: {",
2535
- ...m,
2020
+ ...p,
2536
2021
  " },",
2537
2022
  " notFounds: {",
2538
- ...h,
2023
+ ...m,
2539
2024
  " },",
2540
2025
  " pages: {},",
2541
2026
  "}",
@@ -2600,11 +2085,11 @@ import {
2600
2085
  "if (import.meta.hot) {",
2601
2086
  " import.meta.hot.accept(",
2602
2087
  " [",
2603
- ...x,
2088
+ ...h,
2604
2089
  " ],",
2605
2090
  " (newMods: Array<Record<string, unknown> | undefined>) => {",
2606
2091
  " let changed = false",
2607
- ...S,
2092
+ ...x,
2608
2093
  " if (changed) bump()",
2609
2094
  " },",
2610
2095
  " )",
@@ -2624,12 +2109,12 @@ import {
2624
2109
  ...O,
2625
2110
  "import { subscribe, getVersion, buildRoutes, buildNotFounds } from './routeTable'",
2626
2111
  "",
2627
- ...E ? [
2628
- `// i18n auto-wiring (config.locales = [${C.map((e) => JSON.stringify(e)).join(", ")}]).`,
2112
+ ...T ? [
2113
+ `// i18n auto-wiring (config.locales = [${S.map((e) => JSON.stringify(e)).join(", ")}]).`,
2629
2114
  "const I18N_CATALOGS: Record<string, import('@voltro/i18n').MessageCatalog> = {",
2630
- ...C.map((e) => ` ${JSON.stringify(e)}: i18nCatalog_${e},`),
2115
+ ...S.map((e) => ` ${JSON.stringify(e)}: i18nCatalog_${e},`),
2631
2116
  "}",
2632
- `const I18N_SUPPORTED: ReadonlyArray<string> = [${C.map((e) => JSON.stringify(e)).join(", ")}]`,
2117
+ `const I18N_SUPPORTED: ReadonlyArray<string> = [${S.map((e) => JSON.stringify(e)).join(", ")}]`,
2633
2118
  `const I18N_DEFAULT = ${JSON.stringify(D)}`,
2634
2119
  "",
2635
2120
  "const pickI18nLocale = (ssr: ReturnType<typeof useServerRequest>): string => {",
@@ -2681,7 +2166,7 @@ import {
2681
2166
  " const v = useSyncExternalStore(subscribe, getVersion, getVersion)",
2682
2167
  " const routes = useMemo(() => buildRoutes(), [v])",
2683
2168
  " const notFounds = useMemo(() => buildNotFounds(), [v])",
2684
- ...E ? [
2169
+ ...T ? [
2685
2170
  " const ssr = useServerRequest()",
2686
2171
  " const locale = pickI18nLocale(ssr)",
2687
2172
  " const messages = I18N_CATALOGS[locale] ?? I18N_CATALOGS[I18N_DEFAULT]!",
@@ -2699,14 +2184,14 @@ import {
2699
2184
  "// resolved apis map. Side-effect only — no local component definitions —",
2700
2185
  "// so downstream invalidations (user page edits) terminate at app.tsx.",
2701
2186
  "",
2702
- ...ji(t),
2187
+ ...pr(t),
2703
2188
  "import { mount } from '@voltro/web'",
2704
2189
  ...g,
2705
2190
  "import { App } from './app'",
2706
2191
  "import { preloadCurrentRoute } from './routeTable'",
2707
- ...ki(t),
2708
- ...Di(t, o),
2709
- ...Ai(t),
2192
+ ...dr(t),
2193
+ ...lr(t, o),
2194
+ ...fr(t),
2710
2195
  "",
2711
2196
  "// Preload the current route's page chunk BEFORE hydration so the first",
2712
2197
  "// client render matches the SSG/SSR-prerendered HTML. Without it, a lazy",
@@ -2723,10 +2208,10 @@ import {
2723
2208
  " apis: {",
2724
2209
  ..._,
2725
2210
  " },",
2726
- ...Oi(t, o),
2211
+ ...ur(t, o),
2727
2212
  "})",
2728
2213
  "",
2729
- Ui
2214
+ Tr
2730
2215
  ].join("\n");
2731
2216
  } else v = "", y = "", b = [
2732
2217
  "// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
@@ -2734,43 +2219,43 @@ import {
2734
2219
  "// and calls mount(). Side-effect only, no component definitions, so the",
2735
2220
  "// user's component file remains the Fast Refresh boundary.",
2736
2221
  "",
2737
- ...ji(t),
2222
+ ...pr(t),
2738
2223
  "import { mount } from '@voltro/web'",
2739
2224
  ...g,
2740
2225
  "import App from '../src/App'",
2741
- ...ki(t),
2742
- ...Di(t, o),
2743
- ...Ai(t),
2226
+ ...dr(t),
2227
+ ...lr(t, o),
2228
+ ...fr(t),
2744
2229
  "",
2745
2230
  "mount(App, {",
2746
2231
  " apis: {",
2747
2232
  ..._,
2748
2233
  " },",
2749
- ...Oi(t, o),
2234
+ ...ur(t, o),
2750
2235
  "})",
2751
2236
  "",
2752
- Ui
2237
+ Tr
2753
2238
  ].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 = "";
2239
+ let x = C(e, ".framework");
2240
+ 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 }));
2241
+ let S = C(e, ".gitignore"), w = "";
2757
2242
  try {
2758
- C = await O.readFile(S, "utf8");
2243
+ w = await D.readFile(S, "utf8");
2759
2244
  } 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";
2245
+ let T = ["/.framework/"], O = new Set(w.split("\n").map((e) => e.trim())), k = T.filter((e) => !O.has(e));
2246
+ if (k.length > 0) {
2247
+ let e = w === "" || w.endsWith("\n") ? "" : "\n";
2763
2248
  try {
2764
- await O.appendFile(S, `${e}${D.join("\n")}\n`, "utf8");
2249
+ await D.appendFile(S, `${e}${k.join("\n")}\n`, "utf8");
2765
2250
  } 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) });
2251
+ 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
2252
  }
2768
2253
  }
2769
- }, aa = async (e, t) => {
2254
+ }, Vr = async (e, t) => {
2770
2255
  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 = [];
2256
+ let n = C(S(e), "project.json");
2257
+ if (!E(n)) return;
2258
+ let r = await D.readFile(n, "utf8"), i = JSON.parse(r).apps ?? {}, a = e.split("/").filter(Boolean).pop() ?? "", o = [];
2774
2259
  for (let [e, n] of Object.entries(i)) e !== a && n.port === t && o.push(e);
2775
2260
  if (o.length === 0) return;
2776
2261
  Z.warn("sibling app(s) claim the same port — only one boots", {
@@ -2779,72 +2264,79 @@ import {
2779
2264
  projectJson: n
2780
2265
  });
2781
2266
  } 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");
2267
+ }, Hr = (e) => C(e, ".framework", "dist", "server", "appConfig.js"), Ur = async (e, t = {}) => {
2268
+ let n = Hr(e), r = t.preferSource !== !0 && E(n) ? n : C(e, "app.config.ts");
2784
2269
  try {
2785
- let e = (await import(_(r).href)).default;
2270
+ let e = (await import(P(r).href)).default;
2786
2271
  return typeof e == "object" && e && "type" in e && e.type === "web" ? e : null;
2787
2272
  } catch {
2788
2273
  return null;
2789
2274
  }
2790
- }, ca = async (e) => {
2791
- let t = await sa(e, { preferSource: !0 });
2792
- if (!t) return {
2275
+ }, Wr = async (e) => {
2276
+ let r = await Ur(e, { preferSource: !0 });
2277
+ if (!r) return {
2793
2278
  ran: !1,
2794
2279
  exitCode: 0
2795
2280
  };
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", {
2281
+ on();
2282
+ let i = bt();
2283
+ Rt(i), Z.info("booting voltro dev (web)", { app: r.name ?? "(unnamed)" }), He(e, Z);
2284
+ let m = await Pr(e, r);
2285
+ for (let e of m) Z.info("api wired", {
2801
2286
  name: e.name,
2802
2287
  pkg: e.pkg,
2803
2288
  ...e.proxyTarget ? { proxyTo: e.proxyTarget } : { directWs: e.browserWsUrl }
2804
2289
  });
2805
- Fe(e).then((e) => {
2290
+ d(e).then((e) => {
2806
2291
  for (let t of e.files) if (t.action === "created") {
2807
2292
  let e = t.path.split("/").pop() ?? t.path;
2808
2293
  Z.info(`${e} seeded`, { path: t.path });
2809
2294
  }
2810
2295
  }).catch(() => {});
2811
- let { resolved: d } = await ot({
2812
- rawEnv: t.env,
2296
+ let { resolved: h } = await _e({
2297
+ rawEnv: r.env,
2813
2298
  appType: "web",
2814
2299
  root: e,
2815
2300
  log: Z,
2816
2301
  generateTypes: !0
2817
- }), f = d.publicValues;
2818
- await ia(e, t, r, f), Z.debug("generated framework entry files", { files: [
2302
+ }), S = h.publicValues;
2303
+ await Br(e, r, m, S), Z.debug("generated framework entry files", { files: [
2819
2304
  "index.html",
2820
2305
  ".framework/main.tsx",
2821
- ...t.env ? [".framework/env.public.ts"] : []
2306
+ ...r.env ? [".framework/env.public.ts"] : []
2822
2307
  ] });
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: _,
2308
+ let O = n({
2309
+ kind: "web",
2310
+ configPort: r.port,
2311
+ env: process.env,
2312
+ dashboardPin: process.env[Sn] === "1"
2313
+ });
2314
+ for (let e of O.warnings) Z.warn(e);
2315
+ let k = O.port, A = r.name ?? "unnamed", j = y("web", A, k), M = b(A);
2316
+ await g({
2317
+ id: j,
2318
+ name: A,
2827
2319
  kind: "web",
2828
- url: `http://localhost:${g}`,
2320
+ url: `http://localhost:${k}`,
2829
2321
  pid: process.pid,
2830
2322
  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) => ({
2323
+ logFile: M.path
2324
+ }).catch(() => {}), await Vr(e, k);
2325
+ let { pages: N, dirs: P } = await $(C(e, "src", "pages")), F = {
2326
+ dirs: P,
2327
+ ssrRoutes: Dr(N)
2328
+ }, I = P.map((e) => ({
2837
2329
  dir: e.dir,
2838
2330
  hasLayout: e.hasLayout,
2839
2331
  hasError: e.hasError,
2840
2332
  hasPending: e.hasPending,
2841
2333
  hasNotFound: e.hasNotFound
2842
- })), E = await sn({
2334
+ })), R = await ft({
2843
2335
  appRoot: e,
2844
- pages: b
2336
+ pages: N
2845
2337
  });
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([
2338
+ R.wrote && Z.debug("routes codegen wrote", { path: w(e, R.path) });
2339
+ 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
2340
  ".framework",
2849
2341
  "node_modules",
2850
2342
  "dist",
@@ -2852,120 +2344,107 @@ import {
2852
2344
  ".vite",
2853
2345
  ".turbo",
2854
2346
  ".cache"
2855
- ]), ee = {
2347
+ ]), ne = {
2856
2348
  name: "framework:watch-app-sources",
2857
2349
  async configureServer(t) {
2858
2350
  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);
2351
+ let n = (await D.readdir(e, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !H.has(e.name));
2352
+ for (let r of n) t.watcher.add(C(e, r.name));
2353
+ n.length === 0 && t.watcher.add(te);
2862
2354
  } catch {
2863
- t.watcher.add(M);
2355
+ t.watcher.add(te);
2864
2356
  }
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 {}
2357
+ for (let n of await Se(e)) t.watcher.add(n.dir);
2879
2358
  }
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) => {
2359
+ }, 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
2360
  try {
2882
- let i = Date.now();
2883
- await ia(e, t, r, f);
2884
- let { pages: a, dirs: o } = await $(P);
2885
- await sn({
2361
+ let n = Date.now();
2362
+ await Br(e, r, m, S);
2363
+ let { pages: i, dirs: a } = await $(U);
2364
+ await ft({
2886
2365
  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
2366
+ pages: i
2367
+ }), F.dirs = a, F.ssrRoutes = Dr(i), Z.info("page tree regenerated", {
2368
+ reason: t,
2369
+ ms: Date.now() - n,
2370
+ routes: F.ssrRoutes.length
2892
2371
  });
2893
2372
  } catch (e) {
2894
- Z.error("page tree regen failed", { reason: n }, e);
2373
+ Z.error("page tree regen failed", { reason: t }, e);
2895
2374
  }
2896
- }, L = {
2375
+ }, oe = {
2897
2376
  name: "framework:regenerate-on-page-tree-change",
2898
2377
  configureServer(t) {
2899
2378
  let n = null, r = [], i = (e) => {
2900
2379
  r.push(e), n && clearTimeout(n), n = setTimeout(() => {
2901
2380
  n = null;
2902
2381
  let e = r.length === 1 ? r[0] : `${r.length} events (${r[0]}, …)`;
2903
- r.length = 0, te(e);
2382
+ r.length = 0, ae(e);
2904
2383
  }, 50);
2905
2384
  };
2906
2385
  t.watcher.on("add", (t) => {
2907
- F(t) && i(`add ${m(e, t)}`);
2386
+ W(t) && i(`add ${w(e, t)}`);
2908
2387
  }), t.watcher.on("unlink", (t) => {
2909
- F(t) && i(`unlink ${m(e, t)}`);
2388
+ W(t) && i(`unlink ${w(e, t)}`);
2910
2389
  }), t.watcher.on("addDir", (t) => {
2911
- I(t) && i(`addDir ${m(e, t)}`);
2390
+ ie(t) && i(`addDir ${w(e, t)}`);
2912
2391
  }), t.watcher.on("unlinkDir", (t) => {
2913
- I(t) && i(`unlinkDir ${m(e, t)}`);
2392
+ ie(t) && i(`unlinkDir ${w(e, t)}`);
2914
2393
  });
2915
2394
  }
2916
- }, R = p(e, "app.config.ts"), ne = (e) => {
2917
- if (!ae(e.env)) return "";
2395
+ }, G = C(e, "app.config.ts"), K = (e) => {
2396
+ if (!re(e.env)) return "";
2918
2397
  let t = Object.entries(e.env.vars).map(([e, t]) => `${e}:${t.access}`).sort();
2919
2398
  return `${String(e.env.publicPrefix)}|${t.join(",")}`;
2920
- }, re = (e, t) => {
2399
+ }, le = (e, t) => {
2921
2400
  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 = {
2401
+ 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;
2402
+ }, ue = r, de = T(G), pe = {
2924
2403
  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 () => {
2404
+ async configureServer(n) {
2405
+ n.watcher.add(G), Z.info("watching app.config.ts for changes", { path: w(e, G) });
2406
+ let r = async () => {
2928
2407
  try {
2929
2408
  try {
2930
- let e = t.moduleGraph.getModuleById(R);
2931
- e && t.moduleGraph.invalidateModule(e);
2409
+ let e = n.moduleGraph.getModuleById(G);
2410
+ e && n.moduleGraph.invalidateModule(e);
2932
2411
  } catch {}
2933
- let e = (await t.ssrLoadModule(R, { fixStacktrace: !0 })).default;
2412
+ let e = (await n.ssrLoadModule(G, { fixStacktrace: !0 })).default;
2934
2413
  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
2414
  } catch (e) {
2936
2415
  return Z.warn("app.config.ts re-load failed — ignoring this change", {}, e), null;
2937
2416
  }
2938
- }, r = null, i = () => {
2939
- r && clearTimeout(r), r = setTimeout(() => {
2940
- r = null, a();
2417
+ }, i = null, a = () => {
2418
+ i && clearTimeout(i), i = setTimeout(() => {
2419
+ i = null, o();
2941
2420
  }, 100);
2942
- }, a = async () => {
2943
- let r = await n();
2944
- if (!r) {
2421
+ }, o = async () => {
2422
+ let t = await r();
2423
+ if (!t) {
2945
2424
  Z.info("app.config.ts onConfigChange: load returned null — skipping");
2946
2425
  return;
2947
2426
  }
2948
2427
  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)) {
2428
+ theme: t.theme,
2429
+ port: t.port,
2430
+ name: t.name
2431
+ }), JSON.stringify(t) === JSON.stringify(ue)) {
2953
2432
  Z.info("app.config.ts onConfigChange: parsed config unchanged — skipping (no-op edit?)");
2954
2433
  return;
2955
2434
  }
2956
- let i = re(z, r);
2435
+ let i = le(ue, t);
2957
2436
  if (i.length > 0) {
2958
2437
  Z.warn("app.config.ts changed — hard restart required", { fields: i });
2959
2438
  try {
2960
- await t.close();
2439
+ await n.close();
2961
2440
  } catch {}
2962
- let e = fe(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
2441
+ let e = ce(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
2963
2442
  stdio: "inherit",
2964
2443
  env: process.env,
2965
2444
  cwd: process.cwd()
2966
- }), n = (t) => {
2445
+ }), t = (t) => {
2967
2446
  e.kill(t);
2968
- }, r = () => n("SIGINT"), a = () => n("SIGTERM");
2447
+ }, r = () => t("SIGINT"), a = () => t("SIGTERM");
2969
2448
  process.on("SIGINT", r), process.on("SIGTERM", a), e.on("exit", (e, t) => {
2970
2449
  process.off("SIGINT", r), process.off("SIGTERM", a), t ? process.kill(process.pid, t) : process.exit(e ?? 0);
2971
2450
  }), e.on("error", (e) => {
@@ -2974,52 +2453,52 @@ import {
2974
2453
  return;
2975
2454
  }
2976
2455
  try {
2977
- let n = Date.now();
2978
- await ia(e, r, await Qi(e, r)), z = r, t.ws && t.ws.send({
2456
+ let r = Date.now();
2457
+ await Br(e, t, await Pr(e, t)), ue = t, n.ws && n.ws.send({
2979
2458
  type: "full-reload",
2980
2459
  path: "*"
2981
2460
  }), Z.info("app.config.ts soft-regen", {
2982
- ms: Date.now() - n,
2461
+ ms: Date.now() - r,
2983
2462
  reload: "full"
2984
2463
  });
2985
2464
  } catch (e) {
2986
2465
  Z.error("app.config.ts soft-regen failed", {}, e);
2987
2466
  }
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());
2467
+ }, s = (e) => x(e) === "app.config.ts" ? e === G || T(e) === de : !1;
2468
+ n.watcher.on("change", (e) => {
2469
+ s(e) && (Z.info("app.config.ts change event (chokidar)", { file: e }), a());
2470
+ }), n.watcher.on("add", (e) => {
2471
+ s(e) && (Z.info("app.config.ts add event (chokidar)", { file: e }), a());
2993
2472
  });
2994
2473
  try {
2995
2474
  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());
2475
+ e(G, { interval: 500 }, (e, t) => {
2476
+ e.mtimeMs !== t.mtimeMs && (Z.info("app.config.ts change event (poll)", { mtime: e.mtimeMs }), a());
2998
2477
  }), Z.info("app.config.ts polling watcher attached", { intervalMs: 500 });
2999
2478
  } catch (e) {
3000
2479
  Z.warn("app.config.ts polling watcher could not attach", {}, e);
3001
2480
  }
3002
- yt(gt, Z, {
2481
+ we(t, Z, {
3003
2482
  root: e,
3004
- onBeforeRestart: () => t.close()
2483
+ onBeforeRestart: () => n.close()
3005
2484
  });
3006
2485
  }
3007
- }, V = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, oe = 0, se = {
2486
+ }, me = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, q = 0, he = {
3008
2487
  name: "framework:suppress-api-hmr",
3009
2488
  handleHotUpdate(e) {
3010
- if (oe += 1, V.test(e.file)) return [];
2489
+ if (q += 1, me.test(e.file)) return [];
3011
2490
  }
3012
- }, ce = {
2491
+ }, ge = {
3013
2492
  name: "framework:reoptimize-on-rpcgroup-change",
3014
2493
  async configureServer(t) {
3015
2494
  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");
2495
+ for (let r of m) {
2496
+ if (!r.proxyTarget) continue;
2497
+ let i = await kr(e, r.pkg);
2498
+ if (!i) continue;
2499
+ let a = C(i, "rpcGroup.generated.ts");
3021
2500
  try {
3022
- n.set(a, await O.readFile(a, "utf8"));
2501
+ n.set(a, await D.readFile(a, "utf8"));
3023
2502
  } catch {
3024
2503
  n.set(a, "");
3025
2504
  }
@@ -3028,94 +2507,94 @@ import {
3028
2507
  } catch {}
3029
2508
  }
3030
2509
  if (n.size === 0) return;
3031
- let i = null, a = !1, o = async () => {
3032
- if (a) return;
2510
+ let r = null, i = !1, a = async () => {
2511
+ if (i) return;
3033
2512
  let r = null;
3034
2513
  for (let [e, t] of n) {
3035
2514
  let i;
3036
2515
  try {
3037
- i = await O.readFile(e, "utf8");
2516
+ i = await D.readFile(e, "utf8");
3038
2517
  } catch {
3039
2518
  continue;
3040
2519
  }
3041
2520
  i !== t && (n.set(e, i), r = e);
3042
2521
  }
3043
2522
  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)`);
2523
+ i = !0, Z.info(`rpcGroup changed (${w(e, r)}) — re-bundling the api client + reloading (descriptor edits propagate automatically; no manual restart needed)`);
3045
2524
  try {
3046
- await O.rm(p(j, ".vite", "deps"), {
2525
+ await D.rm(C(V, ".vite", "deps"), {
3047
2526
  recursive: !0,
3048
2527
  force: !0
3049
2528
  }), await t.restart(!0);
3050
2529
  } catch (e) {
3051
- a = !1, Z.error("rpcGroup re-optimize failed", {}, e);
2530
+ i = !1, Z.error("rpcGroup re-optimize failed", {}, e);
3052
2531
  }
3053
2532
  }
3054
- }, s = (e) => {
3055
- n.has(h(e)) && (i && clearTimeout(i), i = setTimeout(() => {
3056
- o();
2533
+ }, o = (e) => {
2534
+ n.has(T(e)) && (r && clearTimeout(r), r = setTimeout(() => {
2535
+ a();
3057
2536
  }, 120));
3058
2537
  };
3059
- t.watcher.on("change", s), t.watcher.on("add", s);
2538
+ t.watcher.on("change", o), t.watcher.on("add", o);
3060
2539
  }
3061
- }, H = {}, le = (e) => (t) => {
2540
+ }, J = {}, ve = (e) => (t) => {
3062
2541
  t.on("proxyReq", (t, n) => {
3063
- Qn(t, n, {
2542
+ rn(t, n, {
3064
2543
  target: e,
3065
2544
  token: process.env.VOLTRO_INSPECT_TOKEN,
3066
2545
  writeToken: process.env.VOLTRO_INSPECT_WRITE_TOKEN,
3067
- isLoopback: i
2546
+ isLoopback: l
3068
2547
  });
3069
2548
  });
3070
2549
  };
3071
- for (let e of r) {
2550
+ for (let e of m) {
3072
2551
  if (!e.proxyTarget) continue;
3073
- H[e.browserWsUrl] = {
2552
+ J[e.browserWsUrl] = {
3074
2553
  target: e.proxyTarget,
3075
2554
  ws: !0,
3076
2555
  changeOrigin: !0,
3077
2556
  ...e.wsPath ? {} : { rewrite: () => "/ws" }
3078
2557
  };
3079
2558
  let t = e.proxyTarget.replace(/^ws/, "http");
3080
- H[`/_voltro/api/${e.name}`] = {
2559
+ J[`/_voltro/api/${e.name}`] = {
3081
2560
  target: t,
3082
2561
  changeOrigin: !0,
3083
2562
  rewrite: (t) => t.replace(RegExp(`^/_voltro/api/${e.name}`), ""),
3084
- configure: le(t)
2563
+ configure: ve(t)
3085
2564
  };
3086
2565
  }
3087
- for (let [e, n] of Object.entries(t.proxies ?? {})) {
3088
- if (H[e]) {
2566
+ for (let [e, t] of Object.entries(r.proxies ?? {})) {
2567
+ if (J[e]) {
3089
2568
  Z.warn("user proxy ignored — prefix already claimed by an api ws proxy", { prefix: e });
3090
2569
  continue;
3091
2570
  }
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}`, {
2571
+ J[e] = {
2572
+ target: t.target,
2573
+ changeOrigin: t.changeOrigin ?? !0,
2574
+ ...t.rewrite === void 0 ? {} : { rewrite: (n) => n.replace(RegExp(`^${e}`), t.rewrite) }
2575
+ }, Z.info(`proxy ${e} → ${t.target}`, {
3097
2576
  prefix: e,
3098
- target: n.target,
3099
- ...n.rewrite === void 0 ? {} : { rewrite: n.rewrite }
2577
+ target: t.target,
2578
+ ...t.rewrite === void 0 ? {} : { rewrite: t.rewrite }
3100
2579
  });
3101
2580
  }
3102
- let ue = {
2581
+ let be = {
3103
2582
  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({
2583
+ configureServer(t) {
2584
+ let n = null, d = async () => {
2585
+ if (n !== null) return n;
2586
+ let r = [];
2587
+ for (let n of N) try {
2588
+ let i = await t.ssrLoadModule(C(e, "src", "pages", n.file));
2589
+ r.push({
3111
2590
  pattern: n.pattern,
3112
2591
  file: n.file,
3113
2592
  dirChain: n.dirChain,
3114
- renderMode: yr(i, p("src", "pages", n.file)),
2593
+ renderMode: f(i, C("src", "pages", n.file)),
3115
2594
  interactive: i.interactive ?? "full",
3116
2595
  tenantAware: i.tenantAware === !0,
3117
- revalidateMs: J(i.revalidate),
3118
- staleWhileRevalidateMs: J(i.staleWhileRevalidate) ?? 0,
2596
+ revalidateMs: p(i.revalidate),
2597
+ staleWhileRevalidateMs: p(i.staleWhileRevalidate) ?? 0,
3119
2598
  cacheInvalidatesOn: Array.isArray(i.cacheInvalidatesOn) ? i.cacheInvalidatesOn : [],
3120
2599
  hasLoader: typeof i.loader == "function",
3121
2600
  hasMeta: i.meta != null,
@@ -3124,83 +2603,83 @@ import {
3124
2603
  } catch (e) {
3125
2604
  Z.warn("inspect: failed to load page metadata", { pattern: n.pattern }, e);
3126
2605
  }
3127
- return u = t, t;
2606
+ return n = r, r;
3128
2607
  };
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();
2608
+ t.middlewares.use((e, t, n) => {
2609
+ let r = e.url ?? "/";
2610
+ if (r.startsWith("/_voltro/inspect") || r.startsWith("/api/dashboard/proxy")) return n();
3132
2611
  let a = Date.now(), o = t.end.bind(t);
3133
2612
  t.end = ((...e) => {
3134
2613
  try {
3135
- n.emit("request", {
3136
- url: i.split("?")[0],
2614
+ i.emit("request", {
2615
+ url: r.split("?")[0],
3137
2616
  status: t.statusCode ?? 0,
3138
2617
  durationMs: Date.now() - a
3139
2618
  });
3140
2619
  } catch {}
3141
2620
  return o(...e);
3142
- }), r();
3143
- }), r.middlewares.use((t, n, r) => {
2621
+ }), n();
2622
+ }), t.middlewares.use((t, n, r) => {
3144
2623
  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") {
2624
+ let { pathname: i } = zn(t.url ?? "/");
2625
+ if (i !== "/robots.txt" || E(C(e, "public", "robots.txt"))) return r();
2626
+ n.statusCode = 200, n.setHeader("Content-Type", "text/plain; charset=utf-8"), n.end(vt({ indexable: !1 }));
2627
+ }), r.name === "voltroDashboard" && t.middlewares.use(async (e, t, n) => {
2628
+ let r = e.url ?? "", i = r.split("?")[0];
2629
+ if (i === "/api/dashboard/proxy") {
3151
2630
  let n = new URL(r, "http://x").searchParams.get("target");
3152
2631
  if (!n) {
3153
2632
  t.statusCode = 400, t.end("missing ?target=");
3154
2633
  return;
3155
2634
  }
3156
- if (!o(n)) {
2635
+ if (!u(n)) {
3157
2636
  t.statusCode = 400, t.end("target not allowed: must be loopback or an origin configured in VOLTRO_DASHBOARD_APPS");
3158
2637
  return;
3159
2638
  }
3160
2639
  try {
3161
2640
  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;
2641
+ e.headers.authorization ? r.authorization = String(e.headers.authorization) : l(n) && process.env.VOLTRO_INSPECT_TOKEN && (r.authorization = `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}`);
2642
+ let i;
3164
2643
  if (e.method && e.method !== "GET" && e.method !== "HEAD") {
3165
2644
  let t = [];
3166
2645
  for await (let n of e) t.push(n);
3167
- a = Buffer.concat(t);
2646
+ i = Buffer.concat(t);
3168
2647
  let n = e.headers["content-type"];
3169
2648
  n && (r["content-type"] = Array.isArray(n) ? n[0] : String(n));
3170
2649
  }
3171
- let o = await fetch(n, {
2650
+ let a = await fetch(n, {
3172
2651
  redirect: "manual",
3173
2652
  ...e.method ? { method: e.method } : {},
3174
2653
  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);
2654
+ ...i && i.length ? { body: new Uint8Array(i.buffer, i.byteOffset, i.byteLength) } : {}
2655
+ }), o = Buffer.from(await a.arrayBuffer());
2656
+ 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
2657
  } catch (e) {
3179
2658
  t.statusCode = 502, t.end(`proxy error: ${e.message}`);
3180
2659
  }
3181
2660
  return;
3182
2661
  }
3183
- if (a === "/api/dashboard/proxy/stream") {
2662
+ if (i === "/api/dashboard/proxy/stream") {
3184
2663
  let n = new URL(r, "http://x").searchParams.get("target");
3185
2664
  if (!n) {
3186
2665
  t.statusCode = 400, t.end("missing ?target=");
3187
2666
  return;
3188
2667
  }
3189
- if (!o(n)) {
2668
+ if (!u(n)) {
3190
2669
  t.statusCode = 400, t.end("target not allowed: must be loopback or an origin configured in VOLTRO_DASHBOARD_APPS");
3191
2670
  return;
3192
2671
  }
3193
- let a = new AbortController();
3194
- e.on("close", () => a.abort()), t.on("close", () => a.abort());
2672
+ let i = new AbortController();
2673
+ e.on("close", () => i.abort()), t.on("close", () => i.abort());
3195
2674
  try {
3196
2675
  let r = await fetch(n, {
3197
2676
  redirect: "manual",
3198
2677
  method: "GET",
3199
2678
  headers: {
3200
2679
  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}` } : {}
2680
+ ...e.headers.authorization ? { authorization: String(e.headers.authorization) } : l(n) && process.env.VOLTRO_INSPECT_TOKEN ? { authorization: `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}` } : {}
3202
2681
  },
3203
- signal: a.signal
2682
+ signal: i.signal
3204
2683
  });
3205
2684
  if (!r.ok || !r.body) {
3206
2685
  t.statusCode = r.status, t.end(`upstream ${r.status}`);
@@ -3212,15 +2691,15 @@ import {
3212
2691
  connection: "keep-alive",
3213
2692
  "x-accel-buffering": "no"
3214
2693
  });
3215
- let o = r.body.getReader();
2694
+ let a = r.body.getReader();
3216
2695
  try {
3217
2696
  for (;;) {
3218
- let { done: e, value: n } = await o.read();
2697
+ let { done: e, value: n } = await a.read();
3219
2698
  if (e) break;
3220
2699
  n && t.write(Buffer.from(n));
3221
2700
  }
3222
2701
  } finally {
3223
- o.releaseLock(), t.end();
2702
+ a.releaseLock(), t.end();
3224
2703
  }
3225
2704
  } catch (e) {
3226
2705
  e.name !== "AbortError" && (t.statusCode = 502, t.end(`proxy stream error: ${e.message}`));
@@ -3228,86 +2707,86 @@ import {
3228
2707
  return;
3229
2708
  }
3230
2709
  n();
3231
- }), r.middlewares.use(async (e, r, i) => {
3232
- let o = e.url ?? "";
3233
- if (!o.startsWith("/_voltro/inspect")) return i();
2710
+ }), t.middlewares.use(async (e, t, n) => {
2711
+ let l = e.url ?? "";
2712
+ if (!l.startsWith("/_voltro/inspect")) return n();
3234
2713
  let u = {};
3235
2714
  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);
2715
+ let f = l.split("?")[0];
2716
+ if (e.method === "GET" && (f === "/_voltro/inspect/logs" || l.startsWith("/_voltro/inspect/logs?"))) {
2717
+ let e = o(u.origin), n = Zt(l, Nt(), u);
2718
+ t.statusCode = n.status, t.setHeader("content-type", n.contentType);
2719
+ for (let [n, r] of Object.entries(e)) t.setHeader(n, r);
2720
+ t.end(n.body);
3242
2721
  return;
3243
2722
  }
3244
2723
  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)" }));
2724
+ let n = o(u.origin);
2725
+ if (a()) {
2726
+ t.statusCode = 503, t.setHeader("content-type", "application/json");
2727
+ for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
2728
+ t.end(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }));
3250
2729
  return;
3251
2730
  }
3252
- let i = "";
2731
+ let r = "";
3253
2732
  e.setEncoding("utf-8"), e.on("data", (e) => {
3254
- i += e;
2733
+ r += e;
3255
2734
  }), 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);
2735
+ let e = Gt(r, i);
2736
+ t.statusCode = e.status, t.setHeader("content-type", e.contentType);
2737
+ for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
2738
+ t.end(e.body);
3260
2739
  }), e.on("error", () => {
3261
- r.statusCode = 400, r.setHeader("content-type", "application/json"), r.end(JSON.stringify({ error: "read failed" }));
2740
+ t.statusCode = 400, t.setHeader("content-type", "application/json"), t.end(JSON.stringify({ error: "read failed" }));
3262
2741
  });
3263
2742
  return;
3264
2743
  }
3265
2744
  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)" }));
2745
+ let n = o(u.origin);
2746
+ if (a()) {
2747
+ t.statusCode = 503, t.setHeader("content-type", "application/json");
2748
+ for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
2749
+ t.end(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }));
3271
2750
  return;
3272
2751
  }
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({
2752
+ let r = s(u, "GET");
2753
+ if (!r.ok) {
2754
+ t.statusCode = 401, t.setHeader("content-type", "application/json");
2755
+ for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
2756
+ t.end(JSON.stringify({
3278
2757
  error: "unauthorized",
3279
- reason: i.reason
2758
+ reason: r.reason
3280
2759
  }));
3281
2760
  return;
3282
2761
  }
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) => {
2762
+ 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");
2763
+ for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
2764
+ t.flushHeaders?.(), t.write("retry: 5000\n\n");
2765
+ let c = l.indexOf("?");
2766
+ if (!(c !== -1 && new URLSearchParams(l.slice(c + 1)).get("live") === "1")) for (let e of i.buffered()) t.write(xt(e));
2767
+ let d = i.subscribe((e) => {
3289
2768
  try {
3290
- r.write(gn(e));
2769
+ t.write(xt(e));
3291
2770
  } catch {}
3292
2771
  }), f = setInterval(() => {
3293
2772
  try {
3294
- r.write(_n());
2773
+ t.write(St());
3295
2774
  } catch {}
3296
2775
  }, 15e3), p = () => {
3297
2776
  clearInterval(f), d();
3298
2777
  };
3299
- e.on("close", p), r.on("close", p);
2778
+ e.on("close", p), t.on("close", p);
3300
2779
  return;
3301
2780
  }
3302
2781
  try {
3303
- let n = l(o, {
2782
+ let i = c(l, {
3304
2783
  kind: "web",
3305
2784
  meta: {
3306
- name: t.name ?? "(unnamed)",
3307
- voltroVersion: Ti,
3308
- port: g,
2785
+ name: r.name ?? "(unnamed)",
2786
+ voltroVersion: sr,
2787
+ port: k,
3309
2788
  mode: "dev",
3310
- apis: Object.entries(t.apis ?? {}).map(([e, t]) => {
2789
+ apis: Object.entries(r.apis ?? {}).map(([e, t]) => {
3311
2790
  let n = {
3312
2791
  name: e,
3313
2792
  package: t.package
@@ -3316,42 +2795,42 @@ import {
3316
2795
  })
3317
2796
  },
3318
2797
  routes: await d(),
3319
- dirs: w,
2798
+ dirs: I,
3320
2799
  cache: () => ({
3321
2800
  backend: "memory",
3322
2801
  size: 0,
3323
2802
  entries: []
3324
2803
  }),
3325
- env: () => ct(t.name ?? "app", { contract: ae(t.env) ? t.env : void 0 })
2804
+ env: () => ye(r.name ?? "app", { contract: re(r.env) ? r.env : void 0 })
3326
2805
  }, 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);
2806
+ if (i === null) return n();
2807
+ t.statusCode = i.status, t.setHeader("content-type", i.contentType);
2808
+ for (let [e, n] of Object.entries(i.headers ?? {})) t.setHeader(e, n);
2809
+ t.end(i.body);
3331
2810
  } catch (e) {
3332
- r.statusCode = 500, r.setHeader("content-type", "text/plain"), r.end(`inspect handler error: ${e.message}`);
2811
+ t.statusCode = 500, t.setHeader("content-type", "text/plain"), t.end(`inspect handler error: ${e.message}`);
3333
2812
  }
3334
2813
  });
3335
2814
  }
3336
- }, pe = t.name === "voltroDashboard" ? {
2815
+ }, xe = r.name === "voltroDashboard" ? {
3337
2816
  name: "framework:dashboard-registry",
3338
2817
  configureServer(e) {
3339
2818
  e.middlewares.use(async (e, t, n) => {
3340
2819
  if (!(e.url ?? "").startsWith("/api/dashboard/registry")) return n();
3341
2820
  try {
3342
- let e = await Ke();
2821
+ let e = await _();
3343
2822
  t.statusCode = 200, t.setHeader("content-type", "application/json; charset=utf-8"), t.end(JSON.stringify(e));
3344
2823
  } catch (e) {
3345
2824
  t.statusCode = 500, t.setHeader("content-type", "text/plain"), t.end(`registry read error: ${e.message}`);
3346
2825
  }
3347
2826
  });
3348
2827
  }
3349
- } : null, me = /* @__PURE__ */ new Set(), U = (e, t, n, r, i, a = !1) => {
3350
- let o = ui(i, a, t) ?? "";
2828
+ } : null, Ce = /* @__PURE__ */ new Set(), Te = (e, t, n, r, i, a = !1) => {
2829
+ let o = Kn(i, a, t) ?? "";
3351
2830
  if (Z.error(`${t} render failed`, {
3352
2831
  pathname: n,
3353
2832
  pattern: r,
3354
- cause: yn(i) + o
2833
+ cause: wt(i) + o
3355
2834
  }), e.headersSent) {
3356
2835
  e.end();
3357
2836
  return;
@@ -3359,12 +2838,12 @@ import {
3359
2838
  e.writeHead(500, {
3360
2839
  "content-type": "text/plain; charset=utf-8",
3361
2840
  "x-voltro-rendered-by": `${t}-failed`,
3362
- "x-voltro-ssr-generation": String(oe)
2841
+ "x-voltro-ssr-generation": String(q)
3363
2842
  });
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,
2843
+ 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`;
2844
+ e.end(`${t} render failed for ${n}\n\n${wt(i)}\n${o}\n${s}`);
2845
+ }, Ee = et(), De = nt({
2846
+ limit: Ee,
3368
2847
  onColdStart: (e) => Z.debug("ssr cold-compile start", { id: e }),
3369
2848
  onColdEnd: (e, { durationMs: t, failed: n }) => Z.debug(`ssr cold-compile ${n ? "FAILED" : "end"} ${t}ms`, {
3370
2849
  id: e,
@@ -3372,85 +2851,85 @@ import {
3372
2851
  ...n ? { failed: !0 } : {}
3373
2852
  })
3374
2853
  });
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 = {
2854
+ Z.debug(`ssr cold-compile concurrency ${Ee}`, { concurrency: Ee });
2855
+ let Oe = null, ke = async () => (Oe === null && (Oe = await D.readFile(C(e, ".framework", "index.html"), "utf8")), Oe), Ae = {
3377
2856
  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));
2857
+ configureServer(t) {
2858
+ let n = (e) => De.load(e, async () => await t.ssrLoadModule(e)), i, a = !1, o = () => {
2859
+ if (i !== void 0) return i;
2860
+ let t = r.locales ?? [], o = r.defaultLocale ?? t[0] ?? "en";
2861
+ return t.length === 0 ? (i = Promise.resolve(() => void 0), i) : (i = (async () => {
2862
+ let [{ makeSsgWrap: r }, { makeSsrI18nResolver: i }] = await Promise.all([n("@voltro/i18n"), n("@voltro/i18n/server")]), s = {};
2863
+ for (let i of t) if (E(C(e, "src", "locales", `${i}.ts`))) try {
2864
+ let t = (await n(C(e, "src", "locales", `${i}.ts`))).default;
2865
+ t !== void 0 && (s[i] = r(i, t, o));
3387
2866
  } catch (e) {
3388
- Z.warn("locale catalog failed to load for SSR", { locale: a }, e);
2867
+ Z.warn("locale catalog failed to load for SSR", { locale: i }, e);
3389
2868
  }
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) => ({
2869
+ if (a = Object.keys(s).length > 0, Object.keys(s).length === 0) {
2870
+ let { resolveLocale: e } = await n("@voltro/i18n/server");
2871
+ return (n, r) => ({
3393
2872
  locale: e({
3394
- cookieHeader: t ?? null,
3395
- acceptLanguageHeader: i ?? null,
3396
- supported: n,
3397
- defaultLocale: r
2873
+ cookieHeader: n ?? null,
2874
+ acceptLanguageHeader: r ?? null,
2875
+ supported: t,
2876
+ defaultLocale: o
3398
2877
  }),
3399
2878
  outerWrap: (e) => e
3400
2879
  });
3401
2880
  }
3402
- return a({
2881
+ return i({
3403
2882
  wraps: s,
3404
- supported: n,
3405
- defaultLocale: r
2883
+ supported: t,
2884
+ defaultLocale: o
3406
2885
  });
3407
- })(), a);
2886
+ })(), i);
3408
2887
  };
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
2888
+ t.middlewares.use(async (i, s, c) => {
2889
+ if (i.method !== "GET" && i.method !== "HEAD") return c();
2890
+ let l = i.url ?? "/";
2891
+ l.indexOf("?");
2892
+ let { pathname: u, search: d } = zn(l);
2893
+ 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();
2894
+ let p = Or(u, F.ssrRoutes);
2895
+ if (!p) return c();
2896
+ let h = !Ce.has(p.route.pattern), g = Date.now();
2897
+ h && Z.info(`ssr compiling ${p.route.pattern}`, {
2898
+ pattern: p.route.pattern,
2899
+ pathname: u
3421
2900
  });
3422
2901
  let _ = {}, v = async (e, t) => {
3423
2902
  let n = Date.now(), r = await t();
3424
2903
  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)) {
2904
+ }, y = async (e, n, r) => {
2905
+ let i = await t.moduleGraph.getModuleById(e);
2906
+ if (!(!i || n.has(e))) {
2907
+ if (n.add(e), i.id && /\.(css|sass|scss|less|stylus|pcss|postcss)(\?|$)/.test(i.id)) {
3429
2908
  let e = i.url.replace(/\?.*$/, "");
3430
2909
  r.includes(e) || r.push(e);
3431
2910
  return;
3432
2911
  }
3433
- for (let e of i.importedModules ?? []) e.id && await y(e.id, t, r);
2912
+ for (let e of i.importedModules ?? []) e.id && await y(e.id, n, r);
3434
2913
  }
3435
2914
  }, b = !1;
3436
2915
  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();
2916
+ 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);
2917
+ if (S !== "ssr" && S !== "isr" && !T) return c();
3439
2918
  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);
2919
+ for (let [e, t] of Object.entries(i.headers ?? {})) typeof t == "string" ? E[e] = t : Array.isArray(t) && (E[e] = t.join(", "));
2920
+ let D = zr(Rr(m[0], { allowDevProxy: !0 }), E.cookie, { apiName: m[0]?.name }), O = new AbortController(), k = () => O.abort();
2921
+ s.once("close", k);
3443
2922
  let A = null, j = [], M = {};
3444
2923
  try {
3445
- (await i("@voltro/web/ssr")).beginStoreSeeds(), {chain: j, segmentLoaderData: M} = await v("loadChain", () => Vi({
2924
+ (await n("@voltro/web/ssr")).beginStoreSeeds(), {chain: j, segmentLoaderData: M} = await v("loadChain", () => Cr({
3446
2925
  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")),
2926
+ loadLayout: (t) => n(C(e, "src", "pages", t.dir, "layout.tsx")),
2927
+ loadError: (t) => n(C(e, "src", "pages", t.dir, "error.tsx")),
2928
+ loadPending: (t) => n(C(e, "src", "pages", t.dir, "loading.tsx")),
3450
2929
  ctx: {
3451
- params: m.params,
3452
- pathname: d,
3453
- search: f,
2930
+ params: p.params,
2931
+ pathname: u,
2932
+ search: d,
3454
2933
  signal: O.signal,
3455
2934
  headers: E,
3456
2935
  query: D
@@ -3458,143 +2937,143 @@ import {
3458
2937
  }));
3459
2938
  let t = x.loader;
3460
2939
  typeof t == "function" && !T && (A = await v("loader", () => t({
3461
- params: m.params,
3462
- pathname: d,
3463
- search: f,
2940
+ params: p.params,
2941
+ pathname: u,
2942
+ search: d,
3464
2943
  signal: O.signal,
3465
2944
  headers: E,
3466
2945
  query: D
3467
2946
  })));
3468
2947
  } finally {
3469
- c.off("close", k);
2948
+ s.off("close", k);
3470
2949
  }
3471
- let N = await v("loadSsrHelpers", async () => await i("@voltro/web/ssr"));
3472
- T || await Ci({
2950
+ let N = await v("loadSsrHelpers", async () => await n("@voltro/web/ssr"));
2951
+ T || await ar({
3473
2952
  pageMod: x,
3474
- params: m.params,
2953
+ params: p.params,
3475
2954
  query: D,
3476
- apiName: r[0]?.name,
2955
+ apiName: m[0]?.name,
3477
2956
  seed: N.seedPreloadedSubscription,
3478
2957
  onError: ({ tag: e, apiName: t }, n) => Z.warn("preload seed failed", {
3479
2958
  tag: e,
3480
2959
  apiName: t,
3481
- pathname: d
2960
+ pathname: u
3482
2961
  }, n)
3483
2962
  });
3484
- let ee = {
3485
- pattern: m.route.pattern,
2963
+ let P = {
2964
+ pattern: p.route.pattern,
3486
2965
  Component: x.default,
3487
2966
  meta: x.meta,
3488
2967
  loader: x.loader,
3489
2968
  ErrorBoundary: x.ErrorBoundary,
3490
2969
  Pending: x.Pending,
3491
- renderMode: C,
2970
+ renderMode: S,
3492
2971
  chain: j
3493
- }, P = {
2972
+ }, I = {
3494
2973
  cookies: N.parseCookieHeader(E.cookie),
3495
2974
  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({
2975
+ url: l
2976
+ }, L = x.interactive ?? "full", R = (await o())(E.cookie, E["accept-language"]);
2977
+ b = R !== void 0 && a;
2978
+ let ee = R ? {
2979
+ outerWrap: R.outerWrap,
2980
+ locale: R.locale
2981
+ } : {}, z = T ? In({
3503
2982
  helpers: N,
3504
- page: `src/pages/${m.route.file}`,
3505
- interactive: F,
2983
+ page: `src/pages/${p.route.file}`,
2984
+ interactive: L,
3506
2985
  delivery: "stream",
3507
2986
  renderInput: {
3508
- descriptor: ee,
3509
- params: m.params,
3510
- pathname: d,
3511
- search: f,
2987
+ descriptor: P,
2988
+ params: p.params,
2989
+ pathname: u,
2990
+ search: d,
3512
2991
  segmentLoaderData: M,
3513
- requestContext: P,
3514
- ...te
2992
+ requestContext: I,
2993
+ ...ee
3515
2994
  }
3516
- }) : null, R = T ? null : $r({
2995
+ }) : null, B = T ? null : Fn({
3517
2996
  helpers: N,
3518
- page: `src/pages/${m.route.file}`,
3519
- pathname: d,
3520
- renderMode: C,
3521
- interactive: F,
2997
+ page: `src/pages/${p.route.file}`,
2998
+ pathname: u,
2999
+ renderMode: S,
3000
+ interactive: L,
3522
3001
  loaderData: A,
3523
3002
  segmentLoaderData: M,
3524
3003
  pageLoaderRan: typeof x.loader == "function"
3525
- }), ne = [];
3004
+ }), V = [];
3526
3005
  await v("collectCss", async () => {
3527
3006
  let t = /* @__PURE__ */ new Set(), n = [
3528
- p(e, "src", "pages", m.route.file),
3007
+ C(e, "src", "pages", p.route.file),
3529
3008
  ...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")] : []
3009
+ ...t.hasLayout ? [C(e, "src", "pages", t.dir, "layout.tsx")] : [],
3010
+ ...t.hasError ? [C(e, "src", "pages", t.dir, "error.tsx")] : [],
3011
+ ...t.hasPending ? [C(e, "src", "pages", t.dir, "loading.tsx")] : []
3533
3012
  ]),
3534
- p(e, ".framework", "main.tsx")
3013
+ C(e, ".framework", "main.tsx")
3535
3014
  ];
3536
- for (let e of n) await y(e, t, ne);
3015
+ for (let e of n) await y(e, t, V);
3537
3016
  });
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({
3017
+ 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();
3018
+ if (z) {
3019
+ let e = (e) => Rn({
3541
3020
  helpers: N,
3542
- prepared: L,
3021
+ prepared: z,
3543
3022
  meta: e,
3544
- interactive: F,
3545
- extra: [ie]
3023
+ interactive: L,
3024
+ extra: [ne]
3546
3025
  });
3547
- if (L.hasDeferred) bi({
3548
- res: c,
3549
- shell: _i({
3550
- shell: z,
3026
+ if (z.hasDeferred) nr({
3027
+ res: s,
3028
+ shell: $n({
3029
+ shell: H,
3551
3030
  inlineModuleScriptsAsync: !0
3552
3031
  }),
3553
- htmlLang: B,
3032
+ htmlLang: U,
3554
3033
  headers: {
3555
3034
  "content-type": "text/html; charset=utf-8",
3556
3035
  "x-voltro-rendered-by": "spa-shell-dev"
3557
3036
  },
3558
3037
  headInjection: e,
3559
3038
  render: (e) => N.renderPageToStream({
3560
- ...L.renderInput,
3039
+ ...z.renderInput,
3561
3040
  ...e
3562
3041
  }),
3563
3042
  onShellError: (e) => {
3564
- U(c, "spa-shell-dev", d, m.route.pattern, e, b);
3043
+ Te(s, "spa-shell-dev", u, p.route.pattern, e, b);
3565
3044
  }
3566
3045
  });
3567
3046
  else {
3568
- let t = ti({
3047
+ let t = Ln({
3569
3048
  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);
3049
+ prepared: z
3050
+ }), 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}"`);
3051
+ 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
3052
  }
3574
- } else if (R) {
3053
+ } else if (B) {
3575
3054
  let e = (e) => [
3576
- ie,
3055
+ ne,
3577
3056
  N.renderMetaToHtml(e),
3578
- `<meta name="voltro-interactive" content="${F}" />`,
3579
- ...R.hasDeferred ? [N.renderDeferredRegistryScript()] : [],
3580
- N.renderRouterStateScript(R.stateInput)
3057
+ `<meta name="voltro-interactive" content="${L}" />`,
3058
+ ...B.hasDeferred ? [N.renderDeferredRegistryScript()] : [],
3059
+ N.renderRouterStateScript(B.stateInput)
3581
3060
  ].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
3061
+ descriptor: P,
3062
+ params: p.params,
3063
+ pathname: u,
3064
+ search: d,
3065
+ loaderData: B.loaderData,
3066
+ segmentLoaderData: B.segmentLoaderData,
3067
+ requestContext: I,
3068
+ ...ee
3590
3069
  };
3591
- if (C === "ssr" && F === "full") bi({
3592
- res: c,
3593
- shell: _i({
3594
- shell: z,
3070
+ if (S === "ssr" && L === "full") nr({
3071
+ res: s,
3072
+ shell: $n({
3073
+ shell: H,
3595
3074
  inlineModuleScriptsAsync: !0
3596
3075
  }),
3597
- htmlLang: B,
3076
+ htmlLang: U,
3598
3077
  headers: {
3599
3078
  "content-type": "text/html; charset=utf-8",
3600
3079
  "x-voltro-rendered-by": "ssr-dev"
@@ -3605,76 +3084,76 @@ import {
3605
3084
  ...e
3606
3085
  }),
3607
3086
  onShellError: (e) => {
3608
- U(c, "ssr-dev", d, m.route.pattern, e, b);
3087
+ Te(s, "ssr-dev", u, p.route.pattern, e, b);
3609
3088
  }
3610
3089
  });
3611
3090
  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);
3091
+ 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}"`);
3092
+ s.statusCode = 200, s.setHeader("content-type", "text/html; charset=utf-8"), s.setHeader("x-voltro-rendered-by", "ssr-dev"), s.end(i);
3614
3093
  }
3615
3094
  }
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,
3095
+ _.render = Date.now() - re;
3096
+ let W = Date.now() - g;
3097
+ h ? (Ce.add(p.route.pattern), Z.info(`ssr compiled ${p.route.pattern} in ${W}ms`, {
3098
+ pattern: p.route.pattern,
3099
+ pathname: u,
3100
+ elapsedMs: W,
3622
3101
  cold: !0,
3623
3102
  phases: _
3624
- })) : V > 200 && Z.info(`ssr rendered ${d} in ${V}ms`, {
3625
- pattern: m.route.pattern,
3626
- pathname: d,
3627
- elapsedMs: V,
3103
+ })) : W > 200 && Z.info(`ssr rendered ${u} in ${W}ms`, {
3104
+ pattern: p.route.pattern,
3105
+ pathname: u,
3106
+ elapsedMs: W,
3628
3107
  cold: !1,
3629
3108
  phases: _
3630
3109
  });
3631
3110
  } catch (e) {
3632
- if (Zr(e)) {
3111
+ if (Nn(e)) {
3633
3112
  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);
3113
+ pathname: u,
3114
+ pattern: p.route.pattern
3115
+ }, e), s.statusCode = 500, s.setHeader("content-type", "text/plain; charset=utf-8"), s.end(e.message);
3637
3116
  return;
3638
3117
  }
3639
- let t = Qr(e);
3118
+ let t = Pn(e);
3640
3119
  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);
3120
+ s.statusCode = t.status;
3121
+ for (let [e, n] of Object.entries(t.headers)) s.setHeader(e, String(n));
3122
+ s.end(t.body);
3644
3123
  return;
3645
3124
  }
3646
- U(c, "ssr-dev", d, m.route.pattern, e, b);
3125
+ Te(s, "ssr-dev", u, p.route.pattern, e, b);
3647
3126
  }
3648
3127
  });
3649
3128
  }
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 () => {
3129
+ }, 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
3130
  let t = [];
3652
- for (let n of r) {
3131
+ for (let n of m) {
3653
3132
  if (!n.proxyTarget) continue;
3654
- let r = await qi(e, n.pkg);
3133
+ let r = await kr(e, n.pkg);
3655
3134
  if (r) try {
3656
- t.push(await O.readFile(p(r, "rpcGroup.generated.ts"), "utf8"));
3135
+ t.push(await D.readFile(C(r, "rpcGroup.generated.ts"), "utf8"));
3657
3136
  } catch {}
3658
3137
  }
3659
3138
  if (t.length === 0) return !1;
3660
- let n = de("sha1").update(t.join("\0")).digest("hex"), i = p(j, ".voltro-rpcgroup-optimize"), a = "";
3139
+ let n = se("sha1").update(t.join("\0")).digest("hex"), r = C(V, ".voltro-rpcgroup-optimize"), i = "";
3661
3140
  try {
3662
- a = (await O.readFile(i, "utf8")).trim();
3141
+ i = (await D.readFile(r, "utf8")).trim();
3663
3142
  } catch {}
3664
- if (a === n) return !1;
3143
+ if (i === n) return !1;
3665
3144
  try {
3666
- await O.writeFile(i, n);
3145
+ await D.writeFile(r, n);
3667
3146
  } catch {}
3668
3147
  return !0;
3669
3148
  })();
3670
- Se && Z.info("rpcGroup changed since last boot — forcing a dep re-optimize so the browser loads the current api client");
3149
+ Le && Z.info("rpcGroup changed since last boot — forcing a dep re-optimize so the browser loads the current api client");
3671
3150
  try {
3672
- await Et(g, "voltro dev (web)");
3151
+ await je(k, "voltro dev (web)");
3673
3152
  } catch (e) {
3674
3153
  Z.error(String(e.message ?? e)), process.exit(1);
3675
3154
  }
3676
- await (await D.createServer({
3677
- root: j,
3155
+ await (await ee.createServer({
3156
+ root: V,
3678
3157
  envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
3679
3158
  ssr: { noExternal: ["react-intl", "@voltro/i18n"] },
3680
3159
  resolve: {
@@ -3685,141 +3164,145 @@ import {
3685
3164
  "@voltro/i18n"
3686
3165
  ],
3687
3166
  alias: [
3688
- ...be ? [{
3167
+ ...Pe ? [{
3689
3168
  find: "@voltro/devtools/styles.css",
3690
- replacement: p(be, "src/styles.css")
3169
+ replacement: C(Pe, "src/styles.css")
3691
3170
  }, {
3692
3171
  find: "@voltro/devtools",
3693
- replacement: p(be, "src/index.ts")
3172
+ replacement: C(Pe, "src/index.ts")
3694
3173
  }] : [],
3695
- ...q ? [
3174
+ ...Y ? [
3696
3175
  {
3697
3176
  find: "@voltro/ui-shadcn/tokens.css",
3698
- replacement: p(q, "src/tokens.css")
3177
+ replacement: C(Y, "src/tokens.css")
3699
3178
  },
3700
3179
  {
3701
3180
  find: "@voltro/ui-shadcn/cn",
3702
- replacement: p(q, "src/cn.ts")
3181
+ replacement: C(Y, "src/cn.ts")
3703
3182
  },
3704
3183
  {
3705
3184
  find: "@voltro/ui-shadcn/brand",
3706
- replacement: p(q, "src/brand/voltroLogo.tsx")
3185
+ replacement: C(Y, "src/brand/voltroLogo.tsx")
3707
3186
  },
3708
3187
  {
3709
3188
  find: "@voltro/ui-shadcn",
3710
- replacement: p(q, "src/index.ts")
3189
+ replacement: C(Y, "src/index.ts")
3711
3190
  }
3712
3191
  ] : [],
3713
- ...Ze(e)
3192
+ ...$e(e)
3714
3193
  ]
3715
3194
  },
3716
3195
  optimizeDeps: {
3717
- include: [...r.map((e) => `${e.pkg}/rpcGroup`), ...xe],
3718
- force: Se
3196
+ include: [...m.map((e) => `${e.pkg}/rpcGroup`), ...Ie],
3197
+ force: Le
3719
3198
  },
3720
- customLogger: qt(),
3199
+ customLogger: Ze(),
3721
3200
  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] : []
3201
+ _n(C(e, "src", "pages")),
3202
+ z(),
3203
+ B(),
3204
+ ne,
3205
+ oe,
3206
+ pe,
3207
+ he,
3208
+ ge,
3209
+ be,
3210
+ Ae,
3211
+ ...xe ? [xe] : []
3733
3212
  ],
3734
3213
  server: {
3735
- port: g,
3214
+ port: k,
3736
3215
  strictPort: !0,
3737
3216
  host: !0,
3738
- allowedHosts: t.allowedHosts === !0 || [...t.allowedHosts ?? []],
3739
- proxy: H,
3740
- fs: { allow: [e, ...Mi(e)] }
3217
+ allowedHosts: r.allowedHosts === !0 || [...r.allowedHosts ?? []],
3218
+ proxy: J,
3219
+ fs: { allow: [e, ...mr(e)] }
3741
3220
  },
3742
3221
  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)"
3222
+ cacheDir: C(V, ".vite"),
3223
+ publicDir: C(e, "public")
3224
+ })).listen(), or.info(`v${Ne} ready in ${Date.now() - Me}ms`, {
3225
+ version: Ne,
3226
+ bootMs: Date.now() - Me
3227
+ }), Z.info(`listening on http://localhost:${k}`, {
3228
+ port: k,
3229
+ app: r.name ?? "(unnamed)"
3751
3230
  });
3752
- for (let e of r) e.proxyTarget && (Z.info(`proxy /ws/${e.name} → ${e.proxyTarget}`, {
3231
+ for (let e of m) e.proxyTarget && (Z.info(`proxy /ws/${e.name} → ${e.proxyTarget}`, {
3753
3232
  api: e.name,
3754
3233
  target: e.proxyTarget
3755
3234
  }), Z.info(`proxy /_voltro/api/${e.name} → ${e.proxyTarget.replace(/^ws/, "http")}/_voltro/inspect`, { api: e.name }));
3756
3235
  try {
3757
- await qe({
3758
- id: v,
3759
- name: _,
3236
+ await g({
3237
+ id: j,
3238
+ name: A,
3760
3239
  kind: "web",
3761
- url: `http://localhost:${g}`,
3240
+ url: `http://localhost:${k}`,
3762
3241
  pid: process.pid,
3763
3242
  status: "live",
3764
- logFile: y.path
3243
+ logFile: M.path
3765
3244
  });
3766
- let t = zr(e);
3245
+ let t = xn(e);
3767
3246
  if (t) {
3768
- let e = await Yr({ dashboardAppPath: t });
3247
+ let e = await jn({ dashboardAppPath: t });
3769
3248
  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
3249
  }
3771
3250
  setInterval(() => {
3772
- qe({
3773
- id: v,
3774
- name: _,
3251
+ g({
3252
+ id: j,
3253
+ name: A,
3775
3254
  kind: "web",
3776
- url: `http://localhost:${g}`,
3255
+ url: `http://localhost:${k}`,
3777
3256
  pid: process.pid,
3778
3257
  status: "live",
3779
- logFile: y.path
3258
+ logFile: M.path
3780
3259
  }).catch(() => {});
3781
3260
  }, 1e4).unref();
3782
3261
  let n = () => {
3783
- Je(v), y.dispose();
3262
+ v(j), M.dispose();
3784
3263
  };
3785
3264
  process.on("SIGINT", n), process.on("SIGTERM", n);
3786
3265
  } catch (e) {
3787
3266
  Z.warn("runtime-registry write failed", {}, e);
3788
3267
  }
3789
- return C({
3790
- app: t.name ?? "unnamed",
3268
+ return L({
3269
+ app: r.name ?? "unnamed",
3791
3270
  kind: "web",
3792
- url: `http://localhost:${g}`,
3793
- bootMs: Date.now() - ve
3271
+ url: `http://localhost:${k}`,
3272
+ bootMs: Date.now() - Me
3794
3273
  }), 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 {
3274
+ }, Gr = async (t) => {
3275
+ e("serve");
3276
+ let r = await Ur(t);
3277
+ if (!r) return {
3799
3278
  ran: !1,
3800
3279
  exitCode: 0
3801
3280
  };
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", {
3281
+ let i = Date.now(), a = Z.child("serve");
3282
+ a.info("booting voltro serve (preview)", { app: r.name ?? "(unnamed)" });
3283
+ let o = await Pr(t, r);
3284
+ for (let e of o) a.info("api wired", {
3806
3285
  name: e.name,
3807
3286
  pkg: e.pkg
3808
3287
  });
3809
- await ia(e, t, i);
3288
+ await Br(t, r, o);
3810
3289
  {
3811
- let { pages: t } = await $(p(e, "src", "pages"));
3812
- await sn({
3813
- appRoot: e,
3814
- pages: t
3290
+ let { pages: e } = await $(C(t, "src", "pages"));
3291
+ await ft({
3292
+ appRoot: t,
3293
+ pages: e
3815
3294
  });
3816
3295
  }
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,
3296
+ let s = n({
3297
+ kind: "web",
3298
+ configPort: r.port,
3299
+ env: process.env
3300
+ }).port, c = await fe("vite", () => import("vite")), l = (await import("@vitejs/plugin-react")).default, u = C(t, ".framework");
3301
+ Z.info("running production build"), await c.build({
3302
+ root: u,
3820
3303
  envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
3821
- plugins: [s()],
3822
- customLogger: qt(),
3304
+ plugins: [l()],
3305
+ customLogger: Ze(),
3823
3306
  resolve: { dedupe: [
3824
3307
  "react",
3825
3308
  "react-dom",
@@ -3828,93 +3311,26 @@ import {
3828
3311
  ] },
3829
3312
  build: {
3830
3313
  outDir: "dist",
3831
- rollupOptions: { output: { manualChunks: Pi } }
3314
+ rollupOptions: { output: { manualChunks: gr } }
3832
3315
  },
3833
- publicDir: p(e, "public")
3316
+ publicDir: C(t, "public")
3834
3317
  });
3835
- let l = (await o.preview({
3836
- root: c,
3318
+ let d = (await c.preview({
3319
+ root: u,
3837
3320
  envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
3838
- preview: { port: a },
3321
+ preview: { port: s },
3839
3322
  build: { outDir: "dist" }
3840
- })).resolvedUrls, u = l?.local[0] ?? `http://localhost:${a}`, d = l?.local.slice(1).map((e) => ({
3323
+ })).resolvedUrls, f = d?.local[0] ?? `http://localhost:${s}`, p = d?.local.slice(1).map((e) => ({
3841
3324
  label: "Local",
3842
3325
  url: e
3843
3326
  })) ?? [];
3844
- return C({
3845
- app: t.name ?? "unnamed",
3327
+ return L({
3328
+ app: r.name ?? "unnamed",
3846
3329
  kind: "preview",
3847
- url: u,
3848
- extras: d,
3849
- bootMs: Date.now() - n
3330
+ url: f,
3331
+ extras: p,
3332
+ bootMs: Date.now() - i
3850
3333
  }), 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
3334
  };
3919
3335
  //#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 };
3336
+ 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 };