next.js
ae62a6f7 - codemod: cache-components-instant-false + next-cache-components-adoption skill (#94941)

Commit
39 days ago
codemod: cache-components-instant-false + next-cache-components-adoption skill (#94941) ### Why? Turning on `cacheComponents` makes every blocking route a build error at once. On a large app that's a wall of failures with no clear order to fix them in, which is a rough first experience. ### What? An opt-in adoption path so enabling Cache Components doesn't have to be all-or-nothing: - **`cache-components-instant-false` codemod** (`@next/codemod`) — blanket-inserts `export const instant = false` (with a `// TODO: Cache Components adoption` comment) into every `app/**/{page,layout}` file, so the build goes green immediately. Idempotent: skips files that already export `instant` (including aliased `export { x as instant }`). Skips Client Components (`"use client"`) and route handlers. - **`next-cache-components-adoption` skill** (`skills/`) — sequences the full migration in five steps across four milestones: green build (codemod or direct), remove the opt-outs top-down one group at a time, make navigations instant via the dev-overlay Insights, then adopt Partial Prefetching. It defers individual fixes to the dev overlay fix cards, stack traces, and the `/docs/messages/blocking-prerender-*` pages, and points at the migration / instant-navigation / Partial Prefetching guides rather than re-teaching them. Verifies each change at runtime via `next-dev-loop` (with a manual dev-overlay fallback). The `next-cache-components-optimizer` skill is referenced only as optional shell-growing polish after adoption is complete. ### How? - Transform registered in `TRANSFORMER_INQUIRER_CHOICES` at `version: '16.3.0'`. - 8 fixtures cover insert-into-page / -layout, JSDoc placement, and no-op on existing / aliased / multi-declarator / local-binding `instant` and on `"use client"` pages. `pnpm jest cache-components-instant-false` passes. - Docs: a `cache-components-instant-false` entry in the codemods reference, and a pointer to the skill + codemod from the migration guide.
Author
Parents
Loading