alchemy 0.74.2 → 0.75.1

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 (351) hide show
  1. package/README.md +1 -1
  2. package/bin/alchemy.js +1781 -1746
  3. package/bin/alchemy.ts +1 -1
  4. package/bin/commands/create.ts +5 -4
  5. package/bin/commands/init.ts +109 -65
  6. package/bin/commands/util.ts +3 -1
  7. package/bin/constants.ts +2 -2
  8. package/bin/services/dependencies.ts +4 -4
  9. package/bin/services/execute-alchemy.ts +5 -3
  10. package/bin/services/get-package-version.ts +4 -4
  11. package/bin/services/github-workflow.ts +9 -10
  12. package/bin/services/package-manager.ts +1 -5
  13. package/bin/services/template-manager.ts +20 -13
  14. package/bin/services/vibe-rules.ts +6 -5
  15. package/bin/trpc.ts +7 -0
  16. package/bin/types.ts +1 -0
  17. package/lib/alchemy.d.ts +1 -1
  18. package/lib/alchemy.d.ts.map +1 -1
  19. package/lib/alchemy.js +30 -2
  20. package/lib/alchemy.js.map +1 -1
  21. package/lib/apply.js +10 -0
  22. package/lib/apply.js.map +1 -1
  23. package/lib/auth.js +1 -1
  24. package/lib/auth.js.map +1 -1
  25. package/lib/aws/control/types.d.ts.map +1 -1
  26. package/lib/aws/control/types.js.map +1 -1
  27. package/lib/clickhouse/api/sdk.gen.d.ts.map +1 -1
  28. package/lib/clickhouse/api/sdk.gen.js.map +1 -1
  29. package/lib/cloudflare/account-api-token.d.ts.map +1 -1
  30. package/lib/cloudflare/account-api-token.js.map +1 -1
  31. package/lib/cloudflare/astro/astro.js +1 -1
  32. package/lib/cloudflare/astro/astro.js.map +1 -1
  33. package/lib/cloudflare/bound.d.ts.map +1 -1
  34. package/lib/cloudflare/bucket.d.ts +1 -1
  35. package/lib/cloudflare/bucket.d.ts.map +1 -1
  36. package/lib/cloudflare/bucket.js +1 -1
  37. package/lib/cloudflare/bucket.js.map +1 -1
  38. package/lib/cloudflare/bun-spa/bun-spa.d.ts +1 -1
  39. package/lib/cloudflare/bun-spa/bun-spa.d.ts.map +1 -1
  40. package/lib/cloudflare/bun-spa/bun-spa.js +10 -11
  41. package/lib/cloudflare/bun-spa/bun-spa.js.map +1 -1
  42. package/lib/cloudflare/bun-spa/get-bun-spa-backend.d.ts +11 -0
  43. package/lib/cloudflare/bun-spa/get-bun-spa-backend.d.ts.map +1 -0
  44. package/lib/cloudflare/bun-spa/get-bun-spa-backend.js +26 -0
  45. package/lib/cloudflare/bun-spa/get-bun-spa-backend.js.map +1 -0
  46. package/lib/cloudflare/bun-spa/index.d.ts +2 -0
  47. package/lib/cloudflare/bun-spa/index.d.ts.map +1 -0
  48. package/lib/cloudflare/bun-spa/index.js +2 -0
  49. package/lib/cloudflare/bun-spa/index.js.map +1 -0
  50. package/lib/cloudflare/bundle/internal-worker-bundle.js +1 -1
  51. package/lib/cloudflare/bundle/internal-worker-bundle.js.map +1 -1
  52. package/lib/cloudflare/bundle/plugin-hybrid-node-compat.js +1 -1
  53. package/lib/cloudflare/bundle/plugin-hybrid-node-compat.js.map +1 -1
  54. package/lib/cloudflare/bundle/plugin-node-compat.js +1 -1
  55. package/lib/cloudflare/bundle/plugin-node-compat.js.map +1 -1
  56. package/lib/cloudflare/bundle/plugin-wasm.js +1 -1
  57. package/lib/cloudflare/bundle/plugin-wasm.js.map +1 -1
  58. package/lib/cloudflare/cloudflare-env-proxy.d.ts.map +1 -1
  59. package/lib/cloudflare/cloudflare-env-proxy.js +3 -3
  60. package/lib/cloudflare/cloudflare-env-proxy.js.map +1 -1
  61. package/lib/cloudflare/d1-migrations.js +1 -1
  62. package/lib/cloudflare/d1-migrations.js.map +1 -1
  63. package/lib/cloudflare/dns-records.js.map +1 -1
  64. package/lib/cloudflare/kv-namespace.d.ts +5 -0
  65. package/lib/cloudflare/kv-namespace.d.ts.map +1 -1
  66. package/lib/cloudflare/kv-namespace.js +44 -19
  67. package/lib/cloudflare/kv-namespace.js.map +1 -1
  68. package/lib/cloudflare/miniflare/delete.d.ts.map +1 -1
  69. package/lib/cloudflare/miniflare/delete.js +3 -0
  70. package/lib/cloudflare/miniflare/delete.js.map +1 -1
  71. package/lib/cloudflare/miniflare/miniflare-controller.js +1 -1
  72. package/lib/cloudflare/miniflare/miniflare-controller.js.map +1 -1
  73. package/lib/cloudflare/miniflare/miniflare-worker-proxy.d.ts.map +1 -1
  74. package/lib/cloudflare/miniflare/miniflare-worker-proxy.js +34 -4
  75. package/lib/cloudflare/miniflare/miniflare-worker-proxy.js.map +1 -1
  76. package/lib/cloudflare/miniflare/paths.d.ts +0 -1
  77. package/lib/cloudflare/miniflare/paths.d.ts.map +1 -1
  78. package/lib/cloudflare/miniflare/paths.js +6 -18
  79. package/lib/cloudflare/miniflare/paths.js.map +1 -1
  80. package/lib/cloudflare/next.js +1 -1
  81. package/lib/cloudflare/next.js.map +1 -1
  82. package/lib/cloudflare/nuxt/nuxt.js +1 -1
  83. package/lib/cloudflare/nuxt/nuxt.js.map +1 -1
  84. package/lib/cloudflare/nuxt/plugin.d.ts.map +1 -1
  85. package/lib/cloudflare/nuxt/plugin.js +2 -2
  86. package/lib/cloudflare/nuxt/plugin.js.map +1 -1
  87. package/lib/cloudflare/react-router/plugin.js +1 -1
  88. package/lib/cloudflare/react-router/plugin.js.map +1 -1
  89. package/lib/cloudflare/react-router/react-router.js +1 -1
  90. package/lib/cloudflare/react-router/react-router.js.map +1 -1
  91. package/lib/cloudflare/redwood/redwood.js +1 -1
  92. package/lib/cloudflare/redwood/redwood.js.map +1 -1
  93. package/lib/cloudflare/sveltekit/sveltekit.js +1 -1
  94. package/lib/cloudflare/sveltekit/sveltekit.js.map +1 -1
  95. package/lib/cloudflare/tanstack-start/tanstack-start.js +1 -1
  96. package/lib/cloudflare/tanstack-start/tanstack-start.js.map +1 -1
  97. package/lib/cloudflare/tunnel.d.ts.map +1 -1
  98. package/lib/cloudflare/tunnel.js +25 -1
  99. package/lib/cloudflare/tunnel.js.map +1 -1
  100. package/lib/cloudflare/vite/plugin.d.ts.map +1 -1
  101. package/lib/cloudflare/vite/plugin.js +4 -4
  102. package/lib/cloudflare/vite/plugin.js.map +1 -1
  103. package/lib/cloudflare/website.d.ts.map +1 -1
  104. package/lib/cloudflare/website.js +1 -5
  105. package/lib/cloudflare/website.js.map +1 -1
  106. package/lib/cloudflare/worker-assets.d.ts +1 -1
  107. package/lib/cloudflare/worker-assets.d.ts.map +1 -1
  108. package/lib/cloudflare/worker-assets.js +1 -1
  109. package/lib/cloudflare/worker-assets.js.map +1 -1
  110. package/lib/cloudflare/worker-metadata.d.ts.map +1 -1
  111. package/lib/cloudflare/worker-metadata.js.map +1 -1
  112. package/lib/cloudflare/worker-tail.d.ts.map +1 -1
  113. package/lib/cloudflare/worker-tail.js.map +1 -1
  114. package/lib/cloudflare/worker.d.ts.map +1 -1
  115. package/lib/cloudflare/worker.js +1 -1
  116. package/lib/cloudflare/worker.js.map +1 -1
  117. package/lib/cloudflare/wrangler.json.js +1 -2
  118. package/lib/cloudflare/wrangler.json.js.map +1 -1
  119. package/lib/coinbase/evm-account.d.ts.map +1 -1
  120. package/lib/coinbase/evm-account.js.map +1 -1
  121. package/lib/coinbase/evm-smart-account.d.ts.map +1 -1
  122. package/lib/coinbase/evm-smart-account.js.map +1 -1
  123. package/lib/coinbase/faucet.js +2 -2
  124. package/lib/coinbase/faucet.js.map +1 -1
  125. package/lib/docker/api.d.ts.map +1 -1
  126. package/lib/docker/api.js +1 -1
  127. package/lib/docker/api.js.map +1 -1
  128. package/lib/docker/image.js +1 -1
  129. package/lib/docker/image.js.map +1 -1
  130. package/lib/esbuild/bundle.js +1 -1
  131. package/lib/esbuild/bundle.js.map +1 -1
  132. package/lib/fs/file.js +1 -1
  133. package/lib/fs/file.js.map +1 -1
  134. package/lib/github/secret.d.ts.map +1 -1
  135. package/lib/github/secret.js.map +1 -1
  136. package/lib/llms.js +1 -1
  137. package/lib/llms.js.map +1 -1
  138. package/lib/neon/api/sdk.gen.d.ts.map +1 -1
  139. package/lib/neon/api/sdk.gen.js.map +1 -1
  140. package/lib/os/exec.d.ts.map +1 -1
  141. package/lib/os/exec.js +1 -1
  142. package/lib/os/exec.js.map +1 -1
  143. package/lib/planetscale/api/sdk.gen.d.ts.map +1 -1
  144. package/lib/planetscale/api/sdk.gen.js.map +1 -1
  145. package/lib/prisma-postgres/api/sdk.gen.d.ts.map +1 -1
  146. package/lib/prisma-postgres/api/sdk.gen.js.map +1 -1
  147. package/lib/scope.d.ts.map +1 -1
  148. package/lib/scope.js +3 -3
  149. package/lib/scope.js.map +1 -1
  150. package/lib/sentry/client-key.js +1 -1
  151. package/lib/sentry/client-key.js.map +1 -1
  152. package/lib/state/file-system-state-store.js +1 -1
  153. package/lib/state/file-system-state-store.js.map +1 -1
  154. package/lib/state/migrations.js +1 -1
  155. package/lib/state/migrations.js.map +1 -1
  156. package/lib/state/sqlite-state-store.js +1 -1
  157. package/lib/state/sqlite-state-store.js.map +1 -1
  158. package/lib/stripe/file.d.ts +3 -3
  159. package/lib/stripe/file.js +3 -3
  160. package/lib/test/bun.d.ts.map +1 -1
  161. package/lib/test/bun.js +1 -1
  162. package/lib/test/bun.js.map +1 -1
  163. package/lib/test/prune.js +1 -1
  164. package/lib/test/prune.js.map +1 -1
  165. package/lib/test/vitest.d.ts.map +1 -1
  166. package/lib/test/vitest.js +1 -1
  167. package/lib/test/vitest.js.map +1 -1
  168. package/lib/util/api/client/client.gen.d.ts +1 -1
  169. package/lib/util/api/client/client.gen.js +45 -45
  170. package/lib/util/api/client/types.gen.d.ts +22 -22
  171. package/lib/util/api/client/utils.gen.d.ts +3 -3
  172. package/lib/util/api/client/utils.gen.d.ts.map +1 -1
  173. package/lib/util/api/client/utils.gen.js +34 -34
  174. package/lib/util/api/client/utils.gen.js.map +1 -1
  175. package/lib/util/api/core/auth.gen.d.ts +3 -3
  176. package/lib/util/api/core/auth.gen.js +3 -3
  177. package/lib/util/api/core/bodySerializer.gen.d.ts +1 -1
  178. package/lib/util/api/core/bodySerializer.gen.js +3 -3
  179. package/lib/util/api/core/params.gen.d.ts +3 -3
  180. package/lib/util/api/core/params.gen.js +7 -7
  181. package/lib/util/api/core/pathSerializer.gen.d.ts +3 -3
  182. package/lib/util/api/core/pathSerializer.gen.js +36 -36
  183. package/lib/util/api/core/serverSentEvents.gen.d.ts +3 -3
  184. package/lib/util/api/core/serverSentEvents.gen.js +18 -18
  185. package/lib/util/api/core/types.gen.d.ts +4 -4
  186. package/lib/util/api/core/utils.gen.d.ts +1 -1
  187. package/lib/util/api/core/utils.gen.js +17 -17
  188. package/lib/util/camel-to-snake.d.ts.map +1 -1
  189. package/lib/util/content-type.js +1 -1
  190. package/lib/util/content-type.js.map +1 -1
  191. package/lib/util/find-workspace-root.d.ts +3 -0
  192. package/lib/util/find-workspace-root.d.ts.map +1 -0
  193. package/lib/util/find-workspace-root.js +64 -0
  194. package/lib/util/find-workspace-root.js.map +1 -0
  195. package/lib/util/idempotent-spawn.d.ts.map +1 -1
  196. package/lib/util/idempotent-spawn.js +2 -2
  197. package/lib/util/idempotent-spawn.js.map +1 -1
  198. package/lib/util/lock.js +1 -1
  199. package/lib/util/lock.js.map +1 -1
  200. package/lib/util/peer.d.ts.map +1 -1
  201. package/lib/util/peer.js.map +1 -1
  202. package/package.json +6 -1
  203. package/src/alchemy.ts +60 -4
  204. package/src/apply.ts +16 -1
  205. package/src/auth.ts +1 -1
  206. package/src/aws/control/types.ts +87107 -85281
  207. package/src/clickhouse/api/sdk.gen.ts +1 -3
  208. package/src/cloudflare/account-api-token.ts +3 -1
  209. package/src/cloudflare/astro/astro.ts +1 -1
  210. package/src/cloudflare/bound.ts +64 -65
  211. package/src/cloudflare/bucket.ts +4 -7
  212. package/src/cloudflare/bun-spa/bun-spa.ts +13 -13
  213. package/src/cloudflare/bun-spa/get-bun-spa-backend.ts +29 -0
  214. package/src/cloudflare/bun-spa/index.ts +1 -0
  215. package/src/cloudflare/bundle/internal-worker-bundle.ts +1 -1
  216. package/src/cloudflare/bundle/plugin-hybrid-node-compat.ts +1 -1
  217. package/src/cloudflare/bundle/plugin-node-compat.ts +1 -1
  218. package/src/cloudflare/bundle/plugin-wasm.ts +1 -1
  219. package/src/cloudflare/cloudflare-env-proxy.ts +2 -4
  220. package/src/cloudflare/d1-migrations.ts +1 -1
  221. package/src/cloudflare/dns-records.ts +3 -1
  222. package/src/cloudflare/kv-namespace.ts +52 -20
  223. package/src/cloudflare/miniflare/delete.ts +3 -0
  224. package/src/cloudflare/miniflare/miniflare-controller.ts +1 -1
  225. package/src/cloudflare/miniflare/miniflare-worker-proxy.ts +39 -4
  226. package/src/cloudflare/miniflare/paths.ts +6 -26
  227. package/src/cloudflare/next.ts +1 -1
  228. package/src/cloudflare/nuxt/nuxt.ts +1 -1
  229. package/src/cloudflare/nuxt/plugin.ts +1 -4
  230. package/src/cloudflare/react-router/plugin.ts +1 -1
  231. package/src/cloudflare/react-router/react-router.ts +1 -1
  232. package/src/cloudflare/redwood/redwood.ts +1 -1
  233. package/src/cloudflare/sveltekit/sveltekit.ts +1 -1
  234. package/src/cloudflare/tanstack-start/tanstack-start.ts +1 -1
  235. package/src/cloudflare/tunnel.ts +36 -1
  236. package/src/cloudflare/vite/plugin.ts +2 -4
  237. package/src/cloudflare/website.ts +1 -6
  238. package/src/cloudflare/worker-assets.ts +1 -6
  239. package/src/cloudflare/worker-metadata.ts +5 -3
  240. package/src/cloudflare/worker-tail.ts +3 -1
  241. package/src/cloudflare/worker.ts +1 -3
  242. package/src/cloudflare/wrangler.json.ts +1 -2
  243. package/src/coinbase/evm-account.ts +3 -1
  244. package/src/coinbase/evm-smart-account.ts +3 -1
  245. package/src/coinbase/faucet.ts +2 -2
  246. package/src/docker/api.ts +4 -2
  247. package/src/docker/image.ts +1 -1
  248. package/src/esbuild/bundle.ts +1 -1
  249. package/src/fs/file.ts +1 -1
  250. package/src/github/secret.ts +5 -1
  251. package/src/llms.ts +1 -1
  252. package/src/neon/api/sdk.gen.ts +1 -3
  253. package/src/os/exec.ts +4 -2
  254. package/src/planetscale/api/sdk.gen.ts +1 -3
  255. package/src/prisma-postgres/api/sdk.gen.ts +1 -3
  256. package/src/scope.ts +3 -3
  257. package/src/sentry/client-key.ts +1 -5
  258. package/src/state/file-system-state-store.ts +1 -1
  259. package/src/state/migrations.ts +1 -1
  260. package/src/state/sqlite-state-store.ts +1 -1
  261. package/src/stripe/file.ts +3 -3
  262. package/src/test/bun.ts +4 -2
  263. package/src/test/prune.ts +1 -1
  264. package/src/test/vitest.ts +4 -2
  265. package/src/util/api/client/client.gen.ts +49 -49
  266. package/src/util/api/client/types.gen.ts +43 -43
  267. package/src/util/api/client/utils.gen.ts +47 -42
  268. package/src/util/api/core/auth.gen.ts +6 -6
  269. package/src/util/api/core/bodySerializer.gen.ts +4 -4
  270. package/src/util/api/core/params.gen.ts +10 -10
  271. package/src/util/api/core/pathSerializer.gen.ts +39 -39
  272. package/src/util/api/core/serverSentEvents.gen.ts +22 -22
  273. package/src/util/api/core/types.gen.ts +12 -12
  274. package/src/util/api/core/utils.gen.ts +18 -18
  275. package/src/util/camel-to-snake.ts +12 -10
  276. package/src/util/content-type.ts +1 -1
  277. package/{bin/services → src/util}/find-workspace-root.ts +27 -5
  278. package/src/util/idempotent-spawn.ts +2 -6
  279. package/src/util/lock.ts +1 -1
  280. package/src/util/peer.ts +3 -1
  281. package/templates/astro/alchemy.run.ts +0 -2
  282. package/templates/astro/astro.config.mjs +3 -3
  283. package/templates/astro/src/pages/api/hello.ts +16 -13
  284. package/templates/bun-spa/README.md +94 -0
  285. package/templates/bun-spa/_env +1 -0
  286. package/templates/bun-spa/_env.example +1 -0
  287. package/templates/bun-spa/_gitignore +29 -0
  288. package/templates/bun-spa/alchemy.run.ts +21 -0
  289. package/templates/bun-spa/bun-env.d.ts +25 -0
  290. package/templates/bun-spa/eslint.config.js +26 -0
  291. package/templates/bun-spa/package.json +30 -0
  292. package/templates/bun-spa/src/App.css +46 -0
  293. package/templates/bun-spa/src/App.tsx +53 -0
  294. package/templates/bun-spa/src/assets/logo.svg +1 -0
  295. package/templates/bun-spa/src/assets/react.svg +1 -0
  296. package/templates/bun-spa/src/frontend.tsx +14 -0
  297. package/templates/bun-spa/src/index.css +69 -0
  298. package/templates/bun-spa/src/index.html +14 -0
  299. package/templates/bun-spa/src/worker.ts +51 -0
  300. package/templates/bun-spa/tsconfig.json +24 -0
  301. package/templates/hono/alchemy.run.ts +0 -2
  302. package/templates/hono/src/index.ts +13 -13
  303. package/templates/nextjs/alchemy.run.ts +1 -3
  304. package/templates/nextjs/eslint.config.mjs +1 -1
  305. package/templates/nextjs/next-env.d.ts +1 -1
  306. package/templates/nextjs/next.config.ts +1 -1
  307. package/templates/nextjs/open-next.config.ts +1 -1
  308. package/templates/nextjs/src/app/api/hello/route.ts +2 -2
  309. package/templates/nextjs/src/app/layout.tsx +1 -1
  310. package/templates/nextjs/src/app/page.tsx +14 -15
  311. package/templates/nextjs/types/env.d.ts +4 -4
  312. package/templates/nuxt/alchemy.run.ts +0 -2
  313. package/templates/nuxt/server/middleware/auth.ts +1 -1
  314. package/templates/nuxt/server/middleware/hello.ts +2 -2
  315. package/templates/react-router/alchemy.run.ts +0 -2
  316. package/templates/react-router/app/entry.server.tsx +2 -2
  317. package/templates/react-router/package.json +1 -1
  318. package/templates/react-router/vite.config.ts +1 -1
  319. package/templates/react-router/workers/app.ts +2 -2
  320. package/templates/rwsdk/alchemy.run.ts +6 -4
  321. package/templates/rwsdk/package.json +1 -1
  322. package/templates/sveltekit/alchemy.run.ts +0 -2
  323. package/templates/sveltekit/package.json +1 -1
  324. package/templates/sveltekit/src/app.d.ts +7 -7
  325. package/templates/sveltekit/svelte.config.js +4 -4
  326. package/templates/sveltekit/vite.config.ts +3 -3
  327. package/templates/tanstack-start/alchemy.run.ts +0 -2
  328. package/templates/tanstack-start/package.json +1 -1
  329. package/templates/tanstack-start/src/components/Header.tsx +2 -2
  330. package/templates/tanstack-start/src/router.tsx +4 -4
  331. package/templates/tanstack-start/src/routes/__root.tsx +10 -10
  332. package/templates/tanstack-start/src/routes/api.demo-names.ts +6 -6
  333. package/templates/tanstack-start/src/routes/demo.start.api-request.tsx +11 -11
  334. package/templates/tanstack-start/src/routes/demo.start.server-funcs.tsx +30 -30
  335. package/templates/tanstack-start/src/routes/index.tsx +5 -5
  336. package/templates/tanstack-start/vite.config.ts +9 -9
  337. package/templates/typescript/alchemy.run.ts +0 -2
  338. package/templates/typescript/src/worker.ts +5 -1
  339. package/templates/vite/alchemy.run.ts +0 -2
  340. package/templates/vite/eslint.config.js +12 -12
  341. package/templates/vite/package.json +1 -1
  342. package/templates/vite/src/App.tsx +7 -7
  343. package/templates/vite/src/main.tsx +6 -6
  344. package/templates/vite/src/worker.ts +11 -12
  345. package/templates/vite/vite.config.ts +2 -2
  346. package/workers/tunnel-proxy.js +1 -1
  347. package/lib/cloudflare/miniflare/symlink-miniflare-state.d.ts +0 -2
  348. package/lib/cloudflare/miniflare/symlink-miniflare-state.d.ts.map +0 -1
  349. package/lib/cloudflare/miniflare/symlink-miniflare-state.js +0 -18
  350. package/lib/cloudflare/miniflare/symlink-miniflare-state.js.map +0 -1
  351. package/src/cloudflare/miniflare/symlink-miniflare-state.ts +0 -18
@@ -3,7 +3,6 @@ import {
3
3
  getDefaultConfigPath,
4
4
  getDefaultPersistPath,
5
5
  validateConfigPath,
6
- validatePersistPath,
7
6
  } from "../miniflare/paths.ts";
8
7
 
9
8
  const alchemy = (
@@ -15,9 +14,7 @@ const alchemy = (
15
14
  configPath: validateConfigPath(
16
15
  options.dev?.configPath ?? getDefaultConfigPath(),
17
16
  ),
18
- persistDir: validatePersistPath(
19
- options.dev?.persistDir ?? getDefaultPersistPath(),
20
- ),
17
+ persistDir: options.dev?.persistDir ?? getDefaultPersistPath(),
21
18
  ...options.dev,
22
19
  },
23
20
  ...options,
@@ -1,6 +1,6 @@
1
1
  import type { PluginConfig } from "@cloudflare/vite-plugin";
2
2
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
3
- import { dirname } from "node:path";
3
+ import { dirname } from "pathe";
4
4
  import { getDefaultConfigPath } from "../miniflare/paths.ts";
5
5
  import alchemyVite from "../vite/plugin.ts";
6
6
 
@@ -1,4 +1,4 @@
1
- import path from "node:path";
1
+ import path from "pathe";
2
2
  import { getPackageManagerRunner } from "../../util/detect-package-manager.ts";
3
3
  import type { Assets } from "../assets.ts";
4
4
  import type { Bindings } from "../bindings.ts";
@@ -1,4 +1,4 @@
1
- import path from "node:path";
1
+ import path from "pathe";
2
2
  import type { Assets } from "../assets.ts";
3
3
  import type { Bindings } from "../bindings.ts";
4
4
  import { Vite, type ViteProps } from "../vite/vite.ts";
@@ -1,4 +1,4 @@
1
- import { join } from "node:path";
1
+ import { join } from "pathe";
2
2
  import type { Assets } from "../assets.ts";
3
3
  import type { Bindings } from "../bindings.ts";
4
4
  import { Vite, type ViteProps } from "../vite/vite.ts";
@@ -1,4 +1,4 @@
1
- import path from "node:path";
1
+ import path from "pathe";
2
2
  import { exists } from "../../util/exists.ts";
3
3
  import type { Assets } from "../assets.ts";
4
4
  import type { Bindings } from "../bindings.ts";
@@ -494,6 +494,9 @@ export const Tunnel = Resource(
494
494
  const name =
495
495
  props.name ?? this.output?.name ?? this.scope.createPhysicalName(id);
496
496
 
497
+ // Track if we're replacing the tunnel (don't fetch token in this case)
498
+ let isReplacing = false;
499
+
497
500
  if (this.phase === "update" && this.output.name !== name) {
498
501
  console.log("replacing tunnel", this.output.name, name);
499
502
  this.replace(true);
@@ -563,7 +566,6 @@ export const Tunnel = Resource(
563
566
  (error.message.includes("already have a tunnel with this name") ||
564
567
  error.message.includes("already exists"))
565
568
  ) {
566
- console.log(error);
567
569
  logger.log(`Tunnel '${name}' already exists, adopting it`);
568
570
 
569
571
  // Find the existing tunnel by name
@@ -596,6 +598,12 @@ export const Tunnel = Resource(
596
598
  }
597
599
  }
598
600
 
601
+ // Ensure tunnel token is available (unless we're replacing)
602
+ // Sometimes Cloudflare doesn't return the token in the initial response
603
+ if (!isReplacing && !tunnelData.token) {
604
+ tunnelData.token = await getTunnelToken(api, tunnelData.id);
605
+ }
606
+
599
607
  // Handle DNS records for ingress hostnames
600
608
  let dnsRecords = this.output?.dnsRecords || {};
601
609
 
@@ -918,3 +926,30 @@ export async function findTunnelByName(
918
926
  // No matching tunnel found
919
927
  return null;
920
928
  }
929
+
930
+ /**
931
+ * Get tunnel token
932
+ */
933
+ async function getTunnelToken(
934
+ api: CloudflareApi,
935
+ tunnelId: string,
936
+ ): Promise<string> {
937
+ const response = await api.get(
938
+ `/accounts/${api.accountId}/cfd_tunnel/${tunnelId}/token`,
939
+ );
940
+
941
+ if (!response.ok) {
942
+ logger.error(
943
+ `Failed to fetch token for tunnel ${tunnelId}: ${response.status} ${response.statusText}`,
944
+ );
945
+ await handleApiError(response, "get token", "tunnel", tunnelId);
946
+ }
947
+
948
+ const data = (await response.json()) as CloudflareApiResponse<string>;
949
+ if (!data.result) {
950
+ logger.warn(`Could not retrieve token for tunnel ${tunnelId}`);
951
+ } else {
952
+ logger.log(`Successfully fetched token for tunnel ${tunnelId}`);
953
+ }
954
+ return data.result;
955
+ }
@@ -1,21 +1,19 @@
1
1
  import { cloudflare, type PluginConfig } from "@cloudflare/vite-plugin";
2
- import path from "node:path";
2
+ import path from "pathe";
3
3
  import type { PluginOption } from "vite";
4
4
  import {
5
5
  getDefaultConfigPath,
6
6
  getDefaultPersistPath,
7
7
  validateConfigPath,
8
- validatePersistPath,
9
8
  } from "../miniflare/paths.ts";
10
9
 
11
10
  const alchemy = (config?: PluginConfig): PluginOption => {
12
11
  const persistState = config?.persistState ?? {
13
- path: validatePersistPath(
12
+ path:
14
13
  typeof config?.persistState === "object"
15
14
  ? config.persistState.path
16
15
  : // persist path should default to the /.alchemy/miniflare/v3
17
16
  getDefaultPersistPath(),
18
- ),
19
17
  };
20
18
  if (typeof persistState === "object" && persistState.path.endsWith("v3")) {
21
19
  persistState.path = path.dirname(persistState.path);
@@ -1,6 +1,6 @@
1
1
  import assert from "node:assert";
2
2
  import fs from "node:fs/promises";
3
- import path from "node:path";
3
+ import path from "pathe";
4
4
  import { Exec } from "../os/index.ts";
5
5
  import { Scope } from "../scope.ts";
6
6
  import { dedent } from "../util/dedent.ts";
@@ -9,7 +9,6 @@ import { Assets } from "./assets.ts";
9
9
  import type { Bindings } from "./bindings.ts";
10
10
  import { DEFAULT_COMPATIBILITY_DATE } from "./compatibility-date.gen.ts";
11
11
  import { unionCompatibilityFlags } from "./compatibility-presets.ts";
12
- import { writeMiniflareSymlink } from "./miniflare/symlink-miniflare-state.ts";
13
12
  import {
14
13
  extractStringAndSecretBindings,
15
14
  unencryptSecrets,
@@ -263,10 +262,6 @@ export async function Website<B extends Bindings>(
263
262
  await fs.writeFile(paths.entrypoint, content);
264
263
  }
265
264
 
266
- if (Scope.current.local) {
267
- await writeMiniflareSymlink(Scope.current.rootDir, paths.cwd);
268
- }
269
-
270
265
  await WranglerJson({
271
266
  path: path.relative(paths.cwd, paths.wrangler.path),
272
267
  worker,
@@ -30,12 +30,7 @@ interface FileMetadata {
30
30
  */
31
31
  export async function uploadAssets(
32
32
  api: CloudflareApi,
33
- {
34
- workerName,
35
- assets,
36
- assetConfig,
37
- namespace,
38
- }: {
33
+ { workerName, assets, assetConfig, namespace }: {
39
34
  workerName: string;
40
35
  assets: Assets;
41
36
  assetConfig?: WorkerProps["assets"];
@@ -239,9 +239,11 @@ export async function prepareWorkerMetadata(
239
239
  };
240
240
  },
241
241
  ): Promise<WorkerMetadata> {
242
- const oldSettings = await (props.unstable_cacheWorkerSettings
243
- ? getWorkerSettingsWithCache
244
- : getWorkerSettings)(api, props.workerName);
242
+ const oldSettings = await (
243
+ props.unstable_cacheWorkerSettings
244
+ ? getWorkerSettingsWithCache
245
+ : getWorkerSettings
246
+ )(api, props.workerName);
245
247
  const oldTags: string[] | undefined = Array.from(
246
248
  new Set([
247
249
  ...(oldSettings?.default_environment?.script?.tags ?? []),
@@ -110,7 +110,9 @@ class TailClient {
110
110
  const status = event.response?.status ?? 500;
111
111
  // TODO: make this look nicer
112
112
  logger.log(
113
- `${prefix} ${pc.gray(event.request.method)} ${url.pathname} ${pc.dim(">")} ${status >= 200 && status < 300 ? pc.green(status) : pc.red(status)} ${pc.gray(`(cpu: ${Math.round(data.cpuTime)}ms, wall: ${Math.round(data.wallTime)}ms)`)}`,
113
+ `${prefix} ${pc.gray(event.request.method)} ${url.pathname} ${pc.dim(">")} ${
114
+ status >= 200 && status < 300 ? pc.green(status) : pc.red(status)
115
+ } ${pc.gray(`(cpu: ${Math.round(data.cpuTime)}ms, wall: ${Math.round(data.wallTime)}ms)`)}`,
114
116
  );
115
117
  }
116
118
  for (const log of data.logs) {
@@ -34,6 +34,7 @@ import {
34
34
  } from "./durable-object-namespace.ts";
35
35
  import { type EventSource, isQueueEventSource } from "./event-source.ts";
36
36
  import { deleteMiniflareWorkerData } from "./miniflare/delete.ts";
37
+ import { MiniflareController } from "./miniflare/miniflare-controller.ts";
37
38
  import {
38
39
  QueueConsumer,
39
40
  deleteQueueConsumer,
@@ -966,9 +967,6 @@ const _Worker = Resource(
966
967
  if (props.dev?.url) {
967
968
  url = props.dev.url;
968
969
  } else {
969
- const { MiniflareController } = await import(
970
- "./miniflare/miniflare-controller.js"
971
- );
972
970
  const controller = MiniflareController.singleton;
973
971
  url = await controller.add({
974
972
  api,
@@ -1,5 +1,5 @@
1
1
  import fs from "node:fs/promises";
2
- import path from "node:path";
2
+ import path from "pathe";
3
3
  import type { Context } from "../context.ts";
4
4
  import { Resource } from "../resource.ts";
5
5
  import { Scope } from "../scope.ts";
@@ -861,7 +861,6 @@ function processBindings(
861
861
  });
862
862
  } else {
863
863
  console.log("binding", binding);
864
- // biome-ignore lint/correctness/noVoidTypeReturn: it returns never
865
864
  return assertNever(binding);
866
865
  }
867
866
  }
@@ -207,7 +207,9 @@ export const EvmAccount = Resource(
207
207
  );
208
208
 
209
209
  console.log(
210
- `💧 Requested ${toFund.length} new faucet fund${toFund.length === 1 ? "" : "s"} for ${this.output.address}`,
210
+ `💧 Requested ${toFund.length} new faucet fund${
211
+ toFund.length === 1 ? "" : "s"
212
+ } for ${this.output.address}`,
211
213
  );
212
214
  }
213
215
  } catch (error: any) {
@@ -234,7 +234,9 @@ export const EvmSmartAccount = Resource(
234
234
  );
235
235
 
236
236
  console.log(
237
- `💧 Requested ${toFund.length} new faucet fund${toFund.length === 1 ? "" : "s"} for smart account ${this.output.address}`,
237
+ `💧 Requested ${toFund.length} new faucet fund${
238
+ toFund.length === 1 ? "" : "s"
239
+ } for smart account ${this.output.address}`,
238
240
  );
239
241
  }
240
242
  } catch (error: any) {
@@ -8,9 +8,9 @@
8
8
  * bun node_modules/alchemy/src/coinbase/faucet.ts backend/dev # Fund specific scope
9
9
  */
10
10
 
11
- import { readFile, access } from "node:fs/promises";
12
- import { join } from "node:path";
13
11
  import { glob } from "glob";
12
+ import { access, readFile } from "node:fs/promises";
13
+ import { join } from "pathe";
14
14
  import { createCdpClient } from "./client.ts";
15
15
  import type { EvmAccount } from "./evm-account.ts";
16
16
  import type { EvmSmartAccount } from "./evm-smart-account.ts";
package/src/docker/api.ts CHANGED
@@ -2,7 +2,7 @@ import { execa } from "execa";
2
2
  import { Buffer } from "node:buffer";
3
3
  import { spawn } from "node:child_process";
4
4
  import fs from "node:fs/promises";
5
- import path from "node:path";
5
+ import path from "pathe";
6
6
  import type { Duration, HealthcheckConfig } from "./container.ts";
7
7
 
8
8
  /**
@@ -159,7 +159,9 @@ export class DockerApi {
159
159
  return true;
160
160
  } catch (error) {
161
161
  console.log(
162
- `Docker daemon not running: ${error instanceof Error ? error.message : String(error)}`,
162
+ `Docker daemon not running: ${
163
+ error instanceof Error ? error.message : String(error)
164
+ }`,
163
165
  );
164
166
  return false;
165
167
  }
@@ -1,6 +1,6 @@
1
1
  import fs from "node:fs/promises";
2
2
  import os from "node:os";
3
- import path from "node:path";
3
+ import path from "pathe";
4
4
  import type { Context } from "../context.ts";
5
5
  import { Resource } from "../resource.ts";
6
6
  import type { Secret } from "../secret.ts";
@@ -1,7 +1,7 @@
1
1
  import type esbuild from "esbuild";
2
2
  import crypto from "node:crypto";
3
3
  import fs from "node:fs/promises";
4
- import path from "node:path";
4
+ import path from "pathe";
5
5
  import type { Context } from "../context.ts";
6
6
  import { Resource } from "../resource.ts";
7
7
  import { logger } from "../util/logger.ts";
package/src/fs/file.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import fs from "node:fs";
2
- import path from "node:path";
2
+ import path from "pathe";
3
3
  import type { Context } from "../context.ts";
4
4
  import { Resource } from "../resource.ts";
5
5
  import { ignore } from "../util/ignore.ts";
@@ -190,7 +190,11 @@ export const GitHubSecret = Resource(
190
190
  // If secret type changed, we need to delete the old one first
191
191
  if (secretTypeChanged) {
192
192
  logger.log(
193
- `Secret type changed from ${wasEnvironmentSecret ? "environment" : "repository"} to ${isEnvironmentSecret ? "environment" : "repository"} secret. Deleting the old secret first.`,
193
+ `Secret type changed from ${
194
+ wasEnvironmentSecret ? "environment" : "repository"
195
+ } to ${
196
+ isEnvironmentSecret ? "environment" : "repository"
197
+ } secret. Deleting the old secret first.`,
194
198
  );
195
199
 
196
200
  try {
package/src/llms.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import fs from "node:fs/promises";
2
- import path from "node:path";
2
+ import path from "pathe";
3
3
 
4
4
  export interface AlchemyRule {
5
5
  name: string;
@@ -338,9 +338,7 @@ export type Options<
338
338
  class _HeyApiClient {
339
339
  protected _client: Client = client;
340
340
 
341
- constructor(args?: {
342
- client?: Client;
343
- }) {
341
+ constructor(args?: { client?: Client }) {
344
342
  if (args?.client) {
345
343
  this._client = args.client;
346
344
  }
package/src/os/exec.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { spawn, type SpawnOptions } from "node:child_process";
2
2
  import { createHash } from "node:crypto";
3
- import { join } from "node:path";
3
+ import { join } from "pathe";
4
4
  import type { Context } from "../context.ts";
5
5
  import { Resource } from "../resource.ts";
6
6
  import type { Secret } from "../secret.ts";
@@ -356,7 +356,9 @@ export async function exec(
356
356
  } else {
357
357
  reject(
358
358
  new Error(
359
- `Command failed with exit code ${code}${stderr ? `: ${stderr}` : ""}`,
359
+ `Command failed with exit code ${code}${
360
+ stderr ? `: ${stderr}` : ""
361
+ }`,
360
362
  ),
361
363
  );
362
364
  }
@@ -355,9 +355,7 @@ export type Options<
355
355
  class _HeyApiClient {
356
356
  protected _client: Client = client;
357
357
 
358
- constructor(args?: {
359
- client?: Client;
360
- }) {
358
+ constructor(args?: { client?: Client }) {
361
359
  if (args?.client) {
362
360
  this._client = args.client;
363
361
  }
@@ -86,9 +86,7 @@ export type Options<
86
86
  class _HeyApiClient {
87
87
  protected _client: Client = client;
88
88
 
89
- constructor(args?: {
90
- client?: Client;
91
- }) {
89
+ constructor(args?: { client?: Client }) {
92
90
  if (args?.client) {
93
91
  this._client = args.client;
94
92
  }
package/src/scope.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AsyncLocalStorage } from "node:async_hooks";
2
- import path from "node:path";
3
2
  import util from "node:util";
3
+ import path from "pathe";
4
4
  import pc from "picocolors";
5
5
  import type { Phase } from "./alchemy.ts";
6
6
  import { destroy, destroyAll, DestroyStrategy } from "./destroy.ts";
@@ -173,8 +173,8 @@ export class Scope {
173
173
 
174
174
  public static readonly KIND = "alchemy::Scope" as const;
175
175
 
176
- public static storage = (globalThis.__ALCHEMY_STORAGE__ ??=
177
- new AsyncLocalStorage<Scope>());
176
+ public static storage = globalThis.__ALCHEMY_STORAGE__ ??=
177
+ new AsyncLocalStorage<Scope>();
178
178
 
179
179
  public static getScope(): Scope | undefined {
180
180
  return Scope.storage.getStore();
@@ -340,11 +340,7 @@ async function findClientKeyByName(
340
340
  */
341
341
  async function getClientKeyName(
342
342
  api: SentryApi,
343
- {
344
- organization,
345
- project,
346
- keyId,
347
- }: {
343
+ { organization, project, keyId }: {
348
344
  organization: string;
349
345
  project: string;
350
346
  keyId: string;
@@ -1,5 +1,5 @@
1
1
  import fs from "node:fs";
2
- import path from "node:path";
2
+ import path from "pathe";
3
3
  import { ResourceScope } from "../resource.ts";
4
4
  import type { Scope } from "../scope.ts";
5
5
  import { deserialize, serialize } from "../serde.ts";
@@ -1,4 +1,4 @@
1
- import path from "node:path";
1
+ import path from "pathe";
2
2
 
3
3
  export const MIGRATIONS_DIRECTORY = path.join(
4
4
  import.meta.dirname,
@@ -1,6 +1,6 @@
1
1
  import type { Config as LibSQLConfig } from "@libsql/client";
2
2
  import fs from "node:fs/promises";
3
- import path from "node:path";
3
+ import path from "pathe";
4
4
  import type { Scope } from "../scope.ts";
5
5
  import { exists } from "../util/exists.ts";
6
6
  import { memoize } from "../util/memoize.ts";
@@ -121,21 +121,21 @@ export interface File {
121
121
  * @example
122
122
  * // Upload a dispute evidence file
123
123
  * const disputeEvidence = await File("dispute-evidence", {
124
- * file: fs.readFileSync("./evidence.pdf"),
124
+ * file: await fs.promises.readFile("./evidence.pdf"),
125
125
  * purpose: "dispute_evidence"
126
126
  * });
127
127
  *
128
128
  * @example
129
129
  * // Upload an identity document
130
130
  * const identityDocument = await File("identity-doc", {
131
- * file: fs.readFileSync("./passport.jpg"),
131
+ * file: await fs.promises.readFile("./passport.jpg"),
132
132
  * purpose: "identity_document"
133
133
  * });
134
134
  *
135
135
  * @example
136
136
  * // Upload a business logo with file link
137
137
  * const businessLogo = await File("business-logo", {
138
- * file: fs.readFileSync("./logo.png"),
138
+ * file: await fs.promises.readFile("./logo.png"),
139
139
  * purpose: "business_logo",
140
140
  * fileLink: {
141
141
  * create: true,
package/src/test/bun.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /// <reference types="bun" />
2
2
 
3
3
  import { afterAll, beforeAll, it } from "bun:test";
4
- import path from "node:path";
4
+ import path from "pathe";
5
5
  import { alchemy } from "../alchemy.ts";
6
6
  import { Scope } from "../scope.ts";
7
7
  import type { TestOptions } from "./options.ts";
@@ -98,7 +98,9 @@ export function test(meta: ImportMeta, defaultOptions?: TestOptions): test {
98
98
  // Create local test scope based on filename
99
99
  const scope = new Scope({
100
100
  parent: undefined,
101
- scopeName: `${defaultOptions.prefix ? `${defaultOptions.prefix}-` : ""}${path.basename(meta.filename)}`,
101
+ scopeName: `${
102
+ defaultOptions.prefix ? `${defaultOptions.prefix}-` : ""
103
+ }${path.basename(meta.filename)}`,
102
104
  // parent: globalTestScope,
103
105
  stateStore: defaultOptions?.stateStore,
104
106
  phase: "up",
package/src/test/prune.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as esbuild from "esbuild";
2
2
  import { glob } from "glob";
3
3
  import { exec, spawn } from "node:child_process";
4
- import path from "node:path";
5
4
  import { promisify } from "node:util";
5
+ import path from "pathe";
6
6
 
7
7
  const execAsync = promisify(exec);
8
8
 
@@ -1,4 +1,4 @@
1
- import path from "node:path";
1
+ import path from "pathe";
2
2
  import { afterAll, beforeAll, it } from "vitest";
3
3
  import { alchemy } from "../alchemy.ts";
4
4
  import { Scope } from "../scope.ts";
@@ -128,7 +128,9 @@ export function test(
128
128
 
129
129
  const scope = new Scope({
130
130
  parent: undefined,
131
- scopeName: `${defaultOptions.prefix ? `${defaultOptions.prefix}-` : ""}${path.basename(meta.filename)}`,
131
+ scopeName: `${
132
+ defaultOptions.prefix ? `${defaultOptions.prefix}-` : ""
133
+ }${path.basename(meta.filename)}`,
132
134
  stateStore: defaultOptions?.stateStore,
133
135
  phase: "up",
134
136
  noTrack: true,