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
e079cce4
Unverified
Commit
e079cce4
authored
Jan 24, 2020
by
JJ Kasper
Committed by
GitHub
Jan 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update static check vars and fix types (#10260)
Co-authored-by:
Joe Haddad
<
timer150@gmail.com
>
parent
8579888c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
index.ts
packages/next/build/index.ts
+6
-4
utils.ts
packages/next/build/utils.ts
+4
-4
No files found.
packages/next/build/index.ts
View file @
e079cce4
...
@@ -53,6 +53,7 @@ import { generateBuildId } from './generate-build-id'
...
@@ -53,6 +53,7 @@ import { generateBuildId } from './generate-build-id'
import
{
isWriteable
}
from
'./is-writeable'
import
{
isWriteable
}
from
'./is-writeable'
import
createSpinner
from
'./spinner'
import
createSpinner
from
'./spinner'
import
{
import
{
isPageStatic
,
collectPages
,
collectPages
,
getPageSizeInKb
,
getPageSizeInKb
,
hasCustomAppGetInitialProps
,
hasCustomAppGetInitialProps
,
...
@@ -416,7 +417,8 @@ export default async function build(dir: string, conf = null): Promise<void> {
...
@@ -416,7 +417,8 @@ export default async function build(dir: string, conf = null): Promise<void> {
const
staticCheckWorkers
=
new
Worker
(
staticCheckWorker
,
{
const
staticCheckWorkers
=
new
Worker
(
staticCheckWorker
,
{
numWorkers
:
config
.
experimental
.
cpus
,
numWorkers
:
config
.
experimental
.
cpus
,
enableWorkerThreads
:
config
.
experimental
.
workerThreads
,
enableWorkerThreads
:
config
.
experimental
.
workerThreads
,
})
})
as
Worker
&
{
isPageStatic
:
typeof
isPageStatic
}
staticCheckWorkers
.
getStdout
().
pipe
(
process
.
stdout
)
staticCheckWorkers
.
getStdout
().
pipe
(
process
.
stdout
)
staticCheckWorkers
.
getStderr
().
pipe
(
process
.
stderr
)
staticCheckWorkers
.
getStderr
().
pipe
(
process
.
stderr
)
...
@@ -481,7 +483,7 @@ export default async function build(dir: string, conf = null): Promise<void> {
...
@@ -481,7 +483,7 @@ export default async function build(dir: string, conf = null): Promise<void> {
if
(
nonReservedPage
)
{
if
(
nonReservedPage
)
{
try
{
try
{
let
result
:
any
=
await
(
staticCheckWorkers
as
any
)
.
isPageStatic
(
let
result
=
await
staticCheckWorkers
.
isPageStatic
(
page
,
page
,
serverBundle
,
serverBundle
,
runtimeEnvConfig
runtimeEnvConfig
...
@@ -492,7 +494,7 @@ export default async function build(dir: string, conf = null): Promise<void> {
...
@@ -492,7 +494,7 @@ export default async function build(dir: string, conf = null): Promise<void> {
hybridAmpPages
.
add
(
page
)
hybridAmpPages
.
add
(
page
)
}
}
if
(
result
.
prerender
)
{
if
(
result
.
hasStaticProps
)
{
ssgPages
.
add
(
page
)
ssgPages
.
add
(
page
)
isSsg
=
true
isSsg
=
true
...
@@ -500,7 +502,7 @@ export default async function build(dir: string, conf = null): Promise<void> {
...
@@ -500,7 +502,7 @@ export default async function build(dir: string, conf = null): Promise<void> {
additionalSsgPaths
.
set
(
page
,
result
.
prerenderRoutes
)
additionalSsgPaths
.
set
(
page
,
result
.
prerenderRoutes
)
ssgPageRoutes
=
result
.
prerenderRoutes
ssgPageRoutes
=
result
.
prerenderRoutes
}
}
}
else
if
(
result
.
s
tatic
&&
customAppGetInitialProps
===
false
)
{
}
else
if
(
result
.
isS
tatic
&&
customAppGetInitialProps
===
false
)
{
staticPages
.
add
(
page
)
staticPages
.
add
(
page
)
isStatic
=
true
isStatic
=
true
}
}
...
...
packages/next/build/utils.ts
View file @
e079cce4
...
@@ -479,9 +479,9 @@ export async function isPageStatic(
...
@@ -479,9 +479,9 @@ export async function isPageStatic(
serverBundle
:
string
,
serverBundle
:
string
,
runtimeEnvConfig
:
any
runtimeEnvConfig
:
any
):
Promise
<
{
):
Promise
<
{
static
?:
boolean
isStatic
?:
boolean
prerender
?:
boolean
isHybridAmp
?:
boolean
isHybridAmp
?:
boolean
hasStaticProps
?:
boolean
prerenderRoutes
?:
string
[]
|
undefined
prerenderRoutes
?:
string
[]
|
undefined
}
>
{
}
>
{
try
{
try
{
...
@@ -593,10 +593,10 @@ export async function isPageStatic(
...
@@ -593,10 +593,10 @@ export async function isPageStatic(
const
config
=
mod
.
config
||
{}
const
config
=
mod
.
config
||
{}
return
{
return
{
s
tatic
:
!
hasStaticProps
&&
!
hasGetInitialProps
,
isS
tatic
:
!
hasStaticProps
&&
!
hasGetInitialProps
,
isHybridAmp
:
config
.
amp
===
'hybrid'
,
isHybridAmp
:
config
.
amp
===
'hybrid'
,
prerenderRoutes
:
prerenderPaths
,
prerenderRoutes
:
prerenderPaths
,
prerender
:
hasStaticProps
,
hasStaticProps
,
}
}
}
catch
(
err
)
{
}
catch
(
err
)
{
if
(
err
.
code
===
'MODULE_NOT_FOUND'
)
return
{}
if
(
err
.
code
===
'MODULE_NOT_FOUND'
)
return
{}
...
...
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