Skip to content

Commit ad4f5ce

Browse files
committed
improve ux
1 parent 961fb0a commit ad4f5ce

File tree

17 files changed

+344
-517
lines changed

17 files changed

+344
-517
lines changed

packages/next/src/bin/next.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ program
187187
'Comma-separated glob patterns or explicit paths for selective builds. Examples: "app/*", "app/page.tsx", "app/**/page.tsx"'
188188
)
189189
.option(
190-
'--profiler',
191-
'Creates a profiler build with source maps enabled, no minification, and React profiling.'
190+
'--insights',
191+
'Creates an insights build with source maps enabled, no minification, and React profiling.'
192192
)
193193
.action((directory: string, options: NextBuildOptions) => {
194194
if (options.experimentalNextConfigStripTypes) {

packages/next/src/build/build-context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,5 @@ export const NextBuildContext: Partial<{
9696
isCompileMode?: boolean
9797
debugPrerender: boolean
9898
analyze: boolean
99-
profiler: boolean
99+
insights: boolean
100100
}> = {}

packages/next/src/build/define-env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ export function getDefineEnv({
345345
config.experimental.reactDebugChannel ?? false,
346346
'process.env.__NEXT_TRANSITION_INDICATOR':
347347
config.experimental.transitionIndicator ?? false,
348-
'process.env.__NEXT_PROFILER_BUILD': config.profiler ?? false,
348+
'process.env.__NEXT_INSIGHTS_BUILD': config.insights ?? false,
349349
}
350350

351351
const userDefines = config.compiler?.define ?? {}

packages/next/src/build/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ export default async function build(
891891
traceUploadUrl: string | undefined,
892892
debugBuildAppPaths?: string[],
893893
debugBuildPagePaths?: string[],
894-
profiler = false
894+
insights = false
895895
): Promise<void> {
896896
const isCompileMode = experimentalBuildMode === 'compile'
897897
const isGenerateMode = experimentalBuildMode === 'generate'
@@ -914,7 +914,7 @@ export default async function build(
914914
NextBuildContext.reactProductionProfiling = reactProductionProfiling
915915
NextBuildContext.noMangling = noMangling
916916
NextBuildContext.debugPrerender = debugPrerender
917-
NextBuildContext.profiler = profiler
917+
NextBuildContext.insights = insights
918918

919919
await nextBuildSpan.traceAsyncFn(async () => {
920920
// attempt to load global env values so they are available in next.config.js
@@ -934,7 +934,7 @@ export default async function build(
934934
silent: false,
935935
reactProductionProfiling,
936936
debugPrerender,
937-
profiler,
937+
insights,
938938
}),
939939
turborepoAccessTraceResult
940940
)

packages/next/src/build/turbopack-build/impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export async function workerMain(workerData: {
230230
{
231231
debugPrerender: NextBuildContext.debugPrerender,
232232
reactProductionProfiling: NextBuildContext.reactProductionProfiling,
233-
profiler: NextBuildContext.profiler,
233+
insights: NextBuildContext.insights,
234234
}
235235
))
236236
// Matches handling in build/index.ts

packages/next/src/build/webpack-build/impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ export async function workerMain(workerData: {
390390
{
391391
debugPrerender: NextBuildContext.debugPrerender,
392392
reactProductionProfiling: NextBuildContext.reactProductionProfiling,
393-
profiler: NextBuildContext.profiler,
393+
insights: NextBuildContext.insights,
394394
}
395395
))
396396
await installBindings(config.experimental?.useWasmBinary)

packages/next/src/build/webpack-config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,8 @@ export default async function getBaseWebpackConfig(
394394

395395
const hasAppDir = !!appDir
396396
const disableOptimizedLoading = true
397-
// Combine reactProductionProfiling with profiler flag for React profiling builds
398-
const enableReactProfiling = reactProductionProfiling || config.profiler
397+
// Combine reactProductionProfiling with insights flag for React profiling builds
398+
const enableReactProfiling = reactProductionProfiling || config.insights
399399
const bundledReactChannel = needsExperimentalReact(config)
400400
? '-experimental'
401401
: ''

packages/next/src/cli/next-build.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export type NextBuildOptions = {
2121
debug?: boolean
2222
debugPrerender?: boolean
2323
profile?: boolean
24-
profiler?: boolean
24+
insights?: boolean
2525
mangling: boolean
2626
turbo?: boolean
2727
turbopack?: boolean
@@ -45,7 +45,7 @@ const nextBuild = async (options: NextBuildOptions, directory?: string) => {
4545
debugPrerender,
4646
experimentalDebugMemoryUsage,
4747
profile,
48-
profiler,
48+
insights,
4949
mangling,
5050
experimentalAppOnly,
5151
experimentalBuildMode,
@@ -86,9 +86,9 @@ const nextBuild = async (options: NextBuildOptions, directory?: string) => {
8686
)
8787
}
8888

89-
if (profiler) {
89+
if (insights) {
9090
warn(
91-
`Profiler build is enabled. ${italic(
91+
`Insights build is enabled. ${italic(
9292
'Note: Source maps are enabled and minification is disabled. This build is not suitable for production.'
9393
)}`
9494
)
@@ -139,7 +139,7 @@ const nextBuild = async (options: NextBuildOptions, directory?: string) => {
139139
traceUploadUrl,
140140
resolvedAppPaths,
141141
resolvedPagePaths,
142-
profiler
142+
insights
143143
)
144144
.catch((err) => {
145145
if (experimentalDebugMemoryUsage) {

packages/next/src/client/app-bootstrap.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ window.next = {
1515
appDir: true,
1616
}
1717

18-
// Log profiler build info at startup
19-
if (process.env.__NEXT_PROFILER_BUILD) {
18+
// Log insights build info at startup
19+
if (process.env.__NEXT_INSIGHTS_BUILD) {
2020
console.log('')
2121
console.log(
22-
'%c[Next.js Profiler Build]',
22+
'%c[Next.js Insights Build]',
2323
'background: #0070f3; color: white; padding: 2px 6px; border-radius: 3px;',
2424
'\n• Source maps: enabled',
2525
'\n• Minification: disabled',

packages/next/src/client/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ import { isNextRouterError } from './components/is-next-router-error'
5050

5151
/// <reference types="react-dom/experimental" />
5252

53-
// Log profiler build info at startup
54-
if (process.env.__NEXT_PROFILER_BUILD) {
53+
// Log insights build info at startup
54+
if (process.env.__NEXT_INSIGHTS_BUILD) {
5555
console.log('')
5656
console.log(
57-
'%c[Next.js Profiler Build]',
57+
'%c[Next.js Insights Build]',
5858
'background: #0070f3; color: white; padding: 2px 6px; border-radius: 3px;',
5959
'\n• Source maps: enabled',
6060
'\n• Minification: disabled',

0 commit comments

Comments
 (0)