alchemy 0.75.0 → 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.
- package/bin/alchemy.js +25 -25
- package/bin/commands/util.ts +3 -1
- package/bin/services/execute-alchemy.ts +4 -2
- package/bin/services/github-workflow.ts +2 -3
- package/bin/services/package-manager.ts +1 -5
- package/lib/alchemy.d.ts +1 -1
- package/lib/alchemy.d.ts.map +1 -1
- package/lib/alchemy.js +1 -1
- package/lib/alchemy.js.map +1 -1
- package/lib/apply.js +10 -0
- package/lib/apply.js.map +1 -1
- package/lib/aws/control/types.d.ts.map +1 -1
- package/lib/aws/control/types.js.map +1 -1
- package/lib/clickhouse/api/sdk.gen.d.ts.map +1 -1
- package/lib/clickhouse/api/sdk.gen.js.map +1 -1
- package/lib/cloudflare/account-api-token.d.ts.map +1 -1
- package/lib/cloudflare/account-api-token.js.map +1 -1
- package/lib/cloudflare/bound.d.ts.map +1 -1
- package/lib/cloudflare/bucket.d.ts +1 -1
- package/lib/cloudflare/bucket.d.ts.map +1 -1
- package/lib/cloudflare/bucket.js +1 -1
- package/lib/cloudflare/bucket.js.map +1 -1
- package/lib/cloudflare/cloudflare-env-proxy.d.ts.map +1 -1
- package/lib/cloudflare/cloudflare-env-proxy.js +3 -3
- package/lib/cloudflare/cloudflare-env-proxy.js.map +1 -1
- package/lib/cloudflare/dns-records.js.map +1 -1
- package/lib/cloudflare/miniflare/delete.d.ts.map +1 -1
- package/lib/cloudflare/miniflare/delete.js +3 -0
- package/lib/cloudflare/miniflare/delete.js.map +1 -1
- package/lib/cloudflare/miniflare/paths.d.ts +0 -1
- package/lib/cloudflare/miniflare/paths.d.ts.map +1 -1
- package/lib/cloudflare/miniflare/paths.js +4 -17
- package/lib/cloudflare/miniflare/paths.js.map +1 -1
- package/lib/cloudflare/nuxt/plugin.d.ts.map +1 -1
- package/lib/cloudflare/nuxt/plugin.js +2 -2
- package/lib/cloudflare/nuxt/plugin.js.map +1 -1
- package/lib/cloudflare/react-router/plugin.d.ts.map +1 -1
- package/lib/cloudflare/react-router/plugin.js +0 -1
- package/lib/cloudflare/react-router/plugin.js.map +1 -1
- package/lib/cloudflare/vite/plugin.d.ts.map +1 -1
- package/lib/cloudflare/vite/plugin.js +3 -3
- package/lib/cloudflare/vite/plugin.js.map +1 -1
- package/lib/cloudflare/website.d.ts.map +1 -1
- package/lib/cloudflare/website.js +0 -4
- package/lib/cloudflare/website.js.map +1 -1
- package/lib/cloudflare/worker-assets.d.ts +1 -1
- package/lib/cloudflare/worker-assets.d.ts.map +1 -1
- package/lib/cloudflare/worker-assets.js +1 -1
- package/lib/cloudflare/worker-assets.js.map +1 -1
- package/lib/cloudflare/worker-metadata.d.ts.map +1 -1
- package/lib/cloudflare/worker-metadata.js.map +1 -1
- package/lib/cloudflare/worker-tail.d.ts.map +1 -1
- package/lib/cloudflare/worker-tail.js.map +1 -1
- package/lib/cloudflare/wrangler.json.js +0 -1
- package/lib/cloudflare/wrangler.json.js.map +1 -1
- package/lib/coinbase/evm-account.d.ts.map +1 -1
- package/lib/coinbase/evm-account.js.map +1 -1
- package/lib/coinbase/evm-smart-account.d.ts.map +1 -1
- package/lib/coinbase/evm-smart-account.js.map +1 -1
- package/lib/docker/api.d.ts.map +1 -1
- package/lib/docker/api.js.map +1 -1
- package/lib/github/secret.d.ts.map +1 -1
- package/lib/github/secret.js.map +1 -1
- package/lib/neon/api/sdk.gen.d.ts.map +1 -1
- package/lib/neon/api/sdk.gen.js.map +1 -1
- package/lib/os/exec.d.ts.map +1 -1
- package/lib/os/exec.js.map +1 -1
- package/lib/planetscale/api/sdk.gen.d.ts.map +1 -1
- package/lib/planetscale/api/sdk.gen.js.map +1 -1
- package/lib/prisma-postgres/api/sdk.gen.d.ts.map +1 -1
- package/lib/prisma-postgres/api/sdk.gen.js.map +1 -1
- package/lib/scope.d.ts.map +1 -1
- package/lib/scope.js +2 -2
- package/lib/scope.js.map +1 -1
- package/lib/sentry/client-key.js +1 -1
- package/lib/sentry/client-key.js.map +1 -1
- package/lib/test/bun.d.ts.map +1 -1
- package/lib/test/bun.js.map +1 -1
- package/lib/test/vitest.d.ts.map +1 -1
- package/lib/test/vitest.js.map +1 -1
- package/lib/util/api/client/client.gen.d.ts +1 -1
- package/lib/util/api/client/client.gen.js +45 -45
- package/lib/util/api/client/types.gen.d.ts +22 -22
- package/lib/util/api/client/utils.gen.d.ts +3 -3
- package/lib/util/api/client/utils.gen.d.ts.map +1 -1
- package/lib/util/api/client/utils.gen.js +34 -34
- package/lib/util/api/client/utils.gen.js.map +1 -1
- package/lib/util/api/core/auth.gen.d.ts +3 -3
- package/lib/util/api/core/auth.gen.js +3 -3
- package/lib/util/api/core/bodySerializer.gen.d.ts +1 -1
- package/lib/util/api/core/bodySerializer.gen.js +3 -3
- package/lib/util/api/core/params.gen.d.ts +3 -3
- package/lib/util/api/core/params.gen.js +7 -7
- package/lib/util/api/core/pathSerializer.gen.d.ts +3 -3
- package/lib/util/api/core/pathSerializer.gen.js +36 -36
- package/lib/util/api/core/serverSentEvents.gen.d.ts +3 -3
- package/lib/util/api/core/serverSentEvents.gen.js +18 -18
- package/lib/util/api/core/types.gen.d.ts +4 -4
- package/lib/util/api/core/utils.gen.d.ts +1 -1
- package/lib/util/api/core/utils.gen.js +17 -17
- package/lib/util/camel-to-snake.d.ts.map +1 -1
- package/lib/util/find-workspace-root.d.ts +3 -0
- package/lib/util/find-workspace-root.d.ts.map +1 -0
- package/lib/util/find-workspace-root.js +64 -0
- package/lib/util/find-workspace-root.js.map +1 -0
- package/lib/util/idempotent-spawn.d.ts.map +1 -1
- package/lib/util/idempotent-spawn.js +1 -1
- package/lib/util/idempotent-spawn.js.map +1 -1
- package/lib/util/peer.d.ts.map +1 -1
- package/lib/util/peer.js.map +1 -1
- package/package.json +1 -1
- package/src/alchemy.ts +4 -3
- package/src/apply.ts +16 -1
- package/src/aws/control/types.ts +87107 -85281
- package/src/clickhouse/api/sdk.gen.ts +1 -3
- package/src/cloudflare/account-api-token.ts +3 -1
- package/src/cloudflare/bound.ts +64 -65
- package/src/cloudflare/bucket.ts +4 -7
- package/src/cloudflare/cloudflare-env-proxy.ts +2 -4
- package/src/cloudflare/dns-records.ts +3 -1
- package/src/cloudflare/miniflare/delete.ts +3 -0
- package/src/cloudflare/miniflare/paths.ts +4 -25
- package/src/cloudflare/nuxt/plugin.ts +1 -4
- package/src/cloudflare/react-router/plugin.ts +0 -1
- package/src/cloudflare/vite/plugin.ts +1 -3
- package/src/cloudflare/website.ts +0 -5
- package/src/cloudflare/worker-assets.ts +1 -6
- package/src/cloudflare/worker-metadata.ts +5 -3
- package/src/cloudflare/worker-tail.ts +3 -1
- package/src/cloudflare/wrangler.json.ts +0 -1
- package/src/coinbase/evm-account.ts +3 -1
- package/src/coinbase/evm-smart-account.ts +3 -1
- package/src/docker/api.ts +3 -1
- package/src/github/secret.ts +5 -1
- package/src/neon/api/sdk.gen.ts +1 -3
- package/src/os/exec.ts +3 -1
- package/src/planetscale/api/sdk.gen.ts +1 -3
- package/src/prisma-postgres/api/sdk.gen.ts +1 -3
- package/src/scope.ts +2 -2
- package/src/sentry/client-key.ts +1 -5
- package/src/test/bun.ts +3 -1
- package/src/test/vitest.ts +3 -1
- package/src/util/api/client/client.gen.ts +49 -49
- package/src/util/api/client/types.gen.ts +43 -43
- package/src/util/api/client/utils.gen.ts +47 -42
- package/src/util/api/core/auth.gen.ts +6 -6
- package/src/util/api/core/bodySerializer.gen.ts +4 -4
- package/src/util/api/core/params.gen.ts +10 -10
- package/src/util/api/core/pathSerializer.gen.ts +39 -39
- package/src/util/api/core/serverSentEvents.gen.ts +22 -22
- package/src/util/api/core/types.gen.ts +12 -12
- package/src/util/api/core/utils.gen.ts +18 -18
- package/src/util/camel-to-snake.ts +12 -10
- package/{bin/services → src/util}/find-workspace-root.ts +26 -4
- package/src/util/idempotent-spawn.ts +1 -5
- package/src/util/peer.ts +3 -1
- package/templates/astro/astro.config.mjs +3 -3
- package/templates/astro/src/pages/api/hello.ts +16 -13
- package/templates/bun-spa/bun-env.d.ts +0 -1
- package/templates/bun-spa/eslint.config.js +11 -12
- package/templates/bun-spa/src/App.tsx +0 -1
- package/templates/bun-spa/src/frontend.tsx +0 -1
- package/templates/hono/src/index.ts +13 -13
- package/templates/nextjs/alchemy.run.ts +1 -1
- package/templates/nextjs/eslint.config.mjs +1 -1
- package/templates/nextjs/next-env.d.ts +1 -1
- package/templates/nextjs/next.config.ts +1 -1
- package/templates/nextjs/open-next.config.ts +1 -1
- package/templates/nextjs/src/app/api/hello/route.ts +2 -2
- package/templates/nextjs/src/app/layout.tsx +1 -1
- package/templates/nextjs/src/app/page.tsx +14 -15
- package/templates/nextjs/types/env.d.ts +4 -4
- package/templates/nuxt/server/middleware/auth.ts +1 -1
- package/templates/nuxt/server/middleware/hello.ts +2 -2
- package/templates/react-router/app/entry.server.tsx +2 -2
- package/templates/react-router/vite.config.ts +1 -1
- package/templates/react-router/workers/app.ts +2 -2
- package/templates/rwsdk/alchemy.run.ts +6 -3
- package/templates/sveltekit/src/app.d.ts +7 -7
- package/templates/sveltekit/svelte.config.js +4 -4
- package/templates/sveltekit/vite.config.ts +3 -3
- package/templates/tanstack-start/src/components/Header.tsx +2 -2
- package/templates/tanstack-start/src/router.tsx +4 -4
- package/templates/tanstack-start/src/routes/__root.tsx +10 -10
- package/templates/tanstack-start/src/routes/api.demo-names.ts +6 -6
- package/templates/tanstack-start/src/routes/demo.start.api-request.tsx +11 -11
- package/templates/tanstack-start/src/routes/demo.start.server-funcs.tsx +30 -30
- package/templates/tanstack-start/src/routes/index.tsx +5 -5
- package/templates/tanstack-start/vite.config.ts +9 -9
- package/templates/typescript/src/worker.ts +5 -1
- package/templates/vite/eslint.config.js +12 -12
- package/templates/vite/src/App.tsx +7 -7
- package/templates/vite/src/main.tsx +6 -6
- package/templates/vite/src/worker.ts +11 -12
- package/templates/vite/vite.config.ts +2 -2
- package/workers/tunnel-proxy.js +1 -1
- package/lib/cloudflare/miniflare/symlink-miniflare-state.d.ts +0 -2
- package/lib/cloudflare/miniflare/symlink-miniflare-state.d.ts.map +0 -1
- package/lib/cloudflare/miniflare/symlink-miniflare-state.js +0 -18
- package/lib/cloudflare/miniflare/symlink-miniflare-state.js.map +0 -1
- package/src/cloudflare/miniflare/symlink-miniflare-state.ts +0 -18
package/src/util/peer.ts
CHANGED
|
@@ -11,7 +11,9 @@ export class PeerDependencyError extends Error {
|
|
|
11
11
|
}) {
|
|
12
12
|
super(
|
|
13
13
|
[
|
|
14
|
-
`Missing peer ${input.missing.length} ${
|
|
14
|
+
`Missing peer ${input.missing.length} ${
|
|
15
|
+
input.missing.length === 1 ? "dependency" : "dependencies"
|
|
16
|
+
}${input.feature ? ` for ${input.feature}` : ""}:`,
|
|
15
17
|
...input.missing.map((dep) => `- "${dep}"`),
|
|
16
18
|
"",
|
|
17
19
|
"Please install with:",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import alchemy from
|
|
2
|
-
import { defineConfig } from
|
|
1
|
+
import alchemy from "alchemy/cloudflare/astro";
|
|
2
|
+
import { defineConfig } from "astro/config";
|
|
3
3
|
|
|
4
4
|
// https://astro.build/config
|
|
5
5
|
export default defineConfig({
|
|
6
|
-
output:
|
|
6
|
+
output: "server",
|
|
7
7
|
adapter: alchemy(),
|
|
8
8
|
});
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import type { APIRoute } from
|
|
1
|
+
import type { APIRoute } from "astro";
|
|
2
2
|
|
|
3
3
|
export const GET: APIRoute = async ({ request }) => {
|
|
4
4
|
// Access Cloudflare runtime context
|
|
5
5
|
const runtime = request.cf;
|
|
6
|
-
|
|
7
|
-
return new Response(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
|
|
7
|
+
return new Response(
|
|
8
|
+
JSON.stringify({
|
|
9
|
+
message: "Hello from Astro API on Cloudflare!",
|
|
10
|
+
timestamp: new Date().toISOString(),
|
|
11
|
+
colo: runtime?.colo || "unknown",
|
|
12
|
+
country: runtime?.country || "unknown",
|
|
13
|
+
city: runtime?.city || "unknown",
|
|
14
|
+
}),
|
|
15
|
+
{
|
|
16
|
+
status: 200,
|
|
17
|
+
headers: {
|
|
18
|
+
"Content-Type": "application/json",
|
|
19
|
+
},
|
|
17
20
|
},
|
|
18
|
-
|
|
21
|
+
);
|
|
19
22
|
};
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import js from
|
|
2
|
-
import reactHooks from
|
|
3
|
-
import reactRefresh from
|
|
4
|
-
import tseslint from
|
|
1
|
+
import js from "@eslint/js";
|
|
2
|
+
import reactHooks from "eslint-plugin-react-hooks";
|
|
3
|
+
import reactRefresh from "eslint-plugin-react-refresh";
|
|
4
|
+
import tseslint from "typescript-eslint";
|
|
5
5
|
|
|
6
6
|
export default tseslint.config(
|
|
7
|
-
{ ignores: [
|
|
7
|
+
{ ignores: ["dist"] },
|
|
8
8
|
{
|
|
9
9
|
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
|
10
|
-
files: [
|
|
10
|
+
files: ["**/*.{ts,tsx}"],
|
|
11
11
|
languageOptions: {
|
|
12
12
|
ecmaVersion: 2020,
|
|
13
13
|
},
|
|
14
14
|
plugins: {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
"react-hooks": reactHooks,
|
|
16
|
+
"react-refresh": reactRefresh,
|
|
17
17
|
},
|
|
18
18
|
rules: {
|
|
19
19
|
...reactHooks.configs.recommended.rules,
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
"react-refresh/only-export-components": [
|
|
21
|
+
"warn",
|
|
22
22
|
{ allowConstantExport: true },
|
|
23
23
|
],
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
|
-
)
|
|
27
|
-
|
|
26
|
+
);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Hono } from
|
|
1
|
+
import { Hono } from "hono";
|
|
2
2
|
|
|
3
|
-
const app = new Hono<{ Bindings: Env }>()
|
|
3
|
+
const app = new Hono<{ Bindings: Env }>();
|
|
4
4
|
|
|
5
|
-
app.get(
|
|
6
|
-
return c.text(
|
|
7
|
-
})
|
|
5
|
+
app.get("/", (c) => {
|
|
6
|
+
return c.text("Hello Hono!");
|
|
7
|
+
});
|
|
8
8
|
|
|
9
|
-
app.get(
|
|
10
|
-
const key =
|
|
11
|
-
const value = `world@${Date.now()}
|
|
12
|
-
await c.env.KV.put(key, value)
|
|
13
|
-
const got = await c.env.KV.get(key)
|
|
14
|
-
return c.json({ key, value: got })
|
|
15
|
-
})
|
|
9
|
+
app.get("/kv", async (c) => {
|
|
10
|
+
const key = "hello";
|
|
11
|
+
const value = `world@${Date.now()}`;
|
|
12
|
+
await c.env.KV.put(key, value);
|
|
13
|
+
const got = await c.env.KV.get(key);
|
|
14
|
+
return c.json({ key, value: got });
|
|
15
|
+
});
|
|
16
16
|
|
|
17
|
-
export default app
|
|
17
|
+
export default app;
|
|
@@ -10,10 +10,10 @@ export async function GET(request: NextRequest) {
|
|
|
10
10
|
|
|
11
11
|
export async function POST(request: NextRequest) {
|
|
12
12
|
const body = await request.json();
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
return Response.json({
|
|
15
15
|
message: "POST received",
|
|
16
16
|
data: body,
|
|
17
17
|
timestamp: new Date().toISOString(),
|
|
18
18
|
});
|
|
19
|
-
}
|
|
19
|
+
}
|
|
@@ -4,15 +4,12 @@ export default function Home() {
|
|
|
4
4
|
<h1>Welcome to Next.js on Cloudflare Workers!</h1>
|
|
5
5
|
<p>
|
|
6
6
|
This is a Next.js application deployed to Cloudflare Workers using{" "}
|
|
7
|
-
<a
|
|
8
|
-
href="https://alchemy.run"
|
|
9
|
-
target="_blank"
|
|
10
|
-
rel="noopener noreferrer"
|
|
11
|
-
>
|
|
7
|
+
<a href="https://alchemy.run" target="_blank" rel="noopener noreferrer">
|
|
12
8
|
Alchemy
|
|
13
|
-
</a
|
|
9
|
+
</a>
|
|
10
|
+
.
|
|
14
11
|
</p>
|
|
15
|
-
|
|
12
|
+
|
|
16
13
|
<section>
|
|
17
14
|
<h2>Features</h2>
|
|
18
15
|
<ul>
|
|
@@ -27,23 +24,25 @@ export default function Home() {
|
|
|
27
24
|
|
|
28
25
|
<section>
|
|
29
26
|
<h2>Get Started</h2>
|
|
30
|
-
<p>
|
|
27
|
+
<p>
|
|
28
|
+
Edit <code>src/app/page.tsx</code> and save to see your changes.
|
|
29
|
+
</p>
|
|
31
30
|
</section>
|
|
32
31
|
|
|
33
32
|
<footer>
|
|
34
33
|
<p>
|
|
35
34
|
Learn more:{" "}
|
|
36
|
-
<a
|
|
37
|
-
href="https://nextjs.org/docs"
|
|
38
|
-
target="_blank"
|
|
35
|
+
<a
|
|
36
|
+
href="https://nextjs.org/docs"
|
|
37
|
+
target="_blank"
|
|
39
38
|
rel="noopener noreferrer"
|
|
40
39
|
>
|
|
41
40
|
Next.js Docs
|
|
42
41
|
</a>{" "}
|
|
43
42
|
|{" "}
|
|
44
|
-
<a
|
|
45
|
-
href="https://alchemy.run"
|
|
46
|
-
target="_blank"
|
|
43
|
+
<a
|
|
44
|
+
href="https://alchemy.run"
|
|
45
|
+
target="_blank"
|
|
47
46
|
rel="noopener noreferrer"
|
|
48
47
|
>
|
|
49
48
|
Alchemy Docs
|
|
@@ -52,4 +51,4 @@ export default function Home() {
|
|
|
52
51
|
</footer>
|
|
53
52
|
</main>
|
|
54
53
|
);
|
|
55
|
-
}
|
|
54
|
+
}
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
import type { website } from "./alchemy.run.ts";
|
|
5
5
|
|
|
6
6
|
declare global {
|
|
7
|
-
|
|
7
|
+
type CloudflareEnv = typeof website.Env;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
declare module "cloudflare:workers" {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
namespace Cloudflare {
|
|
12
|
+
export interface Env extends CloudflareEnv {}
|
|
13
|
+
}
|
|
14
14
|
}
|
|
@@ -8,7 +8,7 @@ export default async function handleRequest(
|
|
|
8
8
|
responseStatusCode: number,
|
|
9
9
|
responseHeaders: Headers,
|
|
10
10
|
routerContext: EntryContext,
|
|
11
|
-
_loadContext: AppLoadContext
|
|
11
|
+
_loadContext: AppLoadContext,
|
|
12
12
|
) {
|
|
13
13
|
let shellRendered = false;
|
|
14
14
|
const userAgent = request.headers.get("user-agent");
|
|
@@ -25,7 +25,7 @@ export default async function handleRequest(
|
|
|
25
25
|
console.error(error);
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
}
|
|
28
|
+
},
|
|
29
29
|
);
|
|
30
30
|
shellRendered = true;
|
|
31
31
|
|
|
@@ -11,7 +11,7 @@ declare module "react-router" {
|
|
|
11
11
|
|
|
12
12
|
const requestHandler = createRequestHandler(
|
|
13
13
|
() => import("virtual:react-router/server-build"),
|
|
14
|
-
import.meta.env.MODE
|
|
14
|
+
import.meta.env.MODE,
|
|
15
15
|
);
|
|
16
16
|
|
|
17
17
|
export default {
|
|
@@ -20,4 +20,4 @@ export default {
|
|
|
20
20
|
cloudflare: { env, ctx },
|
|
21
21
|
});
|
|
22
22
|
},
|
|
23
|
-
}
|
|
23
|
+
};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import alchemy from "alchemy";
|
|
2
|
-
import {
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
2
|
-
import alchemy from
|
|
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
|
|
2
|
-
import { defineConfig } from
|
|
1
|
+
import { sveltekit } from "@sveltejs/kit/vite";
|
|
2
|
+
import { defineConfig } from "vite";
|
|
3
3
|
|
|
4
4
|
export default defineConfig({
|
|
5
|
-
|
|
5
|
+
plugins: [sveltekit()],
|
|
6
6
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createRouter } from
|
|
1
|
+
import { createRouter } from "@tanstack/react-router";
|
|
2
2
|
|
|
3
3
|
// Import the generated route tree
|
|
4
|
-
import { routeTree } from
|
|
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
|
|
1
|
+
import { HeadContent, Scripts, createRootRoute } from "@tanstack/react-router";
|
|
2
2
|
|
|
3
|
-
import Header from
|
|
3
|
+
import Header from "../components/Header";
|
|
4
4
|
|
|
5
|
-
import appCss from
|
|
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:
|
|
11
|
+
charSet: "utf-8",
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
|
-
name:
|
|
15
|
-
content:
|
|
14
|
+
name: "viewport",
|
|
15
|
+
content: "width=device-width, initial-scale=1",
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
title:
|
|
18
|
+
title: "TanStack Start Starter",
|
|
19
19
|
},
|
|
20
20
|
],
|
|
21
21
|
links: [
|
|
22
22
|
{
|
|
23
|
-
rel:
|
|
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
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
2
|
|
|
3
|
-
export const Route = createFileRoute(
|
|
3
|
+
export const Route = createFileRoute("/api/demo-names")({
|
|
4
4
|
server: {
|
|
5
5
|
handlers: {
|
|
6
6
|
GET: () => {
|
|
7
|
-
return new Response(JSON.stringify([
|
|
7
|
+
return new Response(JSON.stringify(["Alice", "Bob", "Charlie"]), {
|
|
8
8
|
headers: {
|
|
9
|
-
|
|
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
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
2
|
|
|
3
|
-
import { createFileRoute } from
|
|
3
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
4
4
|
|
|
5
5
|
function getNames() {
|
|
6
|
-
return fetch(
|
|
6
|
+
return fetch("/api/demo-names").then((res) => res.json());
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export const Route = createFileRoute(
|
|
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:
|
|
24
|
+
backgroundColor: "#000",
|
|
25
25
|
backgroundImage:
|
|
26
|
-
|
|
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
|
}
|