devflare 1.0.0-next.5 → 1.0.0-next.50

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 (594) hide show
  1. package/LICENSE +21 -0
  2. package/LLM.md +17312 -2139
  3. package/README.md +394 -605
  4. package/bin/devflare.js +30 -14
  5. package/dist/_chunks/account-BI3WZMDy.js +462 -0
  6. package/dist/_chunks/account-resources-CsmVowJp.js +159 -0
  7. package/dist/_chunks/ai-CBEuLdoP.js +322 -0
  8. package/dist/_chunks/api-TzdliH-6.js +568 -0
  9. package/dist/_chunks/build-artifacts-DU5V0J0Z.js +483 -0
  10. package/dist/_chunks/build-e0KR38-4.js +24 -0
  11. package/dist/_chunks/cli-DuUz10Mn.js +1163 -0
  12. package/dist/_chunks/cloudflare-BaloqI3H.js +157 -0
  13. package/dist/_chunks/colors-DiK6wPJ5.js +13 -0
  14. package/dist/_chunks/command-utils-DA0Qx9_K.js +45 -0
  15. package/dist/_chunks/compiler-Zw16C9Pi.js +489 -0
  16. package/dist/_chunks/config-Brju62xy.js +78 -0
  17. package/dist/_chunks/config-path-DaL1ylZ_.js +42 -0
  18. package/dist/_chunks/context-CX50Y2Kb.js +2250 -0
  19. package/dist/_chunks/decorators-QmV57ixr.js +19 -0
  20. package/dist/_chunks/dependencies-C2oxFjU_.js +57 -0
  21. package/dist/_chunks/deploy-B-Kku1Vk.js +1032 -0
  22. package/dist/_chunks/dev-D4e_RRZn.js +3471 -0
  23. package/dist/_chunks/doctor-jm_K4dxL.js +219 -0
  24. package/dist/_chunks/durable-object-DMtH0XYX.js +234 -0
  25. package/dist/_chunks/env-S0_nMVz1.js +125 -0
  26. package/dist/_chunks/family-_9-mGSfO.js +143 -0
  27. package/dist/_chunks/generated-artifacts-dMJY4KAt.js +32 -0
  28. package/dist/_chunks/glob-CmQOvunB.js +56 -0
  29. package/dist/_chunks/init-DnkJOmpW.js +165 -0
  30. package/dist/_chunks/loader-Cr0_OWPy.js +1288 -0
  31. package/dist/_chunks/local-dev-vars-CTSa-wvF.js +81 -0
  32. package/dist/_chunks/local-hyperdrive-CJ90j46O.js +119 -0
  33. package/dist/_chunks/local-media-bindings-DsAW4AMF.js +335 -0
  34. package/dist/_chunks/local-secrets-DMPkmOn3.js +123 -0
  35. package/dist/_chunks/local-workflow-entrypoints-Cq_WJajd.js +90 -0
  36. package/dist/_chunks/login-FjTAAQbi.js +51 -0
  37. package/dist/_chunks/package-metadata-DjHBLB-z.js +39 -0
  38. package/dist/_chunks/preferences-BKp_7XJx.js +241 -0
  39. package/dist/_chunks/preview-C3Cdr8an.js +462 -0
  40. package/dist/_chunks/preview-registry-ClAbLTHH.js +1186 -0
  41. package/dist/_chunks/preview-resources-CGMBjsYB.js +359 -0
  42. package/dist/_chunks/previews-C7hs9-BT.js +1134 -0
  43. package/dist/_chunks/productions-T9Als4fE.js +411 -0
  44. package/dist/_chunks/ref-CYJNAAe_.js +178 -0
  45. package/dist/_chunks/remote-CZnP-HLJ.js +79 -0
  46. package/dist/_chunks/remote-config-D39BY9ji.js +132 -0
  47. package/dist/_chunks/resolve-package-qizBfCIm.js +152 -0
  48. package/dist/_chunks/rolldown-runtime-CvQ6eiug.js +14 -0
  49. package/dist/_chunks/routes-BFYCqHb-.js +833 -0
  50. package/dist/_chunks/runtime-DL-Nz3k8.js +550 -0
  51. package/dist/_chunks/schema-normalization-BCwTLTGp.js +660 -0
  52. package/dist/_chunks/secrets-DIpJGe6C.js +95 -0
  53. package/dist/_chunks/tail-IY-ijYmv.js +239 -0
  54. package/dist/_chunks/token-Dmi0KXyX.js +333 -0
  55. package/dist/_chunks/tokens-iVcgNXi-.js +221 -0
  56. package/dist/_chunks/types-DoKsMYfm.js +484 -0
  57. package/dist/_chunks/ui-BUoZApvE.js +103 -0
  58. package/dist/_chunks/usage-BBTGzjon.js +272 -0
  59. package/dist/_chunks/vite-CGtVNf5E.js +1267 -0
  60. package/dist/_chunks/vite-utils-OVLMV605.js +183 -0
  61. package/dist/_chunks/worker-BEZI4od1.js +410 -0
  62. package/dist/_chunks/worker-bundler-dTTnYU3n.js +458 -0
  63. package/dist/_chunks/worker-entrypoint-CQW77lG8.js +247 -0
  64. package/dist/_chunks/workerName-CFJsLZA-.js +23 -0
  65. package/dist/bridge/client.d.ts +49 -7
  66. package/dist/bridge/client.d.ts.map +1 -1
  67. package/dist/bridge/gateway-runtime.d.ts +8 -0
  68. package/dist/bridge/gateway-runtime.d.ts.map +1 -0
  69. package/dist/bridge/index.d.ts +6 -6
  70. package/dist/bridge/index.d.ts.map +1 -1
  71. package/dist/bridge/log.d.ts +5 -0
  72. package/dist/bridge/log.d.ts.map +1 -0
  73. package/dist/bridge/miniflare.d.ts +82 -2
  74. package/dist/bridge/miniflare.d.ts.map +1 -1
  75. package/dist/bridge/proxy.d.ts +12 -11
  76. package/dist/bridge/proxy.d.ts.map +1 -1
  77. package/dist/bridge/server.d.ts +2 -1
  78. package/dist/bridge/server.d.ts.map +1 -1
  79. package/dist/bridge/v2/body-streams.d.ts +53 -0
  80. package/dist/bridge/v2/body-streams.d.ts.map +1 -0
  81. package/dist/bridge/v2/codec.d.ts +106 -0
  82. package/dist/bridge/v2/codec.d.ts.map +1 -0
  83. package/dist/bridge/v2/control-messages.d.ts +46 -0
  84. package/dist/bridge/v2/control-messages.d.ts.map +1 -0
  85. package/dist/bridge/v2/frames.d.ts +109 -0
  86. package/dist/bridge/v2/frames.d.ts.map +1 -0
  87. package/dist/bridge/v2/index.d.ts +11 -0
  88. package/dist/bridge/v2/index.d.ts.map +1 -0
  89. package/dist/bridge/v2/serialization.d.ts +48 -0
  90. package/dist/bridge/v2/serialization.d.ts.map +1 -0
  91. package/dist/bridge/v2/transport.d.ts +31 -0
  92. package/dist/bridge/v2/transport.d.ts.map +1 -0
  93. package/dist/bridge/v2/value-codec.d.ts +61 -0
  94. package/dist/bridge/v2/value-codec.d.ts.map +1 -0
  95. package/dist/bridge/{serialization.d.ts → v2/value-serialization.d.ts} +40 -18
  96. package/dist/bridge/v2/value-serialization.d.ts.map +1 -0
  97. package/dist/bridge/{protocol.d.ts → v2/wire.d.ts} +32 -8
  98. package/dist/bridge/v2/wire.d.ts.map +1 -0
  99. package/dist/bridge/v2/ws-relay.d.ts +53 -0
  100. package/dist/bridge/v2/ws-relay.d.ts.map +1 -0
  101. package/dist/browser-shim/handler.d.ts +2 -2
  102. package/dist/browser-shim/handler.d.ts.map +1 -1
  103. package/dist/browser-shim/index.d.ts +2 -2
  104. package/dist/browser-shim/server.d.ts +63 -0
  105. package/dist/browser-shim/server.d.ts.map +1 -1
  106. package/dist/browser.d.ts +5411 -0
  107. package/dist/browser.d.ts.map +1 -0
  108. package/dist/browser.js +80 -0
  109. package/dist/bundler/defaults.d.ts +23 -0
  110. package/dist/bundler/defaults.d.ts.map +1 -0
  111. package/dist/bundler/do-bundler.d.ts +7 -0
  112. package/dist/bundler/do-bundler.d.ts.map +1 -1
  113. package/dist/bundler/index.d.ts +3 -1
  114. package/dist/bundler/index.d.ts.map +1 -1
  115. package/dist/bundler/rolldown-shared.d.ts +53 -0
  116. package/dist/bundler/rolldown-shared.d.ts.map +1 -0
  117. package/dist/bundler/worker-bundler.d.ts +13 -0
  118. package/dist/bundler/worker-bundler.d.ts.map +1 -0
  119. package/dist/bundler/worker-compat.d.ts +4 -0
  120. package/dist/bundler/worker-compat.d.ts.map +1 -0
  121. package/dist/cli/build-manifest.d.ts +66 -0
  122. package/dist/cli/build-manifest.d.ts.map +1 -0
  123. package/dist/cli/command-utils.d.ts +18 -0
  124. package/dist/cli/command-utils.d.ts.map +1 -0
  125. package/dist/cli/commands/account.d.ts +2 -2
  126. package/dist/cli/commands/account.d.ts.map +1 -1
  127. package/dist/cli/commands/ai.d.ts +1 -1
  128. package/dist/cli/commands/ai.d.ts.map +1 -1
  129. package/dist/cli/commands/build-artifacts.d.ts +40 -0
  130. package/dist/cli/commands/build-artifacts.d.ts.map +1 -0
  131. package/dist/cli/commands/build.d.ts +2 -2
  132. package/dist/cli/commands/build.d.ts.map +1 -1
  133. package/dist/cli/commands/config.d.ts +4 -0
  134. package/dist/cli/commands/config.d.ts.map +1 -0
  135. package/dist/cli/commands/deploy/metadata.d.ts +18 -0
  136. package/dist/cli/commands/deploy/metadata.d.ts.map +1 -0
  137. package/dist/cli/commands/deploy/prepare.d.ts +23 -0
  138. package/dist/cli/commands/deploy/prepare.d.ts.map +1 -0
  139. package/dist/cli/commands/deploy/runtime.d.ts +4 -0
  140. package/dist/cli/commands/deploy/runtime.d.ts.map +1 -0
  141. package/dist/cli/commands/deploy/verification.d.ts +36 -0
  142. package/dist/cli/commands/deploy/verification.d.ts.map +1 -0
  143. package/dist/cli/commands/deploy.d.ts +2 -2
  144. package/dist/cli/commands/deploy.d.ts.map +1 -1
  145. package/dist/cli/commands/dev.d.ts +9 -1
  146. package/dist/cli/commands/dev.d.ts.map +1 -1
  147. package/dist/cli/commands/doctor.d.ts +2 -2
  148. package/dist/cli/commands/doctor.d.ts.map +1 -1
  149. package/dist/cli/commands/init.d.ts +2 -2
  150. package/dist/cli/commands/init.d.ts.map +1 -1
  151. package/dist/cli/commands/login.d.ts +4 -0
  152. package/dist/cli/commands/login.d.ts.map +1 -0
  153. package/dist/cli/commands/previews-support/cleanup.d.ts +9 -0
  154. package/dist/cli/commands/previews-support/cleanup.d.ts.map +1 -0
  155. package/dist/cli/commands/previews-support/family.d.ts +10 -0
  156. package/dist/cli/commands/previews-support/family.d.ts.map +1 -0
  157. package/dist/cli/commands/previews-support/render.d.ts +8 -0
  158. package/dist/cli/commands/previews-support/render.d.ts.map +1 -0
  159. package/dist/cli/commands/previews-support/theme.d.ts +10 -0
  160. package/dist/cli/commands/previews-support/theme.d.ts.map +1 -0
  161. package/dist/cli/commands/previews-support/types.d.ts +70 -0
  162. package/dist/cli/commands/previews-support/types.d.ts.map +1 -0
  163. package/dist/cli/commands/previews.d.ts +4 -0
  164. package/dist/cli/commands/previews.d.ts.map +1 -0
  165. package/dist/cli/commands/productions.d.ts +4 -0
  166. package/dist/cli/commands/productions.d.ts.map +1 -0
  167. package/dist/cli/commands/remote.d.ts +1 -1
  168. package/dist/cli/commands/remote.d.ts.map +1 -1
  169. package/dist/cli/commands/secrets.d.ts +4 -0
  170. package/dist/cli/commands/secrets.d.ts.map +1 -0
  171. package/dist/cli/commands/tail.d.ts +44 -0
  172. package/dist/cli/commands/tail.d.ts.map +1 -0
  173. package/dist/cli/commands/token.d.ts +4 -0
  174. package/dist/cli/commands/token.d.ts.map +1 -0
  175. package/dist/cli/commands/type-generation/discovery.d.ts +7 -0
  176. package/dist/cli/commands/type-generation/discovery.d.ts.map +1 -0
  177. package/dist/cli/commands/type-generation/generator.d.ts +121 -0
  178. package/dist/cli/commands/type-generation/generator.d.ts.map +1 -0
  179. package/dist/cli/commands/type-generation/models.d.ts +27 -0
  180. package/dist/cli/commands/type-generation/models.d.ts.map +1 -0
  181. package/dist/cli/commands/types.d.ts +2 -2
  182. package/dist/cli/commands/types.d.ts.map +1 -1
  183. package/dist/cli/commands/worker.d.ts +4 -0
  184. package/dist/cli/commands/worker.d.ts.map +1 -0
  185. package/dist/cli/config-path.d.ts +6 -0
  186. package/dist/cli/config-path.d.ts.map +1 -0
  187. package/dist/cli/dependencies.d.ts +2 -1
  188. package/dist/cli/dependencies.d.ts.map +1 -1
  189. package/dist/cli/deploy-strategy.d.ts +17 -0
  190. package/dist/cli/deploy-strategy.d.ts.map +1 -0
  191. package/dist/cli/deploy-target.d.ts +17 -0
  192. package/dist/cli/deploy-target.d.ts.map +1 -0
  193. package/dist/cli/generated-artifacts.d.ts +12 -0
  194. package/dist/cli/generated-artifacts.d.ts.map +1 -0
  195. package/dist/cli/gradual-deploy.d.ts +49 -0
  196. package/dist/cli/gradual-deploy.d.ts.map +1 -0
  197. package/dist/cli/help-pages/pages/account.d.ts +3 -0
  198. package/dist/cli/help-pages/pages/account.d.ts.map +1 -0
  199. package/dist/cli/help-pages/pages/core.d.ts +4 -0
  200. package/dist/cli/help-pages/pages/core.d.ts.map +1 -0
  201. package/dist/cli/help-pages/pages/index.d.ts +3 -0
  202. package/dist/cli/help-pages/pages/index.d.ts.map +1 -0
  203. package/dist/cli/help-pages/pages/misc.d.ts +3 -0
  204. package/dist/cli/help-pages/pages/misc.d.ts.map +1 -0
  205. package/dist/cli/help-pages/pages/previews.d.ts +3 -0
  206. package/dist/cli/help-pages/pages/previews.d.ts.map +1 -0
  207. package/dist/cli/help-pages/pages/productions.d.ts +3 -0
  208. package/dist/cli/help-pages/pages/productions.d.ts.map +1 -0
  209. package/dist/cli/help-pages/render.d.ts +12 -0
  210. package/dist/cli/help-pages/render.d.ts.map +1 -0
  211. package/dist/cli/help-pages/shared.d.ts +15 -0
  212. package/dist/cli/help-pages/shared.d.ts.map +1 -0
  213. package/dist/cli/help-pages/types.d.ts +23 -0
  214. package/dist/cli/help-pages/types.d.ts.map +1 -0
  215. package/dist/cli/help.d.ts +6 -0
  216. package/dist/cli/help.d.ts.map +1 -0
  217. package/dist/cli/index.d.ts +1 -0
  218. package/dist/cli/index.d.ts.map +1 -1
  219. package/dist/cli/index.js +2 -0
  220. package/dist/cli/package-metadata.d.ts +16 -0
  221. package/dist/cli/package-metadata.d.ts.map +1 -0
  222. package/dist/cli/preview-bindings.d.ts +49 -0
  223. package/dist/cli/preview-bindings.d.ts.map +1 -0
  224. package/dist/cli/preview.d.ts +10 -0
  225. package/dist/cli/preview.d.ts.map +1 -0
  226. package/dist/cli/ui.d.ts +37 -0
  227. package/dist/cli/ui.d.ts.map +1 -0
  228. package/dist/cli/workspace-build-guard.d.ts +14 -0
  229. package/dist/cli/workspace-build-guard.d.ts.map +1 -0
  230. package/dist/cli/wrangler-auth.d.ts +1 -1
  231. package/dist/cloudflare/account-core.d.ts +6 -0
  232. package/dist/cloudflare/account-core.d.ts.map +1 -0
  233. package/dist/cloudflare/account-resources.d.ts +40 -0
  234. package/dist/cloudflare/account-resources.d.ts.map +1 -0
  235. package/dist/cloudflare/account-status.d.ts +11 -0
  236. package/dist/cloudflare/account-status.d.ts.map +1 -0
  237. package/dist/cloudflare/account-workers.d.ts +14 -0
  238. package/dist/cloudflare/account-workers.d.ts.map +1 -0
  239. package/dist/cloudflare/account.d.ts +7 -64
  240. package/dist/cloudflare/account.d.ts.map +1 -1
  241. package/dist/cloudflare/api.d.ts +71 -3
  242. package/dist/cloudflare/api.d.ts.map +1 -1
  243. package/dist/cloudflare/auth.d.ts +1 -1
  244. package/dist/cloudflare/auth.d.ts.map +1 -1
  245. package/dist/cloudflare/index.d.ts +61 -6
  246. package/dist/cloudflare/index.d.ts.map +1 -1
  247. package/dist/cloudflare/index.js +4 -13
  248. package/dist/cloudflare/known-permission-group-ids.generated.d.ts +10 -0
  249. package/dist/cloudflare/known-permission-group-ids.generated.d.ts.map +1 -0
  250. package/dist/cloudflare/kv-namespace.d.ts +4 -0
  251. package/dist/cloudflare/kv-namespace.d.ts.map +1 -0
  252. package/dist/cloudflare/preferences.d.ts +7 -0
  253. package/dist/cloudflare/preferences.d.ts.map +1 -1
  254. package/dist/cloudflare/preview-registry-cache.d.ts +6 -0
  255. package/dist/cloudflare/preview-registry-cache.d.ts.map +1 -0
  256. package/dist/cloudflare/preview-registry-inference.d.ts +14 -0
  257. package/dist/cloudflare/preview-registry-inference.d.ts.map +1 -0
  258. package/dist/cloudflare/preview-registry-records.d.ts +4 -0
  259. package/dist/cloudflare/preview-registry-records.d.ts.map +1 -0
  260. package/dist/cloudflare/preview-registry-shape.d.ts +47 -0
  261. package/dist/cloudflare/preview-registry-shape.d.ts.map +1 -0
  262. package/dist/cloudflare/preview-registry-store.d.ts +14 -0
  263. package/dist/cloudflare/preview-registry-store.d.ts.map +1 -0
  264. package/dist/cloudflare/preview-registry-transport.d.ts +4 -0
  265. package/dist/cloudflare/preview-registry-transport.d.ts.map +1 -0
  266. package/dist/cloudflare/preview-registry-types.d.ts +103 -0
  267. package/dist/cloudflare/preview-registry-types.d.ts.map +1 -0
  268. package/dist/cloudflare/preview-registry.d.ts +42 -0
  269. package/dist/cloudflare/preview-registry.d.ts.map +1 -0
  270. package/dist/cloudflare/preview-urls.d.ts +3 -0
  271. package/dist/cloudflare/preview-urls.d.ts.map +1 -0
  272. package/dist/cloudflare/registry-schema.d.ts +253 -0
  273. package/dist/cloudflare/registry-schema.d.ts.map +1 -0
  274. package/dist/cloudflare/remote-config.d.ts.map +1 -1
  275. package/dist/cloudflare/tokens.d.ts +44 -0
  276. package/dist/cloudflare/tokens.d.ts.map +1 -0
  277. package/dist/cloudflare/types.d.ts +124 -7
  278. package/dist/cloudflare/types.d.ts.map +1 -1
  279. package/dist/cloudflare/usage.d.ts +31 -3
  280. package/dist/cloudflare/usage.d.ts.map +1 -1
  281. package/dist/config/binding-resolution-helpers.d.ts +41 -0
  282. package/dist/config/binding-resolution-helpers.d.ts.map +1 -0
  283. package/dist/config/compatibility.d.ts +3 -0
  284. package/dist/config/compatibility.d.ts.map +1 -0
  285. package/dist/config/compiler/bindings.d.ts +14 -0
  286. package/dist/config/compiler/bindings.d.ts.map +1 -0
  287. package/dist/config/compiler/core-helpers.d.ts +6 -0
  288. package/dist/config/compiler/core-helpers.d.ts.map +1 -0
  289. package/dist/config/compiler/do-workers.d.ts +34 -0
  290. package/dist/config/compiler/do-workers.d.ts.map +1 -0
  291. package/dist/config/compiler/paths.d.ts +18 -0
  292. package/dist/config/compiler/paths.d.ts.map +1 -0
  293. package/dist/config/compiler/types.d.ts +298 -0
  294. package/dist/config/compiler/types.d.ts.map +1 -0
  295. package/dist/config/compiler.d.ts +22 -134
  296. package/dist/config/compiler.d.ts.map +1 -1
  297. package/dist/config/cron.d.ts +19 -0
  298. package/dist/config/cron.d.ts.map +1 -0
  299. package/dist/config/define.d.ts +8 -5
  300. package/dist/config/define.d.ts.map +1 -1
  301. package/dist/config/deploy-resources.d.ts +58 -0
  302. package/dist/config/deploy-resources.d.ts.map +1 -0
  303. package/dist/config/env-vars.d.ts +309 -0
  304. package/dist/config/env-vars.d.ts.map +1 -0
  305. package/dist/config/framework-providers.d.ts +9 -0
  306. package/dist/config/framework-providers.d.ts.map +1 -0
  307. package/dist/config/index.d.ts +12 -5
  308. package/dist/config/index.d.ts.map +1 -1
  309. package/dist/config/loader.d.ts +2 -1
  310. package/dist/config/loader.d.ts.map +1 -1
  311. package/dist/config/local-dev-vars.d.ts +15 -0
  312. package/dist/config/local-dev-vars.d.ts.map +1 -0
  313. package/dist/config/preview-resources.d.ts +83 -0
  314. package/dist/config/preview-resources.d.ts.map +1 -0
  315. package/dist/config/preview.d.ts +29 -0
  316. package/dist/config/preview.d.ts.map +1 -0
  317. package/dist/config/ref.d.ts +16 -25
  318. package/dist/config/ref.d.ts.map +1 -1
  319. package/dist/config/resolve-phased.d.ts +72 -0
  320. package/dist/config/resolve-phased.d.ts.map +1 -0
  321. package/dist/config/resolve.d.ts +11 -0
  322. package/dist/config/resolve.d.ts.map +1 -0
  323. package/dist/config/resource-resolution.d.ts +80 -0
  324. package/dist/config/resource-resolution.d.ts.map +1 -0
  325. package/dist/config/schema-bindings.d.ts +2025 -0
  326. package/dist/config/schema-bindings.d.ts.map +1 -0
  327. package/dist/config/schema-build.d.ts +67 -0
  328. package/dist/config/schema-build.d.ts.map +1 -0
  329. package/dist/config/schema-env.d.ts +3579 -0
  330. package/dist/config/schema-env.d.ts.map +1 -0
  331. package/dist/config/schema-normalization.d.ts +265 -0
  332. package/dist/config/schema-normalization.d.ts.map +1 -0
  333. package/dist/config/schema-runtime.d.ts +508 -0
  334. package/dist/config/schema-runtime.d.ts.map +1 -0
  335. package/dist/config/schema-types-bindings-platform.d.ts +508 -0
  336. package/dist/config/schema-types-bindings-platform.d.ts.map +1 -0
  337. package/dist/config/schema-types-bindings-resources.d.ts +767 -0
  338. package/dist/config/schema-types-bindings-resources.d.ts.map +1 -0
  339. package/dist/config/schema-types-bindings.d.ts +293 -0
  340. package/dist/config/schema-types-bindings.d.ts.map +1 -0
  341. package/dist/config/schema-types-build.d.ts +86 -0
  342. package/dist/config/schema-types-build.d.ts.map +1 -0
  343. package/dist/config/schema-types-runtime.d.ts +917 -0
  344. package/dist/config/schema-types-runtime.d.ts.map +1 -0
  345. package/dist/config/schema-types.d.ts +424 -0
  346. package/dist/config/schema-types.d.ts.map +1 -0
  347. package/dist/config/schema.d.ts +5324 -2011
  348. package/dist/config/schema.d.ts.map +1 -1
  349. package/dist/config/service-bindings-validation.d.ts +36 -0
  350. package/dist/config/service-bindings-validation.d.ts.map +1 -0
  351. package/dist/config-entry.d.ts +7 -0
  352. package/dist/config-entry.d.ts.map +1 -0
  353. package/dist/config-entry.js +3 -0
  354. package/dist/decorators/durable-object.d.ts.map +1 -1
  355. package/dist/decorators/index.d.ts +2 -2
  356. package/dist/decorators/index.js +2 -9
  357. package/dist/dev-server/d1-migrations.d.ts +36 -0
  358. package/dist/dev-server/d1-migrations.d.ts.map +1 -0
  359. package/dist/dev-server/dev-server-state.d.ts +59 -0
  360. package/dist/dev-server/dev-server-state.d.ts.map +1 -0
  361. package/dist/dev-server/gateway-script.d.ts +21 -0
  362. package/dist/dev-server/gateway-script.d.ts.map +1 -0
  363. package/dist/dev-server/index.d.ts +1 -1
  364. package/dist/dev-server/miniflare-bindings.d.ts +81 -0
  365. package/dist/dev-server/miniflare-bindings.d.ts.map +1 -0
  366. package/dist/dev-server/miniflare-dev-config.d.ts +36 -0
  367. package/dist/dev-server/miniflare-dev-config.d.ts.map +1 -0
  368. package/dist/dev-server/miniflare-log.d.ts +20 -0
  369. package/dist/dev-server/miniflare-log.d.ts.map +1 -0
  370. package/dist/dev-server/miniflare-worker-config.d.ts +82 -0
  371. package/dist/dev-server/miniflare-worker-config.d.ts.map +1 -0
  372. package/dist/dev-server/reload-queue.d.ts +13 -0
  373. package/dist/dev-server/reload-queue.d.ts.map +1 -0
  374. package/dist/dev-server/runtime-stdio.d.ts +8 -0
  375. package/dist/dev-server/runtime-stdio.d.ts.map +1 -0
  376. package/dist/dev-server/server-startup-helpers.d.ts +84 -0
  377. package/dist/dev-server/server-startup-helpers.d.ts.map +1 -0
  378. package/dist/dev-server/server.d.ts +2 -0
  379. package/dist/dev-server/server.d.ts.map +1 -1
  380. package/dist/dev-server/vite-process.d.ts +15 -0
  381. package/dist/dev-server/vite-process.d.ts.map +1 -0
  382. package/dist/dev-server/vite-utils.d.ts +19 -1
  383. package/dist/dev-server/vite-utils.d.ts.map +1 -1
  384. package/dist/dev-server/worker-source-watcher.d.ts +17 -0
  385. package/dist/dev-server/worker-source-watcher.d.ts.map +1 -0
  386. package/dist/dev-server/worker-surface-paths.d.ts +6 -0
  387. package/dist/dev-server/worker-surface-paths.d.ts.map +1 -0
  388. package/dist/env.d.ts +10 -0
  389. package/dist/env.d.ts.map +1 -1
  390. package/dist/index.d.ts +8 -12
  391. package/dist/index.d.ts.map +1 -1
  392. package/dist/index.js +9 -298
  393. package/dist/runtime/context-events.d.ts +13 -0
  394. package/dist/runtime/context-events.d.ts.map +1 -0
  395. package/dist/runtime/context-types.d.ts +82 -0
  396. package/dist/runtime/context-types.d.ts.map +1 -0
  397. package/dist/runtime/context.d.ts +20 -44
  398. package/dist/runtime/context.d.ts.map +1 -1
  399. package/dist/runtime/exports.d.ts +70 -55
  400. package/dist/runtime/exports.d.ts.map +1 -1
  401. package/dist/runtime/index.d.ts +10 -3
  402. package/dist/runtime/index.d.ts.map +1 -1
  403. package/dist/runtime/index.js +5 -111
  404. package/dist/runtime/middleware.d.ts +119 -67
  405. package/dist/runtime/middleware.d.ts.map +1 -1
  406. package/dist/runtime/router/index.d.ts +7 -0
  407. package/dist/runtime/router/index.d.ts.map +1 -0
  408. package/dist/runtime/router/types.d.ts +24 -0
  409. package/dist/runtime/router/types.d.ts.map +1 -0
  410. package/dist/runtime/validation.d.ts +18 -4
  411. package/dist/runtime/validation.d.ts.map +1 -1
  412. package/dist/secrets/local-secrets.d.ts +46 -0
  413. package/dist/secrets/local-secrets.d.ts.map +1 -0
  414. package/dist/shims/local-hyperdrive.d.ts +12 -0
  415. package/dist/shims/local-hyperdrive.d.ts.map +1 -0
  416. package/dist/shims/local-media-bindings.d.ts +19 -0
  417. package/dist/shims/local-media-bindings.d.ts.map +1 -0
  418. package/dist/shims/local-worker-loader.d.ts +3 -0
  419. package/dist/shims/local-worker-loader.d.ts.map +1 -0
  420. package/dist/sveltekit/index.d.ts +1 -1
  421. package/dist/sveltekit/index.d.ts.map +1 -1
  422. package/dist/sveltekit/index.js +313 -167
  423. package/dist/sveltekit/local-bindings.d.ts +4 -0
  424. package/dist/sveltekit/local-bindings.d.ts.map +1 -0
  425. package/dist/sveltekit/platform.d.ts +20 -2
  426. package/dist/sveltekit/platform.d.ts.map +1 -1
  427. package/dist/test/ai-search.d.ts +39 -0
  428. package/dist/test/ai-search.d.ts.map +1 -0
  429. package/dist/test/alarm.d.ts +55 -0
  430. package/dist/test/alarm.d.ts.map +1 -0
  431. package/dist/test/binding-hints.d.ts +10 -0
  432. package/dist/test/binding-hints.d.ts.map +1 -0
  433. package/dist/test/cf.d.ts +71 -35
  434. package/dist/test/cf.d.ts.map +1 -1
  435. package/dist/test/containers.d.ts +87 -0
  436. package/dist/test/containers.d.ts.map +1 -0
  437. package/dist/test/email.d.ts +16 -7
  438. package/dist/test/email.d.ts.map +1 -1
  439. package/dist/test/index.d.ts +20 -21
  440. package/dist/test/index.d.ts.map +1 -1
  441. package/dist/test/index.js +4971 -70
  442. package/dist/test/offline-bindings.d.ts +115 -0
  443. package/dist/test/offline-bindings.d.ts.map +1 -0
  444. package/dist/test/queue.d.ts.map +1 -1
  445. package/dist/test/remote-ai.d.ts.map +1 -1
  446. package/dist/test/remote-cloudflare.d.ts +13 -0
  447. package/dist/test/remote-cloudflare.d.ts.map +1 -0
  448. package/dist/test/remote-vectorize.d.ts.map +1 -1
  449. package/dist/test/resolve-service-bindings.d.ts +64 -4
  450. package/dist/test/resolve-service-bindings.d.ts.map +1 -1
  451. package/dist/test/scheduled.d.ts.map +1 -1
  452. package/dist/test/should-skip.d.ts +14 -18
  453. package/dist/test/should-skip.d.ts.map +1 -1
  454. package/dist/test/simple-context-bindings.d.ts +13 -0
  455. package/dist/test/simple-context-bindings.d.ts.map +1 -0
  456. package/dist/test/simple-context-durable-objects.d.ts +6 -0
  457. package/dist/test/simple-context-durable-objects.d.ts.map +1 -0
  458. package/dist/test/simple-context-env.d.ts +35 -0
  459. package/dist/test/simple-context-env.d.ts.map +1 -0
  460. package/dist/test/simple-context-gateway-script.d.ts +2 -0
  461. package/dist/test/simple-context-gateway-script.d.ts.map +1 -0
  462. package/dist/test/simple-context-handlers.d.ts +12 -0
  463. package/dist/test/simple-context-handlers.d.ts.map +1 -0
  464. package/dist/test/simple-context-lifecycle.d.ts +32 -0
  465. package/dist/test/simple-context-lifecycle.d.ts.map +1 -0
  466. package/dist/test/simple-context-mfconfig.d.ts +10 -0
  467. package/dist/test/simple-context-mfconfig.d.ts.map +1 -0
  468. package/dist/test/simple-context-multi-worker.d.ts +16 -0
  469. package/dist/test/simple-context-multi-worker.d.ts.map +1 -0
  470. package/dist/test/simple-context-paths.d.ts +40 -0
  471. package/dist/test/simple-context-paths.d.ts.map +1 -0
  472. package/dist/test/simple-context-runtime.d.ts +19 -0
  473. package/dist/test/simple-context-runtime.d.ts.map +1 -0
  474. package/dist/test/simple-context-startup.d.ts +11 -0
  475. package/dist/test/simple-context-startup.d.ts.map +1 -0
  476. package/dist/test/simple-context-transport.d.ts +14 -0
  477. package/dist/test/simple-context-transport.d.ts.map +1 -0
  478. package/dist/test/simple-context.d.ts +8 -27
  479. package/dist/test/simple-context.d.ts.map +1 -1
  480. package/dist/test/tail.d.ts +3 -2
  481. package/dist/test/tail.d.ts.map +1 -1
  482. package/dist/test/utilities/analytics-engine.d.ts +22 -0
  483. package/dist/test/utilities/analytics-engine.d.ts.map +1 -0
  484. package/dist/test/utilities/artifacts.d.ts +11 -0
  485. package/dist/test/utilities/artifacts.d.ts.map +1 -0
  486. package/dist/test/utilities/context.d.ts +39 -0
  487. package/dist/test/utilities/context.d.ts.map +1 -0
  488. package/dist/test/utilities/d1.d.ts +21 -0
  489. package/dist/test/utilities/d1.d.ts.map +1 -0
  490. package/dist/test/utilities/env.d.ts +43 -0
  491. package/dist/test/utilities/env.d.ts.map +1 -0
  492. package/dist/test/utilities/kv.d.ts +11 -0
  493. package/dist/test/utilities/kv.d.ts.map +1 -0
  494. package/dist/test/utilities/media.d.ts +16 -0
  495. package/dist/test/utilities/media.d.ts.map +1 -0
  496. package/dist/test/utilities/platform.d.ts +41 -0
  497. package/dist/test/utilities/platform.d.ts.map +1 -0
  498. package/dist/test/utilities/queue.d.ts +5 -0
  499. package/dist/test/utilities/queue.d.ts.map +1 -0
  500. package/dist/test/utilities/r2.d.ts +2 -0
  501. package/dist/test/utilities/r2.d.ts.map +1 -0
  502. package/dist/test/utilities/stream-flagship.d.ts +27 -0
  503. package/dist/test/utilities/stream-flagship.d.ts.map +1 -0
  504. package/dist/test/utilities/vectorize.d.ts +38 -0
  505. package/dist/test/utilities/vectorize.d.ts.map +1 -0
  506. package/dist/test/utilities/workflows.d.ts +26 -0
  507. package/dist/test/utilities/workflows.d.ts.map +1 -0
  508. package/dist/test/utilities.d.ts +13 -98
  509. package/dist/test/utilities.d.ts.map +1 -1
  510. package/dist/test/worker.d.ts +6 -0
  511. package/dist/test/worker.d.ts.map +1 -1
  512. package/dist/transform/durable-object.d.ts.map +1 -1
  513. package/dist/transform/index.d.ts +2 -2
  514. package/dist/transform/worker-entrypoint.d.ts +5 -0
  515. package/dist/transform/worker-entrypoint.d.ts.map +1 -1
  516. package/dist/utils/entrypoint-discovery.d.ts +6 -3
  517. package/dist/utils/entrypoint-discovery.d.ts.map +1 -1
  518. package/dist/utils/glob.d.ts.map +1 -1
  519. package/dist/utils/resolve-package.d.ts.map +1 -1
  520. package/dist/utils/send-email.d.ts +15 -0
  521. package/dist/utils/send-email.d.ts.map +1 -0
  522. package/dist/utils/send-email.js +163 -0
  523. package/dist/vite/config-file.d.ts +25 -0
  524. package/dist/vite/config-file.d.ts.map +1 -0
  525. package/dist/vite/index.d.ts +3 -2
  526. package/dist/vite/index.d.ts.map +1 -1
  527. package/dist/vite/index.js +2 -339
  528. package/dist/vite/plugin-config-hook.d.ts +28 -0
  529. package/dist/vite/plugin-config-hook.d.ts.map +1 -0
  530. package/dist/vite/plugin-context.d.ts +27 -0
  531. package/dist/vite/plugin-context.d.ts.map +1 -0
  532. package/dist/vite/plugin-durable-objects.d.ts +18 -0
  533. package/dist/vite/plugin-durable-objects.d.ts.map +1 -0
  534. package/dist/vite/plugin-programmatic.d.ts +44 -0
  535. package/dist/vite/plugin-programmatic.d.ts.map +1 -0
  536. package/dist/vite/plugin-service-bindings.d.ts +13 -0
  537. package/dist/vite/plugin-service-bindings.d.ts.map +1 -0
  538. package/dist/vite/plugin-transform.d.ts +41 -0
  539. package/dist/vite/plugin-transform.d.ts.map +1 -0
  540. package/dist/vite/plugin.d.ts +10 -41
  541. package/dist/vite/plugin.d.ts.map +1 -1
  542. package/dist/worker-entry/composed-worker.d.ts +7 -0
  543. package/dist/worker-entry/composed-worker.d.ts.map +1 -0
  544. package/dist/worker-entry/durable-object-discovery.d.ts +20 -0
  545. package/dist/worker-entry/durable-object-discovery.d.ts.map +1 -0
  546. package/dist/worker-entry/extensions.d.ts +5 -0
  547. package/dist/worker-entry/extensions.d.ts.map +1 -0
  548. package/dist/worker-entry/routes.d.ts +22 -0
  549. package/dist/worker-entry/routes.d.ts.map +1 -0
  550. package/dist/worker-entry/surface-paths.d.ts +26 -0
  551. package/dist/worker-entry/surface-paths.d.ts.map +1 -0
  552. package/dist/worker-entry/validate-fetch-style.d.ts +12 -0
  553. package/dist/worker-entry/validate-fetch-style.d.ts.map +1 -0
  554. package/dist/workflows/local-workflow-entrypoints.d.ts +7 -0
  555. package/dist/workflows/local-workflow-entrypoints.d.ts.map +1 -0
  556. package/package.json +159 -116
  557. package/R2.md +0 -170
  558. package/dist/account-rvrj687w.js +0 -397
  559. package/dist/ai-dx4fr9jh.js +0 -107
  560. package/dist/bridge/protocol.d.ts.map +0 -1
  561. package/dist/bridge/serialization.d.ts.map +0 -1
  562. package/dist/browser-shim/worker.d.ts +0 -14
  563. package/dist/browser-shim/worker.d.ts.map +0 -1
  564. package/dist/build-mnf6v8gd.js +0 -53
  565. package/dist/deploy-nhceck39.js +0 -70
  566. package/dist/dev-b9dmrj7b.js +0 -2417
  567. package/dist/doctor-fmgb3d28.js +0 -190
  568. package/dist/durable-object-t4kbb0yt.js +0 -13
  569. package/dist/index-07q6yxyc.js +0 -168
  570. package/dist/index-18hvb6gb.js +0 -194
  571. package/dist/index-1xpj0m4r.js +0 -57
  572. package/dist/index-37x76zdn.js +0 -4
  573. package/dist/index-3t6rypgc.js +0 -13
  574. package/dist/index-67qcae0f.js +0 -183
  575. package/dist/index-a855bdsx.js +0 -18
  576. package/dist/index-d8bdkx2h.js +0 -109
  577. package/dist/index-ep3445yc.js +0 -2225
  578. package/dist/index-gz1gndna.js +0 -307
  579. package/dist/index-hcex3rgh.js +0 -266
  580. package/dist/index-m2q41jwa.js +0 -462
  581. package/dist/index-n7rs26ft.js +0 -77
  582. package/dist/index-pf5s73n9.js +0 -1413
  583. package/dist/index-rbht7m9r.js +0 -36
  584. package/dist/index-tfyxa77h.js +0 -850
  585. package/dist/index-tk6ej9dj.js +0 -94
  586. package/dist/index-z14anrqp.js +0 -226
  587. package/dist/init-f9mgmew3.js +0 -186
  588. package/dist/remote-q59qk463.js +0 -97
  589. package/dist/test/bridge-context.d.ts +0 -76
  590. package/dist/test/bridge-context.d.ts.map +0 -1
  591. package/dist/test/multi-worker-context.d.ts +0 -114
  592. package/dist/test/multi-worker-context.d.ts.map +0 -1
  593. package/dist/types-5nyrz1sz.js +0 -454
  594. package/dist/worker-entrypoint-m9th0rg0.js +0 -13
@@ -0,0 +1,81 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { resolve } from "pathe";
3
+ //#region src/config/local-dev-vars.ts
4
+ function parseEnvValue(value) {
5
+ const trimmed = value.trim();
6
+ const quote = trimmed[0];
7
+ if ((quote === "\"" || quote === "'" || quote === "`") && trimmed.endsWith(quote) && trimmed.length >= 2) {
8
+ const inner = trimmed.slice(1, -1);
9
+ return quote === "\"" ? inner.replace(/\\n/g, "\n").replace(/\\r/g, "\r").replace(/\\t/g, " ").replace(/\\"/g, "\"").replace(/\\\\/g, "\\") : inner;
10
+ }
11
+ const commentIndex = trimmed.search(/\s+#/);
12
+ return (commentIndex >= 0 ? trimmed.slice(0, commentIndex) : trimmed).trimEnd();
13
+ }
14
+ function parseEnvFile(contents) {
15
+ const vars = {};
16
+ for (const line of contents.split(/\r?\n/)) {
17
+ const trimmed = line.trim();
18
+ if (!trimmed || trimmed.startsWith("#")) continue;
19
+ const assignment = trimmed.startsWith("export ") ? trimmed.slice(7).trimStart() : trimmed;
20
+ const equalsIndex = assignment.indexOf("=");
21
+ if (equalsIndex <= 0) continue;
22
+ const key = assignment.slice(0, equalsIndex).trim();
23
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) continue;
24
+ vars[key] = parseEnvValue(assignment.slice(equalsIndex + 1));
25
+ }
26
+ return vars;
27
+ }
28
+ async function readOptionalEnvFile(filePath) {
29
+ try {
30
+ return parseEnvFile(await readFile(filePath, "utf8"));
31
+ } catch (error) {
32
+ if (error.code === "ENOENT") return null;
33
+ throw error;
34
+ }
35
+ }
36
+ async function loadWranglerCompatibleLocalVars(cwd, environment) {
37
+ const environmentDevVars = environment ? await readOptionalEnvFile(resolve(cwd, `.dev.vars.${environment}`)) : null;
38
+ if (environmentDevVars) return environmentDevVars;
39
+ const devVars = await readOptionalEnvFile(resolve(cwd, ".dev.vars"));
40
+ if (devVars) return devVars;
41
+ const envFiles = [
42
+ ".env",
43
+ ".env.local",
44
+ ...environment ? [`.env.${environment}`, `.env.${environment}.local`] : []
45
+ ];
46
+ const merged = {};
47
+ for (const fileName of envFiles) {
48
+ const values = await readOptionalEnvFile(resolve(cwd, fileName));
49
+ if (values) Object.assign(merged, values);
50
+ }
51
+ return merged;
52
+ }
53
+ function toWranglerSecretsConfig(secrets) {
54
+ if (!secrets) return;
55
+ const required = Object.entries(secrets).filter(([, config]) => config.required !== false).map(([name]) => name).sort();
56
+ return required.length > 0 ? { required } : void 0;
57
+ }
58
+ async function loadLocalDevVars(options) {
59
+ const activeEnvironment = options.environment ?? process.env.CLOUDFLARE_ENV;
60
+ const localVars = await loadWranglerCompatibleLocalVars(options.cwd, activeEnvironment);
61
+ const secretNames = toWranglerSecretsConfig(options.secrets)?.required;
62
+ const filteredLocalVars = secretNames ? Object.fromEntries(Object.entries(localVars).filter(([name]) => secretNames.includes(name))) : localVars;
63
+ return {
64
+ ...options.vars ?? {},
65
+ ...filteredLocalVars
66
+ };
67
+ }
68
+ async function applyLocalDevVarsToConfig(config, options) {
69
+ const vars = await loadLocalDevVars({
70
+ ...options,
71
+ vars: config.vars,
72
+ secrets: config.secrets
73
+ });
74
+ if (Object.keys(vars).length === 0) return config;
75
+ return {
76
+ ...config,
77
+ vars
78
+ };
79
+ }
80
+ //#endregion
81
+ export { toWranglerSecretsConfig as n, applyLocalDevVarsToConfig as t };
@@ -0,0 +1,119 @@
1
+ //#region src/test/binding-hints.ts
2
+ /**
3
+ * Derive `BindingHints` from a resolved Devflare config.
4
+ *
5
+ * Shared by the test-context surface (`createTestContext` / simple-context) so
6
+ * the mapping between config sections and hint kinds lives in one place.
7
+ */
8
+ function extractBindingHints(config) {
9
+ const hints = {};
10
+ if (config.bindings?.kv) for (const name of Object.keys(config.bindings.kv)) hints[name] = "kv";
11
+ if (config.bindings?.r2) for (const name of Object.keys(config.bindings.r2)) hints[name] = "r2";
12
+ if (config.bindings?.d1) for (const name of Object.keys(config.bindings.d1)) hints[name] = "d1";
13
+ if (config.bindings?.durableObjects) for (const name of Object.keys(config.bindings.durableObjects)) hints[name] = "do";
14
+ if (config.bindings?.services) for (const name of Object.keys(config.bindings.services)) hints[name] = "service";
15
+ if (config.bindings?.queues?.consumers) for (const consumer of config.bindings.queues.consumers) hints[consumer.queue] = "queue";
16
+ if (config.bindings?.queues?.producers) for (const name of Object.keys(config.bindings.queues.producers)) hints[name] = "queue";
17
+ if (config.bindings?.ai) hints[config.bindings.ai.binding] = "ai";
18
+ if (config.bindings?.sendEmail) for (const name of Object.keys(config.bindings.sendEmail)) hints[name] = "sendEmail";
19
+ if (config.bindings?.workflows) for (const name of Object.keys(config.bindings.workflows)) hints[name] = "workflow";
20
+ return hints;
21
+ }
22
+ //#endregion
23
+ //#region src/shims/local-worker-loader.ts
24
+ const activeWorkerLoaderRuntimes = /* @__PURE__ */ new Set();
25
+ function getModuleSource(module, mainModule) {
26
+ if (typeof module === "string") return module;
27
+ if (module && typeof module === "object" && typeof module.js === "string") return module.js;
28
+ throw new Error(`Worker Loader local shim only supports JavaScript main modules. Could not load "${mainModule}".`);
29
+ }
30
+ function createRequestInit(request) {
31
+ return {
32
+ method: request.method,
33
+ headers: request.headers,
34
+ body: request.body
35
+ };
36
+ }
37
+ async function createRuntime(code) {
38
+ const { Miniflare } = await import("miniflare");
39
+ const mainModule = code.mainModule;
40
+ const script = getModuleSource(code.modules[mainModule], mainModule);
41
+ const miniflare = new Miniflare({
42
+ modules: true,
43
+ compatibilityDate: code.compatibilityDate,
44
+ ...code.compatibilityFlags && { compatibilityFlags: code.compatibilityFlags },
45
+ ...code.env && { bindings: code.env },
46
+ script
47
+ });
48
+ await miniflare.ready;
49
+ activeWorkerLoaderRuntimes.add(miniflare);
50
+ return miniflare;
51
+ }
52
+ function createLocalWorkerStub(codeProvider) {
53
+ let runtimePromise = null;
54
+ const getRuntime = () => {
55
+ runtimePromise ??= Promise.resolve(codeProvider()).then(createRuntime);
56
+ return runtimePromise;
57
+ };
58
+ const fetcher = { async fetch(input, init) {
59
+ const request = input instanceof Request ? input : new Request(input, init);
60
+ return (await getRuntime()).dispatchFetch(request.url, createRequestInit(request));
61
+ } };
62
+ return {
63
+ getEntrypoint() {
64
+ return fetcher;
65
+ },
66
+ getDurableObjectClass() {
67
+ throw new Error("Worker Loader local shim cannot materialise a dynamic Durable Object class. getDurableObjectClass() returns an opaque facet-spawning reference that workerd only exposes inside the runtime. Use createTestContext() (a real Miniflare worker) for Durable Object behavior, or createMockWorkerLoader({ stub }) to inject a stub.");
68
+ }
69
+ };
70
+ }
71
+ function createLocalWorkerLoaderBinding() {
72
+ return {
73
+ get(_name, getCode) {
74
+ return createLocalWorkerStub(getCode);
75
+ },
76
+ load(code) {
77
+ return createLocalWorkerStub(() => code);
78
+ }
79
+ };
80
+ }
81
+ async function disposeLocalWorkerLoaderBindings() {
82
+ const runtimes = Array.from(activeWorkerLoaderRuntimes);
83
+ activeWorkerLoaderRuntimes.clear();
84
+ await Promise.all(runtimes.map(async (runtime) => {
85
+ await runtime.dispose();
86
+ }));
87
+ }
88
+ //#endregion
89
+ //#region src/shims/local-hyperdrive.ts
90
+ const HYPERDRIVE_CONNECT_MESSAGE = "Local Hyperdrive does not implement the raw socket connect(). Use the populated connection fields (connectionString, or host/port/user/password/database) with your Node database driver, or run a createTestContext()/Miniflare-backed test (Miniflare establishes real Hyperdrive socket connections) for socket-level behavior.";
91
+ function defaultPortForDatabaseUrl(url) {
92
+ if (url.port) return Number(url.port);
93
+ return url.protocol === "mysql:" ? 3306 : 5432;
94
+ }
95
+ /**
96
+ * Creates a Hyperdrive binding around a local database connection string.
97
+ *
98
+ * The connection fields are real and usable with any Node database client. The
99
+ * Cloudflare `connect()` raw socket is intentionally not implemented — it would
100
+ * require faithfully reproducing `cloudflare:sockets` semantics (TLS, startTls(),
101
+ * half-open, SocketInfo) over node:net, which is exactly the kind of fake that
102
+ * fails silently. It throws a clear, actionable error instead.
103
+ */
104
+ function createLocalHyperdrive(connectionString) {
105
+ const url = new URL(connectionString);
106
+ return {
107
+ connectionString,
108
+ host: url.hostname,
109
+ port: defaultPortForDatabaseUrl(url),
110
+ user: decodeURIComponent(url.username),
111
+ password: decodeURIComponent(url.password),
112
+ database: decodeURIComponent(url.pathname.replace(/^\//, "")),
113
+ connect() {
114
+ throw new Error(HYPERDRIVE_CONNECT_MESSAGE);
115
+ }
116
+ };
117
+ }
118
+ //#endregion
119
+ export { extractBindingHints as i, createLocalWorkerLoaderBinding as n, disposeLocalWorkerLoaderBindings as r, createLocalHyperdrive as t };
@@ -0,0 +1,335 @@
1
+ //#region src/shims/local-media-bindings.ts
2
+ function emptyNodeStream() {
3
+ return new ReadableStream({ start(controller) {
4
+ controller.close();
5
+ } });
6
+ }
7
+ function normalizeNodeContentType(value, fallback) {
8
+ if (!value) return fallback;
9
+ if (value.includes("/")) return value;
10
+ if (value === "jpg" || value === "jpeg") return "image/jpeg";
11
+ if (value === "png") return "image/png";
12
+ if (value === "webp") return "image/webp";
13
+ if (value === "avif") return "image/avif";
14
+ if (value === "mp4") return "video/mp4";
15
+ return value;
16
+ }
17
+ async function readNodeBytes(stream) {
18
+ const buffer = await new Response(stream ?? emptyNodeStream()).arrayBuffer();
19
+ return new Uint8Array(buffer);
20
+ }
21
+ function streamFromNodeBytes(bytes) {
22
+ const copy = new Uint8Array(bytes.byteLength);
23
+ copy.set(bytes);
24
+ return new Response(copy).body ?? emptyNodeStream();
25
+ }
26
+ function createUnsupportedHostedImagesBinding() {
27
+ const unsupported = () => {
28
+ throw new Error("Devflare local Images hosted API is not implemented. Use transform/info APIs locally, or connect to Cloudflare for hosted image storage.");
29
+ };
30
+ return {
31
+ image(_imageId) {
32
+ return {
33
+ details: unsupported,
34
+ bytes: unsupported,
35
+ update: unsupported,
36
+ delete: unsupported
37
+ };
38
+ },
39
+ upload: unsupported,
40
+ list: unsupported
41
+ };
42
+ }
43
+ function createNodeImageResult(bytes, contentType) {
44
+ return {
45
+ response() {
46
+ return new Response(streamFromNodeBytes(bytes), { headers: { "Content-Type": contentType } });
47
+ },
48
+ contentType() {
49
+ return contentType;
50
+ },
51
+ image() {
52
+ return streamFromNodeBytes(bytes);
53
+ }
54
+ };
55
+ }
56
+ function createNodeImageTransformer(bytesPromise) {
57
+ const transformer = {
58
+ transform(_transform) {
59
+ return transformer;
60
+ },
61
+ draw(_image, _options) {
62
+ return transformer;
63
+ },
64
+ async output(options) {
65
+ return createNodeImageResult(await bytesPromise, normalizeNodeContentType(options?.format, "image/png"));
66
+ }
67
+ };
68
+ return transformer;
69
+ }
70
+ function createLocalImagesBinding() {
71
+ return {
72
+ async info(stream) {
73
+ return {
74
+ format: "image/png",
75
+ fileSize: (await readNodeBytes(stream)).byteLength,
76
+ width: 1,
77
+ height: 1
78
+ };
79
+ },
80
+ input(stream) {
81
+ return createNodeImageTransformer(readNodeBytes(stream));
82
+ },
83
+ hosted: createUnsupportedHostedImagesBinding()
84
+ };
85
+ }
86
+ function createNodeMediaResult(bytesPromise, contentType) {
87
+ return {
88
+ async media() {
89
+ return streamFromNodeBytes(await bytesPromise);
90
+ },
91
+ async response() {
92
+ return new Response(streamFromNodeBytes(await bytesPromise), { headers: { "Content-Type": contentType } });
93
+ },
94
+ async contentType() {
95
+ return contentType;
96
+ }
97
+ };
98
+ }
99
+ function createNodeMediaTransformer(bytesPromise) {
100
+ const output = (options = {}) => createNodeMediaResult(bytesPromise, normalizeNodeContentType(options.format, "video/mp4"));
101
+ return {
102
+ transform(_transform) {
103
+ return { output(options) {
104
+ return output(options);
105
+ } };
106
+ },
107
+ output(options) {
108
+ return output(options);
109
+ }
110
+ };
111
+ }
112
+ function createLocalMediaBinding() {
113
+ return { input(stream) {
114
+ return createNodeMediaTransformer(readNodeBytes(stream));
115
+ } };
116
+ }
117
+ const LOCAL_MEDIA_BINDING_SCRIPT = `
118
+ import { RpcTarget, WorkerEntrypoint } from 'cloudflare:workers'
119
+
120
+ function emptyStream() {
121
+ return new ReadableStream({
122
+ start(controller) {
123
+ controller.close()
124
+ }
125
+ })
126
+ }
127
+
128
+ function normalizeContentType(value, fallback) {
129
+ if (typeof value !== 'string' || value.length === 0) return fallback
130
+ if (value.includes('/')) return value
131
+ if (value === 'jpg') return 'image/jpeg'
132
+ if (value === 'jpeg') return 'image/jpeg'
133
+ if (value === 'png') return 'image/png'
134
+ if (value === 'webp') return 'image/webp'
135
+ if (value === 'avif') return 'image/avif'
136
+ if (value === 'mp4') return 'video/mp4'
137
+ return value
138
+ }
139
+
140
+ async function readBytes(stream) {
141
+ return await new Response(stream || emptyStream()).arrayBuffer()
142
+ }
143
+
144
+ function streamFromBytes(bytes) {
145
+ return new Response(bytes.slice(0)).body || emptyStream()
146
+ }
147
+
148
+ function createBodyReader(bytes) {
149
+ return function takeBody() {
150
+ return streamFromBytes(bytes)
151
+ }
152
+ }
153
+
154
+ class LocalImageResult extends RpcTarget {
155
+ constructor(takeBody, contentType) {
156
+ super()
157
+ this.takeBody = takeBody
158
+ this.contentTypeValue = contentType
159
+ }
160
+
161
+ response() {
162
+ return new Response(this.takeBody(), {
163
+ headers: { 'Content-Type': this.contentTypeValue }
164
+ })
165
+ }
166
+
167
+ contentType() {
168
+ return this.contentTypeValue
169
+ }
170
+
171
+ image() {
172
+ return this.takeBody()
173
+ }
174
+ }
175
+
176
+ class LocalImageTransformer extends RpcTarget {
177
+ constructor(bytes) {
178
+ super()
179
+ this.takeBody = createBodyReader(bytes)
180
+ }
181
+
182
+ transform() {
183
+ return this
184
+ }
185
+
186
+ draw() {
187
+ return this
188
+ }
189
+
190
+ async output(options = {}) {
191
+ return new LocalImageResult(
192
+ this.takeBody,
193
+ normalizeContentType(options.format, 'image/png')
194
+ )
195
+ }
196
+ }
197
+
198
+ function createHostedImagesBinding() {
199
+ const unsupported = () => {
200
+ 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.')
201
+ }
202
+ return {
203
+ image() {
204
+ return {
205
+ details: unsupported,
206
+ bytes: unsupported,
207
+ update: unsupported,
208
+ delete: unsupported
209
+ }
210
+ },
211
+ upload: unsupported,
212
+ list: unsupported
213
+ }
214
+ }
215
+
216
+ export class LocalImagesBinding extends WorkerEntrypoint {
217
+ async info(stream) {
218
+ const bytes = await readBytes(stream)
219
+ return {
220
+ format: 'image/png',
221
+ fileSize: bytes.byteLength,
222
+ width: 1,
223
+ height: 1
224
+ }
225
+ }
226
+
227
+ async input(stream) {
228
+ return new LocalImageTransformer(await readBytes(stream))
229
+ }
230
+
231
+ get hosted() {
232
+ return createHostedImagesBinding()
233
+ }
234
+ }
235
+
236
+ class LocalMediaResult extends RpcTarget {
237
+ constructor(takeBody, contentType) {
238
+ super()
239
+ this.takeBody = takeBody
240
+ this.contentTypeValue = contentType
241
+ }
242
+
243
+ async media() {
244
+ return this.takeBody()
245
+ }
246
+
247
+ async response() {
248
+ return new Response(this.takeBody(), {
249
+ headers: { 'Content-Type': this.contentTypeValue }
250
+ })
251
+ }
252
+
253
+ async contentType() {
254
+ return this.contentTypeValue
255
+ }
256
+ }
257
+
258
+ class LocalMediaTransformationGenerator extends RpcTarget {
259
+ constructor(takeBody) {
260
+ super()
261
+ this.takeBody = takeBody
262
+ }
263
+
264
+ output(options = {}) {
265
+ return new LocalMediaResult(
266
+ this.takeBody,
267
+ normalizeContentType(options.format, 'video/mp4')
268
+ )
269
+ }
270
+ }
271
+
272
+ class LocalMediaTransformer extends RpcTarget {
273
+ constructor(bytes) {
274
+ super()
275
+ this.takeBody = createBodyReader(bytes)
276
+ }
277
+
278
+ transform() {
279
+ return new LocalMediaTransformationGenerator(this.takeBody)
280
+ }
281
+
282
+ output(options = {}) {
283
+ return new LocalMediaResult(
284
+ this.takeBody,
285
+ normalizeContentType(options.format, 'video/mp4')
286
+ )
287
+ }
288
+ }
289
+
290
+ export class LocalMediaBinding extends WorkerEntrypoint {
291
+ async input(stream) {
292
+ return new LocalMediaTransformer(await readBytes(stream))
293
+ }
294
+ }
295
+
296
+ export default {
297
+ fetch() {
298
+ return new Response('Devflare local Images/Media binding')
299
+ }
300
+ }
301
+ `;
302
+ function toLocalShimWorkerName(kind, bindingName, index) {
303
+ return `devflare-local-${kind}-${index}-${bindingName.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || kind}`;
304
+ }
305
+ function getEntrypoint(kind) {
306
+ return kind === "images" ? "LocalImagesBinding" : "LocalMediaBinding";
307
+ }
308
+ function buildLocalBindingShimServiceConfig(config) {
309
+ const entries = [...Object.keys(config.bindings?.images ?? {}).map((bindingName) => ({
310
+ bindingName,
311
+ kind: "images"
312
+ })), ...Object.keys(config.bindings?.media ?? {}).map((bindingName) => ({
313
+ bindingName,
314
+ kind: "media"
315
+ }))];
316
+ return {
317
+ localBindingNames: entries.map((entry) => entry.bindingName),
318
+ serviceBindings: Object.fromEntries(entries.map((entry, index) => {
319
+ const workerName = toLocalShimWorkerName(entry.kind, entry.bindingName, index);
320
+ return [entry.bindingName, {
321
+ name: workerName,
322
+ entrypoint: getEntrypoint(entry.kind)
323
+ }];
324
+ })),
325
+ workers: entries.map((entry, index) => ({
326
+ name: toLocalShimWorkerName(entry.kind, entry.bindingName, index),
327
+ modules: true,
328
+ script: LOCAL_MEDIA_BINDING_SCRIPT,
329
+ compatibilityDate: config.compatibilityDate ?? "2025-01-01",
330
+ ...config.compatibilityFlags && { compatibilityFlags: config.compatibilityFlags }
331
+ }))
332
+ };
333
+ }
334
+ //#endregion
335
+ export { createLocalImagesBinding as n, createLocalMediaBinding as r, buildLocalBindingShimServiceConfig as t };
@@ -0,0 +1,123 @@
1
+ import { _ as normalizeSecretsStoreBinding } from "./schema-normalization-BCwTLTGp.js";
2
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
+ import { dirname, join } from "node:path";
4
+ //#region src/secrets/local-secrets.ts
5
+ const LOCAL_SECRETS_PATH = join(".devflare", "secrets.local.json");
6
+ const LOCAL_SECRET_WRAPPED_BINDING_SCRIPT = `
7
+ class LocalSecretsStoreSecret {
8
+ constructor(env) {
9
+ this.value = env.value
10
+ }
11
+
12
+ async get() {
13
+ return this.value
14
+ }
15
+ }
16
+
17
+ export default function makeBinding(env) {
18
+ return new LocalSecretsStoreSecret(env)
19
+ }
20
+ `;
21
+ function createEmptyLocalSecretsFile() {
22
+ return {
23
+ version: 1,
24
+ stores: {}
25
+ };
26
+ }
27
+ function getLocalSecretsFilePath(cwd) {
28
+ return join(cwd, LOCAL_SECRETS_PATH);
29
+ }
30
+ function parseLocalSecretsFile(raw) {
31
+ const parsed = JSON.parse(raw);
32
+ if (parsed.version !== 1 || !parsed.stores || typeof parsed.stores !== "object") return createEmptyLocalSecretsFile();
33
+ return {
34
+ version: 1,
35
+ stores: parsed.stores
36
+ };
37
+ }
38
+ function readLocalSecretsFile(cwd) {
39
+ const filePath = getLocalSecretsFilePath(cwd);
40
+ if (!existsSync(filePath)) return createEmptyLocalSecretsFile();
41
+ return parseLocalSecretsFile(readFileSync(filePath, "utf8"));
42
+ }
43
+ function writeLocalSecretsFile(cwd, file) {
44
+ const filePath = getLocalSecretsFilePath(cwd);
45
+ mkdirSync(dirname(filePath), { recursive: true });
46
+ writeFileSync(filePath, `${JSON.stringify(file, null, " ")}\n`, {
47
+ encoding: "utf8",
48
+ mode: 384
49
+ });
50
+ }
51
+ function writeLocalSecret({ cwd, storeId, name, value }) {
52
+ const file = readLocalSecretsFile(cwd);
53
+ file.stores[storeId] ??= {};
54
+ file.stores[storeId][name] = {
55
+ value,
56
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
57
+ };
58
+ writeLocalSecretsFile(cwd, file);
59
+ }
60
+ function readLocalSecret({ cwd, storeId, name }) {
61
+ return readLocalSecretsFile(cwd).stores[storeId]?.[name]?.value;
62
+ }
63
+ function deleteLocalSecret({ cwd, storeId, name }) {
64
+ const file = readLocalSecretsFile(cwd);
65
+ const store = file.stores[storeId];
66
+ if (!store || !(name in store)) return false;
67
+ delete store[name];
68
+ if (Object.keys(store).length === 0) delete file.stores[storeId];
69
+ writeLocalSecretsFile(cwd, file);
70
+ return true;
71
+ }
72
+ function listLocalSecrets({ cwd, storeId }) {
73
+ const file = readLocalSecretsFile(cwd);
74
+ const stores = storeId ? { [storeId]: file.stores[storeId] ?? {} } : file.stores;
75
+ return Object.entries(stores).flatMap(([currentStoreId, secrets]) => Object.entries(secrets).map(([name, secret]) => ({
76
+ storeId: currentStoreId,
77
+ name,
78
+ hasValue: typeof secret.value === "string",
79
+ updatedAt: secret.updatedAt
80
+ })));
81
+ }
82
+ function resolveLocalSecretValuesForBindings(config, cwd) {
83
+ const values = {};
84
+ for (const [bindingName, binding] of Object.entries(config.bindings?.secretsStore ?? {})) {
85
+ const normalized = normalizeSecretsStoreBinding(binding, config.secretsStoreId, bindingName);
86
+ const value = readLocalSecret({
87
+ cwd,
88
+ storeId: normalized.storeId,
89
+ name: normalized.secretName
90
+ });
91
+ if (value !== void 0) values[bindingName] = value;
92
+ }
93
+ return values;
94
+ }
95
+ function toLocalSecretWorkerName(bindingName, index) {
96
+ return `devflare-local-secret-${index}-${bindingName.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "secret"}`;
97
+ }
98
+ function buildLocalSecretWrappedBindingConfig(config, cwd) {
99
+ const values = resolveLocalSecretValuesForBindings(config, cwd);
100
+ const entries = Object.entries(values);
101
+ return {
102
+ localBindingNames: entries.map(([bindingName]) => bindingName),
103
+ wrappedBindings: Object.fromEntries(entries.map(([bindingName, value], index) => {
104
+ return [bindingName, {
105
+ scriptName: toLocalSecretWorkerName(bindingName, index),
106
+ bindings: { value }
107
+ }];
108
+ })),
109
+ workers: entries.map(([bindingName], index) => ({
110
+ name: toLocalSecretWorkerName(bindingName, index),
111
+ modules: true,
112
+ script: LOCAL_SECRET_WRAPPED_BINDING_SCRIPT
113
+ }))
114
+ };
115
+ }
116
+ function buildLocalSecretNodeBindings(config, cwd) {
117
+ const values = resolveLocalSecretValuesForBindings(config, cwd);
118
+ return Object.fromEntries(Object.entries(values).map(([bindingName, value]) => [bindingName, { async get() {
119
+ return value;
120
+ } }]));
121
+ }
122
+ //#endregion
123
+ export { resolveLocalSecretValuesForBindings as a, listLocalSecrets as i, buildLocalSecretWrappedBindingConfig as n, writeLocalSecret as o, deleteLocalSecret as r, buildLocalSecretNodeBindings as t };