-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add deprecation getters for Astro.locals.runtime #15075
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
Conversation
Adds helpful error messages when accessing removed runtime properties:
- runtime.env -> import { env } from 'cloudflare:workers'
- runtime.cf -> Astro.request.cf
- runtime.caches -> global caches object
- runtime.ctx -> Astro.locals.cfContext
Improves migration experience from v5 to v6.
🦋 Changeset detectedLatest commit: ace91f0 The changes in this PR will be included in the next version bump. 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 |
|
| 📦 Package | 🔒 Before | 🔓 After |
|---|---|---|
| @cloudflare/unenv-preset | trusted-with-provenance | none |
| workerd | trusted-with-provenance | none |
| undici | provenance | none |
| miniflare | trusted-with-provenance | none |
| youch | provenance | none |
| @cloudflare/workerd-darwin-64 | trusted-with-provenance | none |
| @cloudflare/workerd-darwin-arm64 | trusted-with-provenance | none |
| @cloudflare/workerd-linux-64 | trusted-with-provenance | none |
| @cloudflare/workerd-linux-arm64 | trusted-with-provenance | none |
| @cloudflare/workerd-windows-64 | trusted-with-provenance | none |
| wrangler | trusted-with-provenance | none |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I left a suggestion for the changeset but feel free to discard, this is really a nit.
Are there other changes to Cloudflare that are not yet reflected in docs? I noticed we have some Astro.locals.runtime.env in the v6 docs (e.g. https://v6.docs.astro.build/en/guides/integrations-guide/cloudflare/#cloudflare-runtime). If this is the only change, I can make the update myself!
Edit:: Matt took care of this in withastro/docs#12981 🙌🏽
Co-authored-by: Armand Philippot <git@armand.philippot.eu>
- Remove runtime from Runtime interface to prevent autocomplete - Use Object.defineProperty with enumerable: false
Per request in Discord, adds errors to each of these getters instructing users what to use instead.
Changes
Testing
N/A
Docs
N/A, already documented.