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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-browser-visible-commit.js","names":["_exhaustive"],"sources":["../../src/server/app-browser-visible-commit.ts"],"sourcesContent":["import type { ClientNavigationRenderSnapshot } from \"vinext/shims/navigation\";\nimport { mergeElements } from \"vinext/shims/slot\";\nimport type { AppElements } from \"./app-elements.js\";\nimport {\n createPendingNavigationCommit,\n resolvePendingNavigationCommitDispositionDecision,\n type AppRouterAction,\n type AppRouterState,\n type CommittedOperationRecord,\n type OperationLane,\n type PendingNavigationCommit,\n type PendingOperationRecord,\n} from \"./app-browser-state.js\";\nimport {\n NavigationTraceReasonCodes,\n NavigationTraceTransactionCodes,\n createNavigationTrace,\n prependNavigationTraceEntry,\n type NavigationTrace,\n type NavigationTraceFields,\n type NavigationTraceTransactionCode,\n} from \"./navigation-trace.js\";\n\ntype VisibleCommitDecision = {\n disposition: \"commit\";\n preserveAbsentSlots: boolean;\n preserveElementIds: readonly string[];\n trace: NavigationTrace;\n};\ntype HardNavigateCommitDecision = {\n disposition: \"hard-navigate\";\n trace: NavigationTrace;\n};\ntype NoCommitDecision = {\n disposition: \"no-commit\";\n trace: NavigationTrace;\n};\ntype CommitDecision = VisibleCommitDecision | HardNavigateCommitDecision | NoCommitDecision;\nconst approvedVisibleCommitBrand: unique symbol = Symbol(\"ApprovedVisibleCommit\");\nexport type ApprovedVisibleCommit = {\n readonly [approvedVisibleCommitBrand]: true;\n readonly action: AppRouterAction;\n readonly decision: VisibleCommitDecision;\n readonly interceptionContext: string | null;\n readonly previousNextUrl: string | null;\n readonly rootLayoutTreePath: string | null;\n readonly routeId: string;\n};\ntype VisibleCommitApproval = {\n approvedCommit: ApprovedVisibleCommit;\n decision: VisibleCommitDecision;\n};\ntype NonVisibleCommitApproval = {\n approvedCommit: null;\n decision: HardNavigateCommitDecision | NoCommitDecision;\n};\ntype CommitApproval = VisibleCommitApproval | NonVisibleCommitApproval;\ntype ClassifiedPendingNavigationCommit = {\n approvedCommit: ApprovedVisibleCommit | null;\n decision: CommitDecision;\n pending: PendingNavigationCommit;\n trace: NavigationTrace;\n};\n\nexport function applyApprovedVisibleCommit(\n state: AppRouterState,\n commit: ApprovedVisibleCommit,\n): AppRouterState {\n assertApprovedVisibleCommit(commit);\n return reduceApprovedVisibleCommitState(state, commit);\n}\n\nfunction assertApprovedVisibleCommit(commit: ApprovedVisibleCommit): void {\n if (commit[approvedVisibleCommitBrand] !== true) {\n throw new Error(\"[vinext] Visible router state mutation requires ApprovedVisibleCommit\");\n }\n}\n\nfunction commitOperationRecord(\n operation: PendingOperationRecord,\n visibleCommitVersion: number,\n): CommittedOperationRecord {\n return {\n id: operation.id,\n lane: operation.lane,\n startedVisibleCommitVersion: operation.startedVisibleCommitVersion,\n state: \"committed\",\n visibleCommitVersion,\n };\n}\n\nfunction commitVisibleRouterState(\n state: AppRouterState,\n nextState: Omit<AppRouterState, \"activeOperation\" | \"visibleCommitVersion\">,\n operation: PendingOperationRecord,\n): AppRouterState {\n // Single owner for visibleCommitVersion: only an ApprovedVisibleCommit may\n // advance it, and every accepted visible mutation advances it exactly once.\n const visibleCommitVersion = state.visibleCommitVersion + 1;\n return {\n ...nextState,\n activeOperation: commitOperationRecord(operation, visibleCommitVersion),\n visibleCommitVersion,\n };\n}\n\nfunction reduceApprovedVisibleCommitState(\n state: AppRouterState,\n commit: ApprovedVisibleCommit,\n): AppRouterState {\n const { action } = commit;\n switch (action.type) {\n case \"traverse\":\n case \"navigate\":\n return commitVisibleRouterState(\n state,\n {\n elements: mergeElements(state.elements, action.elements, {\n clearAbsentSlots: action.type === \"traverse\",\n preserveAbsentSlots: commit.decision.preserveAbsentSlots,\n preserveElementIds: commit.decision.preserveElementIds,\n }),\n interceptionContext: action.interceptionContext,\n layoutFlags: mergeLayoutFlags(\n state.layoutFlags,\n action.layoutFlags,\n commit.decision.preserveElementIds,\n ),\n layoutIds: action.layoutIds,\n navigationSnapshot: action.navigationSnapshot,\n previousNextUrl: action.previousNextUrl,\n renderId: action.renderId,\n rootLayoutTreePath: action.rootLayoutTreePath,\n routeId: action.routeId,\n },\n action.operation,\n );\n case \"replace\":\n return commitVisibleRouterState(\n state,\n {\n elements: action.elements,\n interceptionContext: action.interceptionContext,\n layoutFlags: action.layoutFlags,\n layoutIds: action.layoutIds,\n navigationSnapshot: action.navigationSnapshot,\n previousNextUrl: action.previousNextUrl,\n renderId: action.renderId,\n rootLayoutTreePath: action.rootLayoutTreePath,\n routeId: action.routeId,\n },\n action.operation,\n );\n default: {\n const _exhaustive: never = action.type;\n throw new Error(\"[vinext] Unknown router action: \" + String(_exhaustive));\n }\n }\n}\n\nfunction resolvePendingNavigationCommitDecision(options: {\n activeNavigationId: number;\n currentState: AppRouterState;\n pending: PendingNavigationCommit;\n startedNavigationId: number;\n targetHref: string;\n}): CommitDecision {\n const decision = resolvePendingNavigationCommitDispositionDecision(options);\n\n switch (decision.disposition) {\n case \"skip\":\n return { disposition: \"no-commit\", trace: decision.trace };\n case \"hard-navigate\":\n return { disposition: \"hard-navigate\", trace: decision.trace };\n case \"dispatch\":\n return createVisibleCommitDecision(\n decision.trace,\n decision.preserveElementIds,\n decision.preserveAbsentSlots,\n );\n default: {\n const _exhaustive: never = decision;\n throw new Error(\"[vinext] Unknown navigation commit disposition: \" + String(_exhaustive));\n }\n }\n}\n\nfunction createVisibleCommitDecision(\n trace: NavigationTrace = createNavigationTrace(NavigationTraceReasonCodes.commitCurrent),\n preserveElementIds: readonly string[] = [],\n preserveAbsentSlots: boolean = false,\n): VisibleCommitDecision {\n return {\n disposition: \"commit\",\n preserveAbsentSlots,\n preserveElementIds: [...preserveElementIds],\n trace,\n };\n}\n\nfunction mergeLayoutFlags(\n previousFlags: AppRouterState[\"layoutFlags\"],\n nextFlags: AppRouterState[\"layoutFlags\"],\n preserveElementIds: readonly string[],\n): AppRouterState[\"layoutFlags\"] {\n const merged: Record<string, \"s\" | \"d\"> = { ...nextFlags };\n for (const id of preserveElementIds) {\n if (Object.hasOwn(merged, id)) continue;\n const value = previousFlags[id];\n if (value) merged[id] = value;\n }\n return merged;\n}\n\nfunction createApprovedVisibleCommit(options: {\n decision: VisibleCommitDecision;\n pending: PendingNavigationCommit;\n}): ApprovedVisibleCommit {\n return {\n [approvedVisibleCommitBrand]: true,\n action: options.pending.action,\n decision: options.decision,\n interceptionContext: options.pending.interceptionContext,\n previousNextUrl: options.pending.previousNextUrl,\n rootLayoutTreePath: options.pending.rootLayoutTreePath,\n routeId: options.pending.routeId,\n };\n}\n\nfunction createCommitTransactionFields(pending: PendingNavigationCommit): NavigationTraceFields {\n return {\n operationLane: pending.action.operation.lane,\n pendingOperationId: pending.action.operation.id,\n startedVisibleCommitVersion: pending.action.operation.startedVisibleCommitVersion,\n };\n}\n\nfunction prependCommitTransactionTrace(\n trace: NavigationTrace,\n code: NavigationTraceTransactionCode,\n pending: PendingNavigationCommit,\n): NavigationTrace {\n return prependNavigationTraceEntry(trace, code, createCommitTransactionFields(pending));\n}\n\nfunction addCommitTransactionTrace(\n decision: CommitDecision,\n pending: PendingNavigationCommit,\n): CommitDecision {\n switch (decision.disposition) {\n case \"commit\":\n return {\n ...decision,\n trace: prependCommitTransactionTrace(\n decision.trace,\n NavigationTraceTransactionCodes.visibleCommit,\n pending,\n ),\n };\n case \"hard-navigate\":\n return {\n ...decision,\n trace: prependCommitTransactionTrace(\n decision.trace,\n NavigationTraceTransactionCodes.hardNavigate,\n pending,\n ),\n };\n case \"no-commit\":\n return {\n ...decision,\n trace: prependCommitTransactionTrace(\n decision.trace,\n NavigationTraceTransactionCodes.noCommit,\n pending,\n ),\n };\n default: {\n const _exhaustive: never = decision;\n throw new Error(\"[vinext] Unknown commit decision: \" + String(_exhaustive));\n }\n }\n}\n\nexport function approveHmrVisibleCommit(pending: PendingNavigationCommit): ApprovedVisibleCommit {\n if (pending.action.operation.lane !== \"hmr\") {\n throw new Error(\"[vinext] HMR visible commit approval requires an HMR pending operation\");\n }\n\n const decision = addCommitTransactionTrace(createVisibleCommitDecision(), pending);\n // This guard is a type narrowing assertion: createVisibleCommitDecision()\n // structurally produces a commit decision, and addCommitTransactionTrace()\n // must preserve that disposition while adding operator trace context.\n if (decision.disposition !== \"commit\") {\n throw new Error(\"[vinext] HMR visible commit approval did not produce a commit decision\");\n }\n\n return createApprovedVisibleCommit({\n decision,\n pending,\n });\n}\n\nexport function approvePendingNavigationCommit(options: {\n activeNavigationId: number;\n currentState: AppRouterState;\n pending: PendingNavigationCommit;\n startedNavigationId: number;\n targetHref: string;\n}): CommitApproval {\n const decision = addCommitTransactionTrace(\n resolvePendingNavigationCommitDecision({\n activeNavigationId: options.activeNavigationId,\n currentState: options.currentState,\n pending: options.pending,\n startedNavigationId: options.startedNavigationId,\n targetHref: options.targetHref,\n }),\n options.pending,\n );\n\n switch (decision.disposition) {\n case \"commit\":\n return {\n approvedCommit: createApprovedVisibleCommit({\n decision,\n pending: options.pending,\n }),\n decision,\n };\n case \"hard-navigate\":\n case \"no-commit\":\n return {\n approvedCommit: null,\n decision,\n };\n default: {\n const _exhaustive: never = decision;\n throw new Error(\"[vinext] Unknown commit decision: \" + String(_exhaustive));\n }\n }\n}\n\nexport async function resolveAndClassifyNavigationCommit(options: {\n activeNavigationId: number;\n currentState: AppRouterState;\n // When provided, these getters are called after awaiting nextElements so\n // approval uses the latest lifecycle authority instead of the call snapshot.\n getActiveNavigationId?: () => number;\n getCurrentStateForApproval?: () => AppRouterState;\n navigationSnapshot: ClientNavigationRenderSnapshot;\n nextElements: Promise<AppElements>;\n operationLane: OperationLane;\n previousNextUrl?: string | null;\n renderId: number;\n startedNavigationId: number;\n targetHref: string;\n type: \"navigate\" | \"replace\" | \"traverse\";\n}): Promise<ClassifiedPendingNavigationCommit> {\n const pending = await createPendingNavigationCommit({\n currentState: options.currentState,\n nextElements: options.nextElements,\n navigationSnapshot: options.navigationSnapshot,\n operationLane: options.operationLane,\n previousNextUrl: options.previousNextUrl,\n renderId: options.renderId,\n type: options.type,\n });\n\n const approvalState = options.getCurrentStateForApproval?.() ?? options.currentState;\n const approval = approvePendingNavigationCommit({\n activeNavigationId: options.getActiveNavigationId?.() ?? options.activeNavigationId,\n currentState: approvalState,\n pending,\n startedNavigationId: options.startedNavigationId,\n targetHref: options.targetHref,\n });\n\n return {\n approvedCommit: approval.approvedCommit,\n decision: approval.decision,\n pending,\n trace: approval.decision.trace,\n };\n}\n"],"mappings":";;;;AAsCA,MAAM,6BAA4C,OAAO,wBAAwB;AA0BjF,SAAgB,2BACd,OACA,QACgB;CAChB,4BAA4B,OAAO;CACnC,OAAO,iCAAiC,OAAO,OAAO;;AAGxD,SAAS,4BAA4B,QAAqC;CACxE,IAAI,OAAO,gCAAgC,MACzC,MAAM,IAAI,MAAM,wEAAwE;;AAI5F,SAAS,sBACP,WACA,sBAC0B;CAC1B,OAAO;EACL,IAAI,UAAU;EACd,MAAM,UAAU;EAChB,6BAA6B,UAAU;EACvC,OAAO;EACP;EACD;;AAGH,SAAS,yBACP,OACA,WACA,WACgB;CAGhB,MAAM,uBAAuB,MAAM,uBAAuB;CAC1D,OAAO;EACL,GAAG;EACH,iBAAiB,sBAAsB,WAAW,qBAAqB;EACvE;EACD;;AAGH,SAAS,iCACP,OACA,QACgB;CAChB,MAAM,EAAE,WAAW;CACnB,QAAQ,OAAO,MAAf;EACE,KAAK;EACL,KAAK,YACH,OAAO,yBACL,OACA;GACE,UAAU,cAAc,MAAM,UAAU,OAAO,UAAU;IACvD,kBAAkB,OAAO,SAAS;IAClC,qBAAqB,OAAO,SAAS;IACrC,oBAAoB,OAAO,SAAS;IACrC,CAAC;GACF,qBAAqB,OAAO;GAC5B,aAAa,iBACX,MAAM,aACN,OAAO,aACP,OAAO,SAAS,mBACjB;GACD,WAAW,OAAO;GAClB,oBAAoB,OAAO;GAC3B,iBAAiB,OAAO;GACxB,UAAU,OAAO;GACjB,oBAAoB,OAAO;GAC3B,SAAS,OAAO;GACjB,EACD,OAAO,UACR;EACH,KAAK,WACH,OAAO,yBACL,OACA;GACE,UAAU,OAAO;GACjB,qBAAqB,OAAO;GAC5B,aAAa,OAAO;GACpB,WAAW,OAAO;GAClB,oBAAoB,OAAO;GAC3B,iBAAiB,OAAO;GACxB,UAAU,OAAO;GACjB,oBAAoB,OAAO;GAC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B,oBAAoB,QAAQ;EAC5B,eAAe,QAAQ;EACvB,iBAAiB,QAAQ;EACzB,UAAU,QAAQ;EAClB,MAAM,QAAQ;EACf,CAAC;CAEF,MAAM,gBAAgB,QAAQ,8BAA8B,IAAI,QAAQ;CACxE,MAAM,WAAW,+BAA+B;EAC9C,oBAAoB,QAAQ,yBAAyB,IAAI,QAAQ;EACjE,cAAc;EACd;EACA,qBAAqB,QAAQ;EAC7B,YAAY,QAAQ;EACrB,CAAC;CAEF,OAAO;EACL,gBAAgB,SAAS;EACzB,UAAU,SAAS;EACnB;EACA,OAAO,SAAS,SAAS;EAC1B"}
|
|
1
|
+
{"version":3,"file":"app-browser-visible-commit.js","names":["_exhaustive"],"sources":["../../src/server/app-browser-visible-commit.ts"],"sourcesContent":["import type { ClientNavigationRenderSnapshot } from \"vinext/shims/navigation\";\nimport type { RouteManifest } from \"../routing/app-route-graph.js\";\nimport { mergeElements } from \"vinext/shims/slot\";\nimport {\n normalizeAppElementsSlotBindings,\n type AppElements,\n type AppElementsSlotBinding,\n} from \"./app-elements.js\";\nimport {\n createPendingNavigationCommit,\n resolvePendingNavigationCommitDispositionDecision,\n type AppNavigationPayloadOrigin,\n type AppRouterAction,\n type AppRouterState,\n type CommittedOperationRecord,\n type OperationLane,\n type PendingNavigationCommit,\n type PendingOperationRecord,\n} from \"./app-browser-state.js\";\nimport {\n NavigationTraceReasonCodes,\n NavigationTraceTransactionCodes,\n createNavigationTrace,\n prependNavigationTraceEntry,\n type NavigationTrace,\n type NavigationTraceFields,\n type NavigationTraceTransactionCode,\n} from \"./navigation-trace.js\";\n\ntype VisibleCommitDecision = {\n disposition: \"commit\";\n preserveAbsentSlots: boolean;\n preserveElementIds: readonly string[];\n preservePreviousSlotIds: readonly string[];\n trace: NavigationTrace;\n};\ntype HardNavigateCommitDecision = {\n disposition: \"hard-navigate\";\n trace: NavigationTrace;\n};\ntype NoCommitDecision = {\n disposition: \"no-commit\";\n trace: NavigationTrace;\n};\ntype CommitDecision = VisibleCommitDecision | HardNavigateCommitDecision | NoCommitDecision;\nconst approvedVisibleCommitBrand: unique symbol = Symbol(\"ApprovedVisibleCommit\");\nexport type ApprovedVisibleCommit = {\n readonly [approvedVisibleCommitBrand]: true;\n readonly action: AppRouterAction;\n readonly decision: VisibleCommitDecision;\n readonly interception: AppRouterAction[\"interception\"];\n readonly interceptionContext: string | null;\n readonly previousNextUrl: string | null;\n readonly rootLayoutTreePath: string | null;\n readonly routeId: string;\n};\ntype VisibleCommitApproval = {\n approvedCommit: ApprovedVisibleCommit;\n decision: VisibleCommitDecision;\n};\ntype NonVisibleCommitApproval = {\n approvedCommit: null;\n decision: HardNavigateCommitDecision | NoCommitDecision;\n};\ntype CommitApproval = VisibleCommitApproval | NonVisibleCommitApproval;\ntype ClassifiedPendingNavigationCommit = {\n approvedCommit: ApprovedVisibleCommit | null;\n decision: CommitDecision;\n pending: PendingNavigationCommit;\n trace: NavigationTrace;\n};\n\nexport function applyApprovedVisibleCommit(\n state: AppRouterState,\n commit: ApprovedVisibleCommit,\n): AppRouterState {\n assertApprovedVisibleCommit(commit);\n return reduceApprovedVisibleCommitState(state, commit);\n}\n\nfunction assertApprovedVisibleCommit(commit: ApprovedVisibleCommit): void {\n if (commit[approvedVisibleCommitBrand] !== true) {\n throw new Error(\"[vinext] Visible router state mutation requires ApprovedVisibleCommit\");\n }\n}\n\nfunction commitOperationRecord(\n operation: PendingOperationRecord,\n visibleCommitVersion: number,\n): CommittedOperationRecord {\n return {\n id: operation.id,\n lane: operation.lane,\n startedVisibleCommitVersion: operation.startedVisibleCommitVersion,\n state: \"committed\",\n visibleCommitVersion,\n };\n}\n\nfunction commitVisibleRouterState(\n state: AppRouterState,\n nextState: Omit<AppRouterState, \"activeOperation\" | \"visibleCommitVersion\">,\n operation: PendingOperationRecord,\n): AppRouterState {\n // Single owner for visibleCommitVersion: only an ApprovedVisibleCommit may\n // advance it, and every accepted visible mutation advances it exactly once.\n const visibleCommitVersion = state.visibleCommitVersion + 1;\n return {\n ...nextState,\n activeOperation: commitOperationRecord(operation, visibleCommitVersion),\n visibleCommitVersion,\n };\n}\n\nfunction mergeSlotBindings(\n previousBindings: readonly AppElementsSlotBinding[],\n nextBindings: readonly AppElementsSlotBinding[],\n layoutIds: readonly string[],\n preservePreviousSlotIds: readonly string[],\n): readonly AppElementsSlotBinding[] {\n if (preservePreviousSlotIds.length === 0) return nextBindings;\n\n const preservedSlotIds = new Set(preservePreviousSlotIds);\n const previousBindingsBySlotId = new Map<string, AppElementsSlotBinding>();\n for (const binding of previousBindings) {\n if (!preservedSlotIds.has(binding.slotId)) continue;\n previousBindingsBySlotId.set(binding.slotId, binding);\n }\n\n const mergedBindings: AppElementsSlotBinding[] = [];\n const seenSlotIds = new Set<string>();\n for (const binding of nextBindings) {\n const previousBinding = previousBindingsBySlotId.get(binding.slotId);\n mergedBindings.push(previousBinding ?? binding);\n seenSlotIds.add(binding.slotId);\n }\n for (const slotId of preservePreviousSlotIds) {\n if (seenSlotIds.has(slotId)) continue;\n const previousBinding = previousBindingsBySlotId.get(slotId);\n if (previousBinding) mergedBindings.push(previousBinding);\n }\n return normalizeAppElementsSlotBindings(mergedBindings, { layoutIds });\n}\n\nfunction reduceApprovedVisibleCommitState(\n state: AppRouterState,\n commit: ApprovedVisibleCommit,\n): AppRouterState {\n const { action } = commit;\n switch (action.type) {\n case \"traverse\":\n case \"navigate\":\n return commitVisibleRouterState(\n state,\n {\n elements: mergeElements(state.elements, action.elements, {\n clearAbsentSlots: action.type === \"traverse\",\n preserveAbsentSlots: commit.decision.preserveAbsentSlots,\n preserveElementIds: commit.decision.preserveElementIds,\n preservePreviousSlotIds: commit.decision.preservePreviousSlotIds,\n }),\n interception: action.interception,\n interceptionContext: action.interceptionContext,\n layoutFlags: mergeLayoutFlags(\n state.layoutFlags,\n action.layoutFlags,\n commit.decision.preserveElementIds,\n ),\n layoutIds: action.layoutIds,\n navigationSnapshot: action.navigationSnapshot,\n previousNextUrl: action.previousNextUrl,\n renderId: action.renderId,\n rootLayoutTreePath: action.rootLayoutTreePath,\n routeId: action.routeId,\n slotBindings: mergeSlotBindings(\n state.slotBindings,\n action.slotBindings,\n action.layoutIds,\n commit.decision.preservePreviousSlotIds,\n ),\n },\n action.operation,\n );\n case \"replace\":\n return commitVisibleRouterState(\n state,\n {\n elements: action.elements,\n interception: action.interception,\n interceptionContext: action.interceptionContext,\n layoutFlags: action.layoutFlags,\n layoutIds: action.layoutIds,\n navigationSnapshot: action.navigationSnapshot,\n previousNextUrl: action.previousNextUrl,\n renderId: action.renderId,\n rootLayoutTreePath: action.rootLayoutTreePath,\n routeId: action.routeId,\n slotBindings: action.slotBindings,\n },\n action.operation,\n );\n default: {\n const _exhaustive: never = action.type;\n throw new Error(\"[vinext] Unknown router action: \" + String(_exhaustive));\n }\n }\n}\n\nfunction resolvePendingNavigationCommitDecision(options: {\n activeNavigationId: number;\n currentState: AppRouterState;\n pending: PendingNavigationCommit;\n routeManifest?: RouteManifest | null;\n startedNavigationId: number;\n targetHref: string;\n}): CommitDecision {\n const decision = resolvePendingNavigationCommitDispositionDecision(options);\n\n switch (decision.disposition) {\n case \"skip\":\n return { disposition: \"no-commit\", trace: decision.trace };\n case \"hard-navigate\":\n return { disposition: \"hard-navigate\", trace: decision.trace };\n case \"dispatch\":\n return createVisibleCommitDecision(\n decision.trace,\n decision.preserveElementIds,\n decision.preserveAbsentSlots,\n decision.preservePreviousSlotIds,\n );\n default: {\n const _exhaustive: never = decision;\n throw new Error(\"[vinext] Unknown navigation commit disposition: \" + String(_exhaustive));\n }\n }\n}\n\nfunction createVisibleCommitDecision(\n trace: NavigationTrace = createNavigationTrace(NavigationTraceReasonCodes.commitCurrent),\n preserveElementIds: readonly string[] = [],\n preserveAbsentSlots: boolean = false,\n preservePreviousSlotIds: readonly string[] = [],\n): VisibleCommitDecision {\n return {\n disposition: \"commit\",\n preserveAbsentSlots,\n preserveElementIds: [...preserveElementIds],\n preservePreviousSlotIds: [...preservePreviousSlotIds],\n trace,\n };\n}\n\nfunction mergeLayoutFlags(\n previousFlags: AppRouterState[\"layoutFlags\"],\n nextFlags: AppRouterState[\"layoutFlags\"],\n preserveElementIds: readonly string[],\n): AppRouterState[\"layoutFlags\"] {\n const merged: Record<string, \"s\" | \"d\"> = { ...nextFlags };\n for (const id of preserveElementIds) {\n if (Object.hasOwn(merged, id)) continue;\n const value = previousFlags[id];\n if (value) merged[id] = value;\n }\n return merged;\n}\n\nfunction createApprovedVisibleCommit(options: {\n decision: VisibleCommitDecision;\n pending: PendingNavigationCommit;\n}): ApprovedVisibleCommit {\n return {\n [approvedVisibleCommitBrand]: true,\n action: options.pending.action,\n decision: options.decision,\n interception: options.pending.interception,\n interceptionContext: options.pending.interceptionContext,\n previousNextUrl: options.pending.previousNextUrl,\n rootLayoutTreePath: options.pending.rootLayoutTreePath,\n routeId: options.pending.routeId,\n };\n}\n\nfunction createCommitTransactionFields(pending: PendingNavigationCommit): NavigationTraceFields {\n return {\n operationLane: pending.action.operation.lane,\n pendingOperationId: pending.action.operation.id,\n startedVisibleCommitVersion: pending.action.operation.startedVisibleCommitVersion,\n };\n}\n\nfunction prependCommitTransactionTrace(\n trace: NavigationTrace,\n code: NavigationTraceTransactionCode,\n pending: PendingNavigationCommit,\n): NavigationTrace {\n return prependNavigationTraceEntry(trace, code, createCommitTransactionFields(pending));\n}\n\nfunction addCommitTransactionTrace(\n decision: CommitDecision,\n pending: PendingNavigationCommit,\n): CommitDecision {\n switch (decision.disposition) {\n case \"commit\":\n return {\n ...decision,\n trace: prependCommitTransactionTrace(\n decision.trace,\n NavigationTraceTransactionCodes.visibleCommit,\n pending,\n ),\n };\n case \"hard-navigate\":\n return {\n ...decision,\n trace: prependCommitTransactionTrace(\n decision.trace,\n NavigationTraceTransactionCodes.hardNavigate,\n pending,\n ),\n };\n case \"no-commit\":\n return {\n ...decision,\n trace: prependCommitTransactionTrace(\n decision.trace,\n NavigationTraceTransactionCodes.noCommit,\n pending,\n ),\n };\n default: {\n const _exhaustive: never = decision;\n throw new Error(\"[vinext] Unknown commit decision: \" + String(_exhaustive));\n }\n }\n}\n\nexport function approveHmrVisibleCommit(pending: PendingNavigationCommit): ApprovedVisibleCommit {\n if (pending.action.operation.lane !== \"hmr\") {\n throw new Error(\"[vinext] HMR visible commit approval requires an HMR pending operation\");\n }\n\n const decision = addCommitTransactionTrace(createVisibleCommitDecision(), pending);\n // This guard is a type narrowing assertion: createVisibleCommitDecision()\n // structurally produces a commit decision, and addCommitTransactionTrace()\n // must preserve that disposition while adding operator trace context.\n if (decision.disposition !== \"commit\") {\n throw new Error(\"[vinext] HMR visible commit approval did not produce a commit decision\");\n }\n\n return createApprovedVisibleCommit({\n decision,\n pending,\n });\n}\n\nexport function approvePendingNavigationCommit(options: {\n activeNavigationId: number;\n currentState: AppRouterState;\n pending: PendingNavigationCommit;\n routeManifest?: RouteManifest | null;\n startedNavigationId: number;\n targetHref: string;\n}): CommitApproval {\n const decision = addCommitTransactionTrace(\n resolvePendingNavigationCommitDecision({\n activeNavigationId: options.activeNavigationId,\n currentState: options.currentState,\n pending: options.pending,\n routeManifest: options.routeManifest ?? null,\n startedNavigationId: options.startedNavigationId,\n targetHref: options.targetHref,\n }),\n options.pending,\n );\n\n switch (decision.disposition) {\n case \"commit\":\n return {\n approvedCommit: createApprovedVisibleCommit({\n decision,\n pending: options.pending,\n }),\n decision,\n };\n case \"hard-navigate\":\n case \"no-commit\":\n return {\n approvedCommit: null,\n decision,\n };\n default: {\n const _exhaustive: never = decision;\n throw new Error(\"[vinext] Unknown commit decision: \" + String(_exhaustive));\n }\n }\n}\n\nexport async function resolveAndClassifyNavigationCommit(options: {\n activeNavigationId: number;\n currentState: AppRouterState;\n // When provided, these getters are called after awaiting nextElements so\n // approval uses the latest lifecycle authority instead of the call snapshot.\n getActiveNavigationId?: () => number;\n getCurrentStateForApproval?: () => AppRouterState;\n navigationSnapshot: ClientNavigationRenderSnapshot;\n nextElements: Promise<AppElements>;\n operationLane: OperationLane;\n payloadOrigin: AppNavigationPayloadOrigin;\n previousNextUrl?: string | null;\n renderId: number;\n routeManifest?: RouteManifest | null;\n startedNavigationId: number;\n targetHref: string;\n type: \"navigate\" | \"replace\" | \"traverse\";\n}): Promise<ClassifiedPendingNavigationCommit> {\n const pending = await createPendingNavigationCommit({\n currentState: options.currentState,\n nextElements: options.nextElements,\n navigationSnapshot: options.navigationSnapshot,\n operationLane: options.operationLane,\n payloadOrigin: options.payloadOrigin,\n previousNextUrl: options.previousNextUrl,\n renderId: options.renderId,\n type: options.type,\n });\n\n const approvalState = options.getCurrentStateForApproval?.() ?? options.currentState;\n const approval = approvePendingNavigationCommit({\n activeNavigationId: options.getActiveNavigationId?.() ?? options.activeNavigationId,\n currentState: approvalState,\n pending,\n routeManifest: options.routeManifest ?? null,\n startedNavigationId: options.startedNavigationId,\n targetHref: options.targetHref,\n });\n\n return {\n approvedCommit: approval.approvedCommit,\n decision: approval.decision,\n pending,\n trace: approval.decision.trace,\n };\n}\n"],"mappings":";;;;;;AA6CA,MAAM,6BAA4C,OAAO,wBAAwB;AA2BjF,SAAgB,2BACd,OACA,QACgB;CAChB,4BAA4B,OAAO;CACnC,OAAO,iCAAiC,OAAO,OAAO;;AAGxD,SAAS,4BAA4B,QAAqC;CACxE,IAAI,OAAO,gCAAgC,MACzC,MAAM,IAAI,MAAM,wEAAwE;;AAI5F,SAAS,sBACP,WACA,sBAC0B;CAC1B,OAAO;EACL,IAAI,UAAU;EACd,MAAM,UAAU;EAChB,6BAA6B,UAAU;EACvC,OAAO;EACP;EACD;;AAGH,SAAS,yBACP,OACA,WACA,WACgB;CAGhB,MAAM,uBAAuB,MAAM,uBAAuB;CAC1D,OAAO;EACL,GAAG;EACH,iBAAiB,sBAAsB,WAAW,qBAAqB;EACvE;EACD;;AAGH,SAAS,kBACP,kBACA,cACA,WACA,yBACmC;CACnC,IAAI,wBAAwB,WAAW,GAAG,OAAO;CAEjD,MAAM,mBAAmB,IAAI,IAAI,wBAAwB;CACzD,MAAM,2CAA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AC1C;IACA,SAAS,QAAQ;IAClB,CAAC;GACF;GACD;EACH,KAAK;EACL,KAAK,aACH,OAAO;GACL,gBAAgB;GAChB;GACD;EACH,SAEE,MAAM,IAAI,MAAM,uCAAuC,OAAOA,SAAY,CAAC;;;AAKjF,eAAsB,mCAAmC,SAiBV;CAC7C,MAAM,UAAU,MAAM,8BAA8B;EAClD,cAAc,QAAQ;EACtB,cAAc,QAAQ;EACtB,oBAAoB,QAAQ;EAC5B,eAAe,QAAQ;EACvB,eAAe,QAAQ;EACvB,iBAAiB,QAAQ;EACzB,UAAU,QAAQ;EAClB,MAAM,QAAQ;EACf,CAAC;CAEF,MAAM,gBAAgB,QAAQ,8BAA8B,IAAI,QAAQ;CACxE,MAAM,WAAW,+BAA+B;EAC9C,oBAAoB,QAAQ,yBAAyB,IAAI,QAAQ;EACjE,cAAc;EACd;EACA,eAAe,QAAQ,iBAAiB;EACxC,qBAAqB,QAAQ;EAC7B,YAAY,QAAQ;EACrB,CAAC;CAEF,OAAO;EACL,gBAAgB,SAAS;EACzB,UAAU,SAAS;EACnB;EACA,OAAO,SAAS,SAAS;EAC1B"}
|
|
@@ -1,17 +1,39 @@
|
|
|
1
1
|
import { ArtifactCompatibilityEnvelope } from "./artifact-compatibility.js";
|
|
2
|
+
import { CacheEntryReuseProof, RenderObservation } from "./cache-proof.js";
|
|
2
3
|
import { ReactNode } from "react";
|
|
3
4
|
|
|
4
5
|
//#region src/server/app-elements-wire.d.ts
|
|
5
6
|
declare const APP_ARTIFACT_COMPATIBILITY_KEY = "__artifactCompatibility";
|
|
7
|
+
declare const APP_CACHE_ENTRY_REUSE_PROOF_KEY = "__cacheEntryReuseProof";
|
|
8
|
+
declare const APP_INTERCEPTION_KEY = "__interception";
|
|
6
9
|
declare const APP_INTERCEPTION_CONTEXT_KEY = "__interceptionContext";
|
|
7
10
|
declare const APP_LAYOUT_IDS_KEY = "__layoutIds";
|
|
8
11
|
declare const APP_LAYOUT_FLAGS_KEY = "__layoutFlags";
|
|
12
|
+
declare const APP_RENDER_OBSERVATION_KEY = "__renderObservation";
|
|
9
13
|
declare const APP_ROUTE_KEY = "__route";
|
|
10
14
|
declare const APP_ROOT_LAYOUT_KEY = "__rootLayout";
|
|
15
|
+
declare const APP_SLOT_BINDINGS_KEY = "__slotBindings";
|
|
11
16
|
declare const APP_UNMATCHED_SLOT_WIRE_VALUE = "__VINEXT_UNMATCHED_SLOT__";
|
|
12
17
|
declare const UNMATCHED_SLOT: unique symbol;
|
|
13
|
-
type
|
|
14
|
-
type
|
|
18
|
+
type AppElementsSlotBindingState = "active" | "default" | "unmatched";
|
|
19
|
+
type AppElementsSlotBinding = Readonly<{
|
|
20
|
+
ownerLayoutId: string | null;
|
|
21
|
+
slotId: string;
|
|
22
|
+
state: AppElementsSlotBindingState;
|
|
23
|
+
}>;
|
|
24
|
+
type AppElementsInterception = Readonly<{
|
|
25
|
+
sourceMatchedUrl: string;
|
|
26
|
+
sourceRouteId: string;
|
|
27
|
+
slotId: string;
|
|
28
|
+
targetMatchedUrl: string;
|
|
29
|
+
targetRouteId: string;
|
|
30
|
+
}>;
|
|
31
|
+
declare function compareAppElementsSlotIds(left: string, right: string): number;
|
|
32
|
+
declare function normalizeAppElementsSlotBindings(slotBindings: readonly AppElementsSlotBinding[], options?: {
|
|
33
|
+
layoutIds?: readonly string[];
|
|
34
|
+
}): readonly AppElementsSlotBinding[];
|
|
35
|
+
type AppElementValue = ReactNode | typeof UNMATCHED_SLOT | string | null | LayoutFlags | ArtifactCompatibilityEnvelope | CacheEntryReuseProof | AppElementsInterception | readonly AppElementsSlotBinding[];
|
|
36
|
+
type AppWireElementValue = ReactNode | string | null | LayoutFlags | ArtifactCompatibilityEnvelope | CacheEntryReuseProof | AppElementsInterception | readonly AppElementsSlotBinding[];
|
|
15
37
|
type AppElements = Readonly<Record<string, AppElementValue>>;
|
|
16
38
|
type AppWireElements = Readonly<Record<string, AppWireElementValue>>;
|
|
17
39
|
/**
|
|
@@ -34,11 +56,14 @@ type AppWireElements = Readonly<Record<string, AppWireElementValue>>;
|
|
|
34
56
|
type LayoutFlags = Readonly<Record<string, "s" | "d">>;
|
|
35
57
|
type AppElementsMetadata = {
|
|
36
58
|
artifactCompatibility: ArtifactCompatibilityEnvelope;
|
|
59
|
+
cacheEntryReuseProof?: CacheEntryReuseProof;
|
|
60
|
+
interception: AppElementsInterception | null;
|
|
37
61
|
interceptionContext: string | null;
|
|
38
62
|
layoutIds: readonly string[];
|
|
39
63
|
layoutFlags: LayoutFlags;
|
|
40
64
|
routeId: string;
|
|
41
65
|
rootLayoutTreePath: string | null;
|
|
66
|
+
slotBindings: readonly AppElementsSlotBinding[];
|
|
42
67
|
};
|
|
43
68
|
type AppElementsWireElementKey = {
|
|
44
69
|
kind: "layout";
|
|
@@ -60,16 +85,20 @@ type AppElementsWireElementKey = {
|
|
|
60
85
|
treePath: string;
|
|
61
86
|
};
|
|
62
87
|
type AppElementsWireMetadataInput = {
|
|
88
|
+
interception?: AppElementsInterception | null;
|
|
63
89
|
interceptionContext: string | null;
|
|
64
90
|
layoutIds?: readonly string[];
|
|
65
91
|
routeId: string;
|
|
66
92
|
rootLayoutTreePath: string | null;
|
|
93
|
+
slotBindings?: readonly AppElementsSlotBinding[];
|
|
67
94
|
};
|
|
68
95
|
type AppElementsWireMetadataEntries = Readonly<{
|
|
69
96
|
[APP_ROUTE_KEY]: string;
|
|
97
|
+
[APP_INTERCEPTION_KEY]?: AppElementsInterception;
|
|
70
98
|
[APP_INTERCEPTION_CONTEXT_KEY]: string | null;
|
|
71
99
|
[APP_LAYOUT_IDS_KEY]: readonly string[];
|
|
72
100
|
[APP_ROOT_LAYOUT_KEY]: string | null;
|
|
101
|
+
[APP_SLOT_BINDINGS_KEY]?: readonly AppElementsSlotBinding[];
|
|
73
102
|
}>;
|
|
74
103
|
/**
|
|
75
104
|
* The outgoing wire payload shape. Includes ReactNode values for the
|
|
@@ -77,14 +106,18 @@ type AppElementsWireMetadataEntries = Readonly<{
|
|
|
77
106
|
* known keys (e.g. __layoutFlags). Distinct from AppElements / AppWireElements
|
|
78
107
|
* which only carry render-time values.
|
|
79
108
|
*/
|
|
80
|
-
type AppOutgoingElements = Readonly<Record<string, ReactNode | LayoutFlags | ArtifactCompatibilityEnvelope>>;
|
|
109
|
+
type AppOutgoingElements = Readonly<Record<string, ReactNode | LayoutFlags | ArtifactCompatibilityEnvelope | CacheEntryReuseProof | AppElementsInterception | RenderObservation | readonly AppElementsSlotBinding[]>>;
|
|
81
110
|
type AppElementsWireKeys = {
|
|
82
111
|
readonly artifactCompatibility: typeof APP_ARTIFACT_COMPATIBILITY_KEY;
|
|
112
|
+
readonly cacheEntryReuseProof: typeof APP_CACHE_ENTRY_REUSE_PROOF_KEY;
|
|
113
|
+
readonly interception: typeof APP_INTERCEPTION_KEY;
|
|
83
114
|
readonly interceptionContext: typeof APP_INTERCEPTION_CONTEXT_KEY;
|
|
84
115
|
readonly layoutIds: typeof APP_LAYOUT_IDS_KEY;
|
|
85
116
|
readonly layoutFlags: typeof APP_LAYOUT_FLAGS_KEY;
|
|
117
|
+
readonly renderObservation: typeof APP_RENDER_OBSERVATION_KEY;
|
|
86
118
|
readonly rootLayout: typeof APP_ROOT_LAYOUT_KEY;
|
|
87
119
|
readonly route: typeof APP_ROUTE_KEY;
|
|
120
|
+
readonly slotBindings: typeof APP_SLOT_BINDINGS_KEY;
|
|
88
121
|
};
|
|
89
122
|
type AppElementsWireCodec = {
|
|
90
123
|
readonly keys: AppElementsWireKeys;
|
|
@@ -94,9 +127,11 @@ type AppElementsWireCodec = {
|
|
|
94
127
|
encodeCacheKey(rscUrl: string, interceptionContext: string | null): string;
|
|
95
128
|
encodeLayoutId(treePath: string): string;
|
|
96
129
|
encodeOutgoingPayload(input: {
|
|
97
|
-
element: ReactNode | Readonly<Record<string, ReactNode>>;
|
|
130
|
+
element: ReactNode | Readonly<Record<string, ReactNode | AppElementsInterception | readonly AppElementsSlotBinding[]>>;
|
|
98
131
|
artifactCompatibility?: ArtifactCompatibilityEnvelope;
|
|
132
|
+
cacheEntryReuseProof?: CacheEntryReuseProof;
|
|
99
133
|
layoutFlags: LayoutFlags;
|
|
134
|
+
renderObservation?: RenderObservation;
|
|
100
135
|
}): ReactNode | AppOutgoingElements;
|
|
101
136
|
encodePageId(routePath: string, interceptionContext: string | null): string;
|
|
102
137
|
encodeRouteId(routePath: string, interceptionContext: string | null): string;
|
|
@@ -124,12 +159,14 @@ declare function withLayoutFlags<T extends Record<string, unknown>>(elements: T,
|
|
|
124
159
|
[APP_LAYOUT_FLAGS_KEY]: LayoutFlags;
|
|
125
160
|
};
|
|
126
161
|
declare function buildOutgoingAppPayload(input: {
|
|
127
|
-
element: ReactNode | Readonly<Record<string, ReactNode>>;
|
|
162
|
+
element: ReactNode | Readonly<Record<string, ReactNode | AppElementsInterception | readonly AppElementsSlotBinding[]>>;
|
|
128
163
|
artifactCompatibility?: ArtifactCompatibilityEnvelope;
|
|
164
|
+
cacheEntryReuseProof?: CacheEntryReuseProof;
|
|
129
165
|
layoutFlags: LayoutFlags;
|
|
166
|
+
renderObservation?: RenderObservation;
|
|
130
167
|
}): ReactNode | AppOutgoingElements;
|
|
131
168
|
declare function readAppElementsMetadata(elements: Readonly<Record<string, unknown>>): AppElementsMetadata;
|
|
132
169
|
declare const AppElementsWire: AppElementsWireCodec;
|
|
133
170
|
//#endregion
|
|
134
|
-
export { APP_ARTIFACT_COMPATIBILITY_KEY, APP_INTERCEPTION_CONTEXT_KEY, APP_LAYOUT_FLAGS_KEY, APP_LAYOUT_IDS_KEY, APP_ROOT_LAYOUT_KEY, APP_ROUTE_KEY, APP_UNMATCHED_SLOT_WIRE_VALUE, AppElementValue, AppElements, AppElementsWire, AppOutgoingElements, AppWireElements, LayoutFlags, UNMATCHED_SLOT, buildOutgoingAppPayload, isAppElementsRecord, normalizeAppElements, readAppElementsMetadata, withLayoutFlags };
|
|
171
|
+
export { APP_ARTIFACT_COMPATIBILITY_KEY, APP_CACHE_ENTRY_REUSE_PROOF_KEY, APP_INTERCEPTION_CONTEXT_KEY, APP_INTERCEPTION_KEY, APP_LAYOUT_FLAGS_KEY, APP_LAYOUT_IDS_KEY, APP_RENDER_OBSERVATION_KEY, APP_ROOT_LAYOUT_KEY, APP_ROUTE_KEY, APP_SLOT_BINDINGS_KEY, APP_UNMATCHED_SLOT_WIRE_VALUE, AppElementValue, AppElements, AppElementsInterception, AppElementsSlotBinding, AppElementsSlotBindingState, AppElementsWire, AppOutgoingElements, AppWireElements, LayoutFlags, UNMATCHED_SLOT, buildOutgoingAppPayload, compareAppElementsSlotIds, isAppElementsRecord, normalizeAppElements, normalizeAppElementsSlotBindings, readAppElementsMetadata, withLayoutFlags };
|
|
135
172
|
//# sourceMappingURL=app-elements-wire.d.ts.map
|
|
@@ -1,15 +1,74 @@
|
|
|
1
|
+
import { isInterceptionMatchedUrlPath } from "./normalize-path.js";
|
|
1
2
|
import { createArtifactCompatibilityEnvelope, parseArtifactCompatibilityEnvelope } from "./artifact-compatibility.js";
|
|
2
3
|
import { isValidElement } from "react";
|
|
3
4
|
//#region src/server/app-elements-wire.ts
|
|
4
5
|
const APP_INTERCEPTION_SEPARATOR = "\0";
|
|
5
6
|
const APP_ARTIFACT_COMPATIBILITY_KEY = "__artifactCompatibility";
|
|
7
|
+
const APP_CACHE_ENTRY_REUSE_PROOF_KEY = "__cacheEntryReuseProof";
|
|
8
|
+
const APP_INTERCEPTION_KEY = "__interception";
|
|
6
9
|
const APP_INTERCEPTION_CONTEXT_KEY = "__interceptionContext";
|
|
7
10
|
const APP_LAYOUT_IDS_KEY = "__layoutIds";
|
|
8
11
|
const APP_LAYOUT_FLAGS_KEY = "__layoutFlags";
|
|
12
|
+
const APP_RENDER_OBSERVATION_KEY = "__renderObservation";
|
|
9
13
|
const APP_ROUTE_KEY = "__route";
|
|
10
14
|
const APP_ROOT_LAYOUT_KEY = "__rootLayout";
|
|
15
|
+
const APP_SLOT_BINDINGS_KEY = "__slotBindings";
|
|
11
16
|
const APP_UNMATCHED_SLOT_WIRE_VALUE = "__VINEXT_UNMATCHED_SLOT__";
|
|
12
17
|
const UNMATCHED_SLOT = Symbol.for("vinext.unmatchedSlot");
|
|
18
|
+
function createCacheProofRejectionCodeSet(codes) {
|
|
19
|
+
return new Set(codes);
|
|
20
|
+
}
|
|
21
|
+
const CACHE_PROOF_REJECTION_CODES = createCacheProofRejectionCodeSet([
|
|
22
|
+
"CP_CACHE_ENTRY_PROOF_MISSING",
|
|
23
|
+
"CP_MODEL_DISABLED",
|
|
24
|
+
"CP_ARTIFACT_COMPATIBILITY_INCOMPATIBLE",
|
|
25
|
+
"CP_ARTIFACT_COMPATIBILITY_UNKNOWN",
|
|
26
|
+
"CP_DIMENSION_COUNT_EXCEEDED",
|
|
27
|
+
"CP_DIMENSION_NAME_MISSING",
|
|
28
|
+
"CP_DIMENSION_NAME_TOO_LONG",
|
|
29
|
+
"CP_DIMENSION_VALUE_COUNT_EXCEEDED",
|
|
30
|
+
"CP_DIMENSION_VALUE_TOO_LONG",
|
|
31
|
+
"CP_DIMENSION_VALUES_MISSING",
|
|
32
|
+
"CP_ENCODED_VARIANT_TOO_LONG",
|
|
33
|
+
"CP_INVALID_VARIANT_BUDGET",
|
|
34
|
+
"CP_ROUTE_VARIANT_BUDGET_ROUTE_MISMATCH",
|
|
35
|
+
"CP_ROUTE_VARIANT_CEILING_EXCEEDED",
|
|
36
|
+
"CP_UNSAFE_PUBLIC_DIMENSION",
|
|
37
|
+
"CP_BOUNDARY_OUTCOME_MISMATCH",
|
|
38
|
+
"CP_BOUNDARY_OUTCOME_UNKNOWN",
|
|
39
|
+
"CP_PRIVATE_DYNAMIC_DOWNGRADE",
|
|
40
|
+
"CP_STATIC_LAYOUT_CANDIDATE_OUTPUT_KIND",
|
|
41
|
+
"CP_STATIC_LAYOUT_CURRENT_OUTPUT_KIND",
|
|
42
|
+
"CP_STATIC_LAYOUT_ID_MISMATCH",
|
|
43
|
+
"CP_STATIC_LAYOUT_OBSERVATION_OUTPUT_KIND",
|
|
44
|
+
"CP_STATIC_LAYOUT_OBSERVATION_OUTPUT_MISMATCH",
|
|
45
|
+
"CP_STATIC_LAYOUT_PRIVATE_DYNAMIC_DOWNGRADE",
|
|
46
|
+
"CP_STATIC_LAYOUT_REQUEST_API_OBSERVED",
|
|
47
|
+
"CP_STATIC_LAYOUT_REQUEST_API_UNKNOWN",
|
|
48
|
+
"CP_STATIC_LAYOUT_ROOT_BOUNDARY_MISMATCH",
|
|
49
|
+
"CP_STATIC_LAYOUT_ROOT_BOUNDARY_UNKNOWN",
|
|
50
|
+
"CP_STATIC_LAYOUT_VARIANT_DIMENSION_UNPROVEN"
|
|
51
|
+
]);
|
|
52
|
+
function compareAppElementsSlotIds(left, right) {
|
|
53
|
+
if (left < right) return -1;
|
|
54
|
+
if (left > right) return 1;
|
|
55
|
+
return 0;
|
|
56
|
+
}
|
|
57
|
+
function compareAppElementsSlotBindingsBySlotId(left, right) {
|
|
58
|
+
return compareAppElementsSlotIds(left.slotId, right.slotId);
|
|
59
|
+
}
|
|
60
|
+
function normalizeAppElementsSlotBindings(slotBindings, options = {}) {
|
|
61
|
+
const ownerLayoutIds = options.layoutIds ? new Set(options.layoutIds) : null;
|
|
62
|
+
const seenSlotIds = /* @__PURE__ */ new Set();
|
|
63
|
+
const normalized = [];
|
|
64
|
+
for (const binding of slotBindings) {
|
|
65
|
+
if (seenSlotIds.has(binding.slotId)) throw new Error("[vinext] Invalid __slotBindings in App Router payload: duplicate slot id");
|
|
66
|
+
seenSlotIds.add(binding.slotId);
|
|
67
|
+
if (ownerLayoutIds && binding.ownerLayoutId !== null && !ownerLayoutIds.has(binding.ownerLayoutId)) throw new Error("[vinext] Invalid __slotBindings in App Router payload: owner layout id missing from __layoutIds");
|
|
68
|
+
normalized.push({ ...binding });
|
|
69
|
+
}
|
|
70
|
+
return normalized.sort(compareAppElementsSlotBindingsBySlotId);
|
|
71
|
+
}
|
|
13
72
|
function appendInterceptionContext(identity, interceptionContext) {
|
|
14
73
|
return interceptionContext === null ? identity : `${identity}${APP_INTERCEPTION_SEPARATOR}${interceptionContext}`;
|
|
15
74
|
}
|
|
@@ -101,12 +160,22 @@ function isAppElementsWireSlotId(key) {
|
|
|
101
160
|
return separatorIndex > 0 && body.charCodeAt(separatorIndex + 1) === 47;
|
|
102
161
|
}
|
|
103
162
|
function createAppElementsWireMetadataEntries(input) {
|
|
104
|
-
|
|
163
|
+
const layoutIds = [...input.layoutIds ?? []];
|
|
164
|
+
const entries = {
|
|
105
165
|
[APP_ROUTE_KEY]: input.routeId,
|
|
106
166
|
[APP_INTERCEPTION_CONTEXT_KEY]: input.interceptionContext,
|
|
107
|
-
[APP_LAYOUT_IDS_KEY]:
|
|
167
|
+
[APP_LAYOUT_IDS_KEY]: layoutIds,
|
|
108
168
|
[APP_ROOT_LAYOUT_KEY]: input.rootLayoutTreePath
|
|
109
169
|
};
|
|
170
|
+
const entriesWithInterception = input.interception ? {
|
|
171
|
+
...entries,
|
|
172
|
+
[APP_INTERCEPTION_KEY]: input.interception
|
|
173
|
+
} : entries;
|
|
174
|
+
if (input.slotBindings && input.slotBindings.length > 0) return {
|
|
175
|
+
...entriesWithInterception,
|
|
176
|
+
[APP_SLOT_BINDINGS_KEY]: normalizeAppElementsSlotBindings(input.slotBindings, { layoutIds })
|
|
177
|
+
};
|
|
178
|
+
return entriesWithInterception;
|
|
110
179
|
}
|
|
111
180
|
function normalizeAppElements(elements) {
|
|
112
181
|
let needsNormalization = false;
|
|
@@ -124,6 +193,9 @@ function isLayoutFlagsRecord(value) {
|
|
|
124
193
|
for (const v of Object.values(value)) if (v !== "s" && v !== "d") return false;
|
|
125
194
|
return true;
|
|
126
195
|
}
|
|
196
|
+
function isRecord(value) {
|
|
197
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
198
|
+
}
|
|
127
199
|
function parseLayoutFlags(value) {
|
|
128
200
|
if (isLayoutFlagsRecord(value)) return value;
|
|
129
201
|
return {};
|
|
@@ -139,6 +211,60 @@ function parseLayoutIds(value) {
|
|
|
139
211
|
}
|
|
140
212
|
return layoutIds;
|
|
141
213
|
}
|
|
214
|
+
function isSlotBindingState(value) {
|
|
215
|
+
return value === "active" || value === "default" || value === "unmatched";
|
|
216
|
+
}
|
|
217
|
+
function parseSlotBindings(value, options = {}) {
|
|
218
|
+
if (value === void 0) return [];
|
|
219
|
+
if (!Array.isArray(value)) throw new Error("[vinext] Invalid __slotBindings in App Router payload: expected array");
|
|
220
|
+
const slotBindings = [];
|
|
221
|
+
for (const entry of value) {
|
|
222
|
+
if (!isRecord(entry)) throw new Error("[vinext] Invalid __slotBindings in App Router payload: expected objects");
|
|
223
|
+
const slotId = entry.slotId;
|
|
224
|
+
if (typeof slotId !== "string" || parseAppElementsWireElementKey(slotId)?.kind !== "slot") throw new Error("[vinext] Invalid __slotBindings in App Router payload: expected slot ids");
|
|
225
|
+
const ownerLayoutId = entry.ownerLayoutId;
|
|
226
|
+
if (ownerLayoutId !== null && (typeof ownerLayoutId !== "string" || parseAppElementsWireElementKey(ownerLayoutId)?.kind !== "layout")) throw new Error("[vinext] Invalid __slotBindings in App Router payload: expected owner layout ids");
|
|
227
|
+
const state = entry.state;
|
|
228
|
+
if (!isSlotBindingState(state)) throw new Error("[vinext] Invalid __slotBindings in App Router payload: expected state");
|
|
229
|
+
slotBindings.push({
|
|
230
|
+
ownerLayoutId,
|
|
231
|
+
slotId,
|
|
232
|
+
state
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
return normalizeAppElementsSlotBindings(slotBindings, options);
|
|
236
|
+
}
|
|
237
|
+
function readRequiredInterceptionString(entry, fieldName) {
|
|
238
|
+
const value = entry[fieldName];
|
|
239
|
+
if (typeof value !== "string") throw new Error("[vinext] Invalid __interception in App Router payload: expected strings");
|
|
240
|
+
return value;
|
|
241
|
+
}
|
|
242
|
+
function parseInterceptionMatchedUrl(value) {
|
|
243
|
+
if (!isInterceptionMatchedUrlPath(value)) throw new Error("[vinext] Invalid __interception in App Router payload: expected path URLs");
|
|
244
|
+
return value;
|
|
245
|
+
}
|
|
246
|
+
function parseInterceptionRouteId(value, matchedUrl) {
|
|
247
|
+
const parsed = parseAppElementsWireElementKey(value);
|
|
248
|
+
if (parsed?.kind !== "route" || parsed.path !== matchedUrl || parsed.interceptionContext !== null) throw new Error("[vinext] Invalid __interception in App Router payload: expected route ids");
|
|
249
|
+
return value;
|
|
250
|
+
}
|
|
251
|
+
function parseInterceptionSlotId(value) {
|
|
252
|
+
if (parseAppElementsWireElementKey(value)?.kind !== "slot") throw new Error("[vinext] Invalid __interception in App Router payload: expected slot id");
|
|
253
|
+
return value;
|
|
254
|
+
}
|
|
255
|
+
function parseInterceptionMetadata(value) {
|
|
256
|
+
if (value === void 0 || value === null) return null;
|
|
257
|
+
if (!isRecord(value)) throw new Error("[vinext] Invalid __interception in App Router payload: expected object");
|
|
258
|
+
const sourceMatchedUrl = parseInterceptionMatchedUrl(readRequiredInterceptionString(value, "sourceMatchedUrl"));
|
|
259
|
+
const targetMatchedUrl = parseInterceptionMatchedUrl(readRequiredInterceptionString(value, "targetMatchedUrl"));
|
|
260
|
+
return {
|
|
261
|
+
sourceMatchedUrl,
|
|
262
|
+
sourceRouteId: parseInterceptionRouteId(readRequiredInterceptionString(value, "sourceRouteId"), sourceMatchedUrl),
|
|
263
|
+
slotId: parseInterceptionSlotId(readRequiredInterceptionString(value, "slotId")),
|
|
264
|
+
targetMatchedUrl,
|
|
265
|
+
targetRouteId: parseInterceptionRouteId(readRequiredInterceptionString(value, "targetRouteId"), targetMatchedUrl)
|
|
266
|
+
};
|
|
267
|
+
}
|
|
142
268
|
/**
|
|
143
269
|
* Type predicate for a plain (non-null, non-array) record of app payload values.
|
|
144
270
|
* Used to distinguish the App Router payload object from bare React elements at
|
|
@@ -162,16 +288,61 @@ function withLayoutFlags(elements, layoutFlags) {
|
|
|
162
288
|
}
|
|
163
289
|
function buildOutgoingAppPayload(input) {
|
|
164
290
|
if (!isAppElementsRecord(input.element)) return input.element;
|
|
165
|
-
|
|
291
|
+
const payload = {
|
|
166
292
|
...input.element,
|
|
167
293
|
[APP_LAYOUT_FLAGS_KEY]: input.layoutFlags,
|
|
168
294
|
[APP_ARTIFACT_COMPATIBILITY_KEY]: input.artifactCompatibility ?? createArtifactCompatibilityEnvelope()
|
|
169
295
|
};
|
|
296
|
+
if (input.cacheEntryReuseProof) payload[APP_CACHE_ENTRY_REUSE_PROOF_KEY] = input.cacheEntryReuseProof;
|
|
297
|
+
if (input.renderObservation) payload[APP_RENDER_OBSERVATION_KEY] = input.renderObservation;
|
|
298
|
+
return payload;
|
|
170
299
|
}
|
|
171
300
|
function readArtifactCompatibilityMetadata(value) {
|
|
172
301
|
if (value === void 0) return createArtifactCompatibilityEnvelope();
|
|
173
302
|
return parseArtifactCompatibilityEnvelope(value) ?? createArtifactCompatibilityEnvelope();
|
|
174
303
|
}
|
|
304
|
+
function createMissingCacheEntryReuseProof() {
|
|
305
|
+
return {
|
|
306
|
+
kind: "runtime-cache-entry",
|
|
307
|
+
decision: null
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
function isCacheProofRejectionCode(value) {
|
|
311
|
+
return typeof value === "string" && CACHE_PROOF_REJECTION_CODES.has(value);
|
|
312
|
+
}
|
|
313
|
+
function isCacheProofFallbackMode(value) {
|
|
314
|
+
return value === "renderFresh" || value === "privateUncacheable";
|
|
315
|
+
}
|
|
316
|
+
function isCacheProofFallbackScope(value) {
|
|
317
|
+
return value === "affectedOutput" || value === "route";
|
|
318
|
+
}
|
|
319
|
+
function parseCacheEntryReuseProofMetadata(value) {
|
|
320
|
+
if (value === void 0) return null;
|
|
321
|
+
if (!isRecord(value) || value.kind !== "runtime-cache-entry") return createMissingCacheEntryReuseProof();
|
|
322
|
+
const decision = value.decision;
|
|
323
|
+
if (decision === null) return createMissingCacheEntryReuseProof();
|
|
324
|
+
if (!isRecord(decision)) return createMissingCacheEntryReuseProof();
|
|
325
|
+
if (decision.kind === "reuse" && decision.canReuse === true && decision.code === "CP_STATIC_LAYOUT_REUSE_PROVEN" && decision.reuseClass === "static-layout") return {
|
|
326
|
+
kind: "runtime-cache-entry",
|
|
327
|
+
decision: {
|
|
328
|
+
canReuse: true,
|
|
329
|
+
code: decision.code,
|
|
330
|
+
kind: "reuse",
|
|
331
|
+
reuseClass: decision.reuseClass
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
if (decision.kind === "reject" && decision.canReuse === false && isCacheProofRejectionCode(decision.code) && isCacheProofFallbackMode(decision.mode) && isCacheProofFallbackScope(decision.scope)) return {
|
|
335
|
+
kind: "runtime-cache-entry",
|
|
336
|
+
decision: {
|
|
337
|
+
canReuse: false,
|
|
338
|
+
code: decision.code,
|
|
339
|
+
kind: "reject",
|
|
340
|
+
mode: decision.mode,
|
|
341
|
+
scope: decision.scope
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
return createMissingCacheEntryReuseProof();
|
|
345
|
+
}
|
|
175
346
|
function readAppElementsMetadata(elements) {
|
|
176
347
|
const routeId = elements[APP_ROUTE_KEY];
|
|
177
348
|
if (typeof routeId !== "string") throw new Error("[vinext] Missing __route string in App Router payload");
|
|
@@ -182,23 +353,34 @@ function readAppElementsMetadata(elements) {
|
|
|
182
353
|
if (rootLayoutTreePath !== null && typeof rootLayoutTreePath !== "string") throw new Error("[vinext] Invalid __rootLayout in App Router payload: expected string or null");
|
|
183
354
|
const layoutFlags = parseLayoutFlags(elements[APP_LAYOUT_FLAGS_KEY]);
|
|
184
355
|
const layoutIds = parseLayoutIds(elements[APP_LAYOUT_IDS_KEY]);
|
|
356
|
+
const slotBindings = parseSlotBindings(elements[APP_SLOT_BINDINGS_KEY], { layoutIds });
|
|
357
|
+
const interception = parseInterceptionMetadata(elements[APP_INTERCEPTION_KEY]);
|
|
358
|
+
const artifactCompatibility = readArtifactCompatibilityMetadata(elements[APP_ARTIFACT_COMPATIBILITY_KEY]);
|
|
359
|
+
const cacheEntryReuseProof = parseCacheEntryReuseProofMetadata(elements[APP_CACHE_ENTRY_REUSE_PROOF_KEY]);
|
|
185
360
|
return {
|
|
186
|
-
artifactCompatibility
|
|
361
|
+
artifactCompatibility,
|
|
362
|
+
...cacheEntryReuseProof ? { cacheEntryReuseProof } : {},
|
|
363
|
+
interception,
|
|
187
364
|
interceptionContext: interceptionContext ?? null,
|
|
188
365
|
layoutIds,
|
|
189
366
|
layoutFlags,
|
|
190
367
|
routeId,
|
|
191
|
-
rootLayoutTreePath
|
|
368
|
+
rootLayoutTreePath,
|
|
369
|
+
slotBindings
|
|
192
370
|
};
|
|
193
371
|
}
|
|
194
372
|
const AppElementsWire = {
|
|
195
373
|
keys: {
|
|
196
374
|
artifactCompatibility: APP_ARTIFACT_COMPATIBILITY_KEY,
|
|
375
|
+
cacheEntryReuseProof: APP_CACHE_ENTRY_REUSE_PROOF_KEY,
|
|
376
|
+
interception: APP_INTERCEPTION_KEY,
|
|
197
377
|
interceptionContext: APP_INTERCEPTION_CONTEXT_KEY,
|
|
198
378
|
layoutIds: APP_LAYOUT_IDS_KEY,
|
|
199
379
|
layoutFlags: APP_LAYOUT_FLAGS_KEY,
|
|
380
|
+
renderObservation: APP_RENDER_OBSERVATION_KEY,
|
|
200
381
|
rootLayout: APP_ROOT_LAYOUT_KEY,
|
|
201
|
-
route: APP_ROUTE_KEY
|
|
382
|
+
route: APP_ROUTE_KEY,
|
|
383
|
+
slotBindings: APP_SLOT_BINDINGS_KEY
|
|
202
384
|
},
|
|
203
385
|
unmatchedSlotValue: APP_UNMATCHED_SLOT_WIRE_VALUE,
|
|
204
386
|
createMetadataEntries: createAppElementsWireMetadataEntries,
|
|
@@ -216,6 +398,6 @@ const AppElementsWire = {
|
|
|
216
398
|
withLayoutFlags
|
|
217
399
|
};
|
|
218
400
|
//#endregion
|
|
219
|
-
export { APP_ARTIFACT_COMPATIBILITY_KEY, APP_INTERCEPTION_CONTEXT_KEY, APP_LAYOUT_FLAGS_KEY, APP_LAYOUT_IDS_KEY, APP_ROOT_LAYOUT_KEY, APP_ROUTE_KEY, APP_UNMATCHED_SLOT_WIRE_VALUE, AppElementsWire, UNMATCHED_SLOT, buildOutgoingAppPayload, isAppElementsRecord, normalizeAppElements, readAppElementsMetadata, withLayoutFlags };
|
|
401
|
+
export { APP_ARTIFACT_COMPATIBILITY_KEY, APP_CACHE_ENTRY_REUSE_PROOF_KEY, APP_INTERCEPTION_CONTEXT_KEY, APP_INTERCEPTION_KEY, APP_LAYOUT_FLAGS_KEY, APP_LAYOUT_IDS_KEY, APP_RENDER_OBSERVATION_KEY, APP_ROOT_LAYOUT_KEY, APP_ROUTE_KEY, APP_SLOT_BINDINGS_KEY, APP_UNMATCHED_SLOT_WIRE_VALUE, AppElementsWire, UNMATCHED_SLOT, buildOutgoingAppPayload, compareAppElementsSlotIds, isAppElementsRecord, normalizeAppElements, normalizeAppElementsSlotBindings, readAppElementsMetadata, withLayoutFlags };
|
|
220
402
|
|
|
221
403
|
//# sourceMappingURL=app-elements-wire.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-elements-wire.js","names":[],"sources":["../../src/server/app-elements-wire.ts"],"sourcesContent":["import { isValidElement, type ReactNode } from \"react\";\nimport {\n createArtifactCompatibilityEnvelope,\n parseArtifactCompatibilityEnvelope,\n type ArtifactCompatibilityEnvelope,\n} from \"./artifact-compatibility.js\";\n\nconst APP_INTERCEPTION_SEPARATOR = \"\\0\";\n\nexport const APP_ARTIFACT_COMPATIBILITY_KEY = \"__artifactCompatibility\";\nexport const APP_INTERCEPTION_CONTEXT_KEY = \"__interceptionContext\";\nexport const APP_LAYOUT_IDS_KEY = \"__layoutIds\";\nexport const APP_LAYOUT_FLAGS_KEY = \"__layoutFlags\";\nexport const APP_ROUTE_KEY = \"__route\";\nexport const APP_ROOT_LAYOUT_KEY = \"__rootLayout\";\nexport const APP_UNMATCHED_SLOT_WIRE_VALUE = \"__VINEXT_UNMATCHED_SLOT__\";\n\nexport const UNMATCHED_SLOT = Symbol.for(\"vinext.unmatchedSlot\");\n\nexport type AppElementValue = ReactNode | typeof UNMATCHED_SLOT | string | null;\ntype AppWireElementValue = ReactNode | string | null;\n\nexport type AppElements = Readonly<Record<string, AppElementValue>>;\nexport type AppWireElements = Readonly<Record<string, AppWireElementValue>>;\n\n/**\n * Per-layout static/dynamic flags. `\"s\"` = static (skippable on next nav);\n * `\"d\"` = dynamic (must always render).\n *\n * Lifecycle (partial — later PRs extend this):\n *\n * 1. PROBE — probeAppPageLayouts (server/app-page-execution.ts) returns\n * LayoutFlags for every layout in the route at render time.\n *\n * 2. ATTACH — AppElementsWire.encodeOutgoingPayload writes `__layoutFlags`\n * into the outgoing App Router payload record.\n *\n * 3. WIRE — renderToReadableStream serializes the record as RSC row 0.\n *\n * 4. PARSE — AppElementsWire.readMetadata extracts layoutFlags from the\n * wire payload on the client side.\n */\nexport type LayoutFlags = Readonly<Record<string, \"s\" | \"d\">>;\n\ntype AppElementsMetadata = {\n artifactCompatibility: ArtifactCompatibilityEnvelope;\n interceptionContext: string | null;\n layoutIds: readonly string[];\n layoutFlags: LayoutFlags;\n routeId: string;\n rootLayoutTreePath: string | null;\n};\n\ntype AppElementsWireElementKey =\n | { kind: \"layout\"; treePath: string }\n | { interceptionContext: string | null; kind: \"page\"; path: string }\n | { interceptionContext: string | null; kind: \"route\"; path: string }\n | { kind: \"slot\"; name: string; treePath: string }\n | { kind: \"template\"; treePath: string };\n\ntype AppElementsWireMetadataInput = {\n interceptionContext: string | null;\n layoutIds?: readonly string[];\n routeId: string;\n rootLayoutTreePath: string | null;\n};\n\ntype AppElementsWireMetadataEntries = Readonly<{\n [APP_ROUTE_KEY]: string;\n [APP_INTERCEPTION_CONTEXT_KEY]: string | null;\n [APP_LAYOUT_IDS_KEY]: readonly string[];\n [APP_ROOT_LAYOUT_KEY]: string | null;\n}>;\n\n/**\n * The outgoing wire payload shape. Includes ReactNode values for the\n * rendered tree plus metadata values like LayoutFlags attached under\n * known keys (e.g. __layoutFlags). Distinct from AppElements / AppWireElements\n * which only carry render-time values.\n */\nexport type AppOutgoingElements = Readonly<\n Record<string, ReactNode | LayoutFlags | ArtifactCompatibilityEnvelope>\n>;\n\ntype AppElementsWireKeys = {\n readonly artifactCompatibility: typeof APP_ARTIFACT_COMPATIBILITY_KEY;\n readonly interceptionContext: typeof APP_INTERCEPTION_CONTEXT_KEY;\n readonly layoutIds: typeof APP_LAYOUT_IDS_KEY;\n readonly layoutFlags: typeof APP_LAYOUT_FLAGS_KEY;\n readonly rootLayout: typeof APP_ROOT_LAYOUT_KEY;\n readonly route: typeof APP_ROUTE_KEY;\n};\n\ntype AppElementsWireCodec = {\n readonly keys: AppElementsWireKeys;\n readonly unmatchedSlotValue: typeof APP_UNMATCHED_SLOT_WIRE_VALUE;\n createMetadataEntries(input: AppElementsWireMetadataInput): AppElementsWireMetadataEntries;\n decode(elements: AppWireElements): AppElements;\n encodeCacheKey(rscUrl: string, interceptionContext: string | null): string;\n encodeLayoutId(treePath: string): string;\n encodeOutgoingPayload(input: {\n element: ReactNode | Readonly<Record<string, ReactNode>>;\n artifactCompatibility?: ArtifactCompatibilityEnvelope;\n layoutFlags: LayoutFlags;\n }): ReactNode | AppOutgoingElements;\n encodePageId(routePath: string, interceptionContext: string | null): string;\n encodeRouteId(routePath: string, interceptionContext: string | null): string;\n encodeSlotId(slotName: string, treePath: string): string;\n encodeTemplateId(treePath: string): string;\n isSlotId(key: string): boolean;\n parseElementKey(key: string): AppElementsWireElementKey | null;\n readMetadata(elements: Readonly<Record<string, unknown>>): AppElementsMetadata;\n withLayoutFlags<T extends Record<string, unknown>>(\n elements: T,\n layoutFlags: LayoutFlags,\n ): T & { [APP_LAYOUT_FLAGS_KEY]: LayoutFlags };\n};\n\nfunction appendInterceptionContext(identity: string, interceptionContext: string | null): string {\n return interceptionContext === null\n ? identity\n : `${identity}${APP_INTERCEPTION_SEPARATOR}${interceptionContext}`;\n}\n\nfunction createAppPayloadRouteId(routePath: string, interceptionContext: string | null): string {\n return appendInterceptionContext(`route:${routePath}`, interceptionContext);\n}\n\nfunction createAppPayloadPageId(routePath: string, interceptionContext: string | null): string {\n return appendInterceptionContext(`page:${routePath}`, interceptionContext);\n}\n\nfunction createAppPayloadLayoutId(treePath: string): string {\n return `layout:${treePath}`;\n}\n\nfunction createAppPayloadTemplateId(treePath: string): string {\n return `template:${treePath}`;\n}\n\nfunction createAppPayloadSlotId(slotName: string, treePath: string): string {\n return `slot:${slotName}:${treePath}`;\n}\n\nfunction createAppPayloadCacheKey(rscUrl: string, interceptionContext: string | null): string {\n return appendInterceptionContext(rscUrl, interceptionContext);\n}\n\nfunction parsePathWithInterception(input: string): {\n interceptionContext: string | null;\n path: string;\n} | null {\n const separatorIndex = input.indexOf(APP_INTERCEPTION_SEPARATOR);\n const path = separatorIndex === -1 ? input : input.slice(0, separatorIndex);\n if (!path.startsWith(\"/\")) return null;\n\n return {\n interceptionContext: separatorIndex === -1 ? null : input.slice(separatorIndex + 1),\n path,\n };\n}\n\n/**\n * AppElements tree paths are absolute route-tree paths on the wire.\n * Bare segment names are not valid layout/template/slot tree identities.\n */\nfunction parseTreePath(input: string): string | null {\n return input.startsWith(\"/\") ? input : null;\n}\n\nfunction parseAppElementsWireElementKey(key: string): AppElementsWireElementKey | null {\n if (key.startsWith(\"route:\")) {\n const parsed = parsePathWithInterception(key.slice(\"route:\".length));\n if (!parsed) return null;\n return { interceptionContext: parsed.interceptionContext, kind: \"route\", path: parsed.path };\n }\n\n if (key.startsWith(\"page:\")) {\n const parsed = parsePathWithInterception(key.slice(\"page:\".length));\n if (!parsed) return null;\n return { interceptionContext: parsed.interceptionContext, kind: \"page\", path: parsed.path };\n }\n\n if (key.startsWith(\"layout:\")) {\n const treePath = parseTreePath(key.slice(\"layout:\".length));\n return treePath ? { kind: \"layout\", treePath } : null;\n }\n\n if (key.startsWith(\"template:\")) {\n const treePath = parseTreePath(key.slice(\"template:\".length));\n return treePath ? { kind: \"template\", treePath } : null;\n }\n\n if (key.startsWith(\"slot:\")) {\n const body = key.slice(\"slot:\".length);\n const separatorIndex = body.indexOf(\":\");\n if (separatorIndex <= 0) return null;\n const name = body.slice(0, separatorIndex);\n const treePath = parseTreePath(body.slice(separatorIndex + 1));\n return treePath ? { kind: \"slot\", name, treePath } : null;\n }\n\n return null;\n}\n\nfunction isAppElementsWireSlotId(key: string): boolean {\n if (!key.startsWith(\"slot:\")) return false;\n const body = key.slice(\"slot:\".length);\n const separatorIndex = body.indexOf(\":\");\n return separatorIndex > 0 && body.charCodeAt(separatorIndex + 1) === 0x2f;\n}\n\nfunction createAppElementsWireMetadataEntries(\n input: AppElementsWireMetadataInput,\n): AppElementsWireMetadataEntries {\n return {\n [APP_ROUTE_KEY]: input.routeId,\n [APP_INTERCEPTION_CONTEXT_KEY]: input.interceptionContext,\n [APP_LAYOUT_IDS_KEY]: [...(input.layoutIds ?? [])],\n [APP_ROOT_LAYOUT_KEY]: input.rootLayoutTreePath,\n };\n}\n\nexport function normalizeAppElements(elements: AppWireElements): AppElements {\n let needsNormalization = false;\n for (const [key, value] of Object.entries(elements)) {\n if (isAppElementsWireSlotId(key) && value === APP_UNMATCHED_SLOT_WIRE_VALUE) {\n needsNormalization = true;\n break;\n }\n }\n\n if (!needsNormalization) {\n return elements;\n }\n\n const normalized: Record<string, AppElementValue> = {};\n for (const [key, value] of Object.entries(elements)) {\n normalized[key] =\n isAppElementsWireSlotId(key) && value === APP_UNMATCHED_SLOT_WIRE_VALUE\n ? UNMATCHED_SLOT\n : value;\n }\n\n return normalized;\n}\n\nfunction isLayoutFlagsRecord(value: unknown): value is LayoutFlags {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return false;\n for (const v of Object.values(value)) {\n if (v !== \"s\" && v !== \"d\") return false;\n }\n return true;\n}\n\nfunction parseLayoutFlags(value: unknown): LayoutFlags {\n if (isLayoutFlagsRecord(value)) return value;\n return {};\n}\n\nfunction parseLayoutIds(value: unknown): readonly string[] {\n if (value === undefined) return [];\n if (!Array.isArray(value)) {\n throw new Error(\n \"[vinext] Invalid __layoutIds in App Router payload: expected layout id string[]\",\n );\n }\n\n const layoutIds: string[] = [];\n for (const entry of value) {\n if (typeof entry !== \"string\") {\n throw new Error(\n \"[vinext] Invalid __layoutIds in App Router payload: expected layout id string[]\",\n );\n }\n\n const parsed = parseAppElementsWireElementKey(entry);\n if (parsed?.kind !== \"layout\") {\n throw new Error(\"[vinext] Invalid __layoutIds in App Router payload: expected layout ids\");\n }\n\n layoutIds.push(entry);\n }\n return layoutIds;\n}\n\n/**\n * Type predicate for a plain (non-null, non-array) record of app payload values.\n * Used to distinguish the App Router payload object from bare React elements at\n * the render boundary. Narrows to `Readonly<Record<string, unknown>>` because\n * the outgoing payload carries heterogeneous values (ReactNodes for the rendered\n * tree, plus metadata like `__layoutFlags` which is a plain object). Delegates\n * to React's canonical `isValidElement` so we don't depend on React's internal\n * `$$typeof` marker scheme.\n */\nexport function isAppElementsRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n if (typeof value !== \"object\" || value === null) return false;\n if (Array.isArray(value)) return false;\n if (isValidElement(value)) return false;\n return true;\n}\n\nexport function withLayoutFlags<T extends Record<string, unknown>>(\n elements: T,\n layoutFlags: LayoutFlags,\n): T & { [APP_LAYOUT_FLAGS_KEY]: LayoutFlags } {\n return { ...elements, [APP_LAYOUT_FLAGS_KEY]: layoutFlags };\n}\n\nexport function buildOutgoingAppPayload(input: {\n element: ReactNode | Readonly<Record<string, ReactNode>>;\n artifactCompatibility?: ArtifactCompatibilityEnvelope;\n layoutFlags: LayoutFlags;\n}): ReactNode | AppOutgoingElements {\n if (!isAppElementsRecord(input.element)) {\n return input.element;\n }\n return {\n ...input.element,\n [APP_LAYOUT_FLAGS_KEY]: input.layoutFlags,\n [APP_ARTIFACT_COMPATIBILITY_KEY]:\n input.artifactCompatibility ?? createArtifactCompatibilityEnvelope(),\n };\n}\n\nfunction readArtifactCompatibilityMetadata(value: unknown): ArtifactCompatibilityEnvelope {\n if (value === undefined) return createArtifactCompatibilityEnvelope();\n\n const artifactCompatibility = parseArtifactCompatibilityEnvelope(value);\n // TODO(#726-COMPAT-04): hard-fail malformed compatibility metadata once\n // cache/skip consumers depend on this proof. During Wave01 the field is\n // emitted as scaffolding, so bad or future-version values degrade like\n // missing __layoutFlags instead of crashing render paths that do not read it.\n return artifactCompatibility ?? createArtifactCompatibilityEnvelope();\n}\n\nexport function readAppElementsMetadata(\n elements: Readonly<Record<string, unknown>>,\n): AppElementsMetadata {\n const routeId = elements[APP_ROUTE_KEY];\n if (typeof routeId !== \"string\") {\n throw new Error(\"[vinext] Missing __route string in App Router payload\");\n }\n\n const interceptionContext = elements[APP_INTERCEPTION_CONTEXT_KEY];\n if (\n interceptionContext !== undefined &&\n interceptionContext !== null &&\n typeof interceptionContext !== \"string\"\n ) {\n throw new Error(\"[vinext] Invalid __interceptionContext in App Router payload\");\n }\n\n const rootLayoutTreePath = elements[APP_ROOT_LAYOUT_KEY];\n if (rootLayoutTreePath === undefined) {\n throw new Error(\"[vinext] Missing __rootLayout key in App Router payload\");\n }\n if (rootLayoutTreePath !== null && typeof rootLayoutTreePath !== \"string\") {\n throw new Error(\"[vinext] Invalid __rootLayout in App Router payload: expected string or null\");\n }\n\n const layoutFlags = parseLayoutFlags(elements[APP_LAYOUT_FLAGS_KEY]);\n const layoutIds = parseLayoutIds(elements[APP_LAYOUT_IDS_KEY]);\n const artifactCompatibility = readArtifactCompatibilityMetadata(\n elements[APP_ARTIFACT_COMPATIBILITY_KEY],\n );\n\n return {\n artifactCompatibility,\n interceptionContext: interceptionContext ?? null,\n layoutIds,\n layoutFlags,\n routeId,\n rootLayoutTreePath,\n };\n}\n\nexport const AppElementsWire: AppElementsWireCodec = {\n // WIRE follow-ups use these stable key names when moving payload readers and writers\n // behind the codec boundary.\n keys: {\n artifactCompatibility: APP_ARTIFACT_COMPATIBILITY_KEY,\n interceptionContext: APP_INTERCEPTION_CONTEXT_KEY,\n layoutIds: APP_LAYOUT_IDS_KEY,\n layoutFlags: APP_LAYOUT_FLAGS_KEY,\n rootLayout: APP_ROOT_LAYOUT_KEY,\n route: APP_ROUTE_KEY,\n },\n unmatchedSlotValue: APP_UNMATCHED_SLOT_WIRE_VALUE,\n createMetadataEntries: createAppElementsWireMetadataEntries,\n decode: normalizeAppElements,\n encodeCacheKey: createAppPayloadCacheKey,\n encodeLayoutId: createAppPayloadLayoutId,\n encodeOutgoingPayload: buildOutgoingAppPayload,\n encodePageId: createAppPayloadPageId,\n encodeRouteId: createAppPayloadRouteId,\n encodeSlotId: createAppPayloadSlotId,\n encodeTemplateId: createAppPayloadTemplateId,\n isSlotId: isAppElementsWireSlotId,\n parseElementKey: parseAppElementsWireElementKey,\n readMetadata: readAppElementsMetadata,\n withLayoutFlags,\n};\n"],"mappings":";;;AAOA,MAAM,6BAA6B;AAEnC,MAAa,iCAAiC;AAC9C,MAAa,+BAA+B;AAC5C,MAAa,qBAAqB;AAClC,MAAa,uBAAuB;AACpC,MAAa,gBAAgB;AAC7B,MAAa,sBAAsB;AACnC,MAAa,gCAAgC;AAE7C,MAAa,iBAAiB,OAAO,IAAI,uBAAuB;AAqGhE,SAAS,0BAA0B,UAAkB,qBAA4C;CAC/F,OAAO,wBAAwB,OAC3B,WACA,GAAG,WAAW,6BAA6B;;AAGjD,SAAS,wBAAwB,WAAmB,qBAA4C;CAC9F,OAAO,0BAA0B,SAAS,aAAa,oBAAoB;;AAG7E,SAAS,uBAAuB,WAAmB,qBAA4C;CAC7F,OAAO,0BAA0B,QAAQ,aAAa,oBAAoB;;AAG5E,SAAS,yBAAyB,UAA0B;CAC1D,OAAO,UAAU;;AAGnB,SAAS,2BAA2B,UAA0B;CAC5D,OAAO,YAAY;;AAGrB,SAAS,uBAAuB,UAAkB,UAA0B;CAC1E,OAAO,QAAQ,SAAS,GAAG;;AAG7B,SAAS,yBAAyB,QAAgB,qBAA4C;CAC5F,OAAO,0BAA0B,QAAQ,oBAAoB;;AAG/D,SAAS,0BAA0B,OAG1B;CACP,MAAM,iBAAiB,MAAM,QAAQ,2BA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O;EACL,uBAL4B,kCAC5B,SAAS,gCAIY;EACrB,qBAAqB,uBAAuB;EAC5C;EACA;EACA;EACA;EACD;;AAGH,MAAa,kBAAwC;CAGnD,MAAM;EACJ,uBAAuB;EACvB,qBAAqB;EACrB,WAAW;EACX,aAAa;EACb,YAAY;EACZ,OAAO;EACR;CACD,oBAAoB;CACpB,uBAAuB;CACvB,QAAQ;CACR,gBAAgB;CAChB,gBAAgB;CAChB,uBAAuB;CACvB,cAAc;CACd,eAAe;CACf,cAAc;CACd,kBAAkB;CAClB,UAAU;CACV,iBAAiB;CACjB,cAAc;CACd;CACD"}
|
|
1
|
+
{"version":3,"file":"app-elements-wire.js","names":[],"sources":["../../src/server/app-elements-wire.ts"],"sourcesContent":["import { isValidElement, type ReactNode } from \"react\";\nimport {\n createArtifactCompatibilityEnvelope,\n parseArtifactCompatibilityEnvelope,\n type ArtifactCompatibilityEnvelope,\n} from \"./artifact-compatibility.js\";\nimport type {\n CacheEntryReuseProof,\n CacheProofBreakerFallbackMode,\n CacheProofFallbackScope,\n CacheProofRejectionCode,\n RenderObservation,\n} from \"./cache-proof.js\";\nimport { isInterceptionMatchedUrlPath } from \"./normalize-path.js\";\n\nconst APP_INTERCEPTION_SEPARATOR = \"\\0\";\n\nexport const APP_ARTIFACT_COMPATIBILITY_KEY = \"__artifactCompatibility\";\nexport const APP_CACHE_ENTRY_REUSE_PROOF_KEY = \"__cacheEntryReuseProof\";\nexport const APP_INTERCEPTION_KEY = \"__interception\";\nexport const APP_INTERCEPTION_CONTEXT_KEY = \"__interceptionContext\";\nexport const APP_LAYOUT_IDS_KEY = \"__layoutIds\";\nexport const APP_LAYOUT_FLAGS_KEY = \"__layoutFlags\";\nexport const APP_RENDER_OBSERVATION_KEY = \"__renderObservation\";\nexport const APP_ROUTE_KEY = \"__route\";\nexport const APP_ROOT_LAYOUT_KEY = \"__rootLayout\";\nexport const APP_SLOT_BINDINGS_KEY = \"__slotBindings\";\nexport const APP_UNMATCHED_SLOT_WIRE_VALUE = \"__VINEXT_UNMATCHED_SLOT__\";\n\nexport const UNMATCHED_SLOT = Symbol.for(\"vinext.unmatchedSlot\");\n\nfunction createCacheProofRejectionCodeSet<const T extends readonly CacheProofRejectionCode[]>(\n codes: T &\n ([CacheProofRejectionCode] extends [T[number]]\n ? unknown\n : readonly [\n \"Missing cache proof rejection codes\",\n Exclude<CacheProofRejectionCode, T[number]>,\n ]),\n): ReadonlySet<string> {\n return new Set(codes);\n}\n\nconst CACHE_PROOF_REJECTION_CODES = createCacheProofRejectionCodeSet([\n \"CP_CACHE_ENTRY_PROOF_MISSING\",\n \"CP_MODEL_DISABLED\",\n \"CP_ARTIFACT_COMPATIBILITY_INCOMPATIBLE\",\n \"CP_ARTIFACT_COMPATIBILITY_UNKNOWN\",\n \"CP_DIMENSION_COUNT_EXCEEDED\",\n \"CP_DIMENSION_NAME_MISSING\",\n \"CP_DIMENSION_NAME_TOO_LONG\",\n \"CP_DIMENSION_VALUE_COUNT_EXCEEDED\",\n \"CP_DIMENSION_VALUE_TOO_LONG\",\n \"CP_DIMENSION_VALUES_MISSING\",\n \"CP_ENCODED_VARIANT_TOO_LONG\",\n \"CP_INVALID_VARIANT_BUDGET\",\n \"CP_ROUTE_VARIANT_BUDGET_ROUTE_MISMATCH\",\n \"CP_ROUTE_VARIANT_CEILING_EXCEEDED\",\n \"CP_UNSAFE_PUBLIC_DIMENSION\",\n \"CP_BOUNDARY_OUTCOME_MISMATCH\",\n \"CP_BOUNDARY_OUTCOME_UNKNOWN\",\n \"CP_PRIVATE_DYNAMIC_DOWNGRADE\",\n \"CP_STATIC_LAYOUT_CANDIDATE_OUTPUT_KIND\",\n \"CP_STATIC_LAYOUT_CURRENT_OUTPUT_KIND\",\n \"CP_STATIC_LAYOUT_ID_MISMATCH\",\n \"CP_STATIC_LAYOUT_OBSERVATION_OUTPUT_KIND\",\n \"CP_STATIC_LAYOUT_OBSERVATION_OUTPUT_MISMATCH\",\n \"CP_STATIC_LAYOUT_PRIVATE_DYNAMIC_DOWNGRADE\",\n \"CP_STATIC_LAYOUT_REQUEST_API_OBSERVED\",\n \"CP_STATIC_LAYOUT_REQUEST_API_UNKNOWN\",\n \"CP_STATIC_LAYOUT_ROOT_BOUNDARY_MISMATCH\",\n \"CP_STATIC_LAYOUT_ROOT_BOUNDARY_UNKNOWN\",\n \"CP_STATIC_LAYOUT_VARIANT_DIMENSION_UNPROVEN\",\n]);\n\nexport type AppElementsSlotBindingState = \"active\" | \"default\" | \"unmatched\";\n\nexport type AppElementsSlotBinding = Readonly<{\n ownerLayoutId: string | null;\n slotId: string;\n state: AppElementsSlotBindingState;\n}>;\n\nexport type AppElementsInterception = Readonly<{\n sourceMatchedUrl: string;\n sourceRouteId: string;\n slotId: string;\n targetMatchedUrl: string;\n targetRouteId: string;\n}>;\n\nexport function compareAppElementsSlotIds(left: string, right: string): number {\n if (left < right) return -1;\n if (left > right) return 1;\n return 0;\n}\n\nfunction compareAppElementsSlotBindingsBySlotId(\n left: Pick<AppElementsSlotBinding, \"slotId\">,\n right: Pick<AppElementsSlotBinding, \"slotId\">,\n): number {\n return compareAppElementsSlotIds(left.slotId, right.slotId);\n}\n\nexport function normalizeAppElementsSlotBindings(\n slotBindings: readonly AppElementsSlotBinding[],\n options: { layoutIds?: readonly string[] } = {},\n): readonly AppElementsSlotBinding[] {\n const ownerLayoutIds = options.layoutIds ? new Set(options.layoutIds) : null;\n const seenSlotIds = new Set<string>();\n const normalized: AppElementsSlotBinding[] = [];\n\n for (const binding of slotBindings) {\n if (seenSlotIds.has(binding.slotId)) {\n throw new Error(\"[vinext] Invalid __slotBindings in App Router payload: duplicate slot id\");\n }\n seenSlotIds.add(binding.slotId);\n\n if (\n ownerLayoutIds &&\n binding.ownerLayoutId !== null &&\n !ownerLayoutIds.has(binding.ownerLayoutId)\n ) {\n throw new Error(\n \"[vinext] Invalid __slotBindings in App Router payload: owner layout id missing from __layoutIds\",\n );\n }\n\n normalized.push({ ...binding });\n }\n\n return normalized.sort(compareAppElementsSlotBindingsBySlotId);\n}\n\nexport type AppElementValue =\n | ReactNode\n | typeof UNMATCHED_SLOT\n | string\n | null\n | LayoutFlags\n | ArtifactCompatibilityEnvelope\n | CacheEntryReuseProof\n | AppElementsInterception\n | readonly AppElementsSlotBinding[];\ntype AppWireElementValue =\n | ReactNode\n | string\n | null\n | LayoutFlags\n | ArtifactCompatibilityEnvelope\n | CacheEntryReuseProof\n | AppElementsInterception\n | readonly AppElementsSlotBinding[];\n\nexport type AppElements = Readonly<Record<string, AppElementValue>>;\nexport type AppWireElements = Readonly<Record<string, AppWireElementValue>>;\n\n/**\n * Per-layout static/dynamic flags. `\"s\"` = static (skippable on next nav);\n * `\"d\"` = dynamic (must always render).\n *\n * Lifecycle (partial — later PRs extend this):\n *\n * 1. PROBE — probeAppPageLayouts (server/app-page-execution.ts) returns\n * LayoutFlags for every layout in the route at render time.\n *\n * 2. ATTACH — AppElementsWire.encodeOutgoingPayload writes `__layoutFlags`\n * into the outgoing App Router payload record.\n *\n * 3. WIRE — renderToReadableStream serializes the record as RSC row 0.\n *\n * 4. PARSE — AppElementsWire.readMetadata extracts layoutFlags from the\n * wire payload on the client side.\n */\nexport type LayoutFlags = Readonly<Record<string, \"s\" | \"d\">>;\n\ntype AppElementsMetadata = {\n artifactCompatibility: ArtifactCompatibilityEnvelope;\n cacheEntryReuseProof?: CacheEntryReuseProof;\n interception: AppElementsInterception | null;\n interceptionContext: string | null;\n layoutIds: readonly string[];\n layoutFlags: LayoutFlags;\n routeId: string;\n rootLayoutTreePath: string | null;\n slotBindings: readonly AppElementsSlotBinding[];\n};\n\ntype AppElementsWireElementKey =\n | { kind: \"layout\"; treePath: string }\n | { interceptionContext: string | null; kind: \"page\"; path: string }\n | { interceptionContext: string | null; kind: \"route\"; path: string }\n | { kind: \"slot\"; name: string; treePath: string }\n | { kind: \"template\"; treePath: string };\n\ntype AppElementsWireMetadataInput = {\n interception?: AppElementsInterception | null;\n interceptionContext: string | null;\n layoutIds?: readonly string[];\n routeId: string;\n rootLayoutTreePath: string | null;\n slotBindings?: readonly AppElementsSlotBinding[];\n};\n\ntype AppElementsWireMetadataEntries = Readonly<{\n [APP_ROUTE_KEY]: string;\n [APP_INTERCEPTION_KEY]?: AppElementsInterception;\n [APP_INTERCEPTION_CONTEXT_KEY]: string | null;\n [APP_LAYOUT_IDS_KEY]: readonly string[];\n [APP_ROOT_LAYOUT_KEY]: string | null;\n [APP_SLOT_BINDINGS_KEY]?: readonly AppElementsSlotBinding[];\n}>;\n\n/**\n * The outgoing wire payload shape. Includes ReactNode values for the\n * rendered tree plus metadata values like LayoutFlags attached under\n * known keys (e.g. __layoutFlags). Distinct from AppElements / AppWireElements\n * which only carry render-time values.\n */\nexport type AppOutgoingElements = Readonly<\n Record<\n string,\n | ReactNode\n | LayoutFlags\n | ArtifactCompatibilityEnvelope\n | CacheEntryReuseProof\n | AppElementsInterception\n | RenderObservation\n | readonly AppElementsSlotBinding[]\n >\n>;\n\ntype AppElementsWireKeys = {\n readonly artifactCompatibility: typeof APP_ARTIFACT_COMPATIBILITY_KEY;\n readonly cacheEntryReuseProof: typeof APP_CACHE_ENTRY_REUSE_PROOF_KEY;\n readonly interception: typeof APP_INTERCEPTION_KEY;\n readonly interceptionContext: typeof APP_INTERCEPTION_CONTEXT_KEY;\n readonly layoutIds: typeof APP_LAYOUT_IDS_KEY;\n readonly layoutFlags: typeof APP_LAYOUT_FLAGS_KEY;\n readonly renderObservation: typeof APP_RENDER_OBSERVATION_KEY;\n readonly rootLayout: typeof APP_ROOT_LAYOUT_KEY;\n readonly route: typeof APP_ROUTE_KEY;\n readonly slotBindings: typeof APP_SLOT_BINDINGS_KEY;\n};\n\ntype AppElementsWireCodec = {\n readonly keys: AppElementsWireKeys;\n readonly unmatchedSlotValue: typeof APP_UNMATCHED_SLOT_WIRE_VALUE;\n createMetadataEntries(input: AppElementsWireMetadataInput): AppElementsWireMetadataEntries;\n decode(elements: AppWireElements): AppElements;\n encodeCacheKey(rscUrl: string, interceptionContext: string | null): string;\n encodeLayoutId(treePath: string): string;\n encodeOutgoingPayload(input: {\n element:\n | ReactNode\n | Readonly<\n Record<string, ReactNode | AppElementsInterception | readonly AppElementsSlotBinding[]>\n >;\n artifactCompatibility?: ArtifactCompatibilityEnvelope;\n cacheEntryReuseProof?: CacheEntryReuseProof;\n layoutFlags: LayoutFlags;\n renderObservation?: RenderObservation;\n }): ReactNode | AppOutgoingElements;\n encodePageId(routePath: string, interceptionContext: string | null): string;\n encodeRouteId(routePath: string, interceptionContext: string | null): string;\n encodeSlotId(slotName: string, treePath: string): string;\n encodeTemplateId(treePath: string): string;\n isSlotId(key: string): boolean;\n parseElementKey(key: string): AppElementsWireElementKey | null;\n readMetadata(elements: Readonly<Record<string, unknown>>): AppElementsMetadata;\n withLayoutFlags<T extends Record<string, unknown>>(\n elements: T,\n layoutFlags: LayoutFlags,\n ): T & { [APP_LAYOUT_FLAGS_KEY]: LayoutFlags };\n};\n\nfunction appendInterceptionContext(identity: string, interceptionContext: string | null): string {\n return interceptionContext === null\n ? identity\n : `${identity}${APP_INTERCEPTION_SEPARATOR}${interceptionContext}`;\n}\n\nfunction createAppPayloadRouteId(routePath: string, interceptionContext: string | null): string {\n return appendInterceptionContext(`route:${routePath}`, interceptionContext);\n}\n\nfunction createAppPayloadPageId(routePath: string, interceptionContext: string | null): string {\n return appendInterceptionContext(`page:${routePath}`, interceptionContext);\n}\n\nfunction createAppPayloadLayoutId(treePath: string): string {\n return `layout:${treePath}`;\n}\n\nfunction createAppPayloadTemplateId(treePath: string): string {\n return `template:${treePath}`;\n}\n\nfunction createAppPayloadSlotId(slotName: string, treePath: string): string {\n return `slot:${slotName}:${treePath}`;\n}\n\nfunction createAppPayloadCacheKey(rscUrl: string, interceptionContext: string | null): string {\n return appendInterceptionContext(rscUrl, interceptionContext);\n}\n\nfunction parsePathWithInterception(input: string): {\n interceptionContext: string | null;\n path: string;\n} | null {\n const separatorIndex = input.indexOf(APP_INTERCEPTION_SEPARATOR);\n const path = separatorIndex === -1 ? input : input.slice(0, separatorIndex);\n if (!path.startsWith(\"/\")) return null;\n\n return {\n interceptionContext: separatorIndex === -1 ? null : input.slice(separatorIndex + 1),\n path,\n };\n}\n\n/**\n * AppElements tree paths are absolute route-tree paths on the wire.\n * Bare segment names are not valid layout/template/slot tree identities.\n */\nfunction parseTreePath(input: string): string | null {\n return input.startsWith(\"/\") ? input : null;\n}\n\nfunction parseAppElementsWireElementKey(key: string): AppElementsWireElementKey | null {\n if (key.startsWith(\"route:\")) {\n const parsed = parsePathWithInterception(key.slice(\"route:\".length));\n if (!parsed) return null;\n return { interceptionContext: parsed.interceptionContext, kind: \"route\", path: parsed.path };\n }\n\n if (key.startsWith(\"page:\")) {\n const parsed = parsePathWithInterception(key.slice(\"page:\".length));\n if (!parsed) return null;\n return { interceptionContext: parsed.interceptionContext, kind: \"page\", path: parsed.path };\n }\n\n if (key.startsWith(\"layout:\")) {\n const treePath = parseTreePath(key.slice(\"layout:\".length));\n return treePath ? { kind: \"layout\", treePath } : null;\n }\n\n if (key.startsWith(\"template:\")) {\n const treePath = parseTreePath(key.slice(\"template:\".length));\n return treePath ? { kind: \"template\", treePath } : null;\n }\n\n if (key.startsWith(\"slot:\")) {\n const body = key.slice(\"slot:\".length);\n const separatorIndex = body.indexOf(\":\");\n if (separatorIndex <= 0) return null;\n const name = body.slice(0, separatorIndex);\n const treePath = parseTreePath(body.slice(separatorIndex + 1));\n return treePath ? { kind: \"slot\", name, treePath } : null;\n }\n\n return null;\n}\n\nfunction isAppElementsWireSlotId(key: string): boolean {\n if (!key.startsWith(\"slot:\")) return false;\n const body = key.slice(\"slot:\".length);\n const separatorIndex = body.indexOf(\":\");\n return separatorIndex > 0 && body.charCodeAt(separatorIndex + 1) === 0x2f;\n}\n\nfunction createAppElementsWireMetadataEntries(\n input: AppElementsWireMetadataInput,\n): AppElementsWireMetadataEntries {\n const layoutIds = [...(input.layoutIds ?? [])];\n const entries: AppElementsWireMetadataEntries = {\n [APP_ROUTE_KEY]: input.routeId,\n [APP_INTERCEPTION_CONTEXT_KEY]: input.interceptionContext,\n [APP_LAYOUT_IDS_KEY]: layoutIds,\n [APP_ROOT_LAYOUT_KEY]: input.rootLayoutTreePath,\n };\n // Empty slot binding metadata is intentionally omitted. Missing\n // __slotBindings round-trips as [] and means \"no route-state proof\", so\n // default/unmatched slot preservation is not promoted for that payload.\n const entriesWithInterception = input.interception\n ? { ...entries, [APP_INTERCEPTION_KEY]: input.interception }\n : entries;\n if (input.slotBindings && input.slotBindings.length > 0) {\n return {\n ...entriesWithInterception,\n [APP_SLOT_BINDINGS_KEY]: normalizeAppElementsSlotBindings(input.slotBindings, { layoutIds }),\n };\n }\n return entriesWithInterception;\n}\n\nexport function normalizeAppElements(elements: AppWireElements): AppElements {\n let needsNormalization = false;\n for (const [key, value] of Object.entries(elements)) {\n if (isAppElementsWireSlotId(key) && value === APP_UNMATCHED_SLOT_WIRE_VALUE) {\n needsNormalization = true;\n break;\n }\n }\n\n if (!needsNormalization) {\n return elements;\n }\n\n const normalized: Record<string, AppElementValue> = {};\n for (const [key, value] of Object.entries(elements)) {\n normalized[key] =\n isAppElementsWireSlotId(key) && value === APP_UNMATCHED_SLOT_WIRE_VALUE\n ? UNMATCHED_SLOT\n : value;\n }\n\n return normalized;\n}\n\nfunction isLayoutFlagsRecord(value: unknown): value is LayoutFlags {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return false;\n for (const v of Object.values(value)) {\n if (v !== \"s\" && v !== \"d\") return false;\n }\n return true;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction parseLayoutFlags(value: unknown): LayoutFlags {\n if (isLayoutFlagsRecord(value)) return value;\n return {};\n}\n\nfunction parseLayoutIds(value: unknown): readonly string[] {\n if (value === undefined) return [];\n if (!Array.isArray(value)) {\n throw new Error(\n \"[vinext] Invalid __layoutIds in App Router payload: expected layout id string[]\",\n );\n }\n\n const layoutIds: string[] = [];\n for (const entry of value) {\n if (typeof entry !== \"string\") {\n throw new Error(\n \"[vinext] Invalid __layoutIds in App Router payload: expected layout id string[]\",\n );\n }\n\n const parsed = parseAppElementsWireElementKey(entry);\n if (parsed?.kind !== \"layout\") {\n throw new Error(\"[vinext] Invalid __layoutIds in App Router payload: expected layout ids\");\n }\n\n layoutIds.push(entry);\n }\n return layoutIds;\n}\n\nfunction isSlotBindingState(value: unknown): value is AppElementsSlotBindingState {\n return value === \"active\" || value === \"default\" || value === \"unmatched\";\n}\n\nfunction parseSlotBindings(\n value: unknown,\n options: { layoutIds?: readonly string[] } = {},\n): readonly AppElementsSlotBinding[] {\n // Missing metadata is compatibility-safe but not semantic proof: callers see\n // an empty binding list, so promoted default/unmatched slot preservation is\n // denied instead of inferred from legacy transport shape.\n if (value === undefined) return [];\n if (!Array.isArray(value)) {\n throw new Error(\"[vinext] Invalid __slotBindings in App Router payload: expected array\");\n }\n\n const slotBindings: AppElementsSlotBinding[] = [];\n for (const entry of value) {\n if (!isRecord(entry)) {\n throw new Error(\"[vinext] Invalid __slotBindings in App Router payload: expected objects\");\n }\n\n const slotId = entry.slotId;\n if (typeof slotId !== \"string\" || parseAppElementsWireElementKey(slotId)?.kind !== \"slot\") {\n throw new Error(\"[vinext] Invalid __slotBindings in App Router payload: expected slot ids\");\n }\n\n const ownerLayoutId = entry.ownerLayoutId;\n if (\n ownerLayoutId !== null &&\n (typeof ownerLayoutId !== \"string\" ||\n parseAppElementsWireElementKey(ownerLayoutId)?.kind !== \"layout\")\n ) {\n throw new Error(\n \"[vinext] Invalid __slotBindings in App Router payload: expected owner layout ids\",\n );\n }\n\n const state = entry.state;\n if (!isSlotBindingState(state)) {\n throw new Error(\"[vinext] Invalid __slotBindings in App Router payload: expected state\");\n }\n\n slotBindings.push({ ownerLayoutId, slotId, state });\n }\n return normalizeAppElementsSlotBindings(slotBindings, options);\n}\n\nfunction readRequiredInterceptionString(\n entry: Record<string, unknown>,\n fieldName: keyof AppElementsInterception,\n): string {\n const value = entry[fieldName];\n if (typeof value !== \"string\") {\n throw new Error(\"[vinext] Invalid __interception in App Router payload: expected strings\");\n }\n return value;\n}\n\nfunction parseInterceptionMatchedUrl(value: string): string {\n if (!isInterceptionMatchedUrlPath(value)) {\n throw new Error(\"[vinext] Invalid __interception in App Router payload: expected path URLs\");\n }\n return value;\n}\n\nfunction parseInterceptionRouteId(value: string, matchedUrl: string): string {\n const parsed = parseAppElementsWireElementKey(value);\n if (\n parsed?.kind !== \"route\" ||\n parsed.path !== matchedUrl ||\n parsed.interceptionContext !== null\n ) {\n throw new Error(\"[vinext] Invalid __interception in App Router payload: expected route ids\");\n }\n return value;\n}\n\nfunction parseInterceptionSlotId(value: string): string {\n if (parseAppElementsWireElementKey(value)?.kind !== \"slot\") {\n throw new Error(\"[vinext] Invalid __interception in App Router payload: expected slot id\");\n }\n return value;\n}\n\nfunction parseInterceptionMetadata(value: unknown): AppElementsInterception | null {\n if (value === undefined || value === null) return null;\n if (!isRecord(value)) {\n throw new Error(\"[vinext] Invalid __interception in App Router payload: expected object\");\n }\n\n const sourceMatchedUrl = parseInterceptionMatchedUrl(\n readRequiredInterceptionString(value, \"sourceMatchedUrl\"),\n );\n const targetMatchedUrl = parseInterceptionMatchedUrl(\n readRequiredInterceptionString(value, \"targetMatchedUrl\"),\n );\n return {\n sourceMatchedUrl,\n sourceRouteId: parseInterceptionRouteId(\n readRequiredInterceptionString(value, \"sourceRouteId\"),\n sourceMatchedUrl,\n ),\n slotId: parseInterceptionSlotId(readRequiredInterceptionString(value, \"slotId\")),\n targetMatchedUrl,\n targetRouteId: parseInterceptionRouteId(\n readRequiredInterceptionString(value, \"targetRouteId\"),\n targetMatchedUrl,\n ),\n };\n}\n\n/**\n * Type predicate for a plain (non-null, non-array) record of app payload values.\n * Used to distinguish the App Router payload object from bare React elements at\n * the render boundary. Narrows to `Readonly<Record<string, unknown>>` because\n * the outgoing payload carries heterogeneous values (ReactNodes for the rendered\n * tree, plus metadata like `__layoutFlags` which is a plain object). Delegates\n * to React's canonical `isValidElement` so we don't depend on React's internal\n * `$$typeof` marker scheme.\n */\nexport function isAppElementsRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n if (typeof value !== \"object\" || value === null) return false;\n if (Array.isArray(value)) return false;\n if (isValidElement(value)) return false;\n return true;\n}\n\nexport function withLayoutFlags<T extends Record<string, unknown>>(\n elements: T,\n layoutFlags: LayoutFlags,\n): T & { [APP_LAYOUT_FLAGS_KEY]: LayoutFlags } {\n return { ...elements, [APP_LAYOUT_FLAGS_KEY]: layoutFlags };\n}\n\nexport function buildOutgoingAppPayload(input: {\n element:\n | ReactNode\n | Readonly<\n Record<string, ReactNode | AppElementsInterception | readonly AppElementsSlotBinding[]>\n >;\n artifactCompatibility?: ArtifactCompatibilityEnvelope;\n cacheEntryReuseProof?: CacheEntryReuseProof;\n layoutFlags: LayoutFlags;\n renderObservation?: RenderObservation;\n}): ReactNode | AppOutgoingElements {\n if (!isAppElementsRecord(input.element)) {\n return input.element;\n }\n const payload: Record<\n string,\n | ReactNode\n | LayoutFlags\n | ArtifactCompatibilityEnvelope\n | CacheEntryReuseProof\n | AppElementsInterception\n | RenderObservation\n | readonly AppElementsSlotBinding[]\n > = {\n ...input.element,\n [APP_LAYOUT_FLAGS_KEY]: input.layoutFlags,\n [APP_ARTIFACT_COMPATIBILITY_KEY]:\n input.artifactCompatibility ?? createArtifactCompatibilityEnvelope(),\n };\n if (input.cacheEntryReuseProof) {\n payload[APP_CACHE_ENTRY_REUSE_PROOF_KEY] = input.cacheEntryReuseProof;\n }\n if (input.renderObservation) {\n payload[APP_RENDER_OBSERVATION_KEY] = input.renderObservation;\n }\n return payload;\n}\n\nfunction readArtifactCompatibilityMetadata(value: unknown): ArtifactCompatibilityEnvelope {\n if (value === undefined) return createArtifactCompatibilityEnvelope();\n\n const artifactCompatibility = parseArtifactCompatibilityEnvelope(value);\n // TODO(#726-COMPAT-04): hard-fail malformed compatibility metadata once\n // cache/skip consumers depend on this proof. During Wave01 the field is\n // emitted as scaffolding, so bad or future-version values degrade like\n // missing __layoutFlags instead of crashing render paths that do not read it.\n return artifactCompatibility ?? createArtifactCompatibilityEnvelope();\n}\n\nfunction createMissingCacheEntryReuseProof(): CacheEntryReuseProof {\n return {\n kind: \"runtime-cache-entry\",\n decision: null,\n };\n}\n\nfunction isCacheProofRejectionCode(value: unknown): value is CacheProofRejectionCode {\n return typeof value === \"string\" && CACHE_PROOF_REJECTION_CODES.has(value);\n}\n\nfunction isCacheProofFallbackMode(value: unknown): value is CacheProofBreakerFallbackMode {\n return value === \"renderFresh\" || value === \"privateUncacheable\";\n}\n\nfunction isCacheProofFallbackScope(value: unknown): value is CacheProofFallbackScope {\n return value === \"affectedOutput\" || value === \"route\";\n}\n\n// Three-way wire semantics are intentional:\n// - null means the proof field was absent and no cache authority was claimed.\n// - { decision: null } means a present proof was malformed or unusable.\n// - { decision: ... } means the proof parsed into an explicit reuse decision.\nfunction parseCacheEntryReuseProofMetadata(value: unknown): CacheEntryReuseProof | null {\n if (value === undefined) return null;\n if (!isRecord(value) || value.kind !== \"runtime-cache-entry\") {\n return createMissingCacheEntryReuseProof();\n }\n\n const decision = value.decision;\n if (decision === null) return createMissingCacheEntryReuseProof();\n if (!isRecord(decision)) return createMissingCacheEntryReuseProof();\n\n if (\n decision.kind === \"reuse\" &&\n decision.canReuse === true &&\n decision.code === \"CP_STATIC_LAYOUT_REUSE_PROVEN\" &&\n // Static layout proofs are the only runtime cache-entry reuse class today.\n // Extend this parser alongside any new reuse class before it can restore\n // visited cache entries as commit-capable payloads.\n decision.reuseClass === \"static-layout\"\n ) {\n return {\n kind: \"runtime-cache-entry\",\n decision: {\n canReuse: true,\n code: decision.code,\n kind: \"reuse\",\n reuseClass: decision.reuseClass,\n },\n };\n }\n\n if (\n decision.kind === \"reject\" &&\n decision.canReuse === false &&\n isCacheProofRejectionCode(decision.code) &&\n isCacheProofFallbackMode(decision.mode) &&\n isCacheProofFallbackScope(decision.scope)\n ) {\n return {\n kind: \"runtime-cache-entry\",\n decision: {\n canReuse: false,\n code: decision.code,\n kind: \"reject\",\n mode: decision.mode,\n scope: decision.scope,\n },\n };\n }\n\n return createMissingCacheEntryReuseProof();\n}\n\nexport function readAppElementsMetadata(\n elements: Readonly<Record<string, unknown>>,\n): AppElementsMetadata {\n const routeId = elements[APP_ROUTE_KEY];\n if (typeof routeId !== \"string\") {\n throw new Error(\"[vinext] Missing __route string in App Router payload\");\n }\n\n const interceptionContext = elements[APP_INTERCEPTION_CONTEXT_KEY];\n if (\n interceptionContext !== undefined &&\n interceptionContext !== null &&\n typeof interceptionContext !== \"string\"\n ) {\n throw new Error(\"[vinext] Invalid __interceptionContext in App Router payload\");\n }\n\n const rootLayoutTreePath = elements[APP_ROOT_LAYOUT_KEY];\n if (rootLayoutTreePath === undefined) {\n throw new Error(\"[vinext] Missing __rootLayout key in App Router payload\");\n }\n if (rootLayoutTreePath !== null && typeof rootLayoutTreePath !== \"string\") {\n throw new Error(\"[vinext] Invalid __rootLayout in App Router payload: expected string or null\");\n }\n\n const layoutFlags = parseLayoutFlags(elements[APP_LAYOUT_FLAGS_KEY]);\n const layoutIds = parseLayoutIds(elements[APP_LAYOUT_IDS_KEY]);\n const slotBindings = parseSlotBindings(elements[APP_SLOT_BINDINGS_KEY], { layoutIds });\n const interception = parseInterceptionMetadata(elements[APP_INTERCEPTION_KEY]);\n const artifactCompatibility = readArtifactCompatibilityMetadata(\n elements[APP_ARTIFACT_COMPATIBILITY_KEY],\n );\n const cacheEntryReuseProof = parseCacheEntryReuseProofMetadata(\n elements[APP_CACHE_ENTRY_REUSE_PROOF_KEY],\n );\n\n return {\n artifactCompatibility,\n ...(cacheEntryReuseProof ? { cacheEntryReuseProof } : {}),\n interception,\n interceptionContext: interceptionContext ?? null,\n layoutIds,\n layoutFlags,\n routeId,\n rootLayoutTreePath,\n slotBindings,\n };\n}\n\nexport const AppElementsWire: AppElementsWireCodec = {\n // WIRE follow-ups use these stable key names when moving payload readers and writers\n // behind the codec boundary.\n keys: {\n artifactCompatibility: APP_ARTIFACT_COMPATIBILITY_KEY,\n cacheEntryReuseProof: APP_CACHE_ENTRY_REUSE_PROOF_KEY,\n interception: APP_INTERCEPTION_KEY,\n interceptionContext: APP_INTERCEPTION_CONTEXT_KEY,\n layoutIds: APP_LAYOUT_IDS_KEY,\n layoutFlags: APP_LAYOUT_FLAGS_KEY,\n renderObservation: APP_RENDER_OBSERVATION_KEY,\n rootLayout: APP_ROOT_LAYOUT_KEY,\n route: APP_ROUTE_KEY,\n slotBindings: APP_SLOT_BINDINGS_KEY,\n },\n unmatchedSlotValue: APP_UNMATCHED_SLOT_WIRE_VALUE,\n createMetadataEntries: createAppElementsWireMetadataEntries,\n decode: normalizeAppElements,\n encodeCacheKey: createAppPayloadCacheKey,\n encodeLayoutId: createAppPayloadLayoutId,\n encodeOutgoingPayload: buildOutgoingAppPayload,\n encodePageId: createAppPayloadPageId,\n encodeRouteId: createAppPayloadRouteId,\n encodeSlotId: createAppPayloadSlotId,\n encodeTemplateId: createAppPayloadTemplateId,\n isSlotId: isAppElementsWireSlotId,\n parseElementKey: parseAppElementsWireElementKey,\n readMetadata: readAppElementsMetadata,\n withLayoutFlags,\n};\n"],"mappings":";;;;AAeA,MAAM,6BAA6B;AAEnC,MAAa,iCAAiC;AAC9C,MAAa,kCAAkC;AAC/C,MAAa,uBAAuB;AACpC,MAAa,+BAA+B;AAC5C,MAAa,qBAAqB;AAClC,MAAa,uBAAuB;AACpC,MAAa,6BAA6B;AAC1C,MAAa,gBAAgB;AAC7B,MAAa,sBAAsB;AACnC,MAAa,wBAAwB;AACrC,MAAa,gCAAgC;AAE7C,MAAa,iBAAiB,OAAO,IAAI,uBAAuB;AAEhE,SAAS,iCACP,OAOqB;CACrB,OAAO,IAAI,IAAI,MAAM;;AAGvB,MAAM,8BAA8B,iCAAiC;CACnE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;C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