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
This commit is contained in:
Darsh Patel 2020-08-04 14:12:18 +05:30 committed by GitHub
parent 6c59cbb46a
commit 96a66c4bd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 1 deletions

View file

@ -592,6 +592,7 @@ export default async function build(
isHybridAmp,
ssgPageRoutes,
hasSsgFallback,
initialRevalidateSeconds: false,
})
})
)
@ -832,6 +833,13 @@ export default async function build(
srcRoute: null,
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 {
// For a dynamic SSG page, we did not copy its data exports and only
// copy the fallback HTML file (if present).
@ -859,6 +867,14 @@ export default async function build(
`${normalizePagePath(route)}.json`
),
}
// Set route Revalidation Interval
const pageInfo = pageInfos.get(route)
if (pageInfo) {
pageInfo.initialRevalidateSeconds =
exportConfig.initialPageRevalidationMap[route]
pageInfos.set(route, pageInfo)
}
}
}
}

View file

@ -52,6 +52,7 @@ export interface PageInfo {
isSsg: boolean
ssgPageRoutes: string[] | null
hasSsgFallback: boolean
initialRevalidateSeconds: number | false
}
export async function printTreeView(
@ -153,7 +154,11 @@ export async function printTreeView(
: pageInfo?.isSsg
? '●'
: 'λ'
} ${item}`,
} ${
pageInfo?.initialRevalidateSeconds
? `${item} (ISR: ${pageInfo?.initialRevalidateSeconds} Seconds)`
: item
}`,
pageInfo
? ampFirst
? chalk.cyan('AMP')
@ -271,6 +276,13 @@ export async function printTreeView(
'getStaticProps'
)})`,
],
[
'',
'(ISR)',
`incremental static regeneration (uses revalidate in ${chalk.cyan(
'getStaticProps'
)})`,
],
] as [string, string, string][],
{
align: ['l', 'l', 'l'],