alchemy 0.75.0 → 0.76.0

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 (226) hide show
  1. package/bin/alchemy.js +302 -287
  2. package/bin/commands/util.ts +8 -4
  3. package/bin/services/execute-alchemy.ts +4 -2
  4. package/bin/services/github-workflow.ts +2 -3
  5. package/bin/services/package-manager.ts +1 -5
  6. package/lib/alchemy.d.ts +1 -1
  7. package/lib/alchemy.d.ts.map +1 -1
  8. package/lib/alchemy.js +1 -1
  9. package/lib/alchemy.js.map +1 -1
  10. package/lib/apply.js +10 -0
  11. package/lib/apply.js.map +1 -1
  12. package/lib/aws/control/types.d.ts.map +1 -1
  13. package/lib/aws/control/types.js.map +1 -1
  14. package/lib/clickhouse/api/sdk.gen.d.ts.map +1 -1
  15. package/lib/clickhouse/api/sdk.gen.js.map +1 -1
  16. package/lib/cloudflare/account-api-token.d.ts.map +1 -1
  17. package/lib/cloudflare/account-api-token.js.map +1 -1
  18. package/lib/cloudflare/bound.d.ts.map +1 -1
  19. package/lib/cloudflare/bucket.d.ts +1 -1
  20. package/lib/cloudflare/bucket.d.ts.map +1 -1
  21. package/lib/cloudflare/bucket.js +1 -1
  22. package/lib/cloudflare/bucket.js.map +1 -1
  23. package/lib/cloudflare/cloudflare-env-proxy.d.ts.map +1 -1
  24. package/lib/cloudflare/cloudflare-env-proxy.js +3 -3
  25. package/lib/cloudflare/cloudflare-env-proxy.js.map +1 -1
  26. package/lib/cloudflare/compatibility-date.gen.d.ts +1 -1
  27. package/lib/cloudflare/compatibility-date.gen.js +1 -1
  28. package/lib/cloudflare/d1-database.d.ts.map +1 -1
  29. package/lib/cloudflare/d1-database.js +0 -4
  30. package/lib/cloudflare/d1-database.js.map +1 -1
  31. package/lib/cloudflare/dns-records.js.map +1 -1
  32. package/lib/cloudflare/hyperdrive.d.ts +0 -1
  33. package/lib/cloudflare/hyperdrive.d.ts.map +1 -1
  34. package/lib/cloudflare/hyperdrive.js.map +1 -1
  35. package/lib/cloudflare/miniflare/delete.d.ts.map +1 -1
  36. package/lib/cloudflare/miniflare/delete.js +3 -0
  37. package/lib/cloudflare/miniflare/delete.js.map +1 -1
  38. package/lib/cloudflare/miniflare/paths.d.ts +0 -1
  39. package/lib/cloudflare/miniflare/paths.d.ts.map +1 -1
  40. package/lib/cloudflare/miniflare/paths.js +4 -17
  41. package/lib/cloudflare/miniflare/paths.js.map +1 -1
  42. package/lib/cloudflare/nuxt/plugin.d.ts.map +1 -1
  43. package/lib/cloudflare/nuxt/plugin.js +2 -2
  44. package/lib/cloudflare/nuxt/plugin.js.map +1 -1
  45. package/lib/cloudflare/queue-consumer.d.ts.map +1 -1
  46. package/lib/cloudflare/queue-consumer.js +0 -2
  47. package/lib/cloudflare/queue-consumer.js.map +1 -1
  48. package/lib/cloudflare/react-router/plugin.d.ts.map +1 -1
  49. package/lib/cloudflare/react-router/plugin.js +0 -1
  50. package/lib/cloudflare/react-router/plugin.js.map +1 -1
  51. package/lib/cloudflare/vite/plugin.d.ts.map +1 -1
  52. package/lib/cloudflare/vite/plugin.js +3 -3
  53. package/lib/cloudflare/vite/plugin.js.map +1 -1
  54. package/lib/cloudflare/website.d.ts.map +1 -1
  55. package/lib/cloudflare/website.js +0 -4
  56. package/lib/cloudflare/website.js.map +1 -1
  57. package/lib/cloudflare/worker-assets.d.ts +1 -1
  58. package/lib/cloudflare/worker-assets.d.ts.map +1 -1
  59. package/lib/cloudflare/worker-assets.js +1 -1
  60. package/lib/cloudflare/worker-assets.js.map +1 -1
  61. package/lib/cloudflare/worker-metadata.d.ts.map +1 -1
  62. package/lib/cloudflare/worker-metadata.js.map +1 -1
  63. package/lib/cloudflare/worker-tail.d.ts.map +1 -1
  64. package/lib/cloudflare/worker-tail.js.map +1 -1
  65. package/lib/cloudflare/worker.d.ts.map +1 -1
  66. package/lib/cloudflare/worker.js +3 -1
  67. package/lib/cloudflare/worker.js.map +1 -1
  68. package/lib/cloudflare/wrangler.json.js +0 -1
  69. package/lib/cloudflare/wrangler.json.js.map +1 -1
  70. package/lib/cloudflare/zone.d.ts +1 -1
  71. package/lib/cloudflare/zone.d.ts.map +1 -1
  72. package/lib/cloudflare/zone.js +3 -28
  73. package/lib/cloudflare/zone.js.map +1 -1
  74. package/lib/coinbase/evm-account.d.ts.map +1 -1
  75. package/lib/coinbase/evm-account.js.map +1 -1
  76. package/lib/coinbase/evm-smart-account.d.ts.map +1 -1
  77. package/lib/coinbase/evm-smart-account.js.map +1 -1
  78. package/lib/docker/api.d.ts.map +1 -1
  79. package/lib/docker/api.js.map +1 -1
  80. package/lib/github/secret.d.ts.map +1 -1
  81. package/lib/github/secret.js.map +1 -1
  82. package/lib/neon/api/sdk.gen.d.ts.map +1 -1
  83. package/lib/neon/api/sdk.gen.js.map +1 -1
  84. package/lib/os/exec.d.ts.map +1 -1
  85. package/lib/os/exec.js.map +1 -1
  86. package/lib/planetscale/api/sdk.gen.d.ts.map +1 -1
  87. package/lib/planetscale/api/sdk.gen.js.map +1 -1
  88. package/lib/prisma-postgres/api/sdk.gen.d.ts.map +1 -1
  89. package/lib/prisma-postgres/api/sdk.gen.js.map +1 -1
  90. package/lib/scope.d.ts.map +1 -1
  91. package/lib/scope.js +2 -2
  92. package/lib/scope.js.map +1 -1
  93. package/lib/sentry/client-key.js +1 -1
  94. package/lib/sentry/client-key.js.map +1 -1
  95. package/lib/test/bun.d.ts.map +1 -1
  96. package/lib/test/bun.js.map +1 -1
  97. package/lib/test/vitest.d.ts.map +1 -1
  98. package/lib/test/vitest.js.map +1 -1
  99. package/lib/util/api/client/client.gen.d.ts +1 -1
  100. package/lib/util/api/client/client.gen.js +45 -45
  101. package/lib/util/api/client/types.gen.d.ts +22 -22
  102. package/lib/util/api/client/utils.gen.d.ts +3 -3
  103. package/lib/util/api/client/utils.gen.d.ts.map +1 -1
  104. package/lib/util/api/client/utils.gen.js +34 -34
  105. package/lib/util/api/client/utils.gen.js.map +1 -1
  106. package/lib/util/api/core/auth.gen.d.ts +3 -3
  107. package/lib/util/api/core/auth.gen.js +3 -3
  108. package/lib/util/api/core/bodySerializer.gen.d.ts +1 -1
  109. package/lib/util/api/core/bodySerializer.gen.js +3 -3
  110. package/lib/util/api/core/params.gen.d.ts +3 -3
  111. package/lib/util/api/core/params.gen.js +7 -7
  112. package/lib/util/api/core/pathSerializer.gen.d.ts +3 -3
  113. package/lib/util/api/core/pathSerializer.gen.js +36 -36
  114. package/lib/util/api/core/serverSentEvents.gen.d.ts +3 -3
  115. package/lib/util/api/core/serverSentEvents.gen.js +18 -18
  116. package/lib/util/api/core/types.gen.d.ts +4 -4
  117. package/lib/util/api/core/utils.gen.d.ts +1 -1
  118. package/lib/util/api/core/utils.gen.js +17 -17
  119. package/lib/util/camel-to-snake.d.ts.map +1 -1
  120. package/lib/util/find-workspace-root.d.ts +3 -0
  121. package/lib/util/find-workspace-root.d.ts.map +1 -0
  122. package/lib/util/find-workspace-root.js +94 -0
  123. package/lib/util/find-workspace-root.js.map +1 -0
  124. package/lib/util/idempotent-spawn.d.ts.map +1 -1
  125. package/lib/util/idempotent-spawn.js +1 -1
  126. package/lib/util/idempotent-spawn.js.map +1 -1
  127. package/lib/util/peer.d.ts.map +1 -1
  128. package/lib/util/peer.js.map +1 -1
  129. package/package.json +1 -1
  130. package/src/alchemy.ts +4 -3
  131. package/src/apply.ts +16 -1
  132. package/src/aws/control/types.ts +87107 -85281
  133. package/src/clickhouse/api/sdk.gen.ts +1 -3
  134. package/src/cloudflare/account-api-token.ts +3 -1
  135. package/src/cloudflare/bound.ts +64 -65
  136. package/src/cloudflare/bucket.ts +4 -7
  137. package/src/cloudflare/cloudflare-env-proxy.ts +2 -4
  138. package/src/cloudflare/compatibility-date.gen.ts +1 -1
  139. package/src/cloudflare/d1-database.ts +0 -9
  140. package/src/cloudflare/dns-records.ts +3 -1
  141. package/src/cloudflare/hyperdrive.ts +0 -1
  142. package/src/cloudflare/miniflare/delete.ts +3 -0
  143. package/src/cloudflare/miniflare/paths.ts +4 -25
  144. package/src/cloudflare/nuxt/plugin.ts +1 -4
  145. package/src/cloudflare/queue-consumer.ts +0 -2
  146. package/src/cloudflare/react-router/plugin.ts +0 -1
  147. package/src/cloudflare/vite/plugin.ts +1 -3
  148. package/src/cloudflare/website.ts +0 -5
  149. package/src/cloudflare/worker-assets.ts +1 -6
  150. package/src/cloudflare/worker-metadata.ts +5 -3
  151. package/src/cloudflare/worker-tail.ts +3 -1
  152. package/src/cloudflare/worker.ts +3 -1
  153. package/src/cloudflare/wrangler.json.ts +0 -1
  154. package/src/cloudflare/zone.ts +6 -38
  155. package/src/coinbase/evm-account.ts +3 -1
  156. package/src/coinbase/evm-smart-account.ts +3 -1
  157. package/src/docker/api.ts +3 -1
  158. package/src/github/secret.ts +5 -1
  159. package/src/neon/api/sdk.gen.ts +1 -3
  160. package/src/os/exec.ts +3 -1
  161. package/src/planetscale/api/sdk.gen.ts +1 -3
  162. package/src/prisma-postgres/api/sdk.gen.ts +1 -3
  163. package/src/scope.ts +2 -2
  164. package/src/sentry/client-key.ts +1 -5
  165. package/src/test/bun.ts +3 -1
  166. package/src/test/vitest.ts +3 -1
  167. package/src/util/api/client/client.gen.ts +49 -49
  168. package/src/util/api/client/types.gen.ts +43 -43
  169. package/src/util/api/client/utils.gen.ts +47 -42
  170. package/src/util/api/core/auth.gen.ts +6 -6
  171. package/src/util/api/core/bodySerializer.gen.ts +4 -4
  172. package/src/util/api/core/params.gen.ts +10 -10
  173. package/src/util/api/core/pathSerializer.gen.ts +39 -39
  174. package/src/util/api/core/serverSentEvents.gen.ts +22 -22
  175. package/src/util/api/core/types.gen.ts +12 -12
  176. package/src/util/api/core/utils.gen.ts +18 -18
  177. package/src/util/camel-to-snake.ts +12 -10
  178. package/src/util/find-workspace-root.ts +112 -0
  179. package/src/util/idempotent-spawn.ts +1 -5
  180. package/src/util/peer.ts +3 -1
  181. package/templates/astro/astro.config.mjs +3 -3
  182. package/templates/astro/src/pages/api/hello.ts +16 -13
  183. package/templates/bun-spa/bun-env.d.ts +0 -1
  184. package/templates/bun-spa/eslint.config.js +11 -12
  185. package/templates/bun-spa/src/App.tsx +0 -1
  186. package/templates/bun-spa/src/frontend.tsx +0 -1
  187. package/templates/hono/src/index.ts +13 -13
  188. package/templates/nextjs/alchemy.run.ts +1 -1
  189. package/templates/nextjs/eslint.config.mjs +1 -1
  190. package/templates/nextjs/next-env.d.ts +1 -1
  191. package/templates/nextjs/next.config.ts +1 -1
  192. package/templates/nextjs/open-next.config.ts +1 -1
  193. package/templates/nextjs/src/app/api/hello/route.ts +2 -2
  194. package/templates/nextjs/src/app/layout.tsx +1 -1
  195. package/templates/nextjs/src/app/page.tsx +14 -15
  196. package/templates/nextjs/types/env.d.ts +4 -4
  197. package/templates/nuxt/server/middleware/auth.ts +1 -1
  198. package/templates/nuxt/server/middleware/hello.ts +2 -2
  199. package/templates/react-router/app/entry.server.tsx +2 -2
  200. package/templates/react-router/vite.config.ts +1 -1
  201. package/templates/react-router/workers/app.ts +2 -2
  202. package/templates/rwsdk/alchemy.run.ts +6 -3
  203. package/templates/sveltekit/src/app.d.ts +7 -7
  204. package/templates/sveltekit/svelte.config.js +4 -4
  205. package/templates/sveltekit/vite.config.ts +3 -3
  206. package/templates/tanstack-start/src/components/Header.tsx +2 -2
  207. package/templates/tanstack-start/src/router.tsx +4 -4
  208. package/templates/tanstack-start/src/routes/__root.tsx +10 -10
  209. package/templates/tanstack-start/src/routes/api.demo-names.ts +6 -6
  210. package/templates/tanstack-start/src/routes/demo.start.api-request.tsx +11 -11
  211. package/templates/tanstack-start/src/routes/demo.start.server-funcs.tsx +30 -30
  212. package/templates/tanstack-start/src/routes/index.tsx +5 -5
  213. package/templates/tanstack-start/vite.config.ts +9 -9
  214. package/templates/typescript/src/worker.ts +5 -1
  215. package/templates/vite/eslint.config.js +12 -12
  216. package/templates/vite/src/App.tsx +7 -7
  217. package/templates/vite/src/main.tsx +6 -6
  218. package/templates/vite/src/worker.ts +11 -12
  219. package/templates/vite/vite.config.ts +2 -2
  220. package/workers/tunnel-proxy.js +1 -1
  221. package/bin/services/find-workspace-root.ts +0 -48
  222. package/lib/cloudflare/miniflare/symlink-miniflare-state.d.ts +0 -2
  223. package/lib/cloudflare/miniflare/symlink-miniflare-state.d.ts.map +0 -1
  224. package/lib/cloudflare/miniflare/symlink-miniflare-state.js +0 -18
  225. package/lib/cloudflare/miniflare/symlink-miniflare-state.js.map +0 -1
  226. package/src/cloudflare/miniflare/symlink-miniflare-state.ts +0 -18
@@ -1,8 +1,12 @@
1
1
  import alchemy from "alchemy";
2
- import { D1Database, DurableObjectNamespace, Redwood } from "alchemy/cloudflare";
2
+ import {
3
+ D1Database,
4
+ DurableObjectNamespace,
5
+ Redwood,
6
+ } from "alchemy/cloudflare";
3
7
 
4
8
  const app = await alchemy("{projectName}");
5
-
9
+
6
10
  const database = await D1Database("database", {
7
11
  migrationsDir: "migrations",
8
12
  });
@@ -22,4 +26,3 @@ console.log({
22
26
  });
23
27
 
24
28
  await app.finalize();
25
-
@@ -1,13 +1,13 @@
1
1
  // See https://svelte.dev/docs/kit/types#app.d.ts
2
2
  // for information about these interfaces
3
3
  declare global {
4
- namespace App {
5
- // interface Error {}
6
- // interface Locals {}
7
- // interface PageData {}
8
- // interface PageState {}
9
- // interface Platform {}
10
- }
4
+ namespace App {
5
+ // interface Error {}
6
+ // interface Locals {}
7
+ // interface PageData {}
8
+ // interface PageState {}
9
+ // interface Platform {}
10
+ }
11
11
  }
12
12
 
13
13
  export {};
@@ -1,12 +1,12 @@
1
- import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
2
- import alchemy from 'alchemy/cloudflare/sveltekit';
1
+ import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
2
+ import alchemy from "alchemy/cloudflare/sveltekit";
3
3
 
4
4
  /** @type {import('@sveltejs/kit').Config} */
5
5
  const config = {
6
6
  preprocess: vitePreprocess(),
7
7
  kit: {
8
- adapter: alchemy()
9
- }
8
+ adapter: alchemy(),
9
+ },
10
10
  };
11
11
 
12
12
  export default config;
@@ -1,6 +1,6 @@
1
- import { sveltekit } from '@sveltejs/kit/vite';
2
- import { defineConfig } from 'vite';
1
+ import { sveltekit } from "@sveltejs/kit/vite";
2
+ import { defineConfig } from "vite";
3
3
 
4
4
  export default defineConfig({
5
- plugins: [sveltekit()],
5
+ plugins: [sveltekit()],
6
6
  });
@@ -1,4 +1,4 @@
1
- import { Link } from '@tanstack/react-router'
1
+ import { Link } from "@tanstack/react-router";
2
2
 
3
3
  export default function Header() {
4
4
  return (
@@ -17,5 +17,5 @@ export default function Header() {
17
17
  </div>
18
18
  </nav>
19
19
  </header>
20
- )
20
+ );
21
21
  }
@@ -1,7 +1,7 @@
1
- import { createRouter } from '@tanstack/react-router'
1
+ import { createRouter } from "@tanstack/react-router";
2
2
 
3
3
  // Import the generated route tree
4
- import { routeTree } from './routeTree.gen'
4
+ import { routeTree } from "./routeTree.gen";
5
5
 
6
6
  // Create a new router instance
7
7
  export const getRouter = () => {
@@ -9,5 +9,5 @@ export const getRouter = () => {
9
9
  routeTree,
10
10
  scrollRestoration: true,
11
11
  defaultPreloadStaleTime: 0,
12
- })
13
- }
12
+ });
13
+ };
@@ -1,33 +1,33 @@
1
- import { HeadContent, Scripts, createRootRoute } from '@tanstack/react-router'
1
+ import { HeadContent, Scripts, createRootRoute } from "@tanstack/react-router";
2
2
 
3
- import Header from '../components/Header'
3
+ import Header from "../components/Header";
4
4
 
5
- import appCss from '../styles.css?url'
5
+ import appCss from "../styles.css?url";
6
6
 
7
7
  export const Route = createRootRoute({
8
8
  head: () => ({
9
9
  meta: [
10
10
  {
11
- charSet: 'utf-8',
11
+ charSet: "utf-8",
12
12
  },
13
13
  {
14
- name: 'viewport',
15
- content: 'width=device-width, initial-scale=1',
14
+ name: "viewport",
15
+ content: "width=device-width, initial-scale=1",
16
16
  },
17
17
  {
18
- title: 'TanStack Start Starter',
18
+ title: "TanStack Start Starter",
19
19
  },
20
20
  ],
21
21
  links: [
22
22
  {
23
- rel: 'stylesheet',
23
+ rel: "stylesheet",
24
24
  href: appCss,
25
25
  },
26
26
  ],
27
27
  }),
28
28
 
29
29
  shellComponent: RootDocument,
30
- })
30
+ });
31
31
 
32
32
  function RootDocument({ children }: { children: React.ReactNode }) {
33
33
  return (
@@ -41,5 +41,5 @@ function RootDocument({ children }: { children: React.ReactNode }) {
41
41
  <Scripts />
42
42
  </body>
43
43
  </html>
44
- )
44
+ );
45
45
  }
@@ -1,15 +1,15 @@
1
- import { createFileRoute } from '@tanstack/react-router'
1
+ import { createFileRoute } from "@tanstack/react-router";
2
2
 
3
- export const Route = createFileRoute('/api/demo-names')({
3
+ export const Route = createFileRoute("/api/demo-names")({
4
4
  server: {
5
5
  handlers: {
6
6
  GET: () => {
7
- return new Response(JSON.stringify(['Alice', 'Bob', 'Charlie']), {
7
+ return new Response(JSON.stringify(["Alice", "Bob", "Charlie"]), {
8
8
  headers: {
9
- 'Content-Type': 'application/json',
9
+ "Content-Type": "application/json",
10
10
  },
11
- })
11
+ });
12
12
  },
13
13
  },
14
14
  },
15
- })
15
+ });
@@ -1,29 +1,29 @@
1
- import { useEffect, useState } from 'react'
1
+ import { useEffect, useState } from "react";
2
2
 
3
- import { createFileRoute } from '@tanstack/react-router'
3
+ import { createFileRoute } from "@tanstack/react-router";
4
4
 
5
5
  function getNames() {
6
- return fetch('/api/demo-names').then((res) => res.json())
6
+ return fetch("/api/demo-names").then((res) => res.json());
7
7
  }
8
8
 
9
- export const Route = createFileRoute('/demo/start/api-request')({
9
+ export const Route = createFileRoute("/demo/start/api-request")({
10
10
  component: Home,
11
- })
11
+ });
12
12
 
13
13
  function Home() {
14
- const [names, setNames] = useState<Array<string>>([])
14
+ const [names, setNames] = useState<Array<string>>([]);
15
15
 
16
16
  useEffect(() => {
17
- getNames().then(setNames)
18
- }, [])
17
+ getNames().then(setNames);
18
+ }, []);
19
19
 
20
20
  return (
21
21
  <div
22
22
  className="flex items-center justify-center min-h-screen p-4 text-white"
23
23
  style={{
24
- backgroundColor: '#000',
24
+ backgroundColor: "#000",
25
25
  backgroundImage:
26
- 'radial-gradient(ellipse 60% 60% at 0% 100%, #444 0%, #222 60%, #000 100%)',
26
+ "radial-gradient(ellipse 60% 60% at 0% 100%, #444 0%, #222 60%, #000 100%)",
27
27
  }}
28
28
  >
29
29
  <div className="w-full max-w-2xl p-8 rounded-xl backdrop-blur-md bg-black/50 shadow-xl border-8 border-black/10">
@@ -40,5 +40,5 @@ function Home() {
40
40
  </ul>
41
41
  </div>
42
42
  </div>
43
- )
43
+ );
44
44
  }
@@ -1,61 +1,61 @@
1
- import fs from 'node:fs'
2
- import { useCallback, useState } from 'react'
3
- import { createFileRoute, useRouter } from '@tanstack/react-router'
4
- import { createServerFn } from '@tanstack/react-start'
1
+ import fs from "node:fs";
2
+ import { useCallback, useState } from "react";
3
+ import { createFileRoute, useRouter } from "@tanstack/react-router";
4
+ import { createServerFn } from "@tanstack/react-start";
5
5
 
6
- const filePath = 'todos.json'
6
+ const filePath = "todos.json";
7
7
 
8
8
  async function readTodos() {
9
9
  return JSON.parse(
10
- await fs.promises.readFile(filePath, 'utf-8').catch(() =>
10
+ await fs.promises.readFile(filePath, "utf-8").catch(() =>
11
11
  JSON.stringify(
12
12
  [
13
- { id: 1, name: 'Get groceries' },
14
- { id: 2, name: 'Buy a new phone' },
13
+ { id: 1, name: "Get groceries" },
14
+ { id: 2, name: "Buy a new phone" },
15
15
  ],
16
16
  null,
17
17
  2,
18
18
  ),
19
19
  ),
20
- )
20
+ );
21
21
  }
22
22
 
23
23
  const getTodos = createServerFn({
24
- method: 'GET',
25
- }).handler(async () => await readTodos())
24
+ method: "GET",
25
+ }).handler(async () => await readTodos());
26
26
 
27
- const addTodo = createServerFn({ method: 'POST' })
27
+ const addTodo = createServerFn({ method: "POST" })
28
28
  .inputValidator((d: string) => d)
29
29
  .handler(async ({ data }) => {
30
- const todos = await readTodos()
31
- todos.push({ id: todos.length + 1, name: data })
32
- await fs.promises.writeFile(filePath, JSON.stringify(todos, null, 2))
33
- return todos
34
- })
30
+ const todos = await readTodos();
31
+ todos.push({ id: todos.length + 1, name: data });
32
+ await fs.promises.writeFile(filePath, JSON.stringify(todos, null, 2));
33
+ return todos;
34
+ });
35
35
 
36
- export const Route = createFileRoute('/demo/start/server-funcs')({
36
+ export const Route = createFileRoute("/demo/start/server-funcs")({
37
37
  component: Home,
38
38
  loader: async () => await getTodos(),
39
- })
39
+ });
40
40
 
41
41
  function Home() {
42
- const router = useRouter()
43
- let todos = Route.useLoaderData()
42
+ const router = useRouter();
43
+ let todos = Route.useLoaderData();
44
44
 
45
- const [todo, setTodo] = useState('')
45
+ const [todo, setTodo] = useState("");
46
46
 
47
47
  const submitTodo = useCallback(async () => {
48
- todos = await addTodo({ data: todo })
49
- setTodo('')
50
- router.invalidate()
51
- }, [addTodo, todo])
48
+ todos = await addTodo({ data: todo });
49
+ setTodo("");
50
+ router.invalidate();
51
+ }, [addTodo, todo]);
52
52
 
53
53
  return (
54
54
  <div
55
55
  className="flex items-center justify-center min-h-screen bg-gradient-to-br from-zinc-800 to-black p-4 text-white"
56
56
  style={{
57
57
  backgroundImage:
58
- 'radial-gradient(50% 50% at 20% 60%, #23272a 0%, #18181b 50%, #000000 100%)',
58
+ "radial-gradient(50% 50% at 20% 60%, #23272a 0%, #18181b 50%, #000000 100%)",
59
59
  }}
60
60
  >
61
61
  <div className="w-full max-w-2xl p-8 rounded-xl backdrop-blur-md bg-black/50 shadow-xl border-8 border-black/10">
@@ -76,8 +76,8 @@ function Home() {
76
76
  value={todo}
77
77
  onChange={(e) => setTodo(e.target.value)}
78
78
  onKeyDown={(e) => {
79
- if (e.key === 'Enter') {
80
- submitTodo()
79
+ if (e.key === "Enter") {
80
+ submitTodo();
81
81
  }
82
82
  }}
83
83
  placeholder="Enter a new todo..."
@@ -93,5 +93,5 @@ function Home() {
93
93
  </div>
94
94
  </div>
95
95
  </div>
96
- )
96
+ );
97
97
  }
@@ -1,9 +1,9 @@
1
- import { createFileRoute } from '@tanstack/react-router'
2
- import logo from '../logo.svg'
1
+ import { createFileRoute } from "@tanstack/react-router";
2
+ import logo from "../logo.svg";
3
3
 
4
- export const Route = createFileRoute('/')({
4
+ export const Route = createFileRoute("/")({
5
5
  component: App,
6
- })
6
+ });
7
7
 
8
8
  function App() {
9
9
  return (
@@ -35,5 +35,5 @@ function App() {
35
35
  </a>
36
36
  </header>
37
37
  </div>
38
- )
38
+ );
39
39
  }
@@ -1,21 +1,21 @@
1
- import tailwindcss from '@tailwindcss/vite'
2
- import { tanstackStart } from '@tanstack/react-start/plugin/vite'
3
- import viteReact from '@vitejs/plugin-react'
4
- import alchemy from 'alchemy/cloudflare/tanstack-start'
5
- import { defineConfig, type PluginOption } from 'vite'
6
- import viteTsConfigPaths from 'vite-tsconfig-paths'
1
+ import tailwindcss from "@tailwindcss/vite";
2
+ import { tanstackStart } from "@tanstack/react-start/plugin/vite";
3
+ import viteReact from "@vitejs/plugin-react";
4
+ import alchemy from "alchemy/cloudflare/tanstack-start";
5
+ import { defineConfig, type PluginOption } from "vite";
6
+ import viteTsConfigPaths from "vite-tsconfig-paths";
7
7
 
8
8
  const config = defineConfig({
9
9
  plugins: [
10
10
  // this is the plugin that enables path aliases
11
11
  viteTsConfigPaths({
12
- projects: ['./tsconfig.json'],
12
+ projects: ["./tsconfig.json"],
13
13
  }),
14
14
  tailwindcss(),
15
15
  alchemy() as PluginOption,
16
16
  tanstackStart(),
17
17
  viteReact(),
18
18
  ],
19
- })
19
+ });
20
20
 
21
- export default config
21
+ export default config;
@@ -1,7 +1,11 @@
1
1
  import type { worker } from "../alchemy.run.ts";
2
2
 
3
3
  export default {
4
- async fetch(request: Request, env: typeof worker.Env, ctx: ExecutionContext): Promise<Response> {
4
+ async fetch(
5
+ request: Request,
6
+ env: typeof worker.Env,
7
+ ctx: ExecutionContext,
8
+ ): Promise<Response> {
5
9
  return new Response("Hello World from my-alchemy-app!");
6
10
  },
7
11
  };
@@ -1,28 +1,28 @@
1
- import js from '@eslint/js'
2
- import globals from 'globals'
3
- import reactHooks from 'eslint-plugin-react-hooks'
4
- import reactRefresh from 'eslint-plugin-react-refresh'
5
- import tseslint from 'typescript-eslint'
1
+ import js from "@eslint/js";
2
+ import globals from "globals";
3
+ import reactHooks from "eslint-plugin-react-hooks";
4
+ import reactRefresh from "eslint-plugin-react-refresh";
5
+ import tseslint from "typescript-eslint";
6
6
 
7
7
  export default tseslint.config(
8
- { ignores: ['dist'] },
8
+ { ignores: ["dist"] },
9
9
  {
10
10
  extends: [js.configs.recommended, ...tseslint.configs.recommended],
11
- files: ['**/*.{ts,tsx}'],
11
+ files: ["**/*.{ts,tsx}"],
12
12
  languageOptions: {
13
13
  ecmaVersion: 2020,
14
14
  globals: globals.browser,
15
15
  },
16
16
  plugins: {
17
- 'react-hooks': reactHooks,
18
- 'react-refresh': reactRefresh,
17
+ "react-hooks": reactHooks,
18
+ "react-refresh": reactRefresh,
19
19
  },
20
20
  rules: {
21
21
  ...reactHooks.configs.recommended.rules,
22
- 'react-refresh/only-export-components': [
23
- 'warn',
22
+ "react-refresh/only-export-components": [
23
+ "warn",
24
24
  { allowConstantExport: true },
25
25
  ],
26
26
  },
27
27
  },
28
- )
28
+ );
@@ -1,10 +1,10 @@
1
- import { useState } from 'react'
2
- import reactLogo from './assets/react.svg'
3
- import viteLogo from '/vite.svg'
4
- import './App.css'
1
+ import { useState } from "react";
2
+ import reactLogo from "./assets/react.svg";
3
+ import viteLogo from "/vite.svg";
4
+ import "./App.css";
5
5
 
6
6
  function App() {
7
- const [count, setCount] = useState(0)
7
+ const [count, setCount] = useState(0);
8
8
 
9
9
  return (
10
10
  <>
@@ -29,7 +29,7 @@ function App() {
29
29
  Click on the Vite and React logos to learn more
30
30
  </p>
31
31
  </>
32
- )
32
+ );
33
33
  }
34
34
 
35
- export default App
35
+ export default App;
@@ -1,10 +1,10 @@
1
- import { StrictMode } from 'react'
2
- import { createRoot } from 'react-dom/client'
3
- import './index.css'
4
- import App from './App.tsx'
1
+ import { StrictMode } from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import "./index.css";
4
+ import App from "./App.tsx";
5
5
 
6
- createRoot(document.getElementById('root')!).render(
6
+ createRoot(document.getElementById("root")!).render(
7
7
  <StrictMode>
8
8
  <App />
9
9
  </StrictMode>,
10
- )
10
+ );
@@ -1,13 +1,12 @@
1
1
  export default {
2
- fetch(request) {
3
- const url = new URL(request.url);
4
-
5
- if (url.pathname.startsWith("/api/")) {
6
- return Response.json({
7
- name: "Cloudflare",
8
- });
9
- }
10
- return new Response(null, { status: 404 });
11
- },
12
- } satisfies ExportedHandler<Env>;
13
-
2
+ fetch(request) {
3
+ const url = new URL(request.url);
4
+
5
+ if (url.pathname.startsWith("/api/")) {
6
+ return Response.json({
7
+ name: "Cloudflare",
8
+ });
9
+ }
10
+ return new Response(null, { status: 404 });
11
+ },
12
+ } satisfies ExportedHandler<Env>;
@@ -1,6 +1,6 @@
1
- import react from '@vitejs/plugin-react';
1
+ import react from "@vitejs/plugin-react";
2
2
  import alchemy from "alchemy/cloudflare/vite";
3
- import { defineConfig } from 'vite';
3
+ import { defineConfig } from "vite";
4
4
 
5
5
  // https://vite.dev/config/
6
6
  export default defineConfig({
@@ -34,7 +34,7 @@ var h={async fetch(e,r){let n=new URL(e.url);n.host=r.TUNNEL_HOST;let l=new Head
34
34
  Alchemy</a>.</p>
35
35
  </div>
36
36
  <div class="bg-slate-200 px-5 py-3 flex flex-col w-full max-w-lg">
37
- <p class="text-sm text-slate-500">Alchemy 0.75.0</p>
37
+ <p class="text-sm text-slate-500">Alchemy 0.76.0</p>
38
38
  </div>
39
39
  </div>
40
40
  </body>
@@ -1,48 +0,0 @@
1
- import fs from "node:fs/promises";
2
- import path from "pathe";
3
-
4
- export async function findWorkspaceRoot(dir: string = process.cwd()) {
5
- if ((await fs.stat(dir)).isDirectory()) {
6
- if (await exists(dir, ".git")) {
7
- // the root of the git repo is usually the workspace root and we should always stop here
8
- return dir;
9
- } else if ((await read(dir, "package.json"))?.workspaces) {
10
- // package.json with workspaces (bun, npm, etc.)
11
- return dir;
12
- } else if (await anyExists(dir, ...rootFiles)) {
13
- return dir;
14
- }
15
- }
16
- return findWorkspaceRoot(path.resolve(dir, ".."));
17
- }
18
-
19
- const read = (...p: string[]): Promise<any> =>
20
- fs
21
- .readFile(path.join(...p), "utf8")
22
- .then(JSON.parse)
23
- .catch(() => undefined);
24
-
25
- const exists = (...p: string[]) =>
26
- fs
27
- .access(path.join(...p))
28
- .then(() => true)
29
- .catch(() => false);
30
-
31
- const anyExists = (base: string, ...files: string[]) =>
32
- Promise.all(files.map((file) => exists(base, file))).then((results) =>
33
- results.some(Boolean),
34
- );
35
-
36
- const rootFiles = [
37
- // pnpm
38
- "pnpm-workspace.yaml",
39
- "pnpm-workspace.yml",
40
- // lerna
41
- "lerna.json",
42
- // nx
43
- "nx.json",
44
- // turbo
45
- // "turbo.json",
46
- // rush
47
- "rush.json",
48
- ];
@@ -1,2 +0,0 @@
1
- export declare function writeMiniflareSymlink(rootDir: string, cwd: string): Promise<void>;
2
- //# sourceMappingURL=symlink-miniflare-state.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"symlink-miniflare-state.d.ts","sourceRoot":"","sources":["../../../src/cloudflare/miniflare/symlink-miniflare-state.ts"],"names":[],"mappings":"AAIA,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAavE"}
@@ -1,18 +0,0 @@
1
- import fs from "node:fs/promises";
2
- import path from "pathe";
3
- import { getDefaultPersistPath } from "./paths.js";
4
- export async function writeMiniflareSymlink(rootDir, cwd) {
5
- const target = path.resolve(getDefaultPersistPath(cwd));
6
- await fs.mkdir(target, { recursive: true });
7
- if (cwd === rootDir) {
8
- return;
9
- }
10
- const persistPath = path.resolve(cwd, getDefaultPersistPath(rootDir));
11
- await fs.mkdir(path.dirname(persistPath), { recursive: true });
12
- await fs.symlink(target, persistPath).catch((e) => {
13
- if (e.code !== "EEXIST") {
14
- throw e;
15
- }
16
- });
17
- }
18
- //# sourceMappingURL=symlink-miniflare-state.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"symlink-miniflare-state.js","sourceRoot":"","sources":["../../../src/cloudflare/miniflare/symlink-miniflare-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,OAAO,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAAe,EAAE,GAAW;IACtE,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC;IACxD,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,IAAI,GAAG,KAAK,OAAO,EAAE,CAAC;QACpB,OAAO;IACT,CAAC;IACD,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC;IACtE,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/D,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QAChD,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACxB,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,18 +0,0 @@
1
- import fs from "node:fs/promises";
2
- import path from "pathe";
3
- import { getDefaultPersistPath } from "./paths.ts";
4
-
5
- export async function writeMiniflareSymlink(rootDir: string, cwd: string) {
6
- const target = path.resolve(getDefaultPersistPath(cwd));
7
- await fs.mkdir(target, { recursive: true });
8
- if (cwd === rootDir) {
9
- return;
10
- }
11
- const persistPath = path.resolve(cwd, getDefaultPersistPath(rootDir));
12
- await fs.mkdir(path.dirname(persistPath), { recursive: true });
13
- await fs.symlink(target, persistPath).catch((e) => {
14
- if (e.code !== "EEXIST") {
15
- throw e;
16
- }
17
- });
18
- }