next 15.6.0-canary.5 → 15.6.0-canary.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/next +1 -1
- package/dist/build/index.js +3 -3
- package/dist/build/swc/index.js +1 -1
- package/dist/build/templates/app-page.js +2 -2
- package/dist/build/templates/app-page.js.map +1 -1
- package/dist/build/templates/app-route.js +2 -2
- package/dist/build/templates/app-route.js.map +1 -1
- package/dist/build/templates/edge-ssr-app.js +2 -2
- package/dist/build/templates/edge-ssr-app.js.map +1 -1
- package/dist/build/templates/edge-ssr.js +2 -2
- package/dist/build/templates/edge-ssr.js.map +1 -1
- package/dist/build/templates/pages-api.js +2 -2
- package/dist/build/templates/pages-api.js.map +1 -1
- package/dist/build/webpack-config.js +2 -2
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js +1 -1
- package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/pages-api.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages-api.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages-api.runtime.prod.js +1 -1
- package/dist/compiled/next-server/pages-api.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.prod.js +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/pages.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages.runtime.prod.js +1 -1
- package/dist/compiled/next-server/pages.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
- package/dist/esm/build/index.js +3 -3
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/templates/app-page.js +2 -2
- package/dist/esm/build/templates/app-page.js.map +1 -1
- package/dist/esm/build/templates/app-route.js +2 -2
- package/dist/esm/build/templates/app-route.js.map +1 -1
- package/dist/esm/build/templates/edge-ssr-app.js +2 -2
- package/dist/esm/build/templates/edge-ssr-app.js.map +1 -1
- package/dist/esm/build/templates/edge-ssr.js +2 -2
- package/dist/esm/build/templates/edge-ssr.js.map +1 -1
- package/dist/esm/build/templates/pages-api.js +2 -2
- package/dist/esm/build/templates/pages-api.js.map +1 -1
- package/dist/esm/build/webpack-config.js +2 -2
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/server/base-server.js +2 -2
- package/dist/esm/server/base-server.js.map +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/esm/shared/lib/canary-only.js +1 -1
- package/dist/server/base-server.js +2 -2
- package/dist/server/base-server.js.map +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/shared/lib/canary-only.js +1 -1
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/version.js +2 -2
- package/package.json +15 -15
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/build/templates/app-route.ts"],"sourcesContent":["import {\n AppRouteRouteModule,\n type AppRouteRouteHandlerContext,\n type AppRouteRouteModuleOptions,\n} from '../../server/route-modules/app-route/module.compiled'\nimport { RouteKind } from '../../server/route-kind'\nimport { patchFetch as _patchFetch } from '../../server/lib/patch-fetch'\nimport type { IncomingMessage, ServerResponse } from 'node:http'\nimport { getRequestMeta } from '../../server/request-meta'\nimport { getTracer, type Span, SpanKind } from '../../server/lib/trace/tracer'\nimport { setReferenceManifestsSingleton } from '../../server/app-render/encryption-utils'\nimport { createServerModuleMap } from '../../server/app-render/action-utils'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { NodeNextRequest, NodeNextResponse } from '../../server/base-http/node'\nimport {\n NextRequestAdapter,\n signalFromNodeResponse,\n} from '../../server/web/spec-extension/adapters/next-request'\nimport { BaseServerSpan } from '../../server/lib/trace/constants'\nimport { getRevalidateReason } from '../../server/instrumentation/utils'\nimport { sendResponse } from '../../server/send-response'\nimport {\n fromNodeOutgoingHttpHeaders,\n toNodeOutgoingHttpHeaders,\n} from '../../server/web/utils'\nimport { getCacheControlHeader } from '../../server/lib/cache-control'\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from '../../lib/constants'\nimport { NoFallbackError } from '../../shared/lib/no-fallback-error.external'\nimport {\n CachedRouteKind,\n type ResponseCacheEntry,\n type ResponseGenerator,\n} from '../../server/response-cache'\n\nimport * as userland from 'VAR_USERLAND'\n\n// These are injected by the loader afterwards. This is injected as a variable\n// instead of a replacement because this could also be `undefined` instead of\n// an empty string.\ndeclare const nextConfigOutput: AppRouteRouteModuleOptions['nextConfigOutput']\n\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\n// INJECT:nextConfigOutput\n\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: 'VAR_DEFINITION_PAGE',\n pathname: 'VAR_DEFINITION_PATHNAME',\n filename: 'VAR_DEFINITION_FILENAME',\n bundlePath: 'VAR_DEFINITION_BUNDLE_PATH',\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: 'VAR_RESOLVED_PAGE_PATH',\n nextConfigOutput,\n userland,\n})\n\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule\n\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage,\n })\n}\n\nexport {\n routeModule,\n workAsyncStorage,\n workUnitAsyncStorage,\n serverHooks,\n patchFetch,\n}\n\nexport async function handler(\n req: IncomingMessage,\n res: ServerResponse,\n ctx: {\n waitUntil: (prom: Promise<void>) => void\n }\n) {\n let srcPage = 'VAR_DEFINITION_PAGE'\n\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/'\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/'\n }\n const multiZoneDraftMode = process.env\n .__NEXT_MULTI_ZONE_DRAFT_MODE as any as boolean\n\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode,\n })\n\n if (!prepareResult) {\n res.statusCode = 400\n res.end('Bad Request')\n ctx.waitUntil?.(Promise.resolve())\n return null\n }\n\n const {\n buildId,\n params,\n nextConfig,\n isDraftMode,\n prerenderManifest,\n routerServerContext,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n resolvedPathname,\n clientReferenceManifest,\n serverActionsManifest,\n } = prepareResult\n\n const normalizedSrcPage = normalizeAppPath(srcPage)\n\n let isIsr = Boolean(\n prerenderManifest.dynamicRoutes[normalizedSrcPage] ||\n prerenderManifest.routes[resolvedPathname]\n )\n\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname])\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage]\n\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n throw new NoFallbackError()\n }\n }\n }\n\n let cacheKey: string | null = null\n\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey\n }\n\n const supportsDynamicResponse: boolean =\n // If we're in development, we always support dynamic HTML\n routeModule.isDev === true ||\n // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr\n\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isRevalidate = isIsr && !supportsDynamicResponse\n\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setReferenceManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest,\n serverModuleMap: createServerModuleMap({\n serverActionsManifest,\n }),\n })\n }\n\n const method = req.method || 'GET'\n const tracer = getTracer()\n const activeSpan = tracer.getActiveScopeSpan()\n\n const context: AppRouteRouteHandlerContext = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n cacheComponents: Boolean(nextConfig.experimental.cacheComponents),\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts),\n },\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.experimental?.cacheLife,\n isRevalidate,\n waitUntil: ctx.waitUntil,\n onClose: (cb) => {\n res.on('close', cb)\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext) =>\n routeModule.onRequestError(\n req,\n error,\n errorContext,\n routerServerContext\n ),\n },\n sharedContext: {\n buildId,\n },\n }\n const nodeNextReq = new NodeNextRequest(req)\n const nodeNextRes = new NodeNextResponse(res)\n\n const nextReq = NextRequestAdapter.fromNodeNextRequest(\n nodeNextReq,\n signalFromNodeResponse(res)\n )\n\n try {\n const invokeRouteModule = async (span?: Span) => {\n return routeModule.handle(nextReq, context).finally(() => {\n if (!span) return\n\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false,\n })\n\n const rootSpanAttributes = tracer.getRootSpanAttributes()\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return\n }\n\n if (\n rootSpanAttributes.get('next.span_type') !==\n BaseServerSpan.handleRequest\n ) {\n console.warn(\n `Unexpected root span type '${rootSpanAttributes.get(\n 'next.span_type'\n )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n )\n return\n }\n\n const route = rootSpanAttributes.get('next.route')\n if (route) {\n const name = `${method} ${route}`\n\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name,\n })\n span.updateName(name)\n } else {\n span.updateName(`${method} ${req.url}`)\n }\n })\n }\n\n const handleResponse = async (currentSpan?: Span) => {\n const responseGenerator: ResponseGenerator = async ({\n previousCacheEntry,\n }) => {\n try {\n if (\n !getRequestMeta(req, 'minimalMode') &&\n isOnDemandRevalidate &&\n revalidateOnlyGenerated &&\n !previousCacheEntry\n ) {\n res.statusCode = 404\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED')\n res.end('This page could not be found')\n return null\n }\n\n const response = await invokeRouteModule(currentSpan)\n\n ;(req as any).fetchMetrics = (context.renderOpts as any).fetchMetrics\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil\n\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil)\n pendingWaitUntil = undefined\n }\n }\n const cacheTags = context.renderOpts.collectedTags\n\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob()\n\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers)\n\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags\n }\n\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type\n }\n\n const revalidate =\n typeof context.renderOpts.collectedRevalidate === 'undefined' ||\n context.renderOpts.collectedRevalidate >= INFINITE_CACHE\n ? false\n : context.renderOpts.collectedRevalidate\n\n const expire =\n typeof context.renderOpts.collectedExpire === 'undefined' ||\n context.renderOpts.collectedExpire >= INFINITE_CACHE\n ? undefined\n : context.renderOpts.collectedExpire\n\n // Create the cache entry for the response.\n const cacheEntry: ResponseCacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers,\n },\n cacheControl: { revalidate, expire },\n }\n\n return cacheEntry\n } else {\n // send response without caching if not ISR\n await sendResponse(\n nodeNextReq,\n nodeNextRes,\n response,\n context.renderOpts.pendingWaitUntil\n )\n return null\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry?.isStale) {\n await routeModule.onRequestError(\n req,\n err,\n {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isRevalidate,\n isOnDemandRevalidate,\n }),\n },\n routerServerContext\n )\n }\n throw err\n }\n }\n\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n })\n\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null\n }\n\n if (cacheEntry?.value?.kind !== CachedRouteKind.APP_ROUTE) {\n throw new Error(\n `Invariant: app-route received invalid cache entry ${cacheEntry?.value?.kind}`\n )\n }\n\n if (!getRequestMeta(req, 'minimalMode')) {\n res.setHeader(\n 'x-nextjs-cache',\n isOnDemandRevalidate\n ? 'REVALIDATED'\n : cacheEntry.isMiss\n ? 'MISS'\n : cacheEntry.isStale\n ? 'STALE'\n : 'HIT'\n )\n }\n\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader(\n 'Cache-Control',\n 'private, no-cache, no-store, max-age=0, must-revalidate'\n )\n }\n\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers)\n\n if (!(getRequestMeta(req, 'minimalMode') && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER)\n }\n\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (\n cacheEntry.cacheControl &&\n !res.getHeader('Cache-Control') &&\n !headers.get('Cache-Control')\n ) {\n headers.set(\n 'Cache-Control',\n getCacheControlHeader(cacheEntry.cacheControl)\n )\n }\n\n await sendResponse(\n nodeNextReq,\n nodeNextRes,\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200,\n })\n )\n return null\n }\n\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan)\n } else {\n await tracer.withPropagatedContext(req.headers, () =>\n tracer.trace(\n BaseServerSpan.handleRequest,\n {\n spanName: `${method} ${req.url}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url,\n },\n },\n handleResponse\n )\n )\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isRevalidate,\n isOnDemandRevalidate,\n }),\n })\n }\n\n // rethrow so that we can handle serving error page\n\n // If this is during static generation, throw the error again.\n if (isIsr) throw err\n\n // Otherwise, send a 500 response.\n await sendResponse(\n nodeNextReq,\n nodeNextRes,\n new Response(null, { status: 500 })\n )\n return null\n }\n}\n"],"names":["handler","patchFetch","routeModule","serverHooks","workAsyncStorage","workUnitAsyncStorage","AppRouteRouteModule","definition","kind","RouteKind","APP_ROUTE","page","pathname","filename","bundlePath","distDir","process","env","__NEXT_RELATIVE_DIST_DIR","relativeProjectDir","__NEXT_RELATIVE_PROJECT_DIR","resolvedPagePath","nextConfigOutput","userland","_patchFetch","req","res","ctx","nextConfig","srcPage","TURBOPACK","replace","multiZoneDraftMode","__NEXT_MULTI_ZONE_DRAFT_MODE","prepareResult","prepare","statusCode","end","waitUntil","Promise","resolve","buildId","params","isDraftMode","prerenderManifest","routerServerContext","isOnDemandRevalidate","revalidateOnlyGenerated","resolvedPathname","clientReferenceManifest","serverActionsManifest","normalizedSrcPage","normalizeAppPath","isIsr","Boolean","dynamicRoutes","routes","isPrerendered","prerenderInfo","fallback","NoFallbackError","cacheKey","isDev","supportsDynamicResponse","isRevalidate","setReferenceManifestsSingleton","serverModuleMap","createServerModuleMap","method","tracer","getTracer","activeSpan","getActiveScopeSpan","context","renderOpts","experimental","cacheComponents","authInterrupts","incrementalCache","getRequestMeta","cacheLifeProfiles","cacheLife","onClose","cb","on","onAfterTaskError","undefined","onInstrumentationRequestError","error","_request","errorContext","onRequestError","sharedContext","nodeNextReq","NodeNextRequest","nodeNextRes","NodeNextResponse","nextReq","NextRequestAdapter","fromNodeNextRequest","signalFromNodeResponse","invokeRouteModule","span","handle","finally","setAttributes","rootSpanAttributes","getRootSpanAttributes","get","BaseServerSpan","handleRequest","console","warn","route","name","updateName","url","handleResponse","currentSpan","cacheEntry","responseGenerator","previousCacheEntry","setHeader","response","fetchMetrics","pendingWaitUntil","cacheTags","collectedTags","blob","headers","toNodeOutgoingHttpHeaders","NEXT_CACHE_TAGS_HEADER","type","revalidate","collectedRevalidate","INFINITE_CACHE","expire","collectedExpire","value","CachedRouteKind","status","body","Buffer","from","arrayBuffer","cacheControl","sendResponse","err","isStale","routerKind","routePath","routeType","revalidateReason","getRevalidateReason","routeKind","isFallback","isRoutePPREnabled","Error","isMiss","fromNodeOutgoingHttpHeaders","delete","getHeader","set","getCacheControlHeader","Response","withPropagatedContext","trace","spanName","SpanKind","SERVER","attributes"],"mappings":";;;;;;;;;;;;;;;;;;;IAgFsBA,OAAO;eAAPA;;IAHpBC,UAAU;eAAVA;;IAJAC,WAAW;eAAXA;;IAGAC,WAAW;eAAXA;;IAFAC,gBAAgB;eAAhBA;;IACAC,oBAAoB;eAApBA;;;gCAvEK;2BACmB;4BACgB;6BAEX;wBACgB;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gBAClCZ;gBACAW,QAAQrB,WAAWmB,KAAK,CAACE,MAAM,IAAI;YACrC;YAEF,OAAO;QACT;QAEA,oDAAoD;QACpD,yDAAyD;QACzD,IAAIrE,YAAY;YACd,MAAM8C,eAAe9C;QACvB,OAAO;YACL,MAAMF,OAAOgG,qBAAqB,CAAC5I,IAAIwG,OAAO,EAAE,IAC9C5D,OAAOiG,KAAK,CACVzD,yBAAc,CAACC,aAAa,EAC5B;oBACEyD,UAAU,GAAGnG,OAAO,CAAC,EAAE3C,IAAI2F,GAAG,EAAE;oBAChC5G,MAAMgK,gBAAQ,CAACC,MAAM;oBACrBC,YAAY;wBACV,eAAetG;wBACf,eAAe3C,IAAI2F,GAAG;oBACxB;gBACF,GACAC;QAGN;IACF,EAAE,OAAO8B,KAAK;QACZ,IAAI,CAAEA,CAAAA,eAAevF,wCAAe,AAAD,GAAI;YACrC,MAAM1D,YAAYyF,cAAc,CAAClE,KAAK0H,KAAK;gBACzCE,YAAY;gBACZC,WAAWnG;gBACXoG,WAAW;gBACXC,kBAAkBC,IAAAA,0BAAmB,EAAC;oBACpCzF;oBACAlB;gBACF;YACF;QACF;QAEA,mDAAmD;QAEnD,8DAA8D;QAC9D,IAAIO,OAAO,MAAM8F;QAEjB,kCAAkC;QAClC,MAAMD,IAAAA,0BAAY,EAChBrD,aACAE,aACA,IAAIqE,SAAS,MAAM;YAAExB,QAAQ;QAAI;QAEnC,OAAO;IACT;AACF","ignoreList":[0]}
|
1
|
+
{"version":3,"sources":["../../../src/build/templates/app-route.ts"],"sourcesContent":["import {\n AppRouteRouteModule,\n type AppRouteRouteHandlerContext,\n type AppRouteRouteModuleOptions,\n} from '../../server/route-modules/app-route/module.compiled'\nimport { RouteKind } from '../../server/route-kind'\nimport { patchFetch as _patchFetch } from '../../server/lib/patch-fetch'\nimport type { IncomingMessage, ServerResponse } from 'node:http'\nimport { getRequestMeta } from '../../server/request-meta'\nimport { getTracer, type Span, SpanKind } from '../../server/lib/trace/tracer'\nimport { setReferenceManifestsSingleton } from '../../server/app-render/encryption-utils'\nimport { createServerModuleMap } from '../../server/app-render/action-utils'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { NodeNextRequest, NodeNextResponse } from '../../server/base-http/node'\nimport {\n NextRequestAdapter,\n signalFromNodeResponse,\n} from '../../server/web/spec-extension/adapters/next-request'\nimport { BaseServerSpan } from '../../server/lib/trace/constants'\nimport { getRevalidateReason } from '../../server/instrumentation/utils'\nimport { sendResponse } from '../../server/send-response'\nimport {\n fromNodeOutgoingHttpHeaders,\n toNodeOutgoingHttpHeaders,\n} from '../../server/web/utils'\nimport { getCacheControlHeader } from '../../server/lib/cache-control'\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from '../../lib/constants'\nimport { NoFallbackError } from '../../shared/lib/no-fallback-error.external'\nimport {\n CachedRouteKind,\n type ResponseCacheEntry,\n type ResponseGenerator,\n} from '../../server/response-cache'\n\nimport * as userland from 'VAR_USERLAND'\n\n// These are injected by the loader afterwards. This is injected as a variable\n// instead of a replacement because this could also be `undefined` instead of\n// an empty string.\ndeclare const nextConfigOutput: AppRouteRouteModuleOptions['nextConfigOutput']\n\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\n// INJECT:nextConfigOutput\n\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: 'VAR_DEFINITION_PAGE',\n pathname: 'VAR_DEFINITION_PATHNAME',\n filename: 'VAR_DEFINITION_FILENAME',\n bundlePath: 'VAR_DEFINITION_BUNDLE_PATH',\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: 'VAR_RESOLVED_PAGE_PATH',\n nextConfigOutput,\n userland,\n})\n\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule\n\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage,\n })\n}\n\nexport {\n routeModule,\n workAsyncStorage,\n workUnitAsyncStorage,\n serverHooks,\n patchFetch,\n}\n\nexport async function handler(\n req: IncomingMessage,\n res: ServerResponse,\n ctx: {\n waitUntil: (prom: Promise<void>) => void\n }\n) {\n let srcPage = 'VAR_DEFINITION_PAGE'\n\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/'\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/'\n }\n const multiZoneDraftMode = process.env\n .__NEXT_MULTI_ZONE_DRAFT_MODE as any as boolean\n\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode,\n })\n\n if (!prepareResult) {\n res.statusCode = 400\n res.end('Bad Request')\n ctx.waitUntil?.(Promise.resolve())\n return null\n }\n\n const {\n buildId,\n params,\n nextConfig,\n isDraftMode,\n prerenderManifest,\n routerServerContext,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n resolvedPathname,\n clientReferenceManifest,\n serverActionsManifest,\n } = prepareResult\n\n const normalizedSrcPage = normalizeAppPath(srcPage)\n\n let isIsr = Boolean(\n prerenderManifest.dynamicRoutes[normalizedSrcPage] ||\n prerenderManifest.routes[resolvedPathname]\n )\n\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname])\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage]\n\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n throw new NoFallbackError()\n }\n }\n }\n\n let cacheKey: string | null = null\n\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey\n }\n\n const supportsDynamicResponse: boolean =\n // If we're in development, we always support dynamic HTML\n routeModule.isDev === true ||\n // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr\n\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isRevalidate = isIsr && !supportsDynamicResponse\n\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setReferenceManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest,\n serverModuleMap: createServerModuleMap({\n serverActionsManifest,\n }),\n })\n }\n\n const method = req.method || 'GET'\n const tracer = getTracer()\n const activeSpan = tracer.getActiveScopeSpan()\n\n const context: AppRouteRouteHandlerContext = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n cacheComponents: Boolean(nextConfig.experimental.cacheComponents),\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts),\n },\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.experimental?.cacheLife,\n isRevalidate,\n waitUntil: ctx.waitUntil,\n onClose: (cb) => {\n res.on('close', cb)\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext) =>\n routeModule.onRequestError(\n req,\n error,\n errorContext,\n routerServerContext\n ),\n },\n sharedContext: {\n buildId,\n },\n }\n const nodeNextReq = new NodeNextRequest(req)\n const nodeNextRes = new NodeNextResponse(res)\n\n const nextReq = NextRequestAdapter.fromNodeNextRequest(\n nodeNextReq,\n signalFromNodeResponse(res)\n )\n\n try {\n const invokeRouteModule = async (span?: Span) => {\n return routeModule.handle(nextReq, context).finally(() => {\n if (!span) return\n\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false,\n })\n\n const rootSpanAttributes = tracer.getRootSpanAttributes()\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return\n }\n\n if (\n rootSpanAttributes.get('next.span_type') !==\n BaseServerSpan.handleRequest\n ) {\n console.warn(\n `Unexpected root span type '${rootSpanAttributes.get(\n 'next.span_type'\n )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n )\n return\n }\n\n const route = rootSpanAttributes.get('next.route')\n if (route) {\n const name = `${method} ${route}`\n\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name,\n })\n span.updateName(name)\n } else {\n span.updateName(`${method}`)\n }\n })\n }\n\n const handleResponse = async (currentSpan?: Span) => {\n const responseGenerator: ResponseGenerator = async ({\n previousCacheEntry,\n }) => {\n try {\n if (\n !getRequestMeta(req, 'minimalMode') &&\n isOnDemandRevalidate &&\n revalidateOnlyGenerated &&\n !previousCacheEntry\n ) {\n res.statusCode = 404\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED')\n res.end('This page could not be found')\n return null\n }\n\n const response = await invokeRouteModule(currentSpan)\n\n ;(req as any).fetchMetrics = (context.renderOpts as any).fetchMetrics\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil\n\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil)\n pendingWaitUntil = undefined\n }\n }\n const cacheTags = context.renderOpts.collectedTags\n\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob()\n\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers)\n\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags\n }\n\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type\n }\n\n const revalidate =\n typeof context.renderOpts.collectedRevalidate === 'undefined' ||\n context.renderOpts.collectedRevalidate >= INFINITE_CACHE\n ? false\n : context.renderOpts.collectedRevalidate\n\n const expire =\n typeof context.renderOpts.collectedExpire === 'undefined' ||\n context.renderOpts.collectedExpire >= INFINITE_CACHE\n ? undefined\n : context.renderOpts.collectedExpire\n\n // Create the cache entry for the response.\n const cacheEntry: ResponseCacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers,\n },\n cacheControl: { revalidate, expire },\n }\n\n return cacheEntry\n } else {\n // send response without caching if not ISR\n await sendResponse(\n nodeNextReq,\n nodeNextRes,\n response,\n context.renderOpts.pendingWaitUntil\n )\n return null\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry?.isStale) {\n await routeModule.onRequestError(\n req,\n err,\n {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isRevalidate,\n isOnDemandRevalidate,\n }),\n },\n routerServerContext\n )\n }\n throw err\n }\n }\n\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n })\n\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null\n }\n\n if (cacheEntry?.value?.kind !== CachedRouteKind.APP_ROUTE) {\n throw new Error(\n `Invariant: app-route received invalid cache entry ${cacheEntry?.value?.kind}`\n )\n }\n\n if (!getRequestMeta(req, 'minimalMode')) {\n res.setHeader(\n 'x-nextjs-cache',\n isOnDemandRevalidate\n ? 'REVALIDATED'\n : cacheEntry.isMiss\n ? 'MISS'\n : cacheEntry.isStale\n ? 'STALE'\n : 'HIT'\n )\n }\n\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader(\n 'Cache-Control',\n 'private, no-cache, no-store, max-age=0, must-revalidate'\n )\n }\n\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers)\n\n if (!(getRequestMeta(req, 'minimalMode') && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER)\n }\n\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (\n cacheEntry.cacheControl &&\n !res.getHeader('Cache-Control') &&\n !headers.get('Cache-Control')\n ) {\n headers.set(\n 'Cache-Control',\n getCacheControlHeader(cacheEntry.cacheControl)\n )\n }\n\n await sendResponse(\n nodeNextReq,\n nodeNextRes,\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200,\n })\n )\n return null\n }\n\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan)\n } else {\n await tracer.withPropagatedContext(req.headers, () =>\n tracer.trace(\n BaseServerSpan.handleRequest,\n {\n spanName: `${method}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url,\n },\n },\n handleResponse\n )\n )\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isRevalidate,\n isOnDemandRevalidate,\n }),\n })\n }\n\n // rethrow so that we can handle serving error page\n\n // If this is during static generation, throw the error again.\n if (isIsr) throw err\n\n // Otherwise, send a 500 response.\n await sendResponse(\n nodeNextReq,\n nodeNextRes,\n new Response(null, { status: 500 })\n )\n return null\n }\n}\n"],"names":["handler","patchFetch","routeModule","serverHooks","workAsyncStorage","workUnitAsyncStorage","AppRouteRouteModule","definition","kind","RouteKind","APP_ROUTE","page","pathname","filename","bundlePath","distDir","process","env","__NEXT_RELATIVE_DIST_DIR","relativeProjectDir","__NEXT_RELATIVE_PROJECT_DIR","resolvedPagePath","nextConfigOutput","userland","_patchFetch","req","res","ctx","nextConfig","srcPage","TURBOPACK","replace","multiZoneDraftMode","__NEXT_MULTI_ZONE_DRAFT_MODE","prepareResult","prepare","statusCode","end","waitUntil","Promise","resolve","buildId","params","isDraftMode","prerenderManifest","routerServerContext","isOnDemandRevalidate","revalidateOnlyGenerated","resolvedPathname","clientReferenceManifest","serverActionsManifest","normalizedSrcPage","normalizeAppPath","isIsr","Boolean","dynamicRoutes","routes","isPrerendered","prerenderInfo","fallback","NoFallbackError","cacheKey","isDev","supportsDynamicResponse","isRevalidate","setReferenceManifestsSingleton","serverModuleMap","createServerModuleMap","method","tracer","getTracer","activeSpan","getActiveScopeSpan","context","renderOpts","experimental","cacheComponents","authInterrupts","incrementalCache","getRequestMeta","cacheLifeProfiles","cacheLife","onClose","cb","on","onAfterTaskError","undefined","onInstrumentationRequestError","error","_request","errorContext","onRequestError","sharedContext","nodeNextReq","NodeNextRequest","nodeNextRes","NodeNextResponse","nextReq","NextRequestAdapter","fromNodeNextRequest","signalFromNodeResponse","invokeRouteModule","span","handle","finally","setAttributes","rootSpanAttributes","getRootSpanAttributes","get","BaseServerSpan","handleRequest","console","warn","route","name","updateName","handleResponse","currentSpan","cacheEntry","responseGenerator","previousCacheEntry","setHeader","response","fetchMetrics","pendingWaitUntil","cacheTags","collectedTags","blob","headers","toNodeOutgoingHttpHeaders","NEXT_CACHE_TAGS_HEADER","type","revalidate","collectedRevalidate","INFINITE_CACHE","expire","collectedExpire","value","CachedRouteKind","status","body","Buffer","from","arrayBuffer","cacheControl","sendResponse","err","isStale","routerKind","routePath","routeType","revalidateReason","getRevalidateReason","routeKind","isFallback","isRoutePPREnabled","Error","isMiss","fromNodeOutgoingHttpHeaders","delete","getHeader","set","getCacheControlHeader","Response","withPropagatedContext","trace","spanName","SpanKind","SERVER","attributes","url"],"mappings":";;;;;;;;;;;;;;;;;;;IAgFsBA,OAAO;eAAPA;;IAHpBC,UAAU;eAAVA;;IAJAC,WAAW;eAAXA;;IAGAC,WAAW;eAAXA;;IAFAC,gBAAgB;eAAhBA;;IACAC,oBAAoB;eAApBA;;;gCAvEK;2BACmB;4BACgB;6BAEX;wBACgB;iCACA;6BACT;0BACL;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M,IAAI;YACrC;YAEF,OAAO;QACT;QAEA,oDAAoD;QACpD,yDAAyD;QACzD,IAAIpE,YAAY;YACd,MAAM6C,eAAe7C;QACvB,OAAO;YACL,MAAMF,OAAO+F,qBAAqB,CAAC3I,IAAIuG,OAAO,EAAE,IAC9C3D,OAAOgG,KAAK,CACVxD,yBAAc,CAACC,aAAa,EAC5B;oBACEwD,UAAU,GAAGlG,QAAQ;oBACrB5D,MAAM+J,gBAAQ,CAACC,MAAM;oBACrBC,YAAY;wBACV,eAAerG;wBACf,eAAe3C,IAAIiJ,GAAG;oBACxB;gBACF,GACAtD;QAGN;IACF,EAAE,OAAO8B,KAAK;QACZ,IAAI,CAAEA,CAAAA,eAAetF,wCAAe,AAAD,GAAI;YACrC,MAAM1D,YAAYyF,cAAc,CAAClE,KAAKyH,KAAK;gBACzCE,YAAY;gBACZC,WAAWlG;gBACXmG,WAAW;gBACXC,kBAAkBC,IAAAA,0BAAmB,EAAC;oBACpCxF;oBACAlB;gBACF;YACF;QACF;QAEA,mDAAmD;QAEnD,8DAA8D;QAC9D,IAAIO,OAAO,MAAM6F;QAEjB,kCAAkC;QAClC,MAAMD,IAAAA,0BAAY,EAChBpD,aACAE,aACA,IAAIoE,SAAS,MAAM;YAAExB,QAAQ;QAAI;QAEnC,OAAO;IACT;AACF","ignoreList":[0]}
|
@@ -277,7 +277,7 @@ async function requestHandler(req, event) {
|
|
277
277
|
});
|
278
278
|
span.updateName(name);
|
279
279
|
} else {
|
280
|
-
span.updateName(`${req.method}
|
280
|
+
span.updateName(`${req.method}`);
|
281
281
|
}
|
282
282
|
});
|
283
283
|
return renderResultToResponse(result);
|
@@ -294,7 +294,7 @@ async function requestHandler(req, event) {
|
|
294
294
|
};
|
295
295
|
const tracer = (0, _tracer.getTracer)();
|
296
296
|
return tracer.withPropagatedContext(req.headers, ()=>tracer.trace(_constants.BaseServerSpan.handleRequest, {
|
297
|
-
spanName: `${req.method}
|
297
|
+
spanName: `${req.method}`,
|
298
298
|
kind: _tracer.SpanKind.SERVER,
|
299
299
|
attributes: {
|
300
300
|
'http.method': req.method,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/build/templates/edge-ssr-app.ts"],"sourcesContent":["import '../../server/web/globals'\nimport { adapter, type NextRequestHint } from '../../server/web/adapter'\nimport { IncrementalCache } from '../../server/lib/incremental-cache'\n\nimport * as pageMod from 'VAR_USERLAND'\n\nimport type { RequestData } from '../../server/web/types'\nimport type { NextConfigComplete } from '../../server/config-shared'\nimport { setReferenceManifestsSingleton } from '../../server/app-render/encryption-utils'\nimport { createServerModuleMap } from '../../server/app-render/action-utils'\nimport { initializeCacheHandlers } from '../../server/use-cache/handlers'\nimport { BaseServerSpan } from '../../server/lib/trace/constants'\nimport { getTracer, SpanKind, type Span } from '../../server/lib/trace/tracer'\nimport { WebNextRequest, WebNextResponse } from '../../server/base-http/web'\nimport type { NextFetchEvent } from '../../server/web/spec-extension/fetch-event'\nimport type {\n AppPageRouteHandlerContext,\n AppPageRouteModule,\n} from '../../server/route-modules/app-page/module.compiled'\nimport type { AppPageRenderResultMetadata } from '../../server/render-result'\nimport type RenderResult from '../../server/render-result'\nimport { getIsPossibleServerAction } from '../../server/lib/server-action-request-meta'\nimport { getBotType } from '../../shared/lib/router/utils/is-bot'\nimport { interopDefault } from '../../lib/interop-default'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { checkIsOnDemandRevalidate } from '../../server/api-utils'\nimport { CloseController } from '../../server/web/web-on-close'\n\ndeclare const incrementalCacheHandler: any\n// OPTIONAL_IMPORT:incrementalCacheHandler\n\n// Initialize the cache handlers interface.\ninitializeCacheHandlers()\n\n// injected by the loader afterwards.\ndeclare const nextConfig: NextConfigComplete\n// INJECT:nextConfig\n\nconst maybeJSONParse = (str?: string) => (str ? JSON.parse(str) : undefined)\n\nconst rscManifest = self.__RSC_MANIFEST?.['VAR_PAGE']\nconst rscServerManifest = maybeJSONParse(self.__RSC_SERVER_MANIFEST)\n\nif (rscManifest && rscServerManifest) {\n setReferenceManifestsSingleton({\n page: 'VAR_PAGE',\n clientReferenceManifest: rscManifest,\n serverActionsManifest: rscServerManifest,\n serverModuleMap: createServerModuleMap({\n serverActionsManifest: rscServerManifest,\n }),\n })\n}\n\nexport const ComponentMod = pageMod\n\nasync function requestHandler(\n req: NextRequestHint,\n event: NextFetchEvent\n): Promise<Response> {\n let srcPage = 'VAR_PAGE'\n\n const normalizedSrcPage = normalizeAppPath(srcPage)\n const relativeUrl = `${req.nextUrl.pathname}${req.nextUrl.search}`\n const baseReq = new WebNextRequest(req)\n const baseRes = new WebNextResponse(undefined)\n\n const pageRouteModule = pageMod.routeModule as AppPageRouteModule\n const prepareResult = await pageRouteModule.prepare(baseReq, null, {\n srcPage,\n multiZoneDraftMode: false,\n })\n\n if (!prepareResult) {\n return new Response('Bad Request', {\n status: 400,\n })\n }\n const {\n query,\n params,\n buildId,\n buildManifest,\n prerenderManifest,\n reactLoadableManifest,\n clientReferenceManifest,\n subresourceIntegrityManifest,\n dynamicCssManifest,\n nextFontManifest,\n resolvedPathname,\n serverActionsManifest,\n interceptionRoutePatterns,\n routerServerContext,\n } = prepareResult\n\n const isPossibleServerAction = getIsPossibleServerAction(req)\n const botType = getBotType(req.headers.get('User-Agent') || '')\n const { isOnDemandRevalidate } = checkIsOnDemandRevalidate(\n req,\n prerenderManifest.preview\n )\n\n const closeController = new CloseController()\n\n const renderContext: AppPageRouteHandlerContext = {\n page: normalizedSrcPage,\n query,\n params,\n\n sharedContext: {\n buildId,\n },\n fallbackRouteParams: null,\n\n renderOpts: {\n App: () => null,\n Document: () => null,\n pageConfig: {},\n ComponentMod,\n Component: interopDefault(ComponentMod),\n routeModule: pageRouteModule,\n\n params,\n page: srcPage,\n postponed: undefined,\n shouldWaitOnAllReady: false,\n serveStreamingMetadata: true,\n supportsDynamicResponse: true,\n buildManifest,\n nextFontManifest,\n reactLoadableManifest,\n subresourceIntegrityManifest,\n dynamicCssManifest,\n serverActionsManifest,\n clientReferenceManifest,\n setIsrStatus: routerServerContext?.setIsrStatus,\n\n dir: pageRouteModule.relativeProjectDir,\n botType,\n isDraftMode: false,\n isRevalidate: false,\n isOnDemandRevalidate,\n isPossibleServerAction,\n assetPrefix: nextConfig.assetPrefix,\n nextConfigOutput: nextConfig.output,\n crossOrigin: nextConfig.crossOrigin,\n trailingSlash: nextConfig.trailingSlash,\n previewProps: prerenderManifest.preview,\n deploymentId: nextConfig.deploymentId,\n enableTainting: nextConfig.experimental.taint,\n htmlLimitedBots: nextConfig.htmlLimitedBots,\n reactMaxHeadersLength: nextConfig.reactMaxHeadersLength,\n\n multiZoneDraftMode: false,\n cacheLifeProfiles: nextConfig.experimental.cacheLife,\n basePath: nextConfig.basePath,\n serverActions: nextConfig.experimental.serverActions,\n\n experimental: {\n isRoutePPREnabled: false,\n expireTime: nextConfig.expireTime,\n staleTimes: nextConfig.experimental.staleTimes,\n cacheComponents: Boolean(nextConfig.experimental.cacheComponents),\n clientSegmentCache: Boolean(nextConfig.experimental.clientSegmentCache),\n clientParamParsing: Boolean(nextConfig.experimental.clientParamParsing),\n dynamicOnHover: Boolean(nextConfig.experimental.dynamicOnHover),\n inlineCss: Boolean(nextConfig.experimental.inlineCss),\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts),\n clientTraceMetadata:\n nextConfig.experimental.clientTraceMetadata || ([] as any),\n clientParamParsingOrigins:\n nextConfig.experimental.clientParamParsingOrigins,\n },\n\n incrementalCache: await pageRouteModule.getIncrementalCache(\n baseReq,\n nextConfig,\n prerenderManifest\n ),\n\n waitUntil: event.waitUntil.bind(event),\n onClose: (cb) => {\n closeController.onClose(cb)\n },\n onAfterTaskError: () => {},\n\n onInstrumentationRequestError: (error, _request, errorContext) =>\n pageRouteModule.onRequestError(\n baseReq,\n error,\n errorContext,\n routerServerContext\n ),\n dev: pageRouteModule.isDev,\n },\n }\n let finalStatus = 200\n\n const renderResultToResponse = (\n result: RenderResult<AppPageRenderResultMetadata>\n ): Response => {\n const varyHeader = pageRouteModule.getVaryHeader(\n resolvedPathname,\n interceptionRoutePatterns\n )\n // Handle null responses\n if (result.isNull) {\n finalStatus = 500\n closeController.dispatchClose()\n return new Response(null, { status: 500 })\n }\n\n // Extract metadata\n const { metadata } = result\n const headers = new Headers()\n finalStatus = metadata.statusCode || baseRes.statusCode || 200\n // Pull any fetch metrics from the render onto the request.\n ;(req as any).fetchMetrics = metadata.fetchMetrics\n\n // Set content type\n const contentType = result.contentType || 'text/html; charset=utf-8'\n headers.set('Content-Type', contentType)\n headers.set('x-edge-runtime', '1')\n\n if (varyHeader) {\n headers.set('Vary', varyHeader)\n }\n\n // Add existing headers\n for (const [key, value] of Object.entries({\n ...baseRes.getHeaders(),\n ...metadata.headers,\n })) {\n if (value !== undefined) {\n if (Array.isArray(value)) {\n // Handle multiple header values\n for (const v of value) {\n headers.append(key, String(v))\n }\n } else {\n headers.set(key, String(value))\n }\n }\n }\n\n // Handle static response\n if (!result.isDynamic) {\n const body = result.toUnchunkedString()\n headers.set(\n 'Content-Length',\n String(new TextEncoder().encode(body).length)\n )\n closeController.dispatchClose()\n return new Response(body, {\n status: finalStatus,\n headers,\n })\n }\n\n // Handle dynamic/streaming response\n // For edge runtime, we need to create a readable stream that pipes from the result\n const { readable, writable } = new TransformStream()\n\n // Start piping the result to the writable stream\n // This is done asynchronously to avoid blocking the response creation\n result\n .pipeTo(writable)\n .catch((err: unknown) => {\n console.error('Error piping RenderResult to response:', err)\n })\n .finally(() => closeController.dispatchClose())\n\n return new Response(readable, {\n status: finalStatus,\n headers,\n })\n }\n\n const invokeRender = async (span?: Span): Promise<Response> => {\n try {\n const result = await pageRouteModule\n .render(baseReq, baseRes, renderContext)\n .finally(() => {\n if (!span) return\n\n span.setAttributes({\n 'http.status_code': finalStatus,\n 'next.rsc': false,\n })\n\n const rootSpanAttributes = tracer.getRootSpanAttributes()\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return\n }\n\n if (\n rootSpanAttributes.get('next.span_type') !==\n BaseServerSpan.handleRequest\n ) {\n console.warn(\n `Unexpected root span type '${rootSpanAttributes.get(\n 'next.span_type'\n )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n )\n return\n }\n\n const route = normalizedSrcPage\n if (route) {\n const name = `${req.method} ${route}`\n\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name,\n })\n span.updateName(name)\n } else {\n span.updateName(`${req.method} ${relativeUrl}`)\n }\n })\n\n return renderResultToResponse(result)\n } catch (err) {\n await pageRouteModule.onRequestError(baseReq, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'render',\n revalidateReason: undefined,\n })\n // rethrow so that we can handle serving error page\n throw err\n }\n }\n\n const tracer = getTracer()\n\n return tracer.withPropagatedContext(req.headers, () =>\n tracer.trace(\n BaseServerSpan.handleRequest,\n {\n spanName: `${req.method} ${relativeUrl}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': req.method,\n 'http.target': relativeUrl,\n 'http.route': normalizedSrcPage,\n },\n },\n invokeRender\n )\n )\n}\n\nexport default function nHandler(opts: { page: string; request: RequestData }) {\n return adapter({\n ...opts,\n IncrementalCache,\n handler: requestHandler,\n incrementalCacheHandler,\n })\n}\n"],"names":["ComponentMod","nHandler","self","initializeCacheHandlers","maybeJSONParse","str","JSON","parse","undefined","rscManifest","__RSC_MANIFEST","rscServerManifest","__RSC_SERVER_MANIFEST","setReferenceManifestsSingleton","page","clientReferenceManifest","serverActionsManifest","serverModuleMap","createServerModuleMap","pageMod","requestHandler","req","event","srcPage","normalizedSrcPage","normalizeAppPath","relativeUrl","nextUrl","pathname","search","baseReq","WebNextRequest","baseRes","WebNextResponse","pageRouteModule","routeModule","prepareResult","prepare","multiZoneDraftMode","Response","status","query","params","buildId","buildManifest","prerenderManifest","reactLoadableManifest","subresourceIntegrityManifest","dynamicCssManifest","nextFontManifest","resolvedPathname","interceptionRoutePatterns","routerServerContext","isPossibleServerAction","getIsPossibleServerAction","botType","getBotType","headers","get","isOnDemandRevalidate","checkIsOnDemandRevalidate","preview","closeController","CloseController","renderContext","sharedContext","fallbackRouteParams","renderOpts","App","Document","pageConfig","Component","interopDefault","postponed","shouldWaitOnAllReady","serveStreamingMetadata","supportsDynamicResponse","setIsrStatus","dir","relativeProjectDir","isDraftMode","isRevalidate","assetPrefix","nextConfig","nextConfigOutput","output","crossOrigin","trailingSlash","previewProps","deploymentId","enableTainting","experimental","taint","htmlLimitedBots","reactMaxHeadersLength","cacheLifeProfiles","cacheLife","basePath","serverActions","isRoutePPREnabled","expireTime","staleTimes","cacheComponents","Boolean","clientSegmentCache","clientParamParsing","dynamicOnHover","inlineCss","authInterrupts","clientTraceMetadata","clientParamParsingOrigins","incrementalCache","getIncrementalCache","waitUntil","bind","onClose","cb","onAfterTaskError","onInstrumentationRequestError","error","_request","errorContext","onRequestError","dev","isDev","finalStatus","renderResultToResponse","result","varyHeader","getVaryHeader","isNull","dispatchClose","metadata","Headers","statusCode","fetchMetrics","contentType","set","key","value","Object","entries","getHeaders","Array","isArray","v","append","String","isDynamic","body","toUnchunkedString","TextEncoder","encode","length","readable","writable","TransformStream","pipeTo","catch","err","console","finally","invokeRender","span","render","setAttributes","rootSpanAttributes","tracer","getRootSpanAttributes","BaseServerSpan","handleRequest","warn","route","name","method","updateName","routerKind","routePath","routeType","revalidateReason","getTracer","withPropagatedContext","trace","spanName","kind","SpanKind","SERVER","attributes","opts","adapter","IncrementalCache","handler","incrementalCacheHandler"],"mappings":";;;;;;;;;;;;;;;IAsDaA,YAAY;eAAZA;;IA6Sb,OAOC;eAPuBC;;;QAnWjB;yBACuC;kCACb;sEAER;iCAIsB;6BACT;0BACE;2BACT;wBACgB;qBACC;yCAQN;uBACf;gCACI;0BACE;0BACS;4BACV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAcZC;AAXpB,0CAA0C;AAE1C,2CAA2C;AAC3CC,IAAAA,iCAAuB;AAIvB,oB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ASjK,SAAS2L,IAA4C;IAC3E,OAAOC,IAAAA,gBAAO,EAAC;QACb,GAAGD,IAAI;QACPE,kBAAAA,kCAAgB;QAChBC,SAAS3K;QACT4K;IACF;AACF","ignoreList":[0]}
|
1
|
+
{"version":3,"sources":["../../../src/build/templates/edge-ssr-app.ts"],"sourcesContent":["import '../../server/web/globals'\nimport { adapter, type NextRequestHint } from '../../server/web/adapter'\nimport { IncrementalCache } from '../../server/lib/incremental-cache'\n\nimport * as pageMod from 'VAR_USERLAND'\n\nimport type { RequestData } from '../../server/web/types'\nimport type { NextConfigComplete } from '../../server/config-shared'\nimport { setReferenceManifestsSingleton } from '../../server/app-render/encryption-utils'\nimport { createServerModuleMap } from '../../server/app-render/action-utils'\nimport { initializeCacheHandlers } from '../../server/use-cache/handlers'\nimport { BaseServerSpan } from '../../server/lib/trace/constants'\nimport { getTracer, SpanKind, type Span } from '../../server/lib/trace/tracer'\nimport { WebNextRequest, WebNextResponse } from '../../server/base-http/web'\nimport type { NextFetchEvent } from '../../server/web/spec-extension/fetch-event'\nimport type {\n AppPageRouteHandlerContext,\n AppPageRouteModule,\n} from '../../server/route-modules/app-page/module.compiled'\nimport type { AppPageRenderResultMetadata } from '../../server/render-result'\nimport type RenderResult from '../../server/render-result'\nimport { getIsPossibleServerAction } from '../../server/lib/server-action-request-meta'\nimport { getBotType } from '../../shared/lib/router/utils/is-bot'\nimport { interopDefault } from '../../lib/interop-default'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { checkIsOnDemandRevalidate } from '../../server/api-utils'\nimport { CloseController } from '../../server/web/web-on-close'\n\ndeclare const incrementalCacheHandler: any\n// OPTIONAL_IMPORT:incrementalCacheHandler\n\n// Initialize the cache handlers interface.\ninitializeCacheHandlers()\n\n// injected by the loader afterwards.\ndeclare const nextConfig: NextConfigComplete\n// INJECT:nextConfig\n\nconst maybeJSONParse = (str?: string) => (str ? JSON.parse(str) : undefined)\n\nconst rscManifest = self.__RSC_MANIFEST?.['VAR_PAGE']\nconst rscServerManifest = maybeJSONParse(self.__RSC_SERVER_MANIFEST)\n\nif (rscManifest && rscServerManifest) {\n setReferenceManifestsSingleton({\n page: 'VAR_PAGE',\n clientReferenceManifest: rscManifest,\n serverActionsManifest: rscServerManifest,\n serverModuleMap: createServerModuleMap({\n serverActionsManifest: rscServerManifest,\n }),\n })\n}\n\nexport const ComponentMod = pageMod\n\nasync function requestHandler(\n req: NextRequestHint,\n event: NextFetchEvent\n): Promise<Response> {\n let srcPage = 'VAR_PAGE'\n\n const normalizedSrcPage = normalizeAppPath(srcPage)\n const relativeUrl = `${req.nextUrl.pathname}${req.nextUrl.search}`\n const baseReq = new WebNextRequest(req)\n const baseRes = new WebNextResponse(undefined)\n\n const pageRouteModule = pageMod.routeModule as AppPageRouteModule\n const prepareResult = await pageRouteModule.prepare(baseReq, null, {\n srcPage,\n multiZoneDraftMode: false,\n })\n\n if (!prepareResult) {\n return new Response('Bad Request', {\n status: 400,\n })\n }\n const {\n query,\n params,\n buildId,\n buildManifest,\n prerenderManifest,\n reactLoadableManifest,\n clientReferenceManifest,\n subresourceIntegrityManifest,\n dynamicCssManifest,\n nextFontManifest,\n resolvedPathname,\n serverActionsManifest,\n interceptionRoutePatterns,\n routerServerContext,\n } = prepareResult\n\n const isPossibleServerAction = getIsPossibleServerAction(req)\n const botType = getBotType(req.headers.get('User-Agent') || '')\n const { isOnDemandRevalidate } = checkIsOnDemandRevalidate(\n req,\n prerenderManifest.preview\n )\n\n const closeController = new CloseController()\n\n const renderContext: AppPageRouteHandlerContext = {\n page: normalizedSrcPage,\n query,\n params,\n\n sharedContext: {\n buildId,\n },\n fallbackRouteParams: null,\n\n renderOpts: {\n App: () => null,\n Document: () => null,\n pageConfig: {},\n ComponentMod,\n Component: interopDefault(ComponentMod),\n routeModule: pageRouteModule,\n\n params,\n page: srcPage,\n postponed: undefined,\n shouldWaitOnAllReady: false,\n serveStreamingMetadata: true,\n supportsDynamicResponse: true,\n buildManifest,\n nextFontManifest,\n reactLoadableManifest,\n subresourceIntegrityManifest,\n dynamicCssManifest,\n serverActionsManifest,\n clientReferenceManifest,\n setIsrStatus: routerServerContext?.setIsrStatus,\n\n dir: pageRouteModule.relativeProjectDir,\n botType,\n isDraftMode: false,\n isRevalidate: false,\n isOnDemandRevalidate,\n isPossibleServerAction,\n assetPrefix: nextConfig.assetPrefix,\n nextConfigOutput: nextConfig.output,\n crossOrigin: nextConfig.crossOrigin,\n trailingSlash: nextConfig.trailingSlash,\n previewProps: prerenderManifest.preview,\n deploymentId: nextConfig.deploymentId,\n enableTainting: nextConfig.experimental.taint,\n htmlLimitedBots: nextConfig.htmlLimitedBots,\n reactMaxHeadersLength: nextConfig.reactMaxHeadersLength,\n\n multiZoneDraftMode: false,\n cacheLifeProfiles: nextConfig.experimental.cacheLife,\n basePath: nextConfig.basePath,\n serverActions: nextConfig.experimental.serverActions,\n\n experimental: {\n isRoutePPREnabled: false,\n expireTime: nextConfig.expireTime,\n staleTimes: nextConfig.experimental.staleTimes,\n cacheComponents: Boolean(nextConfig.experimental.cacheComponents),\n clientSegmentCache: Boolean(nextConfig.experimental.clientSegmentCache),\n clientParamParsing: Boolean(nextConfig.experimental.clientParamParsing),\n dynamicOnHover: Boolean(nextConfig.experimental.dynamicOnHover),\n inlineCss: Boolean(nextConfig.experimental.inlineCss),\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts),\n clientTraceMetadata:\n nextConfig.experimental.clientTraceMetadata || ([] as any),\n clientParamParsingOrigins:\n nextConfig.experimental.clientParamParsingOrigins,\n },\n\n incrementalCache: await pageRouteModule.getIncrementalCache(\n baseReq,\n nextConfig,\n prerenderManifest\n ),\n\n waitUntil: event.waitUntil.bind(event),\n onClose: (cb) => {\n closeController.onClose(cb)\n },\n onAfterTaskError: () => {},\n\n onInstrumentationRequestError: (error, _request, errorContext) =>\n pageRouteModule.onRequestError(\n baseReq,\n error,\n errorContext,\n routerServerContext\n ),\n dev: pageRouteModule.isDev,\n },\n }\n let finalStatus = 200\n\n const renderResultToResponse = (\n result: RenderResult<AppPageRenderResultMetadata>\n ): Response => {\n const varyHeader = pageRouteModule.getVaryHeader(\n resolvedPathname,\n interceptionRoutePatterns\n )\n // Handle null responses\n if (result.isNull) {\n finalStatus = 500\n closeController.dispatchClose()\n return new Response(null, { status: 500 })\n }\n\n // Extract metadata\n const { metadata } = result\n const headers = new Headers()\n finalStatus = metadata.statusCode || baseRes.statusCode || 200\n // Pull any fetch metrics from the render onto the request.\n ;(req as any).fetchMetrics = metadata.fetchMetrics\n\n // Set content type\n const contentType = result.contentType || 'text/html; charset=utf-8'\n headers.set('Content-Type', contentType)\n headers.set('x-edge-runtime', '1')\n\n if (varyHeader) {\n headers.set('Vary', varyHeader)\n }\n\n // Add existing headers\n for (const [key, value] of Object.entries({\n ...baseRes.getHeaders(),\n ...metadata.headers,\n })) {\n if (value !== undefined) {\n if (Array.isArray(value)) {\n // Handle multiple header values\n for (const v of value) {\n headers.append(key, String(v))\n }\n } else {\n headers.set(key, String(value))\n }\n }\n }\n\n // Handle static response\n if (!result.isDynamic) {\n const body = result.toUnchunkedString()\n headers.set(\n 'Content-Length',\n String(new TextEncoder().encode(body).length)\n )\n closeController.dispatchClose()\n return new Response(body, {\n status: finalStatus,\n headers,\n })\n }\n\n // Handle dynamic/streaming response\n // For edge runtime, we need to create a readable stream that pipes from the result\n const { readable, writable } = new TransformStream()\n\n // Start piping the result to the writable stream\n // This is done asynchronously to avoid blocking the response creation\n result\n .pipeTo(writable)\n .catch((err: unknown) => {\n console.error('Error piping RenderResult to response:', err)\n })\n .finally(() => closeController.dispatchClose())\n\n return new Response(readable, {\n status: finalStatus,\n headers,\n })\n }\n\n const invokeRender = async (span?: Span): Promise<Response> => {\n try {\n const result = await pageRouteModule\n .render(baseReq, baseRes, renderContext)\n .finally(() => {\n if (!span) return\n\n span.setAttributes({\n 'http.status_code': finalStatus,\n 'next.rsc': false,\n })\n\n const rootSpanAttributes = tracer.getRootSpanAttributes()\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return\n }\n\n if (\n rootSpanAttributes.get('next.span_type') !==\n BaseServerSpan.handleRequest\n ) {\n console.warn(\n `Unexpected root span type '${rootSpanAttributes.get(\n 'next.span_type'\n )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n )\n return\n }\n\n const route = normalizedSrcPage\n if (route) {\n const name = `${req.method} ${route}`\n\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name,\n })\n span.updateName(name)\n } else {\n span.updateName(`${req.method}`)\n }\n })\n\n return renderResultToResponse(result)\n } catch (err) {\n await pageRouteModule.onRequestError(baseReq, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'render',\n revalidateReason: undefined,\n })\n // rethrow so that we can handle serving error page\n throw err\n }\n }\n\n const tracer = getTracer()\n\n return tracer.withPropagatedContext(req.headers, () =>\n tracer.trace(\n BaseServerSpan.handleRequest,\n {\n spanName: `${req.method}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': req.method,\n 'http.target': relativeUrl,\n 'http.route': normalizedSrcPage,\n },\n },\n invokeRender\n )\n )\n}\n\nexport default function nHandler(opts: { page: string; request: RequestData }) {\n return adapter({\n ...opts,\n IncrementalCache,\n handler: requestHandler,\n incrementalCacheHandler,\n })\n}\n"],"names":["ComponentMod","nHandler","self","initializeCacheHandlers","maybeJSONParse","str","JSON","parse","undefined","rscManifest","__RSC_MANIFEST","rscServerManifest","__RSC_SERVER_MANIFEST","setReferenceManifestsSingleton","page","clientReferenceManifest","serverActionsManifest","serverModuleMap","createServerModuleMap","pageMod","requestHandler","req","event","srcPage","normalizedSrcPage","normalizeAppPath","relativeUrl","nextUrl","pathname","search","baseReq","WebNextRequest","baseRes","WebNextResponse","pageRouteModule","routeModule","prepareResult","prepare","multiZoneDraftMode","Response","status","query","params","buildId","buildManifest","prerenderManifest","reactLoadableManifest","subresourceIntegrityManifest","dynamicCssManifest","nextFontManifest","resolvedPathname","interceptionRoutePatterns","routerServerContext","isPossibleServerAction","getIsPossibleServerAction","botType","getBotType","headers","get","isOnDemandRevalidate","checkIsOnDemandRevalidate","preview","closeController","CloseController","renderContext","sharedContext","fallbackRouteParams","renderOpts","App","Document","pageConfig","Component","interopDefault","postponed","shouldWaitOnAllReady","serveStreamingMetadata","supportsDynamicResponse","setIsrStatus","dir","relativeProjectDir","isDraftMode","isRevalidate","assetPrefix","nextConfig","nextConfigOutput","output","crossOrigin","trailingSlash","previewProps","deploymentId","enableTainting","experimental","taint","htmlLimitedBots","reactMaxHeadersLength","cacheLifeProfiles","cacheLife","basePath","serverActions","isRoutePPREnabled","expireTime","staleTimes","cacheComponents","Boolean","clientSegmentCache","clientParamParsing","dynamicOnHover","inlineCss","authInterrupts","clientTraceMetadata","clientParamParsingOrigins","incrementalCache","getIncrementalCache","waitUntil","bind","onClose","cb","onAfterTaskError","onInstrumentationRequestError","error","_request","errorContext","onRequestError","dev","isDev","finalStatus","renderResultToResponse","result","varyHeader","getVaryHeader","isNull","dispatchClose","metadata","Headers","statusCode","fetchMetrics","contentType","set","key","value","Object","entries","getHeaders","Array","isArray","v","append","String","isDynamic","body","toUnchunkedString","TextEncoder","encode","length","readable","writable","TransformStream","pipeTo","catch","err","console","finally","invokeRender","span","render","setAttributes","rootSpanAttributes","tracer","getRootSpanAttributes","BaseServerSpan","handleRequest","warn","route","name","method","updateName","routerKind","routePath","routeType","revalidateReason","getTracer","withPropagatedContext","trace","spanName","kind","SpanKind","SERVER","attributes","opts","adapter","IncrementalCache","handler","incrementalCacheHandler"],"mappings":";;;;;;;;;;;;;;;IAsDaA,YAAY;eAAZA;;IA6Sb,OAOC;eAPuBC;;;QAnWjB;yBACuC;kCACb;sEAER;iCAIsB;6BACT;0BACE;2BACT;wBACgB;qBACC;yCAQN;uBACf;gCACI;0BACE;0BACS;4BACV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAcZC;AAXpB,0CAA0C;AAE1C,2CA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AAS2L,IAA4C;IAC3E,OAAOC,IAAAA,gBAAO,EAAC;QACb,GAAGD,IAAI;QACPE,kBAAAA,kCAAgB;QAChBC,SAAS3K;QACT4K;IACF;AACF","ignoreList":[0]}
|
@@ -279,7 +279,7 @@ async function requestHandler(req, _event) {
|
|
279
279
|
});
|
280
280
|
span.updateName(name);
|
281
281
|
} else {
|
282
|
-
span.updateName(`${req.method}
|
282
|
+
span.updateName(`${req.method}`);
|
283
283
|
}
|
284
284
|
});
|
285
285
|
return renderResultToResponse(result);
|
@@ -312,7 +312,7 @@ async function requestHandler(req, _event) {
|
|
312
312
|
};
|
313
313
|
const tracer = (0, _tracer.getTracer)();
|
314
314
|
return tracer.withPropagatedContext(req.headers, ()=>tracer.trace(_constants.BaseServerSpan.handleRequest, {
|
315
|
-
spanName: `${req.method}
|
315
|
+
spanName: `${req.method}`,
|
316
316
|
kind: _tracer.SpanKind.SERVER,
|
317
317
|
attributes: {
|
318
318
|
'http.method': req.method,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/build/templates/edge-ssr.ts"],"sourcesContent":["import '../../server/web/globals'\nimport { adapter, type NextRequestHint } from '../../server/web/adapter'\nimport { IncrementalCache } from '../../server/lib/incremental-cache'\nimport { initializeCacheHandlers } from '../../server/use-cache/handlers'\n\nimport Document from 'VAR_MODULE_DOCUMENT'\nimport * as appMod from 'VAR_MODULE_APP'\nimport * as userlandPage from 'VAR_USERLAND'\nimport * as userlandErrorPage from 'VAR_MODULE_GLOBAL_ERROR'\n\ndeclare const userland500Page: any\ndeclare const incrementalCacheHandler: any\n// OPTIONAL_IMPORT:* as userland500Page\n// OPTIONAL_IMPORT:incrementalCacheHandler\n\nimport RouteModule, {\n type PagesRouteHandlerContext,\n} from '../../server/route-modules/pages/module'\nimport { WebNextRequest, WebNextResponse } from '../../server/base-http/web'\n\nimport type { RequestData } from '../../server/web/types'\nimport type { NextConfigComplete } from '../../server/config-shared'\nimport type { NextFetchEvent } from '../../server/web/spec-extension/fetch-event'\nimport type RenderResult from '../../server/render-result'\nimport type { RenderResultMetadata } from '../../server/render-result'\nimport { getTracer, SpanKind, type Span } from '../../server/lib/trace/tracer'\nimport { BaseServerSpan } from '../../server/lib/trace/constants'\nimport { HTML_CONTENT_TYPE_HEADER } from '../../lib/constants'\n\n// injected by the loader afterwards.\ndeclare const nextConfig: NextConfigComplete\ndeclare const pageRouteModuleOptions: any\ndeclare const errorRouteModuleOptions: any\ndeclare const user500RouteModuleOptions: any\n// INJECT:nextConfig\n// INJECT:pageRouteModuleOptions\n// INJECT:errorRouteModuleOptions\n// INJECT:user500RouteModuleOptions\n\n// Initialize the cache handlers interface.\ninitializeCacheHandlers()\n\n// expose this for the route-module\n;(globalThis as any).nextConfig = nextConfig\n\nconst pageMod = {\n ...userlandPage,\n routeModule: new RouteModule({\n ...pageRouteModuleOptions,\n components: {\n App: appMod.default,\n Document,\n },\n userland: userlandPage,\n }),\n}\n\nconst errorMod = {\n ...userlandErrorPage,\n routeModule: new RouteModule({\n ...errorRouteModuleOptions,\n components: {\n App: appMod.default,\n Document,\n },\n userland: userlandErrorPage,\n }),\n}\n\n// FIXME: this needs to be made compatible with the template\nconst error500Mod = userland500Page\n ? {\n ...userland500Page,\n routeModule: new RouteModule({\n ...user500RouteModuleOptions,\n components: {\n App: appMod.default,\n Document,\n },\n userland: userland500Page,\n }),\n }\n : null\n\nexport const ComponentMod = pageMod\n\nasync function requestHandler(\n req: NextRequestHint,\n _event: NextFetchEvent\n): Promise<Response> {\n let srcPage = 'VAR_PAGE'\n\n const relativeUrl = `${req.nextUrl.pathname}${req.nextUrl.search}`\n const baseReq = new WebNextRequest(req)\n const pageRouteModule = pageMod.routeModule as RouteModule\n const prepareResult = await pageRouteModule.prepare(baseReq, null, {\n srcPage,\n multiZoneDraftMode: false,\n })\n\n if (!prepareResult) {\n return new Response('Bad Request', {\n status: 400,\n })\n }\n const {\n query,\n params,\n buildId,\n isNextDataRequest,\n buildManifest,\n prerenderManifest,\n reactLoadableManifest,\n clientReferenceManifest,\n subresourceIntegrityManifest,\n dynamicCssManifest,\n } = prepareResult\n\n const renderContext: PagesRouteHandlerContext = {\n page: srcPage,\n query,\n params,\n\n sharedContext: {\n buildId,\n deploymentId: process.env.NEXT_DEPLOYMENT_ID,\n customServer: undefined,\n },\n\n renderContext: {\n isFallback: false,\n isDraftMode: false,\n developmentNotFoundSourcePage: undefined,\n },\n\n renderOpts: {\n params,\n page: srcPage,\n supportsDynamicResponse: true,\n Component: pageMod.Component,\n ComponentMod: pageMod,\n pageConfig: pageMod.pageConfig,\n routeModule: pageMod.routeModule,\n canonicalBase: nextConfig.amp.canonicalBase || '',\n previewProps: prerenderManifest.preview,\n ampOptimizerConfig: nextConfig.experimental.amp?.optimizer,\n basePath: nextConfig.basePath,\n assetPrefix: nextConfig.assetPrefix,\n images: nextConfig.images,\n optimizeCss: nextConfig.experimental.optimizeCss,\n nextConfigOutput: nextConfig.output,\n nextScriptWorkers: nextConfig.experimental.nextScriptWorkers,\n disableOptimizedLoading: nextConfig.experimental.disableOptimizedLoading,\n domainLocales: nextConfig.i18n?.domains,\n distDir: '',\n crossOrigin: nextConfig.crossOrigin ? nextConfig.crossOrigin : undefined,\n largePageDataBytes: nextConfig.experimental.largePageDataBytes,\n // Only the `publicRuntimeConfig` key is exposed to the client side\n // It'll be rendered as part of __NEXT_DATA__ on the client side\n runtimeConfig:\n Object.keys(nextConfig.publicRuntimeConfig).length > 0\n ? nextConfig.publicRuntimeConfig\n : undefined,\n\n isExperimentalCompile: nextConfig.experimental.isExperimentalCompile,\n // `htmlLimitedBots` is passed to server as serialized config in string format\n experimental: {\n clientTraceMetadata: nextConfig.experimental.clientTraceMetadata,\n },\n\n buildManifest,\n subresourceIntegrityManifest,\n reactLoadableManifest,\n clientReferenceManifest,\n dynamicCssManifest,\n },\n }\n let finalStatus = 200\n\n const renderResultToResponse = (\n result: RenderResult<RenderResultMetadata>\n ): Response => {\n // Handle null responses\n if (result.isNull) {\n finalStatus = 500\n return new Response(null, { status: 500 })\n }\n\n // Extract metadata\n const { metadata } = result\n finalStatus = metadata.statusCode || 200\n const headers = new Headers()\n\n // Set content type\n const contentType = result.contentType || HTML_CONTENT_TYPE_HEADER\n headers.set('Content-Type', contentType)\n\n // Add metadata headers\n if (metadata.headers) {\n for (const [key, value] of Object.entries(metadata.headers)) {\n if (value !== undefined) {\n if (Array.isArray(value)) {\n // Handle multiple header values\n for (const v of value) {\n headers.append(key, String(v))\n }\n } else {\n headers.set(key, String(value))\n }\n }\n }\n }\n\n // Handle static response\n if (!result.isDynamic) {\n const body = result.toUnchunkedString()\n headers.set(\n 'Content-Length',\n String(new TextEncoder().encode(body).length)\n )\n return new Response(body, {\n status: finalStatus,\n headers,\n })\n }\n\n // Handle dynamic/streaming response\n // For edge runtime, we need to create a readable stream that pipes from the result\n const { readable, writable } = new TransformStream()\n\n // Start piping the result to the writable stream\n // This is done asynchronously to avoid blocking the response creation\n result.pipeTo(writable).catch((err) => {\n console.error('Error piping RenderResult to response:', err)\n })\n\n return new Response(readable, {\n status: finalStatus,\n headers,\n })\n }\n\n const invokeRender = async (span?: Span): Promise<Response> => {\n try {\n const result = await pageRouteModule\n .render(\n // @ts-expect-error we don't type this for edge\n baseReq,\n new WebNextResponse(undefined),\n {\n ...renderContext,\n renderOpts: {\n ...renderContext.renderOpts,\n getServerSideProps: pageMod.getServerSideProps,\n Component: pageMod.default || pageMod,\n ComponentMod: pageMod,\n pageConfig: pageMod.config,\n isNextDataRequest,\n },\n }\n )\n .finally(() => {\n if (!span) return\n\n span.setAttributes({\n 'http.status_code': finalStatus,\n 'next.rsc': false,\n })\n\n const rootSpanAttributes = tracer.getRootSpanAttributes()\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return\n }\n\n if (\n rootSpanAttributes.get('next.span_type') !==\n BaseServerSpan.handleRequest\n ) {\n console.warn(\n `Unexpected root span type '${rootSpanAttributes.get(\n 'next.span_type'\n )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n )\n return\n }\n\n const route = rootSpanAttributes.get('next.route')\n if (route) {\n const name = `${req.method} ${route}`\n\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name,\n })\n span.updateName(name)\n } else {\n span.updateName(`${req.method} ${relativeUrl}`)\n }\n })\n\n return renderResultToResponse(result)\n } catch (err) {\n const errModule = error500Mod || errorMod\n const errRouteModule = errModule.routeModule as RouteModule\n\n if (errRouteModule.isDev) {\n throw err\n }\n\n await errRouteModule.onRequestError(baseReq, err, {\n routerKind: 'Pages Router',\n routePath: srcPage,\n routeType: 'render',\n revalidateReason: undefined,\n })\n\n const errResult = await errRouteModule.render(\n // @ts-expect-error we don't type this for edge\n baseReq,\n new WebNextResponse(undefined),\n {\n ...renderContext,\n page: error500Mod ? '/500' : '/_error',\n renderOpts: {\n ...renderContext.renderOpts,\n getServerSideProps: errModule.getServerSideProps,\n Component: errModule.default || errModule,\n ComponentMod: errModule,\n pageConfig: errModule.config,\n },\n }\n )\n\n return renderResultToResponse(errResult)\n }\n }\n\n const tracer = getTracer()\n\n return tracer.withPropagatedContext(req.headers, () =>\n tracer.trace(\n BaseServerSpan.handleRequest,\n {\n spanName: `${req.method} ${relativeUrl}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': req.method,\n 'http.target': relativeUrl,\n 'http.route': srcPage,\n },\n },\n invokeRender\n )\n )\n}\n\nexport default function nHandler(opts: { page: string; request: RequestData }) {\n return adapter({\n ...opts,\n IncrementalCache,\n handler: requestHandler,\n incrementalCacheHandler,\n bypassNextUrl: true,\n })\n}\n"],"names":["ComponentMod","nHandler","initializeCacheHandlers","globalThis","nextConfig","pageMod","userlandPage","routeModule","RouteModule","pageRouteModuleOptions","components","App","appMod","default","Document","userland","errorMod","userlandErrorPage","errorRouteModuleOptions","error500Mod","userland500Page","user500RouteModuleOptions","requestHandler","req","_event","srcPage","relativeUrl","nextUrl","pathname","search","baseReq","WebNextRequest","pageRouteModule","prepareResult","prepare","multiZoneDraftMode","Response","status","query","params","buildId","isNextDataRequest","buildManifest","prerenderManifest","reactLoadableManifest","clientReferenceManifest","subresourceIntegrityManifest","dynamicCssManifest","renderContext","page","sharedContext","deploymentId","process","env","NEXT_DEPLOYMENT_ID","customServer","undefined","isFallback","isDraftMode","developmentNotFoundSourcePage","renderOpts","supportsDynamicResponse","Component","pageConfig","canonicalBase","amp","previewProps","preview","ampOptimizerConfig","experimental","optimizer","basePath","assetPrefix","images","optimizeCss","nextConfigOutput","output","nextScriptWorkers","disableOptimizedLoading","domainLocales","i18n","domains","distDir","crossOrigin","largePageDataBytes","runtimeConfig","Object","keys","publicRuntimeConfig","length","isExperimentalCompile","clientTraceMetadata","finalStatus","renderResultToResponse","result","isNull","metadata","statusCode","headers","Headers","contentType","HTML_CONTENT_TYPE_HEADER","set","key","value","entries","Array","isArray","v","append","String","isDynamic","body","toUnchunkedString","TextEncoder","encode","readable","writable","TransformStream","pipeTo","catch","err","console","error","invokeRender","span","render","WebNextResponse","getServerSideProps","config","finally","setAttributes","rootSpanAttributes","tracer","getRootSpanAttributes","get","BaseServerSpan","handleRequest","warn","route","name","method","updateName","errModule","errRouteModule","isDev","onRequestError","routerKind","routePath","routeType","revalidateReason","errResult","getTracer","withPropagatedContext","trace","spanName","kind","SpanKind","SERVER","attributes","opts","adapter","IncrementalCache","handler","incrementalCacheHandler","bypassNextUrl"],"mappings":";;;;;;;;;;;;;;;IAoFaA,YAAY;eAAZA;;IAkRb,OAQC;eARuBC;;;QAtWjB;yBACuC;kCACb;0BACO;4EAEnB;wEACG;sEACM;iFACK;+DAS5B;qBACyC;wBAOD;2BAChB;4BACU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOzC,oBAAoB;AACpB,gCAAgC;AAChC,iCAAiC;AACjC,mCAAmC;AAEnC,2CAA2C;AAC3CC,IAAAA,iCAAuB;AAGrBC,WAAmBC,UAAU,GAAGA;AAElC,MAAMC,UAAU;IACd,GAA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BD,UAAUxI,WAAW;YAE5C,IAAIyI,eAAeC,KAAK,EAAE;gBACxB,MAAMxB;YACR;YAEA,MAAMuB,eAAeE,cAAc,CAACpH,SAAS2F,KAAK;gBAChD0B,YAAY;gBACZC,WAAW3H;gBACX4H,WAAW;gBACXC,kBAAkB9F;YACpB;YAEA,MAAM+F,YAAY,MAAMP,eAAelB,MAAM,CAC3C,+CAA+C;YAC/ChG,SACA,IAAIiG,oBAAe,CAACvE,YACpB;gBACE,GAAGR,aAAa;gBAChBC,MAAM9B,cAAc,SAAS;gBAC7ByC,YAAY;oBACV,GAAGZ,cAAcY,UAAU;oBAC3BoE,oBAAoBe,UAAUf,kBAAkB;oBAChDlE,WAAWiF,UAAUlI,OAAO,IAAIkI;oBAChC/I,cAAc+I;oBACdhF,YAAYgF,UAAUd,MAAM;gBAC9B;YACF;YAGF,OAAOpC,uBAAuB0D;QAChC;IACF;IAEA,MAAMlB,SAASmB,IAAAA,iBAAS;IAExB,OAAOnB,OAAOoB,qBAAqB,CAAClI,IAAI2E,OAAO,EAAE,IAC/CmC,OAAOqB,KAAK,CACVlB,yBAAc,CAACC,aAAa,EAC5B;YACEkB,UAAU,GAAGpI,IAAIsH,MAAM,CAAC,CAAC,EAAEnH,aAAa;YACxCkI,MAAMC,gBAAQ,CAACC,MAAM;YACrBC,YAAY;gBACV,eAAexI,IAAIsH,MAAM;gBACzB,eAAenH;gBACf,cAAcD;YAChB;QACF,GACAmG;AAGN;AAEe,SAAS3H,SAAS+J,IAA4C;IAC3E,OAAOC,IAAAA,gBAAO,EAAC;QACb,GAAGD,IAAI;QACPE,kBAAAA,kCAAgB;QAChBC,SAAS7I;QACT8I;QACAC,eAAe;IACjB;AACF","ignoreList":[0]}
|
1
|
+
{"version":3,"sources":["../../../src/build/templates/edge-ssr.ts"],"sourcesContent":["import '../../server/web/globals'\nimport { adapter, type NextRequestHint } from '../../server/web/adapter'\nimport { IncrementalCache } from '../../server/lib/incremental-cache'\nimport { initializeCacheHandlers } from '../../server/use-cache/handlers'\n\nimport Document from 'VAR_MODULE_DOCUMENT'\nimport * as appMod from 'VAR_MODULE_APP'\nimport * as userlandPage from 'VAR_USERLAND'\nimport * as userlandErrorPage from 'VAR_MODULE_GLOBAL_ERROR'\n\ndeclare const userland500Page: any\ndeclare const incrementalCacheHandler: any\n// OPTIONAL_IMPORT:* as userland500Page\n// OPTIONAL_IMPORT:incrementalCacheHandler\n\nimport RouteModule, {\n type PagesRouteHandlerContext,\n} from '../../server/route-modules/pages/module'\nimport { WebNextRequest, WebNextResponse } from '../../server/base-http/web'\n\nimport type { RequestData } from '../../server/web/types'\nimport type { NextConfigComplete } from '../../server/config-shared'\nimport type { NextFetchEvent } from '../../server/web/spec-extension/fetch-event'\nimport type RenderResult from '../../server/render-result'\nimport type { RenderResultMetadata } from '../../server/render-result'\nimport { getTracer, SpanKind, type Span } from '../../server/lib/trace/tracer'\nimport { BaseServerSpan } from '../../server/lib/trace/constants'\nimport { HTML_CONTENT_TYPE_HEADER } from '../../lib/constants'\n\n// injected by the loader afterwards.\ndeclare const nextConfig: NextConfigComplete\ndeclare const pageRouteModuleOptions: any\ndeclare const errorRouteModuleOptions: any\ndeclare const user500RouteModuleOptions: any\n// INJECT:nextConfig\n// INJECT:pageRouteModuleOptions\n// INJECT:errorRouteModuleOptions\n// INJECT:user500RouteModuleOptions\n\n// Initialize the cache handlers interface.\ninitializeCacheHandlers()\n\n// expose this for the route-module\n;(globalThis as any).nextConfig = nextConfig\n\nconst pageMod = {\n ...userlandPage,\n routeModule: new RouteModule({\n ...pageRouteModuleOptions,\n components: {\n App: appMod.default,\n Document,\n },\n userland: userlandPage,\n }),\n}\n\nconst errorMod = {\n ...userlandErrorPage,\n routeModule: new RouteModule({\n ...errorRouteModuleOptions,\n components: {\n App: appMod.default,\n Document,\n },\n userland: userlandErrorPage,\n }),\n}\n\n// FIXME: this needs to be made compatible with the template\nconst error500Mod = userland500Page\n ? {\n ...userland500Page,\n routeModule: new RouteModule({\n ...user500RouteModuleOptions,\n components: {\n App: appMod.default,\n Document,\n },\n userland: userland500Page,\n }),\n }\n : null\n\nexport const ComponentMod = pageMod\n\nasync function requestHandler(\n req: NextRequestHint,\n _event: NextFetchEvent\n): Promise<Response> {\n let srcPage = 'VAR_PAGE'\n\n const relativeUrl = `${req.nextUrl.pathname}${req.nextUrl.search}`\n const baseReq = new WebNextRequest(req)\n const pageRouteModule = pageMod.routeModule as RouteModule\n const prepareResult = await pageRouteModule.prepare(baseReq, null, {\n srcPage,\n multiZoneDraftMode: false,\n })\n\n if (!prepareResult) {\n return new Response('Bad Request', {\n status: 400,\n })\n }\n const {\n query,\n params,\n buildId,\n isNextDataRequest,\n buildManifest,\n prerenderManifest,\n reactLoadableManifest,\n clientReferenceManifest,\n subresourceIntegrityManifest,\n dynamicCssManifest,\n } = prepareResult\n\n const renderContext: PagesRouteHandlerContext = {\n page: srcPage,\n query,\n params,\n\n sharedContext: {\n buildId,\n deploymentId: process.env.NEXT_DEPLOYMENT_ID,\n customServer: undefined,\n },\n\n renderContext: {\n isFallback: false,\n isDraftMode: false,\n developmentNotFoundSourcePage: undefined,\n },\n\n renderOpts: {\n params,\n page: srcPage,\n supportsDynamicResponse: true,\n Component: pageMod.Component,\n ComponentMod: pageMod,\n pageConfig: pageMod.pageConfig,\n routeModule: pageMod.routeModule,\n canonicalBase: nextConfig.amp.canonicalBase || '',\n previewProps: prerenderManifest.preview,\n ampOptimizerConfig: nextConfig.experimental.amp?.optimizer,\n basePath: nextConfig.basePath,\n assetPrefix: nextConfig.assetPrefix,\n images: nextConfig.images,\n optimizeCss: nextConfig.experimental.optimizeCss,\n nextConfigOutput: nextConfig.output,\n nextScriptWorkers: nextConfig.experimental.nextScriptWorkers,\n disableOptimizedLoading: nextConfig.experimental.disableOptimizedLoading,\n domainLocales: nextConfig.i18n?.domains,\n distDir: '',\n crossOrigin: nextConfig.crossOrigin ? nextConfig.crossOrigin : undefined,\n largePageDataBytes: nextConfig.experimental.largePageDataBytes,\n // Only the `publicRuntimeConfig` key is exposed to the client side\n // It'll be rendered as part of __NEXT_DATA__ on the client side\n runtimeConfig:\n Object.keys(nextConfig.publicRuntimeConfig).length > 0\n ? nextConfig.publicRuntimeConfig\n : undefined,\n\n isExperimentalCompile: nextConfig.experimental.isExperimentalCompile,\n // `htmlLimitedBots` is passed to server as serialized config in string format\n experimental: {\n clientTraceMetadata: nextConfig.experimental.clientTraceMetadata,\n },\n\n buildManifest,\n subresourceIntegrityManifest,\n reactLoadableManifest,\n clientReferenceManifest,\n dynamicCssManifest,\n },\n }\n let finalStatus = 200\n\n const renderResultToResponse = (\n result: RenderResult<RenderResultMetadata>\n ): Response => {\n // Handle null responses\n if (result.isNull) {\n finalStatus = 500\n return new Response(null, { status: 500 })\n }\n\n // Extract metadata\n const { metadata } = result\n finalStatus = metadata.statusCode || 200\n const headers = new Headers()\n\n // Set content type\n const contentType = result.contentType || HTML_CONTENT_TYPE_HEADER\n headers.set('Content-Type', contentType)\n\n // Add metadata headers\n if (metadata.headers) {\n for (const [key, value] of Object.entries(metadata.headers)) {\n if (value !== undefined) {\n if (Array.isArray(value)) {\n // Handle multiple header values\n for (const v of value) {\n headers.append(key, String(v))\n }\n } else {\n headers.set(key, String(value))\n }\n }\n }\n }\n\n // Handle static response\n if (!result.isDynamic) {\n const body = result.toUnchunkedString()\n headers.set(\n 'Content-Length',\n String(new TextEncoder().encode(body).length)\n )\n return new Response(body, {\n status: finalStatus,\n headers,\n })\n }\n\n // Handle dynamic/streaming response\n // For edge runtime, we need to create a readable stream that pipes from the result\n const { readable, writable } = new TransformStream()\n\n // Start piping the result to the writable stream\n // This is done asynchronously to avoid blocking the response creation\n result.pipeTo(writable).catch((err) => {\n console.error('Error piping RenderResult to response:', err)\n })\n\n return new Response(readable, {\n status: finalStatus,\n headers,\n })\n }\n\n const invokeRender = async (span?: Span): Promise<Response> => {\n try {\n const result = await pageRouteModule\n .render(\n // @ts-expect-error we don't type this for edge\n baseReq,\n new WebNextResponse(undefined),\n {\n ...renderContext,\n renderOpts: {\n ...renderContext.renderOpts,\n getServerSideProps: pageMod.getServerSideProps,\n Component: pageMod.default || pageMod,\n ComponentMod: pageMod,\n pageConfig: pageMod.config,\n isNextDataRequest,\n },\n }\n )\n .finally(() => {\n if (!span) return\n\n span.setAttributes({\n 'http.status_code': finalStatus,\n 'next.rsc': false,\n })\n\n const rootSpanAttributes = tracer.getRootSpanAttributes()\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return\n }\n\n if (\n rootSpanAttributes.get('next.span_type') !==\n BaseServerSpan.handleRequest\n ) {\n console.warn(\n `Unexpected root span type '${rootSpanAttributes.get(\n 'next.span_type'\n )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n )\n return\n }\n\n const route = rootSpanAttributes.get('next.route')\n if (route) {\n const name = `${req.method} ${route}`\n\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name,\n })\n span.updateName(name)\n } else {\n span.updateName(`${req.method}`)\n }\n })\n\n return renderResultToResponse(result)\n } catch (err) {\n const errModule = error500Mod || errorMod\n const errRouteModule = errModule.routeModule as RouteModule\n\n if (errRouteModule.isDev) {\n throw err\n }\n\n await errRouteModule.onRequestError(baseReq, err, {\n routerKind: 'Pages Router',\n routePath: srcPage,\n routeType: 'render',\n revalidateReason: undefined,\n })\n\n const errResult = await errRouteModule.render(\n // @ts-expect-error we don't type this for edge\n baseReq,\n new WebNextResponse(undefined),\n {\n ...renderContext,\n page: error500Mod ? '/500' : '/_error',\n renderOpts: {\n ...renderContext.renderOpts,\n getServerSideProps: errModule.getServerSideProps,\n Component: errModule.default || errModule,\n ComponentMod: errModule,\n pageConfig: errModule.config,\n },\n }\n )\n\n return renderResultToResponse(errResult)\n }\n }\n\n const tracer = getTracer()\n\n return tracer.withPropagatedContext(req.headers, () =>\n tracer.trace(\n BaseServerSpan.handleRequest,\n {\n spanName: `${req.method}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': req.method,\n 'http.target': relativeUrl,\n 'http.route': srcPage,\n },\n },\n invokeRender\n )\n )\n}\n\nexport default function nHandler(opts: { page: string; request: RequestData }) {\n return adapter({\n ...opts,\n IncrementalCache,\n handler: requestHandler,\n incrementalCacheHandler,\n bypassNextUrl: true,\n })\n}\n"],"names":["ComponentMod","nHandler","initializeCacheHandlers","globalThis","nextConfig","pageMod","userlandPage","routeModule","RouteModule","pageRouteModuleOptions","components","App","appMod","default","Document","userland","errorMod","userlandErrorPage","errorRouteModuleOptions","error500Mod","userland500Page","user500RouteModuleOptions","requestHandler","req","_event","srcPage","relativeUrl","nextUrl","pathname","search","baseReq","WebNextRequest","pageRouteModule","prepareResult","prepare","multiZoneDraftMode","Response","status","query","params","buildId","isNextDataRequest","buildManifest","prerenderManifest","reactLoadableManifest","clientReferenceManifest","subresourceIntegrityManifest","dynamicCssManifest","renderContext","page","sharedContext","deploymentId","process","env","NEXT_DEPLOYMENT_ID","customServer","undefined","isFallback","isDraftMode","developmentNotFoundSourcePage","renderOpts","supportsDynamicResponse","Component","pageConfig","canonicalBase","amp","previewProps","preview","ampOptimizerConfig","experimental","optimizer","basePath","assetPrefix","images","optimizeCss","nextConfigOutput","output","nextScriptWorkers","disableOptimizedLoading","domainLocales","i18n","domains","distDir","crossOrigin","largePageDataBytes","runtimeConfig","Object","keys","publicRuntimeConfig","length","isExperimentalCompile","clientTraceMetadata","finalStatus","renderResultToResponse","result","isNull","metadata","statusCode","headers","Headers","contentType","HTML_CONTENT_TYPE_HEADER","set","key","value","entries","Array","isArray","v","append","String","isDynamic","body","toUnchunkedString","TextEncoder","encode","readable","writable","TransformStream","pipeTo","catch","err","console","error","invokeRender","span","render","WebNextResponse","getServerSideProps","config","finally","setAttributes","rootSpanAttributes","tracer","getRootSpanAttributes","get","BaseServerSpan","handleRequest","warn","route","name","method","updateName","errModule","errRouteModule","isDev","onRequestError","routerKind","routePath","routeType","revalidateReason","errResult","getTracer","withPropagatedContext","trace","spanName","kind","SpanKind","SERVER","attributes","opts","adapter","IncrementalCache","handler","incrementalCacheHandler","bypassNextUrl"],"mappings":";;;;;;;;;;;;;;;IAoFaA,YAAY;eAAZA;;IAkRb,OAQC;eARuBC;;;QAtWjB;yBACuC;kCACb;0BACO;4EAEnB;wEACG;sEACM;iFACK;+DAS5B;qBACyC;wBAOD;2BAChB;4BACU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOzC,oBAAoB;AACpB,gCAAgC;AAChC,iCAAiC;AACjC,mCAAmC;AAEnC,2CAA2C;AAC3CC,IAAAA,iCAAuB;AAGrBC,WAAmBC,UAAU,GAAGA;AAElC,MAAMC,UAAU;IACd,GAAGC,aAAY;IACfC,aAAa,IAAIC,eAAW,CAAC;QAC3B,GAAGC,sBAAsB;QACzBC,YAAY;YACVC,KAAKC,gBAAOC,OAAO;YACnBC,UAAAA,4BAAQ;QACV;QACAC,UAAUT;IACZ;AACF;AAEA,MAAMU,WAAW;IACf,GAAGC,wBAAiB;IACpBV,aAAa,IAAIC,eAAW,CAAC;QAC3B,GAAGU,uBAAuB;QAC1BR,YAAY;YACVC,KAAKC,gBAAOC,OAAO;YACnBC,UAAAA,4BAAQ;QACV;QACAC,UAAUE;IACZ;AACF;AAEA,4DAA4D;AAC5D,MAAME,cAAcC,kBAChB;IACE,GAAGA,eAAe;IAClBb,aAAa,IAAIC,eAAW,CAAC;QAC3B,GAAGa,yBAAyB;QAC5BX,YAAY;YACVC,KAAKC,gBAAOC,OAAO;YACnBC,UAAAA,4BAAQ;QACV;QACAC,UAAUK;IACZ;AACF,IACA;AAEG,MAAMpB,eAAeK;AAE5B,eAAeiB,eACbC,GAAoB,EACpBC,MAAsB;QAyDEpB,8BAQLA;IA/DnB,IAAIqB,UAAU;IAEd,MAAMC,cAAc,GAAGH,IAAII,OAAO,CAACC,QAAQ,GAAGL,IAAII,OAAO,CAACE,MAAM,EAAE;IAClE,MAAMC,UAAU,IAAIC,mBAAc,CAACR;IACnC,MAAMS,kBA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BACzB,eAAenH;gBACf,cAAcD;YAChB;QACF,GACAmG;AAGN;AAEe,SAAS3H,SAAS+J,IAA4C;IAC3E,OAAOC,IAAAA,gBAAO,EAAC;QACb,GAAGD,IAAI;QACPE,kBAAAA,kCAAgB;QAChBC,SAAS7I;QACT8I;QACAC,eAAe;IACjB;AACF","ignoreList":[0]}
|
@@ -154,7 +154,7 @@ async function handler(req, res, ctx) {
|
|
154
154
|
});
|
155
155
|
span.updateName(name);
|
156
156
|
} else {
|
157
|
-
span.updateName(`${method}
|
157
|
+
span.updateName(`${method}`);
|
158
158
|
}
|
159
159
|
});
|
160
160
|
// TODO: activeSpan code path is for when wrapped by
|
@@ -163,7 +163,7 @@ async function handler(req, res, ctx) {
|
|
163
163
|
await invokeRouteModule(activeSpan);
|
164
164
|
} else {
|
165
165
|
await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(_constants.BaseServerSpan.handleRequest, {
|
166
|
-
spanName: `${method}
|
166
|
+
spanName: `${method}`,
|
167
167
|
kind: _tracer.SpanKind.SERVER,
|
168
168
|
attributes: {
|
169
169
|
'http.method': method,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/build/templates/pages-api.ts"],"sourcesContent":["import type { NextApiResponse } from '../../types'\nimport type { IncomingMessage, ServerResponse } from 'node:http'\n\nimport { sendError } from '../../server/api-utils'\nimport { RouteKind } from '../../server/route-kind'\nimport type { Span } from '../../server/lib/trace/tracer'\nimport { PagesAPIRouteModule } from '../../server/route-modules/pages-api/module.compiled'\n\nimport { hoist } from './helpers'\n\n// Import the userland code.\nimport * as userland from 'VAR_USERLAND'\nimport { getTracer, SpanKind } from '../../server/lib/trace/tracer'\nimport { BaseServerSpan } from '../../server/lib/trace/constants'\nimport type { InstrumentationOnRequestError } from '../../server/instrumentation/types'\n\n// Re-export the handler (should be the default export).\nexport default hoist(userland, 'default')\n\n// Re-export config.\nexport const config = hoist(userland, 'config')\n\n// Create and export the route module that will be consumed.\nconst routeModule = new PagesAPIRouteModule({\n definition: {\n kind: RouteKind.PAGES_API,\n page: 'VAR_DEFINITION_PAGE',\n pathname: 'VAR_DEFINITION_PATHNAME',\n // The following aren't used in production.\n bundlePath: '',\n filename: '',\n },\n userland,\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n})\n\nexport async function handler(\n req: IncomingMessage,\n res: ServerResponse,\n ctx: {\n waitUntil?: (prom: Promise<void>) => void\n }\n): Promise<void> {\n let srcPage = 'VAR_DEFINITION_PAGE'\n\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/'\n }\n\n const prepareResult = await routeModule.prepare(req, res, { srcPage })\n\n if (!prepareResult) {\n res.statusCode = 400\n res.end('Bad Request')\n ctx.waitUntil?.(Promise.resolve())\n return\n }\n\n const { query, params, prerenderManifest, routerServerContext } =\n prepareResult\n\n try {\n const method = req.method || 'GET'\n const tracer = getTracer()\n\n const activeSpan = tracer.getActiveScopeSpan()\n const onRequestError =\n routeModule.instrumentationOnRequestError.bind(routeModule)\n\n const invokeRouteModule = async (span?: Span) =>\n routeModule\n .render(req, res, {\n query: {\n ...query,\n ...params,\n },\n params,\n allowedRevalidateHeaderKeys: process.env\n .__NEXT_ALLOWED_REVALIDATE_HEADERS as any as string[],\n multiZoneDraftMode: Boolean(process.env.__NEXT_MULTI_ZONE_DRAFT_MODE),\n trustHostHeader: process.env\n .__NEXT_TRUST_HOST_HEADER as any as boolean,\n // TODO: get this from from runtime env so manifest\n // doesn't need to load\n previewProps: prerenderManifest.preview,\n propagateError: false,\n dev: routeModule.isDev,\n page: 'VAR_DEFINITION_PAGE',\n\n internalRevalidate: routerServerContext?.revalidate,\n\n onError: (...args: Parameters<InstrumentationOnRequestError>) =>\n onRequestError(req, ...args),\n })\n .finally(() => {\n if (!span) return\n\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false,\n })\n\n const rootSpanAttributes = tracer.getRootSpanAttributes()\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return\n }\n\n if (\n rootSpanAttributes.get('next.span_type') !==\n BaseServerSpan.handleRequest\n ) {\n console.warn(\n `Unexpected root span type '${rootSpanAttributes.get(\n 'next.span_type'\n )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n )\n return\n }\n\n const route = rootSpanAttributes.get('next.route')\n if (route) {\n const name = `${method} ${route}`\n\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name,\n })\n span.updateName(name)\n } else {\n span.updateName(`${method}
|
1
|
+
{"version":3,"sources":["../../../src/build/templates/pages-api.ts"],"sourcesContent":["import type { NextApiResponse } from '../../types'\nimport type { IncomingMessage, ServerResponse } from 'node:http'\n\nimport { sendError } from '../../server/api-utils'\nimport { RouteKind } from '../../server/route-kind'\nimport type { Span } from '../../server/lib/trace/tracer'\nimport { PagesAPIRouteModule } from '../../server/route-modules/pages-api/module.compiled'\n\nimport { hoist } from './helpers'\n\n// Import the userland code.\nimport * as userland from 'VAR_USERLAND'\nimport { getTracer, SpanKind } from '../../server/lib/trace/tracer'\nimport { BaseServerSpan } from '../../server/lib/trace/constants'\nimport type { InstrumentationOnRequestError } from '../../server/instrumentation/types'\n\n// Re-export the handler (should be the default export).\nexport default hoist(userland, 'default')\n\n// Re-export config.\nexport const config = hoist(userland, 'config')\n\n// Create and export the route module that will be consumed.\nconst routeModule = new PagesAPIRouteModule({\n definition: {\n kind: RouteKind.PAGES_API,\n page: 'VAR_DEFINITION_PAGE',\n pathname: 'VAR_DEFINITION_PATHNAME',\n // The following aren't used in production.\n bundlePath: '',\n filename: '',\n },\n userland,\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n})\n\nexport async function handler(\n req: IncomingMessage,\n res: ServerResponse,\n ctx: {\n waitUntil?: (prom: Promise<void>) => void\n }\n): Promise<void> {\n let srcPage = 'VAR_DEFINITION_PAGE'\n\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/'\n }\n\n const prepareResult = await routeModule.prepare(req, res, { srcPage })\n\n if (!prepareResult) {\n res.statusCode = 400\n res.end('Bad Request')\n ctx.waitUntil?.(Promise.resolve())\n return\n }\n\n const { query, params, prerenderManifest, routerServerContext } =\n prepareResult\n\n try {\n const method = req.method || 'GET'\n const tracer = getTracer()\n\n const activeSpan = tracer.getActiveScopeSpan()\n const onRequestError =\n routeModule.instrumentationOnRequestError.bind(routeModule)\n\n const invokeRouteModule = async (span?: Span) =>\n routeModule\n .render(req, res, {\n query: {\n ...query,\n ...params,\n },\n params,\n allowedRevalidateHeaderKeys: process.env\n .__NEXT_ALLOWED_REVALIDATE_HEADERS as any as string[],\n multiZoneDraftMode: Boolean(process.env.__NEXT_MULTI_ZONE_DRAFT_MODE),\n trustHostHeader: process.env\n .__NEXT_TRUST_HOST_HEADER as any as boolean,\n // TODO: get this from from runtime env so manifest\n // doesn't need to load\n previewProps: prerenderManifest.preview,\n propagateError: false,\n dev: routeModule.isDev,\n page: 'VAR_DEFINITION_PAGE',\n\n internalRevalidate: routerServerContext?.revalidate,\n\n onError: (...args: Parameters<InstrumentationOnRequestError>) =>\n onRequestError(req, ...args),\n })\n .finally(() => {\n if (!span) return\n\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false,\n })\n\n const rootSpanAttributes = tracer.getRootSpanAttributes()\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return\n }\n\n if (\n rootSpanAttributes.get('next.span_type') !==\n BaseServerSpan.handleRequest\n ) {\n console.warn(\n `Unexpected root span type '${rootSpanAttributes.get(\n 'next.span_type'\n )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n )\n return\n }\n\n const route = rootSpanAttributes.get('next.route')\n if (route) {\n const name = `${method} ${route}`\n\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name,\n })\n span.updateName(name)\n } else {\n span.updateName(`${method}`)\n }\n })\n\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await invokeRouteModule(activeSpan)\n } else {\n await tracer.withPropagatedContext(req.headers, () =>\n tracer.trace(\n BaseServerSpan.handleRequest,\n {\n spanName: `${method}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url,\n },\n },\n invokeRouteModule\n )\n )\n }\n } catch (err) {\n // we re-throw in dev to show the error overlay\n if (routeModule.isDev) {\n throw err\n }\n // this is technically an invariant as error handling\n // should be done inside of api-resolver onError\n sendError(res as NextApiResponse, 500, 'Internal Server Error')\n } finally {\n // We don't allow any waitUntil work in pages API routes currently\n // so if callback is present return with resolved promise since no\n // pending work\n ctx.waitUntil?.(Promise.resolve())\n }\n}\n"],"names":["config","handler","hoist","userland","routeModule","PagesAPIRouteModule","definition","kind","RouteKind","PAGES_API","page","pathname","bundlePath","filename","distDir","process","env","__NEXT_RELATIVE_DIST_DIR","relativeProjectDir","__NEXT_RELATIVE_PROJECT_DIR","req","res","ctx","srcPage","TURBOPACK","replace","prepareResult","prepare","statusCode","end","waitUntil","Promise","resolve","query","params","prerenderManifest","routerServerContext","method","tracer","getTracer","activeSpan","getActiveScopeSpan","onRequestError","instrumentationOnRequestError","bind","invokeRouteModule","span","render","allowedRevalidateHeaderKeys","__NEXT_ALLOWED_REVALIDATE_HEADERS","multiZoneDraftMode","Boolean","__NEXT_MULTI_ZONE_DRAFT_MODE","trustHostHeader","__NEXT_TRUST_HOST_HEADER","previewProps","preview","propagateError","dev","isDev","internalRevalidate","revalidate","onError","args","finally","setAttributes","rootSpanAttributes","getRootSpanAttributes","get","BaseServerSpan","handleRequest","console","warn","route","name","updateName","withPropagatedContext","headers","trace","spanName","SpanKind","SERVER","attributes","url","err","sendError"],"mappings":";;;;;;;;;;;;;;;;IAoBaA,MAAM;eAANA;;IAJb,wDAAwD;IACxD,OAAyC;eAAzC;;IAoBsBC,OAAO;eAAPA;;;0BAlCI;2BACA;gCAEU;yBAEd;sEAGI;wBACU;2BACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAI/B,WAAeC,IAAAA,cAAK,EAACC,eAAU;AAGxB,MAAMH,SAASE,IAAAA,cAAK,EAACC,eAAU;AAEtC,4DAA4D;AAC5D,MAAMC,cAAc,IAAIC,mCAAmB,CAAC;IAC1CC,YAAY;QACVC,MAAMC,oBAAS,CAACC,SAAS;QACzBC,MAAM;QACNC,UAAU;QACV,2CAA2C;QAC3CC,YAAY;QACZC,UAAU;IACZ;IACAV,UAAAA;IACAW,SAASC,QAAQC,GAAG,CAACC,wBAAwB,IAAI;IACjDC,oBAAoBH,QAAQC,GAAG,CAACG,2BAA2B,IAAI;AACjE;AAEO,eAAelB,QACpBmB,GAAoB,EACpBC,GAAmB,EACnBC,GAEC;IAED,IAAIC,UAAU;IAEd,wDAAwD;IACxD,mDAAmD;IACnD,6DAA6D;IAC7D,IAAIR,QAAQC,GAAG,CAACQ,SAAS,EAAE;QACzBD,UAAUA,QAAQE,OAAO,CAAC,YAAY,OAAO;IAC/C;IAEA,MAAMC,gBAAgB,MAAMtB,YAAYuB,OAAO,CAACP,KAAKC,KAAK;QAAEE;IAAQ;IAEpE,IAAI,CAACG,eAAe;QAClBL,IAAIO,UAAU,GAAG;QACjBP,IAAIQ,GAAG,CAAC;QACRP,IAAIQ,SAAS,oBAAbR,IAAIQ,SAAS,MAAbR,KAAgBS,QAAQC,OAAO;QAC/B;IACF;IAEA,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAEC,iBAAiB,EAAEC,mBAAmB,EAAE,GAC7DV;IAEF,IAAI;QACF,MAAMW,SAASjB,IAAI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AAcQ;wBACd,cAAcA;wBACd,kBAAkBC;oBACpB;oBACA5B,KAAK6B,UAAU,CAACD;gBAClB,OAAO;oBACL5B,KAAK6B,UAAU,CAAC,GAAGtC,QAAQ;gBAC7B;YACF;QAEJ,oDAAoD;QACpD,yDAAyD;QACzD,IAAIG,YAAY;YACd,MAAMK,kBAAkBL;QAC1B,OAAO;YACL,MAAMF,OAAOsC,qBAAqB,CAACxD,IAAIyD,OAAO,EAAE,IAC9CvC,OAAOwC,KAAK,CACVT,yBAAc,CAACC,aAAa,EAC5B;oBACES,UAAU,GAAG1C,QAAQ;oBACrB9B,MAAMyE,gBAAQ,CAACC,MAAM;oBACrBC,YAAY;wBACV,eAAe7C;wBACf,eAAejB,IAAI+D,GAAG;oBACxB;gBACF,GACAtC;QAGN;IACF,EAAE,OAAOuC,KAAK;QACZ,+CAA+C;QAC/C,IAAIhF,YAAYuD,KAAK,EAAE;YACrB,MAAMyB;QACR;QACA,qDAAqD;QACrD,gDAAgD;QAChDC,IAAAA,mBAAS,EAAChE,KAAwB,KAAK;IACzC,SAAU;QACR,kEAAkE;QAClE,kEAAkE;QAClE,eAAe;QACfC,IAAIQ,SAAS,oBAAbR,IAAIQ,SAAS,MAAbR,KAAgBS,QAAQC,OAAO;IACjC;AACF","ignoreList":[0]}
|
@@ -1711,7 +1711,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
1711
1711
|
isClient && new _copyfileplugin.CopyFilePlugin({
|
1712
1712
|
// file path to build output of `@next/polyfill-nomodule`
|
1713
1713
|
filePath: require.resolve('./polyfills/polyfill-nomodule'),
|
1714
|
-
cacheKey: "15.6.0-canary.
|
1714
|
+
cacheKey: "15.6.0-canary.6",
|
1715
1715
|
name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
|
1716
1716
|
minimize: false,
|
1717
1717
|
info: {
|
@@ -1895,7 +1895,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
1895
1895
|
// - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
|
1896
1896
|
// - Next.js version
|
1897
1897
|
// - next.config.js keys that affect compilation
|
1898
|
-
version: `${__dirname}|${"15.6.0-canary.
|
1898
|
+
version: `${__dirname}|${"15.6.0-canary.6"}|${configVars}`,
|
1899
1899
|
cacheDirectory: _path.default.join(distDir, 'cache', 'webpack'),
|
1900
1900
|
// For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
|
1901
1901
|
// So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
|
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "appBootstrap", {
|
|
15
15
|
});
|
16
16
|
const _assetprefix = require("./asset-prefix");
|
17
17
|
const _setattributesfromprops = require("./set-attributes-from-props");
|
18
|
-
const version = "15.6.0-canary.
|
18
|
+
const version = "15.6.0-canary.6";
|
19
19
|
window.next = {
|
20
20
|
version,
|
21
21
|
appDir: true
|
package/dist/client/index.js
CHANGED
@@ -61,7 +61,7 @@ const _hooksclientcontextsharedruntime = require("../shared/lib/hooks-client-con
|
|
61
61
|
const _onrecoverableerror = require("./react-client-callbacks/on-recoverable-error");
|
62
62
|
const _tracer = /*#__PURE__*/ _interop_require_default._(require("./tracing/tracer"));
|
63
63
|
const _isnextroutererror = require("./components/is-next-router-error");
|
64
|
-
const version = "15.6.0-canary.
|
64
|
+
const version = "15.6.0-canary.6";
|
65
65
|
let router;
|
66
66
|
const emitter = (0, _mitt.default)();
|
67
67
|
const looseToArray = (input)=>[].slice.call(input);
|