Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: deprecate adapter-cloudflare-workers in favour of adapter-cloudflare #13634

Merged
merged 24 commits into from
Apr 2, 2025

Conversation

eltigerchino
Copy link
Member

@eltigerchino eltigerchino commented Mar 24, 2025

an alternative that closes #13427

closes #13360
closes #13071
closes #13005
closes #12813
closes #13579
closes #10924

This PR adds a deprecation notice to the adapter-cloudflare-workers docs while adding support for Cloudflare Workers Static Assets by skipping Cloudflare Pages-specific build steps and respecting Wrangler configuration settings if building for Cloudflare Workers Static Assets.

We use a heuristic to guess whether we're building for Cloudflare Pages or Workers based on the Wrangler configuration file settings, but even if there is no Wrangler configuration file, the build output is compatible with both platforms.


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

Copy link

changeset-bot bot commented Mar 24, 2025

🦋 Changeset detected

Latest commit: 49d28e8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/adapter-cloudflare Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@svelte-docs-bot
Copy link

@eltigerchino eltigerchino requested a review from benmccann March 24, 2025 10:42
Copy link
Contributor

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff! I love seeing a single adapter that chooses workers or pages for you based on the config file! 🫶

@eltigerchino
Copy link
Member Author

eltigerchino commented Mar 26, 2025

Thanks for the feedback guys. I've updated the docs and also bumped the minimum Wrangler version to v4. I've also updated the fallback option to work with Cloudflare Workers if the user has configured the assets 404-handling option.

EDIT: I've also added some simple tests to check that the build output is successful and works with the pages/workers dev environment provided by wrangler.

@eltigerchino eltigerchino merged commit ebec1e9 into main Apr 2, 2025
31 of 32 checks passed
@eltigerchino eltigerchino deleted the merge-cloudflare-adapters branch April 2, 2025 02:26
@github-actions github-actions bot mentioned this pull request Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment