Conversation
…cloudflare#3132) The generated `virtual:vinext-cache-adapters` registrar only ran a descriptor's factory and warned on failure, so any adapter that needs runtime bindings warned on every Node run — `vinext build` prerender, `vinext start`, and Node dev — about a binding that cannot exist there. Descriptors can now declare `requiresEnv`, and the registrar skips such slots silently when the caller supplies no env. `kvDataAdapter()` sets the flag, so Node runs keep the default in-memory handler without a warning, while Workers callers (which always pass env) register exactly as before. An env-present caller whose binding is genuinely missing still warns.
@vinext/cloudflare
create-vinext-app
@vinext/types
vinext
@cloudflare/workers-response-store
commit: |
Contributor
Performance benchmarksCompared 0 improved · 0 regressed · 6 within ±1.5%
View detailed results and traces 🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head |
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.
Fixes #3132
Summary
requiresEnvflag toCacheAdapterDescriptor. The generatedvirtual:vinext-cache-adaptersregistrar emits that slot's registration insideif (env != null) { ... }, so a runtime that supplies no env skips it silently instead of invoking a factory that cannot construct and warning about it.kvDataAdapter()setsrequiresEnv: true, so Node runs (vinext buildprerender,vinext start, Node dev) keep the default in-memory handler with no warning about aVINEXT_KV_CACHEbinding that cannot exist off the Workers runtime.docs/caching.md.Test plan
tests/cache-adapters-config.test.ts: guarded-codegen shape, descriptor flag, and executed-registrar behaviour (skip without env / register with env / warn when the binding is genuinely missing / non-opted adapters unchanged).vp test run --project unit tests/cache-adapters-config.test.ts tests/cache-adapters-build.test.ts tests/image-adapters-config.test.ts— 65 passed.cache: { data: kvDataAdapter() },prerender: { routes: '*' }):vinext buildandvinext startemit no warning and serve 200.create-next-app(node and cloudflare init) andcreate-vinext-app(Cloudflare build). The only failures are pre-existing on a pristinee97de291baseline in this macOS environment (path-derived action ids, temp-path fixtures).