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
de22009a
Commit
de22009a
authored
Oct 17, 2025
by
Niklas Mischkulnig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix printing phase durations for non-tty terminals
parent
1e4ae2cc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
34 deletions
+30
-34
index.ts
packages/next/src/build/index.ts
+1
-22
progress.ts
packages/next/src/build/progress.ts
+2
-1
spinner.ts
packages/next/src/build/spinner.ts
+26
-5
type-check.ts
packages/next/src/build/type-check.ts
+1
-6
No files found.
packages/next/src/build/index.ts
View file @
de22009a
...
@@ -210,7 +210,7 @@ import { turbopackBuild } from './turbopack-build'
...
@@ -210,7 +210,7 @@ import { turbopackBuild } from './turbopack-build'
import
{
isFileSystemCacheEnabledForBuild
}
from
'../shared/lib/turbopack/utils'
import
{
isFileSystemCacheEnabledForBuild
}
from
'../shared/lib/turbopack/utils'
import
{
inlineStaticEnv
}
from
'../lib/inline-static-env'
import
{
inlineStaticEnv
}
from
'../lib/inline-static-env'
import
{
populateStaticEnv
}
from
'../lib/static-env'
import
{
populateStaticEnv
}
from
'../lib/static-env'
import
{
durationToString
,
hrtimeDurationToString
}
from
'./duration-to-string'
import
{
durationToString
}
from
'./duration-to-string'
import
{
traceGlobals
}
from
'../trace/shared'
import
{
traceGlobals
}
from
'../trace/shared'
import
{
extractNextErrorCode
}
from
'../lib/error-telemetry-utils'
import
{
extractNextErrorCode
}
from
'../lib/error-telemetry-utils'
import
{
runAfterProductionCompile
}
from
'./after-production-compile'
import
{
runAfterProductionCompile
}
from
'./after-production-compile'
...
@@ -1857,7 +1857,6 @@ export default async function build(
...
@@ -1857,7 +1857,6 @@ export default async function build(
traceMemoryUsage
(
'Finished type checking'
,
nextBuildSpan
)
traceMemoryUsage
(
'Finished type checking'
,
nextBuildSpan
)
}
}
const
collectingPageDataStart
=
process
.
hrtime
()
const
postCompileSpinner
=
createSpinner
(
'Collecting page data'
)
const
postCompileSpinner
=
createSpinner
(
'Collecting page data'
)
const
buildManifestPath
=
path
.
join
(
distDir
,
BUILD_MANIFEST
)
const
buildManifestPath
=
path
.
join
(
distDir
,
BUILD_MANIFEST
)
...
@@ -2419,10 +2418,6 @@ export default async function build(
...
@@ -2419,10 +2418,6 @@ export default async function build(
})
})
if
(
postCompileSpinner
)
{
if
(
postCompileSpinner
)
{
const
collectingPageDataEnd
=
process
.
hrtime
(
collectingPageDataStart
)
postCompileSpinner
.
setText
(
`Collecting page data in
${
hrtimeDurationToString
(
collectingPageDataEnd
)}
`
)
postCompileSpinner
.
stopAndPersist
()
postCompileSpinner
.
stopAndPersist
()
}
}
traceMemoryUsage
(
'Finished collecting page data'
,
nextBuildSpan
)
traceMemoryUsage
(
'Finished collecting page data'
,
nextBuildSpan
)
...
@@ -3931,12 +3926,9 @@ export default async function build(
...
@@ -3931,12 +3926,9 @@ export default async function build(
.
traceAsyncFn
(()
=>
writeManifest
(
routesManifestPath
,
routesManifest
))
.
traceAsyncFn
(()
=>
writeManifest
(
routesManifestPath
,
routesManifest
))
}
}
const
finalizingPageOptimizationStart
=
process
.
hrtime
()
const
postBuildSpinner
=
createSpinner
(
'Finalizing page optimization'
)
const
postBuildSpinner
=
createSpinner
(
'Finalizing page optimization'
)
let
buildTracesSpinner
let
buildTracesSpinner
let
buildTracesStart
if
(
buildTracesPromise
)
{
if
(
buildTracesPromise
)
{
buildTracesStart
=
process
.
hrtime
()
buildTracesSpinner
=
createSpinner
(
'Collecting build traces'
)
buildTracesSpinner
=
createSpinner
(
'Collecting build traces'
)
}
}
...
@@ -4088,14 +4080,7 @@ export default async function build(
...
@@ -4088,14 +4080,7 @@ export default async function build(
await
buildTracesPromise
await
buildTracesPromise
if
(
buildTracesSpinner
)
{
if
(
buildTracesSpinner
)
{
if
(
buildTracesStart
)
{
const
buildTracesEnd
=
process
.
hrtime
(
buildTracesStart
)
buildTracesSpinner
.
setText
(
`Collecting build traces in
${
hrtimeDurationToString
(
buildTracesEnd
)}
`
)
}
buildTracesSpinner
.
stopAndPersist
()
buildTracesSpinner
.
stopAndPersist
()
buildTracesSpinner
=
undefined
}
}
if
(
isCompileMode
)
{
if
(
isCompileMode
)
{
...
@@ -4172,12 +4157,6 @@ export default async function build(
...
@@ -4172,12 +4157,6 @@ export default async function build(
}
}
if
(
postBuildSpinner
)
{
if
(
postBuildSpinner
)
{
const
finalizingPageOptimizationEnd
=
process
.
hrtime
(
finalizingPageOptimizationStart
)
postBuildSpinner
.
setText
(
`Finalizing page optimization in
${
hrtimeDurationToString
(
finalizingPageOptimizationEnd
)}
`
)
postBuildSpinner
.
stopAndPersist
()
postBuildSpinner
.
stopAndPersist
()
}
}
console
.
log
()
console
.
log
()
...
...
packages/next/src/build/progress.ts
View file @
de22009a
...
@@ -72,7 +72,7 @@ export const createProgress = (total: number, label: string) => {
...
@@ -72,7 +72,7 @@ export const createProgress = (total: number, label: string) => {
const
isFinished
=
curProgress
===
total
const
isFinished
=
curProgress
===
total
const
message
=
`
${
label
}
(
${
curProgress
}
/
${
total
}
)`
const
message
=
`
${
label
}
(
${
curProgress
}
/
${
total
}
)`
if
(
progressSpinner
&&
!
isFinished
)
{
if
(
pro
cess
.
stdout
.
isTTY
&&
pro
gressSpinner
&&
!
isFinished
)
{
progressSpinner
.
setText
(
message
)
progressSpinner
.
setText
(
message
)
}
else
{
}
else
{
progressSpinner
?.
stop
()
progressSpinner
?.
stop
()
...
@@ -87,6 +87,7 @@ export const createProgress = (total: number, label: string) => {
...
@@ -87,6 +87,7 @@ export const createProgress = (total: number, label: string) => {
const
clear
=
()
=>
{
const
clear
=
()
=>
{
if
(
if
(
process
.
stdout
.
isTTY
&&
progressSpinner
&&
progressSpinner
&&
// Ensure only reset and clear once to avoid set operation overflow in ora
// Ensure only reset and clear once to avoid set operation overflow in ora
progressSpinner
.
isSpinning
progressSpinner
.
isSpinning
...
...
packages/next/src/build/spinner.ts
View file @
de22009a
import
ora
from
'next/dist/compiled/ora'
import
ora
from
'next/dist/compiled/ora'
import
*
as
Log
from
'./output/log'
import
*
as
Log
from
'./output/log'
import
{
hrtimeDurationToString
}
from
'./duration-to-string'
const
dotsSpinner
=
{
const
dotsSpinner
=
{
frames
:
[
'.'
,
'..'
,
'...'
],
frames
:
[
'.'
,
'..'
,
'...'
],
...
@@ -11,12 +12,10 @@ export default function createSpinner(
...
@@ -11,12 +12,10 @@ export default function createSpinner(
options
:
ora
.
Options
=
{},
options
:
ora
.
Options
=
{},
logFn
:
(...
data
:
any
[])
=>
void
=
console
.
log
logFn
:
(...
data
:
any
[])
=>
void
=
console
.
log
)
{
)
{
let
spinner
:
undefined
|
(
ora
.
Ora
&
{
setText
:
(
text
:
string
)
=>
void
})
let
prefixText
=
`
${
Log
.
prefixes
.
info
}
${
text
}
`
let
prefixText
=
`
${
Log
.
prefixes
.
info
}
${
text
}
`
if
(
process
.
stdout
.
isTTY
)
{
if
(
process
.
stdout
.
isTTY
)
{
spinner
=
ora
({
let
spinner
=
ora
({
text
:
undefined
,
text
:
undefined
,
prefixText
,
prefixText
,
spinner
:
dotsSpinner
,
spinner
:
dotsSpinner
,
...
@@ -81,9 +80,31 @@ export default function createSpinner(
...
@@ -81,9 +80,31 @@ export default function createSpinner(
resetLog
()
resetLog
()
return
spinner
!
return
spinner
!
}
}
return
spinner
}
else
if
(
prefixText
||
text
)
{
}
else
if
(
prefixText
||
text
)
{
logFn
(
prefixText
?
prefixText
+
'...'
:
text
)
logFn
(
prefixText
?
prefixText
+
'...'
:
text
)
}
return
spinner
const
progressStart
=
process
.
hrtime
()
// @ts-ignore
let
spinner
=
{
isSpinning
:
false
,
prefixText
:
''
,
text
:
''
,
clear
:
''
,
setText
(
newText
:
string
)
{
logFn
(
`
${
Log
.
prefixes
.
info
}
${
newText
}
`
)
},
stop
:
()
=>
spinner
,
stopAndPersist
:
()
=>
{
const
progressEnd
=
process
.
hrtime
(
progressStart
)
logFn
(
`
${
Log
.
prefixes
.
event
}
${
text
}
in
${
hrtimeDurationToString
(
progressEnd
)}
`
)
return
spinner
!
},
}
as
ora
.
Ora
&
{
setText
:
(
text
:
string
)
=>
void
}
return
spinner
}
}
}
packages/next/src/build/type-check.ts
View file @
de22009a
...
@@ -7,7 +7,6 @@ import { Worker } from '../lib/worker'
...
@@ -7,7 +7,6 @@ import { Worker } from '../lib/worker'
import
createSpinner
from
'./spinner'
import
createSpinner
from
'./spinner'
import
{
eventTypeCheckCompleted
}
from
'../telemetry/events'
import
{
eventTypeCheckCompleted
}
from
'../telemetry/events'
import
isError
from
'../lib/is-error'
import
isError
from
'../lib/is-error'
import
{
hrtimeDurationToString
}
from
'./duration-to-string'
/**
/**
* typescript will be loaded in "next/lib/verify-typescript-setup" and
* typescript will be loaded in "next/lib/verify-typescript-setup" and
...
@@ -127,11 +126,7 @@ export async function startTypeChecking({
...
@@ -127,11 +126,7 @@ export async function startTypeChecking({
)
)
if
(
typeCheckingSpinner
)
{
if
(
typeCheckingSpinner
)
{
typeCheckingSpinner
.
stop
()
typeCheckingSpinner
.
stopAndPersist
()
createSpinner
(
`Finished TypeScript
${
ignoreTypeScriptErrors
?
' config validation'
:
''
}
in
${
hrtimeDurationToString
(
typeCheckEnd
)}
`
)?.
stopAndPersist
()
}
}
if
(
!
ignoreTypeScriptErrors
&&
verifyResult
)
{
if
(
!
ignoreTypeScriptErrors
&&
verifyResult
)
{
...
...
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