UNPKG

45.2 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../../server/next-dev-server.ts"],"names":["React","Suspense","Error","ReactDevOverlayImpl","ReactDevOverlay","props","undefined","require","DevServer","Server","constructor","options","dev","devReady","setDevReady","webpackWatcher","hotReloader","isCustomServer","sortedRoutes","staticPathsWorker","_devCachedPreviewProps","renderOpts","ErrorDebug","Promise","resolve","ampSkipValidation","nextConfig","experimental","amp","skipValidation","ampValidator","html","pathname","validatorPath","validator","AmpHtmlValidator","getInstance","then","result","validateString","errors","filter","e","severity","_filterAmpDevelopmentScript","fs","existsSync","dir","console","warn","isNextDevCommand","pagesDir","Worker","maxRetries","numWorkers","cpus","forkOptions","env","process","NODE_OPTIONS","getStdout","pipe","stdout","getStderr","stderr","readBuildId","addExportPathMapRoutes","exportPathMap","log","outDir","distDir","buildId","path","page","query","router","addFsRoute","match","type","name","fn","req","res","_params","parsedUrl","urlQuery","Object","keys","key","forEach","mergedQuery","render","finished","startWatcher","regexPageExtension","RegExp","pageExtensions","join","resolved","reject","readdir","_","files","length","wp","Watchpack","watch","on","routedPages","knownFiles","getTimeInfoEntries","fileName","accuracy","test","pageName","replace","push","every","val","idx","send","devPagesManifest","dynamicRoutes","isDynamicRoute","map","setDynamicRoutes","stopWatcher","close","prepare","images","disableStaticImages","customRoutes","redirects","rewrites","headers","beforeFiles","afterFiles","fallback","Router","generateRoutes","HotReloader","config","previewProps","getPreviewProps","start","telemetry","Telemetry","record","PHASE_DEVELOPMENT_SERVER","webpackVersion","isWebpack5","cliCommand","isSrcDir","startsWith","hasNowJson","cwd","end","stop","hasPage","normalizedPath","err","error","pageFile","_beforeCatchAllRender","params","pathParts","decodedPath","decodeURIComponent","code","hasPublicFile","statusCode","renderError","servePublic","run","basePath","originalPathname","slice","publicDir","PUBLIC_DIR_MIDDLEWARE_CONFLICT","getCustomRoutes","previewModeId","crypto","randomBytes","toString","previewModeSigningKey","previewModeEncryptionKey","fsRoutes","otherRoutes","unshift","p","serveStatic","CLIENT_STATIC_FILES_PATH","DEV_CLIENT_PAGES_MANIFEST","_req","setHeader","JSON","stringify","pages","requireBasePath","generatePublicRoutes","getDynamicRoutes","event","snippetChunks","split","snippet","line","substring","col","indexOf","includes","getStaticPaths","__getStaticPaths","publicRuntimeConfig","serverRuntimeConfig","locales","defaultLocale","i18n","paths","loadStaticPaths","_isLikeServerless","staticPaths","value","fallbackMode","ensureApiPage","ensurePage","renderToHTML","compilationErr","getCompilationError","renderErrorToHTML","catch","dynamicRoute","hotReloaderError","quiet","STATIC_STATUS_PAGES","out","err2","Log","sendHTML","setImmutableAssetCacheControl","info","promises","stat","isFile","getCompilationErrors","isServeableUrl","untrustedFileUrl","decodedUntrustedFilePath","untrustedFilePath","sep"],"mappings":"4DAAA,sDACA,8CAEA,uCACA,8FACA,0EACA,0BACA,oDAEA,4DACA,4CACA,gEACA,2CACA,8CACA,mDACA,mFACA,mEACA,wDAMA,sDAOA,qFACA,4EACA,6EACA,2CACA,6CACA,yCACA,mEACA,kDACA,mCACA,4D,w4BAGA,GAAI,MAAOA,gBAAMC,QAAb,GAA0B,WAA9B,CAA2C,CACzC,KAAM,IAAIC,CAAAA,KAAJ,CACH,gOADG,CAAN,CAGD,CAED;AACA,GAAIC,CAAAA,mBAAJ,CACA,KAAMC,CAAAA,eAAe,CAAIC,KAAD,EAAgB,CACtC,GAAIF,mBAAmB,GAAKG,SAA5B,CAAuC,CACrCH,mBAAmB,CAAGI,OAAO,CAAC,oCAAD,CAAP,CACnBH,eADH,CAED,CACD,MAAOD,CAAAA,mBAAmB,CAACE,KAAD,CAA1B,CACD,CAND,CAQe,KAAMG,CAAAA,SAAN,QAAwBC,oBAAO,CAY5CC,WAAW,CACTC,OADS,CAKT,yEACA,MAAM,CAAE,GAAGA,OAAL,CAAcC,GAAG,CAAE,IAAnB,CAAN,EADA,KAhBMC,QAgBN,aAfMC,WAeN,aAdMC,cAcN,aAbMC,WAaN,aAZMC,cAYN,aAXQC,YAWR,aATQC,iBASR,aAmXM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;AACA;AACA;AAEA,GAAIC,CAAAA,wBAAJ,CACA,GAAI,CACF;AACAA,wBAAwB,CAAG/E,kBAAkB,CAAC8E,gBAAD,CAA7C,CACD,CAAC,cAAM,CACN,MAAO,MAAP,CACD,CAED;AACA,KAAME,CAAAA,iBAAiB,CAAG,kBAAYD,wBAAZ,CAA1B,CAEA;AACA,GAAIC,iBAAiB,CAACvC,OAAlB,CAA0B,IAA1B,IAAoC,CAAC,CAAzC,CAA4C,CAC1C,MAAO,MAAP,CACD,CAED;AACA;AACA;AACA;AACA,GACEuC,iBAAiB,CAAC9F,UAAlB,CAA6B,eAAS,KAAKnF,OAAd,CAAuB,QAAvB,EAAmCkL,SAAhE,GACAD,iBAAiB,CAAC9F,UAAlB,CAA6B,eAAS,KAAKnF,OAAd,CAAuB,QAAvB,EAAmCkL,SAAhE,CADA,EAEAD,iBAAiB,CAAC9F,UAAlB,CAA6B,eAAS,KAAK1G,GAAd,CAAmB,QAAnB,EAA+ByM,SAA5D,CAFA,EAGAD,iBAAiB,CAAC9F,UAAlB,CAA6B,eAAS,KAAK1G,GAAd,CAAmB,QAAnB,EAA+ByM,SAA5D,CAJF,CAKE,CACA,MAAO,KAAP,CACD,CAED,MAAO,MAAP,CACD,CAzsB2C,C","sourcesContent":["import crypto from 'crypto'\nimport fs from 'fs'\nimport { IncomingMessage, ServerResponse } from 'http'\nimport { Worker } from 'jest-worker'\nimport AmpHtmlValidator from 'next/dist/compiled/amphtml-validator'\nimport findUp from 'next/dist/compiled/find-up'\nimport { join as pathJoin, relative, resolve as pathResolve, sep } from 'path'\nimport React from 'react'\nimport { UrlWithParsedQuery } from 'url'\nimport Watchpack from 'watchpack'\nimport { ampValidation } from '../build/output/index'\nimport * as Log from '../build/output/log'\nimport { PUBLIC_DIR_MIDDLEWARE_CONFLICT } from '../lib/constants'\nimport { fileExists } from '../lib/file-exists'\nimport { findPagesDir } from '../lib/find-pages-dir'\nimport loadCustomRoutes, { CustomRoutes } from '../lib/load-custom-routes'\nimport { verifyTypeScriptSetup } from '../lib/verifyTypeScriptSetup'\nimport {\n PHASE_DEVELOPMENT_SERVER,\n CLIENT_STATIC_FILES_PATH,\n DEV_CLIENT_PAGES_MANIFEST,\n STATIC_STATUS_PAGES,\n} from '../next-server/lib/constants'\nimport {\n getRouteMatcher,\n getRouteRegex,\n getSortedRoutes,\n isDynamicRoute,\n} from '../next-server/lib/router/utils'\nimport { __ApiPreviewProps } from '../next-server/server/api-utils'\nimport Server, { ServerConstructor } from '../next-server/server/next-server'\nimport { normalizePagePath } from '../next-server/server/normalize-page-path'\nimport Router, { Params, route } from '../next-server/server/router'\nimport { eventCliSession } from '../telemetry/events'\nimport { Telemetry } from '../telemetry/storage'\nimport { setGlobal } from '../telemetry/trace'\nimport HotReloader from './hot-reloader'\nimport { findPageFile } from './lib/find-page-file'\nimport { getNodeOptionsWithoutInspect } from './lib/utils'\nimport { withCoalescedInvoke } from '../lib/coalesced-function'\nimport { NextConfig } from '../next-server/server/config'\n\nif (typeof React.Suspense === 'undefined') {\n throw new Error(\n `The version of React you are using is lower than the minimum required version needed for Next.js. Please upgrade \"react\" and \"react-dom\": \"npm install react react-dom\" https://nextjs.org/docs/messages/invalid-react-version`\n )\n}\n\n// Load ReactDevOverlay only when needed\nlet ReactDevOverlayImpl: React.FunctionComponent\nconst ReactDevOverlay = (props: any) => {\n if (ReactDevOverlayImpl === undefined) {\n ReactDevOverlayImpl = require('@next/react-dev-overlay/lib/client')\n .ReactDevOverlay\n }\n return ReactDevOverlayImpl(props)\n}\n\nexport default class DevServer extends Server {\n private devReady: Promise<void>\n private setDevReady?: Function\n private webpackWatcher?: Watchpack | null\n private hotReloader?: HotReloader\n private isCustomServer: boolean\n protected sortedRoutes?: string[]\n\n protected staticPathsWorker: import('jest-worker').Worker & {\n loadStaticPaths: typeof import('./static-paths-worker').loadStaticPaths\n }\n\n constructor(\n options: ServerConstructor & {\n conf: NextConfig\n isNextDevCommand?: boolean\n }\n ) {\n super({ ...options, dev: true })\n this.renderOpts.dev = true\n ;(this.renderOpts as any).ErrorDebug = ReactDevOverlay\n this.devReady = new Promise((resolve) => {\n this.setDevReady = resolve\n })\n ;(this.renderOpts as any).ampSkipValidation =\n this.nextConfig.experimental?.amp?.skipValidation ?? false\n ;(this.renderOpts as any).ampValidator = (\n html: string,\n pathname: string\n ) => {\n const validatorPath =\n this.nextConfig.experimental &&\n this.nextConfig.experimental.amp &&\n this.nextConfig.experimental.amp.validator\n return AmpHtmlValidator.getInstance(validatorPath).then((validator) => {\n const result = validator.validateString(html)\n ampValidation(\n pathname,\n result.errors\n .filter((e) => e.severity === 'ERROR')\n .filter((e) => this._filterAmpDevelopmentScript(html, e)),\n result.errors.filter((e) => e.severity !== 'ERROR')\n )\n })\n }\n if (fs.existsSync(pathJoin(this.dir, 'static'))) {\n console.warn(\n `The static directory has been deprecated in favor of the public directory. https://nextjs.org/docs/messages/static-dir-deprecated`\n )\n }\n this.isCustomServer = !options.isNextDevCommand\n this.pagesDir = findPagesDir(this.dir)\n this.staticPathsWorker = new Worker(\n require.resolve('./static-paths-worker'),\n {\n maxRetries: 1,\n numWorkers: this.nextConfig.experimental.cpus,\n forkOptions: {\n env: {\n ...process.env,\n // discard --inspect/--inspect-brk flags from process.env.NODE_OPTIONS. Otherwise multiple Node.js debuggers\n // would be started if user launch Next.js in debugging mode. The number of debuggers is linked to\n // the number of workers Next.js tries to launch. The only worker users are interested in debugging\n // is the main Next.js one\n NODE_OPTIONS: getNodeOptionsWithoutInspect(),\n },\n },\n }\n ) as Worker & {\n loadStaticPaths: typeof import('./static-paths-worker').loadStaticPaths\n }\n\n this.staticPathsWorker.getStdout().pipe(process.stdout)\n this.staticPathsWorker.getStderr().pipe(process.stderr)\n }\n\n protected readBuildId(): string {\n return 'development'\n }\n\n async addExportPathMapRoutes() {\n // Makes `next export` exportPathMap work in development mode.\n // So that the user doesn't have to define a custom server reading the exportPathMap\n if (this.nextConfig.exportPathMap) {\n console.log('Defining routes from exportPathMap')\n const exportPathMap = await this.nextConfig.exportPathMap(\n {},\n {\n dev: true,\n dir: this.dir,\n outDir: null,\n distDir: this.distDir,\n buildId: this.buildId,\n }\n ) // In development we can't give a default path mapping\n for (const path in exportPathMap) {\n const { page, query = {} } = exportPathMap[path]\n\n // We use unshift so that we're sure the routes is defined before Next's default routes\n this.router.addFsRoute({\n match: route(path),\n type: 'route',\n name: `${path} exportpathmap route`,\n fn: async (req, res, _params, parsedUrl) => {\n const { query: urlQuery } = parsedUrl\n\n Object.keys(urlQuery)\n .filter((key) => query[key] === undefined)\n .forEach((key) =>\n console.warn(\n `Url '${path}' defines a query parameter '${key}' that is missing in exportPathMap`\n )\n )\n\n const mergedQuery = { ...urlQuery, ...query }\n\n await this.render(req, res, page, mergedQuery, parsedUrl)\n return {\n finished: true,\n }\n },\n })\n }\n }\n }\n\n async startWatcher(): Promise<void> {\n if (this.webpackWatcher) {\n return\n }\n\n const regexPageExtension = new RegExp(\n `\\\\.+(?:${this.nextConfig.pageExtensions.join('|')})$`\n )\n\n let resolved = false\n return new Promise((resolve, reject) => {\n const pagesDir = this.pagesDir\n\n // Watchpack doesn't emit an event for an empty directory\n fs.readdir(pagesDir!, (_, files) => {\n if (files?.length) {\n return\n }\n\n if (!resolved) {\n resolve()\n resolved = true\n }\n })\n\n let wp = (this.webpackWatcher = new Watchpack())\n wp.watch([], [pagesDir!], 0)\n\n wp.on('aggregated', () => {\n const routedPages = []\n const knownFiles = wp.getTimeInfoEntries()\n for (const [fileName, { accuracy }] of knownFiles) {\n if (accuracy === undefined || !regexPageExtension.test(fileName)) {\n continue\n }\n\n let pageName =\n '/' + relative(pagesDir!, fileName).replace(/\\\\+/g, '/')\n pageName = pageName.replace(regexPageExtension, '')\n pageName = pageName.replace(/\\/index$/, '') || '/'\n\n routedPages.push(pageName)\n }\n\n try {\n // we serve a separate manifest with all pages for the client in\n // dev mode so that we can match a page after a rewrite on the client\n // before it has been built and is populated in the _buildManifest\n const sortedRoutes = getSortedRoutes(routedPages)\n\n if (\n !this.sortedRoutes?.every((val, idx) => val === sortedRoutes[idx])\n ) {\n // emit the change so clients fetch the update\n this.hotReloader!.send(undefined, { devPagesManifest: true })\n }\n this.sortedRoutes = sortedRoutes\n\n this.dynamicRoutes = this.sortedRoutes\n .filter(isDynamicRoute)\n .map((page) => ({\n page,\n match: getRouteMatcher(getRouteRegex(page)),\n }))\n\n this.router.setDynamicRoutes(this.dynamicRoutes)\n\n if (!resolved) {\n resolve()\n resolved = true\n }\n } catch (e) {\n if (!resolved) {\n reject(e)\n resolved = true\n } else {\n console.warn('Failed to reload dynamic routes:', e)\n }\n }\n })\n })\n }\n\n async stopWatcher(): Promise<void> {\n if (!this.webpackWatcher) {\n return\n }\n\n this.webpackWatcher.close()\n this.webpackWatcher = null\n }\n\n async prepare(): Promise<void> {\n await verifyTypeScriptSetup(\n this.dir,\n this.pagesDir!,\n false,\n !this.nextConfig.images.disableStaticImages\n )\n\n this.customRoutes = await loadCustomRoutes(this.nextConfig)\n\n // reload router\n const { redirects, rewrites, headers } = this.customRoutes\n\n if (\n rewrites.beforeFiles.length ||\n rewrites.afterFiles.length ||\n rewrites.fallback.length ||\n redirects.length ||\n headers.length\n ) {\n this.router = new Router(this.generateRoutes())\n }\n\n this.hotReloader = new HotReloader(this.dir, {\n pagesDir: this.pagesDir!,\n config: this.nextConfig,\n previewProps: this.getPreviewProps(),\n buildId: this.buildId,\n rewrites,\n })\n await super.prepare()\n await this.addExportPathMapRoutes()\n await this.hotReloader.start()\n await this.startWatcher()\n this.setDevReady!()\n\n const telemetry = new Telemetry({ distDir: this.distDir })\n telemetry.record(\n eventCliSession(PHASE_DEVELOPMENT_SERVER, this.distDir, {\n webpackVersion: this.hotReloader.isWebpack5 ? 5 : 4,\n cliCommand: 'dev',\n isSrcDir: relative(this.dir, this.pagesDir!).startsWith('src'),\n hasNowJson: !!(await findUp('now.json', { cwd: this.dir })),\n isCustomServer: this.isCustomServer,\n })\n )\n // This is required by the tracing subsystem.\n setGlobal('telemetry', telemetry)\n }\n\n protected async close(): Promise<void> {\n await this.stopWatcher()\n await this.staticPathsWorker.end()\n if (this.hotReloader) {\n await this.hotReloader.stop()\n }\n }\n\n protected async hasPage(pathname: string): Promise<boolean> {\n let normalizedPath: string\n\n try {\n normalizedPath = normalizePagePath(pathname)\n } catch (err) {\n console.error(err)\n // if normalizing the page fails it means it isn't valid\n // so it doesn't exist so don't throw and return false\n // to ensure we return 404 instead of 500\n return false\n }\n\n const pageFile = await findPageFile(\n this.pagesDir!,\n normalizedPath,\n this.nextConfig.pageExtensions\n )\n return !!pageFile\n }\n\n protected async _beforeCatchAllRender(\n req: IncomingMessage,\n res: ServerResponse,\n params: Params,\n parsedUrl: UrlWithParsedQuery\n ): Promise<boolean> {\n const { pathname } = parsedUrl\n const pathParts = params.path || []\n const path = `/${pathParts.join('/')}`\n // check for a public file, throwing error if there's a\n // conflicting page\n let decodedPath: string\n\n try {\n decodedPath = decodeURIComponent(path)\n } catch (_) {\n const err: Error & { code?: string } = new Error('failed to decode param')\n err.code = 'DECODE_FAILED'\n throw err\n }\n\n if (await this.hasPublicFile(decodedPath)) {\n if (await this.hasPage(pathname!)) {\n const err = new Error(\n `A conflicting public file and page file was found for path ${pathname} https://nextjs.org/docs/messages/conflicting-public-file-page`\n )\n res.statusCode = 500\n await this.renderError(err, req, res, pathname!, {})\n return true\n }\n await this.servePublic(req, res, pathParts)\n return true\n }\n\n return false\n }\n\n async run(\n req: IncomingMessage,\n res: ServerResponse,\n parsedUrl: UrlWithParsedQuery\n ): Promise<void> {\n await this.devReady\n\n const { basePath } = this.nextConfig\n let originalPathname: string | null = null\n\n if (basePath && parsedUrl.pathname?.startsWith(basePath)) {\n // strip basePath before handling dev bundles\n // If replace ends up replacing the full url it'll be `undefined`, meaning we have to default it to `/`\n originalPathname = parsedUrl.pathname\n parsedUrl.pathname = parsedUrl.pathname!.slice(basePath.length) || '/'\n }\n\n const { pathname } = parsedUrl\n\n if (pathname!.startsWith('/_next')) {\n if (await fileExists(pathJoin(this.publicDir, '_next'))) {\n throw new Error(PUBLIC_DIR_MIDDLEWARE_CONFLICT)\n }\n }\n\n const { finished = false } = await this.hotReloader!.run(\n req,\n res,\n parsedUrl\n )\n\n if (finished) {\n return\n }\n\n if (originalPathname) {\n // restore the path before continuing so that custom-routes can accurately determine\n // if they should match against the basePath or not\n parsedUrl.pathname = originalPathname\n }\n\n return super.run(req, res, parsedUrl)\n }\n\n // override production loading of routes-manifest\n protected getCustomRoutes(): CustomRoutes {\n // actual routes will be loaded asynchronously during .prepare()\n return {\n redirects: [],\n rewrites: { beforeFiles: [], afterFiles: [], fallback: [] },\n headers: [],\n }\n }\n\n private _devCachedPreviewProps: __ApiPreviewProps | undefined\n protected getPreviewProps() {\n if (this._devCachedPreviewProps) {\n return this._devCachedPreviewProps\n }\n return (this._devCachedPreviewProps = {\n previewModeId: crypto.randomBytes(16).toString('hex'),\n previewModeSigningKey: crypto.randomBytes(32).toString('hex'),\n previewModeEncryptionKey: crypto.randomBytes(32).toString('hex'),\n })\n }\n\n generateRoutes() {\n const { fsRoutes, ...otherRoutes } = super.generateRoutes()\n\n // In development we expose all compiled files for react-error-overlay's line show feature\n // We use unshift so that we're sure the routes is defined before Next's default routes\n fsRoutes.unshift({\n match: route('/_next/development/:path*'),\n type: 'route',\n name: '_next/development catchall',\n fn: async (req, res, params) => {\n const p = pathJoin(this.distDir, ...(params.path || []))\n await this.serveStatic(req, res, p)\n return {\n finished: true,\n }\n },\n })\n\n fsRoutes.unshift({\n match: route(\n `/_next/${CLIENT_STATIC_FILES_PATH}/${this.buildId}/${DEV_CLIENT_PAGES_MANIFEST}`\n ),\n type: 'route',\n name: `_next/${CLIENT_STATIC_FILES_PATH}/${this.buildId}/${DEV_CLIENT_PAGES_MANIFEST}`,\n fn: async (_req, res) => {\n res.statusCode = 200\n res.setHeader('Content-Type', 'application/json; charset=utf-8')\n res.end(\n JSON.stringify({\n pages: this.sortedRoutes,\n })\n )\n return {\n finished: true,\n }\n },\n })\n\n fsRoutes.push({\n match: route('/:path*'),\n type: 'route',\n requireBasePath: false,\n name: 'catchall public directory route',\n fn: async (req, res, params, parsedUrl) => {\n const { pathname } = parsedUrl\n if (!pathname) {\n throw new Error('pathname is undefined')\n }\n\n // Used in development to check public directory paths\n if (await this._beforeCatchAllRender(req, res, params, parsedUrl)) {\n return {\n finished: true,\n }\n }\n\n return {\n finished: false,\n }\n },\n })\n\n return { fsRoutes, ...otherRoutes }\n }\n\n // In development public files are not added to the router but handled as a fallback instead\n protected generatePublicRoutes(): never[] {\n return []\n }\n\n // In development dynamic routes cannot be known ahead of time\n protected getDynamicRoutes(): never[] {\n return []\n }\n\n _filterAmpDevelopmentScript(\n html: string,\n event: { line: number; col: number; code: string }\n ): boolean {\n if (event.code !== 'DISALLOWED_SCRIPT_TAG') {\n return true\n }\n\n const snippetChunks = html.split('\\n')\n\n let snippet\n if (\n !(snippet = html.split('\\n')[event.line - 1]) ||\n !(snippet = snippet.substring(event.col))\n ) {\n return true\n }\n\n snippet = snippet + snippetChunks.slice(event.line).join('\\n')\n snippet = snippet.substring(0, snippet.indexOf('</script>'))\n\n return !snippet.includes('data-amp-development-mode-only')\n }\n\n protected async getStaticPaths(\n pathname: string\n ): Promise<{\n staticPaths: string[] | undefined\n fallbackMode: false | 'static' | 'blocking'\n }> {\n // we lazy load the staticPaths to prevent the user\n // from waiting on them for the page to load in dev mode\n\n const __getStaticPaths = async () => {\n const { publicRuntimeConfig, serverRuntimeConfig } = this.nextConfig\n const { locales, defaultLocale } = this.nextConfig.i18n || {}\n\n const paths = await this.staticPathsWorker.loadStaticPaths(\n this.distDir,\n pathname,\n !this.renderOpts.dev && this._isLikeServerless,\n {\n publicRuntimeConfig,\n serverRuntimeConfig,\n },\n locales,\n defaultLocale\n )\n return paths\n }\n const { paths: staticPaths, fallback } = (\n await withCoalescedInvoke(__getStaticPaths)(`staticPaths-${pathname}`, [])\n ).value\n\n return {\n staticPaths,\n fallbackMode:\n fallback === 'blocking'\n ? 'blocking'\n : fallback === true\n ? 'static'\n : false,\n }\n }\n\n protected async ensureApiPage(pathname: string) {\n return this.hotReloader!.ensurePage(pathname)\n }\n\n async renderToHTML(\n req: IncomingMessage,\n res: ServerResponse,\n pathname: string,\n query: { [key: string]: string }\n ): Promise<string | null> {\n await this.devReady\n const compilationErr = await this.getCompilationError(pathname)\n if (compilationErr) {\n res.statusCode = 500\n return this.renderErrorToHTML(compilationErr, req, res, pathname, query)\n }\n\n // In dev mode we use on demand entries to compile the page before rendering\n try {\n await this.hotReloader!.ensurePage(pathname).catch(async (err: Error) => {\n if ((err as any).code !== 'ENOENT') {\n throw err\n }\n\n for (const dynamicRoute of this.dynamicRoutes || []) {\n const params = dynamicRoute.match(pathname)\n if (!params) {\n continue\n }\n\n return this.hotReloader!.ensurePage(dynamicRoute.page)\n }\n throw err\n })\n } catch (err) {\n if (err.code === 'ENOENT') {\n try {\n await this.hotReloader!.ensurePage('/404')\n } catch (hotReloaderError) {\n if (hotReloaderError.code !== 'ENOENT') {\n throw hotReloaderError\n }\n }\n\n res.statusCode = 404\n return this.renderErrorToHTML(null, req, res, pathname, query)\n }\n if (!this.quiet) console.error(err)\n }\n const html = await super.renderToHTML(req, res, pathname, query)\n return html\n }\n\n async renderErrorToHTML(\n err: Error | null,\n req: IncomingMessage,\n res: ServerResponse,\n pathname: string,\n query: { [key: string]: string }\n ): Promise<string | null> {\n await this.devReady\n if (res.statusCode === 404 && (await this.hasPage('/404'))) {\n await this.hotReloader!.ensurePage('/404')\n } else if (\n STATIC_STATUS_PAGES.includes(`/${res.statusCode}`) &&\n (await this.hasPage(`/${res.statusCode}`))\n ) {\n await this.hotReloader!.ensurePage(`/${res.statusCode}`)\n } else {\n await this.hotReloader!.ensurePage('/_error')\n }\n\n const compilationErr = await this.getCompilationError(pathname)\n if (compilationErr) {\n res.statusCode = 500\n return super.renderErrorToHTML(compilationErr, req, res, pathname, query)\n }\n\n if (!err && res.statusCode === 500) {\n err = new Error(\n 'An undefined error was thrown sometime during render... ' +\n 'See https://nextjs.org/docs/messages/threw-undefined'\n )\n }\n\n try {\n const out = await super.renderErrorToHTML(err, req, res, pathname, query)\n return out\n } catch (err2) {\n if (!this.quiet) Log.error(err2)\n res.statusCode = 500\n return super.renderErrorToHTML(err2, req, res, pathname, query)\n }\n }\n\n sendHTML(\n req: IncomingMessage,\n res: ServerResponse,\n html: string\n ): Promise<void> {\n // In dev, we should not cache pages for any reason.\n res.setHeader('Cache-Control', 'no-store, must-revalidate')\n return super.sendHTML(req, res, html)\n }\n\n protected setImmutableAssetCacheControl(res: ServerResponse): void {\n res.setHeader('Cache-Control', 'no-store, must-revalidate')\n }\n\n private servePublic(\n req: IncomingMessage,\n res: ServerResponse,\n pathParts: string[]\n ): Promise<void> {\n const p = pathJoin(this.publicDir, ...pathParts)\n return this.serveStatic(req, res, p)\n }\n\n async hasPublicFile(path: string): Promise<boolean> {\n try {\n const info = await fs.promises.stat(pathJoin(this.publicDir, path))\n return info.isFile()\n } catch (_) {\n return false\n }\n }\n\n async getCompilationError(page: string): Promise<any> {\n const errors = await this.hotReloader!.getCompilationErrors(page)\n if (errors.length === 0) return\n\n // Return the very first error we found.\n return errors[0]\n }\n\n protected isServeableUrl(untrustedFileUrl: string): boolean {\n // This method mimics what the version of `send` we use does:\n // 1. decodeURIComponent:\n // https://github.com/pillarjs/send/blob/0.17.1/index.js#L989\n // https://github.com/pillarjs/send/blob/0.17.1/index.js#L518-L522\n // 2. resolve:\n // https://github.com/pillarjs/send/blob/de073ed3237ade9ff71c61673a34474b30e5d45b/index.js#L561\n\n let decodedUntrustedFilePath: string\n try {\n // (1) Decode the URL so we have the proper file name\n decodedUntrustedFilePath = decodeURIComponent(untrustedFileUrl)\n } catch {\n return false\n }\n\n // (2) Resolve \"up paths\" to determine real request\n const untrustedFilePath = pathResolve(decodedUntrustedFilePath)\n\n // don't allow null bytes anywhere in the file path\n if (untrustedFilePath.indexOf('\\0') !== -1) {\n return false\n }\n\n // During development mode, files can be added while the server is running.\n // Checks for .next/static, .next/server, static and public.\n // Note that in development .next/server is available for error reporting purposes.\n // see `packages/next/next-server/server/next-server.ts` for more details.\n if (\n untrustedFilePath.startsWith(pathJoin(this.distDir, 'static') + sep) ||\n untrustedFilePath.startsWith(pathJoin(this.distDir, 'server') + sep) ||\n untrustedFilePath.startsWith(pathJoin(this.dir, 'static') + sep) ||\n untrustedFilePath.startsWith(pathJoin(this.dir, 'public') + sep)\n ) {\n return true\n }\n\n return false\n }\n}\n"]}
\No newline at end of file