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

Function nextDevWorkflow

scripts/devlow-bench.mjs:227–548  ·  scripts/devlow-bench.mjs::nextDevWorkflow
(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] === class="st">'string' ? { url: pages[page] } : pages[page]
231 const cleanupTasks = []
232 try {
233 const benchmarkDir = resolve(REPO_ROOT, class="st">'bench', benchDir)
234
235 class="cm">// cleanup .next directory to remove filesystem cache
236 await retry(() =>
237 rm(join(benchmarkDir, class="st">'.next'), { recursive: true, force: true })
238 )
239
240 await measureTime(class="st">'cleanup', {
241 scenario: benchmarkName,
242 props: { turbopack, page },
243 })
244
245 class="cm">// 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(class="st">'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 class="cm">// Disable otel initialization to prevent pending / hanging request to otel collector
264 OTEL_SDK_DISABLED: class="st">'true',
265 NEXT_PUBLIC_OTEL_SENTRY: class="st">'true',
266 NEXT_PUBLIC_OTEL_DEV_DISABLED: class="st">'true',
267 NEXT_TRACE_UPLOAD_DISABLED: class="st">'true',
268 class="cm">// Enable next.js test mode to get HMR events and silence canary only
269 __NEXT_TEST_MODE: class="st">'1',
270 }
271
272 const serverEnv = {
273 ...env,
274 PORT: class="st">'0',
275 }
276
277 class="cm">// run command to start dev server
278 const args = [turbopack ? class="st">'dev-turbopack' : class="st">'dev-webpack']
279 let shell = command(class="st">'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