From da666e1e36d953c7c479be3e192f1cf61859579e Mon Sep 17 00:00:00 2001 From: Shu Ding Date: Thu, 20 Oct 2022 02:39:25 +0200 Subject: [PATCH] Update page config APIs (#41580) This PR updates app configurations from `export const config = { ... }` to be directly exported. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md) Co-authored-by: JJ Kasper --- .../build/analysis/get-page-static-info.ts | 71 ++++++++++++------- packages/next/build/utils.ts | 33 ++++++++- .../webpack/plugins/flight-types-plugin.ts | 7 +- packages/next/server/app-render.tsx | 4 +- .../app-dir/app-edge/app/app-edge/page.tsx | 2 +- .../app-prefetch/app/dashboard/page.js | 4 +- .../app/isr-multiple/nested/page.js | 4 +- .../app-rendering/app/ssr-only/layout.js | 4 +- .../app/static-only/nested/page.js | 4 +- .../app/static-only/slow/page.js | 4 +- .../app-static/app/(new)/custom/page.js | 4 +- .../app/blog/[author]/[slug]/page.js | 4 +- .../app-static/app/blog/[author]/page.js | 4 +- .../dynamic-no-gen-params-ssr/[slug]/page.js | 4 +- .../ssr-auto/fetch-revalidate-zero/page.js | 4 +- .../app-dir/app-static/app/ssr-forced/page.js | 4 +- .../e2e/app-dir/app-typescript/app/layout.tsx | 4 -- .../app/(rootonly)/dashboard/hello/page.js | 4 +- test/e2e/app-dir/app/app/dashboard/page.js | 4 +- .../server-component/custom-digest/page.js | 4 +- .../app/app/error/server-component/page.js | 4 +- test/e2e/app-dir/app/app/layout.js | 4 +- .../app/app/slow-page-no-loading/page.js | 4 +- .../app/app/slow-page-with-loading/page.js | 4 +- test/e2e/app-dir/next-font/app/page.js | 2 +- .../(mpa-navigation)/(route-group)/layout.js | 4 +- .../(mpa-navigation)/basic-route/layout.js | 4 +- .../app/(mpa-navigation)/dynamic/layout.js | 4 +- .../(mpa-navigation)/to-pages-dir/layout.js | 4 +- .../with-parallel-routes/layout.js | 4 +- .../app/(required-tags)/has-tags/layout.js | 4 +- .../(required-tags)/missing-tags/layout.js | 4 +- .../static-missing-tags/[slug]/page.js | 4 +- .../rsc-basic/app/edge/dynamic/[id]/page.js | 4 +- .../rsc-basic/app/edge/dynamic/page.js | 4 +- test/e2e/app-dir/rsc-basic/app/layout.js | 4 +- .../rsc-basic/app/native-module/page.js | 4 +- 37 files changed, 112 insertions(+), 131 deletions(-) diff --git a/packages/next/build/analysis/get-page-static-info.ts b/packages/next/build/analysis/get-page-static-info.ts index 589eb59ffb270..da4fb7f45e64b 100644 --- a/packages/next/build/analysis/get-page-static-info.ts +++ b/packages/next/build/analysis/get-page-static-info.ts @@ -48,11 +48,30 @@ export function getRSCModuleType(source: string): RSCModuleType { * requires a runtime to be specified. Those are: * - Modules with `export function getStaticProps | getServerSideProps` * - Modules with `export { getStaticProps | getServerSideProps } ` + * - Modules with `export const runtime = ...` */ -export function checkExports(swcAST: any): { ssr: boolean; ssg: boolean } { +function checkExports(swcAST: any): { + ssr: boolean + ssg: boolean + runtime?: string +} { if (Array.isArray(swcAST?.body)) { try { + let runtime: string | undefined + let ssr: boolean = false + let ssg: boolean = false + for (const node of swcAST.body) { + if ( + node.type === 'ExportDeclaration' && + node.declaration?.type === 'VariableDeclaration' + ) { + const id = node.declaration?.declarations[0]?.id.value + if (id === 'runtime') { + runtime = node.declaration?.declarations[0]?.init.value + } + } + if ( node.type === 'ExportDeclaration' && node.declaration?.type === 'FunctionDeclaration' && @@ -60,10 +79,8 @@ export function checkExports(swcAST: any): { ssr: boolean; ssg: boolean } { node.declaration.identifier?.value ) ) { - return { - ssg: node.declaration.identifier.value === 'getStaticProps', - ssr: node.declaration.identifier.value === 'getServerSideProps', - } + ssg = node.declaration.identifier.value === 'getStaticProps' + ssr = node.declaration.identifier.value === 'getServerSideProps' } if ( @@ -72,10 +89,8 @@ export function checkExports(swcAST: any): { ssr: boolean; ssg: boolean } { ) { const id = node.declaration?.declarations[0]?.id.value if (['getStaticProps', 'getServerSideProps'].includes(id)) { - return { - ssg: id === 'getStaticProps', - ssr: id === 'getServerSideProps', - } + ssg = id === 'getStaticProps' + ssr = id === 'getServerSideProps' } } @@ -87,16 +102,14 @@ export function checkExports(swcAST: any): { ssr: boolean; ssg: boolean } { specifier.orig?.value ) - return { - ssg: values.some((value: any) => - ['getStaticProps'].includes(value) - ), - ssr: values.some((value: any) => - ['getServerSideProps'].includes(value) - ), - } + ssg = values.some((value: any) => ['getStaticProps'].includes(value)) + ssr = values.some((value: any) => + ['getServerSideProps'].includes(value) + ) } } + + return { ssr, ssg, runtime } } catch (err) {} } @@ -270,7 +283,7 @@ export async function getPageStaticInfo(params: { ) ) { const swcAST = await parseModule(pageFilePath, fileContent) - const { ssg, ssr } = checkExports(swcAST) + const { ssg, ssr, runtime } = checkExports(swcAST) const rsc = getRSCModuleType(fileContent) // default / failsafe value for config @@ -284,12 +297,18 @@ export async function getPageStaticInfo(params: { // `export config` doesn't exist, or other unknown error throw by swc, silence them } + // Currently, we use `export const config = { runtime: '...' }` to specify the page runtime. + // But in the new app directory, we prefer to use `export const runtime = '...'` + // and deprecate the old way. To prevent breaking changes for `pages`, we use the exported config + // as the fallback value. + let resolvedRuntime = runtime || config.runtime + if ( - typeof config.runtime !== 'undefined' && - !isServerRuntime(config.runtime) + typeof resolvedRuntime !== 'undefined' && + !isServerRuntime(resolvedRuntime) ) { const options = Object.values(SERVER_RUNTIME).join(', ') - if (typeof config.runtime !== 'string') { + if (typeof resolvedRuntime !== 'string') { Log.error( `The \`runtime\` config must be a string. Please leave it empty or choose one of: ${options}` ) @@ -303,14 +322,14 @@ export async function getPageStaticInfo(params: { } } - let runtime = - SERVER_RUNTIME.edge === config?.runtime + resolvedRuntime = + SERVER_RUNTIME.edge === resolvedRuntime ? SERVER_RUNTIME.edge : ssr || ssg - ? config?.runtime || nextConfig.experimental?.runtime + ? resolvedRuntime || nextConfig.experimental?.runtime : undefined - if (runtime === SERVER_RUNTIME.edge) { + if (resolvedRuntime === SERVER_RUNTIME.edge) { warnAboutExperimentalEdgeApiFunctions() } @@ -325,7 +344,7 @@ export async function getPageStaticInfo(params: { ssg, rsc, ...(middlewareConfig && { middleware: middlewareConfig }), - ...(runtime && { runtime }), + ...(resolvedRuntime && { runtime: resolvedRuntime }), } } diff --git a/packages/next/build/utils.ts b/packages/next/build/utils.ts index 93c5e6592d193..8165f4a417f21 100644 --- a/packages/next/build/utils.ts +++ b/packages/next/build/utils.ts @@ -1044,13 +1044,41 @@ export type AppConfig = { preferredRegion?: string } type GenerateParams = Array<{ - config: AppConfig + config?: AppConfig segmentPath: string getStaticPaths?: GetStaticPaths generateStaticParams?: any isLayout?: boolean }> +export const collectAppConfig = (mod: any): AppConfig | undefined => { + let hasConfig = false + + const config: AppConfig = {} + if (typeof mod?.revalidate !== 'undefined') { + config.revalidate = mod.revalidate + hasConfig = true + } + if (typeof mod?.dynamicParams !== 'undefined') { + config.dynamicParams = mod.dynamicParams + hasConfig = true + } + if (typeof mod?.dynamic !== 'undefined') { + config.dynamic = mod.dynamic + hasConfig = true + } + if (typeof mod?.fetchCache !== 'undefined') { + config.fetchCache = mod.fetchCache + hasConfig = true + } + if (typeof mod?.preferredRegion !== 'undefined') { + config.preferredRegion = mod.preferredRegion + hasConfig = true + } + + return hasConfig ? config : undefined +} + export const collectGenerateParams = async ( segment: any, parentSegments: string[] = [], @@ -1059,13 +1087,14 @@ export const collectGenerateParams = async ( if (!Array.isArray(segment)) return generateParams const isLayout = !!segment[2]?.layout const mod = await (isLayout ? segment[2]?.layout?.() : segment[2]?.page?.()) + const config = collectAppConfig(mod) const result = { isLayout, segmentPath: `/${parentSegments.join('/')}${ segment[0] && parentSegments.length > 0 ? '/' : '' }${segment[0]}`, - config: mod?.config, + config, getStaticPaths: mod?.getStaticPaths, generateStaticParams: mod?.generateStaticParams, } diff --git a/packages/next/build/webpack/plugins/flight-types-plugin.ts b/packages/next/build/webpack/plugins/flight-types-plugin.ts index bf73137589ff3..fdc716c2452ec 100644 --- a/packages/next/build/webpack/plugins/flight-types-plugin.ts +++ b/packages/next/build/webpack/plugins/flight-types-plugin.ts @@ -31,17 +31,14 @@ interface IEntry { ? `default: (props: { children: React.ReactNode; params?: any }) => React.ReactNode | null` : `default: (props: { params?: any }) => React.ReactNode | null` } + config?: {} generateStaticParams?: (params?:any) => Promise - config?: { - // TODO: remove revalidate here - revalidate?: number | boolean - ${options.type === 'page' ? 'runtime?: string' : ''} - } revalidate?: RevalidateRange | false dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static' dynamicParams?: boolean fetchCache?: 'auto' | 'force-no-store' | 'only-no-store' | 'default-no-store' | 'default-cache' | 'only-cache' | 'force-cache' preferredRegion?: 'auto' | 'home' | 'edge' + ${options.type === 'page' ? "runtime?: 'nodejs' | 'experimental-edge'" : ''} } // ============= diff --git a/packages/next/server/app-render.tsx b/packages/next/server/app-render.tsx index 37afe1a50de9b..704fb57473415 100644 --- a/packages/next/server/app-render.tsx +++ b/packages/next/server/app-render.tsx @@ -947,8 +947,8 @@ export async function renderToHTMLOrFlight( ? await page() : undefined - if (layoutOrPageMod?.config) { - defaultRevalidate = layoutOrPageMod.config.revalidate + if (typeof layoutOrPageMod?.revalidate !== 'undefined') { + defaultRevalidate = layoutOrPageMod.revalidate if (isStaticGeneration && defaultRevalidate === 0) { const { DynamicServerError } = diff --git a/test/e2e/app-dir/app-edge/app/app-edge/page.tsx b/test/e2e/app-dir/app-edge/app/app-edge/page.tsx index 3aa83203566ab..ee909102491f2 100644 --- a/test/e2e/app-dir/app-edge/app/app-edge/page.tsx +++ b/test/e2e/app-dir/app-edge/app/app-edge/page.tsx @@ -1,4 +1,4 @@ export default function Page() { return

app-edge-ssr

} -export const config = { runtime: 'experimental-edge' } +export const runtime = 'experimental-edge' diff --git a/test/e2e/app-dir/app-prefetch/app/dashboard/page.js b/test/e2e/app-dir/app-prefetch/app/dashboard/page.js index 5f2d416fa6cfe..0649c4eb968f7 100644 --- a/test/e2e/app-dir/app-prefetch/app/dashboard/page.js +++ b/test/e2e/app-dir/app-prefetch/app/dashboard/page.js @@ -1,8 +1,6 @@ import { experimental_use as use } from 'react' -export const config = { - revalidate: 0, -} +export const revalidate = 0 async function getData() { await new Promise((resolve) => setTimeout(resolve, 3000)) diff --git a/test/e2e/app-dir/app-rendering/app/isr-multiple/nested/page.js b/test/e2e/app-dir/app-rendering/app/isr-multiple/nested/page.js index 4b39fb2fb7f52..9957606085263 100644 --- a/test/e2e/app-dir/app-rendering/app/isr-multiple/nested/page.js +++ b/test/e2e/app-dir/app-rendering/app/isr-multiple/nested/page.js @@ -1,8 +1,6 @@ import { experimental_use as use } from 'react' -export const config = { - revalidate: 1, -} +export const revalidate = 1 async function getData() { return { diff --git a/test/e2e/app-dir/app-rendering/app/ssr-only/layout.js b/test/e2e/app-dir/app-rendering/app/ssr-only/layout.js index 81fc9425465b8..8a85c4d14bb7e 100644 --- a/test/e2e/app-dir/app-rendering/app/ssr-only/layout.js +++ b/test/e2e/app-dir/app-rendering/app/ssr-only/layout.js @@ -1,8 +1,6 @@ import { experimental_use as use } from 'react' -export const config = { - revalidate: 0, -} +export const revalidate = 0 async function getData() { return { diff --git a/test/e2e/app-dir/app-rendering/app/static-only/nested/page.js b/test/e2e/app-dir/app-rendering/app/static-only/nested/page.js index c6206115e7f0a..df8cf59f917a3 100644 --- a/test/e2e/app-dir/app-rendering/app/static-only/nested/page.js +++ b/test/e2e/app-dir/app-rendering/app/static-only/nested/page.js @@ -1,8 +1,6 @@ import { experimental_use as use } from 'react' -export const config = { - revalidate: false, -} +export const revalidate = false async function getData() { return { diff --git a/test/e2e/app-dir/app-rendering/app/static-only/slow/page.js b/test/e2e/app-dir/app-rendering/app/static-only/slow/page.js index d16e406b0e453..df659a579fd49 100644 --- a/test/e2e/app-dir/app-rendering/app/static-only/slow/page.js +++ b/test/e2e/app-dir/app-rendering/app/static-only/slow/page.js @@ -1,8 +1,6 @@ import { experimental_use as use } from 'react' -export const config = { - revalidate: false, -} +export const revalidate = false async function getData() { await new Promise((resolve) => setTimeout(resolve, 5000)) diff --git a/test/e2e/app-dir/app-static/app/(new)/custom/page.js b/test/e2e/app-dir/app-static/app/(new)/custom/page.js index ddc2d8b0fd754..bb9db4f2e7325 100644 --- a/test/e2e/app-dir/app-static/app/(new)/custom/page.js +++ b/test/e2e/app-dir/app-static/app/(new)/custom/page.js @@ -1,6 +1,4 @@ -export const config = { - revalidate: 0, -} +export const revalidate = 0 export default function Page() { return

new root ssr

diff --git a/test/e2e/app-dir/app-static/app/blog/[author]/[slug]/page.js b/test/e2e/app-dir/app-static/app/blog/[author]/[slug]/page.js index ee301c119b61b..f597e830916ff 100644 --- a/test/e2e/app-dir/app-static/app/blog/[author]/[slug]/page.js +++ b/test/e2e/app-dir/app-static/app/blog/[author]/[slug]/page.js @@ -1,6 +1,4 @@ -export const config = { - dynamicParams: true, -} +export const dynamicParams = true export default function Page({ params }) { return ( diff --git a/test/e2e/app-dir/app-static/app/blog/[author]/page.js b/test/e2e/app-dir/app-static/app/blog/[author]/page.js index cbdefb1dd8837..18ff1b30cde8d 100644 --- a/test/e2e/app-dir/app-static/app/blog/[author]/page.js +++ b/test/e2e/app-dir/app-static/app/blog/[author]/page.js @@ -1,8 +1,6 @@ import Link from 'next/link' -export const config = { - dynamicParams: false, -} +export const dynamicParams = false export default function Page({ params }) { return ( diff --git a/test/e2e/app-dir/app-static/app/dynamic-no-gen-params-ssr/[slug]/page.js b/test/e2e/app-dir/app-static/app/dynamic-no-gen-params-ssr/[slug]/page.js index 972c1ec17d586..834d9077d28d1 100644 --- a/test/e2e/app-dir/app-static/app/dynamic-no-gen-params-ssr/[slug]/page.js +++ b/test/e2e/app-dir/app-static/app/dynamic-no-gen-params-ssr/[slug]/page.js @@ -1,6 +1,4 @@ -export const config = { - revalidate: 0, -} +export const revalidate = 0 export default function Page({ params }) { return ( diff --git a/test/e2e/app-dir/app-static/app/ssr-auto/fetch-revalidate-zero/page.js b/test/e2e/app-dir/app-static/app/ssr-auto/fetch-revalidate-zero/page.js index d8d2688196c37..c72ab71d05da3 100644 --- a/test/e2e/app-dir/app-static/app/ssr-auto/fetch-revalidate-zero/page.js +++ b/test/e2e/app-dir/app-static/app/ssr-auto/fetch-revalidate-zero/page.js @@ -20,6 +20,4 @@ export default function Page() { } // TODO-APP: remove revalidate config once next.revalidate is supported -export const config = { - revalidate: 0, -} +export const revalidate = 0 diff --git a/test/e2e/app-dir/app-static/app/ssr-forced/page.js b/test/e2e/app-dir/app-static/app/ssr-forced/page.js index 7c81b5c70ba10..e3ec469edbee1 100644 --- a/test/e2e/app-dir/app-static/app/ssr-forced/page.js +++ b/test/e2e/app-dir/app-static/app/ssr-forced/page.js @@ -1,6 +1,4 @@ -export const config = { - revalidate: 0, -} +export const revalidate = 0 export default function Page() { return ( diff --git a/test/e2e/app-dir/app-typescript/app/layout.tsx b/test/e2e/app-dir/app-typescript/app/layout.tsx index e81e33f88cf6b..88d93c9a1395a 100644 --- a/test/e2e/app-dir/app-typescript/app/layout.tsx +++ b/test/e2e/app-dir/app-typescript/app/layout.tsx @@ -1,9 +1,5 @@ /* eslint-disable */ -export const config = { - revalidate: 0, -} - export const revalidate = -1 export default function Root({ children }) { diff --git a/test/e2e/app-dir/app/app/(rootonly)/dashboard/hello/page.js b/test/e2e/app-dir/app/app/(rootonly)/dashboard/hello/page.js index 20fef22a73245..0b83235a5f40c 100644 --- a/test/e2e/app-dir/app/app/(rootonly)/dashboard/hello/page.js +++ b/test/e2e/app-dir/app/app/(rootonly)/dashboard/hello/page.js @@ -6,6 +6,4 @@ export default function HelloPage(props) { ) } -export const config = { - runtime: 'experimental-edge', -} +export const runtime = 'experimental-edge' diff --git a/test/e2e/app-dir/app/app/dashboard/page.js b/test/e2e/app-dir/app/app/dashboard/page.js index 966a2a3e03b0b..5a3e15c25c935 100644 --- a/test/e2e/app-dir/app/app/dashboard/page.js +++ b/test/e2e/app-dir/app/app/dashboard/page.js @@ -13,6 +13,4 @@ export default function DashboardPage(props) { ) } -export const config = { - runtime: 'experimental-edge', -} +export const runtime = 'experimental-edge' diff --git a/test/e2e/app-dir/app/app/error/server-component/custom-digest/page.js b/test/e2e/app-dir/app/app/error/server-component/custom-digest/page.js index 4bb541ae218e6..3c1af09b5b8da 100644 --- a/test/e2e/app-dir/app/app/error/server-component/custom-digest/page.js +++ b/test/e2e/app-dir/app/app/error/server-component/custom-digest/page.js @@ -1,6 +1,4 @@ -export const config = { - revalidate: 0, -} +export const revalidate = 0 export default function Page() { const err = new Error('this is a test') diff --git a/test/e2e/app-dir/app/app/error/server-component/page.js b/test/e2e/app-dir/app/app/error/server-component/page.js index f771b09bbbfd1..35108577dc03d 100644 --- a/test/e2e/app-dir/app/app/error/server-component/page.js +++ b/test/e2e/app-dir/app/app/error/server-component/page.js @@ -1,6 +1,4 @@ -export const config = { - revalidate: 0, -} +export const revalidate = 0 export default function Page() { throw new Error('this is a test') diff --git a/test/e2e/app-dir/app/app/layout.js b/test/e2e/app-dir/app/app/layout.js index d632f8dab8d5f..f927b818ea39e 100644 --- a/test/e2e/app-dir/app/app/layout.js +++ b/test/e2e/app-dir/app/app/layout.js @@ -3,9 +3,7 @@ import { experimental_use as use } from 'react' import '../styles/global.css' import './style.css' -export const config = { - revalidate: 0, -} +export const revalidate = 0 async function getData() { return { diff --git a/test/e2e/app-dir/app/app/slow-page-no-loading/page.js b/test/e2e/app-dir/app/app/slow-page-no-loading/page.js index c92356c4175bd..07c80d148e092 100644 --- a/test/e2e/app-dir/app/app/slow-page-no-loading/page.js +++ b/test/e2e/app-dir/app/app/slow-page-no-loading/page.js @@ -13,6 +13,4 @@ export default function SlowPage(props) { return

{data.message}

} -export const config = { - runtime: 'experimental-edge', -} +export const runtime = 'experimental-edge' diff --git a/test/e2e/app-dir/app/app/slow-page-with-loading/page.js b/test/e2e/app-dir/app/app/slow-page-with-loading/page.js index c92356c4175bd..07c80d148e092 100644 --- a/test/e2e/app-dir/app/app/slow-page-with-loading/page.js +++ b/test/e2e/app-dir/app/app/slow-page-with-loading/page.js @@ -13,6 +13,4 @@ export default function SlowPage(props) { return

{data.message}

} -export const config = { - runtime: 'experimental-edge', -} +export const runtime = 'experimental-edge' diff --git a/test/e2e/app-dir/next-font/app/page.js b/test/e2e/app-dir/next-font/app/page.js index 4d2b19abd5385..32dcdf6c7997a 100644 --- a/test/e2e/app-dir/next-font/app/page.js +++ b/test/e2e/app-dir/next-font/app/page.js @@ -13,4 +13,4 @@ export default function HomePage() { ) } -export const config = { runtime: 'experimental-edge' } +export const runtime = 'experimental-edge' diff --git a/test/e2e/app-dir/root-layout/app/(mpa-navigation)/(route-group)/layout.js b/test/e2e/app-dir/root-layout/app/(mpa-navigation)/(route-group)/layout.js index cfbc1de9ce956..2efc75f50266f 100644 --- a/test/e2e/app-dir/root-layout/app/(mpa-navigation)/(route-group)/layout.js +++ b/test/e2e/app-dir/root-layout/app/(mpa-navigation)/(route-group)/layout.js @@ -1,7 +1,5 @@ // TODO-APP: remove after fixing filtering static flight data -export const config = { - revalidate: 0, -} +export const revalidate = 0 export default function Root({ children }) { return ( diff --git a/test/e2e/app-dir/root-layout/app/(mpa-navigation)/basic-route/layout.js b/test/e2e/app-dir/root-layout/app/(mpa-navigation)/basic-route/layout.js index cfbc1de9ce956..2efc75f50266f 100644 --- a/test/e2e/app-dir/root-layout/app/(mpa-navigation)/basic-route/layout.js +++ b/test/e2e/app-dir/root-layout/app/(mpa-navigation)/basic-route/layout.js @@ -1,7 +1,5 @@ // TODO-APP: remove after fixing filtering static flight data -export const config = { - revalidate: 0, -} +export const revalidate = 0 export default function Root({ children }) { return ( diff --git a/test/e2e/app-dir/root-layout/app/(mpa-navigation)/dynamic/layout.js b/test/e2e/app-dir/root-layout/app/(mpa-navigation)/dynamic/layout.js index cfbc1de9ce956..2efc75f50266f 100644 --- a/test/e2e/app-dir/root-layout/app/(mpa-navigation)/dynamic/layout.js +++ b/test/e2e/app-dir/root-layout/app/(mpa-navigation)/dynamic/layout.js @@ -1,7 +1,5 @@ // TODO-APP: remove after fixing filtering static flight data -export const config = { - revalidate: 0, -} +export const revalidate = 0 export default function Root({ children }) { return ( diff --git a/test/e2e/app-dir/root-layout/app/(mpa-navigation)/to-pages-dir/layout.js b/test/e2e/app-dir/root-layout/app/(mpa-navigation)/to-pages-dir/layout.js index cfbc1de9ce956..2efc75f50266f 100644 --- a/test/e2e/app-dir/root-layout/app/(mpa-navigation)/to-pages-dir/layout.js +++ b/test/e2e/app-dir/root-layout/app/(mpa-navigation)/to-pages-dir/layout.js @@ -1,7 +1,5 @@ // TODO-APP: remove after fixing filtering static flight data -export const config = { - revalidate: 0, -} +export const revalidate = 0 export default function Root({ children }) { return ( diff --git a/test/e2e/app-dir/root-layout/app/(mpa-navigation)/with-parallel-routes/layout.js b/test/e2e/app-dir/root-layout/app/(mpa-navigation)/with-parallel-routes/layout.js index bd7c2817d37a5..25648360d8d0a 100644 --- a/test/e2e/app-dir/root-layout/app/(mpa-navigation)/with-parallel-routes/layout.js +++ b/test/e2e/app-dir/root-layout/app/(mpa-navigation)/with-parallel-routes/layout.js @@ -1,7 +1,5 @@ // TODO-APP: remove after fixing filtering static flight data -export const config = { - revalidate: 0, -} +export const revalidate = 0 export default function Root({ one, two }) { return ( diff --git a/test/e2e/app-dir/root-layout/app/(required-tags)/has-tags/layout.js b/test/e2e/app-dir/root-layout/app/(required-tags)/has-tags/layout.js index 8d949068ce5b6..f8fd9c6d9b3ea 100644 --- a/test/e2e/app-dir/root-layout/app/(required-tags)/has-tags/layout.js +++ b/test/e2e/app-dir/root-layout/app/(required-tags)/has-tags/layout.js @@ -1,7 +1,5 @@ // TODO-APP: remove after fixing filtering static flight data -export const config = { - revalidate: 0, -} +export const revalidate = 0 export default function Root({ children }) { return ( diff --git a/test/e2e/app-dir/root-layout/app/(required-tags)/missing-tags/layout.js b/test/e2e/app-dir/root-layout/app/(required-tags)/missing-tags/layout.js index 82917da557b6c..a77457c91e08d 100644 --- a/test/e2e/app-dir/root-layout/app/(required-tags)/missing-tags/layout.js +++ b/test/e2e/app-dir/root-layout/app/(required-tags)/missing-tags/layout.js @@ -1,7 +1,5 @@ // TODO-APP: remove after fixing filtering static flight data -export const config = { - revalidate: 0, -} +export const revalidate = 0 export default function Root({ children }) { return children diff --git a/test/e2e/app-dir/root-layout/app/(required-tags)/static-missing-tags/[slug]/page.js b/test/e2e/app-dir/root-layout/app/(required-tags)/static-missing-tags/[slug]/page.js index 19089f791f438..38449dcc2feaa 100644 --- a/test/e2e/app-dir/root-layout/app/(required-tags)/static-missing-tags/[slug]/page.js +++ b/test/e2e/app-dir/root-layout/app/(required-tags)/static-missing-tags/[slug]/page.js @@ -1,6 +1,4 @@ -export const config = { - dynamicParams: false, -} +export const dynamicParams = false export default function Page({ params }) { return

Static page

diff --git a/test/e2e/app-dir/rsc-basic/app/edge/dynamic/[id]/page.js b/test/e2e/app-dir/rsc-basic/app/edge/dynamic/[id]/page.js index 87bac2ff6be9e..6f2b162798eb9 100644 --- a/test/e2e/app-dir/rsc-basic/app/edge/dynamic/[id]/page.js +++ b/test/e2e/app-dir/rsc-basic/app/edge/dynamic/[id]/page.js @@ -2,6 +2,4 @@ export default function page() { return 'dynamic route [id] page' } -export const config = { - runtime: 'experimental-edge', -} +export const runtime = 'experimental-edge' diff --git a/test/e2e/app-dir/rsc-basic/app/edge/dynamic/page.js b/test/e2e/app-dir/rsc-basic/app/edge/dynamic/page.js index 1b83f0120a6ab..356b786c602f3 100644 --- a/test/e2e/app-dir/rsc-basic/app/edge/dynamic/page.js +++ b/test/e2e/app-dir/rsc-basic/app/edge/dynamic/page.js @@ -2,6 +2,4 @@ export default function page() { return 'dynamic route index page' } -export const config = { - runtime: 'experimental-edge', -} +export const runtime = 'experimental-edge' diff --git a/test/e2e/app-dir/rsc-basic/app/layout.js b/test/e2e/app-dir/rsc-basic/app/layout.js index 55cded827d1a8..e9a9ebba67353 100644 --- a/test/e2e/app-dir/rsc-basic/app/layout.js +++ b/test/e2e/app-dir/rsc-basic/app/layout.js @@ -1,9 +1,7 @@ import React from 'react' import RootStyleRegistry from './root-style-registry' -export const config = { - revalidate: 0, -} +export const revalidate = 0 export default function AppLayout({ children }) { return ( diff --git a/test/e2e/app-dir/rsc-basic/app/native-module/page.js b/test/e2e/app-dir/rsc-basic/app/native-module/page.js index 67dffb1a5259f..2afddefe3f60a 100644 --- a/test/e2e/app-dir/rsc-basic/app/native-module/page.js +++ b/test/e2e/app-dir/rsc-basic/app/native-module/page.js @@ -11,6 +11,4 @@ export default function Page() { ) } -export const config = { - runtime: 'nodejs', -} +export const runtime = 'nodejs'