vite-hub 0.5.0 → 0.6.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 (553) hide show
  1. package/README.md +9 -8
  2. package/dist/_internal/runtime/browser-errors.d.ts +0 -2
  3. package/dist/_internal/runtime/browser-errors.js +3 -4
  4. package/dist/_internal/runtime/redirects.d.ts +1 -2
  5. package/dist/_internal/runtime/redirects.js +2 -3
  6. package/dist/_internal/runtime/request-policy.d.ts +1 -2
  7. package/dist/_internal/runtime/request-policy.js +2 -3
  8. package/dist/_internal/runtime/security.d.ts +1 -2
  9. package/dist/_internal/runtime/security.js +1 -2
  10. package/dist/{access-BC9HtX_M.js → access-CUFHPi8T.js} +13 -140
  11. package/dist/{access-policy-DhsEACna.d.ts → access-DkBck8Vu.d.ts} +17 -21
  12. package/dist/{access-policy-CVZg9LPR.js → access-policy-BM48XstY.js} +5 -6
  13. package/dist/{account-Cjj-tYzo.d.ts → account-DNr8fHcQ.d.ts} +5 -7
  14. package/dist/{console/runtime/server → agent/console}/agents.get.d.ts +2 -3
  15. package/dist/{console/runtime/server → agent/console}/agents.get.js +3 -4
  16. package/dist/{console/runtime/server → agent/console}/channel-replay.d.ts +3 -5
  17. package/dist/{console/runtime/server → agent/console}/channel-replay.js +6 -7
  18. package/dist/{console/runtime/server → agent/console}/invocation-capabilities.get.d.ts +1 -3
  19. package/dist/{console/runtime/server → agent/console}/invocation-capabilities.get.js +4 -5
  20. package/dist/agent/console/invocation-workspace.get.d.ts +6 -0
  21. package/dist/{console/runtime/server → agent/console}/invocation-workspace.get.js +6 -7
  22. package/dist/{console/runtime/server → agent/console}/invocation.get.d.ts +4 -6
  23. package/dist/{console/runtime/server → agent/console}/invocation.get.js +8 -9
  24. package/dist/{console/runtime/server → agent/console}/invocations.get.d.ts +1 -2
  25. package/dist/{console/runtime/server → agent/console}/invocations.get.js +5 -6
  26. package/dist/agent/console/invocations.usage.d.ts +6 -0
  27. package/dist/agent/console/invocations.usage.js +51 -0
  28. package/dist/agent/console/operations.d.ts +6 -0
  29. package/dist/agent/console/operations.js +247 -0
  30. package/dist/{console/runtime/server → agent/console}/status.get.d.ts +2 -4
  31. package/dist/{console/runtime/server → agent/console}/status.get.js +6 -7
  32. package/dist/{server-W0c79AYZ.js → agent-console-CHsLxKk_.js} +4 -4
  33. package/dist/agent-console-FmaYpVv-.d.ts +14 -0
  34. package/dist/{agent-invocations.post-C3Onl2yH.js → agent-invocations.post-CF5anHY6.js} +14 -17
  35. package/dist/agents-DBm_PJie.js +1 -0
  36. package/dist/{agents-B76RICcy.js → agents-DXLHsE7x.js} +5 -6
  37. package/dist/{agents-C94A4N9u.d.ts → agents-Gyw4VKPt.d.ts} +0 -2
  38. package/dist/auth/console/auth.d.ts +25 -0
  39. package/dist/{console/runtime/server → auth/console}/auth.js +11 -13
  40. package/dist/auth/console/operations.d.ts +3 -0
  41. package/dist/auth/console/operations.js +135 -0
  42. package/dist/auth/server.js +1 -2
  43. package/dist/{auth-operations-GcQk0O0X.js → auth-operations-BKqoX8Ua.js} +4 -5
  44. package/dist/{auth-types-D3ugQ8xM.d.ts → auth-types-Cotn7406.d.ts} +4 -21
  45. package/dist/bin.js +8 -11
  46. package/dist/blob/console/operations.d.ts +3 -0
  47. package/dist/blob/console/operations.js +44 -0
  48. package/dist/blob/nuxt-image.js +1 -2
  49. package/dist/{blob-BcgsZtqM.js → blob-iw8pWQ6o.js} +5 -6
  50. package/dist/{blob-iVewd7KQ.d.ts → blob-uNin0_TV.d.ts} +1 -3
  51. package/dist/{browser-error-limits-CToqAD-O.js → browser-error-limits-B0yS95zt.js} +2 -4
  52. package/dist/cache/operations.d.ts +2 -4
  53. package/dist/cache/operations.js +3 -4
  54. package/dist/cache.d.ts +1 -3
  55. package/dist/cache.js +2 -3
  56. package/dist/{cli-config-FPHk1nbC.js → cli-config-BX8H4ZCo.js} +2 -3
  57. package/dist/cli-config-DgpmE_7z.js +1 -0
  58. package/dist/cms.js +1 -2
  59. package/dist/console/auth-types.d.ts +2 -2
  60. package/dist/console/auth.d.ts +2 -4
  61. package/dist/console/auth.js +2 -3
  62. package/dist/console/runtime/auth-operations.d.ts +4 -6
  63. package/dist/console/runtime/auth-operations.js +1 -2
  64. package/dist/console/runtime/client/account-views.d.ts +1 -3
  65. package/dist/console/runtime/client/account-views.js +1 -2
  66. package/dist/console/runtime/client/account.d.ts +1 -1
  67. package/dist/console/runtime/client/account.js +29 -45
  68. package/dist/console/runtime/client/appearance.d.ts +1 -2
  69. package/dist/console/runtime/client/appearance.js +1 -2
  70. package/dist/console/runtime/client/auth-management.ts +6 -6
  71. package/dist/console/runtime/client/blob-media.d.ts +2 -4
  72. package/dist/console/runtime/client/blob-media.js +5 -6
  73. package/dist/console/runtime/client/comment-thread.d.ts +1 -3
  74. package/dist/console/runtime/client/comment-thread.js +3 -4
  75. package/dist/console/runtime/client/content-heads.d.ts +1 -2
  76. package/dist/console/runtime/client/content-heads.js +2 -3
  77. package/dist/console/runtime/client/documents.d.ts +2 -2
  78. package/dist/console/runtime/client/documents.js +1 -2
  79. package/dist/console/runtime/client/editor.d.ts +3 -5
  80. package/dist/console/runtime/client/editor.js +1 -2
  81. package/dist/console/runtime/client/env-groups.d.ts +1 -3
  82. package/dist/console/runtime/client/env-groups.js +1 -2
  83. package/dist/console/runtime/client/env-status.d.ts +1 -3
  84. package/dist/console/runtime/client/env-status.js +1 -2
  85. package/dist/console/runtime/client/format.d.ts +1 -3
  86. package/dist/console/runtime/client/format.js +1 -2
  87. package/dist/console/runtime/client/invocation-deletion.d.ts +1 -2
  88. package/dist/console/runtime/client/invocation-deletion.js +1 -2
  89. package/dist/console/runtime/client/invocation.d.ts +1 -2
  90. package/dist/console/runtime/client/invocation.js +4 -5
  91. package/dist/console/runtime/client/live.d.ts +2 -4
  92. package/dist/console/runtime/client/live.js +1 -2
  93. package/dist/console/runtime/client/mcp-client.d.ts +7 -5
  94. package/dist/console/runtime/client/mcp-client.js +10 -5
  95. package/dist/console/runtime/client/media-library.d.ts +1 -1
  96. package/dist/console/runtime/client/media-library.js +1 -2
  97. package/dist/console/runtime/client/media-uploads.d.ts +2 -4
  98. package/dist/console/runtime/client/media-uploads.js +2 -3
  99. package/dist/console/runtime/client/media.d.ts +1 -1
  100. package/dist/console/runtime/client/media.js +1 -2
  101. package/dist/console/runtime/client/operation-view.d.ts +2 -4
  102. package/dist/console/runtime/client/operation-view.js +4 -5
  103. package/dist/console/runtime/client/presence.d.ts +2 -4
  104. package/dist/console/runtime/client/presence.js +1 -2
  105. package/dist/console/runtime/client/preview.d.ts +1 -3
  106. package/dist/console/runtime/client/preview.js +1 -2
  107. package/dist/console/runtime/client/problem.d.ts +2 -4
  108. package/dist/console/runtime/client/problem.js +3 -4
  109. package/dist/console/runtime/client/project-link.d.ts +1 -1
  110. package/dist/console/runtime/client/project-link.js +1 -2
  111. package/dist/console/runtime/client/project-session.d.ts +19 -10
  112. package/dist/console/runtime/client/project-session.js +1 -723
  113. package/dist/console/runtime/client/project.d.ts +1 -3
  114. package/dist/console/runtime/client/project.js +1 -2
  115. package/dist/console/runtime/client/projects.d.ts +1 -1
  116. package/dist/console/runtime/client/projects.js +1 -2
  117. package/dist/console/runtime/client/publish.d.ts +2 -4
  118. package/dist/console/runtime/client/publish.js +1 -2
  119. package/dist/console/runtime/client/rate-limit.d.ts +1 -3
  120. package/dist/console/runtime/client/rate-limit.js +3 -4
  121. package/dist/console/runtime/client/read-only.d.ts +2 -4
  122. package/dist/console/runtime/client/read-only.js +2 -3
  123. package/dist/console/runtime/client/request.d.ts +2 -2
  124. package/dist/console/runtime/client/request.js +1 -2
  125. package/dist/console/runtime/client/route-query.d.ts +4 -5
  126. package/dist/console/runtime/client/route-query.js +1 -2
  127. package/dist/console/runtime/client/schedule-run.d.ts +1 -3
  128. package/dist/console/runtime/client/schedule-run.js +3 -4
  129. package/dist/console/runtime/client/schema-form.d.ts +1 -1
  130. package/dist/console/runtime/client/schema-form.js +1 -2
  131. package/dist/console/runtime/client/sections.d.ts +1 -1
  132. package/dist/console/runtime/client/sections.js +1 -2
  133. package/dist/console/runtime/client/site-access.d.ts +83 -16
  134. package/dist/console/runtime/client/site-access.js +159 -32
  135. package/dist/console/runtime/client/site-link.d.ts +2 -0
  136. package/dist/console/runtime/client/site-link.js +1 -0
  137. package/dist/console/runtime/client/stored.d.ts +1 -3
  138. package/dist/console/runtime/client/stored.js +1 -2
  139. package/dist/console/runtime/client/toast.d.ts +1 -3
  140. package/dist/console/runtime/client/toast.js +1 -2
  141. package/dist/console/runtime/client/workflow.d.ts +1 -3
  142. package/dist/console/runtime/client/workflow.js +3 -4
  143. package/dist/console/runtime/components/console-account-home.vue +9 -7
  144. package/dist/console/runtime/components/console-account-link.vue +8 -5
  145. package/dist/console/runtime/components/console-account-setup.vue +10 -7
  146. package/dist/console/runtime/components/console-account-shell.vue +7 -2
  147. package/dist/console/runtime/components/console-account-unlink.vue +2 -3
  148. package/dist/console/runtime/components/console-app-settings.vue +8 -2
  149. package/dist/console/runtime/components/console-auth-detail.vue +1 -1
  150. package/dist/console/runtime/components/console-auth-event-list.vue +1 -0
  151. package/dist/console/runtime/components/console-document-editor.vue +3 -4
  152. package/dist/console/runtime/components/console-hosted-comments-embed.vue +106 -0
  153. package/dist/console/runtime/components/console-mcp-callback.vue +6 -1
  154. package/dist/console/runtime/components/console-mcp-items.vue +3 -16
  155. package/dist/console/runtime/components/console-site.vue +10 -8
  156. package/dist/console/runtime/components/console-usage.vue +2 -2
  157. package/dist/console/runtime/console-route.d.ts +1 -3
  158. package/dist/console/runtime/console-route.js +1 -2
  159. package/dist/console/runtime/definitions.d.ts +1 -1
  160. package/dist/console/runtime/definitions.js +1 -2
  161. package/dist/console/runtime/diagnostics.ts +14 -49
  162. package/dist/console/runtime/mcp-client.d.ts +2 -2
  163. package/dist/console/runtime/mcp-client.js +1 -2
  164. package/dist/console/runtime/operation-loader.d.ts +1 -0
  165. package/dist/console/runtime/operation-loader.js +10 -0
  166. package/dist/console/runtime/page-tool/account.js +26 -0
  167. package/dist/console/runtime/page-tool/page-tool.js +2 -2
  168. package/dist/console/runtime/rpc.d.ts +1 -1
  169. package/dist/console/runtime/rpc.js +1 -2
  170. package/dist/console/runtime/sections.d.ts +2 -2
  171. package/dist/console/runtime/sections.js +1 -2
  172. package/dist/console/runtime/server/access-policy.d.ts +1 -1
  173. package/dist/console/runtime/server/access-policy.js +1 -2
  174. package/dist/console/runtime/server/agent-console.d.ts +2 -0
  175. package/dist/console/runtime/server/agent-console.js +1 -0
  176. package/dist/console/runtime/server/blob.d.ts +1 -1
  177. package/dist/console/runtime/server/blob.js +1 -2
  178. package/dist/console/runtime/server/database.d.ts +1 -1
  179. package/dist/console/runtime/server/database.js +1 -2
  180. package/dist/console/runtime/server/definitions.d.ts +1 -1
  181. package/dist/console/runtime/server/definitions.get.d.ts +4 -6
  182. package/dist/console/runtime/server/definitions.get.js +5 -6
  183. package/dist/console/runtime/server/definitions.js +1 -2
  184. package/dist/console/runtime/server/development.d.ts +1 -1
  185. package/dist/console/runtime/server/development.js +1 -2
  186. package/dist/console/runtime/server/documents.d.ts +2 -2
  187. package/dist/console/runtime/server/documents.js +3 -3
  188. package/dist/console/runtime/server/entry-site-access.d.ts +3 -0
  189. package/dist/console/runtime/server/entry-site-access.js +4 -0
  190. package/dist/console/runtime/server/entry.d.ts +3 -0
  191. package/dist/console/runtime/server/entry.js +4 -0
  192. package/dist/console/runtime/server/env.d.ts +1 -3
  193. package/dist/console/runtime/server/env.js +1 -2
  194. package/dist/console/runtime/server/operation-contributions.d.ts +1 -1
  195. package/dist/console/runtime/server/operation-contributions.js +1 -2
  196. package/dist/console/runtime/server/pill.d.ts +45 -0
  197. package/dist/console/runtime/server/pill.js +62 -0
  198. package/dist/console/runtime/server/rpc.d.ts +5 -10
  199. package/dist/console/runtime/server/rpc.js +19 -27
  200. package/dist/console/runtime/server/runtime.d.ts +1 -1
  201. package/dist/console/runtime/server/runtime.js +1 -2
  202. package/dist/console/runtime/server/sections.d.ts +5 -5
  203. package/dist/console/runtime/server/sections.get.d.ts +1 -1
  204. package/dist/console/runtime/server/sections.get.js +8 -9
  205. package/dist/console/runtime/server/sections.js +6 -6
  206. package/dist/console/runtime/server/setup.d.ts +5 -5
  207. package/dist/console/runtime/server/setup.js +5 -5
  208. package/dist/console/runtime/server/site-access-operation.d.ts +7 -0
  209. package/dist/console/runtime/server/site-access-operation.js +36 -0
  210. package/dist/console/runtime/server/site-actions.d.ts +73 -0
  211. package/dist/console/runtime/server/site-actions.js +105 -0
  212. package/dist/console/runtime/server/site-entry.d.ts +16 -9
  213. package/dist/console/runtime/server/site-entry.js +62 -46
  214. package/dist/console/runtime/server/site-visitor.d.ts +17 -0
  215. package/dist/console/runtime/server/site-visitor.js +1 -0
  216. package/dist/console/runtime/server/site.d.ts +27 -0
  217. package/dist/console/runtime/server/site.js +1 -0
  218. package/dist/console/runtime/skills.d.ts +1 -3
  219. package/dist/console/runtime/skills.js +1 -2
  220. package/dist/console/server.d.ts +9 -25
  221. package/dist/console/server.js +8 -8
  222. package/dist/console/ui.d.ts +0 -10
  223. package/dist/console/ui.js +14 -27
  224. package/dist/console-lazy-views-VEjcbL4Q.js +1 -0
  225. package/dist/{console-route-CM2G5hiC.js → console-route-DbdnLkkF.js} +2 -3
  226. package/dist/console-signature--55DIKf2.js +237 -0
  227. package/dist/console.d.ts +1 -3
  228. package/dist/console.js +1 -2
  229. package/dist/content/console/operations.d.ts +3 -0
  230. package/dist/content/console/operations.js +62 -0
  231. package/dist/{console/runtime/server → database/console}/database.get.d.ts +2 -3
  232. package/dist/{console/runtime/server → database/console}/database.get.js +4 -5
  233. package/dist/database/console/operations.d.ts +3 -0
  234. package/dist/database/console/operations.js +49 -0
  235. package/dist/{database-UMJgnU2z.js → database-CrgBUdIx.js} +3 -4
  236. package/dist/{database-DC67Ipm-.d.ts → database-yFezh5U1.d.ts} +1 -3
  237. package/dist/{definition-catalog-BUcclwSH.js → definition-catalog-1xPPtzOx.js} +3 -4
  238. package/dist/definition-catalog-M5ua7JRS.js +1 -0
  239. package/dist/{definitions-BW6SvmMM.js → definitions-BFYqXchw.js} +1 -2
  240. package/dist/{definitions-DB4LbZ7T.d.ts → definitions-ChvMnA1L.d.ts} +0 -2
  241. package/dist/{definitions-DTytrw42.js → definitions-DGo2rNQ9.js} +5 -6
  242. package/dist/{definitions-Dbgxfz3I.d.ts → definitions-DRkgHKmk.d.ts} +1 -3
  243. package/dist/{deployment-BUshgN5Q.js → deployment-CURATxjG.js} +2 -3
  244. package/dist/deployment-l7RuKdEp.js +1 -0
  245. package/dist/{dev-peer-CHjyHYG6.js → dev-peer-CRYp01PE.js} +2 -222
  246. package/dist/dev-peer-CX5C9243.js +1 -0
  247. package/dist/{development-zLxOp-AO.js → development-DD567hhJ.js} +2 -3
  248. package/dist/{development-RnopiRwK.d.ts → development-I40mfD7B.d.ts} +1 -3
  249. package/dist/{diagnostics-DtR0TAmq.js → diagnostics-DLHqjKGe.js} +3 -9
  250. package/dist/diagnostics-DgGKvWzF.d.ts +7 -0
  251. package/dist/docs/nuxt.js +1 -2
  252. package/dist/doctor.d.ts +0 -6
  253. package/dist/doctor.js +11492 -12152
  254. package/dist/{documents-BDR0AkYR.d.ts → documents-A-7Ho0g0.d.ts} +12 -16
  255. package/dist/{documents-B4R4JSfH.js → documents-BduuZjm3.js} +6 -6
  256. package/dist/{documents-BASIRZ91.d.ts → documents-CApMRd4o.d.ts} +4 -7
  257. package/dist/{documents-BewAPY61.js → documents-D6ueeoUR.js} +17 -21
  258. package/dist/durability/operations.d.ts +2 -4
  259. package/dist/durability/operations.js +3 -4
  260. package/dist/{entries-DbyNPLC9.js → entries-UFs9n1MB.js} +2 -3
  261. package/dist/{console/runtime/server → env/console}/env.get.d.ts +2 -4
  262. package/dist/env/console/env.get.js +15 -0
  263. package/dist/env/console/operations.d.ts +3 -0
  264. package/dist/env/console/operations.js +12 -0
  265. package/dist/env/vite.d.ts +1 -0
  266. package/dist/env/vite.js +2 -0
  267. package/dist/{env-Dg1I_DWr.js → env-D-wtSupz.js} +2 -3
  268. package/dist/{error-diagnostics-B1yAIaSn.js → error-diagnostics-CBtvqI30.js} +2 -7
  269. package/dist/{error-diagnostics-C0KyI408.js → error-diagnostics-kKXseq8d.js} +5 -2
  270. package/dist/error-diagnostics.ts +1 -7
  271. package/dist/{features-CC5OcZqJ.js → features-BXRKlmtN.js} +5 -6
  272. package/dist/features-CD5i5I8V.js +1 -0
  273. package/dist/{format-BOYlanIZ.js → format-Df-bS4Ly.js} +1 -2
  274. package/dist/{github-login-Bi3bfjRX.js → github-login-W-vaahWP.js} +1 -2
  275. package/dist/{host-CkL0jjBq.js → host-DeNPYIeV.js} +1 -2
  276. package/dist/{http-error-Bs6e8_-8.js → http-error-BorAxJYM.js} +1 -2
  277. package/dist/index.d.ts +1 -7
  278. package/dist/index.js +5 -7
  279. package/dist/{inspect-DbZuP_7b.js → inspect-CWwAuL-B.js} +2 -3
  280. package/dist/internal/agent-invocations-libsql.js +1 -2
  281. package/dist/internal/disabled-redis-driver.d.ts +1 -3
  282. package/dist/internal/disabled-redis-driver.js +2 -3
  283. package/dist/internal/disabled-upstash-driver.d.ts +1 -3
  284. package/dist/internal/disabled-upstash-driver.js +2 -3
  285. package/dist/internal/test-loader.d.ts +1 -3
  286. package/dist/internal/test-loader.js +2 -3
  287. package/dist/internal/test-server.js +2 -3
  288. package/dist/{internal-BreyUsQ6.js → internal-0C_CC601.js} +1 -2
  289. package/dist/{internal-Cc9N0shU.d.ts → internal-BRNf11h3.d.ts} +14 -8
  290. package/dist/{invariant-DolT9EEx.js → invariant-Dj2R1eMr.js} +1 -2
  291. package/dist/{invocation-page-undo-DqYcPlkQ.js → invocation-page-undo-DHbXczWY.js} +8 -7
  292. package/dist/invocations-B60XWNES.js +45 -0
  293. package/dist/{limits-BUlwWYQE.js → limits-BLo31qDR.js} +1 -2
  294. package/dist/logs/client.d.ts +1 -3
  295. package/dist/logs/client.js +1 -2
  296. package/dist/{console/runtime/server → logs/console}/logs.get.d.ts +3 -5
  297. package/dist/{console/runtime/server → logs/console}/logs.get.js +7 -8
  298. package/dist/logs/console/operations.d.ts +3 -0
  299. package/dist/logs/console/operations.js +23 -0
  300. package/dist/logs/host.d.ts +2 -4
  301. package/dist/logs/host.js +1 -2
  302. package/dist/logs/memory.d.ts +1 -1
  303. package/dist/logs/memory.js +1 -2
  304. package/dist/logs/source.d.ts +1 -1
  305. package/dist/logs/source.js +1 -2
  306. package/dist/logs.d.ts +2 -2
  307. package/dist/logs.js +2 -2
  308. package/dist/loopback-Bl9Cvj1k.js +139 -0
  309. package/dist/mcp/eval.d.ts +1 -0
  310. package/dist/mcp/eval.js +2 -0
  311. package/dist/{mcp-client-C_sEmyQw.d.ts → mcp-client-uXVvS7RL.d.ts} +5 -10
  312. package/dist/{media-uKX4Wy-c.d.ts → media-C79RB1oH.d.ts} +0 -2
  313. package/dist/{media-D3OfyKni.js → media-CNwnh6CG.js} +8 -9
  314. package/dist/{media-library-o8RRsnn_.js → media-library-DTC8TLsZ.js} +5 -6
  315. package/dist/{media-library-D9ThbXqs.d.ts → media-library-DxGu6w9z.d.ts} +0 -2
  316. package/dist/{memory-C54SDH_l.js → memory-D3EJS_Bp.js} +3 -4
  317. package/dist/{memory-2bbl4hcV.d.ts → memory-GK5ZGWrp.d.ts} +1 -3
  318. package/dist/{nuxt-server-auto-imports-cfTZYvgy.js → nuxt-server-auto-imports-4aT5BD4u.js} +1 -2
  319. package/dist/{nuxt-server-imports-75bWMeXc.js → nuxt-server-imports-BdJqiVhT.js} +1 -2
  320. package/dist/nuxt.d.ts +1 -3
  321. package/dist/nuxt.js +276 -182
  322. package/dist/{object-D8pRdprI.js → object-DRSmpe04.js} +1 -2
  323. package/dist/{operation-contributions-C3lwePQu.js → operation-contributions-BU10k2QS.js} +9 -9
  324. package/dist/{operation-contributions-CrdmqtJW.d.ts → operation-contributions-xwjDzj28.d.ts} +6 -7
  325. package/dist/{operation-definition-DxjKcCGm.js → operation-definition-D04Rdjbe.js} +7 -9
  326. package/dist/operation-modules-BUXlwjvd.js +1 -0
  327. package/dist/operation-modules-DHWkPcfS.js +139 -0
  328. package/dist/{operation-registry-BogGwk_I.js → operation-registry-DfQbL7vE.js} +1 -2
  329. package/dist/{operation-rpc-DI9txNxK.js → operation-rpc-BMdfapja.js} +3 -4
  330. package/dist/operations-D-7ljPqw.js +1 -0
  331. package/dist/{operations-TTjL_7Zc.d.ts → operations-DgFhA1WE.d.ts} +0 -4
  332. package/dist/{operations-CFYGXqLm.js → operations-DksTrRMb.js} +4 -5
  333. package/dist/operations-byxiZ2R2.js +113 -0
  334. package/dist/{optional-owners-O6sj4uoj.js → optional-owners-Cypch7V3.js} +4 -6
  335. package/dist/{out-fRNaVslw.js → out-Cw5Tvr92.js} +2933 -2301
  336. package/dist/{owned-paths-BnjT0FhU.js → owned-paths-MjjDftBn.js} +1 -2
  337. package/dist/page/pill.iife.js +2 -2
  338. package/dist/page-tools-BeZrtn4S.js +46 -0
  339. package/dist/page-tools-Chk8Gm9x.d.ts +23 -0
  340. package/dist/page-tools-shared-BLPidmCi.js +39 -0
  341. package/dist/{pathe.M-eThtNZ-J4gfe1m9.js → pathe.M-eThtNZ-D4EC7Wue.js} +1 -2
  342. package/dist/{plugins-DoXnU6-s.d.ts → plugins-BmkOoyIh.d.ts} +25 -110
  343. package/dist/{plugins-BTZQaFtZ.js → plugins-DfXcUnzN.js} +1779 -1384
  344. package/dist/presets/workspace.js +1 -2
  345. package/dist/{project-Dgyq1F1V.d.ts → project-B2qWt8on.d.ts} +3 -12
  346. package/dist/{project-DlWTGB7h.js → project-DRC67Uiu.js} +1 -2
  347. package/dist/{project-DXZRZEPX.js → project-_juMSuAS.js} +8 -11
  348. package/dist/{project-link-DT99MoyU.js → project-link-CJbCkOlC.js} +7 -8
  349. package/dist/{project-link-bNS-KROO.d.ts → project-link-Ck3vuq9w.d.ts} +2 -4
  350. package/dist/{project-root-v6ba4tn7.js → project-root-mAVQGZTX.js} +1 -2
  351. package/dist/project-session-8pN7pRo8.js +764 -0
  352. package/dist/{projects-CAcXztf4.js → projects-BRp0iseV.js} +1 -2
  353. package/dist/{projects-Ddvl9EJp.d.ts → projects-mgPxrKZr.d.ts} +0 -2
  354. package/dist/{registry-zw6aE2N9.js → registry-B8JE5NY-.js} +1 -2
  355. package/dist/{registry-CDKLACCZ.js → registry-CnPC-gNu.js} +1 -2
  356. package/dist/{request-CMA2UKKq.js → request-D769eiBL.js} +5 -6
  357. package/dist/{request-D7h3SQ92.d.ts → request-DYmjLTqP.d.ts} +2 -4
  358. package/dist/{request-SBLxvpyr.d.ts → request-DkoE0b2h.d.ts} +11 -4
  359. package/dist/{request-Cs0FqxEL.js → request-XFVx7CGC.js} +30 -9
  360. package/dist/{request-origin-COUkgHd6.js → request-origin-pzWr9UUu.js} +1 -2
  361. package/dist/{rolldown-runtime-CMFfr-1z.js → rolldown-runtime-DegdyBIC.js} +2 -3
  362. package/dist/{route-query-CRVWXIrc.js → route-query-BWVl6ZO6.js} +4 -5
  363. package/dist/routes-D02vxUSg.js +26 -0
  364. package/dist/{rpc-DIUA61pv.js → rpc-D3tsx5lZ.js} +1 -2
  365. package/dist/{rpc-7nlHSv3y.d.ts → rpc-oijgKQtD.d.ts} +0 -2
  366. package/dist/{runtime-YLWfdrtO.js → runtime-CAbuQGMP.js} +3 -4
  367. package/dist/{runtime-B-46Bawt.js → runtime-CRJsqVTa.js} +2 -3
  368. package/dist/{runtime-DxfJOfCd.js → runtime-DA7HJe10.js} +3 -4
  369. package/dist/runtime-DGvimtvc.d.ts +5 -0
  370. package/dist/{runtime-CX_l_78I.js → runtime-F0CTqBFx.js} +5 -6
  371. package/dist/{runtime-feature-guard-CuyPVGj9.js → runtime-feature-guard-BKAMRZzM.js} +6 -7
  372. package/dist/scan-module-B1A24jqP.js +1 -0
  373. package/dist/{scan-module-Df58L_6T.js → scan-module-BfZvDBxb.js} +2 -4
  374. package/dist/{schema-form-C-fy3xaU.d.ts → schema-form-Bl79Bdm-.d.ts} +0 -2
  375. package/dist/search-jgMrZJXR.js +84 -0
  376. package/dist/{sections-DumoLKQN.js → sections-AUGy9EkY.js} +2 -8
  377. package/dist/{sections-BogiCmtz.d.ts → sections-BMkFB3S-.d.ts} +4 -6
  378. package/dist/{sections-C83x0slv.js → sections-BNTdIEJw.js} +2 -3
  379. package/dist/{sections-Do7X4Nwt.d.ts → sections-DCoCa4nF.d.ts} +1 -8
  380. package/dist/sections-DjeAUX7o.d.ts +8 -0
  381. package/dist/{sections-BKUReack.js → sections-ZFAlI4JW.js} +14 -7
  382. package/dist/{sections.get-H46e2urg.d.ts → sections.get-BY5dClJY.d.ts} +2 -4
  383. package/dist/seo/runtime.d.ts +2 -5
  384. package/dist/seo/runtime.js +3 -5
  385. package/dist/{seo-CtLywyRx.d.ts → seo-CgW5uI9L.d.ts} +0 -2
  386. package/dist/seo.d.ts +1 -1
  387. package/dist/seo.js +1 -2
  388. package/dist/{setup-BC0P3eZy.d.ts → setup-BBnZPziq.d.ts} +5 -10
  389. package/dist/{setup-DNGzawFn.js → setup-yc3_WKNG.js} +4 -17
  390. package/dist/site-CZCIWsUQ.js +169 -0
  391. package/dist/site-link-Bvo2SxPo.js +58 -0
  392. package/dist/site-link-Dtw8MNVB.d.ts +18 -0
  393. package/dist/site-pages-B6J8U2Nq.js +66 -0
  394. package/dist/site-token-Wa7fhjwg.js +215 -0
  395. package/dist/site-visitor-BkhE2TA0.js +89 -0
  396. package/dist/skills/operations.d.ts +1 -5
  397. package/dist/skills/operations.js +4 -5
  398. package/dist/{skills-DdpSMiCI.js → skills-C1MaGEbO.js} +1 -2
  399. package/dist/skills.d.ts +1 -2
  400. package/dist/{skills.get-CRd06TTb.js → skills.get-CW8vc_Hf.js} +3 -4
  401. package/dist/skills.js +1 -2
  402. package/dist/{source-Cw3iYvJF.js → source-DYFndd0W.js} +2 -3
  403. package/dist/{source-S-LChQvw.d.ts → source-DemBtwla.d.ts} +0 -2
  404. package/dist/{stored-Dhv2qsQv.js → stored-J3TetMKf.js} +1 -2
  405. package/dist/task/operations.d.ts +1 -5
  406. package/dist/task/operations.js +3 -4
  407. package/dist/test/register.js +2 -3
  408. package/dist/test.d.ts +0 -4
  409. package/dist/test.js +1 -2
  410. package/dist/ui/vite.js +1 -2
  411. package/dist/usage-DBi7aOhx.js +33 -0
  412. package/dist/{version-dkga9imp.js → version-DUCd7Orc.js} +24 -21
  413. package/dist/{vite-stage-D7fe614I.js → vite-stage-Dmo4RgnK.js} +3 -5
  414. package/dist/{vue-router-C68IU1jM.d.ts → vue-router-plZJLlpm.d.ts} +120 -182
  415. package/dist/workspace/console/operations.d.ts +3 -0
  416. package/dist/workspace/console/operations.js +22 -0
  417. package/dist/{console/runtime/server → workspace/console}/workspace-files.get.d.ts +3 -5
  418. package/dist/{console/runtime/server → workspace/console}/workspace-files.get.js +4 -5
  419. package/dist/{workspace-history-B95Q-kGI.js → workspace-history-B52xib2J.js} +3 -4
  420. package/dist/{workspace-history-CeVwBB6Q.d.ts → workspace-history-WuxgLsi4.d.ts} +0 -2
  421. package/package.json +158 -149
  422. package/dist/agents-BhFggA26.js +0 -2
  423. package/dist/auth-GFIN6xSJ.d.ts +0 -120
  424. package/dist/cli-config-g_mbWdjT.js +0 -2
  425. package/dist/cloudflare-env-lookup-DKXdr4P_.js +0 -16
  426. package/dist/console/runtime/client/ticket.d.ts +0 -2
  427. package/dist/console/runtime/client/ticket.js +0 -2
  428. package/dist/console/runtime/page/loader.js +0 -134
  429. package/dist/console/runtime/server/auth.d.ts +0 -2
  430. package/dist/console/runtime/server/env.get.js +0 -16
  431. package/dist/console/runtime/server/invocation-workspace.get.d.ts +0 -8
  432. package/dist/console/runtime/server/mcp-client-operations.d.ts +0 -5
  433. package/dist/console/runtime/server/mcp-client-operations.js +0 -139
  434. package/dist/console/runtime/server/page-auth.d.ts +0 -18
  435. package/dist/console/runtime/server/page-auth.js +0 -44
  436. package/dist/console/runtime/server/page-tool.d.ts +0 -2
  437. package/dist/console/runtime/server/page-tool.js +0 -110
  438. package/dist/console/runtime/server/page-tools-route.d.ts +0 -2
  439. package/dist/console/runtime/server/page-tools-route.js +0 -5
  440. package/dist/console/runtime/server/search.get.d.ts +0 -4
  441. package/dist/console/runtime/server/search.get.js +0 -97
  442. package/dist/console/runtime/server/site-session.d.ts +0 -80
  443. package/dist/console/runtime/server/site-session.js +0 -2
  444. package/dist/console/runtime/server/tickets.d.ts +0 -2
  445. package/dist/console/runtime/server/tickets.js +0 -2
  446. package/dist/console/runtime/server/usage.get.d.ts +0 -10
  447. package/dist/console/runtime/server/usage.get.js +0 -92
  448. package/dist/console/runtime/site-access.d.ts +0 -2
  449. package/dist/console/runtime/site-access.js +0 -2
  450. package/dist/console-lazy-views-DXnIkdyd.js +0 -2
  451. package/dist/definition-catalog-og_1razf.js +0 -2
  452. package/dist/deployment-C2B0hBBj.js +0 -2
  453. package/dist/diagnostics-CjGiniKb.d.ts +0 -11
  454. package/dist/features-ujWsvlEH.js +0 -2
  455. package/dist/invocations-6jxqLkGY.js +0 -86
  456. package/dist/mcp-client-C91h8Taa.js +0 -1024
  457. package/dist/mcp-client-CTbTbn7d.js +0 -10
  458. package/dist/operations-5Lwd1xEI.js +0 -2
  459. package/dist/operations-ChEXk2ij.js +0 -853
  460. package/dist/page-tool-PmxH65gt.d.ts +0 -69
  461. package/dist/page-tools-ClgqElu-.js +0 -462
  462. package/dist/page-tools-DcCCtDKi.d.ts +0 -23
  463. package/dist/page-tools-shared-aNC9YtoI.js +0 -125
  464. package/dist/runtime-B_btezs1.d.ts +0 -7
  465. package/dist/scan-module-D_3X08mj.js +0 -2
  466. package/dist/secret-DELGKpCJ.js +0 -44
  467. package/dist/sections-CFiMNsqu.d.ts +0 -10
  468. package/dist/site-access-BycrwM2v.js +0 -18
  469. package/dist/site-access-CAiWyKOD.js +0 -2
  470. package/dist/site-access-DxfdOel1.d.ts +0 -55
  471. package/dist/site-access-L1qbvKt6.js +0 -293
  472. package/dist/site-session-CRwgKtTF.js +0 -300
  473. package/dist/skills/vitehub/SKILL.md +0 -142
  474. package/dist/skills/vitehub/agents/openai.yaml +0 -4
  475. package/dist/skills/vitehub/references/agent-definitions.md +0 -36
  476. package/dist/skills/vitehub/references/bundle.md +0 -57
  477. package/dist/skills/vitehub/references/capabilities-authority.md +0 -30
  478. package/dist/skills/vitehub/references/channels-triggers.md +0 -27
  479. package/dist/skills/vitehub/references/framework-composition.md +0 -29
  480. package/dist/skills/vitehub/references/preview-contract.md +0 -44
  481. package/dist/skills/vitehub/references/primitives/auth.md +0 -14
  482. package/dist/skills/vitehub/references/primitives/blob.md +0 -13
  483. package/dist/skills/vitehub/references/primitives/browser.md +0 -17
  484. package/dist/skills/vitehub/references/primitives/cache.md +0 -13
  485. package/dist/skills/vitehub/references/primitives/channels.md +0 -11
  486. package/dist/skills/vitehub/references/primitives/connections.md +0 -14
  487. package/dist/skills/vitehub/references/primitives/content.md +0 -13
  488. package/dist/skills/vitehub/references/primitives/database.md +0 -15
  489. package/dist/skills/vitehub/references/primitives/email.md +0 -11
  490. package/dist/skills/vitehub/references/primitives/env.md +0 -13
  491. package/dist/skills/vitehub/references/primitives/kv.md +0 -13
  492. package/dist/skills/vitehub/references/primitives/markdown-template.md +0 -13
  493. package/dist/skills/vitehub/references/primitives/queue.md +0 -14
  494. package/dist/skills/vitehub/references/primitives/rate-limit.md +0 -11
  495. package/dist/skills/vitehub/references/primitives/realtime.md +0 -19
  496. package/dist/skills/vitehub/references/primitives/sandbox-task.md +0 -11
  497. package/dist/skills/vitehub/references/primitives/sandbox.md +0 -13
  498. package/dist/skills/vitehub/references/primitives/schedule.md +0 -11
  499. package/dist/skills/vitehub/references/primitives/shell.md +0 -11
  500. package/dist/skills/vitehub/references/primitives/source.md +0 -11
  501. package/dist/skills/vitehub/references/primitives/workflow.md +0 -11
  502. package/dist/skills/vitehub/references/primitives/workspace.md +0 -11
  503. package/dist/skills/vitehub/references/project-patterns.md +0 -19
  504. package/dist/skills/vitehub/references/project-shapes.md +0 -81
  505. package/dist/skills/vitehub/references/proof-recovery.md +0 -31
  506. package/dist/skills/vitehub/references/sandboxes-hosts.md +0 -26
  507. package/dist/skills/vitehub/references/schedules-workflows-invocations.md +0 -28
  508. package/dist/skills/vitehub/references/server-primitives.md +0 -39
  509. package/dist/skills/vitehub/references/workspaces-sources-access.md +0 -26
  510. package/dist/ticket-DtBAstEU.js +0 -31
  511. package/dist/ticket-Pr_8ZtXW.d.ts +0 -14
  512. package/dist/tickets-DahBmKDT.js +0 -357
  513. package/dist/usage-CoQXs5nW.d.ts +0 -22
  514. package/dist/usage-index-VJAZ7a0p.js +0 -335
  515. package/dist/usage-jKtAgJZ0.js +0 -571
  516. /package/dist/{console/runtime/public/skills → console-skills}/index.json +0 -0
  517. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/SKILL.md +0 -0
  518. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/agents/openai.yaml +0 -0
  519. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/agent-definitions.md +0 -0
  520. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/bundle.md +0 -0
  521. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/capabilities-authority.md +0 -0
  522. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/channels-triggers.md +0 -0
  523. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/framework-composition.md +0 -0
  524. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/preview-contract.md +0 -0
  525. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/auth.md +0 -0
  526. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/blob.md +0 -0
  527. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/browser.md +0 -0
  528. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/cache.md +0 -0
  529. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/channels.md +0 -0
  530. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/connections.md +0 -0
  531. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/content.md +0 -0
  532. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/database.md +0 -0
  533. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/email.md +0 -0
  534. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/env.md +0 -0
  535. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/kv.md +0 -0
  536. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/markdown-template.md +0 -0
  537. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/queue.md +0 -0
  538. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/rate-limit.md +0 -0
  539. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/realtime.md +0 -0
  540. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/sandbox-task.md +0 -0
  541. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/sandbox.md +0 -0
  542. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/schedule.md +0 -0
  543. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/shell.md +0 -0
  544. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/source.md +0 -0
  545. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/workflow.md +0 -0
  546. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/workspace.md +0 -0
  547. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/project-patterns.md +0 -0
  548. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/project-shapes.md +0 -0
  549. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/proof-recovery.md +0 -0
  550. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/sandboxes-hosts.md +0 -0
  551. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/schedules-workflows-invocations.md +0 -0
  552. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/server-primitives.md +0 -0
  553. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/workspaces-sources-access.md +0 -0
@@ -1,27 +1,28 @@
1
- import { r as __toESM } from "./rolldown-runtime-CMFfr-1z.js";
2
- import { n as invariantError, t as invariant } from "./invariant-DolT9EEx.js";
3
- import { a as features, i as featureSupport } from "./features-CC5OcZqJ.js";
4
- import { n as isRecord$1, r as isRecordOrFunction, t as cloneRecord } from "./object-D8pRdprI.js";
5
- import { t as viteHubErrorDiagnostics } from "./error-diagnostics-B1yAIaSn.js";
6
- import { a as installCommandArguments, c as optionalFeaturePackages, d as unsupportedPeerPackagesError, i as importOptionalOwner, l as requireOptionalOwner, n as forgetPackageChecks, o as isPackageInstalled, r as hostFeaturePackages, s as isPackageInstalledInApp, t as assertFeaturePackages } from "./optional-owners-O6sj4uoj.js";
7
- import { n as relative$1, r as resolve$1, t as dirname$1 } from "./pathe.M-eThtNZ-J4gfe1m9.js";
8
- import { n as redactInspectionText, r as summarizeDefinitions, t as collectViteHubResourceSummaries } from "./inspect-DbZuP_7b.js";
9
- import { t as internalErrorDiagnostics } from "./error-diagnostics-C0KyI408.js";
10
- import { i as removeViteHubDevServerFile, o as writeViteHubDevServerFile, r as readViteHubDevServerFile, t as loadAllEnv } from "./vite-stage-D7fe614I.js";
11
- import { D as resolveConsoleSectionIds, b as isConsoleMcpClientEnabled, v as insertConsoleSection } from "./sections-DumoLKQN.js";
12
- import { n as callOperationRpc, r as operationRpcPath } from "./operation-rpc-DI9txNxK.js";
13
- import { n as addViteHubDevPeerUpgradeSigner, o as consolePublicKeyPrefix, r as isViteHubLoopbackAddress, t as addViteHubDevPeerDevHandler } from "./dev-peer-CHjyHYG6.js";
14
- import { a as createOperationRegistry, i as collectOperationContributions, p as operationsOf } from "./operations-CFYGXqLm.js";
15
- import { a as exports, n as assertNoRemovedViteHubOptions, t as readViteHubVersion } from "./version-dkga9imp.js";
16
- import { _ as moduleLanguage, f as scanModule, v as walk } from "./scan-module-Df58L_6T.js";
17
- import { a as normalizeNitroPreset, c as resolveDeploymentPlan, i as hostFromNitroPreset, r as findProviderHostConflict, s as resolveBuildHost, t as assertDeploymentService } from "./deployment-BUshgN5Q.js";
18
- import { f as writeFileIfChanged$1, l as normalizePathDefinitionName, n as discoverDefinitions, r as hasDefinitionFiles, t as createDirectoryDefinitionSource } from "./definition-catalog-BUcclwSH.js";
19
- import { n as evlogBridgeKey, t as browserErrorMaxBytes } from "./browser-error-limits-CToqAD-O.js";
20
- import { t as renderServedSkillsRegistryPlugin } from "./registry-zw6aE2N9.js";
21
- import { i as viteHubPageToolsAssets, n as viteHubBasePath, r as viteHubPageSessionPath } from "./page-tools-shared-aNC9YtoI.js";
22
- import { n as isViteHubSecretEqual } from "./secret-DELGKpCJ.js";
23
- import { t as githubAuthorLogin } from "./github-login-Bi3bfjRX.js";
24
- import { t as renderTaskRegistryPlugin } from "./registry-CDKLACCZ.js";
1
+ import { r as __toESM } from "./rolldown-runtime-DegdyBIC.js";
2
+ import { n as invariantError, t as invariant } from "./invariant-Dj2R1eMr.js";
3
+ import { a as features, i as featureSupport } from "./features-BXRKlmtN.js";
4
+ import { n as isRecord$1, r as isRecordOrFunction, t as cloneRecord } from "./object-DRSmpe04.js";
5
+ import { t as viteHubErrorDiagnostics } from "./error-diagnostics-CBtvqI30.js";
6
+ import { a as installCommandArguments, c as optionalFeaturePackages, d as unsupportedPeerPackagesError, i as importOptionalOwner, l as requireOptionalOwner, n as forgetPackageChecks, o as isPackageInstalled, r as hostFeaturePackages, s as isPackageInstalledInApp, t as assertFeaturePackages } from "./optional-owners-Cypch7V3.js";
7
+ import { n as relative$1, r as resolve$1, t as dirname$1 } from "./pathe.M-eThtNZ-D4EC7Wue.js";
8
+ import { n as redactInspectionText, r as summarizeDefinitions, t as collectViteHubResourceSummaries } from "./inspect-CWwAuL-B.js";
9
+ import { t as internalErrorDiagnostics } from "./error-diagnostics-kKXseq8d.js";
10
+ import { i as removeViteHubDevServerFile, o as writeViteHubDevServerFile, r as readViteHubDevServerFile, t as loadAllEnv } from "./vite-stage-Dmo4RgnK.js";
11
+ import { E as resolveConsoleSectionIds, v as insertConsoleSection } from "./sections-AUGy9EkY.js";
12
+ import { n as callOperationRpc, r as operationRpcPath } from "./operation-rpc-BMdfapja.js";
13
+ import { n as consolePublicKeyPrefix } from "./console-signature--55DIKf2.js";
14
+ import { a as createOperationRegistry, i as collectOperationContributions, p as operationsOf } from "./operations-DksTrRMb.js";
15
+ import { a as exports, n as assertNoRemovedViteHubOptions, t as readViteHubVersion } from "./version-DUCd7Orc.js";
16
+ import { _ as moduleLanguage, f as scanModule, v as walk } from "./scan-module-BfZvDBxb.js";
17
+ import { a as ownModule, i as createImportPath, n as loadConsoleOperations, r as generatedModules, t as consoleOperationModules } from "./operation-modules-DHWkPcfS.js";
18
+ import { a as normalizeNitroPreset, c as resolveDeploymentPlan, i as hostFromNitroPreset, r as findProviderHostConflict, s as resolveBuildHost, t as assertDeploymentService } from "./deployment-CURATxjG.js";
19
+ import { f as writeFileIfChanged$1, l as normalizePathDefinitionName, n as discoverDefinitions, r as hasDefinitionFiles, t as createDirectoryDefinitionSource } from "./definition-catalog-1xPPtzOx.js";
20
+ import { n as evlogBridgeKey, t as browserErrorMaxBytes } from "./browser-error-limits-B0yS95zt.js";
21
+ import { t as renderServedSkillsRegistryPlugin } from "./registry-B8JE5NY-.js";
22
+ import { t as viteHubBasePath } from "./page-tools-shared-BLPidmCi.js";
23
+ import { i as isViteHubLoopbackAddress, n as addViteHubDevPeerUpgradeSigner, t as addViteHubDevPeerDevHandler } from "./dev-peer-CRYp01PE.js";
24
+ import { t as githubAuthorLogin } from "./github-login-W-vaahWP.js";
25
+ import { t as renderTaskRegistryPlugin } from "./registry-CnPC-gNu.js";
25
26
  import { builtinModules, createRequire, findPackageJSON, isBuiltin } from "node:module";
26
27
  import { basename, dirname, extname, isAbsolute, join, parse, posix, relative, resolve, sep } from "node:path";
27
28
  import { inspect, isDeepStrictEqual, promisify } from "node:util";
@@ -34,9 +35,9 @@ import { tmpdir } from "node:os";
34
35
  import { isRuntimeDiagnostic } from "@vite-hub/runtime";
35
36
  import { parseJSONC } from "confbox/jsonc";
36
37
  import { describeServerEnv } from "@vite-hub/env/server";
38
+ import { env, hubEnv } from "@vite-hub/env/vite";
37
39
  import { findContentEntry, hubSource, prepareSourceGeneration, toRuntimeModuleSpecifier } from "@vite-hub/source/vite";
38
40
  import { defaultServerConditions, loadEnv, mergeConfig, parseAst } from "vite";
39
- import { env, hubEnv } from "@vite-hub/env/vite";
40
41
  import { hubBundle } from "@vite-hub/bundle/vite";
41
42
  import { createHash, randomUUID } from "node:crypto";
42
43
  import { readInstanceCount, sqliteUrlInput } from "@vite-hub/runtime/durability";
@@ -46,7 +47,7 @@ import { parseTOML } from "confbox/toml";
46
47
  import { request } from "node:http";
47
48
  import { request as request$1 } from "node:https";
48
49
  import process$1 from "node:process";
49
- //#region ../internal/src/build/vite.ts
50
+ // ../internal/src/build/vite.ts
50
51
  const generatedViteHubFilesPattern = "**/.vitehub/**";
51
52
  const projectRootDirectoryMarkers = [
52
53
  ["server", "agents"],
@@ -128,7 +129,7 @@ function loadNativePackageModule(id) {
128
129
  }
129
130
  function reexportNativeModule(file) {
130
131
  const url = JSON.stringify(pathToFileURL(realpathSync(file)).href);
131
- const hasDefault = /\bexport default\b|\bas default\b/.test(readFileSync(file, "utf8"));
132
+ const hasDefault = /^export\s+default\b|^export\s*\{[^}]*\bdefault\s*[,}]/m.test(readFileSync(file, "utf8"));
132
133
  const native = JSON.stringify(`data:text/javascript,${encodeURIComponent(`export * from ${url}${hasDefault ? `\nexport { default } from ${url}` : ""}`)}`);
133
134
  return `export * from ${native}\n${hasDefault ? `export { default } from ${native}\n` : ""}`;
134
135
  }
@@ -304,8 +305,7 @@ function publishViteHubDevServer(server) {
304
305
  else http.once("listening", write);
305
306
  http.once("close", remove);
306
307
  }
307
- //#endregion
308
- //#region src/hook-errors.ts
308
+ // src/hook-errors.ts
309
309
  /** Vite prints a `config` or `configResolved` error with `util.inspect`, as an error of the config file itself. */
310
310
  const inspectedByVite = /* @__PURE__ */ new Set(["config", "configResolved"]);
311
311
  const printed = /* @__PURE__ */ new WeakSet();
@@ -395,8 +395,7 @@ function withPrintedDiagnostics(option) {
395
395
  if (option && typeof option === "object" && "name" in option) wrapPlugin(option);
396
396
  return option;
397
397
  }
398
- //#endregion
399
- //#region ../internal/src/build/included-nitro-registry.ts
398
+ // ../internal/src/build/included-nitro-registry.ts
400
399
  const includedKey = Symbol.for("vitehub.included-nitro");
401
400
  const scope = globalThis;
402
401
  const includedNitroPlugins = scope[includedKey] ??= /* @__PURE__ */ new WeakSet();
@@ -411,8 +410,7 @@ function markIncludedNitroPlugin(plugin) {
411
410
  function isIncludedNitroPlugin(plugin) {
412
411
  return includedNitroPlugins.has(plugin);
413
412
  }
414
- //#endregion
415
- //#region src/internal/owner-modules.ts
413
+ // src/internal/owner-modules.ts
416
414
  /**
417
415
  * The build-time modules of the optional owner packages. A module is `undefined` when the app did not install its
418
416
  * package, so an app without features loads none of them. They load in parallel.
@@ -628,14 +626,12 @@ function optionalOwnerImportsPlugin() {
628
626
  }
629
627
  };
630
628
  }
631
- //#endregion
632
- //#region src/agent-invocations-setting.ts
629
+ // src/agent-invocations-setting.ts
633
630
  /** True for an omitted `agent.invocations` or the default journal options. Build code reads it without loading the Agent package. */
634
631
  function isDefaultAgentJournal(setting) {
635
632
  return setting === void 0 || typeof setting === "object" && setting.store === void 0;
636
633
  }
637
- //#endregion
638
- //#region src/storage-config.ts
634
+ // src/storage-config.ts
639
635
  /** An explicit Node data directory selects local storage; the host owns durability. */
640
636
  function withDataDir(options) {
641
637
  if (options.dataDir === void 0) return options;
@@ -757,8 +753,7 @@ function withConnectionsDatabase(options) {
757
753
  database: true
758
754
  };
759
755
  }
760
- //#endregion
761
- //#region src/cache-storage.ts
756
+ // src/cache-storage.ts
762
757
  const defaultCacheBase = ".vitehub/data/cache";
763
758
  const defaultCloudflareCacheBinding = "CACHE";
764
759
  const cacheDriverHosts = {
@@ -903,8 +898,7 @@ function applyCacheStorage(nitro, cache) {
903
898
  next.cloudflare = cloudflare;
904
899
  return next;
905
900
  }
906
- //#endregion
907
- //#region ../internal/src/hints.ts
901
+ // ../internal/src/hints.ts
908
902
  /**
909
903
  * The file that lists the hints of the last build or dev server, relative to the project root. A hint is a warning
910
904
  * about something that works now and fails later, such as counts that stay in one server's memory. Agents and CI read
@@ -992,8 +986,7 @@ function viteHubHintsPlugin() {
992
986
  }
993
987
  };
994
988
  }
995
- //#endregion
996
- //#region ../internal/src/build/client-output.ts
989
+ // ../internal/src/build/client-output.ts
997
990
  function hasStaticIndex(clientDir) {
998
991
  return existsSync(resolve$1(clientDir, "index.html"));
999
992
  }
@@ -1030,8 +1023,7 @@ async function copyClientOutput(clientDir, targetDir, excludedDirs = []) {
1030
1023
  filter
1031
1024
  });
1032
1025
  }
1033
- //#endregion
1034
- //#region ../internal/src/build/provider-output-config.ts
1026
+ // ../internal/src/build/provider-output-config.ts
1035
1027
  function isProviderJsonArray(value, ancestors) {
1036
1028
  if (Object.getPrototypeOf(value) !== Array.prototype || ancestors.has(value)) return false;
1037
1029
  if (Reflect.ownKeys(value).length !== value.length + 1) return false;
@@ -1169,13 +1161,11 @@ async function cleanProviderOutputConfig(file, ownership) {
1169
1161
  if (!changed) return;
1170
1162
  await persistProviderJsonRecord(file, next, true);
1171
1163
  }
1172
- //#endregion
1173
- //#region ../internal/src/build/user-entry.ts
1164
+ // ../internal/src/build/user-entry.ts
1174
1165
  function toSafeAppName(rootDir) {
1175
1166
  return basename(rootDir).replace(/[^a-z0-9-]+/gi, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").toLowerCase();
1176
1167
  }
1177
- //#endregion
1178
- //#region ../internal/src/build/wrangler-bindings.ts
1168
+ // ../internal/src/build/wrangler-bindings.ts
1179
1169
  /**
1180
1170
  * Named-entry arrays that ViteHub writes, other than `d1_databases`, which the Database package collapses with its
1181
1171
  * own rules and error.
@@ -1445,8 +1435,7 @@ async function collapseWranglerConfigFile(serverDir, options = {}) {
1445
1435
  const collapsed = collapseWranglerConfig(wrangler, options);
1446
1436
  if (!isDeepStrictEqual(collapsed, wrangler)) await writeFile(file, `${JSON.stringify(collapsed, null, 2)}\n`);
1447
1437
  }
1448
- //#endregion
1449
- //#region ../internal/src/build/cloudflare.ts
1438
+ // ../internal/src/build/cloudflare.ts
1450
1439
  const defaultCloudflareCompatibilityDate = "2026-04-20";
1451
1440
  function createDefaultCloudflareOutputRoot(rootDir) {
1452
1441
  return resolve(rootDir, "dist", toSafeAppName(rootDir));
@@ -1464,21 +1453,23 @@ async function writeCloudflareWranglerConfig(options) {
1464
1453
  removeIfEmpty: true
1465
1454
  });
1466
1455
  }
1467
- //#endregion
1468
- //#region ../internal/src/build/bundle-options.ts
1456
+ // ../internal/src/build/bundle-options.ts
1469
1457
  const encodedAliasPrefixMarker = "\0vitehub-prefix:";
1470
1458
  const encodedAliasExactMarker = "\0vitehub-exact:";
1471
1459
  /** Select the runtime constants from one resolved Vite configuration. */
1472
1460
  function resolveViteHubBundleDefines(config) {
1473
1461
  const defines = {};
1474
- for (const name of ["__VITEHUB_PUBLIC_URL__", "__VITEHUB_APP_BASE_URL__"]) {
1462
+ for (const name of [
1463
+ "__VITEHUB_PUBLIC_URL__",
1464
+ "__VITEHUB_APP_BASE_URL__",
1465
+ "__VITEHUB_CONSOLE_URL__"
1466
+ ]) {
1475
1467
  const value = config.define?.[name];
1476
1468
  if (typeof value === "string") defines[name] = value;
1477
1469
  }
1478
1470
  return defines;
1479
1471
  }
1480
- //#endregion
1481
- //#region ../internal/src/build/rolldown.ts
1472
+ // ../internal/src/build/rolldown.ts
1482
1473
  const viteRawPrefix = "\0vitehub-vite-raw:";
1483
1474
  const markdownTemplatePrefix = "\0vitehub-markdown-template:";
1484
1475
  const markdownTemplateFileSuffix = ".template.md";
@@ -1501,6 +1492,24 @@ async function importRolldown() {
1501
1492
  }
1502
1493
  return await import(pathToFileURL(entry).href);
1503
1494
  }
1495
+ /** Loads the built-in plugins from the bundler's Rolldown package directory or entry when supplied. */
1496
+ async function importRolldownExperimental(root, rolldownPath) {
1497
+ return await import(pathToFileURL(await resolveRolldownExperimentalEntry(root, rolldownPath)).href);
1498
+ }
1499
+ async function resolveRolldownExperimentalEntry(root, rolldownPath) {
1500
+ if (rolldownPath) {
1501
+ const path = await realpath(rolldownPath.startsWith("file:") ? fileURLToPath(rolldownPath) : resolve(root, rolldownPath));
1502
+ const importer = (await stat(path)).isDirectory() ? join(path, "package.json") : path;
1503
+ return createRequire(importer).resolve("rolldown/experimental");
1504
+ }
1505
+ const require = createRequire(import.meta.url);
1506
+ try {
1507
+ return require.resolve("rolldown/experimental", { paths: [root, dirname(fileURLToPath(import.meta.resolve("vite")))] });
1508
+ } catch (error) {
1509
+ if (!(error instanceof Error) || !("code" in error) || error.code !== "MODULE_NOT_FOUND") throw error;
1510
+ return require.resolve("vite/rolldown/experimental");
1511
+ }
1512
+ }
1504
1513
  function normalizePathSeparators(path) {
1505
1514
  return path.replaceAll("\\", "/");
1506
1515
  }
@@ -1844,20 +1853,20 @@ function createFileUrlPlugin() {
1844
1853
  }
1845
1854
  };
1846
1855
  }
1847
- /**
1848
- * Copies a `.wasm?module` import next to the bundle and keeps it as a relative `.wasm` import. Wrangler and Nitro load
1849
- * such an import as a compiled WebAssembly module, which Workers need because they can't compile WebAssembly bytes.
1850
- * Node.js compiles WebAssembly bytes, so there the import becomes the bytes of the file.
1851
- */
1852
1856
  function createWasmModulePlugin(outdir, workingDir, copy) {
1853
1857
  return {
1854
1858
  name: "vitehub-wasm-module",
1855
1859
  async resolveId(source, importer, extra) {
1856
- if (!source.endsWith(".wasm?module")) return;
1857
- const resolved = await this.resolve(source.slice(0, -7), importerFor(importer, workingDir), {
1860
+ const explicitModule = source.endsWith(".wasm?module");
1861
+ if (!explicitModule && (!copy || !source.endsWith(".wasm") || extra.custom?.[skipMarkdownTemplateResolve])) return;
1862
+ const path = explicitModule ? source.slice(0, -7) : source;
1863
+ const resolved = await this.resolve(path, importerFor(importer, workingDir), {
1858
1864
  custom: extra.custom,
1859
- kind: extra.kind
1865
+ isEntry: extra.isEntry,
1866
+ kind: extra.kind,
1867
+ skipSelf: true
1860
1868
  });
1869
+ if (!explicitModule && (!isFileResolution(resolved) || !resolved.id.endsWith(".wasm"))) return resolved ?? void 0;
1861
1870
  if (!isFileResolution(resolved)) this.error(`[vitehub] Could not resolve ${JSON.stringify(source)}.`);
1862
1871
  if (!copy) return resolved.id;
1863
1872
  const bytes = await readFile(resolved.id);
@@ -2075,49 +2084,7 @@ async function bundleEsmEntry(entryFile, outfile, options = {}) {
2075
2084
  await writeFile(outfile, chunk.code, { signal: options.signal });
2076
2085
  options.signal?.throwIfAborted();
2077
2086
  }
2078
- //#endregion
2079
- //#region ../internal/src/build/paths.ts
2080
- function resolveRuntimeModule(packageDir, modulePath) {
2081
- const distFile = resolve$1(packageDir, "dist", `${modulePath}.js`);
2082
- return existsSync(distFile) ? distFile : resolve$1(packageDir, "src", `${modulePath}.ts`);
2083
- }
2084
- const packageDirs = /* @__PURE__ */ new Map();
2085
- function findPackageDir(file) {
2086
- const start = dirname$1(file);
2087
- const cached = packageDirs.get(start);
2088
- if (cached) return cached;
2089
- let dir = start;
2090
- while (!existsSync(resolve$1(dir, "package.json"))) {
2091
- const parent = dirname$1(dir);
2092
- invariant(parent !== dir, `a file that a package resolver found has a package.json above it (${file})`);
2093
- dir = parent;
2094
- }
2095
- packageDirs.set(start, dir);
2096
- return dir;
2097
- }
2098
- /**
2099
- * The absolute path of a module that the calling package builds, such as `ownModule(import.meta.url, "runtime/state")`.
2100
- * Owner plugins write this path into generated code, so the module needs no package export, and an app resolves it
2101
- * only when the owner's feature is on. It is the `dist` file, or the `src` file before the package is built.
2102
- */
2103
- function ownModule(importMetaUrl, modulePath) {
2104
- return resolveRuntimeModule(findPackageDir(fileURLToPath(importMetaUrl)), modulePath);
2105
- }
2106
- function createImportPath(fromFile, targetFile) {
2107
- const fromDir = realpathIfExists(dirname$1(fromFile));
2108
- const target = realpathIfExists(targetFile);
2109
- const importPath = relative$1(fromDir, target);
2110
- return importPath.startsWith(".") ? importPath : `./${importPath}`;
2111
- }
2112
- function realpathIfExists(path) {
2113
- try {
2114
- return realpathSync.native(path);
2115
- } catch {
2116
- return resolve$1(path);
2117
- }
2118
- }
2119
- //#endregion
2120
- //#region ../../node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js
2087
+ // ../../node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js
2121
2088
  const balanced = (a, b, str) => {
2122
2089
  const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
2123
2090
  const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
@@ -2164,8 +2131,7 @@ const range = (a, b, str) => {
2164
2131
  }
2165
2132
  return result;
2166
2133
  };
2167
- //#endregion
2168
- //#region ../../node_modules/.pnpm/brace-expansion@5.0.12/node_modules/brace-expansion/dist/esm/index.js
2134
+ // ../../node_modules/.pnpm/brace-expansion@5.0.12/node_modules/brace-expansion/dist/esm/index.js
2169
2135
  const escSlash = "\0SLASH" + Math.random() + "\0";
2170
2136
  const escOpen = "\0OPEN" + Math.random() + "\0";
2171
2137
  const escClose = "\0CLOSE" + Math.random() + "\0";
@@ -2365,39 +2331,94 @@ function expand_(str, max, maxLength, maxDepth, depth, maxRewrites, isTop) {
2365
2331
  }
2366
2332
  return acc;
2367
2333
  }
2368
- //#endregion
2369
- //#region ../../node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/assert-valid-pattern.js
2370
- const MAX_PATTERN_LENGTH = 65536;
2371
- const assertValidPattern = (pattern) => {
2372
- if (typeof pattern !== "string") throw new TypeError("invalid pattern");
2373
- if (pattern.length > MAX_PATTERN_LENGTH) throw new TypeError("pattern is too long");
2334
+ // ../../node_modules/.pnpm/@isaacs+nonrecursive-glob-match@1.1.0/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/numeric-range.js
2335
+ const digit = (a, b) => a === b ? {
2336
+ t: "lit",
2337
+ ch: String(a)
2338
+ } : {
2339
+ t: "class",
2340
+ re: new RegExp(`^[${a}-${b}]$`)
2341
+ };
2342
+ const prefix = (d, alts) => alts.map((s) => [digit(d, d), ...s]);
2343
+ const fixed = (a, b) => {
2344
+ if (!a) return [[]];
2345
+ let lo = +a[0];
2346
+ let hi = +b[0];
2347
+ const ra = a.slice(1);
2348
+ const rb = b.slice(1);
2349
+ if (lo === hi) return prefix(lo, fixed(ra, rb));
2350
+ const zeros = "0".repeat(ra.length);
2351
+ const nines = "9".repeat(ra.length);
2352
+ const out = [];
2353
+ if (ra !== zeros) out.push(...prefix(lo++, fixed(ra, nines)));
2354
+ const last = rb === nines ? [] : prefix(hi--, fixed(zeros, rb));
2355
+ if (lo <= hi) out.push([digit(lo, hi), ...Array.from(ra, () => digit(0, 9))]);
2356
+ out.push(...last);
2357
+ return out;
2358
+ };
2359
+ const nonneg = (a, b, width) => {
2360
+ if (width) return fixed(String(a).padStart(width, "0"), String(b).padStart(width, "0"));
2361
+ const out = [];
2362
+ for (let len = String(a).length; len <= String(b).length; len++) {
2363
+ const lo = Math.max(a, len === 1 ? 0 : 10 ** (len - 1));
2364
+ const hi = Math.min(b, 10 ** len - 1);
2365
+ out.push(...fixed(String(lo), String(hi)));
2366
+ }
2367
+ return out;
2368
+ };
2369
+ /**
2370
+ * The strings that the bash brace expansion `{lo..hi}` makes, as
2371
+ * the alternatives of an `@(...)` extglob. Each one is a sequence of
2372
+ * digits and digit classes, so there are only a few of them, even for
2373
+ * a large range.
2374
+ *
2375
+ * If either end has a leading zero, such as `{01..10}`, each number
2376
+ * has leading zeros to make it as long as the longer end, counting a
2377
+ * `-` sign. So `{-05..3}` makes `-05` to `-01`, then `000` to `003`.
2378
+ *
2379
+ * Returns undefined if either end is not a safe integer.
2380
+ */
2381
+ const numericRange = (loStr, hiStr) => {
2382
+ let lo = Number(loStr);
2383
+ let hi = Number(hiStr);
2384
+ if (!Number.isSafeInteger(lo) || !Number.isSafeInteger(hi)) return;
2385
+ if (lo > hi) [lo, hi] = [hi, lo];
2386
+ const width = /^-?0\d/.test(loStr) || /^-?0\d/.test(hiStr) ? Math.max(loStr.length, hiStr.length) : 0;
2387
+ const out = [];
2388
+ if (lo < 0) {
2389
+ const neg = nonneg(Math.max(-hi, 1), -lo, width && width - 1);
2390
+ out.push(...neg.map((s) => [{
2391
+ t: "lit",
2392
+ ch: "-"
2393
+ }, ...s]));
2394
+ }
2395
+ if (hi >= 0) out.push(...nonneg(Math.max(lo, 0), hi, width));
2396
+ return out;
2374
2397
  };
2375
- //#endregion
2376
- //#region ../../node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/brace-expressions.js
2398
+ // ../../node_modules/.pnpm/@isaacs+nonrecursive-glob-match@1.1.0/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.js
2377
2399
  const posixClasses = {
2378
- "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
2379
- "[:alpha:]": ["\\p{L}\\p{Nl}", true],
2380
- "[:ascii:]": ["\\x00-\\x7f", false],
2381
- "[:blank:]": ["\\p{Zs}\\t", true],
2382
- "[:cntrl:]": ["\\p{Cc}", true],
2383
- "[:digit:]": ["\\p{Nd}", true],
2384
- "[:graph:]": [
2385
- "\\p{Z}\\p{C}",
2386
- true,
2387
- true
2388
- ],
2389
- "[:lower:]": ["\\p{Ll}", true],
2400
+ "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}"],
2401
+ "[:alpha:]": ["\\p{L}\\p{Nl}"],
2402
+ "[:ascii:]": ["\\x00-\\x7f"],
2403
+ "[:blank:]": ["\\p{Zs}\\t"],
2404
+ "[:cntrl:]": ["\\p{Cc}"],
2405
+ "[:digit:]": ["\\p{Nd}"],
2406
+ "[:graph:]": ["\\p{Z}\\p{C}", true],
2407
+ "[:lower:]": ["\\p{Ll}"],
2390
2408
  "[:print:]": ["\\p{C}", true],
2391
- "[:punct:]": ["\\p{P}", true],
2392
- "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
2393
- "[:upper:]": ["\\p{Lu}", true],
2394
- "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
2395
- "[:xdigit:]": ["A-Fa-f0-9", false]
2409
+ "[:punct:]": ["\\p{P}\\p{S}"],
2410
+ "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f"],
2411
+ "[:upper:]": ["\\p{Lu}"],
2412
+ "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}"],
2413
+ "[:xdigit:]": ["A-Fa-f0-9"]
2396
2414
  };
2397
2415
  const braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
2398
- const regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
2399
- const rangesToString = (ranges) => ranges.join("");
2400
- const parseClass = (glob, position) => {
2416
+ const noMatch = /$./;
2417
+ const parseClass = (glob, position, nocase = false, form) => {
2418
+ const norm = (c) => {
2419
+ const n = form ? c.normalize(form) : c;
2420
+ return [...n].length === 1 ? n : c;
2421
+ };
2401
2422
  const pos = position;
2402
2423
  /* c8 ignore start */
2403
2424
  if (glob.charAt(pos) !== "[") throw new Error("not in a brace expression");
@@ -2406,13 +2427,12 @@ const parseClass = (glob, position) => {
2406
2427
  const negs = [];
2407
2428
  let i = pos + 1;
2408
2429
  let sawStart = false;
2409
- let uflag = false;
2410
2430
  let escaping = false;
2411
2431
  let negate = false;
2412
2432
  let endPos = pos;
2413
2433
  let rangeStart = "";
2414
2434
  WHILE: while (i < glob.length) {
2415
- const c = glob.charAt(i);
2435
+ const c = String.fromCodePoint(glob.codePointAt(i));
2416
2436
  if ((c === "!" || c === "^") && i === pos + 1) {
2417
2437
  negate = true;
2418
2438
  i++;
@@ -2431,607 +2451,659 @@ const parseClass = (glob, position) => {
2431
2451
  }
2432
2452
  }
2433
2453
  if (c === "[" && !escaping) {
2434
- for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) if (glob.startsWith(cls, i)) {
2435
- if (rangeStart) return [
2436
- "$.",
2437
- false,
2438
- glob.length - pos,
2439
- true
2440
- ];
2454
+ for (const [cls, [unip, neg]] of Object.entries(posixClasses)) if (glob.startsWith(cls, i)) {
2455
+ if (rangeStart) return [noMatch, glob.length - pos];
2441
2456
  i += cls.length;
2442
2457
  if (neg) negs.push(unip);
2443
2458
  else ranges.push(unip);
2444
- uflag = uflag || u;
2445
2459
  continue WHILE;
2446
2460
  }
2447
2461
  }
2448
2462
  escaping = false;
2463
+ const n = norm(c);
2449
2464
  if (rangeStart) {
2450
- if (c > rangeStart) ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
2451
- else if (c === rangeStart) ranges.push(braceEscape(c));
2465
+ if (n.codePointAt(0) > rangeStart.codePointAt(0)) ranges.push(braceEscape(rangeStart) + "-" + braceEscape(n));
2466
+ else if (n === rangeStart) ranges.push(braceEscape(n));
2452
2467
  rangeStart = "";
2453
- i++;
2468
+ i += c.length;
2454
2469
  continue;
2455
2470
  }
2456
- if (glob.startsWith("-]", i + 1)) {
2457
- ranges.push(braceEscape(c + "-"));
2458
- i += 2;
2471
+ if (glob.startsWith("-]", i + c.length)) {
2472
+ ranges.push(braceEscape(n + "-"));
2473
+ i += c.length + 1;
2459
2474
  continue;
2460
2475
  }
2461
- if (glob.startsWith("-", i + 1)) {
2462
- rangeStart = c;
2463
- i += 2;
2476
+ if (glob.startsWith("-", i + c.length)) {
2477
+ rangeStart = n;
2478
+ i += c.length + 1;
2464
2479
  continue;
2465
2480
  }
2466
- ranges.push(braceEscape(c));
2467
- i++;
2468
- }
2469
- if (endPos < i) return [
2470
- "",
2471
- false,
2472
- 0,
2473
- false
2474
- ];
2475
- if (!ranges.length && !negs.length) return [
2476
- "$.",
2477
- false,
2478
- glob.length - pos,
2479
- true
2480
- ];
2481
- if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
2482
- const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
2483
- return [
2484
- regexpEscape(r),
2485
- false,
2486
- endPos - pos,
2487
- false
2488
- ];
2481
+ ranges.push(braceEscape(n));
2482
+ i += c.length;
2489
2483
  }
2490
- const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
2491
- const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
2492
- return [
2493
- ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs,
2494
- uflag,
2495
- endPos - pos,
2496
- true
2497
- ];
2484
+ if (endPos < i) return [noMatch, 0];
2485
+ if (!ranges.length && !negs.length) return [noMatch, glob.length - pos];
2486
+ const sranges = "[" + (negate ? "^" : "") + ranges.join("") + "]";
2487
+ const snegs = "[" + (negate ? "" : "^") + negs.join("") + "]";
2488
+ const comb = "^" + (ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs);
2489
+ return [new RegExp(comb, nocase ? "iu" : "u"), endPos - pos];
2498
2490
  };
2499
- //#endregion
2500
- //#region ../../node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/unescape.js
2501
- /**
2502
- * Un-escape a string that has been escaped with {@link escape}.
2503
- *
2504
- * If the {@link MinimatchOptions.windowsPathsNoEscape} option is used, then
2505
- * square-bracket escapes are removed, but not backslash escapes.
2506
- *
2507
- * For example, it will turn the string `'[*]'` into `*`, but it will not
2508
- * turn `'\\*'` into `'*'`, because `\` is a path separator in
2509
- * `windowsPathsNoEscape` mode.
2510
- *
2511
- * When `windowsPathsNoEscape` is not set, then both square-bracket escapes and
2512
- * backslash escapes are removed.
2513
- *
2514
- * Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
2515
- * or unescaped.
2516
- *
2517
- * When `magicalBraces` is not set, escapes of braces (`{` and `}`) will not be
2518
- * unescaped.
2519
- */
2520
- const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
2521
- if (magicalBraces) return windowsPathsNoEscape ? s.replace(/\[([^/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1");
2522
- return windowsPathsNoEscape ? s.replace(/\[([^/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
2491
+ // ../../node_modules/.pnpm/@isaacs+nonrecursive-glob-match@1.1.0/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.js
2492
+ const MATCH = {
2493
+ t: "match",
2494
+ id: 0
2523
2495
  };
2524
- //#endregion
2525
- //#region ../../node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/ast.js
2526
- var _a;
2527
- const types = /* @__PURE__ */ new Set([
2528
- "!",
2529
- "?",
2530
- "+",
2531
- "*",
2532
- "@"
2533
- ]);
2534
- const isExtglobType = (c) => types.has(c);
2535
- const isExtglobAST = (c) => isExtglobType(c.type);
2536
- const adoptionMap = /* @__PURE__ */ new Map([
2537
- ["!", ["@"]],
2538
- ["?", ["?", "@"]],
2539
- ["@", ["@"]],
2540
- ["*", [
2541
- "*",
2542
- "+",
2543
- "?",
2544
- "@"
2545
- ]],
2546
- ["+", ["+", "@"]]
2547
- ]);
2548
- const adoptionWithSpaceMap = /* @__PURE__ */ new Map([
2549
- ["!", ["?"]],
2550
- ["@", ["?"]],
2551
- ["+", ["?", "*"]]
2552
- ]);
2553
- const adoptionAnyMap = /* @__PURE__ */ new Map([
2554
- ["!", ["?", "@"]],
2555
- ["?", ["?", "@"]],
2556
- ["@", ["?", "@"]],
2557
- ["*", [
2558
- "*",
2559
- "+",
2560
- "?",
2561
- "@"
2562
- ]],
2563
- ["+", [
2564
- "+",
2565
- "@",
2566
- "?",
2567
- "*"
2568
- ]]
2569
- ]);
2570
- const usurpMap = /* @__PURE__ */ new Map([
2571
- ["!", /* @__PURE__ */ new Map([["!", "@"]])],
2572
- ["?", /* @__PURE__ */ new Map([["*", "*"], ["+", "*"]])],
2573
- ["@", /* @__PURE__ */ new Map([
2574
- ["!", "!"],
2575
- ["?", "?"],
2576
- ["@", "@"],
2577
- ["*", "*"],
2578
- ["+", "+"]
2579
- ])],
2580
- ["+", /* @__PURE__ */ new Map([["?", "*"], ["*", "*"]])]
2581
- ]);
2582
- const startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
2583
- const startNoDot = "(?!\\.)";
2584
- const addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
2585
- const justDots = /* @__PURE__ */ new Set(["..", "."]);
2586
- const reSpecials = /* @__PURE__ */ new Set("().*{}+?[]^$\\!");
2587
- const regExpEscape$1 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
2588
- const qmark = "[^/]";
2589
- const star$1 = "[^/]*?";
2590
- const starNoEmpty = "[^/]+?";
2591
- let ID = 0;
2592
- var AST = class {
2593
- type;
2594
- #root;
2595
- #hasMagic;
2596
- #uflag = false;
2597
- #parts = [];
2598
- #parent;
2599
- #parentIndex;
2600
- #negs;
2601
- #filledNegs = false;
2602
- #options;
2603
- #toString;
2604
- #emptyExt = false;
2605
- id = ++ID;
2606
- get depth() {
2607
- return (this.#parent?.depth ?? -1) + 1;
2608
- }
2609
- [Symbol.for("nodejs.util.inspect.custom")]() {
2610
- return {
2611
- "@@type": "AST",
2612
- id: this.id,
2613
- type: this.type,
2614
- root: this.#root.id,
2615
- parent: this.#parent?.id,
2616
- depth: this.depth,
2617
- partsLength: this.#parts.length,
2618
- parts: this.#parts
2619
- };
2620
- }
2621
- constructor(type, parent, options = {}) {
2622
- this.type = type;
2623
- if (type) this.#hasMagic = true;
2624
- this.#parent = parent;
2625
- this.#root = this.#parent ? this.#parent.#root : this;
2626
- this.#options = this.#root === this ? options : this.#root.#options;
2627
- this.#negs = this.#root === this ? [] : this.#root.#negs;
2628
- if (type === "!" && !this.#root.#filledNegs) this.#negs.push(this);
2629
- this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
2630
- }
2631
- get hasMagic() {
2632
- /* c8 ignore start */
2633
- if (this.#hasMagic !== void 0) return this.#hasMagic;
2634
- /* c8 ignore stop */
2635
- for (const p of this.#parts) {
2636
- if (typeof p === "string") continue;
2637
- if (p.type || p.hasMagic) return this.#hasMagic = true;
2638
- }
2639
- return this.#hasMagic;
2640
- }
2641
- toString() {
2642
- return this.#toString !== void 0 ? this.#toString : !this.type ? this.#toString = this.#parts.map((p) => String(p)).join("") : this.#toString = this.type + "(" + this.#parts.map((p) => String(p)).join("|") + ")";
2643
- }
2644
- #fillNegs() {
2645
- /* c8 ignore start */
2646
- if (this !== this.#root) throw new Error("should only call on root");
2647
- if (this.#filledNegs) return this;
2648
- /* c8 ignore stop */
2649
- this.toString();
2650
- this.#filledNegs = true;
2651
- let n;
2652
- while (n = this.#negs.pop()) {
2653
- if (n.type !== "!") continue;
2654
- let p = n;
2655
- let pp = p.#parent;
2656
- while (pp) {
2657
- for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) for (const part of n.#parts) {
2658
- /* c8 ignore start */
2659
- if (typeof part === "string") throw new Error("string part in extglob AST??");
2660
- /* c8 ignore stop */
2661
- part.copyIn(pp.#parts[i]);
2496
+ const extTypes = "!?+*@";
2497
+ const lit = (ch) => ({
2498
+ t: "lit",
2499
+ ch
2500
+ });
2501
+ const reEscape = (s) => s.replace(/[\\^$.*+?()[\]{}|/]/g, "\\$&");
2502
+ const newFoldRe = (s) => new RegExp(`^${reEscape(s)}$`, "iu");
2503
+ const foldCache = /* @__PURE__ */ new Map();
2504
+ const foldRe = (ch) => {
2505
+ let re = foldCache.get(ch);
2506
+ if (!re) {
2507
+ re = newFoldRe(ch);
2508
+ if (foldCache.size >= 1e3) foldCache.clear();
2509
+ foldCache.set(ch, re);
2510
+ }
2511
+ return re;
2512
+ };
2513
+ const litMatch = (l, c) => {
2514
+ if (c === l.ch) return true;
2515
+ if (!l.re) return false;
2516
+ const code = c.charCodeAt(0);
2517
+ if (code >= 128) return l.re.test(c);
2518
+ const ascii = l.ascii ??= /* @__PURE__ */ new Uint8Array(128);
2519
+ ascii[code] ||= l.re.test(c) ? 1 : 2;
2520
+ return ascii[code] === 1;
2521
+ };
2522
+ const tokenize = (p, nocase, noext, form, mark) => {
2523
+ const toks = [];
2524
+ for (let i = 0; i < p.length;) {
2525
+ const c = String.fromCodePoint(p.codePointAt(i));
2526
+ if (mark) {
2527
+ const m = c === "\\" && p.startsWith(mark, i + 1) ? 1 : 0;
2528
+ if (m || c === mark) {
2529
+ const start = i + m + mark.length;
2530
+ const end = p.indexOf(mark, start);
2531
+ const r = /^(-?\d+)\.\.(-?\d+)$/.exec(p.slice(start, end));
2532
+ const alts = end !== -1 && r && numericRange(r[1], r[2]);
2533
+ if (alts) {
2534
+ toks.push({
2535
+ t: "ext",
2536
+ type: "@",
2537
+ alts
2538
+ });
2539
+ i = end + mark.length;
2540
+ continue;
2662
2541
  }
2663
- p = pp;
2664
- pp = p.#parent;
2665
2542
  }
2666
2543
  }
2667
- return this;
2668
- }
2669
- push(...parts) {
2670
- for (const p of parts) {
2671
- if (p === "") continue;
2672
- /* c8 ignore start */
2673
- if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) throw new Error("invalid part: " + p);
2674
- /* c8 ignore stop */
2675
- this.#parts.push(p);
2544
+ if (c === "\\") {
2545
+ const e = p.codePointAt(i + 1);
2546
+ const ch = e === void 0 ? c : String.fromCodePoint(e);
2547
+ toks.push(lit(ch));
2548
+ i += 1 + ch.length;
2549
+ continue;
2676
2550
  }
2551
+ if (c === "[") {
2552
+ const [re, consumed] = parseClass(p, i, nocase, form);
2553
+ if (consumed) {
2554
+ toks.push({
2555
+ t: "class",
2556
+ re
2557
+ });
2558
+ i += consumed;
2559
+ continue;
2560
+ }
2561
+ }
2562
+ if (!noext && extTypes.includes(c) && p[i + 1] === "(") {
2563
+ toks.push({
2564
+ t: "open",
2565
+ type: c
2566
+ });
2567
+ i += 2;
2568
+ continue;
2569
+ }
2570
+ toks.push(!noext && c === "|" ? { t: "bar" } : !noext && c === ")" ? { t: "close" } : c === "*" ? { t: "star" } : c === "?" ? { t: "any" } : lit(c));
2571
+ i += c.length;
2677
2572
  }
2678
- toJSON() {
2679
- const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
2680
- if (this.isStart() && !this.type) ret.unshift([]);
2681
- if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === "!")) ret.push({});
2682
- return ret;
2573
+ return toks;
2574
+ };
2575
+ const pair = (toks) => {
2576
+ const pairs = /* @__PURE__ */ new Map();
2577
+ const stack = [];
2578
+ toks.forEach((tok, i) => {
2579
+ if (tok.t === "open") stack.push(i);
2580
+ else if (tok.t === "close" && stack.length) pairs.set(stack.pop(), i);
2581
+ });
2582
+ return pairs;
2583
+ };
2584
+ const build = (toks, pairs, start, end, top) => {
2585
+ let seq = [];
2586
+ const alts = [seq];
2587
+ for (let i = start; i < end; i++) {
2588
+ const tok = toks[i];
2589
+ const close = pairs.get(i);
2590
+ if (tok.t === "open" && close !== void 0) {
2591
+ const sub = build(toks, pairs, i + 1, close, false);
2592
+ seq.push({
2593
+ t: "ext",
2594
+ type: tok.type,
2595
+ alts: sub
2596
+ });
2597
+ i = close;
2598
+ } else if (tok.t === "bar" && !top) alts.push(seq = []);
2599
+ else if (tok.t === "open") seq.push(lit(tok.type), lit("("));
2600
+ else if (tok.t === "bar") seq.push(lit("|"));
2601
+ else if (tok.t === "close") seq.push(lit(")"));
2602
+ else seq.push(tok);
2603
+ }
2604
+ return alts;
2605
+ };
2606
+ const normalize = (items, form) => {
2607
+ const out = [];
2608
+ let run = "";
2609
+ const flush = () => {
2610
+ for (const ch of run.normalize(form)) out.push(lit(ch));
2611
+ run = "";
2612
+ };
2613
+ for (const it of items) {
2614
+ if (it.t === "lit") {
2615
+ run += it.ch;
2616
+ continue;
2617
+ }
2618
+ flush();
2619
+ out.push(it.t === "ext" ? {
2620
+ ...it,
2621
+ alts: it.alts.map((a) => normalize(a, form))
2622
+ } : it);
2683
2623
  }
2684
- isStart() {
2685
- if (this.#root === this) return true;
2686
- if (!this.#parent?.isStart()) return false;
2687
- if (this.#parentIndex === 0) return true;
2688
- const p = this.#parent;
2689
- for (let i = 0; i < this.#parentIndex; i++) {
2690
- const pp = p.#parts[i];
2691
- if (!(pp instanceof _a && pp.type === "!")) return false;
2624
+ flush();
2625
+ return out;
2626
+ };
2627
+ const compile = (items, nocase) => {
2628
+ let id = 1;
2629
+ const split = (out) => ({
2630
+ t: "split",
2631
+ id: id++,
2632
+ out
2633
+ });
2634
+ const seq = (items, next) => items.reduceRight((next, it) => item(it, next), next);
2635
+ const item = (it, next) => {
2636
+ switch (it.t) {
2637
+ case "lit":
2638
+ const re = nocase ? foldRe(it.ch) : void 0;
2639
+ return {
2640
+ t: "lit",
2641
+ id: id++,
2642
+ ch: it.ch,
2643
+ re,
2644
+ next
2645
+ };
2646
+ case "any":
2647
+ case "star": return {
2648
+ t: it.t,
2649
+ id: id++,
2650
+ next
2651
+ };
2652
+ case "class": return {
2653
+ t: "class",
2654
+ id: id++,
2655
+ re: it.re,
2656
+ next
2657
+ };
2658
+ }
2659
+ const alts = (next) => it.alts.map((a) => seq(a, next));
2660
+ switch (it.type) {
2661
+ case "@": return split(alts(next));
2662
+ case "?": return split([next, ...alts(next)]);
2663
+ case "!": return {
2664
+ t: "neg",
2665
+ id: id++,
2666
+ sub: split(alts(MATCH)),
2667
+ next
2668
+ };
2692
2669
  }
2670
+ const after = split([]);
2671
+ const entry = split(alts(after));
2672
+ after.out.push(next, entry);
2673
+ return it.type === "*" ? after : entry;
2674
+ };
2675
+ return [seq(items, MATCH), id];
2676
+ };
2677
+ const show = (start) => {
2678
+ const lines = [];
2679
+ const seen = /* @__PURE__ */ new Set();
2680
+ const ref = (n) => n.t === "match" ? "match" : String(n.id);
2681
+ const walk = (n, indent) => {
2682
+ if (n.t === "match" || seen.has(n)) return;
2683
+ seen.add(n);
2684
+ const line = (desc) => lines.push(`${indent}${n.id}: ${desc}`);
2685
+ switch (n.t) {
2686
+ case "split":
2687
+ line(`split -> ${n.out.map(ref).join(", ")}`);
2688
+ for (const o of n.out) walk(o, indent);
2689
+ return;
2690
+ case "neg":
2691
+ line(`!(${ref(n.sub)}) -> ${ref(n.next)}`);
2692
+ walk(n.sub, indent + " ");
2693
+ return walk(n.next, indent);
2694
+ case "lit":
2695
+ line(`${JSON.stringify(n.ch)} -> ${ref(n.next)}`);
2696
+ break;
2697
+ case "class":
2698
+ line(`${n.re} -> ${ref(n.next)}`);
2699
+ break;
2700
+ default: line(`${n.t === "any" ? "?" : "*"} -> ${ref(n.next)}`);
2701
+ }
2702
+ walk(n.next, indent);
2703
+ };
2704
+ walk(start, "");
2705
+ return [`start -> ${ref(start)}`, ...lines].join("\n");
2706
+ };
2707
+ var State = class {
2708
+ gen;
2709
+ threads = [];
2710
+ match = false;
2711
+ runs = [];
2712
+ ids = [];
2713
+ constructor(gen) {
2714
+ this.gen = gen;
2715
+ }
2716
+ get dead() {
2717
+ return !this.threads.length && !this.match && !this.runs.length;
2718
+ }
2719
+ };
2720
+ const sameState = (a, b) => {
2721
+ if (a.ids.length !== b.ids.length) return false;
2722
+ if (a.runs.length !== b.runs.length) return false;
2723
+ if (a.ids.some((id, i) => id !== b.ids[i])) return false;
2724
+ return a.runs.every((r) => b.runs.some((o) => o.neg === r.neg && sameState(o.state, r.state)));
2725
+ };
2726
+ const marks = (size) => ({
2727
+ has: new Float64Array(size),
2728
+ seen: new Float64Array(size),
2729
+ gen: 0
2730
+ });
2731
+ var Sim = class {
2732
+ dots;
2733
+ dotStart;
2734
+ #marks;
2735
+ constructor(dots, dotStart, marks) {
2736
+ this.dots = dots;
2737
+ this.dotStart = dotStart;
2738
+ this.#marks = marks;
2739
+ }
2740
+ state() {
2741
+ return new State(++this.#marks.gen);
2742
+ }
2743
+ done(state) {
2744
+ state.ids = state.threads.map((n) => n.id).sort((a, b) => a - b);
2745
+ if (state.match) state.ids.unshift(MATCH.id);
2746
+ return state;
2747
+ }
2748
+ #visit(state, node) {
2749
+ const { seen } = this.#marks;
2750
+ if (seen[node.id] === state.gen) return false;
2751
+ seen[node.id] = state.gen;
2693
2752
  return true;
2694
2753
  }
2695
- isEnd() {
2696
- if (this.#root === this) return true;
2697
- if (this.#parent?.type === "!") return true;
2698
- if (!this.#parent?.isEnd()) return false;
2699
- if (!this.type) return this.#parent?.isEnd();
2700
- /* c8 ignore start */
2701
- const pl = this.#parent ? this.#parent.#parts.length : 0;
2702
- /* c8 ignore stop */
2703
- return this.#parentIndex === pl - 1;
2704
- }
2705
- copyIn(part) {
2706
- if (typeof part === "string") this.push(part);
2707
- else this.push(part.clone(this));
2708
- }
2709
- clone(parent) {
2710
- const c = new _a(this.type, parent);
2711
- for (const p of this.#parts) c.copyIn(p);
2712
- return c;
2713
- }
2714
- static #parseAST(str, ast, pos, opt, extDepth) {
2715
- const maxDepth = opt.maxExtglobRecursion ?? 2;
2716
- let escaping = false;
2717
- let inBrace = false;
2718
- let braceStart = -1;
2719
- let braceNeg = false;
2720
- if (ast.type === null) {
2721
- let i = pos;
2722
- let acc = "";
2723
- while (i < str.length) {
2724
- const c = str.charAt(i++);
2725
- if (escaping || c === "\\") {
2726
- escaping = !escaping;
2727
- acc += c;
2728
- continue;
2729
- }
2730
- if (inBrace) {
2731
- if (i === braceStart + 1) {
2732
- if (c === "^" || c === "!") braceNeg = true;
2733
- } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) inBrace = false;
2734
- acc += c;
2735
- continue;
2736
- } else if (c === "[") {
2737
- inBrace = true;
2738
- braceStart = i;
2739
- braceNeg = false;
2740
- acc += c;
2741
- continue;
2742
- }
2743
- if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && extDepth <= maxDepth) {
2744
- ast.push(acc);
2745
- acc = "";
2746
- const ext = new _a(c, ast);
2747
- i = _a.#parseAST(str, ext, i, opt, extDepth + 1);
2748
- ast.push(ext);
2749
- continue;
2750
- }
2751
- acc += c;
2752
- }
2753
- ast.push(acc);
2754
- return i;
2755
- }
2756
- let i = pos + 1;
2757
- let part = new _a(null, ast);
2758
- const parts = [];
2759
- let acc = "";
2760
- while (i < str.length) {
2761
- const c = str.charAt(i++);
2762
- if (escaping || c === "\\") {
2763
- escaping = !escaping;
2764
- acc += c;
2765
- continue;
2766
- }
2767
- if (inBrace) {
2768
- if (i === braceStart + 1) {
2769
- if (c === "^" || c === "!") braceNeg = true;
2770
- } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) inBrace = false;
2771
- acc += c;
2772
- continue;
2773
- } else if (c === "[") {
2774
- inBrace = true;
2775
- braceStart = i;
2776
- braceNeg = false;
2777
- acc += c;
2778
- continue;
2779
- }
2780
- /* c8 ignore stop */
2781
- if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && (extDepth <= maxDepth || ast && ast.#canAdoptType(c))) {
2782
- const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
2783
- part.push(acc);
2784
- acc = "";
2785
- const ext = new _a(c, part);
2786
- part.push(ext);
2787
- i = _a.#parseAST(str, ext, i, opt, extDepth + depthAdd);
2788
- continue;
2789
- }
2790
- if (c === "|") {
2791
- part.push(acc);
2792
- acc = "";
2793
- parts.push(part);
2794
- part = new _a(null, ast);
2795
- continue;
2796
- }
2797
- if (c === ")") {
2798
- if (acc === "" && ast.#parts.length === 0) ast.#emptyExt = true;
2799
- part.push(acc);
2800
- acc = "";
2801
- ast.push(...parts, part);
2802
- return i;
2803
- }
2804
- acc += c;
2805
- }
2806
- ast.type = null;
2807
- ast.#hasMagic = void 0;
2808
- ast.#parts = [str.substring(pos - 1)];
2809
- return i;
2810
- }
2811
- #canAdoptWithSpace(child) {
2812
- return this.#canAdopt(child, adoptionWithSpaceMap);
2813
- }
2814
- #canAdopt(child, map = adoptionMap) {
2815
- if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) return false;
2816
- const gc = child.#parts[0];
2817
- if (!gc || typeof gc !== "object" || gc.type === null) return false;
2818
- return this.#canAdoptType(gc.type, map);
2819
- }
2820
- #canAdoptType(c, map = adoptionAnyMap) {
2821
- return !!map.get(this.type)?.includes(c);
2822
- }
2823
- #adoptWithSpace(child, index) {
2824
- const gc = child.#parts[0];
2825
- const blank = new _a(null, gc, this.options);
2826
- blank.#parts.push("");
2827
- gc.push(blank);
2828
- this.#adopt(child, index);
2829
- }
2830
- #adopt(child, index) {
2831
- const gc = child.#parts[0];
2832
- this.#parts.splice(index, 1, ...gc.#parts);
2833
- for (const p of gc.#parts) if (typeof p === "object") p.#parent = this;
2834
- this.#toString = void 0;
2835
- }
2836
- #canUsurpType(c) {
2837
- return !!usurpMap.get(this.type)?.has(c);
2838
- }
2839
- #canUsurp(child) {
2840
- if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) return false;
2841
- const gc = child.#parts[0];
2842
- if (!gc || typeof gc !== "object" || gc.type === null) return false;
2843
- return this.#canUsurpType(gc.type);
2844
- }
2845
- #usurp(child) {
2846
- const m = usurpMap.get(this.type);
2847
- const gc = child.#parts[0];
2848
- const nt = m?.get(gc.type);
2849
- /* c8 ignore start - impossible */
2850
- if (!nt) return false;
2851
- /* c8 ignore stop */
2852
- this.#parts = gc.#parts;
2853
- for (const p of this.#parts) if (typeof p === "object") p.#parent = this;
2854
- this.type = nt;
2855
- this.#toString = void 0;
2856
- this.#emptyExt = false;
2857
- }
2858
- static fromGlob(pattern, options = {}) {
2859
- const ast = new _a(null, void 0, options);
2860
- _a.#parseAST(pattern, ast, 0, options, 0);
2861
- return ast;
2862
- }
2863
- toMMPattern() {
2864
- /* c8 ignore start */
2865
- if (this !== this.#root) return this.#root.toMMPattern();
2866
- /* c8 ignore stop */
2867
- const glob = this.toString();
2868
- const [re, body, hasMagic, uflag] = this.toRegExpSource();
2869
- if (!(hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase())) return body;
2870
- const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
2871
- return Object.assign(new RegExp(`^${re}$`, flags), {
2872
- _src: re,
2873
- _glob: glob
2874
- });
2754
+ #addThread(state, node) {
2755
+ const { has } = this.#marks;
2756
+ if (has[node.id] === state.gen) return false;
2757
+ has[node.id] = state.gen;
2758
+ state.threads.push(node);
2759
+ return true;
2875
2760
  }
2876
- get options() {
2877
- return this.#options;
2878
- }
2879
- toRegExpSource(allowDot) {
2880
- const dot = allowDot ?? !!this.#options.dot;
2881
- if (this.#root === this) {
2882
- this.#flatten();
2883
- this.#fillNegs();
2884
- }
2885
- if (!isExtglobAST(this)) {
2886
- const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
2887
- const src = this.#parts.map((p) => {
2888
- const [re, _, hasMagic, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
2889
- this.#hasMagic = this.#hasMagic || hasMagic;
2890
- this.#uflag = this.#uflag || uflag;
2891
- return re;
2892
- }).join("");
2893
- let start = "";
2894
- if (this.isStart()) {
2895
- if (typeof this.#parts[0] === "string") {
2896
- if (!(this.#parts.length === 1 && justDots.has(this.#parts[0]))) {
2897
- const aps = addPatternStart;
2898
- const needNoTrav = dot && aps.has(src.charAt(0)) || src.startsWith("\\.") && aps.has(src.charAt(2)) || src.startsWith("\\.\\.") && aps.has(src.charAt(4));
2899
- const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
2900
- start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
2901
- }
2902
- }
2903
- }
2904
- let end = "";
2905
- if (this.isEnd() && this.#root.#filledNegs && this.#parent?.type === "!") end = "(?:$|\\/)";
2906
- return [
2907
- start + src + end,
2908
- unescape(src),
2909
- this.#hasMagic = !!this.#hasMagic,
2910
- this.#uflag
2911
- ];
2912
- }
2913
- const repeated = this.type === "*" || this.type === "+";
2914
- const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
2915
- let body = this.#partsToRegExp(dot);
2916
- if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
2917
- const s = this.toString();
2918
- const me = this;
2919
- me.#parts = [s];
2920
- me.type = null;
2921
- me.#hasMagic = void 0;
2922
- return [
2923
- s,
2924
- unescape(this.toString()),
2925
- false,
2926
- false
2927
- ];
2928
- }
2929
- let bodyDotAllowed = !repeated || allowDot || dot || false ? "" : this.#partsToRegExp(true);
2930
- if (bodyDotAllowed === body) bodyDotAllowed = "";
2931
- if (bodyDotAllowed) body = `(?:${body})(?:${bodyDotAllowed})*?`;
2932
- let final = "";
2933
- if (this.type === "!" && this.#emptyExt) final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
2934
- else {
2935
- const close = this.type === "!" ? "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + "[^/]*?)" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
2936
- final = start + body + close;
2937
- }
2938
- return [
2939
- final,
2940
- unescape(body),
2941
- this.#hasMagic = !!this.#hasMagic,
2942
- this.#uflag
2943
- ];
2761
+ restricted(i, top) {
2762
+ return top && (this.dots || this.dotStart && i === 0);
2944
2763
  }
2945
- #flatten() {
2946
- if (!isExtglobAST(this)) {
2947
- for (const p of this.#parts) if (typeof p === "object") p.#flatten();
2948
- } else {
2949
- let iterations = 0;
2950
- let done = false;
2951
- do {
2952
- done = true;
2953
- for (let i = 0; i < this.#parts.length; i++) {
2954
- const c = this.#parts[i];
2955
- if (typeof c === "object") {
2956
- c.#flatten();
2957
- if (this.#canAdopt(c)) {
2958
- done = false;
2959
- this.#adopt(c, i);
2960
- } else if (this.#canAdoptWithSpace(c)) {
2961
- done = false;
2962
- this.#adoptWithSpace(c, i);
2963
- } else if (this.#canUsurp(c)) {
2964
- done = false;
2965
- this.#usurp(c);
2966
- }
2967
- }
2968
- }
2969
- } while (!done && ++iterations < 10);
2764
+ add(state, node, i, top) {
2765
+ switch (node.t) {
2766
+ case "split":
2767
+ if (!this.#visit(state, node)) return;
2768
+ for (const o of node.out) this.add(state, o, i, top);
2769
+ return;
2770
+ case "neg":
2771
+ if (!this.#visit(state, node)) return;
2772
+ const sub = this.state();
2773
+ this.add(sub, node.sub, i, false);
2774
+ this.done(sub);
2775
+ return this.addRun(state, {
2776
+ t: "run",
2777
+ neg: node,
2778
+ state: sub
2779
+ }, i, top);
2780
+ case "star":
2781
+ if (this.restricted(i, top)) return;
2782
+ if (this.#addThread(state, node)) this.add(state, node.next, i, top);
2783
+ return;
2784
+ case "match":
2785
+ state.match = true;
2786
+ return;
2787
+ default: this.#addThread(state, node);
2970
2788
  }
2971
- this.#toString = void 0;
2972
2789
  }
2973
- #partsToRegExp(dot) {
2974
- return this.#parts.map((p) => {
2975
- /* c8 ignore start */
2976
- if (typeof p === "string") throw new Error("string type in extglob ast??");
2977
- /* c8 ignore stop */
2978
- const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot);
2979
- this.#uflag = this.#uflag || uflag;
2980
- return re;
2981
- }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
2982
- }
2983
- static #parseGlob(glob, hasMagic, noEmpty = false) {
2984
- let escaping = false;
2985
- let re = "";
2986
- let uflag = false;
2987
- let inStar = false;
2988
- for (let i = 0; i < glob.length; i++) {
2989
- const c = glob.charAt(i);
2990
- if (escaping) {
2991
- escaping = false;
2992
- re += (reSpecials.has(c) ? "\\" : "") + c;
2993
- continue;
2994
- }
2995
- if (c === "*") {
2996
- if (inStar) continue;
2997
- inStar = true;
2998
- re += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star$1;
2999
- hasMagic = true;
3000
- continue;
3001
- } else inStar = false;
3002
- if (c === "\\") {
3003
- if (i === glob.length - 1) re += "\\\\";
3004
- else escaping = true;
3005
- continue;
3006
- }
3007
- if (c === "[") {
3008
- const [src, needUflag, consumed, magic] = parseClass(glob, i);
3009
- if (consumed) {
3010
- re += src;
3011
- uflag = uflag || needUflag;
3012
- i += consumed - 1;
3013
- hasMagic = hasMagic || magic;
3014
- continue;
3015
- }
3016
- }
3017
- if (c === "?") {
3018
- re += qmark;
3019
- hasMagic = true;
2790
+ addRun(state, run, i, top) {
2791
+ for (const r of state.runs) if (r.neg === run.neg && sameState(r.state, run.state)) return;
2792
+ state.runs.push(run);
2793
+ if (!run.state.match) this.add(state, run.neg.next, i, top);
2794
+ }
2795
+ step(state, c, i, top) {
2796
+ const next = this.state();
2797
+ for (const th of state.threads) switch (th.t) {
2798
+ case "lit":
2799
+ if (litMatch(th, c)) this.add(next, th.next, i + 1, top);
2800
+ break;
2801
+ case "any":
2802
+ if (!this.restricted(i, top)) this.add(next, th.next, i + 1, top);
2803
+ break;
2804
+ case "class":
2805
+ if (!this.restricted(i, top) && th.re.test(c)) this.add(next, th.next, i + 1, top);
2806
+ break;
2807
+ case "star": if (!this.restricted(i, top)) this.add(next, th, i + 1, top);
2808
+ }
2809
+ if (!this.restricted(i, top)) for (const run of state.runs) {
2810
+ if (run.state.dead) {
2811
+ this.addRun(next, run, i + 1, top);
3020
2812
  continue;
3021
2813
  }
3022
- re += regExpEscape$1(c);
2814
+ const sub = this.step(run.state, c, i, false);
2815
+ this.addRun(next, {
2816
+ t: "run",
2817
+ neg: run.neg,
2818
+ state: sub
2819
+ }, i + 1, top);
3023
2820
  }
3024
- return [
3025
- re,
3026
- unescape(glob),
3027
- !!hasMagic,
3028
- uflag
3029
- ];
2821
+ return this.done(next);
2822
+ }
2823
+ };
2824
+ const stateKey = (state) => {
2825
+ const ids = state.ids.join();
2826
+ if (!state.runs.length) return ids;
2827
+ return `${ids}|${state.runs.map((r) => `${r.neg.id}(${stateKey(r.state)})`).sort().join("|")}`;
2828
+ };
2829
+ const DFA_BUDGET = 1 << 18;
2830
+ var Dfa = class {
2831
+ #start;
2832
+ #states = /* @__PURE__ */ new Map();
2833
+ #size = 0;
2834
+ #plain;
2835
+ #dotStart;
2836
+ #sim;
2837
+ #dotSim;
2838
+ constructor(start, marks) {
2839
+ this.#start = start;
2840
+ this.#sim = new Sim(false, false, marks);
2841
+ this.#dotSim = new Sim(false, true, marks);
2842
+ }
2843
+ #make(state) {
2844
+ return {
2845
+ state,
2846
+ match: state.match,
2847
+ dead: state.dead,
2848
+ next: /* @__PURE__ */ new Map()
2849
+ };
2850
+ }
2851
+ #intern(state) {
2852
+ const key = stateKey(state);
2853
+ const found = this.#states.get(key);
2854
+ if (found) return found;
2855
+ if (this.#size > DFA_BUDGET) this.#clear();
2856
+ const d = this.#make(state);
2857
+ this.#states.set(key, d);
2858
+ this.#size += key.length + 1;
2859
+ return d;
2860
+ }
2861
+ #clear() {
2862
+ this.#states.clear();
2863
+ this.#size = 0;
2864
+ this.#plain = void 0;
2865
+ this.#dotStart = void 0;
2866
+ }
2867
+ start(dotStart) {
2868
+ if (dotStart) {
2869
+ if (this.#dotStart) return this.#dotStart;
2870
+ const state = this.#dotSim.state();
2871
+ this.#dotSim.add(state, this.#start, 0, true);
2872
+ return this.#dotStart = this.#make(this.#dotSim.done(state));
2873
+ }
2874
+ if (this.#plain) return this.#plain;
2875
+ const state = this.#sim.state();
2876
+ this.#sim.add(state, this.#start, 0, true);
2877
+ return this.#plain = this.#intern(this.#sim.done(state));
2878
+ }
2879
+ next(d, c) {
2880
+ const code = c.charCodeAt(0);
2881
+ const found = code < 128 ? void 0 : d.next.get(c);
2882
+ if (found) return found;
2883
+ const n = d === this.#dotStart ? this.#intern(this.#dotSim.step(d.state, c, 0, true)) : this.#intern(this.#sim.step(d.state, c, 1, true));
2884
+ if (code < 128) {
2885
+ if (!d.ascii) {
2886
+ d.ascii = new Array(128);
2887
+ this.#size += 128;
2888
+ }
2889
+ d.ascii[code] = n;
2890
+ } else d.next.set(c, n);
2891
+ this.#size++;
2892
+ return n;
3030
2893
  }
3031
2894
  };
3032
- _a = AST;
3033
- //#endregion
3034
- //#region ../../node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/escape.js
2895
+ const linear = (start) => {
2896
+ const nodes = [];
2897
+ for (let n = start; n.t !== "match"; n = n.next) {
2898
+ if (n.t === "split" || n.t === "neg") return void 0;
2899
+ nodes.push(n);
2900
+ }
2901
+ return nodes;
2902
+ };
2903
+ const testLinear = (nodes, chars, start, end) => {
2904
+ let ni = 0;
2905
+ let ci = start;
2906
+ let starNi = -1;
2907
+ let starCi = 0;
2908
+ while (ci < end) {
2909
+ const n = nodes[ni];
2910
+ if (n?.t === "star") {
2911
+ starNi = ni++;
2912
+ starCi = ci;
2913
+ continue;
2914
+ }
2915
+ const c = chars[ci];
2916
+ if (n && (n.t === "any" || n.t === "lit" && litMatch(n, c) || n.t === "class" && n.re.test(c))) {
2917
+ ni++;
2918
+ ci++;
2919
+ continue;
2920
+ }
2921
+ if (starNi === -1) return false;
2922
+ ni = starNi + 1;
2923
+ ci = ++starCi;
2924
+ }
2925
+ while (nodes[ni]?.t === "star") ni++;
2926
+ return ni === nodes.length;
2927
+ };
2928
+ const lengths = (items) => {
2929
+ let min = 0;
2930
+ let max = 0;
2931
+ for (const it of items) {
2932
+ const [lo, hi] = itemLengths(it);
2933
+ min += lo;
2934
+ max += hi;
2935
+ }
2936
+ return [min, max];
2937
+ };
2938
+ const itemLengths = (it) => {
2939
+ if (it.t === "star") return [0, Infinity];
2940
+ if (it.t !== "ext") return [1, 1];
2941
+ if (it.type === "!") return [0, Infinity];
2942
+ const alts = it.alts.map(lengths);
2943
+ const min = Math.min(...alts.map((a) => a[0]));
2944
+ const max = Math.max(...alts.map((a) => a[1]));
2945
+ const loop = max === 0 ? 0 : Infinity;
2946
+ return it.type === "@" ? [min, max] : it.type === "?" ? [0, max] : it.type === "*" ? [0, loop] : [min, loop];
2947
+ };
2948
+ const hasAffix = (lits, chars, start) => {
2949
+ for (let j = 0; j < lits.length; j++) if (!litMatch(lits[j], chars[start + j])) return false;
2950
+ return true;
2951
+ };
2952
+ const slashOrSurrogate = /[/\ud800-\udfff]/;
2953
+ const surrogate = /[\ud800-\udfff]/;
2954
+ const codePoints = (s) => surrogate.test(s) ? [...s] : s;
2955
+ const noSlash = (s) => {
2956
+ if (s.includes("/")) throw new Error("can only match a single path portion, got: " + s);
2957
+ };
2958
+ var Matcher = class {
2959
+ pattern;
2960
+ options;
2961
+ #start;
2962
+ #size;
2963
+ #marks;
2964
+ #dotsSim;
2965
+ #literal;
2966
+ #literalFold = false;
2967
+ #literalRe;
2968
+ #linear;
2969
+ #wild = false;
2970
+ #min = 0;
2971
+ #max = Infinity;
2972
+ #prefix = [];
2973
+ #suffix = [];
2974
+ #prefixStr;
2975
+ #suffixStr;
2976
+ #affix = false;
2977
+ #dfa;
2978
+ #form;
2979
+ constructor(pattern, options = {}) {
2980
+ if (pattern.includes("/")) throw new Error("can only match a single path portion, got pattern: " + pattern);
2981
+ this.pattern = pattern;
2982
+ this.options = options;
2983
+ const { nocase = false, noext = false, normalize: n } = options;
2984
+ this.#form = n === true ? "NFC" : n || void 0;
2985
+ const literal = /^[?*+@]\(\)$/.test(pattern);
2986
+ const toks = tokenize(pattern, nocase, noext || literal, this.#form, options.rangeMark);
2987
+ let [items] = build(toks, pair(toks), 0, toks.length, true);
2988
+ if (this.#form) items = normalize(items, this.#form);
2989
+ const [start, size] = compile(items, nocase);
2990
+ this.#start = start;
2991
+ this.#size = size;
2992
+ if (items.every((it) => it.t === "lit")) {
2993
+ this.#literal = items.map((it) => it.ch).join("");
2994
+ this.#literalFold = nocase;
2995
+ } else {
2996
+ const lit = (it) => it.t !== "lit" ? void 0 : nocase ? {
2997
+ ch: it.ch,
2998
+ re: foldRe(it.ch)
2999
+ } : { ch: it.ch };
3000
+ for (const it of items) {
3001
+ const l = lit(it);
3002
+ if (!l) break;
3003
+ this.#prefix.push(l);
3004
+ }
3005
+ for (let j = items.length - 1; j >= 0; j--) {
3006
+ const l = lit(items[j]);
3007
+ if (!l) break;
3008
+ this.#suffix.unshift(l);
3009
+ }
3010
+ this.#affix = !!(this.#prefix.length || this.#suffix.length);
3011
+ if (!nocase) {
3012
+ this.#prefixStr = this.#prefix.map((l) => l.ch).join("");
3013
+ this.#suffixStr = this.#suffix.map((l) => l.ch).join("");
3014
+ }
3015
+ this.#linear = linear(this.#start)?.slice(this.#prefix.length, -this.#suffix.length || void 0);
3016
+ this.#wild = !!this.#linear?.every((n) => n.t === "star" || n.t === "any");
3017
+ const [min, max] = lengths(items);
3018
+ this.#min = min;
3019
+ this.#max = max;
3020
+ }
3021
+ }
3022
+ test(s) {
3023
+ if (this.#form) {
3024
+ noSlash(s);
3025
+ return this.#test(s.normalize(this.#form));
3026
+ }
3027
+ if (slashOrSurrogate.test(s)) {
3028
+ noSlash(s);
3029
+ return this.#test(s, [...s]);
3030
+ }
3031
+ return this.#test(s, s);
3032
+ }
3033
+ /**
3034
+ * The same as {@link Matcher#test}, but the string is not checked
3035
+ * for `/` chars, so the result for a string that has one is not
3036
+ * defined. Only use it for a string that is known to be one path
3037
+ * portion, such as a part of a path that was split on `/`. It can
3038
+ * be faster, because some patterns do not need to look at each char
3039
+ * of the string.
3040
+ */
3041
+ testUnchecked(s) {
3042
+ return this.#test(this.#form ? s.normalize(this.#form) : s);
3043
+ }
3044
+ #test(s, chars) {
3045
+ if (this.#literal !== void 0) return this.#literalFold ? (this.#literalRe ??= newFoldRe(this.#literal)).test(s) : s === this.#literal;
3046
+ const min = this.#min;
3047
+ const max = this.#max;
3048
+ if (chars === void 0) {
3049
+ const most = s.length;
3050
+ const least = most + 1 >> 1;
3051
+ if (most < min || least > max) return false;
3052
+ if (least < min || most > max) chars = codePoints(s);
3053
+ }
3054
+ if (chars !== void 0 && (chars.length < min || chars.length > max)) return false;
3055
+ const prefix = this.#prefix.length;
3056
+ if (this.#affix) {
3057
+ if (this.#prefixStr !== void 0 && this.#suffixStr !== void 0) {
3058
+ if (!s.startsWith(this.#prefixStr) || !s.endsWith(this.#suffixStr)) return false;
3059
+ } else {
3060
+ chars ??= codePoints(s);
3061
+ const end = chars.length - this.#suffix.length;
3062
+ if (!hasAffix(this.#prefix, chars, 0) || !hasAffix(this.#suffix, chars, end)) return false;
3063
+ }
3064
+ }
3065
+ const dotStart = !this.options.dot && s.startsWith(".");
3066
+ if (this.#linear) {
3067
+ if (s === "." || s === "..") return false;
3068
+ if (dotStart && !prefix) return false;
3069
+ if (this.#wild) return true;
3070
+ chars ??= codePoints(s);
3071
+ const end = chars.length - this.#suffix.length;
3072
+ return testLinear(this.#linear, chars, prefix, end);
3073
+ }
3074
+ chars ??= codePoints(s);
3075
+ if (s === "." || s === "..") {
3076
+ this.#marks ??= marks(this.#size);
3077
+ const sim = this.#dotsSim ??= new Sim(true, false, this.#marks);
3078
+ const start = sim.state();
3079
+ sim.add(start, this.#start, 0, true);
3080
+ let state = sim.done(start);
3081
+ for (let i = 0; i < chars.length; i++) state = sim.step(state, chars[i], i, true);
3082
+ return state.match;
3083
+ }
3084
+ this.#marks ??= marks(this.#size);
3085
+ const dfa = this.#dfa ??= new Dfa(this.#start, this.#marks);
3086
+ let d = dfa.start(dotStart);
3087
+ const str = chars === s;
3088
+ for (let i = 0; i < chars.length; i++) {
3089
+ if (d.dead) return false;
3090
+ const code = str ? s.charCodeAt(i) : chars[i].charCodeAt(0);
3091
+ d = d.ascii?.[code] ?? dfa.next(d, chars[i]);
3092
+ }
3093
+ return d.match;
3094
+ }
3095
+ /** a readable listing of the state machine */
3096
+ toString() {
3097
+ return show(this.#start);
3098
+ }
3099
+ };
3100
+ // ../../node_modules/.pnpm/minimatch@11.0.9/node_modules/minimatch/dist/esm/assert-valid-pattern.js
3101
+ const MAX_PATTERN_LENGTH = 65536;
3102
+ const assertValidPattern = (pattern) => {
3103
+ if (typeof pattern !== "string") throw new TypeError("invalid pattern");
3104
+ if (pattern.length > MAX_PATTERN_LENGTH) throw new TypeError("pattern is too long");
3105
+ };
3106
+ // ../../node_modules/.pnpm/minimatch@11.0.9/node_modules/minimatch/dist/esm/escape.js
3035
3107
  /**
3036
3108
  * Escape all magic characters in a glob pattern.
3037
3109
  *
@@ -3043,68 +3115,154 @@ _a = AST;
3043
3115
  *
3044
3116
  * If the {@link MinimatchOptions.magicalBraces} option is used,
3045
3117
  * then braces (`{` and `}`) will be escaped.
3118
+ *
3119
+ * A leading `#` or `!` is escaped as well, so that the result is never a
3120
+ * comment or a negated pattern. In `windowsPathsNoEscape` mode, a leading
3121
+ * `!` is written as `@(!)`, because `[!` starts a negated class.
3046
3122
  */
3047
3123
  const escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
3048
- if (magicalBraces) return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
3049
- return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
3050
- };
3051
- //#endregion
3052
- //#region ../../node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/index.js
3053
- const minimatch = (p, pattern, options = {}) => {
3054
- assertValidPattern(pattern);
3055
- if (!options.nocomment && pattern.charAt(0) === "#") return false;
3056
- return new Minimatch(pattern, options).match(p);
3124
+ const e = magicalBraces ? windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&") : windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
3125
+ const c = e.charAt(0);
3126
+ if (c === "#") return (windowsPathsNoEscape ? "[#]" : "\\#") + e.slice(1);
3127
+ if (c === "!") return (windowsPathsNoEscape ? "@(!)" : "\\!") + e.slice(1);
3128
+ return e;
3057
3129
  };
3058
- const starDotExtRE = /^\*+([^+@!?*[(]*)$/;
3059
- const starDotExtTest = (ext) => (f) => !f.startsWith(".") && f.endsWith(ext);
3060
- const starDotExtTestDot = (ext) => (f) => f.endsWith(ext);
3061
- const starDotExtTestNocase = (ext) => {
3062
- ext = ext.toLowerCase();
3063
- return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext);
3064
- };
3065
- const starDotExtTestNocaseDot = (ext) => {
3066
- ext = ext.toLowerCase();
3067
- return (f) => f.toLowerCase().endsWith(ext);
3068
- };
3069
- const starDotStarRE = /^\*+\.\*+$/;
3070
- const starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
3071
- const starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
3072
- const dotStarRE = /^\.\*+$/;
3073
- const dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
3074
- const starRE = /^\*+$/;
3075
- const starTest = (f) => f.length !== 0 && !f.startsWith(".");
3076
- const starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
3077
- const qmarksRE = /^\?+([^+@!?*[(]*)?$/;
3078
- const qmarksTestNocase = ([$0, ext = ""]) => {
3079
- const noext = qmarksTestNoExt([$0]);
3080
- if (!ext) return noext;
3081
- ext = ext.toLowerCase();
3082
- return (f) => noext(f) && f.toLowerCase().endsWith(ext);
3130
+ // ../../node_modules/.pnpm/minimatch@11.0.9/node_modules/minimatch/dist/esm/unescape.js
3131
+ /**
3132
+ * Un-escape a string that has been escaped with {@link escape}.
3133
+ *
3134
+ * If the {@link MinimatchOptions.windowsPathsNoEscape} option is used, then
3135
+ * square-bracket escapes are removed, but not backslash escapes.
3136
+ *
3137
+ * For example, it will turn the string `'[*]'` into `*`, but it will not
3138
+ * turn `'\\*'` into `'*'`, because `\` is a path separator in
3139
+ * `windowsPathsNoEscape` mode.
3140
+ *
3141
+ * When `windowsPathsNoEscape` is not set, then both square-bracket escapes and
3142
+ * backslash escapes are removed.
3143
+ *
3144
+ * Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
3145
+ * or unescaped.
3146
+ *
3147
+ * When `magicalBraces` is not set, escapes of braces (`{` and `}`) will not be
3148
+ * unescaped.
3149
+ */
3150
+ const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
3151
+ if (windowsPathsNoEscape && s.startsWith("@(!)")) return "!" + unescape(s.slice(4), {
3152
+ windowsPathsNoEscape,
3153
+ magicalBraces
3154
+ });
3155
+ if (magicalBraces) return windowsPathsNoEscape ? s.replace(/\[([^/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1");
3156
+ return windowsPathsNoEscape ? s.replace(/\[([^/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
3083
3157
  };
3084
- const qmarksTestNocaseDot = ([$0, ext = ""]) => {
3085
- const noext = qmarksTestNoExtDot([$0]);
3086
- if (!ext) return noext;
3087
- ext = ext.toLowerCase();
3088
- return (f) => noext(f) && f.toLowerCase().endsWith(ext);
3158
+ // ../../node_modules/.pnpm/minimatch@11.0.9/node_modules/minimatch/dist/esm/index.js
3159
+ const DEFAULT_BRACE_EXPAND_MAX = 1e5;
3160
+ const DEFAULT_GLOB_STAR_RECURSION_MAX = 200;
3161
+ const AWE_KEY = "allowWindowsEscape";
3162
+ const minimatch = (p, pattern, options) => {
3163
+ assertValidPattern(pattern);
3164
+ if (!options?.nocomment && pattern.charAt(0) === "#") return false;
3165
+ return cachedMinimatch(pattern, options).match(p);
3089
3166
  };
3090
- const qmarksTestDot = ([$0, ext = ""]) => {
3091
- const noext = qmarksTestNoExtDot([$0]);
3092
- return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
3167
+ let cache = /* @__PURE__ */ new Map();
3168
+ let oldCache = /* @__PURE__ */ new Map();
3169
+ let cacheSize = 0;
3170
+ let cacheTotalWeight = 0;
3171
+ const cacheMax = 256;
3172
+ const cacheMaxWeight = 32768;
3173
+ const cacheMaxEntryWeight = 4096;
3174
+ const cacheWeight = (mm) => {
3175
+ let w = mm.pattern.length;
3176
+ for (const s of mm.globSet) {
3177
+ w += s.length + 1;
3178
+ if (w > cacheMaxEntryWeight) break;
3179
+ }
3180
+ return w;
3093
3181
  };
3094
- const qmarksTest = ([$0, ext = ""]) => {
3095
- const noext = qmarksTestNoExt([$0]);
3096
- return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
3182
+ const tri = (v) => v === void 0 ? 0 : v ? 2 : 1;
3183
+ const booleanWeights = new Map(Object.keys({
3184
+ nobrace: 0,
3185
+ nocomment: 0,
3186
+ nonegate: 0,
3187
+ noglobstar: 0,
3188
+ noext: 0,
3189
+ nonull: 0,
3190
+ partial: 0,
3191
+ dot: 0,
3192
+ nocase: 0,
3193
+ nocaseMagicOnly: 0,
3194
+ magicalBraces: 0,
3195
+ matchBase: 0,
3196
+ flipNegate: 0,
3197
+ preserveMultipleSlashes: 0,
3198
+ windowsNoMagicRoot: 0
3199
+ }).map((k, i) => [k, 24 * 3 ** i]));
3200
+ const optionsKey = (o) => {
3201
+ let n = 0;
3202
+ let wpe = false;
3203
+ for (const k in o) {
3204
+ const v = o[k];
3205
+ switch (k) {
3206
+ case "windowsPathsNoEscape":
3207
+ if (v) wpe = true;
3208
+ break;
3209
+ case AWE_KEY:
3210
+ if (v === false) wpe = true;
3211
+ break;
3212
+ case "platform": {
3213
+ const p = v || defaultPlatform;
3214
+ if (p === defaultPlatform) break;
3215
+ if (p === "darwin") n += 3;
3216
+ else if (p === "win32") n += 6;
3217
+ else if (p === "linux") n += 9;
3218
+ else return JSON.stringify(o);
3219
+ break;
3220
+ }
3221
+ case "optimizationLevel":
3222
+ if (v === void 0) break;
3223
+ n += v >= 2 ? 1 : v >= 1 ? 0 : 2;
3224
+ break;
3225
+ case "braceExpandMax":
3226
+ if (v !== void 0 && v !== DEFAULT_BRACE_EXPAND_MAX) return JSON.stringify(o);
3227
+ break;
3228
+ case "maxGlobstarRecursion":
3229
+ if (v !== void 0 && v !== DEFAULT_GLOB_STAR_RECURSION_MAX) return JSON.stringify(o);
3230
+ break;
3231
+ case "normalize":
3232
+ if (v !== void 0) return JSON.stringify(o);
3233
+ break;
3234
+ default: n += (booleanWeights.get(k) ?? 0) * tri(v);
3235
+ }
3236
+ }
3237
+ return wpe ? n + 12 : n;
3097
3238
  };
3098
- const qmarksTestNoExt = ([$0]) => {
3099
- const len = $0.length;
3100
- return (f) => f.length === len && !f.startsWith(".");
3239
+ const copyOptions = (o) => {
3240
+ const copy = {};
3241
+ for (const k in o) copy[k] = o[k];
3242
+ return copy;
3101
3243
  };
3102
- const qmarksTestNoExtDot = ([$0]) => {
3103
- const len = $0.length;
3104
- return (f) => f.length === len && f !== "." && f !== "..";
3244
+ const cachedMinimatch = (pattern, options) => {
3245
+ const key = options ? optionsKey(options) : 0;
3246
+ let mm = cache.get(key)?.get(pattern);
3247
+ if (mm) return mm;
3248
+ mm = oldCache.get(key)?.get(pattern) ?? new Minimatch(pattern, copyOptions(options));
3249
+ const weight = cacheWeight(mm);
3250
+ if (weight > cacheMaxEntryWeight) return mm;
3251
+ if (cacheSize >= cacheMax || cacheTotalWeight + weight > cacheMaxWeight) {
3252
+ oldCache = cache;
3253
+ cache = /* @__PURE__ */ new Map();
3254
+ cacheSize = 0;
3255
+ cacheTotalWeight = 0;
3256
+ }
3257
+ let byPattern = cache.get(key);
3258
+ if (!byPattern) cache.set(key, byPattern = /* @__PURE__ */ new Map());
3259
+ byPattern.set(pattern, mm);
3260
+ cacheSize++;
3261
+ cacheTotalWeight += weight;
3262
+ return mm;
3105
3263
  };
3106
3264
  /* c8 ignore start */
3107
- const defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
3265
+ const defaultPlatform = typeof process === "object" && process ? process.env?.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
3108
3266
  const path = {
3109
3267
  win32: { sep: "\\" },
3110
3268
  posix: { sep: "/" }
@@ -3112,10 +3270,10 @@ const path = {
3112
3270
  minimatch.sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
3113
3271
  const GLOBSTAR = Symbol("globstar **");
3114
3272
  minimatch.GLOBSTAR = GLOBSTAR;
3115
- const star = "[^/]*?";
3116
- const twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
3117
- const twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
3118
- const filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
3273
+ const filter = (pattern, options) => {
3274
+ let mm;
3275
+ return (p) => (mm ??= cachedMinimatch(pattern, options)).match(p);
3276
+ };
3119
3277
  minimatch.filter = filter;
3120
3278
  const ext = (a, b = {}) => Object.assign({}, a, b);
3121
3279
  const defaults = (def) => {
@@ -3131,21 +3289,10 @@ const defaults = (def) => {
3131
3289
  return orig.defaults(ext(def, options)).Minimatch;
3132
3290
  }
3133
3291
  },
3134
- AST: class AST extends orig.AST {
3135
- /* c8 ignore start */
3136
- constructor(type, parent, options = {}) {
3137
- super(type, parent, ext(def, options));
3138
- }
3139
- /* c8 ignore stop */
3140
- static fromGlob(pattern, options = {}) {
3141
- return orig.AST.fromGlob(pattern, ext(def, options));
3142
- }
3143
- },
3144
3292
  unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
3145
3293
  escape: (s, options = {}) => orig.escape(s, ext(def, options)),
3146
3294
  filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
3147
3295
  defaults: (options) => orig.defaults(ext(def, options)),
3148
- makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
3149
3296
  braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
3150
3297
  match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
3151
3298
  sep: orig.sep,
@@ -3156,11 +3303,27 @@ minimatch.defaults = defaults;
3156
3303
  const braceExpand = (pattern, options = {}) => {
3157
3304
  assertValidPattern(pattern);
3158
3305
  if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) return [pattern];
3159
- return expand(pattern, { max: options.braceExpandMax });
3306
+ let p = pattern.replace(/\\\\/g, "\\\\\\\\");
3307
+ if (options.windowsPathsNoEscape || options[AWE_KEY] === false) p = p.replace(/\[([{}])\]/g, "[\\$1]");
3308
+ return expand(p, { max: options.braceExpandMax });
3160
3309
  };
3161
3310
  minimatch.braceExpand = braceExpand;
3162
- const makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
3163
- minimatch.makeRe = makeRe;
3311
+ const RANGE_MIN = 100;
3312
+ const rangeRe = /(?<![\\$])\{(-?\d+)\.\.(-?\d+)\}/g;
3313
+ const inRepeatOrNegExt = (portion, mark) => {
3314
+ const stack = [];
3315
+ for (let i = 0; i < portion.length; i++) {
3316
+ const c = portion.charAt(i);
3317
+ if (c === "\\") i++;
3318
+ else if (c === mark) {
3319
+ if (stack.some((t) => t !== "@" && t !== "?")) return true;
3320
+ } else if (portion.charAt(i + 1) === "(" && "!?+*@".includes(c)) {
3321
+ stack.push(c);
3322
+ i++;
3323
+ } else if (c === ")") stack.pop();
3324
+ }
3325
+ return false;
3326
+ };
3164
3327
  const match = (list, pattern, options = {}) => {
3165
3328
  const mm = new Minimatch(pattern, options);
3166
3329
  list = list.filter((f) => mm.match(f));
@@ -3169,7 +3332,114 @@ const match = (list, pattern, options = {}) => {
3169
3332
  };
3170
3333
  minimatch.match = match;
3171
3334
  const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
3172
- const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
3335
+ const classEnd = (pattern, start) => {
3336
+ let i = start + 1;
3337
+ if (pattern.charAt(i) === "!" || pattern.charAt(i) === "^") i++;
3338
+ let sawStart = false;
3339
+ for (; i < pattern.length; i++) {
3340
+ const c = pattern.charAt(i);
3341
+ if (c === "]" && sawStart) return i;
3342
+ sawStart = true;
3343
+ if (c === "\\") i++;
3344
+ }
3345
+ return -1;
3346
+ };
3347
+ const literal = (pattern, noext) => {
3348
+ if (!noext && (pattern === "+()" || pattern === "@()")) return pattern;
3349
+ let lit = "";
3350
+ for (let i = 0; i < pattern.length; i++) {
3351
+ const c = pattern.charAt(i);
3352
+ if (c === "\\") lit += pattern.charAt(++i) || c;
3353
+ else if (c === "*" || c === "?") return;
3354
+ else if (c === "[") {
3355
+ const close = classEnd(pattern, i);
3356
+ if (close === -1) {
3357
+ lit += c;
3358
+ continue;
3359
+ }
3360
+ let body = pattern.slice(i + 1, close);
3361
+ if (body.startsWith("\\")) body = body.slice(1);
3362
+ if ([...body].length !== 1 || "!^".includes(pattern.charAt(i + 1))) return;
3363
+ lit += body;
3364
+ i = close;
3365
+ } else if (!noext && "+@!".includes(c) && pattern.charAt(i + 1) === "(" && pattern.includes(")", i + 2)) return;
3366
+ else lit += c;
3367
+ }
3368
+ return lit;
3369
+ };
3370
+ const MAX_EXTGLOBS = 256;
3371
+ const extglobCount = (pattern) => {
3372
+ let n = 0;
3373
+ for (let i = 0; i < pattern.length - 1; i++) {
3374
+ const c = pattern.charAt(i);
3375
+ if (c === "\\") i++;
3376
+ else if ("+@!?*".includes(c) && pattern.charAt(i + 1) === "(") {
3377
+ n++;
3378
+ i++;
3379
+ }
3380
+ }
3381
+ return n;
3382
+ };
3383
+ const assertValidExtglobs = (pattern) => {
3384
+ if (extglobCount(pattern) > MAX_EXTGLOBS) throw new TypeError("pattern has too many extglobs");
3385
+ };
3386
+ const extSafe = (pattern) => {
3387
+ if (/^[?*+@]\(\)$/.test(pattern) || pattern.includes("[:")) return false;
3388
+ let depth = 0;
3389
+ for (let i = 0; i < pattern.length; i++) {
3390
+ const c = pattern.charAt(i);
3391
+ if (c === "\\") {
3392
+ if (++i === pattern.length) return false;
3393
+ } else if (c === "[") {
3394
+ const close = classEnd(pattern, i);
3395
+ if (close !== -1) i = close;
3396
+ } else if ("+@!?*".includes(c) && pattern.charAt(i + 1) === "(") {
3397
+ depth++;
3398
+ i++;
3399
+ } else if (c === ")") {
3400
+ if (!depth--) return false;
3401
+ } else if (c === "|" && !depth) return false;
3402
+ }
3403
+ return !depth;
3404
+ };
3405
+ let lastSplit;
3406
+ let lastChecked;
3407
+ const portionMatch = (p, f) => typeof p === "string" ? f === p : f !== "" && p.testUnchecked(f);
3408
+ const endIndex = (p, last, lastStart, prev, prevStart) => portionMatch(p, last) ? lastStart : prev !== void 0 && portionMatch(p, prev) ? prevStart : -1;
3409
+ const isDots = (p) => p === "." || p === "..";
3410
+ const isDrive = (p) => typeof p === "string" && /^[a-z]:$/i.test(p);
3411
+ const isLongUNC = (p) => typeof p === "string" && /^unc$/i.test(p);
3412
+ const uncHost = (p) => {
3413
+ if (p[0] !== "" || p[1] !== "") return -1;
3414
+ const h = p[2] !== "?" ? 2 : isLongUNC(p[3]) ? 4 : -1;
3415
+ const host = p[h];
3416
+ const share = p[h + 1];
3417
+ return h !== -1 && host !== void 0 && host !== "" && host !== GLOBSTAR && share !== void 0 && share !== "" && share !== GLOBSTAR ? h : -1;
3418
+ };
3419
+ const walkable = (p, dot) => !isDots(p) && (dot || !p.startsWith("."));
3420
+ const dotPortion = (f, start, end, dot, sep) => {
3421
+ for (let k = start; k < end;) {
3422
+ if (f.charCodeAt(k) === 46) {
3423
+ if (!dot) return true;
3424
+ const n = f.charCodeAt(k + 1) === 46 ? k + 2 : k + 1;
3425
+ if (n >= end || isSep(f.charCodeAt(n), sep)) return true;
3426
+ }
3427
+ const s = nextSep(f, k, sep);
3428
+ if (s === -1) return false;
3429
+ k = s + 1;
3430
+ while (k < end && isSep(f.charCodeAt(k), sep)) k++;
3431
+ }
3432
+ return false;
3433
+ };
3434
+ const isSep = (c, sep) => sep === "/" ? c === 47 : sep === "\\" ? c === 92 : c === 47 || c === 92;
3435
+ const nextSep = (f, from, sep) => {
3436
+ if (sep !== "both") return f.indexOf(sep, from);
3437
+ const s = f.indexOf("/", from);
3438
+ const b = f.indexOf("\\", from);
3439
+ return s === -1 ? b : b === -1 ? s : Math.min(s, b);
3440
+ };
3441
+ const lastSep = (f, from, sep) => sep !== "both" ? f.lastIndexOf(sep, from) : Math.max(f.lastIndexOf("/", from), f.lastIndexOf("\\", from));
3442
+ const PENDING = {};
3173
3443
  var Minimatch = class {
3174
3444
  options;
3175
3445
  set;
@@ -3188,20 +3458,28 @@ var Minimatch = class {
3188
3458
  platform;
3189
3459
  windowsNoMagicRoot;
3190
3460
  maxGlobstarRecursion;
3191
- regexp;
3461
+ #endCheck;
3462
+ #literalCheck;
3463
+ #level2;
3464
+ #form;
3465
+ #literals = [];
3466
+ #shapes = [];
3467
+ #endRows = [];
3468
+ #matchers = /* @__PURE__ */ new Map();
3469
+ #pending = false;
3470
+ #rangeMark;
3471
+ #globstarParts = /* @__PURE__ */ new WeakMap();
3192
3472
  constructor(pattern, options = {}) {
3193
3473
  assertValidPattern(pattern);
3194
3474
  options = options || {};
3195
3475
  this.options = options;
3196
- this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
3476
+ this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? DEFAULT_GLOB_STAR_RECURSION_MAX;
3197
3477
  this.pattern = pattern;
3198
3478
  this.platform = options.platform || defaultPlatform;
3199
3479
  this.isWindows = this.platform === "win32";
3200
- const awe = "allowWindowsEscape";
3201
- this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options[awe] === false;
3480
+ this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options[AWE_KEY] === false;
3202
3481
  if (this.windowsPathsNoEscape) this.pattern = this.pattern.replace(/\\/g, "/");
3203
3482
  this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
3204
- this.regexp = null;
3205
3483
  this.negate = false;
3206
3484
  this.nonegate = !!options.nonegate;
3207
3485
  this.comment = false;
@@ -3212,14 +3490,45 @@ var Minimatch = class {
3212
3490
  this.globSet = [];
3213
3491
  this.globParts = [];
3214
3492
  this.set = [];
3493
+ this.#endCheck = !this.preserveMultipleSlashes;
3494
+ this.#level2 = (options.optimizationLevel ?? 1) >= 2;
3495
+ const n = options.normalize;
3496
+ this.#form = n === true ? "NFC" : n || void 0;
3215
3497
  this.make();
3498
+ const drives = this.set.map((row) => this.#rootIndex(row));
3499
+ this.#endRows = this.set.map((row, r) => this.#endCheck && row.length - 1 > drives[r]);
3500
+ this.#literals = this.set.map((row, r) => {
3501
+ const end = this.#endRows[r] ? row.length - 1 : row.length;
3502
+ const lits = row.slice(drives[r] + 1, end).filter((p) => typeof p === "string" && !!p);
3503
+ return [...new Set(lits)];
3504
+ });
3505
+ this.#literalCheck = this.#literals.some((l) => l.length);
3506
+ this.#shapes = this.set.map((row, r) => {
3507
+ const [p0, p1, p2] = row;
3508
+ if (this.#endRows[r] && row.length === 2) {
3509
+ if (p0 === GLOBSTAR && p1 !== GLOBSTAR) return "tail";
3510
+ }
3511
+ if (this.#endRows[r] && options.matchBase && row.length === 1 && p0 !== GLOBSTAR && p0 !== "") return "base";
3512
+ if (!this.#endCheck || drives[r] !== -1) return void 0;
3513
+ if (row.length === 3 && p0 === GLOBSTAR && p2 === GLOBSTAR && p1 !== GLOBSTAR && p1 !== "" && this.maxGlobstarRecursion > 0) return "mid";
3514
+ if (row.length === 2 && p1 === GLOBSTAR && p0 !== GLOBSTAR && p0 !== "") return "head";
3515
+ });
3516
+ }
3517
+ #norm(p) {
3518
+ return this.#form ? p.normalize(this.#form) : p;
3519
+ }
3520
+ #rootIndex(row) {
3521
+ if (!this.isWindows) return -1;
3522
+ if (isDrive(row[0])) return 0;
3523
+ if (row[0] === "" && row[1] === "" && row[2] === "?" && isDrive(row[3])) return 3;
3524
+ const h = uncHost(row);
3525
+ return h === -1 ? -1 : h + 1;
3216
3526
  }
3217
3527
  hasMagic() {
3218
3528
  if (this.options.magicalBraces && this.set.length > 1) return true;
3219
3529
  for (const pattern of this.set) for (const part of pattern) if (typeof part !== "string") return true;
3220
3530
  return false;
3221
3531
  }
3222
- debug(..._) {}
3223
3532
  make() {
3224
3533
  const pattern = this.pattern;
3225
3534
  const options = this.options;
@@ -3232,28 +3541,108 @@ var Minimatch = class {
3232
3541
  return;
3233
3542
  }
3234
3543
  this.parseNegate();
3235
- this.globSet = [...new Set(this.braceExpand())];
3236
- if (options.debug) this.debug = (...args) => console.error(...args);
3237
- this.debug(this.pattern, this.globSet);
3238
- const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
3544
+ this.globSet = [...new Set(this.#expandBraces())];
3545
+ const rawGlobParts = this.globSet.map((s) => this.#slashSplit(s));
3239
3546
  this.globParts = this.preprocess(rawGlobParts);
3240
- this.debug(this.pattern, this.globParts);
3547
+ this.#pending = true;
3241
3548
  let set = this.globParts.map((s, _, __) => {
3242
3549
  if (this.isWindows && this.windowsNoMagicRoot) {
3243
- const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
3550
+ const n = s[2] === "?" && isLongUNC(s[3]) ? 6 : 4;
3551
+ const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && s.slice(3, n).every((p) => !globMagic.test(p));
3244
3552
  const isDrive = /^[a-z]:/i.test(s[0]);
3245
- if (isUNC) return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
3246
- else if (isDrive) return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
3553
+ if (isUNC) return [...s.slice(0, n).map((p) => this.#norm(p)), ...s.slice(n).map((ss) => this.parse(ss))];
3554
+ else if (isDrive) return [this.#norm(s[0]), ...s.slice(1).map((ss) => this.parse(ss))];
3247
3555
  }
3248
3556
  return s.map((ss) => this.parse(ss));
3249
3557
  });
3250
- this.debug(this.pattern, set);
3251
3558
  this.set = set.filter((s) => s.indexOf(false) === -1);
3252
3559
  if (this.isWindows) for (let i = 0; i < this.set.length; i++) {
3253
3560
  const p = this.set[i];
3254
- if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) p[2] = "?";
3561
+ if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && (isDrive(p[3]) || isLongUNC(this.globParts[i][3]))) {
3562
+ if (isLongUNC(this.globParts[i][3])) p[3] = "UNC";
3563
+ p[2] = "?";
3564
+ }
3255
3565
  }
3256
- this.debug(this.pattern, this.set);
3566
+ if (!options.noext) this.mergeRows();
3567
+ this.#pending = false;
3568
+ this.set.forEach((row, i) => {
3569
+ for (let k = 0; k < row.length; k++) if (row[k] === PENDING) row[k] = this.parse(this.globParts[i][k]);
3570
+ });
3571
+ }
3572
+ mergeRows() {
3573
+ let merged = true;
3574
+ while (merged) {
3575
+ merged = false;
3576
+ if (this.set.length < 2) return;
3577
+ let keys = this.#mergeKeys();
3578
+ const len = Math.max(0, ...this.set.map((r) => r.length));
3579
+ for (let k = 0; k < len; k++) {
3580
+ const groups = /* @__PURE__ */ new Map();
3581
+ const R = this.set.length + 1;
3582
+ this.set.forEach((row, i) => {
3583
+ if (!(row[k] instanceof Matcher || row[k] === PENDING) || !extSafe(this.globParts[i][k])) return;
3584
+ const { pre, suf } = keys[i];
3585
+ const key = pre[k] * R + suf[k + 1];
3586
+ const g = groups.get(key);
3587
+ if (g) g.push(i);
3588
+ else groups.set(key, [i]);
3589
+ });
3590
+ const drop = /* @__PURE__ */ new Set();
3591
+ for (const g of groups.values()) {
3592
+ if (g.length < 2) continue;
3593
+ const [first, ...rest] = g;
3594
+ const glob = `@(${g.map((i) => this.globParts[i][k]).join("|")})`;
3595
+ if (extglobCount(glob) > MAX_EXTGLOBS) continue;
3596
+ this.globParts[first][k] = glob;
3597
+ this.set[first][k] = this.parse(glob);
3598
+ for (const i of rest) drop.add(i);
3599
+ }
3600
+ if (drop.size) {
3601
+ merged = true;
3602
+ this.set = this.set.filter((_, i) => !drop.has(i));
3603
+ this.globParts = this.globParts.filter((_, i) => !drop.has(i));
3604
+ if (this.set.length < 2) return;
3605
+ keys = this.#mergeKeys();
3606
+ }
3607
+ }
3608
+ }
3609
+ }
3610
+ #mergeKeys() {
3611
+ const partIds = /* @__PURE__ */ new Map();
3612
+ const ids = this.globParts.map((parts) => parts.map((s) => {
3613
+ let id = partIds.get(s);
3614
+ if (id === void 0) partIds.set(s, id = partIds.size);
3615
+ return id;
3616
+ }));
3617
+ const P = partIds.size;
3618
+ const len = Math.max(0, ...ids.map((r) => r.length));
3619
+ const keys = ids.map((r) => ({
3620
+ pre: [0],
3621
+ suf: new Array(r.length + 1).fill(0)
3622
+ }));
3623
+ for (let k = 0; k < len; k++) {
3624
+ const m = /* @__PURE__ */ new Map();
3625
+ ids.forEach((r, i) => {
3626
+ if (k >= r.length) return;
3627
+ const { pre } = keys[i];
3628
+ const key = pre[k] * P + r[k];
3629
+ let id = m.get(key);
3630
+ if (id === void 0) m.set(key, id = m.size + 1);
3631
+ pre.push(id);
3632
+ });
3633
+ }
3634
+ for (let k = len - 1; k >= 0; k--) {
3635
+ const m = /* @__PURE__ */ new Map();
3636
+ ids.forEach((r, i) => {
3637
+ if (k >= r.length) return;
3638
+ const { suf } = keys[i];
3639
+ const key = suf[k + 1] * P + r[k];
3640
+ let id = m.get(key);
3641
+ if (id === void 0) m.set(key, id = m.size + 1);
3642
+ suf[k] = id;
3643
+ });
3644
+ }
3645
+ return keys;
3257
3646
  }
3258
3647
  preprocess(globParts) {
3259
3648
  if (this.options.noglobstar) {
@@ -3280,11 +3669,12 @@ var Minimatch = class {
3280
3669
  }
3281
3670
  levelOneOptimize(globParts) {
3282
3671
  return globParts.map((parts) => {
3672
+ const root = this.#rootIndex(parts) + 1;
3283
3673
  parts = parts.reduce((set, part) => {
3284
3674
  const prev = set[set.length - 1];
3285
3675
  if (part === "**" && prev === "**") return set;
3286
3676
  if (part === "..") {
3287
- if (prev && prev !== ".." && prev !== "." && prev !== "**") {
3677
+ if (set.length > root && prev && prev !== ".." && prev !== "." && prev !== "**") {
3288
3678
  set.pop();
3289
3679
  return set;
3290
3680
  }
@@ -3295,8 +3685,120 @@ var Minimatch = class {
3295
3685
  return parts.length === 0 ? [""] : parts;
3296
3686
  });
3297
3687
  }
3298
- levelTwoFileOptimize(parts) {
3299
- if (!Array.isArray(parts)) parts = this.slashSplit(parts);
3688
+ #canMatch(f) {
3689
+ const sep = !this.isWindows || !f.includes("\\") ? "/" : f.includes("/") ? "both" : "\\";
3690
+ let ends = this.#endCheck ? 0 : -1;
3691
+ let last = "";
3692
+ let lastStart = 0;
3693
+ let prev;
3694
+ let prevStart = 0;
3695
+ const dot = !!this.options.dot;
3696
+ ROWS: for (let r = 0; r < this.set.length; r++) {
3697
+ const row = this.set[r];
3698
+ const p = row[row.length - 1];
3699
+ let end = ends !== -1 && this.#endRows[r] && p !== GLOBSTAR;
3700
+ if (end && ends === 0) {
3701
+ const i = lastSep(f, f.length, sep);
3702
+ lastStart = i + 1;
3703
+ last = f.slice(lastStart);
3704
+ if (last === "" && i >= 0) {
3705
+ let j = i;
3706
+ while (j > 0 && isSep(f.charCodeAt(j - 1), sep)) j--;
3707
+ prevStart = j === 0 ? 0 : lastSep(f, j - 1, sep) + 1;
3708
+ prev = f.slice(prevStart, j);
3709
+ }
3710
+ const resolves = this.#level2 && (isDots(last) || last === "" && prev !== void 0 && isDots(prev));
3711
+ ends = resolves ? -1 : 1;
3712
+ end = !resolves;
3713
+ }
3714
+ let tailStart = -1;
3715
+ if (end && typeof p === "string") {
3716
+ tailStart = endIndex(p, last, lastStart, prev, prevStart);
3717
+ if (tailStart === -1) continue;
3718
+ }
3719
+ if (this.#literalCheck) {
3720
+ for (const l of this.#literals[r]) if (!f.includes(l)) continue ROWS;
3721
+ }
3722
+ if (end && typeof p === "object") {
3723
+ tailStart = endIndex(p, last, lastStart, prev, prevStart);
3724
+ if (tailStart === -1) continue;
3725
+ }
3726
+ const shape = this.#shapes[r];
3727
+ if (shape === "base" && end) return "yes";
3728
+ if (shape === "tail" && end) {
3729
+ if (this.#level2 && dotPortion(f, 0, tailStart, true, sep)) return "maybe";
3730
+ if (!dotPortion(f, 0, tailStart, dot, sep)) return "yes";
3731
+ continue;
3732
+ }
3733
+ if (shape === "mid" || shape === "head") {
3734
+ const m = this.#walk(f, row, shape === "head", dot, sep);
3735
+ if (m !== "no") return m;
3736
+ continue;
3737
+ }
3738
+ return "maybe";
3739
+ }
3740
+ return "no";
3741
+ }
3742
+ #matchShape(file, row, shape) {
3743
+ const dot = !!this.options.dot;
3744
+ const n = file.length;
3745
+ if (shape === "head") {
3746
+ if (n < 2 || !portionMatch(row[0], file[0])) return false;
3747
+ for (let i = 1; i < n; i++) if (!walkable(file[i], dot)) return false;
3748
+ return true;
3749
+ }
3750
+ const x = row[1];
3751
+ if (shape === "tail") {
3752
+ let t = n - 1;
3753
+ if (!portionMatch(x, file[t])) {
3754
+ if (file[t] !== "" || n === 1 || !portionMatch(x, file[--t])) return false;
3755
+ }
3756
+ for (let i = 0; i < t; i++) if (!walkable(file[i], dot)) return false;
3757
+ return true;
3758
+ }
3759
+ for (let k = 0; k < n; k++) {
3760
+ if (portionMatch(x, file[k]) && k + 1 < n) {
3761
+ let i = k + 1;
3762
+ while (i < n && walkable(file[i], dot)) i++;
3763
+ if (i === n) return true;
3764
+ }
3765
+ if (!walkable(file[k], dot)) return false;
3766
+ }
3767
+ return false;
3768
+ }
3769
+ #walk(f, row, head, dot, sep) {
3770
+ if (this.#level2 && dotPortion(f, 0, f.length, true, sep)) return "maybe";
3771
+ const x = row[head ? 0 : 1];
3772
+ let s = 0;
3773
+ for (let e = nextSep(f, s, sep); e !== -1; e = nextSep(f, s, sep)) {
3774
+ let next = e + 1;
3775
+ while (next < f.length && isSep(f.charCodeAt(next), sep)) next++;
3776
+ if ((typeof x === "string" ? e - s === x.length && f.startsWith(x, s) : e > s && x.testUnchecked(f.slice(s, e))) && !dotPortion(f, next, f.length, dot, sep)) return "yes";
3777
+ if (head || dotPortion(f, s, next, dot, sep)) return "no";
3778
+ s = next;
3779
+ }
3780
+ return "no";
3781
+ }
3782
+ #cachedSplit(f) {
3783
+ const last = lastSplit;
3784
+ return last?.f === f && last.isWindows === this.isWindows && last.preserveMultipleSlashes === this.preserveMultipleSlashes && last.normalize === this.#form ? last : void 0;
3785
+ }
3786
+ #split(f) {
3787
+ const { isWindows, preserveMultipleSlashes } = this;
3788
+ let parts = this.#slashSplit(isWindows ? f.split("\\").join("/") : f);
3789
+ const normalize = this.#form;
3790
+ if (normalize) parts = parts.map((p) => p.normalize(normalize));
3791
+ lastSplit = {
3792
+ f,
3793
+ isWindows,
3794
+ preserveMultipleSlashes,
3795
+ normalize,
3796
+ parts
3797
+ };
3798
+ return lastSplit;
3799
+ }
3800
+ #levelTwoFileOptimize(file) {
3801
+ const parts = [...file];
3300
3802
  let didSomething = false;
3301
3803
  do {
3302
3804
  didSomething = false;
@@ -3315,19 +3817,23 @@ var Minimatch = class {
3315
3817
  parts.pop();
3316
3818
  }
3317
3819
  }
3318
- let dd = 0;
3820
+ const root = this.#rootIndex(parts) + 1;
3821
+ let dd = root;
3319
3822
  while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
3320
3823
  const p = parts[dd - 1];
3321
- if (p && p !== "." && p !== ".." && p !== "**" && !(this.isWindows && /^[a-z]:$/i.test(p))) {
3824
+ if (p && p !== "." && p !== ".." && p !== "**") {
3322
3825
  didSomething = true;
3323
3826
  parts.splice(dd - 1, 2);
3324
- dd -= 2;
3827
+ dd = Math.max(dd - 2, root);
3325
3828
  }
3326
3829
  }
3327
3830
  } while (didSomething);
3328
3831
  return parts.length === 0 ? [""] : parts;
3329
3832
  }
3330
3833
  firstPhasePreProcess(globParts) {
3834
+ const { braceExpandMax = DEFAULT_BRACE_EXPAND_MAX } = this.options;
3835
+ let splitCells = 0;
3836
+ const maxSplitCells = 1e6;
3331
3837
  let didSomething = false;
3332
3838
  do {
3333
3839
  didSomething = false;
@@ -3342,10 +3848,13 @@ var Minimatch = class {
3342
3848
  const p2 = parts[gs + 3];
3343
3849
  if (next !== "..") continue;
3344
3850
  if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") continue;
3851
+ const addedCells = parts.length - 1;
3852
+ if (globParts.length >= braceExpandMax || splitCells + addedCells > maxSplitCells) throw new RangeError(`optimizationLevel 2: too many patterns from '**/..'`);
3345
3853
  didSomething = true;
3346
3854
  parts.splice(gs, 1);
3347
3855
  const other = parts.slice(0);
3348
3856
  other[gs] = "**";
3857
+ splitCells += addedCells;
3349
3858
  globParts.push(other);
3350
3859
  gs--;
3351
3860
  }
@@ -3364,7 +3873,8 @@ var Minimatch = class {
3364
3873
  parts.pop();
3365
3874
  }
3366
3875
  }
3367
- let dd = 0;
3876
+ const root = this.#rootIndex(parts) + 1;
3877
+ let dd = root;
3368
3878
  while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
3369
3879
  const p = parts[dd - 1];
3370
3880
  if (p && p !== "." && p !== ".." && p !== "**") {
@@ -3372,7 +3882,7 @@ var Minimatch = class {
3372
3882
  const splin = dd === 1 && parts[dd + 1] === "**" ? ["."] : [];
3373
3883
  parts.splice(dd - 1, 2, ...splin);
3374
3884
  if (parts.length === 0) parts.push("");
3375
- dd -= 2;
3885
+ dd = Math.max(dd - 2, root);
3376
3886
  }
3377
3887
  }
3378
3888
  }
@@ -3380,45 +3890,41 @@ var Minimatch = class {
3380
3890
  return globParts;
3381
3891
  }
3382
3892
  secondPhasePreProcess(globParts) {
3383
- for (let i = 0; i < globParts.length - 1; i++) for (let j = i + 1; j < globParts.length; j++) {
3384
- const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
3385
- if (matched) {
3386
- globParts[i] = [];
3387
- globParts[j] = matched;
3388
- break;
3893
+ const keys = /* @__PURE__ */ new Set();
3894
+ const rows = globParts.filter((parts) => {
3895
+ const key = parts.join("/");
3896
+ if (keys.has(key)) return false;
3897
+ keys.add(key);
3898
+ return true;
3899
+ });
3900
+ const stars = /* @__PURE__ */ new Map();
3901
+ for (const parts of rows) {
3902
+ const s = [];
3903
+ for (let i = 0; i < parts.length; i++) if (parts[i] === "*") s.push(i);
3904
+ if (s.length) stars.set(s.join(","), s);
3905
+ }
3906
+ if (!stars.size || rows.length * stars.size > 1e5) return rows;
3907
+ const { dot } = this.options;
3908
+ return rows.filter((parts) => {
3909
+ for (const s of stars.values()) {
3910
+ if (s[s.length - 1] >= parts.length) continue;
3911
+ const c = [...parts];
3912
+ let ok = true;
3913
+ let changed = false;
3914
+ for (const i of s) {
3915
+ const p = parts[i];
3916
+ if (p === "*") continue;
3917
+ if (!p || p === "**" || !dot && p.startsWith(".")) {
3918
+ ok = false;
3919
+ break;
3920
+ }
3921
+ c[i] = "*";
3922
+ changed = true;
3923
+ }
3924
+ if (ok && changed && keys.has(c.join("/"))) return false;
3389
3925
  }
3390
- }
3391
- return globParts.filter((gs) => gs.length);
3392
- }
3393
- partsMatch(a, b, emptyGSMatch = false) {
3394
- let ai = 0;
3395
- let bi = 0;
3396
- let result = [];
3397
- let which = "";
3398
- while (ai < a.length && bi < b.length) if (a[ai] === b[bi]) {
3399
- result.push(which === "b" ? b[bi] : a[ai]);
3400
- ai++;
3401
- bi++;
3402
- } else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
3403
- result.push(a[ai]);
3404
- ai++;
3405
- } else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
3406
- result.push(b[bi]);
3407
- bi++;
3408
- } else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
3409
- if (which === "b") return false;
3410
- which = "a";
3411
- result.push(a[ai]);
3412
- ai++;
3413
- bi++;
3414
- } else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
3415
- if (which === "a") return false;
3416
- which = "b";
3417
- result.push(b[bi]);
3418
- ai++;
3419
- bi++;
3420
- } else return false;
3421
- return a.length === b.length && result;
3926
+ return true;
3927
+ });
3422
3928
  }
3423
3929
  parseNegate() {
3424
3930
  if (this.nonegate) return;
@@ -3432,10 +3938,22 @@ var Minimatch = class {
3432
3938
  if (negateOffset) this.pattern = pattern.slice(negateOffset);
3433
3939
  this.negate = negate;
3434
3940
  }
3435
- matchOne(file, pattern, partial = false) {
3941
+ #matchRow(file, resolved, pattern, partial) {
3436
3942
  let fileStartIndex = 0;
3437
3943
  let patternStartIndex = 0;
3438
- if (this.isWindows) {
3944
+ const fh = this.isWindows ? uncHost(resolved) : -1;
3945
+ const ph = fh === -1 ? -1 : uncHost(pattern);
3946
+ if (ph !== -1) {
3947
+ const host = pattern[ph];
3948
+ const share = pattern[ph + 1];
3949
+ if (typeof host !== "string" || typeof share !== "string") {
3950
+ fileStartIndex = fh;
3951
+ patternStartIndex = ph;
3952
+ } else if (resolved[fh].toLowerCase() === host.toLowerCase() && resolved[fh + 1].toLowerCase() === share.toLowerCase()) {
3953
+ fileStartIndex = fh + 2;
3954
+ patternStartIndex = ph + 2;
3955
+ }
3956
+ } else if (this.isWindows) {
3439
3957
  const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
3440
3958
  const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
3441
3959
  const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
@@ -3445,32 +3963,20 @@ var Minimatch = class {
3445
3963
  if (typeof fdi === "number" && typeof pdi === "number") {
3446
3964
  const [fd, pd] = [file[fdi], pattern[pdi]];
3447
3965
  if (fd.toLowerCase() === pd.toLowerCase()) {
3448
- pattern[pdi] = fd;
3449
- patternStartIndex = pdi;
3450
- fileStartIndex = fdi;
3966
+ patternStartIndex = pdi + 1;
3967
+ fileStartIndex = fdi + 1;
3451
3968
  }
3452
3969
  }
3453
3970
  }
3454
- const { optimizationLevel = 1 } = this.options;
3455
- if (optimizationLevel >= 2) file = this.levelTwoFileOptimize(file);
3971
+ file = resolved;
3456
3972
  if (pattern.includes(GLOBSTAR)) return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
3457
3973
  return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
3458
3974
  }
3459
3975
  #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
3460
- const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
3461
- const lastgs = pattern.lastIndexOf(GLOBSTAR);
3462
- const [head, body, tail] = partial ? [
3463
- pattern.slice(patternIndex, firstgs),
3464
- pattern.slice(firstgs + 1),
3465
- []
3466
- ] : [
3467
- pattern.slice(patternIndex, firstgs),
3468
- pattern.slice(firstgs + 1, lastgs),
3469
- pattern.slice(lastgs + 1)
3470
- ];
3976
+ const { head, body, tail, segments } = this.#getGlobstarParts(pattern, partial, patternIndex);
3471
3977
  if (head.length) {
3472
- const fileHead = file.slice(fileIndex, fileIndex + head.length);
3473
- if (!this.#matchOne(fileHead, head, partial, 0, 0)) return false;
3978
+ const headEnd = fileIndex + head.length;
3979
+ if (!this.#matchOne(file, head, partial, fileIndex, 0, headEnd)) return false;
3474
3980
  fileIndex += head.length;
3475
3981
  patternIndex += head.length;
3476
3982
  }
@@ -3495,67 +4001,86 @@ var Minimatch = class {
3495
4001
  }
3496
4002
  return partial || sawSome;
3497
4003
  }
3498
- const bodySegments = [[[], 0]];
3499
- let currentBody = bodySegments[0];
4004
+ return !!this.#matchGlobStarBodySections(file, segments, file.length - fileTailMatch, fileIndex, 0, partial, 0, !!fileTailMatch, /* @__PURE__ */ new Set());
4005
+ }
4006
+ #getGlobstarParts(pattern, partial, patternIndex) {
4007
+ let byStart = this.#globstarParts.get(pattern);
4008
+ if (!byStart) {
4009
+ byStart = [];
4010
+ this.#globstarParts.set(pattern, byStart);
4011
+ }
4012
+ const key = patternIndex * 2 + (partial ? 1 : 0);
4013
+ const found = byStart[key];
4014
+ if (found) return found;
4015
+ const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
4016
+ const lastgs = pattern.lastIndexOf(GLOBSTAR);
4017
+ const head = pattern.slice(patternIndex, firstgs);
4018
+ const body = pattern.slice(firstgs + 1, partial ? void 0 : lastgs);
4019
+ const tail = partial ? [] : pattern.slice(lastgs + 1);
4020
+ const segments = [[[], 0]];
4021
+ let current = segments[0];
3500
4022
  let nonGsParts = 0;
3501
4023
  const nonGsPartsSums = [0];
3502
4024
  for (const b of body) if (b === GLOBSTAR) {
3503
4025
  nonGsPartsSums.push(nonGsParts);
3504
- currentBody = [[], 0];
3505
- bodySegments.push(currentBody);
4026
+ current = [[], 0];
4027
+ segments.push(current);
3506
4028
  } else {
3507
- currentBody[0].push(b);
4029
+ current[0].push(b);
3508
4030
  nonGsParts++;
3509
4031
  }
3510
- let i = bodySegments.length - 1;
3511
- const fileLength = file.length - fileTailMatch;
3512
- for (const b of bodySegments) b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
3513
- return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
4032
+ segments.forEach((b, i) => {
4033
+ b[1] = nonGsParts - nonGsPartsSums[i];
4034
+ });
4035
+ const parts = {
4036
+ head,
4037
+ body,
4038
+ tail,
4039
+ segments
4040
+ };
4041
+ byStart[key] = parts;
4042
+ return parts;
3514
4043
  }
3515
- #matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
4044
+ #matchGlobStarBodySections(file, bodySegments, fileLength, fileIndex, bodyIndex, partial, globStarDepth, sawTail, tried) {
3516
4045
  const bs = bodySegments[bodyIndex];
3517
4046
  if (!bs) {
3518
- for (let i = fileIndex; i < file.length; i++) {
4047
+ if (partial) return fileIndex >= fileLength || fileIndex === fileLength - 1 && file[fileIndex] === "";
4048
+ for (let i = fileIndex; i < fileLength; i++) {
3519
4049
  sawTail = true;
3520
4050
  const f = file[i];
3521
4051
  if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
3522
4052
  }
3523
4053
  return sawTail;
3524
4054
  }
3525
- const [body, after] = bs;
4055
+ const [body, need] = bs;
4056
+ const after = partial ? fileLength : fileLength - need;
3526
4057
  while (fileIndex <= after) {
3527
- if (this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0) && globStarDepth < this.maxGlobstarRecursion) {
3528
- const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
4058
+ const key = bodyIndex * (file.length + 1) + fileIndex;
4059
+ if (tried.has(key)) return false;
4060
+ tried.add(key);
4061
+ if (this.#matchOne(file, body, partial, fileIndex, 0, fileIndex + body.length) && globStarDepth < this.maxGlobstarRecursion) {
4062
+ const sub = this.#matchGlobStarBodySections(file, bodySegments, fileLength, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail, tried);
3529
4063
  if (sub !== false) return sub;
3530
4064
  }
4065
+ if (fileIndex === after) break;
3531
4066
  const f = file[fileIndex];
3532
4067
  if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
3533
4068
  fileIndex++;
3534
4069
  }
3535
4070
  return partial || null;
3536
4071
  }
3537
- #matchOne(file, pattern, partial, fileIndex, patternIndex) {
4072
+ #matchOne(file, pattern, partial, fileIndex, patternIndex, fileEnd = file.length) {
3538
4073
  let fi;
3539
4074
  let pi;
3540
4075
  let pl;
3541
4076
  let fl;
3542
- for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
3543
- this.debug("matchOne loop");
4077
+ for (fi = fileIndex, pi = patternIndex, fl = Math.min(fileEnd, file.length), pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
3544
4078
  let p = pattern[pi];
3545
4079
  let f = file[fi];
3546
- this.debug(pattern, p, f);
3547
4080
  /* c8 ignore start */
3548
4081
  if (p === false || p === GLOBSTAR) return false;
3549
4082
  /* c8 ignore stop */
3550
- let hit;
3551
- if (typeof p === "string") {
3552
- hit = f === p;
3553
- this.debug("string match", p, f, hit);
3554
- } else {
3555
- hit = p.test(f);
3556
- this.debug("pattern match", p, f, hit);
3557
- }
3558
- if (!hit) return false;
4083
+ if (!portionMatch(p, f)) return false;
3559
4084
  }
3560
4085
  if (fi === fl && pi === pl) return true;
3561
4086
  else if (fi === fl) return partial;
@@ -3566,92 +4091,83 @@ var Minimatch = class {
3566
4091
  braceExpand() {
3567
4092
  return braceExpand(this.pattern, this.options);
3568
4093
  }
4094
+ #expandBraces() {
4095
+ const { pattern } = this;
4096
+ if (this.options.nobrace) return this.braceExpand();
4097
+ let code = 57344;
4098
+ while (pattern.includes(String.fromCharCode(code))) if (++code > 63743) return this.braceExpand();
4099
+ const mark = String.fromCharCode(code);
4100
+ let found = false;
4101
+ const marked = pattern.replace(rangeRe, (m, lo, hi) => {
4102
+ const a = Number(lo);
4103
+ const b = Number(hi);
4104
+ if (!Number.isSafeInteger(a) || !Number.isSafeInteger(b) || Math.abs(a - b) + 1 < RANGE_MIN) return m;
4105
+ found = true;
4106
+ return `${mark}${lo}..${hi}${mark}`;
4107
+ });
4108
+ if (!found) return this.braceExpand();
4109
+ const set = braceExpand(marked, this.options);
4110
+ for (const p of set) for (const portion of p.split("/")) {
4111
+ const c = portion.indexOf("[");
4112
+ if (c !== -1 && c < portion.lastIndexOf(mark)) return this.braceExpand();
4113
+ if (!this.options.noext && inRepeatOrNegExt(portion, mark)) return this.braceExpand();
4114
+ }
4115
+ this.#rangeMark = mark;
4116
+ return set;
4117
+ }
3569
4118
  parse(pattern) {
3570
4119
  assertValidPattern(pattern);
3571
4120
  const options = this.options;
3572
4121
  if (pattern === "**") return GLOBSTAR;
3573
4122
  if (pattern === "") return "";
3574
- let m;
3575
- let fastTest = null;
3576
- if (m = pattern.match(starRE)) fastTest = options.dot ? starTestDot : starTest;
3577
- else if (m = pattern.match(starDotExtRE)) fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
3578
- else if (m = pattern.match(qmarksRE)) fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
3579
- else if (m = pattern.match(starDotStarRE)) fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
3580
- else if (m = pattern.match(dotStarRE)) fastTest = dotStarTest;
3581
- const re = AST.fromGlob(pattern, this.options).toMMPattern();
3582
- if (fastTest && typeof re === "object") Reflect.defineProperty(re, "test", { value: fastTest });
3583
- return re;
3584
- }
3585
- makeRe() {
3586
- if (this.regexp || this.regexp === false) return this.regexp;
3587
- const set = this.set;
3588
- if (!set.length) {
3589
- this.regexp = false;
3590
- return this.regexp;
3591
- }
3592
- const options = this.options;
3593
- const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
3594
- const flags = new Set(options.nocase ? ["i"] : []);
3595
- let re = set.map((pattern) => {
3596
- const pp = pattern.map((p) => {
3597
- if (p instanceof RegExp) for (const f of p.flags.split("")) flags.add(f);
3598
- return typeof p === "string" ? regExpEscape(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
3599
- });
3600
- pp.forEach((p, i) => {
3601
- const next = pp[i + 1];
3602
- const prev = pp[i - 1];
3603
- if (p !== GLOBSTAR || prev === GLOBSTAR) return;
3604
- if (prev === void 0) {
3605
- if (next !== void 0 && next !== GLOBSTAR) pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
3606
- else pp[i] = twoStar;
3607
- } else if (next === void 0) pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
3608
- else if (next !== GLOBSTAR) {
3609
- pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
3610
- pp[i + 1] = GLOBSTAR;
3611
- }
4123
+ const { nocase, nocaseMagicOnly, noext = false, dot, normalize } = options;
4124
+ const rangeMark = this.#rangeMark;
4125
+ const lit = rangeMark && pattern.includes(rangeMark) ? void 0 : literal(pattern, noext);
4126
+ if (lit !== void 0 && !(nocase && !nocaseMagicOnly && pattern.toUpperCase() !== pattern.toLowerCase())) return this.#norm(lit);
4127
+ if (this.#pending) return PENDING;
4128
+ let m = this.#matchers.get(pattern);
4129
+ if (!m) {
4130
+ if (!noext) assertValidExtglobs(pattern);
4131
+ m = new Matcher(pattern, {
4132
+ nocase,
4133
+ noext,
4134
+ dot,
4135
+ normalize,
4136
+ ...rangeMark && { rangeMark }
3612
4137
  });
3613
- const filtered = pp.filter((p) => p !== GLOBSTAR);
3614
- if (this.partial && filtered.length >= 1) {
3615
- const prefixes = [];
3616
- for (let i = 1; i <= filtered.length; i++) prefixes.push(filtered.slice(0, i).join("/"));
3617
- return "(?:" + prefixes.join("|") + ")";
3618
- }
3619
- return filtered.join("/");
3620
- }).join("|");
3621
- const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
3622
- re = "^" + open + re + close + "$";
3623
- if (this.partial) re = "^(?:\\/|" + open + re.slice(1, -1) + close + ")$";
3624
- if (this.negate) re = "^(?!" + re + ").+$";
3625
- try {
3626
- this.regexp = new RegExp(re, [...flags].join(""));
3627
- } catch {
3628
- this.regexp = false;
4138
+ this.#matchers.set(pattern, m);
3629
4139
  }
3630
- /* c8 ignore stop */
3631
- return this.regexp;
4140
+ return m;
3632
4141
  }
3633
- slashSplit(p) {
4142
+ #slashSplit(p) {
3634
4143
  if (this.preserveMultipleSlashes) return p.split("/");
3635
4144
  else if (this.isWindows && /^\/\/[^/]+/.test(p)) return ["", ...p.split(/\/+/)];
3636
4145
  else return p.split(/\/+/);
3637
4146
  }
3638
4147
  match(f, partial = this.partial) {
3639
- this.debug("match", f, this.pattern);
3640
4148
  if (this.comment) return false;
3641
4149
  if (this.empty) return f === "";
3642
4150
  if (f === "/" && partial) return true;
3643
4151
  const options = this.options;
3644
- if (this.isWindows) f = f.split("\\").join("/");
3645
- const ff = this.slashSplit(f);
3646
- this.debug(this.pattern, "split", ff);
4152
+ let split = this.#cachedSplit(f);
4153
+ if (!split) {
4154
+ if (!partial && !this.#form && (this.#endCheck || this.#literalCheck) && lastChecked !== f) {
4155
+ lastChecked = f;
4156
+ const can = this.#canMatch(f);
4157
+ if (can === "no") return options.flipNegate ? false : this.negate;
4158
+ if (can === "yes") return options.flipNegate ? true : !this.negate;
4159
+ }
4160
+ split = this.#split(f);
4161
+ }
4162
+ const ff = split.parts;
4163
+ const resolved = this.#level2 ? split.resolved ??= this.#levelTwoFileOptimize(ff) : ff;
3647
4164
  const set = this.set;
3648
- this.debug(this.pattern, "set", set);
3649
4165
  let filename = ff[ff.length - 1];
3650
4166
  if (!filename) for (let i = ff.length - 2; !filename && i >= 0; i--) filename = ff[i];
3651
- for (const pattern of set) {
3652
- let file = ff;
3653
- if (options.matchBase && pattern.length === 1) file = [filename];
3654
- if (this.matchOne(file, pattern, partial)) {
4167
+ for (let r = 0; r < set.length; r++) {
4168
+ const pattern = set[r];
4169
+ const shape = partial ? void 0 : this.#shapes[r];
4170
+ if (shape === "base" ? portionMatch(pattern[0], filename) : shape ? this.#matchShape(resolved, pattern, shape) : options.matchBase && pattern.length === 1 ? this.#matchRow([filename], [filename], pattern, partial) : this.#matchRow(ff, resolved, pattern, partial)) {
3655
4171
  if (options.flipNegate) return true;
3656
4172
  return !this.negate;
3657
4173
  }
@@ -3664,12 +4180,10 @@ var Minimatch = class {
3664
4180
  }
3665
4181
  };
3666
4182
  /* c8 ignore stop */
3667
- minimatch.AST = AST;
3668
4183
  minimatch.Minimatch = Minimatch;
3669
4184
  minimatch.escape = escape;
3670
4185
  minimatch.unescape = unescape;
3671
- //#endregion
3672
- //#region ../internal/src/build/runtime-package-files.ts
4186
+ // ../internal/src/build/runtime-package-files.ts
3673
4187
  const alwaysPublishedFile = /^(?:package\.json|(?:readme|copying|licen[cs]e)(?:\..*[^~$])?)$/i;
3674
4188
  const rootExcluded = /* @__PURE__ */ new Set([
3675
4189
  "package-lock.json",
@@ -3827,8 +4341,7 @@ async function copyRuntimePackageFiles(packageDir, targetDir) {
3827
4341
  await unlessGone(() => copyFile(join(packageDir, path), target));
3828
4342
  }
3829
4343
  }
3830
- //#endregion
3831
- //#region ../internal/src/build/provider-output-sources.ts
4344
+ // ../internal/src/build/provider-output-sources.ts
3832
4345
  function escapeRegExp$2(value) {
3833
4346
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3834
4347
  }
@@ -3967,8 +4480,7 @@ async function removeProviderOutputArtifactDir(path) {
3967
4480
  retryDelay: 50
3968
4481
  });
3969
4482
  }
3970
- //#endregion
3971
- //#region ../internal/src/build/vercel-config.ts
4483
+ // ../internal/src/build/vercel-config.ts
3972
4484
  function createDefaultVercelOutputRoot(rootDir) {
3973
4485
  return resolve(rootDir, ".vercel", "output");
3974
4486
  }
@@ -3991,8 +4503,7 @@ function createNodeFunctionConfig(extra = {}) {
3991
4503
  ...extra
3992
4504
  };
3993
4505
  }
3994
- //#endregion
3995
- //#region ../internal/src/build/runtime-package-resolution.ts
4506
+ // ../internal/src/build/runtime-package-resolution.ts
3996
4507
  /** Locates package metadata through exports, an entry's ancestors, or the project's dependency roots. */
3997
4508
  function createRuntimePackageResolver(readPackageName) {
3998
4509
  return async (name, resolver, fromDir) => {
@@ -4033,8 +4544,7 @@ function isPackageResolutionMiss(error) {
4033
4544
  const code = error?.code;
4034
4545
  return code === "MODULE_NOT_FOUND" || code === "ERR_MODULE_NOT_FOUND" || code === "ERR_PACKAGE_PATH_NOT_EXPORTED";
4035
4546
  }
4036
- //#endregion
4037
- //#region ../internal/src/build/runtime-package-directory.ts
4547
+ // ../internal/src/build/runtime-package-directory.ts
4038
4548
  /** Update a staged copy, then publish it with rollback on failure or cancellation. */
4039
4549
  async function updateRuntimePackageDirectory(options) {
4040
4550
  const stagingRoot = await mkdtemp(join(dirname(options.directory), ".vitehub-runtime-packages-"));
@@ -4081,8 +4591,7 @@ async function updateRuntimePackageDirectory(options) {
4081
4591
  });
4082
4592
  }
4083
4593
  }
4084
- //#endregion
4085
- //#region ../internal/src/build/vercel-runtime-packages.ts
4594
+ // ../internal/src/build/vercel-runtime-packages.ts
4086
4595
  const runtimeExportConditions = /* @__PURE__ */ new Set([
4087
4596
  "default",
4088
4597
  "import",
@@ -4230,7 +4739,7 @@ async function copyTracedPackageFiles(name, resolver, packageDir, packageJsonPat
4230
4739
  return true;
4231
4740
  }
4232
4741
  async function loadNodeFileTrace() {
4233
- nodeFileTracePromise ??= import("./out-fRNaVslw.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1)).then(({ nodeFileTrace }) => nodeFileTrace);
4742
+ nodeFileTracePromise ??= import("./out-Cw5Tvr92.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1)).then(({ nodeFileTrace }) => nodeFileTrace);
4234
4743
  return nodeFileTracePromise;
4235
4744
  }
4236
4745
  async function resolvePackageTraceEntries(name, resolver, packageDir, packageJson) {
@@ -4296,8 +4805,7 @@ function parsePackageJson(value, path) {
4296
4805
  if (typeof value !== "object" || value === null || Array.isArray(value)) throw internalErrorDiagnostics.INTERNAL_B0047({ message: `Expected ${path} to contain a JSON object.` });
4297
4806
  return value;
4298
4807
  }
4299
- //#endregion
4300
- //#region ../internal/src/build/cloudflare-provider-output.ts
4808
+ // ../internal/src/build/cloudflare-provider-output.ts
4301
4809
  function isDeepStrictEqual$1(left, right) {
4302
4810
  if (Object.is(left, right)) return true;
4303
4811
  if (!left || !right || typeof left !== "object" || typeof right !== "object") return false;
@@ -4476,8 +4984,7 @@ function composeNitroCloudflareProviderOutput(catalog, value, inheritedValue = v
4476
4984
  associateProviderOutputCatalog(output, catalog);
4477
4985
  return output;
4478
4986
  }
4479
- //#endregion
4480
- //#region ../internal/src/build/provider-output-catalog.ts
4987
+ // ../internal/src/build/provider-output-catalog.ts
4481
4988
  var ProviderOutputCatalog = class {
4482
4989
  bundleDefines = {};
4483
4990
  #appliedCloudflareContributions = /* @__PURE__ */ new Map();
@@ -4709,8 +5216,7 @@ function contributeCloudflareProviderOutput(catalog, contribution) {
4709
5216
  const { owner, ...value } = contribution;
4710
5217
  catalog.replaceCloudflareContribution(owner, value);
4711
5218
  }
4712
- //#endregion
4713
- //#region ../internal/src/build/deployment-output.ts
5219
+ // ../internal/src/build/deployment-output.ts
4714
5220
  const providerDeploymentOutputRegistry = globalThis;
4715
5221
  const providerDeploymentOutputWrites = providerDeploymentOutputRegistry.__vitehubProviderDeploymentOutputWrites ??= /* @__PURE__ */ new Map();
4716
5222
  const providerDeploymentOutputFinalizations = providerDeploymentOutputRegistry.__vitehubProviderDeploymentOutputFinalizations ??= /* @__PURE__ */ new WeakMap();
@@ -5722,8 +6228,7 @@ async function finalizeProviderDeploymentOutputs(catalog, options = {}) {
5722
6228
  if (providerDeploymentOutputFinalizations.get(catalog) === active) providerDeploymentOutputFinalizations.delete(catalog);
5723
6229
  }
5724
6230
  }
5725
- //#endregion
5726
- //#region ../internal/src/build/deployment-plan-output.ts
6231
+ // ../internal/src/build/deployment-plan-output.ts
5727
6232
  const hostVariableName = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/;
5728
6233
  function deploymentEnvContribution(plugin) {
5729
6234
  if (!plugin || typeof plugin !== "object") return;
@@ -5849,8 +6354,7 @@ async function finalizeDeploymentPlanOutput(options) {
5849
6354
  await mkdir(dirname(manifestPath), { recursive: true });
5850
6355
  await writeFile(manifestPath, JSON.stringify(manifest, null, 2) + "\n", "utf8");
5851
6356
  }
5852
- //#endregion
5853
- //#region ../../node_modules/.pnpm/resolve-pkg-maps@1.0.0/node_modules/resolve-pkg-maps/dist/index.mjs
6357
+ // ../../node_modules/.pnpm/resolve-pkg-maps@1.0.0/node_modules/resolve-pkg-maps/dist/index.mjs
5854
6358
  const A = (r) => r !== null && typeof r == "object";
5855
6359
  const a = (r, t) => Object.assign(/* @__PURE__ */ new Error(`[${r}]: ${t}`), { code: r });
5856
6360
  const _ = "ERR_INVALID_PACKAGE_CONFIG";
@@ -5900,8 +6404,7 @@ const T = (r, t, e) => {
5900
6404
  if (n.length === 0) throw a(P, `Package import specifier "${t}" is not defined in package`);
5901
6405
  return n;
5902
6406
  };
5903
- //#endregion
5904
- //#region ../internal/src/build/deno-deploy-runner.injected.ts
6407
+ // ../internal/src/build/deno-deploy-runner.injected.ts
5905
6408
  function denoDeployRunnerSource(deploymentName, entrypoint) {
5906
6409
  return `import { spawn } from "node:child_process"
5907
6410
  import { access, cp, mkdtemp, realpath, rm } from "node:fs/promises"
@@ -5993,8 +6496,7 @@ try {
5993
6496
  }
5994
6497
  `;
5995
6498
  }
5996
- //#endregion
5997
- //#region ../internal/src/build/deno-runtime-packages.ts
6499
+ // ../internal/src/build/deno-runtime-packages.ts
5998
6500
  const resolvePackageJson = createRuntimePackageResolver((source) => parseRuntimePackageJson(source).name);
5999
6501
  const builtinModuleNames = /* @__PURE__ */ new Set([...builtinModules, ...builtinModules.map((name) => `node:${name}`)]);
6000
6502
  const activeDenoDeploymentStages = /* @__PURE__ */ new Set();
@@ -6936,15 +7438,13 @@ async function finalizeStagedDenoDeploymentOutput(options) {
6936
7438
  await writeFile(join(outputDir, "deno.json"), `${JSON.stringify(denoConfig, null, 2)}\n`, "utf8");
6937
7439
  await writeFile(join(outputDir, "deploy.mjs"), denoDeployRunnerSource(options.deploymentName, entrypoint), "utf8");
6938
7440
  }
6939
- //#endregion
6940
- //#region ../internal/src/runtime/cache-bypass.ts
7441
+ // ../internal/src/runtime/cache-bypass.ts
6941
7442
  /**
6942
7443
  * `Symbol.for()` key of the shared check set. Every bundled copy of this module and the Nitro cache seam that
6943
7444
  * `nitroCacheBypass()` generates read the same set.
6944
7445
  */
6945
7446
  const cacheBypassKey = "vitehub.nitro.cache-bypass";
6946
- //#endregion
6947
- //#region ../internal/src/build/nitro-cache-bypass.ts
7447
+ // ../internal/src/build/nitro-cache-bypass.ts
6948
7448
  /**
6949
7449
  * Nitro has no global hook that keeps one request out of its cache: `shouldBypassCache` is an option of each cached
6950
7450
  * handler or function, and `cache`/`swr` route rules create theirs internally. This plugin puts a thin module between
@@ -7010,8 +7510,7 @@ function nitroCacheBypass() {
7010
7510
  }
7011
7511
  };
7012
7512
  }
7013
- //#endregion
7014
- //#region src/internal/types.ts
7513
+ // src/internal/types.ts
7015
7514
  const viteHubTypesEntry = ".vitehub/types.d.ts";
7016
7515
  function isRetainedSourceDirectory(name) {
7017
7516
  return name === "node_modules" || name === "sources" || name === "runtime-sources" || name.endsWith("-generations") || name.endsWith("-sources");
@@ -7156,8 +7655,7 @@ function viteHubTypesPlugin(options = {}) {
7156
7655
  }] } }
7157
7656
  };
7158
7657
  }
7159
- //#endregion
7160
- //#region src/internal/feature-support.ts
7658
+ // src/internal/feature-support.ts
7161
7659
  /** The features that `vitehub()` checks when the app turns them on, with the error for a host that cannot provide them. */
7162
7660
  const featureErrors = { browser: () => viteHubErrorDiagnostics.VITE_HUB_R0088({ message: "[vitehub] Browser currently requires the Cloudflare host." }) };
7163
7661
  /**
@@ -7200,8 +7698,7 @@ function assertHostService(plan, service) {
7200
7698
  if (featureSupport(serviceFeatures[service], plan.host).level === "native") return;
7201
7699
  assertDeploymentService(plan, service);
7202
7700
  }
7203
- //#endregion
7204
- //#region src/internal/cms-preset-features.ts
7701
+ // src/internal/cms-preset-features.ts
7205
7702
  function cmsStore(project) {
7206
7703
  return ownerModules.cmsVite?.cmsStore(project);
7207
7704
  }
@@ -7418,8 +7915,7 @@ function withContentKVPlugins(options, create) {
7418
7915
  }
7419
7916
  return composeVariants(flattenPluginOptions$1(create(options), []), withKV, (config) => usesGitHubSources(projectOf(config)));
7420
7917
  }
7421
- //#endregion
7422
- //#region src/internal/definition-features.ts
7918
+ // src/internal/definition-features.ts
7423
7919
  /**
7424
7920
  * The features that a Definition file turns on when the app does not set their key, such as Auth with
7425
7921
  * `server/auth.ts` or Queue with `server/queues/`. `x: false` keeps a feature off, and `x: {…}` sets its options.
@@ -7515,8 +8011,7 @@ function definitionFeaturesRootPlugin(options, project, validate) {
7515
8011
  }
7516
8012
  };
7517
8013
  }
7518
- //#endregion
7519
- //#region src/internal/kv-runtime.ts
8014
+ // src/internal/kv-runtime.ts
7520
8015
  const upstashDriverSpecifier = "@vite-hub/kv/runtime/upstash-driver";
7521
8016
  const disabledUpstashDriver = ownModule(import.meta.url, "internal/disabled-upstash-driver");
7522
8017
  const redisDriverSpecifier = "@vite-hub/kv/runtime/redis-driver";
@@ -7535,30 +8030,7 @@ function hasRedisStore(kv) {
7535
8030
  if (!kv) return false;
7536
8031
  return Object.values(kv.stores || { default: kv.store }).some((store) => store.driver === "redis");
7537
8032
  }
7538
- //#endregion
7539
- //#region src/internal/generated-modules.ts
7540
- /**
7541
- * Modules of this package that only generated code imports. Generated code imports each one by its absolute path, so
7542
- * each is a build entry and not a package export.
7543
- */
7544
- const generatedModules = {
7545
- commentsRealtime: ownModule(import.meta.url, "comments/realtime"),
7546
- commentsRuntimeAuth: ownModule(import.meta.url, "comments/runtime/auth"),
7547
- connectionsAgent: ownModule(import.meta.url, "connections/agent"),
7548
- consoleBlob: ownModule(import.meta.url, "console/runtime/server/blob"),
7549
- consoleDatabase: ownModule(import.meta.url, "console/runtime/server/database"),
7550
- consoleDefinitions: ownModule(import.meta.url, "console/runtime/server/definitions"),
7551
- consoleDocuments: ownModule(import.meta.url, "console/runtime/server/documents"),
7552
- consoleEnv: ownModule(import.meta.url, "console/runtime/server/env"),
7553
- consoleOperations: ownModule(import.meta.url, "console/runtime/server/operation-contributions"),
7554
- consolePageAuth: ownModule(import.meta.url, "console/runtime/server/page-auth"),
7555
- consolePageTool: ownModule(import.meta.url, "console/runtime/server/page-tool"),
7556
- consoleSections: ownModule(import.meta.url, "console/runtime/server/sections"),
7557
- consoleSetup: ownModule(import.meta.url, "console/runtime/server/setup"),
7558
- consoleSiteSession: ownModule(import.meta.url, "console/runtime/server/site-session")
7559
- };
7560
- //#endregion
7561
- //#region ../internal/src/forge.ts
8033
+ // ../internal/src/forge.ts
7562
8034
  /**
7563
8035
  * Server Env of each Forge, keyed by the `env.server.<forge>.<field>` path.
7564
8036
  * Channels, Capabilities, Workspaces and Sources read the same names.
@@ -7619,8 +8091,7 @@ const forgeEnv = {
7619
8091
  }
7620
8092
  }
7621
8093
  };
7622
- //#endregion
7623
- //#region src/agent-channel-env.ts
8094
+ // src/agent-channel-env.ts
7624
8095
  /**
7625
8096
  * Declare the Server Env of built-in Channels and gateway presets used by discovered Agents, before
7626
8097
  * hubEnv() builds the registry. hubEnv() applies the application's declarations over them field by field.
@@ -7669,8 +8140,7 @@ function agentChannelEnvPlugin(options = {}) {
7669
8140
  }
7670
8141
  };
7671
8142
  }
7672
- //#endregion
7673
- //#region ../internal/src/contributions.ts
8143
+ // ../internal/src/contributions.ts
7674
8144
  function isThenable(value) {
7675
8145
  return typeof value.then === "function";
7676
8146
  }
@@ -7698,14 +8168,7 @@ async function flattenPluginOptions(plugins) {
7698
8168
  return flattened;
7699
8169
  }
7700
8170
  Object.freeze({ vitehubAuthAccess: "handler" });
7701
- /**
7702
- * The route meta of a generated handler that checks access on every request, even when the app adds no rule: a required
7703
- * `authorize` policy, an explicit `access` rule, a required access token, or a signature. Auth access routes still apply
7704
- * to it, so an app rule stays in force. `checksOwnAccess(event)` of `vite-hub/auth` reads it, so app middleware can skip
7705
- * the route. A route that can run without a check, such as a browser error sink, an optional `authorize`, or a webhook
7706
- * with `secret: false`, must not use it.
7707
- */
7708
- const ownAccessRouteMeta = Object.freeze({ vitehubOwnAccess: true });
8171
+ Object.freeze({ vitehubOwnAccess: true });
7709
8172
  function cloneArray(value) {
7710
8173
  return Array.isArray(value) ? [...value] : [];
7711
8174
  }
@@ -7733,8 +8196,7 @@ function createNitroServerKit(value = {}) {
7733
8196
  }
7734
8197
  };
7735
8198
  }
7736
- //#endregion
7737
- //#region ../internal/src/durability.ts
8199
+ // ../internal/src/durability.ts
7738
8200
  function isObject(value) {
7739
8201
  return Object(value) === value && !Array.isArray(value);
7740
8202
  }
@@ -7765,8 +8227,7 @@ function collectDurabilityContributions(plugins) {
7765
8227
  function resolveDurabilityModule(importMetaUrl, specifier) {
7766
8228
  return createRequire(importMetaUrl).resolve(specifier);
7767
8229
  }
7768
- //#endregion
7769
- //#region src/agent-invocations-vite.ts
8230
+ // src/agent-invocations-vite.ts
7770
8231
  const agentInvocationsLibsqlModule = ownModule(import.meta.url, "internal/agent-invocations-libsql");
7771
8232
  const generatedAgentInvocationsPlugin = ".vitehub/nitro/agent/invocations.mjs";
7772
8233
  const agentInvocationsPluginName = "vite-hub/agent-invocations";
@@ -8014,8 +8475,7 @@ function agentInvocationsVitePlugin(options) {
8014
8475
  }
8015
8476
  };
8016
8477
  }
8017
- //#endregion
8018
- //#region src/generated-nitro-plugin.ts
8478
+ // src/generated-nitro-plugin.ts
8019
8479
  async function writeIfChanged$1(file, contents) {
8020
8480
  if (await readFile(file, "utf8").catch(() => void 0) === contents) return;
8021
8481
  await mkdir(dirname(file), { recursive: true });
@@ -8039,14 +8499,14 @@ function generatedNitroPlugin(name, file, render, options = {}) {
8039
8499
  }
8040
8500
  };
8041
8501
  }
8042
- //#endregion
8043
- //#region src/dev-defines-vite.ts
8502
+ // src/dev-defines-vite.ts
8044
8503
  /** The `define` names that ViteHub package code reads at runtime. */
8045
8504
  const viteHubRuntimeDefines = [
8046
8505
  "__VITEHUB_AGENT_APP_ROOT__",
8047
8506
  "__VITEHUB_APP_BASE_URL__",
8048
8507
  "__VITEHUB_AUTH_APP_BASE_URL__",
8049
8508
  "__VITEHUB_AUTH_DEV__",
8509
+ "__VITEHUB_CONSOLE_URL__",
8050
8510
  "__VITEHUB_PRESETS_BUILD_REVISION__",
8051
8511
  "__VITEHUB_PUBLIC_URL__"
8052
8512
  ];
@@ -8074,8 +8534,7 @@ function devDefinesVitePlugin() {
8074
8534
  apply: "serve"
8075
8535
  };
8076
8536
  }
8077
- //#endregion
8078
- //#region src/cloudflare-workers-dev-shim.injected.ts
8537
+ // src/cloudflare-workers-dev-shim.injected.ts
8079
8538
  const cloudflareWorkersDevShimSource = [
8080
8539
  "const bindings = () => globalThis.__env__ ?? process.env",
8081
8540
  "const read = key => bindings()[key] ?? process.env[key]",
@@ -8105,8 +8564,7 @@ const cloudflareEmailDevShimSource = [
8105
8564
  "}",
8106
8565
  ""
8107
8566
  ].join("\n");
8108
- //#endregion
8109
- //#region src/vitest-inline.ts
8567
+ // src/vitest-inline.ts
8110
8568
  /** The installed ViteHub packages, such as `node_modules/vite-hub/` and `node_modules/.pnpm/…/node_modules/@vite-hub/env/`. */
8111
8569
  const viteHubPackagePath = /[\\/]node_modules[\\/](?:vite-hub|@vite-hub[\\/][^\\/]+)[\\/]/;
8112
8570
  const cloudflareWorkersTestId = "\0vitehub-test:cloudflare-workers";
@@ -8132,8 +8590,7 @@ function vitestInlinePlugin() {
8132
8590
  }
8133
8591
  };
8134
8592
  }
8135
- //#endregion
8136
- //#region src/cloudflare-node-dev.ts
8593
+ // src/cloudflare-node-dev.ts
8137
8594
  const cloudflareDevShims = {
8138
8595
  "cloudflare:email": {
8139
8596
  id: "\0vitehub-dev:cloudflare-email",
@@ -8166,8 +8623,7 @@ function cloudflareNodeDevPlugin() {
8166
8623
  }
8167
8624
  };
8168
8625
  }
8169
- //#endregion
8170
- //#region src/miniflare-dev-env.ts
8626
+ // src/miniflare-dev-env.ts
8171
8627
  /**
8172
8628
  * Nitro's `miniflare` dev runner runs the server in workerd, which does not inherit the shell. It reads only the Wrangler
8173
8629
  * `vars` and the `.dev.vars` or `.env` files. So a ViteHub variable from the shell, such as `VITEHUB_AGENT_STATE_URL`,
@@ -8193,8 +8649,7 @@ function miniflareDevEnvPlugin() {
8193
8649
  } }
8194
8650
  };
8195
8651
  }
8196
- //#endregion
8197
- //#region src/internal/forge-build-check.ts
8652
+ // src/internal/forge-build-check.ts
8198
8653
  const sourceEntries = /* @__PURE__ */ new Set([
8199
8654
  "vite-hub/source",
8200
8655
  "@vite-hub/source",
@@ -8273,8 +8728,7 @@ function forgeBuildCheckPlugin() {
8273
8728
  }
8274
8729
  };
8275
8730
  }
8276
- //#endregion
8277
- //#region src/internal/drizzle-build-check.ts
8731
+ // src/internal/drizzle-build-check.ts
8278
8732
  /** The journal itself does not use Drizzle. Check only when a build reaches a ViteHub codec import. */
8279
8733
  function drizzleBuildCheckPlugin() {
8280
8734
  return {
@@ -8310,8 +8764,7 @@ function drizzleBuildCheckPlugin() {
8310
8764
  }
8311
8765
  };
8312
8766
  }
8313
- //#endregion
8314
- //#region src/error-log-vite.ts
8767
+ // src/error-log-vite.ts
8315
8768
  /**
8316
8769
  * Render the Nitro plugin that logs unhandled request errors with their message, stack, status, and cause chain.
8317
8770
  * h3 logs only the sanitized HTTPError, and Cloudflare Workers serialize it through toJSON(), which drops all of these.
@@ -8339,8 +8792,7 @@ function renderErrorLogNitroPlugin() {
8339
8792
  function errorLogVitePlugin() {
8340
8793
  return generatedNitroPlugin("vite-hub/error-log", "error-log.mjs", renderErrorLogNitroPlugin);
8341
8794
  }
8342
- //#endregion
8343
- //#region src/evlog-bridge-vite.ts
8795
+ // src/evlog-bridge-vite.ts
8344
8796
  /**
8345
8797
  * Render the Nitro plugin that gives ViteHub packages evlog's standalone logger, for failures and Schedule runs outside
8346
8798
  * a request. It does nothing when the app does not register evlog's Nitro module, which sets `runtimeConfig.evlog`, or
@@ -8374,8 +8826,7 @@ function renderEvlogBridgeNitroPlugin() {
8374
8826
  function evlogBridgeVitePlugin() {
8375
8827
  return generatedNitroPlugin("vite-hub/evlog-bridge", "evlog-bridge.mjs", renderEvlogBridgeNitroPlugin, { when: (root) => installsPackage(root, "evlog") });
8376
8828
  }
8377
- //#endregion
8378
- //#region ../internal/src/build/revision.ts
8829
+ // ../internal/src/build/revision.ts
8379
8830
  /** CI and host variables that name the commit and branch of a build, in the order they are read. */
8380
8831
  const buildVariables = [
8381
8832
  ["VERCEL_GIT_COMMIT_SHA", "VERCEL_GIT_COMMIT_REF"],
@@ -8464,8 +8915,7 @@ async function readBuildRepository(root, env = process.env, git = (args) => read
8464
8915
  "origin"
8465
8916
  ]));
8466
8917
  }
8467
- //#endregion
8468
- //#region src/health-vite.ts
8918
+ // src/health-vite.ts
8469
8919
  const defaultHealthRoute = "/_vitehub/health";
8470
8920
  /** How long one Database, KV store, or Blob store may take to answer the health check. */
8471
8921
  const healthCheckTimeoutMs = 2e3;
@@ -8573,8 +9023,7 @@ function healthVitePlugin(options, available) {
8573
9023
  }
8574
9024
  };
8575
9025
  }
8576
- //#endregion
8577
- //#region src/deploy-options.ts
9026
+ // src/deploy-options.ts
8578
9027
  function checkPath(path) {
8579
9028
  if (!path.startsWith("/") || path.startsWith("//") || /\s/u.test(path)) throw viteHubErrorDiagnostics.VITE_HUB_DEPLOY_CHECK_INVALID({ value: JSON.stringify(path) });
8580
9029
  return path;
@@ -8617,8 +9066,7 @@ function writeIndexNowKeyFile(generatedRoot, key) {
8617
9066
  writeFileSync(join(dir, `${key}.txt`), key);
8618
9067
  return dir;
8619
9068
  }
8620
- //#endregion
8621
- //#region src/seo/vite.ts
9069
+ // src/seo/vite.ts
8622
9070
  const sitemapModule = ".vitehub/nitro/seo/sitemap.mjs";
8623
9071
  const robotsModule = ".vitehub/nitro/seo/robots.mjs";
8624
9072
  const pagesModule = ".vitehub/nitro/seo/pages.mjs";
@@ -8730,8 +9178,7 @@ function viteHubSeoPlugin(options, publicUrl) {
8730
9178
  }
8731
9179
  };
8732
9180
  }
8733
- //#endregion
8734
- //#region src/security-vite.ts
9181
+ // src/security-vite.ts
8735
9182
  /** The headers that built output sends by default. */
8736
9183
  const defaultSecurityHeaders = {
8737
9184
  "Strict-Transport-Security": "max-age=31536000",
@@ -8857,8 +9304,7 @@ function securityHeadersNitroModule(headers) {
8857
9304
  });
8858
9305
  };
8859
9306
  }
8860
- //#endregion
8861
- //#region src/request-policy-vite.ts
9307
+ // src/request-policy-vite.ts
8862
9308
  /**
8863
9309
  * Render the Nitro plugin that installs `trustProxy`, `sameOriginWrites`, and `security`. `security` wraps
8864
9310
  * `nitroApp.fetch` last, so a 403 from `sameOriginWrites` also gets the security headers.
@@ -8899,8 +9345,7 @@ function requestPolicyVitePlugin(host, options, security) {
8899
9345
  }
8900
9346
  });
8901
9347
  }
8902
- //#endregion
8903
- //#region src/cloudflare-custom-domain.ts
9348
+ // src/cloudflare-custom-domain.ts
8904
9349
  const wranglerConfigFiles = [
8905
9350
  "wrangler.json",
8906
9351
  "wrangler.jsonc",
@@ -8913,7 +9358,8 @@ function readProjectWranglerConfig(rootDir) {
8913
9358
  const configPath = wranglerConfigFiles.map((file) => join(directory, file)).find((file) => existsSync(file) && statSync(file).isFile());
8914
9359
  if (configPath) {
8915
9360
  const text = readFileSync(configPath, "utf8");
8916
- const config = extname(configPath) === ".toml" ? parseTOML(text) : parseJSONC(text);
9361
+ if (!text.trim()) return;
9362
+ const config = extname(configPath) === ".toml" ? parseTOML(text) : parseJSONC(text, { allowTrailingComma: true });
8917
9363
  return isRecord$1(config) ? config : void 0;
8918
9364
  }
8919
9365
  const parent = dirname(directory);
@@ -8948,8 +9394,7 @@ function cloudflareCustomDomainConfig(publicUrl, wrangler, project) {
8948
9394
  workers_dev: false
8949
9395
  };
8950
9396
  }
8951
- //#endregion
8952
- //#region src/redirects-vite.ts
9397
+ // src/redirects-vite.ts
8953
9398
  /** The preview hosts that never redirect. */
8954
9399
  const defaultPreviewHosts = [
8955
9400
  "*.workers.dev",
@@ -9053,8 +9498,7 @@ function redirectsVitePlugin(policy) {
9053
9498
  }
9054
9499
  });
9055
9500
  }
9056
- //#endregion
9057
- //#region src/stale-chunk-reload.ts
9501
+ // src/stale-chunk-reload.ts
9058
9502
  /**
9059
9503
  * After a deploy, an open tab still asks for the chunks of the old build. The host no longer has them, so a lazy page,
9060
9504
  * component, or `import()` fails. Vite reports each failure as a `vite:preloadError` window event. ViteHub reloads the
@@ -9137,8 +9581,7 @@ async function installStaleChunkReloadNuxt(nuxt, projectRoot) {
9137
9581
  const plugins = nuxt.options.plugins ??= [];
9138
9582
  if (!plugins.some((entry) => (typeof entry === "string" ? entry : entry.src) === plugin)) plugins.push(plugin);
9139
9583
  }
9140
- //#endregion
9141
- //#region src/standard-context-vite.ts
9584
+ // src/standard-context-vite.ts
9142
9585
  /**
9143
9586
  * Render the Nitro plugin that sets `event["~standard"]` for each request, so ViteHub primitives read one
9144
9587
  * Standard Context. Delete it when H3 implements Standard Context.
@@ -9171,8 +9614,7 @@ function standardContextVitePlugin() {
9171
9614
  types: standardContextTypes
9172
9615
  });
9173
9616
  }
9174
- //#endregion
9175
- //#region src/database-disabled.ts
9617
+ // src/database-disabled.ts
9176
9618
  const databasePluginName = "@vite-hub/database/vite";
9177
9619
  const enableDatabase = "Set `database: true` in vitehub() to enable Database.";
9178
9620
  const disabledWorkspaceDatabaseId = "\0vite-hub/workspace-database-disabled";
@@ -9260,15 +9702,7 @@ function hasDatabaseDefinitions(state) {
9260
9702
  return true;
9261
9703
  }
9262
9704
  }
9263
- //#endregion
9264
- //#region src/cloudflare-pkce-challenge.ts
9265
- /**
9266
- * Resolves pkce-challenge to its browser build in a Cloudflare production build.
9267
- *
9268
- * The MCP SDK client, which Content, Workspace, the Console, and the Agent bundle, imports pkce-challenge. Its 5.x
9269
- * releases export only `browser` and `node` builds, so the `workerd` conditions match nothing and the build fails.
9270
- * The browser build uses only Web Crypto, which Workers have.
9271
- */
9705
+ // src/cloudflare-pkce-challenge.ts
9272
9706
  function cloudflarePkceChallengePlugin() {
9273
9707
  return {
9274
9708
  name: "vite-hub/cloudflare-pkce-challenge",
@@ -9283,8 +9717,7 @@ function cloudflarePkceChallengePlugin() {
9283
9717
  }
9284
9718
  };
9285
9719
  }
9286
- //#endregion
9287
- //#region src/cloudflare-sh-syntax.ts
9720
+ // src/cloudflare-sh-syntax.ts
9288
9721
  /**
9289
9722
  * Resolves sh-syntax, the parser of `@vite-hub/shell`, to its browser build in a Cloudflare production build.
9290
9723
  *
@@ -9315,8 +9748,7 @@ function cloudflareShSyntaxPlugin() {
9315
9748
  }
9316
9749
  };
9317
9750
  }
9318
- //#endregion
9319
- //#region src/cloudflare-redirects-vite.ts
9751
+ // src/cloudflare-redirects-vite.ts
9320
9752
  const statuses = /* @__PURE__ */ new Set([
9321
9753
  301,
9322
9754
  302,
@@ -9564,8 +9996,7 @@ function cloudflareRedirectsFileVitePlugin() {
9564
9996
  }
9565
9997
  };
9566
9998
  }
9567
- //#endregion
9568
- //#region src/cloudflare-entry-exports.ts
9999
+ // src/cloudflare-entry-exports.ts
9569
10000
  const pluginName = "vite-hub/cloudflare-entry-exports";
9570
10001
  const chunkFileName = "app-cloudflare-exports.mjs";
9571
10002
  const extensions = [
@@ -9645,8 +10076,7 @@ function cloudflareEntryExportsModule(nitro) {
9645
10076
  if (list.some((plugin) => typeof plugin === "object" && plugin !== null && "name" in plugin && plugin.name === pluginName)) return;
9646
10077
  rollupConfig.plugins = [...list, cloudflareEntryExportsPlugin(() => nitro.options.scanDirs)];
9647
10078
  }
9648
- //#endregion
9649
- //#region src/unavailable-services.ts
10079
+ // src/unavailable-services.ts
9650
10080
  const services = {
9651
10081
  browser: {
9652
10082
  label: "Browser",
@@ -9703,8 +10133,7 @@ function unavailableServicesPlugin(plan, enabled) {
9703
10133
  }
9704
10134
  };
9705
10135
  }
9706
- //#endregion
9707
- //#region ../internal/src/console.ts
10136
+ // ../internal/src/console.ts
9708
10137
  const sectionIdPattern = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
9709
10138
  const runtimeModulePattern = /^@vite-hub\/[a-z0-9-]+(?:\/[a-z0-9-]+)*$/;
9710
10139
  /** An owner package specifier, or the absolute path of an owner module from `ownModule()`. */
@@ -9851,8 +10280,7 @@ async function readViteHubConsoleSection(section, options) {
9851
10280
  records: "read" in section && section.read ? [...await section.read(options)] : []
9852
10281
  };
9853
10282
  }
9854
- //#endregion
9855
- //#region src/console/contributions.ts
10283
+ // src/console/contributions.ts
9856
10284
  function registerConsoleSection(section, options) {
9857
10285
  const descriptor = describeViteHubConsoleSection(section);
9858
10286
  const runtime = describeViteHubConsoleRuntimeReader(section);
@@ -9992,8 +10420,7 @@ function describeConsoleDocumentEditors(sections, entries) {
9992
10420
  }] : [];
9993
10421
  });
9994
10422
  }
9995
- //#endregion
9996
- //#region src/skills/console.ts
10423
+ // src/skills/console.ts
9997
10424
  /**
9998
10425
  * Console section for the skills of `server/skills.ts`: each skill with a switch. It lists `served-skills.list` and
9999
10426
  * flips a switch with `served-skills.set`, so `console.authorize` decides who may change them.
@@ -10033,8 +10460,7 @@ const servedSkillsConsoleSection = {
10033
10460
  operation: "served-skills.list"
10034
10461
  }
10035
10462
  };
10036
- //#endregion
10037
- //#region src/skills/vite.ts
10463
+ // src/skills/vite.ts
10038
10464
  const generatedRegistryPlugin = ".vitehub/nitro/skills/registry.mjs";
10039
10465
  /** The `server/skills.{ts,js}` file of the project, or undefined. */
10040
10466
  function findServedSkillsEntry(options) {
@@ -10079,8 +10505,7 @@ function viteHubServedSkillsPlugin() {
10079
10505
  }] : [] }
10080
10506
  };
10081
10507
  }
10082
- //#endregion
10083
- //#region src/console/build.ts
10508
+ // src/console/build.ts
10084
10509
  /**
10085
10510
  * Returns the sections in navigation order with every document editor section that discovery found. A document editor
10086
10511
  * has no Vite option: the Console shows it when its application module exists, such as `server/content.ts`.
@@ -10096,9 +10521,9 @@ function withConsoleDocumentEditorSections(sections, catalog) {
10096
10521
  * and checked again when the app starts.
10097
10522
  */
10098
10523
  async function assertUniqueOperationNames(contributions) {
10099
- const { consoleOperations } = await import("./operations-5Lwd1xEI.js");
10524
+ const { loadConsoleOperations } = await import("./operation-modules-BUXlwjvd.js");
10100
10525
  const sources = [{
10101
- operations: [...consoleOperations],
10526
+ operations: await loadConsoleOperations(),
10102
10527
  plugin: "vite-hub"
10103
10528
  }];
10104
10529
  for (const contribution of contributions) try {
@@ -10233,8 +10658,7 @@ async function discoverConsoleBuildCatalog(options) {
10233
10658
  operations: contributed.filter((contribution) => contribution.runtime !== false)
10234
10659
  };
10235
10660
  }
10236
- //#endregion
10237
- //#region src/operations-check.ts
10661
+ // src/operations-check.ts
10238
10662
  /**
10239
10663
  * Fails the build when two operations share a name or a CLI command. The Console plugin checks too, but only when the
10240
10664
  * app sets `console`, so this runs for every app.
@@ -10247,31 +10671,7 @@ function operationsCheckPlugin() {
10247
10671
  }
10248
10672
  };
10249
10673
  }
10250
- //#endregion
10251
- //#region ../internal/src/build/page-tools.ts
10252
- /**
10253
- * Adds the session route `GET <mount>/_vitehub/page/tools` and the loader script at
10254
- * `<mount>/_vitehub/page/assets/loader.js` to a Nitro configuration. Each owner package of a page tool calls it from its
10255
- * Vite plugin, so the routes exist without the Console. The first owner wins: a later call keeps the route and the asset
10256
- * that are already there, because the page tools registry is shared by every copy of this package.
10257
- */
10258
- function addViteHubPageToolRoutes(kit, options) {
10259
- const mount = options.mount ?? "";
10260
- const route = `${mount}${viteHubPageSessionPath}`;
10261
- const assetsBase = `${mount}${viteHubPageToolsAssets}`;
10262
- if (!(Array.isArray(kit.config.handlers) ? kit.config.handlers : []).some((handler) => Object(handler) === handler && Reflect.get(Object(handler), "route") === route)) kit.addHandler({
10263
- handler: options.handler,
10264
- meta: { ...ownAccessRouteMeta },
10265
- route
10266
- });
10267
- const assets = Array.isArray(kit.config.publicAssets) ? [...kit.config.publicAssets] : [];
10268
- if (!assets.some((asset) => Object(asset) === asset && Reflect.get(Object(asset), "baseURL") === assetsBase)) assets.push({
10269
- baseURL: assetsBase,
10270
- dir: options.loader,
10271
- maxAge: 300
10272
- });
10273
- kit.config.publicAssets = assets;
10274
- }
10674
+ // ../internal/src/build/page-tools.ts
10275
10675
  function readString(value, key) {
10276
10676
  const field = value !== null && typeof value === "object" ? Reflect.get(value, key) : void 0;
10277
10677
  return typeof field === "string" ? field : void 0;
@@ -10298,8 +10698,22 @@ function viteHubPageToolsBase(config, env = process.env) {
10298
10698
  mount: nitroBase && (base === nitroBase || base.startsWith(`${nitroBase}/`)) ? base.slice(nitroBase.length) : base
10299
10699
  };
10300
10700
  }
10301
- //#endregion
10302
- //#region ../internal/src/dev-endpoint.ts
10701
+ // ../internal/src/secret.ts
10702
+ const secretEncoder = new TextEncoder();
10703
+ /**
10704
+ * Compares a request value with an expected secret in constant time for the length of `expected`. Returns `false`
10705
+ * when either value is missing or empty. It uses no Node API, so it also runs in Worker runtimes.
10706
+ */
10707
+ function isViteHubSecretEqual(actual, expected) {
10708
+ if (!actual || !expected) return false;
10709
+ const left = secretEncoder.encode(actual);
10710
+ const right = secretEncoder.encode(expected);
10711
+ let difference = left.length ^ right.length;
10712
+ for (let index = 0; index < right.length; index += 1) difference |= (left[index] ?? 0) ^ right[index];
10713
+ return difference === 0;
10714
+ }
10715
+ Object.freeze({ prefix: "sha256=" });
10716
+ // ../internal/src/dev-endpoint.ts
10303
10717
  function firstHeader(value) {
10304
10718
  return Array.isArray(value) ? value[0] : value;
10305
10719
  }
@@ -10491,8 +10905,7 @@ function registerViteHubDevEndpoint(server, options) {
10491
10905
  });
10492
10906
  });
10493
10907
  }
10494
- //#endregion
10495
- //#region ../internal/src/dev-token.ts
10908
+ // ../internal/src/dev-token.ts
10496
10909
  const viteHubDevTokenHeader = "x-vitehub-dev-token";
10497
10910
  async function viteHubDevTokenFile(rootDir, scope) {
10498
10911
  const [{ createHash }, { tmpdir }, { join, resolve }] = await Promise.all([
@@ -10592,8 +11005,7 @@ async function removeViteHubDevToken(rootDir, scope) {
10592
11005
  if (entries.get(file) === entry) entries.delete(file);
10593
11006
  }
10594
11007
  }
10595
- //#endregion
10596
- //#region src/setup-dev.ts
11008
+ // src/setup-dev.ts
10597
11009
  /** Base of the dev Setup endpoints. They exist only on the Vite dev server, never in Nitro or in build output. */
10598
11010
  const setupDevRoute = "/__vitehub/setup";
10599
11011
  /** Token namespace of the dev Setup endpoints. The token file lets a local CLI call them too. */
@@ -10891,8 +11303,7 @@ function setupDevPlugin(options = {}) {
10891
11303
  }
10892
11304
  };
10893
11305
  }
10894
- //#endregion
10895
- //#region src/console/build-info.ts
11306
+ // src/console/build-info.ts
10896
11307
  const commitDetails = [{
10897
11308
  sha: "VERCEL_GIT_COMMIT_SHA",
10898
11309
  message: "VERCEL_GIT_COMMIT_MESSAGE",
@@ -10968,14 +11379,13 @@ async function collectConsoleBuild(options) {
10968
11379
  };
10969
11380
  }
10970
11381
  const collected = /* @__PURE__ */ new Map();
10971
- /** The build facts of a project, collected once per process, so each write of the generated plugin names the same build. */
11382
+ /** The build facts of a project, collected once per process, so each write of the generated Console app module names the same build. */
10972
11383
  function consoleBuildOf(projectRoot) {
10973
11384
  let build = collected.get(projectRoot);
10974
11385
  if (!build) collected.set(projectRoot, build = collectConsoleBuild({ cwd: projectRoot }));
10975
11386
  return build;
10976
11387
  }
10977
- //#endregion
10978
- //#region src/console/project.ts
11388
+ // src/console/project.ts
10979
11389
  const projectManifestSchema = v.object({ name: v.optional(v.string()) });
10980
11390
  /** The name that `project.get` reports: the `name` option of `vitehub()`, else the `package.json` name, else the folder. */
10981
11391
  function resolveConsoleProjectName(projectRoot, name) {
@@ -10987,16 +11397,13 @@ function resolveConsoleProjectName(projectRoot, name) {
10987
11397
  } catch {}
10988
11398
  return basename(projectRoot);
10989
11399
  }
10990
- //#endregion
10991
- //#region src/console/plugin.ts
11400
+ // src/console/app-module.ts
10992
11401
  function resolveConsoleRuntimeRoot() {
10993
11402
  const root = [fileURLToPath(new URL("./runtime", import.meta.url)), fileURLToPath(new URL("./console/runtime", import.meta.url))].find((root) => ["rpc.ts", "rpc.js"].some((file) => existsSync(join(root, "server", file))));
10994
11403
  if (!root) throw viteHubErrorDiagnostics.VITE_HUB_B0001({ message: "[vitehub] Could not locate the packaged Console runtime." });
10995
11404
  return root;
10996
11405
  }
10997
11406
  const consoleRuntimeRoot = resolveConsoleRuntimeRoot();
10998
- /** The ViteHub skill and its well-known index, which the Console serves at `/_vitehub/.well-known/skills`. */
10999
- const consoleSkillsRoot = join(consoleRuntimeRoot, "public/skills");
11000
11407
  const consoleRuntimeCapabilityImports = [
11001
11408
  {
11002
11409
  exportName: "blob",
@@ -11031,7 +11438,17 @@ const consoleRuntimeCapabilityImports = [
11031
11438
  name: "kv"
11032
11439
  }
11033
11440
  ];
11034
- /** The Agent capabilities of a Console invocation. They load with the first invocation, not when the server starts. */
11441
+ function resolveConsoleRuntimeCapabilityImports(imports, plugins) {
11442
+ if (!plugins) return imports;
11443
+ return {
11444
+ ...imports,
11445
+ ...!imports?.email && plugins.some((plugin) => plugin.name === "@vite-hub/email/vite") ? { email: "vite-hub/email" } : {},
11446
+ ...!imports?.realtime && plugins.some((plugin) => plugin.name === "@vite-hub/realtime/vite") ? { realtime: "vite-hub/realtime/agent" } : {}
11447
+ };
11448
+ }
11449
+ function renderPickedImport(module, bindings) {
11450
+ return `import(${JSON.stringify(module)}).then(({ ${bindings} }) => ({ ${bindings} }))`;
11451
+ }
11035
11452
  function renderConsoleRuntimeCapabilities(imports) {
11036
11453
  if (!imports) return void 0;
11037
11454
  const capabilities = consoleRuntimeCapabilityImports.flatMap(({ exportName, name }) => {
@@ -11045,7 +11462,7 @@ function renderConsoleRuntimeCapabilities(imports) {
11045
11462
  }];
11046
11463
  });
11047
11464
  if (!capabilities.length) return void 0;
11048
- return `capabilities: async () => { const [${capabilities.map(({ alias, exportName }) => `{ ${exportName}: ${alias} }`).join(", ")}] = await Promise.all([${capabilities.map(({ module }) => `import(${JSON.stringify(module)})`).join(", ")}]); return { ${capabilities.map(({ alias, name }) => `${name}: ${alias}`).join(", ")} } }`;
11465
+ return `capabilities: async () => { const [${capabilities.map(({ alias, exportName }) => `{ ${exportName}: ${alias} }`).join(", ")}] = await Promise.all([${capabilities.map(({ exportName, module }) => renderPickedImport(module, exportName)).join(", ")}]); return { ${capabilities.map(({ alias, name }) => `${name}: ${alias}`).join(", ")} } }`;
11049
11466
  }
11050
11467
  function renderConsoleAccess(access) {
11051
11468
  if (!access) return {
@@ -11064,18 +11481,23 @@ function renderConsoleAccess(access) {
11064
11481
  install: [`installConsoleAccess({ ${fields.join(", ")} })`]
11065
11482
  };
11066
11483
  }
11067
- /** The URL of the Console page tool script below the app base. Its version query changes when the script changes. */
11068
- const consolePageToolScript = "/_vitehub/console/assets/page-tool.js?v=2";
11069
- function renderConsolePageTool(pageTool, auth) {
11070
- if (!pageTool) return "export default function viteHubConsolePlugin() {}";
11071
- const user = auth ? `, user: async request => (await import(${JSON.stringify(generatedModules.consolePageAuth)})).consolePageAuthUser(request)` : `, site: async request => (await import(${JSON.stringify(generatedModules.consoleSiteSession)})).readConsoleSiteVisitor(request)`;
11072
- return `export default function viteHubConsolePlugin(nitroApp) { installConsolePageTool(nitroApp, { base: ${JSON.stringify(pageTool.base)}, script: ${JSON.stringify(consolePageToolScript)}${user} }) }`;
11484
+ function consoleAppModuleSections({ access, catalog, sections, site = false }) {
11485
+ return withConsoleDocumentEditorSections(site ? [...sections, "site"] : sections, catalog).filter((section) => !access?.hiddenSections?.includes(section));
11486
+ }
11487
+ /** Whether the generated Console app module registers a document editor, which turns on `import.meta.viteHubConsoleDocuments`. */
11488
+ function consoleAppModuleHasDocumentEditors(options) {
11489
+ return describeConsoleDocumentEditors(consoleAppModuleSections(options), options.catalog.documents ?? {}).length > 0;
11073
11490
  }
11074
- function renderConsoleNitroPlugin({ projectRoot, name, sections: configuredSections, navigationSections, catalog, blobStores, invoke = false, access, runtimeCapabilityImports, development = false, pageTool }, build) {
11491
+ function renderConsoleAppModule({ projectRoot, name, sections: configuredSections, operationSections = configuredSections, navigationSections, catalog, blobStores, invoke = false, access, runtimeCapabilityImports, development = false, site = false }, build) {
11075
11492
  const agents = catalog.agents;
11076
11493
  const accessCode = renderConsoleAccess(access);
11077
11494
  const operations = catalog.operations ?? [];
11078
- const sections = withConsoleDocumentEditorSections(pageTool ? [...configuredSections, "site"] : configuredSections, catalog).filter((section) => !access?.hiddenSections?.includes(section));
11495
+ const sections = consoleAppModuleSections({
11496
+ access,
11497
+ catalog,
11498
+ sections: configuredSections,
11499
+ site
11500
+ });
11079
11501
  const documentEditors = describeConsoleDocumentEditors(sections, catalog.documents ?? {});
11080
11502
  const runtimeCapabilities = renderConsoleRuntimeCapabilities(runtimeCapabilityImports);
11081
11503
  const agentSkills = agents.map((agent) => requireOptionalOwner(ownerModules.agentVite, "agent").readColocatedAgentSkills(agent.handler));
@@ -11087,10 +11509,6 @@ function renderConsoleNitroPlugin({ projectRoot, name, sections: configuredSecti
11087
11509
  const agentsEnabled = sections.includes("agents");
11088
11510
  const blobEnabled = sections.includes("blob");
11089
11511
  const databaseEnabled = sections.includes("databases");
11090
- const databaseNames = catalog.content.databases?.kind === "definition-catalog" ? catalog.content.databases.definitions.map((definition) => definition.name) : [];
11091
- const siteDatabaseEnabled = !development && sections.includes("site") && configuredSections.includes("databases");
11092
- const firstDatabase = databaseNames.includes("default") ? "default" : [...databaseNames].sort((left, right) => left.localeCompare(right))[0];
11093
- const mcpClientEnabled = sections.includes("mcp-client");
11094
11512
  const schedulesEnabled = sections.includes("schedules");
11095
11513
  const runnableSchedules = (invoke ? catalog.manualSchedules ?? [] : []).map((schedule) => ` [${JSON.stringify(schedule.name)}]: () => import(${JSON.stringify(pathToFileURL(schedule.handler).href)}),`).join("").replace(/,$/, " ");
11096
11514
  const registered = new Map(describeConsoleContributedSections(sections).map((section) => [section.id, section]));
@@ -11100,19 +11518,28 @@ function renderConsoleNitroPlugin({ projectRoot, name, sections: configuredSecti
11100
11518
  });
11101
11519
  const runtimeReaders = describeConsoleRuntimeReaders(sections).filter((reader) => catalog.sectionOverrides?.[reader.section]?.view.kind !== "operation-view");
11102
11520
  const definitionsEnabled = databaseEnabled || contributedSections.length > 0;
11521
+ const ownOperations = consoleOperationModules.filter((entry) => entry.enabled({
11522
+ documents: documentEditors.length > 0,
11523
+ sections: operationSections,
11524
+ site: sections.includes("site")
11525
+ })).map((entry, index) => ({
11526
+ binding: `vitehubConsoleOwnOperations${index}`,
11527
+ entry
11528
+ }));
11529
+ const agentRealtime = ownOperations.some(({ entry }) => entry.module === generatedModules.consoleAgentOperations) ? runtimeCapabilityImports?.realtime : void 0;
11103
11530
  const runtimeImports = [
11104
11531
  {
11105
11532
  bindings: "installConsoleOperations",
11106
11533
  module: generatedModules.consoleOperations
11107
11534
  },
11535
+ ...ownOperations.map(({ binding, entry }) => ({
11536
+ bindings: `${entry.export}: ${binding}${agentRealtime && entry.module === generatedModules.consoleAgentOperations ? ", installConsoleAgentRealtime" : ""}`,
11537
+ module: entry.module
11538
+ })),
11108
11539
  ...operations.map((operation, index) => ({
11109
11540
  bindings: `${operation.export}: vitehubConsoleOperations${index}`,
11110
11541
  module: operation.module
11111
11542
  })),
11112
- ...mcpClientEnabled ? [{
11113
- bindings: "consoleMcpClientOperations: vitehubConsoleMcpClientOperations",
11114
- module: "vite-hub/console/mcp-client"
11115
- }] : [],
11116
11543
  ...blobEnabled ? [{
11117
11544
  bindings: "installConsoleBlob",
11118
11545
  module: generatedModules.consoleBlob
@@ -11158,24 +11585,23 @@ function renderConsoleNitroPlugin({ projectRoot, name, sections: configuredSecti
11158
11585
  const runtimeInstall = [
11159
11586
  ...blobEnabled ? [`installConsoleBlob(${JSON.stringify(projectRoot)}, vitehubConsoleBlob, ${JSON.stringify(blobStores)})`] : [],
11160
11587
  ...sections.includes("env") ? [`installConsoleEnv(${JSON.stringify(projectRoot)}, describeServerEnv())`] : [],
11161
- `installConsoleOperations([${[...mcpClientEnabled ? ["{ operations: vitehubConsoleMcpClientOperations, plugin: \"vite-hub\" }"] : [], ...operations.map((operation, index) => `{ operations: vitehubConsoleOperations${index}, plugin: ${JSON.stringify(operation.plugin)} }`)].join(", ")}], { invoke: ${invoke} })`,
11588
+ ...agentRealtime ? [`installConsoleAgentRealtime(() => import(${JSON.stringify(agentRealtime)}))`] : [],
11589
+ `installConsoleOperations([${[...ownOperations.map(({ binding }) => `{ operations: ${binding}, plugin: "vite-hub" }`), ...operations.map((operation, index) => `{ operations: vitehubConsoleOperations${index}, plugin: ${JSON.stringify(operation.plugin)} }`)].join(", ")}], { invoke: ${invoke} })`,
11162
11590
  ...definitionsEnabled ? [`installConsoleDefinitions(${JSON.stringify(projectRoot)}, ${JSON.stringify(catalog.content)}, ${JSON.stringify(contributedSections)}${runtimeReaders.length ? `, { ${runtimeReaders.map((reader, index) => `${JSON.stringify(reader.section)}: vitehubConsoleRuntimeReader${index}`).join(", ")} }` : ""})`] : [],
11163
11591
  ...schedulesEnabled ? [`installConsoleSchedules(${JSON.stringify(projectRoot)}, {${runnableSchedules}})`] : [],
11164
- ...databaseEnabled ? [`installConsoleDatabase(${JSON.stringify(projectRoot)}, vitehubConsoleDatabases, ${JSON.stringify(databaseNames)})`] : [],
11592
+ ...databaseEnabled ? [`installConsoleDatabase(${JSON.stringify(projectRoot)}, vitehubConsoleDatabases, ${JSON.stringify(catalog.content.databases?.kind === "definition-catalog" ? catalog.content.databases.definitions.map((definition) => definition.name) : [])})`] : [],
11165
11593
  ...agentsEnabled ? [`installConsoleAgentDefinitions([${definitions}], { projectRoot: ${JSON.stringify(projectRoot)}${invoke ? ", invoke: true" : ""}${runtimeCapabilities ? `, ${runtimeCapabilities}` : ""} })`] : []
11166
11594
  ];
11167
11595
  return [
11168
- `import { ${access ? "installConsoleAccess, " : ""}${build ? "installConsoleBuild, " : ""}installConsoleDevelopment, installConsoleProjectName, installConsoleRuntime, installConsoleSections, ${siteDatabaseEnabled ? "installConsoleSiteDatabase, " : ""}installConsoleVersion } from ${JSON.stringify(generatedModules.consoleSetup)}`,
11596
+ `import { ${access ? "installConsoleAccess, " : ""}${build ? "installConsoleBuild, " : ""}installConsoleDevelopment, installConsoleProjectName, installConsoleRuntime, installConsoleSections, installConsoleVersion } from ${JSON.stringify(generatedModules.consoleSetup)}`,
11169
11597
  ...accessCode.imports,
11170
- ...pageTool ? [`import { installConsolePageTool } from ${JSON.stringify(generatedModules.consolePageTool)}`] : [],
11171
11598
  ...documentEditors.length ? [`import { installConsoleDocuments } from ${JSON.stringify(generatedModules.consoleDocuments)}`] : [],
11172
11599
  ...documentEditors.map((editor, index) => `import { ${editor.export} as vitehubConsoleDocumentActions${index} } from ${JSON.stringify(editor.module)}`),
11173
11600
  `installConsoleDevelopment(${JSON.stringify(projectRoot)}, ${JSON.stringify(development)}${development && sections.includes("setup") ? `, ${JSON.stringify(setupDevRoute)}` : ""})`,
11174
11601
  ...accessCode.install,
11175
11602
  `installConsoleSections(${JSON.stringify(projectRoot)}, ${JSON.stringify(sections)}${navigationSections ? `, ${JSON.stringify(navigationSections)}` : ""})`,
11176
- ...siteDatabaseEnabled ? [`installConsoleSiteDatabase(async () => (await import("@vite-hub/database/runtime/registry")).databases${firstDatabase === void 0 ? "" : `, ${JSON.stringify(firstDatabase)}`})`] : [],
11177
11603
  `installConsoleRuntime(async () => {`,
11178
- ` const [${[...runtimeImports.map((entry) => `{ ${entry.bindings} }`), ...agentModules.map((entry) => entry.binding)].join(", ")}] = await Promise.all([${[...runtimeImports, ...agentModules].map((entry) => `import(${JSON.stringify(entry.module)})`).join(", ")}])`,
11604
+ ` const [${[...runtimeImports.map((entry) => `{ ${entry.bindings} }`), ...agentModules.map((entry) => entry.binding)].join(", ")}] = await Promise.all([${[...runtimeImports.map((entry) => renderPickedImport(entry.module, entry.bindings)), ...agentModules.map((entry) => `import(${JSON.stringify(entry.module)})`)].join(", ")}])`,
11179
11605
  " return () => {",
11180
11606
  ...runtimeInstall.map((line) => ` ${line}`),
11181
11607
  " }",
@@ -11184,15 +11610,14 @@ function renderConsoleNitroPlugin({ projectRoot, name, sections: configuredSecti
11184
11610
  `installConsoleVersion(${JSON.stringify(readViteHubVersion())})`,
11185
11611
  ...build ? [`installConsoleBuild(${JSON.stringify(build)})`] : [],
11186
11612
  ...documentEditors.length ? [`installConsoleDocuments(${JSON.stringify(projectRoot)}, { ${documentEditors.map((editor, index) => `${JSON.stringify(editor.section)}: { actions: vitehubConsoleDocumentActions${index}, load: () => import(${JSON.stringify(pathToFileURL(editor.entry).href)}) }`).join(", ")} })`] : [],
11187
- renderConsolePageTool(pageTool, configuredSections.includes("auth")),
11188
11613
  ""
11189
11614
  ].join("\n");
11190
11615
  }
11191
- /** Write the generated Console Nitro plugin. */
11192
- async function writeConsoleNitroPlugin(options) {
11616
+ /** Write the generated Console app module. */
11617
+ async function writeConsoleAppModule(options) {
11193
11618
  const { file, active = () => true } = options;
11194
11619
  if (!active()) return;
11195
- const contents = renderConsoleNitroPlugin(options, options.development ? void 0 : {
11620
+ const contents = renderConsoleAppModule(options, options.development ? void 0 : {
11196
11621
  ...await consoleBuildOf(options.projectRoot),
11197
11622
  ...options.target
11198
11623
  });
@@ -11201,8 +11626,7 @@ async function writeConsoleNitroPlugin(options) {
11201
11626
  await writeFile(file, contents, "utf8");
11202
11627
  }
11203
11628
  }
11204
- //#endregion
11205
- //#region src/console/refresh.ts
11629
+ // src/console/refresh.ts
11206
11630
  function serializeConsoleRefresh(refresh) {
11207
11631
  let queue = Promise.resolve();
11208
11632
  return () => {
@@ -11211,8 +11635,7 @@ function serializeConsoleRefresh(refresh) {
11211
11635
  return result;
11212
11636
  };
11213
11637
  }
11214
- //#endregion
11215
- //#region src/console/nitro.ts
11638
+ // src/console/nitro.ts
11216
11639
  function mountPath(base, path) {
11217
11640
  return `${viteHubBasePath(base)}${path}`;
11218
11641
  }
@@ -11222,44 +11645,6 @@ function mountPath(base, path) {
11222
11645
  * so an app route file on the same path keeps the app Auth access routes.
11223
11646
  */
11224
11647
  const consoleRouteMeta = { vitehubAuthAccess: "handler" };
11225
- /**
11226
- * Serves the ViteHub skill at `/_vitehub/.well-known/skills` for `npx skills add <app>/_vitehub`. The files are static and
11227
- * public, and match the installed `vite-hub` version. Nitro adds the application base to the path.
11228
- */
11229
- function addConsoleAppRoutes(nitro, consoleRuntimeRoot, base) {
11230
- const skills = join(consoleRuntimeRoot, "public/skills");
11231
- nitro.publicAssets = [{
11232
- baseURL: mountPath(base, "/_vitehub/.well-known/skills"),
11233
- dir: skills,
11234
- fallthrough: false
11235
- }, ...(nitro.publicAssets ?? []).filter((asset) => asset.dir !== skills)];
11236
- addConsolePageToolRoutes(nitro, consoleRuntimeRoot, viteHubBasePath(base));
11237
- }
11238
- /**
11239
- * Serves the script of the **Console** page tool at `<mount>/_vitehub/console/assets`, and the page tools session
11240
- * `GET <mount>/_vitehub/page/tools` with the loader at `<mount>/_vitehub/page/assets`, so the Console link works in
11241
- * an app without Comments. When Comments added the session and the loader first, they stay as they are. `mount` is the
11242
- * route prefix from `viteHubPageToolsBase()`, or empty when Nitro adds the app base, as with Nuxt.
11243
- */
11244
- function addConsolePageToolRoutes(nitro, consoleRuntimeRoot, mount = "") {
11245
- const script = join(consoleRuntimeRoot, "page-tool");
11246
- const loader = join(consoleRuntimeRoot, "page");
11247
- const handler = join(consoleRuntimeRoot, "server/page-tools-route.js");
11248
- nitro.handlers = (nitro.handlers ?? []).filter((candidate) => candidate.handler !== handler);
11249
- nitro.publicAssets = [...(nitro.publicAssets ?? []).filter((asset) => asset.dir !== script && asset.dir !== loader), {
11250
- baseURL: `${mount}/_vitehub/console/assets`,
11251
- dir: script,
11252
- maxAge: 300
11253
- }];
11254
- const kit = createNitroServerKit(nitro);
11255
- addViteHubPageToolRoutes(kit, {
11256
- handler,
11257
- loader,
11258
- mount
11259
- });
11260
- nitro.handlers = kit.config.handlers;
11261
- nitro.publicAssets = kit.config.publicAssets;
11262
- }
11263
11648
  const consoleRouteGuardName = "vite-hub/console-route-guard";
11264
11649
  /**
11265
11650
  * A Nitro module that refuses an app route file, such as `server/routes/_vitehub/rpc.post.ts`, on a Console route.
@@ -11272,86 +11657,95 @@ function consoleRouteGuard(routes) {
11272
11657
  name: consoleRouteGuardName,
11273
11658
  setup(nitro) {
11274
11659
  nitro.hooks.hook("build:before", () => {
11275
- const conflict = nitro.scannedHandlers.find((candidate) => !candidate.middleware && candidate.route !== void 0 && routes.includes(candidate.route));
11660
+ const conflict = nitro.scannedHandlers.find((candidate) => !candidate.middleware && candidate.route !== void 0 && routes.includes(withoutTrailingSlashes(candidate.route)));
11276
11661
  if (!conflict) return;
11277
11662
  throw viteHubErrorDiagnostics.VITE_HUB_R0040({ message: `Cannot mount the ViteHub Console handler at "${conflict.route}" because the app route "${conflict.handler}" uses that path. Move the app route to another path.` });
11278
11663
  });
11279
11664
  }
11280
11665
  };
11281
11666
  }
11667
+ function withoutTrailingSlashes(path) {
11668
+ return path.replace(/\/+$/, "");
11669
+ }
11282
11670
  function isConsoleRouteGuard(value) {
11283
11671
  return value instanceof Object && "name" in value && value.name === consoleRouteGuardName;
11284
11672
  }
11285
11673
  /**
11286
- * Add the Console routes of the app. The ViteHub Console and the CLI `POST` signed calls to `/_vitehub/rpc`, and a
11287
- * browser `GET`s it with a one-time ticket that an operation made, such as for impersonation or Content preview. A
11288
- * browser that opens `/_vitehub` or `/_vitehub/<page>` goes back to that page with the pill. See `server/site-entry.ts`.
11674
+ * Add the Console route of the app: lazy handlers under `<base>/_vitehub`. The ViteHub Console and the CLI `POST` signed
11675
+ * calls to `/_vitehub/rpc`. A browser that opens `/_vitehub` or `/_vitehub/<page>` goes to the page of the app with the
11676
+ * pill, or, in an app without Comments, to that page of the app in the ViteHub Console. See `server/site-entry.ts`.
11677
+ * `/_vitehub/site` takes the tokens of the Console: impersonation and Content preview in every app, and with
11678
+ * `siteAccess`, in an app with Comments, Site access. See `server/site.ts`.
11289
11679
  */
11290
- function addConsoleRpcHandler(nitro, consoleRuntimeRoot, base) {
11680
+ function addConsoleRpcHandler(nitro, consoleRuntimeRoot, base, options = {}) {
11291
11681
  const kit = createNitroServerKit(nitro);
11292
11682
  const handlers = kit.config.handlers;
11293
- const registrations = [
11294
- {
11295
- suffix: "/_vitehub/rpc",
11296
- handler: join(consoleRuntimeRoot, "server/rpc.js")
11297
- },
11298
- {
11299
- suffix: "/_vitehub",
11300
- handler: join(consoleRuntimeRoot, "server/site-entry.js")
11301
- },
11302
- {
11303
- suffix: "/_vitehub/**",
11304
- handler: join(consoleRuntimeRoot, "server/site-entry.js")
11305
- }
11683
+ const consoleEntry = join(consoleRuntimeRoot, "server/entry.js");
11684
+ const siteAccessEntry = join(consoleRuntimeRoot, "server/entry-site-access.js");
11685
+ const entries = [consoleEntry, siteAccessEntry];
11686
+ const handler = options.siteAccess ? siteAccessEntry : consoleEntry;
11687
+ const suffixes = [
11688
+ "/_vitehub/**",
11689
+ "/_vitehub",
11690
+ "/_vitehub/rpc",
11691
+ "/_vitehub/site"
11306
11692
  ];
11307
- const ownedHandlers = new Set(registrations.map((registration) => registration.handler));
11308
- const ownedSuffixes = registrations.map((registration) => registration.suffix);
11309
- const retainedHandlers = handlers.filter((candidate) => {
11310
- if (!ownedHandlers.has(candidate.handler)) return true;
11311
- const route = candidate.route;
11312
- return route !== void 0 && !ownedSuffixes.some((suffix) => route === suffix || route.endsWith(suffix));
11313
- });
11693
+ const retainedHandlers = handlers.filter((candidate) => !entries.includes(candidate.handler) || !suffixes.some((suffix) => candidate.route?.endsWith(suffix)));
11314
11694
  handlers.splice(0, handlers.length, ...retainedHandlers);
11315
- const routes = [];
11316
- for (const registration of registrations) {
11317
- const route = mountPath(base, registration.suffix);
11318
- routes.push(route);
11319
- const conflict = retainedHandlers.find((candidate) => candidate.route === route && candidate.handler !== registration.handler);
11320
- if (conflict) throw viteHubErrorDiagnostics.VITE_HUB_R0040({ message: `Cannot mount the ViteHub Console handler at "${route}" because that route already uses "${conflict.handler}".` });
11321
- const handler = {
11322
- handler: registration.handler,
11323
- route
11324
- };
11325
- handler.meta = { ...consoleRouteMeta };
11326
- handler.lazy = true;
11327
- kit.addHandler(handler, "end");
11328
- }
11695
+ const routes = suffixes.map((path) => mountPath(base, path));
11696
+ const taken = (path) => routes.includes(withoutTrailingSlashes(path));
11697
+ const conflict = retainedHandlers.find((candidate) => candidate.route !== void 0 && taken(candidate.route));
11698
+ if (conflict) throw viteHubErrorDiagnostics.VITE_HUB_R0040({ message: `Cannot mount the ViteHub Console handler at "${conflict.route}" because that route already uses "${conflict.handler}".` });
11699
+ const routeConflict = Object.keys(nitro.routes ?? {}).find(taken);
11700
+ if (routeConflict) throw viteHubErrorDiagnostics.VITE_HUB_R0040({ message: `Cannot mount the ViteHub Console handler at "${routeConflict}" because the Nitro routes option uses that path. Move the app route to another path.` });
11701
+ for (const route of routes) kit.addHandler({
11702
+ handler,
11703
+ lazy: true,
11704
+ meta: { ...consoleRouteMeta },
11705
+ route
11706
+ }, "end");
11707
+ const operationLoader = join(consoleRuntimeRoot, "operation-loader.js");
11708
+ nitro.plugins = [.../* @__PURE__ */ new Set([...nitro.plugins ?? [], operationLoader])];
11329
11709
  nitro.handlers = kit.config.handlers;
11330
11710
  nitro.modules = [...(nitro.modules ?? []).filter((module) => !isConsoleRouteGuard(module)), consoleRouteGuard(routes)];
11331
- const plugins = kit.config.plugins;
11332
- if (nitro.plugins) nitro.plugins.splice(0, nitro.plugins.length, ...plugins);
11333
- else nitro.plugins = plugins;
11334
11711
  }
11335
- //#endregion
11336
- //#region src/console/operation-features.ts
11712
+ // src/console/site-access.ts
11713
+ /**
11714
+ * Whether the app has Site access: the Comments pill, which reads the person of the site cookie. Comments is on with
11715
+ * `server/comments.ts` or the `comments` option, and `overlay: false` leaves the pill out. Vite and Nuxt read this one
11716
+ * value for the `/_vitehub/site` route, the `/_vitehub/<page>` route, and the `site` section of the Console.
11717
+ */
11718
+ function resolveConsoleSiteAccess(comments, options) {
11719
+ const commentsVite = ownerModules.commentsVite;
11720
+ if (comments === false || !commentsVite) return false;
11721
+ if (typeof comments === "object" && comments.overlay === false) return false;
11722
+ return Boolean(comments) || commentsVite.findCommentsEntry(options.projectRoot, options.serverDirs) !== void 0;
11723
+ }
11724
+ // src/console/operation-features.ts
11337
11725
  /** Every module that the operation transform changes reads one of these `import.meta.viteHubConsole*` flags. */
11338
11726
  const consoleOperationFeaturesFilter = { code: "import.meta.viteHubConsole" };
11339
11727
  /**
11340
11728
  * Remove disabled operation loaders before server bundlers follow their optional imports. The document editor and media
11341
- * library code stays only when an installed owner package, such as `@vite-hub/content`, contributes a document editor.
11729
+ * library code stays only when the app configures a document editor section that an owner package, such as
11730
+ * `@vite-hub/content`, contributes. With `development: false`, the development-only loopback peer check is removed.
11342
11731
  */
11343
- function transformConsoleOperationFeatures(code, sections, documents = consoleDocumentEditorSectionIds.length > 0) {
11344
- const transformed = code.replaceAll("import.meta.viteHubConsoleOperationSections", JSON.stringify(sections)).replaceAll("import.meta.viteHubConsoleAgents", String(sections.includes("agents"))).replaceAll("import.meta.viteHubConsoleAuth", String(sections.includes("auth"))).replaceAll("import.meta.viteHubConsoleDatabase", String(sections.includes("databases"))).replaceAll("import.meta.viteHubConsoleWorkspaces", String(sections.includes("workspaces"))).replaceAll("import.meta.viteHubConsoleDocuments", String(documents));
11732
+ function transformConsoleOperationFeatures(code, sections, documents, development) {
11733
+ const featured = code.replaceAll("import.meta.viteHubConsoleAgents", String(sections.includes("agents"))).replaceAll("import.meta.viteHubConsoleAuth", String(sections.includes("auth"))).replaceAll("import.meta.viteHubConsoleDocuments", String(documents ?? consoleDocumentEditorSectionIds.some((section) => sections.includes(section))));
11734
+ const transformed = development === void 0 ? featured : featured.replaceAll("import.meta.viteHubConsoleDevelopment", String(development));
11345
11735
  return transformed === code ? void 0 : transformed;
11346
11736
  }
11347
- /** Nuxt's Nitro bundles the Console independently of the app's Vite plugins. */
11348
- function consoleOperationFeatures(sections) {
11737
+ /**
11738
+ * Nuxt's Nitro bundles the Console independently of the app's Vite plugins. `documents` reads the document editors of the
11739
+ * written Console app module, because discovery finds them after the plugin is installed. A development server keeps the
11740
+ * document code whenever an owner contributes an editor, because it caches the transform and an editor can appear later.
11741
+ */
11742
+ function consoleOperationFeatures(sections, documents = () => void 0, development) {
11349
11743
  return {
11350
11744
  name: "vite-hub/console-operation-features",
11351
11745
  transform: {
11352
11746
  filter: consoleOperationFeaturesFilter,
11353
11747
  handler(code) {
11354
- const transformed = transformConsoleOperationFeatures(code, sections);
11748
+ const transformed = transformConsoleOperationFeatures(code, sections, documents(), development);
11355
11749
  return transformed === void 0 ? void 0 : {
11356
11750
  code: transformed,
11357
11751
  map: null
@@ -11360,8 +11754,7 @@ function consoleOperationFeatures(sections) {
11360
11754
  }
11361
11755
  };
11362
11756
  }
11363
- //#endregion
11364
- //#region src/console/dev-access-notice.ts
11757
+ // src/console/dev-access-notice.ts
11365
11758
  const guide = "https://vitehub.dev/docs/console/development#share-a-development-server";
11366
11759
  /**
11367
11760
  * The startup warning of a development server that takes Console calls without a signature and listens beyond loopback,
@@ -11379,17 +11772,19 @@ function consoleDevAccessNotice(mode, address, env = process.env) {
11379
11772
  const fix = keyless ? `Set a ${key}` : mode === "open" ? `Remove console.auth and set a ${key}` : `Set console: true and a ${key}`;
11380
11773
  return `[vitehub] The dev server listens on ${address.address}, and the Console endpoint takes calls without a signature. It refuses other machines, but a tunnel or a proxy on this machine can reach it. ${fix} before you share this dev server: ${guide}`;
11381
11774
  }
11382
- //#endregion
11383
- //#region src/console/vite.ts
11384
- const generatedConsolePlugin = ".vitehub/nitro/console/plugin.mjs";
11385
- const generatedDevelopmentConsolePlugin = ".vitehub/nitro/console/plugin-dev.mjs";
11775
+ // src/console/vite.ts
11776
+ const generatedConsoleApp = ".vitehub/nitro/console/app.mjs";
11777
+ const generatedDevelopmentConsoleApp = ".vitehub/nitro/console/app-dev.mjs";
11778
+ /** The import that the Console routes and the Agent `console` capability use to load the generated Console app module. */
11779
+ const consoleAppModuleId = "#vitehub/console/app";
11386
11780
  /**
11387
- * The generated Console plugin of a project. A development server writes its own file: it installs the local access
11388
- * mode and development routes, and it rewrites the file when the project changes. A build that runs while the dev
11389
- * server is up would otherwise bundle that file and ship development access to production.
11781
+ * The generated Console app module of a project. The Console routes import it on their first request, so it never
11782
+ * loads when the server starts. A development server writes its own file: it installs the local access mode and
11783
+ * development routes, and it rewrites the file when the project changes. A build that runs while the dev server is up
11784
+ * would otherwise bundle that file and ship development access to production.
11390
11785
  */
11391
- function resolveGeneratedConsolePlugin(root, development = false) {
11392
- return resolve(root, development ? generatedDevelopmentConsolePlugin : generatedConsolePlugin);
11786
+ function resolveGeneratedConsoleApp(root, development = false) {
11787
+ return resolve(root, development ? generatedDevelopmentConsoleApp : generatedConsoleApp);
11393
11788
  }
11394
11789
  const localDevelopmentConsole = Object.freeze({
11395
11790
  auth: false,
@@ -11403,9 +11798,27 @@ const removedConsoleOptions = {
11403
11798
  retention: "The Agent Invocation journal does not depend on the Console. Set agent: { invocations: { retention } } in vitehub() instead.",
11404
11799
  embed: `Apps do not serve the Console page. Open the app in the ViteHub Console at https://console.vitehub.dev. Remove console.embed. See ${consoleGuide}`,
11405
11800
  mcp: `Apps do not serve a Console MCP at /_vitehub/mcp. Agents use the ViteHub MCP of the Console at https://console.vitehub.dev/mcp. Remove console.mcp. See ${consoleGuide}`,
11801
+ mcpClient: `Apps do not run an MCP client. The MCP client section of the ViteHub Console connects to MCP servers from the Console server, so the app needs no @modelcontextprotocol/sdk and no VITEHUB_CONSOLE_MCP_KEY. Remove console.mcpClient. See ${consoleGuide}`,
11406
11802
  origins: `Apps take no Console calls from browsers. The ViteHub Console signs calls on its server. Remove console.origins. See ${consoleGuide}`,
11803
+ pill: `Apps do not add the Console link to their pages. The Comments pill loads the Console segment from the ViteHub Console, and an app without Comments opens through the Console at https://console.vitehub.dev. Remove console.pill. See ${consoleGuide}`,
11407
11804
  signInPage: `Apps do not serve a Console sign-in page. People sign in to the ViteHub Console at https://console.vitehub.dev. Remove console.signInPage. See ${consoleGuide}`
11408
11805
  };
11806
+ const loopbackConsoleHosts = /* @__PURE__ */ new Set([
11807
+ "localhost",
11808
+ "127.0.0.1",
11809
+ "[::1]"
11810
+ ]);
11811
+ /** The origin of a `console.url` value, or `undefined` when it is not an `https:` origin or a loopback `http:` origin. */
11812
+ function consoleOrigin(value) {
11813
+ if (typeof value !== "string" || !URL.canParse(value)) return void 0;
11814
+ const url = new URL(value);
11815
+ if (!(url.protocol === "https:" || url.protocol === "http:" && loopbackConsoleHosts.has(url.hostname)) || url.username || url.password || url.pathname !== "/" || url.search || url.hash || value.includes("@")) return void 0;
11816
+ return url.origin;
11817
+ }
11818
+ /** The origin of the ViteHub Console that the app links to: `console.url`, or `undefined` for the hosted Console. */
11819
+ function resolveConsoleUrl(configured) {
11820
+ return configured?.url === void 0 ? void 0 : consoleOrigin(configured.url);
11821
+ }
11409
11822
  /** The fix of a removed `console.auth` value. */
11410
11823
  function removedConsoleAuth(auth) {
11411
11824
  if (auth === "token") return "console.auth: \"token\" was removed. Signed calls are the default now. Remove console.auth, or set console: true.";
@@ -11427,13 +11840,13 @@ function resolveConsoleOptions(value) {
11427
11840
  if (auth !== void 0 && auth !== false) throw viteHubErrorDiagnostics.VITE_HUB_B0004({ message: "[vitehub] console.auth must be false, for development without signed calls, or left out." });
11428
11841
  const impersonation = Reflect.get(value, "impersonation");
11429
11842
  if (impersonation !== void 0 && impersonation !== true && impersonation !== false) throw viteHubErrorDiagnostics.VITE_HUB_B0004({ message: "[vitehub] console.impersonation must be true or false." });
11430
- const pill = Reflect.get(value, "pill");
11431
- if (pill !== void 0 && pill !== false) throw viteHubErrorDiagnostics.VITE_HUB_B0004({ message: "[vitehub] console.pill must be false, to leave the Console link out of the page tools pill, or left out." });
11432
11843
  const sections = Reflect.get(value, "sections");
11433
11844
  if (sections !== void 0 && (!(sections instanceof Object) || Array.isArray(sections) || Object.values(sections).some((entry) => entry !== false))) throw viteHubErrorDiagnostics.VITE_HUB_B0004({ message: "[vitehub] console.sections maps a section id to false, such as { content: false }." });
11845
+ const url = Reflect.get(value, "url");
11846
+ if (url !== void 0 && consoleOrigin(url) === void 0) throw viteHubErrorDiagnostics.VITE_HUB_B0004({ message: `[vitehub] console.url must be the https:// origin of a ViteHub Console without a path, such as "https://console.example.com", or http://localhost for a Console on this computer.` });
11434
11847
  return value;
11435
11848
  }
11436
- function configureConsoleNitroRoutes(nitro, baseURL, sections, rpcOnly = false) {
11849
+ function configureConsoleNitroRoutes(nitro, baseURL, siteAccess, app) {
11437
11850
  const mount = viteHubPageToolsBase({
11438
11851
  base: baseURL,
11439
11852
  nitro
@@ -11442,24 +11855,16 @@ function configureConsoleNitroRoutes(nitro, baseURL, sections, rpcOnly = false)
11442
11855
  ...nitro,
11443
11856
  handlers: Array.isArray(nitro.handlers) ? [...nitro.handlers] : []
11444
11857
  });
11445
- addConsoleRpcHandler(kit.config, consoleRuntimeRoot, mount);
11446
- if (!rpcOnly) addConsolePageToolRoutes(kit.config, consoleRuntimeRoot, mount);
11447
- const userPublicAssets = (kit.config.publicAssets ?? []).filter((asset) => asset?.dir !== consoleSkillsRoot);
11448
- return {
11449
- kit,
11450
- publicAssets: [...rpcOnly ? [] : [{
11451
- baseURL: consoleMountPath(mount, "/_vitehub/.well-known/skills"),
11452
- dir: consoleSkillsRoot,
11453
- fallthrough: false
11454
- }], ...userPublicAssets]
11858
+ addConsoleRpcHandler(kit.config, consoleRuntimeRoot, mount, { siteAccess });
11859
+ if (app) kit.config.alias = {
11860
+ ...kit.config.alias instanceof Object ? kit.config.alias : {},
11861
+ [consoleAppModuleId]: app
11455
11862
  };
11456
- }
11457
- function consoleMountPath(base, path) {
11458
- return `${viteHubBasePath(base)}${path}`;
11863
+ return kit;
11459
11864
  }
11460
11865
  /**
11461
- * The variables that a deployed Console reads: a `VITEHUB_CONSOLE_KEY_<NAME>` public key for each linked Console, and
11462
- * `VITEHUB_CONSOLE_MCP_KEY`, which seals MCP connections when `mcpClient` is on. Without `console`, it reads none.
11866
+ * The variables that a deployed Console reads: a `VITEHUB_CONSOLE_KEY_<NAME>` public key for each linked Console.
11867
+ * Without `console`, it reads none.
11463
11868
  */
11464
11869
  function consoleDeploymentEnv(configured) {
11465
11870
  if (!configured) return [];
@@ -11470,13 +11875,7 @@ function consoleDeploymentEnv(configured) {
11470
11875
  secret: false,
11471
11876
  hasDefault: false,
11472
11877
  owners: ["console"]
11473
- }, ...isConsoleMcpClientEnabled(configured) ? [{
11474
- names: ["VITEHUB_CONSOLE_MCP_KEY"],
11475
- required: false,
11476
- secret: true,
11477
- hasDefault: false,
11478
- owners: ["console"]
11479
- }] : []];
11878
+ }];
11480
11879
  }
11481
11880
  /** Reject a production build that takes Console calls without a signature. */
11482
11881
  function assertConsoleProductionAuth(configured) {
@@ -11511,14 +11910,10 @@ function resolveConsoleAccessBuild(configured, options) {
11511
11910
  function assertConsoleAccess(configured, options) {
11512
11911
  if (configured.impersonation === true && !options.auth) throw viteHubErrorDiagnostics.VITE_HUB_B0005({ message: "[vitehub] console.impersonation needs app Auth. Add server/auth.ts with Better Auth's admin plugin, or remove console.impersonation." });
11513
11912
  }
11514
- function generatedConsolePluginRegistration(value) {
11515
- const normalized = value.replaceAll("\\", "/");
11516
- return normalized === generatedConsolePlugin || /\/\.vitehub\/nitro\/console\/plugin(?:-[^/]+)?\.mjs$/.test(normalized);
11517
- }
11518
11913
  function consoleVitePlugin(options) {
11519
11914
  let sections = options.sections ?? [];
11520
11915
  let blobStores = options.blobStores ?? [];
11521
- let generatedPlugin;
11916
+ let generatedApp;
11522
11917
  let databaseDiscoveryRoot;
11523
11918
  let projectRoot;
11524
11919
  let rateLimitDiscoveryRoot;
@@ -11536,12 +11931,16 @@ function consoleVitePlugin(options) {
11536
11931
  const consoleBuildCatalogs = /* @__PURE__ */ new Map();
11537
11932
  let baseURL = "/";
11538
11933
  let applicationBase = "/";
11934
+ const siteAccess = () => projectRoot !== void 0 && resolveConsoleSiteAccess(options.comments, {
11935
+ projectRoot,
11936
+ serverDirs
11937
+ });
11539
11938
  function consoleAccess() {
11540
11939
  if (!resolvedConsoleConfiguration || !root) return;
11541
11940
  return resolveConsoleAccessBuild(resolvedConsoleConfiguration, { root });
11542
11941
  }
11543
- /** The options of the generated Console Nitro plugin, read from the current state when it is written. */
11544
- function consolePluginOptions() {
11942
+ /** The options of the generated Console app module, read from the current state when it is written. */
11943
+ function consoleAppModuleOptions() {
11545
11944
  return {
11546
11945
  access: consoleAccess(),
11547
11946
  active: () => !options.invocationRootState?.closed,
@@ -11549,7 +11948,8 @@ function consoleVitePlugin(options) {
11549
11948
  development,
11550
11949
  invoke,
11551
11950
  name: options.name,
11552
- runtimeCapabilityImports: options.runtimeCapabilityImports,
11951
+ operationSections: options.operationSections,
11952
+ runtimeCapabilityImports: resolveConsoleRuntimeCapabilityImports(options.runtimeCapabilityImports, resolvedPlugins),
11553
11953
  sections,
11554
11954
  ...development ? {} : { target: {
11555
11955
  ...options.host ? { host: options.host } : {},
@@ -11559,11 +11959,11 @@ function consoleVitePlugin(options) {
11559
11959
  }
11560
11960
  } },
11561
11961
  navigationSections: options.rpcOnly ? sections.filter((section) => section === "setup") : void 0,
11562
- ...options.rpcOnly || resolvedConsoleConfiguration?.pill === false ? {} : { pageTool: { base: applicationBase } }
11962
+ ...options.rpcOnly || !siteAccess() ? {} : { site: true }
11563
11963
  };
11564
11964
  }
11565
11965
  const refreshConsoleCatalog = serializeConsoleRefresh(async () => {
11566
- if (!generatedPlugin || !projectRoot || !root) return;
11966
+ if (!generatedApp || !projectRoot || !root) return;
11567
11967
  const catalog = await discoverConsoleBuildCatalog({
11568
11968
  contentImportBase: options.contentImportBase,
11569
11969
  databaseDiscoveryRoot,
@@ -11580,10 +11980,10 @@ function consoleVitePlugin(options) {
11580
11980
  workspaceDiscoveryRoot
11581
11981
  });
11582
11982
  consoleBuildCatalogs.set(projectRoot, catalog);
11583
- await writeConsoleNitroPlugin({
11584
- ...consolePluginOptions(),
11983
+ await writeConsoleAppModule({
11984
+ ...consoleAppModuleOptions(),
11585
11985
  catalog,
11586
- file: generatedPlugin,
11986
+ file: generatedApp,
11587
11987
  projectRoot
11588
11988
  });
11589
11989
  });
@@ -11614,10 +12014,22 @@ function consoleVitePlugin(options) {
11614
12014
  const framework = nitro.options.framework;
11615
12015
  nitroVersion = framework?.name === "nitro" ? framework.version : void 0;
11616
12016
  } },
12017
+ resolveId: {
12018
+ order: "pre",
12019
+ filter: { id: /^#vitehub\/console\/app$/ },
12020
+ handler() {
12021
+ return generatedApp;
12022
+ }
12023
+ },
11617
12024
  transform: {
11618
12025
  filter: consoleOperationFeaturesFilter,
11619
12026
  handler(code) {
11620
- const transformed = transformConsoleOperationFeatures(code, options.operationSections ?? sections);
12027
+ const catalog = projectRoot ? consoleBuildCatalogs.get(projectRoot) : void 0;
12028
+ const documents = development ? consoleDocumentEditorSectionIds.length > 0 : catalog ? consoleAppModuleHasDocumentEditors({
12029
+ ...consoleAppModuleOptions(),
12030
+ catalog
12031
+ }) : void 0;
12032
+ const transformed = transformConsoleOperationFeatures(code, options.operationSections ?? sections, documents, development);
11621
12033
  return transformed === void 0 ? void 0 : {
11622
12034
  code: transformed,
11623
12035
  map: null
@@ -11667,7 +12079,7 @@ function consoleVitePlugin(options) {
11667
12079
  projectRoot = resolveViteHubProjectRoot(root);
11668
12080
  const build = environment.command === "build";
11669
12081
  invoke = configured.invoke ?? !build;
11670
- generatedPlugin = resolveGeneratedConsolePlugin(projectRoot, development);
12082
+ generatedApp = resolveGeneratedConsoleApp(projectRoot, development);
11671
12083
  if (!cliDiscovery) {
11672
12084
  const resolvedOnlySections = /* @__PURE__ */ new Set([
11673
12085
  "databases",
@@ -11691,24 +12103,24 @@ function consoleVitePlugin(options) {
11691
12103
  workspaceDiscoveryRoot
11692
12104
  });
11693
12105
  consoleBuildCatalogs.set(projectRoot, catalog);
11694
- await writeConsoleNitroPlugin({
11695
- ...consolePluginOptions(),
12106
+ await writeConsoleAppModule({
12107
+ ...consoleAppModuleOptions(),
11696
12108
  catalog,
11697
- file: generatedPlugin,
12109
+ file: generatedApp,
11698
12110
  projectRoot
11699
12111
  });
11700
12112
  }
11701
12113
  const consoleConfig = viteConfig;
11702
- const { kit, publicAssets } = configureConsoleNitroRoutes(consoleConfig.nitro ? { ...consoleConfig.nitro } : {}, applicationBase, sections, options.rpcOnly);
11703
- if (Array.isArray(kit.config.plugins)) {
11704
- const plugins = kit.config.plugins.filter((candidate) => !generatedConsolePluginRegistration(candidate));
11705
- kit.config.plugins.splice(0, kit.config.plugins.length, ...plugins);
11706
- }
11707
- kit.addPlugin(generatedPlugin);
11708
- consoleConfig.nitro = {
11709
- ...kit.config,
11710
- publicAssets
12114
+ const nitroConfig = { ...configureConsoleNitroRoutes(consoleConfig.nitro ? { ...consoleConfig.nitro } : {}, applicationBase, siteAccess(), generatedApp).config };
12115
+ consoleConfig.nitro = nitroConfig;
12116
+ const consoleUrl = resolveConsoleUrl(configured);
12117
+ if (!consoleUrl) return;
12118
+ const define = JSON.stringify(consoleUrl);
12119
+ if (viteConfig["__vitehubNitroConfigContext"] === true) nitroConfig.replace = {
12120
+ ...nitroConfig.replace instanceof Object ? nitroConfig.replace : {},
12121
+ __VITEHUB_CONSOLE_URL__: define
11711
12122
  };
12123
+ return { define: { __VITEHUB_CONSOLE_URL__: define } };
11712
12124
  },
11713
12125
  async configResolved(config) {
11714
12126
  root = config.root;
@@ -11716,7 +12128,7 @@ function consoleVitePlugin(options) {
11716
12128
  baseURL = viteHubPageToolsBase(config).base || "/";
11717
12129
  applicationBase = baseURL;
11718
12130
  projectRoot ||= resolveViteHubProjectRoot(config.root);
11719
- generatedPlugin ||= resolveGeneratedConsolePlugin(projectRoot, development);
12131
+ generatedApp ||= resolveGeneratedConsoleApp(projectRoot, development);
11720
12132
  const viteConfig = config;
11721
12133
  const database = getResolvedFeatureOptions(config, "database");
11722
12134
  const rateLimit = getResolvedFeatureOptions(config, "rateLimit");
@@ -11739,13 +12151,9 @@ function consoleVitePlugin(options) {
11739
12151
  sections = sections.filter((section) => section !== "sandbox-tasks");
11740
12152
  if (sandboxTask) sections = [...sections, "sandbox-tasks"];
11741
12153
  }
11742
- const { kit, publicAssets } = configureConsoleNitroRoutes(viteConfig.nitro ??= {}, viteHubPageToolsBase(config).base, sections, options.rpcOnly);
11743
- viteConfig.nitro = {
11744
- ...kit.config,
11745
- publicAssets
11746
- };
11747
- generatedPlugin = resolveGeneratedConsolePlugin(projectRoot, development);
12154
+ generatedApp = resolveGeneratedConsoleApp(projectRoot, development);
11748
12155
  serverDirs = config[VITEHUB_SERVER_DIRS];
12156
+ viteConfig.nitro = { ...configureConsoleNitroRoutes(viteConfig.nitro ??= {}, viteHubPageToolsBase(config).base, siteAccess(), generatedApp).config };
11749
12157
  if (!cliDiscovery) await refreshConsoleCatalog();
11750
12158
  },
11751
12159
  configureServer(server) {
@@ -11779,19 +12187,14 @@ function consoleVitePlugin(options) {
11779
12187
  function consoleOperationContributions(sections) {
11780
12188
  return [{
11781
12189
  export: "consoleOperations",
11782
- load: async () => (await import("./operations-5Lwd1xEI.js")).consoleOperations.filter((operation) => sections().includes("databases") || !operation.name.startsWith("databases.")),
12190
+ load: async () => (await loadConsoleOperations()).filter((operation) => sections().includes("databases") || !operation.name.startsWith("databases.")),
11783
12191
  module: "vite-hub/console/server",
11784
12192
  runtime: false
11785
- }, ...sections().includes("mcp-client") ? [{
11786
- export: "consoleMcpClientOperations",
11787
- load: async () => (await import("./console/runtime/server/mcp-client-operations.js")).consoleMcpClientOperations,
11788
- module: "vite-hub/console/mcp-client",
11789
- runtime: false
11790
- }] : []];
12193
+ }];
11791
12194
  }
11792
12195
  /**
11793
12196
  * Keeps `vite-hub` in the server environments of an app with Agents, so the Console and the app read one Agent
11794
- * Invocation journal, and records when those environments close, so a closed server writes no generated plugin.
12197
+ * Invocation journal, and records when those environments close, so a closed server writes no generated app module.
11795
12198
  */
11796
12199
  function consoleInvocationRootPlugin(state = {}) {
11797
12200
  const activeEnvironments = /* @__PURE__ */ new Set();
@@ -11833,8 +12236,7 @@ function consoleInvocationRootPlugin(state = {}) {
11833
12236
  }
11834
12237
  };
11835
12238
  }
11836
- //#endregion
11837
- //#region src/deployment.ts
12239
+ // src/deployment.ts
11838
12240
  /**
11839
12241
  * Adds the `module` export condition to a Cloudflare build. Vite resolves server code with it, and Nitro does not.
11840
12242
  * Without it, a package that keeps its ESM build under `module`, such as `@opentelemetry/semantic-conventions` (which
@@ -11844,8 +12246,7 @@ function cloudflareExportConditions(conditions) {
11844
12246
  const current = Array.isArray(conditions) ? conditions.filter((condition) => String(condition) === condition) : [];
11845
12247
  return current.includes("module") || current.includes("!module") ? current : [...current, "module"];
11846
12248
  }
11847
- //#endregion
11848
- //#region ../internal/src/systemd.ts
12249
+ // ../internal/src/systemd.ts
11849
12250
  /** systemd expands `%` specifiers in every value, and a line break ends the setting. */
11850
12251
  function systemdValue(value, lineBreak) {
11851
12252
  if (/[\n\r]/.test(value)) lineBreak();
@@ -11860,8 +12261,7 @@ function systemdExecArgument(value, lineBreak) {
11860
12261
  function systemdAssignment(name, value, lineBreak) {
11861
12262
  return `"${systemdValue(`${name}=${value}`, lineBreak).replaceAll("\\", "\\\\").replaceAll("\"", "\\\"")}"`;
11862
12263
  }
11863
- //#endregion
11864
- //#region src/systemd.ts
12264
+ // src/systemd.ts
11865
12265
  /** The settle and close time that ViteHub adds after the drain budget, plus 5 seconds of margin. */
11866
12266
  const shutdownOverheadSeconds = 30;
11867
12267
  const unitName = /^[\w.:-]+$/;
@@ -11955,8 +12355,7 @@ async function writeSystemdUnit(outputDir, name, unit) {
11955
12355
  await writeFile(file, renderSystemdUnit(unit), "utf8");
11956
12356
  return file;
11957
12357
  }
11958
- //#endregion
11959
- //#region src/dockerfile.ts
12358
+ // src/dockerfile.ts
11960
12359
  const appDir = "/app";
11961
12360
  const defaultDataDir = `${appDir}/.vitehub`;
11962
12361
  const dockerArch = {
@@ -12094,8 +12493,7 @@ async function writeDockerfile(build, output) {
12094
12493
  })), "utf8");
12095
12494
  return file;
12096
12495
  }
12097
- //#endregion
12098
- //#region src/cloudflare-resources.ts
12496
+ // src/cloudflare-resources.ts
12099
12497
  function entries(value) {
12100
12498
  return Array.isArray(value) ? value.filter((entry) => typeof entry === "object" && entry !== null) : [];
12101
12499
  }
@@ -12183,8 +12581,7 @@ async function assertCloudflareResources(serverDir, plugins, options = {}) {
12183
12581
  resources: missing.map(describe).join("; ")
12184
12582
  });
12185
12583
  }
12186
- //#endregion
12187
- //#region src/cloudflare-vars.ts
12584
+ // src/cloudflare-vars.ts
12188
12585
  /**
12189
12586
  * The Worker `vars` for `cloudflare: { vars: true }`: each non-secret Server Env value read from a host variable, under
12190
12587
  * the name that holds it in `env`, the build environment. A name is tried in the order Server Env reads it at runtime.
@@ -12253,8 +12650,7 @@ async function addCloudflareVars(serverDir, vars) {
12253
12650
  if (isRecord$1(wrangler.env)) result.env = Object.fromEntries(Object.entries(wrangler.env).map(([name, config]) => [name, isRecord$1(config) ? withVars(config) : config]));
12254
12651
  await writeFile(file, `${JSON.stringify(result, null, 2)}\n`);
12255
12652
  }
12256
- //#endregion
12257
- //#region src/nitro-order.ts
12653
+ // src/nitro-order.ts
12258
12654
  const nitroConfigPlugins = [
12259
12655
  "nitro:init",
12260
12656
  "nitro:env",
@@ -12357,8 +12753,7 @@ function nitroOrderPlugins() {
12357
12753
  }
12358
12754
  }];
12359
12755
  }
12360
- //#endregion
12361
- //#region src/task/discovery.ts
12756
+ // src/task/discovery.ts
12362
12757
  /**
12363
12758
  * Lists the task files below each `<server dir>/tasks`. The name follows Nitro: the path without the extension and
12364
12759
  * `/index`, with `/` replaced by `:`. For example, `server/tasks/db/seed.ts` is `db:seed`.
@@ -12367,8 +12762,7 @@ function discoverTaskDefinitions(projectRoot, serverDirs) {
12367
12762
  const scanDirs = serverDirs?.length ? [...serverDirs] : [resolve(projectRoot, "server")];
12368
12763
  return discoverDefinitions("task", [createDirectoryDefinitionSource("server-tasks", scanDirs, "tasks", { normalizeName: (directory, file) => normalizePathDefinitionName(directory, file).replaceAll("/", ":") })]);
12369
12764
  }
12370
- //#endregion
12371
- //#region src/task/vite.ts
12765
+ // src/task/vite.ts
12372
12766
  const generatedNitroRegistryPlugin = ".vitehub/nitro/task/registry.mjs";
12373
12767
  /**
12374
12768
  * Enables Nitro tasks for the discovered `server/tasks` files. The app keeps control: `nitro.experimental.tasks: false`
@@ -12436,8 +12830,7 @@ function viteHubTaskPlugin() {
12436
12830
  }
12437
12831
  };
12438
12832
  }
12439
- //#endregion
12440
- //#region src/cache/vite.ts
12833
+ // src/cache/vite.ts
12441
12834
  /** Contributes the `cache.*` operations that `vitehub cache` and the Console Cache section run. */
12442
12835
  function viteHubCachePlugin() {
12443
12836
  return {
@@ -12449,8 +12842,7 @@ function viteHubCachePlugin() {
12449
12842
  }] }
12450
12843
  };
12451
12844
  }
12452
- //#endregion
12453
- //#region src/durability/vite.ts
12845
+ // src/durability/vite.ts
12454
12846
  const durabilityReportersId = "#vitehub/durability/reporters";
12455
12847
  const resolvedDurabilityReportersId = `\0${durabilityReportersId}`;
12456
12848
  /**
@@ -12529,8 +12921,7 @@ function viteHubDurabilityPlugin(options = {}) {
12529
12921
  vitehub: { operations }
12530
12922
  }];
12531
12923
  }
12532
- //#endregion
12533
- //#region src/browser-errors-vite.ts
12924
+ // src/browser-errors-vite.ts
12534
12925
  /** Below the app base. */
12535
12926
  const browserErrorsRoute = "/_vitehub/browser-errors";
12536
12927
  /**
@@ -12665,8 +13056,7 @@ async function installBrowserErrorsNuxt(nuxt, projectRoot) {
12665
13056
  const plugins = nuxt.options.plugins ??= [];
12666
13057
  if (!plugins.some((entry) => (typeof entry === "string" ? entry : entry.src) === plugin)) plugins.push(plugin);
12667
13058
  }
12668
- //#endregion
12669
- //#region src/logs-vite.ts
13059
+ // src/logs-vite.ts
12670
13060
  function renderLogsPlugin(projectRoot, source, options = {}) {
12671
13061
  return [
12672
13062
  "import { installLogSource } from \"vite-hub/logs/host\"",
@@ -12703,8 +13093,7 @@ function logsVitePlugin(options) {
12703
13093
  }
12704
13094
  };
12705
13095
  }
12706
- //#endregion
12707
- //#region ../internal/src/hosting.ts
13096
+ // ../internal/src/hosting.ts
12708
13097
  /**
12709
13098
  * Returns the Nitro preset name that this build targets, as the developer wrote it.
12710
13099
  * The order is `nitro.preset`, `hosting`, `NITRO_PRESET`, `SERVER_PRESET`, then `VITEHUB_HOST`.
@@ -12725,8 +13114,7 @@ function resolveHostPreset(input = {}) {
12725
13114
  function resolveHost(input = {}) {
12726
13115
  return hostFromNitroPreset(resolveHostPreset(input));
12727
13116
  }
12728
- //#endregion
12729
- //#region src/observability-vite.ts
13117
+ // src/observability-vite.ts
12730
13118
  const generatedObservabilityPlugin = ".vitehub/nitro/observability/plugin.mjs";
12731
13119
  function renderObservabilityNitroPlugin(options) {
12732
13120
  const papercuts = options.papercuts === true ? {} : options.papercuts;
@@ -12816,8 +13204,7 @@ function observabilityVitePlugin(options, target = {}) {
12816
13204
  }
12817
13205
  };
12818
13206
  }
12819
- //#endregion
12820
- //#region src/plugins.ts
13207
+ // src/plugins.ts
12821
13208
  function resolveServerOptions(config) {
12822
13209
  const serverResolve = config.environments?.nitro?.resolve ?? config.environments?.ssr?.resolve ?? config.resolve;
12823
13210
  const conditions = serverResolve?.conditions ?? defaultServerConditions;
@@ -13838,7 +14225,6 @@ function createViteHubPlugins(options, reportVersionError) {
13838
14225
  ["channels", options.channels],
13839
14226
  ["comments", options.comments],
13840
14227
  ["console agents", configuredConsole && options.agent],
13841
- ["console mcp-client", isConsoleMcpClientEnabled(configuredConsole)],
13842
14228
  ["connections", options.connections],
13843
14229
  ["database", options.database && !options.connections],
13844
14230
  ["email", options.email],
@@ -13964,19 +14350,19 @@ function createViteHubPlugins(options, reportVersionError) {
13964
14350
  if (redirects) plugins.push(redirectsVitePlugin(redirects));
13965
14351
  if (options.webContainer) plugins.push(requireOptionalOwner(ownerModules.webContainerVite, "webContainer").webContainerVitePlugin(options.webContainer));
13966
14352
  plugins.push(staleChunkReloadVitePlugin());
14353
+ const devOperationsOnly = options.console === void 0;
13967
14354
  const runtimeCapabilityImports = {
13968
14355
  blob: blobEnabled ? "vite-hub/blob" : false,
13969
14356
  connections: options.connections ? generatedModules.connectionsAgent : false,
13970
- console: configuredConsole ? "vite-hub/console/server" : false,
14357
+ console: configuredConsole || devOperationsOnly ? generatedModules.consoleAgent : false,
13971
14358
  db: options.database ? "@vite-hub/database/runtime/registry" : false,
13972
14359
  i18n: options.i18n ? "vite-hub/i18n/server" : false,
13973
14360
  realtime: options.realtime ? "vite-hub/realtime/agent" : false,
13974
- ...emailVite ? { email: "vite-hub/email" } : {},
14361
+ ...emailVite && options.email ? { email: "vite-hub/email" } : {},
13975
14362
  ...kvVite ? { kv: "vite-hub/kv" } : {}
13976
14363
  };
13977
14364
  plugins.push(setupDevPlugin());
13978
14365
  plugins.push(operationsCheckPlugin());
13979
- const devOperationsOnly = options.console === void 0;
13980
14366
  if (configuredConsole || devOperationsOnly) {
13981
14367
  const invocationRootState = {};
13982
14368
  const consolePlugin = consoleVitePlugin({
@@ -13989,6 +14375,7 @@ function createViteHubPlugins(options, reportVersionError) {
13989
14375
  blobStores: blobStoreNames,
13990
14376
  console: configuredConsole || void 0,
13991
14377
  rpcOnly: devOperationsOnly,
14378
+ comments: options.comments,
13992
14379
  runtimeCapabilityImports,
13993
14380
  databaseDiscoveryRoot: options.database && options.database !== true ? options.database.projectRoot : void 0,
13994
14381
  rateLimitDiscoveryRoot: options.rateLimit && options.rateLimit !== true ? options.rateLimit.projectRoot : void 0,
@@ -14138,8 +14525,17 @@ function createViteHubPlugins(options, reportVersionError) {
14138
14525
  rateLimit: "vite-hub/rate-limit",
14139
14526
  realtime: generatedModules.commentsRealtime,
14140
14527
  runtime: "vite-hub/comments/runtime",
14528
+ ...configuredConsole ? { siteVisitor: generatedModules.consoleSiteVisitor } : {},
14141
14529
  webhooks: "vite-hub/webhooks"
14142
- }
14530
+ },
14531
+ ...configuredConsole ? { pillSegments: [{
14532
+ module: generatedModules.consolePill,
14533
+ export: "installConsolePill",
14534
+ options: {
14535
+ version: readViteHubVersion(),
14536
+ useCurrentGrants: configuredConsole.authorize === void 0
14537
+ }
14538
+ }] } : {}
14143
14539
  });
14144
14540
  if (options.realtime) plugins.push(requireOptionalOwner(ownerModules.realtimeVite, "realtime").hubRealtime({
14145
14541
  ...options.name ? { namespace: options.name } : {},
@@ -14295,5 +14691,4 @@ function viteHubPlugins(options, reportVersionError = true) {
14295
14691
  }
14296
14692
  return [...create(options), rootPlugin()];
14297
14693
  }
14298
- //#endregion
14299
- export { agentJournalStateUrl as $, cloudflareEmailDevShimSource as A, disabledUpstashDriver as B, consoleDocumentEditorSectionIds as C, staleChunkReloadPluginName as D, installStaleChunkReloadNuxt as E, defaultJournalNeedsLibsql as F, resolveDefinitionFeatures as G, hasUpstashStore as H, writeAgentInvocationsNitroPlugin as I, nitroCacheBypass as J, markCmsPresetFeaturesResolved as K, generatedModules as L, VITEHUB_AGENT_JOURNAL_STORE as M, assertAgentInvocationsRetention as N, drizzleBuildCheckPlugin as O, assertAgentInvocationsUrl as P, startViteHubHints as Q, disabledKVConfigModule as R, consoleContributedSections as S, isConsoleContributedSectionId as T, redisDriverSpecifier as U, hasRedisStore as V, upstashDriverSpecifier as W, VITEHUB_NUXT_HINTS as X, describeDeploymentPlanOutput as Y, reportViteHubHint as Z, addConsoleRpcHandler as _, getResolvedFeatureOptions as _t, cloudflareExportConditions as a, hasSyncDirectory as at, resolveConsoleProjectName as b, consoleInvocationRootPlugin as c, markIncludedNitroPlugin as ct, resolveConsoleAccessBuild as d, VITEHUB_APP_BASE_URL as dt, defaultDatabaseD1Binding as et, resolveConsoleOptions as f, VITEHUB_GENERATED_ROOT as ft, addConsoleAppRoutes as g, VITEHUB_SERVER_DIRS as gt, consoleOperationFeatures as h, VITEHUB_PROJECT_ROOT as ht, installBrowserErrorsNuxt as i, isDefaultAgentJournal as it, cloudflareWorkersDevShimSource as j, forgeBuildCheckPlugin as k, consoleOperationContributions as l, withPrintedDiagnostics as lt, consoleDevAccessNotice as m, VITEHUB_PREPARE as mt, resolveSandboxTaskDriver as n, withConnectionsDatabase as nt, assertConsoleAccess as o, ownerModules as ot, resolveGeneratedConsolePlugin as p, VITEHUB_NITRO_CONFIG_CONTEXT as pt, resolveCmsPresetFeatures as q, viteHubPlugins as r, withDataDir as rt, assertConsoleProductionAuth as s, isIncludedNitroPlugin as st, applyCloudflareNodeCompatOptOut as t, withComments as tt, generatedConsolePluginRegistration as u, withShortInspect as ut, serializeConsoleRefresh as v, resolveNuxtServerDirs as vt, discoverConsoleEntrySections as w, discoverConsoleBuildCatalog as x, writeConsoleNitroPlugin as y, resolveViteHubProjectRoot as yt, disabledRedisDriver as z };
14694
+ export { VITEHUB_NUXT_HINTS as $, staleChunkReloadPluginName as A, disabledKVConfigModule as B, resolveConsoleProjectName as C, discoverConsoleEntrySections as D, consoleDocumentEditorSectionIds as E, VITEHUB_AGENT_JOURNAL_STORE as F, redisDriverSpecifier as G, disabledUpstashDriver as H, assertAgentInvocationsRetention as I, markCmsPresetFeaturesResolved as J, upstashDriverSpecifier as K, assertAgentInvocationsUrl as L, forgeBuildCheckPlugin as M, cloudflareEmailDevShimSource as N, isConsoleContributedSectionId as O, cloudflareWorkersDevShimSource as P, importRolldownExperimental as Q, defaultJournalNeedsLibsql as R, writeConsoleAppModule as S, resolveViteHubProjectRoot as St, consoleContributedSections as T, hasRedisStore as U, disabledRedisDriver as V, hasUpstashStore as W, nitroCacheBypass as X, resolveCmsPresetFeatures as Y, describeDeploymentPlanOutput as Z, resolveConsoleSiteAccess as _, VITEHUB_PREPARE as _t, cloudflareExportConditions as a, withConnectionsDatabase as at, consoleAppModuleHasDocumentEditors as b, getResolvedFeatureOptions as bt, consoleAppModuleId as c, hasSyncDirectory as ct, resolveConsoleAccessBuild as d, markIncludedNitroPlugin as dt, reportViteHubHint as et, resolveConsoleOptions as f, withPrintedDiagnostics as ft, consoleOperationFeatures as g, VITEHUB_NITRO_CONFIG_CONTEXT as gt, consoleDevAccessNotice as h, VITEHUB_GENERATED_ROOT as ht, installBrowserErrorsNuxt as i, withComments as it, drizzleBuildCheckPlugin as j, installStaleChunkReloadNuxt as k, consoleInvocationRootPlugin as l, ownerModules as lt, resolveGeneratedConsoleApp as m, VITEHUB_APP_BASE_URL as mt, resolveSandboxTaskDriver as n, agentJournalStateUrl as nt, assertConsoleAccess as o, withDataDir as ot, resolveConsoleUrl as p, withShortInspect as pt, resolveDefinitionFeatures as q, viteHubPlugins as r, defaultDatabaseD1Binding as rt, assertConsoleProductionAuth as s, isDefaultAgentJournal as st, applyCloudflareNodeCompatOptOut as t, startViteHubHints as tt, consoleOperationContributions as u, isIncludedNitroPlugin as ut, addConsoleRpcHandler as v, VITEHUB_PROJECT_ROOT as vt, discoverConsoleBuildCatalog as w, resolveConsoleRuntimeCapabilityImports as x, resolveNuxtServerDirs as xt, serializeConsoleRefresh as y, VITEHUB_SERVER_DIRS as yt, writeAgentInvocationsNitroPlugin as z };