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

Function nextDevWorkflow

scripts/devlow-bench.mjs:227–548  ·  view source on GitHub ↗
(benchmarkName, benchDir, pages)

Source from the content-addressed store, hash-verified

225
226const nextDevWorkflow =
227 (benchmarkName, benchDir, pages) =>
228 async ({ turbopack, page }) => {
229 const pageConfig =
230 typeof pages[page] === 'string' ? { url: pages[page] } : pages[page]
231 const cleanupTasks = []
232 try {
233 const benchmarkDir = resolve(REPO_ROOT, 'bench', benchDir)
234
235 // cleanup .next directory to remove filesystem cache
236 await retry(() =>
237 rm(join(benchmarkDir, '.next'), { recursive: true, force: true })
238 )
239
240 await measureTime('cleanup', {
241 scenario: benchmarkName,
242 props: { turbopack, page },
243 })
244
245 // startup browser
246 let session = await newBrowserSession({})
247 const closeSession = async () => {
248 if (session) {
249 await session.close()
250 session = null
251 }
252 }
253 cleanupTasks.push(closeSession)
254 await measureTime('browser startup', {
255 props: { turbopack, page },
256 })
257
258 const env = {
259 PATH: process.env.PATH,
260 NODE: process.env.NODE,
261 HOSTNAME: process.env.HOSTNAME,
262 PWD: process.env.PWD,
263 // Disable otel initialization to prevent pending / hanging request to otel collector
264 OTEL_SDK_DISABLED: 'true',
265 NEXT_PUBLIC_OTEL_SENTRY: 'true',
266 NEXT_PUBLIC_OTEL_DEV_DISABLED: 'true',
267 NEXT_TRACE_UPLOAD_DISABLED: 'true',
268 // Enable next.js test mode to get HMR events and silence canary only
269 __NEXT_TEST_MODE: '1',
270 }
271
272 const serverEnv = {
273 ...env,
274 PORT: '0',
275 }
276
277 // run command to start dev server
278 const args = [turbopack ? 'dev-turbopack' : 'dev-webpack']
279 let shell = command('pnpm', args, {
280 cwd: benchmarkDir,
281 env: serverEnv,
282 })
283 const killShell = async () => {
284 if (shell) {

Callers 1

devlow-bench.mjsFile · 0.85

Calls 15

newBrowserSessionFunction · 0.90
commandFunction · 0.90
waitForFileFunction · 0.90
hmrEventFunction · 0.85
killShellFunction · 0.85
closeSessionFunction · 0.85
splitMethod · 0.80
onceMethod · 0.80
retryFunction · 0.70
measureTimeFunction · 0.70
reportMeasurementFunction · 0.70
endFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…