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(
.
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
worker
.
end
()
...
...
@@ -4096,6 +4090,11 @@ export default async function build(
})
}
let
buildTracesSpinner
if
(
buildTracesPromise
)
{
buildTracesSpinner
=
createSpinner
(
'Collecting build traces'
)
}
await
buildTracesPromise
if
(
buildTracesSpinner
)
{
...
...
@@ -4109,6 +4108,7 @@ export default async function build(
}
if
(
config
.
output
===
'export'
)
{
const
spinner
=
createSpinner
(
'Outputting static export'
)
await
nextBuildSpan
.
traceChild
(
'output-export-full-static-export'
)
.
traceAsyncFn
(
async
()
=>
{
...
...
@@ -4121,6 +4121,8 @@ export default async function build(
appDirOnly
)
})
spinner
.
stopAndPersist
()
}
// This should come after output: export handling but before
...
...
@@ -4128,6 +4130,7 @@ export default async function build(
// not be allowed if an adapter with onBuildComplete is configured
const
adapterPath
=
config
.
experimental
.
adapterPath
if
(
adapterPath
)
{
const
spinner
=
createSpinner
(
'Finalizing build with adapter'
)
await
nextBuildSpan
.
traceChild
(
'adapter-handle-build-complete'
)
.
traceAsyncFn
(
async
()
=>
{
...
...
@@ -4152,9 +4155,11 @@ export default async function build(
requiredServerFiles
:
requiredServerFilesManifest
.
files
,
})
})
spinner
.
stopAndPersist
()
}
if
(
config
.
output
===
'standalone'
)
{
const
spinner
=
createSpinner
(
'Generating standalone output'
)
await
nextBuildSpan
.
traceChild
(
'output-standalone'
)
.
traceAsyncFn
(
async
()
=>
{
...
...
@@ -4173,13 +4178,9 @@ export default async function build(
appDir
)
})
spinner
.
stopAndPersist
()
}
if
(
postBuildSpinner
)
{
postBuildSpinner
.
stopAndPersist
()
}
console
.
log
()
if
(
debugOutput
)
{
nextBuildSpan
.
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'
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
)
=>
{
const
progressStart
=
process
.
hrtime
()
const
segments
=
divideSegments
(
total
,
4
)
if
(
total
===
0
)
{
...
...
@@ -49,10 +45,6 @@ export const createProgress = (total: number, label: string) => {
interval
:
200
,
},
})
if
(
process
.
stdout
.
isTTY
)
{
// createSpinner logs the initial state, but doesn't do anything afterwards anyway.
progressSpinner
=
undefined
}
const
run
=
()
=>
{
curProgress
++
...
...
@@ -79,13 +71,8 @@ export const createProgress = (total: number, label: string) => {
if
(
progressSpinner
&&
!
isFinished
)
{
progressSpinner
.
setText
(
message
)
}
else
{
progressSpinner
?.
stop
()
if
(
isFinished
)
{
const
progressEnd
=
process
.
hrtime
(
progressStart
)
Log
.
event
(
`
${
message
}
in
${
hrtimeDurationToString
(
progressEnd
)}
`
)
}
else
{
Log
.
info
(
`
${
message
}
${
process
.
stdout
.
isTTY
?
'
\
n'
:
'
\
r'
}
`
)
}
progressSpinner
.
setText
(
message
)
progressSpinner
?.
stopAndPersist
()
}
}
...
...
packages/next/src/build/spinner.ts
View file @
76dddc43
...
...
@@ -13,6 +13,7 @@ export default function createSpinner(
logFn
:
(...
data
:
any
[])
=>
void
=
console
.
log
)
{
let
prefixText
=
`
${
Log
.
prefixes
.
info
}
${
text
}
`
const
progressStart
=
process
.
hrtime
()
if
(
process
.
stdout
.
isTTY
)
{
let
spinner
=
ora
({
...
...
@@ -34,8 +35,8 @@ export default function createSpinner(
const
logHandle
=
(
method
:
any
,
args
:
any
[])
=>
{
// Enter a new line before logging new message, to avoid
// the new message shows up right after the spinner in the same line.
const
isInProgress
=
spinner
?
.
isSpinning
if
(
spinner
&&
isInProgress
)
{
const
isInProgress
=
spinner
.
isSpinning
if
(
isInProgress
)
{
// Reset the current running spinner to empty line by `\r`
spinner
.
prefixText
=
'
\
r'
spinner
.
text
=
'
\
r'
...
...
@@ -43,7 +44,7 @@ export default function createSpinner(
origStop
()
}
method
(...
args
)
if
(
spinner
&&
isInProgress
)
{
if
(
isInProgress
)
{
spinner
.
start
()
}
}
...
...
@@ -60,32 +61,27 @@ export default function createSpinner(
spinner
.
setText
=
(
newText
)
=>
{
text
=
newText
prefixText
=
`
${
Log
.
prefixes
.
info
}
${
newText
}
`
spinner
!
.
prefixText
=
prefixText
return
spinner
!
spinner
.
prefixText
=
prefixText
return
spinner
}
spinner
.
stop
=
()
=>
{
origStop
()
resetLog
()
return
spinner
!
return
spinner
}
spinner
.
stopAndPersist
=
()
=>
{
// Add \r at beginning to reset the current line of loading status text
const
suffixText
=
`\r
${
Log
.
prefixes
.
event
}
${
text
}
`
if
(
spinner
)
{
spinner
.
text
=
suffixText
}
else
{
logFn
(
suffixText
)
}
const
progressEnd
=
process
.
hrtime
(
progressStart
)
text
=
`
${
text
}
in
${
hrtimeDurationToString
(
progressEnd
)}
`
prefixText
=
`
${
Log
.
prefixes
.
info
}
${
text
}
`
spinner
.
prefixText
=
prefixText
origStopAndPersist
()
resetLog
()
return
spinner
!
return
spinner
}
return
spinner
}
else
if
(
prefixText
||
text
)
{
}
else
{
logFn
(
prefixText
?
prefixText
+
'...'
:
text
)
const
progressStart
=
process
.
hrtime
()
// @ts-ignore
let
spinner
=
{
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