mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
6144980ce3
## Summary Reworks Turbopack deferred entries in production build so deferred routes are processed last in the same project lifecycle, with `onBeforeDeferredEntries` executed between the non-deferred and deferred phases. ## What changed - Moved deferred build phasing into Rust in `project_write_all_entrypoints_to_disk`: - non-deferred phase - `onBeforeDeferredEntries` - deferred phase - Kept callback invocation on the Rust side via the existing node-worker callback plumbing. - Narrowed invalidation after `onBeforeDeferredEntries` to deferred app source subtrees instead of invalidating the whole project filesystem cache. - Added `DiskFileSystem::invalidate_path_and_children_with_reason(...)` in `turbo-tasks-fs`. - Derived deferred invalidation dirs from deferred routes’ `original_name` values. - Retained a full-invalidation fallback only when app-dir path resolution is unavailable. - Deferred route selection still includes both app pages and app route handlers. ## Validation - `cargo check -p next-napi-bindings -p turbo-tasks-fs` - `pnpm test-start-turbo test/e2e/deferred-entries/deferred-entries.test.ts` (21/21 passing) - Validated against [workflows repo](https://github.com/vercel/workflow/pull/1058) and v0