mirror of
https://github.com/cloudflare/vinext.git
synced 2026-09-14 19:04:59 +08:00
b71ccd27c2
* fix: pass NextFetchEvent to middleware and bubble up waitUntil promises to Cloudflare Worker ctx - Instantiates `NextFetchEvent` with `waitUntil` shim and passes to `middlewareFn` - Extracts `_waitUntilPromises` from the middleware result and attaches them to the `Response` object via `__vinextWaitUntil` - Updates the generated Cloudflare Worker `fetch` signature to include `ctx: ExecutionContext` - Iterates over `__vinextWaitUntil` on the final response and delegates to Cloudflare's native `ctx.waitUntil(promise)` - Enables background tasks (like telemetry and session sync in `@clerk/nextjs`) to survive the worker response lifecycle - Updates `vinext check` to explicitly report `@clerk/nextjs` as supported - Adds `app-router.test.ts` assertion to verify `waitUntil` injection * fix: address review feedback for waitUntil/NextFetchEvent support - Fix lost waitUntil promises on redirect/custom response early returns - Settle waitUntil promises in prod-server (Node.js) instead of dropping - Mark @clerk/nextjs as "partial" until ESM fix lands (clerk/javascript#7954) - Align __vinextWaitUntil guard in deploy.ts with app-router-entry.ts - Use const for non-reassigned _waitUntilPromises array - Add comment explaining waitUntil check ordering in app-router-entry - Add unit test verifying runMiddleware bubbles up waitUntil promises Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: move waitUntil settlement before early returns in prod-server Promise.allSettled(waitUntilPromises) was placed after the !result.continue check, so redirect/custom-response paths silently dropped promises (e.g. Clerk session sync on auth redirects). Moved it before the check to match the pattern in deploy.ts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(middleware): remove double drainWaitUntil, include waitUntilPromises on error path * fix: remove dead __vinextWaitUntil read code with no corresponding setter * fix: remove no-op .catch on Promise.allSettled, strengthen waitUntil redirect test * test: add waitUntil continue:true path coverage * fix: settle waitUntil promises in Pages Router dev server (index.ts) * fix: drain waitUntil promises in generated entry error paths * regen snaps --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: James <james@eli.cx>