Skip to content

Commit

Permalink
incremental static generation and regeneration support in build manif…
Browse files Browse the repository at this point in the history
…est (#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
  • Loading branch information
darshkpatel authored Aug 4, 2020
1 parent 6c59cbb commit 96a66c4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
16 changes: 16 additions & 0 deletions packages/next/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ export default async function build(
isHybridAmp,
ssgPageRoutes,
hasSsgFallback,
initialRevalidateSeconds: false,
})
})
)
Expand Down Expand Up @@ -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).
Expand Down Expand Up @@ -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)
}
}
}
}
Expand Down
14 changes: 13 additions & 1 deletion packages/next/build/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export interface PageInfo {
isSsg: boolean
ssgPageRoutes: string[] | null
hasSsgFallback: boolean
initialRevalidateSeconds: number | false
}

export async function printTreeView(
Expand Down Expand Up @@ -153,7 +154,11 @@ export async function printTreeView(
: pageInfo?.isSsg
? '●'
: 'λ'
} ${item}`,
} ${
pageInfo?.initialRevalidateSeconds
? `${item} (ISR: ${pageInfo?.initialRevalidateSeconds} Seconds)`
: item
}`,
pageInfo
? ampFirst
? chalk.cyan('AMP')
Expand Down Expand Up @@ -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'],
Expand Down

0 comments on commit 96a66c4

Please sign in to comment.