Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
9e65c6a9
Unverified
Commit
9e65c6a9
authored
Aug 12, 2020
by
Joe Haddad
Committed by
GitHub
Aug 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Strongly type PageLoader (#16132)
Fixes #16131
parent
e72ac764
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
65 deletions
+89
-65
index.ts
packages/next/build/index.ts
+3
-1
build-manifest-plugin.ts
packages/next/build/webpack/plugins/build-manifest-plugin.ts
+3
-1
page-loader.ts
packages/next/client/page-loader.ts
+83
-63
No files found.
packages/next/build/index.ts
View file @
9e65c6a9
...
@@ -1064,6 +1064,8 @@ export default async function build(
...
@@ -1064,6 +1064,8 @@ export default async function build(
await
telemetry
.
flush
()
await
telemetry
.
flush
()
}
}
export
type
ClientSsgManifest
=
Set
<
string
>
function
generateClientSsgManifest
(
function
generateClientSsgManifest
(
prerenderManifest
:
PrerenderManifest
,
prerenderManifest
:
PrerenderManifest
,
{
{
...
@@ -1072,7 +1074,7 @@ function generateClientSsgManifest(
...
@@ -1072,7 +1074,7 @@ function generateClientSsgManifest(
isModern
,
isModern
,
}:
{
buildId
:
string
;
distDir
:
string
;
isModern
:
boolean
}
}:
{
buildId
:
string
;
distDir
:
string
;
isModern
:
boolean
}
)
{
)
{
const
ssgPages
:
Set
<
string
>
=
new
Set
<
string
>
([
const
ssgPages
:
ClientSsgManifest
=
new
Set
<
string
>
([
...
Object
.
entries
(
prerenderManifest
.
routes
)
...
Object
.
entries
(
prerenderManifest
.
routes
)
// Filter out dynamic routes
// Filter out dynamic routes
.
filter
(([,
{
srcRoute
}])
=>
srcRoute
==
null
)
.
filter
(([,
{
srcRoute
}])
=>
srcRoute
==
null
)
...
...
packages/next/build/webpack/plugins/build-manifest-plugin.ts
View file @
9e65c6a9
...
@@ -15,13 +15,15 @@ import { ampFirstEntryNamesMap } from './next-drop-client-page-plugin'
...
@@ -15,13 +15,15 @@ import { ampFirstEntryNamesMap } from './next-drop-client-page-plugin'
const
isWebpack5
=
parseInt
(
webpack
.
version
!
)
===
5
const
isWebpack5
=
parseInt
(
webpack
.
version
!
)
===
5
export
type
ClientBuildManifest
=
Record
<
string
,
string
[]
>
// This function takes the asset map generated in BuildManifestPlugin and creates a
// This function takes the asset map generated in BuildManifestPlugin and creates a
// reduced version to send to the client.
// reduced version to send to the client.
function
generateClientManifest
(
function
generateClientManifest
(
assetMap
:
BuildManifest
,
assetMap
:
BuildManifest
,
isModern
:
boolean
isModern
:
boolean
):
string
{
):
string
{
const
clientManifest
:
{
[
s
:
string
]:
string
[]
}
=
{}
const
clientManifest
:
ClientBuildManifest
=
{}
const
appDependencies
=
new
Set
(
assetMap
.
pages
[
'/_app'
])
const
appDependencies
=
new
Set
(
assetMap
.
pages
[
'/_app'
])
Object
.
entries
(
assetMap
.
pages
).
forEach
(([
page
,
dependencies
])
=>
{
Object
.
entries
(
assetMap
.
pages
).
forEach
(([
page
,
dependencies
])
=>
{
...
...
packages/next/client/page-loader.
j
s
→
packages/next/client/page-loader.
t
s
View file @
9e65c6a9
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment