Repository navigation
feat(cloudflare/website): Waku, Astro, SvelteKit, Nuxt resources - #1086
Merged
Merged
Conversation
Co-authored-by: Sam Goodwin <sam@alchemy.run> Co-authored-by: John Royal <34844819+john-royal@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
Factor the shared shapes out of the new `Sources/*` modules and drop redundant state added alongside them. - `Sources/shared.ts` gains `bundleSource` (the bundle-only provider shape, written out verbatim in InlineScript/Prebuilt/Python/Rolldown) and `watchBundleDirectory` (`watchPrebuiltWorkerBundle` was a copy of `watchPythonWorkerBundle` modulo a path filter). - Delete `WorkerProvider.hashViteInput`, a verbatim copy of the one in `Sources/Vite.ts`; both call sites go through one lazy `loadVite`. The copies had already drifted — carry the POSIX label normalization into the surviving one. - Extract `serveBundleStream` from `LocalWorkerProvider.runWorker`; `runSource` re-copied ~50 lines of the same serve pipeline. - `Rolldown.sanitizeMain` reimplemented `Bundle/TempRoot.resolveMainPath`. - Drop the hand-rolled `nodejs_compat` merge from Astro/Nuxt/SvelteKit. `getCompatibility` already appends it to every non-python Worker and dedupes, so the blocks only fired when they shouldn't have: defeating an explicit `no_nodejs_compat` opt-out and the pre-2024-09-23 v2-mode date guard. - Drop `DevContext.worker.name` (always `SourceContext.workerName`), widen `SourceBuildOutput.hash` to `Partial<SourceHash>` to match `hash()`, and collapse the three hash-slot comparisons in `diff`. - `sourceModules` cached the un-memoized effect; cache the validated module instead. Use `createArtifactStore()` over a bare `new Map()`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Waku (live 2/2, local 2/2): API POST echo through the asset router, middleware headers, real KV namespace via env with out-of-band verification and destroy-side deletion; dev KV with dev: identity, HMR with binding survival, and the Alchemy.remote() opt-out case (real cloud namespace behind the local dev server). Nuxt (live 2/2, local 2/2): custom worker entry hosting a Durable Object through alchemy (Waku-pattern), POST echo, real KV via event.context.cloudflare.env with out-of-band verification; dev KV + HMR with binding survival, and the remote() case — ungated now that the dev platform proxy is hosted in the sidecar runtime stack (cloudflare-tools#99). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…egration # Conflicts: # packages/alchemy/src/Cloudflare/Workers/LocalWorkerProvider.ts # packages/alchemy/src/Cloudflare/Workers/RuntimeBindings.ts # packages/alchemy/src/Cloudflare/Workers/ViteChild.shared.ts # packages/alchemy/src/Cloudflare/Workers/ViteChildRunner.ts
Contributor
|
Install the packages built from this commit: alchemy bun add alchemy@https://pkg.ing/alchemy/00acfe2@alchemy.run/better-auth bun add @alchemy.run/better-auth@https://pkg.ing/@alchemy.run/better-auth/00acfe2@alchemy.run/pr-package bun add @alchemy.run/pr-package@https://pkg.ing/@alchemy.run/pr-package/00acfe2 |
…edirects provider fix - WorkerProvider: fold assets _headers/_redirects into upload metadata via mergeAssetsConfigFiles on both the fresh-upload and keep paths — they were hashed into the manifest but never sent to Cloudflare - SvelteKit: default assets.notFoundHandling from adapter.notFoundHandling so one prop configures both the fallback generation and the assets layer - Astro: middleware, redirects, _headers (fresh + keep), binary responses, form POST, KV round-trip; local dev sessions, static-in-dev, ungated remote() - SvelteKit: SPA fixture (app-shell fallback + server endpoints), form action with CSRF origin, KV round-trip; local HMR + ungated remote() - PropSurface.test.ts: compile-time pins that Website resources reject script/bundle/main/source - bun.lock: sync with package.json (@clack/prompts from main, overrides removed) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…BeDeleted Deletion propagates in stages: getScript can briefly 404 with "This Worker has no versions" before the 10007 not-found lands. Bump distilled to type it on getScript (alchemy-run/distilled#414) and treat the tag as gone in the test helper. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
filipfalcon
added a commit
to filipfalcon/alchemy-effect
that referenced
this pull request
Sep 14, 2026
`props.vite` was built by a duplicated arm inside the WorkerProvider that never consulted `ViteOptions.deriveAssets`; `makeViteSource` has existed since alchemy-run#1086 but was only reached for `props.source`. Dispatch both through `resolveSource`, and move the self-URL env resolution, the absolute `main` (alchemy-run#796), and the `base` manifest prefix into the vite source.
filipfalcon
added a commit
to filipfalcon/alchemy-effect
that referenced
this pull request
Sep 20, 2026
…rive asset routing from its build
Foldkit's `vite build` (`@foldkit/vite-plugin` 0.24+, `ssr.build`) emits
`dist/server/fetch.js`: a Web `fetch` handler with the built shell
embedded, its default export `{ fetch }`. That is a Worker entry, so the
Cloudflare plugin adopts it the way it adopts a TanStack Start server
bundle, and everything the resource did instead goes away: the `main` a
server-rendered app had to name, the Worker that read the shell back out
of the `ASSETS` binding, and the two asset-routing settings that failed
quietly when wrong.
The build also writes `foldkit.build.json` beside the handler, recording
which paths it prerendered, and keeps the unfilled `index.html` out of the
client output, so a server-rendered build needs no routing of its own: a
prerendered route is a file, and every other request, the front page
included, reaches the handler. A build with no manifest is client-only
and gets the single-page-application fallback, the default the other
clouds' Foldkit resources apply. Anything set in `assets` still wins.
`ViteOptions.framework: "foldkit"` names the framework whose build the
vite source knows how to read; a registry maps it to the deriver that
reads the manifest. It is plain data, so it crosses the dev-child
boundary and compares by value in props.
`props.vite` used to be built by a duplicated arm inside the
WorkerProvider that bypassed `makeViteSource`, which has existed since
alchemy-run#1086 but was only reached for `props.source`. Both now dispatch through
`resolveSource`, and the self-URL env resolution, the absolute `main`
(alchemy-run#796), and the `base` manifest prefix move into the vite source.
The SSR example drops its Worker, its `main`, and its asset settings. The
docs describe the delivery shapes and what the build derives for each.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Framework website resources for Waku, Astro, SvelteKit, and Nuxt, built on a
source-descriptor dispatch in the Worker provider. (Website.Nextjsis split out to #923.)Each resource sets
source: { provider: "@distilled.cloud/<fw>/source", options }on the Worker. The framework package's source module does the build (programmatic, no wrangler binary, no wrangler.json), asset manifesting, and rebuild-free input hashing for diff memoization. All four return a plainWorker<Bindings>—envtakes the full binding vocabulary,url/domain/compatibility/asset routing all apply — and all four run underalchemy devthrough the same dispatch (server-mode dev handle → dev proxy).Waku
nodejs_alsauto-injected,assets.htmlHandling: "drop-trailing-slash"(waku links SSG pages without trailing slashes)mainescape hatch wrapsvirtual:waku/server-entry, so the deployed Worker can export DO classes alongside waku's fetch handlerAstro
output: "server"by default (astro's own default isstatic, which would prerender "SSR" pages inside workerd where bindings don't exist);astro: { output: "static" }deploys assets-only — no server bundle at allnodejs_compatauto-injectedSESSION(sessionKVBindingName: falseopts out; skipped for static output); destroyed with the stackastro.config.*still loads natively; the resource's inline config merges over it; prerendered routes render inside workerd by defaultSvelteKit
svelte.config.js, no@sveltejs/adapter-cloudflare) + rolldown finishing pass re-bundles_worker.jsfor workerdnodejs_compatauto-injected; bindings reach server routes viaplatform.envplatform.env/caches/cfserved by cloudflare-runtime's platform proxy with real bindings, literalenvoverlaidprocess.cwd()— dev now works from any working directoryNuxt
cloudflare_modulepreset; the only resource that natively loads yournuxt.config.ts— thenuxtprop merges over it (override wins)nodejs_compatauto-injected; bindings reach handlers viaevent.context.cloudflare.env(+cf,waitUntil)isrroute rules are ignored; custom-entry DO classes are not servable in dev (the platform proxy can't host them)Tests, examples, docs
test/Cloudflare/Websitegreen: create → memoized noop → edit-redeploy → destroy per framework (also fixes the StaticSite noop plan assertion that fails on main){Waku,Astro,SvelteKit,Nuxt}.local.test.ts(Test.make({ dev: true })): local identity, SSR markers, env bindings, static assetsexamples/cloudflare-website-{waku,astro,sveltekit,nuxt}with integ tests, wired intotest:examplesand root tsconfig references — all four verified green against the real cloudfrontends/astro/nuxtguides, newsveltekit+wakupages, sidebar registrationSubmodule: pins cloudflare-tools to alchemy-run/cloudflare-tools#74 (framework packages, DeployTarget architecture, fixtures, and the kit runtime-id re-rooting fix).
🤖 Generated with Claude Code