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
76dddc43
Commit
76dddc43
authored
Oct 18, 2025
by
Niklas Mischkulnig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dedupe
parent
b5599525
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
43 deletions
+27
-43
index.ts
packages/next/src/build/index.ts
+12
-11
progress.ts
packages/next/src/build/progress.ts
+2
-15
spinner.ts
packages/next/src/build/spinner.ts
+13
-17
No files found.
packages/next/src/build/index.ts
View file @
76dddc43
...
@@ -3945,12 +3945,6 @@ export default async function build(
...
@@ -3945,12 +3945,6 @@ export default async function build(
.
traceAsyncFn
(()
=>
writeManifest
(
routesManifestPath
,
routesManifest
))
.
traceAsyncFn
(()
=>
writeManifest
(
routesManifestPath
,
routesManifest
))
}
}
const
postBuildSpinner
=
createSpinner
(
'Finalizing page optimization'
)
let
buildTracesSpinner
if
(
buildTracesPromise
)
{
buildTracesSpinner
=
createSpinner
(
'Collecting build traces'
)
}
// ensure the worker is not left hanging
// ensure the worker is not left hanging
worker
.
end
()
worker
.
end
()
...
@@ -4096,6 +4090,11 @@ export default async function build(
...
@@ -4096,6 +4090,11 @@ export default async function build(
})
})
}
}
let
buildTracesSpinner
if
(
buildTracesPromise
)
{
buildTracesSpinner
=
createSpinner
(
'Collecting build traces'
)
}
await
buildTracesPromise
await
buildTracesPromise
if
(
buildTracesSpinner
)
{
if
(
buildTracesSpinner
)
{
...
@@ -4109,6 +4108,7 @@ export default async function build(
...
@@ -4109,6 +4108,7 @@ export default async function build(
}
}
if
(
config
.
output
===
'export'
)
{
if
(
config
.
output
===
'export'
)
{
const
spinner
=
createSpinner
(
'Outputting static export'
)
await
nextBuildSpan
await
nextBuildSpan
.
traceChild
(
'output-export-full-static-export'
)
.
traceChild
(
'output-export-full-static-export'
)
.
traceAsyncFn
(
async
()
=>
{
.
traceAsyncFn
(
async
()
=>
{
...
@@ -4121,6 +4121,8 @@ export default async function build(
...
@@ -4121,6 +4121,8 @@ export default async function build(
appDirOnly
appDirOnly
)
)
})
})
spinner
.
stopAndPersist
()
}
}
// This should come after output: export handling but before
// This should come after output: export handling but before
...
@@ -4128,6 +4130,7 @@ export default async function build(
...
@@ -4128,6 +4130,7 @@ export default async function build(
// not be allowed if an adapter with onBuildComplete is configured
// not be allowed if an adapter with onBuildComplete is configured
const
adapterPath
=
config
.
experimental
.
adapterPath
const
adapterPath
=
config
.
experimental
.
adapterPath
if
(
adapterPath
)
{
if
(
adapterPath
)
{
const
spinner
=
createSpinner
(
'Finalizing build with adapter'
)
await
nextBuildSpan
await
nextBuildSpan
.
traceChild
(
'adapter-handle-build-complete'
)
.
traceChild
(
'adapter-handle-build-complete'
)
.
traceAsyncFn
(
async
()
=>
{
.
traceAsyncFn
(
async
()
=>
{
...
@@ -4152,9 +4155,11 @@ export default async function build(
...
@@ -4152,9 +4155,11 @@ export default async function build(
requiredServerFiles
:
requiredServerFilesManifest
.
files
,
requiredServerFiles
:
requiredServerFilesManifest
.
files
,
})
})
})
})
spinner
.
stopAndPersist
()
}
}
if
(
config
.
output
===
'standalone'
)
{
if
(
config
.
output
===
'standalone'
)
{
const
spinner
=
createSpinner
(
'Generating standalone output'
)
await
nextBuildSpan
await
nextBuildSpan
.
traceChild
(
'output-standalone'
)
.
traceChild
(
'output-standalone'
)
.
traceAsyncFn
(
async
()
=>
{
.
traceAsyncFn
(
async
()
=>
{
...
@@ -4173,13 +4178,9 @@ export default async function build(
...
@@ -4173,13 +4178,9 @@ export default async function build(
appDir
appDir
)
)
})
})
spinner
.
stopAndPersist
()
}
}
if
(
postBuildSpinner
)
{
postBuildSpinner
.
stopAndPersist
()
}
console
.
log
()
if
(
debugOutput
)
{
if
(
debugOutput
)
{
nextBuildSpan
nextBuildSpan
.
traceChild
(
'print-custom-routes'
)
.
traceChild
(
'print-custom-routes'
)
...
...
packages/next/src/build/progress.ts
View file @
76dddc43
import
*
as
Log
from
'../build/output/log'
import
{
hrtimeDurationToString
}
from
'./duration-to-string'
import
createSpinner
from
'./spinner'
import
createSpinner
from
'./spinner'
function
divideSegments
(
number
:
number
,
segments
:
number
):
number
[]
{
function
divideSegments
(
number
:
number
,
segments
:
number
):
number
[]
{
...
@@ -16,8 +14,6 @@ function divideSegments(number: number, segments: number): number[] {
...
@@ -16,8 +14,6 @@ function divideSegments(number: number, segments: number): number[] {
}
}
export
const
createProgress
=
(
total
:
number
,
label
:
string
)
=>
{
export
const
createProgress
=
(
total
:
number
,
label
:
string
)
=>
{
const
progressStart
=
process
.
hrtime
()
const
segments
=
divideSegments
(
total
,
4
)
const
segments
=
divideSegments
(
total
,
4
)
if
(
total
===
0
)
{
if
(
total
===
0
)
{
...
@@ -49,10 +45,6 @@ export const createProgress = (total: number, label: string) => {
...
@@ -49,10 +45,6 @@ export const createProgress = (total: number, label: string) => {
interval
:
200
,
interval
:
200
,
},
},
})
})
if
(
process
.
stdout
.
isTTY
)
{
// createSpinner logs the initial state, but doesn't do anything afterwards anyway.
progressSpinner
=
undefined
}
const
run
=
()
=>
{
const
run
=
()
=>
{
curProgress
++
curProgress
++
...
@@ -79,13 +71,8 @@ export const createProgress = (total: number, label: string) => {
...
@@ -79,13 +71,8 @@ export const createProgress = (total: number, label: string) => {
if
(
progressSpinner
&&
!
isFinished
)
{
if
(
progressSpinner
&&
!
isFinished
)
{
progressSpinner
.
setText
(
message
)
progressSpinner
.
setText
(
message
)
}
else
{
}
else
{
progressSpinner
?.
stop
()
progressSpinner
.
setText
(
message
)
if
(
isFinished
)
{
progressSpinner
?.
stopAndPersist
()
const
progressEnd
=
process
.
hrtime
(
progressStart
)
Log
.
event
(
`
${
message
}
in
${
hrtimeDurationToString
(
progressEnd
)}
`
)
}
else
{
Log
.
info
(
`
${
message
}
${
process
.
stdout
.
isTTY
?
'
\
n'
:
'
\
r'
}
`
)
}
}
}
}
}
...
...
packages/next/src/build/spinner.ts
View file @
76dddc43
...
@@ -13,6 +13,7 @@ export default function createSpinner(
...
@@ -13,6 +13,7 @@ export default function createSpinner(
logFn
:
(...
data
:
any
[])
=>
void
=
console
.
log
logFn
:
(...
data
:
any
[])
=>
void
=
console
.
log
)
{
)
{
let
prefixText
=
`
${
Log
.
prefixes
.
info
}
${
text
}
`
let
prefixText
=
`
${
Log
.
prefixes
.
info
}
${
text
}
`
const
progressStart
=
process
.
hrtime
()
if
(
process
.
stdout
.
isTTY
)
{
if
(
process
.
stdout
.
isTTY
)
{
let
spinner
=
ora
({
let
spinner
=
ora
({
...
@@ -34,8 +35,8 @@ export default function createSpinner(
...
@@ -34,8 +35,8 @@ export default function createSpinner(
const
logHandle
=
(
method
:
any
,
args
:
any
[])
=>
{
const
logHandle
=
(
method
:
any
,
args
:
any
[])
=>
{
// Enter a new line before logging new message, to avoid
// Enter a new line before logging new message, to avoid
// the new message shows up right after the spinner in the same line.
// the new message shows up right after the spinner in the same line.
const
isInProgress
=
spinner
?
.
isSpinning
const
isInProgress
=
spinner
.
isSpinning
if
(
spinner
&&
isInProgress
)
{
if
(
isInProgress
)
{
// Reset the current running spinner to empty line by `\r`
// Reset the current running spinner to empty line by `\r`
spinner
.
prefixText
=
'
\
r'
spinner
.
prefixText
=
'
\
r'
spinner
.
text
=
'
\
r'
spinner
.
text
=
'
\
r'
...
@@ -43,7 +44,7 @@ export default function createSpinner(
...
@@ -43,7 +44,7 @@ export default function createSpinner(
origStop
()
origStop
()
}
}
method
(...
args
)
method
(...
args
)
if
(
spinner
&&
isInProgress
)
{
if
(
isInProgress
)
{
spinner
.
start
()
spinner
.
start
()
}
}
}
}
...
@@ -60,32 +61,27 @@ export default function createSpinner(
...
@@ -60,32 +61,27 @@ export default function createSpinner(
spinner
.
setText
=
(
newText
)
=>
{
spinner
.
setText
=
(
newText
)
=>
{
text
=
newText
text
=
newText
prefixText
=
`
${
Log
.
prefixes
.
info
}
${
newText
}
`
prefixText
=
`
${
Log
.
prefixes
.
info
}
${
newText
}
`
spinner
!
.
prefixText
=
prefixText
spinner
.
prefixText
=
prefixText
return
spinner
!
return
spinner
}
}
spinner
.
stop
=
()
=>
{
spinner
.
stop
=
()
=>
{
origStop
()
origStop
()
resetLog
()
resetLog
()
return
spinner
!
return
spinner
}
}
spinner
.
stopAndPersist
=
()
=>
{
spinner
.
stopAndPersist
=
()
=>
{
// Add \r at beginning to reset the current line of loading status text
const
progressEnd
=
process
.
hrtime
(
progressStart
)
const
suffixText
=
`\r
${
Log
.
prefixes
.
event
}
${
text
}
`
text
=
`
${
text
}
in
${
hrtimeDurationToString
(
progressEnd
)}
`
if
(
spinner
)
{
prefixText
=
`
${
Log
.
prefixes
.
info
}
${
text
}
`
spinner
.
text
=
suffixText
spinner
.
prefixText
=
prefixText
}
else
{
logFn
(
suffixText
)
}
origStopAndPersist
()
origStopAndPersist
()
resetLog
()
resetLog
()
return
spinner
!
return
spinner
}
}
return
spinner
return
spinner
}
else
if
(
prefixText
||
text
)
{
}
else
{
logFn
(
prefixText
?
prefixText
+
'...'
:
text
)
logFn
(
prefixText
?
prefixText
+
'...'
:
text
)
const
progressStart
=
process
.
hrtime
()
// @ts-ignore
// @ts-ignore
let
spinner
=
{
let
spinner
=
{
isSpinning
:
false
,
isSpinning
:
false
,
...
...
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