alchemy 2.0.0-beta.70 → 2.0.0-beta.72
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/LICENSE +201 -0
- package/NOTICE +5 -0
- package/README.md +3 -1
- package/THIRD_PARTY_LICENSES.md +127 -0
- package/bin/exec.js +25 -9
- package/bin/exec.js.map +1 -1
- package/lib/AWS/DataZone/Domain.d.ts.map +1 -1
- package/lib/AWS/DataZone/Domain.js +7 -7
- package/lib/AWS/DataZone/Domain.js.map +1 -1
- package/lib/AWS/EC2/InternetGateway.d.ts.map +1 -1
- package/lib/AWS/EC2/InternetGateway.js +14 -16
- package/lib/AWS/EC2/InternetGateway.js.map +1 -1
- package/lib/AWS/EC2/LingeringEnis.d.ts +2 -2
- package/lib/AWS/EC2/LingeringEnis.d.ts.map +1 -1
- package/lib/AWS/EC2/LingeringEnis.js +9 -7
- package/lib/AWS/EC2/LingeringEnis.js.map +1 -1
- package/lib/AWS/RDSData/Marshall.d.ts +23 -0
- package/lib/AWS/RDSData/Marshall.d.ts.map +1 -0
- package/lib/AWS/RDSData/Marshall.js +87 -0
- package/lib/AWS/RDSData/Marshall.js.map +1 -0
- package/lib/AWS/RDSData/index.d.ts +1 -0
- package/lib/AWS/RDSData/index.d.ts.map +1 -1
- package/lib/AWS/RDSData/index.js +1 -0
- package/lib/AWS/RDSData/index.js.map +1 -1
- package/lib/AWS/ResourceGroups/Group.d.ts.map +1 -1
- package/lib/AWS/ResourceGroups/Group.js +3 -1
- package/lib/AWS/ResourceGroups/Group.js.map +1 -1
- package/lib/AWS/S3Tables/Namespace.d.ts.map +1 -1
- package/lib/AWS/S3Tables/Namespace.js +3 -1
- package/lib/AWS/S3Tables/Namespace.js.map +1 -1
- package/lib/AWS/S3Tables/TableBucket.d.ts.map +1 -1
- package/lib/AWS/S3Tables/TableBucket.js +8 -2
- package/lib/AWS/S3Tables/TableBucket.js.map +1 -1
- package/lib/AWS/S3Vectors/VectorBucket.d.ts.map +1 -1
- package/lib/AWS/S3Vectors/VectorBucket.js +6 -1
- package/lib/AWS/S3Vectors/VectorBucket.js.map +1 -1
- package/lib/AWS/Website/cfcode.d.ts.map +1 -1
- package/lib/AWS/Website/cfcode.js +2 -0
- package/lib/AWS/Website/cfcode.js.map +1 -1
- package/lib/Apply.d.ts.map +1 -1
- package/lib/Apply.js +22 -8
- package/lib/Apply.js.map +1 -1
- package/lib/Auth/AuthProvider.d.ts.map +1 -1
- package/lib/Auth/AuthProvider.js +1 -1
- package/lib/Auth/AuthProvider.js.map +1 -1
- package/lib/Bundle/Bundle.js +2 -2
- package/lib/Bundle/Bundle.js.map +1 -1
- package/lib/Cli/commands/cloudflare.js +1 -1
- package/lib/Cli/commands/cloudflare.js.map +1 -1
- package/lib/Cli/commands/logs.d.ts.map +1 -1
- package/lib/Cli/commands/logs.js +2 -1
- package/lib/Cli/commands/logs.js.map +1 -1
- package/lib/Cli/commands/nuke.js +1 -1
- package/lib/Cli/commands/nuke.js.map +1 -1
- package/lib/Cli/commands/tail.d.ts.map +1 -1
- package/lib/Cli/commands/tail.js +2 -1
- package/lib/Cli/commands/tail.js.map +1 -1
- package/lib/Cloudflare/AI/LanguageModel.js +1 -1
- package/lib/Cloudflare/AI/LanguageModel.js.map +1 -1
- package/lib/Cloudflare/Access.js +1 -1
- package/lib/Cloudflare/Access.js.map +1 -1
- package/lib/Cloudflare/Containers/ContainerBundle.d.ts +1 -1
- package/lib/Cloudflare/Containers/ContainerBundle.js +1 -1
- package/lib/Cloudflare/Containers/ContainerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Containers/ContainerProvider.js +24 -2
- package/lib/Cloudflare/Containers/ContainerProvider.js.map +1 -1
- package/lib/Cloudflare/Containers/LocalContainerProvider.d.ts +1 -1
- package/lib/Cloudflare/Containers/LocalContainerProvider.js +1 -1
- package/lib/Cloudflare/D1/Database.d.ts +2 -2
- package/lib/Cloudflare/D1/Database.d.ts.map +1 -1
- package/lib/Cloudflare/D1/LocalD1Gateway.d.ts +3 -3
- package/lib/Cloudflare/D1/LocalD1Gateway.d.ts.map +1 -1
- package/lib/Cloudflare/D1/LocalD1Gateway.js +3 -3
- package/lib/Cloudflare/D1/LocalD1Gateway.js.map +1 -1
- package/lib/Cloudflare/KV/LocalKVGateway.js +2 -2
- package/lib/Cloudflare/KV/LocalKVGateway.js.map +1 -1
- package/lib/Cloudflare/LocalGateway.d.ts +1 -1
- package/lib/Cloudflare/LocalGateway.d.ts.map +1 -1
- package/lib/Cloudflare/LocalGateway.js +1 -1
- package/lib/Cloudflare/LocalGateway.js.map +1 -1
- package/lib/Cloudflare/LocalRuntime.d.ts +1 -1
- package/lib/Cloudflare/LocalRuntime.d.ts.map +1 -1
- package/lib/Cloudflare/LocalRuntime.js +5 -4
- package/lib/Cloudflare/LocalRuntime.js.map +1 -1
- package/lib/Cloudflare/Queues/Consumer.d.ts +22 -5
- package/lib/Cloudflare/Queues/Consumer.d.ts.map +1 -1
- package/lib/Cloudflare/Queues/Consumer.js +129 -38
- package/lib/Cloudflare/Queues/Consumer.js.map +1 -1
- package/lib/Cloudflare/Queues/Queue.d.ts +4 -3
- package/lib/Cloudflare/Queues/Queue.d.ts.map +1 -1
- package/lib/Cloudflare/Queues/Queue.js +115 -6
- package/lib/Cloudflare/Queues/Queue.js.map +1 -1
- package/lib/Cloudflare/R2/LocalR2Gateway.js +2 -2
- package/lib/Cloudflare/R2/LocalR2Gateway.js.map +1 -1
- package/lib/Cloudflare/SecretsStore/LocalSecretsStoreGateway.d.ts +4 -4
- package/lib/Cloudflare/SecretsStore/LocalSecretsStoreGateway.d.ts.map +1 -1
- package/lib/Cloudflare/SecretsStore/LocalSecretsStoreGateway.js +2 -2
- package/lib/Cloudflare/SecretsStore/LocalSecretsStoreGateway.js.map +1 -1
- package/lib/Cloudflare/SecretsStore/Secret.d.ts +2 -2
- package/lib/Cloudflare/SecretsStore/Secret.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/Api.js +7 -0
- package/lib/Cloudflare/StateStore/Api.js.map +1 -1
- package/lib/Cloudflare/Website/Astro.d.ts +19 -11
- package/lib/Cloudflare/Website/Astro.d.ts.map +1 -1
- package/lib/Cloudflare/Website/Astro.js +16 -9
- package/lib/Cloudflare/Website/Astro.js.map +1 -1
- package/lib/Cloudflare/Website/Nextjs.d.ts +7 -4
- package/lib/Cloudflare/Website/Nextjs.d.ts.map +1 -1
- package/lib/Cloudflare/Website/Nextjs.js +10 -8
- package/lib/Cloudflare/Website/Nextjs.js.map +1 -1
- package/lib/Cloudflare/Website/Nuxt.d.ts +5 -4
- package/lib/Cloudflare/Website/Nuxt.d.ts.map +1 -1
- package/lib/Cloudflare/Website/Nuxt.js +4 -3
- package/lib/Cloudflare/Website/Nuxt.js.map +1 -1
- package/lib/Cloudflare/Website/Octane.d.ts +4 -3
- package/lib/Cloudflare/Website/Octane.d.ts.map +1 -1
- package/lib/Cloudflare/Website/Octane.js +5 -4
- package/lib/Cloudflare/Website/Octane.js.map +1 -1
- package/lib/Cloudflare/Website/SvelteKit.d.ts +17 -10
- package/lib/Cloudflare/Website/SvelteKit.d.ts.map +1 -1
- package/lib/Cloudflare/Website/SvelteKit.js +9 -5
- package/lib/Cloudflare/Website/SvelteKit.js.map +1 -1
- package/lib/Cloudflare/Website/Waku.d.ts +20 -9
- package/lib/Cloudflare/Website/Waku.d.ts.map +1 -1
- package/lib/Cloudflare/Website/Waku.js +10 -4
- package/lib/Cloudflare/Website/Waku.js.map +1 -1
- package/lib/Cloudflare/Workers/Assets.d.ts +54 -1
- package/lib/Cloudflare/Workers/Assets.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Assets.js +60 -26
- package/lib/Cloudflare/Workers/Assets.js.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts +2 -2
- package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js +153 -49
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js.map +1 -1
- package/lib/Cloudflare/Workers/RuntimeBindings.d.ts +3 -3
- package/lib/Cloudflare/Workers/RuntimeBindings.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/RuntimeBindings.js +2 -2
- package/lib/Cloudflare/Workers/RuntimeBindings.js.map +1 -1
- package/lib/Cloudflare/Workers/Source.d.ts +1 -1
- package/lib/Cloudflare/Workers/Source.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Source.js +1 -1
- package/lib/Cloudflare/Workers/Source.js.map +1 -1
- package/lib/Cloudflare/Workers/Sources/Rolldown.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Sources/Rolldown.js +3 -4
- package/lib/Cloudflare/Workers/Sources/Rolldown.js.map +1 -1
- package/lib/Cloudflare/Workers/Sources/Vite.d.ts +1 -1
- package/lib/Cloudflare/Workers/Sources/Vite.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Sources/Vite.js +36 -17
- package/lib/Cloudflare/Workers/Sources/Vite.js.map +1 -1
- package/lib/Cloudflare/Workers/ViteChild.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/ViteChild.js +6 -0
- package/lib/Cloudflare/Workers/ViteChild.js.map +1 -1
- package/lib/Cloudflare/Workers/ViteChild.shared.d.ts +1 -1
- package/lib/Cloudflare/Workers/ViteChild.shared.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/ViteChildRunner.js +5 -10
- package/lib/Cloudflare/Workers/ViteChildRunner.js.map +1 -1
- package/lib/Cloudflare/Workers/Worker.d.ts +11 -4
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerProvider.d.ts +1 -1
- package/lib/Cloudflare/Workers/WorkerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerProvider.js +12 -2
- package/lib/Cloudflare/Workers/WorkerProvider.js.map +1 -1
- package/lib/Docker/Docker.d.ts.map +1 -1
- package/lib/Docker/Docker.js +6 -2
- package/lib/Docker/Docker.js.map +1 -1
- package/lib/Drizzle/{DurableObject.d.ts → Cloudflare.d.ts} +2 -1
- package/lib/Drizzle/Cloudflare.d.ts.map +1 -0
- package/lib/Drizzle/{DurableObject.js → Cloudflare.js} +2 -1
- package/lib/Drizzle/Cloudflare.js.map +1 -0
- package/lib/Drizzle/MySQL.d.ts +2 -2
- package/lib/Drizzle/MySQL.d.ts.map +1 -1
- package/lib/Drizzle/MySQL.js +5 -3
- package/lib/Drizzle/MySQL.js.map +1 -1
- package/lib/Drizzle/Postgres.d.ts +1 -1
- package/lib/Drizzle/Postgres.d.ts.map +1 -1
- package/lib/Drizzle/Postgres.js +4 -2
- package/lib/Drizzle/Postgres.js.map +1 -1
- package/lib/Drizzle/index.d.ts +0 -3
- package/lib/Drizzle/index.d.ts.map +1 -1
- package/lib/Drizzle/index.js +5 -3
- package/lib/Drizzle/index.js.map +1 -1
- package/lib/Neon/Migrations.d.ts.map +1 -1
- package/lib/Neon/Migrations.js +1 -5
- package/lib/Neon/Migrations.js.map +1 -1
- package/lib/PhysicalName.d.ts +8 -0
- package/lib/PhysicalName.d.ts.map +1 -1
- package/lib/PhysicalName.js +5 -2
- package/lib/PhysicalName.js.map +1 -1
- package/lib/Plan.d.ts.map +1 -1
- package/lib/Plan.js +16 -9
- package/lib/Plan.js.map +1 -1
- package/lib/ProviderMode.d.ts +45 -0
- package/lib/ProviderMode.d.ts.map +1 -1
- package/lib/ProviderMode.js +51 -0
- package/lib/ProviderMode.js.map +1 -1
- package/lib/SQL/ConnectionSource.d.ts +45 -0
- package/lib/SQL/ConnectionSource.d.ts.map +1 -0
- package/lib/SQL/ConnectionSource.js +51 -0
- package/lib/SQL/ConnectionSource.js.map +1 -0
- package/lib/SQL/MySQLDriver.d.ts +21 -0
- package/lib/SQL/MySQLDriver.d.ts.map +1 -0
- package/lib/SQL/MySQLDriver.js +31 -0
- package/lib/SQL/MySQLDriver.js.map +1 -0
- package/lib/SQL/PostgresDriver.d.ts +21 -0
- package/lib/SQL/PostgresDriver.d.ts.map +1 -0
- package/lib/SQL/PostgresDriver.js +29 -0
- package/lib/SQL/PostgresDriver.js.map +1 -0
- package/lib/State/HttpStateApi.d.ts +11 -11
- package/lib/State/LocalState.d.ts.map +1 -1
- package/lib/State/LocalState.js +17 -1
- package/lib/State/LocalState.js.map +1 -1
- package/lib/State/ResourceState.d.ts +6 -2
- package/lib/State/ResourceState.d.ts.map +1 -1
- package/lib/State/StateEncoding.d.ts +8 -0
- package/lib/State/StateEncoding.d.ts.map +1 -1
- package/lib/State/StateEncoding.js +38 -0
- package/lib/State/StateEncoding.js.map +1 -1
- package/lib/Sync.d.ts.map +1 -1
- package/lib/Sync.js +4 -2
- package/lib/Sync.js.map +1 -1
- package/lib/Test/Alchemy.d.ts.map +1 -1
- package/lib/Test/Alchemy.js +24 -14
- package/lib/Test/Alchemy.js.map +1 -1
- package/lib/Test/Core.d.ts +25 -8
- package/lib/Test/Core.d.ts.map +1 -1
- package/lib/Test/Core.js +24 -7
- package/lib/Test/Core.js.map +1 -1
- package/package.json +49 -40
- package/src/AWS/DataZone/Domain.ts +15 -13
- package/src/AWS/EC2/InternetGateway.ts +28 -32
- package/src/AWS/EC2/LingeringEnis.ts +11 -9
- package/src/AWS/RDSData/Marshall.ts +106 -0
- package/src/AWS/RDSData/index.ts +1 -0
- package/src/AWS/ResourceGroups/Group.ts +5 -1
- package/src/AWS/S3Tables/Namespace.ts +3 -1
- package/src/AWS/S3Tables/TableBucket.ts +8 -2
- package/src/AWS/S3Vectors/VectorBucket.ts +6 -1
- package/src/AWS/Website/cfcode.ts +2 -0
- package/src/Apply.ts +22 -9
- package/src/Auth/AuthProvider.ts +4 -7
- package/src/Bundle/Bundle.ts +2 -2
- package/src/Cli/commands/cloudflare.ts +1 -1
- package/src/Cli/commands/logs.ts +2 -1
- package/src/Cli/commands/nuke.ts +1 -1
- package/src/Cli/commands/tail.ts +2 -1
- package/src/Cloudflare/AI/LanguageModel.ts +3 -0
- package/src/Cloudflare/Access.ts +1 -1
- package/src/Cloudflare/Containers/ContainerBundle.ts +1 -1
- package/src/Cloudflare/Containers/ContainerProvider.ts +35 -5
- package/src/Cloudflare/Containers/LocalContainerProvider.ts +1 -1
- package/src/Cloudflare/D1/Database.ts +1 -1
- package/src/Cloudflare/D1/LocalD1Gateway.ts +4 -4
- package/src/Cloudflare/KV/LocalKVGateway.ts +2 -2
- package/src/Cloudflare/LocalGateway.ts +1 -1
- package/src/Cloudflare/LocalRuntime.ts +6 -4
- package/src/Cloudflare/Queues/Consumer.ts +183 -45
- package/src/Cloudflare/Queues/Queue.ts +157 -5
- package/src/Cloudflare/R2/LocalR2Gateway.ts +2 -2
- package/src/Cloudflare/SecretsStore/LocalSecretsStoreGateway.ts +2 -2
- package/src/Cloudflare/SecretsStore/Secret.ts +1 -1
- package/src/Cloudflare/StateStore/Api.ts +7 -0
- package/src/Cloudflare/Website/Astro.ts +20 -12
- package/src/Cloudflare/Website/Nextjs.ts +13 -8
- package/src/Cloudflare/Website/Nuxt.ts +6 -5
- package/src/Cloudflare/Website/Octane.ts +6 -4
- package/src/Cloudflare/Website/SvelteKit.ts +18 -11
- package/src/Cloudflare/Website/Waku.ts +21 -10
- package/src/Cloudflare/Workers/Assets.ts +122 -20
- package/src/Cloudflare/Workers/LocalWorkerProvider.ts +228 -81
- package/src/Cloudflare/Workers/RuntimeBindings.ts +3 -3
- package/src/Cloudflare/Workers/Source.ts +2 -2
- package/src/Cloudflare/Workers/Sources/Rolldown.ts +3 -4
- package/src/Cloudflare/Workers/Sources/Vite.ts +46 -24
- package/src/Cloudflare/Workers/ViteChild.shared.ts +1 -1
- package/src/Cloudflare/Workers/ViteChild.ts +6 -0
- package/src/Cloudflare/Workers/ViteChildRunner.ts +5 -10
- package/src/Cloudflare/Workers/Worker.ts +26 -6
- package/src/Cloudflare/Workers/WorkerProvider.ts +19 -2
- package/src/Docker/Docker.ts +17 -11
- package/src/Drizzle/{DurableObject.ts → Cloudflare.ts} +1 -0
- package/src/Drizzle/MySQL.ts +13 -3
- package/src/Drizzle/Postgres.ts +10 -2
- package/src/Drizzle/index.ts +6 -3
- package/src/Neon/Migrations.ts +1 -10
- package/src/PhysicalName.ts +17 -1
- package/src/Plan.ts +20 -9
- package/src/ProviderMode.ts +56 -0
- package/src/SQL/ConnectionSource.ts +101 -0
- package/src/SQL/MySQLDriver.ts +49 -0
- package/src/SQL/PostgresDriver.ts +45 -0
- package/src/State/LocalState.ts +24 -0
- package/src/State/ResourceState.ts +6 -2
- package/src/State/StateEncoding.ts +37 -0
- package/src/Sync.ts +4 -2
- package/src/Test/Alchemy.ts +17 -6
- package/src/Test/Core.ts +42 -15
- package/lib/Drizzle/DurableObject.d.ts.map +0 -1
- package/lib/Drizzle/DurableObject.js.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as queues from "@distilled.cloud/cloudflare/queues";
|
|
2
|
+
import * as workers from "@distilled.cloud/cloudflare/workers";
|
|
2
3
|
import * as Effect from "effect/Effect";
|
|
3
4
|
import * as Layer from "effect/Layer";
|
|
4
5
|
import * as MutableHashMap from "effect/MutableHashMap";
|
|
@@ -11,9 +12,12 @@ import * as RpcProvider from "../../Local/RpcProvider.ts";
|
|
|
11
12
|
import { createPhysicalName } from "../../PhysicalName.ts";
|
|
12
13
|
import * as Provider from "../../Provider.ts";
|
|
13
14
|
import { isResourceOfType, Resource } from "../../Resource.ts";
|
|
15
|
+
import { Stack } from "../../Stack.ts";
|
|
14
16
|
import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
|
|
17
|
+
import { detachQueueConsumersOfScript } from "./Consumer.ts";
|
|
15
18
|
import {
|
|
16
19
|
generateLocalId,
|
|
20
|
+
isLiveId,
|
|
17
21
|
LOCAL_ENTRY_URL,
|
|
18
22
|
LocalRuntimeState,
|
|
19
23
|
localRuntimeServices,
|
|
@@ -138,7 +142,10 @@ export const ProviderLive = () =>
|
|
|
138
142
|
let observed:
|
|
139
143
|
| { queueId?: string | null; queueName?: string | null }
|
|
140
144
|
| undefined;
|
|
141
|
-
|
|
145
|
+
// A `dev:` id (a mis-stamped legacy local row) is not a real queue id —
|
|
146
|
+
// skip the lookup (Cloudflare rejects it as a malformed parameter) and
|
|
147
|
+
// fall through to the name scan.
|
|
148
|
+
if (output?.queueId && isLiveId(output.queueId)) {
|
|
142
149
|
observed = yield* queues
|
|
143
150
|
.getQueue({
|
|
144
151
|
accountId: acct,
|
|
@@ -189,11 +196,18 @@ export const ProviderLive = () =>
|
|
|
189
196
|
};
|
|
190
197
|
}),
|
|
191
198
|
delete: Effect.fn(function* ({ output }) {
|
|
199
|
+
// A `dev:` id means the physical resource only ever existed locally
|
|
200
|
+
// (a mis-stamped legacy row) — there is nothing to delete, and the
|
|
201
|
+
// API would reject the id as a malformed parameter.
|
|
202
|
+
if (!isLiveId(output.queueId)) return;
|
|
192
203
|
// Dependents (e.g. R2 event notification configs targeting this
|
|
193
204
|
// queue) may still be tearing down concurrently — ride out the
|
|
194
205
|
// dependency violation briefly, then fail loudly instead of
|
|
195
|
-
// silently leaking the queue.
|
|
196
|
-
|
|
206
|
+
// silently leaking the queue. A worker producer binding
|
|
207
|
+
// (`QueueInUseByWorkerBinding`) gets a shorter window: a sibling
|
|
208
|
+
// Worker's just-processed delete/unbind takes a few seconds to
|
|
209
|
+
// propagate to the queues subsystem.
|
|
210
|
+
const attempt = queues
|
|
197
211
|
.deleteQueue({
|
|
198
212
|
accountId: output.accountId,
|
|
199
213
|
queueId: output.queueId,
|
|
@@ -206,8 +220,34 @@ export const ProviderLive = () =>
|
|
|
206
220
|
Schedule.recurs(8),
|
|
207
221
|
]),
|
|
208
222
|
}),
|
|
223
|
+
Effect.retry({
|
|
224
|
+
while: (e) => e._tag === "QueueInUseByWorkerBinding",
|
|
225
|
+
schedule: Schedule.max([
|
|
226
|
+
Schedule.spaced("2 seconds"),
|
|
227
|
+
Schedule.recurs(6),
|
|
228
|
+
]),
|
|
229
|
+
}),
|
|
209
230
|
Effect.catchTag("QueueNotFound", () => Effect.void),
|
|
210
231
|
);
|
|
232
|
+
yield* attempt.pipe(
|
|
233
|
+
// Still pinned by a worker producer binding after the propagation
|
|
234
|
+
// window: every *tracked* worker is deleted or unbound before its
|
|
235
|
+
// queues by dependency order, so the referencing script is an
|
|
236
|
+
// orphaned generation leaked by a pre-stamping dev run (a local-
|
|
237
|
+
// stamped row whose real script was never deleted). Remove the
|
|
238
|
+
// scripts that carry this stack+stage's ownership tags and retry;
|
|
239
|
+
// a script from outside this stack+stage keeps the typed failure.
|
|
240
|
+
Effect.catchTag("QueueInUseByWorkerBinding", (cause) =>
|
|
241
|
+
Effect.gen(function* () {
|
|
242
|
+
const removed = yield* deleteOwnedProducerScripts(
|
|
243
|
+
output.accountId,
|
|
244
|
+
output.queueId,
|
|
245
|
+
);
|
|
246
|
+
if (removed === 0) return yield* Effect.fail(cause);
|
|
247
|
+
return yield* attempt;
|
|
248
|
+
}),
|
|
249
|
+
),
|
|
250
|
+
);
|
|
211
251
|
}),
|
|
212
252
|
list: Effect.fn(function* () {
|
|
213
253
|
const { accountId } = yield* yield* CloudflareEnvironment;
|
|
@@ -231,7 +271,7 @@ export const ProviderLive = () =>
|
|
|
231
271
|
}),
|
|
232
272
|
read: Effect.fn(function* ({ id, output, olds }) {
|
|
233
273
|
const { accountId } = yield* yield* CloudflareEnvironment;
|
|
234
|
-
if (output?.queueId) {
|
|
274
|
+
if (output?.queueId && isLiveId(output.queueId)) {
|
|
235
275
|
return yield* queues
|
|
236
276
|
.getQueue({
|
|
237
277
|
accountId: output.accountId,
|
|
@@ -270,6 +310,80 @@ const createQueueName = (id: string, name: string | undefined) =>
|
|
|
270
310
|
})).toLowerCase();
|
|
271
311
|
});
|
|
272
312
|
|
|
313
|
+
/**
|
|
314
|
+
* Delete the worker scripts that hold a producer binding on `queueId` AND
|
|
315
|
+
* carry this stack+stage's `alchemy:` ownership tags. Returns how many
|
|
316
|
+
* scripts were deleted.
|
|
317
|
+
*
|
|
318
|
+
* Used by the live queue delete when `QueueInUseByWorkerBinding` persists
|
|
319
|
+
* past the propagation-lag retry window: tracked workers are always
|
|
320
|
+
* deleted/unbound before their queues, so an own-stack script still
|
|
321
|
+
* binding the queue at that point is an orphaned generation (leaked by a
|
|
322
|
+
* pre-stamping dev run that rewrote the worker's row as local). Scripts
|
|
323
|
+
* without our ownership tags are left alone.
|
|
324
|
+
*/
|
|
325
|
+
const deleteOwnedProducerScripts = Effect.fn(function* (
|
|
326
|
+
accountId: string,
|
|
327
|
+
queueId: string,
|
|
328
|
+
) {
|
|
329
|
+
const stack = yield* Stack;
|
|
330
|
+
const queue = yield* queues
|
|
331
|
+
.getQueue({ accountId, queueId })
|
|
332
|
+
.pipe(
|
|
333
|
+
Effect.catchTag(["QueueNotFound", "InvalidRoute"], () =>
|
|
334
|
+
Effect.succeed(undefined),
|
|
335
|
+
),
|
|
336
|
+
);
|
|
337
|
+
const producerScripts = Array.from(
|
|
338
|
+
new Set(
|
|
339
|
+
(queue?.producers ?? []).flatMap((producer) =>
|
|
340
|
+
producer.type === "worker" &&
|
|
341
|
+
"scriptName" in producer &&
|
|
342
|
+
producer.scriptName
|
|
343
|
+
? [producer.scriptName]
|
|
344
|
+
: [],
|
|
345
|
+
),
|
|
346
|
+
),
|
|
347
|
+
);
|
|
348
|
+
let removed = 0;
|
|
349
|
+
for (const scriptName of producerScripts) {
|
|
350
|
+
const settings = yield* workers
|
|
351
|
+
.getScriptScriptAndVersionSetting({ accountId, scriptName })
|
|
352
|
+
.pipe(
|
|
353
|
+
Effect.catchTag(["WorkerNotFound", "WorkerHasNoVersions"], () =>
|
|
354
|
+
Effect.succeed(undefined),
|
|
355
|
+
),
|
|
356
|
+
);
|
|
357
|
+
const tags = new Set(settings?.tags ?? []);
|
|
358
|
+
if (
|
|
359
|
+
!tags.has(`alchemy:stack:${stack.name}`) ||
|
|
360
|
+
!tags.has(`alchemy:stage:${stack.stage}`)
|
|
361
|
+
) {
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
yield* Effect.logWarning(
|
|
365
|
+
`Cloudflare Queue delete: removing orphaned worker script ` +
|
|
366
|
+
`"${scriptName}" that still binds queue ${queueId} (leaked by a ` +
|
|
367
|
+
`pre-providerMode dev run)`,
|
|
368
|
+
);
|
|
369
|
+
yield* workers.deleteScript({ accountId, scriptName, force: true }).pipe(
|
|
370
|
+
// The orphan may also be registered as a queue consumer — detach
|
|
371
|
+
// its consumers and retry, mirroring the Worker provider's own
|
|
372
|
+
// delete recovery.
|
|
373
|
+
Effect.catchTag("QueueConsumerConflict", () =>
|
|
374
|
+
detachQueueConsumersOfScript(accountId, scriptName).pipe(
|
|
375
|
+
Effect.andThen(
|
|
376
|
+
workers.deleteScript({ accountId, scriptName, force: true }),
|
|
377
|
+
),
|
|
378
|
+
),
|
|
379
|
+
),
|
|
380
|
+
Effect.catchTag("WorkerNotFound", () => Effect.void),
|
|
381
|
+
);
|
|
382
|
+
removed++;
|
|
383
|
+
}
|
|
384
|
+
return removed;
|
|
385
|
+
});
|
|
386
|
+
|
|
273
387
|
// Cloudflare's `listQueues` accepts no name/prefix filter, so
|
|
274
388
|
// adoption-by-name has to scan every page. Use the paginated
|
|
275
389
|
// `.items` stream off the un-yielded operation method.
|
|
@@ -293,6 +407,15 @@ export const ProviderLocal = () =>
|
|
|
293
407
|
diff: Effect.fn(function* ({ id, olds = {}, news = {}, output }) {
|
|
294
408
|
const { accountId } = yield* yield* CloudflareEnvironment;
|
|
295
409
|
if (!output?.queueId) return { action: "update" };
|
|
410
|
+
// A real (non-`dev:`) queueId on a local-mode row is legacy damage:
|
|
411
|
+
// pre-stamping dev runs preserved the live id, which the worker
|
|
412
|
+
// binding then treats as an `Alchemy.remote()` queue and fails on
|
|
413
|
+
// the missing producer shim. Replace so the new generation mints a
|
|
414
|
+
// true local identity (delete best-effort removes the stray live
|
|
415
|
+
// queue).
|
|
416
|
+
if (isLiveId(output.queueId)) {
|
|
417
|
+
return { action: "replace" };
|
|
418
|
+
}
|
|
296
419
|
if (!isResolved(news)) return undefined;
|
|
297
420
|
const name = yield* createQueueName(id, news.name);
|
|
298
421
|
const oldName = output?.queueName
|
|
@@ -316,7 +439,13 @@ export const ProviderLocal = () =>
|
|
|
316
439
|
reconcile: Effect.fn(function* ({ id, news = {}, output }) {
|
|
317
440
|
const { accountId } = yield* yield* CloudflareEnvironment;
|
|
318
441
|
const queue: Queue["Attributes"] = {
|
|
319
|
-
|
|
442
|
+
// Never carry a real (non-`dev:`) id forward onto a local row —
|
|
443
|
+
// the worker binding would treat it as an `Alchemy.remote()`
|
|
444
|
+
// queue and fail on the missing producer shim.
|
|
445
|
+
queueId:
|
|
446
|
+
output?.queueId && !isLiveId(output.queueId)
|
|
447
|
+
? output.queueId
|
|
448
|
+
: generateLocalId(),
|
|
320
449
|
queueName: yield* createQueueName(id, news.name),
|
|
321
450
|
accountId: output?.accountId ?? accountId,
|
|
322
451
|
};
|
|
@@ -325,6 +454,29 @@ export const ProviderLocal = () =>
|
|
|
325
454
|
}),
|
|
326
455
|
delete: Effect.fn(function* ({ output }) {
|
|
327
456
|
MutableHashMap.remove(localRuntimeState.queues, output.queueId);
|
|
457
|
+
// Legacy local-mode rows written before providerMode stamping can
|
|
458
|
+
// carry a real queue's id — remove the live queue too so migrating
|
|
459
|
+
// the row to a true local identity doesn't leak it.
|
|
460
|
+
if (isLiveId(output.queueId)) {
|
|
461
|
+
yield* queues
|
|
462
|
+
.deleteQueue({
|
|
463
|
+
accountId: output.accountId,
|
|
464
|
+
queueId: output.queueId,
|
|
465
|
+
})
|
|
466
|
+
.pipe(
|
|
467
|
+
Effect.retry({
|
|
468
|
+
while: (e) => e._tag === "QueueInUseByEventNotification",
|
|
469
|
+
schedule: Schedule.max([
|
|
470
|
+
Schedule.exponential("1 second"),
|
|
471
|
+
Schedule.recurs(8),
|
|
472
|
+
]),
|
|
473
|
+
}),
|
|
474
|
+
Effect.catchTag(
|
|
475
|
+
["QueueNotFound", "InvalidRoute"],
|
|
476
|
+
() => Effect.void,
|
|
477
|
+
),
|
|
478
|
+
);
|
|
479
|
+
}
|
|
328
480
|
}),
|
|
329
481
|
};
|
|
330
482
|
}),
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
*
|
|
18
18
|
* NOT exported from `index.ts` — capability-internal scaffolding.
|
|
19
19
|
*/
|
|
20
|
-
import { R2Bucket } from "@
|
|
21
|
-
import { open } from "@
|
|
20
|
+
import { R2Bucket } from "@alchemy.run/cloudflare-runtime/core/bindings";
|
|
21
|
+
import { open } from "@alchemy.run/cloudflare-runtime/core/platform-proxy";
|
|
22
22
|
import type * as runtime from "@cloudflare/workers-types";
|
|
23
23
|
import type * as Context from "effect/Context";
|
|
24
24
|
import * as Effect from "effect/Effect";
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
* NOT exported from `index.ts` — provider-internal scaffolding.
|
|
18
18
|
*/
|
|
19
19
|
import type * as runtime from "@cloudflare/workers-types";
|
|
20
|
-
import { SecretsStore } from "@
|
|
21
|
-
import { open } from "@
|
|
20
|
+
import { SecretsStore } from "@alchemy.run/cloudflare-runtime/core/bindings";
|
|
21
|
+
import { open } from "@alchemy.run/cloudflare-runtime/core/platform-proxy";
|
|
22
22
|
import * as Data from "effect/Data";
|
|
23
23
|
import * as Effect from "effect/Effect";
|
|
24
24
|
import { gatewayName } from "../LocalGateway.ts";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RuntimeServices } from "@
|
|
1
|
+
import type { RuntimeServices } from "@alchemy.run/cloudflare-runtime/core";
|
|
2
2
|
import * as secretsStore from "@distilled.cloud/cloudflare/secrets-store";
|
|
3
3
|
import * as Console from "effect/Console";
|
|
4
4
|
import * as Effect from "effect/Effect";
|
|
@@ -331,6 +331,13 @@ export default Worker(
|
|
|
331
331
|
* have.
|
|
332
332
|
*/
|
|
333
333
|
const HttpPlatformStub = Layer.succeed(HttpPlatform.HttpPlatform, {
|
|
334
|
+
platform: "web",
|
|
335
|
+
// Advertises no algorithms, so the compression middleware never engages
|
|
336
|
+
// and compressResponse is never called.
|
|
337
|
+
compression: {
|
|
338
|
+
algorithms: new Set<HttpPlatform.CompressionAlgorithm>(),
|
|
339
|
+
compressResponse: (response) => Effect.succeed(response),
|
|
340
|
+
},
|
|
334
341
|
fileResponse: () => Effect.die("HttpPlatform.fileResponse not supported"),
|
|
335
342
|
fileWebResponse: () =>
|
|
336
343
|
Effect.die("HttpPlatform.fileWebResponse not supported"),
|
|
@@ -52,9 +52,10 @@ export interface AstroProps<
|
|
|
52
52
|
sessionKVBindingName?: string | false;
|
|
53
53
|
/**
|
|
54
54
|
* Serializable Astro config merged into the in-memory configuration.
|
|
55
|
-
* The project's `astro.config.*` file
|
|
56
|
-
*
|
|
57
|
-
* environments are managed for you
|
|
55
|
+
* The project's `astro.config.*` file loads natively; astro merges
|
|
56
|
+
* these options OVER it (scalars override the file). The Cloudflare
|
|
57
|
+
* adapter, output target, and Vite environments are managed for you —
|
|
58
|
+
* do not declare an `adapter` in the config file.
|
|
58
59
|
*/
|
|
59
60
|
astro?: {
|
|
60
61
|
/** The full URL the site deploys to (`Astro.site`). */
|
|
@@ -89,19 +90,19 @@ export interface AstroProps<
|
|
|
89
90
|
* project.
|
|
90
91
|
*
|
|
91
92
|
* `Astro` runs Astro's programmatic build with a wrangler-free
|
|
92
|
-
* Cloudflare adapter (`@
|
|
93
|
+
* Cloudflare adapter (`@alchemy.run/cloudflare-frameworks/astro`): server-rendered pages
|
|
93
94
|
* execute in the Worker, prerendered pages and client assets deploy as
|
|
94
|
-
* static assets
|
|
95
|
-
* configuration required.
|
|
95
|
+
* static assets. Your `astro.config.*` loads natively — no adapter
|
|
96
|
+
* setup or Wrangler configuration required.
|
|
96
97
|
*
|
|
97
98
|
* Input files are content-hashed (respecting `.gitignore` by default)
|
|
98
99
|
* so unchanged projects skip the build and deploy entirely.
|
|
99
100
|
*
|
|
100
|
-
* The `@
|
|
101
|
-
* project
|
|
101
|
+
* The `@alchemy.run/cloudflare-frameworks` package must be installed in your
|
|
102
|
+
* project; its `/astro` export is loaded dynamically at deploy time:
|
|
102
103
|
*
|
|
103
104
|
* ```sh
|
|
104
|
-
* bun add -d @
|
|
105
|
+
* bun add -d @alchemy.run/cloudflare-frameworks
|
|
105
106
|
* ```
|
|
106
107
|
*
|
|
107
108
|
* @resource
|
|
@@ -194,8 +195,15 @@ export interface AstroProps<
|
|
|
194
195
|
* ```
|
|
195
196
|
*
|
|
196
197
|
* @section Astro Configuration
|
|
197
|
-
*
|
|
198
|
-
*
|
|
198
|
+
* Your `astro.config.*` file loads natively — integrations, Vite
|
|
199
|
+
* plugins, and other non-serializable options work as usual. Common
|
|
200
|
+
* serializable options are exposed under `astro` for deploy-specific
|
|
201
|
+
* overrides; astro merges them OVER the config file (scalars override,
|
|
202
|
+
* arrays like `integrations` concatenate). The Cloudflare adapter is
|
|
203
|
+
* injected for you — declaring an `adapter` in the config file fails
|
|
204
|
+
* the build. `output` defaults to `"server"`, superseding a file-level
|
|
205
|
+
* `output`; opt into a fully prerendered site with
|
|
206
|
+
* `astro: { output: "static" }`.
|
|
199
207
|
*
|
|
200
208
|
* @example Setting the site URL and source directory
|
|
201
209
|
* ```typescript
|
|
@@ -287,7 +295,7 @@ export const Astro: {
|
|
|
287
295
|
// `no_nodejs_compat` opt-out and the v2-mode date guard).
|
|
288
296
|
main: undefined!,
|
|
289
297
|
source: {
|
|
290
|
-
provider: "@
|
|
298
|
+
provider: "@alchemy.run/cloudflare-frameworks/astro/source",
|
|
291
299
|
devMode: "server",
|
|
292
300
|
options: {
|
|
293
301
|
rootDir: props.rootDir,
|
|
@@ -15,14 +15,16 @@ import {
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* The module specifier of the Next.js source provider. Loaded with a
|
|
18
|
-
* dynamic `import()`, so `@
|
|
19
|
-
* the deploying project.
|
|
18
|
+
* dynamic `import()`, so `@alchemy.run/cloudflare-frameworks` must be installed
|
|
19
|
+
* in the deploying project. The provider is exposed through its `/nextjs`
|
|
20
|
+
* subpath.
|
|
20
21
|
*/
|
|
21
|
-
const NEXTJS_SOURCE_PROVIDER =
|
|
22
|
+
const NEXTJS_SOURCE_PROVIDER =
|
|
23
|
+
"@alchemy.run/cloudflare-frameworks/nextjs/source";
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
26
|
* The default compatibility date when none is provided. Matches the
|
|
25
|
-
* `@
|
|
27
|
+
* `@alchemy.run/cloudflare-frameworks/nextjs` integration's own default so deploy and local
|
|
26
28
|
* dev agree.
|
|
27
29
|
*/
|
|
28
30
|
const DEFAULT_COMPATIBILITY_DATE = "2026-05-12";
|
|
@@ -36,6 +38,8 @@ export interface NextjsBuildOptions {
|
|
|
36
38
|
configPath?: string;
|
|
37
39
|
/**
|
|
38
40
|
* The command the OpenNext pipeline runs to build the Next.js app.
|
|
41
|
+
* A `buildCommand` set in the project's `open-next.config.ts` takes
|
|
42
|
+
* precedence over this option.
|
|
39
43
|
* @default "npx next build"
|
|
40
44
|
*/
|
|
41
45
|
buildCommand?: string;
|
|
@@ -103,16 +107,17 @@ export interface NextjsProps<
|
|
|
103
107
|
* A Cloudflare Worker deployed from a Next.js project.
|
|
104
108
|
*
|
|
105
109
|
* `Nextjs` builds the app with the wrangler-free OpenNext pipeline from
|
|
106
|
-
* [`@
|
|
110
|
+
* [`@alchemy.run/cloudflare-frameworks/nextjs`](https://github.com/alchemy-run/alchemy/tree/main/packages/cloudflare-frameworks/src/nextjs):
|
|
107
111
|
* `next build` runs through `@opennextjs/cloudflare`, the resulting worker
|
|
108
112
|
* is bundled into a self-contained ES module set, and the static assets
|
|
109
113
|
* (including prerendered pages and the read-only incremental cache) deploy
|
|
110
114
|
* as Workers static assets. Input files are content-hashed so unchanged
|
|
111
115
|
* projects skip the build and deploy entirely.
|
|
112
116
|
*
|
|
113
|
-
* Both `@
|
|
114
|
-
* must be installed in the deploying project
|
|
115
|
-
* loaded with a dynamic
|
|
117
|
+
* Both `@alchemy.run/cloudflare-frameworks` and its peer
|
|
118
|
+
* `@opennextjs/cloudflare` must be installed in the deploying project. The
|
|
119
|
+
* source provider is loaded from the package's `/nextjs` export with a dynamic
|
|
120
|
+
* `import()`.
|
|
116
121
|
*
|
|
117
122
|
* Local dev (`alchemy dev`) defaults to preview parity — the built worker
|
|
118
123
|
* served under workerd. Set `nextjs: { devMode: "hmr" }` for the real
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
* installed in the user's project — `loadSource` fails with a
|
|
18
18
|
* `SourceProviderError` naming it otherwise.
|
|
19
19
|
*/
|
|
20
|
-
const NUXT_SOURCE_PROVIDER = "@
|
|
20
|
+
const NUXT_SOURCE_PROVIDER = "@alchemy.run/cloudflare-frameworks/nuxt/source";
|
|
21
21
|
|
|
22
22
|
export interface NuxtProps<
|
|
23
23
|
Bindings extends WorkerBindingProps = {},
|
|
@@ -59,8 +59,8 @@ export interface NuxtProps<
|
|
|
59
59
|
memo?: MemoOptions;
|
|
60
60
|
/**
|
|
61
61
|
* Nuxt configuration overrides merged over the project's own
|
|
62
|
-
* `nuxt.config.ts` (the override wins).
|
|
63
|
-
*
|
|
62
|
+
* `nuxt.config.ts` (the override wins). The project's config file is
|
|
63
|
+
* loaded natively — modules, layers, and all — so this is for
|
|
64
64
|
* deploy-specific tweaks (`routeRules`, `runtimeConfig`, ...). Must be
|
|
65
65
|
* JSON-serializable (it persists in state). Do not set `nitro.preset`
|
|
66
66
|
* here — the Cloudflare deploy target owns the preset and a foreign
|
|
@@ -84,8 +84,9 @@ export interface NuxtProps<
|
|
|
84
84
|
* deploys as the Worker script; client assets and prerendered pages
|
|
85
85
|
* (`.output/public`) deploy as Worker static assets.
|
|
86
86
|
*
|
|
87
|
-
* Requires the `@
|
|
88
|
-
* project
|
|
87
|
+
* Requires the `@alchemy.run/cloudflare-frameworks` package to be installed in
|
|
88
|
+
* your project; the integration is loaded from its `/nuxt` export. Input files
|
|
89
|
+
* are content-hashed
|
|
89
90
|
* (respecting `.gitignore` by default) so unchanged projects skip the
|
|
90
91
|
* build and deploy entirely.
|
|
91
92
|
*
|
|
@@ -17,7 +17,8 @@ import {
|
|
|
17
17
|
* installed in the user's project — `loadSource` fails with a
|
|
18
18
|
* `SourceProviderError` naming it otherwise.
|
|
19
19
|
*/
|
|
20
|
-
const OCTANE_SOURCE_PROVIDER =
|
|
20
|
+
const OCTANE_SOURCE_PROVIDER =
|
|
21
|
+
"@alchemy.run/cloudflare-frameworks/octane/source";
|
|
21
22
|
|
|
22
23
|
export interface OctaneProps<
|
|
23
24
|
Bindings extends WorkerBindingProps = {},
|
|
@@ -65,9 +66,10 @@ export interface OctaneProps<
|
|
|
65
66
|
* `dist/client` deploys as static assets — no Wrangler configuration and
|
|
66
67
|
* no build command required.
|
|
67
68
|
*
|
|
68
|
-
* Requires the `@
|
|
69
|
-
* project
|
|
70
|
-
* `@octanejs/
|
|
69
|
+
* Requires the `@alchemy.run/cloudflare-frameworks` package to be installed in
|
|
70
|
+
* your project; the integration is loaded from its `/octane` export. The
|
|
71
|
+
* project also needs `octane`, `@octanejs/vite-plugin`, and
|
|
72
|
+
* `@octanejs/adapter-cloudflare`. Input files are content-hashed
|
|
71
73
|
* (respecting `.gitignore` by default) so unchanged projects skip the
|
|
72
74
|
* build and deploy entirely.
|
|
73
75
|
*
|
|
@@ -33,12 +33,15 @@ export interface SvelteKitProps<
|
|
|
33
33
|
*/
|
|
34
34
|
memo?: MemoOptions;
|
|
35
35
|
/**
|
|
36
|
-
* SvelteKit configuration
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
36
|
+
* SvelteKit configuration overrides. A project-owned `vite.config.*`
|
|
37
|
+
* loads natively — its `sveltekit(...)` call is the primary config
|
|
38
|
+
* source — and these options are merged OVER it (the override wins).
|
|
39
|
+
* Without a config file, this is the whole kit config. Construction-time
|
|
40
|
+
* options (`preprocess`, `extensions`, `compilerOptions`, `vitePlugin`)
|
|
41
|
+
* only apply in the no-config-file case — put them in your own
|
|
42
|
+
* `sveltekit(...)` call otherwise. The `adapter` field is injected by
|
|
43
|
+
* Alchemy's wrangler-free Cloudflare adapter — do not set it here. Must
|
|
44
|
+
* be JSON-serializable (it persists in state).
|
|
42
45
|
*/
|
|
43
46
|
kit?: Record<string, unknown>;
|
|
44
47
|
/**
|
|
@@ -77,13 +80,15 @@ export interface SvelteKitProps<
|
|
|
77
80
|
*
|
|
78
81
|
* `SvelteKit` builds the app with SvelteKit's own Vite pipeline and a
|
|
79
82
|
* wrangler-free in-memory Cloudflare adapter, then re-bundles the
|
|
80
|
-
* Node-flavored server output for workerd
|
|
83
|
+
* Node-flavored server output for workerd. A project-owned
|
|
84
|
+
* `vite.config.*` loads natively (its `sveltekit(...)` options apply) —
|
|
85
|
+
* no `svelte.config.js` (kit v3 dropped it), no
|
|
81
86
|
* `@sveltejs/adapter-cloudflare`, no Wrangler configuration required.
|
|
82
87
|
* Client assets and prerendered pages are deployed as Worker static
|
|
83
88
|
* assets; dynamic routes are served by the generated Worker.
|
|
84
89
|
*
|
|
85
|
-
* The `@
|
|
86
|
-
* project —
|
|
90
|
+
* The `@alchemy.run/cloudflare-frameworks` package must be installed in your
|
|
91
|
+
* project — its `/sveltekit` export is loaded dynamically at deploy time.
|
|
87
92
|
*
|
|
88
93
|
* Input files are content-hashed (respecting `.gitignore` by default) so
|
|
89
94
|
* unchanged projects skip the build and deploy entirely.
|
|
@@ -130,7 +135,9 @@ export interface SvelteKitProps<
|
|
|
130
135
|
* ```
|
|
131
136
|
*
|
|
132
137
|
* @section Kit and Adapter Options
|
|
133
|
-
*
|
|
138
|
+
* Kit options normally live in the `sveltekit(...)` call in your
|
|
139
|
+
* `vite.config.ts`, which loads natively; `kit` is a deploy-time
|
|
140
|
+
* override layer merged over them (the override wins). The generated
|
|
134
141
|
* Cloudflare adapter is configured via `adapter`.
|
|
135
142
|
*
|
|
136
143
|
* @example SPA-style 404 fallback
|
|
@@ -232,7 +239,7 @@ export const SvelteKit: {
|
|
|
232
239
|
}
|
|
233
240
|
: props?.assets,
|
|
234
241
|
source: {
|
|
235
|
-
provider: "@
|
|
242
|
+
provider: "@alchemy.run/cloudflare-frameworks/sveltekit/source",
|
|
236
243
|
devMode: "server",
|
|
237
244
|
options: {
|
|
238
245
|
rootDir: props?.rootDir,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
* installed in the user's project — `loadSource` fails with a
|
|
18
18
|
* `SourceProviderError` naming it otherwise.
|
|
19
19
|
*/
|
|
20
|
-
const WAKU_SOURCE_PROVIDER = "@
|
|
20
|
+
const WAKU_SOURCE_PROVIDER = "@alchemy.run/cloudflare-frameworks/waku/source";
|
|
21
21
|
|
|
22
22
|
export interface WakuProps<
|
|
23
23
|
Bindings extends WorkerBindingProps = {},
|
|
@@ -51,20 +51,25 @@ export interface WakuProps<
|
|
|
51
51
|
*/
|
|
52
52
|
rootDir?: string;
|
|
53
53
|
/**
|
|
54
|
-
* Waku source directory, relative to {@link rootDir}.
|
|
55
|
-
*
|
|
54
|
+
* Waku source directory, relative to {@link rootDir}. Setting this
|
|
55
|
+
* overrides a `srcDir` in the project's `waku.config.*`.
|
|
56
|
+
* @default the project's `waku.config.*` value, or waku's own default (`"src"`)
|
|
56
57
|
*/
|
|
57
58
|
srcDir?: string;
|
|
58
59
|
/**
|
|
59
60
|
* Waku build output directory, relative to {@link rootDir}. The server
|
|
60
61
|
* bundle is read from `<distDir>/server` and the client assets from
|
|
61
|
-
* `<distDir>/public`.
|
|
62
|
-
*
|
|
62
|
+
* `<distDir>/public`. Setting this overrides a `distDir` in the
|
|
63
|
+
* project's `waku.config.*` — if your config file customizes `distDir`,
|
|
64
|
+
* mirror it here (or exclude it via `memo`) so the build output doesn't
|
|
65
|
+
* pollute the rebuild hash.
|
|
66
|
+
* @default the project's `waku.config.*` value, or waku's own default (`"dist"`)
|
|
63
67
|
*/
|
|
64
68
|
distDir?: string;
|
|
65
69
|
/**
|
|
66
|
-
* Base path the app is served under.
|
|
67
|
-
*
|
|
70
|
+
* Base path the app is served under. Setting this overrides a
|
|
71
|
+
* `basePath` in the project's `waku.config.*`.
|
|
72
|
+
* @default the project's `waku.config.*` value, or waku's own default (`"/"`)
|
|
68
73
|
*/
|
|
69
74
|
basePath?: string;
|
|
70
75
|
/**
|
|
@@ -92,12 +97,18 @@ export interface WakuProps<
|
|
|
92
97
|
* A Cloudflare Worker deployed from a [Waku](https://waku.gg) project.
|
|
93
98
|
*
|
|
94
99
|
* `Waku` builds the project programmatically — no `waku.config.ts` edits,
|
|
95
|
-
* no Wrangler configuration, and no build command required.
|
|
100
|
+
* no Wrangler configuration, and no build command required. A project's
|
|
101
|
+
* `waku.config.*` loads natively (same as waku's CLI) as the base config,
|
|
102
|
+
* with `srcDir`/`distDir`/`basePath` from this resource winning per key;
|
|
103
|
+
* `unstable_adapter` is owned by Alchemy and must not be set. Note that a
|
|
104
|
+
* standalone `vite.config.ts` is NOT loaded (same as waku's CLI) — Vite
|
|
105
|
+
* config belongs in `waku.config.*`'s `vite` field. The RSC server
|
|
96
106
|
* bundle deploys as the Worker script and the client output (including
|
|
97
107
|
* SSG-prerendered pages) deploys as static assets.
|
|
98
108
|
*
|
|
99
|
-
* Requires the `@
|
|
100
|
-
* project
|
|
109
|
+
* Requires the `@alchemy.run/cloudflare-frameworks` package to be installed in
|
|
110
|
+
* your project; the integration is loaded from its `/waku` export. Input files
|
|
111
|
+
* are content-hashed
|
|
101
112
|
* (respecting `.gitignore` by default) so unchanged projects skip the
|
|
102
113
|
* build and deploy entirely.
|
|
103
114
|
*
|