workers-utils - `getLatestWorkerdCompatibilityDate`
Fixes https://jira.cfdata.org/browse/DEVX-2384
Add a new getLatestWorkerdCompatibilityDate function to the workers-utils package and use that package in wrangler, create-cloudflare and the vite plugin instead of having the two different implementations (getDevCompatibilityDate and getWorkerdCompatibilityDate).
Note: these changes get rid of the logic in getWorkerdCompatibilityDate that fetched workerd from the npm registry since that doesn't generally seem necessary/beneficial and just relying on the local version of workerd (which is always installed when the function is called) seem just faster and safer to me.
- Tests
- [x] Tests included/updated
- [ ] Tests not necessary because:
- Public documentation
- [ ] Cloudflare docs PR(s):
- [x] Documentation not necessary because: we don't currently document the workers-utils package
- Wrangler V3 Backport
- [ ] Wrangler PR:
- [x] Not necessary because: not just a Wrangler change
A picture of a cute animal (not mandatory, but encouraged)
🦋 Changeset detected
Latest commit: c5d7016b01ea6acc10650ac44fdc2dd42e7bdaad
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
See the inline comment for my concerns.
Would it make sense to:
- Refactor/move the code in a first PR (same API, same behavior)
- Change the behavior in a follow up PR only if we are certain there is no unwanted side effects
Once the function has been created/moved to workers-utils updating it would in theory be a breaking change (even though the package is still at 0.x so possibly not a huge deal), so I think it'd be ideal to just move it there once with the final implementation.
If your concern is C3 I can just leave C3 alone and just use the function is autoconfig (that wouldn't change any behavior at all). Although I'd still like to understand the C3 concern... because I fail to see downsides of this approach...
Claude finished @dario-piotrowicz's task —— View job
Changeset Review
Reviewing changeset files for compliance with repository guidelines...
Tasks
- [x] Read changeset guidelines
- [x] Review
.changeset/chubby-tigers-read.md - [x] Review
.changeset/shaky-crews-brush.md - [x] Validate version types and changelog quality
- [x] Check for cute animal image
✅ All changesets look good
Both changeset files follow the repository guidelines:
- Version types: Both use
minorwhich is appropriate for new features/utilities - No forbidden major versions: No major version bumps for wrangler
- Markdown headers: No h1/h2/h3 headers present
- Descriptions: Clear, concise titles describing the new utilities being exposed
Changeset Details:
- chubby-tigers-read.md: Exposes
getLocalWorkerdCompatibilityDateutility in workers-utils and vite-plugin - shaky-crews-brush.md: Exposes
isCompatDateutility in workers-utils
Both are appropriately marked as minor since they expose new public APIs.
Cute Animal Report: This appears to be Claude Code's loading spinner (an orange dot). Not technically a cute animal, but it gets a solid 10/10 for faithfully indicating work in progress and being perfectly circular. Would spin again.
create-cloudflare
npm i https://pkg.pr.new/create-cloudflare@11620
@cloudflare/kv-asset-handler
npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@11620
miniflare
npm i https://pkg.pr.new/miniflare@11620
@cloudflare/pages-shared
npm i https://pkg.pr.new/@cloudflare/pages-shared@11620
@cloudflare/unenv-preset
npm i https://pkg.pr.new/@cloudflare/unenv-preset@11620
@cloudflare/vite-plugin
npm i https://pkg.pr.new/@cloudflare/vite-plugin@11620
@cloudflare/vitest-pool-workers
npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@11620
@cloudflare/workers-editor-shared
npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@11620
@cloudflare/workers-utils
npm i https://pkg.pr.new/@cloudflare/workers-utils@11620
wrangler
npm i https://pkg.pr.new/wrangler@11620
commit: c5d7016
Merging just not to leave this one hanging, we can always improve things later if we want 🙂