vinext 0.0.46 → 0.0.48
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 +8 -6
- package/dist/build/layout-classification.js +3 -1
- package/dist/build/layout-classification.js.map +1 -1
- package/dist/build/prerender.d.ts +2 -1
- package/dist/build/prerender.js +80 -24
- package/dist/build/prerender.js.map +1 -1
- package/dist/build/report.d.ts +9 -5
- package/dist/build/report.js +17 -7
- package/dist/build/report.js.map +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/run-prerender.d.ts +5 -0
- package/dist/build/run-prerender.js +4 -1
- package/dist/build/run-prerender.js.map +1 -1
- package/dist/build/server-manifest.js +2 -7
- package/dist/build/server-manifest.js.map +1 -1
- package/dist/build/standalone.js +3 -5
- package/dist/build/standalone.js.map +1 -1
- package/dist/build/static-export.d.ts +1 -1
- package/dist/check.js +45 -29
- package/dist/check.js.map +1 -1
- package/dist/cli-args.d.ts +33 -0
- package/dist/cli-args.js +121 -0
- package/dist/cli-args.js.map +1 -0
- package/dist/cli.js +11 -20
- 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/config-matchers.js +46 -37
- package/dist/config/config-matchers.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/deploy.d.ts +18 -2
- package/dist/deploy.js +47 -4
- package/dist/deploy.js.map +1 -1
- package/dist/entries/app-rsc-entry.d.ts +4 -3
- package/dist/entries/app-rsc-entry.js +379 -858
- 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 +6 -1
- package/dist/entries/app-rsc-manifest.js.map +1 -1
- package/dist/entries/pages-client-entry.js +3 -2
- package/dist/entries/pages-client-entry.js.map +1 -1
- package/dist/entries/pages-server-entry.js +19 -61
- package/dist/entries/pages-server-entry.js.map +1 -1
- package/dist/entries/runtime-entry-module.d.ts +12 -3
- package/dist/entries/runtime-entry-module.js +15 -4
- package/dist/entries/runtime-entry-module.js.map +1 -1
- package/dist/index.js +40 -58
- 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/og-assets.js +15 -16
- package/dist/plugins/og-assets.js.map +1 -1
- package/dist/plugins/rsc-client-shim-excludes.d.ts +2 -1
- package/dist/plugins/rsc-client-shim-excludes.js +11 -1
- package/dist/plugins/rsc-client-shim-excludes.js.map +1 -1
- package/dist/routing/app-route-graph.d.ts +195 -0
- package/dist/routing/app-route-graph.js +1022 -0
- package/dist/routing/app-route-graph.js.map +1 -0
- package/dist/routing/app-router.d.ts +14 -88
- package/dist/routing/app-router.js +21 -712
- package/dist/routing/app-router.js.map +1 -1
- package/dist/routing/file-matcher.d.ts +3 -1
- package/dist/routing/file-matcher.js +6 -1
- package/dist/routing/file-matcher.js.map +1 -1
- package/dist/routing/pages-router.js +10 -19
- package/dist/routing/pages-router.js.map +1 -1
- package/dist/routing/route-matching.d.ts +28 -0
- package/dist/routing/route-matching.js +44 -0
- package/dist/routing/route-matching.js.map +1 -0
- package/dist/routing/route-pattern.js +4 -1
- package/dist/routing/route-pattern.js.map +1 -1
- package/dist/routing/route-trie.d.ts +8 -0
- package/dist/routing/route-trie.js +12 -1
- package/dist/routing/route-trie.js.map +1 -1
- package/dist/routing/route-validation.js +3 -4
- package/dist/routing/route-validation.js.map +1 -1
- package/dist/routing/utils.d.ts +8 -1
- package/dist/routing/utils.js +25 -2
- package/dist/routing/utils.js.map +1 -1
- package/dist/server/app-browser-entry.js +145 -294
- 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 +75 -0
- package/dist/server/app-browser-navigation-controller.js +290 -0
- package/dist/server/app-browser-navigation-controller.js.map +1 -0
- package/dist/server/app-browser-state.d.ts +33 -15
- package/dist/server/app-browser-state.js +52 -59
- package/dist/server/app-browser-state.js.map +1 -1
- package/dist/server/app-browser-visible-commit.d.ts +68 -0
- package/dist/server/app-browser-visible-commit.js +182 -0
- package/dist/server/app-browser-visible-commit.js.map +1 -0
- package/dist/server/app-client-reference-preloader.d.ts +15 -0
- package/dist/server/app-client-reference-preloader.js +46 -0
- package/dist/server/app-client-reference-preloader.js.map +1 -0
- package/dist/server/app-elements-wire.d.ts +130 -0
- package/dist/server/app-elements-wire.js +205 -0
- package/dist/server/app-elements-wire.js.map +1 -0
- package/dist/server/app-elements.d.ts +2 -84
- package/dist/server/app-elements.js +4 -107
- 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-middleware.d.ts +2 -1
- package/dist/server/app-middleware.js +34 -11
- package/dist/server/app-middleware.js.map +1 -1
- 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 +3 -3
- package/dist/server/app-page-boundary-render.js +8 -5
- package/dist/server/app-page-boundary-render.js.map +1 -1
- package/dist/server/app-page-boundary.js +2 -1
- package/dist/server/app-page-boundary.js.map +1 -1
- package/dist/server/app-page-cache.d.ts +19 -4
- package/dist/server/app-page-cache.js +60 -22
- package/dist/server/app-page-cache.js.map +1 -1
- package/dist/server/app-page-dispatch.d.ts +9 -5
- package/dist/server/app-page-dispatch.js +41 -17
- 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 +142 -0
- package/dist/server/app-page-element-builder.js.map +1 -0
- package/dist/server/app-page-execution.d.ts +23 -5
- package/dist/server/app-page-execution.js +39 -24
- package/dist/server/app-page-execution.js.map +1 -1
- package/dist/server/app-page-head.js +2 -1
- package/dist/server/app-page-head.js.map +1 -1
- package/dist/server/app-page-method.js +2 -5
- package/dist/server/app-page-method.js.map +1 -1
- 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-probe.d.ts +1 -1
- package/dist/server/app-page-probe.js +5 -1
- package/dist/server/app-page-probe.js.map +1 -1
- package/dist/server/app-page-render.d.ts +6 -2
- package/dist/server/app-page-render.js +118 -30
- package/dist/server/app-page-render.js.map +1 -1
- package/dist/server/app-page-request.d.ts +19 -5
- package/dist/server/app-page-request.js +49 -7
- 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 +6 -9
- package/dist/server/app-page-response.js.map +1 -1
- package/dist/server/app-page-route-wiring.d.ts +20 -4
- package/dist/server/app-page-route-wiring.js +15 -12
- package/dist/server/app-page-route-wiring.js.map +1 -1
- package/dist/server/app-page-stream.d.ts +7 -0
- package/dist/server/app-page-stream.js +9 -2
- package/dist/server/app-page-stream.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-prerender-endpoints.js +3 -2
- package/dist/server/app-prerender-endpoints.js.map +1 -1
- 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 +7 -2
- 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 +8 -5
- 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-policy.js +13 -13
- package/dist/server/app-route-handler-policy.js.map +1 -1
- package/dist/server/app-route-handler-response.d.ts +4 -2
- package/dist/server/app-route-handler-response.js +9 -7
- package/dist/server/app-route-handler-response.js.map +1 -1
- package/dist/server/app-route-handler-runtime.d.ts +9 -1
- package/dist/server/app-route-handler-runtime.js +11 -1
- package/dist/server/app-route-handler-runtime.js.map +1 -1
- package/dist/server/app-router-entry.js +9 -4
- package/dist/server/app-router-entry.js.map +1 -1
- package/dist/server/app-rsc-cache-busting.d.ts +34 -0
- package/dist/server/app-rsc-cache-busting.js +137 -0
- package/dist/server/app-rsc-cache-busting.js.map +1 -0
- 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 +271 -0
- package/dist/server/app-rsc-handler.js.map +1 -0
- package/dist/server/app-rsc-request-normalization.d.ts +42 -0
- package/dist/server/app-rsc-request-normalization.js +67 -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-rsc-route-matching.js +8 -4
- package/dist/server/app-rsc-route-matching.js.map +1 -1
- package/dist/server/app-segment-config.d.ts +33 -0
- package/dist/server/app-segment-config.js +90 -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 +45 -51
- package/dist/server/app-server-action-execution.js.map +1 -1
- package/dist/server/app-ssr-entry.js +21 -20
- package/dist/server/app-ssr-entry.js.map +1 -1
- package/dist/server/artifact-compatibility.d.ts +44 -0
- package/dist/server/artifact-compatibility.js +82 -0
- package/dist/server/artifact-compatibility.js.map +1 -0
- 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/cache-proof.d.ts +200 -0
- package/dist/server/cache-proof.js +342 -0
- package/dist/server/cache-proof.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/dev-origin-check.js +8 -4
- package/dist/server/dev-origin-check.js.map +1 -1
- package/dist/server/dev-server.js +1 -6
- package/dist/server/dev-server.js.map +1 -1
- package/dist/server/http-error-responses.d.ts +67 -0
- package/dist/server/http-error-responses.js +77 -0
- package/dist/server/http-error-responses.js.map +1 -0
- package/dist/server/image-optimization.js +2 -1
- package/dist/server/image-optimization.js.map +1 -1
- 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/metadata-route-response.js +6 -5
- package/dist/server/metadata-route-response.js.map +1 -1
- package/dist/server/metadata-routes.d.ts +1 -0
- package/dist/server/metadata-routes.js +6 -0
- package/dist/server/metadata-routes.js.map +1 -1
- package/dist/server/middleware-matcher.js +2 -2
- package/dist/server/middleware-matcher.js.map +1 -1
- package/dist/server/middleware-response-headers.js +21 -0
- package/dist/server/middleware-response-headers.js.map +1 -1
- package/dist/server/middleware-runtime.js +3 -3
- package/dist/server/middleware-runtime.js.map +1 -1
- package/dist/server/navigation-trace.d.ts +33 -0
- package/dist/server/navigation-trace.js +35 -0
- package/dist/server/navigation-trace.js.map +1 -0
- package/dist/server/next-error-digest.d.ts +44 -0
- package/dist/server/next-error-digest.js +40 -0
- package/dist/server/next-error-digest.js.map +1 -0
- package/dist/server/pages-api-route.js +2 -1
- package/dist/server/pages-api-route.js.map +1 -1
- package/dist/server/pages-node-compat.js +4 -16
- package/dist/server/pages-node-compat.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 +3 -8
- package/dist/server/pages-page-response.js +46 -15
- package/dist/server/pages-page-response.js.map +1 -1
- package/dist/server/prod-server.d.ts +6 -0
- package/dist/server/prod-server.js +28 -21
- package/dist/server/prod-server.js.map +1 -1
- package/dist/server/request-pipeline.d.ts +42 -1
- package/dist/server/request-pipeline.js +97 -17
- package/dist/server/request-pipeline.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.d.ts +2 -2
- package/dist/shims/cache-runtime.js +31 -17
- package/dist/shims/cache-runtime.js.map +1 -1
- package/dist/shims/cache.d.ts +15 -3
- package/dist/shims/cache.js +45 -20
- 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 +57 -16
- package/dist/shims/fetch-cache.js.map +1 -1
- package/dist/shims/head-state.js +2 -3
- package/dist/shims/head-state.js.map +1 -1
- package/dist/shims/headers.js +4 -44
- package/dist/shims/headers.js.map +1 -1
- package/dist/shims/i18n-state.js +2 -3
- package/dist/shims/i18n-state.js.map +1 -1
- package/dist/shims/image.js +93 -5
- package/dist/shims/image.js.map +1 -1
- package/dist/shims/internal/als-registry.d.ts +15 -0
- package/dist/shims/internal/als-registry.js +55 -0
- package/dist/shims/internal/als-registry.js.map +1 -0
- package/dist/shims/internal/cookie-serialize.d.ts +46 -0
- package/dist/shims/internal/cookie-serialize.js +51 -0
- package/dist/shims/internal/cookie-serialize.js.map +1 -0
- package/dist/shims/link.js +31 -26
- package/dist/shims/link.js.map +1 -1
- package/dist/shims/metadata.d.ts +26 -1
- package/dist/shims/metadata.js +94 -4
- package/dist/shims/metadata.js.map +1 -1
- package/dist/shims/navigation-state.js +2 -3
- package/dist/shims/navigation-state.js.map +1 -1
- package/dist/shims/navigation.d.ts +2 -7
- package/dist/shims/navigation.js +44 -36
- package/dist/shims/navigation.js.map +1 -1
- package/dist/shims/request-context.js +2 -4
- package/dist/shims/request-context.js.map +1 -1
- package/dist/shims/request-state-types.d.ts +1 -1
- package/dist/shims/router-state.js +2 -3
- package/dist/shims/router-state.js.map +1 -1
- package/dist/shims/router.js +2 -2
- package/dist/shims/router.js.map +1 -1
- package/dist/shims/server.js +5 -30
- package/dist/shims/server.js.map +1 -1
- package/dist/shims/slot.d.ts +1 -1
- package/dist/shims/slot.js +5 -4
- package/dist/shims/slot.js.map +1 -1
- package/dist/shims/thenable-params.d.ts +5 -2
- package/dist/shims/thenable-params.js +26 -6
- package/dist/shims/thenable-params.js.map +1 -1
- package/dist/shims/unified-request-context.d.ts +1 -1
- package/dist/shims/unified-request-context.js +3 -14
- 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/base-path.d.ts +7 -1
- package/dist/utils/base-path.js +12 -1
- package/dist/utils/base-path.js.map +1 -1
- 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/dist/utils/safe-json-file.d.ts +18 -0
- package/dist/utils/safe-json-file.js +25 -0
- package/dist/utils/safe-json-file.js.map +1 -0
- package/dist/utils/text-stream.d.ts +29 -0
- package/dist/utils/text-stream.js +66 -0
- package/dist/utils/text-stream.js.map +1 -0
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolveEntryPath } from "./runtime-entry-module.js";
|
|
1
|
+
import { normalizePathSeparators, resolveEntryPath } from "./runtime-entry-module.js";
|
|
2
2
|
import { isProxyFile } from "../server/middleware.js";
|
|
3
3
|
import { buildAppRscManifestCode } from "./app-rsc-manifest.js";
|
|
4
4
|
import { generateDevOriginCheckCode } from "../server/dev-origin-check.js";
|
|
@@ -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
|
-
${middlewarePath ? `import * as middlewareModule from ${JSON.stringify(middlewarePath
|
|
100
|
-
${instrumentationPath ? `import * as _instrumentation from ${JSON.stringify(instrumentationPath
|
|
101
|
-
import {
|
|
102
|
-
import {
|
|
103
|
-
import { decodePathParams as __decodePathParams
|
|
104
|
-
import { normalizePathnameForRouteMatch as __normalizePathnameForRouteMatch, normalizePathnameForRouteMatchStrict as __normalizePathnameForRouteMatchStrict } from ${JSON.stringify(routingUtilsPath)};
|
|
89
|
+
${middlewarePath ? `import * as middlewareModule from ${JSON.stringify(normalizePathSeparators(middlewarePath))};` : ""}
|
|
90
|
+
${instrumentationPath ? `import * as _instrumentation from ${JSON.stringify(normalizePathSeparators(instrumentationPath))};
|
|
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,66 @@ 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
|
-
|
|
131
|
-
createAppPayloadRouteId as __createAppPayloadRouteId,
|
|
116
|
+
AppElementsWire as __AppElementsWire,
|
|
132
117
|
} from ${JSON.stringify(appElementsPath)};
|
|
133
118
|
import {
|
|
134
|
-
buildAppPageElements as __buildAppPageElements,
|
|
135
|
-
createAppPageTreePath as __createAppPageTreePath,
|
|
136
119
|
resolveAppPageChildSegments as __resolveAppPageChildSegments,
|
|
137
120
|
} from ${JSON.stringify(appPageRouteWiringPath)};
|
|
121
|
+
import { buildPageElements as __buildPageElements } from ${JSON.stringify(appPageElementBuilderPath)};
|
|
138
122
|
import {
|
|
139
123
|
resolveAppPageSegmentParams as __resolveAppPageSegmentParams,
|
|
140
124
|
} from ${JSON.stringify(appPageParamsPath)};
|
|
141
125
|
import {
|
|
142
126
|
collectAppPageSearchParams as __collectAppPageSearchParams,
|
|
143
|
-
resolveActiveParallelRouteHeadInputs as __resolveActiveParallelRouteHeadInputs,
|
|
144
|
-
resolveAppPageHead as __resolveAppPageHead,
|
|
145
127
|
} from ${JSON.stringify(appPageHeadPath)};
|
|
146
|
-
import {
|
|
147
|
-
mergeMiddlewareResponseHeaders as __mergeMiddlewareResponseHeaders,
|
|
148
|
-
} from ${JSON.stringify(appPageResponsePath)};
|
|
149
128
|
import {
|
|
150
129
|
dispatchAppPage as __dispatchAppPage,
|
|
151
130
|
} from ${JSON.stringify(appPageDispatchPath)};
|
|
152
|
-
import {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
import {
|
|
131
|
+
import {
|
|
132
|
+
resolveAppPageGenerateStaticParamsSources as __resolveAppPageGenerateStaticParamsSources,
|
|
133
|
+
} from ${JSON.stringify(appPageRequestPath)};
|
|
134
|
+
import {
|
|
135
|
+
resolveAppPageFetchCacheMode as __resolveAppPageFetchCacheMode,
|
|
136
|
+
resolveAppPageSegmentConfig as __resolveAppPageSegmentConfig,
|
|
137
|
+
} from ${JSON.stringify(appSegmentConfigPath)};
|
|
156
138
|
import { makeThenableParams } from ${JSON.stringify(thenableParamsShimPath)};
|
|
157
|
-
import { ensureFetchPatch as _ensureFetchPatch, setCurrentFetchSoftTags } from "vinext/fetch-cache";
|
|
158
139
|
import {
|
|
159
140
|
createAppRscRouteMatcher as __createAppRscRouteMatcher,
|
|
160
141
|
} from ${JSON.stringify(appRscRouteMatchingPath)};
|
|
161
|
-
import {
|
|
162
|
-
handleAppPrerenderEndpoint as __handleAppPrerenderEndpoint,
|
|
163
|
-
} from ${JSON.stringify(appPrerenderEndpointsPath)};
|
|
164
142
|
import {
|
|
165
143
|
appIsrHtmlKey as __isrHtmlKey,
|
|
166
144
|
appIsrRscKey as __isrRscKey,
|
|
167
145
|
appIsrRouteKey as __isrRouteKey,
|
|
168
146
|
isrGet as __isrGet,
|
|
169
147
|
isrSet as __isrSet,
|
|
170
|
-
normalizeMountedSlotsHeader as __normalizeMountedSlotsHeader,
|
|
171
148
|
triggerBackgroundRegeneration as __triggerBackgroundRegeneration,
|
|
172
149
|
} from ${JSON.stringify(isrCachePath)};
|
|
173
150
|
// Import server-only state module to register ALS-backed accessors.
|
|
174
151
|
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
152
|
import { reportRequestError as _reportRequestError } from "vinext/instrumentation";
|
|
178
|
-
import { flattenErrorCauses as __flattenErrorCauses } from ${JSON.stringify(errorCausePath)};
|
|
179
153
|
import { getSSRFontLinks as _getSSRFontLinks, getSSRFontStyles as _getSSRFontStylesGoogle, getSSRFontPreloads as _getSSRFontPreloadsGoogle } from "next/font/google";
|
|
180
154
|
import { getSSRFontStyles as _getSSRFontStylesLocal, getSSRFontPreloads as _getSSRFontPreloadsLocal } from "next/font/local";
|
|
181
155
|
function _getSSRFontStyles() { return [..._getSSRFontStylesGoogle(), ..._getSSRFontStylesLocal()]; }
|
|
182
156
|
function _getSSRFontPreloads() { return [..._getSSRFontPreloadsGoogle(), ..._getSSRFontPreloadsLocal()]; }
|
|
183
157
|
${hasPagesDir ? `// Pages Router routes are loaded lazily from the SSR environment for internal prerender requests.` : ""}
|
|
184
158
|
|
|
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
|
-
}
|
|
159
|
+
// Suppress expected "Invalid hook call" dev warning when layout/page
|
|
160
|
+
// components are probed outside React's render cycle. The import patches
|
|
161
|
+
// console.error once at module load (side-effect) and exposes the ALS
|
|
162
|
+
// so per-route dispatch can opt into suppression via .run(true, ...).
|
|
163
|
+
import { suppressHookWarningAls } from ${JSON.stringify(appHookWarningSuppressionPath)};
|
|
164
|
+
import { clearAppRequestContext as __clearRequestContext, setAppNavigationContext as setNavigationContext } from ${JSON.stringify(appRequestContextPath)};
|
|
214
165
|
|
|
215
166
|
// Note: cache entries are written with \`headers: undefined\`. Next.js stores
|
|
216
167
|
// response headers (e.g. set-cookie from cookies().set() during render) in the
|
|
@@ -239,57 +190,19 @@ const __classDebug = process.env.VINEXT_DEBUG_CLASSIFICATION
|
|
|
239
190
|
}
|
|
240
191
|
: undefined;
|
|
241
192
|
|
|
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,
|
|
193
|
+
function __resolveRouteFetchCacheMode(route) {
|
|
194
|
+
return __resolveAppPageFetchCacheMode({
|
|
195
|
+
layouts: route.layouts,
|
|
196
|
+
page: route.page,
|
|
257
197
|
});
|
|
258
198
|
}
|
|
259
199
|
|
|
260
200
|
${imports.join("\n")}
|
|
261
201
|
|
|
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
|
-
}` : ""}
|
|
202
|
+
${instrumentationPath ? `// Lazy instrumentation initialisation is handled by ensureInstrumentationRegistered
|
|
203
|
+
// (imported from vinext/instrumentation-runtime). The generated entry only passes
|
|
204
|
+
// the user module in; all bookkeeping (initialized flag, shared promise, prerender
|
|
205
|
+
// skip) lives in the typed helper so it can be unit-tested independently.` : ""}
|
|
293
206
|
|
|
294
207
|
// Build-time layout classification dispatch. Replaced in generateBundle
|
|
295
208
|
// with a switch statement that returns a pre-computed per-layout
|
|
@@ -322,96 +235,40 @@ const rootNotFoundModule = ${rootNotFoundVar ? rootNotFoundVar : "null"};
|
|
|
322
235
|
const rootForbiddenModule = ${rootForbiddenVar ? rootForbiddenVar : "null"};
|
|
323
236
|
const rootUnauthorizedModule = ${rootUnauthorizedVar ? rootUnauthorizedVar : "null"};
|
|
324
237
|
const rootLayouts = [${rootLayoutVars.join(", ")}];
|
|
325
|
-
const __APP_PAGE_EMPTY_MW_CTX = { headers: null, status: null };
|
|
326
238
|
|
|
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
|
-
}
|
|
239
|
+
const createRscOnErrorHandler = (request, pathname, routePath) =>
|
|
240
|
+
createAppRscOnErrorHandler(_reportRequestError, request, pathname, routePath);
|
|
370
241
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
return __renderAppPageErrorBoundary({
|
|
242
|
+
const __fallbackRenderer = __createAppFallbackRenderer({
|
|
243
|
+
rootBoundaries: {
|
|
244
|
+
rootForbiddenModule,
|
|
245
|
+
rootLayouts,
|
|
246
|
+
rootNotFoundModule,
|
|
247
|
+
rootUnauthorizedModule,
|
|
248
|
+
},
|
|
249
|
+
globalErrorModule: ${globalErrorVar ? globalErrorVar : "null"},
|
|
250
|
+
metadataRoutes,
|
|
251
|
+
ssrLoader() {
|
|
252
|
+
return import.meta.viteRsc.loadModule("ssr", "index");
|
|
253
|
+
},
|
|
254
|
+
fontProviders: {
|
|
385
255
|
buildFontLinkHeader: __buildAppPageFontLinkHeader,
|
|
386
|
-
clearRequestContext() {
|
|
387
|
-
__clearRequestContext();
|
|
388
|
-
},
|
|
389
|
-
createRscOnErrorHandler(pathname, routePath) {
|
|
390
|
-
return createRscOnErrorHandler(request, pathname, routePath);
|
|
391
|
-
},
|
|
392
|
-
error,
|
|
393
256
|
getFontLinks: _getSSRFontLinks,
|
|
394
257
|
getFontPreloads: _getSSRFontPreloads,
|
|
395
258
|
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
|
-
}
|
|
259
|
+
},
|
|
260
|
+
makeThenableParams,
|
|
261
|
+
sanitizer: __sanitizeErrorForClient,
|
|
262
|
+
rscRenderer: renderToReadableStream,
|
|
263
|
+
getNavigationContext: _getNavigationContext,
|
|
264
|
+
resolveChildSegments: __resolveAppPageChildSegments,
|
|
265
|
+
clearRequestContext() {
|
|
266
|
+
__clearRequestContext();
|
|
267
|
+
},
|
|
268
|
+
createRscOnErrorHandler(request, pathname, routePath) {
|
|
269
|
+
return createRscOnErrorHandler(request, pathname, routePath);
|
|
270
|
+
},
|
|
271
|
+
});
|
|
415
272
|
|
|
416
273
|
function matchRoute(url) {
|
|
417
274
|
return __routeMatcher.matchRoute(url);
|
|
@@ -426,110 +283,16 @@ function findIntercept(pathname, sourcePathname = null) {
|
|
|
426
283
|
}
|
|
427
284
|
|
|
428
285
|
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
|
-
}),
|
|
286
|
+
return __buildPageElements({
|
|
287
|
+
route,
|
|
475
288
|
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
289
|
routePath,
|
|
290
|
+
pageRequest,
|
|
291
|
+
globalErrorModule: ${globalErrorVar ? globalErrorVar : "null"},
|
|
519
292
|
rootNotFoundModule: ${rootNotFoundVar ? rootNotFoundVar : "null"},
|
|
520
293
|
rootForbiddenModule: ${rootForbiddenVar ? rootForbiddenVar : "null"},
|
|
521
294
|
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,
|
|
295
|
+
metadataRoutes,
|
|
533
296
|
});
|
|
534
297
|
}
|
|
535
298
|
|
|
@@ -541,38 +304,10 @@ const __configRewrites = ${JSON.stringify(rewrites)};
|
|
|
541
304
|
const __configHeaders = ${JSON.stringify(headers)};
|
|
542
305
|
const __publicFiles = new Set(${JSON.stringify(publicFiles)});
|
|
543
306
|
const __allowedOrigins = ${JSON.stringify(allowedOrigins)};
|
|
307
|
+
const __expireTime = ${JSON.stringify(expireTime)};
|
|
544
308
|
|
|
545
309
|
${generateDevOriginCheckCode(config?.allowedDevOrigins)}
|
|
546
310
|
|
|
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
311
|
/**
|
|
577
312
|
* Maximum server-action request body size.
|
|
578
313
|
* Configurable via experimental.serverActions.bodySizeLimit in next.config.
|
|
@@ -597,432 +332,149 @@ const rootParamNamesMap = {
|
|
|
597
332
|
${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
333
|
};
|
|
599
334
|
|
|
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) {
|
|
335
|
+
export default __createAppRscHandler({
|
|
336
|
+
basePath: __basePath,
|
|
337
|
+
clearRequestContext() {
|
|
812
338
|
__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,
|
|
339
|
+
},
|
|
340
|
+
configHeaders: __configHeaders,
|
|
341
|
+
configRedirects: __configRedirects,
|
|
342
|
+
configRewrites: __configRewrites,
|
|
343
|
+
dispatchMatchedPage({
|
|
830
344
|
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
|
-
},
|
|
345
|
+
handlerStart,
|
|
346
|
+
interceptionContext,
|
|
900
347
|
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,
|
|
348
|
+
middlewareContext,
|
|
349
|
+
mountedSlotsHeader,
|
|
350
|
+
params,
|
|
913
351
|
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
|
-
|
|
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)) {
|
|
352
|
+
route,
|
|
353
|
+
scriptNonce,
|
|
354
|
+
searchParams,
|
|
355
|
+
}) {
|
|
356
|
+
const PageComponent = route.page?.default;
|
|
357
|
+
const __segmentConfig = __resolveAppPageSegmentConfig({
|
|
358
|
+
layouts: route.layouts,
|
|
359
|
+
page: route.page,
|
|
360
|
+
});
|
|
361
|
+
const __generateStaticParams = __resolveAppPageGenerateStaticParamsSources({
|
|
362
|
+
layouts: route.layouts,
|
|
363
|
+
layoutTreePositions: route.layoutTreePositions,
|
|
364
|
+
page: route.page,
|
|
365
|
+
routeSegments: route.routeSegments,
|
|
366
|
+
});
|
|
367
|
+
const _asyncRouteParams = makeThenableParams(params);
|
|
368
|
+
return __dispatchAppPage({
|
|
369
|
+
basePath: __basePath,
|
|
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,173 @@ ${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
|
+
...__AppElementsWire.createMetadataEntries({
|
|
567
|
+
interceptionContext: null,
|
|
568
|
+
rootLayoutTreePath: null,
|
|
569
|
+
routeId: actionRouteId,
|
|
570
|
+
}),
|
|
571
|
+
[actionRouteId]: createElement("div", null, "Page not found"),
|
|
572
|
+
};
|
|
573
|
+
},
|
|
574
|
+
createPayloadRouteId(pathnameToRender, currentInterceptionContext) {
|
|
575
|
+
return __AppElementsWire.encodeRouteId(pathnameToRender, currentInterceptionContext);
|
|
576
|
+
},
|
|
577
|
+
createRscOnErrorHandler(actionRequest, actionPathname, routePattern) {
|
|
578
|
+
return createRscOnErrorHandler(actionRequest, actionPathname, routePattern);
|
|
579
|
+
},
|
|
580
|
+
createTemporaryReferenceSet,
|
|
581
|
+
decodeReply,
|
|
582
|
+
findIntercept(pathnameToMatch) {
|
|
583
|
+
return findIntercept(pathnameToMatch, interceptionContext);
|
|
584
|
+
},
|
|
585
|
+
getAndClearPendingCookies,
|
|
586
|
+
getDraftModeCookieHeader,
|
|
587
|
+
getRouteParamNames(sourceRoute) {
|
|
588
|
+
return sourceRoute.params;
|
|
589
|
+
},
|
|
590
|
+
getSourceRoute(sourceRouteIndex) {
|
|
591
|
+
return routes[sourceRouteIndex];
|
|
592
|
+
},
|
|
593
|
+
isRscRequest,
|
|
594
|
+
loadServerAction,
|
|
595
|
+
matchRoute(pathnameToMatch) {
|
|
596
|
+
return matchRoute(pathnameToMatch);
|
|
597
|
+
},
|
|
598
|
+
maxActionBodySize: __MAX_ACTION_BODY_SIZE,
|
|
599
|
+
middlewareHeaders: middlewareContext.headers,
|
|
600
|
+
middlewareStatus: middlewareContext.status,
|
|
601
|
+
mountedSlotsHeader,
|
|
602
|
+
readBodyWithLimit: __readBodyWithLimit,
|
|
603
|
+
readFormDataWithLimit: __readFormDataWithLimit,
|
|
604
|
+
renderToReadableStream,
|
|
605
|
+
reportRequestError: _reportRequestError,
|
|
606
|
+
request,
|
|
607
|
+
sanitizeErrorForClient(error) {
|
|
608
|
+
return __sanitizeErrorForClient(error);
|
|
609
|
+
},
|
|
610
|
+
searchParams,
|
|
611
|
+
setHeadersAccessPhase,
|
|
612
|
+
setNavigationContext,
|
|
613
|
+
toInterceptOpts(intercept) {
|
|
614
|
+
return {
|
|
615
|
+
interceptionContext,
|
|
616
|
+
interceptLayouts: intercept.interceptLayouts,
|
|
617
|
+
interceptSlotKey: intercept.slotKey,
|
|
618
|
+
interceptPage: intercept.page,
|
|
619
|
+
interceptParams: intercept.matchedParams,
|
|
620
|
+
};
|
|
621
|
+
},
|
|
622
|
+
});
|
|
623
|
+
},
|
|
624
|
+
i18nConfig: __i18nConfig,
|
|
625
|
+
isMiddlewareProxy: ${JSON.stringify(middlewarePath ? isProxyFile(middlewarePath) : false)},
|
|
626
|
+
${hasPagesDir ? `loadPrerenderPagesRoutes: __loadPrerenderPagesRoutes,` : ""}
|
|
627
|
+
makeThenableParams,
|
|
628
|
+
matchRoute,
|
|
629
|
+
metadataRoutes,
|
|
630
|
+
middlewareModule: ${middlewarePath ? "middlewareModule" : "null"},
|
|
631
|
+
publicFiles: __publicFiles,
|
|
632
|
+
renderNotFound({ isRscRequest, matchedParams, middlewareContext, request, route, scriptNonce }) {
|
|
633
|
+
return __fallbackRenderer.renderNotFound(route, isRscRequest, request, matchedParams, scriptNonce, middlewareContext);
|
|
634
|
+
},
|
|
635
|
+
${hasPagesDir ? `async renderPagesFallback({ isRscRequest, middlewareContext, request, url }) {
|
|
636
|
+
if (isRscRequest) return null;
|
|
637
|
+
|
|
638
|
+
const __pagesEntry = await import.meta.viteRsc.loadModule("ssr", "index");
|
|
639
|
+
if (typeof __pagesEntry.renderPage !== "function") return null;
|
|
640
|
+
|
|
641
|
+
const __pagesRequestHeaders = middlewareContext.requestHeaders
|
|
642
|
+
? __buildRequestHeadersFromMiddlewareResponse(request.headers, middlewareContext.requestHeaders)
|
|
643
|
+
: null;
|
|
644
|
+
const __pagesRequest = __pagesRequestHeaders
|
|
645
|
+
? new Request(request.url, { method: request.method, headers: __pagesRequestHeaders })
|
|
646
|
+
: request;
|
|
647
|
+
const __pagesRes = await __pagesEntry.renderPage(
|
|
648
|
+
__pagesRequest,
|
|
649
|
+
__decodePathParams(url.pathname) + (url.search || ""),
|
|
650
|
+
{},
|
|
651
|
+
undefined,
|
|
652
|
+
middlewareContext.requestHeaders,
|
|
653
|
+
);
|
|
654
|
+
return __pagesRes.status !== 404 ? __pagesRes : null;
|
|
655
|
+
},` : ""}
|
|
656
|
+
rootParamNamesByPattern: rootParamNamesMap,
|
|
657
|
+
setNavigationContext,
|
|
658
|
+
staticParamsMap: generateStaticParamsMap,
|
|
659
|
+
trailingSlash: __trailingSlash,
|
|
660
|
+
validateDevRequestOrigin: __validateDevRequestOrigin,
|
|
661
|
+
});
|
|
1141
662
|
|
|
1142
663
|
if (import.meta.hot) {
|
|
1143
664
|
import.meta.hot.accept();
|