vinext 0.0.50 → 0.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build/google-fonts/fallback-metrics-data.js +14031 -0
- package/dist/build/google-fonts/fallback-metrics-data.js.map +1 -0
- package/dist/build/google-fonts/fallback-metrics.d.ts +13 -0
- package/dist/build/google-fonts/fallback-metrics.js +46 -0
- package/dist/build/google-fonts/fallback-metrics.js.map +1 -0
- package/dist/build/precompress.d.ts +13 -2
- package/dist/build/precompress.js +23 -13
- package/dist/build/precompress.js.map +1 -1
- package/dist/build/prerender.d.ts +4 -15
- package/dist/build/prerender.js +83 -53
- package/dist/build/prerender.js.map +1 -1
- package/dist/build/report.d.ts +5 -4
- package/dist/build/report.js +196 -348
- package/dist/build/report.js.map +1 -1
- package/dist/check.js +5 -0
- package/dist/check.js.map +1 -1
- package/dist/cli-args.d.ts +1 -0
- package/dist/cli-args.js +5 -0
- package/dist/cli-args.js.map +1 -1
- package/dist/cli.js +99 -3
- package/dist/cli.js.map +1 -1
- package/dist/client/navigation-runtime.d.ts +47 -0
- package/dist/client/navigation-runtime.js +156 -0
- package/dist/client/navigation-runtime.js.map +1 -0
- package/dist/client/pages-router-link-navigation.d.ts +26 -0
- package/dist/client/pages-router-link-navigation.js +14 -0
- package/dist/client/pages-router-link-navigation.js.map +1 -0
- package/dist/client/vinext-next-data.d.ts +12 -2
- package/dist/client/vinext-next-data.js +50 -1
- package/dist/client/vinext-next-data.js.map +1 -0
- package/dist/client/window-next.d.ts +3 -1
- package/dist/client/window-next.js.map +1 -1
- package/dist/cloudflare/kv-cache-handler.js +2 -1
- package/dist/cloudflare/kv-cache-handler.js.map +1 -1
- package/dist/config/config-matchers.d.ts +63 -16
- package/dist/config/config-matchers.js +143 -8
- package/dist/config/config-matchers.js.map +1 -1
- package/dist/config/dotenv.d.ts +11 -1
- package/dist/config/dotenv.js.map +1 -1
- package/dist/config/next-config.d.ts +107 -5
- package/dist/config/next-config.js +233 -7
- package/dist/config/next-config.js.map +1 -1
- package/dist/config/tsconfig-paths.d.ts +13 -0
- package/dist/config/tsconfig-paths.js +117 -0
- package/dist/config/tsconfig-paths.js.map +1 -0
- package/dist/deploy.js +104 -41
- package/dist/deploy.js.map +1 -1
- package/dist/entries/app-browser-entry.d.ts +2 -2
- package/dist/entries/app-browser-entry.js +34 -3
- package/dist/entries/app-browser-entry.js.map +1 -1
- package/dist/entries/app-rsc-entry.d.ts +19 -1
- package/dist/entries/app-rsc-entry.js +89 -23
- package/dist/entries/app-rsc-entry.js.map +1 -1
- package/dist/entries/app-rsc-manifest.d.ts +10 -0
- package/dist/entries/app-rsc-manifest.js +57 -7
- package/dist/entries/app-rsc-manifest.js.map +1 -1
- package/dist/entries/app-ssr-entry.d.ts +3 -3
- package/dist/entries/app-ssr-entry.js +4 -4
- package/dist/entries/app-ssr-entry.js.map +1 -1
- package/dist/entries/pages-client-entry.js +21 -7
- package/dist/entries/pages-client-entry.js.map +1 -1
- package/dist/entries/pages-server-entry.js +77 -9
- package/dist/entries/pages-server-entry.js.map +1 -1
- package/dist/entries/runtime-entry-module.d.ts +2 -1
- package/dist/entries/runtime-entry-module.js +9 -3
- package/dist/entries/runtime-entry-module.js.map +1 -1
- package/dist/index.js +260 -75
- package/dist/index.js.map +1 -1
- package/dist/plugins/client-reference-dedup.d.ts +15 -2
- package/dist/plugins/client-reference-dedup.js +138 -16
- package/dist/plugins/client-reference-dedup.js.map +1 -1
- package/dist/plugins/css-data-url.d.ts +7 -0
- package/dist/plugins/css-data-url.js +81 -0
- package/dist/plugins/css-data-url.js.map +1 -0
- package/dist/plugins/fonts.d.ts +2 -2
- package/dist/plugins/fonts.js +20 -9
- package/dist/plugins/fonts.js.map +1 -1
- package/dist/plugins/middleware-server-only.d.ts +54 -0
- package/dist/plugins/middleware-server-only.js +91 -0
- package/dist/plugins/middleware-server-only.js.map +1 -0
- package/dist/plugins/optimize-imports.js +4 -4
- package/dist/plugins/optimize-imports.js.map +1 -1
- package/dist/plugins/sass.d.ts +34 -0
- package/dist/plugins/sass.js +22 -0
- package/dist/plugins/sass.js.map +1 -0
- package/dist/plugins/strip-server-exports.js +5 -8
- package/dist/plugins/strip-server-exports.js.map +1 -1
- package/dist/routing/app-route-graph.d.ts +50 -2
- package/dist/routing/app-route-graph.js +140 -16
- package/dist/routing/app-route-graph.js.map +1 -1
- package/dist/routing/app-router.d.ts +2 -2
- package/dist/routing/app-router.js +2 -2
- package/dist/routing/app-router.js.map +1 -1
- package/dist/routing/route-pattern.d.ts +56 -1
- package/dist/routing/route-pattern.js +60 -1
- package/dist/routing/route-pattern.js.map +1 -1
- package/dist/routing/utils.d.ts +2 -1
- package/dist/routing/utils.js +4 -1
- package/dist/routing/utils.js.map +1 -1
- package/dist/server/api-handler.js +139 -37
- package/dist/server/api-handler.js.map +1 -1
- package/dist/server/app-browser-action-result.d.ts +27 -2
- package/dist/server/app-browser-action-result.js +63 -2
- package/dist/server/app-browser-action-result.js.map +1 -1
- package/dist/server/app-browser-entry.js +493 -195
- package/dist/server/app-browser-entry.js.map +1 -1
- package/dist/server/app-browser-hydration.d.ts +13 -1
- package/dist/server/app-browser-hydration.js +9 -1
- package/dist/server/app-browser-hydration.js.map +1 -1
- package/dist/server/app-browser-interception-context.d.ts +24 -0
- package/dist/server/app-browser-interception-context.js +32 -0
- package/dist/server/app-browser-interception-context.js.map +1 -0
- package/dist/server/app-browser-navigation-controller.d.ts +17 -2
- package/dist/server/app-browser-navigation-controller.js +33 -10
- package/dist/server/app-browser-navigation-controller.js.map +1 -1
- package/dist/server/app-browser-popstate.d.ts +16 -0
- package/dist/server/app-browser-popstate.js +17 -0
- package/dist/server/app-browser-popstate.js.map +1 -0
- package/dist/server/app-browser-rsc-redirect.d.ts +29 -0
- package/dist/server/app-browser-rsc-redirect.js +37 -0
- package/dist/server/app-browser-rsc-redirect.js.map +1 -0
- package/dist/server/app-browser-state.d.ts +28 -7
- package/dist/server/app-browser-state.js +63 -27
- package/dist/server/app-browser-state.js.map +1 -1
- package/dist/server/app-browser-stream.d.ts +9 -17
- package/dist/server/app-browser-stream.js +18 -13
- package/dist/server/app-browser-stream.js.map +1 -1
- package/dist/server/app-browser-visible-commit.d.ts +7 -1
- package/dist/server/app-browser-visible-commit.js +39 -5
- package/dist/server/app-browser-visible-commit.js.map +1 -1
- package/dist/server/app-elements-wire.d.ts +43 -6
- package/dist/server/app-elements-wire.js +189 -7
- package/dist/server/app-elements-wire.js.map +1 -1
- package/dist/server/app-elements.d.ts +3 -2
- package/dist/server/app-elements.js +3 -2
- package/dist/server/app-elements.js.map +1 -1
- package/dist/server/app-fallback-renderer.d.ts +10 -1
- package/dist/server/app-fallback-renderer.js +41 -3
- package/dist/server/app-fallback-renderer.js.map +1 -1
- package/dist/server/app-history-state.d.ts +26 -0
- package/dist/server/app-history-state.js +53 -0
- package/dist/server/app-history-state.js.map +1 -0
- package/dist/server/app-middleware.d.ts +13 -0
- package/dist/server/app-middleware.js +3 -1
- package/dist/server/app-middleware.js.map +1 -1
- package/dist/server/app-optimistic-routing.d.ts +54 -0
- package/dist/server/app-optimistic-routing.js +200 -0
- package/dist/server/app-optimistic-routing.js.map +1 -0
- package/dist/server/app-page-boundary-render.d.ts +10 -1
- package/dist/server/app-page-boundary-render.js +13 -6
- package/dist/server/app-page-boundary-render.js.map +1 -1
- package/dist/server/app-page-boundary.js +3 -2
- package/dist/server/app-page-boundary.js.map +1 -1
- package/dist/server/app-page-cache.d.ts +26 -1
- package/dist/server/app-page-cache.js +86 -14
- package/dist/server/app-page-cache.js.map +1 -1
- package/dist/server/app-page-dispatch.d.ts +7 -0
- package/dist/server/app-page-dispatch.js +96 -12
- package/dist/server/app-page-dispatch.js.map +1 -1
- package/dist/server/app-page-element-builder.d.ts +7 -0
- package/dist/server/app-page-element-builder.js +34 -5
- package/dist/server/app-page-element-builder.js.map +1 -1
- package/dist/server/app-page-execution.d.ts +28 -1
- package/dist/server/app-page-execution.js +91 -7
- package/dist/server/app-page-execution.js.map +1 -1
- package/dist/server/app-page-head.d.ts +7 -0
- package/dist/server/app-page-head.js +23 -3
- package/dist/server/app-page-head.js.map +1 -1
- package/dist/server/app-page-probe.d.ts +23 -1
- package/dist/server/app-page-probe.js +29 -1
- package/dist/server/app-page-probe.js.map +1 -1
- package/dist/server/app-page-render-observation.d.ts +35 -0
- package/dist/server/app-page-render-observation.js +68 -0
- package/dist/server/app-page-render-observation.js.map +1 -0
- package/dist/server/app-page-render.d.ts +7 -1
- package/dist/server/app-page-render.js +81 -4
- package/dist/server/app-page-render.js.map +1 -1
- package/dist/server/app-page-request.d.ts +1 -0
- package/dist/server/app-page-request.js.map +1 -1
- package/dist/server/app-page-response.js +7 -5
- package/dist/server/app-page-response.js.map +1 -1
- package/dist/server/app-page-route-wiring.d.ts +3 -1
- package/dist/server/app-page-route-wiring.js +59 -24
- package/dist/server/app-page-route-wiring.js.map +1 -1
- package/dist/server/app-page-stream.d.ts +5 -0
- package/dist/server/app-page-stream.js +2 -0
- package/dist/server/app-page-stream.js.map +1 -1
- package/dist/server/app-prerender-static-params.d.ts +2 -1
- package/dist/server/app-prerender-static-params.js +44 -8
- package/dist/server/app-prerender-static-params.js.map +1 -1
- package/dist/server/app-route-handler-cache.d.ts +2 -2
- package/dist/server/app-route-handler-cache.js +3 -2
- package/dist/server/app-route-handler-cache.js.map +1 -1
- package/dist/server/app-route-handler-dispatch.d.ts +6 -1
- package/dist/server/app-route-handler-dispatch.js +1 -1
- package/dist/server/app-route-handler-dispatch.js.map +1 -1
- package/dist/server/app-route-handler-execution.d.ts +17 -2
- package/dist/server/app-route-handler-execution.js.map +1 -1
- package/dist/server/app-route-handler-response.js +5 -4
- package/dist/server/app-route-handler-response.js.map +1 -1
- package/dist/server/app-router-entry.js +7 -15
- package/dist/server/app-router-entry.js.map +1 -1
- package/dist/server/app-rsc-cache-busting.d.ts +19 -1
- package/dist/server/app-rsc-cache-busting.js +36 -1
- package/dist/server/app-rsc-cache-busting.js.map +1 -1
- package/dist/server/app-rsc-embedded-chunks.d.ts +9 -0
- package/dist/server/app-rsc-embedded-chunks.js +34 -0
- package/dist/server/app-rsc-embedded-chunks.js.map +1 -0
- package/dist/server/app-rsc-errors.d.ts +4 -1
- package/dist/server/app-rsc-errors.js +1 -1
- package/dist/server/app-rsc-errors.js.map +1 -1
- package/dist/server/app-rsc-handler.d.ts +21 -5
- package/dist/server/app-rsc-handler.js +38 -15
- package/dist/server/app-rsc-handler.js.map +1 -1
- package/dist/server/app-rsc-render-mode.d.ts +4 -3
- package/dist/server/app-rsc-render-mode.js +7 -1
- package/dist/server/app-rsc-render-mode.js.map +1 -1
- package/dist/server/app-rsc-request-normalization.d.ts +4 -1
- package/dist/server/app-rsc-request-normalization.js +4 -1
- package/dist/server/app-rsc-request-normalization.js.map +1 -1
- package/dist/server/app-rsc-response-finalizer.d.ts +8 -1
- package/dist/server/app-rsc-response-finalizer.js +10 -3
- package/dist/server/app-rsc-response-finalizer.js.map +1 -1
- package/dist/server/app-rsc-route-matching.d.ts +23 -0
- package/dist/server/app-rsc-route-matching.js +47 -25
- package/dist/server/app-rsc-route-matching.js.map +1 -1
- package/dist/server/app-server-action-execution.d.ts +35 -3
- package/dist/server/app-server-action-execution.js +87 -33
- package/dist/server/app-server-action-execution.js.map +1 -1
- package/dist/server/app-ssr-entry.d.ts +3 -0
- package/dist/server/app-ssr-entry.js +83 -58
- package/dist/server/app-ssr-entry.js.map +1 -1
- package/dist/server/app-ssr-error-meta.d.ts +14 -0
- package/dist/server/app-ssr-error-meta.js +50 -0
- package/dist/server/app-ssr-error-meta.js.map +1 -0
- package/dist/server/app-ssr-stream.d.ts +7 -2
- package/dist/server/app-ssr-stream.js +26 -15
- package/dist/server/app-ssr-stream.js.map +1 -1
- package/dist/server/artifact-compatibility.d.ts +13 -3
- package/dist/server/artifact-compatibility.js +12 -8
- package/dist/server/artifact-compatibility.js.map +1 -1
- package/dist/server/cache-headers.d.ts +7 -0
- package/dist/server/cache-headers.js +19 -0
- package/dist/server/cache-headers.js.map +1 -0
- package/dist/server/cache-proof.d.ts +170 -5
- package/dist/server/cache-proof.js +472 -18
- package/dist/server/cache-proof.js.map +1 -1
- package/dist/server/client-reuse-manifest.d.ts +99 -0
- package/dist/server/client-reuse-manifest.js +212 -0
- package/dist/server/client-reuse-manifest.js.map +1 -0
- package/dist/server/default-global-error-module.d.ts +20 -0
- package/dist/server/default-global-error-module.js +20 -0
- package/dist/server/default-global-error-module.js.map +1 -0
- package/dist/server/dev-lockfile.d.ts +110 -0
- package/dist/server/dev-lockfile.js +180 -0
- package/dist/server/dev-lockfile.js.map +1 -0
- package/dist/server/dev-server.d.ts +9 -1
- package/dist/server/dev-server.js +76 -19
- package/dist/server/dev-server.js.map +1 -1
- package/dist/server/edge-api-runtime.d.ts +5 -0
- package/dist/server/edge-api-runtime.js +8 -0
- package/dist/server/edge-api-runtime.js.map +1 -0
- package/dist/server/file-based-metadata.d.ts +13 -0
- package/dist/server/file-based-metadata.js +49 -2
- package/dist/server/file-based-metadata.js.map +1 -1
- package/dist/server/headers.d.ts +20 -1
- package/dist/server/headers.js +22 -2
- package/dist/server/headers.js.map +1 -1
- package/dist/server/html.js +1 -1
- package/dist/server/html.js.map +1 -1
- package/dist/server/http-error-responses.d.ts +26 -1
- package/dist/server/http-error-responses.js +32 -2
- package/dist/server/http-error-responses.js.map +1 -1
- package/dist/server/isr-cache.d.ts +8 -3
- package/dist/server/isr-cache.js +24 -6
- package/dist/server/isr-cache.js.map +1 -1
- package/dist/server/metadata-route-response.js +22 -5
- package/dist/server/metadata-route-response.js.map +1 -1
- package/dist/server/metadata-routes.js +27 -8
- package/dist/server/metadata-routes.js.map +1 -1
- package/dist/server/middleware-runtime.d.ts +15 -0
- package/dist/server/middleware-runtime.js +60 -7
- package/dist/server/middleware-runtime.js.map +1 -1
- package/dist/server/middleware.d.ts +13 -1
- package/dist/server/middleware.js +16 -2
- package/dist/server/middleware.js.map +1 -1
- package/dist/server/navigation-planner.d.ts +26 -6
- package/dist/server/navigation-planner.js +358 -24
- package/dist/server/navigation-planner.js.map +1 -1
- package/dist/server/navigation-trace.d.ts +9 -1
- package/dist/server/navigation-trace.js +8 -0
- package/dist/server/navigation-trace.js.map +1 -1
- package/dist/server/normalize-path.d.ts +2 -1
- package/dist/server/normalize-path.js +4 -1
- package/dist/server/normalize-path.js.map +1 -1
- package/dist/server/pages-api-route.d.ts +27 -1
- package/dist/server/pages-api-route.js +25 -3
- package/dist/server/pages-api-route.js.map +1 -1
- package/dist/server/pages-data-route.d.ts +77 -0
- package/dist/server/pages-data-route.js +97 -0
- package/dist/server/pages-data-route.js.map +1 -0
- package/dist/server/pages-i18n.d.ts +51 -1
- package/dist/server/pages-i18n.js +61 -1
- package/dist/server/pages-i18n.js.map +1 -1
- package/dist/server/pages-page-data.d.ts +32 -4
- package/dist/server/pages-page-data.js +52 -19
- package/dist/server/pages-page-data.js.map +1 -1
- package/dist/server/pages-page-response.d.ts +11 -1
- package/dist/server/pages-page-response.js +6 -4
- package/dist/server/pages-page-response.js.map +1 -1
- package/dist/server/prod-server.d.ts +26 -1
- package/dist/server/prod-server.js +150 -44
- package/dist/server/prod-server.js.map +1 -1
- package/dist/server/request-pipeline.d.ts +11 -2
- package/dist/server/request-pipeline.js +28 -11
- package/dist/server/request-pipeline.js.map +1 -1
- package/dist/server/seed-cache.d.ts +12 -31
- package/dist/server/seed-cache.js +22 -35
- package/dist/server/seed-cache.js.map +1 -1
- package/dist/server/server-action-not-found.d.ts +16 -3
- package/dist/server/server-action-not-found.js +27 -4
- package/dist/server/server-action-not-found.js.map +1 -1
- package/dist/server/server-globals.d.ts +5 -0
- package/dist/server/server-globals.js +37 -0
- package/dist/server/server-globals.js.map +1 -0
- package/dist/server/skip-cache-proof.d.ts +41 -0
- package/dist/server/skip-cache-proof.js +101 -0
- package/dist/server/skip-cache-proof.js.map +1 -0
- package/dist/server/static-file-cache.d.ts +1 -1
- package/dist/server/static-file-cache.js +7 -6
- package/dist/server/static-file-cache.js.map +1 -1
- package/dist/shims/cache-runtime.d.ts +19 -2
- package/dist/shims/cache-runtime.js +67 -11
- package/dist/shims/cache-runtime.js.map +1 -1
- package/dist/shims/cache.d.ts +5 -18
- package/dist/shims/cache.js +2 -0
- package/dist/shims/cache.js.map +1 -1
- package/dist/shims/client-locale.d.ts +15 -0
- package/dist/shims/client-locale.js +13 -0
- package/dist/shims/client-locale.js.map +1 -0
- package/dist/shims/default-global-error.d.ts +32 -0
- package/dist/shims/default-global-error.js +181 -0
- package/dist/shims/default-global-error.js.map +1 -0
- package/dist/shims/document.d.ts +59 -3
- package/dist/shims/document.js +36 -5
- package/dist/shims/document.js.map +1 -1
- package/dist/shims/error-boundary.d.ts +2 -2
- package/dist/shims/error-boundary.js +6 -8
- package/dist/shims/error-boundary.js.map +1 -1
- package/dist/shims/error.d.ts +18 -1
- package/dist/shims/error.js +56 -1
- package/dist/shims/error.js.map +1 -1
- package/dist/shims/fetch-cache.d.ts +4 -1
- package/dist/shims/fetch-cache.js +40 -5
- package/dist/shims/fetch-cache.js.map +1 -1
- package/dist/shims/font-google-base.d.ts +22 -8
- package/dist/shims/font-google-base.js +41 -71
- package/dist/shims/font-google-base.js.map +1 -1
- package/dist/shims/font-local.d.ts +3 -20
- package/dist/shims/font-local.js +23 -75
- package/dist/shims/font-local.js.map +1 -1
- package/dist/shims/font-utils.d.ts +51 -0
- package/dist/shims/font-utils.js +97 -0
- package/dist/shims/font-utils.js.map +1 -0
- package/dist/shims/form.js +13 -6
- package/dist/shims/form.js.map +1 -1
- package/dist/shims/hash-scroll.d.ts +7 -0
- package/dist/shims/hash-scroll.js +30 -0
- package/dist/shims/hash-scroll.js.map +1 -0
- package/dist/shims/headers.d.ts +8 -11
- package/dist/shims/headers.js +22 -2
- package/dist/shims/headers.js.map +1 -1
- package/dist/shims/image.d.ts +1 -0
- package/dist/shims/image.js +144 -78
- package/dist/shims/image.js.map +1 -1
- package/dist/shims/internal/app-router-context.d.ts +6 -6
- package/dist/shims/internal/app-router-context.js +17 -6
- package/dist/shims/internal/app-router-context.js.map +1 -1
- package/dist/shims/link-prefetch.d.ts +9 -1
- package/dist/shims/link-prefetch.js +11 -6
- package/dist/shims/link-prefetch.js.map +1 -1
- package/dist/shims/link.d.ts +33 -5
- package/dist/shims/link.js +205 -50
- package/dist/shims/link.js.map +1 -1
- package/dist/shims/metadata.d.ts +16 -30
- package/dist/shims/metadata.js +91 -32
- package/dist/shims/metadata.js.map +1 -1
- package/dist/shims/navigation.d.ts +164 -17
- package/dist/shims/navigation.js +355 -84
- package/dist/shims/navigation.js.map +1 -1
- package/dist/shims/navigation.react-server.d.ts +3 -2
- package/dist/shims/navigation.react-server.js +5 -2
- package/dist/shims/navigation.react-server.js.map +1 -1
- package/dist/shims/og.d.ts +18 -2
- package/dist/shims/og.js +49 -1
- package/dist/shims/og.js.map +1 -0
- package/dist/shims/pages-router-runtime.d.ts +7 -0
- package/dist/shims/pages-router-runtime.js +16 -0
- package/dist/shims/pages-router-runtime.js.map +1 -0
- package/dist/shims/request-state-types.d.ts +1 -1
- package/dist/shims/root-params.d.ts +3 -1
- package/dist/shims/root-params.js +11 -3
- package/dist/shims/root-params.js.map +1 -1
- package/dist/shims/router-state.d.ts +1 -0
- package/dist/shims/router-state.js.map +1 -1
- package/dist/shims/router.d.ts +40 -7
- package/dist/shims/router.js +355 -250
- package/dist/shims/router.js.map +1 -1
- package/dist/shims/script.js +110 -32
- package/dist/shims/script.js.map +1 -1
- package/dist/shims/server.d.ts +21 -4
- package/dist/shims/server.js +31 -10
- package/dist/shims/server.js.map +1 -1
- package/dist/shims/slot.d.ts +1 -0
- package/dist/shims/slot.js +45 -1
- package/dist/shims/slot.js.map +1 -1
- package/dist/shims/unified-request-context.d.ts +1 -1
- package/dist/shims/unified-request-context.js +2 -0
- package/dist/shims/unified-request-context.js.map +1 -1
- package/dist/shims/unrecognized-action-error.d.ts +35 -0
- package/dist/shims/unrecognized-action-error.js +41 -0
- package/dist/shims/unrecognized-action-error.js.map +1 -0
- package/dist/shims/url-safety.d.ts +23 -1
- package/dist/shims/url-safety.js +29 -2
- package/dist/shims/url-safety.js.map +1 -1
- package/dist/shims/url-utils.d.ts +21 -1
- package/dist/shims/url-utils.js +67 -3
- package/dist/shims/url-utils.js.map +1 -1
- package/dist/typegen.d.ts +10 -0
- package/dist/typegen.js +242 -0
- package/dist/typegen.js.map +1 -0
- package/dist/utils/asset-prefix.d.ts +97 -0
- package/dist/utils/asset-prefix.js +124 -0
- package/dist/utils/asset-prefix.js.map +1 -0
- package/dist/utils/base-path.d.ts +7 -1
- package/dist/utils/base-path.js +10 -1
- package/dist/utils/base-path.js.map +1 -1
- package/dist/utils/cache-control-metadata.d.ts +2 -1
- package/dist/utils/cache-control-metadata.js +1 -3
- package/dist/utils/cache-control-metadata.js.map +1 -1
- package/dist/utils/domain-locale.d.ts +2 -1
- package/dist/utils/domain-locale.js +9 -1
- package/dist/utils/domain-locale.js.map +1 -1
- package/dist/utils/lazy-chunks.d.ts +1 -1
- package/dist/utils/lazy-chunks.js +1 -1
- package/dist/utils/lazy-chunks.js.map +1 -1
- package/dist/utils/navigation-signal.d.ts +1 -2
- package/dist/utils/navigation-signal.js +1 -1
- package/dist/utils/navigation-signal.js.map +1 -1
- package/dist/utils/prerender-output-paths.d.ts +15 -0
- package/dist/utils/prerender-output-paths.js +24 -0
- package/dist/utils/prerender-output-paths.js.map +1 -0
- package/dist/utils/query.d.ts +17 -1
- package/dist/utils/query.js +36 -1
- package/dist/utils/query.js.map +1 -1
- package/dist/utils/record.d.ts +5 -0
- package/dist/utils/record.js +8 -0
- package/dist/utils/record.js.map +1 -0
- package/dist/utils/sorted-array.d.ts +9 -0
- package/dist/utils/sorted-array.js +22 -0
- package/dist/utils/sorted-array.js.map +1 -0
- package/package.json +13 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { shouldSuppressLoadingBoundaries } from "./app-rsc-render-mode.js";
|
|
2
|
-
import { AppElementsWire } from "./app-elements-wire.js";
|
|
3
|
-
import "./app-elements.js";
|
|
1
|
+
import { APP_RSC_RENDER_MODE_PREFETCH_LOADING_SHELL, shouldSuppressLoadingBoundaries } from "./app-rsc-render-mode.js";
|
|
2
|
+
import { AppElementsWire, normalizeAppElementsSlotBindings } from "./app-elements-wire.js";
|
|
3
|
+
import { APP_PREFETCH_LOADING_SHELL_MARKER_KEY } from "./app-elements.js";
|
|
4
4
|
import { ErrorBoundary, ForbiddenBoundary, NotFoundBoundary, RedirectBoundary, UnauthorizedBoundary } from "../shims/error-boundary.js";
|
|
5
5
|
import { LayoutSegmentProvider } from "../shims/layout-segment-context.js";
|
|
6
6
|
import { MetadataHead, ViewportHead } from "../shims/metadata.js";
|
|
@@ -67,24 +67,52 @@ function createAppPageParallelSlotEntries(layoutIndex, layoutEntries, route, get
|
|
|
67
67
|
const slotName = slot.name;
|
|
68
68
|
const targetIndex = slot.layoutIndex >= 0 ? slot.layoutIndex : layoutEntries.length - 1;
|
|
69
69
|
if (targetIndex !== layoutIndex) continue;
|
|
70
|
-
const
|
|
70
|
+
const slotId = resolveAppPageSlotId(slot, layoutEntries[targetIndex]?.treePath ?? "/");
|
|
71
71
|
const slotParams = getEffectiveSlotParams(slotKey, slotName);
|
|
72
72
|
parallelSlots[slotName] = /* @__PURE__ */ jsx(LayoutSegmentProvider, {
|
|
73
73
|
segmentMap: { children: slot.routeSegments ? resolveAppPageChildSegments(slot.routeSegments, 0, slotParams) : [] },
|
|
74
|
-
children: /* @__PURE__ */ jsx(Slot, { id:
|
|
74
|
+
children: /* @__PURE__ */ jsx(Slot, { id: slotId })
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
return Object.keys(parallelSlots).length > 0 ? parallelSlots : void 0;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function resolveAppPageSlotId(slot, treePath) {
|
|
80
|
+
const slotId = AppElementsWire.encodeSlotId(slot.name, treePath);
|
|
81
|
+
if (slot.id && slot.id !== slotId) throw new Error(`[vinext] App Router slot id mismatch for @${slot.name}: graph id ${slot.id} does not match wire id ${slotId}`);
|
|
82
|
+
return slotId;
|
|
83
|
+
}
|
|
84
|
+
function resolveAppPageSlotBindingState(slot, override) {
|
|
85
|
+
if (getDefaultExport(override?.pageModule) ?? getDefaultExport(slot.page)) return "active";
|
|
86
|
+
if (getDefaultExport(slot.default)) return "default";
|
|
87
|
+
return "unmatched";
|
|
88
|
+
}
|
|
89
|
+
function createAppPageSlotBindings(route, layoutEntries, resolveSlotOverride) {
|
|
90
|
+
const bindings = [];
|
|
91
|
+
for (const [slotKey, slot] of Object.entries(route.slots ?? {})) {
|
|
92
|
+
const layoutEntry = layoutEntries[slot.layoutIndex >= 0 ? slot.layoutIndex : layoutEntries.length - 1] ?? null;
|
|
93
|
+
const ownerLayoutId = layoutEntry?.id ?? null;
|
|
94
|
+
const override = resolveSlotOverride(slotKey, slot.name);
|
|
95
|
+
bindings.push({
|
|
96
|
+
ownerLayoutId,
|
|
97
|
+
slotId: resolveAppPageSlotId(slot, layoutEntry?.treePath ?? "/"),
|
|
98
|
+
state: resolveAppPageSlotBindingState(slot, override)
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return normalizeAppElementsSlotBindings(bindings, { layoutIds: layoutEntries.map((entry) => entry.id) });
|
|
102
|
+
}
|
|
103
|
+
function createAppPageRouteHead(metadata, viewport, pathname) {
|
|
80
104
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
81
105
|
/* @__PURE__ */ jsx("meta", { charSet: "utf-8" }),
|
|
82
|
-
metadata ? /* @__PURE__ */ jsx(MetadataHead, {
|
|
106
|
+
metadata ? /* @__PURE__ */ jsx(MetadataHead, {
|
|
107
|
+
metadata,
|
|
108
|
+
pathname
|
|
109
|
+
}) : null,
|
|
83
110
|
/* @__PURE__ */ jsx(ViewportHead, { viewport })
|
|
84
111
|
] });
|
|
85
112
|
}
|
|
86
113
|
function buildAppPageElements(options) {
|
|
87
114
|
const interceptionContext = options.interceptionContext ?? null;
|
|
115
|
+
const renderMode = options.renderMode ?? "navigation";
|
|
88
116
|
const routeSegments = options.route.routeSegments ?? [];
|
|
89
117
|
const routeResetKey = resolveAppPageRouteStateKey(routeSegments, options.matchedParams);
|
|
90
118
|
const routeId = AppElementsWire.encodeRouteId(options.routePath, interceptionContext);
|
|
@@ -107,12 +135,6 @@ function buildAppPageElements(options) {
|
|
|
107
135
|
const templateDependenciesBeforeById = /* @__PURE__ */ new Map();
|
|
108
136
|
const pageDependencies = [];
|
|
109
137
|
const rootLayoutTreePath = layoutEntries[0]?.treePath ?? null;
|
|
110
|
-
const elements = { ...AppElementsWire.createMetadataEntries({
|
|
111
|
-
interceptionContext,
|
|
112
|
-
layoutIds: options.route.ids?.layouts ?? layoutEntries.map((entry) => entry.id),
|
|
113
|
-
rootLayoutTreePath,
|
|
114
|
-
routeId
|
|
115
|
-
}) };
|
|
116
138
|
const slotNameCounts = /* @__PURE__ */ new Map();
|
|
117
139
|
for (const slot of Object.values(options.route.slots ?? {})) {
|
|
118
140
|
const slotName = slot.name;
|
|
@@ -128,6 +150,14 @@ function buildAppPageElements(options) {
|
|
|
128
150
|
if (overrideByKey) return overrideByKey;
|
|
129
151
|
if (slotKey === slotName || (slotNameCounts.get(slotName) ?? 0) === 1) return options.slotOverrides?.[slotName];
|
|
130
152
|
};
|
|
153
|
+
const elements = { ...AppElementsWire.createMetadataEntries({
|
|
154
|
+
interception: options.interception ?? null,
|
|
155
|
+
interceptionContext,
|
|
156
|
+
layoutIds: options.route.ids?.layouts ?? layoutEntries.map((entry) => entry.id),
|
|
157
|
+
rootLayoutTreePath,
|
|
158
|
+
routeId,
|
|
159
|
+
slotBindings: createAppPageSlotBindings(options.route, layoutEntries, resolveSlotOverride)
|
|
160
|
+
}) };
|
|
131
161
|
const getEffectiveSlotParams = (slotKey, slotName) => resolveSlotOverride(slotKey, slotName)?.params ?? options.matchedParams;
|
|
132
162
|
for (const treePosition of orderedTreePositions) {
|
|
133
163
|
const layoutIndex = layoutIndicesByTreePosition.get(treePosition);
|
|
@@ -148,7 +178,10 @@ function buildAppPageElements(options) {
|
|
|
148
178
|
templateDependenciesBeforeById.set(templateEntry.id, [...pageDependencies]);
|
|
149
179
|
pageDependencies.push(templateDependency);
|
|
150
180
|
}
|
|
151
|
-
|
|
181
|
+
const routeLoadingComponent = getDefaultExport(options.route.loading);
|
|
182
|
+
const isPrefetchLoadingShell = renderMode === APP_RSC_RENDER_MODE_PREFETCH_LOADING_SHELL;
|
|
183
|
+
if (isPrefetchLoadingShell && routeLoadingComponent !== null) elements[APP_PREFETCH_LOADING_SHELL_MARKER_KEY] = "LoadingBoundary";
|
|
184
|
+
elements[pageId] = isPrefetchLoadingShell ? null : renderAfterAppDependencies(options.element, pageDependencies);
|
|
152
185
|
for (const templateEntry of templateEntries) {
|
|
153
186
|
const templateComponent = getDefaultExport(templateEntry.templateModule);
|
|
154
187
|
if (!templateComponent) continue;
|
|
@@ -187,8 +220,7 @@ function buildAppPageElements(options) {
|
|
|
187
220
|
for (const [slotKey, slot] of Object.entries(options.route.slots ?? {})) {
|
|
188
221
|
const slotName = slot.name;
|
|
189
222
|
const targetIndex = slot.layoutIndex >= 0 ? slot.layoutIndex : layoutEntries.length - 1;
|
|
190
|
-
const
|
|
191
|
-
const slotId = AppElementsWire.encodeSlotId(slotName, treePath);
|
|
223
|
+
const slotId = resolveAppPageSlotId(slot, layoutEntries[targetIndex]?.treePath ?? "/");
|
|
192
224
|
const slotOverride = resolveSlotOverride(slotKey, slotName);
|
|
193
225
|
const slotParams = getEffectiveSlotParams(slotKey, slotName);
|
|
194
226
|
const slotResetKey = resolveAppPageRouteStateKey(slot.routeSegments ?? [], slotParams);
|
|
@@ -219,7 +251,7 @@ function buildAppPageElements(options) {
|
|
|
219
251
|
children: slotElement
|
|
220
252
|
});
|
|
221
253
|
const slotLoadingComponent = getDefaultExport(slot.loading);
|
|
222
|
-
if (slotLoadingComponent && !shouldSuppressLoadingBoundaries(
|
|
254
|
+
if (slotLoadingComponent && !shouldSuppressLoadingBoundaries(renderMode)) slotElement = /* @__PURE__ */ jsx(Suspense, {
|
|
223
255
|
fallback: /* @__PURE__ */ jsx(slotLoadingComponent, {}),
|
|
224
256
|
children: slotElement
|
|
225
257
|
}, slotResetKey);
|
|
@@ -235,12 +267,15 @@ function buildAppPageElements(options) {
|
|
|
235
267
|
segmentMap: { children: [] },
|
|
236
268
|
children: /* @__PURE__ */ jsx(Slot, { id: pageId })
|
|
237
269
|
});
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
270
|
+
if (isPrefetchLoadingShell) if (routeLoadingComponent === null) routeChildren = null;
|
|
271
|
+
else routeChildren = /* @__PURE__ */ jsx(routeLoadingComponent, {});
|
|
272
|
+
else {
|
|
273
|
+
routeChildren = /* @__PURE__ */ jsx(RedirectBoundary, { children: routeChildren });
|
|
274
|
+
if (routeLoadingComponent && !shouldSuppressLoadingBoundaries(renderMode)) routeChildren = /* @__PURE__ */ jsx(Suspense, {
|
|
275
|
+
fallback: /* @__PURE__ */ jsx(routeLoadingComponent, {}),
|
|
276
|
+
children: routeChildren
|
|
277
|
+
}, routeResetKey);
|
|
278
|
+
}
|
|
244
279
|
const lastLayoutErrorModule = errorEntries.length > 0 ? errorEntries[errorEntries.length - 1].errorModule : null;
|
|
245
280
|
const notFoundComponent = getDefaultExport(options.route.notFound) ?? getDefaultExport(options.rootNotFoundModule);
|
|
246
281
|
if (notFoundComponent) routeChildren = /* @__PURE__ */ jsx(NotFoundBoundary, {
|
|
@@ -330,7 +365,7 @@ function buildAppPageElements(options) {
|
|
|
330
365
|
fallback: globalErrorComponent,
|
|
331
366
|
children: routeChildren
|
|
332
367
|
});
|
|
333
|
-
elements[routeId] = /* @__PURE__ */ jsxs(Fragment$1, { children: [createAppPageRouteHead(options.resolvedMetadata, options.resolvedViewport), routeChildren] });
|
|
368
|
+
elements[routeId] = /* @__PURE__ */ jsxs(Fragment$1, { children: [createAppPageRouteHead(options.resolvedMetadata, options.resolvedViewport, options.resolvedMetadataPathname ?? options.routePath), routeChildren] });
|
|
334
369
|
return elements;
|
|
335
370
|
}
|
|
336
371
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-page-route-wiring.js","names":["Children","SlotComponent","InterceptLayoutComponent","SlotLayoutComponent","SlotLoadingComponent","RouteLoadingComponent","NotFoundComponent","ForbiddenComponent","UnauthorizedComponent","LayoutNotFoundComponent","LayoutForbiddenComponent","LayoutUnauthorizedComponent"],"sources":["../../src/server/app-page-route-wiring.tsx"],"sourcesContent":["import { Suspense, type ComponentType, type ReactNode } from \"react\";\nimport { AppElementsWire, type AppElements } from \"./app-elements.js\";\nimport {\n ErrorBoundary,\n ForbiddenBoundary,\n NotFoundBoundary,\n RedirectBoundary,\n UnauthorizedBoundary,\n} from \"vinext/shims/error-boundary\";\nimport type { AppRouteSemanticIds } from \"../routing/app-route-graph.js\";\nimport { LayoutSegmentProvider } from \"vinext/shims/layout-segment-context\";\nimport { MetadataHead, ViewportHead, type Metadata, type Viewport } from \"vinext/shims/metadata\";\nimport { Children, ParallelSlot, Slot } from \"vinext/shims/slot\";\nimport type { AppPageParams } from \"./app-page-boundary.js\";\nimport {\n createAppRenderDependency,\n renderAfterAppDependencies,\n renderWithAppDependencyBarrier,\n type AppRenderDependency,\n} from \"./app-render-dependency.js\";\nimport { resolveAppPageSegmentParams } from \"./app-page-params.js\";\nimport {\n APP_RSC_RENDER_MODE_NAVIGATION,\n shouldSuppressLoadingBoundaries,\n type AppRscRenderMode,\n} from \"./app-rsc-render-mode.js\";\nimport {\n resolveAppPageChildSegments,\n resolveAppPageRouteStateKey,\n resolveAppPageSegmentStateKey,\n} from \"./app-page-segment-state.js\";\n\nexport { resolveAppPageChildSegments } from \"./app-page-segment-state.js\";\n\ntype AppPageComponentProps = {\n children?: ReactNode;\n error?: unknown;\n params?: unknown;\n reset?: () => void;\n} & Record<string, unknown>;\n\ntype AppPageComponent = ComponentType<AppPageComponentProps>;\ntype AppPageErrorComponent = ComponentType<{ error: unknown; reset: () => void }>;\n\nexport type AppPageModule = Record<string, unknown> & {\n default?: AppPageComponent | null | undefined;\n};\n\nexport type AppPageErrorModule = Record<string, unknown> & {\n default?: AppPageErrorComponent | null | undefined;\n};\n\ntype AppPageRouteWiringSlot<\n TModule extends AppPageModule = AppPageModule,\n TErrorModule extends AppPageErrorModule = AppPageErrorModule,\n> = {\n /** Graph-owned semantic slot identity. */\n id?: string | null;\n /** Slot prop name passed to the owning layout (e.g. \"modal\" from @modal). */\n name: string;\n default?: TModule | null;\n error?: TErrorModule | null;\n layout?: TModule | null;\n layoutIndex: number;\n loading?: TModule | null;\n page?: TModule | null;\n routeSegments?: readonly string[] | null;\n /**\n * Full URL pattern parts for the slot's mirrored sub-page. Set when the\n * slot's params may differ from the route's (e.g. inherited slot whose\n * dynamic markers have different names than the route's). The runtime\n * matches the request URL against these parts to extract slot params.\n */\n slotPatternParts?: readonly string[] | null;\n /** Param names captured by `slotPatternParts`, in order. */\n slotParamNames?: readonly string[] | null;\n};\n\nexport type AppPageRouteWiringRoute<\n TModule extends AppPageModule = AppPageModule,\n TErrorModule extends AppPageErrorModule = AppPageErrorModule,\n> = {\n ids?: AppRouteSemanticIds | null;\n error?: TErrorModule | null;\n errorPaths?: readonly TErrorModule[] | null;\n errors?: readonly (TErrorModule | null | undefined)[] | null;\n errorTreePositions?: readonly number[] | null;\n layoutTreePositions?: readonly number[] | null;\n layouts: readonly (TModule | null | undefined)[];\n loading?: TModule | null;\n notFound?: TModule | null;\n notFounds?: readonly (TModule | null | undefined)[] | null;\n forbidden?: TModule | null;\n forbiddens?: readonly (TModule | null | undefined)[] | null;\n unauthorized?: TModule | null;\n unauthorizeds?: readonly (TModule | null | undefined)[] | null;\n routeSegments?: readonly string[];\n /**\n * Keyed by stable slot id (name + owner path), not necessarily the slot prop name.\n */\n slots?: Readonly<Record<string, AppPageRouteWiringSlot<TModule, TErrorModule>>> | null;\n templateTreePositions?: readonly number[] | null;\n templates?: readonly (TModule | null | undefined)[] | null;\n};\n\nexport type AppPageSlotOverride<TModule extends AppPageModule = AppPageModule> = {\n layoutModules?: readonly (TModule | null | undefined)[] | null;\n /**\n * The page module to render for this slot. Optional — when omitted, the\n * slot's existing `page` is used (e.g. when the override only changes the\n * slot's `params` for an inherited mirror with distinct param names).\n */\n pageModule?: TModule | null;\n params?: AppPageParams;\n props?: Readonly<Record<string, unknown>>;\n};\n\ntype AppPageLayoutEntry<\n TModule extends AppPageModule = AppPageModule,\n TErrorModule extends AppPageErrorModule = AppPageErrorModule,\n> = {\n errorModule?: TErrorModule | null | undefined;\n forbiddenModule?: TModule | null | undefined;\n id: string;\n layoutModule?: TModule | null | undefined;\n notFoundModule?: TModule | null | undefined;\n unauthorizedModule?: TModule | null | undefined;\n treePath: string;\n treePosition: number;\n};\n\ntype BuildAppPageRouteElementOptions<\n TModule extends AppPageModule = AppPageModule,\n TErrorModule extends AppPageErrorModule = AppPageErrorModule,\n> = {\n element: ReactNode;\n globalErrorModule?: TErrorModule | null;\n makeThenableParams: (params: AppPageParams) => unknown;\n matchedParams: AppPageParams;\n resolvedMetadata: Metadata | null;\n resolvedViewport: Viewport;\n rootForbiddenModule?: TModule | null;\n rootNotFoundModule?: TModule | null;\n rootUnauthorizedModule?: TModule | null;\n route: AppPageRouteWiringRoute<TModule, TErrorModule>;\n slotOverrides?: Readonly<Record<string, AppPageSlotOverride<TModule>>> | null;\n};\n\ntype BuildAppPageElementsOptions<\n TModule extends AppPageModule = AppPageModule,\n TErrorModule extends AppPageErrorModule = AppPageErrorModule,\n> = BuildAppPageRouteElementOptions<TModule, TErrorModule> & {\n interceptionContext?: string | null;\n isRscRequest?: boolean;\n mountedSlotIds?: ReadonlySet<string> | null;\n renderMode?: AppRscRenderMode;\n routePath: string;\n};\n\ntype AppPageTemplateEntry<TModule extends AppPageModule = AppPageModule> = {\n id: string;\n templateModule?: TModule | null | undefined;\n treePath: string;\n treePosition: number;\n};\n\ntype AppPageErrorEntry<TErrorModule extends AppPageErrorModule = AppPageErrorModule> = {\n errorModule?: TErrorModule | null | undefined;\n treePosition: number;\n};\n\nfunction getDefaultExport<TModule extends AppPageModule>(\n module: TModule | null | undefined,\n): AppPageComponent | null {\n return module?.default ?? null;\n}\n\nfunction getErrorBoundaryExport<TModule extends AppPageErrorModule>(\n module: TModule | null | undefined,\n): AppPageErrorComponent | null {\n return module?.default ?? null;\n}\n\nexport function createAppPageTreePath(\n routeSegments: readonly string[] | null | undefined,\n treePosition: number,\n): string {\n const treePathSegments = routeSegments?.slice(0, treePosition) ?? [];\n if (treePathSegments.length === 0) {\n return \"/\";\n }\n return `/${treePathSegments.join(\"/\")}`;\n}\n\nexport function createAppPageLayoutEntries<\n TModule extends AppPageModule,\n TErrorModule extends AppPageErrorModule,\n>(\n route: Pick<\n AppPageRouteWiringRoute<TModule, TErrorModule>,\n | \"errors\"\n | \"errorTreePositions\"\n | \"layoutTreePositions\"\n | \"layouts\"\n | \"notFounds\"\n | \"routeSegments\"\n > & {\n forbiddens?: readonly (TModule | null | undefined)[] | null;\n unauthorizeds?: readonly (TModule | null | undefined)[] | null;\n },\n): AppPageLayoutEntry<TModule, TErrorModule>[] {\n return route.layouts.map((layoutModule, index) => {\n const treePosition = route.layoutTreePositions?.[index] ?? 0;\n const treePath = createAppPageTreePath(route.routeSegments, treePosition);\n return {\n errorModule: route.errorTreePositions ? null : (route.errors?.[index] ?? null),\n forbiddenModule: route.forbiddens?.[index] ?? null,\n id: AppElementsWire.encodeLayoutId(treePath),\n layoutModule,\n notFoundModule: route.notFounds?.[index] ?? null,\n unauthorizedModule: route.unauthorizeds?.[index] ?? null,\n treePath,\n treePosition,\n };\n });\n}\n\nfunction createAppPageTemplateEntries<TModule extends AppPageModule>(\n route: Pick<\n AppPageRouteWiringRoute<TModule>,\n \"routeSegments\" | \"templateTreePositions\" | \"templates\"\n >,\n): AppPageTemplateEntry<TModule>[] {\n return (route.templates ?? []).map((templateModule, index) => {\n const treePosition = route.templateTreePositions?.[index] ?? 0;\n const treePath = createAppPageTreePath(route.routeSegments, treePosition);\n return {\n id: AppElementsWire.encodeTemplateId(treePath),\n templateModule,\n treePath,\n treePosition,\n };\n });\n}\n\nfunction createAppPageErrorEntries<TErrorModule extends AppPageErrorModule>(\n route: Pick<\n AppPageRouteWiringRoute<AppPageModule, TErrorModule>,\n \"errorPaths\" | \"errors\" | \"errorTreePositions\"\n >,\n): AppPageErrorEntry<TErrorModule>[] {\n return (route.errorPaths ?? route.errors ?? []).flatMap((errorModule, index) => {\n if (!errorModule) return [];\n const treePosition = route.errorTreePositions?.[index];\n if (treePosition === undefined) return [];\n return [{ errorModule, treePosition }];\n });\n}\n\nfunction createAppPageParallelSlotEntries<\n TModule extends AppPageModule,\n TErrorModule extends AppPageErrorModule,\n>(\n layoutIndex: number,\n layoutEntries: readonly AppPageLayoutEntry<TModule, TErrorModule>[],\n route: AppPageRouteWiringRoute<TModule, TErrorModule>,\n getEffectiveSlotParams: (slotKey: string, slotName: string) => AppPageParams,\n): Readonly<Record<string, ReactNode>> | undefined {\n const parallelSlots: Record<string, ReactNode> = {};\n\n for (const [slotKey, slot] of Object.entries(route.slots ?? {})) {\n const slotName = slot.name;\n const targetIndex = slot.layoutIndex >= 0 ? slot.layoutIndex : layoutEntries.length - 1;\n if (targetIndex !== layoutIndex) {\n continue;\n }\n\n const layoutEntry = layoutEntries[targetIndex];\n const treePath = layoutEntry?.treePath ?? \"/\";\n const slotParams = getEffectiveSlotParams(slotKey, slotName);\n const slotSegments = slot.routeSegments\n ? resolveAppPageChildSegments(slot.routeSegments, 0, slotParams)\n : [];\n parallelSlots[slotName] = (\n <LayoutSegmentProvider segmentMap={{ children: slotSegments }}>\n <Slot id={AppElementsWire.encodeSlotId(slotName, treePath)} />\n </LayoutSegmentProvider>\n );\n }\n\n return Object.keys(parallelSlots).length > 0 ? parallelSlots : undefined;\n}\n\nfunction createAppPageRouteHead(metadata: Metadata | null, viewport: Viewport): ReactNode {\n return (\n <>\n <meta charSet=\"utf-8\" />\n {metadata ? <MetadataHead metadata={metadata} /> : null}\n <ViewportHead viewport={viewport} />\n </>\n );\n}\n\nexport function buildAppPageElements<\n TModule extends AppPageModule,\n TErrorModule extends AppPageErrorModule,\n>(options: BuildAppPageElementsOptions<TModule, TErrorModule>): AppElements {\n const interceptionContext = options.interceptionContext ?? null;\n const routeSegments = options.route.routeSegments ?? [];\n const routeResetKey = resolveAppPageRouteStateKey(routeSegments, options.matchedParams);\n const routeId = AppElementsWire.encodeRouteId(options.routePath, interceptionContext);\n const pageId = AppElementsWire.encodePageId(options.routePath, interceptionContext);\n const layoutEntries = createAppPageLayoutEntries(options.route);\n const templateEntries = createAppPageTemplateEntries(options.route);\n const errorEntries = createAppPageErrorEntries(options.route);\n const layoutEntriesByTreePosition = new Map<number, AppPageLayoutEntry<TModule, TErrorModule>>();\n const templateEntriesByTreePosition = new Map<number, AppPageTemplateEntry<TModule>>();\n const errorEntriesByTreePosition = new Map<number, AppPageErrorEntry<TErrorModule>>();\n for (const layoutEntry of layoutEntries) {\n layoutEntriesByTreePosition.set(layoutEntry.treePosition, layoutEntry);\n }\n for (const templateEntry of templateEntries) {\n templateEntriesByTreePosition.set(templateEntry.treePosition, templateEntry);\n }\n for (const errorEntry of errorEntries) {\n errorEntriesByTreePosition.set(errorEntry.treePosition, errorEntry);\n }\n const layoutIndicesByTreePosition = new Map<number, number>();\n for (let index = 0; index < layoutEntries.length; index++) {\n layoutIndicesByTreePosition.set(layoutEntries[index].treePosition, index);\n }\n const layoutDependenciesByIndex = new Map<number, AppRenderDependency>();\n const layoutDependenciesBefore: AppRenderDependency[][] = [];\n const slotDependenciesByLayoutIndex: AppRenderDependency[][] = [];\n const templateDependenciesById = new Map<string, AppRenderDependency>();\n const templateDependenciesBeforeById = new Map<string, AppRenderDependency[]>();\n const pageDependencies: AppRenderDependency[] = [];\n const rootLayoutTreePath = layoutEntries[0]?.treePath ?? null;\n const elements: Record<string, ReactNode | string | null> = {\n ...AppElementsWire.createMetadataEntries({\n interceptionContext,\n layoutIds: options.route.ids?.layouts ?? layoutEntries.map((entry) => entry.id),\n rootLayoutTreePath,\n routeId,\n }),\n };\n const slotNameCounts = new Map<string, number>();\n for (const slot of Object.values(options.route.slots ?? {})) {\n const slotName = slot.name;\n slotNameCounts.set(slotName, (slotNameCounts.get(slotName) ?? 0) + 1);\n }\n const orderedTreePositions = Array.from(\n new Set<number>([\n ...layoutEntries.map((entry) => entry.treePosition),\n ...templateEntries.map((entry) => entry.treePosition),\n ...errorEntries.map((entry) => entry.treePosition),\n ]),\n ).sort((left, right) => left - right);\n const resolveSlotOverride = (slotKey: string, slotName: string) => {\n const overrideByKey = options.slotOverrides?.[slotKey];\n if (overrideByKey) {\n return overrideByKey;\n }\n\n // Legacy callers may still provide overrides by slot prop name.\n // Only allow that fallback when it is unambiguous.\n if (slotKey === slotName || (slotNameCounts.get(slotName) ?? 0) === 1) {\n return options.slotOverrides?.[slotName];\n }\n\n return undefined;\n };\n const getEffectiveSlotParams = (slotKey: string, slotName: string): AppPageParams =>\n resolveSlotOverride(slotKey, slotName)?.params ?? options.matchedParams;\n\n for (const treePosition of orderedTreePositions) {\n const layoutIndex = layoutIndicesByTreePosition.get(treePosition);\n if (layoutIndex !== undefined) {\n const layoutEntry = layoutEntries[layoutIndex];\n layoutDependenciesBefore[layoutIndex] = [...pageDependencies];\n if (getDefaultExport(layoutEntry.layoutModule)) {\n const layoutDependency = createAppRenderDependency();\n layoutDependenciesByIndex.set(layoutIndex, layoutDependency);\n pageDependencies.push(layoutDependency);\n }\n slotDependenciesByLayoutIndex[layoutIndex] = [...pageDependencies];\n }\n\n const templateEntry = templateEntriesByTreePosition.get(treePosition);\n if (!templateEntry || !getDefaultExport(templateEntry.templateModule)) {\n continue;\n }\n\n const templateDependency = createAppRenderDependency();\n templateDependenciesById.set(templateEntry.id, templateDependency);\n templateDependenciesBeforeById.set(templateEntry.id, [...pageDependencies]);\n pageDependencies.push(templateDependency);\n }\n\n elements[pageId] = renderAfterAppDependencies(options.element, pageDependencies);\n\n for (const templateEntry of templateEntries) {\n const templateComponent = getDefaultExport(templateEntry.templateModule);\n if (!templateComponent) {\n continue;\n }\n const TemplateComponent = templateComponent;\n const templateDependency = templateDependenciesById.get(templateEntry.id);\n const templateElement = templateDependency ? (\n renderWithAppDependencyBarrier(\n <TemplateComponent params={options.matchedParams}>\n <Children />\n </TemplateComponent>,\n templateDependency,\n )\n ) : (\n <TemplateComponent params={options.matchedParams}>\n <Children />\n </TemplateComponent>\n );\n elements[templateEntry.id] = renderAfterAppDependencies(\n templateElement,\n templateDependenciesBeforeById.get(templateEntry.id) ?? [],\n );\n }\n\n for (let index = 0; index < layoutEntries.length; index++) {\n const layoutEntry = layoutEntries[index];\n const layoutComponent = getDefaultExport(layoutEntry.layoutModule);\n if (!layoutComponent) {\n continue;\n }\n\n const layoutProps: Record<string, unknown> = {\n params: options.makeThenableParams(\n resolveAppPageSegmentParams(\n options.route.routeSegments,\n layoutEntry.treePosition,\n options.matchedParams,\n ),\n ),\n };\n\n for (const slot of Object.values(options.route.slots ?? {})) {\n const slotName = slot.name;\n const targetIndex = slot.layoutIndex >= 0 ? slot.layoutIndex : layoutEntries.length - 1;\n if (targetIndex !== index) {\n continue;\n }\n layoutProps[slotName] = <ParallelSlot name={slotName} />;\n }\n\n const LayoutComponent = layoutComponent;\n const layoutDependency = layoutDependenciesByIndex.get(index);\n const layoutElement = layoutDependency ? (\n renderWithAppDependencyBarrier(\n <LayoutComponent {...layoutProps}>\n <Children />\n </LayoutComponent>,\n layoutDependency,\n )\n ) : (\n <LayoutComponent {...layoutProps}>\n <Children />\n </LayoutComponent>\n );\n elements[layoutEntry.id] = renderAfterAppDependencies(\n layoutElement,\n layoutDependenciesBefore[index] ?? [],\n );\n }\n\n for (const [slotKey, slot] of Object.entries(options.route.slots ?? {})) {\n const slotName = slot.name;\n const targetIndex = slot.layoutIndex >= 0 ? slot.layoutIndex : layoutEntries.length - 1;\n const treePath = layoutEntries[targetIndex]?.treePath ?? \"/\";\n const slotId = AppElementsWire.encodeSlotId(slotName, treePath);\n const slotOverride = resolveSlotOverride(slotKey, slotName);\n const slotParams = getEffectiveSlotParams(slotKey, slotName);\n const slotRouteSegments = slot.routeSegments ?? [];\n const slotResetKey = resolveAppPageRouteStateKey(slotRouteSegments, slotParams);\n const overrideOrPageComponent =\n getDefaultExport(slotOverride?.pageModule) ?? getDefaultExport(slot.page);\n const defaultComponent = getDefaultExport(slot.default);\n\n // On soft nav (RSC): omit key when only default.tsx exists and the slot is\n // already mounted on the client. Absent key means the browser retains prior\n // slot content rather than replacing it. When the slot is not yet mounted\n // (first entry into this layout), include the key so default.tsx renders.\n if (\n !overrideOrPageComponent &&\n defaultComponent &&\n options.isRscRequest &&\n options.mountedSlotIds?.has(slotId)\n ) {\n continue;\n }\n\n const slotComponent = overrideOrPageComponent ?? defaultComponent;\n\n if (!slotComponent) {\n elements[slotId] = AppElementsWire.unmatchedSlotValue;\n continue;\n }\n\n const slotThenableParams = options.makeThenableParams(slotParams);\n const slotProps: Record<string, unknown> = {\n params: slotThenableParams,\n };\n if (slotOverride?.props) {\n Object.assign(slotProps, slotOverride.props);\n }\n\n const SlotComponent = slotComponent;\n let slotElement: ReactNode = <SlotComponent {...slotProps} />;\n const interceptLayouts = slotOverride?.layoutModules ?? [];\n\n for (let layoutIndex = interceptLayouts.length - 1; layoutIndex >= 0; layoutIndex--) {\n const interceptLayoutComponent = getDefaultExport(interceptLayouts[layoutIndex]);\n if (!interceptLayoutComponent) {\n continue;\n }\n const InterceptLayoutComponent = interceptLayoutComponent;\n slotElement = (\n <InterceptLayoutComponent params={slotThenableParams}>\n {slotElement}\n </InterceptLayoutComponent>\n );\n }\n\n const slotLayoutComponent = getDefaultExport(slot.layout);\n if (slotLayoutComponent) {\n const SlotLayoutComponent = slotLayoutComponent;\n slotElement = (\n <SlotLayoutComponent params={slotThenableParams}>{slotElement}</SlotLayoutComponent>\n );\n }\n\n const slotLoadingComponent = getDefaultExport(slot.loading);\n if (\n slotLoadingComponent &&\n !shouldSuppressLoadingBoundaries(options.renderMode ?? APP_RSC_RENDER_MODE_NAVIGATION)\n ) {\n const SlotLoadingComponent = slotLoadingComponent;\n slotElement = (\n <Suspense key={slotResetKey} fallback={<SlotLoadingComponent />}>\n {slotElement}\n </Suspense>\n );\n }\n\n const slotErrorComponent = getErrorBoundaryExport(slot.error);\n if (slotErrorComponent) {\n slotElement = (\n <ErrorBoundary resetKey={slotResetKey} fallback={slotErrorComponent}>\n {slotElement}\n </ErrorBoundary>\n );\n }\n\n elements[slotId] = renderAfterAppDependencies(\n slotElement,\n targetIndex >= 0 ? (slotDependenciesByLayoutIndex[targetIndex] ?? []) : [],\n );\n }\n\n let routeChildren: ReactNode = (\n <LayoutSegmentProvider segmentMap={{ children: [] }}>\n <Slot id={pageId} />\n </LayoutSegmentProvider>\n );\n\n // Wrap the page slot in a per-segment RedirectBoundary so that a\n // redirect() thrown from a server component (or a client component\n // within the page subtree) is caught here — below the route's layouts —\n // rather than at the top-level boundary in app-browser-entry. Catching\n // at the top level unmounts the entire route tree including layouts,\n // which destroys client-side state in layout-hosted components\n // (counters, theme toggles, form drafts). Here, only the page subtree\n // is unmounted; the surrounding layouts stay mounted across the\n // boundary's null-render → router.replace transition, and segment\n // reuse keeps their React state intact.\n //\n // Placed inside the Suspense (loading) boundary to match Next.js nesting\n // for the redirect boundary specifically:\n // Error > AccessFallback > Loading (Suspense) > Redirect > content\n // (Note: Next.js places AccessFallback inside Loading, not outside — that\n // is a pre-existing nesting divergence tracked separately.)\n // This keeps the loading fallback visible during redirect-driven\n // transitions rather than unmounting it.\n routeChildren = <RedirectBoundary>{routeChildren}</RedirectBoundary>;\n\n const routeLoadingComponent = getDefaultExport(options.route.loading);\n if (\n routeLoadingComponent &&\n !shouldSuppressLoadingBoundaries(options.renderMode ?? APP_RSC_RENDER_MODE_NAVIGATION)\n ) {\n const RouteLoadingComponent = routeLoadingComponent;\n // Route-level wrappers cover the full page branch in vinext's flat element\n // transport, so their reset key includes the visible segment-state path.\n // Dynamic param changes reset the pending boundary, while search-only changes\n // preserve it.\n routeChildren = (\n <Suspense key={routeResetKey} fallback={<RouteLoadingComponent />}>\n {routeChildren}\n </Suspense>\n );\n }\n\n const lastLayoutErrorModule =\n errorEntries.length > 0 ? errorEntries[errorEntries.length - 1].errorModule : null;\n // Next.js nesting (outer to inner): Error > Unauthorized > Forbidden > NotFound > children.\n // Building bottom-up means NotFoundBoundary must wrap first, then Forbidden, Unauthorized, Error.\n const notFoundComponent =\n getDefaultExport(options.route.notFound) ?? getDefaultExport(options.rootNotFoundModule);\n if (notFoundComponent) {\n const NotFoundComponent = notFoundComponent;\n routeChildren = (\n <NotFoundBoundary resetKey={routeResetKey} fallback={<NotFoundComponent />}>\n {routeChildren}\n </NotFoundBoundary>\n );\n }\n\n const forbiddenComponent =\n getDefaultExport(options.route.forbidden) ?? getDefaultExport(options.rootForbiddenModule);\n if (forbiddenComponent) {\n const ForbiddenComponent = forbiddenComponent;\n routeChildren = (\n <ForbiddenBoundary resetKey={routeResetKey} fallback={<ForbiddenComponent />}>\n {routeChildren}\n </ForbiddenBoundary>\n );\n }\n\n const unauthorizedComponent =\n getDefaultExport(options.route.unauthorized) ??\n getDefaultExport(options.rootUnauthorizedModule);\n if (unauthorizedComponent) {\n const UnauthorizedComponent = unauthorizedComponent;\n routeChildren = (\n <UnauthorizedBoundary resetKey={routeResetKey} fallback={<UnauthorizedComponent />}>\n {routeChildren}\n </UnauthorizedBoundary>\n );\n }\n\n const pageErrorComponent = getErrorBoundaryExport(options.route.error);\n if (pageErrorComponent && options.route.error !== lastLayoutErrorModule) {\n routeChildren = (\n <ErrorBoundary resetKey={routeResetKey} fallback={pageErrorComponent}>\n {routeChildren}\n </ErrorBoundary>\n );\n }\n\n for (let index = orderedTreePositions.length - 1; index >= 0; index--) {\n const treePosition = orderedTreePositions[index];\n const segmentResetKey = resolveAppPageSegmentStateKey(\n routeSegments,\n treePosition,\n options.matchedParams,\n );\n let segmentChildren: ReactNode = routeChildren;\n const layoutEntry = layoutEntriesByTreePosition.get(treePosition);\n const templateEntry = templateEntriesByTreePosition.get(treePosition);\n const errorEntry = errorEntriesByTreePosition.get(treePosition);\n\n // Next.js nesting per segment (outer to inner): Layout > Template > Error > Unauthorized > Forbidden > NotFound > children.\n // Building bottom-up means NotFoundBoundary must wrap the leaf subtree first,\n // then ErrorBoundary, then Template, with the Layout slot outermost.\n if (layoutEntry) {\n const layoutNotFoundComponent = getDefaultExport(layoutEntry.notFoundModule);\n if (layoutNotFoundComponent) {\n const LayoutNotFoundComponent = layoutNotFoundComponent;\n segmentChildren = (\n <NotFoundBoundary resetKey={segmentResetKey} fallback={<LayoutNotFoundComponent />}>\n {segmentChildren}\n </NotFoundBoundary>\n );\n }\n\n const layoutForbiddenComponent = getDefaultExport(layoutEntry.forbiddenModule);\n if (layoutForbiddenComponent) {\n const LayoutForbiddenComponent = layoutForbiddenComponent;\n segmentChildren = (\n <ForbiddenBoundary resetKey={segmentResetKey} fallback={<LayoutForbiddenComponent />}>\n {segmentChildren}\n </ForbiddenBoundary>\n );\n }\n\n const layoutUnauthorizedComponent = getDefaultExport(layoutEntry.unauthorizedModule);\n if (layoutUnauthorizedComponent) {\n const LayoutUnauthorizedComponent = layoutUnauthorizedComponent;\n segmentChildren = (\n <UnauthorizedBoundary\n resetKey={segmentResetKey}\n fallback={<LayoutUnauthorizedComponent />}\n >\n {segmentChildren}\n </UnauthorizedBoundary>\n );\n }\n }\n\n const segmentErrorComponent = getErrorBoundaryExport(\n errorEntry?.errorModule ?? layoutEntry?.errorModule,\n );\n if (segmentErrorComponent) {\n segmentChildren = (\n <ErrorBoundary resetKey={segmentResetKey} fallback={segmentErrorComponent}>\n {segmentChildren}\n </ErrorBoundary>\n );\n }\n\n if (templateEntry && getDefaultExport(templateEntry.templateModule)) {\n segmentChildren = (\n <Slot id={templateEntry.id} key={segmentResetKey}>\n {segmentChildren}\n </Slot>\n );\n }\n\n if (!layoutEntry) {\n routeChildren = segmentChildren;\n continue;\n }\n const layoutHasElement = getDefaultExport(layoutEntry.layoutModule) !== null;\n const layoutIndex = layoutIndicesByTreePosition.get(treePosition) ?? -1;\n const segmentMap: { children: string[] } & Record<string, string[]> = {\n children: resolveAppPageChildSegments(\n routeSegments,\n layoutEntry.treePosition,\n options.matchedParams,\n ),\n };\n for (const [slotKey, slot] of Object.entries(options.route.slots ?? {})) {\n const slotName = slot.name;\n const targetIndex = slot.layoutIndex >= 0 ? slot.layoutIndex : layoutEntries.length - 1;\n if (targetIndex !== layoutIndex) {\n continue;\n }\n const slotParams = getEffectiveSlotParams(slotKey, slotName);\n segmentMap[slotName] = slot.routeSegments\n ? resolveAppPageChildSegments(slot.routeSegments, 0, slotParams)\n : [];\n }\n\n routeChildren = (\n <LayoutSegmentProvider segmentMap={segmentMap}>\n {layoutHasElement ? (\n <Slot\n id={layoutEntry.id}\n parallelSlots={createAppPageParallelSlotEntries(\n layoutIndex,\n layoutEntries,\n options.route,\n getEffectiveSlotParams,\n )}\n >\n {segmentChildren}\n </Slot>\n ) : (\n segmentChildren\n )}\n </LayoutSegmentProvider>\n );\n }\n\n const globalErrorComponent = getErrorBoundaryExport(options.globalErrorModule);\n if (globalErrorComponent) {\n routeChildren = <ErrorBoundary fallback={globalErrorComponent}>{routeChildren}</ErrorBoundary>;\n }\n\n elements[routeId] = (\n <>\n {createAppPageRouteHead(options.resolvedMetadata, options.resolvedViewport)}\n {routeChildren}\n </>\n );\n\n return elements;\n}\n"],"mappings":";;;;;;;;;;;;;AA2KA,SAAS,iBACP,QACyB;CACzB,OAAO,QAAQ,WAAW;;AAG5B,SAAS,uBACP,QAC8B;CAC9B,OAAO,QAAQ,WAAW;;AAG5B,SAAgB,sBACd,eACA,cACQ;CACR,MAAM,mBAAmB,eAAe,MAAM,GAAG,aAAa,IAAI,EAAE;CACpE,IAAI,iBAAiB,WAAW,GAC9B,OAAO;CAET,OAAO,IAAI,iBAAiB,KAAK,I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;IACE,IAAI,YAAY;IAChB,eAAe,iCACb,aACA,eACA,QAAQ,OACR,uBACD;cAEA;IACI,CAAA,GAEP;GAEoB,CAAA;;CAI5B,MAAM,uBAAuB,uBAAuB,QAAQ,kBAAkB;CAC9E,IAAI,sBACF,gBAAgB,oBAAC,eAAD;EAAe,UAAU;YAAuB;EAA8B,CAAA;CAGhG,SAAS,WACP,qBAAA,YAAA,EAAA,UAAA,CACG,uBAAuB,QAAQ,kBAAkB,QAAQ,iBAAiB,EAC1E,cACA,EAAA,CAAA;CAGL,OAAO"}
|
|
1
|
+
{"version":3,"file":"app-page-route-wiring.js","names":["Children","SlotComponent","InterceptLayoutComponent","SlotLayoutComponent","SlotLoadingComponent","RouteLoadingComponent","NotFoundComponent","ForbiddenComponent","UnauthorizedComponent","LayoutNotFoundComponent","LayoutForbiddenComponent","LayoutUnauthorizedComponent"],"sources":["../../src/server/app-page-route-wiring.tsx"],"sourcesContent":["import { Suspense, type ComponentType, type ReactNode } from \"react\";\nimport {\n AppElementsWire,\n APP_PREFETCH_LOADING_SHELL_MARKER_KEY,\n normalizeAppElementsSlotBindings,\n type AppElements,\n type AppElementsInterception,\n type AppElementsSlotBinding,\n} from \"./app-elements.js\";\nimport {\n ErrorBoundary,\n ForbiddenBoundary,\n NotFoundBoundary,\n RedirectBoundary,\n UnauthorizedBoundary,\n} from \"vinext/shims/error-boundary\";\nimport type { AppRouteSemanticIds } from \"../routing/app-route-graph.js\";\nimport { LayoutSegmentProvider } from \"vinext/shims/layout-segment-context\";\nimport { MetadataHead, ViewportHead, type Metadata, type Viewport } from \"vinext/shims/metadata\";\nimport { Children, ParallelSlot, Slot } from \"vinext/shims/slot\";\nimport type { AppPageParams } from \"./app-page-boundary.js\";\nimport {\n createAppRenderDependency,\n renderAfterAppDependencies,\n renderWithAppDependencyBarrier,\n type AppRenderDependency,\n} from \"./app-render-dependency.js\";\nimport { resolveAppPageSegmentParams } from \"./app-page-params.js\";\nimport {\n APP_RSC_RENDER_MODE_NAVIGATION,\n APP_RSC_RENDER_MODE_PREFETCH_LOADING_SHELL,\n shouldSuppressLoadingBoundaries,\n type AppRscRenderMode,\n} from \"./app-rsc-render-mode.js\";\nimport {\n resolveAppPageChildSegments,\n resolveAppPageRouteStateKey,\n resolveAppPageSegmentStateKey,\n} from \"./app-page-segment-state.js\";\n\nexport { resolveAppPageChildSegments } from \"./app-page-segment-state.js\";\n\ntype AppPageComponentProps = {\n children?: ReactNode;\n error?: unknown;\n params?: unknown;\n reset?: () => void;\n} & Record<string, unknown>;\n\ntype AppPageComponent = ComponentType<AppPageComponentProps>;\ntype AppPageErrorComponent = ComponentType<{ error: unknown; reset: () => void }>;\n\nexport type AppPageModule = Record<string, unknown> & {\n default?: AppPageComponent | null | undefined;\n};\n\nexport type AppPageErrorModule = Record<string, unknown> & {\n default?: AppPageErrorComponent | null | undefined;\n};\n\ntype AppPageRouteWiringSlot<\n TModule extends AppPageModule = AppPageModule,\n TErrorModule extends AppPageErrorModule = AppPageErrorModule,\n> = {\n /** Graph-owned semantic slot identity. */\n id?: string | null;\n /** Slot prop name passed to the owning layout (e.g. \"modal\" from @modal). */\n name: string;\n default?: TModule | null;\n error?: TErrorModule | null;\n layout?: TModule | null;\n layoutIndex: number;\n loading?: TModule | null;\n page?: TModule | null;\n routeSegments?: readonly string[] | null;\n /**\n * Full URL pattern parts for the slot's mirrored sub-page. Set when the\n * slot's params may differ from the route's (e.g. inherited slot whose\n * dynamic markers have different names than the route's). The runtime\n * matches the request URL against these parts to extract slot params.\n */\n slotPatternParts?: readonly string[] | null;\n /** Param names captured by `slotPatternParts`, in order. */\n slotParamNames?: readonly string[] | null;\n};\n\nexport type AppPageRouteWiringRoute<\n TModule extends AppPageModule = AppPageModule,\n TErrorModule extends AppPageErrorModule = AppPageErrorModule,\n> = {\n ids?: AppRouteSemanticIds | null;\n error?: TErrorModule | null;\n errorPaths?: readonly TErrorModule[] | null;\n errors?: readonly (TErrorModule | null | undefined)[] | null;\n errorTreePositions?: readonly number[] | null;\n layoutTreePositions?: readonly number[] | null;\n layouts: readonly (TModule | null | undefined)[];\n loading?: TModule | null;\n notFound?: TModule | null;\n notFounds?: readonly (TModule | null | undefined)[] | null;\n forbidden?: TModule | null;\n forbiddens?: readonly (TModule | null | undefined)[] | null;\n unauthorized?: TModule | null;\n unauthorizeds?: readonly (TModule | null | undefined)[] | null;\n routeSegments?: readonly string[];\n /**\n * Keyed by stable slot id (name + owner path), not necessarily the slot prop name.\n */\n slots?: Readonly<Record<string, AppPageRouteWiringSlot<TModule, TErrorModule>>> | null;\n templateTreePositions?: readonly number[] | null;\n templates?: readonly (TModule | null | undefined)[] | null;\n};\n\nexport type AppPageSlotOverride<TModule extends AppPageModule = AppPageModule> = {\n layoutModules?: readonly (TModule | null | undefined)[] | null;\n /**\n * The page module to render for this slot. Optional — when omitted, the\n * slot's existing `page` is used (e.g. when the override only changes the\n * slot's `params` for an inherited mirror with distinct param names).\n */\n pageModule?: TModule | null;\n params?: AppPageParams;\n props?: Readonly<Record<string, unknown>>;\n};\n\ntype AppPageLayoutEntry<\n TModule extends AppPageModule = AppPageModule,\n TErrorModule extends AppPageErrorModule = AppPageErrorModule,\n> = {\n errorModule?: TErrorModule | null | undefined;\n forbiddenModule?: TModule | null | undefined;\n id: string;\n layoutModule?: TModule | null | undefined;\n notFoundModule?: TModule | null | undefined;\n unauthorizedModule?: TModule | null | undefined;\n treePath: string;\n treePosition: number;\n};\n\ntype BuildAppPageRouteElementOptions<\n TModule extends AppPageModule = AppPageModule,\n TErrorModule extends AppPageErrorModule = AppPageErrorModule,\n> = {\n element: ReactNode;\n globalErrorModule?: TErrorModule | null;\n makeThenableParams: (params: AppPageParams) => unknown;\n matchedParams: AppPageParams;\n resolvedMetadata: Metadata | null;\n resolvedMetadataPathname?: string;\n resolvedViewport: Viewport;\n rootForbiddenModule?: TModule | null;\n rootNotFoundModule?: TModule | null;\n rootUnauthorizedModule?: TModule | null;\n route: AppPageRouteWiringRoute<TModule, TErrorModule>;\n slotOverrides?: Readonly<Record<string, AppPageSlotOverride<TModule>>> | null;\n};\n\ntype BuildAppPageElementsOptions<\n TModule extends AppPageModule = AppPageModule,\n TErrorModule extends AppPageErrorModule = AppPageErrorModule,\n> = BuildAppPageRouteElementOptions<TModule, TErrorModule> & {\n interception?: AppElementsInterception | null;\n interceptionContext?: string | null;\n isRscRequest?: boolean;\n mountedSlotIds?: ReadonlySet<string> | null;\n renderMode?: AppRscRenderMode;\n routePath: string;\n};\n\ntype AppPageTemplateEntry<TModule extends AppPageModule = AppPageModule> = {\n id: string;\n templateModule?: TModule | null | undefined;\n treePath: string;\n treePosition: number;\n};\n\ntype AppPageErrorEntry<TErrorModule extends AppPageErrorModule = AppPageErrorModule> = {\n errorModule?: TErrorModule | null | undefined;\n treePosition: number;\n};\n\nfunction getDefaultExport<TModule extends AppPageModule>(\n module: TModule | null | undefined,\n): AppPageComponent | null {\n return module?.default ?? null;\n}\n\nfunction getErrorBoundaryExport<TModule extends AppPageErrorModule>(\n module: TModule | null | undefined,\n): AppPageErrorComponent | null {\n return module?.default ?? null;\n}\n\nexport function createAppPageTreePath(\n routeSegments: readonly string[] | null | undefined,\n treePosition: number,\n): string {\n const treePathSegments = routeSegments?.slice(0, treePosition) ?? [];\n if (treePathSegments.length === 0) {\n return \"/\";\n }\n return `/${treePathSegments.join(\"/\")}`;\n}\n\nexport function createAppPageLayoutEntries<\n TModule extends AppPageModule,\n TErrorModule extends AppPageErrorModule,\n>(\n route: Pick<\n AppPageRouteWiringRoute<TModule, TErrorModule>,\n | \"errors\"\n | \"errorTreePositions\"\n | \"layoutTreePositions\"\n | \"layouts\"\n | \"notFounds\"\n | \"routeSegments\"\n > & {\n forbiddens?: readonly (TModule | null | undefined)[] | null;\n unauthorizeds?: readonly (TModule | null | undefined)[] | null;\n },\n): AppPageLayoutEntry<TModule, TErrorModule>[] {\n return route.layouts.map((layoutModule, index) => {\n const treePosition = route.layoutTreePositions?.[index] ?? 0;\n const treePath = createAppPageTreePath(route.routeSegments, treePosition);\n return {\n errorModule: route.errorTreePositions ? null : (route.errors?.[index] ?? null),\n forbiddenModule: route.forbiddens?.[index] ?? null,\n id: AppElementsWire.encodeLayoutId(treePath),\n layoutModule,\n notFoundModule: route.notFounds?.[index] ?? null,\n unauthorizedModule: route.unauthorizeds?.[index] ?? null,\n treePath,\n treePosition,\n };\n });\n}\n\nfunction createAppPageTemplateEntries<TModule extends AppPageModule>(\n route: Pick<\n AppPageRouteWiringRoute<TModule>,\n \"routeSegments\" | \"templateTreePositions\" | \"templates\"\n >,\n): AppPageTemplateEntry<TModule>[] {\n return (route.templates ?? []).map((templateModule, index) => {\n const treePosition = route.templateTreePositions?.[index] ?? 0;\n const treePath = createAppPageTreePath(route.routeSegments, treePosition);\n return {\n id: AppElementsWire.encodeTemplateId(treePath),\n templateModule,\n treePath,\n treePosition,\n };\n });\n}\n\nfunction createAppPageErrorEntries<TErrorModule extends AppPageErrorModule>(\n route: Pick<\n AppPageRouteWiringRoute<AppPageModule, TErrorModule>,\n \"errorPaths\" | \"errors\" | \"errorTreePositions\"\n >,\n): AppPageErrorEntry<TErrorModule>[] {\n return (route.errorPaths ?? route.errors ?? []).flatMap((errorModule, index) => {\n if (!errorModule) return [];\n const treePosition = route.errorTreePositions?.[index];\n if (treePosition === undefined) return [];\n return [{ errorModule, treePosition }];\n });\n}\n\nfunction createAppPageParallelSlotEntries<\n TModule extends AppPageModule,\n TErrorModule extends AppPageErrorModule,\n>(\n layoutIndex: number,\n layoutEntries: readonly AppPageLayoutEntry<TModule, TErrorModule>[],\n route: AppPageRouteWiringRoute<TModule, TErrorModule>,\n getEffectiveSlotParams: (slotKey: string, slotName: string) => AppPageParams,\n): Readonly<Record<string, ReactNode>> | undefined {\n const parallelSlots: Record<string, ReactNode> = {};\n\n for (const [slotKey, slot] of Object.entries(route.slots ?? {})) {\n const slotName = slot.name;\n const targetIndex = slot.layoutIndex >= 0 ? slot.layoutIndex : layoutEntries.length - 1;\n if (targetIndex !== layoutIndex) {\n continue;\n }\n\n const layoutEntry = layoutEntries[targetIndex];\n const treePath = layoutEntry?.treePath ?? \"/\";\n const slotId = resolveAppPageSlotId(slot, treePath);\n const slotParams = getEffectiveSlotParams(slotKey, slotName);\n const slotSegments = slot.routeSegments\n ? resolveAppPageChildSegments(slot.routeSegments, 0, slotParams)\n : [];\n parallelSlots[slotName] = (\n <LayoutSegmentProvider segmentMap={{ children: slotSegments }}>\n <Slot id={slotId} />\n </LayoutSegmentProvider>\n );\n }\n\n return Object.keys(parallelSlots).length > 0 ? parallelSlots : undefined;\n}\n\nfunction resolveAppPageSlotId(slot: AppPageRouteWiringSlot, treePath: string): string {\n const slotId = AppElementsWire.encodeSlotId(slot.name, treePath);\n if (slot.id && slot.id !== slotId) {\n throw new Error(\n `[vinext] App Router slot id mismatch for @${slot.name}: graph id ${slot.id} does not match wire id ${slotId}`,\n );\n }\n return slotId;\n}\n\nfunction resolveAppPageSlotBindingState(\n slot: AppPageRouteWiringSlot,\n override: AppPageSlotOverride | undefined,\n): AppElementsSlotBinding[\"state\"] {\n const pageComponent = getDefaultExport(override?.pageModule) ?? getDefaultExport(slot.page);\n if (pageComponent) return \"active\";\n if (getDefaultExport(slot.default)) return \"default\";\n return \"unmatched\";\n}\n\nfunction createAppPageSlotBindings<\n TModule extends AppPageModule,\n TErrorModule extends AppPageErrorModule,\n>(\n route: AppPageRouteWiringRoute<TModule, TErrorModule>,\n layoutEntries: readonly AppPageLayoutEntry<TModule, TErrorModule>[],\n resolveSlotOverride: (\n slotKey: string,\n slotName: string,\n ) => AppPageSlotOverride<TModule> | undefined,\n): readonly AppElementsSlotBinding[] {\n const bindings: AppElementsSlotBinding[] = [];\n for (const [slotKey, slot] of Object.entries(route.slots ?? {})) {\n const targetIndex = slot.layoutIndex >= 0 ? slot.layoutIndex : layoutEntries.length - 1;\n const layoutEntry = layoutEntries[targetIndex] ?? null;\n const ownerLayoutId = layoutEntry?.id ?? null;\n const override = resolveSlotOverride(slotKey, slot.name);\n bindings.push({\n ownerLayoutId,\n slotId: resolveAppPageSlotId(slot, layoutEntry?.treePath ?? \"/\"),\n state: resolveAppPageSlotBindingState(slot, override),\n });\n }\n return normalizeAppElementsSlotBindings(bindings, {\n layoutIds: layoutEntries.map((entry) => entry.id),\n });\n}\n\nfunction createAppPageRouteHead(\n metadata: Metadata | null,\n viewport: Viewport,\n pathname: string,\n): ReactNode {\n return (\n <>\n <meta charSet=\"utf-8\" />\n {metadata ? <MetadataHead metadata={metadata} pathname={pathname} /> : null}\n <ViewportHead viewport={viewport} />\n </>\n );\n}\n\nexport function buildAppPageElements<\n TModule extends AppPageModule,\n TErrorModule extends AppPageErrorModule,\n>(options: BuildAppPageElementsOptions<TModule, TErrorModule>): AppElements {\n const interceptionContext = options.interceptionContext ?? null;\n const renderMode = options.renderMode ?? APP_RSC_RENDER_MODE_NAVIGATION;\n const routeSegments = options.route.routeSegments ?? [];\n const routeResetKey = resolveAppPageRouteStateKey(routeSegments, options.matchedParams);\n const routeId = AppElementsWire.encodeRouteId(options.routePath, interceptionContext);\n const pageId = AppElementsWire.encodePageId(options.routePath, interceptionContext);\n const layoutEntries = createAppPageLayoutEntries(options.route);\n const templateEntries = createAppPageTemplateEntries(options.route);\n const errorEntries = createAppPageErrorEntries(options.route);\n const layoutEntriesByTreePosition = new Map<number, AppPageLayoutEntry<TModule, TErrorModule>>();\n const templateEntriesByTreePosition = new Map<number, AppPageTemplateEntry<TModule>>();\n const errorEntriesByTreePosition = new Map<number, AppPageErrorEntry<TErrorModule>>();\n for (const layoutEntry of layoutEntries) {\n layoutEntriesByTreePosition.set(layoutEntry.treePosition, layoutEntry);\n }\n for (const templateEntry of templateEntries) {\n templateEntriesByTreePosition.set(templateEntry.treePosition, templateEntry);\n }\n for (const errorEntry of errorEntries) {\n errorEntriesByTreePosition.set(errorEntry.treePosition, errorEntry);\n }\n const layoutIndicesByTreePosition = new Map<number, number>();\n for (let index = 0; index < layoutEntries.length; index++) {\n layoutIndicesByTreePosition.set(layoutEntries[index].treePosition, index);\n }\n const layoutDependenciesByIndex = new Map<number, AppRenderDependency>();\n const layoutDependenciesBefore: AppRenderDependency[][] = [];\n const slotDependenciesByLayoutIndex: AppRenderDependency[][] = [];\n const templateDependenciesById = new Map<string, AppRenderDependency>();\n const templateDependenciesBeforeById = new Map<string, AppRenderDependency[]>();\n const pageDependencies: AppRenderDependency[] = [];\n const rootLayoutTreePath = layoutEntries[0]?.treePath ?? null;\n const slotNameCounts = new Map<string, number>();\n for (const slot of Object.values(options.route.slots ?? {})) {\n const slotName = slot.name;\n slotNameCounts.set(slotName, (slotNameCounts.get(slotName) ?? 0) + 1);\n }\n const orderedTreePositions = Array.from(\n new Set<number>([\n ...layoutEntries.map((entry) => entry.treePosition),\n ...templateEntries.map((entry) => entry.treePosition),\n ...errorEntries.map((entry) => entry.treePosition),\n ]),\n ).sort((left, right) => left - right);\n const resolveSlotOverride = (slotKey: string, slotName: string) => {\n const overrideByKey = options.slotOverrides?.[slotKey];\n if (overrideByKey) {\n return overrideByKey;\n }\n\n // Legacy callers may still provide overrides by slot prop name.\n // Only allow that fallback when it is unambiguous.\n if (slotKey === slotName || (slotNameCounts.get(slotName) ?? 0) === 1) {\n return options.slotOverrides?.[slotName];\n }\n\n return undefined;\n };\n const elements: Record<\n string,\n ReactNode | string | null | AppElementsInterception | readonly AppElementsSlotBinding[]\n > = {\n ...AppElementsWire.createMetadataEntries({\n interception: options.interception ?? null,\n interceptionContext,\n layoutIds: options.route.ids?.layouts ?? layoutEntries.map((entry) => entry.id),\n rootLayoutTreePath,\n routeId,\n slotBindings: createAppPageSlotBindings(options.route, layoutEntries, resolveSlotOverride),\n }),\n };\n const getEffectiveSlotParams = (slotKey: string, slotName: string): AppPageParams =>\n resolveSlotOverride(slotKey, slotName)?.params ?? options.matchedParams;\n\n for (const treePosition of orderedTreePositions) {\n const layoutIndex = layoutIndicesByTreePosition.get(treePosition);\n if (layoutIndex !== undefined) {\n const layoutEntry = layoutEntries[layoutIndex];\n layoutDependenciesBefore[layoutIndex] = [...pageDependencies];\n if (getDefaultExport(layoutEntry.layoutModule)) {\n const layoutDependency = createAppRenderDependency();\n layoutDependenciesByIndex.set(layoutIndex, layoutDependency);\n pageDependencies.push(layoutDependency);\n }\n slotDependenciesByLayoutIndex[layoutIndex] = [...pageDependencies];\n }\n\n const templateEntry = templateEntriesByTreePosition.get(treePosition);\n if (!templateEntry || !getDefaultExport(templateEntry.templateModule)) {\n continue;\n }\n\n const templateDependency = createAppRenderDependency();\n templateDependenciesById.set(templateEntry.id, templateDependency);\n templateDependenciesBeforeById.set(templateEntry.id, [...pageDependencies]);\n pageDependencies.push(templateDependency);\n }\n\n const routeLoadingComponent = getDefaultExport(options.route.loading);\n const isPrefetchLoadingShell = renderMode === APP_RSC_RENDER_MODE_PREFETCH_LOADING_SHELL;\n const shouldRenderPrefetchLoadingShell = isPrefetchLoadingShell && routeLoadingComponent !== null;\n if (shouldRenderPrefetchLoadingShell) {\n // Client loading components serialize as module references in Flight. Keep\n // a durable marker in the shell payload so external router tests and\n // diagnostics can recognize this as a loading-boundary response without\n // requiring source text to appear in client component references.\n elements[APP_PREFETCH_LOADING_SHELL_MARKER_KEY] = \"LoadingBoundary\";\n }\n\n elements[pageId] = isPrefetchLoadingShell\n ? null\n : renderAfterAppDependencies(options.element, pageDependencies);\n\n for (const templateEntry of templateEntries) {\n const templateComponent = getDefaultExport(templateEntry.templateModule);\n if (!templateComponent) {\n continue;\n }\n const TemplateComponent = templateComponent;\n const templateDependency = templateDependenciesById.get(templateEntry.id);\n const templateElement = templateDependency ? (\n renderWithAppDependencyBarrier(\n <TemplateComponent params={options.matchedParams}>\n <Children />\n </TemplateComponent>,\n templateDependency,\n )\n ) : (\n <TemplateComponent params={options.matchedParams}>\n <Children />\n </TemplateComponent>\n );\n elements[templateEntry.id] = renderAfterAppDependencies(\n templateElement,\n templateDependenciesBeforeById.get(templateEntry.id) ?? [],\n );\n }\n\n for (let index = 0; index < layoutEntries.length; index++) {\n const layoutEntry = layoutEntries[index];\n const layoutComponent = getDefaultExport(layoutEntry.layoutModule);\n if (!layoutComponent) {\n continue;\n }\n\n const layoutProps: Record<string, unknown> = {\n params: options.makeThenableParams(\n resolveAppPageSegmentParams(\n options.route.routeSegments,\n layoutEntry.treePosition,\n options.matchedParams,\n ),\n ),\n };\n\n for (const slot of Object.values(options.route.slots ?? {})) {\n const slotName = slot.name;\n const targetIndex = slot.layoutIndex >= 0 ? slot.layoutIndex : layoutEntries.length - 1;\n if (targetIndex !== index) {\n continue;\n }\n layoutProps[slotName] = <ParallelSlot name={slotName} />;\n }\n\n const LayoutComponent = layoutComponent;\n const layoutDependency = layoutDependenciesByIndex.get(index);\n const layoutElement = layoutDependency ? (\n renderWithAppDependencyBarrier(\n <LayoutComponent {...layoutProps}>\n <Children />\n </LayoutComponent>,\n layoutDependency,\n )\n ) : (\n <LayoutComponent {...layoutProps}>\n <Children />\n </LayoutComponent>\n );\n elements[layoutEntry.id] = renderAfterAppDependencies(\n layoutElement,\n layoutDependenciesBefore[index] ?? [],\n );\n }\n\n for (const [slotKey, slot] of Object.entries(options.route.slots ?? {})) {\n const slotName = slot.name;\n const targetIndex = slot.layoutIndex >= 0 ? slot.layoutIndex : layoutEntries.length - 1;\n const treePath = layoutEntries[targetIndex]?.treePath ?? \"/\";\n const slotId = resolveAppPageSlotId(slot, treePath);\n const slotOverride = resolveSlotOverride(slotKey, slotName);\n const slotParams = getEffectiveSlotParams(slotKey, slotName);\n const slotRouteSegments = slot.routeSegments ?? [];\n const slotResetKey = resolveAppPageRouteStateKey(slotRouteSegments, slotParams);\n const overrideOrPageComponent =\n getDefaultExport(slotOverride?.pageModule) ?? getDefaultExport(slot.page);\n const defaultComponent = getDefaultExport(slot.default);\n\n // On soft nav (RSC): omit key when only default.tsx exists and the slot is\n // already mounted on the client. Absent key means the browser retains prior\n // slot content rather than replacing it. When the slot is not yet mounted\n // (first entry into this layout), include the key so default.tsx renders.\n if (\n !overrideOrPageComponent &&\n defaultComponent &&\n options.isRscRequest &&\n options.mountedSlotIds?.has(slotId)\n ) {\n continue;\n }\n\n const slotComponent = overrideOrPageComponent ?? defaultComponent;\n\n if (!slotComponent) {\n elements[slotId] = AppElementsWire.unmatchedSlotValue;\n continue;\n }\n\n const slotThenableParams = options.makeThenableParams(slotParams);\n const slotProps: Record<string, unknown> = {\n params: slotThenableParams,\n };\n if (slotOverride?.props) {\n Object.assign(slotProps, slotOverride.props);\n }\n\n const SlotComponent = slotComponent;\n let slotElement: ReactNode = <SlotComponent {...slotProps} />;\n const interceptLayouts = slotOverride?.layoutModules ?? [];\n\n for (let layoutIndex = interceptLayouts.length - 1; layoutIndex >= 0; layoutIndex--) {\n const interceptLayoutComponent = getDefaultExport(interceptLayouts[layoutIndex]);\n if (!interceptLayoutComponent) {\n continue;\n }\n const InterceptLayoutComponent = interceptLayoutComponent;\n slotElement = (\n <InterceptLayoutComponent params={slotThenableParams}>\n {slotElement}\n </InterceptLayoutComponent>\n );\n }\n\n const slotLayoutComponent = getDefaultExport(slot.layout);\n if (slotLayoutComponent) {\n const SlotLayoutComponent = slotLayoutComponent;\n slotElement = (\n <SlotLayoutComponent params={slotThenableParams}>{slotElement}</SlotLayoutComponent>\n );\n }\n\n const slotLoadingComponent = getDefaultExport(slot.loading);\n if (slotLoadingComponent && !shouldSuppressLoadingBoundaries(renderMode)) {\n const SlotLoadingComponent = slotLoadingComponent;\n slotElement = (\n <Suspense key={slotResetKey} fallback={<SlotLoadingComponent />}>\n {slotElement}\n </Suspense>\n );\n }\n\n const slotErrorComponent = getErrorBoundaryExport(slot.error);\n if (slotErrorComponent) {\n slotElement = (\n <ErrorBoundary resetKey={slotResetKey} fallback={slotErrorComponent}>\n {slotElement}\n </ErrorBoundary>\n );\n }\n\n elements[slotId] = renderAfterAppDependencies(\n slotElement,\n targetIndex >= 0 ? (slotDependenciesByLayoutIndex[targetIndex] ?? []) : [],\n );\n }\n\n let routeChildren: ReactNode = (\n <LayoutSegmentProvider segmentMap={{ children: [] }}>\n <Slot id={pageId} />\n </LayoutSegmentProvider>\n );\n\n if (isPrefetchLoadingShell) {\n if (routeLoadingComponent === null) {\n routeChildren = null;\n } else {\n const RouteLoadingComponent = routeLoadingComponent;\n routeChildren = <RouteLoadingComponent />;\n }\n } else {\n // Wrap the page slot in a per-segment RedirectBoundary so that a\n // redirect() thrown from a server component (or a client component\n // within the page subtree) is caught here — below the route's layouts —\n // rather than at the top-level boundary in app-browser-entry. Catching\n // at the top level unmounts the entire route tree including layouts,\n // which destroys client-side state in layout-hosted components\n // (counters, theme toggles, form drafts). Here, only the page subtree\n // is unmounted; the surrounding layouts stay mounted across the\n // boundary's null-render → router.replace transition, and segment\n // reuse keeps their React state intact.\n //\n // Placed inside the Suspense (loading) boundary to match Next.js nesting\n // for the redirect boundary specifically:\n // Error > AccessFallback > Loading (Suspense) > Redirect > content\n // (Note: Next.js places AccessFallback inside Loading, not outside — that\n // is a pre-existing nesting divergence tracked separately.)\n // This keeps the loading fallback visible during redirect-driven\n // transitions rather than unmounting it.\n routeChildren = <RedirectBoundary>{routeChildren}</RedirectBoundary>;\n\n if (routeLoadingComponent && !shouldSuppressLoadingBoundaries(renderMode)) {\n const RouteLoadingComponent = routeLoadingComponent;\n // Route-level wrappers cover the full page branch in vinext's flat element\n // transport, so their reset key includes the visible segment-state path.\n // Dynamic param changes reset the pending boundary, while search-only changes\n // preserve it.\n routeChildren = (\n <Suspense key={routeResetKey} fallback={<RouteLoadingComponent />}>\n {routeChildren}\n </Suspense>\n );\n }\n }\n\n const lastLayoutErrorModule =\n errorEntries.length > 0 ? errorEntries[errorEntries.length - 1].errorModule : null;\n // Next.js nesting (outer to inner): Error > Unauthorized > Forbidden > NotFound > children.\n // Building bottom-up means NotFoundBoundary must wrap first, then Forbidden, Unauthorized, Error.\n const notFoundComponent =\n getDefaultExport(options.route.notFound) ?? getDefaultExport(options.rootNotFoundModule);\n if (notFoundComponent) {\n const NotFoundComponent = notFoundComponent;\n routeChildren = (\n <NotFoundBoundary resetKey={routeResetKey} fallback={<NotFoundComponent />}>\n {routeChildren}\n </NotFoundBoundary>\n );\n }\n\n const forbiddenComponent =\n getDefaultExport(options.route.forbidden) ?? getDefaultExport(options.rootForbiddenModule);\n if (forbiddenComponent) {\n const ForbiddenComponent = forbiddenComponent;\n routeChildren = (\n <ForbiddenBoundary resetKey={routeResetKey} fallback={<ForbiddenComponent />}>\n {routeChildren}\n </ForbiddenBoundary>\n );\n }\n\n const unauthorizedComponent =\n getDefaultExport(options.route.unauthorized) ??\n getDefaultExport(options.rootUnauthorizedModule);\n if (unauthorizedComponent) {\n const UnauthorizedComponent = unauthorizedComponent;\n routeChildren = (\n <UnauthorizedBoundary resetKey={routeResetKey} fallback={<UnauthorizedComponent />}>\n {routeChildren}\n </UnauthorizedBoundary>\n );\n }\n\n const pageErrorComponent = getErrorBoundaryExport(options.route.error);\n if (pageErrorComponent && options.route.error !== lastLayoutErrorModule) {\n routeChildren = (\n <ErrorBoundary resetKey={routeResetKey} fallback={pageErrorComponent}>\n {routeChildren}\n </ErrorBoundary>\n );\n }\n\n for (let index = orderedTreePositions.length - 1; index >= 0; index--) {\n const treePosition = orderedTreePositions[index];\n const segmentResetKey = resolveAppPageSegmentStateKey(\n routeSegments,\n treePosition,\n options.matchedParams,\n );\n let segmentChildren: ReactNode = routeChildren;\n const layoutEntry = layoutEntriesByTreePosition.get(treePosition);\n const templateEntry = templateEntriesByTreePosition.get(treePosition);\n const errorEntry = errorEntriesByTreePosition.get(treePosition);\n\n // Next.js nesting per segment (outer to inner): Layout > Template > Error > Unauthorized > Forbidden > NotFound > children.\n // Building bottom-up means NotFoundBoundary must wrap the leaf subtree first,\n // then ErrorBoundary, then Template, with the Layout slot outermost.\n if (layoutEntry) {\n const layoutNotFoundComponent = getDefaultExport(layoutEntry.notFoundModule);\n if (layoutNotFoundComponent) {\n const LayoutNotFoundComponent = layoutNotFoundComponent;\n segmentChildren = (\n <NotFoundBoundary resetKey={segmentResetKey} fallback={<LayoutNotFoundComponent />}>\n {segmentChildren}\n </NotFoundBoundary>\n );\n }\n\n const layoutForbiddenComponent = getDefaultExport(layoutEntry.forbiddenModule);\n if (layoutForbiddenComponent) {\n const LayoutForbiddenComponent = layoutForbiddenComponent;\n segmentChildren = (\n <ForbiddenBoundary resetKey={segmentResetKey} fallback={<LayoutForbiddenComponent />}>\n {segmentChildren}\n </ForbiddenBoundary>\n );\n }\n\n const layoutUnauthorizedComponent = getDefaultExport(layoutEntry.unauthorizedModule);\n if (layoutUnauthorizedComponent) {\n const LayoutUnauthorizedComponent = layoutUnauthorizedComponent;\n segmentChildren = (\n <UnauthorizedBoundary\n resetKey={segmentResetKey}\n fallback={<LayoutUnauthorizedComponent />}\n >\n {segmentChildren}\n </UnauthorizedBoundary>\n );\n }\n }\n\n const segmentErrorComponent = getErrorBoundaryExport(\n errorEntry?.errorModule ?? layoutEntry?.errorModule,\n );\n if (segmentErrorComponent) {\n segmentChildren = (\n <ErrorBoundary resetKey={segmentResetKey} fallback={segmentErrorComponent}>\n {segmentChildren}\n </ErrorBoundary>\n );\n }\n\n if (templateEntry && getDefaultExport(templateEntry.templateModule)) {\n segmentChildren = (\n <Slot id={templateEntry.id} key={segmentResetKey}>\n {segmentChildren}\n </Slot>\n );\n }\n\n if (!layoutEntry) {\n routeChildren = segmentChildren;\n continue;\n }\n const layoutHasElement = getDefaultExport(layoutEntry.layoutModule) !== null;\n const layoutIndex = layoutIndicesByTreePosition.get(treePosition) ?? -1;\n const segmentMap: { children: string[] } & Record<string, string[]> = {\n children: resolveAppPageChildSegments(\n routeSegments,\n layoutEntry.treePosition,\n options.matchedParams,\n ),\n };\n for (const [slotKey, slot] of Object.entries(options.route.slots ?? {})) {\n const slotName = slot.name;\n const targetIndex = slot.layoutIndex >= 0 ? slot.layoutIndex : layoutEntries.length - 1;\n if (targetIndex !== layoutIndex) {\n continue;\n }\n const slotParams = getEffectiveSlotParams(slotKey, slotName);\n segmentMap[slotName] = slot.routeSegments\n ? resolveAppPageChildSegments(slot.routeSegments, 0, slotParams)\n : [];\n }\n\n routeChildren = (\n <LayoutSegmentProvider segmentMap={segmentMap}>\n {layoutHasElement ? (\n <Slot\n id={layoutEntry.id}\n parallelSlots={createAppPageParallelSlotEntries(\n layoutIndex,\n layoutEntries,\n options.route,\n getEffectiveSlotParams,\n )}\n >\n {segmentChildren}\n </Slot>\n ) : (\n segmentChildren\n )}\n </LayoutSegmentProvider>\n );\n }\n\n const globalErrorComponent = getErrorBoundaryExport(options.globalErrorModule);\n if (globalErrorComponent) {\n routeChildren = <ErrorBoundary fallback={globalErrorComponent}>{routeChildren}</ErrorBoundary>;\n }\n\n elements[routeId] = (\n <>\n {createAppPageRouteHead(\n options.resolvedMetadata,\n options.resolvedViewport,\n options.resolvedMetadataPathname ?? options.routePath,\n )}\n {routeChildren}\n </>\n );\n\n return elements;\n}\n"],"mappings":";;;;;;;;;;;;;AAqLA,SAAS,iBACP,QACyB;CACzB,OAAO,QAAQ,WAAW;;AAG5B,SAAS,uBACP,QAC8B;CAC9B,OAAO,QAAQ,WAAW;;AAG5B,SAAgB,sBACd,eACA,cACQ;CACR,MAAM,mBAAmB,eAAe,MAAM,GAAG,aAAa,IAAI,EAAE;CACpE,IAAI,iBAAiB,WAAW,GAC9B,OAAO;CAET,OAAO,IAAI,iBAAiB,KAAK,IAAI;;AAGvC,SAAgB,2BAId,OAY6C;CAC7C,OAAO,MAAM,QAAQ,KAAK,cAAc,UAAU;EAChD,MAAM,eAAe,MAAM,sBAAsB,UAAU;EAC3D,MAAM,WAAW,sBAAsB,MAAM,eAAe,aAAa;EACzE,OAAO;GACL,aAAa,MAAM,qBAAqB,OAAQ,MAAM,SAAS,UAAU;GACzE,iBAAiB,MAAM,aAAa,UAAU;GAC9C,IAAI,gBAAgB,eAAe,SAAS;GAC5C;GACA,gBAAgB,MAAM,YAAY,UAAU;GAC5C,oBAAoB,MAAM,gBAAgB,UAAU;GACpD;GACA;GACD;GACD;;AAGJ,SAAS,6BACP,OAIiC;CACj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U;aACjD;GACa,CAAA;EAIpB,IAAI,iBAAiB,iBAAiB,cAAc,eAAe,EACjE,kBACE,oBAAC,MAAD;GAAM,IAAI,cAAc;aACrB;GACI,EAF0B,gBAE1B;EAIX,IAAI,CAAC,aAAa;GAChB,gBAAgB;GAChB;;EAEF,MAAM,mBAAmB,iBAAiB,YAAY,aAAa,KAAK;EACxE,MAAM,cAAc,4BAA4B,IAAI,aAAa,IAAI;EACrE,MAAM,aAAgE,EACpE,UAAU,4BACR,eACA,YAAY,cACZ,QAAQ,cACT,EACF;EACD,KAAK,MAAM,CAAC,SAAS,SAAS,OAAO,QAAQ,QAAQ,MAAM,SAAS,EAAE,CAAC,EAAE;GACvE,MAAM,WAAW,KAAK;GAEtB,KADoB,KAAK,eAAe,IAAI,KAAK,cAAc,cAAc,SAAS,OAClE,aAClB;GAEF,MAAM,aAAa,uBAAuB,SAAS,SAAS;GAC5D,WAAW,YAAY,KAAK,gBACxB,4BAA4B,KAAK,eAAe,GAAG,WAAW,GAC9D,EAAE;;EAGR,gBACE,oBAAC,uBAAD;GAAmC;aAChC,mBACC,oBAAC,MAAD;IACE,IAAI,YAAY;IAChB,eAAe,iCACb,aACA,eACA,QAAQ,OACR,uBACD;cAEA;IACI,CAAA,GAEP;GAEoB,CAAA;;CAI5B,MAAM,uBAAuB,uBAAuB,QAAQ,kBAAkB;CAC9E,IAAI,sBACF,gBAAgB,oBAAC,eAAD;EAAe,UAAU;YAAuB;EAA8B,CAAA;CAGhG,SAAS,WACP,qBAAA,YAAA,EAAA,UAAA,CACG,uBACC,QAAQ,kBACR,QAAQ,kBACR,QAAQ,4BAA4B,QAAQ,UAC7C,EACA,cACA,EAAA,CAAA;CAGL,OAAO"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AppPageFontPreload } from "./app-page-execution.js";
|
|
2
|
+
import { RootParams } from "../shims/root-params.js";
|
|
2
3
|
import { ReactFormState } from "react-dom/client";
|
|
3
4
|
|
|
4
5
|
//#region src/server/app-page-stream.d.ts
|
|
@@ -16,6 +17,8 @@ type AppPageSsrHandler = {
|
|
|
16
17
|
handleSsr: (rscStream: ReadableStream<Uint8Array>, navigationContext: unknown, fontData: AppPageFontData, options?: {
|
|
17
18
|
formState?: ReactFormState | null;
|
|
18
19
|
scriptNonce?: string;
|
|
20
|
+
basePath?: string;
|
|
21
|
+
rootParams?: RootParams;
|
|
19
22
|
sideStream?: ReadableStream<Uint8Array>;
|
|
20
23
|
capturedRscDataRef?: {
|
|
21
24
|
value: Promise<ArrayBuffer> | null;
|
|
@@ -29,6 +32,8 @@ type RenderAppPageHtmlStreamOptions = {
|
|
|
29
32
|
navigationContext: unknown;
|
|
30
33
|
rscStream: ReadableStream<Uint8Array>;
|
|
31
34
|
scriptNonce?: string;
|
|
35
|
+
basePath?: string;
|
|
36
|
+
rootParams?: RootParams;
|
|
32
37
|
ssrHandler: AppPageSsrHandler;
|
|
33
38
|
/** Pre-split side stream for fused embed+capture (#981). When set,
|
|
34
39
|
* handleSsr skips its internal tee and accumulates raw RSC bytes. */
|
|
@@ -12,6 +12,8 @@ async function renderAppPageHtmlStream(options) {
|
|
|
12
12
|
const ssrOptions = {
|
|
13
13
|
formState: options.formState ?? null,
|
|
14
14
|
scriptNonce: options.scriptNonce,
|
|
15
|
+
basePath: options.basePath,
|
|
16
|
+
rootParams: options.rootParams,
|
|
15
17
|
sideStream: options.sideStream,
|
|
16
18
|
capturedRscDataRef: options.capturedRscDataRef,
|
|
17
19
|
waitForAllReady: options.waitForAllReady
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-page-stream.js","names":[],"sources":["../../src/server/app-page-stream.ts"],"sourcesContent":["import type { AppPageFontPreload } from \"./app-page-execution.js\";\nimport type { ReactFormState } from \"react-dom/client\";\nimport { VINEXT_RSC_VARY_HEADER } from \"./app-rsc-cache-busting.js\";\nimport { mergeMiddlewareResponseHeaders } from \"./middleware-response-headers.js\";\n\nexport type AppPageFontData = {\n links: string[];\n preloads: readonly AppPageFontPreload[];\n styles: string[];\n};\n\ntype CreateAppPageFontDataOptions = {\n getLinks: () => string[];\n getPreloads: () => AppPageFontPreload[];\n getStyles: () => string[];\n};\n\nexport type AppPageSsrHandler = {\n handleSsr: (\n rscStream: ReadableStream<Uint8Array>,\n navigationContext: unknown,\n fontData: AppPageFontData,\n options?: {\n formState?: ReactFormState | null;\n scriptNonce?: string;\n sideStream?: ReadableStream<Uint8Array>;\n capturedRscDataRef?: { value: Promise<ArrayBuffer> | null };\n /** When true, wait for the full React tree before emitting bytes. */\n waitForAllReady?: boolean;\n },\n ) => Promise<ReadableStream<Uint8Array>>;\n};\n\ntype RenderAppPageHtmlStreamOptions = {\n fontData: AppPageFontData;\n formState?: ReactFormState | null;\n navigationContext: unknown;\n rscStream: ReadableStream<Uint8Array>;\n scriptNonce?: string;\n ssrHandler: AppPageSsrHandler;\n /** Pre-split side stream for fused embed+capture (#981). When set,\n * handleSsr skips its internal tee and accumulates raw RSC bytes. */\n sideStream?: ReadableStream<Uint8Array>;\n /** Out-parameter filled with accumulated raw RSC bytes after stream consumption. */\n capturedRscDataRef?: { value: Promise<ArrayBuffer> | null };\n /** When true, wait for the full React tree before emitting bytes. */\n waitForAllReady?: boolean;\n};\n\ntype RenderAppPageHtmlResponseOptions = {\n clearRequestContext: () => void;\n fontLinkHeader?: string;\n middlewareHeaders?: Headers | null;\n status: number;\n} & RenderAppPageHtmlStreamOptions;\n\ntype AppPageHtmlStreamRecoveryResult = {\n htmlStream: ReadableStream<Uint8Array> | null;\n response: Response | null;\n};\n\ntype RenderAppPageHtmlStreamWithRecoveryOptions<TSpecialError> = {\n onShellRendered?: () => void;\n renderErrorBoundaryResponse: (error: unknown) => Promise<Response | null>;\n renderHtmlStream: () => Promise<ReadableStream<Uint8Array>>;\n renderSpecialErrorResponse: (specialError: TSpecialError) => Promise<Response>;\n resolveSpecialError: (error: unknown) => TSpecialError | null;\n};\n\ntype AppPageRscErrorTracker = {\n getCapturedError: () => unknown;\n /**\n * Returns a NEXT_REDIRECT or NEXT_HTTP_ERROR_FALLBACK error captured during\n * the RSC render. Read after the SSR shell promise resolves to swap a\n * 307/404 in place of the streamed body when redirect()/notFound() throws\n * synchronously inside a route-level Suspense boundary (loading.tsx).\n */\n getCapturedSpecialError: () => unknown;\n onRenderError: (error: unknown, requestInfo: unknown, errorContext: unknown) => unknown;\n};\n\ntype ShouldRerenderAppPageWithGlobalErrorOptions = {\n capturedError: unknown;\n hasLocalBoundary: boolean;\n};\n\nexport function createAppPageFontData(options: CreateAppPageFontDataOptions): AppPageFontData {\n return {\n links: options.getLinks(),\n preloads: options.getPreloads(),\n styles: options.getStyles(),\n };\n}\n\nexport async function renderAppPageHtmlStream(\n options: RenderAppPageHtmlStreamOptions,\n): Promise<ReadableStream<Uint8Array>> {\n const ssrOptions = {\n formState: options.formState ?? null,\n scriptNonce: options.scriptNonce,\n sideStream: options.sideStream,\n capturedRscDataRef: options.capturedRscDataRef,\n waitForAllReady: options.waitForAllReady,\n };\n\n return options.ssrHandler.handleSsr(\n options.rscStream,\n options.navigationContext,\n options.fontData,\n ssrOptions,\n );\n}\n\n/**\n * Wraps a stream so that `onFlush` is called when the last byte has been read\n * by the downstream consumer (i.e. when the HTTP layer finishes draining the\n * response body). This is the correct place to clear per-request context,\n * because the RSC/SSR pipeline is lazy — components execute while the stream\n * is being consumed, not when the stream handle is first obtained.\n */\nexport function deferUntilStreamConsumed(\n stream: ReadableStream<Uint8Array>,\n onFlush: () => void,\n): ReadableStream<Uint8Array> {\n let called = false;\n const once = () => {\n if (!called) {\n called = true;\n onFlush();\n }\n };\n\n const cleanup = new TransformStream<Uint8Array, Uint8Array>({\n flush() {\n once();\n },\n });\n\n const piped = stream.pipeThrough(cleanup);\n\n // Wrap with a ReadableStream so we can intercept cancel() — the TransformStream\n // Transformer interface does not expose a cancel hook in the Web Streams spec.\n const reader = piped.getReader();\n return new ReadableStream<Uint8Array>({\n pull(controller) {\n return reader.read().then(\n ({ done, value }) => {\n if (done) {\n controller.close();\n } else {\n controller.enqueue(value);\n }\n },\n (error) => {\n once();\n controller.error(error);\n },\n );\n },\n cancel(reason) {\n // Stream cancelled before fully consumed (e.g. client disconnected).\n // Still clear per-request context to avoid leaks.\n once();\n return reader.cancel(reason);\n },\n });\n}\n\nexport async function renderAppPageHtmlResponse(\n options: RenderAppPageHtmlResponseOptions,\n): Promise<Response> {\n const htmlStream = await renderAppPageHtmlStream(options);\n\n // Defer clearRequestContext() until the stream is fully consumed by the HTTP\n // layer. Calling it synchronously here would race the lazy RSC/SSR pipeline:\n // components execute while the stream is being pulled, not when the handle\n // is first returned. See: https://github.com/cloudflare/vinext/issues/660\n const safeStream = deferUntilStreamConsumed(htmlStream, () => {\n options.clearRequestContext();\n });\n\n const headers = new Headers({\n \"Content-Type\": \"text/html; charset=utf-8\",\n Vary: VINEXT_RSC_VARY_HEADER,\n });\n\n if (options.fontLinkHeader) {\n headers.set(\"Link\", options.fontLinkHeader);\n }\n\n mergeMiddlewareResponseHeaders(headers, options.middlewareHeaders ?? null);\n\n return new Response(safeStream, {\n status: options.status,\n headers,\n });\n}\n\nexport async function renderAppPageHtmlStreamWithRecovery<TSpecialError>(\n options: RenderAppPageHtmlStreamWithRecoveryOptions<TSpecialError>,\n): Promise<AppPageHtmlStreamRecoveryResult> {\n try {\n const htmlStream = await options.renderHtmlStream();\n options.onShellRendered?.();\n return {\n htmlStream,\n response: null,\n };\n } catch (error) {\n const specialError = options.resolveSpecialError(error);\n if (specialError) {\n return {\n htmlStream: null,\n response: await options.renderSpecialErrorResponse(specialError),\n };\n }\n\n const boundaryResponse = await options.renderErrorBoundaryResponse(error);\n if (boundaryResponse) {\n return {\n htmlStream: null,\n response: boundaryResponse,\n };\n }\n\n throw error;\n }\n}\n\nexport function createAppPageRscErrorTracker(\n baseOnError: (error: unknown, requestInfo: unknown, errorContext: unknown) => unknown,\n): AppPageRscErrorTracker {\n let capturedError: unknown = null;\n let capturedSpecialError: unknown = null;\n\n return {\n getCapturedError() {\n return capturedError;\n },\n getCapturedSpecialError() {\n return capturedSpecialError;\n },\n onRenderError(error, requestInfo, errorContext) {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n // Errors with a digest are signal throws (NEXT_REDIRECT,\n // NEXT_NOT_FOUND, NEXT_HTTP_ERROR_FALLBACK). They're not real\n // failures — keep the first one so the lifecycle can swap a\n // 307/404 in place of a streamed \"Switched to client rendering\"\n // body for routes with a route-level Suspense boundary.\n if (capturedSpecialError === null) {\n capturedSpecialError = error;\n }\n } else {\n capturedError = error;\n }\n return baseOnError(error, requestInfo, errorContext);\n },\n };\n}\n\nexport function shouldRerenderAppPageWithGlobalError(\n options: ShouldRerenderAppPageWithGlobalErrorOptions,\n): boolean {\n return Boolean(options.capturedError) && !options.hasLocalBoundary;\n}\n"],"mappings":";;;AAsFA,SAAgB,sBAAsB,SAAwD;CAC5F,OAAO;EACL,OAAO,QAAQ,UAAU;EACzB,UAAU,QAAQ,aAAa;EAC/B,QAAQ,QAAQ,WAAW;EAC5B;;AAGH,eAAsB,wBACpB,SACqC;CACrC,MAAM,aAAa;EACjB,WAAW,QAAQ,aAAa;EAChC,aAAa,QAAQ;EACrB,YAAY,QAAQ;EACpB,oBAAoB,QAAQ;EAC5B,iBAAiB,QAAQ;EAC1B;CAED,OAAO,QAAQ,WAAW,UACxB,QAAQ,WACR,QAAQ,mBACR,QAAQ,UACR,WACD;;;;;;;;;AAUH,SAAgB,yBACd,QACA,SAC4B;CAC5B,IAAI,SAAS;CACb,MAAM,aAAa;EACjB,IAAI,CAAC,QAAQ;GACX,SAAS;GACT,SAAS;;;CAIb,MAAM,UAAU,IAAI,gBAAwC,EAC1D,QAAQ;EACN,MAAM;IAET,CAAC;CAMF,MAAM,SAJQ,OAAO,YAAY,QAIb,CAAC,WAAW;CAChC,OAAO,IAAI,eAA2B;EACpC,KAAK,YAAY;GACf,OAAO,OAAO,MAAM,CAAC,MAClB,EAAE,MAAM,YAAY;IACnB,IAAI,MACF,WAAW,OAAO;SA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AQ,cAAc,IAAI,CAAC,QAAQ"}
|
|
1
|
+
{"version":3,"file":"app-page-stream.js","names":[],"sources":["../../src/server/app-page-stream.ts"],"sourcesContent":["import type { AppPageFontPreload } from \"./app-page-execution.js\";\nimport type { ReactFormState } from \"react-dom/client\";\nimport { VINEXT_RSC_VARY_HEADER } from \"./app-rsc-cache-busting.js\";\nimport { mergeMiddlewareResponseHeaders } from \"./middleware-response-headers.js\";\nimport type { RootParams } from \"vinext/shims/root-params\";\n\nexport type AppPageFontData = {\n links: string[];\n preloads: readonly AppPageFontPreload[];\n styles: string[];\n};\n\ntype CreateAppPageFontDataOptions = {\n getLinks: () => string[];\n getPreloads: () => AppPageFontPreload[];\n getStyles: () => string[];\n};\n\nexport type AppPageSsrHandler = {\n handleSsr: (\n rscStream: ReadableStream<Uint8Array>,\n navigationContext: unknown,\n fontData: AppPageFontData,\n options?: {\n formState?: ReactFormState | null;\n scriptNonce?: string;\n basePath?: string;\n rootParams?: RootParams;\n sideStream?: ReadableStream<Uint8Array>;\n capturedRscDataRef?: { value: Promise<ArrayBuffer> | null };\n /** When true, wait for the full React tree before emitting bytes. */\n waitForAllReady?: boolean;\n },\n ) => Promise<ReadableStream<Uint8Array>>;\n};\n\ntype RenderAppPageHtmlStreamOptions = {\n fontData: AppPageFontData;\n formState?: ReactFormState | null;\n navigationContext: unknown;\n rscStream: ReadableStream<Uint8Array>;\n scriptNonce?: string;\n basePath?: string;\n rootParams?: RootParams;\n ssrHandler: AppPageSsrHandler;\n /** Pre-split side stream for fused embed+capture (#981). When set,\n * handleSsr skips its internal tee and accumulates raw RSC bytes. */\n sideStream?: ReadableStream<Uint8Array>;\n /** Out-parameter filled with accumulated raw RSC bytes after stream consumption. */\n capturedRscDataRef?: { value: Promise<ArrayBuffer> | null };\n /** When true, wait for the full React tree before emitting bytes. */\n waitForAllReady?: boolean;\n};\n\ntype RenderAppPageHtmlResponseOptions = {\n clearRequestContext: () => void;\n fontLinkHeader?: string;\n middlewareHeaders?: Headers | null;\n status: number;\n} & RenderAppPageHtmlStreamOptions;\n\ntype AppPageHtmlStreamRecoveryResult = {\n htmlStream: ReadableStream<Uint8Array> | null;\n response: Response | null;\n};\n\ntype RenderAppPageHtmlStreamWithRecoveryOptions<TSpecialError> = {\n onShellRendered?: () => void;\n renderErrorBoundaryResponse: (error: unknown) => Promise<Response | null>;\n renderHtmlStream: () => Promise<ReadableStream<Uint8Array>>;\n renderSpecialErrorResponse: (specialError: TSpecialError) => Promise<Response>;\n resolveSpecialError: (error: unknown) => TSpecialError | null;\n};\n\ntype AppPageRscErrorTracker = {\n getCapturedError: () => unknown;\n /**\n * Returns a NEXT_REDIRECT or NEXT_HTTP_ERROR_FALLBACK error captured during\n * the RSC render. Read after the SSR shell promise resolves to swap a\n * 307/404 in place of the streamed body when redirect()/notFound() throws\n * synchronously inside a route-level Suspense boundary (loading.tsx).\n */\n getCapturedSpecialError: () => unknown;\n onRenderError: (error: unknown, requestInfo: unknown, errorContext: unknown) => unknown;\n};\n\ntype ShouldRerenderAppPageWithGlobalErrorOptions = {\n capturedError: unknown;\n hasLocalBoundary: boolean;\n};\n\nexport function createAppPageFontData(options: CreateAppPageFontDataOptions): AppPageFontData {\n return {\n links: options.getLinks(),\n preloads: options.getPreloads(),\n styles: options.getStyles(),\n };\n}\n\nexport async function renderAppPageHtmlStream(\n options: RenderAppPageHtmlStreamOptions,\n): Promise<ReadableStream<Uint8Array>> {\n const ssrOptions = {\n formState: options.formState ?? null,\n scriptNonce: options.scriptNonce,\n basePath: options.basePath,\n rootParams: options.rootParams,\n sideStream: options.sideStream,\n capturedRscDataRef: options.capturedRscDataRef,\n waitForAllReady: options.waitForAllReady,\n };\n\n return options.ssrHandler.handleSsr(\n options.rscStream,\n options.navigationContext,\n options.fontData,\n ssrOptions,\n );\n}\n\n/**\n * Wraps a stream so that `onFlush` is called when the last byte has been read\n * by the downstream consumer (i.e. when the HTTP layer finishes draining the\n * response body). This is the correct place to clear per-request context,\n * because the RSC/SSR pipeline is lazy — components execute while the stream\n * is being consumed, not when the stream handle is first obtained.\n */\nexport function deferUntilStreamConsumed(\n stream: ReadableStream<Uint8Array>,\n onFlush: () => void,\n): ReadableStream<Uint8Array> {\n let called = false;\n const once = () => {\n if (!called) {\n called = true;\n onFlush();\n }\n };\n\n const cleanup = new TransformStream<Uint8Array, Uint8Array>({\n flush() {\n once();\n },\n });\n\n const piped = stream.pipeThrough(cleanup);\n\n // Wrap with a ReadableStream so we can intercept cancel() — the TransformStream\n // Transformer interface does not expose a cancel hook in the Web Streams spec.\n const reader = piped.getReader();\n return new ReadableStream<Uint8Array>({\n pull(controller) {\n return reader.read().then(\n ({ done, value }) => {\n if (done) {\n controller.close();\n } else {\n controller.enqueue(value);\n }\n },\n (error) => {\n once();\n controller.error(error);\n },\n );\n },\n cancel(reason) {\n // Stream cancelled before fully consumed (e.g. client disconnected).\n // Still clear per-request context to avoid leaks.\n once();\n return reader.cancel(reason);\n },\n });\n}\n\nexport async function renderAppPageHtmlResponse(\n options: RenderAppPageHtmlResponseOptions,\n): Promise<Response> {\n const htmlStream = await renderAppPageHtmlStream(options);\n\n // Defer clearRequestContext() until the stream is fully consumed by the HTTP\n // layer. Calling it synchronously here would race the lazy RSC/SSR pipeline:\n // components execute while the stream is being pulled, not when the handle\n // is first returned. See: https://github.com/cloudflare/vinext/issues/660\n const safeStream = deferUntilStreamConsumed(htmlStream, () => {\n options.clearRequestContext();\n });\n\n const headers = new Headers({\n \"Content-Type\": \"text/html; charset=utf-8\",\n Vary: VINEXT_RSC_VARY_HEADER,\n });\n\n if (options.fontLinkHeader) {\n headers.set(\"Link\", options.fontLinkHeader);\n }\n\n mergeMiddlewareResponseHeaders(headers, options.middlewareHeaders ?? null);\n\n return new Response(safeStream, {\n status: options.status,\n headers,\n });\n}\n\nexport async function renderAppPageHtmlStreamWithRecovery<TSpecialError>(\n options: RenderAppPageHtmlStreamWithRecoveryOptions<TSpecialError>,\n): Promise<AppPageHtmlStreamRecoveryResult> {\n try {\n const htmlStream = await options.renderHtmlStream();\n options.onShellRendered?.();\n return {\n htmlStream,\n response: null,\n };\n } catch (error) {\n const specialError = options.resolveSpecialError(error);\n if (specialError) {\n return {\n htmlStream: null,\n response: await options.renderSpecialErrorResponse(specialError),\n };\n }\n\n const boundaryResponse = await options.renderErrorBoundaryResponse(error);\n if (boundaryResponse) {\n return {\n htmlStream: null,\n response: boundaryResponse,\n };\n }\n\n throw error;\n }\n}\n\nexport function createAppPageRscErrorTracker(\n baseOnError: (error: unknown, requestInfo: unknown, errorContext: unknown) => unknown,\n): AppPageRscErrorTracker {\n let capturedError: unknown = null;\n let capturedSpecialError: unknown = null;\n\n return {\n getCapturedError() {\n return capturedError;\n },\n getCapturedSpecialError() {\n return capturedSpecialError;\n },\n onRenderError(error, requestInfo, errorContext) {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n // Errors with a digest are signal throws (NEXT_REDIRECT,\n // NEXT_NOT_FOUND, NEXT_HTTP_ERROR_FALLBACK). They're not real\n // failures — keep the first one so the lifecycle can swap a\n // 307/404 in place of a streamed \"Switched to client rendering\"\n // body for routes with a route-level Suspense boundary.\n if (capturedSpecialError === null) {\n capturedSpecialError = error;\n }\n } else {\n capturedError = error;\n }\n return baseOnError(error, requestInfo, errorContext);\n },\n };\n}\n\nexport function shouldRerenderAppPageWithGlobalError(\n options: ShouldRerenderAppPageWithGlobalErrorOptions,\n): boolean {\n return Boolean(options.capturedError) && !options.hasLocalBoundary;\n}\n"],"mappings":";;;AA2FA,SAAgB,sBAAsB,SAAwD;CAC5F,OAAO;EACL,OAAO,QAAQ,UAAU;EACzB,UAAU,QAAQ,aAAa;EAC/B,QAAQ,QAAQ,WAAW;EAC5B;;AAGH,eAAsB,wBACpB,SACqC;CACrC,MAAM,aAAa;EACjB,WAAW,QAAQ,aAAa;EAChC,aAAa,QAAQ;EACrB,UAAU,QAAQ;EAClB,YAAY,QAAQ;EACpB,YAAY,QAAQ;EACpB,oBAAoB,QAAQ;EAC5B,iBAAiB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E;EAGH,MAAM,mBAAmB,MAAM,QAAQ,4BAA4B,MAAM;EACzE,IAAI,kBACF,OAAO;GACL,YAAY;GACZ,UAAU;GACX;EAGH,MAAM;;;AAIV,SAAgB,6BACd,aACwB;CACxB,IAAI,gBAAyB;CAC7B,IAAI,uBAAgC;CAEpC,OAAO;EACL,mBAAmB;GACjB,OAAO;;EAET,0BAA0B;GACxB,OAAO;;EAET,cAAc,OAAO,aAAa,cAAc;GAC9C,IAAI,SAAS,OAAO,UAAU,YAAY,YAAY;QAMhD,yBAAyB,MAC3B,uBAAuB;UAGzB,gBAAgB;GAElB,OAAO,YAAY,OAAO,aAAa,aAAa;;EAEvD;;AAGH,SAAgB,qCACd,SACS;CACT,OAAO,QAAQ,QAAQ,cAAc,IAAI,CAAC,QAAQ"}
|
|
@@ -4,6 +4,7 @@ import { RootParams } from "../shims/root-params.js";
|
|
|
4
4
|
type GenerateStaticParamsFunction = (input: {
|
|
5
5
|
params: RootParams;
|
|
6
6
|
}) => unknown;
|
|
7
|
+
declare function createAppPrerenderStaticParamsResolver(sources: readonly unknown[], rootParamNames?: readonly string[]): GenerateStaticParamsFunction | null;
|
|
7
8
|
type CallAppPrerenderStaticParamsOptions = {
|
|
8
9
|
fn: GenerateStaticParamsFunction;
|
|
9
10
|
params: RootParams;
|
|
@@ -12,5 +13,5 @@ type CallAppPrerenderStaticParamsOptions = {
|
|
|
12
13
|
};
|
|
13
14
|
declare function callAppPrerenderStaticParams(options: CallAppPrerenderStaticParamsOptions): Promise<unknown>;
|
|
14
15
|
//#endregion
|
|
15
|
-
export { callAppPrerenderStaticParams };
|
|
16
|
+
export { callAppPrerenderStaticParams, createAppPrerenderStaticParamsResolver };
|
|
16
17
|
//# sourceMappingURL=app-prerender-static-params.d.ts.map
|
|
@@ -1,14 +1,50 @@
|
|
|
1
|
-
import { pickRootParams,
|
|
1
|
+
import { pickRootParams, runWithRootParamsScope } from "../shims/root-params.js";
|
|
2
2
|
//#region src/server/app-prerender-static-params.ts
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
function isGenerateStaticParamsFunction(value) {
|
|
4
|
+
return typeof value === "function";
|
|
5
|
+
}
|
|
6
|
+
function isRootParams(value) {
|
|
7
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
8
|
+
}
|
|
9
|
+
function createAppPrerenderStaticParamsResolver(sources, rootParamNames) {
|
|
10
|
+
const generateStaticParamsFns = sources.filter(isGenerateStaticParamsFunction);
|
|
11
|
+
if (generateStaticParamsFns.length === 0) return null;
|
|
12
|
+
const filterRootParams = (params) => pickRootParams(params, rootParamNames ?? []);
|
|
13
|
+
if (generateStaticParamsFns.length === 1) {
|
|
14
|
+
const single = generateStaticParamsFns[0];
|
|
15
|
+
return async (input) => {
|
|
16
|
+
return runWithRootParamsScope(filterRootParams(input.params), async () => {
|
|
17
|
+
const result = await single(input);
|
|
18
|
+
if (!Array.isArray(result)) return [];
|
|
19
|
+
for (const item of result) if (!isRootParams(item)) return [];
|
|
20
|
+
return result;
|
|
21
|
+
});
|
|
22
|
+
};
|
|
9
23
|
}
|
|
24
|
+
return async ({ params }) => {
|
|
25
|
+
let paramSets = [params];
|
|
26
|
+
for (const generateStaticParams of generateStaticParamsFns) {
|
|
27
|
+
const nextParamSets = [];
|
|
28
|
+
for (const parentParams of paramSets) {
|
|
29
|
+
const result = await runWithRootParamsScope(filterRootParams(parentParams), async () => generateStaticParams({ params: parentParams }));
|
|
30
|
+
if (!Array.isArray(result)) return [];
|
|
31
|
+
for (const item of result) {
|
|
32
|
+
if (!isRootParams(item)) return [];
|
|
33
|
+
nextParamSets.push({
|
|
34
|
+
...parentParams,
|
|
35
|
+
...item
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
paramSets = nextParamSets;
|
|
40
|
+
}
|
|
41
|
+
return paramSets;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
async function callAppPrerenderStaticParams(options) {
|
|
45
|
+
return runWithRootParamsScope(pickRootParams(options.params, options.rootParamNamesByPattern[options.pattern]), () => options.fn({ params: options.params }));
|
|
10
46
|
}
|
|
11
47
|
//#endregion
|
|
12
|
-
export { callAppPrerenderStaticParams };
|
|
48
|
+
export { callAppPrerenderStaticParams, createAppPrerenderStaticParamsResolver };
|
|
13
49
|
|
|
14
50
|
//# sourceMappingURL=app-prerender-static-params.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-prerender-static-params.js","names":[],"sources":["../../src/server/app-prerender-static-params.ts"],"sourcesContent":["import { pickRootParams,
|
|
1
|
+
{"version":3,"file":"app-prerender-static-params.js","names":[],"sources":["../../src/server/app-prerender-static-params.ts"],"sourcesContent":["import { pickRootParams, runWithRootParamsScope, type RootParams } from \"vinext/shims/root-params\";\n\ntype GenerateStaticParamsFunction = (input: { params: RootParams }) => unknown;\n\nfunction isGenerateStaticParamsFunction(value: unknown): value is GenerateStaticParamsFunction {\n return typeof value === \"function\";\n}\n\nfunction isRootParams(value: unknown): value is RootParams {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nexport function createAppPrerenderStaticParamsResolver(\n sources: readonly unknown[],\n rootParamNames?: readonly string[],\n): GenerateStaticParamsFunction | null {\n const generateStaticParamsFns = sources.filter(isGenerateStaticParamsFunction);\n if (generateStaticParamsFns.length === 0) return null;\n\n const filterRootParams = (params: RootParams): RootParams =>\n pickRootParams(params, rootParamNames ?? []);\n\n if (generateStaticParamsFns.length === 1) {\n const single = generateStaticParamsFns[0];\n // Wrap the single source in the same non-array/non-object guards as the\n // multi-source composition path so the contract is uniform regardless of\n // how many sources were composed.\n return async (input) => {\n const picked = filterRootParams(input.params);\n return runWithRootParamsScope(picked, async () => {\n const result = await single(input);\n if (!Array.isArray(result)) return [];\n for (const item of result) {\n if (!isRootParams(item)) return [];\n }\n return result;\n });\n };\n }\n\n return async ({ params }) => {\n let paramSets: RootParams[] = [params];\n\n for (const generateStaticParams of generateStaticParamsFns) {\n const nextParamSets: RootParams[] = [];\n\n for (const parentParams of paramSets) {\n const rootScope = filterRootParams(parentParams);\n\n const result = await runWithRootParamsScope(rootScope, async () =>\n generateStaticParams({ params: parentParams }),\n );\n\n if (!Array.isArray(result)) return [];\n\n for (const item of result) {\n if (!isRootParams(item)) return [];\n nextParamSets.push({ ...parentParams, ...item });\n }\n }\n\n paramSets = nextParamSets;\n }\n\n return paramSets;\n };\n}\n\ntype CallAppPrerenderStaticParamsOptions = {\n fn: GenerateStaticParamsFunction;\n params: RootParams;\n pattern: string;\n rootParamNamesByPattern: Record<string, readonly string[] | undefined>;\n};\n\nexport async function callAppPrerenderStaticParams(\n options: CallAppPrerenderStaticParamsOptions,\n): Promise<unknown> {\n const picked = pickRootParams(options.params, options.rootParamNamesByPattern[options.pattern]);\n return runWithRootParamsScope(picked, () => options.fn({ params: options.params }));\n}\n"],"mappings":";;AAIA,SAAS,+BAA+B,OAAuD;CAC7F,OAAO,OAAO,UAAU;;AAG1B,SAAS,aAAa,OAAqC;CACzD,OAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,MAAM;;AAG7E,SAAgB,uCACd,SACA,gBACqC;CACrC,MAAM,0BAA0B,QAAQ,OAAO,+BAA+B;CAC9E,IAAI,wBAAwB,WAAW,GAAG,OAAO;CAEjD,MAAM,oBAAoB,WACxB,eAAe,QAAQ,kBAAkB,EAAE,CAAC;CAE9C,IAAI,wBAAwB,WAAW,GAAG;EACxC,MAAM,SAAS,wBAAwB;EAIvC,OAAO,OAAO,UAAU;GAEtB,OAAO,uBADQ,iBAAiB,MAAM,OACF,EAAE,YAAY;IAChD,MAAM,SAAS,MAAM,OAAO,MAAM;IAClC,IAAI,CAAC,MAAM,QAAQ,OAAO,EAAE,OAAO,EAAE;IACrC,KAAK,MAAM,QAAQ,QACjB,IAAI,CAAC,aAAa,KAAK,EAAE,OAAO,EAAE;IAEpC,OAAO;KACP;;;CAIN,OAAO,OAAO,EAAE,aAAa;EAC3B,IAAI,YAA0B,CAAC,OAAO;EAEtC,KAAK,MAAM,wBAAwB,yBAAyB;GAC1D,MAAM,gBAA8B,EAAE;GAEtC,KAAK,MAAM,gBAAgB,WAAW;IAGpC,MAAM,SAAS,MAAM,uBAFH,iBAAiB,aAEkB,EAAE,YACrD,qBAAqB,EAAE,QAAQ,cAAc,CAAC,CAC/C;IAED,IAAI,CAAC,MAAM,QAAQ,OAAO,EAAE,OAAO,EAAE;IAErC,KAAK,MAAM,QAAQ,QAAQ;KACzB,IAAI,CAAC,aAAa,KAAK,EAAE,OAAO,EAAE;KAClC,cAAc,KAAK;MAAE,GAAG;MAAc,GAAG;MAAM,CAAC;;;GAIpD,YAAY;;EAGd,OAAO;;;AAWX,eAAsB,6BACpB,SACkB;CAElB,OAAO,uBADQ,eAAe,QAAQ,QAAQ,QAAQ,wBAAwB,QAAQ,SAClD,QAAQ,QAAQ,GAAG,EAAE,QAAQ,QAAQ,QAAQ,CAAC,CAAC"}
|
|
@@ -24,8 +24,8 @@ type ReadAppRouteHandlerCacheOptions = {
|
|
|
24
24
|
isrRouteKey: (pathname: string) => string;
|
|
25
25
|
isrSet: RouteHandlerCacheSetter;
|
|
26
26
|
markDynamicUsage: MarkAppRouteDynamicUsageFn;
|
|
27
|
-
middlewareContext: RouteHandlerMiddlewareContext;
|
|
28
|
-
params: AppRouteParams;
|
|
27
|
+
middlewareContext: RouteHandlerMiddlewareContext; /** `null` for non-dynamic routes. See `AppRouteHandlerFunction` for details. */
|
|
28
|
+
params: AppRouteParams | null;
|
|
29
29
|
requestUrl: string;
|
|
30
30
|
revalidateSearchParams: URLSearchParams;
|
|
31
31
|
expireSeconds?: number;
|
|
@@ -3,6 +3,7 @@ import { markKnownDynamicAppRoute } from "./app-route-handler-runtime.js";
|
|
|
3
3
|
import { applyRouteHandlerMiddlewareContext, assertSupportedAppRouteHandlerResponse, buildAppRouteCacheValue, buildRouteHandlerCachedResponse } from "./app-route-handler-response.js";
|
|
4
4
|
import { runAppRouteHandler } from "./app-route-handler-execution.js";
|
|
5
5
|
//#region src/server/app-route-handler-cache.ts
|
|
6
|
+
const EMPTY_PARAMS = Object.freeze({});
|
|
6
7
|
function getCachedAppRouteValue(entry) {
|
|
7
8
|
return entry?.value.value && entry.value.value.kind === "APP_ROUTE" ? entry.value.value : null;
|
|
8
9
|
}
|
|
@@ -30,7 +31,7 @@ async function readAppRouteHandlerCacheResponse(options) {
|
|
|
30
31
|
options.setNavigationContext({
|
|
31
32
|
pathname: options.cleanPathname,
|
|
32
33
|
searchParams: revalidateSearchParams,
|
|
33
|
-
params: options.params
|
|
34
|
+
params: options.params ?? EMPTY_PARAMS
|
|
34
35
|
});
|
|
35
36
|
const { dynamicUsedInHandler, response } = await runAppRouteHandler({
|
|
36
37
|
basePath: options.basePath,
|
|
@@ -39,7 +40,7 @@ async function readAppRouteHandlerCacheResponse(options) {
|
|
|
39
40
|
handlerFn: options.handlerFn,
|
|
40
41
|
i18n: options.i18n,
|
|
41
42
|
markDynamicUsage: options.markDynamicUsage,
|
|
42
|
-
params: makeThenableParams(options.params),
|
|
43
|
+
params: options.params === null ? null : makeThenableParams(options.params),
|
|
43
44
|
request: new Request(options.requestUrl, { method: "GET" }),
|
|
44
45
|
routePattern: options.routePattern,
|
|
45
46
|
setHeadersAccessPhase: options.setHeadersAccessPhase
|