vinext 0.0.46 → 0.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/dist/build/prerender.d.ts +2 -1
- package/dist/build/prerender.js +70 -14
- package/dist/build/prerender.js.map +1 -1
- package/dist/build/report.d.ts +1 -1
- package/dist/build/route-classification-injector.d.ts +35 -0
- package/dist/build/route-classification-injector.js +61 -0
- package/dist/build/route-classification-injector.js.map +1 -0
- package/dist/build/route-classification-manifest.d.ts +1 -1
- package/dist/build/static-export.d.ts +1 -1
- package/dist/cli-args.d.ts +31 -0
- package/dist/cli-args.js +104 -0
- package/dist/cli-args.js.map +1 -0
- package/dist/cli.js +2 -19
- package/dist/cli.js.map +1 -1
- package/dist/cloudflare/kv-cache-handler.js +29 -9
- package/dist/cloudflare/kv-cache-handler.js.map +1 -1
- package/dist/config/next-config.d.ts +4 -2
- package/dist/config/next-config.js +3 -0
- package/dist/config/next-config.js.map +1 -1
- package/dist/entries/app-rsc-entry.d.ts +4 -3
- package/dist/entries/app-rsc-entry.js +373 -854
- package/dist/entries/app-rsc-entry.js.map +1 -1
- package/dist/entries/app-rsc-manifest.d.ts +1 -1
- package/dist/entries/app-rsc-manifest.js +2 -0
- package/dist/entries/app-rsc-manifest.js.map +1 -1
- package/dist/entries/pages-server-entry.js +5 -2
- package/dist/entries/pages-server-entry.js.map +1 -1
- package/dist/index.js +28 -51
- package/dist/index.js.map +1 -1
- package/dist/plugins/fonts.js +54 -32
- package/dist/plugins/fonts.js.map +1 -1
- package/dist/plugins/rsc-client-shim-excludes.js +1 -0
- package/dist/plugins/rsc-client-shim-excludes.js.map +1 -1
- package/dist/routing/app-route-graph.d.ts +109 -0
- package/dist/routing/app-route-graph.js +819 -0
- package/dist/routing/app-route-graph.js.map +1 -0
- package/dist/routing/app-router.d.ts +2 -88
- package/dist/routing/app-router.js +6 -694
- package/dist/routing/app-router.js.map +1 -1
- package/dist/server/app-browser-entry.js +86 -252
- package/dist/server/app-browser-entry.js.map +1 -1
- package/dist/server/app-browser-error.d.ts +3 -4
- package/dist/server/app-browser-error.js +8 -4
- package/dist/server/app-browser-error.js.map +1 -1
- package/dist/server/app-browser-navigation-controller.d.ts +73 -0
- package/dist/server/app-browser-navigation-controller.js +282 -0
- package/dist/server/app-browser-navigation-controller.js.map +1 -0
- package/dist/server/app-browser-state.d.ts +1 -1
- package/dist/server/app-elements.js +1 -5
- package/dist/server/app-elements.js.map +1 -1
- package/dist/server/app-fallback-renderer.d.ts +57 -0
- package/dist/server/app-fallback-renderer.js +79 -0
- package/dist/server/app-fallback-renderer.js.map +1 -0
- package/dist/server/app-hook-warning-suppression.d.ts +7 -0
- package/dist/server/app-hook-warning-suppression.js +12 -0
- package/dist/server/app-hook-warning-suppression.js.map +1 -0
- package/dist/server/app-mounted-slots-header.d.ts +17 -0
- package/dist/server/app-mounted-slots-header.js +21 -0
- package/dist/server/app-mounted-slots-header.js.map +1 -0
- package/dist/server/app-page-boundary-render.d.ts +2 -2
- package/dist/server/app-page-boundary-render.js.map +1 -1
- package/dist/server/app-page-cache.d.ts +18 -4
- package/dist/server/app-page-cache.js +53 -10
- package/dist/server/app-page-cache.js.map +1 -1
- package/dist/server/app-page-dispatch.d.ts +7 -4
- package/dist/server/app-page-dispatch.js +24 -8
- package/dist/server/app-page-dispatch.js.map +1 -1
- package/dist/server/app-page-element-builder.d.ts +61 -0
- package/dist/server/app-page-element-builder.js +139 -0
- package/dist/server/app-page-element-builder.js.map +1 -0
- package/dist/server/app-page-params.d.ts +2 -1
- package/dist/server/app-page-params.js +3 -3
- package/dist/server/app-page-params.js.map +1 -1
- package/dist/server/app-page-render.d.ts +5 -1
- package/dist/server/app-page-render.js +80 -27
- package/dist/server/app-page-render.js.map +1 -1
- package/dist/server/app-page-request.d.ts +19 -4
- package/dist/server/app-page-request.js +51 -6
- package/dist/server/app-page-request.js.map +1 -1
- package/dist/server/app-page-response.d.ts +1 -0
- package/dist/server/app-page-response.js +3 -7
- package/dist/server/app-page-response.js.map +1 -1
- package/dist/server/app-page-route-wiring.d.ts +15 -2
- package/dist/server/app-page-route-wiring.js.map +1 -1
- package/dist/server/app-post-middleware-context.d.ts +16 -0
- package/dist/server/app-post-middleware-context.js +28 -0
- package/dist/server/app-post-middleware-context.js.map +1 -0
- package/dist/server/app-request-context.d.ts +22 -0
- package/dist/server/app-request-context.js +30 -0
- package/dist/server/app-request-context.js.map +1 -0
- package/dist/server/app-route-handler-cache.d.ts +1 -0
- package/dist/server/app-route-handler-cache.js +5 -1
- package/dist/server/app-route-handler-cache.js.map +1 -1
- package/dist/server/app-route-handler-dispatch.d.ts +1 -0
- package/dist/server/app-route-handler-dispatch.js +2 -0
- package/dist/server/app-route-handler-dispatch.js.map +1 -1
- package/dist/server/app-route-handler-execution.d.ts +2 -1
- package/dist/server/app-route-handler-execution.js +2 -2
- package/dist/server/app-route-handler-execution.js.map +1 -1
- package/dist/server/app-route-handler-response.d.ts +4 -2
- package/dist/server/app-route-handler-response.js +8 -7
- package/dist/server/app-route-handler-response.js.map +1 -1
- package/dist/server/app-rsc-error-handler.d.ts +21 -0
- package/dist/server/app-rsc-error-handler.js +30 -0
- package/dist/server/app-rsc-error-handler.js.map +1 -0
- package/dist/server/app-rsc-handler.d.ts +117 -0
- package/dist/server/app-rsc-handler.js +260 -0
- package/dist/server/app-rsc-handler.js.map +1 -0
- package/dist/server/app-rsc-request-normalization.d.ts +40 -0
- package/dist/server/app-rsc-request-normalization.js +63 -0
- package/dist/server/app-rsc-request-normalization.js.map +1 -0
- package/dist/server/app-rsc-response-finalizer.d.ts +30 -0
- package/dist/server/app-rsc-response-finalizer.js +38 -0
- package/dist/server/app-rsc-response-finalizer.js.map +1 -0
- package/dist/server/app-segment-config.d.ts +33 -0
- package/dist/server/app-segment-config.js +86 -0
- package/dist/server/app-segment-config.js.map +1 -0
- package/dist/server/app-server-action-execution.d.ts +2 -0
- package/dist/server/app-server-action-execution.js +2 -0
- package/dist/server/app-server-action-execution.js.map +1 -1
- package/dist/server/cache-control.d.ts +24 -0
- package/dist/server/cache-control.js +33 -0
- package/dist/server/cache-control.js.map +1 -0
- package/dist/server/dev-error-overlay-store.d.ts +23 -0
- package/dist/server/dev-error-overlay-store.js +67 -0
- package/dist/server/dev-error-overlay-store.js.map +1 -0
- package/dist/server/dev-error-overlay.d.ts +15 -0
- package/dist/server/dev-error-overlay.js +548 -0
- package/dist/server/dev-error-overlay.js.map +1 -0
- package/dist/server/instrumentation-runtime.d.ts +44 -0
- package/dist/server/instrumentation-runtime.js +29 -0
- package/dist/server/instrumentation-runtime.js.map +1 -0
- package/dist/server/isr-cache.d.ts +2 -7
- package/dist/server/isr-cache.js +7 -10
- package/dist/server/isr-cache.js.map +1 -1
- package/dist/server/pages-page-data.d.ts +2 -1
- package/dist/server/pages-page-data.js +6 -5
- package/dist/server/pages-page-data.js.map +1 -1
- package/dist/server/pages-page-response.d.ts +2 -1
- package/dist/server/pages-page-response.js +3 -2
- package/dist/server/pages-page-response.js.map +1 -1
- package/dist/server/rsc-stream-hints.d.ts +3 -1
- package/dist/server/rsc-stream-hints.js +4 -1
- package/dist/server/rsc-stream-hints.js.map +1 -1
- package/dist/server/seed-cache.js +19 -8
- package/dist/server/seed-cache.js.map +1 -1
- package/dist/shims/cache-runtime.js +28 -11
- package/dist/shims/cache-runtime.js.map +1 -1
- package/dist/shims/cache.d.ts +15 -3
- package/dist/shims/cache.js +42 -15
- package/dist/shims/cache.js.map +1 -1
- package/dist/shims/error-boundary.d.ts +17 -1
- package/dist/shims/error-boundary.js +31 -1
- package/dist/shims/error-boundary.js.map +1 -1
- package/dist/shims/fetch-cache.d.ts +4 -1
- package/dist/shims/fetch-cache.js +55 -13
- package/dist/shims/fetch-cache.js.map +1 -1
- package/dist/shims/image.js +93 -5
- package/dist/shims/image.js.map +1 -1
- package/dist/shims/request-state-types.d.ts +1 -1
- package/dist/shims/unified-request-context.d.ts +1 -1
- package/dist/shims/unified-request-context.js +1 -0
- package/dist/shims/unified-request-context.js.map +1 -1
- package/dist/shims/use-merged-ref.d.ts +7 -0
- package/dist/shims/use-merged-ref.js +40 -0
- package/dist/shims/use-merged-ref.js.map +1 -0
- package/dist/utils/cache-control-metadata.d.ts +6 -0
- package/dist/utils/cache-control-metadata.js +16 -0
- package/dist/utils/cache-control-metadata.js.map +1 -0
- package/package.json +1 -1
|
@@ -12,35 +12,31 @@ import { generateDevOriginCheckCode } from "../server/dev-origin-check.js";
|
|
|
12
12
|
*
|
|
13
13
|
* Previously housed in server/app-dev-server.ts.
|
|
14
14
|
*/
|
|
15
|
-
const
|
|
16
|
-
const requestPipelinePath = resolveEntryPath("../server/request-pipeline.js", import.meta.url);
|
|
17
|
-
const appMiddlewarePath = resolveEntryPath("../server/app-middleware.js", import.meta.url);
|
|
15
|
+
const DEFAULT_EXPIRE_TIME = 31536e3;
|
|
18
16
|
const middlewareRequestHeadersPath = resolveEntryPath("../server/middleware-request-headers.js", import.meta.url);
|
|
19
|
-
const requestContextShimPath = resolveEntryPath("../shims/request-context.js", import.meta.url);
|
|
20
17
|
const normalizePathModulePath = resolveEntryPath("../server/normalize-path.js", import.meta.url);
|
|
21
|
-
const
|
|
18
|
+
const appRscHandlerPath = resolveEntryPath("../server/app-rsc-handler.js", import.meta.url);
|
|
22
19
|
const appRouteHandlerDispatchPath = resolveEntryPath("../server/app-route-handler-dispatch.js", import.meta.url);
|
|
23
20
|
const appServerActionExecutionPath = resolveEntryPath("../server/app-server-action-execution.js", import.meta.url);
|
|
24
21
|
const appRscErrorsPath = resolveEntryPath("../server/app-rsc-errors.js", import.meta.url);
|
|
25
|
-
const implicitTagsPath = resolveEntryPath("../server/implicit-tags.js", import.meta.url);
|
|
26
22
|
const appPageExecutionPath = resolveEntryPath("../server/app-page-execution.js", import.meta.url);
|
|
27
|
-
const
|
|
23
|
+
const appFallbackRendererPath = resolveEntryPath("../server/app-fallback-renderer.js", import.meta.url);
|
|
28
24
|
const appElementsPath = resolveEntryPath("../server/app-elements.js", import.meta.url);
|
|
29
25
|
const appPageRouteWiringPath = resolveEntryPath("../server/app-page-route-wiring.js", import.meta.url);
|
|
30
26
|
const appPageHeadPath = resolveEntryPath("../server/app-page-head.js", import.meta.url);
|
|
31
27
|
const appPageParamsPath = resolveEntryPath("../server/app-page-params.js", import.meta.url);
|
|
32
|
-
const appPageResponsePath = resolveEntryPath("../server/app-page-response.js", import.meta.url);
|
|
33
28
|
const appPageDispatchPath = resolveEntryPath("../server/app-page-dispatch.js", import.meta.url);
|
|
34
|
-
const
|
|
29
|
+
const appPageRequestPath = resolveEntryPath("../server/app-page-request.js", import.meta.url);
|
|
30
|
+
const appSegmentConfigPath = resolveEntryPath("../server/app-segment-config.js", import.meta.url);
|
|
35
31
|
const appRscRouteMatchingPath = resolveEntryPath("../server/app-rsc-route-matching.js", import.meta.url);
|
|
36
|
-
const appPrerenderEndpointsPath = resolveEntryPath("../server/app-prerender-endpoints.js", import.meta.url);
|
|
37
|
-
const prerenderWorkUnitSetupPath = resolveEntryPath("../server/prerender-work-unit-setup.js", import.meta.url);
|
|
38
32
|
const rscStreamHintsPath = resolveEntryPath("../server/rsc-stream-hints.js", import.meta.url);
|
|
39
33
|
const isrCachePath = resolveEntryPath("../server/isr-cache.js", import.meta.url);
|
|
40
|
-
const rootParamsShimPath = resolveEntryPath("../shims/root-params.js", import.meta.url);
|
|
41
34
|
const thenableParamsShimPath = resolveEntryPath("../shims/thenable-params.js", import.meta.url);
|
|
42
|
-
const
|
|
43
|
-
const
|
|
35
|
+
const appPageElementBuilderPath = resolveEntryPath("../server/app-page-element-builder.js", import.meta.url);
|
|
36
|
+
const instrumentationRuntimePath = resolveEntryPath("../server/instrumentation-runtime.js", import.meta.url);
|
|
37
|
+
const appRscErrorHandlerPath = resolveEntryPath("../server/app-rsc-error-handler.js", import.meta.url);
|
|
38
|
+
const appRequestContextPath = resolveEntryPath("../server/app-request-context.js", import.meta.url);
|
|
39
|
+
const appHookWarningSuppressionPath = resolveEntryPath("../server/app-hook-warning-suppression.js", import.meta.url);
|
|
44
40
|
/**
|
|
45
41
|
* Generate the virtual RSC entry module.
|
|
46
42
|
*
|
|
@@ -60,6 +56,7 @@ function generateRscEntry(appDir, routes, middlewarePath, metadataRoutes, global
|
|
|
60
56
|
const headers = config?.headers ?? [];
|
|
61
57
|
const allowedOrigins = config?.allowedOrigins ?? [];
|
|
62
58
|
const bodySizeLimit = config?.bodySizeLimit ?? 1 * 1024 * 1024;
|
|
59
|
+
const expireTime = config?.expireTime ?? DEFAULT_EXPIRE_TIME;
|
|
63
60
|
const i18nConfig = config?.i18n ?? null;
|
|
64
61
|
const hasPagesDir = config?.hasPagesDir ?? false;
|
|
65
62
|
const publicFiles = config?.publicFiles ?? [];
|
|
@@ -74,7 +71,6 @@ async function __loadPrerenderPagesRoutes() {
|
|
|
74
71
|
return __gspSsrEntry.pageRoutes;
|
|
75
72
|
}
|
|
76
73
|
` : "";
|
|
77
|
-
const prerenderPagesLoaderOption = hasPagesDir ? " loadPagesRoutes: __loadPrerenderPagesRoutes,\n" : "";
|
|
78
74
|
return `
|
|
79
75
|
import {
|
|
80
76
|
renderToReadableStream as _renderToReadableStream,
|
|
@@ -83,28 +79,19 @@ import {
|
|
|
83
79
|
loadServerAction,
|
|
84
80
|
createTemporaryReferenceSet,
|
|
85
81
|
} from "@vitejs/plugin-rsc/rsc";
|
|
86
|
-
import {
|
|
82
|
+
import { createRscRenderer } from ${JSON.stringify(rscStreamHintsPath)};
|
|
87
83
|
|
|
88
|
-
|
|
89
|
-
normalizeReactFlightPreloadHints as __normalizeReactFlightPreloadHints,
|
|
90
|
-
} from ${JSON.stringify(rscStreamHintsPath)};
|
|
91
|
-
|
|
92
|
-
function renderToReadableStream(model, options) {
|
|
93
|
-
return __normalizeReactFlightPreloadHints(_renderToReadableStream(model, options));
|
|
94
|
-
}
|
|
84
|
+
const renderToReadableStream = createRscRenderer(_renderToReadableStream);
|
|
95
85
|
import { createElement } from "react";
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
86
|
+
import { getNavigationContext as _getNavigationContext } from "next/navigation";
|
|
87
|
+
import { headersContextFromRequest, getDraftModeCookieHeader, getAndClearPendingCookies, consumeDynamicUsage, consumeInvalidDynamicUsageError, setHeadersAccessPhase } from "next/headers";
|
|
98
88
|
import { mergeMetadata, resolveModuleMetadata, mergeViewport, resolveModuleViewport } from "vinext/metadata";
|
|
99
89
|
${middlewarePath ? `import * as middlewareModule from ${JSON.stringify(middlewarePath.replace(/\\/g, "/"))};` : ""}
|
|
100
|
-
${instrumentationPath ? `import * as _instrumentation from ${JSON.stringify(instrumentationPath.replace(/\\/g, "/"))}
|
|
101
|
-
import {
|
|
102
|
-
import {
|
|
103
|
-
import { decodePathParams as __decodePathParams
|
|
104
|
-
import { normalizePathnameForRouteMatch as __normalizePathnameForRouteMatch, normalizePathnameForRouteMatchStrict as __normalizePathnameForRouteMatchStrict } from ${JSON.stringify(routingUtilsPath)};
|
|
90
|
+
${instrumentationPath ? `import * as _instrumentation from ${JSON.stringify(instrumentationPath.replace(/\\/g, "/"))};
|
|
91
|
+
import { ensureInstrumentationRegistered as __ensureInstrumentationRegistered } from ${JSON.stringify(instrumentationRuntimePath)};` : ""}
|
|
92
|
+
import { createAppRscHandler as __createAppRscHandler } from ${JSON.stringify(appRscHandlerPath)};
|
|
93
|
+
import { decodePathParams as __decodePathParams } from ${JSON.stringify(normalizePathModulePath)};
|
|
105
94
|
import { buildRequestHeadersFromMiddlewareResponse as __buildRequestHeadersFromMiddlewareResponse } from ${JSON.stringify(middlewareRequestHeadersPath)};
|
|
106
|
-
import { applyConfigHeadersToResponse, resolvePublicFileRoute, validateImageUrl, guardProtocolRelativeUrl, hasBasePath, stripBasePath, normalizeTrailingSlash } from ${JSON.stringify(requestPipelinePath)};
|
|
107
|
-
import { applyAppMiddleware as __applyAppMiddleware } from ${JSON.stringify(appMiddlewarePath)};
|
|
108
95
|
import {
|
|
109
96
|
dispatchAppRouteHandler as __dispatchAppRouteHandler,
|
|
110
97
|
} from ${JSON.stringify(appRouteHandlerDispatchPath)};
|
|
@@ -115,102 +102,67 @@ import {
|
|
|
115
102
|
readActionFormDataWithLimit as __readFormDataWithLimit,
|
|
116
103
|
} from ${JSON.stringify(appServerActionExecutionPath)};
|
|
117
104
|
import {
|
|
118
|
-
createRscOnErrorHandler as __createRscOnErrorHandler,
|
|
119
105
|
sanitizeErrorForClient as __sanitizeErrorForClient,
|
|
120
106
|
} from ${JSON.stringify(appRscErrorsPath)};
|
|
107
|
+
import { createAppRscOnErrorHandler } from ${JSON.stringify(appRscErrorHandlerPath)};
|
|
121
108
|
import {
|
|
122
109
|
buildAppPageFontLinkHeader as __buildAppPageFontLinkHeader,
|
|
123
110
|
resolveAppPageSpecialError as __resolveAppPageSpecialError,
|
|
124
111
|
} from ${JSON.stringify(appPageExecutionPath)};
|
|
125
112
|
import {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
} from ${JSON.stringify(appPageBoundaryRenderPath)};
|
|
113
|
+
createAppFallbackRenderer as __createAppFallbackRenderer,
|
|
114
|
+
} from ${JSON.stringify(appFallbackRendererPath)};
|
|
129
115
|
import {
|
|
130
116
|
APP_INTERCEPTION_CONTEXT_KEY as __APP_INTERCEPTION_CONTEXT_KEY,
|
|
131
117
|
createAppPayloadRouteId as __createAppPayloadRouteId,
|
|
132
118
|
} from ${JSON.stringify(appElementsPath)};
|
|
133
119
|
import {
|
|
134
|
-
buildAppPageElements as __buildAppPageElements,
|
|
135
|
-
createAppPageTreePath as __createAppPageTreePath,
|
|
136
120
|
resolveAppPageChildSegments as __resolveAppPageChildSegments,
|
|
137
121
|
} from ${JSON.stringify(appPageRouteWiringPath)};
|
|
122
|
+
import { buildPageElements as __buildPageElements } from ${JSON.stringify(appPageElementBuilderPath)};
|
|
138
123
|
import {
|
|
139
124
|
resolveAppPageSegmentParams as __resolveAppPageSegmentParams,
|
|
140
125
|
} from ${JSON.stringify(appPageParamsPath)};
|
|
141
126
|
import {
|
|
142
127
|
collectAppPageSearchParams as __collectAppPageSearchParams,
|
|
143
|
-
resolveActiveParallelRouteHeadInputs as __resolveActiveParallelRouteHeadInputs,
|
|
144
|
-
resolveAppPageHead as __resolveAppPageHead,
|
|
145
128
|
} from ${JSON.stringify(appPageHeadPath)};
|
|
146
|
-
import {
|
|
147
|
-
mergeMiddlewareResponseHeaders as __mergeMiddlewareResponseHeaders,
|
|
148
|
-
} from ${JSON.stringify(appPageResponsePath)};
|
|
149
129
|
import {
|
|
150
130
|
dispatchAppPage as __dispatchAppPage,
|
|
151
131
|
} from ${JSON.stringify(appPageDispatchPath)};
|
|
152
|
-
import {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
import {
|
|
132
|
+
import {
|
|
133
|
+
resolveAppPageGenerateStaticParamsSources as __resolveAppPageGenerateStaticParamsSources,
|
|
134
|
+
} from ${JSON.stringify(appPageRequestPath)};
|
|
135
|
+
import {
|
|
136
|
+
resolveAppPageFetchCacheMode as __resolveAppPageFetchCacheMode,
|
|
137
|
+
resolveAppPageSegmentConfig as __resolveAppPageSegmentConfig,
|
|
138
|
+
} from ${JSON.stringify(appSegmentConfigPath)};
|
|
156
139
|
import { makeThenableParams } from ${JSON.stringify(thenableParamsShimPath)};
|
|
157
|
-
import { ensureFetchPatch as _ensureFetchPatch, setCurrentFetchSoftTags } from "vinext/fetch-cache";
|
|
158
140
|
import {
|
|
159
141
|
createAppRscRouteMatcher as __createAppRscRouteMatcher,
|
|
160
142
|
} from ${JSON.stringify(appRscRouteMatchingPath)};
|
|
161
|
-
import {
|
|
162
|
-
handleAppPrerenderEndpoint as __handleAppPrerenderEndpoint,
|
|
163
|
-
} from ${JSON.stringify(appPrerenderEndpointsPath)};
|
|
164
143
|
import {
|
|
165
144
|
appIsrHtmlKey as __isrHtmlKey,
|
|
166
145
|
appIsrRscKey as __isrRscKey,
|
|
167
146
|
appIsrRouteKey as __isrRouteKey,
|
|
168
147
|
isrGet as __isrGet,
|
|
169
148
|
isrSet as __isrSet,
|
|
170
|
-
normalizeMountedSlotsHeader as __normalizeMountedSlotsHeader,
|
|
171
149
|
triggerBackgroundRegeneration as __triggerBackgroundRegeneration,
|
|
172
150
|
} from ${JSON.stringify(isrCachePath)};
|
|
173
151
|
// Import server-only state module to register ALS-backed accessors.
|
|
174
152
|
import "vinext/navigation-state";
|
|
175
|
-
import { runWithPrerenderWorkUnit as __runWithPrerenderWorkUnit } from ${JSON.stringify(prerenderWorkUnitSetupPath)};
|
|
176
|
-
import { runWithRequestContext as _runWithUnifiedCtx, createRequestContext as _createUnifiedCtx } from "vinext/unified-request-context";
|
|
177
153
|
import { reportRequestError as _reportRequestError } from "vinext/instrumentation";
|
|
178
|
-
import { flattenErrorCauses as __flattenErrorCauses } from ${JSON.stringify(errorCausePath)};
|
|
179
154
|
import { getSSRFontLinks as _getSSRFontLinks, getSSRFontStyles as _getSSRFontStylesGoogle, getSSRFontPreloads as _getSSRFontPreloadsGoogle } from "next/font/google";
|
|
180
155
|
import { getSSRFontStyles as _getSSRFontStylesLocal, getSSRFontPreloads as _getSSRFontPreloadsLocal } from "next/font/local";
|
|
181
156
|
function _getSSRFontStyles() { return [..._getSSRFontStylesGoogle(), ..._getSSRFontStylesLocal()]; }
|
|
182
157
|
function _getSSRFontPreloads() { return [..._getSSRFontPreloadsGoogle(), ..._getSSRFontPreloadsLocal()]; }
|
|
183
158
|
${hasPagesDir ? `// Pages Router routes are loaded lazily from the SSR environment for internal prerender requests.` : ""}
|
|
184
159
|
|
|
185
|
-
//
|
|
186
|
-
//
|
|
187
|
-
// console.error once at module load (
|
|
188
|
-
//
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
const _origConsoleError = console.error;
|
|
192
|
-
console.error = (...args) => {
|
|
193
|
-
if (_suppressHookWarningAls.getStore() === true &&
|
|
194
|
-
typeof args[0] === "string" &&
|
|
195
|
-
args[0].includes("Invalid hook call")) return;
|
|
196
|
-
_origConsoleError.apply(console, args);
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
// Set navigation context in the ALS-backed store. "use client" components
|
|
200
|
-
// rendered during SSR need the pathname/searchParams/params but the SSR
|
|
201
|
-
// environment has a separate module instance of next/navigation.
|
|
202
|
-
// Use _getNavigationContext() to read the current context — never cache
|
|
203
|
-
// it in a module-level variable (that would leak between concurrent requests).
|
|
204
|
-
function setNavigationContext(ctx) {
|
|
205
|
-
_setNavigationContextOrig(ctx);
|
|
206
|
-
if (ctx === null) __setRootParams(null);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
function __clearRequestContext() {
|
|
210
|
-
setHeadersContext(null);
|
|
211
|
-
setNavigationContext(null);
|
|
212
|
-
// setNavigationContext(null) already clears root params internally
|
|
213
|
-
}
|
|
160
|
+
// Suppress expected "Invalid hook call" dev warning when layout/page
|
|
161
|
+
// components are probed outside React's render cycle. The import patches
|
|
162
|
+
// console.error once at module load (side-effect) and exposes the ALS
|
|
163
|
+
// so per-route dispatch can opt into suppression via .run(true, ...).
|
|
164
|
+
import { suppressHookWarningAls } from ${JSON.stringify(appHookWarningSuppressionPath)};
|
|
165
|
+
import { clearAppRequestContext as __clearRequestContext, setAppNavigationContext as setNavigationContext } from ${JSON.stringify(appRequestContextPath)};
|
|
214
166
|
|
|
215
167
|
// Note: cache entries are written with \`headers: undefined\`. Next.js stores
|
|
216
168
|
// response headers (e.g. set-cookie from cookies().set() during render) in the
|
|
@@ -239,57 +191,19 @@ const __classDebug = process.env.VINEXT_DEBUG_CLASSIFICATION
|
|
|
239
191
|
}
|
|
240
192
|
: undefined;
|
|
241
193
|
|
|
242
|
-
function
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
headers: Object.fromEntries(request.headers.entries()),
|
|
247
|
-
};
|
|
248
|
-
const errorContext = {
|
|
249
|
-
routerKind: "App Router",
|
|
250
|
-
routePath: routePath || pathname,
|
|
251
|
-
routeType: "render",
|
|
252
|
-
};
|
|
253
|
-
return __createRscOnErrorHandler({
|
|
254
|
-
errorContext,
|
|
255
|
-
reportRequestError: _reportRequestError,
|
|
256
|
-
requestInfo,
|
|
194
|
+
function __resolveRouteFetchCacheMode(route) {
|
|
195
|
+
return __resolveAppPageFetchCacheMode({
|
|
196
|
+
layouts: route.layouts,
|
|
197
|
+
page: route.page,
|
|
257
198
|
});
|
|
258
199
|
}
|
|
259
200
|
|
|
260
201
|
${imports.join("\n")}
|
|
261
202
|
|
|
262
|
-
${instrumentationPath ? `//
|
|
263
|
-
//
|
|
264
|
-
//
|
|
265
|
-
//
|
|
266
|
-
// handled" guarantee while not blocking V8 isolate initialization.
|
|
267
|
-
// On Cloudflare Workers, module evaluation happens synchronously in the isolate
|
|
268
|
-
// startup phase; a top-level await extends that phase and increases cold-start
|
|
269
|
-
// wall time for all requests, not just the first.
|
|
270
|
-
let __instrumentationInitialized = false;
|
|
271
|
-
let __instrumentationInitPromise = null;
|
|
272
|
-
async function __ensureInstrumentation() {
|
|
273
|
-
if (process.env.VINEXT_PRERENDER === "1") return;
|
|
274
|
-
if (__instrumentationInitialized) return;
|
|
275
|
-
if (__instrumentationInitPromise) return __instrumentationInitPromise;
|
|
276
|
-
__instrumentationInitPromise = (async () => {
|
|
277
|
-
if (typeof _instrumentation.register === "function") {
|
|
278
|
-
await _instrumentation.register();
|
|
279
|
-
}
|
|
280
|
-
// Store the onRequestError handler on globalThis so it is visible to
|
|
281
|
-
// reportRequestError() (imported as _reportRequestError above) regardless
|
|
282
|
-
// of which Vite environment module graph it is called from. With
|
|
283
|
-
// @vitejs/plugin-rsc the RSC and SSR environments run in the same Node.js
|
|
284
|
-
// process and share globalThis. With @cloudflare/vite-plugin everything
|
|
285
|
-
// runs inside the Worker so globalThis is the Worker's global — also correct.
|
|
286
|
-
if (typeof _instrumentation.onRequestError === "function") {
|
|
287
|
-
globalThis.__VINEXT_onRequestErrorHandler__ = _instrumentation.onRequestError;
|
|
288
|
-
}
|
|
289
|
-
__instrumentationInitialized = true;
|
|
290
|
-
})();
|
|
291
|
-
return __instrumentationInitPromise;
|
|
292
|
-
}` : ""}
|
|
203
|
+
${instrumentationPath ? `// Lazy instrumentation initialisation is handled by ensureInstrumentationRegistered
|
|
204
|
+
// (imported from vinext/instrumentation-runtime). The generated entry only passes
|
|
205
|
+
// the user module in; all bookkeeping (initialized flag, shared promise, prerender
|
|
206
|
+
// skip) lives in the typed helper so it can be unit-tested independently.` : ""}
|
|
293
207
|
|
|
294
208
|
// Build-time layout classification dispatch. Replaced in generateBundle
|
|
295
209
|
// with a switch statement that returns a pre-computed per-layout
|
|
@@ -322,96 +236,40 @@ const rootNotFoundModule = ${rootNotFoundVar ? rootNotFoundVar : "null"};
|
|
|
322
236
|
const rootForbiddenModule = ${rootForbiddenVar ? rootForbiddenVar : "null"};
|
|
323
237
|
const rootUnauthorizedModule = ${rootUnauthorizedVar ? rootUnauthorizedVar : "null"};
|
|
324
238
|
const rootLayouts = [${rootLayoutVars.join(", ")}];
|
|
325
|
-
const __APP_PAGE_EMPTY_MW_CTX = { headers: null, status: null };
|
|
326
239
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
* Returns null if no matching component is available.
|
|
330
|
-
*
|
|
331
|
-
* @param opts.boundaryComponent - Override the boundary component (for layout-level notFound)
|
|
332
|
-
* @param opts.layouts - Override the layouts to wrap with (for layout-level notFound, excludes the throwing layout)
|
|
333
|
-
*/
|
|
334
|
-
async function renderHTTPAccessFallbackPage(route, statusCode, isRscRequest, request, opts, scriptNonce, middlewareContext) {
|
|
335
|
-
return __renderAppPageHttpAccessFallback({
|
|
336
|
-
boundaryComponent: opts?.boundaryComponent ?? null,
|
|
337
|
-
buildFontLinkHeader: __buildAppPageFontLinkHeader,
|
|
338
|
-
clearRequestContext() {
|
|
339
|
-
__clearRequestContext();
|
|
340
|
-
},
|
|
341
|
-
createRscOnErrorHandler(pathname, routePath) {
|
|
342
|
-
return createRscOnErrorHandler(request, pathname, routePath);
|
|
343
|
-
},
|
|
344
|
-
getFontLinks: _getSSRFontLinks,
|
|
345
|
-
getFontPreloads: _getSSRFontPreloads,
|
|
346
|
-
getFontStyles: _getSSRFontStyles,
|
|
347
|
-
getNavigationContext: _getNavigationContext,
|
|
348
|
-
globalErrorModule: ${globalErrorVar ? globalErrorVar : "null"},
|
|
349
|
-
isRscRequest,
|
|
350
|
-
layoutModules: opts?.layouts ?? null,
|
|
351
|
-
loadSsrHandler() {
|
|
352
|
-
return import.meta.viteRsc.loadModule("ssr", "index");
|
|
353
|
-
},
|
|
354
|
-
makeThenableParams,
|
|
355
|
-
matchedParams: opts?.matchedParams ?? route?.params ?? {},
|
|
356
|
-
middlewareContext: middlewareContext ?? __APP_PAGE_EMPTY_MW_CTX,
|
|
357
|
-
metadataRoutes,
|
|
358
|
-
requestUrl: request.url,
|
|
359
|
-
resolveChildSegments: __resolveAppPageChildSegments,
|
|
360
|
-
rootForbiddenModule: rootForbiddenModule,
|
|
361
|
-
rootLayouts: rootLayouts,
|
|
362
|
-
rootNotFoundModule: rootNotFoundModule,
|
|
363
|
-
rootUnauthorizedModule: rootUnauthorizedModule,
|
|
364
|
-
route,
|
|
365
|
-
renderToReadableStream,
|
|
366
|
-
scriptNonce,
|
|
367
|
-
statusCode,
|
|
368
|
-
});
|
|
369
|
-
}
|
|
240
|
+
const createRscOnErrorHandler = (request, pathname, routePath) =>
|
|
241
|
+
createAppRscOnErrorHandler(_reportRequestError, request, pathname, routePath);
|
|
370
242
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
return __renderAppPageErrorBoundary({
|
|
243
|
+
const __fallbackRenderer = __createAppFallbackRenderer({
|
|
244
|
+
rootBoundaries: {
|
|
245
|
+
rootForbiddenModule,
|
|
246
|
+
rootLayouts,
|
|
247
|
+
rootNotFoundModule,
|
|
248
|
+
rootUnauthorizedModule,
|
|
249
|
+
},
|
|
250
|
+
globalErrorModule: ${globalErrorVar ? globalErrorVar : "null"},
|
|
251
|
+
metadataRoutes,
|
|
252
|
+
ssrLoader() {
|
|
253
|
+
return import.meta.viteRsc.loadModule("ssr", "index");
|
|
254
|
+
},
|
|
255
|
+
fontProviders: {
|
|
385
256
|
buildFontLinkHeader: __buildAppPageFontLinkHeader,
|
|
386
|
-
clearRequestContext() {
|
|
387
|
-
__clearRequestContext();
|
|
388
|
-
},
|
|
389
|
-
createRscOnErrorHandler(pathname, routePath) {
|
|
390
|
-
return createRscOnErrorHandler(request, pathname, routePath);
|
|
391
|
-
},
|
|
392
|
-
error,
|
|
393
257
|
getFontLinks: _getSSRFontLinks,
|
|
394
258
|
getFontPreloads: _getSSRFontPreloads,
|
|
395
259
|
getFontStyles: _getSSRFontStyles,
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
route,
|
|
410
|
-
renderToReadableStream,
|
|
411
|
-
sanitizeErrorForClient: __sanitizeErrorForClient,
|
|
412
|
-
scriptNonce,
|
|
413
|
-
});
|
|
414
|
-
}
|
|
260
|
+
},
|
|
261
|
+
makeThenableParams,
|
|
262
|
+
sanitizer: __sanitizeErrorForClient,
|
|
263
|
+
rscRenderer: renderToReadableStream,
|
|
264
|
+
getNavigationContext: _getNavigationContext,
|
|
265
|
+
resolveChildSegments: __resolveAppPageChildSegments,
|
|
266
|
+
clearRequestContext() {
|
|
267
|
+
__clearRequestContext();
|
|
268
|
+
},
|
|
269
|
+
createRscOnErrorHandler(request, pathname, routePath) {
|
|
270
|
+
return createRscOnErrorHandler(request, pathname, routePath);
|
|
271
|
+
},
|
|
272
|
+
});
|
|
415
273
|
|
|
416
274
|
function matchRoute(url) {
|
|
417
275
|
return __routeMatcher.matchRoute(url);
|
|
@@ -426,110 +284,16 @@ function findIntercept(pathname, sourcePathname = null) {
|
|
|
426
284
|
}
|
|
427
285
|
|
|
428
286
|
async function buildPageElements(route, params, routePath, pageRequest) {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
searchParams,
|
|
432
|
-
isRscRequest,
|
|
433
|
-
request,
|
|
434
|
-
mountedSlotsHeader,
|
|
435
|
-
} = pageRequest;
|
|
436
|
-
const hasPageModule = !!route.page;
|
|
437
|
-
const PageComponent = route.page?.default;
|
|
438
|
-
if (hasPageModule && !PageComponent) {
|
|
439
|
-
const _interceptionContext = opts?.interceptionContext ?? null;
|
|
440
|
-
const _noExportRouteId = __createAppPayloadRouteId(routePath, _interceptionContext);
|
|
441
|
-
let _noExportRootLayout = null;
|
|
442
|
-
if (route.layouts?.length > 0) {
|
|
443
|
-
// Compute the root layout tree path for this error payload using the
|
|
444
|
-
// canonical helper so it stays aligned with buildAppPageElements().
|
|
445
|
-
const _tp = route.layoutTreePositions?.[0] ?? 0;
|
|
446
|
-
_noExportRootLayout = __createAppPageTreePath(route.routeSegments, _tp);
|
|
447
|
-
}
|
|
448
|
-
return {
|
|
449
|
-
[__APP_INTERCEPTION_CONTEXT_KEY]: _interceptionContext,
|
|
450
|
-
__route: _noExportRouteId,
|
|
451
|
-
__rootLayout: _noExportRootLayout,
|
|
452
|
-
[_noExportRouteId]: createElement("div", null, "Page has no default export"),
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
const {
|
|
457
|
-
hasSearchParams,
|
|
458
|
-
metadata: resolvedMetadata,
|
|
459
|
-
pageSearchParams,
|
|
460
|
-
viewport: resolvedViewport,
|
|
461
|
-
} = await __resolveAppPageHead({
|
|
462
|
-
layoutModules: route.layouts,
|
|
463
|
-
layoutTreePositions: route.layoutTreePositions,
|
|
464
|
-
metadataRoutes,
|
|
465
|
-
pageModule: route.page,
|
|
466
|
-
parallelRoutes: __resolveActiveParallelRouteHeadInputs({
|
|
467
|
-
interceptLayouts: opts?.interceptLayouts ?? null,
|
|
468
|
-
interceptPage: opts?.interceptPage ?? null,
|
|
469
|
-
interceptParams: opts?.interceptParams ?? null,
|
|
470
|
-
interceptSlotKey: opts?.interceptSlotKey ?? null,
|
|
471
|
-
params,
|
|
472
|
-
routeSegments: route.routeSegments,
|
|
473
|
-
slots: route.slots,
|
|
474
|
-
}),
|
|
287
|
+
return __buildPageElements({
|
|
288
|
+
route,
|
|
475
289
|
params,
|
|
476
|
-
routePath: route.pattern,
|
|
477
|
-
routeSegments: route.routeSegments,
|
|
478
|
-
searchParams,
|
|
479
|
-
});
|
|
480
|
-
|
|
481
|
-
// Build the route tree from the leaf page, then delegate the boundary/layout/
|
|
482
|
-
// template/segment wiring to a typed runtime helper so the generated entry
|
|
483
|
-
// stays thin and the wiring logic can be unit tested directly.
|
|
484
|
-
const pageProps = { params: makeThenableParams(params) };
|
|
485
|
-
if (searchParams) {
|
|
486
|
-
// Always provide searchParams prop when the URL object is available, even
|
|
487
|
-
// when the query string is empty -- pages that do "await searchParams" need
|
|
488
|
-
// it to be a thenable rather than undefined.
|
|
489
|
-
pageProps.searchParams = makeThenableParams(pageSearchParams);
|
|
490
|
-
// If the URL has query parameters, mark the page as dynamic.
|
|
491
|
-
// In Next.js, only accessing the searchParams prop signals dynamic usage,
|
|
492
|
-
// but a Proxy-based approach doesn't work here because React's RSC debug
|
|
493
|
-
// serializer accesses properties on all props (e.g. $$typeof check in
|
|
494
|
-
// isClientReference), triggering the Proxy even when user code doesn't
|
|
495
|
-
// read searchParams. Checking for non-empty query params is a safe
|
|
496
|
-
// approximation: pages with query params in the URL are almost always
|
|
497
|
-
// dynamic, and this avoids false positives from React internals.
|
|
498
|
-
if (hasSearchParams) markDynamicUsage();
|
|
499
|
-
}
|
|
500
|
-
// mountedSlotsHeader is threaded through from the handler scope so every
|
|
501
|
-
// call site shares one source of truth for request-derived values. Reading
|
|
502
|
-
// the same header in two places invites silent drift when a future refactor
|
|
503
|
-
// changes only one of them.
|
|
504
|
-
const mountedSlotIds = mountedSlotsHeader
|
|
505
|
-
? new Set(mountedSlotsHeader.split(" "))
|
|
506
|
-
: null;
|
|
507
|
-
|
|
508
|
-
return __buildAppPageElements({
|
|
509
|
-
element: PageComponent ? createElement(PageComponent, pageProps) : null,
|
|
510
|
-
globalErrorModule: ${globalErrorVar ? globalErrorVar : "null"},
|
|
511
|
-
isRscRequest,
|
|
512
|
-
mountedSlotIds,
|
|
513
|
-
makeThenableParams,
|
|
514
|
-
matchedParams: params,
|
|
515
|
-
resolvedMetadata,
|
|
516
|
-
resolvedViewport,
|
|
517
|
-
interceptionContext: opts?.interceptionContext ?? null,
|
|
518
290
|
routePath,
|
|
291
|
+
pageRequest,
|
|
292
|
+
globalErrorModule: ${globalErrorVar ? globalErrorVar : "null"},
|
|
519
293
|
rootNotFoundModule: ${rootNotFoundVar ? rootNotFoundVar : "null"},
|
|
520
294
|
rootForbiddenModule: ${rootForbiddenVar ? rootForbiddenVar : "null"},
|
|
521
295
|
rootUnauthorizedModule: ${rootUnauthorizedVar ? rootUnauthorizedVar : "null"},
|
|
522
|
-
|
|
523
|
-
slotOverrides:
|
|
524
|
-
opts && opts.interceptSlotKey && opts.interceptPage
|
|
525
|
-
? {
|
|
526
|
-
[opts.interceptSlotKey]: {
|
|
527
|
-
layoutModules: opts.interceptLayouts || null,
|
|
528
|
-
pageModule: opts.interceptPage,
|
|
529
|
-
params: opts.interceptParams || params,
|
|
530
|
-
},
|
|
531
|
-
}
|
|
532
|
-
: null,
|
|
296
|
+
metadataRoutes,
|
|
533
297
|
});
|
|
534
298
|
}
|
|
535
299
|
|
|
@@ -541,38 +305,10 @@ const __configRewrites = ${JSON.stringify(rewrites)};
|
|
|
541
305
|
const __configHeaders = ${JSON.stringify(headers)};
|
|
542
306
|
const __publicFiles = new Set(${JSON.stringify(publicFiles)});
|
|
543
307
|
const __allowedOrigins = ${JSON.stringify(allowedOrigins)};
|
|
308
|
+
const __expireTime = ${JSON.stringify(expireTime)};
|
|
544
309
|
|
|
545
310
|
${generateDevOriginCheckCode(config?.allowedDevOrigins)}
|
|
546
311
|
|
|
547
|
-
// ── Config pattern matching, redirects, rewrites, headers, CSRF validation,
|
|
548
|
-
// external URL proxy, cookie parsing, and request context are imported from
|
|
549
|
-
// config-matchers.ts and request-pipeline.ts (see import statements above).
|
|
550
|
-
// This eliminates ~250 lines of duplicated inline code and ensures the
|
|
551
|
-
// single-pass tokenizer in config-matchers.ts is used consistently
|
|
552
|
-
// (fixing the chained .replace() divergence flagged by CodeQL).
|
|
553
|
-
|
|
554
|
-
/**
|
|
555
|
-
* Build a request context from the live ALS HeadersContext, which reflects
|
|
556
|
-
* any x-middleware-request-* header mutations applied by middleware.
|
|
557
|
-
* Used for afterFiles and fallback rewrite has/missing evaluation — these
|
|
558
|
-
* run after middleware in the App Router execution order.
|
|
559
|
-
*/
|
|
560
|
-
function __buildPostMwRequestContext(request) {
|
|
561
|
-
const url = new URL(request.url);
|
|
562
|
-
const ctx = getHeadersContext();
|
|
563
|
-
if (!ctx) return requestContextFromRequest(request);
|
|
564
|
-
// ctx.cookies is a Map<string, string> (HeadersContext), but RequestContext
|
|
565
|
-
// requires a plain Record<string, string> for has/missing cookie evaluation
|
|
566
|
-
// (config-matchers.ts uses obj[key] not Map.get()). Convert here.
|
|
567
|
-
const cookiesRecord = Object.fromEntries(ctx.cookies);
|
|
568
|
-
return {
|
|
569
|
-
headers: ctx.headers,
|
|
570
|
-
cookies: cookiesRecord,
|
|
571
|
-
query: url.searchParams,
|
|
572
|
-
host: normalizeHost(ctx.headers.get("host"), url.hostname),
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
|
-
|
|
576
312
|
/**
|
|
577
313
|
* Maximum server-action request body size.
|
|
578
314
|
* Configurable via experimental.serverActions.bodySizeLimit in next.config.
|
|
@@ -597,432 +333,148 @@ const rootParamNamesMap = {
|
|
|
597
333
|
${routes.filter((r) => r.isDynamic && r.pagePath && r.rootParamNames && r.rootParamNames.length > 0).map((r) => ` ${JSON.stringify(r.pattern)}: ${JSON.stringify(r.rootParamNames)},`).join("\n")}
|
|
598
334
|
};
|
|
599
335
|
|
|
600
|
-
export default
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
await __ensureInstrumentation();
|
|
604
|
-
` : ""}
|
|
605
|
-
// Wrap the entire request in a single unified ALS scope for per-request
|
|
606
|
-
// isolation. All state modules (headers, navigation, cache, fetch-cache,
|
|
607
|
-
// execution-context) read from this store via isInsideUnifiedScope().
|
|
608
|
-
const headersCtx = headersContextFromRequest(request);
|
|
609
|
-
const __uCtx = _createUnifiedCtx({
|
|
610
|
-
headersContext: headersCtx,
|
|
611
|
-
executionContext: ctx ?? _getRequestExecutionContext() ?? null,
|
|
612
|
-
unstableCacheRevalidation: "background",
|
|
613
|
-
});
|
|
614
|
-
return _runWithUnifiedCtx(__uCtx, () =>
|
|
615
|
-
__runWithPrerenderWorkUnit(async () => {
|
|
616
|
-
_ensureFetchPatch();
|
|
617
|
-
const __reqCtx = requestContextFromRequest(request);
|
|
618
|
-
// Per-request container for middleware state. Passed into
|
|
619
|
-
// _handleRequest which fills in .headers and .status;
|
|
620
|
-
// avoids module-level variables that race on Workers.
|
|
621
|
-
const _mwCtx = { headers: null, requestHeaders: null, status: null };
|
|
622
|
-
let response;
|
|
623
|
-
try {
|
|
624
|
-
response = await _handleRequest(request, __reqCtx, _mwCtx);
|
|
625
|
-
} catch (err) {
|
|
626
|
-
// Dev only: embed err.cause chain into err.message/err.stack so Vite's
|
|
627
|
-
// dev-server "Internal server error:" logger (which builds output from
|
|
628
|
-
// message + stack only) reveals the underlying root cause (ECONNREFUSED,
|
|
629
|
-
// role missing, workerd socket error, etc.) instead of dropping it.
|
|
630
|
-
// Skipped in production because Node's util.inspect / workerd's logger
|
|
631
|
-
// already render .cause natively, so flattening would double-print it.
|
|
632
|
-
// NODE_ENV is build-time-replaced by Vite, so the prod bundle compiles
|
|
633
|
-
// this branch out entirely.
|
|
634
|
-
if (process.env.NODE_ENV !== "production") {
|
|
635
|
-
__flattenErrorCauses(err);
|
|
636
|
-
}
|
|
637
|
-
throw err;
|
|
638
|
-
}
|
|
639
|
-
// Apply custom headers from next.config.js to non-redirect responses.
|
|
640
|
-
// Skip redirects (3xx) because Response.redirect() creates immutable headers,
|
|
641
|
-
// and Next.js doesn't apply custom headers to redirects anyway.
|
|
642
|
-
if (response && response.headers && !(response.status >= 300 && response.status < 400)) {
|
|
643
|
-
if (__configHeaders.length) {
|
|
644
|
-
const url = new URL(request.url);
|
|
645
|
-
let pathname;
|
|
646
|
-
try { pathname = __normalizePath(__normalizePathnameForRouteMatch(url.pathname)); } catch { pathname = url.pathname; }
|
|
647
|
-
${bp ? `if (pathname.startsWith(${JSON.stringify(bp)})) pathname = pathname.slice(${JSON.stringify(bp)}.length) || "/";` : ""}
|
|
648
|
-
applyConfigHeadersToResponse(response.headers, {
|
|
649
|
-
configHeaders: __configHeaders,
|
|
650
|
-
pathname,
|
|
651
|
-
requestContext: __reqCtx,
|
|
652
|
-
});
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
return response;
|
|
656
|
-
}, { route: () => new URL(request.url).pathname })
|
|
657
|
-
);
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
async function _handleRequest(request, __reqCtx, _mwCtx) {
|
|
661
|
-
const __reqStart = process.env.NODE_ENV !== "production" ? performance.now() : 0;
|
|
662
|
-
// __reqStart is included in the timing header so the Node logging middleware
|
|
663
|
-
// can compute true compile time as: handlerStart - middlewareStart.
|
|
664
|
-
// Format: "handlerStart,compileMs,renderMs" - all as integers (ms). Dev-only.
|
|
665
|
-
const url = new URL(request.url);
|
|
666
|
-
|
|
667
|
-
// ── Cross-origin request protection (dev only) ─────────────────────
|
|
668
|
-
// Block requests from non-localhost origins to prevent data exfiltration.
|
|
669
|
-
// Skipped in production — Vite replaces NODE_ENV at build time.
|
|
670
|
-
if (process.env.NODE_ENV !== "production") {
|
|
671
|
-
const __originBlock = __validateDevRequestOrigin(request);
|
|
672
|
-
if (__originBlock) return __originBlock;
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
// Guard against protocol-relative URL open redirects (see request-pipeline.ts).
|
|
676
|
-
const __protoGuard = guardProtocolRelativeUrl(url.pathname);
|
|
677
|
-
if (__protoGuard) return __protoGuard;
|
|
678
|
-
|
|
679
|
-
// Decode percent-encoding segment-wise and normalize pathname to canonical form.
|
|
680
|
-
// This preserves encoded path delimiters like %2F within a single segment.
|
|
681
|
-
// __normalizePath collapses //foo///bar → /foo/bar, resolves . and .. segments.
|
|
682
|
-
let decodedUrlPathname;
|
|
683
|
-
try { decodedUrlPathname = __normalizePathnameForRouteMatchStrict(url.pathname); } catch (e) {
|
|
684
|
-
return new Response("Bad Request", { status: 400 });
|
|
685
|
-
}
|
|
686
|
-
let pathname = __normalizePath(decodedUrlPathname);
|
|
687
|
-
|
|
688
|
-
${bp ? `
|
|
689
|
-
if (!hasBasePath(pathname, __basePath) && !pathname.startsWith("/__vinext/")) {
|
|
690
|
-
return new Response("Not Found", { status: 404 });
|
|
691
|
-
}
|
|
692
|
-
// Strip basePath prefix
|
|
693
|
-
pathname = stripBasePath(pathname, __basePath);
|
|
694
|
-
` : ""}
|
|
695
|
-
|
|
696
|
-
const __prerenderEndpointResponse = await __handleAppPrerenderEndpoint(request, {
|
|
697
|
-
isPrerenderEnabled() {
|
|
698
|
-
return process.env.VINEXT_PRERENDER === "1";
|
|
699
|
-
},
|
|
700
|
-
${prerenderPagesLoaderOption}
|
|
701
|
-
pathname,
|
|
702
|
-
rootParamNamesByPattern: rootParamNamesMap,
|
|
703
|
-
staticParamsMap: generateStaticParamsMap,
|
|
704
|
-
});
|
|
705
|
-
if (__prerenderEndpointResponse) return __prerenderEndpointResponse;
|
|
706
|
-
|
|
707
|
-
// Trailing slash normalization (redirect to canonical form)
|
|
708
|
-
const __tsRedirect = normalizeTrailingSlash(pathname, __basePath, __trailingSlash, url.search);
|
|
709
|
-
if (__tsRedirect) return __tsRedirect;
|
|
710
|
-
|
|
711
|
-
// ── Apply redirects from next.config.js ───────────────────────────────
|
|
712
|
-
if (__configRedirects.length) {
|
|
713
|
-
// Strip .rsc suffix before matching redirect rules - RSC (client-side nav) requests
|
|
714
|
-
// arrive as /some/path.rsc but redirect patterns are defined without it (e.g.
|
|
715
|
-
// /some/path). Without this, soft-nav fetches bypass all config redirects.
|
|
716
|
-
const __redirPathname = pathname.endsWith(".rsc") ? pathname.slice(0, -4) : pathname;
|
|
717
|
-
const __redir = matchRedirect(__redirPathname, __configRedirects, __reqCtx);
|
|
718
|
-
if (__redir) {
|
|
719
|
-
const __redirDest = sanitizeDestination(
|
|
720
|
-
__basePath &&
|
|
721
|
-
!isExternalUrl(__redir.destination) &&
|
|
722
|
-
!hasBasePath(__redir.destination, __basePath)
|
|
723
|
-
? __basePath + __redir.destination
|
|
724
|
-
: __redir.destination
|
|
725
|
-
);
|
|
726
|
-
return new Response(null, {
|
|
727
|
-
status: __redir.permanent ? 308 : 307,
|
|
728
|
-
headers: { Location: __redirDest },
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
const isRscRequest = pathname.endsWith(".rsc") || request.headers.get("accept")?.includes("text/x-component");
|
|
734
|
-
// Read mounted-slots header once at the handler scope and thread it through
|
|
735
|
-
// every buildPageElements call site. Previously both the handler and
|
|
736
|
-
// buildPageElements read and normalized it independently, which invited
|
|
737
|
-
// silent drift if a future refactor changed only one path.
|
|
738
|
-
const __mountedSlotsHeader = __normalizeMountedSlotsHeader(
|
|
739
|
-
request.headers.get("x-vinext-mounted-slots"),
|
|
740
|
-
);
|
|
741
|
-
const interceptionContextHeader = request.headers.get("X-Vinext-Interception-Context")?.replaceAll("\0", "") || null;
|
|
742
|
-
let cleanPathname = pathname.replace(/\\.rsc$/, "");
|
|
743
|
-
|
|
744
|
-
// Middleware response headers and custom rewrite status are stored in
|
|
745
|
-
// _mwCtx (per-request container) so handler() can merge them into
|
|
746
|
-
// every response path without module-level state that races on Workers.
|
|
747
|
-
|
|
748
|
-
${middlewarePath ? `
|
|
749
|
-
const __mwResult = await __applyAppMiddleware({
|
|
750
|
-
basePath: __basePath,
|
|
751
|
-
cleanPathname,
|
|
752
|
-
context: _mwCtx,
|
|
753
|
-
i18nConfig: __i18nConfig,
|
|
754
|
-
isProxy: ${JSON.stringify(isProxyFile(middlewarePath))},
|
|
755
|
-
module: middlewareModule,
|
|
756
|
-
request,
|
|
757
|
-
});
|
|
758
|
-
if (__mwResult.kind === "response") return __mwResult.response;
|
|
759
|
-
cleanPathname = __mwResult.cleanPathname;
|
|
760
|
-
if (__mwResult.search !== null) {
|
|
761
|
-
url.search = __mwResult.search;
|
|
762
|
-
}
|
|
763
|
-
` : ""}
|
|
764
|
-
|
|
765
|
-
const _scriptNonce = __getScriptNonceFromHeaderSources(request.headers, _mwCtx.headers);
|
|
766
|
-
|
|
767
|
-
// Build post-middleware request context for afterFiles/fallback rewrites.
|
|
768
|
-
// These run after middleware in the App Router execution order and should
|
|
769
|
-
// evaluate has/missing conditions against middleware-modified headers.
|
|
770
|
-
// When no middleware is present, this falls back to requestContextFromRequest.
|
|
771
|
-
const __postMwReqCtx = __buildPostMwRequestContext(request);
|
|
772
|
-
|
|
773
|
-
// ── Apply beforeFiles rewrites from next.config.js ────────────────────
|
|
774
|
-
// In App Router execution order, beforeFiles runs after middleware so that
|
|
775
|
-
// has/missing conditions can evaluate against middleware-modified headers.
|
|
776
|
-
if (__configRewrites.beforeFiles && __configRewrites.beforeFiles.length) {
|
|
777
|
-
const __rewritten = matchRewrite(cleanPathname, __configRewrites.beforeFiles, __postMwReqCtx);
|
|
778
|
-
if (__rewritten) {
|
|
779
|
-
if (isExternalUrl(__rewritten)) {
|
|
780
|
-
__clearRequestContext();
|
|
781
|
-
return proxyExternalRequest(request, __rewritten);
|
|
782
|
-
}
|
|
783
|
-
cleanPathname = __rewritten;
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
// ── Image optimization passthrough (dev mode — no transformation) ───────
|
|
788
|
-
if (cleanPathname === "/_vinext/image") {
|
|
789
|
-
const __imgResult = validateImageUrl(url.searchParams.get("url"), request.url);
|
|
790
|
-
if (__imgResult instanceof Response) return __imgResult;
|
|
791
|
-
// In dev, redirect to the original asset URL so Vite's static serving handles it.
|
|
792
|
-
return Response.redirect(new URL(__imgResult, url.origin).href, 302);
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
const metadataRouteResponse = await __handleMetadataRouteRequest({
|
|
796
|
-
metadataRoutes,
|
|
797
|
-
cleanPathname,
|
|
798
|
-
makeThenableParams,
|
|
799
|
-
});
|
|
800
|
-
if (metadataRouteResponse) return metadataRouteResponse;
|
|
801
|
-
|
|
802
|
-
// Serve public/ files as filesystem routes after middleware and before
|
|
803
|
-
// afterFiles/fallback rewrites, matching Next.js routing semantics.
|
|
804
|
-
const __publicFileResponse = resolvePublicFileRoute({
|
|
805
|
-
cleanPathname,
|
|
806
|
-
middlewareContext: _mwCtx,
|
|
807
|
-
pathname,
|
|
808
|
-
publicFiles: __publicFiles,
|
|
809
|
-
request,
|
|
810
|
-
});
|
|
811
|
-
if (__publicFileResponse) {
|
|
336
|
+
export default __createAppRscHandler({
|
|
337
|
+
basePath: __basePath,
|
|
338
|
+
clearRequestContext() {
|
|
812
339
|
__clearRequestContext();
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
setNavigationContext({
|
|
819
|
-
pathname: cleanPathname,
|
|
820
|
-
searchParams: url.searchParams,
|
|
821
|
-
params: {},
|
|
822
|
-
});
|
|
823
|
-
|
|
824
|
-
// Handle server action POST requests
|
|
825
|
-
const actionId = request.headers.get("x-rsc-action") ?? request.headers.get("next-action");
|
|
826
|
-
const actionContentType = request.headers.get("content-type") || "";
|
|
827
|
-
const progressiveActionResponse = await __handleProgressiveServerActionRequest({
|
|
828
|
-
actionId,
|
|
829
|
-
allowedOrigins: __allowedOrigins,
|
|
340
|
+
},
|
|
341
|
+
configHeaders: __configHeaders,
|
|
342
|
+
configRedirects: __configRedirects,
|
|
343
|
+
configRewrites: __configRewrites,
|
|
344
|
+
dispatchMatchedPage({
|
|
830
345
|
cleanPathname,
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
},
|
|
834
|
-
contentType: actionContentType,
|
|
835
|
-
decodeAction,
|
|
836
|
-
getAndClearPendingCookies,
|
|
837
|
-
getDraftModeCookieHeader,
|
|
838
|
-
maxActionBodySize: __MAX_ACTION_BODY_SIZE,
|
|
839
|
-
middlewareHeaders: _mwCtx.headers,
|
|
840
|
-
readFormDataWithLimit: __readFormDataWithLimit,
|
|
841
|
-
reportRequestError: _reportRequestError,
|
|
842
|
-
request,
|
|
843
|
-
setHeadersAccessPhase,
|
|
844
|
-
});
|
|
845
|
-
if (progressiveActionResponse) return progressiveActionResponse;
|
|
846
|
-
|
|
847
|
-
const serverActionResponse = await __handleServerActionRscRequest({
|
|
848
|
-
actionId,
|
|
849
|
-
allowedOrigins: __allowedOrigins,
|
|
850
|
-
buildPageElement({
|
|
851
|
-
route: actionRoute,
|
|
852
|
-
params: actionParams,
|
|
853
|
-
cleanPathname: actionCleanPathname,
|
|
854
|
-
interceptOpts,
|
|
855
|
-
searchParams,
|
|
856
|
-
isRscRequest: actionIsRscRequest,
|
|
857
|
-
request: actionRequest,
|
|
858
|
-
mountedSlotsHeader,
|
|
859
|
-
}) {
|
|
860
|
-
return buildPageElements(actionRoute, actionParams, actionCleanPathname, {
|
|
861
|
-
opts: interceptOpts,
|
|
862
|
-
searchParams,
|
|
863
|
-
isRscRequest: actionIsRscRequest,
|
|
864
|
-
request: actionRequest,
|
|
865
|
-
mountedSlotsHeader,
|
|
866
|
-
});
|
|
867
|
-
},
|
|
868
|
-
cleanPathname,
|
|
869
|
-
clearRequestContext() {
|
|
870
|
-
__clearRequestContext();
|
|
871
|
-
},
|
|
872
|
-
contentType: actionContentType,
|
|
873
|
-
createNotFoundElement(actionRouteId) {
|
|
874
|
-
return {
|
|
875
|
-
[__APP_INTERCEPTION_CONTEXT_KEY]: null,
|
|
876
|
-
__route: actionRouteId,
|
|
877
|
-
__rootLayout: null,
|
|
878
|
-
[actionRouteId]: createElement("div", null, "Page not found"),
|
|
879
|
-
};
|
|
880
|
-
},
|
|
881
|
-
createPayloadRouteId(pathnameToRender, interceptionContext) {
|
|
882
|
-
return __createAppPayloadRouteId(pathnameToRender, interceptionContext);
|
|
883
|
-
},
|
|
884
|
-
createRscOnErrorHandler(actionRequest, actionPathname, routePattern) {
|
|
885
|
-
return createRscOnErrorHandler(actionRequest, actionPathname, routePattern);
|
|
886
|
-
},
|
|
887
|
-
createTemporaryReferenceSet,
|
|
888
|
-
decodeReply,
|
|
889
|
-
findIntercept(pathnameToMatch) {
|
|
890
|
-
return findIntercept(pathnameToMatch, interceptionContextHeader);
|
|
891
|
-
},
|
|
892
|
-
getAndClearPendingCookies,
|
|
893
|
-
getDraftModeCookieHeader,
|
|
894
|
-
getRouteParamNames(sourceRoute) {
|
|
895
|
-
return sourceRoute.params;
|
|
896
|
-
},
|
|
897
|
-
getSourceRoute(sourceRouteIndex) {
|
|
898
|
-
return routes[sourceRouteIndex];
|
|
899
|
-
},
|
|
346
|
+
handlerStart,
|
|
347
|
+
interceptionContext,
|
|
900
348
|
isRscRequest,
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
},
|
|
905
|
-
maxActionBodySize: __MAX_ACTION_BODY_SIZE,
|
|
906
|
-
middlewareHeaders: _mwCtx.headers,
|
|
907
|
-
middlewareStatus: _mwCtx.status,
|
|
908
|
-
mountedSlotsHeader: __mountedSlotsHeader,
|
|
909
|
-
readBodyWithLimit: __readBodyWithLimit,
|
|
910
|
-
readFormDataWithLimit: __readFormDataWithLimit,
|
|
911
|
-
renderToReadableStream,
|
|
912
|
-
reportRequestError: _reportRequestError,
|
|
349
|
+
middlewareContext,
|
|
350
|
+
mountedSlotsHeader,
|
|
351
|
+
params,
|
|
913
352
|
request,
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
}
|
|
940
|
-
cleanPathname
|
|
941
|
-
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
let match = matchRoute(cleanPathname);
|
|
945
|
-
|
|
946
|
-
// ── Fallback rewrites from next.config.js (if no route matched) ───────
|
|
947
|
-
if (!match && __configRewrites.fallback && __configRewrites.fallback.length) {
|
|
948
|
-
const __fallbackRewritten = matchRewrite(cleanPathname, __configRewrites.fallback, __postMwReqCtx);
|
|
949
|
-
if (__fallbackRewritten) {
|
|
950
|
-
if (isExternalUrl(__fallbackRewritten)) {
|
|
353
|
+
route,
|
|
354
|
+
scriptNonce,
|
|
355
|
+
searchParams,
|
|
356
|
+
}) {
|
|
357
|
+
const PageComponent = route.page?.default;
|
|
358
|
+
const __segmentConfig = __resolveAppPageSegmentConfig({
|
|
359
|
+
layouts: route.layouts,
|
|
360
|
+
page: route.page,
|
|
361
|
+
});
|
|
362
|
+
const __generateStaticParams = __resolveAppPageGenerateStaticParamsSources({
|
|
363
|
+
layouts: route.layouts,
|
|
364
|
+
layoutTreePositions: route.layoutTreePositions,
|
|
365
|
+
page: route.page,
|
|
366
|
+
routeSegments: route.routeSegments,
|
|
367
|
+
});
|
|
368
|
+
const _asyncRouteParams = makeThenableParams(params);
|
|
369
|
+
return __dispatchAppPage({
|
|
370
|
+
buildPageElement(targetRoute, targetParams, targetOpts, targetSearchParams) {
|
|
371
|
+
return buildPageElements(targetRoute, targetParams, cleanPathname, {
|
|
372
|
+
opts: targetOpts,
|
|
373
|
+
searchParams: targetSearchParams,
|
|
374
|
+
isRscRequest,
|
|
375
|
+
request,
|
|
376
|
+
mountedSlotsHeader,
|
|
377
|
+
});
|
|
378
|
+
},
|
|
379
|
+
cleanPathname,
|
|
380
|
+
clearRequestContext() {
|
|
951
381
|
__clearRequestContext();
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
382
|
+
},
|
|
383
|
+
createRscOnErrorHandler(pathname, routePath) {
|
|
384
|
+
return createRscOnErrorHandler(request, pathname, routePath);
|
|
385
|
+
},
|
|
386
|
+
debugClassification: __classDebug,
|
|
387
|
+
dynamicConfig: __segmentConfig.dynamicConfig,
|
|
388
|
+
dynamicParamsConfig: __segmentConfig.dynamicParamsConfig,
|
|
389
|
+
fetchCache: __segmentConfig.fetchCache ?? null,
|
|
390
|
+
findIntercept(pathname) {
|
|
391
|
+
return findIntercept(pathname, interceptionContext);
|
|
392
|
+
},
|
|
393
|
+
generateStaticParams: __generateStaticParams,
|
|
394
|
+
getFontLinks: _getSSRFontLinks,
|
|
395
|
+
getFontPreloads: _getSSRFontPreloads,
|
|
396
|
+
getFontStyles: _getSSRFontStyles,
|
|
397
|
+
getNavigationContext: _getNavigationContext,
|
|
398
|
+
getSourceRoute(sourceRouteIndex) {
|
|
399
|
+
return routes[sourceRouteIndex];
|
|
400
|
+
},
|
|
401
|
+
hasGenerateStaticParams: __generateStaticParams.length > 0,
|
|
402
|
+
hasPageDefaultExport: !!PageComponent,
|
|
403
|
+
hasPageModule: !!route.page,
|
|
404
|
+
handlerStart,
|
|
405
|
+
interceptionContext,
|
|
406
|
+
expireSeconds: __expireTime,
|
|
407
|
+
isProduction: process.env.NODE_ENV === "production",
|
|
408
|
+
isRscRequest,
|
|
409
|
+
isrDebug: __isrDebug,
|
|
410
|
+
isrGet: __isrGet,
|
|
411
|
+
isrHtmlKey: __isrHtmlKey,
|
|
412
|
+
isrRscKey: __isrRscKey,
|
|
413
|
+
isrSet: __isrSet,
|
|
414
|
+
loadSsrHandler() {
|
|
415
|
+
return import.meta.viteRsc.loadModule("ssr", "index");
|
|
416
|
+
},
|
|
417
|
+
middlewareContext,
|
|
418
|
+
mountedSlotsHeader,
|
|
419
|
+
params,
|
|
420
|
+
probeLayoutAt(li) {
|
|
421
|
+
const LayoutComp = route.layouts[li]?.default;
|
|
422
|
+
if (!LayoutComp) return null;
|
|
423
|
+
return LayoutComp({
|
|
424
|
+
params: makeThenableParams(__resolveAppPageSegmentParams(
|
|
425
|
+
route.routeSegments,
|
|
426
|
+
route.layoutTreePositions?.[li] ?? 0,
|
|
427
|
+
params,
|
|
428
|
+
)),
|
|
429
|
+
children: null,
|
|
430
|
+
});
|
|
431
|
+
},
|
|
432
|
+
probePage() {
|
|
433
|
+
if (!PageComponent) return null;
|
|
434
|
+
const _asyncSearchParams = makeThenableParams(
|
|
435
|
+
__collectAppPageSearchParams(searchParams).searchParamsObject,
|
|
987
436
|
);
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
437
|
+
return PageComponent({ params: _asyncRouteParams, searchParams: _asyncSearchParams });
|
|
438
|
+
},
|
|
439
|
+
renderErrorBoundaryPage(renderErr) {
|
|
440
|
+
return __fallbackRenderer.renderErrorBoundary(route, renderErr, isRscRequest, request, params, scriptNonce, middlewareContext);
|
|
441
|
+
},
|
|
442
|
+
renderHttpAccessFallbackPage(statusCode, opts, currentMiddlewareContext) {
|
|
443
|
+
return __fallbackRenderer.renderHttpAccessFallback(route, statusCode, isRscRequest, request, opts, scriptNonce, currentMiddlewareContext);
|
|
444
|
+
},
|
|
445
|
+
renderToReadableStream,
|
|
446
|
+
request,
|
|
447
|
+
revalidateSeconds: __segmentConfig.revalidateSeconds,
|
|
448
|
+
resolveRouteFetchCacheMode(targetRoute) {
|
|
449
|
+
return __resolveRouteFetchCacheMode(targetRoute);
|
|
450
|
+
},
|
|
451
|
+
rootForbiddenModule,
|
|
452
|
+
rootNotFoundModule,
|
|
453
|
+
rootUnauthorizedModule,
|
|
454
|
+
route,
|
|
455
|
+
runWithSuppressedHookWarning(probe) {
|
|
456
|
+
return suppressHookWarningAls.run(true, probe);
|
|
457
|
+
},
|
|
458
|
+
scheduleBackgroundRegeneration(key, renderFn, errorContext) {
|
|
459
|
+
__triggerBackgroundRegeneration(key, renderFn, errorContext);
|
|
460
|
+
},
|
|
461
|
+
scriptNonce,
|
|
462
|
+
searchParams,
|
|
463
|
+
setNavigationContext,
|
|
464
|
+
});
|
|
465
|
+
},
|
|
466
|
+
dispatchMatchedRouteHandler({
|
|
467
|
+
cleanPathname,
|
|
468
|
+
middlewareContext,
|
|
1013
469
|
params,
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
if (route.routeHandler) {
|
|
1019
|
-
setCurrentFetchSoftTags(
|
|
1020
|
-
buildPageCacheTags(cleanPathname, [], route.routeSegments, "route"),
|
|
1021
|
-
);
|
|
470
|
+
request,
|
|
471
|
+
route,
|
|
472
|
+
searchParams,
|
|
473
|
+
}) {
|
|
1022
474
|
return __dispatchAppRouteHandler({
|
|
1023
475
|
basePath: __basePath,
|
|
1024
476
|
cleanPathname,
|
|
1025
|
-
clearRequestContext
|
|
477
|
+
clearRequestContext() {
|
|
1026
478
|
__clearRequestContext();
|
|
1027
479
|
},
|
|
1028
480
|
i18n: __i18nConfig,
|
|
@@ -1030,8 +482,8 @@ ${prerenderPagesLoaderOption}
|
|
|
1030
482
|
isrGet: __isrGet,
|
|
1031
483
|
isrRouteKey: __isrRouteKey,
|
|
1032
484
|
isrSet: __isrSet,
|
|
1033
|
-
middlewareContext
|
|
1034
|
-
middlewareRequestHeaders:
|
|
485
|
+
middlewareContext,
|
|
486
|
+
middlewareRequestHeaders: middlewareContext.requestHeaders,
|
|
1035
487
|
params,
|
|
1036
488
|
request,
|
|
1037
489
|
route: {
|
|
@@ -1040,104 +492,171 @@ ${prerenderPagesLoaderOption}
|
|
|
1040
492
|
routeSegments: route.routeSegments,
|
|
1041
493
|
},
|
|
1042
494
|
scheduleBackgroundRegeneration: __triggerBackgroundRegeneration,
|
|
1043
|
-
searchParams
|
|
495
|
+
searchParams,
|
|
1044
496
|
});
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
return buildPageElements(targetRoute, targetParams, cleanPathname, {
|
|
1052
|
-
opts: targetOpts,
|
|
1053
|
-
searchParams: targetSearchParams,
|
|
1054
|
-
isRscRequest,
|
|
1055
|
-
request,
|
|
1056
|
-
mountedSlotsHeader: __mountedSlotsHeader,
|
|
1057
|
-
});
|
|
1058
|
-
},
|
|
497
|
+
},
|
|
498
|
+
${instrumentationPath ? `ensureInstrumentation() {
|
|
499
|
+
return __ensureInstrumentationRegistered(_instrumentation);
|
|
500
|
+
},` : ""}
|
|
501
|
+
handleProgressiveActionRequest({
|
|
502
|
+
actionId,
|
|
1059
503
|
cleanPathname,
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
504
|
+
contentType,
|
|
505
|
+
middlewareContext,
|
|
506
|
+
request,
|
|
507
|
+
}) {
|
|
508
|
+
return __handleProgressiveServerActionRequest({
|
|
509
|
+
actionId,
|
|
510
|
+
allowedOrigins: __allowedOrigins,
|
|
511
|
+
cleanPathname,
|
|
512
|
+
clearRequestContext() {
|
|
513
|
+
__clearRequestContext();
|
|
514
|
+
},
|
|
515
|
+
contentType,
|
|
516
|
+
decodeAction,
|
|
517
|
+
getAndClearPendingCookies,
|
|
518
|
+
getDraftModeCookieHeader,
|
|
519
|
+
maxActionBodySize: __MAX_ACTION_BODY_SIZE,
|
|
520
|
+
middlewareHeaders: middlewareContext.headers,
|
|
521
|
+
readFormDataWithLimit: __readFormDataWithLimit,
|
|
522
|
+
reportRequestError: _reportRequestError,
|
|
523
|
+
request,
|
|
524
|
+
setHeadersAccessPhase,
|
|
525
|
+
});
|
|
526
|
+
},
|
|
527
|
+
handleServerActionRequest({
|
|
528
|
+
actionId,
|
|
529
|
+
cleanPathname,
|
|
530
|
+
contentType,
|
|
531
|
+
interceptionContext,
|
|
1086
532
|
isRscRequest,
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
isrHtmlKey: __isrHtmlKey,
|
|
1090
|
-
isrRscKey: __isrRscKey,
|
|
1091
|
-
isrSet: __isrSet,
|
|
1092
|
-
loadSsrHandler() {
|
|
1093
|
-
return import.meta.viteRsc.loadModule("ssr", "index");
|
|
1094
|
-
},
|
|
1095
|
-
middlewareContext: _mwCtx,
|
|
1096
|
-
mountedSlotsHeader: __mountedSlotsHeader,
|
|
1097
|
-
params,
|
|
1098
|
-
probeLayoutAt(li) {
|
|
1099
|
-
const LayoutComp = route.layouts[li]?.default;
|
|
1100
|
-
if (!LayoutComp) return null;
|
|
1101
|
-
return LayoutComp({
|
|
1102
|
-
params: makeThenableParams(__resolveAppPageSegmentParams(
|
|
1103
|
-
route.routeSegments,
|
|
1104
|
-
route.layoutTreePositions?.[li] ?? 0,
|
|
1105
|
-
params,
|
|
1106
|
-
)),
|
|
1107
|
-
children: null,
|
|
1108
|
-
});
|
|
1109
|
-
},
|
|
1110
|
-
probePage() {
|
|
1111
|
-
if (!PageComponent) return null;
|
|
1112
|
-
const _asyncSearchParams = makeThenableParams(
|
|
1113
|
-
__collectAppPageSearchParams(url.searchParams).searchParamsObject,
|
|
1114
|
-
);
|
|
1115
|
-
return PageComponent({ params: _asyncRouteParams, searchParams: _asyncSearchParams });
|
|
1116
|
-
},
|
|
1117
|
-
renderErrorBoundaryPage(renderErr) {
|
|
1118
|
-
return renderErrorBoundaryPage(route, renderErr, isRscRequest, request, params, _scriptNonce, _mwCtx);
|
|
1119
|
-
},
|
|
1120
|
-
renderHttpAccessFallbackPage(statusCode, opts, middlewareContext) {
|
|
1121
|
-
return renderHTTPAccessFallbackPage(route, statusCode, isRscRequest, request, opts, _scriptNonce, middlewareContext);
|
|
1122
|
-
},
|
|
1123
|
-
renderToReadableStream,
|
|
533
|
+
middlewareContext,
|
|
534
|
+
mountedSlotsHeader,
|
|
1124
535
|
request,
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
536
|
+
searchParams,
|
|
537
|
+
}) {
|
|
538
|
+
return __handleServerActionRscRequest({
|
|
539
|
+
actionId,
|
|
540
|
+
allowedOrigins: __allowedOrigins,
|
|
541
|
+
buildPageElement({
|
|
542
|
+
route: actionRoute,
|
|
543
|
+
params: actionParams,
|
|
544
|
+
cleanPathname: actionCleanPathname,
|
|
545
|
+
interceptOpts,
|
|
546
|
+
searchParams: actionSearchParams,
|
|
547
|
+
isRscRequest: actionIsRscRequest,
|
|
548
|
+
request: actionRequest,
|
|
549
|
+
mountedSlotsHeader: actionMountedSlotsHeader,
|
|
550
|
+
}) {
|
|
551
|
+
return buildPageElements(actionRoute, actionParams, actionCleanPathname, {
|
|
552
|
+
opts: interceptOpts,
|
|
553
|
+
searchParams: actionSearchParams,
|
|
554
|
+
isRscRequest: actionIsRscRequest,
|
|
555
|
+
request: actionRequest,
|
|
556
|
+
mountedSlotsHeader: actionMountedSlotsHeader,
|
|
557
|
+
});
|
|
558
|
+
},
|
|
559
|
+
cleanPathname,
|
|
560
|
+
clearRequestContext() {
|
|
561
|
+
__clearRequestContext();
|
|
562
|
+
},
|
|
563
|
+
contentType,
|
|
564
|
+
createNotFoundElement(actionRouteId) {
|
|
565
|
+
return {
|
|
566
|
+
[__APP_INTERCEPTION_CONTEXT_KEY]: null,
|
|
567
|
+
__route: actionRouteId,
|
|
568
|
+
__rootLayout: null,
|
|
569
|
+
[actionRouteId]: createElement("div", null, "Page not found"),
|
|
570
|
+
};
|
|
571
|
+
},
|
|
572
|
+
createPayloadRouteId(pathnameToRender, currentInterceptionContext) {
|
|
573
|
+
return __createAppPayloadRouteId(pathnameToRender, currentInterceptionContext);
|
|
574
|
+
},
|
|
575
|
+
createRscOnErrorHandler(actionRequest, actionPathname, routePattern) {
|
|
576
|
+
return createRscOnErrorHandler(actionRequest, actionPathname, routePattern);
|
|
577
|
+
},
|
|
578
|
+
createTemporaryReferenceSet,
|
|
579
|
+
decodeReply,
|
|
580
|
+
findIntercept(pathnameToMatch) {
|
|
581
|
+
return findIntercept(pathnameToMatch, interceptionContext);
|
|
582
|
+
},
|
|
583
|
+
getAndClearPendingCookies,
|
|
584
|
+
getDraftModeCookieHeader,
|
|
585
|
+
getRouteParamNames(sourceRoute) {
|
|
586
|
+
return sourceRoute.params;
|
|
587
|
+
},
|
|
588
|
+
getSourceRoute(sourceRouteIndex) {
|
|
589
|
+
return routes[sourceRouteIndex];
|
|
590
|
+
},
|
|
591
|
+
isRscRequest,
|
|
592
|
+
loadServerAction,
|
|
593
|
+
matchRoute(pathnameToMatch) {
|
|
594
|
+
return matchRoute(pathnameToMatch);
|
|
595
|
+
},
|
|
596
|
+
maxActionBodySize: __MAX_ACTION_BODY_SIZE,
|
|
597
|
+
middlewareHeaders: middlewareContext.headers,
|
|
598
|
+
middlewareStatus: middlewareContext.status,
|
|
599
|
+
mountedSlotsHeader,
|
|
600
|
+
readBodyWithLimit: __readBodyWithLimit,
|
|
601
|
+
readFormDataWithLimit: __readFormDataWithLimit,
|
|
602
|
+
renderToReadableStream,
|
|
603
|
+
reportRequestError: _reportRequestError,
|
|
604
|
+
request,
|
|
605
|
+
sanitizeErrorForClient(error) {
|
|
606
|
+
return __sanitizeErrorForClient(error);
|
|
607
|
+
},
|
|
608
|
+
searchParams,
|
|
609
|
+
setHeadersAccessPhase,
|
|
610
|
+
setNavigationContext,
|
|
611
|
+
toInterceptOpts(intercept) {
|
|
612
|
+
return {
|
|
613
|
+
interceptionContext,
|
|
614
|
+
interceptLayouts: intercept.interceptLayouts,
|
|
615
|
+
interceptSlotKey: intercept.slotKey,
|
|
616
|
+
interceptPage: intercept.page,
|
|
617
|
+
interceptParams: intercept.matchedParams,
|
|
618
|
+
};
|
|
619
|
+
},
|
|
620
|
+
});
|
|
621
|
+
},
|
|
622
|
+
i18nConfig: __i18nConfig,
|
|
623
|
+
isMiddlewareProxy: ${JSON.stringify(middlewarePath ? isProxyFile(middlewarePath) : false)},
|
|
624
|
+
${hasPagesDir ? `loadPrerenderPagesRoutes: __loadPrerenderPagesRoutes,` : ""}
|
|
625
|
+
makeThenableParams,
|
|
626
|
+
matchRoute,
|
|
627
|
+
metadataRoutes,
|
|
628
|
+
middlewareModule: ${middlewarePath ? "middlewareModule" : "null"},
|
|
629
|
+
publicFiles: __publicFiles,
|
|
630
|
+
renderNotFound({ isRscRequest, matchedParams, middlewareContext, request, route, scriptNonce }) {
|
|
631
|
+
return __fallbackRenderer.renderNotFound(route, isRscRequest, request, matchedParams, scriptNonce, middlewareContext);
|
|
632
|
+
},
|
|
633
|
+
${hasPagesDir ? `async renderPagesFallback({ isRscRequest, middlewareContext, request, url }) {
|
|
634
|
+
if (isRscRequest) return null;
|
|
635
|
+
|
|
636
|
+
const __pagesEntry = await import.meta.viteRsc.loadModule("ssr", "index");
|
|
637
|
+
if (typeof __pagesEntry.renderPage !== "function") return null;
|
|
638
|
+
|
|
639
|
+
const __pagesRequestHeaders = middlewareContext.requestHeaders
|
|
640
|
+
? __buildRequestHeadersFromMiddlewareResponse(request.headers, middlewareContext.requestHeaders)
|
|
641
|
+
: null;
|
|
642
|
+
const __pagesRequest = __pagesRequestHeaders
|
|
643
|
+
? new Request(request.url, { method: request.method, headers: __pagesRequestHeaders })
|
|
644
|
+
: request;
|
|
645
|
+
const __pagesRes = await __pagesEntry.renderPage(
|
|
646
|
+
__pagesRequest,
|
|
647
|
+
__decodePathParams(url.pathname) + (url.search || ""),
|
|
648
|
+
{},
|
|
649
|
+
undefined,
|
|
650
|
+
middlewareContext.requestHeaders,
|
|
651
|
+
);
|
|
652
|
+
return __pagesRes.status !== 404 ? __pagesRes : null;
|
|
653
|
+
},` : ""}
|
|
654
|
+
rootParamNamesByPattern: rootParamNamesMap,
|
|
655
|
+
setNavigationContext,
|
|
656
|
+
staticParamsMap: generateStaticParamsMap,
|
|
657
|
+
trailingSlash: __trailingSlash,
|
|
658
|
+
validateDevRequestOrigin: __validateDevRequestOrigin,
|
|
659
|
+
});
|
|
1141
660
|
|
|
1142
661
|
if (import.meta.hot) {
|
|
1143
662
|
import.meta.hot.accept();
|