Unverified Commit 96a66c4b authored by Darsh Patel's avatar Darsh Patel Committed by GitHub

incremental static generation and regeneration support in build manifest (#14365)

The icon is just something I thought might look good, can certainly be changed.
I've currently added incremental static generation support

Edit: Updated screenshot after 8037981
![Screenshot 2020-08-04 at 1 51 14 PM](https://user-images.githubusercontent.com/11258286/89270960-afe9f400-d659-11ea-8f18-197dc53b8beb.png)





Fixes: #14204 
parent 6c59cbb4
...@@ -592,6 +592,7 @@ export default async function build( ...@@ -592,6 +592,7 @@ export default async function build(
isHybridAmp, isHybridAmp,
ssgPageRoutes, ssgPageRoutes,
hasSsgFallback, hasSsgFallback,
initialRevalidateSeconds: false,
}) })
}) })
) )
...@@ -832,6 +833,13 @@ export default async function build( ...@@ -832,6 +833,13 @@ export default async function build(
srcRoute: null, srcRoute: null,
dataRoute: path.posix.join('/_next/data', buildId, `${file}.json`), dataRoute: path.posix.join('/_next/data', buildId, `${file}.json`),
} }
// Set Page Revalidation Interval
const pageInfo = pageInfos.get(page)
if (pageInfo) {
pageInfo.initialRevalidateSeconds =
exportConfig.initialPageRevalidationMap[page]
pageInfos.set(page, pageInfo)
}
} else { } else {
// For a dynamic SSG page, we did not copy its data exports and only // For a dynamic SSG page, we did not copy its data exports and only
// copy the fallback HTML file (if present). // copy the fallback HTML file (if present).
...@@ -859,6 +867,14 @@ export default async function build( ...@@ -859,6 +867,14 @@ export default async function build(
`${normalizePagePath(route)}.json` `${normalizePagePath(route)}.json`
), ),
} }
// Set route Revalidation Interval
const pageInfo = pageInfos.get(route)
if (pageInfo) {
pageInfo.initialRevalidateSeconds =
exportConfig.initialPageRevalidationMap[route]
pageInfos.set(route, pageInfo)
}
} }
} }
} }
......
...@@ -52,6 +52,7 @@ export interface PageInfo { ...@@ -52,6 +52,7 @@ export interface PageInfo {
isSsg: boolean isSsg: boolean
ssgPageRoutes: string[] | null ssgPageRoutes: string[] | null
hasSsgFallback: boolean hasSsgFallback: boolean
initialRevalidateSeconds: number | false
} }
export async function printTreeView( export async function printTreeView(
...@@ -153,7 +154,11 @@ export async function printTreeView( ...@@ -153,7 +154,11 @@ export async function printTreeView(
: pageInfo?.isSsg : pageInfo?.isSsg
? '●' ? '●'
: 'λ' : 'λ'
} ${item}`, } ${
pageInfo?.initialRevalidateSeconds
? `${item} (ISR: ${pageInfo?.initialRevalidateSeconds} Seconds)`
: item
}`,
pageInfo pageInfo
? ampFirst ? ampFirst
? chalk.cyan('AMP') ? chalk.cyan('AMP')
...@@ -271,6 +276,13 @@ export async function printTreeView( ...@@ -271,6 +276,13 @@ export async function printTreeView(
'getStaticProps' 'getStaticProps'
)})`, )})`,
], ],
[
'',
'(ISR)',
`incremental static regeneration (uses revalidate in ${chalk.cyan(
'getStaticProps'
)})`,
],
] as [string, string, string][], ] as [string, string, string][],
{ {
align: ['l', 'l', 'l'], align: ['l', 'l', 'l'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment