What does dynamicImportEsmDefault do?
Dynamically imports a module and returns mod.default || mod; uses webpackIgnore when NEXT_MINIMAL is set.
Calls: import(id) / import(/* webpackIgnore */ id). Returns: Promise<any>.</any>
What is the purpose of getMiddlewareMatcher?
Builds and caches a MiddlewareRouteMatch from info.matchers in a WeakMap.
Calls: MiddlewareMatcherCache.get/set, getMiddlewareRouteMatcher(…). Throws if matchers invalid. Returns: matcher fn.
What does installProcessErrorHandlers do?
Replaces Node fatal unhandled-error behavior with log-only handlers; optionally removes existing listeners.
Calls: process.removeAllListeners, process.on(‘unhandledRejection’|’uncaughtException’), isPostpone, console.error. Returns: void.
What is initialized by the constructor(options)?
Server state, env flags, caches, route matchers, middleware manifest path, prepares the server, optional preloading, and installs process error handlers.
Calls: super, installGlobalBehaviors, ResponseCache, getRoutesManifest/getRouteRegex/getRouteMatcher, setHttpClientAndAgentOptions, populateStaticEnv, installProcessErrorHandlers. Returns: instance.
What does unstable_preloadEntries do?
Preloads all pages/app modules and patches fetch for app entries after prepare().
Calls: getPagesManifest/getAppPathsManifest, loadCustomCacheHandlers, loadComponents, ComponentMod.patchFetch(). Returns: Promise<void>.</void>
What is the function of handleUpgrade?
No-op upgrade handler (websockets not supported here; dev/HMR only).
Returns: Promise<void>.</void>
What does loadInstrumentationModule attempt to do?
Tries to load instrumentation hook; ignores MODULE_NOT_FOUND, throws on other errors.
Calls: getInstrumentationModule. Returns: this.instrumentation.
What is the purpose of prepareImpl?
Extends base prepare to register instrumentation hook.
Calls: super.prepareImpl(), runInstrumentationHookIfAvailable(). Returns: Promise<void>.</void>
What does runInstrumentationHookIfAvailable ensure?
Ensures instrumentation is registered.
Calls: ensureInstrumentationRegistered(dir, distDir). Returns: Promise<void>.</void>
What does loadEnvConfig({dev, forceReload}) do?
Loads .env* via @next/env, optionally logs reload path.
Calls: loadEnvConfig(…), Log.info(…). Returns: void.
What is the function of loadCustomCacheHandlers?
Initializes cache handler interface once and registers each configured handler via dynamic import.
Calls: initializeCacheHandlers, dynamicImportEsmDefault, formatDynamicImportPath, interopDefault, setCacheHandler. Returns: Promise<void>.</void>
What does getIncrementalCache({requestHeaders}) create?
Creates per-request IncrementalCache with optional custom handler and cache settings.
Calls: loadCustomCacheHandlers, dynamic import of cacheHandler, new IncrementalCache({ … }). Returns: Promise<IncrementalCache>.</IncrementalCache>
What does getPublicDir resolve?
Resolves project public/ directory.
Calls: join(this.dir, CLIENT_PUBLIC_FILES_PATH). Returns: string.
What does getHasStaticDir check?
Checks whether legacy static/ directory exists.
Calls: fs.existsSync(join(this.dir,’static’)). Returns: boolean.
What does getPagesManifest load?
Loads server pages manifest.
Calls: loadManifest(join(serverDistDir, PAGES_MANIFEST)). Returns: PagesManifest | undefined.
What does getAppPathsManifest load?
Loads app-paths manifest if App Router enabled.
Calls: loadManifest(join(serverDistDir, APP_PATHS_MANIFEST)). Returns: PagesManifest | undefined.
What does getinterceptionRoutePatterns compile?
Compiles interception rewrite regexes from routes manifest (App Router only).
Calls: getRoutesManifest, isInterceptionRouteRewrite, new RegExp(rewrite.regex). Returns: RegExp[].
What does hasPage(pathname) check?
Checks if a page exists in build output.
Calls: getMaybePagePath(…). Returns: Promise<boolean>.</boolean>
What does getBuildId read?
Reads .next/BUILD_ID; throws helpful error if missing.
Calls: fs.readFileSync(…).trim(). Returns: string.
What does getEnabledDirectories(dev) detect?
Detects presence of app/ and pages/ dirs (dev uses project dir, prod uses server dist dir).
Calls: findDir(dir,’app’|’pages’). Returns: { app:boolean, pages:boolean }.
What does sendRenderResult(req,res,opts) do?
Sends a RenderResult using underlying Node req/res.
Calls: sendRenderResult({ req: originalRequest, res: originalResponse, … }). Returns: Promise<void>.</void>
What does runApi(req,res,query,match) do?
Runs Pages API route as edge function if configured; otherwise loads Node handler module and invokes it.
Calls: getEdgeFunctionsPages, runEdgeFunction, parseUrl/getRequestMeta, NodeModuleLoader.load, module.handler(…), addRequestMeta. Returns: Promise<boolean>.</boolean>
What does renderHTML(req,res,pathname,query,renderOpts) do?
Trace-wrapped HTML render entry.
Calls: getTracer().trace(…, renderHTMLImpl). Returns: Promise<RenderResult>.</RenderResult>
What does renderHTMLImpl(req,res,pathname,query,renderOpts) choose?
Chooses App Router vs Pages Router rendering; sets nextFontManifest.
Calls: lazyRenderAppPage OR lazyRenderPagesPage. Throws if NEXT_MINIMAL. Returns: Promise<RenderResult>.</RenderResult>