devflare 1.0.0-next.19 → 1.0.0-next.20

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 (360) hide show
  1. package/LLM.md +6807 -888
  2. package/README.md +375 -957
  3. package/dist/account-05zgta47.js +475 -0
  4. package/dist/account-b2ag1esh.js +475 -0
  5. package/dist/account-bxtcz61a.js +475 -0
  6. package/dist/account-gyfqg964.js +475 -0
  7. package/dist/account-q6pvs9d9.js +475 -0
  8. package/dist/account-rp4zbvw1.js +475 -0
  9. package/dist/bridge/client.d.ts +5 -0
  10. package/dist/bridge/client.d.ts.map +1 -1
  11. package/dist/bridge/gateway-runtime.d.ts +1 -1
  12. package/dist/bridge/gateway-runtime.d.ts.map +1 -1
  13. package/dist/bridge/miniflare.d.ts +67 -0
  14. package/dist/bridge/miniflare.d.ts.map +1 -1
  15. package/dist/bridge/proxy.d.ts +2 -1
  16. package/dist/bridge/proxy.d.ts.map +1 -1
  17. package/dist/bridge/server.d.ts.map +1 -1
  18. package/dist/browser.d.ts +2520 -40
  19. package/dist/browser.d.ts.map +1 -1
  20. package/dist/browser.js +3 -3
  21. package/dist/build-2s5paw5p.js +54 -0
  22. package/dist/build-4c350cp7.js +54 -0
  23. package/dist/build-e7wym63t.js +54 -0
  24. package/dist/build-ge6qp3t4.js +54 -0
  25. package/dist/build-ta8c6t11.js +54 -0
  26. package/dist/build-wvjj8f28.js +54 -0
  27. package/dist/build-ypg6f2kw.js +54 -0
  28. package/dist/build-yts8wwgf.js +54 -0
  29. package/dist/build-yzkdqexs.js +54 -0
  30. package/dist/cli/build-manifest.d.ts +12 -0
  31. package/dist/cli/build-manifest.d.ts.map +1 -1
  32. package/dist/cli/commands/deploy/metadata.d.ts +18 -0
  33. package/dist/cli/commands/deploy/metadata.d.ts.map +1 -0
  34. package/dist/cli/commands/deploy/prepare.d.ts +23 -0
  35. package/dist/cli/commands/deploy/prepare.d.ts.map +1 -0
  36. package/dist/cli/commands/deploy/runtime.d.ts +4 -0
  37. package/dist/cli/commands/deploy/runtime.d.ts.map +1 -0
  38. package/dist/cli/commands/deploy/verification.d.ts +36 -0
  39. package/dist/cli/commands/deploy/verification.d.ts.map +1 -0
  40. package/dist/cli/commands/deploy.d.ts +2 -2
  41. package/dist/cli/commands/deploy.d.ts.map +1 -1
  42. package/dist/cli/commands/secrets.d.ts +4 -0
  43. package/dist/cli/commands/secrets.d.ts.map +1 -0
  44. package/dist/cli/commands/type-generation/generator.d.ts +67 -1
  45. package/dist/cli/commands/type-generation/generator.d.ts.map +1 -1
  46. package/dist/cli/help-pages/pages/core.d.ts +1 -1
  47. package/dist/cli/help-pages/pages/core.d.ts.map +1 -1
  48. package/dist/cli/help-pages/shared.d.ts +1 -1
  49. package/dist/cli/help-pages/shared.d.ts.map +1 -1
  50. package/dist/cli/index.d.ts.map +1 -1
  51. package/dist/cli/index.js +2 -2
  52. package/dist/cli/package-metadata.d.ts.map +1 -1
  53. package/dist/cli/preview-bindings.d.ts.map +1 -1
  54. package/dist/cloudflare/index.js +2 -2
  55. package/dist/cloudflare/preview-registry-store.d.ts +1 -1
  56. package/dist/cloudflare/preview-registry-store.d.ts.map +1 -1
  57. package/dist/cloudflare/types.d.ts +1 -1
  58. package/dist/cloudflare/types.d.ts.map +1 -1
  59. package/dist/config/binding-resolution-helpers.d.ts +5 -0
  60. package/dist/config/binding-resolution-helpers.d.ts.map +1 -1
  61. package/dist/config/compiler/bindings.d.ts +14 -0
  62. package/dist/config/compiler/bindings.d.ts.map +1 -0
  63. package/dist/config/compiler/core-helpers.d.ts +6 -0
  64. package/dist/config/compiler/core-helpers.d.ts.map +1 -0
  65. package/dist/config/compiler/do-workers.d.ts +34 -0
  66. package/dist/config/compiler/do-workers.d.ts.map +1 -0
  67. package/dist/config/compiler/paths.d.ts +18 -0
  68. package/dist/config/compiler/paths.d.ts.map +1 -0
  69. package/dist/config/compiler/types.d.ts +267 -0
  70. package/dist/config/compiler/types.d.ts.map +1 -0
  71. package/dist/config/compiler.d.ts +11 -175
  72. package/dist/config/compiler.d.ts.map +1 -1
  73. package/dist/config/deploy-resources.d.ts.map +1 -1
  74. package/dist/config/index.d.ts +1 -1
  75. package/dist/config/index.d.ts.map +1 -1
  76. package/dist/config/local-dev-vars.d.ts +15 -0
  77. package/dist/config/local-dev-vars.d.ts.map +1 -0
  78. package/dist/config/preview-resources.d.ts.map +1 -1
  79. package/dist/config/preview.d.ts.map +1 -1
  80. package/dist/config/resolve.d.ts.map +1 -1
  81. package/dist/config/resource-resolution.d.ts.map +1 -1
  82. package/dist/config/schema-bindings.d.ts +559 -19
  83. package/dist/config/schema-bindings.d.ts.map +1 -1
  84. package/dist/config/schema-env.d.ts +1306 -34
  85. package/dist/config/schema-env.d.ts.map +1 -1
  86. package/dist/config/schema-normalization.d.ts +97 -1
  87. package/dist/config/schema-normalization.d.ts.map +1 -1
  88. package/dist/config/schema-runtime.d.ts +245 -7
  89. package/dist/config/schema-runtime.d.ts.map +1 -1
  90. package/dist/config/schema.d.ts +2976 -57
  91. package/dist/config/schema.d.ts.map +1 -1
  92. package/dist/config-6m0n7d84.js +59 -0
  93. package/dist/config-7cf004ag.js +59 -0
  94. package/dist/config-b98dp58n.js +59 -0
  95. package/dist/config-cf3djhqy.js +59 -0
  96. package/dist/config-entry.js +1 -1
  97. package/dist/config-wa7hm0w9.js +59 -0
  98. package/dist/deploy-1jfagtn9.js +1055 -0
  99. package/dist/deploy-2afw0jfg.js +1055 -0
  100. package/dist/deploy-2fzj68kq.js +1055 -0
  101. package/dist/deploy-57nzn9wj.js +1045 -0
  102. package/dist/deploy-asyryrvm.js +1055 -0
  103. package/dist/deploy-hc927rw6.js +1045 -0
  104. package/dist/deploy-pnnf8tgy.js +1045 -0
  105. package/dist/deploy-q33bw715.js +1055 -0
  106. package/dist/deploy-tmdgecs3.js +1055 -0
  107. package/dist/deploy-v0y8kczr.js +1055 -0
  108. package/dist/deploy-xhj6zbcx.js +1055 -0
  109. package/dist/dev-1mvcts8w.js +2515 -0
  110. package/dist/dev-2a283xts.js +2515 -0
  111. package/dist/dev-62nhytf8.js +2505 -0
  112. package/dist/dev-75acm2xj.js +2478 -0
  113. package/dist/dev-802rg9dp.js +2515 -0
  114. package/dist/dev-d1bb2t0f.js +2515 -0
  115. package/dist/dev-dwry8494.js +2489 -0
  116. package/dist/dev-g6112y4w.js +2515 -0
  117. package/dist/dev-h2kneh95.js +2496 -0
  118. package/dist/dev-kybq3mwr.js +2489 -0
  119. package/dist/dev-n8qndkyg.js +2512 -0
  120. package/dist/dev-p32fkbwf.js +2489 -0
  121. package/dist/dev-qm9d4mfh.js +2478 -0
  122. package/dist/dev-rcthnse5.js +2473 -0
  123. package/dist/dev-server/dev-server-state.d.ts +1 -0
  124. package/dist/dev-server/dev-server-state.d.ts.map +1 -1
  125. package/dist/dev-server/miniflare-bindings.d.ts +44 -1
  126. package/dist/dev-server/miniflare-bindings.d.ts.map +1 -1
  127. package/dist/dev-server/miniflare-dev-config.d.ts +1 -0
  128. package/dist/dev-server/miniflare-dev-config.d.ts.map +1 -1
  129. package/dist/dev-server/miniflare-log.d.ts +8 -0
  130. package/dist/dev-server/miniflare-log.d.ts.map +1 -1
  131. package/dist/dev-server/miniflare-worker-config.d.ts +31 -1
  132. package/dist/dev-server/miniflare-worker-config.d.ts.map +1 -1
  133. package/dist/dev-server/server.d.ts.map +1 -1
  134. package/dist/dev-server/vite-process.d.ts +1 -0
  135. package/dist/dev-server/vite-process.d.ts.map +1 -1
  136. package/dist/dev-tgwja5mz.js +2496 -0
  137. package/dist/doctor-2shhdak6.js +245 -0
  138. package/dist/doctor-5g73w40j.js +245 -0
  139. package/dist/doctor-gamefzcs.js +245 -0
  140. package/dist/doctor-rn53ctfs.js +245 -0
  141. package/dist/index-01kehw41.js +348 -0
  142. package/dist/index-06bg0z9y.js +185 -0
  143. package/dist/index-0d7tw5r4.js +136 -0
  144. package/dist/index-0m6e4mxz.js +133 -0
  145. package/dist/index-0vah20er.js +1410 -0
  146. package/dist/index-0wa0ebm1.js +68 -0
  147. package/dist/index-1714y3cz.js +1410 -0
  148. package/dist/index-1qs5gcm7.js +895 -0
  149. package/dist/index-29k04v43.js +574 -0
  150. package/dist/index-2jywf4pz.js +1372 -0
  151. package/dist/index-2qhk9nbx.js +1372 -0
  152. package/dist/index-2vq6bveq.js +574 -0
  153. package/dist/index-36h8gkhb.js +1088 -0
  154. package/dist/index-38fq7pww.js +560 -0
  155. package/dist/index-3bxqn033.js +1410 -0
  156. package/dist/index-3jme4hgw.js +1234 -0
  157. package/dist/index-3p7s9mk9.js +360 -0
  158. package/dist/index-47w35sft.js +244 -0
  159. package/dist/index-4by4c7rm.js +52 -0
  160. package/dist/index-4phjwd6h.js +412 -0
  161. package/dist/index-4z5jrw0j.js +594 -0
  162. package/dist/index-51mzqy0d.js +895 -0
  163. package/dist/index-53pqqpq9.js +74 -0
  164. package/dist/index-5enq8ntr.js +1766 -0
  165. package/dist/index-5fnq9r9m.js +1410 -0
  166. package/dist/index-5w9f2b17.js +695 -0
  167. package/dist/index-627srx16.js +45 -0
  168. package/dist/index-6bqgf5x8.js +227 -0
  169. package/dist/index-6xknvbyk.js +1088 -0
  170. package/dist/index-7ef3ktz5.js +1372 -0
  171. package/dist/index-7hpjfdzh.js +185 -0
  172. package/dist/index-8052df4m.js +627 -0
  173. package/dist/index-82epjzrr.js +1410 -0
  174. package/dist/index-82z7rvz6.js +1238 -0
  175. package/dist/index-8atc1yb9.js +68 -0
  176. package/dist/index-8tj0awnv.js +476 -0
  177. package/dist/index-8x745h59.js +1069 -0
  178. package/dist/index-9bawzcny.js +574 -0
  179. package/dist/index-9bjjqdfc.js +236 -0
  180. package/dist/index-9d7x3vfr.js +236 -0
  181. package/dist/index-9nf8zs4p.js +1069 -0
  182. package/dist/index-acwbmagz.js +412 -0
  183. package/dist/index-aqjdaem7.js +74 -0
  184. package/dist/index-b6448fd0.js +133 -0
  185. package/dist/index-b9j55r7q.js +240 -0
  186. package/dist/index-bdatd1za.js +1372 -0
  187. package/dist/index-c3nxftnp.js +699 -0
  188. package/dist/index-c643s0gv.js +488 -0
  189. package/dist/index-d2md1j3d.js +185 -0
  190. package/dist/index-dbr6bfz6.js +528 -0
  191. package/dist/index-dd1g0g7e.js +360 -0
  192. package/dist/index-dktb9az5.js +1372 -0
  193. package/dist/index-dm9q84c7.js +360 -0
  194. package/dist/index-f51mkh13.js +1088 -0
  195. package/dist/index-f86n1fpd.js +55 -0
  196. package/dist/index-fnk0tkw7.js +412 -0
  197. package/dist/index-g5aq66bj.js +1534 -0
  198. package/dist/index-gj5qh491.js +54 -0
  199. package/dist/index-gq39t0rx.js +895 -0
  200. package/dist/index-h5dqna7q.js +1410 -0
  201. package/dist/index-hjs9j2g9.js +895 -0
  202. package/dist/index-hn5nbxbt.js +147 -0
  203. package/dist/index-hpjh0qjx.js +1723 -0
  204. package/dist/index-hs6ekcfs.js +412 -0
  205. package/dist/index-jdzrvnfj.js +52 -0
  206. package/dist/index-jg720mq7.js +476 -0
  207. package/dist/index-jrzddxvt.js +2167 -0
  208. package/dist/index-kgstnk6g.js +239 -0
  209. package/dist/index-khnw972v.js +117 -0
  210. package/dist/index-kwqff3ba.js +1410 -0
  211. package/dist/index-m2v0fj08.js +74 -0
  212. package/dist/index-mjve6tqn.js +447 -0
  213. package/dist/index-mkxzgn0q.js +1372 -0
  214. package/dist/index-mzmq3v0d.js +1088 -0
  215. package/dist/index-ng9n3znd.js +1372 -0
  216. package/dist/index-nhbkm2ba.js +467 -0
  217. package/dist/index-nrfhk0k5.js +1088 -0
  218. package/dist/index-p0zppqxm.js +467 -0
  219. package/dist/index-pkxf6h87.js +895 -0
  220. package/dist/index-pqp4312v.js +52 -0
  221. package/dist/index-pw9jn6kz.js +574 -0
  222. package/dist/index-q31ne0xa.js +412 -0
  223. package/dist/index-qf2dkqxh.js +249 -0
  224. package/dist/index-qmtdf7k5.js +639 -0
  225. package/dist/index-qwgr4q7s.js +37 -0
  226. package/dist/index-rab2dfh3.js +494 -0
  227. package/dist/index-rz7rx80s.js +1410 -0
  228. package/dist/index-s37h3jgk.js +572 -0
  229. package/dist/index-sb705m7d.js +52 -0
  230. package/dist/index-syscwrjp.js +1576 -0
  231. package/dist/index-t14zr0ys.js +1063 -0
  232. package/dist/index-tjc99447.js +68 -0
  233. package/dist/index-v35460hf.js +574 -0
  234. package/dist/index-v7q00d1e.js +1410 -0
  235. package/dist/index-vkkmx4xe.js +1372 -0
  236. package/dist/index-vrps1gky.js +2202 -0
  237. package/dist/index-w4c9vmvg.js +1517 -0
  238. package/dist/index-wqd8n2qk.js +574 -0
  239. package/dist/index-x12e6fzy.js +476 -0
  240. package/dist/index-xagpz645.js +2199 -0
  241. package/dist/index-xbth1r6e.js +572 -0
  242. package/dist/index-xm9fqhcb.js +447 -0
  243. package/dist/index-y59hnmd0.js +132 -0
  244. package/dist/index-y7mkb00x.js +133 -0
  245. package/dist/index-z40mjts9.js +212 -0
  246. package/dist/index-z5k5bjc7.js +1218 -0
  247. package/dist/index-z73sytma.js +895 -0
  248. package/dist/index-zjv6apef.js +1410 -0
  249. package/dist/index.js +8 -8
  250. package/dist/init-cwpergap.js +180 -0
  251. package/dist/login-83bjfhvz.js +77 -0
  252. package/dist/login-ddw888xb.js +77 -0
  253. package/dist/login-e7pytkdc.js +77 -0
  254. package/dist/login-fe0brfcr.js +77 -0
  255. package/dist/login-h7sm5trm.js +77 -0
  256. package/dist/login-vd0m3xr4.js +77 -0
  257. package/dist/previews-2wfvsjfy.js +1337 -0
  258. package/dist/previews-31feb8r3.js +1337 -0
  259. package/dist/previews-3w4pxqby.js +1337 -0
  260. package/dist/previews-93ttrf5f.js +1337 -0
  261. package/dist/previews-bdrefjzx.js +1337 -0
  262. package/dist/previews-cfcn56b4.js +1337 -0
  263. package/dist/previews-mssq1hrm.js +1337 -0
  264. package/dist/previews-tcaz1gt8.js +1337 -0
  265. package/dist/productions-4h80j2c7.js +505 -0
  266. package/dist/productions-86jaqt7m.js +505 -0
  267. package/dist/productions-bn2q31my.js +505 -0
  268. package/dist/productions-dv8g7f6g.js +505 -0
  269. package/dist/productions-e2m9s4tr.js +505 -0
  270. package/dist/productions-fgshs1m7.js +505 -0
  271. package/dist/productions-hphmt68n.js +505 -0
  272. package/dist/productions-vhq7yx86.js +505 -0
  273. package/dist/runtime/index.js +8 -8
  274. package/dist/secrets/local-secrets.d.ts +46 -0
  275. package/dist/secrets/local-secrets.d.ts.map +1 -0
  276. package/dist/secrets-8wcj47nh.js +91 -0
  277. package/dist/secrets-b2ww34ta.js +91 -0
  278. package/dist/secrets-b7g4z621.js +91 -0
  279. package/dist/shims/local-media-bindings.d.ts +19 -0
  280. package/dist/shims/local-media-bindings.d.ts.map +1 -0
  281. package/dist/shims/local-worker-loader.d.ts +3 -0
  282. package/dist/shims/local-worker-loader.d.ts.map +1 -0
  283. package/dist/sveltekit/index.js +163 -26
  284. package/dist/sveltekit/local-bindings.d.ts +4 -0
  285. package/dist/sveltekit/local-bindings.d.ts.map +1 -0
  286. package/dist/sveltekit/platform.d.ts +8 -0
  287. package/dist/sveltekit/platform.d.ts.map +1 -1
  288. package/dist/test/ai-search.d.ts +39 -0
  289. package/dist/test/ai-search.d.ts.map +1 -0
  290. package/dist/test/binding-hints.d.ts.map +1 -1
  291. package/dist/test/cf.d.ts +3 -3
  292. package/dist/test/containers.d.ts +87 -0
  293. package/dist/test/containers.d.ts.map +1 -0
  294. package/dist/test/index.d.ts +4 -1
  295. package/dist/test/index.d.ts.map +1 -1
  296. package/dist/test/index.js +2833 -543
  297. package/dist/test/local-worker-loader.d.ts +3 -0
  298. package/dist/test/local-worker-loader.d.ts.map +1 -0
  299. package/dist/test/offline-bindings.d.ts +65 -0
  300. package/dist/test/offline-bindings.d.ts.map +1 -0
  301. package/dist/test/queue.d.ts.map +1 -1
  302. package/dist/test/remote-ai.d.ts.map +1 -1
  303. package/dist/test/should-skip.d.ts +14 -0
  304. package/dist/test/should-skip.d.ts.map +1 -1
  305. package/dist/test/simple-context-bindings.d.ts.map +1 -1
  306. package/dist/test/simple-context-durable-objects.d.ts.map +1 -1
  307. package/dist/test/simple-context-gateway-script.d.ts +1 -1
  308. package/dist/test/simple-context-gateway-script.d.ts.map +1 -1
  309. package/dist/test/simple-context-lifecycle.d.ts.map +1 -1
  310. package/dist/test/simple-context-mfconfig.d.ts +4 -1
  311. package/dist/test/simple-context-mfconfig.d.ts.map +1 -1
  312. package/dist/test/simple-context-multi-worker.d.ts.map +1 -1
  313. package/dist/test/simple-context-startup.d.ts.map +1 -1
  314. package/dist/test/tail.d.ts.map +1 -1
  315. package/dist/test/utilities/artifacts.d.ts +11 -0
  316. package/dist/test/utilities/artifacts.d.ts.map +1 -0
  317. package/dist/test/utilities/context.d.ts +39 -0
  318. package/dist/test/utilities/context.d.ts.map +1 -0
  319. package/dist/test/utilities/d1.d.ts +21 -0
  320. package/dist/test/utilities/d1.d.ts.map +1 -0
  321. package/dist/test/utilities/env.d.ts +40 -0
  322. package/dist/test/utilities/env.d.ts.map +1 -0
  323. package/dist/test/utilities/kv.d.ts +11 -0
  324. package/dist/test/utilities/kv.d.ts.map +1 -0
  325. package/dist/test/utilities/media.d.ts +16 -0
  326. package/dist/test/utilities/media.d.ts.map +1 -0
  327. package/dist/test/utilities/platform.d.ts +38 -0
  328. package/dist/test/utilities/platform.d.ts.map +1 -0
  329. package/dist/test/utilities/queue.d.ts +5 -0
  330. package/dist/test/utilities/queue.d.ts.map +1 -0
  331. package/dist/test/utilities/r2.d.ts +12 -0
  332. package/dist/test/utilities/r2.d.ts.map +1 -0
  333. package/dist/test/utilities/workflows.d.ts +26 -0
  334. package/dist/test/utilities/workflows.d.ts.map +1 -0
  335. package/dist/test/utilities.d.ts +10 -106
  336. package/dist/test/utilities.d.ts.map +1 -1
  337. package/dist/types-2ejrbba1.js +695 -0
  338. package/dist/types-7jkbm95a.js +695 -0
  339. package/dist/types-a2fk9yns.js +695 -0
  340. package/dist/types-dyb3c6zw.js +695 -0
  341. package/dist/types-e2n9f3pd.js +695 -0
  342. package/dist/types-j4s6qcrc.js +695 -0
  343. package/dist/utils/send-email.d.ts.map +1 -1
  344. package/dist/utils/send-email.js +1 -1
  345. package/dist/vite/index.js +6 -6
  346. package/dist/vite/plugin-context.d.ts.map +1 -1
  347. package/dist/worker-663em30d.js +513 -0
  348. package/dist/worker-argxc7fb.js +513 -0
  349. package/dist/worker-entry/composed-worker.d.ts.map +1 -1
  350. package/dist/worker-entry/surface-paths.d.ts +2 -0
  351. package/dist/worker-entry/surface-paths.d.ts.map +1 -1
  352. package/dist/worker-fcdsnj14.js +513 -0
  353. package/dist/worker-fk42rzse.js +513 -0
  354. package/dist/worker-jkemk8d2.js +513 -0
  355. package/dist/worker-m4ze8djx.js +513 -0
  356. package/dist/worker-wnan5dca.js +513 -0
  357. package/dist/worker-yw3atfb1.js +513 -0
  358. package/dist/workflows/local-workflow-entrypoints.d.ts +7 -0
  359. package/dist/workflows/local-workflow-entrypoints.d.ts.map +1 -0
  360. package/package.json +13 -12
@@ -0,0 +1,360 @@
1
+ // src/shims/local-media-bindings.ts
2
+ function emptyNodeStream() {
3
+ return new ReadableStream({
4
+ start(controller) {
5
+ controller.close();
6
+ }
7
+ });
8
+ }
9
+ function normalizeNodeContentType(value, fallback) {
10
+ if (!value)
11
+ return fallback;
12
+ if (value.includes("/"))
13
+ return value;
14
+ if (value === "jpg" || value === "jpeg")
15
+ return "image/jpeg";
16
+ if (value === "png")
17
+ return "image/png";
18
+ if (value === "webp")
19
+ return "image/webp";
20
+ if (value === "avif")
21
+ return "image/avif";
22
+ if (value === "mp4")
23
+ return "video/mp4";
24
+ return value;
25
+ }
26
+ async function readNodeBytes(stream) {
27
+ const buffer = await new Response(stream ?? emptyNodeStream()).arrayBuffer();
28
+ return new Uint8Array(buffer);
29
+ }
30
+ function streamFromNodeBytes(bytes) {
31
+ const copy = new Uint8Array(bytes.byteLength);
32
+ copy.set(bytes);
33
+ return new Response(copy).body ?? emptyNodeStream();
34
+ }
35
+ function createUnsupportedHostedImagesBinding() {
36
+ const unsupported = () => {
37
+ throw new Error("Devflare local Images hosted API is not implemented. Use transform/info APIs locally, or connect to Cloudflare for hosted image storage.");
38
+ };
39
+ return {
40
+ image(_imageId) {
41
+ return {
42
+ details: unsupported,
43
+ bytes: unsupported,
44
+ update: unsupported,
45
+ delete: unsupported
46
+ };
47
+ },
48
+ upload: unsupported,
49
+ list: unsupported
50
+ };
51
+ }
52
+ function createNodeImageResult(bytes, contentType) {
53
+ return {
54
+ response() {
55
+ return new Response(streamFromNodeBytes(bytes), {
56
+ headers: { "Content-Type": contentType }
57
+ });
58
+ },
59
+ contentType() {
60
+ return contentType;
61
+ },
62
+ image() {
63
+ return streamFromNodeBytes(bytes);
64
+ }
65
+ };
66
+ }
67
+ function createNodeImageTransformer(bytesPromise) {
68
+ const transformer = {
69
+ transform(_transform) {
70
+ return transformer;
71
+ },
72
+ draw(_image, _options) {
73
+ return transformer;
74
+ },
75
+ async output(options = {}) {
76
+ return createNodeImageResult(await bytesPromise, normalizeNodeContentType(options.format, "image/png"));
77
+ }
78
+ };
79
+ return transformer;
80
+ }
81
+ function createLocalImagesBinding() {
82
+ return {
83
+ async info(stream) {
84
+ const bytes = await readNodeBytes(stream);
85
+ return {
86
+ format: "image/png",
87
+ fileSize: bytes.byteLength,
88
+ width: 1,
89
+ height: 1
90
+ };
91
+ },
92
+ input(stream) {
93
+ return createNodeImageTransformer(readNodeBytes(stream));
94
+ },
95
+ hosted: createUnsupportedHostedImagesBinding()
96
+ };
97
+ }
98
+ function createNodeMediaResult(bytes, contentType) {
99
+ return {
100
+ async media() {
101
+ return streamFromNodeBytes(bytes);
102
+ },
103
+ async response() {
104
+ return new Response(streamFromNodeBytes(bytes), {
105
+ headers: { "Content-Type": contentType }
106
+ });
107
+ },
108
+ async contentType() {
109
+ return contentType;
110
+ }
111
+ };
112
+ }
113
+ function createNodeMediaTransformer(bytesPromise) {
114
+ const output = async (options = {}) => createNodeMediaResult(await bytesPromise, normalizeNodeContentType(options.format, "video/mp4"));
115
+ return {
116
+ transform(_transform) {
117
+ return {
118
+ output(options) {
119
+ return output(options);
120
+ }
121
+ };
122
+ },
123
+ output(options) {
124
+ return output(options);
125
+ }
126
+ };
127
+ }
128
+ function createLocalMediaBinding() {
129
+ return {
130
+ input(stream) {
131
+ return createNodeMediaTransformer(readNodeBytes(stream));
132
+ }
133
+ };
134
+ }
135
+ var LOCAL_MEDIA_BINDING_SCRIPT = `
136
+ import { RpcTarget, WorkerEntrypoint } from 'cloudflare:workers'
137
+
138
+ function emptyStream() {
139
+ return new ReadableStream({
140
+ start(controller) {
141
+ controller.close()
142
+ }
143
+ })
144
+ }
145
+
146
+ function normalizeContentType(value, fallback) {
147
+ if (typeof value !== 'string' || value.length === 0) return fallback
148
+ if (value.includes('/')) return value
149
+ if (value === 'jpg') return 'image/jpeg'
150
+ if (value === 'jpeg') return 'image/jpeg'
151
+ if (value === 'png') return 'image/png'
152
+ if (value === 'webp') return 'image/webp'
153
+ if (value === 'avif') return 'image/avif'
154
+ if (value === 'mp4') return 'video/mp4'
155
+ return value
156
+ }
157
+
158
+ async function readBytes(stream) {
159
+ return await new Response(stream || emptyStream()).arrayBuffer()
160
+ }
161
+
162
+ function streamFromBytes(bytes) {
163
+ return new Response(bytes.slice(0)).body || emptyStream()
164
+ }
165
+
166
+ function createBodyReader(bytes) {
167
+ return function takeBody() {
168
+ return streamFromBytes(bytes)
169
+ }
170
+ }
171
+
172
+ class LocalImageResult extends RpcTarget {
173
+ constructor(takeBody, contentType) {
174
+ super()
175
+ this.takeBody = takeBody
176
+ this.contentTypeValue = contentType
177
+ }
178
+
179
+ response() {
180
+ return new Response(this.takeBody(), {
181
+ headers: { 'Content-Type': this.contentTypeValue }
182
+ })
183
+ }
184
+
185
+ contentType() {
186
+ return this.contentTypeValue
187
+ }
188
+
189
+ image() {
190
+ return this.takeBody()
191
+ }
192
+ }
193
+
194
+ class LocalImageTransformer extends RpcTarget {
195
+ constructor(bytes) {
196
+ super()
197
+ this.takeBody = createBodyReader(bytes)
198
+ }
199
+
200
+ transform() {
201
+ return this
202
+ }
203
+
204
+ draw() {
205
+ return this
206
+ }
207
+
208
+ async output(options = {}) {
209
+ return new LocalImageResult(
210
+ this.takeBody,
211
+ normalizeContentType(options.format, 'image/png')
212
+ )
213
+ }
214
+ }
215
+
216
+ function createHostedImagesBinding() {
217
+ const unsupported = () => {
218
+ throw new Error('Devflare local Images hosted API is not implemented. Use the transform/info APIs locally, or connect to Cloudflare for hosted image storage.')
219
+ }
220
+ return {
221
+ image() {
222
+ return {
223
+ details: unsupported,
224
+ bytes: unsupported,
225
+ update: unsupported,
226
+ delete: unsupported
227
+ }
228
+ },
229
+ upload: unsupported,
230
+ list: unsupported
231
+ }
232
+ }
233
+
234
+ export class LocalImagesBinding extends WorkerEntrypoint {
235
+ async info(stream) {
236
+ const bytes = await readBytes(stream)
237
+ return {
238
+ format: 'image/png',
239
+ fileSize: bytes.byteLength,
240
+ width: 1,
241
+ height: 1
242
+ }
243
+ }
244
+
245
+ async input(stream) {
246
+ return new LocalImageTransformer(await readBytes(stream))
247
+ }
248
+
249
+ get hosted() {
250
+ return createHostedImagesBinding()
251
+ }
252
+ }
253
+
254
+ class LocalMediaResult extends RpcTarget {
255
+ constructor(takeBody, contentType) {
256
+ super()
257
+ this.takeBody = takeBody
258
+ this.contentTypeValue = contentType
259
+ }
260
+
261
+ async media() {
262
+ return this.takeBody()
263
+ }
264
+
265
+ async response() {
266
+ return new Response(this.takeBody(), {
267
+ headers: { 'Content-Type': this.contentTypeValue }
268
+ })
269
+ }
270
+
271
+ async contentType() {
272
+ return this.contentTypeValue
273
+ }
274
+ }
275
+
276
+ class LocalMediaTransformationGenerator extends RpcTarget {
277
+ constructor(takeBody) {
278
+ super()
279
+ this.takeBody = takeBody
280
+ }
281
+
282
+ output(options = {}) {
283
+ return new LocalMediaResult(
284
+ this.takeBody,
285
+ normalizeContentType(options.format, 'video/mp4')
286
+ )
287
+ }
288
+ }
289
+
290
+ class LocalMediaTransformer extends RpcTarget {
291
+ constructor(bytes) {
292
+ super()
293
+ this.takeBody = createBodyReader(bytes)
294
+ }
295
+
296
+ transform() {
297
+ return new LocalMediaTransformationGenerator(this.takeBody)
298
+ }
299
+
300
+ output(options = {}) {
301
+ return new LocalMediaResult(
302
+ this.takeBody,
303
+ normalizeContentType(options.format, 'video/mp4')
304
+ )
305
+ }
306
+ }
307
+
308
+ export class LocalMediaBinding extends WorkerEntrypoint {
309
+ async input(stream) {
310
+ return new LocalMediaTransformer(await readBytes(stream))
311
+ }
312
+ }
313
+
314
+ export default {
315
+ fetch() {
316
+ return new Response('Devflare local Images/Media binding')
317
+ }
318
+ }
319
+ `;
320
+ function toLocalShimWorkerName(kind, bindingName, index) {
321
+ const slug = bindingName.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || kind;
322
+ return `devflare-local-${kind}-${index}-${slug}`;
323
+ }
324
+ function getEntrypoint(kind) {
325
+ return kind === "images" ? "LocalImagesBinding" : "LocalMediaBinding";
326
+ }
327
+ function buildLocalBindingShimServiceConfig(config) {
328
+ const entries = [
329
+ ...Object.keys(config.bindings?.images ?? {}).map((bindingName) => ({
330
+ bindingName,
331
+ kind: "images"
332
+ })),
333
+ ...Object.keys(config.bindings?.media ?? {}).map((bindingName) => ({
334
+ bindingName,
335
+ kind: "media"
336
+ }))
337
+ ];
338
+ return {
339
+ localBindingNames: entries.map((entry) => entry.bindingName),
340
+ serviceBindings: Object.fromEntries(entries.map((entry, index) => {
341
+ const workerName = toLocalShimWorkerName(entry.kind, entry.bindingName, index);
342
+ return [
343
+ entry.bindingName,
344
+ {
345
+ name: workerName,
346
+ entrypoint: getEntrypoint(entry.kind)
347
+ }
348
+ ];
349
+ })),
350
+ workers: entries.map((entry, index) => ({
351
+ name: toLocalShimWorkerName(entry.kind, entry.bindingName, index),
352
+ modules: true,
353
+ script: LOCAL_MEDIA_BINDING_SCRIPT,
354
+ compatibilityDate: config.compatibilityDate ?? "2025-01-01",
355
+ ...config.compatibilityFlags && { compatibilityFlags: config.compatibilityFlags }
356
+ }))
357
+ };
358
+ }
359
+
360
+ export { createLocalImagesBinding, createLocalMediaBinding, buildLocalBindingShimServiceConfig };
@@ -0,0 +1,244 @@
1
+ import {
2
+ normalizeArtifactsBinding,
3
+ normalizeDispatchNamespaceBinding,
4
+ normalizeHyperdriveBinding,
5
+ normalizeImagesBinding,
6
+ normalizeMediaBinding,
7
+ normalizeMtlsCertificateBinding,
8
+ normalizePipelineBinding,
9
+ normalizeSecretsStoreBinding,
10
+ normalizeWorkflowBinding
11
+ } from "./index-syscwrjp.js";
12
+
13
+ // src/dev-server/miniflare-bindings.ts
14
+ function buildQueueProducers(bindings) {
15
+ if (!bindings.queues?.producers) {
16
+ return;
17
+ }
18
+ const producers = {};
19
+ for (const [bindingName, queueName] of Object.entries(bindings.queues.producers)) {
20
+ producers[bindingName] = { queueName };
21
+ }
22
+ return producers;
23
+ }
24
+ function buildQueueConsumers(bindings) {
25
+ if (!bindings.queues?.consumers || bindings.queues.consumers.length === 0) {
26
+ return;
27
+ }
28
+ const consumers = {};
29
+ for (const consumer of bindings.queues.consumers) {
30
+ consumers[consumer.queue] = {
31
+ ...consumer.maxBatchSize !== undefined && { maxBatchSize: consumer.maxBatchSize },
32
+ ...consumer.maxBatchTimeout !== undefined && { maxBatchTimeout: consumer.maxBatchTimeout },
33
+ ...consumer.maxRetries !== undefined && { maxRetries: consumer.maxRetries },
34
+ ...consumer.deadLetterQueue && { deadLetterQueue: consumer.deadLetterQueue },
35
+ ...consumer.maxConcurrency !== undefined && { maxConcurrency: consumer.maxConcurrency },
36
+ ...consumer.retryDelay !== undefined && { retryDelay: consumer.retryDelay }
37
+ };
38
+ }
39
+ return consumers;
40
+ }
41
+ function buildRateLimitsConfig(bindings) {
42
+ if (!bindings.rateLimits) {
43
+ return;
44
+ }
45
+ return Object.fromEntries(Object.entries(bindings.rateLimits).map(([name, binding]) => [
46
+ name,
47
+ {
48
+ simple: {
49
+ limit: binding.simple.limit,
50
+ period: binding.simple.period
51
+ }
52
+ }
53
+ ]));
54
+ }
55
+ function buildVersionMetadataConfig(bindings) {
56
+ return bindings.versionMetadata?.binding;
57
+ }
58
+ function buildWorkerLoadersConfig(bindings) {
59
+ if (!bindings.workerLoaders) {
60
+ return;
61
+ }
62
+ return Object.fromEntries(Object.keys(bindings.workerLoaders).map((bindingName) => [bindingName, {}]));
63
+ }
64
+ function buildMtlsCertificatesConfig(bindings) {
65
+ if (!bindings.mtlsCertificates) {
66
+ return;
67
+ }
68
+ return Object.fromEntries(Object.entries(bindings.mtlsCertificates).map(([bindingName, binding]) => {
69
+ const normalized = normalizeMtlsCertificateBinding(binding);
70
+ return [
71
+ bindingName,
72
+ {
73
+ certificate_id: normalized.certificateId
74
+ }
75
+ ];
76
+ }));
77
+ }
78
+ function buildDispatchNamespacesConfig(bindings) {
79
+ if (!bindings.dispatchNamespaces) {
80
+ return;
81
+ }
82
+ return Object.fromEntries(Object.entries(bindings.dispatchNamespaces).map(([bindingName, binding]) => {
83
+ const normalized = normalizeDispatchNamespaceBinding(binding);
84
+ return [
85
+ bindingName,
86
+ {
87
+ namespace: normalized.namespace
88
+ }
89
+ ];
90
+ }));
91
+ }
92
+ function buildWorkflowsConfig(bindings) {
93
+ if (!bindings.workflows) {
94
+ return;
95
+ }
96
+ return Object.fromEntries(Object.entries(bindings.workflows).map(([bindingName, binding]) => {
97
+ const normalized = normalizeWorkflowBinding(binding);
98
+ return [
99
+ bindingName,
100
+ {
101
+ name: normalized.name,
102
+ className: normalized.className,
103
+ ...normalized.scriptName && { scriptName: normalized.scriptName },
104
+ ...normalized.limits && { stepLimit: normalized.limits.steps }
105
+ }
106
+ ];
107
+ }));
108
+ }
109
+ function buildPipelinesConfig(bindings) {
110
+ if (!bindings.pipelines) {
111
+ return;
112
+ }
113
+ return Object.fromEntries(Object.entries(bindings.pipelines).map(([bindingName, binding]) => {
114
+ const normalized = normalizePipelineBinding(binding);
115
+ return [
116
+ bindingName,
117
+ typeof binding === "string" ? normalized.pipeline : { pipeline: normalized.pipeline }
118
+ ];
119
+ }));
120
+ }
121
+ function getHyperdriveLocalConnectionString(bindingName, binding) {
122
+ const cloudflareEnvName = `CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_${bindingName}`;
123
+ const wranglerEnvName = `WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_${bindingName}`;
124
+ const envValue = process.env[cloudflareEnvName] ?? process.env[wranglerEnvName];
125
+ if (envValue?.trim()) {
126
+ return envValue;
127
+ }
128
+ const normalized = normalizeHyperdriveBinding(binding);
129
+ return normalized.localConnectionString;
130
+ }
131
+ function buildHyperdrivesConfig(bindings) {
132
+ if (!bindings.hyperdrive) {
133
+ return;
134
+ }
135
+ const hyperdrives = Object.fromEntries(Object.entries(bindings.hyperdrive).map(([bindingName, binding]) => {
136
+ const localConnectionString = getHyperdriveLocalConnectionString(bindingName, binding);
137
+ return localConnectionString ? [bindingName, localConnectionString] : null;
138
+ }).filter((entry) => entry !== null));
139
+ return Object.keys(hyperdrives).length > 0 ? hyperdrives : undefined;
140
+ }
141
+ function buildImagesConfig(bindings) {
142
+ if (!bindings.images) {
143
+ return;
144
+ }
145
+ const [entry] = Object.entries(bindings.images);
146
+ if (!entry) {
147
+ return;
148
+ }
149
+ const [bindingName, binding] = entry;
150
+ const normalized = normalizeImagesBinding(bindingName, binding);
151
+ return {
152
+ binding: normalized.binding
153
+ };
154
+ }
155
+ function buildMediaConfig(bindings) {
156
+ if (!bindings.media) {
157
+ return;
158
+ }
159
+ const [entry] = Object.entries(bindings.media);
160
+ if (!entry) {
161
+ return;
162
+ }
163
+ const [bindingName, binding] = entry;
164
+ const normalized = normalizeMediaBinding(bindingName, binding);
165
+ return {
166
+ binding: normalized.binding
167
+ };
168
+ }
169
+ function buildArtifactsConfig(bindings) {
170
+ if (!bindings.artifacts) {
171
+ return;
172
+ }
173
+ return Object.fromEntries(Object.entries(bindings.artifacts).map(([bindingName, binding]) => {
174
+ const normalized = normalizeArtifactsBinding(binding);
175
+ return [
176
+ bindingName,
177
+ {
178
+ namespace: normalized.namespace
179
+ }
180
+ ];
181
+ }));
182
+ }
183
+ function buildAiSearchNamespacesConfig(bindings) {
184
+ if (!bindings.aiSearchNamespaces) {
185
+ return;
186
+ }
187
+ return Object.fromEntries(Object.entries(bindings.aiSearchNamespaces).map(([bindingName, binding]) => [
188
+ bindingName,
189
+ {
190
+ namespace: binding.namespace
191
+ }
192
+ ]));
193
+ }
194
+ function buildAiSearchInstancesConfig(bindings) {
195
+ if (!bindings.aiSearch) {
196
+ return;
197
+ }
198
+ return Object.fromEntries(Object.entries(bindings.aiSearch).map(([bindingName, binding]) => [
199
+ bindingName,
200
+ {
201
+ instance_name: binding.instanceName
202
+ }
203
+ ]));
204
+ }
205
+ function buildSecretsStoreConfig(bindings, defaultSecretsStoreId, excludedBindingNames = new Set) {
206
+ if (!bindings.secretsStore) {
207
+ return;
208
+ }
209
+ const entries = Object.entries(bindings.secretsStore).flatMap(([bindingName, binding]) => {
210
+ if (excludedBindingNames.has(bindingName)) {
211
+ return [];
212
+ }
213
+ const normalized = normalizeSecretsStoreBinding(binding, defaultSecretsStoreId, bindingName);
214
+ return [[
215
+ bindingName,
216
+ {
217
+ store_id: normalized.storeId,
218
+ secret_name: normalized.secretName
219
+ }
220
+ ]];
221
+ });
222
+ return entries.length > 0 ? Object.fromEntries(entries) : undefined;
223
+ }
224
+ function buildSendEmailConfig(bindings) {
225
+ if (!bindings.sendEmail) {
226
+ return;
227
+ }
228
+ return {
229
+ send_email: Object.entries(bindings.sendEmail).map(([name, binding]) => ({
230
+ name,
231
+ ...binding.destinationAddress && {
232
+ destination_address: binding.destinationAddress
233
+ },
234
+ ...binding.allowedDestinationAddresses && {
235
+ allowed_destination_addresses: binding.allowedDestinationAddresses
236
+ },
237
+ ...binding.allowedSenderAddresses && {
238
+ allowed_sender_addresses: binding.allowedSenderAddresses
239
+ }
240
+ }))
241
+ };
242
+ }
243
+
244
+ export { buildQueueProducers, buildQueueConsumers, buildRateLimitsConfig, buildVersionMetadataConfig, buildWorkerLoadersConfig, buildMtlsCertificatesConfig, buildDispatchNamespacesConfig, buildWorkflowsConfig, buildPipelinesConfig, buildHyperdrivesConfig, buildImagesConfig, buildMediaConfig, buildArtifactsConfig, buildAiSearchNamespacesConfig, buildAiSearchInstancesConfig, buildSecretsStoreConfig, buildSendEmailConfig };
@@ -0,0 +1,52 @@
1
+ import {
2
+ findFiles
3
+ } from "./index-rbht7m9r.js";
4
+ import {
5
+ resolveConfigPath
6
+ } from "./index-syscwrjp.js";
7
+
8
+ // src/cli/config-path.ts
9
+ import { stat } from "node:fs/promises";
10
+ var CONFIG_FILE_EXTENSIONS = [".ts", ".mts", ".js", ".mjs"];
11
+ var SUPPORTED_CONFIG_FILENAMES = CONFIG_FILE_EXTENSIONS.map((extension) => `devflare.config${extension}`);
12
+ function hasKnownConfigExtension(filePath) {
13
+ return CONFIG_FILE_EXTENSIONS.some((extension) => filePath.endsWith(extension));
14
+ }
15
+ async function getExistingFilePath(filePath) {
16
+ try {
17
+ const fileStat = await stat(filePath);
18
+ return fileStat.isFile() ? filePath : null;
19
+ } catch {
20
+ return null;
21
+ }
22
+ }
23
+ async function resolveConfigCandidatePath(candidatePath) {
24
+ const candidates = [candidatePath];
25
+ if (!hasKnownConfigExtension(candidatePath)) {
26
+ for (const extension of CONFIG_FILE_EXTENSIONS) {
27
+ candidates.push(`${candidatePath}${extension}`);
28
+ }
29
+ }
30
+ for (const candidate of candidates) {
31
+ const existingFilePath = await getExistingFilePath(candidate);
32
+ if (existingFilePath) {
33
+ return existingFilePath;
34
+ }
35
+ }
36
+ return await resolveConfigPath(candidatePath) ?? null;
37
+ }
38
+ async function findConfigPathsUnderDirectory(rootDir) {
39
+ const matches = await findFiles([
40
+ ...SUPPORTED_CONFIG_FILENAMES,
41
+ ...SUPPORTED_CONFIG_FILENAMES.map((filename) => `**/${filename}`)
42
+ ], {
43
+ cwd: rootDir,
44
+ absolute: true
45
+ });
46
+ return [...new Set(matches)].sort((left, right) => left.localeCompare(right));
47
+ }
48
+ function formatSupportedConfigFilenames() {
49
+ return SUPPORTED_CONFIG_FILENAMES.join(", ");
50
+ }
51
+
52
+ export { resolveConfigCandidatePath, findConfigPathsUnderDirectory, formatSupportedConfigFilenames };