Add the `unstable_variant` API behind an experimental flag
A variant is a value that each request resolves, from cookies, headers, or a flags service, and that a route can be prerendered against in addition to its route params. This change adds the flag that gates the feature, the `next/variants` entry point, and the reader that a variant returns. Nothing resolves a value yet, so every read fails or defers until a later change supplies one. The name carries the `unstable_` prefix because the shape of the API is not settled, and not only its behavior. A directive may turn out to be enough on its own, in which case defining a variant needs no function from Next.js at all. Most of the reader is stubbed. No store carries a variant value, so every read either fails or interrupts the prerender. Only Turbopack supports the feature, and a webpack build rejects the config where it loads.
Showing
packages/next/variants.d.ts
0 → 100644
packages/next/variants.js
0 → 100644
Please
register
or
sign in
to comment