MCPcopy
hub / github.com/vercel/next.js / nextAnalyze

Function nextAnalyze

packages/next/src/cli/next-analyze.ts:21–59  ·  view source on GitHub ↗
(options: NextAnalyzeOptions, directory?: string)

Source from the content-addressed store, hash-verified

19}
20
21const nextAnalyze = async (options: NextAnalyzeOptions, directory?: string) => {
22 process.on('SIGTERM', () => {
23 saveCpuProfile()
24 process.exit(143)
25 })
26 process.on('SIGINT', () => {
27 saveCpuProfile()
28 process.exit(130)
29 })
30
31 const { profile, mangling, experimentalAppOnly, output, port } = options
32
33 if (!mangling) {
34 warn(
35 `Mangling is disabled. ${italic('Note: This may affect performance and should only be used for debugging purposes.')}`
36 )
37 }
38
39 if (profile) {
40 warn(
41 `Profiling is enabled. ${italic('Note: This may affect performance.')}`
42 )
43 }
44
45 const dir = getProjectDir(directory)
46
47 if (!existsSync(dir)) {
48 printAndExit(`> No such directory exists as the project root: ${dir}`)
49 }
50
51 return analyze({
52 dir,
53 reactProductionProfiling: profile,
54 noMangling: !mangling,
55 appDirOnly: experimentalAppOnly,
56 output,
57 port,
58 })
59}
60
61export { nextAnalyze }

Callers

nothing calls this directly

Calls 7

saveCpuProfileFunction · 0.90
getProjectDirFunction · 0.90
printAndExitFunction · 0.90
warnFunction · 0.50
analyzeFunction · 0.50
onMethod · 0.45
exitMethod · 0.45

Tested by

no test coverage detected