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
5f06f9f1
Unverified
Commit
5f06f9f1
authored
Oct 14, 2026
by
Niklas Mischkulnig
Committed by
GitHub
Oct 28, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
only run validation in tests
parent
7f13f946
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
73 deletions
+94
-73
get-static-info-including-layouts.ts
packages/next/src/build/get-static-info-including-layouts.ts
+94
-73
No files found.
packages/next/src/build/get-static-info-including-layouts.ts
View file @
5f06f9f1
...
...
@@ -44,16 +44,6 @@ export async function getStaticInfoIncludingLayouts({
page
:
string
bundler
:
Bundler
}):
Promise
<
Omit
<
PageStaticInfo
,
'config'
>>
{
let
reference
=
await
getStaticInfoIncludingLayoutsInner
({
isInsideAppDir
,
pageExtensions
,
pageFilePath
,
appDir
,
config
:
nextConfig
,
isDev
,
page
,
})
if
(
bundler
===
Bundler
.
Turbopack
)
{
// With a custom static-export destination, production build artifacts still live in .next.
const
buildDistDir
=
isDev
...
...
@@ -70,81 +60,112 @@ export async function getStaticInfoIncludingLayouts({
'static-info.json'
)
let
baseline
=
{
...
reference
}
as
any
// Excluded in Turbopack info. Already emitted as issue by Turbopack
delete
baseline
.
hadUnsupportedValue
// Normalization
// The baseline may skip parsing, so false and missing metadata-export flags
// are equivalent. Turbopack omits false flags.
if
(
!
baseline
.
generateImageMetadata
)
delete
baseline
.
generateImageMetadata
if
(
!
baseline
.
generateSitemaps
)
delete
baseline
.
generateSitemaps
// Empty and missing middleware configurations are equivalent.
if
(
baseline
.
middleware
&&
Object
.
entries
(
baseline
.
middleware
).
length
===
0
)
{
delete
baseline
.
middleware
}
// Downstream runtime selection treats both aliases as Edge; Turbopack emits the canonical
// 'edge'.
if
(
baseline
.
runtime
===
'experimental-edge'
)
{
baseline
.
runtime
=
'edge'
}
// Return type is Omit<PageStaticInfo, 'config'> anyway
delete
baseline
.
config
function
sort
(
v
:
Record
<
string
,
any
>
|
undefined
):
any
{
return
v
?
Object
.
keys
(
v
)
.
sort
()
.
reduce
((
acc
,
key
)
=>
{
acc
[
key
]
=
v
[
key
]
return
acc
},
{}
as
any
)
:
v
function
readStaticInfo
():
PageStaticInfo
{
const
staticInfo
=
JSON
.
parse
(
fs
.
readFileSync
(
staticInfoPath
,
'utf8'
)
)
as
PageStaticInfo
if
(
staticInfo
.
middleware
?.
matchers
)
{
for
(
const
matcher
of
staticInfo
.
middleware
.
matchers
)
{
// Turbopack emits the path, not a regex.
matcher
.
regexp
=
pathToRegexp
(
matcher
.
regexp
).
source
}
}
return
staticInfo
}
baseline
=
sort
(
baseline
)
const
retryUntil
=
Date
.
now
()
+
DEV_STATIC_INFO_RETRY_TIMEOUT
while
(
true
)
{
let
validationError
:
Error
if
(
process
.
env
.
__NEXT_TEST_MODE
&&
process
.
env
.
IS_TURBOPACK_TEST
)
{
/// In the e2e tests, ensure parity between webpack and Turbopack static info
let
reference
=
await
getStaticInfoIncludingLayoutsInner
({
isInsideAppDir
,
pageExtensions
,
pageFilePath
,
appDir
,
config
:
nextConfig
,
isDev
,
page
,
})
let
baseline
=
{
...
reference
}
as
any
// Excluded in Turbopack info. Already emitted as issue by Turbopack
delete
baseline
.
hadUnsupportedValue
// Normalization
// The baseline may skip parsing, so false and missing metadata-export flags
// are equivalent. Turbopack omits false flags.
if
(
!
baseline
.
generateImageMetadata
)
delete
baseline
.
generateImageMetadata
if
(
!
baseline
.
generateSitemaps
)
delete
baseline
.
generateSitemaps
// Empty and missing middleware configurations are equivalent.
if
(
baseline
.
middleware
&&
Object
.
entries
(
baseline
.
middleware
).
length
===
0
)
{
delete
baseline
.
middleware
}
// Downstream runtime selection treats both aliases as Edge; Turbopack emits the canonical
// 'edge'.
if
(
baseline
.
runtime
===
'experimental-edge'
)
{
baseline
.
runtime
=
'edge'
}
// Return type is Omit<PageStaticInfo, 'config'> anyway
delete
baseline
.
config
function
sort
(
v
:
Record
<
string
,
any
>
|
undefined
):
any
{
return
v
?
Object
.
keys
(
v
)
.
sort
()
.
reduce
((
acc
,
key
)
=>
{
acc
[
key
]
=
v
[
key
]
return
acc
},
{}
as
any
)
:
v
}
baseline
=
sort
(
baseline
)
const
retryUntil
=
Date
.
now
()
+
DEV_STATIC_INFO_RETRY_TIMEOUT
while
(
true
)
{
let
validationError
:
Error
try
{
let
turbopack
=
JSON
.
parse
(
fs
.
readFileSync
(
staticInfoPath
,
'utf8'
)
)
as
PageStaticInfo
try
{
const
turbopack
=
readStaticInfo
()
if
(
turbopack
.
middleware
?.
matchers
)
{
for
(
const
matcher
of
turbopack
.
middleware
.
matchers
)
{
// Turbopack emits the path, not a regex
matcher
.
regexp
=
pathToRegexp
(
matcher
.
regexp
).
source
if
(
JSON
.
stringify
(
baseline
)
===
JSON
.
stringify
(
sort
(
turbopack
)))
{
return
turbopack
}
}
if
(
JSON
.
stringify
(
baseline
)
===
JSON
.
stringify
(
sort
(
turbopack
)))
{
return
turbopack
validationError
=
new
Error
(
`Static info mismatch for
${
pageFilePath
}
: `
+
JSON
.
stringify
({
baseline
,
turbopack
},
null
,
2
)
)
}
catch
(
cause
)
{
validationError
=
new
Error
(
'Failed to read Turbopack static info from disk'
,
{
cause
}
)
}
validationError
=
new
Error
(
`Static info mismatch for
${
pageFilePath
}
: `
+
JSON
.
stringify
({
baseline
,
turbopack
},
null
,
2
)
)
}
catch
(
cause
)
{
validationError
=
new
Error
(
'Failed to read Turbopack static info from disk'
,
{
cause
}
)
}
if
(
!
isDev
||
Date
.
now
()
>=
retryUntil
)
{
throw
validationError
if
(
!
isDev
||
Date
.
now
()
>=
retryUntil
)
{
throw
validationError
}
await
wait
(
DEV_STATIC_INFO_RETRY_INTERVAL
)
}
await
wait
(
DEV_STATIC_INFO_RETRY_INTERVAL
)
}
else
{
return
readStaticInfo
()
}
}
else
{
return
getStaticInfoIncludingLayoutsInner
({
isInsideAppDir
,
pageExtensions
,
pageFilePath
,
appDir
,
config
:
nextConfig
,
isDev
,
page
,
})
}
return
reference
}
async
function
getStaticInfoIncludingLayoutsInner
({
isInsideAppDir
,
pageExtensions
,
...
...
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