devflare 1.0.0-next.7 → 1.0.0-next.71

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 (635) hide show
  1. package/LICENSE +21 -0
  2. package/LLM.md +17316 -2144
  3. package/README.md +398 -607
  4. package/bin/devflare.js +30 -14
  5. package/dist/_chunks/account-B9ULT9HA.js +462 -0
  6. package/dist/_chunks/account-resources-BdKj8q1h.js +159 -0
  7. package/dist/_chunks/ai-DKDn1iys.js +322 -0
  8. package/dist/_chunks/api-BKClUlUf.js +568 -0
  9. package/dist/_chunks/build-B9jQtUny.js +24 -0
  10. package/dist/_chunks/build-artifacts-C7AbI34o.js +484 -0
  11. package/dist/_chunks/cli-CBRR2-Xr.js +1214 -0
  12. package/dist/_chunks/cloudflare-D_5UWT84.js +157 -0
  13. package/dist/_chunks/colors-D0NVzAFN.js +13 -0
  14. package/dist/_chunks/command-utils-qlsHELwW.js +45 -0
  15. package/dist/_chunks/compiler-UxXQgEPq.js +521 -0
  16. package/dist/_chunks/config-CHdi5-5R.js +78 -0
  17. package/dist/_chunks/config-path-DzZbchb6.js +42 -0
  18. package/dist/_chunks/context-DGMev2AF.js +2515 -0
  19. package/dist/_chunks/decorators-eXNZ1S0N.js +19 -0
  20. package/dist/_chunks/dependencies-HLIhxbIe.js +57 -0
  21. package/dist/_chunks/deploy-dIZuouRW.js +1033 -0
  22. package/dist/_chunks/dev-CRW_hBA3.js +953 -0
  23. package/dist/_chunks/doctor-t8hKA53t.js +219 -0
  24. package/dist/_chunks/durable-object-DuMPM8re.js +234 -0
  25. package/dist/_chunks/env-D4uJqqgu.js +125 -0
  26. package/dist/_chunks/family-DHkROYgX.js +143 -0
  27. package/dist/_chunks/generated-artifacts-D_VIzDOi.js +31 -0
  28. package/dist/_chunks/generated-dir-DC2kM-mt.js +33 -0
  29. package/dist/_chunks/glob-DRw9sbfF.js +56 -0
  30. package/dist/_chunks/init-B9_QIZcO.js +165 -0
  31. package/dist/_chunks/loader-BC0skbnH.js +1330 -0
  32. package/dist/_chunks/local-dev-vars-BFLS-HoI.js +81 -0
  33. package/dist/_chunks/local-hyperdrive-CcORzo76.js +119 -0
  34. package/dist/_chunks/local-media-bindings-ZQe-epuw.js +335 -0
  35. package/dist/_chunks/local-secrets-C0n5oRgI.js +123 -0
  36. package/dist/_chunks/login-Ctw59McM.js +51 -0
  37. package/dist/_chunks/package-metadata-CLI488gB.js +39 -0
  38. package/dist/_chunks/preferences-CbYERA_m.js +241 -0
  39. package/dist/_chunks/preview-j9Kbx4-G.js +462 -0
  40. package/dist/_chunks/preview-registry-CTXU4mBc.js +1186 -0
  41. package/dist/_chunks/preview-resources-BNvfkfqP.js +359 -0
  42. package/dist/_chunks/previews-DXlf8SaQ.js +1133 -0
  43. package/dist/_chunks/productions-TkIy7b1Q.js +504 -0
  44. package/dist/_chunks/r2-presign-runtime-DlgH_FY8.js +291 -0
  45. package/dist/_chunks/ref-CYJNAAe_.js +178 -0
  46. package/dist/_chunks/remote-DB8SU7ea.js +79 -0
  47. package/dist/_chunks/remote-config-Bw6qIVM4.js +132 -0
  48. package/dist/_chunks/resolve-package-DeJUGxoE.js +152 -0
  49. package/dist/_chunks/rolldown-runtime-CvQ6eiug.js +14 -0
  50. package/dist/_chunks/routes-CRXB3-iw.js +851 -0
  51. package/dist/_chunks/runtime-BlKTWIgD.js +874 -0
  52. package/dist/_chunks/schema-normalization-CTdiY17P.js +667 -0
  53. package/dist/_chunks/secrets-CzSWX4-i.js +95 -0
  54. package/dist/_chunks/tail-DXKaqcPB.js +239 -0
  55. package/dist/_chunks/token-CEIRtse8.js +333 -0
  56. package/dist/_chunks/tokens-CE7-gV5E.js +221 -0
  57. package/dist/_chunks/types-BB15NBqw.js +484 -0
  58. package/dist/_chunks/ui-BhCdDC2N.js +103 -0
  59. package/dist/_chunks/usage-rRusKejc.js +272 -0
  60. package/dist/_chunks/vite-DTz2Pbtm.js +1267 -0
  61. package/dist/_chunks/vite-process-BhGXJ764.js +2928 -0
  62. package/dist/_chunks/vite-utils-D_VR07Ks.js +183 -0
  63. package/dist/_chunks/worker-CgIvLp-D.js +410 -0
  64. package/dist/_chunks/worker-bundler-CeMqQtBQ.js +457 -0
  65. package/dist/_chunks/worker-entrypoint-C8j23t6d.js +247 -0
  66. package/dist/_chunks/workerName-kEXwmV2m.js +23 -0
  67. package/dist/_chunks/workspace-CbollZBv.js +518 -0
  68. package/dist/_chunks/workspace-Ds3xMjOE.js +175 -0
  69. package/dist/bridge/client.d.ts +93 -8
  70. package/dist/bridge/client.d.ts.map +1 -1
  71. package/dist/bridge/do-rpc-dispatch.d.ts +23 -0
  72. package/dist/bridge/do-rpc-dispatch.d.ts.map +1 -0
  73. package/dist/bridge/do-websocket-connect.d.ts +33 -0
  74. package/dist/bridge/do-websocket-connect.d.ts.map +1 -0
  75. package/dist/bridge/gateway-runtime.d.ts +8 -0
  76. package/dist/bridge/gateway-runtime.d.ts.map +1 -0
  77. package/dist/bridge/index.d.ts +6 -6
  78. package/dist/bridge/index.d.ts.map +1 -1
  79. package/dist/bridge/log.d.ts +5 -0
  80. package/dist/bridge/log.d.ts.map +1 -0
  81. package/dist/bridge/miniflare-gateway.d.ts +45 -0
  82. package/dist/bridge/miniflare-gateway.d.ts.map +1 -0
  83. package/dist/bridge/miniflare.d.ts +92 -2
  84. package/dist/bridge/miniflare.d.ts.map +1 -1
  85. package/dist/bridge/proxy.d.ts +12 -11
  86. package/dist/bridge/proxy.d.ts.map +1 -1
  87. package/dist/bridge/r2-presign-runtime.d.ts +9 -0
  88. package/dist/bridge/r2-presign-runtime.d.ts.map +1 -0
  89. package/dist/bridge/server.d.ts +2 -1
  90. package/dist/bridge/server.d.ts.map +1 -1
  91. package/dist/bridge/v2/body-streams.d.ts +53 -0
  92. package/dist/bridge/v2/body-streams.d.ts.map +1 -0
  93. package/dist/bridge/v2/codec.d.ts +106 -0
  94. package/dist/bridge/v2/codec.d.ts.map +1 -0
  95. package/dist/bridge/v2/control-messages.d.ts +46 -0
  96. package/dist/bridge/v2/control-messages.d.ts.map +1 -0
  97. package/dist/bridge/v2/frames.d.ts +109 -0
  98. package/dist/bridge/v2/frames.d.ts.map +1 -0
  99. package/dist/bridge/v2/index.d.ts +11 -0
  100. package/dist/bridge/v2/index.d.ts.map +1 -0
  101. package/dist/bridge/v2/serialization.d.ts +48 -0
  102. package/dist/bridge/v2/serialization.d.ts.map +1 -0
  103. package/dist/bridge/v2/transport.d.ts +31 -0
  104. package/dist/bridge/v2/transport.d.ts.map +1 -0
  105. package/dist/bridge/v2/value-codec.d.ts +61 -0
  106. package/dist/bridge/v2/value-codec.d.ts.map +1 -0
  107. package/dist/bridge/v2/value-serialization.d.ts +139 -0
  108. package/dist/bridge/v2/value-serialization.d.ts.map +1 -0
  109. package/dist/bridge/{protocol.d.ts → v2/wire.d.ts} +32 -8
  110. package/dist/bridge/v2/wire.d.ts.map +1 -0
  111. package/dist/bridge/v2/ws-relay.d.ts +53 -0
  112. package/dist/bridge/v2/ws-relay.d.ts.map +1 -0
  113. package/dist/bridge/websocket-constructor.d.ts +38 -0
  114. package/dist/bridge/websocket-constructor.d.ts.map +1 -0
  115. package/dist/browser-shim/handler.d.ts +2 -2
  116. package/dist/browser-shim/handler.d.ts.map +1 -1
  117. package/dist/browser-shim/index.d.ts +2 -2
  118. package/dist/browser-shim/server.d.ts +63 -0
  119. package/dist/browser-shim/server.d.ts.map +1 -1
  120. package/dist/browser.d.ts +5778 -43
  121. package/dist/browser.d.ts.map +1 -1
  122. package/dist/browser.js +73 -142
  123. package/dist/bundler/defaults.d.ts +23 -0
  124. package/dist/bundler/defaults.d.ts.map +1 -0
  125. package/dist/bundler/do-bundler.d.ts +7 -0
  126. package/dist/bundler/do-bundler.d.ts.map +1 -1
  127. package/dist/bundler/index.d.ts +3 -1
  128. package/dist/bundler/index.d.ts.map +1 -1
  129. package/dist/bundler/rolldown-shared.d.ts +52 -0
  130. package/dist/bundler/rolldown-shared.d.ts.map +1 -0
  131. package/dist/bundler/worker-bundler.d.ts +13 -0
  132. package/dist/bundler/worker-bundler.d.ts.map +1 -0
  133. package/dist/bundler/worker-compat.d.ts +4 -0
  134. package/dist/bundler/worker-compat.d.ts.map +1 -0
  135. package/dist/cli/build-manifest.d.ts +66 -0
  136. package/dist/cli/build-manifest.d.ts.map +1 -0
  137. package/dist/cli/command-utils.d.ts +18 -0
  138. package/dist/cli/command-utils.d.ts.map +1 -0
  139. package/dist/cli/commands/account.d.ts +2 -2
  140. package/dist/cli/commands/account.d.ts.map +1 -1
  141. package/dist/cli/commands/ai.d.ts +1 -1
  142. package/dist/cli/commands/ai.d.ts.map +1 -1
  143. package/dist/cli/commands/build-artifacts.d.ts +40 -0
  144. package/dist/cli/commands/build-artifacts.d.ts.map +1 -0
  145. package/dist/cli/commands/build.d.ts +2 -2
  146. package/dist/cli/commands/build.d.ts.map +1 -1
  147. package/dist/cli/commands/config.d.ts +4 -0
  148. package/dist/cli/commands/config.d.ts.map +1 -0
  149. package/dist/cli/commands/deploy/metadata.d.ts +18 -0
  150. package/dist/cli/commands/deploy/metadata.d.ts.map +1 -0
  151. package/dist/cli/commands/deploy/prepare.d.ts +23 -0
  152. package/dist/cli/commands/deploy/prepare.d.ts.map +1 -0
  153. package/dist/cli/commands/deploy/runtime.d.ts +4 -0
  154. package/dist/cli/commands/deploy/runtime.d.ts.map +1 -0
  155. package/dist/cli/commands/deploy/verification.d.ts +36 -0
  156. package/dist/cli/commands/deploy/verification.d.ts.map +1 -0
  157. package/dist/cli/commands/deploy.d.ts +2 -2
  158. package/dist/cli/commands/deploy.d.ts.map +1 -1
  159. package/dist/cli/commands/dev.d.ts +9 -1
  160. package/dist/cli/commands/dev.d.ts.map +1 -1
  161. package/dist/cli/commands/doctor.d.ts +2 -2
  162. package/dist/cli/commands/doctor.d.ts.map +1 -1
  163. package/dist/cli/commands/init.d.ts +2 -2
  164. package/dist/cli/commands/init.d.ts.map +1 -1
  165. package/dist/cli/commands/login.d.ts +4 -0
  166. package/dist/cli/commands/login.d.ts.map +1 -0
  167. package/dist/cli/commands/previews-support/cleanup.d.ts +9 -0
  168. package/dist/cli/commands/previews-support/cleanup.d.ts.map +1 -0
  169. package/dist/cli/commands/previews-support/family.d.ts +10 -0
  170. package/dist/cli/commands/previews-support/family.d.ts.map +1 -0
  171. package/dist/cli/commands/previews-support/render.d.ts +8 -0
  172. package/dist/cli/commands/previews-support/render.d.ts.map +1 -0
  173. package/dist/cli/commands/previews-support/theme.d.ts +10 -0
  174. package/dist/cli/commands/previews-support/theme.d.ts.map +1 -0
  175. package/dist/cli/commands/previews-support/types.d.ts +70 -0
  176. package/dist/cli/commands/previews-support/types.d.ts.map +1 -0
  177. package/dist/cli/commands/previews.d.ts +4 -0
  178. package/dist/cli/commands/previews.d.ts.map +1 -0
  179. package/dist/cli/commands/productions.d.ts +4 -0
  180. package/dist/cli/commands/productions.d.ts.map +1 -0
  181. package/dist/cli/commands/remote.d.ts +1 -1
  182. package/dist/cli/commands/remote.d.ts.map +1 -1
  183. package/dist/cli/commands/secrets.d.ts +4 -0
  184. package/dist/cli/commands/secrets.d.ts.map +1 -0
  185. package/dist/cli/commands/tail.d.ts +44 -0
  186. package/dist/cli/commands/tail.d.ts.map +1 -0
  187. package/dist/cli/commands/token.d.ts +4 -0
  188. package/dist/cli/commands/token.d.ts.map +1 -0
  189. package/dist/cli/commands/type-generation/discovery.d.ts +7 -0
  190. package/dist/cli/commands/type-generation/discovery.d.ts.map +1 -0
  191. package/dist/cli/commands/type-generation/generator.d.ts +121 -0
  192. package/dist/cli/commands/type-generation/generator.d.ts.map +1 -0
  193. package/dist/cli/commands/type-generation/models.d.ts +27 -0
  194. package/dist/cli/commands/type-generation/models.d.ts.map +1 -0
  195. package/dist/cli/commands/types.d.ts +2 -2
  196. package/dist/cli/commands/types.d.ts.map +1 -1
  197. package/dist/cli/commands/worker.d.ts +4 -0
  198. package/dist/cli/commands/worker.d.ts.map +1 -0
  199. package/dist/cli/commands/workspace.d.ts +8 -0
  200. package/dist/cli/commands/workspace.d.ts.map +1 -0
  201. package/dist/cli/config-path.d.ts +6 -0
  202. package/dist/cli/config-path.d.ts.map +1 -0
  203. package/dist/cli/dependencies.d.ts +2 -1
  204. package/dist/cli/dependencies.d.ts.map +1 -1
  205. package/dist/cli/deploy-strategy.d.ts +17 -0
  206. package/dist/cli/deploy-strategy.d.ts.map +1 -0
  207. package/dist/cli/deploy-target.d.ts +17 -0
  208. package/dist/cli/deploy-target.d.ts.map +1 -0
  209. package/dist/cli/generated-artifacts.d.ts +12 -0
  210. package/dist/cli/generated-artifacts.d.ts.map +1 -0
  211. package/dist/cli/gradual-deploy.d.ts +49 -0
  212. package/dist/cli/gradual-deploy.d.ts.map +1 -0
  213. package/dist/cli/help-pages/pages/account.d.ts +3 -0
  214. package/dist/cli/help-pages/pages/account.d.ts.map +1 -0
  215. package/dist/cli/help-pages/pages/core.d.ts +4 -0
  216. package/dist/cli/help-pages/pages/core.d.ts.map +1 -0
  217. package/dist/cli/help-pages/pages/index.d.ts +3 -0
  218. package/dist/cli/help-pages/pages/index.d.ts.map +1 -0
  219. package/dist/cli/help-pages/pages/misc.d.ts +3 -0
  220. package/dist/cli/help-pages/pages/misc.d.ts.map +1 -0
  221. package/dist/cli/help-pages/pages/previews.d.ts +3 -0
  222. package/dist/cli/help-pages/pages/previews.d.ts.map +1 -0
  223. package/dist/cli/help-pages/pages/productions.d.ts +3 -0
  224. package/dist/cli/help-pages/pages/productions.d.ts.map +1 -0
  225. package/dist/cli/help-pages/render.d.ts +12 -0
  226. package/dist/cli/help-pages/render.d.ts.map +1 -0
  227. package/dist/cli/help-pages/shared.d.ts +15 -0
  228. package/dist/cli/help-pages/shared.d.ts.map +1 -0
  229. package/dist/cli/help-pages/types.d.ts +23 -0
  230. package/dist/cli/help-pages/types.d.ts.map +1 -0
  231. package/dist/cli/help.d.ts +6 -0
  232. package/dist/cli/help.d.ts.map +1 -0
  233. package/dist/cli/index.d.ts +1 -0
  234. package/dist/cli/index.d.ts.map +1 -1
  235. package/dist/cli/index.js +2 -0
  236. package/dist/cli/package-metadata.d.ts +16 -0
  237. package/dist/cli/package-metadata.d.ts.map +1 -0
  238. package/dist/cli/preview-bindings.d.ts +49 -0
  239. package/dist/cli/preview-bindings.d.ts.map +1 -0
  240. package/dist/cli/preview.d.ts +10 -0
  241. package/dist/cli/preview.d.ts.map +1 -0
  242. package/dist/cli/ui.d.ts +37 -0
  243. package/dist/cli/ui.d.ts.map +1 -0
  244. package/dist/cli/workspace-build-guard.d.ts +14 -0
  245. package/dist/cli/workspace-build-guard.d.ts.map +1 -0
  246. package/dist/cli/wrangler-auth.d.ts +1 -1
  247. package/dist/cloudflare/account-core.d.ts +6 -0
  248. package/dist/cloudflare/account-core.d.ts.map +1 -0
  249. package/dist/cloudflare/account-resources.d.ts +40 -0
  250. package/dist/cloudflare/account-resources.d.ts.map +1 -0
  251. package/dist/cloudflare/account-status.d.ts +11 -0
  252. package/dist/cloudflare/account-status.d.ts.map +1 -0
  253. package/dist/cloudflare/account-workers.d.ts +14 -0
  254. package/dist/cloudflare/account-workers.d.ts.map +1 -0
  255. package/dist/cloudflare/account.d.ts +7 -64
  256. package/dist/cloudflare/account.d.ts.map +1 -1
  257. package/dist/cloudflare/api.d.ts +71 -3
  258. package/dist/cloudflare/api.d.ts.map +1 -1
  259. package/dist/cloudflare/auth.d.ts +1 -1
  260. package/dist/cloudflare/auth.d.ts.map +1 -1
  261. package/dist/cloudflare/index.d.ts +61 -6
  262. package/dist/cloudflare/index.d.ts.map +1 -1
  263. package/dist/cloudflare/index.js +4 -13
  264. package/dist/cloudflare/known-permission-group-ids.generated.d.ts +10 -0
  265. package/dist/cloudflare/known-permission-group-ids.generated.d.ts.map +1 -0
  266. package/dist/cloudflare/kv-namespace.d.ts +4 -0
  267. package/dist/cloudflare/kv-namespace.d.ts.map +1 -0
  268. package/dist/cloudflare/preferences.d.ts +7 -0
  269. package/dist/cloudflare/preferences.d.ts.map +1 -1
  270. package/dist/cloudflare/preview-registry-cache.d.ts +6 -0
  271. package/dist/cloudflare/preview-registry-cache.d.ts.map +1 -0
  272. package/dist/cloudflare/preview-registry-inference.d.ts +14 -0
  273. package/dist/cloudflare/preview-registry-inference.d.ts.map +1 -0
  274. package/dist/cloudflare/preview-registry-records.d.ts +4 -0
  275. package/dist/cloudflare/preview-registry-records.d.ts.map +1 -0
  276. package/dist/cloudflare/preview-registry-shape.d.ts +47 -0
  277. package/dist/cloudflare/preview-registry-shape.d.ts.map +1 -0
  278. package/dist/cloudflare/preview-registry-store.d.ts +14 -0
  279. package/dist/cloudflare/preview-registry-store.d.ts.map +1 -0
  280. package/dist/cloudflare/preview-registry-transport.d.ts +4 -0
  281. package/dist/cloudflare/preview-registry-transport.d.ts.map +1 -0
  282. package/dist/cloudflare/preview-registry-types.d.ts +103 -0
  283. package/dist/cloudflare/preview-registry-types.d.ts.map +1 -0
  284. package/dist/cloudflare/preview-registry.d.ts +42 -0
  285. package/dist/cloudflare/preview-registry.d.ts.map +1 -0
  286. package/dist/cloudflare/preview-urls.d.ts +3 -0
  287. package/dist/cloudflare/preview-urls.d.ts.map +1 -0
  288. package/dist/cloudflare/registry-schema.d.ts +253 -0
  289. package/dist/cloudflare/registry-schema.d.ts.map +1 -0
  290. package/dist/cloudflare/remote-config.d.ts.map +1 -1
  291. package/dist/cloudflare/tokens.d.ts +44 -0
  292. package/dist/cloudflare/tokens.d.ts.map +1 -0
  293. package/dist/cloudflare/types.d.ts +124 -7
  294. package/dist/cloudflare/types.d.ts.map +1 -1
  295. package/dist/cloudflare/usage.d.ts +31 -3
  296. package/dist/cloudflare/usage.d.ts.map +1 -1
  297. package/dist/config/binding-resolution-helpers.d.ts +41 -0
  298. package/dist/config/binding-resolution-helpers.d.ts.map +1 -0
  299. package/dist/config/compatibility.d.ts +3 -0
  300. package/dist/config/compatibility.d.ts.map +1 -0
  301. package/dist/config/compiler/bindings.d.ts +14 -0
  302. package/dist/config/compiler/bindings.d.ts.map +1 -0
  303. package/dist/config/compiler/core-helpers.d.ts +6 -0
  304. package/dist/config/compiler/core-helpers.d.ts.map +1 -0
  305. package/dist/config/compiler/do-workers.d.ts +34 -0
  306. package/dist/config/compiler/do-workers.d.ts.map +1 -0
  307. package/dist/config/compiler/paths.d.ts +18 -0
  308. package/dist/config/compiler/paths.d.ts.map +1 -0
  309. package/dist/config/compiler/types.d.ts +308 -0
  310. package/dist/config/compiler/types.d.ts.map +1 -0
  311. package/dist/config/compiler.d.ts +22 -134
  312. package/dist/config/compiler.d.ts.map +1 -1
  313. package/dist/config/cron.d.ts +19 -0
  314. package/dist/config/cron.d.ts.map +1 -0
  315. package/dist/config/define.d.ts +8 -5
  316. package/dist/config/define.d.ts.map +1 -1
  317. package/dist/config/deploy-resources.d.ts +58 -0
  318. package/dist/config/deploy-resources.d.ts.map +1 -0
  319. package/dist/config/env-vars.d.ts +309 -0
  320. package/dist/config/env-vars.d.ts.map +1 -0
  321. package/dist/config/framework-providers.d.ts +9 -0
  322. package/dist/config/framework-providers.d.ts.map +1 -0
  323. package/dist/config/index.d.ts +13 -5
  324. package/dist/config/index.d.ts.map +1 -1
  325. package/dist/config/loader.d.ts +2 -1
  326. package/dist/config/loader.d.ts.map +1 -1
  327. package/dist/config/local-dev-vars.d.ts +15 -0
  328. package/dist/config/local-dev-vars.d.ts.map +1 -0
  329. package/dist/config/preview-resources.d.ts +83 -0
  330. package/dist/config/preview-resources.d.ts.map +1 -0
  331. package/dist/config/preview.d.ts +29 -0
  332. package/dist/config/preview.d.ts.map +1 -0
  333. package/dist/config/ref.d.ts +16 -25
  334. package/dist/config/ref.d.ts.map +1 -1
  335. package/dist/config/resolve-phased.d.ts +72 -0
  336. package/dist/config/resolve-phased.d.ts.map +1 -0
  337. package/dist/config/resolve.d.ts +11 -0
  338. package/dist/config/resolve.d.ts.map +1 -0
  339. package/dist/config/resource-resolution.d.ts +80 -0
  340. package/dist/config/resource-resolution.d.ts.map +1 -0
  341. package/dist/config/schema-bindings.d.ts +2124 -0
  342. package/dist/config/schema-bindings.d.ts.map +1 -0
  343. package/dist/config/schema-build.d.ts +67 -0
  344. package/dist/config/schema-build.d.ts.map +1 -0
  345. package/dist/config/schema-env.d.ts +3821 -0
  346. package/dist/config/schema-env.d.ts.map +1 -0
  347. package/dist/config/schema-normalization.d.ts +272 -0
  348. package/dist/config/schema-normalization.d.ts.map +1 -0
  349. package/dist/config/schema-runtime.d.ts +597 -0
  350. package/dist/config/schema-runtime.d.ts.map +1 -0
  351. package/dist/config/schema-types-bindings-platform.d.ts +520 -0
  352. package/dist/config/schema-types-bindings-platform.d.ts.map +1 -0
  353. package/dist/config/schema-types-bindings-resources.d.ts +802 -0
  354. package/dist/config/schema-types-bindings-resources.d.ts.map +1 -0
  355. package/dist/config/schema-types-bindings.d.ts +293 -0
  356. package/dist/config/schema-types-bindings.d.ts.map +1 -0
  357. package/dist/config/schema-types-build.d.ts +86 -0
  358. package/dist/config/schema-types-build.d.ts.map +1 -0
  359. package/dist/config/schema-types-runtime-server.d.ts +196 -0
  360. package/dist/config/schema-types-runtime-server.d.ts.map +1 -0
  361. package/dist/config/schema-types-runtime.d.ts +913 -0
  362. package/dist/config/schema-types-runtime.d.ts.map +1 -0
  363. package/dist/config/schema-types.d.ts +458 -0
  364. package/dist/config/schema-types.d.ts.map +1 -0
  365. package/dist/config/schema.d.ts +5796 -2023
  366. package/dist/config/schema.d.ts.map +1 -1
  367. package/dist/config/service-bindings-validation.d.ts +36 -0
  368. package/dist/config/service-bindings-validation.d.ts.map +1 -0
  369. package/dist/config/workspace.d.ts +282 -0
  370. package/dist/config/workspace.d.ts.map +1 -0
  371. package/dist/config-entry.d.ts +7 -0
  372. package/dist/config-entry.d.ts.map +1 -0
  373. package/dist/config-entry.js +3 -0
  374. package/dist/decorators/durable-object.d.ts.map +1 -1
  375. package/dist/decorators/index.d.ts +2 -2
  376. package/dist/decorators/index.js +2 -9
  377. package/dist/dev-server/d1-migrations.d.ts +36 -0
  378. package/dist/dev-server/d1-migrations.d.ts.map +1 -0
  379. package/dist/dev-server/dev-server-state.d.ts +59 -0
  380. package/dist/dev-server/dev-server-state.d.ts.map +1 -0
  381. package/dist/dev-server/gateway-script.d.ts +22 -0
  382. package/dist/dev-server/gateway-script.d.ts.map +1 -0
  383. package/dist/dev-server/index.d.ts +1 -1
  384. package/dist/dev-server/miniflare-bindings.d.ts +90 -0
  385. package/dist/dev-server/miniflare-bindings.d.ts.map +1 -0
  386. package/dist/dev-server/miniflare-dev-config.d.ts +57 -0
  387. package/dist/dev-server/miniflare-dev-config.d.ts.map +1 -0
  388. package/dist/dev-server/miniflare-log.d.ts +20 -0
  389. package/dist/dev-server/miniflare-log.d.ts.map +1 -0
  390. package/dist/dev-server/miniflare-worker-config.d.ts +100 -0
  391. package/dist/dev-server/miniflare-worker-config.d.ts.map +1 -0
  392. package/dist/dev-server/reload-queue.d.ts +13 -0
  393. package/dist/dev-server/reload-queue.d.ts.map +1 -0
  394. package/dist/dev-server/runtime-health.d.ts +79 -0
  395. package/dist/dev-server/runtime-health.d.ts.map +1 -0
  396. package/dist/dev-server/runtime-stdio.d.ts +8 -0
  397. package/dist/dev-server/runtime-stdio.d.ts.map +1 -0
  398. package/dist/dev-server/server-startup-helpers.d.ts +84 -0
  399. package/dist/dev-server/server-startup-helpers.d.ts.map +1 -0
  400. package/dist/dev-server/server.d.ts +2 -0
  401. package/dist/dev-server/server.d.ts.map +1 -1
  402. package/dist/dev-server/vite-process.d.ts +24 -0
  403. package/dist/dev-server/vite-process.d.ts.map +1 -0
  404. package/dist/dev-server/vite-utils.d.ts +19 -1
  405. package/dist/dev-server/vite-utils.d.ts.map +1 -1
  406. package/dist/dev-server/worker-source-watcher.d.ts +17 -0
  407. package/dist/dev-server/worker-source-watcher.d.ts.map +1 -0
  408. package/dist/dev-server/worker-surface-paths.d.ts +6 -0
  409. package/dist/dev-server/worker-surface-paths.d.ts.map +1 -0
  410. package/dist/dev-server/workspace/merge-config.d.ts +81 -0
  411. package/dist/dev-server/workspace/merge-config.d.ts.map +1 -0
  412. package/dist/dev-server/workspace/prepare-app.d.ts +84 -0
  413. package/dist/dev-server/workspace/prepare-app.d.ts.map +1 -0
  414. package/dist/dev-server/workspace/server.d.ts +47 -0
  415. package/dist/dev-server/workspace/server.d.ts.map +1 -0
  416. package/dist/env.d.ts +10 -0
  417. package/dist/env.d.ts.map +1 -1
  418. package/dist/index.d.ts +8 -12
  419. package/dist/index.d.ts.map +1 -1
  420. package/dist/index.js +10 -297
  421. package/dist/runtime/context-events.d.ts +13 -0
  422. package/dist/runtime/context-events.d.ts.map +1 -0
  423. package/dist/runtime/context-types.d.ts +82 -0
  424. package/dist/runtime/context-types.d.ts.map +1 -0
  425. package/dist/runtime/context.d.ts +20 -44
  426. package/dist/runtime/context.d.ts.map +1 -1
  427. package/dist/runtime/exports.d.ts +70 -55
  428. package/dist/runtime/exports.d.ts.map +1 -1
  429. package/dist/runtime/index.d.ts +11 -5
  430. package/dist/runtime/index.d.ts.map +1 -1
  431. package/dist/runtime/index.js +5 -184
  432. package/dist/runtime/middleware.d.ts +119 -67
  433. package/dist/runtime/middleware.d.ts.map +1 -1
  434. package/dist/runtime/r2-presign.d.ts +164 -0
  435. package/dist/runtime/r2-presign.d.ts.map +1 -0
  436. package/dist/runtime/router/index.d.ts +7 -0
  437. package/dist/runtime/router/index.d.ts.map +1 -0
  438. package/dist/runtime/router/types.d.ts +24 -0
  439. package/dist/runtime/router/types.d.ts.map +1 -0
  440. package/dist/runtime/validation.d.ts +18 -4
  441. package/dist/runtime/validation.d.ts.map +1 -1
  442. package/dist/secrets/local-secrets.d.ts +46 -0
  443. package/dist/secrets/local-secrets.d.ts.map +1 -0
  444. package/dist/shims/local-hyperdrive.d.ts +12 -0
  445. package/dist/shims/local-hyperdrive.d.ts.map +1 -0
  446. package/dist/shims/local-media-bindings.d.ts +19 -0
  447. package/dist/shims/local-media-bindings.d.ts.map +1 -0
  448. package/dist/shims/local-worker-loader.d.ts +3 -0
  449. package/dist/shims/local-worker-loader.d.ts.map +1 -0
  450. package/dist/sveltekit/index.d.ts +1 -1
  451. package/dist/sveltekit/index.d.ts.map +1 -1
  452. package/dist/sveltekit/index.js +377 -169
  453. package/dist/sveltekit/local-bindings.d.ts +4 -0
  454. package/dist/sveltekit/local-bindings.d.ts.map +1 -0
  455. package/dist/sveltekit/platform.d.ts +42 -2
  456. package/dist/sveltekit/platform.d.ts.map +1 -1
  457. package/dist/test/ai-search.d.ts +39 -0
  458. package/dist/test/ai-search.d.ts.map +1 -0
  459. package/dist/test/alarm.d.ts +55 -0
  460. package/dist/test/alarm.d.ts.map +1 -0
  461. package/dist/test/binding-hints.d.ts +10 -0
  462. package/dist/test/binding-hints.d.ts.map +1 -0
  463. package/dist/test/cf.d.ts +71 -35
  464. package/dist/test/cf.d.ts.map +1 -1
  465. package/dist/test/containers.d.ts +87 -0
  466. package/dist/test/containers.d.ts.map +1 -0
  467. package/dist/test/email.d.ts +16 -7
  468. package/dist/test/email.d.ts.map +1 -1
  469. package/dist/test/index.d.ts +20 -21
  470. package/dist/test/index.d.ts.map +1 -1
  471. package/dist/test/index.js +5115 -75
  472. package/dist/test/offline-bindings.d.ts +124 -0
  473. package/dist/test/offline-bindings.d.ts.map +1 -0
  474. package/dist/test/queue.d.ts.map +1 -1
  475. package/dist/test/remote-ai.d.ts.map +1 -1
  476. package/dist/test/remote-cloudflare.d.ts +13 -0
  477. package/dist/test/remote-cloudflare.d.ts.map +1 -0
  478. package/dist/test/remote-vectorize.d.ts.map +1 -1
  479. package/dist/test/resolve-service-bindings.d.ts +64 -4
  480. package/dist/test/resolve-service-bindings.d.ts.map +1 -1
  481. package/dist/test/scheduled.d.ts.map +1 -1
  482. package/dist/test/should-skip.d.ts +14 -18
  483. package/dist/test/should-skip.d.ts.map +1 -1
  484. package/dist/test/simple-context-bindings.d.ts +13 -0
  485. package/dist/test/simple-context-bindings.d.ts.map +1 -0
  486. package/dist/test/simple-context-durable-objects.d.ts +6 -0
  487. package/dist/test/simple-context-durable-objects.d.ts.map +1 -0
  488. package/dist/test/simple-context-env.d.ts +35 -0
  489. package/dist/test/simple-context-env.d.ts.map +1 -0
  490. package/dist/test/simple-context-gateway-script.d.ts +2 -0
  491. package/dist/test/simple-context-gateway-script.d.ts.map +1 -0
  492. package/dist/test/simple-context-handlers.d.ts +12 -0
  493. package/dist/test/simple-context-handlers.d.ts.map +1 -0
  494. package/dist/test/simple-context-lifecycle.d.ts +32 -0
  495. package/dist/test/simple-context-lifecycle.d.ts.map +1 -0
  496. package/dist/test/simple-context-mfconfig.d.ts +18 -0
  497. package/dist/test/simple-context-mfconfig.d.ts.map +1 -0
  498. package/dist/test/simple-context-multi-worker.d.ts +16 -0
  499. package/dist/test/simple-context-multi-worker.d.ts.map +1 -0
  500. package/dist/test/simple-context-paths.d.ts +40 -0
  501. package/dist/test/simple-context-paths.d.ts.map +1 -0
  502. package/dist/test/simple-context-runtime.d.ts +19 -0
  503. package/dist/test/simple-context-runtime.d.ts.map +1 -0
  504. package/dist/test/simple-context-startup.d.ts +11 -0
  505. package/dist/test/simple-context-startup.d.ts.map +1 -0
  506. package/dist/test/simple-context-transport.d.ts +14 -0
  507. package/dist/test/simple-context-transport.d.ts.map +1 -0
  508. package/dist/test/simple-context.d.ts +8 -27
  509. package/dist/test/simple-context.d.ts.map +1 -1
  510. package/dist/test/tail.d.ts +3 -2
  511. package/dist/test/tail.d.ts.map +1 -1
  512. package/dist/test/utilities/analytics-engine.d.ts +22 -0
  513. package/dist/test/utilities/analytics-engine.d.ts.map +1 -0
  514. package/dist/test/utilities/artifacts.d.ts +11 -0
  515. package/dist/test/utilities/artifacts.d.ts.map +1 -0
  516. package/dist/test/utilities/context.d.ts +39 -0
  517. package/dist/test/utilities/context.d.ts.map +1 -0
  518. package/dist/test/utilities/d1.d.ts +21 -0
  519. package/dist/test/utilities/d1.d.ts.map +1 -0
  520. package/dist/test/utilities/env.d.ts +45 -0
  521. package/dist/test/utilities/env.d.ts.map +1 -0
  522. package/dist/test/utilities/kv.d.ts +11 -0
  523. package/dist/test/utilities/kv.d.ts.map +1 -0
  524. package/dist/test/utilities/media.d.ts +16 -0
  525. package/dist/test/utilities/media.d.ts.map +1 -0
  526. package/dist/test/utilities/platform.d.ts +41 -0
  527. package/dist/test/utilities/platform.d.ts.map +1 -0
  528. package/dist/test/utilities/queue.d.ts +5 -0
  529. package/dist/test/utilities/queue.d.ts.map +1 -0
  530. package/dist/test/utilities/r2.d.ts +2 -0
  531. package/dist/test/utilities/r2.d.ts.map +1 -0
  532. package/dist/test/utilities/send-email.d.ts +27 -0
  533. package/dist/test/utilities/send-email.d.ts.map +1 -0
  534. package/dist/test/utilities/stream-flagship.d.ts +27 -0
  535. package/dist/test/utilities/stream-flagship.d.ts.map +1 -0
  536. package/dist/test/utilities/vectorize.d.ts +38 -0
  537. package/dist/test/utilities/vectorize.d.ts.map +1 -0
  538. package/dist/test/utilities/workflows.d.ts +26 -0
  539. package/dist/test/utilities/workflows.d.ts.map +1 -0
  540. package/dist/test/utilities.d.ts +14 -98
  541. package/dist/test/utilities.d.ts.map +1 -1
  542. package/dist/test/worker.d.ts +6 -0
  543. package/dist/test/worker.d.ts.map +1 -1
  544. package/dist/transform/durable-object.d.ts.map +1 -1
  545. package/dist/transform/index.d.ts +2 -2
  546. package/dist/transform/worker-entrypoint.d.ts +5 -0
  547. package/dist/transform/worker-entrypoint.d.ts.map +1 -1
  548. package/dist/utils/entrypoint-discovery.d.ts +6 -3
  549. package/dist/utils/entrypoint-discovery.d.ts.map +1 -1
  550. package/dist/utils/generated-dir.d.ts +25 -0
  551. package/dist/utils/generated-dir.d.ts.map +1 -0
  552. package/dist/utils/glob.d.ts.map +1 -1
  553. package/dist/utils/resolve-package.d.ts.map +1 -1
  554. package/dist/utils/send-email.d.ts +15 -0
  555. package/dist/utils/send-email.d.ts.map +1 -0
  556. package/dist/utils/send-email.js +163 -0
  557. package/dist/vite/config-file.d.ts +25 -0
  558. package/dist/vite/config-file.d.ts.map +1 -0
  559. package/dist/vite/index.d.ts +3 -2
  560. package/dist/vite/index.d.ts.map +1 -1
  561. package/dist/vite/index.js +2 -407
  562. package/dist/vite/plugin-config-hook.d.ts +28 -0
  563. package/dist/vite/plugin-config-hook.d.ts.map +1 -0
  564. package/dist/vite/plugin-context.d.ts +27 -0
  565. package/dist/vite/plugin-context.d.ts.map +1 -0
  566. package/dist/vite/plugin-durable-objects.d.ts +18 -0
  567. package/dist/vite/plugin-durable-objects.d.ts.map +1 -0
  568. package/dist/vite/plugin-programmatic.d.ts +44 -0
  569. package/dist/vite/plugin-programmatic.d.ts.map +1 -0
  570. package/dist/vite/plugin-service-bindings.d.ts +13 -0
  571. package/dist/vite/plugin-service-bindings.d.ts.map +1 -0
  572. package/dist/vite/plugin-transform.d.ts +41 -0
  573. package/dist/vite/plugin-transform.d.ts.map +1 -0
  574. package/dist/vite/plugin.d.ts +10 -41
  575. package/dist/vite/plugin.d.ts.map +1 -1
  576. package/dist/worker-entry/composed-worker.d.ts +5 -8
  577. package/dist/worker-entry/composed-worker.d.ts.map +1 -1
  578. package/dist/worker-entry/durable-object-discovery.d.ts +20 -0
  579. package/dist/worker-entry/durable-object-discovery.d.ts.map +1 -0
  580. package/dist/worker-entry/extensions.d.ts +5 -0
  581. package/dist/worker-entry/extensions.d.ts.map +1 -0
  582. package/dist/worker-entry/routes.d.ts +22 -0
  583. package/dist/worker-entry/routes.d.ts.map +1 -0
  584. package/dist/worker-entry/surface-paths.d.ts +26 -0
  585. package/dist/worker-entry/surface-paths.d.ts.map +1 -0
  586. package/dist/worker-entry/validate-fetch-style.d.ts +12 -0
  587. package/dist/worker-entry/validate-fetch-style.d.ts.map +1 -0
  588. package/dist/workflows/local-workflow-entrypoints.d.ts +7 -0
  589. package/dist/workflows/local-workflow-entrypoints.d.ts.map +1 -0
  590. package/package.json +160 -117
  591. package/R2.md +0 -170
  592. package/dist/account-rvrj687w.js +0 -397
  593. package/dist/ai-dx4fr9jh.js +0 -107
  594. package/dist/bridge/protocol.d.ts.map +0 -1
  595. package/dist/bridge/serialization.d.ts +0 -83
  596. package/dist/bridge/serialization.d.ts.map +0 -1
  597. package/dist/browser-shim/worker.d.ts +0 -14
  598. package/dist/browser-shim/worker.d.ts.map +0 -1
  599. package/dist/build-9myaxf07.js +0 -70
  600. package/dist/deploy-h1wz5p7m.js +0 -86
  601. package/dist/dev-rsdssknb.js +0 -2707
  602. package/dist/doctor-v7jy4s3r.js +0 -190
  603. package/dist/durable-object-t4kbb0yt.js +0 -13
  604. package/dist/index-18hvb6gb.js +0 -194
  605. package/dist/index-1xpj0m4r.js +0 -57
  606. package/dist/index-37x76zdn.js +0 -4
  607. package/dist/index-3t6rypgc.js +0 -13
  608. package/dist/index-62b3gt2g.js +0 -12
  609. package/dist/index-67qcae0f.js +0 -183
  610. package/dist/index-9ats0s83.js +0 -70
  611. package/dist/index-a0fjkq68.js +0 -198
  612. package/dist/index-a855bdsx.js +0 -18
  613. package/dist/index-ccrh4w3t.js +0 -1133
  614. package/dist/index-d8bdkx2h.js +0 -109
  615. package/dist/index-f8qh2tyh.js +0 -2152
  616. package/dist/index-gz1gndna.js +0 -307
  617. package/dist/index-hcex3rgh.js +0 -266
  618. package/dist/index-k7r18na8.js +0 -0
  619. package/dist/index-n3np2d6t.js +0 -462
  620. package/dist/index-n7rs26ft.js +0 -77
  621. package/dist/index-npc1c8jx.js +0 -44
  622. package/dist/index-p7g30wd2.js +0 -281
  623. package/dist/index-rbht7m9r.js +0 -36
  624. package/dist/index-tfyxa77h.js +0 -850
  625. package/dist/index-tk6ej9dj.js +0 -94
  626. package/dist/index-v8vvsn9x.js +0 -169
  627. package/dist/index-z14anrqp.js +0 -226
  628. package/dist/init-f9mgmew3.js +0 -186
  629. package/dist/remote-q59qk463.js +0 -97
  630. package/dist/test/bridge-context.d.ts +0 -76
  631. package/dist/test/bridge-context.d.ts.map +0 -1
  632. package/dist/test/multi-worker-context.d.ts +0 -114
  633. package/dist/test/multi-worker-context.d.ts.map +0 -1
  634. package/dist/types-wdcpnfvy.js +0 -487
  635. package/dist/worker-entrypoint-m9th0rg0.js +0 -13
@@ -0,0 +1,1133 @@
1
+ import { a as resolvePreviewIdentifier } from "./preview-j9Kbx4-G.js";
2
+ import { i as resolveConfigPath, o as loadResolvedConfig, r as loadConfig, t as ConfigNotFoundError } from "./loader-BC0skbnH.js";
3
+ import { t as compileBuildConfig } from "./compiler-UxXQgEPq.js";
4
+ import { t as account } from "./cloudflare-D_5UWT84.js";
5
+ import { _ as yellowBold, a as cyanBold, d as green, f as logLine, g as yellow, h as whiteDim, m as red, n as bold, o as dim, r as createCliTheme, u as formatTableLine } from "./ui-BhCdDC2N.js";
6
+ import { i as resolveNamedSelection, r as resolveCloudflareAccountId, t as asOptionalString } from "./command-utils-qlsHELwW.js";
7
+ import { t as getDependencies } from "./dependencies-HLIhxbIe.js";
8
+ import { t as cleanupPreviewScopedResources } from "./preview-resources-BNvfkfqP.js";
9
+ import { t as findConfigPathsUnderDirectory } from "./config-path-DzZbchb6.js";
10
+ import { a as orderPreviewWorkerNamesForDeletion, i as collectConfiguredWorkerFamilies, n as buildPreviewWorkerCandidatesByScope, r as buildStableWorkerRowsFromLiveWorkers, t as buildPreviewScopeRowsFromLiveWorkers } from "./family-DHkROYgX.js";
11
+ //#region src/cli/preview-bindings.ts
12
+ function normalizeCell(value) {
13
+ return (value ?? "").trim().replace(/\s+/g, " ");
14
+ }
15
+ function buildAssociationKey(type, resource) {
16
+ return `${normalizeCell(type).toLowerCase()}\u0000${normalizeCell(resource).toLowerCase()}`;
17
+ }
18
+ function uniqueStrings(values) {
19
+ return Array.from(new Set(values.filter((value) => value.trim().length > 0)));
20
+ }
21
+ function formatSendEmailResource(entry) {
22
+ const destination = entry.destination_address?.trim();
23
+ if (destination) return destination;
24
+ const destinations = uniqueStrings(entry.allowed_destination_addresses ?? []);
25
+ const senders = uniqueStrings(entry.allowed_sender_addresses ?? []);
26
+ const destinationLabel = destinations.length > 0 ? destinations.join(", ") : "configured destinations";
27
+ if (senders.length === 0) return destinationLabel;
28
+ return `${destinationLabel} - senders: ${senders.join(", ")}`;
29
+ }
30
+ function addAssociationTarget(targets, input) {
31
+ const type = normalizeCell(input.type);
32
+ const resource = normalizeCell(input.resource);
33
+ const key = buildAssociationKey(type, resource);
34
+ const existing = targets.get(key);
35
+ if (existing) {
36
+ if (input.reference) existing.referenceLabels = uniqueStrings([...existing.referenceLabels, input.reference]);
37
+ if (input.note) existing.notes = uniqueStrings([...existing.notes, input.note]);
38
+ if (!existing.queueName && input.queueName) existing.queueName = input.queueName;
39
+ return;
40
+ }
41
+ targets.set(key, {
42
+ key,
43
+ referenceLabels: input.reference ? [input.reference] : [],
44
+ type,
45
+ resource,
46
+ notes: input.note ? [input.note] : [],
47
+ queueName: input.queueName
48
+ });
49
+ }
50
+ function collectBindingAssociationTargets(config) {
51
+ const compiled = compileBuildConfig(config);
52
+ const targets = /* @__PURE__ */ new Map();
53
+ for (const binding of compiled.kv_namespaces ?? []) addAssociationTarget(targets, {
54
+ reference: binding.binding,
55
+ type: "KV Namespace",
56
+ resource: "id" in binding ? binding.id : binding.name
57
+ });
58
+ for (const binding of compiled.d1_databases ?? []) addAssociationTarget(targets, {
59
+ reference: binding.binding,
60
+ type: "D1 Database",
61
+ resource: "database_id" in binding ? binding.database_id : binding.database_name
62
+ });
63
+ for (const binding of compiled.r2_buckets ?? []) addAssociationTarget(targets, {
64
+ reference: binding.binding,
65
+ type: "R2 Bucket",
66
+ resource: binding.bucket_name
67
+ });
68
+ for (const binding of compiled.durable_objects?.bindings ?? []) addAssociationTarget(targets, {
69
+ reference: binding.name,
70
+ type: "Durable Object Namespace",
71
+ resource: binding.class_name,
72
+ note: binding.script_name ? `script ${binding.script_name}` : void 0
73
+ });
74
+ for (const binding of compiled.queues?.producers ?? []) addAssociationTarget(targets, {
75
+ reference: binding.binding,
76
+ type: "Queue",
77
+ resource: binding.queue,
78
+ note: "producer binding",
79
+ queueName: binding.queue
80
+ });
81
+ for (const binding of compiled.queues?.consumers ?? []) {
82
+ addAssociationTarget(targets, {
83
+ type: "Queue",
84
+ resource: binding.queue,
85
+ note: "consumer attachment",
86
+ queueName: binding.queue
87
+ });
88
+ if (binding.dead_letter_queue) addAssociationTarget(targets, {
89
+ type: "Queue",
90
+ resource: binding.dead_letter_queue,
91
+ note: "dead letter queue",
92
+ queueName: binding.dead_letter_queue
93
+ });
94
+ }
95
+ for (const binding of compiled.ratelimits ?? []) addAssociationTarget(targets, {
96
+ reference: binding.name,
97
+ type: "Rate Limiting",
98
+ resource: binding.namespace_id
99
+ });
100
+ if (compiled.version_metadata) addAssociationTarget(targets, {
101
+ reference: compiled.version_metadata.binding,
102
+ type: "Version Metadata",
103
+ resource: "Version Metadata"
104
+ });
105
+ for (const binding of compiled.worker_loaders ?? []) addAssociationTarget(targets, {
106
+ reference: binding.binding,
107
+ type: "Worker Loader",
108
+ resource: "Worker Loader"
109
+ });
110
+ for (const binding of compiled.mtls_certificates ?? []) addAssociationTarget(targets, {
111
+ reference: binding.binding,
112
+ type: "mTLS Certificate",
113
+ resource: binding.certificate_id
114
+ });
115
+ for (const binding of compiled.dispatch_namespaces ?? []) addAssociationTarget(targets, {
116
+ reference: binding.binding,
117
+ type: "Dispatch Namespace",
118
+ resource: binding.namespace,
119
+ note: binding.outbound ? `outbound ${binding.outbound.service}` : void 0
120
+ });
121
+ for (const binding of compiled.workflows ?? []) addAssociationTarget(targets, {
122
+ reference: binding.binding,
123
+ type: "Workflow",
124
+ resource: binding.name,
125
+ note: binding.script_name ? `script ${binding.script_name}` : binding.class_name
126
+ });
127
+ for (const binding of compiled.pipelines ?? []) addAssociationTarget(targets, {
128
+ reference: binding.binding,
129
+ type: "Pipeline",
130
+ resource: binding.pipeline,
131
+ note: binding.remote ? "remote local binding" : void 0
132
+ });
133
+ if (compiled.images) addAssociationTarget(targets, {
134
+ reference: compiled.images.binding,
135
+ type: "Images",
136
+ resource: "Images",
137
+ note: compiled.images.remote ? "remote local binding" : void 0
138
+ });
139
+ if (compiled.media) addAssociationTarget(targets, {
140
+ reference: compiled.media.binding,
141
+ type: "Media Transformations",
142
+ resource: "Media Transformations",
143
+ note: compiled.media.remote ? "remote local binding" : void 0
144
+ });
145
+ for (const binding of compiled.artifacts ?? []) addAssociationTarget(targets, {
146
+ reference: binding.binding,
147
+ type: "Artifacts",
148
+ resource: binding.namespace,
149
+ note: binding.remote ? "remote local binding" : void 0
150
+ });
151
+ for (const binding of compiled.secrets_store_secrets ?? []) addAssociationTarget(targets, {
152
+ reference: binding.binding,
153
+ type: "Secrets Store",
154
+ resource: `${binding.store_id}/${binding.secret_name}`
155
+ });
156
+ for (const consumer of compiled.tail_consumers ?? []) addAssociationTarget(targets, {
157
+ type: "Tail Consumer",
158
+ resource: consumer.service,
159
+ note: consumer.environment ? `env ${consumer.environment}` : void 0
160
+ });
161
+ for (const binding of compiled.services ?? []) addAssociationTarget(targets, {
162
+ reference: binding.binding,
163
+ type: "Worker",
164
+ resource: binding.entrypoint ? `${binding.service}#${binding.entrypoint}` : binding.service
165
+ });
166
+ if (compiled.ai?.binding) addAssociationTarget(targets, {
167
+ reference: compiled.ai.binding,
168
+ type: "AI",
169
+ resource: "Workers AI"
170
+ });
171
+ for (const binding of compiled.vectorize ?? []) addAssociationTarget(targets, {
172
+ reference: binding.binding,
173
+ type: "Vectorize",
174
+ resource: binding.index_name
175
+ });
176
+ for (const binding of compiled.hyperdrive ?? []) addAssociationTarget(targets, {
177
+ reference: binding.binding,
178
+ type: "Hyperdrive",
179
+ resource: "id" in binding ? binding.id : binding.name
180
+ });
181
+ if (compiled.browser?.binding) addAssociationTarget(targets, {
182
+ reference: compiled.browser.binding,
183
+ type: "Browser",
184
+ resource: "Browser Rendering"
185
+ });
186
+ for (const binding of compiled.analytics_engine_datasets ?? []) addAssociationTarget(targets, {
187
+ reference: binding.binding,
188
+ type: "Analytics Engine",
189
+ resource: binding.dataset
190
+ });
191
+ for (const binding of compiled.send_email ?? []) addAssociationTarget(targets, {
192
+ reference: binding.name,
193
+ type: "Send Email",
194
+ resource: formatSendEmailResource(binding)
195
+ });
196
+ return Array.from(targets.values());
197
+ }
198
+ function getActiveVersionId(deployments) {
199
+ const sortedDeployments = [...deployments].sort((left, right) => right.createdOn.getTime() - left.createdOn.getTime());
200
+ for (const deployment of sortedDeployments) {
201
+ const version = [...deployment.versions].sort((left, right) => right.percentage - left.percentage)[0];
202
+ if (version?.versionId) return version.versionId;
203
+ }
204
+ }
205
+ function extractWorkerNames(value) {
206
+ return Array.from(value.matchAll(/worker:([^,\s]+)/gi), (match) => match[1]);
207
+ }
208
+ function parseWranglerQueueInfo(output) {
209
+ const lines = output.split(/\r?\n/);
210
+ let queueName = "";
211
+ const producerWorkers = [];
212
+ const consumerWorkers = [];
213
+ let currentSection = null;
214
+ for (const rawLine of lines) {
215
+ const trimmed = rawLine.trim();
216
+ if (!trimmed) {
217
+ currentSection = null;
218
+ continue;
219
+ }
220
+ const queueMatch = trimmed.match(/^Queue Name:\s*(.+)$/i);
221
+ if (queueMatch) {
222
+ queueName = normalizeCell(queueMatch[1]);
223
+ currentSection = null;
224
+ continue;
225
+ }
226
+ const producerMatch = trimmed.match(/^Producers:\s*(.*)$/i);
227
+ if (producerMatch) {
228
+ producerWorkers.push(...extractWorkerNames(producerMatch[1]));
229
+ currentSection = producerMatch[1] ? null : "producers";
230
+ continue;
231
+ }
232
+ const consumerMatch = trimmed.match(/^Consumers:\s*(.*)$/i);
233
+ if (consumerMatch) {
234
+ consumerWorkers.push(...extractWorkerNames(consumerMatch[1]));
235
+ currentSection = consumerMatch[1] ? null : "consumers";
236
+ continue;
237
+ }
238
+ if (!currentSection) continue;
239
+ const extractedWorkers = extractWorkerNames(trimmed);
240
+ if (currentSection === "producers") producerWorkers.push(...extractedWorkers);
241
+ else consumerWorkers.push(...extractedWorkers);
242
+ }
243
+ if (!queueName) return null;
244
+ return {
245
+ queueName,
246
+ producerWorkers: uniqueStrings(producerWorkers),
247
+ consumerWorkers: uniqueStrings(consumerWorkers)
248
+ };
249
+ }
250
+ /**
251
+ * Parse the JSON output of `wrangler versions view --json` into a flat list
252
+ * of `{ type, bindingName, resource }` rows that match the friendly type
253
+ * labels used by `collectBindingAssociationTargets`.
254
+ *
255
+ * Requires Wrangler 3.99+ (the `--json` flag on `versions view`).
256
+ */
257
+ function parseWranglerVersionBindings(jsonOutput) {
258
+ let parsed;
259
+ try {
260
+ parsed = JSON.parse(jsonOutput);
261
+ } catch {
262
+ return [];
263
+ }
264
+ const bindings = extractBindingsArray(parsed);
265
+ if (!bindings) return [];
266
+ const rows = [];
267
+ for (const raw of bindings) {
268
+ const row = mapWranglerBindingToRow(raw);
269
+ if (row) rows.push(row);
270
+ }
271
+ return rows;
272
+ }
273
+ function extractBindingsArray(parsed) {
274
+ if (!parsed || typeof parsed !== "object") return null;
275
+ const bindings = parsed.resources?.bindings;
276
+ return Array.isArray(bindings) ? bindings : null;
277
+ }
278
+ function mapWranglerBindingToRow(raw) {
279
+ if (!raw || typeof raw !== "object") return null;
280
+ const binding = raw;
281
+ const type = typeof binding.type === "string" ? binding.type : "";
282
+ const bindingName = typeof binding.name === "string" ? binding.name : "";
283
+ if (!type || !bindingName) return null;
284
+ const mapped = mapWranglerBindingType(type, binding);
285
+ if (!mapped) return null;
286
+ return {
287
+ type: mapped.friendlyType,
288
+ bindingName,
289
+ resource: mapped.resource
290
+ };
291
+ }
292
+ function mapWranglerBindingType(type, binding) {
293
+ const stringField = (key) => typeof binding[key] === "string" ? binding[key] : "";
294
+ switch (type) {
295
+ case "kv_namespace": return {
296
+ friendlyType: "KV Namespace",
297
+ resource: stringField("namespace_id")
298
+ };
299
+ case "d1": return {
300
+ friendlyType: "D1 Database",
301
+ resource: stringField("id")
302
+ };
303
+ case "r2_bucket": return {
304
+ friendlyType: "R2 Bucket",
305
+ resource: stringField("bucket_name")
306
+ };
307
+ case "durable_object_namespace": return {
308
+ friendlyType: "Durable Object Namespace",
309
+ resource: stringField("class_name")
310
+ };
311
+ case "queue": return {
312
+ friendlyType: "Queue",
313
+ resource: stringField("queue_name")
314
+ };
315
+ case "ratelimit": return {
316
+ friendlyType: "Rate Limiting",
317
+ resource: stringField("namespace_id")
318
+ };
319
+ case "service": {
320
+ const service = stringField("service") || binding.name;
321
+ const entrypoint = stringField("entrypoint");
322
+ return {
323
+ friendlyType: "Worker",
324
+ resource: entrypoint ? `${service}#${entrypoint}` : service
325
+ };
326
+ }
327
+ case "ai": return {
328
+ friendlyType: "AI",
329
+ resource: "Workers AI"
330
+ };
331
+ case "vectorize": return {
332
+ friendlyType: "Vectorize",
333
+ resource: stringField("index_name")
334
+ };
335
+ case "hyperdrive": return {
336
+ friendlyType: "Hyperdrive",
337
+ resource: stringField("id")
338
+ };
339
+ case "browser": return {
340
+ friendlyType: "Browser",
341
+ resource: "Browser Rendering"
342
+ };
343
+ case "analytics_engine": return {
344
+ friendlyType: "Analytics Engine",
345
+ resource: stringField("dataset")
346
+ };
347
+ case "send_email": return {
348
+ friendlyType: "Send Email",
349
+ resource: stringField("destination_address") || stringField("name") || binding.name
350
+ };
351
+ case "mtls_certificate": return {
352
+ friendlyType: "mTLS Certificate",
353
+ resource: stringField("certificate_id")
354
+ };
355
+ case "dispatch_namespace": return {
356
+ friendlyType: "Dispatch Namespace",
357
+ resource: stringField("namespace")
358
+ };
359
+ case "workflow": return {
360
+ friendlyType: "Workflow",
361
+ resource: stringField("workflow_name") || stringField("name")
362
+ };
363
+ case "pipeline": return {
364
+ friendlyType: "Pipeline",
365
+ resource: stringField("pipeline")
366
+ };
367
+ case "images": return {
368
+ friendlyType: "Images",
369
+ resource: "Images"
370
+ };
371
+ case "media": return {
372
+ friendlyType: "Media Transformations",
373
+ resource: "Media Transformations"
374
+ };
375
+ case "artifacts": return {
376
+ friendlyType: "Artifacts",
377
+ resource: stringField("namespace")
378
+ };
379
+ case "version_metadata": return {
380
+ friendlyType: "Version Metadata",
381
+ resource: "Version Metadata"
382
+ };
383
+ case "worker_loader": return {
384
+ friendlyType: "Worker Loader",
385
+ resource: "Worker Loader"
386
+ };
387
+ case "secrets_store_secret": return {
388
+ friendlyType: "Secrets Store",
389
+ resource: `${stringField("store_id")}/${stringField("secret_name")}`
390
+ };
391
+ case "plain_text":
392
+ case "json":
393
+ case "secret_text": return null;
394
+ default: return {
395
+ friendlyType: type,
396
+ resource: stringField("id") || stringField("name") || ""
397
+ };
398
+ }
399
+ }
400
+ async function inspectWorkerBindings(exec, options) {
401
+ return parseWranglerVersionBindings(await runWranglerInspectionCommand(exec, [
402
+ "wrangler",
403
+ "versions",
404
+ "view",
405
+ options.versionId,
406
+ "--name",
407
+ options.workerName,
408
+ "--json"
409
+ ], options, "Wrangler versions view failed"));
410
+ }
411
+ async function runWranglerInspectionCommand(exec, args, options, failureMessage) {
412
+ const result = await exec.exec("bunx", args, {
413
+ cwd: options.cwd,
414
+ env: {
415
+ ...process.env,
416
+ CLOUDFLARE_ACCOUNT_ID: options.accountId,
417
+ FORCE_COLOR: process.env.FORCE_COLOR ?? "0"
418
+ }
419
+ });
420
+ if (result.exitCode !== 0) throw new Error(result.stderr || result.stdout || failureMessage);
421
+ return `${result.stdout}\n${result.stderr}`;
422
+ }
423
+ async function inspectQueueAssociation(exec, options) {
424
+ return parseWranglerQueueInfo(await runWranglerInspectionCommand(exec, [
425
+ "wrangler",
426
+ "queues",
427
+ "info",
428
+ options.queueName
429
+ ], options, "Wrangler queues info failed"));
430
+ }
431
+ function formatReference(target) {
432
+ return target.referenceLabels.length > 0 ? target.referenceLabels.join(", ") : "—";
433
+ }
434
+ function formatResource(target) {
435
+ return target.resource || "—";
436
+ }
437
+ function buildRowNotes(target, queueAssociation) {
438
+ const notes = [...target.notes];
439
+ if (queueAssociation) {
440
+ notes.push(`producers ${queueAssociation.producerWorkers.length}`);
441
+ notes.push(`consumers ${queueAssociation.consumerWorkers.length}`);
442
+ }
443
+ return uniqueStrings(notes);
444
+ }
445
+ async function inspectBindingAssociations(options) {
446
+ const targets = collectBindingAssociationTargets(options.config);
447
+ const warnings = [];
448
+ const bindingUsage = /* @__PURE__ */ new Map();
449
+ const scannedWorkers = [];
450
+ const queueTargets = uniqueStrings(targets.map((target) => target.queueName).filter((queueName) => typeof queueName === "string" && queueName.length > 0));
451
+ const queueAssociations = /* @__PURE__ */ new Map();
452
+ const workers = await account.workers(options.accountId, options.apiOptions);
453
+ for (const worker of workers) {
454
+ let versionId;
455
+ try {
456
+ versionId = getActiveVersionId(await account.workerDeployments(options.accountId, worker.name, options.apiOptions));
457
+ } catch (error) {
458
+ const message = error instanceof Error ? error.message : String(error);
459
+ warnings.push(`Could not resolve active deployment for ${worker.name}: ${message}`);
460
+ continue;
461
+ }
462
+ if (!versionId) continue;
463
+ scannedWorkers.push(worker.name);
464
+ try {
465
+ const bindings = await inspectWorkerBindings(options.exec, {
466
+ accountId: options.accountId,
467
+ workerName: worker.name,
468
+ versionId,
469
+ cwd: options.cwd
470
+ });
471
+ for (const binding of bindings) {
472
+ const key = buildAssociationKey(binding.type, binding.resource);
473
+ const connectedWorkers = bindingUsage.get(key) ?? /* @__PURE__ */ new Set();
474
+ connectedWorkers.add(worker.name);
475
+ bindingUsage.set(key, connectedWorkers);
476
+ }
477
+ } catch (error) {
478
+ const message = error instanceof Error ? error.message : String(error);
479
+ warnings.push(`Could not inspect bindings for ${worker.name}: ${message}`);
480
+ }
481
+ }
482
+ for (const queueName of queueTargets) try {
483
+ const queueAssociation = await inspectQueueAssociation(options.exec, {
484
+ accountId: options.accountId,
485
+ queueName,
486
+ cwd: options.cwd
487
+ });
488
+ if (queueAssociation) queueAssociations.set(queueName, queueAssociation);
489
+ } catch (error) {
490
+ const message = error instanceof Error ? error.message : String(error);
491
+ warnings.push(`Could not inspect queue ${queueName}: ${message}`);
492
+ }
493
+ const rows = targets.map((target) => {
494
+ const queueAssociation = target.queueName ? queueAssociations.get(target.queueName) : void 0;
495
+ const connectedWorkers = uniqueStrings([
496
+ ...Array.from(bindingUsage.get(target.key) ?? []),
497
+ ...queueAssociation?.producerWorkers ?? [],
498
+ ...queueAssociation?.consumerWorkers ?? []
499
+ ]).sort((left, right) => left.localeCompare(right));
500
+ return {
501
+ reference: formatReference(target),
502
+ type: target.type,
503
+ resource: formatResource(target),
504
+ workerCount: connectedWorkers.length,
505
+ connectedWorkers,
506
+ notes: buildRowNotes(target, queueAssociation),
507
+ producerWorkers: queueAssociation?.producerWorkers,
508
+ consumerWorkers: queueAssociation?.consumerWorkers
509
+ };
510
+ });
511
+ return {
512
+ workerName: options.workerName ?? options.config.name,
513
+ rows,
514
+ targets: targets.length,
515
+ scannedWorkers,
516
+ warnings
517
+ };
518
+ }
519
+ //#endregion
520
+ //#region src/cli/commands/previews-support/theme.ts
521
+ function shouldUseColor(options) {
522
+ return createCliTheme(options).useColor;
523
+ }
524
+ function formatRecordDate(date) {
525
+ return date ? date.toISOString().slice(0, 19).replace("T", " ") : "N/A";
526
+ }
527
+ function formatStatus(value, theme) {
528
+ switch (value) {
529
+ case "active": return green(value, theme);
530
+ case "superseded":
531
+ case "reassigned":
532
+ case "orphaned": return yellow(value, theme);
533
+ case "deleted":
534
+ case "rolled_back": return red(value, theme);
535
+ default: return value;
536
+ }
537
+ }
538
+ function formatOverviewStatus(value, theme) {
539
+ switch (value) {
540
+ case "ready": return green(value, theme);
541
+ case "partial": return yellow(value, theme);
542
+ case "missing": return red(value, theme);
543
+ default: return formatStatus(value, theme);
544
+ }
545
+ }
546
+ //#endregion
547
+ //#region src/cli/commands/previews-support/cleanup.ts
548
+ function comparePreviewCleanupScopeNames(left, right) {
549
+ if (left === "preview" && right !== "preview") return 1;
550
+ if (left !== "preview" && right === "preview") return -1;
551
+ return left.localeCompare(right);
552
+ }
553
+ function buildPreviewCleanupTarget(scope, workerCandidatesByScope, environment) {
554
+ const strategies = /* @__PURE__ */ new Set();
555
+ const workerNames = [...workerCandidatesByScope.get(scope) ?? []];
556
+ if (workerNames.length > 0) strategies.add("dedicated workers");
557
+ if (scope === "preview" && environment === "preview") strategies.add("default preview scope");
558
+ return {
559
+ scope,
560
+ strategies: Array.from(strategies),
561
+ workerNames
562
+ };
563
+ }
564
+ function buildPreviewCleanupTargets(workerCandidatesByScope, environment) {
565
+ const scopeNames = /* @__PURE__ */ new Set();
566
+ for (const scope of workerCandidatesByScope.keys()) scopeNames.add(scope);
567
+ return Array.from(scopeNames).sort(comparePreviewCleanupScopeNames).map((scope) => buildPreviewCleanupTarget(scope, workerCandidatesByScope, environment));
568
+ }
569
+ function getPreviewCleanupResourceCandidateCount(result) {
570
+ return result.candidates.kv.length + result.candidates.d1.length + result.candidates.r2.length + result.candidates.queues.length + result.candidates.vectorize.length + result.candidates.hyperdrive.length;
571
+ }
572
+ function buildPreviewCleanupResourceSummary(result) {
573
+ return [
574
+ result.candidates.kv.length > 0 ? `KV ${result.candidates.kv.length}` : null,
575
+ result.candidates.d1.length > 0 ? `D1 ${result.candidates.d1.length}` : null,
576
+ result.candidates.r2.length > 0 ? `R2 ${result.candidates.r2.length}` : null,
577
+ result.candidates.queues.length > 0 ? `Queues ${result.candidates.queues.length}` : null,
578
+ result.candidates.vectorize.length > 0 ? `Vectorize ${result.candidates.vectorize.length}` : null,
579
+ result.candidates.hyperdrive.length > 0 ? `Hyperdrive ${result.candidates.hyperdrive.length}` : null
580
+ ].filter((segment) => segment !== null);
581
+ }
582
+ function logResolvedPreviewScopes(logger, targets, theme) {
583
+ if (targets.length === 0) {
584
+ logLine(logger, `${dim("preview scopes", theme)} ${dim("none discovered (--all)", theme)}`);
585
+ logLine(logger);
586
+ return;
587
+ }
588
+ logLine(logger, `${dim("preview scopes", theme)} ${green(targets.map((target) => target.scope).join(", "), theme)} ${dim("(--all)", theme)}`);
589
+ logLine(logger);
590
+ }
591
+ function logPreviewCleanupScopeBreakdown(logger, executions, theme) {
592
+ const scopedExecutions = executions.filter((execution) => execution.target);
593
+ if (scopedExecutions.length === 0) return;
594
+ logLine(logger, `${dim("scope breakdown", theme)}`);
595
+ for (const execution of scopedExecutions) {
596
+ const target = execution.target;
597
+ const strategies = target.strategies.length > 0 ? dim(`(${target.strategies.join(" + ")})`, theme) : "";
598
+ const summary = [target.workerNames.length > 0 ? `Workers ${target.workerNames.length}` : null, ...buildPreviewCleanupResourceSummary(execution.result)].filter((segment) => segment !== null);
599
+ logLine(logger, ` ${green(target.scope, theme)} ${strategies} ${dim("—", theme)} ${summary.length > 0 ? summary.join(" · ") : dim("none", theme)}`);
600
+ }
601
+ logLine(logger);
602
+ }
603
+ function showNoPreviewCleanupCandidatesHint(logger, selection, includeAll, theme) {
604
+ if (includeAll) {
605
+ logger.warn("No preview-only resources or dedicated preview Worker scripts were discovered across the live preview scopes Devflare could resolve. This usually means those previews were already cleaned up or the remaining previews only share stable Workers and shared account resources.");
606
+ return;
607
+ }
608
+ if (!selection?.identifier) return;
609
+ if (selection.source === "environment") {
610
+ logger.warn(`No preview-only resources or dedicated preview Worker scripts matched the default "${selection.identifier}" scope. If your previews use branch-style scopes such as "next" or "pr-1", rerun with --scope <name>, use --all, or set DEVFLARE_PREVIEW_BRANCH, DEVFLARE_PREVIEW_PR, or DEVFLARE_PREVIEW_IDENTIFIER.`);
611
+ return;
612
+ }
613
+ logger.warn(`No preview-only resources or dedicated preview Worker scripts matched the resolved "${selection.identifier}" scope. This usually means that scope was already cleaned up or the preview shares stable Workers without preview.scope() resources of its own.`);
614
+ }
615
+ //#endregion
616
+ //#region src/cli/commands/previews-support/render.ts
617
+ function logWorkerFamilyHeader(logger, families, theme) {
618
+ const primaryFamily = families.find((family) => family.role === "primary") ?? families[0];
619
+ const relatedFamilies = families.filter((family) => family.role !== "primary");
620
+ logLine(logger, `${dim("worker family", theme)} ${green(primaryFamily?.baseName ?? "unknown", theme)}`);
621
+ if (relatedFamilies.length > 0) logLine(logger, `${dim("related workers", theme)} ${whiteDim(String(relatedFamilies.length), theme)}`);
622
+ logLine(logger);
623
+ }
624
+ function logSection(logger, title, records, columns, theme) {
625
+ for (const line of buildSectionLines(title, records, columns, theme)) logLine(logger, line);
626
+ }
627
+ function logLiveWorkerFamilyOverview(logger, families, workers, workersSubdomain, theme) {
628
+ const stableRows = buildStableWorkerRowsFromLiveWorkers(families, workers, workersSubdomain);
629
+ const previewScopeRows = buildPreviewScopeRowsFromLiveWorkers(families, workers, workersSubdomain);
630
+ logWorkerFamilyHeader(logger, families, theme);
631
+ logSection(logger, "Stable workers", stableRows, buildStableWorkerColumns(theme), theme);
632
+ logLine(logger);
633
+ if (previewScopeRows.length === 0) logLine(logger, dim("No dedicated preview scopes found for this worker family.", theme));
634
+ else logSection(logger, "Preview scopes", previewScopeRows, buildPreviewScopeColumns(theme), theme);
635
+ }
636
+ function buildStableWorkerColumns(theme) {
637
+ return [
638
+ {
639
+ label: "Worker",
640
+ width: 34,
641
+ value: (row) => row.workerName
642
+ },
643
+ {
644
+ label: "Role",
645
+ width: 20,
646
+ value: (row) => row.role
647
+ },
648
+ {
649
+ label: "Status",
650
+ width: 8,
651
+ value: (row) => formatOverviewStatus(row.status, theme)
652
+ },
653
+ {
654
+ label: "Updated",
655
+ width: 19,
656
+ value: (row) => whiteDim(formatRecordDate(row.updatedAt), theme)
657
+ },
658
+ {
659
+ label: "URL",
660
+ value: (row) => row.url ?? "N/A"
661
+ }
662
+ ];
663
+ }
664
+ function buildPreviewScopeColumns(theme) {
665
+ return [
666
+ {
667
+ label: "Scope",
668
+ width: 18,
669
+ value: (row) => row.scope
670
+ },
671
+ {
672
+ label: "Strategy",
673
+ width: 18,
674
+ value: (row) => row.strategy
675
+ },
676
+ {
677
+ label: "Workers",
678
+ width: 7,
679
+ value: (row) => row.workersLabel
680
+ },
681
+ {
682
+ label: "Status",
683
+ width: 10,
684
+ value: (row) => formatOverviewStatus(row.status, theme)
685
+ },
686
+ {
687
+ label: "Updated",
688
+ width: 19,
689
+ value: (row) => whiteDim(formatRecordDate(row.updatedAt), theme)
690
+ },
691
+ {
692
+ label: "Notes",
693
+ width: 30,
694
+ value: (row) => row.notes ?? dim("—", theme)
695
+ },
696
+ {
697
+ label: "Entry URL",
698
+ value: (row) => row.entryUrl ?? "N/A"
699
+ }
700
+ ];
701
+ }
702
+ function buildSectionLines(title, records, columns, theme) {
703
+ if (records.length === 0) return [];
704
+ const widths = columns.map((column) => column.width);
705
+ return [
706
+ `${title === "Preview scopes" ? cyanBold(title, theme) : title === "Stable workers" ? bold(title, theme) : yellowBold(title, theme)} ${dim(`(${records.length})`, theme)}`,
707
+ formatTableLine(columns.map((column) => dim(column.label, theme)), widths),
708
+ ...records.map((record) => formatTableLine(columns.map((column) => column.value(record)), widths))
709
+ ];
710
+ }
711
+ function showWorkerFamilyOverviewFromLiveWorkers(families, workers, workersSubdomain, logger, theme) {
712
+ logLine(logger);
713
+ logLiveWorkerFamilyOverview(logger, families, workers, workersSubdomain, theme);
714
+ logLine(logger);
715
+ logLine(logger, dim("Preview scopes are derived from live dedicated preview Worker names and the current config family.", theme));
716
+ logLine(logger, dim("Use `devflare previews cleanup --scope <name>` to delete one scope or `--all` to clean every discovered scope.", theme));
717
+ logLine(logger);
718
+ }
719
+ function showWorkspaceWorkerFamilyOverviewFromLiveWorkers(familyGroups, workers, workersSubdomain, logger, theme) {
720
+ logLine(logger);
721
+ logLine(logger, `${dim("configured worker families", theme)} ${whiteDim(String(familyGroups.length), theme)}`);
722
+ logLine(logger);
723
+ for (const [index, families] of familyGroups.entries()) {
724
+ if (index > 0) logLine(logger);
725
+ logLiveWorkerFamilyOverview(logger, families, workers, workersSubdomain, theme);
726
+ }
727
+ logLine(logger);
728
+ logLine(logger, dim("Preview scopes are derived from live dedicated preview Worker names and each discovered config family.", theme));
729
+ logLine(logger, dim("Run inside a configured package or pass `--config <path>` to narrow the summary or clean one family.", theme));
730
+ logLine(logger);
731
+ }
732
+ function buildBindingAssociationColumns(theme) {
733
+ return [
734
+ {
735
+ label: "Reference",
736
+ width: 24,
737
+ value: (row) => row.reference
738
+ },
739
+ {
740
+ label: "Type",
741
+ width: 24,
742
+ value: (row) => row.type
743
+ },
744
+ {
745
+ label: "Resource",
746
+ width: 36,
747
+ value: (row) => row.resource
748
+ },
749
+ {
750
+ label: "Workers",
751
+ width: 7,
752
+ value: (row) => String(row.workerCount)
753
+ },
754
+ {
755
+ label: "Notes",
756
+ width: 28,
757
+ value: (row) => row.notes.length > 0 ? row.notes.join(" · ") : dim("—", theme)
758
+ },
759
+ {
760
+ label: "Connected workers",
761
+ value: (row) => row.connectedWorkers.length > 0 ? row.connectedWorkers.join(", ") : dim("—", theme)
762
+ }
763
+ ];
764
+ }
765
+ function showBindingAssociations(logger, inspection, theme) {
766
+ logLine(logger);
767
+ logLine(logger, `${dim("worker family", theme)} ${green(inspection.workerName, theme)}`);
768
+ logLine(logger, `${dim("resolved targets", theme)} ${whiteDim(String(inspection.targets), theme)}`);
769
+ logLine(logger, `${dim("active deployments scanned", theme)} ${whiteDim(String(inspection.scannedWorkers.length), theme)}`);
770
+ if (inspection.rows.length === 0) {
771
+ logLine(logger);
772
+ logLine(logger, dim("No binding or resource targets were resolved from the current config.", theme));
773
+ logLine(logger);
774
+ return;
775
+ }
776
+ logLine(logger);
777
+ logSection(logger, "Bindings", inspection.rows, buildBindingAssociationColumns(theme), theme);
778
+ if (inspection.warnings.length > 0) {
779
+ logLine(logger);
780
+ for (const warning of inspection.warnings) logger.warn(warning);
781
+ }
782
+ logLine(logger);
783
+ }
784
+ //#endregion
785
+ //#region src/cli/commands/previews-support/types.ts
786
+ const PREVIEW_SUBCOMMANDS = [
787
+ "list",
788
+ "bindings",
789
+ "cleanup"
790
+ ];
791
+ //#endregion
792
+ //#region src/cli/commands/previews.ts
793
+ const CLI_API_OPTIONS = { timeout: 1e4 };
794
+ function compareConfiguredWorkerFamilies(left, right) {
795
+ if (left.role === "primary" && right.role !== "primary") return -1;
796
+ if (left.role !== "primary" && right.role === "primary") return 1;
797
+ return left.baseName.localeCompare(right.baseName);
798
+ }
799
+ function sortConfiguredWorkerFamilies(families) {
800
+ return [...families].sort(compareConfiguredWorkerFamilies);
801
+ }
802
+ function resolvePrimaryWorkerFamilyName(families) {
803
+ return families.find((family) => family.role === "primary")?.baseName ?? families[0]?.baseName;
804
+ }
805
+ function shouldReplaceConfiguredWorkerFamily(existing, candidate) {
806
+ return !existing || candidate.role === "primary" && existing.role !== "primary";
807
+ }
808
+ function mergeConfiguredWorkerFamilies(existing, candidates) {
809
+ const merged = new Map(existing.map((family) => [family.baseName, family]));
810
+ for (const candidate of candidates) if (shouldReplaceConfiguredWorkerFamily(merged.get(candidate.baseName), candidate)) merged.set(candidate.baseName, candidate);
811
+ return sortConfiguredWorkerFamilies(Array.from(merged.values()));
812
+ }
813
+ function comparePreviewConfiguredFamilyGroups(left, right) {
814
+ const leftName = resolvePrimaryWorkerFamilyName(left.families) ?? left.configPath ?? "";
815
+ const rightName = resolvePrimaryWorkerFamilyName(right.families) ?? right.configPath ?? "";
816
+ return leftName.localeCompare(rightName);
817
+ }
818
+ function upsertPreviewConfiguredFamilyGroup(groups, candidate) {
819
+ const groupKey = resolvePrimaryWorkerFamilyName(candidate.families) ?? candidate.configPath ?? `group-${groups.size}`;
820
+ const existing = groups.get(groupKey);
821
+ if (!existing) {
822
+ groups.set(groupKey, {
823
+ ...candidate,
824
+ families: sortConfiguredWorkerFamilies(candidate.families)
825
+ });
826
+ return;
827
+ }
828
+ groups.set(groupKey, {
829
+ accountId: existing.accountId ?? candidate.accountId,
830
+ configPath: existing.configPath ?? candidate.configPath,
831
+ families: mergeConfiguredWorkerFamilies(existing.families, candidate.families)
832
+ });
833
+ }
834
+ async function discoverPreviewListConfigs(cwd, configFile, environment) {
835
+ const groups = /* @__PURE__ */ new Map();
836
+ const accountIds = /* @__PURE__ */ new Set();
837
+ const loadAndCollect = async (candidateConfigFile) => {
838
+ try {
839
+ const config = await loadConfig({
840
+ cwd,
841
+ configFile: candidateConfigFile
842
+ });
843
+ const families = collectConfiguredWorkerFamilies(config, environment);
844
+ const accountId = config.accountId?.trim() || void 0;
845
+ if (accountId) accountIds.add(accountId);
846
+ upsertPreviewConfiguredFamilyGroup(groups, {
847
+ accountId,
848
+ configPath: candidateConfigFile,
849
+ families
850
+ });
851
+ return true;
852
+ } catch (error) {
853
+ if (error instanceof ConfigNotFoundError) return false;
854
+ throw error;
855
+ }
856
+ };
857
+ if (configFile) await loadAndCollect(configFile);
858
+ else if (!(await resolveConfigPath(cwd) ? await loadAndCollect() : false)) {
859
+ const configPaths = await findConfigPathsUnderDirectory(cwd);
860
+ for (const configPath of configPaths) await loadAndCollect(configPath);
861
+ }
862
+ return {
863
+ accountIds: Array.from(accountIds).sort((left, right) => left.localeCompare(right)),
864
+ familyGroups: Array.from(groups.values()).sort(comparePreviewConfiguredFamilyGroups)
865
+ };
866
+ }
867
+ function isPreviewSubcommand(value) {
868
+ return PREVIEW_SUBCOMMANDS.includes(value);
869
+ }
870
+ function resolvePreviewScopeSelection(parsed, environment) {
871
+ const explicitScope = asOptionalString(parsed.options.scope) || asOptionalString(parsed.options.identifier);
872
+ if (explicitScope) return {
873
+ identifier: resolvePreviewIdentifier({ identifier: explicitScope }).identifier,
874
+ source: "scope-option"
875
+ };
876
+ const resolved = resolvePreviewIdentifier({
877
+ environment,
878
+ env: process.env
879
+ });
880
+ return {
881
+ identifier: resolved.identifier,
882
+ source: resolved.source
883
+ };
884
+ }
885
+ function formatPreviewScopeSource(source) {
886
+ switch (source) {
887
+ case "scope-option": return "--scope";
888
+ case "identifier": return "explicit identifier";
889
+ case "env-identifier": return "DEVFLARE_PREVIEW_IDENTIFIER";
890
+ case "env-pr": return "DEVFLARE_PREVIEW_PR";
891
+ case "env-branch": return "DEVFLARE_PREVIEW_BRANCH";
892
+ case "environment": return "default preview scope";
893
+ default: return "no explicit preview scope";
894
+ }
895
+ }
896
+ function logResolvedPreviewScope(logger, selection, theme) {
897
+ if (!selection.identifier) return;
898
+ logLine(logger, `${dim("preview scope", theme)} ${green(selection.identifier, theme)} ${dim(`(${formatPreviewScopeSource(selection.source)})`, theme)}`);
899
+ logLine(logger);
900
+ }
901
+ async function loadLocalConfig(cwd, configFile, needsConfig) {
902
+ if (!needsConfig) return;
903
+ if (!configFile) {
904
+ if (!await resolveConfigPath(cwd)) return;
905
+ try {
906
+ const config = await loadConfig({ cwd });
907
+ return {
908
+ accountId: config.accountId,
909
+ name: config.name
910
+ };
911
+ } catch (error) {
912
+ if (error instanceof ConfigNotFoundError) return;
913
+ throw error;
914
+ }
915
+ }
916
+ try {
917
+ const config = await loadConfig({
918
+ cwd,
919
+ configFile
920
+ });
921
+ return {
922
+ accountId: config.accountId,
923
+ name: config.name
924
+ };
925
+ } catch (error) {
926
+ if (error instanceof ConfigNotFoundError) return;
927
+ throw error;
928
+ }
929
+ }
930
+ async function resolveAccountId(parsed, config) {
931
+ return resolveCloudflareAccountId({
932
+ explicitAccountId: asOptionalString(parsed.options.account),
933
+ configuredAccountId: config?.accountId,
934
+ apiOptions: CLI_API_OPTIONS
935
+ });
936
+ }
937
+ function resolveWorkerName(parsed, config) {
938
+ const selection = resolveNamedSelection({
939
+ explicitValue: asOptionalString(parsed.options.worker),
940
+ configuredValue: config?.name
941
+ });
942
+ return {
943
+ workerName: selection.value,
944
+ source: selection.source
945
+ };
946
+ }
947
+ async function resolveContext(parsed, options, subcommand) {
948
+ const cwd = options.cwd ?? process.cwd();
949
+ const configFile = asOptionalString(parsed.options.config);
950
+ const explicitAccountId = asOptionalString(parsed.options.account);
951
+ const environment = asOptionalString(parsed.options.env);
952
+ if (subcommand === "list") {
953
+ const listDiscovery = await discoverPreviewListConfigs(cwd, configFile, environment);
954
+ if (!explicitAccountId && listDiscovery.accountIds.length > 1) throw new Error("Multiple Cloudflare account ids were discovered across local Devflare configs. Pass --account to select one account explicitly for `devflare previews`.");
955
+ const accountId = await resolveCloudflareAccountId({
956
+ explicitAccountId,
957
+ configuredAccountId: listDiscovery.accountIds[0],
958
+ apiOptions: CLI_API_OPTIONS
959
+ });
960
+ if (!accountId) throw new Error("No Cloudflare account could be resolved. Use --account or configure accountId in devflare.config.*.");
961
+ return {
962
+ accountId,
963
+ workerName: void 0,
964
+ workerNameSource: "none",
965
+ config: void 0,
966
+ listDiscovery
967
+ };
968
+ }
969
+ const needsConfig = subcommand === "cleanup" || subcommand === "bindings" || !explicitAccountId;
970
+ const config = await loadLocalConfig(cwd, configFile, needsConfig);
971
+ if (needsConfig && !config) throw new Error("Preview commands now inspect and clean dedicated preview workers for the current package. Run inside a configured package or pass --config <path>.");
972
+ const accountId = await resolveAccountId(parsed, config);
973
+ const workerSelection = resolveWorkerName(parsed, config);
974
+ if (!accountId) throw new Error("No Cloudflare account could be resolved. Use --account or configure accountId in devflare.config.*.");
975
+ return {
976
+ accountId,
977
+ workerName: workerSelection.workerName,
978
+ workerNameSource: workerSelection.source,
979
+ config
980
+ };
981
+ }
982
+ async function runBindingsSubcommand(parsed, context, logger, options, environment, configFile, theme) {
983
+ const cwd = options.cwd ?? process.cwd();
984
+ const previewScope = resolvePreviewScopeSelection(parsed, environment);
985
+ logResolvedPreviewScope(logger, previewScope, theme);
986
+ const resolvedConfig = await loadResolvedConfig({
987
+ cwd,
988
+ configFile,
989
+ environment,
990
+ identifier: previewScope.identifier,
991
+ accountId: context.accountId
992
+ });
993
+ const deps = await getDependencies();
994
+ showBindingAssociations(logger, await inspectBindingAssociations({
995
+ accountId: context.accountId,
996
+ config: resolvedConfig,
997
+ workerName: context.workerName ?? resolvedConfig.name,
998
+ cwd,
999
+ exec: deps.exec,
1000
+ apiOptions: CLI_API_OPTIONS
1001
+ }), theme);
1002
+ return { exitCode: 0 };
1003
+ }
1004
+ async function runCleanupSubcommand(parsed, context, logger, options, environment, configFile, includeAll, theme) {
1005
+ const cwd = options.cwd ?? process.cwd();
1006
+ const resolvedEnvironment = environment ?? "preview";
1007
+ const explicitScope = asOptionalString(parsed.options.scope) || asOptionalString(parsed.options.identifier);
1008
+ if (includeAll && explicitScope) {
1009
+ logger.error("Choose either --scope <name> or --all for preview cleanup, not both.");
1010
+ return { exitCode: 1 };
1011
+ }
1012
+ const previewScope = resolvePreviewScopeSelection(parsed, resolvedEnvironment);
1013
+ const config = await loadConfig({
1014
+ cwd,
1015
+ configFile
1016
+ });
1017
+ const configuredFamilies = collectConfiguredWorkerFamilies(config, resolvedEnvironment);
1018
+ const workerCandidatesByScope = buildPreviewWorkerCandidatesByScope(configuredFamilies, await account.workers(context.accountId, CLI_API_OPTIONS));
1019
+ const cleanupTargets = includeAll ? buildPreviewCleanupTargets(workerCandidatesByScope, resolvedEnvironment) : previewScope.identifier ? [buildPreviewCleanupTarget(previewScope.identifier, workerCandidatesByScope, resolvedEnvironment)] : [];
1020
+ const cleanupRuns = includeAll ? cleanupTargets.map((target) => ({
1021
+ scope: target.scope,
1022
+ target
1023
+ })) : previewScope.identifier ? [{
1024
+ scope: previewScope.identifier,
1025
+ target: cleanupTargets[0]
1026
+ }] : [];
1027
+ const applyCleanup = parsed.options.apply === true;
1028
+ const executions = [];
1029
+ if (includeAll) logResolvedPreviewScopes(logger, cleanupTargets, theme);
1030
+ else logResolvedPreviewScope(logger, previewScope, theme);
1031
+ for (const cleanupRun of cleanupRuns) {
1032
+ if (applyCleanup) {
1033
+ const orderedWorkerNames = cleanupRun.target ? orderPreviewWorkerNamesForDeletion(cleanupRun.target.workerNames, cleanupRun.target.scope, configuredFamilies) : [];
1034
+ for (const workerName of orderedWorkerNames) await account.deleteWorker(context.accountId, workerName, CLI_API_OPTIONS);
1035
+ }
1036
+ const result = await cleanupPreviewScopedResources(config, {
1037
+ environment: resolvedEnvironment,
1038
+ identifier: cleanupRun.scope,
1039
+ accountId: context.accountId,
1040
+ apply: applyCleanup
1041
+ });
1042
+ executions.push({
1043
+ target: cleanupRun.target,
1044
+ result
1045
+ });
1046
+ }
1047
+ const totalWorkerCandidates = executions.reduce((sum, execution) => {
1048
+ return sum + (execution.target?.workerNames.length ?? 0);
1049
+ }, 0);
1050
+ const totalKvCandidates = executions.reduce((sum, execution) => sum + execution.result.candidates.kv.length, 0);
1051
+ const totalD1Candidates = executions.reduce((sum, execution) => sum + execution.result.candidates.d1.length, 0);
1052
+ const totalR2Candidates = executions.reduce((sum, execution) => sum + execution.result.candidates.r2.length, 0);
1053
+ const totalQueueCandidates = executions.reduce((sum, execution) => sum + execution.result.candidates.queues.length, 0);
1054
+ const totalVectorizeCandidates = executions.reduce((sum, execution) => sum + execution.result.candidates.vectorize.length, 0);
1055
+ const totalHyperdriveCandidates = executions.reduce((sum, execution) => sum + execution.result.candidates.hyperdrive.length, 0);
1056
+ const totalCandidates = totalWorkerCandidates + executions.reduce((sum, execution) => {
1057
+ return sum + getPreviewCleanupResourceCandidateCount(execution.result);
1058
+ }, 0);
1059
+ const scopeCountSuffix = cleanupRuns.length > 0 ? ` across ${cleanupRuns.length} preview scope${cleanupRuns.length === 1 ? "" : "s"}` : "";
1060
+ logger.success(applyCleanup ? `Deleted ${totalCandidates} preview-only cleanup candidate${totalCandidates === 1 ? "" : "s"}${scopeCountSuffix}` : `Preview cleanup dry run complete with ${totalCandidates} candidate${totalCandidates === 1 ? "" : "s"}${scopeCountSuffix}`);
1061
+ const resourceSummary = [
1062
+ totalWorkerCandidates > 0 ? `Workers ${totalWorkerCandidates}` : null,
1063
+ totalKvCandidates > 0 ? `KV ${totalKvCandidates}` : null,
1064
+ totalD1Candidates > 0 ? `D1 ${totalD1Candidates}` : null,
1065
+ totalR2Candidates > 0 ? `R2 ${totalR2Candidates}` : null,
1066
+ totalQueueCandidates > 0 ? `Queues ${totalQueueCandidates}` : null,
1067
+ totalVectorizeCandidates > 0 ? `Vectorize ${totalVectorizeCandidates}` : null,
1068
+ totalHyperdriveCandidates > 0 ? `Hyperdrive ${totalHyperdriveCandidates}` : null
1069
+ ].filter((segment) => segment !== null);
1070
+ if (resourceSummary.length > 0) logger.info(`Candidates: ${resourceSummary.join(" · ")}`);
1071
+ else {
1072
+ logger.info("Candidates: none");
1073
+ showNoPreviewCleanupCandidatesHint(logger, previewScope, includeAll, theme);
1074
+ }
1075
+ if (includeAll || executions.some((execution) => Boolean(execution.target?.workerNames.length))) logPreviewCleanupScopeBreakdown(logger, executions, theme);
1076
+ const warnings = Array.from(new Set(executions.flatMap((execution) => execution.result.warnings)));
1077
+ for (const warning of warnings) logger.warn(warning);
1078
+ return { exitCode: 0 };
1079
+ }
1080
+ async function runListSubcommand(context, logger, theme) {
1081
+ const discoveredFamilyGroups = context.listDiscovery?.familyGroups ?? [];
1082
+ if (discoveredFamilyGroups.length === 0) throw new Error("Preview listing needs a resolvable devflare config in the current package or workspace so Devflare can identify worker families.");
1083
+ const matchingFamilyGroups = discoveredFamilyGroups.filter((group) => {
1084
+ return !group.accountId || group.accountId === context.accountId;
1085
+ });
1086
+ if (matchingFamilyGroups.length === 0) throw new Error(`No configured preview worker families matched Cloudflare account ${context.accountId}. Pass --account or --config <path> to narrow the selection.`);
1087
+ const liveWorkers = await account.workers(context.accountId, CLI_API_OPTIONS);
1088
+ const workersSubdomain = await account.workersSubdomain(context.accountId, CLI_API_OPTIONS);
1089
+ if (matchingFamilyGroups.length === 1) {
1090
+ showWorkerFamilyOverviewFromLiveWorkers(matchingFamilyGroups[0].families, liveWorkers, workersSubdomain, logger, theme);
1091
+ return { exitCode: 0 };
1092
+ }
1093
+ showWorkspaceWorkerFamilyOverviewFromLiveWorkers(matchingFamilyGroups.map((group) => group.families), liveWorkers, workersSubdomain, logger, theme);
1094
+ return { exitCode: 0 };
1095
+ }
1096
+ function resolvePreviewSubcommand(rawSubcommand) {
1097
+ if (!rawSubcommand) return;
1098
+ if (isPreviewSubcommand(rawSubcommand)) return rawSubcommand;
1099
+ }
1100
+ async function runPreviewsCommand(parsed, logger, options) {
1101
+ if (!await account.isAuthenticated()) {
1102
+ logger.error("Not authenticated with Cloudflare");
1103
+ logger.info("Run `devflare login` first.");
1104
+ return { exitCode: 1 };
1105
+ }
1106
+ const rawSubcommand = parsed.args[0];
1107
+ const subcommand = resolvePreviewSubcommand(rawSubcommand) ?? "list";
1108
+ const includeAll = parsed.options.all === true;
1109
+ const theme = { useColor: shouldUseColor(parsed.options) };
1110
+ if (rawSubcommand && !resolvePreviewSubcommand(rawSubcommand)) {
1111
+ logger.error(`Unknown previews subcommand: ${rawSubcommand}`);
1112
+ logger.info(`Available previews subcommands: ${PREVIEW_SUBCOMMANDS.join(", ")}`);
1113
+ return { exitCode: 1 };
1114
+ }
1115
+ try {
1116
+ const context = await resolveContext(parsed, options, subcommand);
1117
+ const environment = asOptionalString(parsed.options.env);
1118
+ const configFile = asOptionalString(parsed.options.config);
1119
+ switch (subcommand) {
1120
+ case "bindings": return runBindingsSubcommand(parsed, context, logger, options, environment, configFile, theme);
1121
+ case "cleanup": return runCleanupSubcommand(parsed, context, logger, options, environment, configFile, includeAll, theme);
1122
+ default: return runListSubcommand(context, logger, theme);
1123
+ }
1124
+ } catch (error) {
1125
+ if (error instanceof Error) {
1126
+ logger.error(error.message);
1127
+ return { exitCode: 1 };
1128
+ }
1129
+ throw error;
1130
+ }
1131
+ }
1132
+ //#endregion
1133
+ export { runPreviewsCommand };