You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

next

Package Overview
Dependencies
Maintainers
3
Versions
3270
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next - npm Package Compare versions

Comparing version

to
15.4.2-canary.15

dist/esm/server/route-modules/pages/pages-handler.js

6

dist/build/define-env.js

@@ -155,5 +155,5 @@ "use strict";

} : undefined,
'process.env.__NEXT_MULTI_ZONE_DRAFT_MODE': JSON.stringify(config.experimental.multiZoneDraftMode),
'process.env.__NEXT_TRUST_HOST_HEADER': JSON.stringify(config.experimental.trustHostHeader),
'process.env.__NEXT_ALLOWED_REVALIDATE_HEADERS': JSON.stringify(config.experimental.allowedRevalidateHeaderKeys),
'process.env.__NEXT_MULTI_ZONE_DRAFT_MODE': config.experimental.multiZoneDraftMode ?? false,
'process.env.__NEXT_TRUST_HOST_HEADER': config.experimental.trustHostHeader ?? false,
'process.env.__NEXT_ALLOWED_REVALIDATE_HEADERS': config.experimental.allowedRevalidateHeaderKeys ?? [],
...isNodeServer ? {

@@ -160,0 +160,0 @@ 'process.env.__NEXT_RELATIVE_DIST_DIR': config.distDir,

@@ -103,4 +103,4 @@ // Manual additions to make the generated types below work.

/**
* An absolute root path from which all files must be nested under. Trying to access
* a file outside this root will fail, so think of this as a chroot.
* An absolute root path (Unix or Windows path) from which all files must be nested under.
* Trying to access a file outside this root will fail, so think of this as a chroot.
* E.g. `/home/user/projects/my-repo`.

@@ -110,9 +110,9 @@ */

/**
* A path which contains the app/pages directories, relative to [`Project::root_path`].
* E.g. `apps/my-app`
* A path which contains the app/pages directories, relative to [`Project::root_path`], always
* Unix path. E.g. `apps/my-app`
*/
projectPath: RcStr
/**
* A path where to emit the build outputs, relative to [`Project::project_path`].
* Corresponds to next.config.js's `distDir`.
* A path where to emit the build outputs, relative to [`Project::project_path`], always Unix
* path. Corresponds to next.config.js's `distDir`.
* E.g. `.next`

@@ -156,4 +156,4 @@ */

/**
* An absolute root path from which all files must be nested under. Trying to access
* a file outside this root will fail, so think of this as a chroot.
* An absolute root path (Unix or Windows path) from which all files must be nested under.
* Trying to access a file outside this root will fail, so think of this as a chroot.
* E.g. `/home/user/projects/my-repo`.

@@ -163,3 +163,4 @@ */

/**
* A path which contains the app/pages directories, relative to [`Project::root_path`].
* A path which contains the app/pages directories, relative to [`Project::root_path`], always
* a Unix path.
* E.g. `apps/my-app`

@@ -169,4 +170,4 @@ */

/**
* A path where to emit the build outputs, relative to [`Project::project_path`].
* Corresponds to next.config.js's `distDir`.
* A path where to emit the build outputs, relative to [`Project::project_path`], always a
* Unix path. Corresponds to next.config.js's `distDir`.
* E.g. `.next`

@@ -173,0 +174,0 @@ */

@@ -134,3 +134,3 @@ /* eslint-disable @typescript-eslint/no-use-before-define */ "use strict";

}
const nextVersion = "15.4.2-canary.14";
const nextVersion = "15.4.2-canary.15";
const ArchName = (0, _os.arch)();

@@ -137,0 +137,0 @@ const PlatformName = (0, _os.platform)();

@@ -47,2 +47,3 @@ "use strict";

const _interopdefault = require("../../server/app-render/interop-default");
const _stripflightheaders = require("../../server/app-render/strip-flight-headers");
const _node = require("../../server/base-http/node");

@@ -145,3 +146,3 @@ const _ppr = require("../../server/lib/experimental/ppr");

distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',
projectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || ''
relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || ''
});

@@ -174,3 +175,3 @@ async function handler(req, res, ctx) {

}
const { buildId, query, params, parsedUrl, pageIsDynamic, buildManifest, nextFontManifest, reactLoadableManifest, serverActionsManifest, clientReferenceManifest, subresourceIntegrityManifest, prerenderManifest, isDraftMode, resolvedPathname, revalidateOnlyGenerated, routerServerContext, nextConfig } = prepareResult;
const { buildId, query, params, parsedUrl, pageIsDynamic, buildManifest, nextFontManifest, reactLoadableManifest, serverActionsManifest, clientReferenceManifest, subresourceIntegrityManifest, prerenderManifest, isDraftMode, resolvedPathname, revalidateOnlyGenerated, routerServerContext, nextConfig, interceptionRoutePatterns } = prepareResult;
const pathname = parsedUrl.pathname || '/';

@@ -260,2 +261,8 @@ const normalizedSrcPage = (0, _apppaths.normalizeAppPath)(srcPage);

}
// If this is a request for an app path that should be statically generated
// and we aren't in the edge runtime, strip the flight headers so it will
// generate the static response.
if (!routeModule.isDev && !isDraftMode && isSSG && isRSCRequest && !isDynamicRSCRequest) {
(0, _stripflightheaders.stripFlightHeaders)(req.headers);
}
const ComponentMod = {

@@ -287,2 +294,4 @@ ..._entrybase,

try {
const varyHeader = routeModule.getVaryHeader(resolvedPathname, interceptionRoutePatterns);
res.setHeader('Vary', varyHeader);
const invokeRouteModule = async (span, context)=>{

@@ -363,3 +372,3 @@ const nextReq = new _node.NodeNextRequest(req);

setIsrStatus: routerServerContext == null ? void 0 : routerServerContext.setIsrStatus,
dir: routeModule.projectDir,
dir: process.env.NEXT_RUNTIME === 'nodejs' ? require('path').join(/* turbopackIgnore: true */ process.cwd(), routeModule.relativeProjectDir) : `${process.cwd()}/${routeModule.relativeProjectDir}`,
isDraftMode,

@@ -959,3 +968,3 @@ isRevalidate: isSSG && !postponed && !isDynamicRSCRequest,

// if we aren't wrapped by base-server handle here
if (!activeSpan) {
if (!activeSpan && !(err instanceof _nofallbackerrorexternal.NoFallbackError)) {
await routeModule.onRequestError(req, err, {

@@ -962,0 +971,0 @@ routerKind: 'App Router',

@@ -109,3 +109,3 @@ "use strict";

distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',
projectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',
relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',
resolvedPagePath: 'VAR_RESOLVED_PAGE_PATH',

@@ -371,3 +371,3 @@ nextConfigOutput,

// if we aren't wrapped by base-server handle here
if (!activeSpan) {
if (!activeSpan && !(err instanceof _nofallbackerrorexternal.NoFallbackError)) {
await routeModule.onRequestError(req, err, {

@@ -374,0 +374,0 @@ routerKind: 'App Router',

@@ -149,3 +149,3 @@ "use strict";

setIsrStatus: routerServerContext == null ? void 0 : routerServerContext.setIsrStatus,
dir: pageRouteModule.projectDir,
dir: pageRouteModule.relativeProjectDir,
botType,

@@ -152,0 +152,0 @@ isDraftMode: false,

@@ -90,3 +90,3 @@ "use strict";

distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',
projectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || ''
relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || ''
});

@@ -110,3 +110,3 @@ async function handler(req, res, ctx) {

}
const { query, params, prerenderManifest } = prepareResult;
const { query, params, prerenderManifest, routerServerContext } = prepareResult;
try {

@@ -132,3 +132,3 @@ const method = req.method || 'GET';

page: 'VAR_DEFINITION_PAGE',
projectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',
internalRevalidate: routerServerContext == null ? void 0 : routerServerContext.revalidate,
onError: (...args)=>onRequestError(req, ...args)

@@ -135,0 +135,0 @@ }).finally(()=>{

@@ -1,2 +0,1 @@

import type { IncomingMessage, ServerResponse } from 'node:http';
import { PagesRouteModule } from '../../server/route-modules/pages/module.compiled';

@@ -16,4 +15,4 @@ declare const _default: any;

export declare const routeModule: PagesRouteModule;
export declare function handler(req: IncomingMessage, res: ServerResponse, ctx: {
export declare const handler: (req: import("http").IncomingMessage, res: import("http").ServerResponse, ctx: {
waitUntil: (prom: Promise<void>) => void;
}): Promise<void>;
}) => Promise<void>;

@@ -70,10 +70,2 @@ "use strict";

const _routekind = require("../../server/route-kind");
const _constants = require("../../server/lib/trace/constants");
const _tracer = require("../../server/lib/trace/tracer");
const _formaturl = require("../../shared/lib/router/utils/format-url");
const _requestmeta = require("../../server/request-meta");
const _interopdefault = require("../../server/app-render/interop-default");
const _utils = require("../../server/instrumentation/utils");
const _normalizedatapath = require("../../shared/lib/page-path/normalize-data-path");
const _responsecache = require("../../server/response-cache");
const _helpers = require("./helpers");

@@ -83,19 +75,3 @@ const _VAR_MODULE_DOCUMENT = /*#__PURE__*/ _interop_require_wildcard(require("VAR_MODULE_DOCUMENT"));

const _VAR_USERLAND = /*#__PURE__*/ _interop_require_wildcard(require("VAR_USERLAND"));
const _cachecontrol = require("../../server/lib/cache-control");
const _utils1 = require("../../shared/lib/utils");
const _redirectstatus = require("../../lib/redirect-status");
const _constants1 = require("../../lib/constants");
const _sendpayload = require("../../server/send-payload");
const _renderresult = /*#__PURE__*/ _interop_require_default(require("../../server/render-result"));
const _utils2 = require("../../server/response-cache/utils");
const _nofallbackerrorexternal = require("../../shared/lib/no-fallback-error.external");
const _redirectstatuscode = require("../../client/components/redirect-status-code");
const _isbot = require("../../shared/lib/router/utils/is-bot");
const _addpathprefix = require("../../shared/lib/router/utils/add-path-prefix");
const _removetrailingslash = require("../../shared/lib/router/utils/remove-trailing-slash");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const _pageshandler = require("../../server/route-modules/pages/pages-handler");
function _getRequireWildcardCache(nodeInterop) {

@@ -163,3 +139,3 @@ if (typeof WeakMap !== "function") return null;

distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',
projectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',
relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',
components: {

@@ -172,480 +148,12 @@ // default export might not exist when optimized for data only

});
async function handler(req, res, ctx) {
var _serverFilesManifest_config_experimental, _serverFilesManifest_config;
let srcPage = 'VAR_DEFINITION_PAGE';
// turbopack doesn't normalize `/index` in the page name
// so we need to to process dynamic routes properly
// TODO: fix turbopack providing differing value from webpack
if (process.env.TURBOPACK) {
srcPage = srcPage.replace(/\/index$/, '') || '/';
} else if (srcPage === '/index') {
// we always normalize /index specifically
srcPage = '/';
}
const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;
const prepareResult = await routeModule.prepare(req, res, {
srcPage,
multiZoneDraftMode
});
if (!prepareResult) {
res.statusCode = 400;
res.end('Bad Request');
ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
return;
}
const { buildId, query, params, parsedUrl, originalQuery, originalPathname, buildManifest, nextFontManifest, serverFilesManifest, reactLoadableManifest, prerenderManifest, isDraftMode, isOnDemandRevalidate, revalidateOnlyGenerated, locale, locales, defaultLocale, routerServerContext, nextConfig, resolvedPathname } = prepareResult;
const isExperimentalCompile = serverFilesManifest == null ? void 0 : (_serverFilesManifest_config = serverFilesManifest.config) == null ? void 0 : (_serverFilesManifest_config_experimental = _serverFilesManifest_config.experimental) == null ? void 0 : _serverFilesManifest_config_experimental.isExperimentalCompile;
const hasServerProps = Boolean(getServerSideProps);
const hasStaticProps = Boolean(getStaticProps);
const hasStaticPaths = Boolean(getStaticPaths);
const hasGetInitialProps = Boolean((_VAR_USERLAND.default || _VAR_USERLAND).getInitialProps);
const isAmp = query.amp && config.amp;
let cacheKey = null;
let isIsrFallback = false;
let isNextDataRequest = prepareResult.isNextDataRequest && (hasStaticProps || hasServerProps);
const is404Page = srcPage === '/404';
const is500Page = srcPage === '/500';
const isErrorPage = srcPage === '/_error';
if (!routeModule.isDev && !isDraftMode && hasStaticProps) {
cacheKey = `${locale ? `/${locale}` : ''}${(srcPage === '/' || resolvedPathname === '/') && locale ? '' : resolvedPathname}${isAmp ? '.amp' : ''}`;
if (is404Page || is500Page || isErrorPage) {
cacheKey = `${locale ? `/${locale}` : ''}${srcPage}${isAmp ? '.amp' : ''}`;
}
// ensure /index and / is normalized to one key
cacheKey = cacheKey === '/index' ? '/' : cacheKey;
}
if (hasStaticPaths && !isDraftMode) {
const decodedPathname = (0, _removetrailingslash.removeTrailingSlash)(locale ? (0, _addpathprefix.addPathPrefix)(resolvedPathname, `/${locale}`) : resolvedPathname);
const isPrerendered = Boolean(prerenderManifest.routes[decodedPathname]) || prerenderManifest.notFoundRoutes.includes(decodedPathname);
const prerenderInfo = prerenderManifest.dynamicRoutes[srcPage];
if (prerenderInfo) {
if (prerenderInfo.fallback === false && !isPrerendered) {
throw new _nofallbackerrorexternal.NoFallbackError();
}
if (typeof prerenderInfo.fallback === 'string' && !isPrerendered && !isNextDataRequest) {
isIsrFallback = true;
}
}
}
// When serving a bot request, we want to serve a blocking render and not
// the prerendered page. This ensures that the correct content is served
// to the bot in the head.
if (isIsrFallback && (0, _isbot.isBot)(req.headers['user-agent'] || '') || (0, _requestmeta.getRequestMeta)(req, 'minimalMode')) {
isIsrFallback = false;
}
const tracer = (0, _tracer.getTracer)();
const activeSpan = tracer.getActiveScopeSpan();
try {
const method = req.method || 'GET';
const resolvedUrl = (0, _formaturl.formatUrl)({
pathname: nextConfig.trailingSlash ? parsedUrl.pathname : (0, _removetrailingslash.removeTrailingSlash)(parsedUrl.pathname || '/'),
// make sure to only add query values from original URL
query: hasStaticProps ? {} : originalQuery
});
const publicRuntimeConfig = (routerServerContext == null ? void 0 : routerServerContext.publicRuntimeConfig) || nextConfig.publicRuntimeConfig;
const handleResponse = async (span)=>{
const responseGenerator = async ({ previousCacheEntry })=>{
var _previousCacheEntry_value;
const doRender = async ()=>{
try {
var _nextConfig_i18n, _nextConfig_experimental_amp, _nextConfig_experimental_amp1;
return await routeModule.render(req, res, {
query: hasStaticProps && !isExperimentalCompile ? {
...params,
...isAmp ? {
amp: query.amp
} : {}
} : {
...query,
...params
},
params,
page: srcPage,
renderContext: {
isDraftMode,
isFallback: isIsrFallback,
developmentNotFoundSourcePage: (0, _requestmeta.getRequestMeta)(req, 'developmentNotFoundSourcePage')
},
sharedContext: {
buildId,
customServer: Boolean(routerServerContext == null ? void 0 : routerServerContext.isCustomServer) || undefined,
deploymentId: process.env.NEXT_DEPLOYMENT_ID
},
renderOpts: {
params,
routeModule,
page: srcPage,
pageConfig: config || {},
Component: (0, _interopdefault.interopDefault)(_VAR_USERLAND),
ComponentMod: _VAR_USERLAND,
getStaticProps,
getStaticPaths,
getServerSideProps,
supportsDynamicResponse: !hasStaticProps,
buildManifest,
nextFontManifest,
reactLoadableManifest,
assetPrefix: nextConfig.assetPrefix,
previewProps: prerenderManifest.preview,
images: nextConfig.images,
nextConfigOutput: nextConfig.output,
optimizeCss: Boolean(nextConfig.experimental.optimizeCss),
nextScriptWorkers: Boolean(nextConfig.experimental.nextScriptWorkers),
domainLocales: (_nextConfig_i18n = nextConfig.i18n) == null ? void 0 : _nextConfig_i18n.domains,
crossOrigin: nextConfig.crossOrigin,
multiZoneDraftMode,
basePath: nextConfig.basePath,
canonicalBase: nextConfig.amp.canonicalBase || '',
ampOptimizerConfig: (_nextConfig_experimental_amp = nextConfig.experimental.amp) == null ? void 0 : _nextConfig_experimental_amp.optimizer,
disableOptimizedLoading: nextConfig.experimental.disableOptimizedLoading,
largePageDataBytes: nextConfig.experimental.largePageDataBytes,
// Only the `publicRuntimeConfig` key is exposed to the client side
// It'll be rendered as part of __NEXT_DATA__ on the client side
runtimeConfig: Object.keys(publicRuntimeConfig).length > 0 ? publicRuntimeConfig : undefined,
isExperimentalCompile,
experimental: {
clientTraceMetadata: nextConfig.experimental.clientTraceMetadata || []
},
locale,
locales,
defaultLocale,
setIsrStatus: routerServerContext == null ? void 0 : routerServerContext.setIsrStatus,
isNextDataRequest: isNextDataRequest && (hasServerProps || hasStaticProps),
resolvedUrl,
// For getServerSideProps and getInitialProps we need to ensure we use the original URL
// and not the resolved URL to prevent a hydration mismatch on
// asPath
resolvedAsPath: hasServerProps || hasGetInitialProps ? (0, _formaturl.formatUrl)({
// we use the original URL pathname less the _next/data prefix if
// present
pathname: isNextDataRequest ? (0, _normalizedatapath.normalizeDataPath)(originalPathname) : originalPathname,
query: originalQuery
}) : resolvedUrl,
isOnDemandRevalidate,
ErrorDebug: (0, _requestmeta.getRequestMeta)(req, 'PagesErrorDebug'),
err: (0, _requestmeta.getRequestMeta)(req, 'invokeError'),
dev: routeModule.isDev,
// needed for experimental.optimizeCss feature
distDir: `${routeModule.projectDir}/${routeModule.distDir}`,
ampSkipValidation: (_nextConfig_experimental_amp1 = nextConfig.experimental.amp) == null ? void 0 : _nextConfig_experimental_amp1.skipValidation,
ampValidator: (0, _requestmeta.getRequestMeta)(req, 'ampValidator')
}
}).then((renderResult)=>{
const { metadata } = renderResult;
let cacheControl = metadata.cacheControl;
if ('isNotFound' in metadata && metadata.isNotFound) {
return {
value: null,
cacheControl
};
}
// Handle `isRedirect`.
if (metadata.isRedirect) {
return {
value: {
kind: _responsecache.CachedRouteKind.REDIRECT,
props: metadata.pageData ?? metadata.flightData
},
cacheControl
};
}
return {
value: {
kind: _responsecache.CachedRouteKind.PAGES,
html: renderResult,
pageData: renderResult.metadata.pageData,
headers: renderResult.metadata.headers,
status: renderResult.metadata.statusCode
},
cacheControl
};
}).finally(()=>{
if (!span) return;
span.setAttributes({
'http.status_code': res.statusCode,
'next.rsc': false
});
const rootSpanAttributes = tracer.getRootSpanAttributes();
// We were unable to get attributes, probably OTEL is not enabled
if (!rootSpanAttributes) {
return;
}
if (rootSpanAttributes.get('next.span_type') !== _constants.BaseServerSpan.handleRequest) {
console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
return;
}
const route = rootSpanAttributes.get('next.route');
if (route) {
const name = `${method} ${route}`;
span.setAttributes({
'next.route': route,
'http.route': route,
'next.span_name': name
});
span.updateName(name);
} else {
span.updateName(`${method} ${req.url}`);
}
});
} catch (err) {
// if this is a background revalidate we need to report
// the request error here as it won't be bubbled
if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
await routeModule.onRequestError(req, err, {
routerKind: 'Pages Router',
routePath: srcPage,
routeType: 'render',
revalidateReason: (0, _utils.getRevalidateReason)({
isRevalidate: hasStaticProps,
isOnDemandRevalidate
})
}, routerServerContext);
}
throw err;
}
};
// if we've already generated this page we no longer
// serve the fallback
if (previousCacheEntry) {
isIsrFallback = false;
}
if (isIsrFallback) {
const fallbackResponse = await routeModule.getResponseCache(req).get(routeModule.isDev ? null : locale ? `/${locale}${srcPage}` : srcPage, async ({ previousCacheEntry: previousFallbackCacheEntry = null })=>{
if (!routeModule.isDev) {
return (0, _utils2.toResponseCacheEntry)(previousFallbackCacheEntry);
}
return doRender();
}, {
routeKind: _routekind.RouteKind.PAGES,
isFallback: true,
isRoutePPREnabled: false,
isOnDemandRevalidate: false,
incrementalCache: await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest),
waitUntil: ctx.waitUntil
});
if (fallbackResponse) {
// Remove the cache control from the response to prevent it from being
// used in the surrounding cache.
delete fallbackResponse.cacheControl;
fallbackResponse.isMiss = true;
return fallbackResponse;
}
}
if (!(0, _requestmeta.getRequestMeta)(req, 'minimalMode') && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
res.statusCode = 404;
// on-demand revalidate always sets this header
res.setHeader('x-nextjs-cache', 'REVALIDATED');
res.end('This page could not be found');
return null;
}
if (isIsrFallback && (previousCacheEntry == null ? void 0 : (_previousCacheEntry_value = previousCacheEntry.value) == null ? void 0 : _previousCacheEntry_value.kind) === _responsecache.CachedRouteKind.PAGES) {
return {
value: {
kind: _responsecache.CachedRouteKind.PAGES,
html: new _renderresult.default(Buffer.from(previousCacheEntry.value.html), {
contentType: _constants1.HTML_CONTENT_TYPE_HEADER,
metadata: {
statusCode: previousCacheEntry.value.status,
headers: previousCacheEntry.value.headers
}
}),
pageData: {},
status: previousCacheEntry.value.status,
headers: previousCacheEntry.value.headers
},
cacheControl: {
revalidate: 0,
expire: undefined
}
};
}
return doRender();
};
const result = await routeModule.handleResponse({
cacheKey,
req,
nextConfig,
routeKind: _routekind.RouteKind.PAGES,
isOnDemandRevalidate,
revalidateOnlyGenerated,
waitUntil: ctx.waitUntil,
responseGenerator: responseGenerator,
prerenderManifest
});
// if we got a cache hit this wasn't an ISR fallback
// but it wasn't generated during build so isn't in the
// prerender-manifest
if (isIsrFallback && !(result == null ? void 0 : result.isMiss)) {
isIsrFallback = false;
}
// response is finished is no cache entry
if (!result) {
return;
}
if (hasStaticProps && !(0, _requestmeta.getRequestMeta)(req, 'minimalMode')) {
res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : result.isMiss ? 'MISS' : result.isStale ? 'STALE' : 'HIT');
}
let cacheControl;
if (!hasStaticProps || isIsrFallback) {
if (!res.getHeader('Cache-Control')) {
cacheControl = {
revalidate: 0,
expire: undefined
};
}
} else if (is404Page) {
const notFoundRevalidate = (0, _requestmeta.getRequestMeta)(req, 'notFoundRevalidate');
cacheControl = {
revalidate: typeof notFoundRevalidate === 'undefined' ? 0 : notFoundRevalidate,
expire: undefined
};
} else if (is500Page) {
cacheControl = {
revalidate: 0,
expire: undefined
};
} else if (result.cacheControl) {
// If the cache entry has a cache control with a revalidate value that's
// a number, use it.
if (typeof result.cacheControl.revalidate === 'number') {
var _result_cacheControl;
if (result.cacheControl.revalidate < 1) {
throw Object.defineProperty(new Error(`Invalid revalidate configuration provided: ${result.cacheControl.revalidate} < 1`), "__NEXT_ERROR_CODE", {
value: "E22",
enumerable: false,
configurable: true
});
}
cacheControl = {
revalidate: result.cacheControl.revalidate,
expire: ((_result_cacheControl = result.cacheControl) == null ? void 0 : _result_cacheControl.expire) ?? nextConfig.expireTime
};
} else {
// revalidate: false
cacheControl = {
revalidate: _constants1.CACHE_ONE_YEAR,
expire: undefined
};
}
}
// If cache control is already set on the response we don't
// override it to allow users to customize it via next.config
if (cacheControl && !res.getHeader('Cache-Control')) {
res.setHeader('Cache-Control', (0, _cachecontrol.getCacheControlHeader)(cacheControl));
}
// notFound: true case
if (!result.value) {
var _result_cacheControl1;
// add revalidate metadata before rendering 404 page
// so that we can use this as source of truth for the
// cache-control header instead of what the 404 page returns
// for the revalidate value
(0, _requestmeta.addRequestMeta)(req, 'notFoundRevalidate', (_result_cacheControl1 = result.cacheControl) == null ? void 0 : _result_cacheControl1.revalidate);
res.statusCode = 404;
if (isNextDataRequest) {
res.end('{"notFound":true}');
return;
}
// TODO: should route-module itself handle rendering the 404
if (routerServerContext == null ? void 0 : routerServerContext.render404) {
await routerServerContext.render404(req, res, parsedUrl, false);
} else {
res.end('This page could not be found');
}
return;
}
if (result.value.kind === _responsecache.CachedRouteKind.REDIRECT) {
if (isNextDataRequest) {
res.setHeader('content-type', _constants1.JSON_CONTENT_TYPE_HEADER);
res.end(JSON.stringify(result.value.props));
return;
} else {
const handleRedirect = (pageData)=>{
const redirect = {
destination: pageData.pageProps.__N_REDIRECT,
statusCode: pageData.pageProps.__N_REDIRECT_STATUS,
basePath: pageData.pageProps.__N_REDIRECT_BASE_PATH
};
const statusCode = (0, _redirectstatus.getRedirectStatus)(redirect);
const { basePath } = nextConfig;
if (basePath && redirect.basePath !== false && redirect.destination.startsWith('/')) {
redirect.destination = `${basePath}${redirect.destination}`;
}
if (redirect.destination.startsWith('/')) {
redirect.destination = (0, _utils1.normalizeRepeatedSlashes)(redirect.destination);
}
res.statusCode = statusCode;
res.setHeader('Location', redirect.destination);
if (statusCode === _redirectstatuscode.RedirectStatusCode.PermanentRedirect) {
res.setHeader('Refresh', `0;url=${redirect.destination}`);
}
res.end(redirect.destination);
};
await handleRedirect(result.value.props);
return null;
}
}
if (result.value.kind !== _responsecache.CachedRouteKind.PAGES) {
throw Object.defineProperty(new Error(`Invariant: received non-pages cache entry in pages handler`), "__NEXT_ERROR_CODE", {
value: "E695",
enumerable: false,
configurable: true
});
}
// In dev, we should not cache pages for any reason.
if (routeModule.isDev) {
res.setHeader('Cache-Control', 'no-store, must-revalidate');
}
// Draft mode should never be cached
if (isDraftMode) {
res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
}
// when invoking _error before pages/500 we don't actually
// send the _error response
if ((0, _requestmeta.getRequestMeta)(req, 'customErrorRender') || isErrorPage && (0, _requestmeta.getRequestMeta)(req, 'minimalMode') && res.statusCode === 500) {
return null;
}
await (0, _sendpayload.sendRenderResult)({
req,
res,
// If we are rendering the error page it's not a data request
// anymore
result: isNextDataRequest && !isErrorPage && !is500Page ? new _renderresult.default(Buffer.from(JSON.stringify(result.value.pageData)), {
contentType: _constants1.JSON_CONTENT_TYPE_HEADER,
metadata: result.value.html.metadata
}) : result.value.html,
generateEtags: nextConfig.generateEtags,
poweredByHeader: nextConfig.poweredByHeader,
cacheControl: routeModule.isDev ? undefined : cacheControl
});
};
// TODO: activeSpan code path is for when wrapped by
// next-server can be removed when this is no longer used
if (activeSpan) {
await handleResponse();
} else {
await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(_constants.BaseServerSpan.handleRequest, {
spanName: `${method} ${req.url}`,
kind: _tracer.SpanKind.SERVER,
attributes: {
'http.method': method,
'http.target': req.url
}
}, handleResponse));
}
} catch (err) {
await routeModule.onRequestError(req, err, {
routerKind: 'Pages Router',
routePath: srcPage,
routeType: 'render',
revalidateReason: (0, _utils.getRevalidateReason)({
isRevalidate: hasStaticProps,
isOnDemandRevalidate
})
}, routerServerContext);
// rethrow so that we can handle serving error page
throw err;
}
}
const handler = (0, _pageshandler.getHandler)({
srcPage: 'VAR_DEFINITION_PAGE',
config,
userland: _VAR_USERLAND,
routeModule,
getStaticPaths,
getStaticProps,
getServerSideProps
});
//# sourceMappingURL=pages.js.map

@@ -38,3 +38,3 @@ "use strict";

distDir: '',
projectDir: ''
relativeProjectDir: ''
};

@@ -41,0 +41,0 @@ return options;

@@ -17,3 +17,3 @@ /**

const _setattributesfromprops = require("./set-attributes-from-props");
const version = "15.4.2-canary.14";
const version = "15.4.2-canary.15";
window.next = {

@@ -20,0 +20,0 @@ version,

@@ -64,3 +64,3 @@ /* global location */ // imports polyfill from `@next/polyfill-module` after build.

const _isnextroutererror = require("./components/is-next-router-error");
const version = "15.4.2-canary.14";
const version = "15.4.2-canary.15";
let router;

@@ -67,0 +67,0 @@ const emitter = (0, _mitt.default)();

@@ -419,3 +419,3 @@ /**

};
exports.version = "19.2.0-experimental-e9638c33-20250721";
exports.version = "19.2.0-experimental-7513996f-20250722";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&

@@ -422,0 +422,0 @@ "function" ===

@@ -210,2 +210,2 @@ /**

};
exports.version = "19.2.0-experimental-e9638c33-20250721";
exports.version = "19.2.0-experimental-7513996f-20250722";

@@ -339,3 +339,3 @@ /**

};
exports.version = "19.2.0-experimental-e9638c33-20250721";
exports.version = "19.2.0-experimental-7513996f-20250722";
})();

@@ -152,2 +152,2 @@ /**

};
exports.version = "19.2.0-experimental-e9638c33-20250721";
exports.version = "19.2.0-experimental-7513996f-20250722";

@@ -75,6 +75,6 @@ {

"dependencies": {
"scheduler": "0.0.0-experimental-e9638c33-20250721"
"scheduler": "0.0.0-experimental-7513996f-20250722"
},
"peerDependencies": {
"react": "0.0.0-experimental-e9638c33-20250721"
"react": "0.0.0-experimental-7513996f-20250722"
},

@@ -81,0 +81,0 @@ "browser": {

@@ -419,3 +419,3 @@ /**

};
exports.version = "19.2.0-canary-e9638c33-20250721";
exports.version = "19.2.0-canary-7513996f-20250722";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&

@@ -422,0 +422,0 @@ "function" ===

@@ -210,2 +210,2 @@ /**

};
exports.version = "19.2.0-canary-e9638c33-20250721";
exports.version = "19.2.0-canary-7513996f-20250722";

@@ -339,3 +339,3 @@ /**

};
exports.version = "19.2.0-canary-e9638c33-20250721";
exports.version = "19.2.0-canary-7513996f-20250722";
})();

@@ -152,2 +152,2 @@ /**

};
exports.version = "19.2.0-canary-e9638c33-20250721";
exports.version = "19.2.0-canary-7513996f-20250722";

@@ -70,6 +70,6 @@ {

"dependencies": {
"scheduler": "0.27.0-canary-e9638c33-20250721"
"scheduler": "0.27.0-canary-7513996f-20250722"
},
"peerDependencies": {
"react": "19.2.0-canary-e9638c33-20250721"
"react": "19.2.0-canary-7513996f-20250722"
},

@@ -76,0 +76,0 @@ "browser": {

@@ -1331,3 +1331,3 @@ /**

};
exports.version = "19.2.0-experimental-e9638c33-20250721";
exports.version = "19.2.0-experimental-7513996f-20250722";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&

@@ -1334,0 +1334,0 @@ "function" ===

@@ -608,2 +608,2 @@ /**

};
exports.version = "19.2.0-experimental-e9638c33-20250721";
exports.version = "19.2.0-experimental-7513996f-20250722";

@@ -999,3 +999,3 @@ /**

};
exports.version = "19.2.0-experimental-e9638c33-20250721";
exports.version = "19.2.0-experimental-7513996f-20250722";
})();

@@ -575,2 +575,2 @@ /**

};
exports.version = "19.2.0-experimental-e9638c33-20250721";
exports.version = "19.2.0-experimental-7513996f-20250722";
{
"name": "react-is",
"version": "19.2.0-canary-e9638c33-20250721",
"version": "19.2.0-canary-7513996f-20250722",
"description": "Brand checking of React Elements.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -51,5 +51,5 @@ {

"peerDependencies": {
"react": "0.0.0-experimental-e9638c33-20250721",
"react-dom": "0.0.0-experimental-e9638c33-20250721"
"react": "0.0.0-experimental-7513996f-20250722",
"react-dom": "0.0.0-experimental-7513996f-20250722"
}
}

@@ -51,5 +51,5 @@ {

"peerDependencies": {
"react": "19.2.0-canary-e9638c33-20250721",
"react-dom": "19.2.0-canary-e9638c33-20250721"
"react": "19.2.0-canary-7513996f-20250722",
"react-dom": "19.2.0-canary-7513996f-20250722"
}
}

@@ -67,6 +67,6 @@ {

"peerDependencies": {
"react": "0.0.0-experimental-e9638c33-20250721",
"react-dom": "0.0.0-experimental-e9638c33-20250721",
"react": "0.0.0-experimental-7513996f-20250722",
"react-dom": "0.0.0-experimental-7513996f-20250722",
"webpack": "^5.59.0"
}
}

@@ -67,6 +67,6 @@ {

"peerDependencies": {
"react": "19.2.0-canary-e9638c33-20250721",
"react-dom": "19.2.0-canary-e9638c33-20250721",
"react": "19.2.0-canary-7513996f-20250722",
"react-dom": "19.2.0-canary-7513996f-20250722",
"webpack": "^5.59.0"
}
}

@@ -1247,3 +1247,3 @@ /**

};
exports.version = "19.2.0-canary-e9638c33-20250721";
exports.version = "19.2.0-canary-7513996f-20250722";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&

@@ -1250,0 +1250,0 @@ "function" ===

@@ -546,2 +546,2 @@ /**

};
exports.version = "19.2.0-canary-e9638c33-20250721";
exports.version = "19.2.0-canary-7513996f-20250722";

@@ -819,3 +819,3 @@ /**

};
exports.version = "19.2.0-canary-e9638c33-20250721";
exports.version = "19.2.0-canary-7513996f-20250722";
})();

@@ -433,2 +433,2 @@ /**

};
exports.version = "19.2.0-canary-e9638c33-20250721";
exports.version = "19.2.0-canary-7513996f-20250722";

@@ -1,1 +0,1 @@

(()=>{var t={390:t=>{function n(t,i){for(var _ in i)t[_]=i[_];return t}t.exports=function(t){var i=[];function u(t){for(var _=[],a=0;a<i.length;a++)i[a]===t?t=null:_.push(i[a]);i=_}function e(_,a,f){t=a?_:n(n({},t),_);for(var o=i,c=0;c<o.length;c++)o[c](t,f)}return t=t||{},{action:function(i){function r(t){e(t,!1,i)}return function(){for(var _=arguments,a=[t],f=0;f<arguments.length;f++)a.push(_[f]);var o=i.apply(this,a);if(null!=o)return o.then?o.then(r):r(o)}},setState:e,subscribe:function(t){return i.push(t),function(){u(t)}},unsubscribe:u,getState:function(){return t}}}}};var i={};function __nccwpck_require__(_){var a=i[_];if(a!==undefined){return a.exports}var f=i[_]={exports:{}};var o=true;try{t[_](f,f.exports,__nccwpck_require__);o=false}finally{if(o)delete i[_]}return f.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var _=__nccwpck_require__(390);module.exports=_})();
(()=>{var t={73:t=>{function n(t,i){for(var _ in i)t[_]=i[_];return t}t.exports=function(t){var i=[];function u(t){for(var _=[],a=0;a<i.length;a++)i[a]===t?t=null:_.push(i[a]);i=_}function e(_,a,f){t=a?_:n(n({},t),_);for(var o=i,c=0;c<o.length;c++)o[c](t,f)}return t=t||{},{action:function(i){function r(t){e(t,!1,i)}return function(){for(var _=arguments,a=[t],f=0;f<arguments.length;f++)a.push(_[f]);var o=i.apply(this,a);if(null!=o)return o.then?o.then(r):r(o)}},setState:e,subscribe:function(t){return i.push(t),function(){u(t)}},unsubscribe:u,getState:function(){return t}}}}};var i={};function __nccwpck_require__(_){var a=i[_];if(a!==undefined){return a.exports}var f=i[_]={exports:{}};var o=true;try{t[_](f,f.exports,__nccwpck_require__);o=false}finally{if(o)delete i[_]}return f.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var _=__nccwpck_require__(73);module.exports=_})();

@@ -140,5 +140,5 @@ import path from 'node:path';

} : undefined,
'process.env.__NEXT_MULTI_ZONE_DRAFT_MODE': JSON.stringify(config.experimental.multiZoneDraftMode),
'process.env.__NEXT_TRUST_HOST_HEADER': JSON.stringify(config.experimental.trustHostHeader),
'process.env.__NEXT_ALLOWED_REVALIDATE_HEADERS': JSON.stringify(config.experimental.allowedRevalidateHeaderKeys),
'process.env.__NEXT_MULTI_ZONE_DRAFT_MODE': config.experimental.multiZoneDraftMode ?? false,
'process.env.__NEXT_TRUST_HOST_HEADER': config.experimental.trustHostHeader ?? false,
'process.env.__NEXT_ALLOWED_REVALIDATE_HEADERS': config.experimental.allowedRevalidateHeaderKeys ?? [],
...isNodeServer ? {

@@ -145,0 +145,0 @@ 'process.env.__NEXT_RELATIVE_DIST_DIR': config.distDir,

@@ -103,4 +103,4 @@ // Manual additions to make the generated types below work.

/**
* An absolute root path from which all files must be nested under. Trying to access
* a file outside this root will fail, so think of this as a chroot.
* An absolute root path (Unix or Windows path) from which all files must be nested under.
* Trying to access a file outside this root will fail, so think of this as a chroot.
* E.g. `/home/user/projects/my-repo`.

@@ -110,9 +110,9 @@ */

/**
* A path which contains the app/pages directories, relative to [`Project::root_path`].
* E.g. `apps/my-app`
* A path which contains the app/pages directories, relative to [`Project::root_path`], always
* Unix path. E.g. `apps/my-app`
*/
projectPath: RcStr
/**
* A path where to emit the build outputs, relative to [`Project::project_path`].
* Corresponds to next.config.js's `distDir`.
* A path where to emit the build outputs, relative to [`Project::project_path`], always Unix
* path. Corresponds to next.config.js's `distDir`.
* E.g. `.next`

@@ -156,4 +156,4 @@ */

/**
* An absolute root path from which all files must be nested under. Trying to access
* a file outside this root will fail, so think of this as a chroot.
* An absolute root path (Unix or Windows path) from which all files must be nested under.
* Trying to access a file outside this root will fail, so think of this as a chroot.
* E.g. `/home/user/projects/my-repo`.

@@ -163,3 +163,4 @@ */

/**
* A path which contains the app/pages directories, relative to [`Project::root_path`].
* A path which contains the app/pages directories, relative to [`Project::root_path`], always
* a Unix path.
* E.g. `apps/my-app`

@@ -169,4 +170,4 @@ */

/**
* A path where to emit the build outputs, relative to [`Project::project_path`].
* Corresponds to next.config.js's `distDir`.
* A path where to emit the build outputs, relative to [`Project::project_path`], always a
* Unix path. Corresponds to next.config.js's `distDir`.
* E.g. `.next`

@@ -173,0 +174,0 @@ */

@@ -14,3 +14,3 @@ /* eslint-disable @typescript-eslint/no-use-before-define */ import path from 'path';

import { throwTurbopackInternalError } from '../../shared/lib/turbopack/internal-error';
const nextVersion = "15.4.2-canary.14";
const nextVersion = "15.4.2-canary.15";
const ArchName = arch();

@@ -17,0 +17,0 @@ const PlatformName = platform();

@@ -12,2 +12,3 @@ import { AppPageRouteModule } from '../../server/route-modules/app-page/module.compiled' with {

import { interopDefault } from '../../server/app-render/interop-default';
import { stripFlightHeaders } from '../../server/app-render/strip-flight-headers';
import { NodeNextRequest, NodeNextResponse } from '../../server/base-http/node';

@@ -67,3 +68,3 @@ import { checkIsAppPPREnabled } from '../../server/lib/experimental/ppr';

distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',
projectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || ''
relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || ''
});

@@ -96,3 +97,3 @@ export async function handler(req, res, ctx) {

}
const { buildId, query, params, parsedUrl, pageIsDynamic, buildManifest, nextFontManifest, reactLoadableManifest, serverActionsManifest, clientReferenceManifest, subresourceIntegrityManifest, prerenderManifest, isDraftMode, resolvedPathname, revalidateOnlyGenerated, routerServerContext, nextConfig } = prepareResult;
const { buildId, query, params, parsedUrl, pageIsDynamic, buildManifest, nextFontManifest, reactLoadableManifest, serverActionsManifest, clientReferenceManifest, subresourceIntegrityManifest, prerenderManifest, isDraftMode, resolvedPathname, revalidateOnlyGenerated, routerServerContext, nextConfig, interceptionRoutePatterns } = prepareResult;
const pathname = parsedUrl.pathname || '/';

@@ -182,2 +183,8 @@ const normalizedSrcPage = normalizeAppPath(srcPage);

}
// If this is a request for an app path that should be statically generated
// and we aren't in the edge runtime, strip the flight headers so it will
// generate the static response.
if (!routeModule.isDev && !isDraftMode && isSSG && isRSCRequest && !isDynamicRSCRequest) {
stripFlightHeaders(req.headers);
}
const ComponentMod = {

@@ -209,2 +216,4 @@ ...entryBase,

try {
const varyHeader = routeModule.getVaryHeader(resolvedPathname, interceptionRoutePatterns);
res.setHeader('Vary', varyHeader);
const invokeRouteModule = async (span, context)=>{

@@ -285,3 +294,3 @@ const nextReq = new NodeNextRequest(req);

setIsrStatus: routerServerContext == null ? void 0 : routerServerContext.setIsrStatus,
dir: routeModule.projectDir,
dir: process.env.NEXT_RUNTIME === 'nodejs' ? require('path').join(/* turbopackIgnore: true */ process.cwd(), routeModule.relativeProjectDir) : `${process.cwd()}/${routeModule.relativeProjectDir}`,
isDraftMode,

@@ -881,3 +890,3 @@ isRevalidate: isSSG && !postponed && !isDynamicRSCRequest,

// if we aren't wrapped by base-server handle here
if (!activeSpan) {
if (!activeSpan && !(err instanceof NoFallbackError)) {
await routeModule.onRequestError(req, err, {

@@ -884,0 +893,0 @@ routerKind: 'App Router',

@@ -30,3 +30,3 @@ import { AppRouteRouteModule } from '../../server/route-modules/app-route/module.compiled';

distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',
projectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',
relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',
resolvedPagePath: 'VAR_RESOLVED_PAGE_PATH',

@@ -293,3 +293,3 @@ nextConfigOutput,

// if we aren't wrapped by base-server handle here
if (!activeSpan) {
if (!activeSpan && !(err instanceof NoFallbackError)) {
await routeModule.onRequestError(req, err, {

@@ -296,0 +296,0 @@ routerKind: 'App Router',

@@ -86,3 +86,3 @@ var _self___RSC_MANIFEST;

setIsrStatus: routerServerContext == null ? void 0 : routerServerContext.setIsrStatus,
dir: pageRouteModule.projectDir,
dir: pageRouteModule.relativeProjectDir,
botType,

@@ -89,0 +89,0 @@ isDraftMode: false,

@@ -25,3 +25,3 @@ import { sendError } from '../../server/api-utils';

distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',
projectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || ''
relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || ''
});

@@ -45,3 +45,3 @@ export async function handler(req, res, ctx) {

}
const { query, params, prerenderManifest } = prepareResult;
const { query, params, prerenderManifest, routerServerContext } = prepareResult;
try {

@@ -67,3 +67,3 @@ const method = req.method || 'GET';

page: 'VAR_DEFINITION_PAGE',
projectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',
internalRevalidate: routerServerContext == null ? void 0 : routerServerContext.revalidate,
onError: (...args)=>onRequestError(req, ...args)

@@ -70,0 +70,0 @@ }).finally(()=>{

import { PagesRouteModule } from '../../server/route-modules/pages/module.compiled';
import { RouteKind } from '../../server/route-kind';
import { BaseServerSpan } from '../../server/lib/trace/constants';
import { getTracer, SpanKind } from '../../server/lib/trace/tracer';
import { formatUrl } from '../../shared/lib/router/utils/format-url';
import { addRequestMeta, getRequestMeta } from '../../server/request-meta';
import { interopDefault } from '../../server/app-render/interop-default';
import { getRevalidateReason } from '../../server/instrumentation/utils';
import { normalizeDataPath } from '../../shared/lib/page-path/normalize-data-path';
import { CachedRouteKind } from '../../server/response-cache';
import { hoist } from './helpers';

@@ -17,14 +9,3 @@ // Import the app and document modules.

import * as userland from 'VAR_USERLAND';
import { getCacheControlHeader } from '../../server/lib/cache-control';
import { normalizeRepeatedSlashes } from '../../shared/lib/utils';
import { getRedirectStatus } from '../../lib/redirect-status';
import { CACHE_ONE_YEAR, HTML_CONTENT_TYPE_HEADER, JSON_CONTENT_TYPE_HEADER } from '../../lib/constants';
import { sendRenderResult } from '../../server/send-payload';
import RenderResult from '../../server/render-result';
import { toResponseCacheEntry } from '../../server/response-cache/utils';
import { NoFallbackError } from '../../shared/lib/no-fallback-error.external';
import { RedirectStatusCode } from '../../client/components/redirect-status-code';
import { isBot } from '../../shared/lib/router/utils/is-bot';
import { addPathPrefix } from '../../shared/lib/router/utils/add-path-prefix';
import { removeTrailingSlash } from '../../shared/lib/router/utils/remove-trailing-slash';
import { getHandler } from '../../server/route-modules/pages/pages-handler';
// Re-export the component (should be the default export).

@@ -55,3 +36,3 @@ export default hoist(userland, 'default');

distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',
projectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',
relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',
components: {

@@ -64,480 +45,12 @@ // default export might not exist when optimized for data only

});
export async function handler(req, res, ctx) {
var _serverFilesManifest_config_experimental, _serverFilesManifest_config;
let srcPage = 'VAR_DEFINITION_PAGE';
// turbopack doesn't normalize `/index` in the page name
// so we need to to process dynamic routes properly
// TODO: fix turbopack providing differing value from webpack
if (process.env.TURBOPACK) {
srcPage = srcPage.replace(/\/index$/, '') || '/';
} else if (srcPage === '/index') {
// we always normalize /index specifically
srcPage = '/';
}
const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;
const prepareResult = await routeModule.prepare(req, res, {
srcPage,
multiZoneDraftMode
});
if (!prepareResult) {
res.statusCode = 400;
res.end('Bad Request');
ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());
return;
}
const { buildId, query, params, parsedUrl, originalQuery, originalPathname, buildManifest, nextFontManifest, serverFilesManifest, reactLoadableManifest, prerenderManifest, isDraftMode, isOnDemandRevalidate, revalidateOnlyGenerated, locale, locales, defaultLocale, routerServerContext, nextConfig, resolvedPathname } = prepareResult;
const isExperimentalCompile = serverFilesManifest == null ? void 0 : (_serverFilesManifest_config = serverFilesManifest.config) == null ? void 0 : (_serverFilesManifest_config_experimental = _serverFilesManifest_config.experimental) == null ? void 0 : _serverFilesManifest_config_experimental.isExperimentalCompile;
const hasServerProps = Boolean(getServerSideProps);
const hasStaticProps = Boolean(getStaticProps);
const hasStaticPaths = Boolean(getStaticPaths);
const hasGetInitialProps = Boolean((userland.default || userland).getInitialProps);
const isAmp = query.amp && config.amp;
let cacheKey = null;
let isIsrFallback = false;
let isNextDataRequest = prepareResult.isNextDataRequest && (hasStaticProps || hasServerProps);
const is404Page = srcPage === '/404';
const is500Page = srcPage === '/500';
const isErrorPage = srcPage === '/_error';
if (!routeModule.isDev && !isDraftMode && hasStaticProps) {
cacheKey = `${locale ? `/${locale}` : ''}${(srcPage === '/' || resolvedPathname === '/') && locale ? '' : resolvedPathname}${isAmp ? '.amp' : ''}`;
if (is404Page || is500Page || isErrorPage) {
cacheKey = `${locale ? `/${locale}` : ''}${srcPage}${isAmp ? '.amp' : ''}`;
}
// ensure /index and / is normalized to one key
cacheKey = cacheKey === '/index' ? '/' : cacheKey;
}
if (hasStaticPaths && !isDraftMode) {
const decodedPathname = removeTrailingSlash(locale ? addPathPrefix(resolvedPathname, `/${locale}`) : resolvedPathname);
const isPrerendered = Boolean(prerenderManifest.routes[decodedPathname]) || prerenderManifest.notFoundRoutes.includes(decodedPathname);
const prerenderInfo = prerenderManifest.dynamicRoutes[srcPage];
if (prerenderInfo) {
if (prerenderInfo.fallback === false && !isPrerendered) {
throw new NoFallbackError();
}
if (typeof prerenderInfo.fallback === 'string' && !isPrerendered && !isNextDataRequest) {
isIsrFallback = true;
}
}
}
// When serving a bot request, we want to serve a blocking render and not
// the prerendered page. This ensures that the correct content is served
// to the bot in the head.
if (isIsrFallback && isBot(req.headers['user-agent'] || '') || getRequestMeta(req, 'minimalMode')) {
isIsrFallback = false;
}
const tracer = getTracer();
const activeSpan = tracer.getActiveScopeSpan();
try {
const method = req.method || 'GET';
const resolvedUrl = formatUrl({
pathname: nextConfig.trailingSlash ? parsedUrl.pathname : removeTrailingSlash(parsedUrl.pathname || '/'),
// make sure to only add query values from original URL
query: hasStaticProps ? {} : originalQuery
});
const publicRuntimeConfig = (routerServerContext == null ? void 0 : routerServerContext.publicRuntimeConfig) || nextConfig.publicRuntimeConfig;
const handleResponse = async (span)=>{
const responseGenerator = async ({ previousCacheEntry })=>{
var _previousCacheEntry_value;
const doRender = async ()=>{
try {
var _nextConfig_i18n, _nextConfig_experimental_amp, _nextConfig_experimental_amp1;
return await routeModule.render(req, res, {
query: hasStaticProps && !isExperimentalCompile ? {
...params,
...isAmp ? {
amp: query.amp
} : {}
} : {
...query,
...params
},
params,
page: srcPage,
renderContext: {
isDraftMode,
isFallback: isIsrFallback,
developmentNotFoundSourcePage: getRequestMeta(req, 'developmentNotFoundSourcePage')
},
sharedContext: {
buildId,
customServer: Boolean(routerServerContext == null ? void 0 : routerServerContext.isCustomServer) || undefined,
deploymentId: process.env.NEXT_DEPLOYMENT_ID
},
renderOpts: {
params,
routeModule,
page: srcPage,
pageConfig: config || {},
Component: interopDefault(userland),
ComponentMod: userland,
getStaticProps,
getStaticPaths,
getServerSideProps,
supportsDynamicResponse: !hasStaticProps,
buildManifest,
nextFontManifest,
reactLoadableManifest,
assetPrefix: nextConfig.assetPrefix,
previewProps: prerenderManifest.preview,
images: nextConfig.images,
nextConfigOutput: nextConfig.output,
optimizeCss: Boolean(nextConfig.experimental.optimizeCss),
nextScriptWorkers: Boolean(nextConfig.experimental.nextScriptWorkers),
domainLocales: (_nextConfig_i18n = nextConfig.i18n) == null ? void 0 : _nextConfig_i18n.domains,
crossOrigin: nextConfig.crossOrigin,
multiZoneDraftMode,
basePath: nextConfig.basePath,
canonicalBase: nextConfig.amp.canonicalBase || '',
ampOptimizerConfig: (_nextConfig_experimental_amp = nextConfig.experimental.amp) == null ? void 0 : _nextConfig_experimental_amp.optimizer,
disableOptimizedLoading: nextConfig.experimental.disableOptimizedLoading,
largePageDataBytes: nextConfig.experimental.largePageDataBytes,
// Only the `publicRuntimeConfig` key is exposed to the client side
// It'll be rendered as part of __NEXT_DATA__ on the client side
runtimeConfig: Object.keys(publicRuntimeConfig).length > 0 ? publicRuntimeConfig : undefined,
isExperimentalCompile,
experimental: {
clientTraceMetadata: nextConfig.experimental.clientTraceMetadata || []
},
locale,
locales,
defaultLocale,
setIsrStatus: routerServerContext == null ? void 0 : routerServerContext.setIsrStatus,
isNextDataRequest: isNextDataRequest && (hasServerProps || hasStaticProps),
resolvedUrl,
// For getServerSideProps and getInitialProps we need to ensure we use the original URL
// and not the resolved URL to prevent a hydration mismatch on
// asPath
resolvedAsPath: hasServerProps || hasGetInitialProps ? formatUrl({
// we use the original URL pathname less the _next/data prefix if
// present
pathname: isNextDataRequest ? normalizeDataPath(originalPathname) : originalPathname,
query: originalQuery
}) : resolvedUrl,
isOnDemandRevalidate,
ErrorDebug: getRequestMeta(req, 'PagesErrorDebug'),
err: getRequestMeta(req, 'invokeError'),
dev: routeModule.isDev,
// needed for experimental.optimizeCss feature
distDir: `${routeModule.projectDir}/${routeModule.distDir}`,
ampSkipValidation: (_nextConfig_experimental_amp1 = nextConfig.experimental.amp) == null ? void 0 : _nextConfig_experimental_amp1.skipValidation,
ampValidator: getRequestMeta(req, 'ampValidator')
}
}).then((renderResult)=>{
const { metadata } = renderResult;
let cacheControl = metadata.cacheControl;
if ('isNotFound' in metadata && metadata.isNotFound) {
return {
value: null,
cacheControl
};
}
// Handle `isRedirect`.
if (metadata.isRedirect) {
return {
value: {
kind: CachedRouteKind.REDIRECT,
props: metadata.pageData ?? metadata.flightData
},
cacheControl
};
}
return {
value: {
kind: CachedRouteKind.PAGES,
html: renderResult,
pageData: renderResult.metadata.pageData,
headers: renderResult.metadata.headers,
status: renderResult.metadata.statusCode
},
cacheControl
};
}).finally(()=>{
if (!span) return;
span.setAttributes({
'http.status_code': res.statusCode,
'next.rsc': false
});
const rootSpanAttributes = tracer.getRootSpanAttributes();
// We were unable to get attributes, probably OTEL is not enabled
if (!rootSpanAttributes) {
return;
}
if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {
console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);
return;
}
const route = rootSpanAttributes.get('next.route');
if (route) {
const name = `${method} ${route}`;
span.setAttributes({
'next.route': route,
'http.route': route,
'next.span_name': name
});
span.updateName(name);
} else {
span.updateName(`${method} ${req.url}`);
}
});
} catch (err) {
// if this is a background revalidate we need to report
// the request error here as it won't be bubbled
if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {
await routeModule.onRequestError(req, err, {
routerKind: 'Pages Router',
routePath: srcPage,
routeType: 'render',
revalidateReason: getRevalidateReason({
isRevalidate: hasStaticProps,
isOnDemandRevalidate
})
}, routerServerContext);
}
throw err;
}
};
// if we've already generated this page we no longer
// serve the fallback
if (previousCacheEntry) {
isIsrFallback = false;
}
if (isIsrFallback) {
const fallbackResponse = await routeModule.getResponseCache(req).get(routeModule.isDev ? null : locale ? `/${locale}${srcPage}` : srcPage, async ({ previousCacheEntry: previousFallbackCacheEntry = null })=>{
if (!routeModule.isDev) {
return toResponseCacheEntry(previousFallbackCacheEntry);
}
return doRender();
}, {
routeKind: RouteKind.PAGES,
isFallback: true,
isRoutePPREnabled: false,
isOnDemandRevalidate: false,
incrementalCache: await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest),
waitUntil: ctx.waitUntil
});
if (fallbackResponse) {
// Remove the cache control from the response to prevent it from being
// used in the surrounding cache.
delete fallbackResponse.cacheControl;
fallbackResponse.isMiss = true;
return fallbackResponse;
}
}
if (!getRequestMeta(req, 'minimalMode') && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {
res.statusCode = 404;
// on-demand revalidate always sets this header
res.setHeader('x-nextjs-cache', 'REVALIDATED');
res.end('This page could not be found');
return null;
}
if (isIsrFallback && (previousCacheEntry == null ? void 0 : (_previousCacheEntry_value = previousCacheEntry.value) == null ? void 0 : _previousCacheEntry_value.kind) === CachedRouteKind.PAGES) {
return {
value: {
kind: CachedRouteKind.PAGES,
html: new RenderResult(Buffer.from(previousCacheEntry.value.html), {
contentType: HTML_CONTENT_TYPE_HEADER,
metadata: {
statusCode: previousCacheEntry.value.status,
headers: previousCacheEntry.value.headers
}
}),
pageData: {},
status: previousCacheEntry.value.status,
headers: previousCacheEntry.value.headers
},
cacheControl: {
revalidate: 0,
expire: undefined
}
};
}
return doRender();
};
const result = await routeModule.handleResponse({
cacheKey,
req,
nextConfig,
routeKind: RouteKind.PAGES,
isOnDemandRevalidate,
revalidateOnlyGenerated,
waitUntil: ctx.waitUntil,
responseGenerator: responseGenerator,
prerenderManifest
});
// if we got a cache hit this wasn't an ISR fallback
// but it wasn't generated during build so isn't in the
// prerender-manifest
if (isIsrFallback && !(result == null ? void 0 : result.isMiss)) {
isIsrFallback = false;
}
// response is finished is no cache entry
if (!result) {
return;
}
if (hasStaticProps && !getRequestMeta(req, 'minimalMode')) {
res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : result.isMiss ? 'MISS' : result.isStale ? 'STALE' : 'HIT');
}
let cacheControl;
if (!hasStaticProps || isIsrFallback) {
if (!res.getHeader('Cache-Control')) {
cacheControl = {
revalidate: 0,
expire: undefined
};
}
} else if (is404Page) {
const notFoundRevalidate = getRequestMeta(req, 'notFoundRevalidate');
cacheControl = {
revalidate: typeof notFoundRevalidate === 'undefined' ? 0 : notFoundRevalidate,
expire: undefined
};
} else if (is500Page) {
cacheControl = {
revalidate: 0,
expire: undefined
};
} else if (result.cacheControl) {
// If the cache entry has a cache control with a revalidate value that's
// a number, use it.
if (typeof result.cacheControl.revalidate === 'number') {
var _result_cacheControl;
if (result.cacheControl.revalidate < 1) {
throw Object.defineProperty(new Error(`Invalid revalidate configuration provided: ${result.cacheControl.revalidate} < 1`), "__NEXT_ERROR_CODE", {
value: "E22",
enumerable: false,
configurable: true
});
}
cacheControl = {
revalidate: result.cacheControl.revalidate,
expire: ((_result_cacheControl = result.cacheControl) == null ? void 0 : _result_cacheControl.expire) ?? nextConfig.expireTime
};
} else {
// revalidate: false
cacheControl = {
revalidate: CACHE_ONE_YEAR,
expire: undefined
};
}
}
// If cache control is already set on the response we don't
// override it to allow users to customize it via next.config
if (cacheControl && !res.getHeader('Cache-Control')) {
res.setHeader('Cache-Control', getCacheControlHeader(cacheControl));
}
// notFound: true case
if (!result.value) {
var _result_cacheControl1;
// add revalidate metadata before rendering 404 page
// so that we can use this as source of truth for the
// cache-control header instead of what the 404 page returns
// for the revalidate value
addRequestMeta(req, 'notFoundRevalidate', (_result_cacheControl1 = result.cacheControl) == null ? void 0 : _result_cacheControl1.revalidate);
res.statusCode = 404;
if (isNextDataRequest) {
res.end('{"notFound":true}');
return;
}
// TODO: should route-module itself handle rendering the 404
if (routerServerContext == null ? void 0 : routerServerContext.render404) {
await routerServerContext.render404(req, res, parsedUrl, false);
} else {
res.end('This page could not be found');
}
return;
}
if (result.value.kind === CachedRouteKind.REDIRECT) {
if (isNextDataRequest) {
res.setHeader('content-type', JSON_CONTENT_TYPE_HEADER);
res.end(JSON.stringify(result.value.props));
return;
} else {
const handleRedirect = (pageData)=>{
const redirect = {
destination: pageData.pageProps.__N_REDIRECT,
statusCode: pageData.pageProps.__N_REDIRECT_STATUS,
basePath: pageData.pageProps.__N_REDIRECT_BASE_PATH
};
const statusCode = getRedirectStatus(redirect);
const { basePath } = nextConfig;
if (basePath && redirect.basePath !== false && redirect.destination.startsWith('/')) {
redirect.destination = `${basePath}${redirect.destination}`;
}
if (redirect.destination.startsWith('/')) {
redirect.destination = normalizeRepeatedSlashes(redirect.destination);
}
res.statusCode = statusCode;
res.setHeader('Location', redirect.destination);
if (statusCode === RedirectStatusCode.PermanentRedirect) {
res.setHeader('Refresh', `0;url=${redirect.destination}`);
}
res.end(redirect.destination);
};
await handleRedirect(result.value.props);
return null;
}
}
if (result.value.kind !== CachedRouteKind.PAGES) {
throw Object.defineProperty(new Error(`Invariant: received non-pages cache entry in pages handler`), "__NEXT_ERROR_CODE", {
value: "E695",
enumerable: false,
configurable: true
});
}
// In dev, we should not cache pages for any reason.
if (routeModule.isDev) {
res.setHeader('Cache-Control', 'no-store, must-revalidate');
}
// Draft mode should never be cached
if (isDraftMode) {
res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
}
// when invoking _error before pages/500 we don't actually
// send the _error response
if (getRequestMeta(req, 'customErrorRender') || isErrorPage && getRequestMeta(req, 'minimalMode') && res.statusCode === 500) {
return null;
}
await sendRenderResult({
req,
res,
// If we are rendering the error page it's not a data request
// anymore
result: isNextDataRequest && !isErrorPage && !is500Page ? new RenderResult(Buffer.from(JSON.stringify(result.value.pageData)), {
contentType: JSON_CONTENT_TYPE_HEADER,
metadata: result.value.html.metadata
}) : result.value.html,
generateEtags: nextConfig.generateEtags,
poweredByHeader: nextConfig.poweredByHeader,
cacheControl: routeModule.isDev ? undefined : cacheControl
});
};
// TODO: activeSpan code path is for when wrapped by
// next-server can be removed when this is no longer used
if (activeSpan) {
await handleResponse();
} else {
await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {
spanName: `${method} ${req.url}`,
kind: SpanKind.SERVER,
attributes: {
'http.method': method,
'http.target': req.url
}
}, handleResponse));
}
} catch (err) {
await routeModule.onRequestError(req, err, {
routerKind: 'Pages Router',
routePath: srcPage,
routeType: 'render',
revalidateReason: getRevalidateReason({
isRevalidate: hasStaticProps,
isOnDemandRevalidate
})
}, routerServerContext);
// rethrow so that we can handle serving error page
throw err;
}
}
export const handler = getHandler({
srcPage: 'VAR_DEFINITION_PAGE',
config,
userland,
routeModule,
getStaticPaths,
getStaticProps,
getServerSideProps
});
//# sourceMappingURL=pages.js.map

@@ -28,3 +28,3 @@ import { getModuleBuildInfo } from '../get-module-build-info';

distDir: '',
projectDir: ''
relativeProjectDir: ''
};

@@ -31,0 +31,0 @@ return options;

@@ -7,3 +7,3 @@ /**

*/ import { setAttributesFromProps } from './set-attributes-from-props';
const version = "15.4.2-canary.14";
const version = "15.4.2-canary.15";
window.next = {

@@ -10,0 +10,0 @@ version,

@@ -29,3 +29,3 @@ /* global location */ // imports polyfill from `@next/polyfill-module` after build.

import { isNextRouterError } from './components/is-next-router-error';
export const version = "15.4.2-canary.14";
export const version = "15.4.2-canary.15";
export let router;

@@ -32,0 +32,0 @@ export const emitter = mitt();

@@ -13,3 +13,2 @@ import bytes from 'next/dist/compiled/bytes';

import { parseBody } from './parse-body';
import { RouterServerContextSymbol, routerServerGlobal } from '../../lib/router-utils/router-server-context';
function getMaxContentLength(responseLimit) {

@@ -190,3 +189,2 @@ if (responseLimit && typeof responseLimit !== 'boolean') {

async function revalidate(urlPath, opts, req, context) {
var _routerServerGlobal_RouterServerContextSymbol_context_projectDir, _routerServerGlobal_RouterServerContextSymbol;
if (typeof urlPath !== 'string' || !urlPath.startsWith('/')) {

@@ -219,3 +217,3 @@ throw Object.defineProperty(new Error(`Invalid urlPath provided to revalidate(), must be a path e.g. /blog/post-1, received ${urlPath}`), "__NEXT_ERROR_CODE", {

}
const internalRevalidate = (_routerServerGlobal_RouterServerContextSymbol = routerServerGlobal[RouterServerContextSymbol]) == null ? void 0 : (_routerServerGlobal_RouterServerContextSymbol_context_projectDir = _routerServerGlobal_RouterServerContextSymbol[context.projectDir]) == null ? void 0 : _routerServerGlobal_RouterServerContextSymbol_context_projectDir.revalidate;
const internalRevalidate = context.internalRevalidate;
try {

@@ -222,0 +220,0 @@ // We use the revalidate in router-server if available.

@@ -92,3 +92,3 @@ import { mkdir, writeFile } from 'fs/promises';

const hotReloaderSpan = trace('hot-reloader', undefined, {
version: "15.4.2-canary.14"
version: "15.4.2-canary.15"
});

@@ -95,0 +95,0 @@ // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing

@@ -498,3 +498,3 @@ import { addRequestMeta, getRequestMeta } from '../request-meta';

}
async getStaticPaths({ pathname, requestHeaders, page, isAppPath }) {
async getStaticPaths({ pathname, urlPathname, requestHeaders, page, isAppPath }) {
// we lazy load the staticPaths to prevent the user

@@ -546,2 +546,20 @@ // from waiting on them for the page to load in dev mode

const { prerenderedRoutes: staticPaths, fallbackMode: fallback } = res.value;
if (isAppPath) {
if (this.nextConfig.output === 'export') {
if (!staticPaths) {
throw Object.defineProperty(new Error(`Page "${page}" is missing exported function "generateStaticParams()", which is required with "output: export" config.`), "__NEXT_ERROR_CODE", {
value: "E353",
enumerable: false,
configurable: true
});
}
if (!staticPaths.some((item)=>item.pathname === urlPathname)) {
throw Object.defineProperty(new Error(`Page "${page}" is missing param "${pathname}" in "generateStaticParams()", which is required with "output: export" config.`), "__NEXT_ERROR_CODE", {
value: "E443",
enumerable: false,
configurable: true
});
}
}
}
if (!isAppPath && this.nextConfig.output === 'export') {

@@ -566,3 +584,5 @@ if (fallback === FallbackMode.BLOCKING_STATIC_RENDER) {

};
if (((_res_value = res.value) == null ? void 0 : _res_value.fallbackMode) !== undefined) {
if (((_res_value = res.value) == null ? void 0 : _res_value.fallbackMode) !== undefined && // This matches the hasGenerateStaticParams logic
// we do during build
(!isAppPath || staticPaths && staticPaths.length > 0)) {
// we write the static paths to partial manifest for

@@ -569,0 +589,0 @@ // fallback handling inside of entry handler's

@@ -15,3 +15,3 @@ import { loadEnvConfig } from '@next/env';

}
Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.4.2-canary.14"}`))}${bundlerSuffix}`);
Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.4.2-canary.15"}`))}${bundlerSuffix}`);
if (appUrl) {

@@ -18,0 +18,0 @@ Log.bootstrap(`- Local: ${appUrl}`);

@@ -103,2 +103,3 @@ // this must come first as it includes require hooks

const requestHandlerImpl = async (req, res)=>{
addRequestMeta(req, 'relativeProjectDir', relativeProjectDir);
// internal headers should not be honored by the request handler

@@ -105,0 +106,0 @@ if (!process.env.NEXT_PRIVATE_TEST_HEADERS) {

@@ -114,3 +114,3 @@ // Start CPU profile if it wasn't already started.

let { port } = serverOptions;
process.title = `next-server (v${"15.4.2-canary.14"})`;
process.title = `next-server (v${"15.4.2-canary.15"})`;
let handlersReady = ()=>{};

@@ -117,0 +117,0 @@ let handlersError = ()=>{};

@@ -51,3 +51,3 @@ import { RouteModule } from '../route-module';

static #_ = this.sharedModules = sharedModules;
constructor({ userland, definition, distDir, projectDir, resolvedPagePath, nextConfigOutput }){
constructor({ userland, definition, distDir, relativeProjectDir, resolvedPagePath, nextConfigOutput }){
super({

@@ -57,3 +57,3 @@ userland,

distDir,
projectDir
relativeProjectDir
}), /**

@@ -60,0 +60,0 @@ * A reference to the request async storage.

@@ -30,3 +30,3 @@ import { wrapApiHandler } from '../../api-utils';

dev: context.dev,
projectDir: context.projectDir
internalRevalidate: context.internalRevalidate
}, context.propagateError, context.dev, context.page, context.onError);

@@ -33,0 +33,0 @@ }

@@ -0,6 +1,7 @@

import App from '../../../../pages/_app';
import Document from '../../../../pages/_document';
import App from '../../../../pages/_app';
import { RouteKind } from '../../../route-kind';
import * as moduleError from '../../../../pages/_error';
import PagesRouteModule from '../module';
import { getHandler } from '../pages-handler';
export const routeModule = new PagesRouteModule({

@@ -16,3 +17,3 @@ // TODO: add descriptor for internal error page

distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',
projectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',
relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',
components: {

@@ -24,3 +25,10 @@ App,

});
export const handler = getHandler({
srcPage: '/_error',
routeModule,
userland: moduleError,
config: {},
isFallbackError: true
});
//# sourceMappingURL=_error.js.map

@@ -29,3 +29,3 @@ import { BUILD_ID_FILE, BUILD_MANIFEST, CLIENT_REFERENCE_MANIFEST, DYNAMIC_CSS_MANIFEST, NEXT_FONT_MANIFEST, PRERENDER_MANIFEST, REACT_LOADABLE_MANIFEST, ROUTES_MANIFEST, SERVER_FILES_MANIFEST, SERVER_REFERENCE_MANIFEST, SUBRESOURCE_INTEGRITY_MANIFEST } from '../../shared/lib/constants';

*/ export class RouteModule {
constructor({ userland, definition, distDir, projectDir }){
constructor({ userland, definition, distDir, relativeProjectDir }){
this.userland = userland;

@@ -35,3 +35,3 @@ this.definition = definition;

this.distDir = distDir;
this.projectDir = projectDir;
this.relativeProjectDir = relativeProjectDir;
}

@@ -47,4 +47,4 @@ async instrumentationOnRequestError(req, ...args) {

const { join } = require('node:path');
const absoluteProjectDir = getRequestMeta(req, 'projectDir') || join(process.cwd(), this.projectDir);
const { instrumentationOnRequestError } = await import('../lib/router-utils/instrumentation-globals.external');
const absoluteProjectDir = join(process.cwd(), getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir);
const { instrumentationOnRequestError } = await import('../lib/router-utils/instrumentation-globals.external.js');
return instrumentationOnRequestError(absoluteProjectDir, this.distDir, ...args);

@@ -61,2 +61,3 @@ }

buildManifest: self.__BUILD_MANIFEST,
fallbackBuildManifest: {},
reactLoadableManifest: maybeJSONParse(self.__REACT_LOADABLE_MANIFEST),

@@ -105,3 +106,3 @@ nextFontManifest: maybeJSONParse(self.__NEXT_FONT_MANIFEST),

const normalizedPagePath = normalizePagePath(srcPage);
const [routesManifest, prerenderManifest, buildManifest, reactLoadableManifest, nextFontManifest, clientReferenceManifest, serverActionsManifest, subresourceIntegrityManifest, serverFilesManifest, buildId, dynamicCssManifest] = [
const [routesManifest, prerenderManifest, buildManifest, fallbackBuildManifest, reactLoadableManifest, nextFontManifest, clientReferenceManifest, serverActionsManifest, subresourceIntegrityManifest, serverFilesManifest, buildId, dynamicCssManifest] = [
loadManifestFromRelativePath({

@@ -125,2 +126,9 @@ projectDir,

}),
srcPage === '/_error' ? loadManifestFromRelativePath({
projectDir,
distDir: this.distDir,
manifest: `fallback-${BUILD_MANIFEST}`,
shouldCache: !this.isDev,
handleMissing: true
}) : {},
loadManifestFromRelativePath({

@@ -182,2 +190,3 @@ projectDir,

buildManifest,
fallbackBuildManifest,
routesManifest,

@@ -207,3 +216,3 @@ nextFontManifest,

const { join } = require('node:path');
const absoluteProjectDir = getRequestMeta(req, 'projectDir') || join(process.cwd(), this.projectDir);
const absoluteProjectDir = join(process.cwd(), getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir);
setCacheHandler(kind, interopDefault(await dynamicImportEsmDefault(formatDynamicImportPath(`${absoluteProjectDir}/${this.distDir}`, handler))));

@@ -224,3 +233,3 @@ }

const { join } = require('node:path');
const projectDir = getRequestMeta(req, 'projectDir') || join(process.cwd(), this.projectDir);
const projectDir = join(process.cwd(), getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir);
await this.loadCustomCacheHandlers(req, nextConfig);

@@ -259,17 +268,17 @@ // incremental-cache is request specific

var _routerServerGlobal_RouterServerContextSymbol;
let projectDir;
let absoluteProjectDir;
// edge runtime handles loading instrumentation at the edge adapter level
if (process.env.NEXT_RUNTIME !== 'edge') {
const { join, relative } = require('node:path');
projectDir = getRequestMeta(req, 'projectDir') || join(process.cwd(), this.projectDir);
absoluteProjectDir = join(process.cwd(), getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir);
const absoluteDistDir = getRequestMeta(req, 'distDir');
if (absoluteDistDir) {
this.distDir = relative(projectDir, absoluteDistDir);
this.distDir = relative(absoluteProjectDir, absoluteDistDir);
}
const { ensureInstrumentationRegistered } = await import('../lib/router-utils/instrumentation-globals.external');
const { ensureInstrumentationRegistered } = await import('../lib/router-utils/instrumentation-globals.external.js');
// ensure instrumentation is registered and pass
// onRequestError below
ensureInstrumentationRegistered(projectDir, this.distDir);
ensureInstrumentationRegistered(absoluteProjectDir, this.distDir);
}
const manifests = await this.loadManifests(srcPage, projectDir);
const manifests = await this.loadManifests(srcPage, absoluteProjectDir);
const { routesManifest, prerenderManifest, serverFilesManifest } = manifests;

@@ -423,3 +432,4 @@ const { basePath, i18n, rewrites } = routesManifest;

}
const routerServerContext = (_routerServerGlobal_RouterServerContextSymbol = routerServerGlobal[RouterServerContextSymbol]) == null ? void 0 : _routerServerGlobal_RouterServerContextSymbol[this.projectDir];
const relativeProjectDir = getRequestMeta(req, 'relativeProjectDir') || this.relativeProjectDir;
const routerServerContext = (_routerServerGlobal_RouterServerContextSymbol = routerServerGlobal[RouterServerContextSymbol]) == null ? void 0 : _routerServerGlobal_RouterServerContextSymbol[relativeProjectDir];
const nextConfig = (routerServerContext == null ? void 0 : routerServerContext.nextConfig) || serverFilesManifest.config;

@@ -426,0 +436,0 @@ const normalizedSrcPage = normalizeAppPath(srcPage);

export function isStableBuild() {
var _process_env___NEXT_VERSION;
return !((_process_env___NEXT_VERSION = "15.4.2-canary.14") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
return !((_process_env___NEXT_VERSION = "15.4.2-canary.15") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
}

@@ -5,0 +5,0 @@ export class CanaryOnlyError extends Error {

import type { IncomingMessage, ServerResponse } from 'http';
import type { __ApiPreviewProps } from '../.';
import type { RevalidateFn } from '../../lib/router-utils/router-server-context';
import type { InstrumentationOnRequestError } from '../../instrumentation/types';

@@ -10,5 +11,5 @@ type ApiContext = __ApiPreviewProps & {

dev: boolean;
projectDir: string;
internalRevalidate?: RevalidateFn;
};
export declare function apiResolver(req: IncomingMessage, res: ServerResponse, query: any, resolverModule: any, apiContext: ApiContext, propagateError: boolean, dev?: boolean, page?: string, onError?: InstrumentationOnRequestError): Promise<void>;
export {};

@@ -23,3 +23,2 @@ "use strict";

const _parsebody = require("./parse-body");
const _routerservercontext = require("../../lib/router-utils/router-server-context");
function _interop_require_default(obj) {

@@ -205,3 +204,2 @@ return obj && obj.__esModule ? obj : {

async function revalidate(urlPath, opts, req, context) {
var _routerServerGlobal_RouterServerContextSymbol_context_projectDir, _routerServerGlobal_RouterServerContextSymbol;
if (typeof urlPath !== 'string' || !urlPath.startsWith('/')) {

@@ -234,3 +232,3 @@ throw Object.defineProperty(new Error(`Invalid urlPath provided to revalidate(), must be a path e.g. /blog/post-1, received ${urlPath}`), "__NEXT_ERROR_CODE", {

}
const internalRevalidate = (_routerServerGlobal_RouterServerContextSymbol = _routerservercontext.routerServerGlobal[_routerservercontext.RouterServerContextSymbol]) == null ? void 0 : (_routerServerGlobal_RouterServerContextSymbol_context_projectDir = _routerServerGlobal_RouterServerContextSymbol[context.projectDir]) == null ? void 0 : _routerServerGlobal_RouterServerContextSymbol_context_projectDir.revalidate;
const internalRevalidate = context.internalRevalidate;
try {

@@ -237,0 +235,0 @@ // We use the revalidate in router-server if available.

@@ -10,3 +10,3 @@ import type { __ApiPreviewProps } from './api-utils';

import type { RenderOptsPartial as AppRenderOptsPartial, ServerOnInstrumentationRequestError } from './app-render/types';
import { type ServerComponentsHmrCache, type ResponseCacheBase } from './response-cache';
import type { ServerComponentsHmrCache, ResponseCacheBase } from './response-cache';
import type { UrlWithParsedQuery } from 'url';

@@ -22,3 +22,2 @@ import type { PagesManifest } from '../build/webpack/plugins/pages-manifest-plugin';

import type { InstrumentationModule } from './instrumentation/types';
import { type CacheControl } from './lib/cache-control';
import RenderResult from './render-result';

@@ -33,4 +32,5 @@ import type { RouteMatcherManager } from './route-matcher-managers/route-matcher-manager';

import { type WaitUntil } from './after/builtin-request-context';
import { FallbackMode } from '../lib/fallback';
import { type FallbackMode } from '../lib/fallback';
import { SegmentPrefixRSCPathnameNormalizer } from './normalizers/request/segment-prefix-rsc';
import type { CacheControl } from './lib/cache-control';
export type FindComponentsResult = {

@@ -270,2 +270,3 @@ components: LoadComponentsReturnType;

pathname: string;
urlPathname: string;
requestHeaders: import('./lib/incremental-cache').IncrementalCache['requestHeaders'];

@@ -272,0 +273,0 @@ page: string;

@@ -148,3 +148,3 @@ "use strict";

const hotReloaderSpan = (0, _trace.trace)('hot-reloader', undefined, {
version: "15.4.2-canary.14"
version: "15.4.2-canary.15"
});

@@ -151,0 +151,0 @@ // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing

@@ -105,4 +105,5 @@ import type { FindComponentsResult, NodeRequestHandler } from '../next-server';

}): boolean;
protected getStaticPaths({ pathname, requestHeaders, page, isAppPath, }: {
protected getStaticPaths({ pathname, urlPathname, requestHeaders, page, isAppPath, }: {
pathname: string;
urlPathname: string;
requestHeaders: IncrementalCache['requestHeaders'];

@@ -109,0 +110,0 @@ page: string;

@@ -554,3 +554,3 @@ "use strict";

}
async getStaticPaths({ pathname, requestHeaders, page, isAppPath }) {
async getStaticPaths({ pathname, urlPathname, requestHeaders, page, isAppPath }) {
// we lazy load the staticPaths to prevent the user

@@ -602,2 +602,20 @@ // from waiting on them for the page to load in dev mode

const { prerenderedRoutes: staticPaths, fallbackMode: fallback } = res.value;
if (isAppPath) {
if (this.nextConfig.output === 'export') {
if (!staticPaths) {
throw Object.defineProperty(new Error(`Page "${page}" is missing exported function "generateStaticParams()", which is required with "output: export" config.`), "__NEXT_ERROR_CODE", {
value: "E353",
enumerable: false,
configurable: true
});
}
if (!staticPaths.some((item)=>item.pathname === urlPathname)) {
throw Object.defineProperty(new Error(`Page "${page}" is missing param "${pathname}" in "generateStaticParams()", which is required with "output: export" config.`), "__NEXT_ERROR_CODE", {
value: "E443",
enumerable: false,
configurable: true
});
}
}
}
if (!isAppPath && this.nextConfig.output === 'export') {

@@ -622,3 +640,5 @@ if (fallback === _fallback.FallbackMode.BLOCKING_STATIC_RENDER) {

};
if (((_res_value = res.value) == null ? void 0 : _res_value.fallbackMode) !== undefined) {
if (((_res_value = res.value) == null ? void 0 : _res_value.fallbackMode) !== undefined && // This matches the hasGenerateStaticParams logic
// we do during build
(!isAppPath || staticPaths && staticPaths.length > 0)) {
// we write the static paths to partial manifest for

@@ -625,0 +645,0 @@ // fallback handling inside of entry handler's

@@ -83,3 +83,3 @@ "use strict";

}
_log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"15.4.2-canary.14"}`))}${bundlerSuffix}`);
_log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"15.4.2-canary.15"}`))}${bundlerSuffix}`);
if (appUrl) {

@@ -86,0 +86,0 @@ _log.bootstrap(`- Local: ${appUrl}`);

@@ -158,2 +158,3 @@ // this must come first as it includes require hooks

const requestHandlerImpl = async (req, res)=>{
(0, _requestmeta.addRequestMeta)(req, 'relativeProjectDir', relativeProjectDir);
// internal headers should not be honored by the request handler

@@ -160,0 +161,0 @@ if (!process.env.NEXT_PRIVATE_TEST_HEADERS) {

@@ -182,3 +182,3 @@ // Start CPU profile if it wasn't already started.

let { port } = serverOptions;
process.title = `next-server (v${"15.4.2-canary.14"})`;
process.title = `next-server (v${"15.4.2-canary.15"})`;
let handlersReady = ()=>{};

@@ -185,0 +185,0 @@ let handlersError = ()=>{};

@@ -160,5 +160,5 @@ import type { IncomingMessage } from 'http';

/**
* The project dir the server is running in
* The relative project dir the server is running in from project root
*/
projectDir?: string;
relativeProjectDir?: string;
/**

@@ -169,6 +169,2 @@ * The dist directory the server is currently using

/**
* Whether we are generating the fallback version of the page in dev mode
*/
isIsrFallback?: boolean;
/**
* The query after resolving routes

@@ -175,0 +171,0 @@ */

@@ -112,3 +112,3 @@ import type { NextConfig } from '../../config-shared';

private readonly dynamic;
constructor({ userland, definition, distDir, projectDir, resolvedPagePath, nextConfigOutput, }: AppRouteRouteModuleOptions);
constructor({ userland, definition, distDir, relativeProjectDir, resolvedPagePath, nextConfigOutput, }: AppRouteRouteModuleOptions);
/**

@@ -115,0 +115,0 @@ * Resolves the handler function for the given method.

@@ -118,3 +118,3 @@ "use strict";

static #_ = this.sharedModules = _sharedmodules;
constructor({ userland, definition, distDir, projectDir, resolvedPagePath, nextConfigOutput }){
constructor({ userland, definition, distDir, relativeProjectDir, resolvedPagePath, nextConfigOutput }){
super({

@@ -124,3 +124,3 @@ userland,

distDir,
projectDir
relativeProjectDir
}), /**

@@ -127,0 +127,0 @@ * A reference to the request async storage.

@@ -9,2 +9,3 @@ import type { IncomingMessage, ServerResponse } from 'http';

import { apiResolver } from '../../api-utils/node/api-resolver';
import type { RevalidateFn } from '../../lib/router-utils/router-server-context';
type PagesAPIHandleFn = (req: IncomingMessage, res: ServerResponse) => Promise<void>;

@@ -77,5 +78,6 @@ /**

/**
* The relative project directory
* Internal revalidate function to avoid revalidating
* over the network
*/
projectDir: string;
internalRevalidate?: RevalidateFn;
};

@@ -82,0 +84,0 @@ export type PagesAPIRouteModuleOptions = RouteModuleOptions<PagesAPIRouteDefinition, PagesAPIUserlandModule>;

@@ -52,3 +52,3 @@ "use strict";

dev: context.dev,
projectDir: context.projectDir
internalRevalidate: context.internalRevalidate
}, context.propagateError, context.dev, context.page, context.onError);

@@ -55,0 +55,0 @@ }

import PagesRouteModule from '../module';
export declare const routeModule: PagesRouteModule;
export declare const handler: (req: import("http").IncomingMessage, res: import("http").ServerResponse, ctx: {
waitUntil: (prom: Promise<void>) => void;
}) => Promise<void>;

@@ -5,13 +5,26 @@ "use strict";

});
Object.defineProperty(exports, "routeModule", {
enumerable: true,
get: function() {
0 && (module.exports = {
handler: null,
routeModule: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
handler: function() {
return handler;
},
routeModule: function() {
return routeModule;
}
});
const _app = /*#__PURE__*/ _interop_require_default(require("../../../../pages/_app"));
const _document = /*#__PURE__*/ _interop_require_default(require("../../../../pages/_document"));
const _app = /*#__PURE__*/ _interop_require_default(require("../../../../pages/_app"));
const _routekind = require("../../../route-kind");
const _error = /*#__PURE__*/ _interop_require_wildcard(require("../../../../pages/_error"));
const _module = /*#__PURE__*/ _interop_require_default(require("../module"));
const _pageshandler = require("../pages-handler");
function _interop_require_default(obj) {

@@ -73,3 +86,3 @@ return obj && obj.__esModule ? obj : {

distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',
projectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',
relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',
components: {

@@ -81,3 +94,10 @@ App: _app.default,

});
const handler = (0, _pageshandler.getHandler)({
srcPage: '/_error',
routeModule,
userland: _error,
config: {},
isFallbackError: true
});
//# sourceMappingURL=_error.js.map

@@ -28,3 +28,3 @@ import type { IncomingMessage, ServerResponse } from 'node:http';

readonly distDir: string;
readonly projectDir: string;
readonly relativeProjectDir: string;
}

@@ -62,7 +62,7 @@ /**

distDir: string;
projectDir: string;
isAppRouter?: boolean;
relativeProjectDir: string;
incrementCache?: IncrementalCache;
responseCache?: ResponseCache;
constructor({ userland, definition, distDir, projectDir, }: RouteModuleOptions<D, U>);
constructor({ userland, definition, distDir, relativeProjectDir, }: RouteModuleOptions<D, U>);
instrumentationOnRequestError(req: IncomingMessage | BaseNextRequest, ...args: Parameters<InstrumentationOnRequestError>): Promise<void>;

@@ -92,2 +92,3 @@ private loadManifests;

buildManifest: DeepReadonly<BuildManifest>;
fallbackBuildManifest: DeepReadonly<BuildManifest>;
nextFontManifest: DeepReadonly<NextFontManifest>;

@@ -94,0 +95,0 @@ serverFilesManifest: DeepReadonly<RequiredServerFilesManifest>;

@@ -41,3 +41,3 @@ "use strict";

class RouteModule {
constructor({ userland, definition, distDir, projectDir }){
constructor({ userland, definition, distDir, relativeProjectDir }){
this.userland = userland;

@@ -47,3 +47,3 @@ this.definition = definition;

this.distDir = distDir;
this.projectDir = projectDir;
this.relativeProjectDir = relativeProjectDir;
}

@@ -59,4 +59,4 @@ async instrumentationOnRequestError(req, ...args) {

const { join } = require('node:path');
const absoluteProjectDir = (0, _requestmeta.getRequestMeta)(req, 'projectDir') || join(process.cwd(), this.projectDir);
const { instrumentationOnRequestError } = await import('../lib/router-utils/instrumentation-globals.external');
const absoluteProjectDir = join(process.cwd(), (0, _requestmeta.getRequestMeta)(req, 'relativeProjectDir') || this.relativeProjectDir);
const { instrumentationOnRequestError } = await import('../lib/router-utils/instrumentation-globals.external.js');
return instrumentationOnRequestError(absoluteProjectDir, this.distDir, ...args);

@@ -73,2 +73,3 @@ }

buildManifest: self.__BUILD_MANIFEST,
fallbackBuildManifest: {},
reactLoadableManifest: maybeJSONParse(self.__REACT_LOADABLE_MANIFEST),

@@ -117,3 +118,3 @@ nextFontManifest: maybeJSONParse(self.__NEXT_FONT_MANIFEST),

const normalizedPagePath = (0, _normalizepagepath.normalizePagePath)(srcPage);
const [routesManifest, prerenderManifest, buildManifest, reactLoadableManifest, nextFontManifest, clientReferenceManifest, serverActionsManifest, subresourceIntegrityManifest, serverFilesManifest, buildId, dynamicCssManifest] = [
const [routesManifest, prerenderManifest, buildManifest, fallbackBuildManifest, reactLoadableManifest, nextFontManifest, clientReferenceManifest, serverActionsManifest, subresourceIntegrityManifest, serverFilesManifest, buildId, dynamicCssManifest] = [
loadManifestFromRelativePath({

@@ -137,2 +138,9 @@ projectDir,

}),
srcPage === '/_error' ? loadManifestFromRelativePath({
projectDir,
distDir: this.distDir,
manifest: `fallback-${_constants.BUILD_MANIFEST}`,
shouldCache: !this.isDev,
handleMissing: true
}) : {},
loadManifestFromRelativePath({

@@ -194,2 +202,3 @@ projectDir,

buildManifest,
fallbackBuildManifest,
routesManifest,

@@ -219,3 +228,3 @@ nextFontManifest,

const { join } = require('node:path');
const absoluteProjectDir = (0, _requestmeta.getRequestMeta)(req, 'projectDir') || join(process.cwd(), this.projectDir);
const absoluteProjectDir = join(process.cwd(), (0, _requestmeta.getRequestMeta)(req, 'relativeProjectDir') || this.relativeProjectDir);
(0, _handlers.setCacheHandler)(kind, (0, _interopdefault.interopDefault)(await dynamicImportEsmDefault(formatDynamicImportPath(`${absoluteProjectDir}/${this.distDir}`, handler))));

@@ -236,3 +245,3 @@ }

const { join } = require('node:path');
const projectDir = (0, _requestmeta.getRequestMeta)(req, 'projectDir') || join(process.cwd(), this.projectDir);
const projectDir = join(process.cwd(), (0, _requestmeta.getRequestMeta)(req, 'relativeProjectDir') || this.relativeProjectDir);
await this.loadCustomCacheHandlers(req, nextConfig);

@@ -271,17 +280,17 @@ // incremental-cache is request specific

var _routerServerGlobal_RouterServerContextSymbol;
let projectDir;
let absoluteProjectDir;
// edge runtime handles loading instrumentation at the edge adapter level
if (process.env.NEXT_RUNTIME !== 'edge') {
const { join, relative } = require('node:path');
projectDir = (0, _requestmeta.getRequestMeta)(req, 'projectDir') || join(process.cwd(), this.projectDir);
absoluteProjectDir = join(process.cwd(), (0, _requestmeta.getRequestMeta)(req, 'relativeProjectDir') || this.relativeProjectDir);
const absoluteDistDir = (0, _requestmeta.getRequestMeta)(req, 'distDir');
if (absoluteDistDir) {
this.distDir = relative(projectDir, absoluteDistDir);
this.distDir = relative(absoluteProjectDir, absoluteDistDir);
}
const { ensureInstrumentationRegistered } = await import('../lib/router-utils/instrumentation-globals.external');
const { ensureInstrumentationRegistered } = await import('../lib/router-utils/instrumentation-globals.external.js');
// ensure instrumentation is registered and pass
// onRequestError below
ensureInstrumentationRegistered(projectDir, this.distDir);
ensureInstrumentationRegistered(absoluteProjectDir, this.distDir);
}
const manifests = await this.loadManifests(srcPage, projectDir);
const manifests = await this.loadManifests(srcPage, absoluteProjectDir);
const { routesManifest, prerenderManifest, serverFilesManifest } = manifests;

@@ -435,3 +444,4 @@ const { basePath, i18n, rewrites } = routesManifest;

}
const routerServerContext = (_routerServerGlobal_RouterServerContextSymbol = _routerservercontext.routerServerGlobal[_routerservercontext.RouterServerContextSymbol]) == null ? void 0 : _routerServerGlobal_RouterServerContextSymbol[this.projectDir];
const relativeProjectDir = (0, _requestmeta.getRequestMeta)(req, 'relativeProjectDir') || this.relativeProjectDir;
const routerServerContext = (_routerServerGlobal_RouterServerContextSymbol = _routerservercontext.routerServerGlobal[_routerservercontext.RouterServerContextSymbol]) == null ? void 0 : _routerServerGlobal_RouterServerContextSymbol[relativeProjectDir];
const nextConfig = (routerServerContext == null ? void 0 : routerServerContext.nextConfig) || serverFilesManifest.config;

@@ -438,0 +448,0 @@ const normalizedSrcPage = (0, _apppaths.normalizeAppPath)(srcPage);

@@ -25,3 +25,3 @@ "use strict";

var _process_env___NEXT_VERSION;
return !((_process_env___NEXT_VERSION = "15.4.2-canary.14") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
return !((_process_env___NEXT_VERSION = "15.4.2-canary.15") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
}

@@ -28,0 +28,0 @@ class CanaryOnlyError extends Error {

@@ -84,3 +84,3 @@ "use strict";

ciName: _ciinfo.isCI && _ciinfo.name || null,
nextVersion: "15.4.2-canary.14"
nextVersion: "15.4.2-canary.15"
};

@@ -87,0 +87,0 @@ return traits;

@@ -14,7 +14,7 @@ "use strict";

// This should be an invariant, if it fails our build tooling is broken.
if (typeof "15.4.2-canary.14" !== 'string') {
if (typeof "15.4.2-canary.15" !== 'string') {
return [];
}
const payload = {
nextVersion: "15.4.2-canary.14",
nextVersion: "15.4.2-canary.15",
nodeVersion: process.version,

@@ -21,0 +21,0 @@ cliCommand: event.cliCommand,

@@ -39,3 +39,3 @@ "use strict";

// This should be an invariant, if it fails our build tooling is broken.
if (typeof "15.4.2-canary.14" !== 'string') {
if (typeof "15.4.2-canary.15" !== 'string') {
return [];

@@ -45,3 +45,3 @@ }

const payload = {
nextVersion: "15.4.2-canary.14",
nextVersion: "15.4.2-canary.15",
nodeVersion: process.version,

@@ -48,0 +48,0 @@ cliCommand: event.cliCommand,

{
"name": "next",
"version": "15.4.2-canary.14",
"version": "15.4.2-canary.15",
"description": "The React Framework",

@@ -103,3 +103,3 @@ "main": "./dist/server/next.js",

"dependencies": {
"@next/env": "15.4.2-canary.14",
"@next/env": "15.4.2-canary.15",
"@swc/helpers": "0.5.15",

@@ -134,10 +134,10 @@ "caniuse-lite": "^1.0.30001579",

"sharp": "^0.34.3",
"@next/swc-darwin-arm64": "15.4.2-canary.14",
"@next/swc-darwin-x64": "15.4.2-canary.14",
"@next/swc-linux-arm64-gnu": "15.4.2-canary.14",
"@next/swc-linux-arm64-musl": "15.4.2-canary.14",
"@next/swc-linux-x64-gnu": "15.4.2-canary.14",
"@next/swc-linux-x64-musl": "15.4.2-canary.14",
"@next/swc-win32-arm64-msvc": "15.4.2-canary.14",
"@next/swc-win32-x64-msvc": "15.4.2-canary.14"
"@next/swc-darwin-arm64": "15.4.2-canary.15",
"@next/swc-darwin-x64": "15.4.2-canary.15",
"@next/swc-linux-arm64-gnu": "15.4.2-canary.15",
"@next/swc-linux-arm64-musl": "15.4.2-canary.15",
"@next/swc-linux-x64-gnu": "15.4.2-canary.15",
"@next/swc-linux-x64-musl": "15.4.2-canary.15",
"@next/swc-win32-arm64-msvc": "15.4.2-canary.15",
"@next/swc-win32-x64-msvc": "15.4.2-canary.15"
},

@@ -176,7 +176,7 @@ "devDependencies": {

"@napi-rs/triples": "1.2.0",
"@next/font": "15.4.2-canary.14",
"@next/polyfill-module": "15.4.2-canary.14",
"@next/polyfill-nomodule": "15.4.2-canary.14",
"@next/react-refresh-utils": "15.4.2-canary.14",
"@next/swc": "15.4.2-canary.14",
"@next/font": "15.4.2-canary.15",
"@next/polyfill-module": "15.4.2-canary.15",
"@next/polyfill-nomodule": "15.4.2-canary.15",
"@next/react-refresh-utils": "15.4.2-canary.15",
"@next/swc": "15.4.2-canary.15",
"@opentelemetry/api": "1.6.0",

@@ -183,0 +183,0 @@ "@playwright/test": "1.51.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet