devflare 1.0.0-next.7 → 1.0.0-next.70

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 (632) hide show
  1. package/LICENSE +21 -0
  2. package/LLM.md +17315 -2144
  3. package/README.md +398 -607
  4. package/bin/devflare.js +30 -14
  5. package/dist/_chunks/account-BHY3fvrA.js +462 -0
  6. package/dist/_chunks/account-resources-BdKj8q1h.js +159 -0
  7. package/dist/_chunks/ai-CN_SREim.js +322 -0
  8. package/dist/_chunks/api-BKClUlUf.js +568 -0
  9. package/dist/_chunks/build-DplSo6Gc.js +24 -0
  10. package/dist/_chunks/build-artifacts-CkwCap5N.js +483 -0
  11. package/dist/_chunks/cli-ZJYtm-lW.js +1214 -0
  12. package/dist/_chunks/cloudflare-Ic5ubQza.js +157 -0
  13. package/dist/_chunks/colors-D0NVzAFN.js +13 -0
  14. package/dist/_chunks/command-utils-DjaaMQX7.js +45 -0
  15. package/dist/_chunks/compiler-UxXQgEPq.js +521 -0
  16. package/dist/_chunks/config-path-CYGlwKDs.js +42 -0
  17. package/dist/_chunks/config-zQd4jmXU.js +78 -0
  18. package/dist/_chunks/context-DGMev2AF.js +2515 -0
  19. package/dist/_chunks/decorators-eXNZ1S0N.js +19 -0
  20. package/dist/_chunks/dependencies-wKqrxKV_.js +57 -0
  21. package/dist/_chunks/deploy-z1_wbNn2.js +1032 -0
  22. package/dist/_chunks/dev-BagtFegV.js +952 -0
  23. package/dist/_chunks/doctor-CAsJ-rSZ.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-BTTpTwUk.js +143 -0
  27. package/dist/_chunks/generated-artifacts-Bb13pGUG.js +32 -0
  28. package/dist/_chunks/glob-DRw9sbfF.js +56 -0
  29. package/dist/_chunks/init-DJ5y3mu5.js +165 -0
  30. package/dist/_chunks/loader-BC0skbnH.js +1330 -0
  31. package/dist/_chunks/local-dev-vars-BFLS-HoI.js +81 -0
  32. package/dist/_chunks/local-hyperdrive-CcORzo76.js +119 -0
  33. package/dist/_chunks/local-media-bindings-ZQe-epuw.js +335 -0
  34. package/dist/_chunks/local-secrets-C0n5oRgI.js +123 -0
  35. package/dist/_chunks/login-CgNcbpEq.js +51 -0
  36. package/dist/_chunks/package-metadata-CLI488gB.js +39 -0
  37. package/dist/_chunks/preferences-CbYERA_m.js +241 -0
  38. package/dist/_chunks/preview-j9Kbx4-G.js +462 -0
  39. package/dist/_chunks/preview-registry-CTXU4mBc.js +1186 -0
  40. package/dist/_chunks/preview-resources-CQIu2-NY.js +359 -0
  41. package/dist/_chunks/previews-BIaw6NVC.js +1133 -0
  42. package/dist/_chunks/productions-CF8oQcX7.js +504 -0
  43. package/dist/_chunks/r2-presign-runtime-C75FkLMd.js +291 -0
  44. package/dist/_chunks/ref-CYJNAAe_.js +178 -0
  45. package/dist/_chunks/remote-8jEHLVGg.js +79 -0
  46. package/dist/_chunks/remote-config-Bw6qIVM4.js +132 -0
  47. package/dist/_chunks/resolve-package-DeJUGxoE.js +152 -0
  48. package/dist/_chunks/rolldown-runtime-CvQ6eiug.js +14 -0
  49. package/dist/_chunks/routes-CRXB3-iw.js +851 -0
  50. package/dist/_chunks/runtime-BlKTWIgD.js +874 -0
  51. package/dist/_chunks/schema-normalization-CTdiY17P.js +667 -0
  52. package/dist/_chunks/secrets-BJuEa9Jz.js +95 -0
  53. package/dist/_chunks/tail-DjGRt8gw.js +239 -0
  54. package/dist/_chunks/token-wmeF8-IQ.js +333 -0
  55. package/dist/_chunks/tokens-KaEr4B8e.js +221 -0
  56. package/dist/_chunks/types-BLGfxIq-.js +484 -0
  57. package/dist/_chunks/ui-BhCdDC2N.js +103 -0
  58. package/dist/_chunks/usage-rRusKejc.js +272 -0
  59. package/dist/_chunks/vite-Bml-Whp8.js +1267 -0
  60. package/dist/_chunks/vite-process-CDa3yQui.js +2929 -0
  61. package/dist/_chunks/vite-utils-D8kPPxUy.js +183 -0
  62. package/dist/_chunks/worker-DgczaXVW.js +410 -0
  63. package/dist/_chunks/worker-bundler-Isj5jiW6.js +458 -0
  64. package/dist/_chunks/worker-entrypoint-C8j23t6d.js +247 -0
  65. package/dist/_chunks/workerName-kEXwmV2m.js +23 -0
  66. package/dist/_chunks/workspace-CrvqPLTX.js +517 -0
  67. package/dist/_chunks/workspace-Ds3xMjOE.js +175 -0
  68. package/dist/bridge/client.d.ts +93 -8
  69. package/dist/bridge/client.d.ts.map +1 -1
  70. package/dist/bridge/do-rpc-dispatch.d.ts +23 -0
  71. package/dist/bridge/do-rpc-dispatch.d.ts.map +1 -0
  72. package/dist/bridge/do-websocket-connect.d.ts +33 -0
  73. package/dist/bridge/do-websocket-connect.d.ts.map +1 -0
  74. package/dist/bridge/gateway-runtime.d.ts +8 -0
  75. package/dist/bridge/gateway-runtime.d.ts.map +1 -0
  76. package/dist/bridge/index.d.ts +6 -6
  77. package/dist/bridge/index.d.ts.map +1 -1
  78. package/dist/bridge/log.d.ts +5 -0
  79. package/dist/bridge/log.d.ts.map +1 -0
  80. package/dist/bridge/miniflare-gateway.d.ts +45 -0
  81. package/dist/bridge/miniflare-gateway.d.ts.map +1 -0
  82. package/dist/bridge/miniflare.d.ts +92 -2
  83. package/dist/bridge/miniflare.d.ts.map +1 -1
  84. package/dist/bridge/proxy.d.ts +12 -11
  85. package/dist/bridge/proxy.d.ts.map +1 -1
  86. package/dist/bridge/r2-presign-runtime.d.ts +9 -0
  87. package/dist/bridge/r2-presign-runtime.d.ts.map +1 -0
  88. package/dist/bridge/server.d.ts +2 -1
  89. package/dist/bridge/server.d.ts.map +1 -1
  90. package/dist/bridge/v2/body-streams.d.ts +53 -0
  91. package/dist/bridge/v2/body-streams.d.ts.map +1 -0
  92. package/dist/bridge/v2/codec.d.ts +106 -0
  93. package/dist/bridge/v2/codec.d.ts.map +1 -0
  94. package/dist/bridge/v2/control-messages.d.ts +46 -0
  95. package/dist/bridge/v2/control-messages.d.ts.map +1 -0
  96. package/dist/bridge/v2/frames.d.ts +109 -0
  97. package/dist/bridge/v2/frames.d.ts.map +1 -0
  98. package/dist/bridge/v2/index.d.ts +11 -0
  99. package/dist/bridge/v2/index.d.ts.map +1 -0
  100. package/dist/bridge/v2/serialization.d.ts +48 -0
  101. package/dist/bridge/v2/serialization.d.ts.map +1 -0
  102. package/dist/bridge/v2/transport.d.ts +31 -0
  103. package/dist/bridge/v2/transport.d.ts.map +1 -0
  104. package/dist/bridge/v2/value-codec.d.ts +61 -0
  105. package/dist/bridge/v2/value-codec.d.ts.map +1 -0
  106. package/dist/bridge/v2/value-serialization.d.ts +139 -0
  107. package/dist/bridge/v2/value-serialization.d.ts.map +1 -0
  108. package/dist/bridge/{protocol.d.ts → v2/wire.d.ts} +32 -8
  109. package/dist/bridge/v2/wire.d.ts.map +1 -0
  110. package/dist/bridge/v2/ws-relay.d.ts +53 -0
  111. package/dist/bridge/v2/ws-relay.d.ts.map +1 -0
  112. package/dist/bridge/websocket-constructor.d.ts +38 -0
  113. package/dist/bridge/websocket-constructor.d.ts.map +1 -0
  114. package/dist/browser-shim/handler.d.ts +2 -2
  115. package/dist/browser-shim/handler.d.ts.map +1 -1
  116. package/dist/browser-shim/index.d.ts +2 -2
  117. package/dist/browser-shim/server.d.ts +63 -0
  118. package/dist/browser-shim/server.d.ts.map +1 -1
  119. package/dist/browser.d.ts +5778 -43
  120. package/dist/browser.d.ts.map +1 -1
  121. package/dist/browser.js +73 -142
  122. package/dist/bundler/defaults.d.ts +23 -0
  123. package/dist/bundler/defaults.d.ts.map +1 -0
  124. package/dist/bundler/do-bundler.d.ts +7 -0
  125. package/dist/bundler/do-bundler.d.ts.map +1 -1
  126. package/dist/bundler/index.d.ts +3 -1
  127. package/dist/bundler/index.d.ts.map +1 -1
  128. package/dist/bundler/rolldown-shared.d.ts +53 -0
  129. package/dist/bundler/rolldown-shared.d.ts.map +1 -0
  130. package/dist/bundler/worker-bundler.d.ts +13 -0
  131. package/dist/bundler/worker-bundler.d.ts.map +1 -0
  132. package/dist/bundler/worker-compat.d.ts +4 -0
  133. package/dist/bundler/worker-compat.d.ts.map +1 -0
  134. package/dist/cli/build-manifest.d.ts +66 -0
  135. package/dist/cli/build-manifest.d.ts.map +1 -0
  136. package/dist/cli/command-utils.d.ts +18 -0
  137. package/dist/cli/command-utils.d.ts.map +1 -0
  138. package/dist/cli/commands/account.d.ts +2 -2
  139. package/dist/cli/commands/account.d.ts.map +1 -1
  140. package/dist/cli/commands/ai.d.ts +1 -1
  141. package/dist/cli/commands/ai.d.ts.map +1 -1
  142. package/dist/cli/commands/build-artifacts.d.ts +40 -0
  143. package/dist/cli/commands/build-artifacts.d.ts.map +1 -0
  144. package/dist/cli/commands/build.d.ts +2 -2
  145. package/dist/cli/commands/build.d.ts.map +1 -1
  146. package/dist/cli/commands/config.d.ts +4 -0
  147. package/dist/cli/commands/config.d.ts.map +1 -0
  148. package/dist/cli/commands/deploy/metadata.d.ts +18 -0
  149. package/dist/cli/commands/deploy/metadata.d.ts.map +1 -0
  150. package/dist/cli/commands/deploy/prepare.d.ts +23 -0
  151. package/dist/cli/commands/deploy/prepare.d.ts.map +1 -0
  152. package/dist/cli/commands/deploy/runtime.d.ts +4 -0
  153. package/dist/cli/commands/deploy/runtime.d.ts.map +1 -0
  154. package/dist/cli/commands/deploy/verification.d.ts +36 -0
  155. package/dist/cli/commands/deploy/verification.d.ts.map +1 -0
  156. package/dist/cli/commands/deploy.d.ts +2 -2
  157. package/dist/cli/commands/deploy.d.ts.map +1 -1
  158. package/dist/cli/commands/dev.d.ts +9 -1
  159. package/dist/cli/commands/dev.d.ts.map +1 -1
  160. package/dist/cli/commands/doctor.d.ts +2 -2
  161. package/dist/cli/commands/doctor.d.ts.map +1 -1
  162. package/dist/cli/commands/init.d.ts +2 -2
  163. package/dist/cli/commands/init.d.ts.map +1 -1
  164. package/dist/cli/commands/login.d.ts +4 -0
  165. package/dist/cli/commands/login.d.ts.map +1 -0
  166. package/dist/cli/commands/previews-support/cleanup.d.ts +9 -0
  167. package/dist/cli/commands/previews-support/cleanup.d.ts.map +1 -0
  168. package/dist/cli/commands/previews-support/family.d.ts +10 -0
  169. package/dist/cli/commands/previews-support/family.d.ts.map +1 -0
  170. package/dist/cli/commands/previews-support/render.d.ts +8 -0
  171. package/dist/cli/commands/previews-support/render.d.ts.map +1 -0
  172. package/dist/cli/commands/previews-support/theme.d.ts +10 -0
  173. package/dist/cli/commands/previews-support/theme.d.ts.map +1 -0
  174. package/dist/cli/commands/previews-support/types.d.ts +70 -0
  175. package/dist/cli/commands/previews-support/types.d.ts.map +1 -0
  176. package/dist/cli/commands/previews.d.ts +4 -0
  177. package/dist/cli/commands/previews.d.ts.map +1 -0
  178. package/dist/cli/commands/productions.d.ts +4 -0
  179. package/dist/cli/commands/productions.d.ts.map +1 -0
  180. package/dist/cli/commands/remote.d.ts +1 -1
  181. package/dist/cli/commands/remote.d.ts.map +1 -1
  182. package/dist/cli/commands/secrets.d.ts +4 -0
  183. package/dist/cli/commands/secrets.d.ts.map +1 -0
  184. package/dist/cli/commands/tail.d.ts +44 -0
  185. package/dist/cli/commands/tail.d.ts.map +1 -0
  186. package/dist/cli/commands/token.d.ts +4 -0
  187. package/dist/cli/commands/token.d.ts.map +1 -0
  188. package/dist/cli/commands/type-generation/discovery.d.ts +7 -0
  189. package/dist/cli/commands/type-generation/discovery.d.ts.map +1 -0
  190. package/dist/cli/commands/type-generation/generator.d.ts +121 -0
  191. package/dist/cli/commands/type-generation/generator.d.ts.map +1 -0
  192. package/dist/cli/commands/type-generation/models.d.ts +27 -0
  193. package/dist/cli/commands/type-generation/models.d.ts.map +1 -0
  194. package/dist/cli/commands/types.d.ts +2 -2
  195. package/dist/cli/commands/types.d.ts.map +1 -1
  196. package/dist/cli/commands/worker.d.ts +4 -0
  197. package/dist/cli/commands/worker.d.ts.map +1 -0
  198. package/dist/cli/commands/workspace.d.ts +8 -0
  199. package/dist/cli/commands/workspace.d.ts.map +1 -0
  200. package/dist/cli/config-path.d.ts +6 -0
  201. package/dist/cli/config-path.d.ts.map +1 -0
  202. package/dist/cli/dependencies.d.ts +2 -1
  203. package/dist/cli/dependencies.d.ts.map +1 -1
  204. package/dist/cli/deploy-strategy.d.ts +17 -0
  205. package/dist/cli/deploy-strategy.d.ts.map +1 -0
  206. package/dist/cli/deploy-target.d.ts +17 -0
  207. package/dist/cli/deploy-target.d.ts.map +1 -0
  208. package/dist/cli/generated-artifacts.d.ts +12 -0
  209. package/dist/cli/generated-artifacts.d.ts.map +1 -0
  210. package/dist/cli/gradual-deploy.d.ts +49 -0
  211. package/dist/cli/gradual-deploy.d.ts.map +1 -0
  212. package/dist/cli/help-pages/pages/account.d.ts +3 -0
  213. package/dist/cli/help-pages/pages/account.d.ts.map +1 -0
  214. package/dist/cli/help-pages/pages/core.d.ts +4 -0
  215. package/dist/cli/help-pages/pages/core.d.ts.map +1 -0
  216. package/dist/cli/help-pages/pages/index.d.ts +3 -0
  217. package/dist/cli/help-pages/pages/index.d.ts.map +1 -0
  218. package/dist/cli/help-pages/pages/misc.d.ts +3 -0
  219. package/dist/cli/help-pages/pages/misc.d.ts.map +1 -0
  220. package/dist/cli/help-pages/pages/previews.d.ts +3 -0
  221. package/dist/cli/help-pages/pages/previews.d.ts.map +1 -0
  222. package/dist/cli/help-pages/pages/productions.d.ts +3 -0
  223. package/dist/cli/help-pages/pages/productions.d.ts.map +1 -0
  224. package/dist/cli/help-pages/render.d.ts +12 -0
  225. package/dist/cli/help-pages/render.d.ts.map +1 -0
  226. package/dist/cli/help-pages/shared.d.ts +15 -0
  227. package/dist/cli/help-pages/shared.d.ts.map +1 -0
  228. package/dist/cli/help-pages/types.d.ts +23 -0
  229. package/dist/cli/help-pages/types.d.ts.map +1 -0
  230. package/dist/cli/help.d.ts +6 -0
  231. package/dist/cli/help.d.ts.map +1 -0
  232. package/dist/cli/index.d.ts +1 -0
  233. package/dist/cli/index.d.ts.map +1 -1
  234. package/dist/cli/index.js +2 -0
  235. package/dist/cli/package-metadata.d.ts +16 -0
  236. package/dist/cli/package-metadata.d.ts.map +1 -0
  237. package/dist/cli/preview-bindings.d.ts +49 -0
  238. package/dist/cli/preview-bindings.d.ts.map +1 -0
  239. package/dist/cli/preview.d.ts +10 -0
  240. package/dist/cli/preview.d.ts.map +1 -0
  241. package/dist/cli/ui.d.ts +37 -0
  242. package/dist/cli/ui.d.ts.map +1 -0
  243. package/dist/cli/workspace-build-guard.d.ts +14 -0
  244. package/dist/cli/workspace-build-guard.d.ts.map +1 -0
  245. package/dist/cli/wrangler-auth.d.ts +1 -1
  246. package/dist/cloudflare/account-core.d.ts +6 -0
  247. package/dist/cloudflare/account-core.d.ts.map +1 -0
  248. package/dist/cloudflare/account-resources.d.ts +40 -0
  249. package/dist/cloudflare/account-resources.d.ts.map +1 -0
  250. package/dist/cloudflare/account-status.d.ts +11 -0
  251. package/dist/cloudflare/account-status.d.ts.map +1 -0
  252. package/dist/cloudflare/account-workers.d.ts +14 -0
  253. package/dist/cloudflare/account-workers.d.ts.map +1 -0
  254. package/dist/cloudflare/account.d.ts +7 -64
  255. package/dist/cloudflare/account.d.ts.map +1 -1
  256. package/dist/cloudflare/api.d.ts +71 -3
  257. package/dist/cloudflare/api.d.ts.map +1 -1
  258. package/dist/cloudflare/auth.d.ts +1 -1
  259. package/dist/cloudflare/auth.d.ts.map +1 -1
  260. package/dist/cloudflare/index.d.ts +61 -6
  261. package/dist/cloudflare/index.d.ts.map +1 -1
  262. package/dist/cloudflare/index.js +4 -13
  263. package/dist/cloudflare/known-permission-group-ids.generated.d.ts +10 -0
  264. package/dist/cloudflare/known-permission-group-ids.generated.d.ts.map +1 -0
  265. package/dist/cloudflare/kv-namespace.d.ts +4 -0
  266. package/dist/cloudflare/kv-namespace.d.ts.map +1 -0
  267. package/dist/cloudflare/preferences.d.ts +7 -0
  268. package/dist/cloudflare/preferences.d.ts.map +1 -1
  269. package/dist/cloudflare/preview-registry-cache.d.ts +6 -0
  270. package/dist/cloudflare/preview-registry-cache.d.ts.map +1 -0
  271. package/dist/cloudflare/preview-registry-inference.d.ts +14 -0
  272. package/dist/cloudflare/preview-registry-inference.d.ts.map +1 -0
  273. package/dist/cloudflare/preview-registry-records.d.ts +4 -0
  274. package/dist/cloudflare/preview-registry-records.d.ts.map +1 -0
  275. package/dist/cloudflare/preview-registry-shape.d.ts +47 -0
  276. package/dist/cloudflare/preview-registry-shape.d.ts.map +1 -0
  277. package/dist/cloudflare/preview-registry-store.d.ts +14 -0
  278. package/dist/cloudflare/preview-registry-store.d.ts.map +1 -0
  279. package/dist/cloudflare/preview-registry-transport.d.ts +4 -0
  280. package/dist/cloudflare/preview-registry-transport.d.ts.map +1 -0
  281. package/dist/cloudflare/preview-registry-types.d.ts +103 -0
  282. package/dist/cloudflare/preview-registry-types.d.ts.map +1 -0
  283. package/dist/cloudflare/preview-registry.d.ts +42 -0
  284. package/dist/cloudflare/preview-registry.d.ts.map +1 -0
  285. package/dist/cloudflare/preview-urls.d.ts +3 -0
  286. package/dist/cloudflare/preview-urls.d.ts.map +1 -0
  287. package/dist/cloudflare/registry-schema.d.ts +253 -0
  288. package/dist/cloudflare/registry-schema.d.ts.map +1 -0
  289. package/dist/cloudflare/remote-config.d.ts.map +1 -1
  290. package/dist/cloudflare/tokens.d.ts +44 -0
  291. package/dist/cloudflare/tokens.d.ts.map +1 -0
  292. package/dist/cloudflare/types.d.ts +124 -7
  293. package/dist/cloudflare/types.d.ts.map +1 -1
  294. package/dist/cloudflare/usage.d.ts +31 -3
  295. package/dist/cloudflare/usage.d.ts.map +1 -1
  296. package/dist/config/binding-resolution-helpers.d.ts +41 -0
  297. package/dist/config/binding-resolution-helpers.d.ts.map +1 -0
  298. package/dist/config/compatibility.d.ts +3 -0
  299. package/dist/config/compatibility.d.ts.map +1 -0
  300. package/dist/config/compiler/bindings.d.ts +14 -0
  301. package/dist/config/compiler/bindings.d.ts.map +1 -0
  302. package/dist/config/compiler/core-helpers.d.ts +6 -0
  303. package/dist/config/compiler/core-helpers.d.ts.map +1 -0
  304. package/dist/config/compiler/do-workers.d.ts +34 -0
  305. package/dist/config/compiler/do-workers.d.ts.map +1 -0
  306. package/dist/config/compiler/paths.d.ts +18 -0
  307. package/dist/config/compiler/paths.d.ts.map +1 -0
  308. package/dist/config/compiler/types.d.ts +308 -0
  309. package/dist/config/compiler/types.d.ts.map +1 -0
  310. package/dist/config/compiler.d.ts +22 -134
  311. package/dist/config/compiler.d.ts.map +1 -1
  312. package/dist/config/cron.d.ts +19 -0
  313. package/dist/config/cron.d.ts.map +1 -0
  314. package/dist/config/define.d.ts +8 -5
  315. package/dist/config/define.d.ts.map +1 -1
  316. package/dist/config/deploy-resources.d.ts +58 -0
  317. package/dist/config/deploy-resources.d.ts.map +1 -0
  318. package/dist/config/env-vars.d.ts +309 -0
  319. package/dist/config/env-vars.d.ts.map +1 -0
  320. package/dist/config/framework-providers.d.ts +9 -0
  321. package/dist/config/framework-providers.d.ts.map +1 -0
  322. package/dist/config/index.d.ts +13 -5
  323. package/dist/config/index.d.ts.map +1 -1
  324. package/dist/config/loader.d.ts +2 -1
  325. package/dist/config/loader.d.ts.map +1 -1
  326. package/dist/config/local-dev-vars.d.ts +15 -0
  327. package/dist/config/local-dev-vars.d.ts.map +1 -0
  328. package/dist/config/preview-resources.d.ts +83 -0
  329. package/dist/config/preview-resources.d.ts.map +1 -0
  330. package/dist/config/preview.d.ts +29 -0
  331. package/dist/config/preview.d.ts.map +1 -0
  332. package/dist/config/ref.d.ts +16 -25
  333. package/dist/config/ref.d.ts.map +1 -1
  334. package/dist/config/resolve-phased.d.ts +72 -0
  335. package/dist/config/resolve-phased.d.ts.map +1 -0
  336. package/dist/config/resolve.d.ts +11 -0
  337. package/dist/config/resolve.d.ts.map +1 -0
  338. package/dist/config/resource-resolution.d.ts +80 -0
  339. package/dist/config/resource-resolution.d.ts.map +1 -0
  340. package/dist/config/schema-bindings.d.ts +2124 -0
  341. package/dist/config/schema-bindings.d.ts.map +1 -0
  342. package/dist/config/schema-build.d.ts +67 -0
  343. package/dist/config/schema-build.d.ts.map +1 -0
  344. package/dist/config/schema-env.d.ts +3821 -0
  345. package/dist/config/schema-env.d.ts.map +1 -0
  346. package/dist/config/schema-normalization.d.ts +272 -0
  347. package/dist/config/schema-normalization.d.ts.map +1 -0
  348. package/dist/config/schema-runtime.d.ts +597 -0
  349. package/dist/config/schema-runtime.d.ts.map +1 -0
  350. package/dist/config/schema-types-bindings-platform.d.ts +520 -0
  351. package/dist/config/schema-types-bindings-platform.d.ts.map +1 -0
  352. package/dist/config/schema-types-bindings-resources.d.ts +802 -0
  353. package/dist/config/schema-types-bindings-resources.d.ts.map +1 -0
  354. package/dist/config/schema-types-bindings.d.ts +293 -0
  355. package/dist/config/schema-types-bindings.d.ts.map +1 -0
  356. package/dist/config/schema-types-build.d.ts +86 -0
  357. package/dist/config/schema-types-build.d.ts.map +1 -0
  358. package/dist/config/schema-types-runtime-server.d.ts +196 -0
  359. package/dist/config/schema-types-runtime-server.d.ts.map +1 -0
  360. package/dist/config/schema-types-runtime.d.ts +913 -0
  361. package/dist/config/schema-types-runtime.d.ts.map +1 -0
  362. package/dist/config/schema-types.d.ts +458 -0
  363. package/dist/config/schema-types.d.ts.map +1 -0
  364. package/dist/config/schema.d.ts +5796 -2023
  365. package/dist/config/schema.d.ts.map +1 -1
  366. package/dist/config/service-bindings-validation.d.ts +36 -0
  367. package/dist/config/service-bindings-validation.d.ts.map +1 -0
  368. package/dist/config/workspace.d.ts +282 -0
  369. package/dist/config/workspace.d.ts.map +1 -0
  370. package/dist/config-entry.d.ts +7 -0
  371. package/dist/config-entry.d.ts.map +1 -0
  372. package/dist/config-entry.js +3 -0
  373. package/dist/decorators/durable-object.d.ts.map +1 -1
  374. package/dist/decorators/index.d.ts +2 -2
  375. package/dist/decorators/index.js +2 -9
  376. package/dist/dev-server/d1-migrations.d.ts +36 -0
  377. package/dist/dev-server/d1-migrations.d.ts.map +1 -0
  378. package/dist/dev-server/dev-server-state.d.ts +59 -0
  379. package/dist/dev-server/dev-server-state.d.ts.map +1 -0
  380. package/dist/dev-server/gateway-script.d.ts +22 -0
  381. package/dist/dev-server/gateway-script.d.ts.map +1 -0
  382. package/dist/dev-server/index.d.ts +1 -1
  383. package/dist/dev-server/miniflare-bindings.d.ts +90 -0
  384. package/dist/dev-server/miniflare-bindings.d.ts.map +1 -0
  385. package/dist/dev-server/miniflare-dev-config.d.ts +57 -0
  386. package/dist/dev-server/miniflare-dev-config.d.ts.map +1 -0
  387. package/dist/dev-server/miniflare-log.d.ts +20 -0
  388. package/dist/dev-server/miniflare-log.d.ts.map +1 -0
  389. package/dist/dev-server/miniflare-worker-config.d.ts +100 -0
  390. package/dist/dev-server/miniflare-worker-config.d.ts.map +1 -0
  391. package/dist/dev-server/reload-queue.d.ts +13 -0
  392. package/dist/dev-server/reload-queue.d.ts.map +1 -0
  393. package/dist/dev-server/runtime-health.d.ts +79 -0
  394. package/dist/dev-server/runtime-health.d.ts.map +1 -0
  395. package/dist/dev-server/runtime-stdio.d.ts +8 -0
  396. package/dist/dev-server/runtime-stdio.d.ts.map +1 -0
  397. package/dist/dev-server/server-startup-helpers.d.ts +84 -0
  398. package/dist/dev-server/server-startup-helpers.d.ts.map +1 -0
  399. package/dist/dev-server/server.d.ts +2 -0
  400. package/dist/dev-server/server.d.ts.map +1 -1
  401. package/dist/dev-server/vite-process.d.ts +24 -0
  402. package/dist/dev-server/vite-process.d.ts.map +1 -0
  403. package/dist/dev-server/vite-utils.d.ts +19 -1
  404. package/dist/dev-server/vite-utils.d.ts.map +1 -1
  405. package/dist/dev-server/worker-source-watcher.d.ts +17 -0
  406. package/dist/dev-server/worker-source-watcher.d.ts.map +1 -0
  407. package/dist/dev-server/worker-surface-paths.d.ts +6 -0
  408. package/dist/dev-server/worker-surface-paths.d.ts.map +1 -0
  409. package/dist/dev-server/workspace/merge-config.d.ts +81 -0
  410. package/dist/dev-server/workspace/merge-config.d.ts.map +1 -0
  411. package/dist/dev-server/workspace/prepare-app.d.ts +84 -0
  412. package/dist/dev-server/workspace/prepare-app.d.ts.map +1 -0
  413. package/dist/dev-server/workspace/server.d.ts +47 -0
  414. package/dist/dev-server/workspace/server.d.ts.map +1 -0
  415. package/dist/env.d.ts +10 -0
  416. package/dist/env.d.ts.map +1 -1
  417. package/dist/index.d.ts +8 -12
  418. package/dist/index.d.ts.map +1 -1
  419. package/dist/index.js +10 -297
  420. package/dist/runtime/context-events.d.ts +13 -0
  421. package/dist/runtime/context-events.d.ts.map +1 -0
  422. package/dist/runtime/context-types.d.ts +82 -0
  423. package/dist/runtime/context-types.d.ts.map +1 -0
  424. package/dist/runtime/context.d.ts +20 -44
  425. package/dist/runtime/context.d.ts.map +1 -1
  426. package/dist/runtime/exports.d.ts +70 -55
  427. package/dist/runtime/exports.d.ts.map +1 -1
  428. package/dist/runtime/index.d.ts +11 -5
  429. package/dist/runtime/index.d.ts.map +1 -1
  430. package/dist/runtime/index.js +5 -184
  431. package/dist/runtime/middleware.d.ts +119 -67
  432. package/dist/runtime/middleware.d.ts.map +1 -1
  433. package/dist/runtime/r2-presign.d.ts +164 -0
  434. package/dist/runtime/r2-presign.d.ts.map +1 -0
  435. package/dist/runtime/router/index.d.ts +7 -0
  436. package/dist/runtime/router/index.d.ts.map +1 -0
  437. package/dist/runtime/router/types.d.ts +24 -0
  438. package/dist/runtime/router/types.d.ts.map +1 -0
  439. package/dist/runtime/validation.d.ts +18 -4
  440. package/dist/runtime/validation.d.ts.map +1 -1
  441. package/dist/secrets/local-secrets.d.ts +46 -0
  442. package/dist/secrets/local-secrets.d.ts.map +1 -0
  443. package/dist/shims/local-hyperdrive.d.ts +12 -0
  444. package/dist/shims/local-hyperdrive.d.ts.map +1 -0
  445. package/dist/shims/local-media-bindings.d.ts +19 -0
  446. package/dist/shims/local-media-bindings.d.ts.map +1 -0
  447. package/dist/shims/local-worker-loader.d.ts +3 -0
  448. package/dist/shims/local-worker-loader.d.ts.map +1 -0
  449. package/dist/sveltekit/index.d.ts +1 -1
  450. package/dist/sveltekit/index.d.ts.map +1 -1
  451. package/dist/sveltekit/index.js +377 -169
  452. package/dist/sveltekit/local-bindings.d.ts +4 -0
  453. package/dist/sveltekit/local-bindings.d.ts.map +1 -0
  454. package/dist/sveltekit/platform.d.ts +42 -2
  455. package/dist/sveltekit/platform.d.ts.map +1 -1
  456. package/dist/test/ai-search.d.ts +39 -0
  457. package/dist/test/ai-search.d.ts.map +1 -0
  458. package/dist/test/alarm.d.ts +55 -0
  459. package/dist/test/alarm.d.ts.map +1 -0
  460. package/dist/test/binding-hints.d.ts +10 -0
  461. package/dist/test/binding-hints.d.ts.map +1 -0
  462. package/dist/test/cf.d.ts +71 -35
  463. package/dist/test/cf.d.ts.map +1 -1
  464. package/dist/test/containers.d.ts +87 -0
  465. package/dist/test/containers.d.ts.map +1 -0
  466. package/dist/test/email.d.ts +16 -7
  467. package/dist/test/email.d.ts.map +1 -1
  468. package/dist/test/index.d.ts +20 -21
  469. package/dist/test/index.d.ts.map +1 -1
  470. package/dist/test/index.js +5115 -75
  471. package/dist/test/offline-bindings.d.ts +124 -0
  472. package/dist/test/offline-bindings.d.ts.map +1 -0
  473. package/dist/test/queue.d.ts.map +1 -1
  474. package/dist/test/remote-ai.d.ts.map +1 -1
  475. package/dist/test/remote-cloudflare.d.ts +13 -0
  476. package/dist/test/remote-cloudflare.d.ts.map +1 -0
  477. package/dist/test/remote-vectorize.d.ts.map +1 -1
  478. package/dist/test/resolve-service-bindings.d.ts +64 -4
  479. package/dist/test/resolve-service-bindings.d.ts.map +1 -1
  480. package/dist/test/scheduled.d.ts.map +1 -1
  481. package/dist/test/should-skip.d.ts +14 -18
  482. package/dist/test/should-skip.d.ts.map +1 -1
  483. package/dist/test/simple-context-bindings.d.ts +13 -0
  484. package/dist/test/simple-context-bindings.d.ts.map +1 -0
  485. package/dist/test/simple-context-durable-objects.d.ts +6 -0
  486. package/dist/test/simple-context-durable-objects.d.ts.map +1 -0
  487. package/dist/test/simple-context-env.d.ts +35 -0
  488. package/dist/test/simple-context-env.d.ts.map +1 -0
  489. package/dist/test/simple-context-gateway-script.d.ts +2 -0
  490. package/dist/test/simple-context-gateway-script.d.ts.map +1 -0
  491. package/dist/test/simple-context-handlers.d.ts +12 -0
  492. package/dist/test/simple-context-handlers.d.ts.map +1 -0
  493. package/dist/test/simple-context-lifecycle.d.ts +32 -0
  494. package/dist/test/simple-context-lifecycle.d.ts.map +1 -0
  495. package/dist/test/simple-context-mfconfig.d.ts +18 -0
  496. package/dist/test/simple-context-mfconfig.d.ts.map +1 -0
  497. package/dist/test/simple-context-multi-worker.d.ts +16 -0
  498. package/dist/test/simple-context-multi-worker.d.ts.map +1 -0
  499. package/dist/test/simple-context-paths.d.ts +40 -0
  500. package/dist/test/simple-context-paths.d.ts.map +1 -0
  501. package/dist/test/simple-context-runtime.d.ts +19 -0
  502. package/dist/test/simple-context-runtime.d.ts.map +1 -0
  503. package/dist/test/simple-context-startup.d.ts +11 -0
  504. package/dist/test/simple-context-startup.d.ts.map +1 -0
  505. package/dist/test/simple-context-transport.d.ts +14 -0
  506. package/dist/test/simple-context-transport.d.ts.map +1 -0
  507. package/dist/test/simple-context.d.ts +8 -27
  508. package/dist/test/simple-context.d.ts.map +1 -1
  509. package/dist/test/tail.d.ts +3 -2
  510. package/dist/test/tail.d.ts.map +1 -1
  511. package/dist/test/utilities/analytics-engine.d.ts +22 -0
  512. package/dist/test/utilities/analytics-engine.d.ts.map +1 -0
  513. package/dist/test/utilities/artifacts.d.ts +11 -0
  514. package/dist/test/utilities/artifacts.d.ts.map +1 -0
  515. package/dist/test/utilities/context.d.ts +39 -0
  516. package/dist/test/utilities/context.d.ts.map +1 -0
  517. package/dist/test/utilities/d1.d.ts +21 -0
  518. package/dist/test/utilities/d1.d.ts.map +1 -0
  519. package/dist/test/utilities/env.d.ts +45 -0
  520. package/dist/test/utilities/env.d.ts.map +1 -0
  521. package/dist/test/utilities/kv.d.ts +11 -0
  522. package/dist/test/utilities/kv.d.ts.map +1 -0
  523. package/dist/test/utilities/media.d.ts +16 -0
  524. package/dist/test/utilities/media.d.ts.map +1 -0
  525. package/dist/test/utilities/platform.d.ts +41 -0
  526. package/dist/test/utilities/platform.d.ts.map +1 -0
  527. package/dist/test/utilities/queue.d.ts +5 -0
  528. package/dist/test/utilities/queue.d.ts.map +1 -0
  529. package/dist/test/utilities/r2.d.ts +2 -0
  530. package/dist/test/utilities/r2.d.ts.map +1 -0
  531. package/dist/test/utilities/send-email.d.ts +27 -0
  532. package/dist/test/utilities/send-email.d.ts.map +1 -0
  533. package/dist/test/utilities/stream-flagship.d.ts +27 -0
  534. package/dist/test/utilities/stream-flagship.d.ts.map +1 -0
  535. package/dist/test/utilities/vectorize.d.ts +38 -0
  536. package/dist/test/utilities/vectorize.d.ts.map +1 -0
  537. package/dist/test/utilities/workflows.d.ts +26 -0
  538. package/dist/test/utilities/workflows.d.ts.map +1 -0
  539. package/dist/test/utilities.d.ts +14 -98
  540. package/dist/test/utilities.d.ts.map +1 -1
  541. package/dist/test/worker.d.ts +6 -0
  542. package/dist/test/worker.d.ts.map +1 -1
  543. package/dist/transform/durable-object.d.ts.map +1 -1
  544. package/dist/transform/index.d.ts +2 -2
  545. package/dist/transform/worker-entrypoint.d.ts +5 -0
  546. package/dist/transform/worker-entrypoint.d.ts.map +1 -1
  547. package/dist/utils/entrypoint-discovery.d.ts +6 -3
  548. package/dist/utils/entrypoint-discovery.d.ts.map +1 -1
  549. package/dist/utils/glob.d.ts.map +1 -1
  550. package/dist/utils/resolve-package.d.ts.map +1 -1
  551. package/dist/utils/send-email.d.ts +15 -0
  552. package/dist/utils/send-email.d.ts.map +1 -0
  553. package/dist/utils/send-email.js +163 -0
  554. package/dist/vite/config-file.d.ts +25 -0
  555. package/dist/vite/config-file.d.ts.map +1 -0
  556. package/dist/vite/index.d.ts +3 -2
  557. package/dist/vite/index.d.ts.map +1 -1
  558. package/dist/vite/index.js +2 -407
  559. package/dist/vite/plugin-config-hook.d.ts +28 -0
  560. package/dist/vite/plugin-config-hook.d.ts.map +1 -0
  561. package/dist/vite/plugin-context.d.ts +27 -0
  562. package/dist/vite/plugin-context.d.ts.map +1 -0
  563. package/dist/vite/plugin-durable-objects.d.ts +18 -0
  564. package/dist/vite/plugin-durable-objects.d.ts.map +1 -0
  565. package/dist/vite/plugin-programmatic.d.ts +44 -0
  566. package/dist/vite/plugin-programmatic.d.ts.map +1 -0
  567. package/dist/vite/plugin-service-bindings.d.ts +13 -0
  568. package/dist/vite/plugin-service-bindings.d.ts.map +1 -0
  569. package/dist/vite/plugin-transform.d.ts +41 -0
  570. package/dist/vite/plugin-transform.d.ts.map +1 -0
  571. package/dist/vite/plugin.d.ts +10 -41
  572. package/dist/vite/plugin.d.ts.map +1 -1
  573. package/dist/worker-entry/composed-worker.d.ts +5 -8
  574. package/dist/worker-entry/composed-worker.d.ts.map +1 -1
  575. package/dist/worker-entry/durable-object-discovery.d.ts +20 -0
  576. package/dist/worker-entry/durable-object-discovery.d.ts.map +1 -0
  577. package/dist/worker-entry/extensions.d.ts +5 -0
  578. package/dist/worker-entry/extensions.d.ts.map +1 -0
  579. package/dist/worker-entry/routes.d.ts +22 -0
  580. package/dist/worker-entry/routes.d.ts.map +1 -0
  581. package/dist/worker-entry/surface-paths.d.ts +26 -0
  582. package/dist/worker-entry/surface-paths.d.ts.map +1 -0
  583. package/dist/worker-entry/validate-fetch-style.d.ts +12 -0
  584. package/dist/worker-entry/validate-fetch-style.d.ts.map +1 -0
  585. package/dist/workflows/local-workflow-entrypoints.d.ts +7 -0
  586. package/dist/workflows/local-workflow-entrypoints.d.ts.map +1 -0
  587. package/package.json +160 -117
  588. package/R2.md +0 -170
  589. package/dist/account-rvrj687w.js +0 -397
  590. package/dist/ai-dx4fr9jh.js +0 -107
  591. package/dist/bridge/protocol.d.ts.map +0 -1
  592. package/dist/bridge/serialization.d.ts +0 -83
  593. package/dist/bridge/serialization.d.ts.map +0 -1
  594. package/dist/browser-shim/worker.d.ts +0 -14
  595. package/dist/browser-shim/worker.d.ts.map +0 -1
  596. package/dist/build-9myaxf07.js +0 -70
  597. package/dist/deploy-h1wz5p7m.js +0 -86
  598. package/dist/dev-rsdssknb.js +0 -2707
  599. package/dist/doctor-v7jy4s3r.js +0 -190
  600. package/dist/durable-object-t4kbb0yt.js +0 -13
  601. package/dist/index-18hvb6gb.js +0 -194
  602. package/dist/index-1xpj0m4r.js +0 -57
  603. package/dist/index-37x76zdn.js +0 -4
  604. package/dist/index-3t6rypgc.js +0 -13
  605. package/dist/index-62b3gt2g.js +0 -12
  606. package/dist/index-67qcae0f.js +0 -183
  607. package/dist/index-9ats0s83.js +0 -70
  608. package/dist/index-a0fjkq68.js +0 -198
  609. package/dist/index-a855bdsx.js +0 -18
  610. package/dist/index-ccrh4w3t.js +0 -1133
  611. package/dist/index-d8bdkx2h.js +0 -109
  612. package/dist/index-f8qh2tyh.js +0 -2152
  613. package/dist/index-gz1gndna.js +0 -307
  614. package/dist/index-hcex3rgh.js +0 -266
  615. package/dist/index-k7r18na8.js +0 -0
  616. package/dist/index-n3np2d6t.js +0 -462
  617. package/dist/index-n7rs26ft.js +0 -77
  618. package/dist/index-npc1c8jx.js +0 -44
  619. package/dist/index-p7g30wd2.js +0 -281
  620. package/dist/index-rbht7m9r.js +0 -36
  621. package/dist/index-tfyxa77h.js +0 -850
  622. package/dist/index-tk6ej9dj.js +0 -94
  623. package/dist/index-v8vvsn9x.js +0 -169
  624. package/dist/index-z14anrqp.js +0 -226
  625. package/dist/init-f9mgmew3.js +0 -186
  626. package/dist/remote-q59qk463.js +0 -97
  627. package/dist/test/bridge-context.d.ts +0 -76
  628. package/dist/test/bridge-context.d.ts.map +0 -1
  629. package/dist/test/multi-worker-context.d.ts +0 -114
  630. package/dist/test/multi-worker-context.d.ts.map +0 -1
  631. package/dist/types-wdcpnfvy.js +0 -487
  632. package/dist/worker-entrypoint-m9th0rg0.js +0 -13
package/README.md CHANGED
@@ -1,607 +1,398 @@
1
- # Devflare
2
-
3
- **Build Cloudflare Workers like an application, not a pile of glue.**
4
-
5
- Devflare is a developer-first toolkit for Cloudflare Workers built on top of Miniflare, Bun, Vite, and Wrangler-compatible configuration.
6
-
7
- It gives you:
8
-
9
- - typed config with `defineConfig()`
10
- - convention-first file discovery
11
- - local orchestration for multi-surface Worker apps
12
- - first-class Durable Object and multi-worker workflows
13
- - testing APIs that mirror real handler surfaces
14
- - browser-rendering support in local development
15
- - Vite and SvelteKit integration
16
-
17
- Miniflare gives you a local runtime.
18
-
19
- Devflare turns that runtime into a **coherent development system**.
20
-
21
- For the exhaustive package-facing guide, including caveats and deeper config semantics, see [`LLM.md`](./LLM.md).
22
-
23
- ---
24
-
25
- ## What Devflare adds
26
-
27
- Devflare does **not** replace Miniflare or Wrangler.
28
-
29
- It adds the higher-level workflow around them:
30
-
31
- - convention-first file structure
32
- - config validation and compilation
33
- - typed cross-worker references via `ref()`
34
- - unified testing helpers for `fetch`, `queue`, `scheduled`, `email`, and `tail`
35
- - bridge-backed local development where needed
36
- - framework-aware integration for Vite and SvelteKit
37
-
38
- The result is a Worker app that stays structured as it grows instead of slowly becoming a single-file boss fight.
39
-
40
- ---
41
-
42
- ## Install
43
-
44
- For the recommended full workflow, install Devflare together with Wrangler, Vite, and the Cloudflare Vite plugin:
45
-
46
- ```bash
47
- bun add -d devflare wrangler vite @cloudflare/vite-plugin
48
- ```
49
-
50
- If you only need the library APIs and not the default Vite-based workflow, you can install fewer packages. The default CLI and diagnostics are built around the Vite + Cloudflare plugin setup.
51
-
52
- ---
53
-
54
- ## Quick start
55
-
56
- ### 1. Create a config
57
-
58
- ```ts
59
- // devflare.config.ts
60
- import { defineConfig } from 'devflare'
61
-
62
- export default defineConfig({
63
- name: 'hello-worker',
64
- files: {
65
- fetch: 'src/fetch.ts'
66
- }
67
- })
68
- ```
69
-
70
- ### 2. Add a fetch handler
71
-
72
- ```ts
73
- // src/fetch.ts
74
- export default async function fetch(): Promise<Response> {
75
- return new Response('Hello from Devflare')
76
- }
77
- ```
78
-
79
- ### 3. Generate types
80
-
81
- ```bash
82
- bunx --bun devflare types
83
- ```
84
-
85
- This generates `env.d.ts` so bindings, secrets, and discovered entrypoints stay typed.
86
-
87
- ### 4. Start development
88
-
89
- ```bash
90
- bunx --bun devflare dev
91
- ```
92
-
93
- ### 5. Add a test
94
-
95
- ```ts
96
- // tests/worker.test.ts
97
- import { beforeAll, afterAll, describe, expect, test } from 'bun:test'
98
- import { createTestContext, cf } from 'devflare/test'
99
- import { env } from 'devflare'
100
-
101
- beforeAll(() => createTestContext())
102
- afterAll(() => env.dispose())
103
-
104
- describe('hello-worker', () => {
105
- test('GET / returns text', async () => {
106
- const response = await cf.worker.get('/')
107
- expect(response.status).toBe(200)
108
- expect(await response.text()).toBe('Hello from Devflare')
109
- })
110
- })
111
- ```
112
-
113
- ---
114
-
115
- ## Package entrypoints
116
-
117
- Use subpaths intentionally.
118
-
119
- | Import | Use for |
120
- |---|---|
121
- | `devflare` | main package entrypoint: config helpers, `ref()`, unified `env`, CLI helpers, bridge helpers, decorators, test helpers, `workerName` |
122
- | `devflare/runtime` | worker-safe runtime helpers like `env`, `ctx`, `event`, `locals`, `runWithContext`, plus middleware/validation/decorator utilities |
123
- | `devflare/test` | `createTestContext`, `cf.*`, mock helpers, bridge test context, skip helpers |
124
- | `devflare/vite` | Vite integration |
125
- | `devflare/sveltekit` | SvelteKit integration |
126
- | `devflare/cloudflare` | Cloudflare account/auth/usage/limits/preferences helpers |
127
- | `devflare/decorators` | decorators only |
128
-
129
- ### Important runtime note
130
-
131
- The published `devflare/runtime` subpath is intentionally smaller than the main package, but it now includes the worker-safe request-scoped runtime helpers such as `env`, `ctx`, `event`, `locals`, and `runWithContext`.
132
-
133
- Use `import { env } from 'devflare/runtime'` for request-scoped worker runtime access, or `import { env } from 'devflare'` when you specifically want the unified request/test/bridge-aware proxy.
134
-
135
- ---
136
-
137
- ## Config model
138
-
139
- ### `defineConfig()` is the source of truth
140
-
141
- Devflare works best when everything flows from `devflare.config.ts`.
142
-
143
- `defineConfig()` supports:
144
-
145
- - a plain object
146
- - a sync function
147
- - an async function
148
-
149
- It also supports a generic parameter for generated entrypoint typing.
150
-
151
- ### Config file names
152
-
153
- Devflare looks for these config filenames:
154
-
155
- - `devflare.config.ts`
156
- - `devflare.config.mts`
157
- - `devflare.config.js`
158
- - `devflare.config.mjs`
159
-
160
- ### Top-level config keys
161
-
162
- These are the main config keys Devflare understands today.
163
-
164
- | Key | What it means |
165
- |---|---|
166
- | `name` | Worker name |
167
- | `accountId` | Cloudflare account ID |
168
- | `compatibilityDate` | Workers compatibility date |
169
- | `compatibilityFlags` | Workers compatibility flags |
170
- | `files` | handler paths and discovery globs |
171
- | `bindings` | Cloudflare bindings |
172
- | `triggers` | cron triggers |
173
- | `vars` | non-secret runtime bindings |
174
- | `secrets` | secret declarations |
175
- | `routes` | deployment routes |
176
- | `wsRoutes` | local websocket-to-DO proxy rules |
177
- | `assets` | static assets config |
178
- | `limits` | worker resource limits |
179
- | `observability` | worker logs / sampling |
180
- | `migrations` | Durable Object migrations |
181
- | `build` | build-related metadata/options |
182
- | `plugins` | plugin extension point |
183
- | `env` | environment-specific overrides |
184
- | `wrangler.passthrough` | escape hatch for Wrangler fields not modeled natively |
185
-
186
- ---
187
-
188
- ## Env files, `vars`, and `secrets`
189
-
190
- This is the most important config nuance to understand.
191
-
192
- ### The short version
193
-
194
- - `loadConfig()` itself does **not** do dotenv loading
195
- - the Devflare CLI runs under **Bun**, and Bun **does** auto-load `.env` files into `process.env`
196
- - `vars` are plain config values compiled into generated Wrangler config
197
- - `secrets` declare expected runtime secret bindings, but do **not** store secret values in config
198
-
199
- ### The layers to keep separate
200
-
201
- | Thing | Used when | Good for secrets? |
202
- |---|---|---|
203
- | `process.env` | config evaluation and build tooling | only if your own process handling is secure |
204
- | `vars` | compile time and runtime | no |
205
- | `secrets` | declaration + runtime binding expectations | yes |
206
- | local runtime secret files like `.dev.vars` | local runtime | yes |
207
- | Cloudflare secret store | deployed runtime | yes |
208
-
209
- ### What this means in practice
210
-
211
- If you run the CLI normally, Bun may populate `process.env` from `.env` before `devflare.config.ts` runs.
212
-
213
- That means:
214
-
215
- - **CLI under Bun**: `.env` values are often available via `process.env`
216
- - **programmatic `loadConfig()` elsewhere**: do not assume env files were loaded unless your process already loaded them
217
-
218
- ### `vars` vs `secrets`
219
-
220
- Use `vars` for:
221
-
222
- - public base URLs
223
- - feature flags
224
- - log levels
225
- - non-secret IDs and modes
226
-
227
- Use `secrets` for:
228
-
229
- - API keys
230
- - tokens
231
- - passwords
232
- - signing secrets
233
-
234
- Current Devflare behavior matters here:
235
-
236
- - `vars` are compiled into generated configuration
237
- - `secrets` declare names and `required` status, but their values must come from a runtime secret source
238
-
239
- ### Example
240
-
241
- ```ts
242
- import { defineConfig } from 'devflare'
243
-
244
- export default defineConfig(() => ({
245
- name: 'billing-worker',
246
- vars: {
247
- PUBLIC_API_BASE: process.env.PUBLIC_API_BASE ?? 'http://localhost:5173',
248
- LOG_LEVEL: process.env.LOG_LEVEL ?? 'info'
249
- },
250
- secrets: {
251
- STRIPE_SECRET_KEY: { required: true }
252
- }
253
- }))
254
- ```
255
-
256
- ---
257
-
258
- ## Environment overrides via `config.env`
259
-
260
- `config.env` is a **Devflare merge layer**, not just a raw mirror of Wrangler environment blocks.
261
-
262
- When you select an environment with `compileConfig(config, 'name')` or CLI `--env name`, Devflare:
263
-
264
- 1. starts from the base config
265
- 2. merges `config.env[name]` into it
266
- 3. compiles the resolved result
267
-
268
- That means nested values can inherit cleanly from the base config.
269
-
270
- This is one of the biggest behavioral differences from thinking in raw Wrangler-only terms.
271
-
272
- ---
273
-
274
- ## File surfaces and routing
275
-
276
- Devflare works best when each concern lives in its own file.
277
-
278
- | File / pattern | Purpose |
279
- |---|---|
280
- | `src/fetch.ts` | HTTP requests |
281
- | `src/queue.ts` | queue consumers |
282
- | `src/scheduled.ts` | cron handlers |
283
- | `src/email.ts` | incoming email handlers |
284
- | `src/routes/**` | file-based routing |
285
- | `do.*.ts` | Durable Objects |
286
- | `ep.*.ts` | WorkerEntrypoints |
287
- | `wf.*.ts` | workflows |
288
- | `src/transport.ts` | custom serialization across boundaries |
289
-
290
- ### Do not confuse these three
291
-
292
- | Key | Meaning |
293
- |---|---|
294
- | `files.routes` | file-based HTTP routing inside your app |
295
- | top-level `routes` | Cloudflare deployment routing |
296
- | `wsRoutes` | local websocket proxying into Durable Objects during dev |
297
-
298
- Use `files.routes` when the HTTP surface is growing beyond a small `fetch.ts` handler.
299
-
300
- ---
301
-
302
- ## Bindings and multi-worker systems
303
-
304
- Devflare natively models these binding categories:
305
-
306
- - KV
307
- - D1
308
- - R2
309
- - Durable Objects
310
- - Queues
311
- - Services
312
- - AI
313
- - Vectorize
314
- - Hyperdrive
315
- - Browser Rendering
316
- - Analytics Engine
317
- - `sendEmail`
318
-
319
- ### Core examples
320
-
321
- ```ts
322
- bindings: {
323
- kv: {
324
- CACHE: 'cache-kv-id'
325
- },
326
- d1: {
327
- DB: 'db-id'
328
- },
329
- durableObjects: {
330
- COUNTER: 'Counter'
331
- },
332
- queues: {
333
- producers: {
334
- TASK_QUEUE: 'task-queue'
335
- }
336
- }
337
- }
338
- ```
339
-
340
- ### Cross-worker references with `ref()`
341
-
342
- Use `ref()` instead of hardcoding worker names and DO script names.
343
-
344
- ```ts
345
- import { defineConfig, ref } from 'devflare'
346
-
347
- const auth = ref(() => import('../auth/devflare.config'))
348
-
349
- export default defineConfig({
350
- name: 'gateway',
351
- bindings: {
352
- services: {
353
- AUTH: auth.worker,
354
- ADMIN: auth.worker('AdminEntrypoint')
355
- },
356
- durableObjects: {
357
- AUTH_CACHE: auth.AUTH_CACHE
358
- }
359
- }
360
- })
361
- ```
362
-
363
- This keeps multi-worker systems typed and centralized.
364
-
365
- ---
366
-
367
- ## Testing and remote testing
368
-
369
- ### `devflare/test`
370
-
371
- The main testing entrypoint exports:
372
-
373
- - `createTestContext`
374
- - `cf`
375
- - `email`
376
- - `queue`
377
- - `scheduled`
378
- - `worker`
379
- - `tail`
380
- - mock helpers like `createMockKV`, `createMockD1`, `createMockR2`, `createMockQueue`
381
- - bridge test helpers
382
- - skip helpers like `shouldSkip`
383
-
384
- ### Integration-style local tests
385
-
386
- Use `createTestContext()` when you want a real local environment backed by Devflare’s orchestration.
387
-
388
- `cf` gives you a unified test surface:
389
-
390
- - `cf.worker`
391
- - `cf.queue`
392
- - `cf.scheduled`
393
- - `cf.email`
394
- - `cf.tail`
395
-
396
- ### Remote-only services
397
-
398
- AI and Vectorize are remote-only in practice. Devflare does not pretend they are fully local equivalents of KV or D1.
399
-
400
- Use remote mode when you want to run tests against real Cloudflare infrastructure:
401
-
402
- ```bash
403
- bunx --bun devflare remote status
404
- bunx --bun devflare remote enable 30
405
- bunx --bun devflare remote disable
406
- ```
407
-
408
- Remote mode can also be enabled with:
409
-
410
- ```text
411
- DEVFLARE_REMOTE=1
412
- ```
413
-
414
- Remote mode is stored locally when enabled through the CLI and is intended to be temporary because it may incur real costs.
415
-
416
- ### Skip helpers
417
-
418
- Use `shouldSkip` to gate cost-sensitive or remote-only tests:
419
-
420
- ```ts
421
- import { shouldSkip } from 'devflare/test'
422
-
423
- describe.skipIf(await shouldSkip.ai)('AI tests', () => {
424
- // ...
425
- })
426
- ```
427
-
428
- The skip helpers check remote mode, authentication, account availability, and usage limits.
429
-
430
- ---
431
-
432
- ## CLI
433
-
434
- The Devflare CLI covers the full development loop.
435
-
436
- | Command | What it does |
437
- |---|---|
438
- | `devflare init` | scaffold a project |
439
- | `devflare dev` | start the unified local development server |
440
- | `devflare build` | resolve config, write `wrangler.jsonc`, run `vite build` |
441
- | `devflare deploy` | build and deploy with Wrangler |
442
- | `devflare types` | generate `env.d.ts` |
443
- | `devflare doctor` | check project configuration and common workflow prerequisites |
444
- | `devflare account` | inspect accounts, resources, usage, and limits |
445
- | `devflare ai` | show Workers AI model pricing info |
446
- | `devflare remote` | manage remote test mode |
447
-
448
- ### Useful CLI notes
449
-
450
- - `build` and `deploy` accept `--env <name>` to select `config.env[name]`
451
- - `doctor` assumes the default Vite-based Devflare workflow and checks for config, package metadata, Vite config, TypeScript config, and generated Wrangler output
452
- - `account` includes subcommands like `workers`, `kv`, `d1`, `r2`, `vectorize`, `limits`, `usage`, `global`, and `workspace`
453
-
454
- Recommended invocation style:
455
-
456
- ```bash
457
- bunx --bun devflare dev
458
- bunx --bun devflare types
459
- bunx --bun devflare build
460
- ```
461
-
462
- ---
463
-
464
- ## `devflare/cloudflare`
465
-
466
- `devflare/cloudflare` exposes the account helper API for Cloudflare-aware tooling.
467
-
468
- ```ts
469
- import { account } from 'devflare/cloudflare'
470
-
471
- const isLoggedIn = await account.isAuthenticated()
472
- const primary = await account.getPrimaryAccount()
473
- ```
474
-
475
- It includes helpers for:
476
-
477
- - authentication and Wrangler auth inspection
478
- - listing Workers, KV, D1, R2, Vectorize, and AI resources
479
- - service status
480
- - usage tracking
481
- - limit enforcement
482
- - test guardrails
483
- - global and workspace account preference management
484
-
485
- ### Account preference storage
486
-
487
- Current account preference behavior is:
488
-
489
- - workspace account: stored in nearest `package.json` as `devflare.accountId`
490
- - global default: cached locally in `~/.devflare/preferences.json` and synced via Devflare-managed Cloudflare KV when possible
491
-
492
- This matters if your repo uses multiple Cloudflare accounts or you want deterministic test behavior across machines.
493
-
494
- ---
495
-
496
- ## Generated artifacts
497
-
498
- Treat these as generated output, not source of truth:
499
-
500
- - `.devflare/`
501
- - `env.d.ts`
502
- - generated `wrangler.jsonc`
503
-
504
- The source of truth is still:
505
-
506
- - `devflare.config.ts`
507
- - your source files under `src/`
508
- - your test files
509
-
510
- ---
511
-
512
- ## Caveats and feature maturity
513
-
514
- Devflare has a broad surface area, but not every feature is equally mature.
515
-
516
- ### Strong core areas
517
-
518
- - typed config
519
- - config loading and compilation
520
- - file conventions
521
- - `vars`
522
- - Durable Objects
523
- - queues
524
- - `ref()`
525
- - testing ergonomics
526
- - unified `env`
527
- - Vite/SvelteKit integration surfaces
528
-
529
- ### Important caveats
530
-
531
- 1. **`vars` are string-only in current Devflare config**
532
- - serialize more complex values yourself if needed
533
-
534
- 2. **`secrets` are declaration-oriented**
535
- - secret values are not stored in config and are not compiled into generated Wrangler config
536
-
537
- 3. **`sendEmail` is lighter than core bindings**
538
- - it exists in the schema and examples
539
- - but it is not as fully wired as KV/D1/R2/DO/queues/services
540
-
541
- 4. **named service entrypoints need verification in generated output**
542
- - `ref().worker('Entrypoint')` is modeled at the Devflare layer
543
- - validate deployment output if named entrypoint wiring is critical to your app
544
-
545
- 5. **workflows, `build`, and `plugins` are lighter than the most central surfaces**
546
- - they exist and matter
547
- - but they are not as battle-hardened as the fetch/queue/DO/test path
548
-
549
- 6. **use `wrangler.passthrough` for unsupported native fields**
550
- - if Wrangler supports something Devflare does not model yet, passthrough is the supported escape hatch
551
-
552
- ---
553
-
554
- ## Deprecations and preferred replacements
555
-
556
- Some older APIs still exist for compatibility.
557
-
558
- | Older API | Prefer instead |
559
- |---|---|
560
- | `createMultiWorkerContext()` | `createTestContext()` |
561
- | `createEntrypointScript()` | normal worker/entrypoint file patterns |
562
- | `resolveRef()` | `ref()` |
563
- | `serviceBinding()` | `ref().worker` or `ref().worker('Entrypoint')` |
564
- | `isRemoteModeEnabled()` | `shouldSkip.*` for tests and `devflare remote ...` for mode management |
565
-
566
- ---
567
-
568
- ## A good starter layout
569
-
570
- ```text
571
- .
572
- ├── devflare.config.ts
573
- ├── env.d.ts
574
- ├── src/
575
- │ ├── fetch.ts
576
- │ ├── queue.ts
577
- │ ├── scheduled.ts
578
- │ ├── email.ts
579
- │ ├── routes/
580
- │ ├── do.counter.ts
581
- │ ├── ep.admin.ts
582
- │ ├── wf.sync.ts
583
- │ └── transport.ts
584
- └── tests/
585
- └── worker.test.ts
586
- ```
587
-
588
- Not every project needs every file, but this layout matches the Devflare mental model well.
589
-
590
- ---
591
-
592
- ## When to use Devflare
593
-
594
- Devflare is especially nice when you want:
595
-
596
- - Cloudflare Workers with clean project structure
597
- - Durable Object-heavy apps
598
- - multi-worker systems with service bindings
599
- - local-first development with realistic tests
600
- - browser rendering in your local workflow
601
- - Vite or SvelteKit apps that still want a clean Worker model
602
-
603
- ---
604
-
605
- ## In one sentence
606
-
607
- **Devflare helps you build Cloudflare Workers with clearer structure, better local tooling, and a development experience that scales with your app.**
1
+ # Devflare
2
+
3
+ Devflare is a developer-first toolkit for Cloudflare Workers. It keeps config,
4
+ runtime helpers, local development, testing, preview deploys, and Cloudflare
5
+ operations in one package without pretending Cloudflare boundaries disappear.
6
+
7
+ The docs app is the authored long-form source. This README is intentionally the
8
+ short package map: install, first Worker, import/API map, config and CLI
9
+ surface, support stances, and links into the deeper docs. `LLM.md` is generated
10
+ from the same docs model and shipped with the package for flattened reading.
11
+
12
+ ## Install
13
+
14
+ For a worker-only project, install only Devflare:
15
+
16
+ ```bash
17
+ bun add -d devflare
18
+ ```
19
+
20
+ For Vite-backed apps, add Vite. Add the Cloudflare Vite plugin only when your
21
+ own `vite.config.*` calls it directly:
22
+
23
+ ```bash
24
+ bun add -d devflare vite
25
+ ```
26
+
27
+ Assumptions used by the examples: Wrangler 4, Miniflare 4,
28
+ `@cloudflare/workers-types` 4, Bun 1.1+, and Node 20+.
29
+
30
+ ## Cloudflare toolchain support
31
+
32
+ Devflare targets Wrangler 4, Miniflare 4, and @cloudflare/workers-types 4.
33
+ Devflare does not support Wrangler 3 in new projects. The package manifest pins
34
+ the exact ranges that scaffolds, local runtime behavior, and generated types
35
+ are validated against in CI.
36
+
37
+ ## Quick Start
38
+
39
+ Create a config:
40
+
41
+ ```ts
42
+ // devflare.config.ts
43
+ import { defineConfig } from 'devflare/config'
44
+
45
+ export default defineConfig({
46
+ name: 'hello-worker',
47
+ compatibilityDate: '2026-03-17',
48
+ files: {
49
+ fetch: 'src/fetch.ts'
50
+ }
51
+ })
52
+ ```
53
+
54
+ Add a fetch handler:
55
+
56
+ ```ts
57
+ // src/fetch.ts
58
+ import type { FetchEvent } from 'devflare/runtime'
59
+
60
+ export async function fetch(_event: FetchEvent): Promise<Response> {
61
+ return new Response('Hello from Devflare')
62
+ }
63
+ ```
64
+
65
+ Generate types and start local dev:
66
+
67
+ ```bash
68
+ bunx --bun devflare types
69
+ bunx --bun devflare dev
70
+ ```
71
+
72
+ Add the first runtime-shaped test:
73
+
74
+ ```ts
75
+ // tests/worker.test.ts
76
+ import { afterAll, beforeAll, expect, test } from 'bun:test'
77
+ import { cf, createTestContext, env } from 'devflare/test'
78
+
79
+ beforeAll(() => createTestContext())
80
+ afterAll(() => env.dispose())
81
+
82
+ test('GET / returns text', async () => {
83
+ const response = await cf.worker.get('/')
84
+
85
+ expect(response.status).toBe(200)
86
+ expect(await response.text()).toBe('Hello from Devflare')
87
+ })
88
+ ```
89
+
90
+ Run it:
91
+
92
+ ```bash
93
+ bun test tests/worker.test.ts
94
+ ```
95
+
96
+ ## Choose Your Next Path
97
+
98
+ | Need | Open |
99
+ | --- | --- |
100
+ | Add route files | `/docs/first-route-tree`, then `/docs/http-routing` |
101
+ | Add one binding | `/docs/first-bindings`, then `/docs/storage-bindings` |
102
+ | Pick a test helper | `/docs/test-helper-reference` |
103
+ | Deploy safely | `/docs/deploy-command-recipes` |
104
+ | Check support stance | `/docs/feature-index` |
105
+ | Copy a larger example | `cases/README.md` |
106
+
107
+ ## Package Entrypoints
108
+
109
+ | Import | Use |
110
+ | --- | --- |
111
+ | `devflare` | Node-side utilities: `defineConfig`, `defineWorkspace`, `preview`, `loadConfig`, `loadResolvedConfig`, `compileConfig`, `stringifyConfig`, `configSchema`, `ConfigNotFoundError`, `ConfigValidationError`, `ConfigResourceResolutionError`, `ref()`, `workerName`, `env`, `vars`, `durableObject`, `getDurableObjectOptions`, `runCli`, `parseArgs` |
112
+ | `devflare/config` | Lightweight config-authoring entry (no CLI/bridge/test barrel): `defineConfig`, `env`, `preview`, `ref`, plus the config types. The full Node-side compiler and normalizer helpers live on the bare devflare import instead. |
113
+ | `devflare/runtime` | Worker-safe runtime helpers: `env`, `ctx`, `event`, `locals`, `sequence`, `defineFetchHandler`, `defineQueueHandler`, `defineScheduledHandler`, `markResolveStyle`, `markWorkerStyle`, `createResolveFetch`, `invokeFetchHandler`, `invokeFetchModule`, `matchFetchRoute`, `invokeRouteModules`, `createRouteResolve`, event creators and getters |
114
+ | `devflare/test` | Testing helpers: `createTestContext`, `env`, `cf`, `worker`, `queue`, `scheduled`, `email`, `tail`, `shouldSkip`, `createOfflineEnv`, `createOfflineBindings`, `describeOfflineSupport`, `getOfflineSupportMatrix`, `containers`, `detectContainerEngine`, `getContainerSkipReason`, `stopActiveContainers`, `createMockEnv`, `createMockKV`, `createMockD1`, `createMockR2`, `createMockQueue`, `createMockRateLimit`, `createMockVersionMetadata`, `createMockHyperdrive`, `createMockWorkerLoader`, `createMockMTLSCertificate`, `createMockDispatchNamespace`, `createMockWorkflow`, `createMockPipeline`, `createMockImagesBinding`, `createMockMediaBinding`, `createMockArtifacts`, `createMockAISearchInstance`, `createMockAISearchNamespace`, `createMockTestContext`, `withTestContext`, `resolveServiceBindings`, `resolveDOBindings`, `clearBundleCache` |
115
+ | `devflare/vite` | Vite integration: `devflarePlugin`, `getCloudflareConfig`, `getDevflareConfigs`, `getPluginContext`, `hasInlineViteConfig`, `resolveEffectiveViteProject`, `resolveViteUserConfig`, `writeGeneratedViteConfig` |
116
+ | `devflare/sveltekit` | SvelteKit integration: `createDevflarePlatform`, `createHandle`, `handle`, `getBridgePort`, `isDevflareDev`, `resetPlatform`, `resetConfigCache` |
117
+ | `devflare/cloudflare` | Cloudflare account and preview registry helpers: `account`, `ensurePreviewRegistry`, `cleanupPreviewRegistry`, `getPreviewRegistryContext`, `listTrackedRegistryState`, `listTrackedPreviewRecords`, `listTrackedPreviewScopeRecords`, `listTrackedDeploymentRecords`, `reconcilePreviewRegistry`, `retirePreviewRegistry` |
118
+ | `devflare/decorators` | Durable Object decorators: `durableObject`, `getDurableObjectOptions` |
119
+
120
+ Runtime import rule of thumb:
121
+
122
+ - Use `devflare/config` in config files.
123
+ - Use `devflare/runtime` in Worker code.
124
+ - Use `devflare/test` in tests.
125
+ - Use `devflare/vite` in a Vite project; it re-exports Vite's `Plugin`/`ConfigEnv`/`UserConfig` types, so type-checking it needs `vite` (an optional peer) installed.
126
+ - Use bare `devflare` for Node-side package tooling and the unified env proxy only when that is intentional.
127
+
128
+ The authoritative frozen-entrypoint list and the stability guarantee on it live
129
+ in [API Stability Policy](https://github.com/Refzlund/devflare/blob/next/docs/API_STABILITY.md);
130
+ the semver, prerelease lane, and release mechanics live in
131
+ [Versioning & Release Policy](https://github.com/Refzlund/devflare/blob/next/docs/VERSIONING_AND_RELEASE.md).
132
+
133
+ ## Config Map
134
+
135
+ The most important top-level keys are:
136
+
137
+ - `accountId`
138
+ - `assets`
139
+ - `baseDir`
140
+ - `bindings`
141
+ - `compatibilityDate`
142
+ - `compatibilityFlags`
143
+ - `complianceRegion`
144
+ - `containers`
145
+ - `env`
146
+ - `files`
147
+ - `findAdditionalModules`
148
+ - `keepVars`
149
+ - `limits`
150
+ - `logpush`
151
+ - `migrations`
152
+ - `name`
153
+ - `observability`
154
+ - `placement`
155
+ - `preserveFileNames`
156
+ - `previews`
157
+ - `rolldown`
158
+ - `routes`
159
+ - `rules`
160
+ - `secrets`
161
+ - `secretsStoreId`
162
+ - `server`
163
+ - `streamingTailConsumers`
164
+ - `tailConsumers`
165
+ - `triggers`
166
+ - `uploadSourceMaps`
167
+ - `vars`
168
+ - `vite`
169
+ - `workersDev`
170
+ - `wrangler.passthrough`
171
+ - `wsRoutes`
172
+
173
+ Open `/docs/full-config`, `/docs/config-basics`, and `/docs/generated-types`
174
+ for examples with file paths.
175
+
176
+ ## CLI
177
+
178
+ | Command | Use |
179
+ | --- | --- |
180
+ | `devflare account` | inspect Cloudflare account resources, limits, and usage |
181
+ | `devflare ai` | inspect Workers AI model pricing information |
182
+ | `devflare build` | generate deploy-ready local artifacts |
183
+ | `devflare config` | print resolved Devflare or Wrangler-facing config |
184
+ | `devflare deploy` | deploy explicitly to production or preview |
185
+ | `devflare dev` | start local development |
186
+ | `devflare doctor` | inspect local project health |
187
+ | `devflare help` | print help for root or nested commands |
188
+ | `devflare init` | scaffold a starter project |
189
+ | `devflare login` | authenticate through Wrangler |
190
+ | `devflare previews` | inspect and clean preview scopes |
191
+ | `devflare productions` | inspect or manage production Worker versions |
192
+ | `devflare remote` | manage remote test mode |
193
+ | `devflare secrets` | manage local Secrets Store values |
194
+ | `devflare tail` | stream live logs from a deployed Worker |
195
+ | `devflare tokens` | create and manage Devflare-scoped API tokens |
196
+ | `devflare types` | generate `env.d.ts` |
197
+ | `devflare version` | print the installed version |
198
+ | `devflare worker` | run Worker control-plane helpers |
199
+ | `devflare workspace` | run several apps in one Miniflare with shared live bindings |
200
+
201
+ Useful local-first switches:
202
+
203
+ - `devflare dev --runtime-port 8788` or `DEVFLARE_RUNTIME_PORT=8788` moves the local Miniflare runtime/bridge off the default `127.0.0.1:8787`. `--bridge-port` and `DEVFLARE_BRIDGE_PORT` are aliases for the same runtime port.
204
+ - `devflare doctor --scope local` skips deploy-readiness artifact warnings during a local-only loop.
205
+ - `devflare config --phase local --format wrangler` prints the local-runtime Wrangler shape without Cloudflare account resource lookups.
206
+ - `devflare dev` and `devflare/vite` start `ref()` service-binding workers inside the same local runtime, including their local KV, D1, R2, Queue producer/consumer, vars, Durable Objects, and other Miniflare-backed bindings.
207
+
208
+ ## Support Stance Index
209
+
210
+ The full support matrix is in `/docs/feature-index`. The short version is:
211
+ offline-first when deterministic local behavior is meaningful, remote-gated
212
+ when Cloudflare owns the product behavior, and explicit skip helpers when CI
213
+ cannot safely run the dependency.
214
+
215
+ ### AutoRAG migration stance
216
+
217
+ AutoRAG is documented under AI Search. The previous `env.AI.autorag()` binding
218
+ shape should move to native AI Search config. Use `bindings.aiSearchNamespaces`
219
+ or `bindings.aiSearch` so the binding is visible in config, generated types,
220
+ and tests.
221
+
222
+ ### AI Gateway binding methods
223
+
224
+ AI Gateway does not use a separate Wrangler binding. It is a method surface on
225
+ Workers AI: `env.AI.gateway(id)` exposes `patchLog()`, `getLog()`, `getUrl()`,
226
+ and `run()`.
227
+
228
+ ### Browser Run product boundary
229
+
230
+ Browser Run is the current product name for Browser Rendering. Devflare runs a
231
+ local browser-rendering shim for the ordinary dev and test loop, but Devflare
232
+ does not manage Live View URLs, Human in the Loop handoff, recordings, browser
233
+ session storage, or Browser Run account-level product state.
234
+
235
+ ### Containers local testing
236
+
237
+ Devflare supports native top-level `containers` config and local container
238
+ testing helpers. Containers have full local support when Docker or Podman is
239
+ available: Devflare can build local Dockerfile paths, run prebuilt image tags,
240
+ and interact with instances through fetch, logs, state, stop, and cleanup
241
+ helpers. Devflare container tests are offline-first by default when the image
242
+ already exists locally or the Dockerfile can build from cached layers. Set
243
+ `DEVFLARE_CONTAINER_TESTS=1` for container lanes, and gate them with
244
+ `shouldSkip.containers` because GitHub Actions or Cloudflare runners may not
245
+ have Docker/Podman. Cloudflare still owns the deployed Containers control plane,
246
+ managed registry rollout, SSH, scaling, and hosted platform behavior.
247
+
248
+ ### Cloudflare Builds stance
249
+
250
+ Cloudflare Builds is CI/CD orchestration, not a Worker runtime binding.
251
+ Devflare does not connect Git repositories, manage build hooks, own Cloudflare
252
+ Builds project settings, or replace GitHub Actions workflows.
253
+
254
+ ### Workers for Platforms lifecycle stance
255
+
256
+ Devflare supports dispatch namespace bindings, not the tenant Worker control
257
+ plane. Devflare does not upload user Workers, manage Worker metadata, own tenant
258
+ routing policy, or provide the Workers for Platforms lifecycle API.
259
+
260
+ ### Hyperdrive local connection stance
261
+
262
+ Hyperdrive has full local support when a binding has a local database connection
263
+ string. Devflare passes `localConnectionString` or
264
+ `CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_<BINDING>` into Miniflare and
265
+ also exposes `createMockHyperdrive()` for pure tests. Cloudflare still owns
266
+ hosted pooling, placement, production credentials, and account state.
267
+
268
+ ### Worker Loaders local payload stance
269
+
270
+ Worker Loaders have full local support through Miniflare worker loader bindings
271
+ and explicit pure-test stubs. Devflare does not upload, discover, or lifecycle
272
+ manage hosted dynamic Worker payloads.
273
+
274
+ ### Secrets Store local values stance
275
+
276
+ Secrets Store has full local support through Miniflare wiring, local
277
+ `devflare secrets --local` values, and explicit fixture values in
278
+ `createOfflineEnv()` or `createMockSecretsStoreSecret()`. The local runtime is
279
+ read-only from Worker code: write values through the CLI, keep config to store
280
+ IDs and secret names, and let dev/test runs seed Miniflare from
281
+ `.devflare/secrets.local.json`. Devflare does not read, provision, or sync
282
+ remote account secret values.
283
+
284
+ ### Workflows local simulation stance
285
+
286
+ Workflows have full local support through Miniflare wiring, WorkflowEntrypoint
287
+ examples, and deterministic pure mocks. Use deployed or Wrangler-backed tests
288
+ for production Workflow lifecycle behavior, retries, durability, and platform
289
+ scheduling.
290
+
291
+ ### Pipelines source and sink lifecycle stance
292
+
293
+ Pipelines local tests are useful for producer-code assertions. Devflare does not
294
+ create streams, pipelines, SQL transformations, sinks, or R2 buckets for the
295
+ deployed product lifecycle.
296
+
297
+ ### Images transformation testability stance
298
+
299
+ Images have full local support for Worker transformation flows through
300
+ Miniflare wiring and deterministic pure mocks. Devflare does not provision
301
+ hosted Images storage, variants, signed URLs, or custom delivery rules.
302
+
303
+ ### Media Transformations local shim stance
304
+
305
+ Media Transformations have full local support for Worker call chains through
306
+ Miniflare wiring and deterministic pure mocks. Devflare does not configure
307
+ zone-level transformation enablement, source origins, signed URL policy, cache
308
+ behavior, or billing controls.
309
+
310
+ ### Artifacts persistence and deployment stance
311
+
312
+ Artifacts pure mocks are in-memory and process-local. Devflare does not create
313
+ Artifacts namespaces, persist local Git repositories, or emulate Git-over-HTTPS
314
+ remotes.
315
+
316
+ ### Preview resource lifecycle policy
317
+
318
+ Devflare preview provisioning is intentionally limited to KV, D1, R2, Queues,
319
+ Vectorize, and the documented Hyperdrive reuse/resolve paths. Preview cleanup
320
+ does not delete Workflows, Pipelines, Images, Media Transformations, Artifacts,
321
+ AI Search, AI Gateway, Browser Run, Containers, Secrets Store, mTLS
322
+ certificates, or dispatch namespace resources.
323
+
324
+ ### Cross-feature implementation decisions
325
+
326
+ Remote mode decisions are per feature, not global. Generated types are emitted
327
+ only for native binding keys. Test helpers exist when Devflare provides a
328
+ deterministic local mock or useful pure assertion surface. Every native binding
329
+ documented above includes a minimal config and Env usage example. Move from
330
+ `wrangler.passthrough` to native config when a binding appears in the native
331
+ list. Cloudflare dependency CI targets the pinned current Wrangler, Miniflare,
332
+ and workers-types majors documented in Cloudflare toolchain support.
333
+
334
+ ### Offline-first testing support matrix
335
+
336
+ `createOfflineEnv(config, fixtures)` derives a deterministic pure-test `env`
337
+ from Devflare config. Offline-native means Devflare or Miniflare can run a
338
+ useful local simulator. Offline-fixture means Devflare provides an explicit
339
+ in-memory or handler-backed mock. Remote-boundary means meaningful behavior
340
+ lives in Cloudflare.
341
+
342
+ Use `shouldSkip.aiSearch`, `shouldSkip.aiGateway`,
343
+ `shouldSkip.mtlsCertificates`, `shouldSkip.artifacts`, and `shouldSkip.builds`
344
+ for remote-boundary lanes. Offline-first tests should not claim to cover real
345
+ Workers AI inference, Vectorize search semantics, AI Search indexing/ranking/
346
+ crawling, final Media Transformations codec fidelity, mTLS certificate
347
+ presentation, Artifacts Git remotes, Browser Run live/HITL/recordings,
348
+ Cloudflare Builds, or the deployed Containers control plane.
349
+
350
+ ## Machine-Checked Support Statements
351
+
352
+ These statements are intentionally exact because the docs tests use them as
353
+ public stance guards:
354
+
355
+ - Use `bindings.aiSearchNamespaces` or `bindings.aiSearch`.
356
+ - `env.AI.gateway(id)` exposes `patchLog()`, `getLog()`, `getUrl()`, and `run()`.
357
+ - Devflare does not manage Live View URLs, Human in the Loop handoff.
358
+ - Set `DEVFLARE_CONTAINER_TESTS=1`.
359
+ - Containers have full local support when Docker or Podman is available.
360
+ - Cloudflare still owns the deployed Containers control plane.
361
+ - Devflare does not connect Git repositories, manage build hooks.
362
+ - Devflare supports dispatch namespace bindings, not the tenant Worker control plane.
363
+ - Devflare does not upload user Workers, manage Worker metadata.
364
+ - Hyperdrive has full local support when a binding has a local database connection string.
365
+ - Worker Loaders have full local support through Miniflare worker loader bindings.
366
+ - Secrets Store has full local support through Miniflare wiring, local `devflare secrets --local` values, and explicit fixture values.
367
+ - Workflows have full local support through Miniflare wiring.
368
+ - Use deployed or Wrangler-backed tests for production Workflow lifecycle behavior.
369
+ - Devflare does not create streams, pipelines, SQL transformations, sinks, or R2 buckets.
370
+ - Images have full local support for Worker transformation flows.
371
+ - Devflare does not provision hosted Images storage, variants, signed URLs, or custom delivery rules.
372
+ - Media Transformations have full local support for Worker call chains.
373
+ - Devflare does not configure zone-level transformation enablement, source origins, signed URL policy, cache behavior, or billing controls.
374
+ - Devflare does not create Artifacts namespaces, persist local Git repositories, or emulate Git-over-HTTPS remotes.
375
+ - Devflare preview provisioning is intentionally limited to KV, D1, R2, Queues, Vectorize, and the documented Hyperdrive reuse/resolve paths.
376
+ - Preview cleanup does not delete Workflows, Pipelines, Images, Media Transformations, Artifacts, AI Search, AI Gateway, Browser Run, Containers, Secrets Store, mTLS certificates, or dispatch namespace resources.
377
+ - Generated types are emitted only for native binding keys.
378
+ - Test helpers exist when Devflare provides a deterministic local mock or useful pure assertion surface.
379
+ - Every native binding documented above includes a minimal config and Env usage example.
380
+ - Move from `wrangler.passthrough` to native config when a binding appears in the native list.
381
+ - Cloudflare dependency CI targets the pinned current Wrangler, Miniflare, and workers-types majors documented in Cloudflare toolchain support.
382
+ - `createOfflineEnv(config, fixtures)` derives a deterministic pure-test `env` from Devflare config.
383
+ - Offline-native means Devflare or Miniflare can run a useful local simulator.
384
+ - Offline-fixture means Devflare provides an explicit in-memory or handler-backed mock.
385
+ - Remote-boundary means meaningful behavior lives in Cloudflare.
386
+ - `shouldSkip.aiSearch`, `shouldSkip.aiGateway`, `shouldSkip.mtlsCertificates`, `shouldSkip.artifacts`, and `shouldSkip.builds`.
387
+ - real Workers AI inference, Vectorize search semantics, AI Search indexing/ranking/crawling, final Media Transformations codec fidelity, mTLS certificate presentation, Artifacts Git remotes, Browser Run live/HITL/recordings, Cloudflare Builds, or the deployed Containers control plane.
388
+
389
+ ## Verification
390
+
391
+ Docs and README drift are covered by:
392
+
393
+ ```bash
394
+ bun run devflare:docs-integrity
395
+ ```
396
+
397
+ The package publish path regenerates `packages/devflare/LLM.md` from the docs
398
+ model through `bun run --cwd packages/devflare llm:generate`.