vinext 0.0.51 → 0.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/build/clean-output.d.ts +14 -0
- package/dist/build/clean-output.js +36 -0
- package/dist/build/clean-output.js.map +1 -0
- package/dist/build/precompress.d.ts +7 -7
- package/dist/build/precompress.js +18 -17
- package/dist/build/precompress.js.map +1 -1
- package/dist/build/prerender.d.ts +9 -16
- package/dist/build/prerender.js +88 -50
- package/dist/build/prerender.js.map +1 -1
- package/dist/build/run-prerender.js +10 -1
- package/dist/build/run-prerender.js.map +1 -1
- package/dist/build/static-export.d.ts +5 -0
- package/dist/build/static-export.js +8 -3
- package/dist/build/static-export.js.map +1 -1
- package/dist/check.js +4 -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 +58 -4
- package/dist/cli.js.map +1 -1
- package/dist/client/instrumentation-client-inject.d.ts +34 -0
- package/dist/client/instrumentation-client-inject.js +57 -0
- package/dist/client/instrumentation-client-inject.js.map +1 -0
- package/dist/client/navigation-runtime.d.ts +60 -0
- package/dist/client/navigation-runtime.js +171 -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 +14 -3
- 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 +10 -2
- 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/cloudflare/tpr.js +1 -1
- package/dist/cloudflare/tpr.js.map +1 -1
- package/dist/config/config-matchers.d.ts +63 -16
- package/dist/config/config-matchers.js +145 -9
- package/dist/config/config-matchers.js.map +1 -1
- package/dist/config/next-config.d.ts +32 -5
- package/dist/config/next-config.js +55 -15
- package/dist/config/next-config.js.map +1 -1
- package/dist/deploy.js +130 -46
- package/dist/deploy.js.map +1 -1
- package/dist/entries/app-browser-entry.js +9 -3
- package/dist/entries/app-browser-entry.js.map +1 -1
- package/dist/entries/app-rsc-entry.d.ts +4 -2
- package/dist/entries/app-rsc-entry.js +76 -16
- package/dist/entries/app-rsc-entry.js.map +1 -1
- package/dist/entries/app-rsc-manifest.d.ts +1 -0
- package/dist/entries/app-rsc-manifest.js +53 -6
- 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 +40 -3
- package/dist/entries/pages-client-entry.js.map +1 -1
- package/dist/entries/pages-server-entry.js +261 -31
- 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 +161 -46
- package/dist/index.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.js +30 -5
- 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/strip-server-exports.js +5 -8
- package/dist/plugins/strip-server-exports.js.map +1 -1
- package/dist/routing/app-route-graph.d.ts +20 -1
- package/dist/routing/app-route-graph.js +58 -6
- 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-trie.js +13 -18
- package/dist/routing/route-trie.js.map +1 -1
- package/dist/routing/utils.d.ts +12 -1
- package/dist/routing/utils.js +18 -1
- package/dist/routing/utils.js.map +1 -1
- package/dist/server/api-handler.js +153 -42
- package/dist/server/api-handler.js.map +1 -1
- package/dist/server/app-browser-action-result.d.ts +16 -1
- package/dist/server/app-browser-action-result.js +15 -1
- package/dist/server/app-browser-action-result.js.map +1 -1
- package/dist/server/app-browser-entry.js +309 -155
- package/dist/server/app-browser-entry.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 +3 -1
- package/dist/server/app-browser-navigation-controller.js +5 -1
- package/dist/server/app-browser-navigation-controller.js.map +1 -1
- package/dist/server/app-browser-rsc-redirect.d.ts +2 -1
- package/dist/server/app-browser-rsc-redirect.js +2 -2
- package/dist/server/app-browser-rsc-redirect.js.map +1 -1
- package/dist/server/app-browser-state.d.ts +18 -1
- package/dist/server/app-browser-state.js +19 -1
- package/dist/server/app-browser-state.js.map +1 -1
- package/dist/server/app-browser-stream.d.ts +5 -14
- package/dist/server/app-browser-stream.js +13 -7
- package/dist/server/app-browser-stream.js.map +1 -1
- package/dist/server/app-browser-visible-commit.d.ts +2 -1
- package/dist/server/app-browser-visible-commit.js +1 -0
- package/dist/server/app-browser-visible-commit.js.map +1 -1
- package/dist/server/app-elements-wire.d.ts +10 -5
- package/dist/server/app-elements-wire.js +84 -2
- 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 +12 -3
- package/dist/server/app-fallback-renderer.js +15 -8
- package/dist/server/app-fallback-renderer.js.map +1 -1
- package/dist/server/app-history-state.js +6 -2
- package/dist/server/app-history-state.js.map +1 -1
- package/dist/server/app-interception-context-header.d.ts +33 -0
- package/dist/server/app-interception-context-header.js +44 -0
- package/dist/server/app-interception-context-header.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-mounted-slots-header.d.ts +19 -0
- package/dist/server/app-mounted-slots-header.js +40 -1
- package/dist/server/app-mounted-slots-header.js.map +1 -1
- package/dist/server/app-optimistic-routing.d.ts +54 -0
- package/dist/server/app-optimistic-routing.js +208 -0
- package/dist/server/app-optimistic-routing.js.map +1 -0
- package/dist/server/app-page-boundary-render.d.ts +1 -0
- package/dist/server/app-page-boundary-render.js +2 -0
- package/dist/server/app-page-boundary-render.js.map +1 -1
- package/dist/server/app-page-boundary.d.ts +1 -0
- package/dist/server/app-page-boundary.js +2 -0
- package/dist/server/app-page-boundary.js.map +1 -1
- package/dist/server/app-page-cache.d.ts +15 -1
- package/dist/server/app-page-cache.js +68 -7
- package/dist/server/app-page-cache.js.map +1 -1
- package/dist/server/app-page-dispatch.d.ts +5 -0
- package/dist/server/app-page-dispatch.js +39 -5
- package/dist/server/app-page-dispatch.js.map +1 -1
- package/dist/server/app-page-element-builder.d.ts +2 -1
- package/dist/server/app-page-element-builder.js +7 -3
- package/dist/server/app-page-element-builder.js.map +1 -1
- package/dist/server/app-page-execution.d.ts +29 -1
- package/dist/server/app-page-execution.js +91 -4
- package/dist/server/app-page-execution.js.map +1 -1
- package/dist/server/app-page-head.d.ts +1 -0
- package/dist/server/app-page-head.js +29 -2
- package/dist/server/app-page-head.js.map +1 -1
- package/dist/server/app-page-probe.js +1 -1
- package/dist/server/app-page-render-observation.js +1 -1
- package/dist/server/app-page-render.d.ts +3 -0
- package/dist/server/app-page-render.js +7 -3
- package/dist/server/app-page-render.js.map +1 -1
- package/dist/server/app-page-response.d.ts +11 -1
- package/dist/server/app-page-response.js +18 -5
- package/dist/server/app-page-response.js.map +1 -1
- package/dist/server/app-page-route-wiring.d.ts +1 -0
- package/dist/server/app-page-route-wiring.js +35 -15
- package/dist/server/app-page-route-wiring.js.map +1 -1
- package/dist/server/app-page-stream.d.ts +4 -0
- package/dist/server/app-page-stream.js +3 -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 +7 -1
- package/dist/server/app-route-handler-dispatch.js +4 -1
- package/dist/server/app-route-handler-dispatch.js.map +1 -1
- package/dist/server/app-route-handler-execution.d.ts +18 -2
- package/dist/server/app-route-handler-execution.js +1 -0
- package/dist/server/app-route-handler-execution.js.map +1 -1
- package/dist/server/app-route-handler-response.js +6 -5
- package/dist/server/app-route-handler-response.js.map +1 -1
- package/dist/server/app-router-entry.js +6 -2
- package/dist/server/app-router-entry.js.map +1 -1
- package/dist/server/app-rsc-handler.d.ts +11 -1
- package/dist/server/app-rsc-handler.js +48 -21
- 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 +6 -2
- 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.js +2 -2
- package/dist/server/app-rsc-route-matching.js.map +1 -1
- package/dist/server/app-segment-config.d.ts +4 -1
- package/dist/server/app-segment-config.js +6 -1
- package/dist/server/app-segment-config.js.map +1 -1
- package/dist/server/app-server-action-execution.d.ts +1 -0
- package/dist/server/app-server-action-execution.js +5 -1
- package/dist/server/app-server-action-execution.js.map +1 -1
- package/dist/server/app-ssr-entry.d.ts +2 -0
- package/dist/server/app-ssr-entry.js +92 -55
- package/dist/server/app-ssr-entry.js.map +1 -1
- package/dist/server/app-ssr-stream.d.ts +30 -2
- package/dist/server/app-ssr-stream.js +95 -8
- package/dist/server/app-ssr-stream.js.map +1 -1
- package/dist/server/app-static-generation.d.ts +1 -0
- package/dist/server/app-static-generation.js +2 -1
- package/dist/server/app-static-generation.js.map +1 -1
- package/dist/server/artifact-compatibility.d.ts +1 -1
- 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 +49 -3
- package/dist/server/cache-proof.js +78 -22
- 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/default-not-found-module.d.ts +20 -0
- package/dist/server/default-not-found-module.js +20 -0
- package/dist/server/default-not-found-module.js.map +1 -0
- package/dist/server/dev-server.d.ts +10 -2
- package/dist/server/dev-server.js +99 -36
- 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/headers.d.ts +22 -1
- package/dist/server/headers.js +22 -1
- package/dist/server/headers.js.map +1 -1
- package/dist/server/http-error-responses.d.ts +16 -1
- package/dist/server/http-error-responses.js +21 -1
- package/dist/server/http-error-responses.js.map +1 -1
- package/dist/server/image-optimization.d.ts +13 -4
- package/dist/server/image-optimization.js +15 -4
- package/dist/server/image-optimization.js.map +1 -1
- package/dist/server/isr-cache.d.ts +6 -2
- package/dist/server/isr-cache.js +20 -4
- package/dist/server/isr-cache.js.map +1 -1
- package/dist/server/middleware-runtime.d.ts +15 -0
- package/dist/server/middleware-runtime.js +59 -7
- package/dist/server/middleware-runtime.js.map +1 -1
- package/dist/server/middleware.d.ts +1 -1
- package/dist/server/middleware.js +5 -3
- package/dist/server/middleware.js.map +1 -1
- package/dist/server/navigation-planner.d.ts +9 -3
- package/dist/server/navigation-planner.js +98 -25
- package/dist/server/navigation-planner.js.map +1 -1
- package/dist/server/navigation-trace.d.ts +2 -1
- package/dist/server/navigation-trace.js +1 -0
- package/dist/server/navigation-trace.js.map +1 -1
- package/dist/server/pages-api-route.d.ts +45 -1
- package/dist/server/pages-api-route.js +27 -4
- package/dist/server/pages-api-route.js.map +1 -1
- package/dist/server/pages-body-parser-config.d.ts +60 -0
- package/dist/server/pages-body-parser-config.js +79 -0
- package/dist/server/pages-body-parser-config.js.map +1 -0
- package/dist/server/pages-data-route.d.ts +77 -0
- package/dist/server/pages-data-route.js +98 -0
- package/dist/server/pages-data-route.js.map +1 -0
- package/dist/server/pages-default-404.d.ts +31 -0
- package/dist/server/pages-default-404.js +40 -0
- package/dist/server/pages-default-404.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-node-compat.d.ts +10 -0
- package/dist/server/pages-node-compat.js +12 -1
- package/dist/server/pages-node-compat.js.map +1 -1
- package/dist/server/pages-page-data.d.ts +69 -2
- package/dist/server/pages-page-data.js +47 -31
- package/dist/server/pages-page-data.js.map +1 -1
- package/dist/server/pages-page-response.d.ts +13 -1
- package/dist/server/pages-page-response.js +16 -11
- package/dist/server/pages-page-response.js.map +1 -1
- package/dist/server/prerender-route-params.d.ts +14 -0
- package/dist/server/prerender-route-params.js +94 -0
- package/dist/server/prerender-route-params.js.map +1 -0
- package/dist/server/prod-server.d.ts +15 -37
- package/dist/server/prod-server.js +143 -107
- package/dist/server/prod-server.js.map +1 -1
- package/dist/server/proxy-trust.d.ts +41 -0
- package/dist/server/proxy-trust.js +70 -0
- package/dist/server/proxy-trust.js.map +1 -0
- package/dist/server/request-pipeline.d.ts +13 -4
- package/dist/server/request-pipeline.js +32 -14
- package/dist/server/request-pipeline.js.map +1 -1
- package/dist/server/seed-cache.d.ts +12 -31
- package/dist/server/seed-cache.js +30 -37
- package/dist/server/seed-cache.js.map +1 -1
- package/dist/server/server-action-not-found.js +8 -3
- package/dist/server/server-action-not-found.js.map +1 -1
- 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 +8 -7
- package/dist/server/static-file-cache.js.map +1 -1
- package/dist/server/streaming-metadata.d.ts +5 -0
- package/dist/server/streaming-metadata.js +10 -0
- package/dist/server/streaming-metadata.js.map +1 -0
- package/dist/shims/app-router-scroll-state.d.ts +12 -0
- package/dist/shims/app-router-scroll-state.js +38 -0
- package/dist/shims/app-router-scroll-state.js.map +1 -0
- package/dist/shims/app-router-scroll.d.ts +14 -0
- package/dist/shims/app-router-scroll.js +100 -0
- package/dist/shims/app-router-scroll.js.map +1 -0
- package/dist/shims/before-interactive-context.d.ts +30 -0
- package/dist/shims/before-interactive-context.js +10 -0
- package/dist/shims/before-interactive-context.js.map +1 -0
- package/dist/shims/cache-runtime.d.ts +1 -1
- package/dist/shims/cache-runtime.js +14 -1
- package/dist/shims/cache-runtime.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/default-not-found.d.ts +12 -0
- package/dist/shims/default-not-found.js +61 -0
- package/dist/shims/default-not-found.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/font-local.d.ts +5 -0
- package/dist/shims/font-local.js +6 -2
- package/dist/shims/font-local.js.map +1 -1
- package/dist/shims/form.js +13 -6
- package/dist/shims/form.js.map +1 -1
- package/dist/shims/head.js +4 -4
- package/dist/shims/head.js.map +1 -1
- package/dist/shims/headers.d.ts +6 -2
- package/dist/shims/headers.js +64 -21
- package/dist/shims/headers.js.map +1 -1
- package/dist/shims/image.d.ts +1 -1
- package/dist/shims/image.js +4 -4
- package/dist/shims/image.js.map +1 -1
- package/dist/shims/internal/pages-data-target.d.ts +58 -0
- package/dist/shims/internal/pages-data-target.js +91 -0
- package/dist/shims/internal/pages-data-target.js.map +1 -0
- package/dist/shims/internal/pages-data-url.d.ts +42 -0
- package/dist/shims/internal/pages-data-url.js +73 -0
- package/dist/shims/internal/pages-data-url.js.map +1 -0
- package/dist/shims/link.d.ts +21 -3
- package/dist/shims/link.js +189 -30
- package/dist/shims/link.js.map +1 -1
- package/dist/shims/metadata.d.ts +2 -1
- package/dist/shims/metadata.js +65 -6
- package/dist/shims/metadata.js.map +1 -1
- package/dist/shims/navigation.d.ts +8 -2
- package/dist/shims/navigation.js +67 -23
- package/dist/shims/navigation.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/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 +12 -5
- package/dist/shims/router.js +535 -86
- package/dist/shims/router.js.map +1 -1
- package/dist/shims/script.js +86 -12
- package/dist/shims/script.js.map +1 -1
- package/dist/shims/server.d.ts +21 -4
- package/dist/shims/server.js +30 -9
- package/dist/shims/server.js.map +1 -1
- package/dist/shims/slot.js +5 -1
- package/dist/shims/slot.js.map +1 -1
- package/dist/shims/unified-request-context.d.ts +1 -1
- 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 +2 -1
- package/dist/shims/url-utils.js +15 -4
- 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 +33 -5
- package/dist/utils/asset-prefix.js +39 -6
- package/dist/utils/asset-prefix.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/html-limited-bots.d.ts +5 -0
- package/dist/utils/html-limited-bots.js +15 -0
- package/dist/utils/html-limited-bots.js.map +1 -0
- 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/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 +23 -1
- package/dist/utils/query.js +46 -2
- 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/package.json +11 -3
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { fnv1a64 } from "../utils/hash.js";
|
|
2
|
+
import { isUnknownRecord } from "../utils/record.js";
|
|
3
|
+
import { parseArtifactCompatibilityEnvelope } from "./artifact-compatibility.js";
|
|
4
|
+
import { AppElementsWire } from "./app-elements-wire.js";
|
|
5
|
+
//#region src/server/client-reuse-manifest.ts
|
|
6
|
+
const CLIENT_REUSE_MANIFEST_SCHEMA_VERSION = 1;
|
|
7
|
+
const CLIENT_REUSE_MANIFEST_HASH_ALGORITHM = "fnv1a64";
|
|
8
|
+
const DEFAULT_CLIENT_REUSE_MANIFEST_LIMITS = {
|
|
9
|
+
maxEntryCount: 64,
|
|
10
|
+
maxEntryIdLength: 512,
|
|
11
|
+
maxManifestBytes: 4096,
|
|
12
|
+
maxPayloadHashLength: 16,
|
|
13
|
+
maxVariantCacheKeyLength: 256
|
|
14
|
+
};
|
|
15
|
+
const HASH_DIGEST_PATTERN = /^[0-9a-z]+$/;
|
|
16
|
+
const textEncoder = new TextEncoder();
|
|
17
|
+
function createRejection(code, fields = {}) {
|
|
18
|
+
return {
|
|
19
|
+
code,
|
|
20
|
+
fields
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function rejectManifest(code, fields = {}) {
|
|
24
|
+
return {
|
|
25
|
+
kind: "rejected",
|
|
26
|
+
rejection: createRejection(code, fields)
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function rejectEntry(code, entryId, fields = {}) {
|
|
30
|
+
return {
|
|
31
|
+
code,
|
|
32
|
+
entryId,
|
|
33
|
+
fields
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function compareManifestEntries(left, right) {
|
|
37
|
+
if (left.id < right.id) return -1;
|
|
38
|
+
if (left.id > right.id) return 1;
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
function createCanonicalWireEntries(entries) {
|
|
42
|
+
const entriesById = /* @__PURE__ */ new Map();
|
|
43
|
+
for (const entry of entries) if (!entriesById.has(entry.id)) entriesById.set(entry.id, entry);
|
|
44
|
+
return Array.from(entriesById.values()).sort(compareManifestEntries);
|
|
45
|
+
}
|
|
46
|
+
function countUtf8Bytes(input) {
|
|
47
|
+
return textEncoder.encode(input).length;
|
|
48
|
+
}
|
|
49
|
+
function isVisibleCommitVersion(value) {
|
|
50
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
51
|
+
}
|
|
52
|
+
function parseReplayWindow(value, visibleCommitVersion) {
|
|
53
|
+
if (!isUnknownRecord(value)) return {
|
|
54
|
+
kind: "rejected",
|
|
55
|
+
rejection: createRejection("SKIP_REPLAY_WINDOW_INVALID", { field: "replayWindow" })
|
|
56
|
+
};
|
|
57
|
+
const validFromVisibleCommitVersion = value.validFromVisibleCommitVersion;
|
|
58
|
+
const validUntilVisibleCommitVersion = value.validUntilVisibleCommitVersion;
|
|
59
|
+
if (!isVisibleCommitVersion(validFromVisibleCommitVersion) || !isVisibleCommitVersion(validUntilVisibleCommitVersion) || validFromVisibleCommitVersion > validUntilVisibleCommitVersion || visibleCommitVersion < validFromVisibleCommitVersion || visibleCommitVersion > validUntilVisibleCommitVersion) return {
|
|
60
|
+
kind: "rejected",
|
|
61
|
+
rejection: createRejection("SKIP_REPLAY_WINDOW_INVALID", {
|
|
62
|
+
validFromVisibleCommitVersion: isVisibleCommitVersion(validFromVisibleCommitVersion) ? validFromVisibleCommitVersion : null,
|
|
63
|
+
validUntilVisibleCommitVersion: isVisibleCommitVersion(validUntilVisibleCommitVersion) ? validUntilVisibleCommitVersion : null,
|
|
64
|
+
visibleCommitVersion
|
|
65
|
+
})
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
kind: "parsed",
|
|
69
|
+
replayWindow: {
|
|
70
|
+
validFromVisibleCommitVersion,
|
|
71
|
+
validUntilVisibleCommitVersion
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function currentCommitVersionMatchesReplayWindow(currentVisibleCommitVersion, replayWindow) {
|
|
76
|
+
if (currentVisibleCommitVersion === void 0) return true;
|
|
77
|
+
return currentVisibleCommitVersion >= replayWindow.validFromVisibleCommitVersion && currentVisibleCommitVersion <= replayWindow.validUntilVisibleCommitVersion;
|
|
78
|
+
}
|
|
79
|
+
function parseEntryKind(id) {
|
|
80
|
+
const parsed = AppElementsWire.parseElementKey(id);
|
|
81
|
+
if (parsed === null) return null;
|
|
82
|
+
return parsed.kind;
|
|
83
|
+
}
|
|
84
|
+
function isValidPayloadHash(value, limits) {
|
|
85
|
+
return typeof value === "string" && value.length > 0 && value.length <= limits.maxPayloadHashLength && HASH_DIGEST_PATTERN.test(value);
|
|
86
|
+
}
|
|
87
|
+
function parseManifestEntry(value, limits, index) {
|
|
88
|
+
if (!isUnknownRecord(value)) return rejectEntry("SKIP_ENTRY_MALFORMED", null, { index });
|
|
89
|
+
const id = value.id;
|
|
90
|
+
if (typeof id !== "string" || id.length === 0) return rejectEntry("SKIP_ENTRY_ID_INVALID", null, { index });
|
|
91
|
+
if (id.length > limits.maxEntryIdLength) return rejectEntry("SKIP_ENTRY_ID_TOO_LONG", id, {
|
|
92
|
+
idHash: createClientReusePayloadHash(id),
|
|
93
|
+
maxEntryIdLength: limits.maxEntryIdLength
|
|
94
|
+
});
|
|
95
|
+
const kind = parseEntryKind(id);
|
|
96
|
+
if (kind === null) return rejectEntry("SKIP_UNKNOWN_ENTRY", id, { idHash: createClientReusePayloadHash(id) });
|
|
97
|
+
const privacy = value.privacy;
|
|
98
|
+
if (privacy === "private") return rejectEntry("SKIP_PRIVATE_ENTRY", id, { privacy });
|
|
99
|
+
if (privacy !== "public") return rejectEntry("SKIP_ENTRY_MALFORMED", id, { field: "privacy" });
|
|
100
|
+
const payloadHash = value.payloadHash;
|
|
101
|
+
if (!isValidPayloadHash(payloadHash, limits)) return rejectEntry("SKIP_ENTRY_HASH_INVALID", id, { maxPayloadHashLength: limits.maxPayloadHashLength });
|
|
102
|
+
const variantCacheKey = value.variantCacheKey;
|
|
103
|
+
if (typeof variantCacheKey !== "string" || variantCacheKey.length === 0) return rejectEntry("SKIP_VARIANT_CACHE_KEY_INVALID", id, { field: "variantCacheKey" });
|
|
104
|
+
if (variantCacheKey.length > limits.maxVariantCacheKeyLength) return rejectEntry("SKIP_VARIANT_CACHE_KEY_TOO_LONG", id, {
|
|
105
|
+
maxVariantCacheKeyLength: limits.maxVariantCacheKeyLength,
|
|
106
|
+
variantCacheKeyHash: createClientReusePayloadHash(variantCacheKey)
|
|
107
|
+
});
|
|
108
|
+
const artifactCompatibility = parseArtifactCompatibilityEnvelope(value.artifactCompatibility);
|
|
109
|
+
if (artifactCompatibility === null) return rejectEntry("SKIP_ARTIFACT_COMPATIBILITY_INVALID", id, { field: "artifactCompatibility" });
|
|
110
|
+
return {
|
|
111
|
+
artifactCompatibility,
|
|
112
|
+
id,
|
|
113
|
+
kind,
|
|
114
|
+
payloadHash,
|
|
115
|
+
privacy,
|
|
116
|
+
variantCacheKey
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function createClientReusePayloadHash(input) {
|
|
120
|
+
return fnv1a64(input);
|
|
121
|
+
}
|
|
122
|
+
function createClientReuseManifest(input) {
|
|
123
|
+
const replayWindow = input.replayWindow ?? {
|
|
124
|
+
validFromVisibleCommitVersion: input.visibleCommitVersion,
|
|
125
|
+
validUntilVisibleCommitVersion: input.visibleCommitVersion
|
|
126
|
+
};
|
|
127
|
+
return {
|
|
128
|
+
entries: createCanonicalWireEntries(input.entries),
|
|
129
|
+
hashAlgorithm: CLIENT_REUSE_MANIFEST_HASH_ALGORITHM,
|
|
130
|
+
replayWindow,
|
|
131
|
+
schemaVersion: 1,
|
|
132
|
+
visibleCommitVersion: input.visibleCommitVersion
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function serializeClientReuseManifest(input) {
|
|
136
|
+
return JSON.stringify(createClientReuseManifest(input));
|
|
137
|
+
}
|
|
138
|
+
function parseClientReuseManifestHeader(rawHeader, options = {}) {
|
|
139
|
+
const header = rawHeader?.trim();
|
|
140
|
+
if (!header) return { kind: "absent" };
|
|
141
|
+
const limits = options.limits ?? DEFAULT_CLIENT_REUSE_MANIFEST_LIMITS;
|
|
142
|
+
const manifestBytes = countUtf8Bytes(header);
|
|
143
|
+
if (manifestBytes > limits.maxManifestBytes) return rejectManifest("SKIP_MANIFEST_TOO_LARGE", {
|
|
144
|
+
manifestBytes,
|
|
145
|
+
maxManifestBytes: limits.maxManifestBytes
|
|
146
|
+
});
|
|
147
|
+
let decoded;
|
|
148
|
+
try {
|
|
149
|
+
decoded = JSON.parse(header);
|
|
150
|
+
} catch {
|
|
151
|
+
return rejectManifest("SKIP_MANIFEST_MALFORMED");
|
|
152
|
+
}
|
|
153
|
+
if (!isUnknownRecord(decoded)) return rejectManifest("SKIP_MANIFEST_MALFORMED", { field: "manifest" });
|
|
154
|
+
if (decoded.schemaVersion !== 1) return rejectManifest("SKIP_MANIFEST_SCHEMA_UNSUPPORTED", { schemaVersion: typeof decoded.schemaVersion === "number" || typeof decoded.schemaVersion === "string" ? decoded.schemaVersion : null });
|
|
155
|
+
if (decoded.hashAlgorithm !== "fnv1a64") return rejectManifest("SKIP_HASH_ALGORITHM_UNSUPPORTED", { hashAlgorithm: typeof decoded.hashAlgorithm === "string" ? decoded.hashAlgorithm : null });
|
|
156
|
+
const visibleCommitVersion = decoded.visibleCommitVersion;
|
|
157
|
+
if (!isVisibleCommitVersion(visibleCommitVersion)) return rejectManifest("SKIP_VISIBLE_COMMIT_VERSION_INVALID", { visibleCommitVersion: null });
|
|
158
|
+
const replayWindowResult = parseReplayWindow(decoded.replayWindow, visibleCommitVersion);
|
|
159
|
+
if (replayWindowResult.kind === "rejected") return {
|
|
160
|
+
kind: "rejected",
|
|
161
|
+
rejection: replayWindowResult.rejection
|
|
162
|
+
};
|
|
163
|
+
const { replayWindow } = replayWindowResult;
|
|
164
|
+
if (!currentCommitVersionMatchesReplayWindow(options.currentVisibleCommitVersion, replayWindow)) return rejectManifest("SKIP_VISIBLE_COMMIT_VERSION_MISMATCH", {
|
|
165
|
+
currentVisibleCommitVersion: options.currentVisibleCommitVersion ?? null,
|
|
166
|
+
validFromVisibleCommitVersion: replayWindow.validFromVisibleCommitVersion,
|
|
167
|
+
validUntilVisibleCommitVersion: replayWindow.validUntilVisibleCommitVersion,
|
|
168
|
+
visibleCommitVersion
|
|
169
|
+
});
|
|
170
|
+
const entriesValue = decoded.entries;
|
|
171
|
+
if (!Array.isArray(entriesValue)) return rejectManifest("SKIP_MANIFEST_MALFORMED", { field: "entries" });
|
|
172
|
+
if (entriesValue.length > limits.maxEntryCount) return rejectManifest("SKIP_ENTRY_COUNT_EXCEEDED", {
|
|
173
|
+
entryCount: entriesValue.length,
|
|
174
|
+
maxEntryCount: limits.maxEntryCount
|
|
175
|
+
});
|
|
176
|
+
const entries = [];
|
|
177
|
+
const entryRejections = [];
|
|
178
|
+
let previousEntryId = null;
|
|
179
|
+
for (let index = 0; index < entriesValue.length; index++) {
|
|
180
|
+
const value = entriesValue[index];
|
|
181
|
+
if (isUnknownRecord(value) && typeof value.id === "string") {
|
|
182
|
+
if (previousEntryId !== null && value.id <= previousEntryId) return rejectManifest("SKIP_ENTRY_ORDER_NON_CANONICAL", {
|
|
183
|
+
entryIdHash: createClientReusePayloadHash(value.id),
|
|
184
|
+
previousEntryIdHash: createClientReusePayloadHash(previousEntryId)
|
|
185
|
+
});
|
|
186
|
+
previousEntryId = value.id;
|
|
187
|
+
}
|
|
188
|
+
const parsedEntry = parseManifestEntry(value, limits, index);
|
|
189
|
+
if ("code" in parsedEntry) entryRejections.push(parsedEntry);
|
|
190
|
+
else entries.push(parsedEntry);
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
entryRejections,
|
|
194
|
+
kind: "parsed",
|
|
195
|
+
manifest: {
|
|
196
|
+
entries,
|
|
197
|
+
hashAlgorithm: CLIENT_REUSE_MANIFEST_HASH_ALGORITHM,
|
|
198
|
+
replayWindow,
|
|
199
|
+
schemaVersion: 1,
|
|
200
|
+
visibleCommitVersion
|
|
201
|
+
},
|
|
202
|
+
skipDisposition: {
|
|
203
|
+
code: "SKIP_MODEL_DISABLED",
|
|
204
|
+
enabled: false,
|
|
205
|
+
mode: "renderAndSend"
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
//#endregion
|
|
210
|
+
export { CLIENT_REUSE_MANIFEST_HASH_ALGORITHM, CLIENT_REUSE_MANIFEST_SCHEMA_VERSION, DEFAULT_CLIENT_REUSE_MANIFEST_LIMITS, createClientReuseManifest, createClientReusePayloadHash, parseClientReuseManifestHeader, serializeClientReuseManifest };
|
|
211
|
+
|
|
212
|
+
//# sourceMappingURL=client-reuse-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-reuse-manifest.js","names":[],"sources":["../../src/server/client-reuse-manifest.ts"],"sourcesContent":["import {\n parseArtifactCompatibilityEnvelope,\n type ArtifactCompatibilityEnvelope,\n} from \"./artifact-compatibility.js\";\nimport { AppElementsWire } from \"./app-elements-wire.js\";\nimport { fnv1a64 } from \"../utils/hash.js\";\nimport { isUnknownRecord } from \"../utils/record.js\";\n\nexport const CLIENT_REUSE_MANIFEST_SCHEMA_VERSION = 1;\nexport type ClientReuseManifestSchemaVersion = 1;\n\nexport const CLIENT_REUSE_MANIFEST_HASH_ALGORITHM = \"fnv1a64\";\nexport type ClientReuseManifestHashAlgorithm = typeof CLIENT_REUSE_MANIFEST_HASH_ALGORITHM;\n\ntype ClientReuseManifestLimits = Readonly<{\n maxEntryCount: number;\n maxEntryIdLength: number;\n maxManifestBytes: number;\n maxPayloadHashLength: number;\n maxVariantCacheKeyLength: number;\n}>;\n\nexport const DEFAULT_CLIENT_REUSE_MANIFEST_LIMITS = {\n maxEntryCount: 64,\n maxEntryIdLength: 512,\n maxManifestBytes: 4096,\n maxPayloadHashLength: 16,\n maxVariantCacheKeyLength: 256,\n} satisfies ClientReuseManifestLimits;\n\nexport type ClientReuseManifestEntryKind = \"layout\" | \"page\" | \"route\" | \"slot\" | \"template\";\ntype ClientReuseManifestEntryPrivacy = \"private\" | \"public\";\n\nexport type ClientReuseManifestReplayWindow = Readonly<{\n validFromVisibleCommitVersion: number;\n validUntilVisibleCommitVersion: number;\n}>;\n\nexport type ClientReuseManifestEntry = Readonly<{\n artifactCompatibility: ArtifactCompatibilityEnvelope;\n id: string;\n kind: ClientReuseManifestEntryKind;\n payloadHash: string;\n privacy: \"public\";\n variantCacheKey: string;\n}>;\n\ntype ClientReuseManifestWireEntry = Readonly<{\n artifactCompatibility: ArtifactCompatibilityEnvelope;\n id: string;\n payloadHash: string;\n privacy: ClientReuseManifestEntryPrivacy;\n variantCacheKey: string;\n}>;\n\nexport type ClientReuseManifest = Readonly<{\n entries: readonly ClientReuseManifestEntry[];\n hashAlgorithm: ClientReuseManifestHashAlgorithm;\n replayWindow: ClientReuseManifestReplayWindow;\n schemaVersion: ClientReuseManifestSchemaVersion;\n visibleCommitVersion: number;\n}>;\n\n// Internal: createClientReuseManifest returns wire shape while parsing decides\n// which client-declared entries can participate in future reuse.\ntype ClientReuseManifestWire = Readonly<{\n entries: readonly ClientReuseManifestWireEntry[];\n hashAlgorithm: ClientReuseManifestHashAlgorithm;\n replayWindow: ClientReuseManifestReplayWindow;\n schemaVersion: ClientReuseManifestSchemaVersion;\n visibleCommitVersion: number;\n}>;\n\ntype CreateClientReuseManifestInput = Readonly<{\n entries: readonly ClientReuseManifestWireEntry[];\n replayWindow?: ClientReuseManifestReplayWindow;\n visibleCommitVersion: number;\n}>;\n\nexport type ClientReuseManifestRejectionCode =\n | \"SKIP_CACHE_ARTIFACT_COMPATIBILITY_INCOMPATIBLE\"\n | \"SKIP_CACHE_ARTIFACT_COMPATIBILITY_UNKNOWN\"\n | \"SKIP_CACHE_ARTIFACT_PROOF_MISMATCH\"\n | \"SKIP_CACHE_ENTRY_ID_MISMATCH\"\n | \"SKIP_CACHE_INVALIDATED\"\n | \"SKIP_CACHE_INVALIDATION_UNKNOWN\"\n | \"SKIP_CACHE_PAYLOAD_HASH_MISMATCH\"\n | \"SKIP_CACHE_PAYLOAD_HASH_MISSING\"\n | \"SKIP_CACHE_PROOF_MISSING\"\n | \"SKIP_CACHE_PROOF_REJECTED\"\n | \"SKIP_CACHE_REUSE_CLASS_UNSUPPORTED\"\n | \"SKIP_CACHE_VARIANT_MISMATCH\"\n | \"SKIP_ARTIFACT_COMPATIBILITY_INVALID\"\n | \"SKIP_ENTRY_COUNT_EXCEEDED\"\n | \"SKIP_ENTRY_HASH_INVALID\"\n | \"SKIP_ENTRY_ID_INVALID\"\n | \"SKIP_ENTRY_ID_TOO_LONG\"\n | \"SKIP_ENTRY_MALFORMED\"\n | \"SKIP_ENTRY_ORDER_NON_CANONICAL\"\n | \"SKIP_HASH_ALGORITHM_UNSUPPORTED\"\n | \"SKIP_MANIFEST_MALFORMED\"\n | \"SKIP_MANIFEST_SCHEMA_UNSUPPORTED\"\n | \"SKIP_MANIFEST_TOO_LARGE\"\n | \"SKIP_PRIVATE_ENTRY\"\n | \"SKIP_REPLAY_WINDOW_INVALID\"\n | \"SKIP_UNKNOWN_ENTRY\"\n | \"SKIP_VARIANT_CACHE_KEY_INVALID\"\n | \"SKIP_VARIANT_CACHE_KEY_TOO_LONG\"\n | \"SKIP_VISIBLE_COMMIT_VERSION_INVALID\"\n | \"SKIP_VISIBLE_COMMIT_VERSION_MISMATCH\";\n\nexport type ClientReuseManifestDispositionCode = \"SKIP_MODEL_DISABLED\";\n\nexport type ClientReuseManifestTraceFieldValue =\n | string\n | number\n | boolean\n | null\n | readonly string[];\n\nexport type ClientReuseManifestTraceFields = Readonly<\n Record<string, ClientReuseManifestTraceFieldValue>\n>;\n\nexport type ClientReuseManifestRejection = Readonly<{\n code: ClientReuseManifestRejectionCode;\n fields: ClientReuseManifestTraceFields;\n}>;\n\nexport type ClientReuseManifestEntryRejection = ClientReuseManifestRejection &\n Readonly<{\n entryId: string | null;\n }>;\n\nexport type ClientReuseManifestSkipDisposition = Readonly<{\n code: ClientReuseManifestDispositionCode;\n enabled: false;\n mode: \"renderAndSend\";\n}>;\n\nexport type ClientReuseManifestParseResult =\n | Readonly<{ kind: \"absent\" }>\n | Readonly<{ kind: \"rejected\"; rejection: ClientReuseManifestRejection }>\n | Readonly<{\n entryRejections: readonly ClientReuseManifestEntryRejection[];\n kind: \"parsed\";\n manifest: ClientReuseManifest;\n skipDisposition: ClientReuseManifestSkipDisposition;\n }>;\n\ntype ParseClientReuseManifestOptions = Readonly<{\n currentVisibleCommitVersion?: number;\n limits?: ClientReuseManifestLimits;\n}>;\n\nconst HASH_DIGEST_PATTERN = /^[0-9a-z]+$/;\nconst textEncoder = new TextEncoder();\n\ntype ParseReplayWindowResult =\n | Readonly<{ kind: \"parsed\"; replayWindow: ClientReuseManifestReplayWindow }>\n | Readonly<{ kind: \"rejected\"; rejection: ClientReuseManifestRejection }>;\n\nfunction createRejection(\n code: ClientReuseManifestRejectionCode,\n fields: ClientReuseManifestTraceFields = {},\n): ClientReuseManifestRejection {\n return { code, fields };\n}\n\nfunction rejectManifest(\n code: ClientReuseManifestRejectionCode,\n fields: ClientReuseManifestTraceFields = {},\n): ClientReuseManifestParseResult {\n return { kind: \"rejected\", rejection: createRejection(code, fields) };\n}\n\nfunction rejectEntry(\n code: ClientReuseManifestRejectionCode,\n entryId: string | null,\n fields: ClientReuseManifestTraceFields = {},\n): ClientReuseManifestEntryRejection {\n return { code, entryId, fields };\n}\n\nfunction compareManifestEntries(\n left: Pick<ClientReuseManifestWireEntry, \"id\">,\n right: Pick<ClientReuseManifestWireEntry, \"id\">,\n): number {\n if (left.id < right.id) return -1;\n if (left.id > right.id) return 1;\n return 0;\n}\n\nfunction createCanonicalWireEntries(\n entries: readonly ClientReuseManifestWireEntry[],\n): ClientReuseManifestWireEntry[] {\n const entriesById = new Map<string, ClientReuseManifestWireEntry>();\n for (const entry of entries) {\n if (!entriesById.has(entry.id)) {\n entriesById.set(entry.id, entry);\n }\n }\n\n return Array.from(entriesById.values()).sort(compareManifestEntries);\n}\n\n// The manifest byte budget is enforced once at the untrusted header boundary.\nfunction countUtf8Bytes(input: string): number {\n return textEncoder.encode(input).length;\n}\n\nfunction isVisibleCommitVersion(value: unknown): value is number {\n return typeof value === \"number\" && Number.isSafeInteger(value) && value >= 0;\n}\n\nfunction parseReplayWindow(value: unknown, visibleCommitVersion: number): ParseReplayWindowResult {\n if (!isUnknownRecord(value)) {\n return {\n kind: \"rejected\",\n rejection: createRejection(\"SKIP_REPLAY_WINDOW_INVALID\", { field: \"replayWindow\" }),\n };\n }\n\n const validFromVisibleCommitVersion = value.validFromVisibleCommitVersion;\n const validUntilVisibleCommitVersion = value.validUntilVisibleCommitVersion;\n if (\n !isVisibleCommitVersion(validFromVisibleCommitVersion) ||\n !isVisibleCommitVersion(validUntilVisibleCommitVersion) ||\n validFromVisibleCommitVersion > validUntilVisibleCommitVersion ||\n visibleCommitVersion < validFromVisibleCommitVersion ||\n visibleCommitVersion > validUntilVisibleCommitVersion\n ) {\n return {\n kind: \"rejected\",\n rejection: createRejection(\"SKIP_REPLAY_WINDOW_INVALID\", {\n validFromVisibleCommitVersion: isVisibleCommitVersion(validFromVisibleCommitVersion)\n ? validFromVisibleCommitVersion\n : null,\n validUntilVisibleCommitVersion: isVisibleCommitVersion(validUntilVisibleCommitVersion)\n ? validUntilVisibleCommitVersion\n : null,\n visibleCommitVersion,\n }),\n };\n }\n\n return {\n kind: \"parsed\",\n replayWindow: {\n validFromVisibleCommitVersion,\n validUntilVisibleCommitVersion,\n },\n };\n}\n\nfunction currentCommitVersionMatchesReplayWindow(\n currentVisibleCommitVersion: number | undefined,\n replayWindow: ClientReuseManifestReplayWindow,\n): boolean {\n if (currentVisibleCommitVersion === undefined) return true;\n return (\n currentVisibleCommitVersion >= replayWindow.validFromVisibleCommitVersion &&\n currentVisibleCommitVersion <= replayWindow.validUntilVisibleCommitVersion\n );\n}\n\nfunction parseEntryKind(id: string): ClientReuseManifestEntryKind | null {\n const parsed = AppElementsWire.parseElementKey(id);\n if (parsed === null) return null;\n return parsed.kind;\n}\n\nfunction isValidPayloadHash(value: unknown, limits: ClientReuseManifestLimits): value is string {\n return (\n typeof value === \"string\" &&\n value.length > 0 &&\n value.length <= limits.maxPayloadHashLength &&\n HASH_DIGEST_PATTERN.test(value)\n );\n}\n\nfunction parseManifestEntry(\n value: unknown,\n limits: ClientReuseManifestLimits,\n index: number,\n): ClientReuseManifestEntry | ClientReuseManifestEntryRejection {\n if (!isUnknownRecord(value)) {\n return rejectEntry(\"SKIP_ENTRY_MALFORMED\", null, { index });\n }\n\n const id = value.id;\n if (typeof id !== \"string\" || id.length === 0) {\n return rejectEntry(\"SKIP_ENTRY_ID_INVALID\", null, { index });\n }\n if (id.length > limits.maxEntryIdLength) {\n return rejectEntry(\"SKIP_ENTRY_ID_TOO_LONG\", id, {\n idHash: createClientReusePayloadHash(id),\n maxEntryIdLength: limits.maxEntryIdLength,\n });\n }\n\n const kind = parseEntryKind(id);\n if (kind === null) {\n return rejectEntry(\"SKIP_UNKNOWN_ENTRY\", id, { idHash: createClientReusePayloadHash(id) });\n }\n\n const privacy = value.privacy;\n if (privacy === \"private\") {\n return rejectEntry(\"SKIP_PRIVATE_ENTRY\", id, { privacy });\n }\n if (privacy !== \"public\") {\n return rejectEntry(\"SKIP_ENTRY_MALFORMED\", id, { field: \"privacy\" });\n }\n\n const payloadHash = value.payloadHash;\n if (!isValidPayloadHash(payloadHash, limits)) {\n return rejectEntry(\"SKIP_ENTRY_HASH_INVALID\", id, {\n maxPayloadHashLength: limits.maxPayloadHashLength,\n });\n }\n\n const variantCacheKey = value.variantCacheKey;\n if (typeof variantCacheKey !== \"string\" || variantCacheKey.length === 0) {\n return rejectEntry(\"SKIP_VARIANT_CACHE_KEY_INVALID\", id, { field: \"variantCacheKey\" });\n }\n if (variantCacheKey.length > limits.maxVariantCacheKeyLength) {\n return rejectEntry(\"SKIP_VARIANT_CACHE_KEY_TOO_LONG\", id, {\n maxVariantCacheKeyLength: limits.maxVariantCacheKeyLength,\n variantCacheKeyHash: createClientReusePayloadHash(variantCacheKey),\n });\n }\n\n const artifactCompatibility = parseArtifactCompatibilityEnvelope(value.artifactCompatibility);\n if (artifactCompatibility === null) {\n return rejectEntry(\"SKIP_ARTIFACT_COMPATIBILITY_INVALID\", id, {\n field: \"artifactCompatibility\",\n });\n }\n\n return {\n artifactCompatibility,\n id,\n kind,\n payloadHash,\n privacy,\n variantCacheKey,\n };\n}\n\nexport function createClientReusePayloadHash(input: string): string {\n return fnv1a64(input);\n}\n\nexport function createClientReuseManifest(\n input: CreateClientReuseManifestInput,\n): ClientReuseManifestWire {\n const replayWindow =\n input.replayWindow ??\n ({\n validFromVisibleCommitVersion: input.visibleCommitVersion,\n validUntilVisibleCommitVersion: input.visibleCommitVersion,\n } satisfies ClientReuseManifestReplayWindow);\n\n return {\n entries: createCanonicalWireEntries(input.entries),\n hashAlgorithm: CLIENT_REUSE_MANIFEST_HASH_ALGORITHM,\n replayWindow,\n schemaVersion: CLIENT_REUSE_MANIFEST_SCHEMA_VERSION,\n visibleCommitVersion: input.visibleCommitVersion,\n };\n}\n\nexport function serializeClientReuseManifest(input: CreateClientReuseManifestInput): string {\n return JSON.stringify(createClientReuseManifest(input));\n}\n\nexport function parseClientReuseManifestHeader(\n rawHeader: string | null | undefined,\n options: ParseClientReuseManifestOptions = {},\n): ClientReuseManifestParseResult {\n const header = rawHeader?.trim();\n if (!header) return { kind: \"absent\" };\n\n const limits = options.limits ?? DEFAULT_CLIENT_REUSE_MANIFEST_LIMITS;\n const manifestBytes = countUtf8Bytes(header);\n if (manifestBytes > limits.maxManifestBytes) {\n return rejectManifest(\"SKIP_MANIFEST_TOO_LARGE\", {\n manifestBytes,\n maxManifestBytes: limits.maxManifestBytes,\n });\n }\n\n let decoded: unknown;\n try {\n decoded = JSON.parse(header);\n } catch {\n return rejectManifest(\"SKIP_MANIFEST_MALFORMED\");\n }\n\n if (!isUnknownRecord(decoded)) {\n return rejectManifest(\"SKIP_MANIFEST_MALFORMED\", { field: \"manifest\" });\n }\n\n if (decoded.schemaVersion !== CLIENT_REUSE_MANIFEST_SCHEMA_VERSION) {\n return rejectManifest(\"SKIP_MANIFEST_SCHEMA_UNSUPPORTED\", {\n schemaVersion:\n typeof decoded.schemaVersion === \"number\" || typeof decoded.schemaVersion === \"string\"\n ? decoded.schemaVersion\n : null,\n });\n }\n\n if (decoded.hashAlgorithm !== CLIENT_REUSE_MANIFEST_HASH_ALGORITHM) {\n return rejectManifest(\"SKIP_HASH_ALGORITHM_UNSUPPORTED\", {\n hashAlgorithm: typeof decoded.hashAlgorithm === \"string\" ? decoded.hashAlgorithm : null,\n });\n }\n\n const visibleCommitVersion = decoded.visibleCommitVersion;\n if (!isVisibleCommitVersion(visibleCommitVersion)) {\n return rejectManifest(\"SKIP_VISIBLE_COMMIT_VERSION_INVALID\", {\n visibleCommitVersion: null,\n });\n }\n\n const replayWindowResult = parseReplayWindow(decoded.replayWindow, visibleCommitVersion);\n if (replayWindowResult.kind === \"rejected\") {\n return { kind: \"rejected\", rejection: replayWindowResult.rejection };\n }\n const { replayWindow } = replayWindowResult;\n if (!currentCommitVersionMatchesReplayWindow(options.currentVisibleCommitVersion, replayWindow)) {\n return rejectManifest(\"SKIP_VISIBLE_COMMIT_VERSION_MISMATCH\", {\n currentVisibleCommitVersion: options.currentVisibleCommitVersion ?? null,\n validFromVisibleCommitVersion: replayWindow.validFromVisibleCommitVersion,\n validUntilVisibleCommitVersion: replayWindow.validUntilVisibleCommitVersion,\n visibleCommitVersion,\n });\n }\n\n const entriesValue = decoded.entries;\n if (!Array.isArray(entriesValue)) {\n return rejectManifest(\"SKIP_MANIFEST_MALFORMED\", { field: \"entries\" });\n }\n if (entriesValue.length > limits.maxEntryCount) {\n return rejectManifest(\"SKIP_ENTRY_COUNT_EXCEEDED\", {\n entryCount: entriesValue.length,\n maxEntryCount: limits.maxEntryCount,\n });\n }\n\n const entries: ClientReuseManifestEntry[] = [];\n const entryRejections: ClientReuseManifestEntryRejection[] = [];\n let previousEntryId: string | null = null;\n\n for (let index = 0; index < entriesValue.length; index++) {\n const value = entriesValue[index];\n if (isUnknownRecord(value) && typeof value.id === \"string\") {\n // Canonical ordering is enforced over entries with string IDs. Malformed\n // entries cannot advance previousEntryId, so interleaving them cannot hide\n // an ordering violation between valid checkpoints. <= rejects both\n // out-of-order and duplicate IDs.\n if (previousEntryId !== null && value.id <= previousEntryId) {\n return rejectManifest(\"SKIP_ENTRY_ORDER_NON_CANONICAL\", {\n entryIdHash: createClientReusePayloadHash(value.id),\n previousEntryIdHash: createClientReusePayloadHash(previousEntryId),\n });\n }\n previousEntryId = value.id;\n }\n\n const parsedEntry = parseManifestEntry(value, limits, index);\n if (\"code\" in parsedEntry) {\n entryRejections.push(parsedEntry);\n } else {\n entries.push(parsedEntry);\n }\n }\n\n return {\n entryRejections,\n kind: \"parsed\",\n manifest: {\n entries,\n hashAlgorithm: CLIENT_REUSE_MANIFEST_HASH_ALGORITHM,\n replayWindow,\n schemaVersion: CLIENT_REUSE_MANIFEST_SCHEMA_VERSION,\n visibleCommitVersion,\n },\n skipDisposition: {\n code: \"SKIP_MODEL_DISABLED\",\n enabled: false,\n mode: \"renderAndSend\",\n },\n };\n}\n"],"mappings":";;;;;AAQA,MAAa,uCAAuC;AAGpD,MAAa,uCAAuC;AAWpD,MAAa,uCAAuC;CAClD,eAAe;CACf,kBAAkB;CAClB,kBAAkB;CAClB,sBAAsB;CACtB,0BAA0B;CAC3B;AA+HD,MAAM,sBAAsB;AAC5B,MAAM,cAAc,IAAI,aAAa;AAMrC,SAAS,gBACP,MACA,SAAyC,EAAE,EACb;CAC9B,OAAO;EAAE;EAAM;EAAQ;;AAGzB,SAAS,eACP,MACA,SAAyC,EAAE,EACX;CAChC,OAAO;EAAE,MAAM;EAAY,WAAW,gBAAgB,MAAM,OAAO;EAAE;;AAGvE,SAAS,YACP,MACA,SACA,SAAyC,EAAE,EACR;CACnC,OAAO;EAAE;EAAM;EAAS;EAAQ;;AAGlC,SAAS,uBACP,MACA,OACQ;CACR,IAAI,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AAS;GACT,MAAM;GACP;EACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/server/default-global-error-module.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Module-shaped wrapper around vinext's built-in default global error
|
|
4
|
+
* component. Used as the fallback when an app does not define its own
|
|
5
|
+
* `app/global-error.tsx`. The runtime treats any `{ default: Component }`
|
|
6
|
+
* record as a "global error module", so wrapping the component this way lets
|
|
7
|
+
* us thread the default through the existing `globalErrorModule` plumbing
|
|
8
|
+
* without introducing a parallel code path.
|
|
9
|
+
*
|
|
10
|
+
* Mirrors Next.js's `defaultGlobalErrorPath`
|
|
11
|
+
* (`next/dist/client/components/builtin/global-error.js`), which is selected
|
|
12
|
+
* automatically when the user has not supplied a custom global error file:
|
|
13
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/build/webpack/loaders/next-app-loader/index.ts
|
|
14
|
+
*/
|
|
15
|
+
declare const DEFAULT_GLOBAL_ERROR_MODULE: {
|
|
16
|
+
readonly default: any;
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { DEFAULT_GLOBAL_ERROR_MODULE };
|
|
20
|
+
//# sourceMappingURL=default-global-error-module.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import DefaultGlobalError from "../shims/default-global-error.js";
|
|
2
|
+
//#region src/server/default-global-error-module.ts
|
|
3
|
+
/**
|
|
4
|
+
* Module-shaped wrapper around vinext's built-in default global error
|
|
5
|
+
* component. Used as the fallback when an app does not define its own
|
|
6
|
+
* `app/global-error.tsx`. The runtime treats any `{ default: Component }`
|
|
7
|
+
* record as a "global error module", so wrapping the component this way lets
|
|
8
|
+
* us thread the default through the existing `globalErrorModule` plumbing
|
|
9
|
+
* without introducing a parallel code path.
|
|
10
|
+
*
|
|
11
|
+
* Mirrors Next.js's `defaultGlobalErrorPath`
|
|
12
|
+
* (`next/dist/client/components/builtin/global-error.js`), which is selected
|
|
13
|
+
* automatically when the user has not supplied a custom global error file:
|
|
14
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/build/webpack/loaders/next-app-loader/index.ts
|
|
15
|
+
*/
|
|
16
|
+
const DEFAULT_GLOBAL_ERROR_MODULE = { default: DefaultGlobalError };
|
|
17
|
+
//#endregion
|
|
18
|
+
export { DEFAULT_GLOBAL_ERROR_MODULE };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=default-global-error-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-global-error-module.js","names":[],"sources":["../../src/server/default-global-error-module.ts"],"sourcesContent":["import DefaultGlobalError from \"vinext/shims/default-global-error\";\n\n/**\n * Module-shaped wrapper around vinext's built-in default global error\n * component. Used as the fallback when an app does not define its own\n * `app/global-error.tsx`. The runtime treats any `{ default: Component }`\n * record as a \"global error module\", so wrapping the component this way lets\n * us thread the default through the existing `globalErrorModule` plumbing\n * without introducing a parallel code path.\n *\n * Mirrors Next.js's `defaultGlobalErrorPath`\n * (`next/dist/client/components/builtin/global-error.js`), which is selected\n * automatically when the user has not supplied a custom global error file:\n * https://github.com/vercel/next.js/blob/canary/packages/next/src/build/webpack/loaders/next-app-loader/index.ts\n */\nexport const DEFAULT_GLOBAL_ERROR_MODULE = {\n default: DefaultGlobalError,\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,8BAA8B,EACzC,SAAS,oBACV"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/server/default-not-found-module.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Module-shaped wrapper around vinext's built-in default not-found component.
|
|
4
|
+
* Used as the fallback when an app does not define its own `app/not-found.tsx`
|
|
5
|
+
* (and has not opted into `app/global-not-found.tsx`). The runtime treats any
|
|
6
|
+
* `{ default: Component }` record as a "not-found module", so wrapping the
|
|
7
|
+
* component this way lets us thread the default through the existing
|
|
8
|
+
* `rootNotFoundModule` plumbing without introducing a parallel code path.
|
|
9
|
+
*
|
|
10
|
+
* Mirrors Next.js's `defaultNotFoundPath`
|
|
11
|
+
* (`next/dist/client/components/builtin/not-found.js`), which is selected
|
|
12
|
+
* automatically when the user has not supplied a custom not-found file:
|
|
13
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/build/webpack/loaders/next-app-loader/index.ts
|
|
14
|
+
*/
|
|
15
|
+
declare const DEFAULT_NOT_FOUND_MODULE: {
|
|
16
|
+
readonly default: any;
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { DEFAULT_NOT_FOUND_MODULE };
|
|
20
|
+
//# sourceMappingURL=default-not-found-module.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import DefaultNotFound from "../shims/default-not-found.js";
|
|
2
|
+
//#region src/server/default-not-found-module.ts
|
|
3
|
+
/**
|
|
4
|
+
* Module-shaped wrapper around vinext's built-in default not-found component.
|
|
5
|
+
* Used as the fallback when an app does not define its own `app/not-found.tsx`
|
|
6
|
+
* (and has not opted into `app/global-not-found.tsx`). The runtime treats any
|
|
7
|
+
* `{ default: Component }` record as a "not-found module", so wrapping the
|
|
8
|
+
* component this way lets us thread the default through the existing
|
|
9
|
+
* `rootNotFoundModule` plumbing without introducing a parallel code path.
|
|
10
|
+
*
|
|
11
|
+
* Mirrors Next.js's `defaultNotFoundPath`
|
|
12
|
+
* (`next/dist/client/components/builtin/not-found.js`), which is selected
|
|
13
|
+
* automatically when the user has not supplied a custom not-found file:
|
|
14
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/build/webpack/loaders/next-app-loader/index.ts
|
|
15
|
+
*/
|
|
16
|
+
const DEFAULT_NOT_FOUND_MODULE = { default: DefaultNotFound };
|
|
17
|
+
//#endregion
|
|
18
|
+
export { DEFAULT_NOT_FOUND_MODULE };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=default-not-found-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-not-found-module.js","names":[],"sources":["../../src/server/default-not-found-module.ts"],"sourcesContent":["import DefaultNotFound from \"vinext/shims/default-not-found\";\n\n/**\n * Module-shaped wrapper around vinext's built-in default not-found component.\n * Used as the fallback when an app does not define its own `app/not-found.tsx`\n * (and has not opted into `app/global-not-found.tsx`). The runtime treats any\n * `{ default: Component }` record as a \"not-found module\", so wrapping the\n * component this way lets us thread the default through the existing\n * `rootNotFoundModule` plumbing without introducing a parallel code path.\n *\n * Mirrors Next.js's `defaultNotFoundPath`\n * (`next/dist/client/components/builtin/not-found.js`), which is selected\n * automatically when the user has not supplied a custom not-found file:\n * https://github.com/vercel/next.js/blob/canary/packages/next/src/build/webpack/loaders/next-app-loader/index.ts\n */\nexport const DEFAULT_NOT_FOUND_MODULE = {\n default: DefaultNotFound,\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,2BAA2B,EACtC,SAAS,iBACV"}
|
|
@@ -36,9 +36,17 @@ declare function parseCookieLocale(req: IncomingMessage, i18nConfig: NextI18nCon
|
|
|
36
36
|
* 4. Render the component to HTML
|
|
37
37
|
* 5. Wrap in _document shell and send response
|
|
38
38
|
*/
|
|
39
|
-
declare function createSSRHandler(server: ViteDevServer, runner: ModuleImporter, routes: Route[], pagesDir: string, i18nConfig?: NextI18nConfig | null, fileMatcher?: ValidFileMatcher, basePath?: string, trailingSlash?: boolean): (req: IncomingMessage, res: ServerResponse, url: string, /** Status code override — propagated from middleware rewrite status. */
|
|
39
|
+
declare function createSSRHandler(server: ViteDevServer, runner: ModuleImporter, routes: Route[], pagesDir: string, i18nConfig?: NextI18nConfig | null, fileMatcher?: ValidFileMatcher, basePath?: string, trailingSlash?: boolean, hasMiddleware?: boolean): (req: IncomingMessage, res: ServerResponse, url: string, /** Status code override — propagated from middleware rewrite status. */
|
|
40
40
|
|
|
41
|
-
statusCode?: number
|
|
41
|
+
statusCode?: number,
|
|
42
|
+
/**
|
|
43
|
+
* True when the request originated as `/_next/data/<buildId>/<page>.json`.
|
|
44
|
+
* When true the handler emits a `{ pageProps }` JSON envelope instead of
|
|
45
|
+
* rendering the React tree to HTML — matching Next.js' behavior for
|
|
46
|
+
* client-side navigations in the Pages Router.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
isDataReq?: boolean) => Promise<void>;
|
|
42
50
|
//#endregion
|
|
43
51
|
export { createSSRHandler, detectLocaleFromHeaders, extractLocaleFromUrl, parseCookieLocale };
|
|
44
52
|
//# sourceMappingURL=dev-server.d.ts.map
|