vinext 0.0.46 → 0.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/dist/build/layout-classification.js +3 -1
- package/dist/build/layout-classification.js.map +1 -1
- package/dist/build/prerender.d.ts +2 -1
- package/dist/build/prerender.js +80 -24
- package/dist/build/prerender.js.map +1 -1
- package/dist/build/report.d.ts +9 -5
- package/dist/build/report.js +17 -7
- package/dist/build/report.js.map +1 -1
- package/dist/build/route-classification-injector.d.ts +35 -0
- package/dist/build/route-classification-injector.js +61 -0
- package/dist/build/route-classification-injector.js.map +1 -0
- package/dist/build/route-classification-manifest.d.ts +1 -1
- package/dist/build/run-prerender.d.ts +5 -0
- package/dist/build/run-prerender.js +4 -1
- package/dist/build/run-prerender.js.map +1 -1
- package/dist/build/server-manifest.js +2 -7
- package/dist/build/server-manifest.js.map +1 -1
- package/dist/build/standalone.js +3 -5
- package/dist/build/standalone.js.map +1 -1
- package/dist/build/static-export.d.ts +1 -1
- package/dist/check.js +45 -29
- package/dist/check.js.map +1 -1
- package/dist/cli-args.d.ts +33 -0
- package/dist/cli-args.js +121 -0
- package/dist/cli-args.js.map +1 -0
- package/dist/cli.js +11 -20
- package/dist/cli.js.map +1 -1
- package/dist/cloudflare/kv-cache-handler.js +29 -9
- package/dist/cloudflare/kv-cache-handler.js.map +1 -1
- package/dist/config/config-matchers.js +46 -37
- package/dist/config/config-matchers.js.map +1 -1
- package/dist/config/next-config.d.ts +4 -2
- package/dist/config/next-config.js +3 -0
- package/dist/config/next-config.js.map +1 -1
- package/dist/deploy.d.ts +18 -2
- package/dist/deploy.js +47 -4
- package/dist/deploy.js.map +1 -1
- package/dist/entries/app-rsc-entry.d.ts +4 -3
- package/dist/entries/app-rsc-entry.js +379 -858
- package/dist/entries/app-rsc-entry.js.map +1 -1
- package/dist/entries/app-rsc-manifest.d.ts +1 -1
- package/dist/entries/app-rsc-manifest.js +6 -1
- package/dist/entries/app-rsc-manifest.js.map +1 -1
- package/dist/entries/pages-client-entry.js +3 -2
- package/dist/entries/pages-client-entry.js.map +1 -1
- package/dist/entries/pages-server-entry.js +19 -61
- package/dist/entries/pages-server-entry.js.map +1 -1
- package/dist/entries/runtime-entry-module.d.ts +12 -3
- package/dist/entries/runtime-entry-module.js +15 -4
- package/dist/entries/runtime-entry-module.js.map +1 -1
- package/dist/index.js +40 -58
- package/dist/index.js.map +1 -1
- package/dist/plugins/fonts.js +54 -32
- package/dist/plugins/fonts.js.map +1 -1
- package/dist/plugins/og-assets.js +15 -16
- package/dist/plugins/og-assets.js.map +1 -1
- package/dist/plugins/rsc-client-shim-excludes.d.ts +2 -1
- package/dist/plugins/rsc-client-shim-excludes.js +11 -1
- package/dist/plugins/rsc-client-shim-excludes.js.map +1 -1
- package/dist/routing/app-route-graph.d.ts +195 -0
- package/dist/routing/app-route-graph.js +1022 -0
- package/dist/routing/app-route-graph.js.map +1 -0
- package/dist/routing/app-router.d.ts +14 -88
- package/dist/routing/app-router.js +21 -712
- package/dist/routing/app-router.js.map +1 -1
- package/dist/routing/file-matcher.d.ts +3 -1
- package/dist/routing/file-matcher.js +6 -1
- package/dist/routing/file-matcher.js.map +1 -1
- package/dist/routing/pages-router.js +10 -19
- package/dist/routing/pages-router.js.map +1 -1
- package/dist/routing/route-matching.d.ts +28 -0
- package/dist/routing/route-matching.js +44 -0
- package/dist/routing/route-matching.js.map +1 -0
- package/dist/routing/route-pattern.js +4 -1
- package/dist/routing/route-pattern.js.map +1 -1
- package/dist/routing/route-trie.d.ts +8 -0
- package/dist/routing/route-trie.js +12 -1
- package/dist/routing/route-trie.js.map +1 -1
- package/dist/routing/route-validation.js +3 -4
- package/dist/routing/route-validation.js.map +1 -1
- package/dist/routing/utils.d.ts +8 -1
- package/dist/routing/utils.js +25 -2
- package/dist/routing/utils.js.map +1 -1
- package/dist/server/app-browser-entry.js +145 -294
- package/dist/server/app-browser-entry.js.map +1 -1
- package/dist/server/app-browser-error.d.ts +3 -4
- package/dist/server/app-browser-error.js +8 -4
- package/dist/server/app-browser-error.js.map +1 -1
- package/dist/server/app-browser-navigation-controller.d.ts +75 -0
- package/dist/server/app-browser-navigation-controller.js +290 -0
- package/dist/server/app-browser-navigation-controller.js.map +1 -0
- package/dist/server/app-browser-state.d.ts +33 -15
- package/dist/server/app-browser-state.js +52 -59
- package/dist/server/app-browser-state.js.map +1 -1
- package/dist/server/app-browser-visible-commit.d.ts +68 -0
- package/dist/server/app-browser-visible-commit.js +182 -0
- package/dist/server/app-browser-visible-commit.js.map +1 -0
- package/dist/server/app-client-reference-preloader.d.ts +15 -0
- package/dist/server/app-client-reference-preloader.js +46 -0
- package/dist/server/app-client-reference-preloader.js.map +1 -0
- package/dist/server/app-elements-wire.d.ts +130 -0
- package/dist/server/app-elements-wire.js +205 -0
- package/dist/server/app-elements-wire.js.map +1 -0
- package/dist/server/app-elements.d.ts +2 -84
- package/dist/server/app-elements.js +4 -107
- package/dist/server/app-elements.js.map +1 -1
- package/dist/server/app-fallback-renderer.d.ts +57 -0
- package/dist/server/app-fallback-renderer.js +79 -0
- package/dist/server/app-fallback-renderer.js.map +1 -0
- package/dist/server/app-hook-warning-suppression.d.ts +7 -0
- package/dist/server/app-hook-warning-suppression.js +12 -0
- package/dist/server/app-hook-warning-suppression.js.map +1 -0
- package/dist/server/app-middleware.d.ts +2 -1
- package/dist/server/app-middleware.js +34 -11
- package/dist/server/app-middleware.js.map +1 -1
- package/dist/server/app-mounted-slots-header.d.ts +17 -0
- package/dist/server/app-mounted-slots-header.js +21 -0
- package/dist/server/app-mounted-slots-header.js.map +1 -0
- package/dist/server/app-page-boundary-render.d.ts +3 -3
- package/dist/server/app-page-boundary-render.js +8 -5
- package/dist/server/app-page-boundary-render.js.map +1 -1
- package/dist/server/app-page-boundary.js +2 -1
- package/dist/server/app-page-boundary.js.map +1 -1
- package/dist/server/app-page-cache.d.ts +19 -4
- package/dist/server/app-page-cache.js +60 -22
- package/dist/server/app-page-cache.js.map +1 -1
- package/dist/server/app-page-dispatch.d.ts +9 -5
- package/dist/server/app-page-dispatch.js +41 -17
- package/dist/server/app-page-dispatch.js.map +1 -1
- package/dist/server/app-page-element-builder.d.ts +61 -0
- package/dist/server/app-page-element-builder.js +142 -0
- package/dist/server/app-page-element-builder.js.map +1 -0
- package/dist/server/app-page-execution.d.ts +23 -5
- package/dist/server/app-page-execution.js +39 -24
- package/dist/server/app-page-execution.js.map +1 -1
- package/dist/server/app-page-head.js +2 -1
- package/dist/server/app-page-head.js.map +1 -1
- package/dist/server/app-page-method.js +2 -5
- package/dist/server/app-page-method.js.map +1 -1
- package/dist/server/app-page-params.d.ts +2 -1
- package/dist/server/app-page-params.js +3 -3
- package/dist/server/app-page-params.js.map +1 -1
- package/dist/server/app-page-probe.d.ts +1 -1
- package/dist/server/app-page-probe.js +5 -1
- package/dist/server/app-page-probe.js.map +1 -1
- package/dist/server/app-page-render.d.ts +6 -2
- package/dist/server/app-page-render.js +118 -30
- package/dist/server/app-page-render.js.map +1 -1
- package/dist/server/app-page-request.d.ts +19 -5
- package/dist/server/app-page-request.js +49 -7
- package/dist/server/app-page-request.js.map +1 -1
- package/dist/server/app-page-response.d.ts +1 -0
- package/dist/server/app-page-response.js +6 -9
- package/dist/server/app-page-response.js.map +1 -1
- package/dist/server/app-page-route-wiring.d.ts +20 -4
- package/dist/server/app-page-route-wiring.js +15 -12
- package/dist/server/app-page-route-wiring.js.map +1 -1
- package/dist/server/app-page-stream.d.ts +7 -0
- package/dist/server/app-page-stream.js +9 -2
- package/dist/server/app-page-stream.js.map +1 -1
- package/dist/server/app-post-middleware-context.d.ts +16 -0
- package/dist/server/app-post-middleware-context.js +28 -0
- package/dist/server/app-post-middleware-context.js.map +1 -0
- package/dist/server/app-prerender-endpoints.js +3 -2
- package/dist/server/app-prerender-endpoints.js.map +1 -1
- package/dist/server/app-request-context.d.ts +22 -0
- package/dist/server/app-request-context.js +30 -0
- package/dist/server/app-request-context.js.map +1 -0
- package/dist/server/app-route-handler-cache.d.ts +1 -0
- package/dist/server/app-route-handler-cache.js +7 -2
- package/dist/server/app-route-handler-cache.js.map +1 -1
- package/dist/server/app-route-handler-dispatch.d.ts +1 -0
- package/dist/server/app-route-handler-dispatch.js +8 -5
- package/dist/server/app-route-handler-dispatch.js.map +1 -1
- package/dist/server/app-route-handler-execution.d.ts +2 -1
- package/dist/server/app-route-handler-execution.js +2 -2
- package/dist/server/app-route-handler-execution.js.map +1 -1
- package/dist/server/app-route-handler-policy.js +13 -13
- package/dist/server/app-route-handler-policy.js.map +1 -1
- package/dist/server/app-route-handler-response.d.ts +4 -2
- package/dist/server/app-route-handler-response.js +9 -7
- package/dist/server/app-route-handler-response.js.map +1 -1
- package/dist/server/app-route-handler-runtime.d.ts +9 -1
- package/dist/server/app-route-handler-runtime.js +11 -1
- package/dist/server/app-route-handler-runtime.js.map +1 -1
- package/dist/server/app-router-entry.js +9 -4
- package/dist/server/app-router-entry.js.map +1 -1
- package/dist/server/app-rsc-cache-busting.d.ts +34 -0
- package/dist/server/app-rsc-cache-busting.js +137 -0
- package/dist/server/app-rsc-cache-busting.js.map +1 -0
- package/dist/server/app-rsc-error-handler.d.ts +21 -0
- package/dist/server/app-rsc-error-handler.js +30 -0
- package/dist/server/app-rsc-error-handler.js.map +1 -0
- package/dist/server/app-rsc-handler.d.ts +117 -0
- package/dist/server/app-rsc-handler.js +271 -0
- package/dist/server/app-rsc-handler.js.map +1 -0
- package/dist/server/app-rsc-request-normalization.d.ts +42 -0
- package/dist/server/app-rsc-request-normalization.js +67 -0
- package/dist/server/app-rsc-request-normalization.js.map +1 -0
- package/dist/server/app-rsc-response-finalizer.d.ts +30 -0
- package/dist/server/app-rsc-response-finalizer.js +38 -0
- package/dist/server/app-rsc-response-finalizer.js.map +1 -0
- package/dist/server/app-rsc-route-matching.js +8 -4
- package/dist/server/app-rsc-route-matching.js.map +1 -1
- package/dist/server/app-segment-config.d.ts +33 -0
- package/dist/server/app-segment-config.js +90 -0
- package/dist/server/app-segment-config.js.map +1 -0
- package/dist/server/app-server-action-execution.d.ts +2 -0
- package/dist/server/app-server-action-execution.js +45 -51
- package/dist/server/app-server-action-execution.js.map +1 -1
- package/dist/server/app-ssr-entry.js +21 -20
- package/dist/server/app-ssr-entry.js.map +1 -1
- package/dist/server/artifact-compatibility.d.ts +44 -0
- package/dist/server/artifact-compatibility.js +82 -0
- package/dist/server/artifact-compatibility.js.map +1 -0
- package/dist/server/cache-control.d.ts +24 -0
- package/dist/server/cache-control.js +33 -0
- package/dist/server/cache-control.js.map +1 -0
- package/dist/server/cache-proof.d.ts +200 -0
- package/dist/server/cache-proof.js +342 -0
- package/dist/server/cache-proof.js.map +1 -0
- package/dist/server/dev-error-overlay-store.d.ts +23 -0
- package/dist/server/dev-error-overlay-store.js +67 -0
- package/dist/server/dev-error-overlay-store.js.map +1 -0
- package/dist/server/dev-error-overlay.d.ts +15 -0
- package/dist/server/dev-error-overlay.js +548 -0
- package/dist/server/dev-error-overlay.js.map +1 -0
- package/dist/server/dev-origin-check.js +8 -4
- package/dist/server/dev-origin-check.js.map +1 -1
- package/dist/server/dev-server.js +1 -6
- package/dist/server/dev-server.js.map +1 -1
- package/dist/server/http-error-responses.d.ts +67 -0
- package/dist/server/http-error-responses.js +77 -0
- package/dist/server/http-error-responses.js.map +1 -0
- package/dist/server/image-optimization.js +2 -1
- package/dist/server/image-optimization.js.map +1 -1
- package/dist/server/instrumentation-runtime.d.ts +44 -0
- package/dist/server/instrumentation-runtime.js +29 -0
- package/dist/server/instrumentation-runtime.js.map +1 -0
- package/dist/server/isr-cache.d.ts +2 -7
- package/dist/server/isr-cache.js +7 -10
- package/dist/server/isr-cache.js.map +1 -1
- package/dist/server/metadata-route-response.js +6 -5
- package/dist/server/metadata-route-response.js.map +1 -1
- package/dist/server/metadata-routes.d.ts +1 -0
- package/dist/server/metadata-routes.js +6 -0
- package/dist/server/metadata-routes.js.map +1 -1
- package/dist/server/middleware-matcher.js +2 -2
- package/dist/server/middleware-matcher.js.map +1 -1
- package/dist/server/middleware-response-headers.js +21 -0
- package/dist/server/middleware-response-headers.js.map +1 -1
- package/dist/server/middleware-runtime.js +3 -3
- package/dist/server/middleware-runtime.js.map +1 -1
- package/dist/server/navigation-trace.d.ts +33 -0
- package/dist/server/navigation-trace.js +35 -0
- package/dist/server/navigation-trace.js.map +1 -0
- package/dist/server/next-error-digest.d.ts +44 -0
- package/dist/server/next-error-digest.js +40 -0
- package/dist/server/next-error-digest.js.map +1 -0
- package/dist/server/pages-api-route.js +2 -1
- package/dist/server/pages-api-route.js.map +1 -1
- package/dist/server/pages-node-compat.js +4 -16
- package/dist/server/pages-node-compat.js.map +1 -1
- package/dist/server/pages-page-data.d.ts +2 -1
- package/dist/server/pages-page-data.js +6 -5
- package/dist/server/pages-page-data.js.map +1 -1
- package/dist/server/pages-page-response.d.ts +3 -8
- package/dist/server/pages-page-response.js +46 -15
- package/dist/server/pages-page-response.js.map +1 -1
- package/dist/server/prod-server.d.ts +6 -0
- package/dist/server/prod-server.js +28 -21
- package/dist/server/prod-server.js.map +1 -1
- package/dist/server/request-pipeline.d.ts +42 -1
- package/dist/server/request-pipeline.js +97 -17
- package/dist/server/request-pipeline.js.map +1 -1
- package/dist/server/rsc-stream-hints.d.ts +3 -1
- package/dist/server/rsc-stream-hints.js +4 -1
- package/dist/server/rsc-stream-hints.js.map +1 -1
- package/dist/server/seed-cache.js +19 -8
- package/dist/server/seed-cache.js.map +1 -1
- package/dist/shims/cache-runtime.d.ts +2 -2
- package/dist/shims/cache-runtime.js +31 -17
- package/dist/shims/cache-runtime.js.map +1 -1
- package/dist/shims/cache.d.ts +15 -3
- package/dist/shims/cache.js +45 -20
- package/dist/shims/cache.js.map +1 -1
- package/dist/shims/error-boundary.d.ts +17 -1
- package/dist/shims/error-boundary.js +31 -1
- package/dist/shims/error-boundary.js.map +1 -1
- package/dist/shims/fetch-cache.d.ts +4 -1
- package/dist/shims/fetch-cache.js +57 -16
- package/dist/shims/fetch-cache.js.map +1 -1
- package/dist/shims/head-state.js +2 -3
- package/dist/shims/head-state.js.map +1 -1
- package/dist/shims/headers.js +4 -44
- package/dist/shims/headers.js.map +1 -1
- package/dist/shims/i18n-state.js +2 -3
- package/dist/shims/i18n-state.js.map +1 -1
- package/dist/shims/image.js +93 -5
- package/dist/shims/image.js.map +1 -1
- package/dist/shims/internal/als-registry.d.ts +15 -0
- package/dist/shims/internal/als-registry.js +55 -0
- package/dist/shims/internal/als-registry.js.map +1 -0
- package/dist/shims/internal/cookie-serialize.d.ts +46 -0
- package/dist/shims/internal/cookie-serialize.js +51 -0
- package/dist/shims/internal/cookie-serialize.js.map +1 -0
- package/dist/shims/link.js +31 -26
- package/dist/shims/link.js.map +1 -1
- package/dist/shims/metadata.d.ts +26 -1
- package/dist/shims/metadata.js +94 -4
- package/dist/shims/metadata.js.map +1 -1
- package/dist/shims/navigation-state.js +2 -3
- package/dist/shims/navigation-state.js.map +1 -1
- package/dist/shims/navigation.d.ts +2 -7
- package/dist/shims/navigation.js +44 -36
- package/dist/shims/navigation.js.map +1 -1
- package/dist/shims/request-context.js +2 -4
- package/dist/shims/request-context.js.map +1 -1
- package/dist/shims/request-state-types.d.ts +1 -1
- package/dist/shims/router-state.js +2 -3
- package/dist/shims/router-state.js.map +1 -1
- package/dist/shims/router.js +2 -2
- package/dist/shims/router.js.map +1 -1
- package/dist/shims/server.js +5 -30
- package/dist/shims/server.js.map +1 -1
- package/dist/shims/slot.d.ts +1 -1
- package/dist/shims/slot.js +5 -4
- package/dist/shims/slot.js.map +1 -1
- package/dist/shims/thenable-params.d.ts +5 -2
- package/dist/shims/thenable-params.js +26 -6
- package/dist/shims/thenable-params.js.map +1 -1
- package/dist/shims/unified-request-context.d.ts +1 -1
- package/dist/shims/unified-request-context.js +3 -14
- package/dist/shims/unified-request-context.js.map +1 -1
- package/dist/shims/use-merged-ref.d.ts +7 -0
- package/dist/shims/use-merged-ref.js +40 -0
- package/dist/shims/use-merged-ref.js.map +1 -0
- package/dist/utils/base-path.d.ts +7 -1
- package/dist/utils/base-path.js +12 -1
- package/dist/utils/base-path.js.map +1 -1
- package/dist/utils/cache-control-metadata.d.ts +6 -0
- package/dist/utils/cache-control-metadata.js +16 -0
- package/dist/utils/cache-control-metadata.js.map +1 -0
- package/dist/utils/safe-json-file.d.ts +18 -0
- package/dist/utils/safe-json-file.js +25 -0
- package/dist/utils/safe-json-file.js.map +1 -0
- package/dist/utils/text-stream.d.ts +29 -0
- package/dist/utils/text-stream.js +66 -0
- package/dist/utils/text-stream.js.map +1 -0
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","names":[],"sources":["../../src/shims/metadata.tsx"],"sourcesContent":["/**\n * Metadata support for App Router.\n *\n * Handles `export const metadata` and `export async function generateMetadata()`.\n * Resolves metadata from layouts and pages (pages override layouts).\n */\nimport React from \"react\";\nimport { makeThenableParams } from \"./thenable-params.js\";\n\n// ---------------------------------------------------------------------------\n// Viewport types and resolution\n// ---------------------------------------------------------------------------\n\nexport type Viewport = {\n /** Viewport width (default: \"device-width\") */\n width?: string | number;\n /** Viewport height */\n height?: string | number;\n /** Initial scale */\n initialScale?: number;\n /** Minimum scale */\n minimumScale?: number;\n /** Maximum scale */\n maximumScale?: number;\n /** Whether user can scale */\n userScalable?: boolean;\n /** Theme color — single color or array of { media, color } */\n themeColor?: string | Array<{ media?: string; color: string }>;\n /** Color scheme: 'light' | 'dark' | 'light dark' | 'normal' */\n colorScheme?: string;\n};\n\n/**\n * Resolve viewport config from a module. Handles both static `viewport` export\n * and async `generateViewport()` function.\n */\nexport async function resolveModuleViewport(\n mod: Record<string, unknown>,\n params: Record<string, string | string[]>,\n): Promise<Viewport | null> {\n if (typeof mod.generateViewport === \"function\") {\n const asyncParams = makeThenableParams(params);\n return await mod.generateViewport({ params: asyncParams });\n }\n if (mod.viewport && typeof mod.viewport === \"object\") {\n return mod.viewport as Viewport;\n }\n return null;\n}\n\n/**\n * Merge viewport configs from multiple sources (layouts + page).\n * Later entries override earlier ones.\n */\nexport const DEFAULT_VIEWPORT: Viewport = {\n width: \"device-width\",\n initialScale: 1,\n};\n\nexport function mergeViewport(viewportList: Viewport[]): Viewport {\n const merged: Viewport = { ...DEFAULT_VIEWPORT };\n for (const vp of viewportList) {\n Object.assign(merged, vp);\n }\n return merged;\n}\n\n/**\n * React component that renders viewport meta tags into <head>.\n */\nexport function ViewportHead({ viewport }: { viewport: Viewport }) {\n const elements: React.ReactElement[] = [];\n let key = 0;\n\n // Build viewport content string\n const parts: string[] = [];\n if (viewport.width !== undefined) parts.push(`width=${viewport.width}`);\n if (viewport.height !== undefined) parts.push(`height=${viewport.height}`);\n if (viewport.initialScale !== undefined) parts.push(`initial-scale=${viewport.initialScale}`);\n if (viewport.minimumScale !== undefined) parts.push(`minimum-scale=${viewport.minimumScale}`);\n if (viewport.maximumScale !== undefined) parts.push(`maximum-scale=${viewport.maximumScale}`);\n if (viewport.userScalable !== undefined)\n parts.push(`user-scalable=${viewport.userScalable ? \"yes\" : \"no\"}`);\n\n if (parts.length > 0) {\n elements.push(<meta key={key++} name=\"viewport\" content={parts.join(\", \")} />);\n }\n\n // Theme color\n if (viewport.themeColor) {\n if (typeof viewport.themeColor === \"string\") {\n elements.push(<meta key={key++} name=\"theme-color\" content={viewport.themeColor} />);\n } else if (Array.isArray(viewport.themeColor)) {\n for (const entry of viewport.themeColor) {\n elements.push(\n <meta\n key={key++}\n name=\"theme-color\"\n content={entry.color}\n {...(entry.media ? { media: entry.media } : {})}\n />,\n );\n }\n }\n }\n\n // Color scheme\n if (viewport.colorScheme) {\n elements.push(<meta key={key++} name=\"color-scheme\" content={viewport.colorScheme} />);\n }\n\n return <>{elements}</>;\n}\n\n// ---------------------------------------------------------------------------\n// Metadata types and resolution\n// ---------------------------------------------------------------------------\n\nexport type Metadata = {\n title?: string | { default?: string; template?: string; absolute?: string };\n description?: string;\n generator?: string;\n applicationName?: string;\n referrer?: string;\n keywords?: string | string[];\n authors?: Array<{ name?: string; url?: string }> | { name?: string; url?: string };\n creator?: string;\n publisher?: string;\n robots?:\n | string\n | {\n index?: boolean;\n follow?: boolean;\n googleBot?: string | { index?: boolean; follow?: boolean; [key: string]: unknown };\n [key: string]: unknown;\n };\n openGraph?: {\n title?: string;\n description?: string;\n url?: string | URL;\n siteName?: string;\n images?:\n | string\n | URL\n | { url: string | URL; width?: number; height?: number; alt?: string; type?: string }\n | Array<\n | string\n | URL\n | { url: string | URL; width?: number; height?: number; alt?: string; type?: string }\n >;\n videos?: Array<{ url: string | URL; width?: number; height?: number }>;\n audio?: Array<{ url: string | URL }>;\n locale?: string;\n type?: string;\n publishedTime?: string;\n modifiedTime?: string;\n authors?: string[];\n };\n twitter?: {\n card?: string;\n site?: string;\n siteId?: string;\n title?: string;\n description?: string;\n images?:\n | string\n | URL\n | { url: string | URL; alt?: string; width?: number; height?: number; type?: string }\n | Array<\n | string\n | URL\n | { url: string | URL; alt?: string; width?: number; height?: number; type?: string }\n >;\n creator?: string;\n creatorId?: string;\n players?: TwitterPlayerDescriptor | TwitterPlayerDescriptor[];\n app?: TwitterAppDescriptor;\n };\n icons?: IconsMetadata;\n manifest?: string | URL;\n alternates?: {\n canonical?: string | URL;\n languages?: Record<string, string | URL>;\n media?: Record<string, string | URL>;\n types?: Record<string, string | URL>;\n };\n verification?: {\n google?: string;\n yahoo?: string;\n yandex?: string;\n other?: Record<string, string | string[]>;\n };\n metadataBase?: URL | null;\n appleWebApp?: {\n capable?: boolean;\n title?: string;\n statusBarStyle?: string;\n startupImage?: string | Array<{ url: string; media?: string }>;\n };\n formatDetection?: {\n email?: boolean;\n address?: boolean;\n telephone?: boolean;\n };\n category?: string;\n itunes?: {\n appId: string;\n appArgument?: string;\n };\n appLinks?: {\n ios?: AppLinksApple | AppLinksApple[];\n iphone?: AppLinksApple | AppLinksApple[];\n ipad?: AppLinksApple | AppLinksApple[];\n android?: AppLinksAndroid | AppLinksAndroid[];\n windows_phone?: AppLinksWindows | AppLinksWindows[];\n windows?: AppLinksWindows | AppLinksWindows[];\n windows_universal?: AppLinksWindows | AppLinksWindows[];\n web?: AppLinksWeb | AppLinksWeb[];\n };\n other?: Record<string, string | string[]>;\n [key: string]: unknown;\n};\n\ntype AppLinksApple = {\n url: string | URL;\n app_store_id?: string | number;\n app_name?: string;\n};\n\ntype AppLinksAndroid = {\n package: string;\n url?: string | URL;\n class?: string;\n app_name?: string;\n};\n\ntype AppLinksWindows = {\n url: string | URL;\n app_id?: string;\n app_name?: string;\n};\n\ntype AppLinksWeb = {\n url: string | URL;\n should_fallback?: boolean;\n};\n\ntype TwitterPlayerDescriptor = {\n playerUrl: string | URL;\n streamUrl: string | URL;\n width: number;\n height: number;\n};\n\ntype TwitterAppDescriptor = {\n id: {\n iphone?: string | number;\n ipad?: string | number;\n googleplay?: string;\n };\n url?: {\n iphone?: string | URL;\n ipad?: string | URL;\n googleplay?: string | URL;\n };\n name?: string;\n};\n\ntype IconDescriptor = {\n url: string | URL;\n sizes?: string;\n type?: string;\n media?: string;\n};\n\ntype AppleIconDescriptor = {\n url: string | URL;\n sizes?: string;\n type?: string;\n};\n\ntype IconInput = string | URL | IconDescriptor;\ntype AppleIconInput = string | URL | AppleIconDescriptor;\n\ntype IconsMap = {\n icon?: IconInput | IconInput[];\n shortcut?: string | URL | Array<string | URL>;\n apple?: AppleIconInput | AppleIconInput[];\n other?: Array<{ rel: string; url: string | URL; sizes?: string; type?: string }>;\n};\n\ntype IconsMetadata = IconInput | IconInput[] | IconsMap;\n\nexport type MetadataMergeEntry = {\n contributesTitle?: boolean;\n isPage?: boolean;\n metadata: Metadata;\n};\n\n/**\n * Merge metadata from multiple sources (layouts + page).\n *\n * The list is ordered [rootLayout, nestedLayout, ..., page].\n * Title template from layouts applies to the page title but NOT to\n * the segment that defines the template itself. `title.absolute`\n * skips all templates. `title.default` is the fallback when no\n * child provides a title.\n *\n * Shallow merge: later entries override earlier ones (per Next.js docs).\n */\nexport function mergeMetadata(metadataList: Metadata[]): Metadata {\n return mergeMetadataEntries(\n metadataList.map((metadata, index) => ({\n isPage: index === metadataList.length - 1,\n metadata,\n })),\n );\n}\n\nexport function mergeMetadataEntries(entries: readonly MetadataMergeEntry[]): Metadata {\n if (entries.length === 0) return {};\n\n const merged: Metadata = {};\n\n // Track the most recent title template from LAYOUTS (not from page).\n let parentTemplate: string | undefined;\n\n for (const entry of entries) {\n const meta = entry.metadata;\n const isPage = Boolean(entry.isPage);\n const contributesTitle = entry.contributesTitle !== false;\n\n // Collect template from layouts only (page templates are ignored per Next.js spec)\n if (\n contributesTitle &&\n !isPage &&\n meta.title &&\n typeof meta.title === \"object\" &&\n meta.title.template\n ) {\n parentTemplate = meta.title.template;\n }\n\n // Shallow merge — later entries override earlier for top-level keys\n for (const key of Object.keys(meta)) {\n if (key === \"title\") continue; // Handle title separately below\n (merged as Record<string, unknown>)[key] = (meta as Record<string, unknown>)[key];\n }\n\n // Title resolution\n if (contributesTitle && meta.title !== undefined) {\n merged.title = meta.title;\n }\n }\n\n // Now resolve the final title, applying the parent template if applicable\n const finalTitle = merged.title;\n if (finalTitle) {\n if (typeof finalTitle === \"string\") {\n // Simple string title — apply parent template\n if (parentTemplate) {\n merged.title = parentTemplate.replace(\"%s\", finalTitle);\n }\n } else if (typeof finalTitle === \"object\") {\n if (finalTitle.absolute) {\n // Absolute title — skip all templates\n merged.title = finalTitle.absolute;\n } else if (finalTitle.default) {\n // Title object with default — this is used when the segment IS the\n // defining layout (its own default doesn't get template-wrapped)\n merged.title = finalTitle.default;\n } else if (finalTitle.template && !finalTitle.default && !finalTitle.absolute) {\n // Template only with no default — no title to render\n merged.title = undefined;\n }\n }\n }\n\n return merged;\n}\n\n/**\n * Resolve metadata from a module. Handles both static `metadata` export\n * and async `generateMetadata()` function.\n *\n * @param parent - A Promise that resolves to the accumulated (merged) metadata\n * from all ancestor segments. Passed as the second argument to\n * `generateMetadata()`, matching Next.js's eager-execution-with-serial-\n * resolution approach. If not provided, defaults to a promise that resolves\n * to an empty object (so `await parent` never throws).\n */\nexport async function resolveModuleMetadata(\n mod: Record<string, unknown>,\n params: Record<string, string | string[]> = {},\n searchParams?: Record<string, string | string[]>,\n parent: Promise<Metadata> = Promise.resolve({}),\n): Promise<Metadata | null> {\n if (typeof mod.generateMetadata === \"function\") {\n // Next.js 16 passes params/searchParams as Promises (async pattern).\n // makeThenableParams() normalises null-prototype + preserves sync access.\n const asyncParams = makeThenableParams(params);\n const props =\n searchParams === undefined\n ? { params: asyncParams }\n : { params: asyncParams, searchParams: makeThenableParams(searchParams) };\n return await mod.generateMetadata(props, parent);\n }\n if (mod.metadata && typeof mod.metadata === \"object\") {\n return mod.metadata as Metadata;\n }\n return null;\n}\n\n/**\n * React component that renders metadata as HTML head elements.\n * Used by the RSC entry to inject into the <head>.\n */\nfunction isIconDescriptor(value: unknown): value is IconDescriptor {\n if (typeof value !== \"object\" || value === null || value instanceof URL || Array.isArray(value)) {\n return false;\n }\n const urlValue = Reflect.get(value, \"url\");\n return typeof urlValue === \"string\" || urlValue instanceof URL;\n}\n\nfunction isIconsMap(value: IconsMetadata): value is IconsMap {\n return (\n typeof value === \"object\" &&\n !(value instanceof URL) &&\n !Array.isArray(value) &&\n !isIconDescriptor(value)\n );\n}\n\nfunction normalizeUrlDescriptor<T extends { url: string | URL }>(\n value: string | URL | T,\n createDescriptor: (url: string | URL) => T,\n): T {\n if (typeof value === \"string\" || value instanceof URL) {\n return createDescriptor(value);\n }\n return value;\n}\n\nfunction normalizeUrlDescriptorEntries<T extends { url: string | URL }>(\n value: string | URL | T | Array<string | URL | T> | undefined,\n createDescriptor: (url: string | URL) => T,\n): T[] {\n if (!value) {\n return [];\n }\n\n if (Array.isArray(value)) {\n return value.map((entry) => normalizeUrlDescriptor(entry, createDescriptor));\n }\n\n return [normalizeUrlDescriptor(value, createDescriptor)];\n}\n\nexport function MetadataHead({ metadata }: { metadata: Metadata }) {\n const elements: React.ReactElement[] = [];\n let key = 0;\n\n // Resolve metadataBase for URL composition\n const base = metadata.metadataBase;\n function resolveUrl(url: string | URL): string;\n function resolveUrl(url: string | URL | undefined): string | undefined;\n function resolveUrl(url: string | URL | undefined): string | undefined {\n if (!url) return undefined;\n // Coerce URL objects to strings (Next.js metadata allows string | URL)\n const s = typeof url === \"string\" ? url : url instanceof URL ? url.toString() : String(url);\n if (!base) return s;\n if (s.startsWith(\"http://\") || s.startsWith(\"https://\") || s.startsWith(\"//\")) return s;\n try {\n return new URL(s, base).toString();\n } catch {\n return s;\n }\n }\n\n // Title\n const title =\n typeof metadata.title === \"string\"\n ? metadata.title\n : typeof metadata.title === \"object\"\n ? metadata.title.absolute || metadata.title.default\n : undefined;\n if (title) {\n elements.push(<title key={key++}>{title}</title>);\n }\n\n // Description\n if (metadata.description) {\n elements.push(<meta key={key++} name=\"description\" content={metadata.description} />);\n }\n\n // Generator\n if (metadata.generator) {\n elements.push(<meta key={key++} name=\"generator\" content={metadata.generator} />);\n }\n\n // Application name\n if (metadata.applicationName) {\n elements.push(<meta key={key++} name=\"application-name\" content={metadata.applicationName} />);\n }\n\n // Referrer\n if (metadata.referrer) {\n elements.push(<meta key={key++} name=\"referrer\" content={metadata.referrer} />);\n }\n\n // Keywords\n if (metadata.keywords) {\n const kw = Array.isArray(metadata.keywords) ? metadata.keywords.join(\",\") : metadata.keywords;\n elements.push(<meta key={key++} name=\"keywords\" content={kw} />);\n }\n\n // Authors\n if (metadata.authors) {\n const authorList = Array.isArray(metadata.authors) ? metadata.authors : [metadata.authors];\n for (const author of authorList) {\n if (author.name) {\n elements.push(<meta key={key++} name=\"author\" content={author.name} />);\n }\n if (author.url) {\n elements.push(<link key={key++} rel=\"author\" href={author.url} />);\n }\n }\n }\n\n // Creator\n if (metadata.creator) {\n elements.push(<meta key={key++} name=\"creator\" content={metadata.creator} />);\n }\n\n // Publisher\n if (metadata.publisher) {\n elements.push(<meta key={key++} name=\"publisher\" content={metadata.publisher} />);\n }\n\n // Format detection\n if (metadata.formatDetection) {\n const parts: string[] = [];\n if (metadata.formatDetection.telephone === false) parts.push(\"telephone=no\");\n if (metadata.formatDetection.address === false) parts.push(\"address=no\");\n if (metadata.formatDetection.email === false) parts.push(\"email=no\");\n if (parts.length > 0) {\n elements.push(<meta key={key++} name=\"format-detection\" content={parts.join(\", \")} />);\n }\n }\n\n // Category\n if (metadata.category) {\n elements.push(<meta key={key++} name=\"category\" content={metadata.category} />);\n }\n\n // Robots\n if (metadata.robots) {\n if (typeof metadata.robots === \"string\") {\n elements.push(<meta key={key++} name=\"robots\" content={metadata.robots} />);\n } else {\n const { googleBot, ...robotsRest } = metadata.robots;\n const robotParts: string[] = [];\n for (const [k, v] of Object.entries(robotsRest)) {\n if (v === true) robotParts.push(k);\n else if (v === false) robotParts.push(`no${k}`);\n else if (typeof v === \"string\" || typeof v === \"number\") robotParts.push(`${k}:${v}`);\n }\n if (robotParts.length > 0) {\n elements.push(<meta key={key++} name=\"robots\" content={robotParts.join(\", \")} />);\n }\n // googlebot\n if (googleBot) {\n if (typeof googleBot === \"string\") {\n elements.push(<meta key={key++} name=\"googlebot\" content={googleBot} />);\n } else {\n const gbParts: string[] = [];\n for (const [k, v] of Object.entries(googleBot)) {\n if (v === true) gbParts.push(k);\n else if (v === false) gbParts.push(`no${k}`);\n else if (typeof v === \"string\" || typeof v === \"number\") gbParts.push(`${k}:${v}`);\n }\n if (gbParts.length > 0) {\n elements.push(<meta key={key++} name=\"googlebot\" content={gbParts.join(\", \")} />);\n }\n }\n }\n }\n }\n\n // Open Graph\n if (metadata.openGraph) {\n const og = metadata.openGraph;\n if (og.title) elements.push(<meta key={key++} property=\"og:title\" content={og.title} />);\n if (og.description)\n elements.push(<meta key={key++} property=\"og:description\" content={og.description} />);\n if (og.url) elements.push(<meta key={key++} property=\"og:url\" content={resolveUrl(og.url)} />);\n if (og.siteName)\n elements.push(<meta key={key++} property=\"og:site_name\" content={og.siteName} />);\n if (og.type) elements.push(<meta key={key++} property=\"og:type\" content={og.type} />);\n if (og.locale) elements.push(<meta key={key++} property=\"og:locale\" content={og.locale} />);\n if (og.publishedTime)\n elements.push(\n <meta key={key++} property=\"article:published_time\" content={og.publishedTime} />,\n );\n if (og.modifiedTime)\n elements.push(\n <meta key={key++} property=\"article:modified_time\" content={og.modifiedTime} />,\n );\n if (og.authors) {\n for (const author of og.authors) {\n elements.push(<meta key={key++} property=\"article:author\" content={author} />);\n }\n }\n if (og.images) {\n const imgList =\n typeof og.images === \"string\" || og.images instanceof URL\n ? [{ url: og.images }]\n : Array.isArray(og.images)\n ? og.images\n : [og.images];\n for (const img of imgList) {\n const imgUrl = typeof img === \"string\" || img instanceof URL ? img : img.url;\n elements.push(<meta key={key++} property=\"og:image\" content={resolveUrl(imgUrl)} />);\n if (typeof img !== \"string\" && !(img instanceof URL)) {\n if (img.width)\n elements.push(\n <meta key={key++} property=\"og:image:width\" content={String(img.width)} />,\n );\n if (img.height)\n elements.push(\n <meta key={key++} property=\"og:image:height\" content={String(img.height)} />,\n );\n if (img.type)\n elements.push(<meta key={key++} property=\"og:image:type\" content={img.type} />);\n if (img.alt)\n elements.push(<meta key={key++} property=\"og:image:alt\" content={img.alt} />);\n }\n }\n }\n if (og.videos) {\n for (const video of og.videos) {\n elements.push(<meta key={key++} property=\"og:video\" content={resolveUrl(video.url)} />);\n if (video.width)\n elements.push(\n <meta key={key++} property=\"og:video:width\" content={String(video.width)} />,\n );\n if (video.height)\n elements.push(\n <meta key={key++} property=\"og:video:height\" content={String(video.height)} />,\n );\n }\n }\n if (og.audio) {\n for (const audio of og.audio) {\n elements.push(<meta key={key++} property=\"og:audio\" content={resolveUrl(audio.url)} />);\n }\n }\n }\n\n // Twitter\n if (metadata.twitter) {\n const tw = metadata.twitter;\n if (tw.card) elements.push(<meta key={key++} name=\"twitter:card\" content={tw.card} />);\n if (tw.site) elements.push(<meta key={key++} name=\"twitter:site\" content={tw.site} />);\n if (tw.siteId) elements.push(<meta key={key++} name=\"twitter:site:id\" content={tw.siteId} />);\n if (tw.title) elements.push(<meta key={key++} name=\"twitter:title\" content={tw.title} />);\n if (tw.description)\n elements.push(<meta key={key++} name=\"twitter:description\" content={tw.description} />);\n if (tw.creator) elements.push(<meta key={key++} name=\"twitter:creator\" content={tw.creator} />);\n if (tw.creatorId)\n elements.push(<meta key={key++} name=\"twitter:creator:id\" content={tw.creatorId} />);\n if (tw.images) {\n const imgList =\n typeof tw.images === \"string\" || tw.images instanceof URL\n ? [tw.images]\n : Array.isArray(tw.images)\n ? tw.images\n : [tw.images];\n for (const img of imgList) {\n const imgUrl = typeof img === \"string\" || img instanceof URL ? img : img.url;\n elements.push(<meta key={key++} name=\"twitter:image\" content={resolveUrl(imgUrl)} />);\n if (typeof img !== \"string\" && !(img instanceof URL)) {\n if (img.type) {\n elements.push(<meta key={key++} name=\"twitter:image:type\" content={img.type} />);\n }\n if (img.width) {\n elements.push(\n <meta key={key++} name=\"twitter:image:width\" content={String(img.width)} />,\n );\n }\n if (img.height) {\n elements.push(\n <meta key={key++} name=\"twitter:image:height\" content={String(img.height)} />,\n );\n }\n if (img.alt) {\n elements.push(<meta key={key++} name=\"twitter:image:alt\" content={img.alt} />);\n }\n }\n }\n }\n // Twitter player cards\n if (tw.players) {\n const players = Array.isArray(tw.players) ? tw.players : [tw.players];\n for (const player of players) {\n const playerUrl = player.playerUrl.toString();\n const streamUrl = player.streamUrl.toString();\n elements.push(<meta key={key++} name=\"twitter:player\" content={resolveUrl(playerUrl)} />);\n elements.push(\n <meta key={key++} name=\"twitter:player:stream\" content={resolveUrl(streamUrl)} />,\n );\n elements.push(\n <meta key={key++} name=\"twitter:player:width\" content={String(player.width)} />,\n );\n elements.push(\n <meta key={key++} name=\"twitter:player:height\" content={String(player.height)} />,\n );\n }\n }\n // Twitter app cards\n if (tw.app) {\n const { app } = tw;\n for (const platform of [\"iphone\", \"ipad\", \"googleplay\"] as const) {\n if (app.name) {\n elements.push(\n <meta key={key++} name={`twitter:app:name:${platform}`} content={app.name} />,\n );\n }\n if (app.id[platform] !== undefined) {\n elements.push(\n <meta\n key={key++}\n name={`twitter:app:id:${platform}`}\n content={String(app.id[platform])}\n />,\n );\n }\n if (app.url?.[platform] !== undefined) {\n const appUrl = app.url[platform]!.toString();\n elements.push(\n <meta key={key++} name={`twitter:app:url:${platform}`} content={resolveUrl(appUrl)} />,\n );\n }\n }\n }\n }\n\n // Icons\n if (metadata.icons) {\n const iconEntries = isIconsMap(metadata.icons)\n ? normalizeUrlDescriptorEntries(metadata.icons.icon, (url): IconDescriptor => ({ url }))\n : normalizeUrlDescriptorEntries(metadata.icons, (url): IconDescriptor => ({ url }));\n\n // Shortcut icon\n if (isIconsMap(metadata.icons) && metadata.icons.shortcut) {\n const shortcuts = Array.isArray(metadata.icons.shortcut)\n ? metadata.icons.shortcut\n : [metadata.icons.shortcut];\n for (const s of shortcuts) {\n elements.push(<link key={key++} rel=\"shortcut icon\" href={resolveUrl(s)} />);\n }\n }\n // Icon\n if (iconEntries.length > 0) {\n for (const i of iconEntries) {\n elements.push(\n <link\n key={key++}\n rel=\"icon\"\n href={resolveUrl(i.url)}\n {...(i.sizes ? { sizes: i.sizes } : {})}\n {...(i.type ? { type: i.type } : {})}\n {...(i.media ? { media: i.media } : {})}\n />,\n );\n }\n }\n // Apple touch icon\n if (isIconsMap(metadata.icons) && metadata.icons.apple) {\n for (const a of normalizeUrlDescriptorEntries(\n metadata.icons.apple,\n (url): AppleIconDescriptor => ({ url }),\n )) {\n elements.push(\n <link\n key={key++}\n rel=\"apple-touch-icon\"\n href={resolveUrl(a.url)}\n {...(a.sizes ? { sizes: a.sizes } : {})}\n {...(a.type ? { type: a.type } : {})}\n />,\n );\n }\n }\n // Other custom icon relations\n if (isIconsMap(metadata.icons) && metadata.icons.other) {\n for (const o of metadata.icons.other) {\n elements.push(\n <link\n key={key++}\n rel={o.rel}\n href={resolveUrl(o.url)}\n {...(o.sizes ? { sizes: o.sizes } : {})}\n />,\n );\n }\n }\n }\n\n // Manifest\n if (metadata.manifest) {\n elements.push(<link key={key++} rel=\"manifest\" href={resolveUrl(metadata.manifest)} />);\n }\n\n // Alternates\n if (metadata.alternates) {\n const alt = metadata.alternates;\n if (alt.canonical) {\n elements.push(<link key={key++} rel=\"canonical\" href={resolveUrl(alt.canonical)} />);\n }\n if (alt.languages) {\n for (const [lang, href] of Object.entries(alt.languages)) {\n elements.push(<link key={key++} rel=\"alternate\" hrefLang={lang} href={resolveUrl(href)} />);\n }\n }\n if (alt.media) {\n for (const [media, href] of Object.entries(alt.media)) {\n elements.push(<link key={key++} rel=\"alternate\" media={media} href={resolveUrl(href)} />);\n }\n }\n if (alt.types) {\n for (const [type, href] of Object.entries(alt.types)) {\n elements.push(<link key={key++} rel=\"alternate\" type={type} href={resolveUrl(href)} />);\n }\n }\n }\n\n // Verification\n if (metadata.verification) {\n const v = metadata.verification;\n if (v.google)\n elements.push(<meta key={key++} name=\"google-site-verification\" content={v.google} />);\n if (v.yahoo) elements.push(<meta key={key++} name=\"y_key\" content={v.yahoo} />);\n if (v.yandex) elements.push(<meta key={key++} name=\"yandex-verification\" content={v.yandex} />);\n if (v.other) {\n for (const [name, content] of Object.entries(v.other)) {\n const values = Array.isArray(content) ? content : [content];\n for (const val of values) {\n elements.push(<meta key={key++} name={name} content={val} />);\n }\n }\n }\n }\n\n // Apple Web App\n if (metadata.appleWebApp) {\n const awa = metadata.appleWebApp;\n if (awa.capable !== false) {\n elements.push(<meta key={key++} name=\"mobile-web-app-capable\" content=\"yes\" />);\n }\n if (awa.title) {\n elements.push(<meta key={key++} name=\"apple-mobile-web-app-title\" content={awa.title} />);\n }\n if (awa.statusBarStyle) {\n elements.push(\n <meta\n key={key++}\n name=\"apple-mobile-web-app-status-bar-style\"\n content={awa.statusBarStyle}\n />,\n );\n }\n if (awa.startupImage) {\n const imgs =\n typeof awa.startupImage === \"string\" ? [{ url: awa.startupImage }] : awa.startupImage;\n for (const img of imgs) {\n elements.push(\n <link\n key={key++}\n rel=\"apple-touch-startup-image\"\n href={resolveUrl(img.url)}\n {...(img.media ? { media: img.media } : {})}\n />,\n );\n }\n }\n }\n\n // iTunes\n if (metadata.itunes) {\n const { appId, appArgument } = metadata.itunes;\n let content = `app-id=${appId}`;\n if (appArgument) {\n content += `, app-argument=${appArgument}`;\n }\n elements.push(<meta key={key++} name=\"apple-itunes-app\" content={content} />);\n }\n\n // App Links\n if (metadata.appLinks) {\n const al = metadata.appLinks;\n const platforms = [\n \"ios\",\n \"iphone\",\n \"ipad\",\n \"android\",\n \"windows_phone\",\n \"windows\",\n \"windows_universal\",\n \"web\",\n ] as const;\n for (const platform of platforms) {\n const entries = al[platform];\n if (!entries) continue;\n const list = Array.isArray(entries) ? entries : [entries];\n for (const entry of list) {\n for (const [k, v] of Object.entries(entry)) {\n if (v === undefined || v === null) continue;\n const str = String(v);\n const content = k === \"url\" ? resolveUrl(str) : str;\n elements.push(<meta key={key++} property={`al:${platform}:${k}`} content={content} />);\n }\n }\n }\n }\n\n // Other custom meta tags\n if (metadata.other) {\n for (const [name, content] of Object.entries(metadata.other)) {\n const values = Array.isArray(content) ? content : [content];\n for (const val of values) {\n elements.push(<meta key={key++} name={name} content={val} />);\n }\n }\n }\n\n return <>{elements}</>;\n}\n"],"mappings":";;;;;;;;AAoCA,eAAsB,sBACpB,KACA,QAC0B;AAC1B,KAAI,OAAO,IAAI,qBAAqB,YAAY;EAC9C,MAAM,cAAc,mBAAmB,OAAO;AAC9C,SAAO,MAAM,IAAI,iBAAiB,EAAE,QAAQ,aAAa,CAAC;;AAE5D,KAAI,IAAI,YAAY,OAAO,IAAI,aAAa,SAC1C,QAAO,IAAI;AAEb,QAAO;;;;;;AAOT,MAAa,mBAA6B;CACxC,OAAO;CACP,cAAc;CACf;AAED,SAAgB,cAAc,cAAoC;CAChE,MAAM,SAAmB,EAAE,GAAG,kBAAkB;AAChD,MAAK,MAAM,MAAM,aACf,QAAO,OAAO,QAAQ,GAAG;AAE3B,QAAO;;;;;AAMT,SAAgB,aAAa,EAAE,YAAoC;CACjE,MAAM,WAAiC,EAAE;CACzC,IAAI,MAAM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AAM,CAAC,MAAM,YAAY,OAAO,QAAQ,SAAS,MAAM,EAAE;EAC5D,MAAM,SAAS,MAAM,QAAQ,QAAQ,GAAG,UAAU,CAAC,QAAQ;AAC3D,OAAK,MAAM,OAAO,OAChB,UAAS,KAAK,oBAAC,QAAD;GAAwB;GAAM,SAAS;GAAO,EAAnC,MAAmC,CAAC;;AAKnE,QAAO,oBAAA,YAAA,EAAA,UAAG,UAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"metadata.js","names":[],"sources":["../../src/shims/metadata.tsx"],"sourcesContent":["/**\n * Metadata support for App Router.\n *\n * Handles `export const metadata` and `export async function generateMetadata()`.\n * Resolves metadata from layouts and pages (pages override layouts).\n */\nimport React from \"react\";\nimport { makeThenableParams } from \"./thenable-params.js\";\n\n// ---------------------------------------------------------------------------\n// Viewport types and resolution\n// ---------------------------------------------------------------------------\n\nexport type Viewport = {\n /** Viewport width (default: \"device-width\") */\n width?: string | number;\n /** Viewport height */\n height?: string | number;\n /** Initial scale */\n initialScale?: number;\n /** Minimum scale */\n minimumScale?: number;\n /** Maximum scale */\n maximumScale?: number;\n /** Whether user can scale */\n userScalable?: boolean;\n /** Theme color — single color or array of { media, color } */\n themeColor?: string | Array<{ media?: string; color: string }>;\n /** Color scheme: 'light' | 'dark' | 'light dark' | 'normal' */\n colorScheme?: string;\n};\n\n/**\n * Resolve viewport config from a module. Handles both static `viewport` export\n * and async `generateViewport()` function.\n */\nexport async function resolveModuleViewport(\n mod: Record<string, unknown>,\n params: Record<string, string | string[]>,\n): Promise<Viewport | null> {\n if (typeof mod.generateViewport === \"function\") {\n const asyncParams = makeThenableParams(params);\n return await mod.generateViewport({ params: asyncParams });\n }\n if (mod.viewport && typeof mod.viewport === \"object\") {\n return mod.viewport as Viewport;\n }\n return null;\n}\n\n/**\n * Merge viewport configs from multiple sources (layouts + page).\n * Later entries override earlier ones.\n */\nexport const DEFAULT_VIEWPORT: Viewport = {\n width: \"device-width\",\n initialScale: 1,\n};\n\nexport function mergeViewport(viewportList: Viewport[]): Viewport {\n const merged: Viewport = { ...DEFAULT_VIEWPORT };\n for (const vp of viewportList) {\n Object.assign(merged, vp);\n }\n return merged;\n}\n\n/**\n * React component that renders viewport meta tags into <head>.\n */\nexport function ViewportHead({ viewport }: { viewport: Viewport }) {\n const elements: React.ReactElement[] = [];\n let key = 0;\n\n // Build viewport content string\n const parts: string[] = [];\n if (viewport.width !== undefined) parts.push(`width=${viewport.width}`);\n if (viewport.height !== undefined) parts.push(`height=${viewport.height}`);\n if (viewport.initialScale !== undefined) parts.push(`initial-scale=${viewport.initialScale}`);\n if (viewport.minimumScale !== undefined) parts.push(`minimum-scale=${viewport.minimumScale}`);\n if (viewport.maximumScale !== undefined) parts.push(`maximum-scale=${viewport.maximumScale}`);\n if (viewport.userScalable !== undefined)\n parts.push(`user-scalable=${viewport.userScalable ? \"yes\" : \"no\"}`);\n\n if (parts.length > 0) {\n elements.push(<meta key={key++} name=\"viewport\" content={parts.join(\", \")} />);\n }\n\n // Theme color\n if (viewport.themeColor) {\n if (typeof viewport.themeColor === \"string\") {\n elements.push(<meta key={key++} name=\"theme-color\" content={viewport.themeColor} />);\n } else if (Array.isArray(viewport.themeColor)) {\n for (const entry of viewport.themeColor) {\n elements.push(\n <meta\n key={key++}\n name=\"theme-color\"\n content={entry.color}\n {...(entry.media ? { media: entry.media } : {})}\n />,\n );\n }\n }\n }\n\n // Color scheme\n if (viewport.colorScheme) {\n elements.push(<meta key={key++} name=\"color-scheme\" content={viewport.colorScheme} />);\n }\n\n return <>{elements}</>;\n}\n\n// ---------------------------------------------------------------------------\n// Metadata types and resolution\n// ---------------------------------------------------------------------------\n\nexport type Metadata = {\n title?: string | { default?: string; template?: string; absolute?: string };\n description?: string;\n generator?: string;\n applicationName?: string;\n referrer?: string;\n keywords?: string | string[];\n authors?: Array<{ name?: string; url?: string }> | { name?: string; url?: string };\n creator?: string;\n publisher?: string;\n robots?:\n | string\n | {\n index?: boolean;\n follow?: boolean;\n googleBot?: string | { index?: boolean; follow?: boolean; [key: string]: unknown };\n [key: string]: unknown;\n };\n openGraph?: {\n title?: string;\n description?: string;\n url?: string | URL;\n siteName?: string;\n images?:\n | string\n | URL\n | { url: string | URL; width?: number; height?: number; alt?: string; type?: string }\n | Array<\n | string\n | URL\n | { url: string | URL; width?: number; height?: number; alt?: string; type?: string }\n >;\n videos?: Array<{ url: string | URL; width?: number; height?: number }>;\n audio?: Array<{ url: string | URL }>;\n locale?: string;\n type?: string;\n publishedTime?: string;\n modifiedTime?: string;\n authors?: string[];\n };\n twitter?: {\n card?: string;\n site?: string;\n siteId?: string;\n title?: string;\n description?: string;\n images?:\n | string\n | URL\n | { url: string | URL; alt?: string; width?: number; height?: number; type?: string }\n | Array<\n | string\n | URL\n | { url: string | URL; alt?: string; width?: number; height?: number; type?: string }\n >;\n creator?: string;\n creatorId?: string;\n players?: TwitterPlayerDescriptor | TwitterPlayerDescriptor[];\n app?: TwitterAppDescriptor;\n };\n icons?: IconsMetadata;\n manifest?: string | URL;\n alternates?: {\n canonical?: string | URL;\n languages?: Record<string, string | URL>;\n media?: Record<string, string | URL>;\n types?: Record<string, string | URL>;\n };\n verification?: {\n google?: string;\n yahoo?: string;\n yandex?: string;\n other?: Record<string, string | string[]>;\n };\n metadataBase?: URL | null;\n appleWebApp?: {\n capable?: boolean;\n title?: string;\n statusBarStyle?: string;\n startupImage?: string | Array<{ url: string; media?: string }>;\n };\n formatDetection?: {\n email?: boolean;\n address?: boolean;\n telephone?: boolean;\n };\n category?: string;\n itunes?: {\n appId: string;\n appArgument?: string;\n };\n appLinks?: {\n ios?: AppLinksApple | AppLinksApple[];\n iphone?: AppLinksApple | AppLinksApple[];\n ipad?: AppLinksApple | AppLinksApple[];\n android?: AppLinksAndroid | AppLinksAndroid[];\n windows_phone?: AppLinksWindows | AppLinksWindows[];\n windows?: AppLinksWindows | AppLinksWindows[];\n windows_universal?: AppLinksWindows | AppLinksWindows[];\n web?: AppLinksWeb | AppLinksWeb[];\n };\n other?: Record<string, string | string[]>;\n [key: string]: unknown;\n};\n\ntype AppLinksApple = {\n url: string | URL;\n app_store_id?: string | number;\n app_name?: string;\n};\n\ntype AppLinksAndroid = {\n package: string;\n url?: string | URL;\n class?: string;\n app_name?: string;\n};\n\ntype AppLinksWindows = {\n url: string | URL;\n app_id?: string;\n app_name?: string;\n};\n\ntype AppLinksWeb = {\n url: string | URL;\n should_fallback?: boolean;\n};\n\ntype TwitterPlayerDescriptor = {\n playerUrl: string | URL;\n streamUrl: string | URL;\n width: number;\n height: number;\n};\n\ntype TwitterAppDescriptor = {\n id: {\n iphone?: string | number;\n ipad?: string | number;\n googleplay?: string;\n };\n url?: {\n iphone?: string | URL;\n ipad?: string | URL;\n googleplay?: string | URL;\n };\n name?: string;\n};\n\ntype IconDescriptor = {\n url: string | URL;\n sizes?: string;\n type?: string;\n media?: string;\n};\n\ntype AppleIconDescriptor = {\n url: string | URL;\n sizes?: string;\n type?: string;\n};\n\ntype IconInput = string | URL | IconDescriptor;\ntype AppleIconInput = string | URL | AppleIconDescriptor;\n\ntype IconsMap = {\n icon?: IconInput | IconInput[];\n shortcut?: string | URL | Array<string | URL>;\n apple?: AppleIconInput | AppleIconInput[];\n other?: Array<{ rel: string; url: string | URL; sizes?: string; type?: string }>;\n};\n\ntype IconsMetadata = IconInput | IconInput[] | IconsMap;\n\nexport type MetadataMergeEntry = {\n contributesTitle?: boolean;\n isPage?: boolean;\n metadata: Metadata;\n};\n\n/**\n * Merge metadata from multiple sources (layouts + page).\n *\n * The list is ordered [rootLayout, nestedLayout, ..., page].\n * Title template from layouts applies to the page title but NOT to\n * the segment that defines the template itself. `title.absolute`\n * skips all templates. `title.default` is the fallback when no\n * child provides a title.\n *\n * Shallow merge: later entries override earlier ones (per Next.js docs).\n */\nexport function mergeMetadata(metadataList: Metadata[]): Metadata {\n const merged = mergeMetadataEntries(\n metadataList.map((metadata, index) => ({\n isPage: index === metadataList.length - 1,\n metadata,\n })),\n );\n return postProcessMetadata(merged);\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return (\n typeof value === \"object\" && value !== null && !Array.isArray(value) && !(value instanceof URL)\n );\n}\n\nfunction isOtherMetadata(value: unknown): value is NonNullable<Metadata[\"other\"]> {\n if (!isPlainObject(value)) return false;\n return Object.values(value).every((item) => {\n if (typeof item === \"string\") return true;\n return Array.isArray(item) && item.every((nestedItem) => typeof nestedItem === \"string\");\n });\n}\n\n/**\n * Extract a plain string title from a metadata title value.\n */\nfunction resolveStringTitle(title: Metadata[\"title\"]): string | undefined {\n if (typeof title === \"string\") return title;\n if (title && typeof title === \"object\") {\n return title.absolute ?? title.default ?? undefined;\n }\n return undefined;\n}\n\n/**\n * Post-process merged metadata to cross-fill openGraph and Twitter fields.\n *\n * Next.js runs this once after all layouts/pages and file-based metadata\n * have been resolved. When openGraph exists, it auto-fills missing\n * twitter:title/description/images from openGraph (falling back to root\n * metadata title/description). Existing openGraph/twitter objects also inherit\n * missing title/description from root metadata.\n *\n * Ported from Next.js:\n * https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/metadata/resolve-metadata.ts\n */\nexport function postProcessMetadata(merged: Metadata): Metadata {\n // Shallow-clone to avoid mutating the caller's object.\n // Both current call sites (mergeMetadata, resolveAppPageHead) pass\n // freshly-constructed objects, but this guards against future misuse.\n const result = { ...merged };\n\n const resolvedTitle = resolveStringTitle(result.title);\n\n // openGraph inherits title/description from root metadata when absent\n if (result.openGraph) {\n const og = { ...result.openGraph };\n if (!og.title && resolvedTitle) {\n og.title = resolvedTitle;\n }\n if (!og.description && result.description) {\n og.description = result.description;\n }\n result.openGraph = og;\n }\n\n if (result.openGraph) {\n const autoFill: {\n title?: string;\n description?: string;\n images?: NonNullable<Metadata[\"twitter\"]>[\"images\"];\n } = {};\n\n const existingTwitter = result.twitter;\n const hasTwTitle = existingTwitter ? Boolean(existingTwitter.title) : false;\n const hasTwDescription = existingTwitter ? Boolean(existingTwitter.description) : false;\n const hasTwImages = existingTwitter\n ? Object.prototype.hasOwnProperty.call(existingTwitter, \"images\") &&\n Boolean(existingTwitter.images)\n : false;\n\n if (!hasTwTitle) {\n if (result.openGraph.title) {\n autoFill.title = result.openGraph.title;\n } else if (resolvedTitle) {\n autoFill.title = resolvedTitle;\n }\n }\n if (!hasTwDescription) {\n autoFill.description = result.openGraph.description || result.description || undefined;\n }\n if (!hasTwImages) {\n autoFill.images = result.openGraph.images;\n }\n\n if (Object.keys(autoFill).length > 0) {\n if (existingTwitter) {\n result.twitter = { ...existingTwitter, ...autoFill };\n } else {\n result.twitter = autoFill;\n }\n }\n }\n\n if (result.twitter) {\n const tw = { ...result.twitter };\n if (!tw.title && resolvedTitle) {\n tw.title = resolvedTitle;\n }\n if (!tw.description && result.description) {\n tw.description = result.description;\n }\n result.twitter = tw;\n }\n\n // If twitter exists (either originally or via auto-fill), ensure card type is set.\n // Next.js resolveTwitter defaults: summary_large_image when images present, else summary.\n if (result.twitter) {\n const tw = { ...result.twitter };\n if (!tw.card) {\n const images = tw.images;\n const hasImages = Array.isArray(images) ? images.length > 0 : Boolean(images);\n tw.card = hasImages ? \"summary_large_image\" : \"summary\";\n }\n result.twitter = tw;\n }\n\n return result;\n}\n\n/**\n * Merge metadata from multiple sources (layouts + page).\n *\n * The list is ordered [rootLayout, nestedLayout, ..., page].\n * Title template from layouts applies to the page title but NOT to\n * the segment that defines the template itself. `title.absolute`\n * skips all templates. `title.default` is the fallback when no\n * child provides a title.\n *\n * For top-level keys, later entries override earlier ones. `other` custom meta\n * tags are the exception: Next.js merges those across segments.\n */\nexport function mergeMetadataEntries(entries: readonly MetadataMergeEntry[]): Metadata {\n if (entries.length === 0) return {};\n\n const merged: Metadata = {};\n\n // Track the most recent title template from LAYOUTS (not from page).\n let parentTemplate: string | undefined;\n\n for (const entry of entries) {\n const meta = entry.metadata;\n const isPage = Boolean(entry.isPage);\n const contributesTitle = entry.contributesTitle !== false;\n\n // Collect template from layouts only (page templates are ignored per Next.js spec)\n if (\n contributesTitle &&\n !isPage &&\n meta.title &&\n typeof meta.title === \"object\" &&\n meta.title.template\n ) {\n parentTemplate = meta.title.template;\n }\n\n // Merge non-title keys\n for (const key of Object.keys(meta)) {\n if (key === \"title\") continue; // Handle title separately below\n\n const incoming = meta[key];\n const existing = merged[key];\n\n if (key === \"other\" && isOtherMetadata(existing) && isOtherMetadata(incoming)) {\n merged.other = { ...existing, ...incoming };\n } else {\n // Plain replacement for everything else\n merged[key] = incoming;\n }\n }\n\n // Title resolution\n if (contributesTitle && meta.title !== undefined) {\n merged.title = meta.title;\n }\n }\n\n // Now resolve the final title, applying the parent template if applicable\n const finalTitle = merged.title;\n if (finalTitle) {\n if (typeof finalTitle === \"string\") {\n // Simple string title — apply parent template\n if (parentTemplate) {\n merged.title = parentTemplate.replace(\"%s\", finalTitle);\n }\n } else if (typeof finalTitle === \"object\") {\n if (finalTitle.absolute) {\n // Absolute title — skip all templates\n merged.title = finalTitle.absolute;\n } else if (finalTitle.default) {\n // Title object with default — this is used when the segment IS the\n // defining layout (its own default doesn't get template-wrapped)\n merged.title = finalTitle.default;\n } else if (finalTitle.template && !finalTitle.default && !finalTitle.absolute) {\n // Template only with no default — no title to render\n merged.title = undefined;\n }\n }\n }\n\n return merged;\n}\n\n/**\n * Resolve metadata from a module. Handles both static `metadata` export\n * and async `generateMetadata()` function.\n *\n * @param parent - A Promise that resolves to the accumulated (merged) metadata\n * from all ancestor segments. Passed as the second argument to\n * `generateMetadata()`, matching Next.js's eager-execution-with-serial-\n * resolution approach. If not provided, defaults to a promise that resolves\n * to an empty object (so `await parent` never throws).\n */\nexport async function resolveModuleMetadata(\n mod: Record<string, unknown>,\n params: Record<string, string | string[]> = {},\n searchParams?: Record<string, string | string[]>,\n parent: Promise<Metadata> = Promise.resolve({}),\n): Promise<Metadata | null> {\n if (typeof mod.generateMetadata === \"function\") {\n // Next.js 16 passes params/searchParams as Promises (async pattern).\n // makeThenableParams() normalises null-prototype + preserves sync access.\n const asyncParams = makeThenableParams(params);\n const props =\n searchParams === undefined\n ? { params: asyncParams }\n : { params: asyncParams, searchParams: makeThenableParams(searchParams) };\n return await mod.generateMetadata(props, parent);\n }\n if (mod.metadata && typeof mod.metadata === \"object\") {\n return mod.metadata as Metadata;\n }\n return null;\n}\n\n/**\n * React component that renders metadata as HTML head elements.\n * Used by the RSC entry to inject into the <head>.\n */\nfunction isIconDescriptor(value: unknown): value is IconDescriptor {\n if (typeof value !== \"object\" || value === null || value instanceof URL || Array.isArray(value)) {\n return false;\n }\n const urlValue = Reflect.get(value, \"url\");\n return typeof urlValue === \"string\" || urlValue instanceof URL;\n}\n\nfunction isIconsMap(value: IconsMetadata): value is IconsMap {\n return (\n typeof value === \"object\" &&\n !(value instanceof URL) &&\n !Array.isArray(value) &&\n !isIconDescriptor(value)\n );\n}\n\nfunction normalizeUrlDescriptor<T extends { url: string | URL }>(\n value: string | URL | T,\n createDescriptor: (url: string | URL) => T,\n): T {\n if (typeof value === \"string\" || value instanceof URL) {\n return createDescriptor(value);\n }\n return value;\n}\n\nfunction normalizeUrlDescriptorEntries<T extends { url: string | URL }>(\n value: string | URL | T | Array<string | URL | T> | undefined,\n createDescriptor: (url: string | URL) => T,\n): T[] {\n if (!value) {\n return [];\n }\n\n if (Array.isArray(value)) {\n return value.map((entry) => normalizeUrlDescriptor(entry, createDescriptor));\n }\n\n return [normalizeUrlDescriptor(value, createDescriptor)];\n}\n\nexport function MetadataHead({ metadata }: { metadata: Metadata }) {\n const elements: React.ReactElement[] = [];\n let key = 0;\n\n // Resolve metadataBase for URL composition\n const base = metadata.metadataBase;\n function resolveUrl(url: string | URL): string;\n function resolveUrl(url: string | URL | undefined): string | undefined;\n function resolveUrl(url: string | URL | undefined): string | undefined {\n if (!url) return undefined;\n // Coerce URL objects to strings (Next.js metadata allows string | URL)\n const s = typeof url === \"string\" ? url : url instanceof URL ? url.toString() : String(url);\n if (!base) return s;\n if (s.startsWith(\"http://\") || s.startsWith(\"https://\") || s.startsWith(\"//\")) return s;\n try {\n return new URL(s, base).toString();\n } catch {\n return s;\n }\n }\n\n // Title\n const title =\n typeof metadata.title === \"string\"\n ? metadata.title\n : typeof metadata.title === \"object\"\n ? metadata.title.absolute || metadata.title.default\n : undefined;\n if (title) {\n elements.push(<title key={key++}>{title}</title>);\n }\n\n // Description\n if (metadata.description) {\n elements.push(<meta key={key++} name=\"description\" content={metadata.description} />);\n }\n\n // Generator\n if (metadata.generator) {\n elements.push(<meta key={key++} name=\"generator\" content={metadata.generator} />);\n }\n\n // Application name\n if (metadata.applicationName) {\n elements.push(<meta key={key++} name=\"application-name\" content={metadata.applicationName} />);\n }\n\n // Referrer\n if (metadata.referrer) {\n elements.push(<meta key={key++} name=\"referrer\" content={metadata.referrer} />);\n }\n\n // Keywords\n if (metadata.keywords) {\n const kw = Array.isArray(metadata.keywords) ? metadata.keywords.join(\",\") : metadata.keywords;\n elements.push(<meta key={key++} name=\"keywords\" content={kw} />);\n }\n\n // Authors\n if (metadata.authors) {\n const authorList = Array.isArray(metadata.authors) ? metadata.authors : [metadata.authors];\n for (const author of authorList) {\n if (author.name) {\n elements.push(<meta key={key++} name=\"author\" content={author.name} />);\n }\n if (author.url) {\n elements.push(<link key={key++} rel=\"author\" href={author.url} />);\n }\n }\n }\n\n // Creator\n if (metadata.creator) {\n elements.push(<meta key={key++} name=\"creator\" content={metadata.creator} />);\n }\n\n // Publisher\n if (metadata.publisher) {\n elements.push(<meta key={key++} name=\"publisher\" content={metadata.publisher} />);\n }\n\n // Format detection\n if (metadata.formatDetection) {\n const parts: string[] = [];\n if (metadata.formatDetection.telephone === false) parts.push(\"telephone=no\");\n if (metadata.formatDetection.address === false) parts.push(\"address=no\");\n if (metadata.formatDetection.email === false) parts.push(\"email=no\");\n if (parts.length > 0) {\n elements.push(<meta key={key++} name=\"format-detection\" content={parts.join(\", \")} />);\n }\n }\n\n // Category\n if (metadata.category) {\n elements.push(<meta key={key++} name=\"category\" content={metadata.category} />);\n }\n\n // Robots\n if (metadata.robots) {\n if (typeof metadata.robots === \"string\") {\n elements.push(<meta key={key++} name=\"robots\" content={metadata.robots} />);\n } else {\n const { googleBot, ...robotsRest } = metadata.robots;\n const robotParts: string[] = [];\n for (const [k, v] of Object.entries(robotsRest)) {\n if (v === true) robotParts.push(k);\n else if (v === false) robotParts.push(`no${k}`);\n else if (typeof v === \"string\" || typeof v === \"number\") robotParts.push(`${k}:${v}`);\n }\n if (robotParts.length > 0) {\n elements.push(<meta key={key++} name=\"robots\" content={robotParts.join(\", \")} />);\n }\n // googlebot\n if (googleBot) {\n if (typeof googleBot === \"string\") {\n elements.push(<meta key={key++} name=\"googlebot\" content={googleBot} />);\n } else {\n const gbParts: string[] = [];\n for (const [k, v] of Object.entries(googleBot)) {\n if (v === true) gbParts.push(k);\n else if (v === false) gbParts.push(`no${k}`);\n else if (typeof v === \"string\" || typeof v === \"number\") gbParts.push(`${k}:${v}`);\n }\n if (gbParts.length > 0) {\n elements.push(<meta key={key++} name=\"googlebot\" content={gbParts.join(\", \")} />);\n }\n }\n }\n }\n }\n\n // Open Graph\n if (metadata.openGraph) {\n const og = metadata.openGraph;\n if (og.title) elements.push(<meta key={key++} property=\"og:title\" content={og.title} />);\n if (og.description)\n elements.push(<meta key={key++} property=\"og:description\" content={og.description} />);\n if (og.url) elements.push(<meta key={key++} property=\"og:url\" content={resolveUrl(og.url)} />);\n if (og.siteName)\n elements.push(<meta key={key++} property=\"og:site_name\" content={og.siteName} />);\n if (og.type) elements.push(<meta key={key++} property=\"og:type\" content={og.type} />);\n if (og.locale) elements.push(<meta key={key++} property=\"og:locale\" content={og.locale} />);\n if (og.publishedTime)\n elements.push(\n <meta key={key++} property=\"article:published_time\" content={og.publishedTime} />,\n );\n if (og.modifiedTime)\n elements.push(\n <meta key={key++} property=\"article:modified_time\" content={og.modifiedTime} />,\n );\n if (og.authors) {\n for (const author of og.authors) {\n elements.push(<meta key={key++} property=\"article:author\" content={author} />);\n }\n }\n if (og.images) {\n const imgList =\n typeof og.images === \"string\" || og.images instanceof URL\n ? [{ url: og.images }]\n : Array.isArray(og.images)\n ? og.images\n : [og.images];\n for (const img of imgList) {\n const imgUrl = typeof img === \"string\" || img instanceof URL ? img : img.url;\n elements.push(<meta key={key++} property=\"og:image\" content={resolveUrl(imgUrl)} />);\n if (typeof img !== \"string\" && !(img instanceof URL)) {\n if (img.width)\n elements.push(\n <meta key={key++} property=\"og:image:width\" content={String(img.width)} />,\n );\n if (img.height)\n elements.push(\n <meta key={key++} property=\"og:image:height\" content={String(img.height)} />,\n );\n if (img.type)\n elements.push(<meta key={key++} property=\"og:image:type\" content={img.type} />);\n if (img.alt)\n elements.push(<meta key={key++} property=\"og:image:alt\" content={img.alt} />);\n }\n }\n }\n if (og.videos) {\n for (const video of og.videos) {\n elements.push(<meta key={key++} property=\"og:video\" content={resolveUrl(video.url)} />);\n if (video.width)\n elements.push(\n <meta key={key++} property=\"og:video:width\" content={String(video.width)} />,\n );\n if (video.height)\n elements.push(\n <meta key={key++} property=\"og:video:height\" content={String(video.height)} />,\n );\n }\n }\n if (og.audio) {\n for (const audio of og.audio) {\n elements.push(<meta key={key++} property=\"og:audio\" content={resolveUrl(audio.url)} />);\n }\n }\n }\n\n // Twitter\n if (metadata.twitter) {\n const tw = metadata.twitter;\n if (tw.card) elements.push(<meta key={key++} name=\"twitter:card\" content={tw.card} />);\n if (tw.site) elements.push(<meta key={key++} name=\"twitter:site\" content={tw.site} />);\n if (tw.siteId) elements.push(<meta key={key++} name=\"twitter:site:id\" content={tw.siteId} />);\n if (tw.title) elements.push(<meta key={key++} name=\"twitter:title\" content={tw.title} />);\n if (tw.description)\n elements.push(<meta key={key++} name=\"twitter:description\" content={tw.description} />);\n if (tw.creator) elements.push(<meta key={key++} name=\"twitter:creator\" content={tw.creator} />);\n if (tw.creatorId)\n elements.push(<meta key={key++} name=\"twitter:creator:id\" content={tw.creatorId} />);\n if (tw.images) {\n const imgList =\n typeof tw.images === \"string\" || tw.images instanceof URL\n ? [tw.images]\n : Array.isArray(tw.images)\n ? tw.images\n : [tw.images];\n for (const img of imgList) {\n const imgUrl = typeof img === \"string\" || img instanceof URL ? img : img.url;\n elements.push(<meta key={key++} name=\"twitter:image\" content={resolveUrl(imgUrl)} />);\n if (typeof img !== \"string\" && !(img instanceof URL)) {\n if (img.type) {\n elements.push(<meta key={key++} name=\"twitter:image:type\" content={img.type} />);\n }\n if (img.width) {\n elements.push(\n <meta key={key++} name=\"twitter:image:width\" content={String(img.width)} />,\n );\n }\n if (img.height) {\n elements.push(\n <meta key={key++} name=\"twitter:image:height\" content={String(img.height)} />,\n );\n }\n if (img.alt) {\n elements.push(<meta key={key++} name=\"twitter:image:alt\" content={img.alt} />);\n }\n }\n }\n }\n // Twitter player cards\n if (tw.players) {\n const players = Array.isArray(tw.players) ? tw.players : [tw.players];\n for (const player of players) {\n const playerUrl = player.playerUrl.toString();\n const streamUrl = player.streamUrl.toString();\n elements.push(<meta key={key++} name=\"twitter:player\" content={resolveUrl(playerUrl)} />);\n elements.push(\n <meta key={key++} name=\"twitter:player:stream\" content={resolveUrl(streamUrl)} />,\n );\n elements.push(\n <meta key={key++} name=\"twitter:player:width\" content={String(player.width)} />,\n );\n elements.push(\n <meta key={key++} name=\"twitter:player:height\" content={String(player.height)} />,\n );\n }\n }\n // Twitter app cards\n if (tw.app) {\n const { app } = tw;\n for (const platform of [\"iphone\", \"ipad\", \"googleplay\"] as const) {\n if (app.name) {\n elements.push(\n <meta key={key++} name={`twitter:app:name:${platform}`} content={app.name} />,\n );\n }\n if (app.id[platform] !== undefined) {\n elements.push(\n <meta\n key={key++}\n name={`twitter:app:id:${platform}`}\n content={String(app.id[platform])}\n />,\n );\n }\n if (app.url?.[platform] !== undefined) {\n const appUrl = app.url[platform]!.toString();\n elements.push(\n <meta key={key++} name={`twitter:app:url:${platform}`} content={resolveUrl(appUrl)} />,\n );\n }\n }\n }\n }\n\n // Icons\n if (metadata.icons) {\n const iconEntries = isIconsMap(metadata.icons)\n ? normalizeUrlDescriptorEntries(metadata.icons.icon, (url): IconDescriptor => ({ url }))\n : normalizeUrlDescriptorEntries(metadata.icons, (url): IconDescriptor => ({ url }));\n\n // Shortcut icon\n if (isIconsMap(metadata.icons) && metadata.icons.shortcut) {\n const shortcuts = Array.isArray(metadata.icons.shortcut)\n ? metadata.icons.shortcut\n : [metadata.icons.shortcut];\n for (const s of shortcuts) {\n elements.push(<link key={key++} rel=\"shortcut icon\" href={resolveUrl(s)} />);\n }\n }\n // Icon\n if (iconEntries.length > 0) {\n for (const i of iconEntries) {\n elements.push(\n <link\n key={key++}\n rel=\"icon\"\n href={resolveUrl(i.url)}\n {...(i.sizes ? { sizes: i.sizes } : {})}\n {...(i.type ? { type: i.type } : {})}\n {...(i.media ? { media: i.media } : {})}\n />,\n );\n }\n }\n // Apple touch icon\n if (isIconsMap(metadata.icons) && metadata.icons.apple) {\n for (const a of normalizeUrlDescriptorEntries(\n metadata.icons.apple,\n (url): AppleIconDescriptor => ({ url }),\n )) {\n elements.push(\n <link\n key={key++}\n rel=\"apple-touch-icon\"\n href={resolveUrl(a.url)}\n {...(a.sizes ? { sizes: a.sizes } : {})}\n {...(a.type ? { type: a.type } : {})}\n />,\n );\n }\n }\n // Other custom icon relations\n if (isIconsMap(metadata.icons) && metadata.icons.other) {\n for (const o of metadata.icons.other) {\n elements.push(\n <link\n key={key++}\n rel={o.rel}\n href={resolveUrl(o.url)}\n {...(o.sizes ? { sizes: o.sizes } : {})}\n />,\n );\n }\n }\n }\n\n // Manifest\n if (metadata.manifest) {\n elements.push(<link key={key++} rel=\"manifest\" href={resolveUrl(metadata.manifest)} />);\n }\n\n // Alternates\n if (metadata.alternates) {\n const alt = metadata.alternates;\n if (alt.canonical) {\n elements.push(<link key={key++} rel=\"canonical\" href={resolveUrl(alt.canonical)} />);\n }\n if (alt.languages) {\n for (const [lang, href] of Object.entries(alt.languages)) {\n elements.push(<link key={key++} rel=\"alternate\" hrefLang={lang} href={resolveUrl(href)} />);\n }\n }\n if (alt.media) {\n for (const [media, href] of Object.entries(alt.media)) {\n elements.push(<link key={key++} rel=\"alternate\" media={media} href={resolveUrl(href)} />);\n }\n }\n if (alt.types) {\n for (const [type, href] of Object.entries(alt.types)) {\n elements.push(<link key={key++} rel=\"alternate\" type={type} href={resolveUrl(href)} />);\n }\n }\n }\n\n // Verification\n if (metadata.verification) {\n const v = metadata.verification;\n if (v.google)\n elements.push(<meta key={key++} name=\"google-site-verification\" content={v.google} />);\n if (v.yahoo) elements.push(<meta key={key++} name=\"y_key\" content={v.yahoo} />);\n if (v.yandex) elements.push(<meta key={key++} name=\"yandex-verification\" content={v.yandex} />);\n if (v.other) {\n for (const [name, content] of Object.entries(v.other)) {\n const values = Array.isArray(content) ? content : [content];\n for (const val of values) {\n elements.push(<meta key={key++} name={name} content={val} />);\n }\n }\n }\n }\n\n // Apple Web App\n if (metadata.appleWebApp) {\n const awa = metadata.appleWebApp;\n if (awa.capable !== false) {\n elements.push(<meta key={key++} name=\"mobile-web-app-capable\" content=\"yes\" />);\n }\n if (awa.title) {\n elements.push(<meta key={key++} name=\"apple-mobile-web-app-title\" content={awa.title} />);\n }\n if (awa.statusBarStyle) {\n elements.push(\n <meta\n key={key++}\n name=\"apple-mobile-web-app-status-bar-style\"\n content={awa.statusBarStyle}\n />,\n );\n }\n if (awa.startupImage) {\n const imgs =\n typeof awa.startupImage === \"string\" ? [{ url: awa.startupImage }] : awa.startupImage;\n for (const img of imgs) {\n elements.push(\n <link\n key={key++}\n rel=\"apple-touch-startup-image\"\n href={resolveUrl(img.url)}\n {...(img.media ? { media: img.media } : {})}\n />,\n );\n }\n }\n }\n\n // iTunes\n if (metadata.itunes) {\n const { appId, appArgument } = metadata.itunes;\n let content = `app-id=${appId}`;\n if (appArgument) {\n content += `, app-argument=${appArgument}`;\n }\n elements.push(<meta key={key++} name=\"apple-itunes-app\" content={content} />);\n }\n\n // App Links\n if (metadata.appLinks) {\n const al = metadata.appLinks;\n const platforms = [\n \"ios\",\n \"iphone\",\n \"ipad\",\n \"android\",\n \"windows_phone\",\n \"windows\",\n \"windows_universal\",\n \"web\",\n ] as const;\n for (const platform of platforms) {\n const entries = al[platform];\n if (!entries) continue;\n const list = Array.isArray(entries) ? entries : [entries];\n for (const entry of list) {\n for (const [k, v] of Object.entries(entry)) {\n if (v === undefined || v === null) continue;\n const str = String(v);\n const content = k === \"url\" ? resolveUrl(str) : str;\n elements.push(<meta key={key++} property={`al:${platform}:${k}`} content={content} />);\n }\n }\n }\n }\n\n // Other custom meta tags\n if (metadata.other) {\n for (const [name, content] of Object.entries(metadata.other)) {\n const values = Array.isArray(content) ? content : [content];\n for (const val of values) {\n elements.push(<meta key={key++} name={name} content={val} />);\n }\n }\n }\n\n return <>{elements}</>;\n}\n"],"mappings":";;;;;;;;AAoCA,eAAsB,sBACpB,KACA,QAC0B;AAC1B,KAAI,OAAO,IAAI,qBAAqB,YAAY;EAC9C,MAAM,cAAc,mBAAmB,OAAO;AAC9C,SAAO,MAAM,IAAI,iBAAiB,EAAE,QAAQ,aAAa,CAAC;;AAE5D,KAAI,IAAI,YAAY,OAAO,IAAI,aAAa,SAC1C,QAAO,IAAI;AAEb,QAAO;;;;;;AAOT,MAAa,mBAA6B;CACxC,OAAO;CACP,cAAc;CACf;AAED,SAAgB,cAAc,cAAoC;CAChE,MAAM,SAAmB,EAAE,GAAG,kBAAkB;AAChD,MAAK,MAAM,MAAM,aACf,QAAO,OAAO,QAAQ,GAAG;AAE3B,QAAO;;;;;AAMT,SAAgB,aAAa,EAAE,YAAoC;CACjE,MAAM,WAAiC,EAAE;CACzC,IAAI,MAAM;CAGV,MAAM,QAAkB,EAAE;AAC1B,KAAI,SAAS,UAAU,KAAA,EAAW,OAAM,KAAK,SAAS,SAAS,QAAQ;AACvE,KAAI,SAAS,WAAW,KAAA,EAAW,OAAM,KAAK,UAAU,SAAS,SAAS;AAC1E,KAAI,SAAS,iBAAiB,KAAA,EAAW,OAAM,KAAK,iBAAiB,SAAS,eAAe;AAC7F,KAAI,SAAS,iBAAiB,KAAA,EAAW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AI,SAAS,UAAU;EACrB,MAAM,KAAK,SAAS;AAWpB,OAAK,MAAM,YAVO;GAChB;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,EACiC;GAChC,MAAM,UAAU,GAAG;AACnB,OAAI,CAAC,QAAS;GACd,MAAM,OAAO,MAAM,QAAQ,QAAQ,GAAG,UAAU,CAAC,QAAQ;AACzD,QAAK,MAAM,SAAS,KAClB,MAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,MAAM,EAAE;AAC1C,QAAI,MAAM,KAAA,KAAa,MAAM,KAAM;IACnC,MAAM,MAAM,OAAO,EAAE;IACrB,MAAM,UAAU,MAAM,QAAQ,WAAW,IAAI,GAAG;AAChD,aAAS,KAAK,oBAAC,QAAD;KAAkB,UAAU,MAAM,SAAS,GAAG;KAAc;KAAW,EAA5D,MAA4D,CAAC;;;;AAO9F,KAAI,SAAS,MACX,MAAK,MAAM,CAAC,MAAM,YAAY,OAAO,QAAQ,SAAS,MAAM,EAAE;EAC5D,MAAM,SAAS,MAAM,QAAQ,QAAQ,GAAG,UAAU,CAAC,QAAQ;AAC3D,OAAK,MAAM,OAAO,OAChB,UAAS,KAAK,oBAAC,QAAD;GAAwB;GAAM,SAAS;GAAO,EAAnC,MAAmC,CAAC;;AAKnE,QAAO,oBAAA,YAAA,EAAA,UAAG,UAAY,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { getOrCreateAls } from "./internal/als-registry.js";
|
|
1
2
|
import { getRequestContext, isInsideUnifiedScope, runWithUnifiedStateMutation } from "./unified-request-context.js";
|
|
2
3
|
import { GLOBAL_ACCESSORS_KEY, _registerStateAccessors } from "./navigation.js";
|
|
3
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
4
|
//#region src/shims/navigation-state.ts
|
|
5
5
|
/**
|
|
6
6
|
* Server-only navigation state backed by AsyncLocalStorage.
|
|
@@ -14,10 +14,9 @@ import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
14
14
|
* be bundled for the browser. The dual-environment navigation.ts shim
|
|
15
15
|
* uses a registration pattern so it works in both environments.
|
|
16
16
|
*/
|
|
17
|
-
const _ALS_KEY = Symbol.for("vinext.navigation.als");
|
|
18
17
|
const _FALLBACK_KEY = Symbol.for("vinext.navigation.fallback");
|
|
19
18
|
const _g = globalThis;
|
|
20
|
-
const _als =
|
|
19
|
+
const _als = getOrCreateAls("vinext.navigation.als");
|
|
21
20
|
const _fallbackState = _g[_FALLBACK_KEY] ??= {
|
|
22
21
|
serverContext: null,
|
|
23
22
|
serverInsertedHTMLCallbacks: []
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-state.js","names":[],"sources":["../../src/shims/navigation-state.ts"],"sourcesContent":["/**\n * Server-only navigation state backed by AsyncLocalStorage.\n *\n * This module provides request-scoped isolation for navigation context\n * and useServerInsertedHTML callbacks. Without ALS, concurrent requests\n * on Cloudflare Workers would share module-level state and leak data\n * (pathnames, params, CSS-in-JS styles) between requests.\n *\n * This module is server-only — it imports node:async_hooks and must NOT\n * be bundled for the browser. The dual-environment navigation.ts shim\n * uses a registration pattern so it works in both environments.\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"navigation-state.js","names":[],"sources":["../../src/shims/navigation-state.ts"],"sourcesContent":["/**\n * Server-only navigation state backed by AsyncLocalStorage.\n *\n * This module provides request-scoped isolation for navigation context\n * and useServerInsertedHTML callbacks. Without ALS, concurrent requests\n * on Cloudflare Workers would share module-level state and leak data\n * (pathnames, params, CSS-in-JS styles) between requests.\n *\n * This module is server-only — it imports node:async_hooks and must NOT\n * be bundled for the browser. The dual-environment navigation.ts shim\n * uses a registration pattern so it works in both environments.\n */\n\nimport { getOrCreateAls } from \"./internal/als-registry.js\";\nimport {\n _registerStateAccessors,\n type NavigationContext,\n GLOBAL_ACCESSORS_KEY,\n} from \"./navigation.js\";\nimport {\n isInsideUnifiedScope,\n getRequestContext,\n runWithUnifiedStateMutation,\n} from \"./unified-request-context.js\";\n\n// ---------------------------------------------------------------------------\n// ALS setup — same pattern as headers.ts\n// ---------------------------------------------------------------------------\n\nexport type NavigationState = {\n serverContext: NavigationContext | null;\n serverInsertedHTMLCallbacks: Array<() => unknown>;\n};\n\nconst _FALLBACK_KEY = Symbol.for(\"vinext.navigation.fallback\");\nconst _g = globalThis as unknown as Record<PropertyKey, unknown>;\nconst _als = getOrCreateAls<NavigationState>(\"vinext.navigation.als\");\n\nconst _fallbackState = (_g[_FALLBACK_KEY] ??= {\n serverContext: null,\n serverInsertedHTMLCallbacks: [],\n} satisfies NavigationState) as NavigationState;\n\nfunction _getState(): NavigationState {\n if (isInsideUnifiedScope()) {\n return getRequestContext();\n }\n return _als.getStore() ?? _fallbackState;\n}\n\n/**\n * Run a function within a navigation ALS scope.\n * Ensures per-request isolation for navigation context and\n * useServerInsertedHTML callbacks on concurrent runtimes.\n */\nexport function runWithNavigationContext<T>(fn: () => Promise<T>): Promise<T>;\nexport function runWithNavigationContext<T>(fn: () => T | Promise<T>): T | Promise<T>;\nexport function runWithNavigationContext<T>(fn: () => T | Promise<T>): T | Promise<T> {\n if (isInsideUnifiedScope()) {\n return runWithUnifiedStateMutation((uCtx) => {\n uCtx.serverContext = null;\n uCtx.serverInsertedHTMLCallbacks = [];\n }, fn);\n }\n const state: NavigationState = {\n serverContext: null,\n serverInsertedHTMLCallbacks: [],\n };\n return _als.run(state, fn);\n}\n\n/**\n * Run a function with a fresh useServerInsertedHTML callback list while\n * preserving the current navigation context.\n *\n * Used by the Pages Router ISR cache-fill pass: it is the same request/path,\n * but it needs a fresh callback collection so CSS-in-JS insertions from the\n * streamed render cannot accumulate into the cache-fill render.\n */\nexport function runWithServerInsertedHTMLState<T>(fn: () => Promise<T>): Promise<T>;\nexport function runWithServerInsertedHTMLState<T>(fn: () => T | Promise<T>): T | Promise<T>;\nexport function runWithServerInsertedHTMLState<T>(fn: () => T | Promise<T>): T | Promise<T> {\n if (isInsideUnifiedScope()) {\n return runWithUnifiedStateMutation((uCtx) => {\n uCtx.serverInsertedHTMLCallbacks = [];\n }, fn);\n }\n\n const parentState = _als.getStore() ?? _fallbackState;\n const state: NavigationState = {\n serverContext: parentState.serverContext,\n serverInsertedHTMLCallbacks: [],\n };\n return _als.run(state, fn);\n}\n\n// ---------------------------------------------------------------------------\n// Register ALS-backed accessors into navigation.ts\n//\n// Two registration paths (issue #688):\n// 1. _registerStateAccessors — updates the module-level function pointers\n// in the same module instance that imported us (the SSR entry's copy).\n// 2. globalThis[Symbol.for(...)] — makes the accessors discoverable by ANY\n// module instance of navigation.ts, even if Vite created a separate one\n// for \"use client\" components due to pre-bundling or env separation.\n// ---------------------------------------------------------------------------\n\nconst _accessors = {\n getServerContext(): NavigationContext | null {\n return _getState().serverContext;\n },\n\n setServerContext(ctx: NavigationContext | null): void {\n _getState().serverContext = ctx;\n },\n\n getInsertedHTMLCallbacks(): Array<() => unknown> {\n return _getState().serverInsertedHTMLCallbacks;\n },\n\n clearInsertedHTMLCallbacks(): void {\n _getState().serverInsertedHTMLCallbacks = [];\n },\n} satisfies Parameters<typeof _registerStateAccessors>[0];\n\n_registerStateAccessors(_accessors);\n(globalThis as unknown as Record<PropertyKey, unknown>)[GLOBAL_ACCESSORS_KEY] = _accessors;\n"],"mappings":";;;;;;;;;;;;;;;;AAkCA,MAAM,gBAAgB,OAAO,IAAI,6BAA6B;AAC9D,MAAM,KAAK;AACX,MAAM,OAAO,eAAgC,wBAAwB;AAErE,MAAM,iBAAkB,GAAG,mBAAmB;CAC5C,eAAe;CACf,6BAA6B,EAAE;CAChC;AAED,SAAS,YAA6B;AACpC,KAAI,sBAAsB,CACxB,QAAO,mBAAmB;AAE5B,QAAO,KAAK,UAAU,IAAI;;AAU5B,SAAgB,yBAA4B,IAA0C;AACpF,KAAI,sBAAsB,CACxB,QAAO,6BAA6B,SAAS;AAC3C,OAAK,gBAAgB;AACrB,OAAK,8BAA8B,EAAE;IACpC,GAAG;AAMR,QAAO,KAAK,IAJmB;EAC7B,eAAe;EACf,6BAA6B,EAAE;EAChC,EACsB,GAAG;;AAa5B,SAAgB,+BAAkC,IAA0C;AAC1F,KAAI,sBAAsB,CACxB,QAAO,6BAA6B,SAAS;AAC3C,OAAK,8BAA8B,EAAE;IACpC,GAAG;CAIR,MAAM,QAAyB;EAC7B,gBAFkB,KAAK,UAAU,IAAI,gBAEV;EAC3B,6BAA6B,EAAE;EAChC;AACD,QAAO,KAAK,IAAI,OAAO,GAAG;;AAc5B,MAAM,aAAa;CACjB,mBAA6C;AAC3C,SAAO,WAAW,CAAC;;CAGrB,iBAAiB,KAAqC;AACpD,aAAW,CAAC,gBAAgB;;CAG9B,2BAAiD;AAC/C,SAAO,WAAW,CAAC;;CAGrB,6BAAmC;AACjC,aAAW,CAAC,8BAA8B,EAAE;;CAE/C;AAED,wBAAwB,WAAW;AACnC,WAAwD,wBAAwB"}
|
|
@@ -62,16 +62,11 @@ type CachedRscResponse = {
|
|
|
62
62
|
url: string;
|
|
63
63
|
};
|
|
64
64
|
type PrefetchCacheEntry = {
|
|
65
|
+
outcome: "pending" | "cache-seeded";
|
|
65
66
|
snapshot?: CachedRscResponse;
|
|
66
67
|
pending?: Promise<void>;
|
|
67
68
|
timestamp: number;
|
|
68
69
|
};
|
|
69
|
-
/**
|
|
70
|
-
* Convert a pathname (with optional query/hash) to its .rsc URL.
|
|
71
|
-
* Strips trailing slashes before appending `.rsc` so that cache keys
|
|
72
|
-
* are consistent regardless of the `trailingSlash` config setting.
|
|
73
|
-
*/
|
|
74
|
-
declare function toRscUrl(href: string): string;
|
|
75
70
|
declare function getCurrentInterceptionContext(): string | null;
|
|
76
71
|
declare function getCurrentNextUrl(): string;
|
|
77
72
|
/** Get or create the shared in-memory RSC prefetch cache on window. */
|
|
@@ -357,5 +352,5 @@ declare function forbidden(): never;
|
|
|
357
352
|
*/
|
|
358
353
|
declare function unauthorized(): never;
|
|
359
354
|
//#endregion
|
|
360
|
-
export { CachedRscResponse, ClientNavigationRenderSnapshot, GLOBAL_ACCESSORS_KEY, HTTP_ERROR_FALLBACK_ERROR_CODE, MAX_PREFETCH_CACHE_SIZE, NavigationContext, PREFETCH_CACHE_TTL, PrefetchCacheEntry, ReadonlyURLSearchParams, RedirectType, SegmentMap, ServerInsertedHTMLContext, __basePath, _registerStateAccessors, activateNavigationSnapshot, clearPendingPathname, clearServerInsertedHTML, commitClientNavigationState, consumePrefetchResponse, createClientNavigationRenderSnapshot, flushServerInsertedHTML, forbidden, getAccessFallbackHTTPStatus, getClientNavigationRenderContext, getClientNavigationState, getClientParams, getCurrentInterceptionContext, getCurrentNextUrl, getLayoutSegmentContext, getMountedSlotsHeader, getNavigationContext, getPrefetchCache, getPrefetchedUrls, isHTTPAccessFallbackError, navigateClientSide, notFound, permanentRedirect, prefetchRscResponse, pushHistoryStateWithoutNotify, redirect, renderServerInsertedHTML, replaceClientParamsWithoutNotify, replaceHistoryStateWithoutNotify, restoreRscResponse, setClientParams, setMountedSlotsHeader, setNavigationContext, setPendingPathname, snapshotRscResponse, storePrefetchResponse,
|
|
355
|
+
export { CachedRscResponse, ClientNavigationRenderSnapshot, GLOBAL_ACCESSORS_KEY, HTTP_ERROR_FALLBACK_ERROR_CODE, MAX_PREFETCH_CACHE_SIZE, NavigationContext, PREFETCH_CACHE_TTL, PrefetchCacheEntry, ReadonlyURLSearchParams, RedirectType, SegmentMap, ServerInsertedHTMLContext, __basePath, _registerStateAccessors, activateNavigationSnapshot, clearPendingPathname, clearServerInsertedHTML, commitClientNavigationState, consumePrefetchResponse, createClientNavigationRenderSnapshot, flushServerInsertedHTML, forbidden, getAccessFallbackHTTPStatus, getClientNavigationRenderContext, getClientNavigationState, getClientParams, getCurrentInterceptionContext, getCurrentNextUrl, getLayoutSegmentContext, getMountedSlotsHeader, getNavigationContext, getPrefetchCache, getPrefetchedUrls, isHTTPAccessFallbackError, navigateClientSide, notFound, permanentRedirect, prefetchRscResponse, pushHistoryStateWithoutNotify, redirect, renderServerInsertedHTML, replaceClientParamsWithoutNotify, replaceHistoryStateWithoutNotify, restoreRscResponse, setClientParams, setMountedSlotsHeader, setNavigationContext, setPendingPathname, snapshotRscResponse, storePrefetchResponse, unauthorized, useParams, usePathname, useRouter, useSearchParams, useSelectedLayoutSegment, useSelectedLayoutSegments, useServerInsertedHTML };
|
|
361
356
|
//# sourceMappingURL=navigation.d.ts.map
|
package/dist/shims/navigation.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { assertSafeNavigationUrl } from "./url-safety.js";
|
|
2
1
|
import { stripBasePath } from "../utils/base-path.js";
|
|
2
|
+
import { assertSafeNavigationUrl } from "./url-safety.js";
|
|
3
3
|
import { toBrowserNavigationHref, toSameOriginAppPath } from "./url-utils.js";
|
|
4
4
|
import { notifyAppRouterTransitionStart } from "../client/instrumentation-client-state.js";
|
|
5
|
-
import {
|
|
5
|
+
import { AppElementsWire } from "../server/app-elements-wire.js";
|
|
6
|
+
import "../server/app-elements.js";
|
|
7
|
+
import { VINEXT_RSC_MOUNTED_SLOTS_HEADER, createRscRequestHeaders, createRscRequestUrl } from "../server/app-rsc-cache-busting.js";
|
|
6
8
|
import { ReadonlyURLSearchParams } from "./readonly-url-search-params.js";
|
|
7
9
|
import * as React$1 from "react";
|
|
8
10
|
//#region src/shims/navigation.ts
|
|
@@ -122,18 +124,6 @@ const __basePath = process.env.__NEXT_ROUTER_BASEPATH ?? "";
|
|
|
122
124
|
const MAX_PREFETCH_CACHE_SIZE = 50;
|
|
123
125
|
/** TTL for prefetch cache entries in ms (matches Next.js static prefetch TTL). */
|
|
124
126
|
const PREFETCH_CACHE_TTL = 3e4;
|
|
125
|
-
/**
|
|
126
|
-
* Convert a pathname (with optional query/hash) to its .rsc URL.
|
|
127
|
-
* Strips trailing slashes before appending `.rsc` so that cache keys
|
|
128
|
-
* are consistent regardless of the `trailingSlash` config setting.
|
|
129
|
-
*/
|
|
130
|
-
function toRscUrl(href) {
|
|
131
|
-
const [beforeHash] = href.split("#");
|
|
132
|
-
const qIdx = beforeHash.indexOf("?");
|
|
133
|
-
const pathname = qIdx === -1 ? beforeHash : beforeHash.slice(0, qIdx);
|
|
134
|
-
const query = qIdx === -1 ? "" : beforeHash.slice(qIdx);
|
|
135
|
-
return (pathname.length > 1 && pathname.endsWith("/") ? pathname.slice(0, -1) : pathname) + ".rsc" + query;
|
|
136
|
-
}
|
|
137
127
|
function getCurrentInterceptionContext() {
|
|
138
128
|
if (isServer) return null;
|
|
139
129
|
return stripBasePath(window.location.pathname, __basePath);
|
|
@@ -195,15 +185,19 @@ function evictPrefetchCacheIfNeeded() {
|
|
|
195
185
|
* function only stores the response in the prefetch cache.
|
|
196
186
|
*/
|
|
197
187
|
function storePrefetchResponse(rscUrl, response, interceptionContext = null) {
|
|
198
|
-
const cacheKey =
|
|
188
|
+
const cacheKey = AppElementsWire.encodeCacheKey(rscUrl, interceptionContext);
|
|
199
189
|
evictPrefetchCacheIfNeeded();
|
|
200
|
-
const entry = {
|
|
190
|
+
const entry = {
|
|
191
|
+
outcome: "pending",
|
|
192
|
+
timestamp: Date.now()
|
|
193
|
+
};
|
|
201
194
|
entry.pending = snapshotRscResponse(response).then((snapshot) => {
|
|
202
195
|
entry.snapshot = snapshot;
|
|
203
196
|
}).catch(() => {
|
|
204
197
|
getPrefetchCache().delete(cacheKey);
|
|
205
198
|
}).finally(() => {
|
|
206
199
|
entry.pending = void 0;
|
|
200
|
+
if (entry.snapshot) entry.outcome = "cache-seeded";
|
|
207
201
|
});
|
|
208
202
|
getPrefetchCache().set(cacheKey, entry);
|
|
209
203
|
}
|
|
@@ -252,10 +246,13 @@ function restoreRscResponse(cached, copy = true) {
|
|
|
252
246
|
* link-heavy pages.
|
|
253
247
|
*/
|
|
254
248
|
function prefetchRscResponse(rscUrl, fetchPromise, interceptionContext = null, mountedSlotsHeader = null) {
|
|
255
|
-
const cacheKey =
|
|
249
|
+
const cacheKey = AppElementsWire.encodeCacheKey(rscUrl, interceptionContext);
|
|
256
250
|
const cache = getPrefetchCache();
|
|
257
251
|
const prefetched = getPrefetchedUrls();
|
|
258
|
-
const entry = {
|
|
252
|
+
const entry = {
|
|
253
|
+
outcome: "pending",
|
|
254
|
+
timestamp: Date.now()
|
|
255
|
+
};
|
|
259
256
|
entry.pending = fetchPromise.then(async (response) => {
|
|
260
257
|
if (response.ok) entry.snapshot = {
|
|
261
258
|
...await snapshotRscResponse(response),
|
|
@@ -270,6 +267,7 @@ function prefetchRscResponse(rscUrl, fetchPromise, interceptionContext = null, m
|
|
|
270
267
|
cache.delete(cacheKey);
|
|
271
268
|
}).finally(() => {
|
|
272
269
|
entry.pending = void 0;
|
|
270
|
+
if (entry.snapshot) entry.outcome = "cache-seeded";
|
|
273
271
|
});
|
|
274
272
|
cache.set(cacheKey, entry);
|
|
275
273
|
evictPrefetchCacheIfNeeded();
|
|
@@ -280,11 +278,11 @@ function prefetchRscResponse(rscUrl, fetchPromise, interceptionContext = null, m
|
|
|
280
278
|
* Returns null if the entry is still in flight or doesn't exist.
|
|
281
279
|
*/
|
|
282
280
|
function consumePrefetchResponse(rscUrl, interceptionContext = null, mountedSlotsHeader = null) {
|
|
283
|
-
const cacheKey =
|
|
281
|
+
const cacheKey = AppElementsWire.encodeCacheKey(rscUrl, interceptionContext);
|
|
284
282
|
const cache = getPrefetchCache();
|
|
285
283
|
const entry = cache.get(cacheKey);
|
|
286
284
|
if (!entry) return null;
|
|
287
|
-
if (entry.pending) return null;
|
|
285
|
+
if (entry.pending || entry.outcome !== "cache-seeded") return null;
|
|
288
286
|
cache.delete(cacheKey);
|
|
289
287
|
getPrefetchedUrls().delete(cacheKey);
|
|
290
288
|
if (entry.snapshot) {
|
|
@@ -730,21 +728,31 @@ const _appRouter = {
|
|
|
730
728
|
prefetch(href) {
|
|
731
729
|
assertSafeNavigationUrl(href);
|
|
732
730
|
if (isServer) return;
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
headers,
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
731
|
+
(async () => {
|
|
732
|
+
let prefetchHref = href;
|
|
733
|
+
if (href.startsWith("http://") || href.startsWith("https://") || href.startsWith("//")) {
|
|
734
|
+
const localPath = toSameOriginAppPath(href, __basePath);
|
|
735
|
+
if (localPath == null) return;
|
|
736
|
+
prefetchHref = localPath;
|
|
737
|
+
}
|
|
738
|
+
const fullHref = toBrowserNavigationHref(prefetchHref, window.location.href, __basePath);
|
|
739
|
+
const interceptionContext = getCurrentInterceptionContext();
|
|
740
|
+
const mountedSlotsHeader = getMountedSlotsHeader();
|
|
741
|
+
const headers = createRscRequestHeaders({ interceptionContext });
|
|
742
|
+
if (mountedSlotsHeader) headers.set(VINEXT_RSC_MOUNTED_SLOTS_HEADER, mountedSlotsHeader);
|
|
743
|
+
const rscUrl = await createRscRequestUrl(fullHref, headers);
|
|
744
|
+
const cacheKey = AppElementsWire.encodeCacheKey(rscUrl, interceptionContext);
|
|
745
|
+
const prefetched = getPrefetchedUrls();
|
|
746
|
+
if (prefetched.has(cacheKey)) return;
|
|
747
|
+
prefetched.add(cacheKey);
|
|
748
|
+
prefetchRscResponse(rscUrl, fetch(rscUrl, {
|
|
749
|
+
headers,
|
|
750
|
+
credentials: "include",
|
|
751
|
+
priority: "low"
|
|
752
|
+
}), interceptionContext, mountedSlotsHeader);
|
|
753
|
+
})().catch((error) => {
|
|
754
|
+
console.error("[vinext] RSC prefetch setup error:", error);
|
|
755
|
+
});
|
|
748
756
|
}
|
|
749
757
|
};
|
|
750
758
|
/**
|
|
@@ -962,6 +970,6 @@ if (!isServer) {
|
|
|
962
970
|
}
|
|
963
971
|
}
|
|
964
972
|
//#endregion
|
|
965
|
-
export { GLOBAL_ACCESSORS_KEY, HTTP_ERROR_FALLBACK_ERROR_CODE, MAX_PREFETCH_CACHE_SIZE, PREFETCH_CACHE_TTL, ReadonlyURLSearchParams, RedirectType, ServerInsertedHTMLContext, __basePath, _registerStateAccessors, activateNavigationSnapshot, clearPendingPathname, clearServerInsertedHTML, commitClientNavigationState, consumePrefetchResponse, createClientNavigationRenderSnapshot, flushServerInsertedHTML, forbidden, getAccessFallbackHTTPStatus, getClientNavigationRenderContext, getClientNavigationState, getClientParams, getCurrentInterceptionContext, getCurrentNextUrl, getLayoutSegmentContext, getMountedSlotsHeader, getNavigationContext, getPrefetchCache, getPrefetchedUrls, isHTTPAccessFallbackError, navigateClientSide, notFound, permanentRedirect, prefetchRscResponse, pushHistoryStateWithoutNotify, redirect, renderServerInsertedHTML, replaceClientParamsWithoutNotify, replaceHistoryStateWithoutNotify, restoreRscResponse, setClientParams, setMountedSlotsHeader, setNavigationContext, setPendingPathname, snapshotRscResponse, storePrefetchResponse,
|
|
973
|
+
export { GLOBAL_ACCESSORS_KEY, HTTP_ERROR_FALLBACK_ERROR_CODE, MAX_PREFETCH_CACHE_SIZE, PREFETCH_CACHE_TTL, ReadonlyURLSearchParams, RedirectType, ServerInsertedHTMLContext, __basePath, _registerStateAccessors, activateNavigationSnapshot, clearPendingPathname, clearServerInsertedHTML, commitClientNavigationState, consumePrefetchResponse, createClientNavigationRenderSnapshot, flushServerInsertedHTML, forbidden, getAccessFallbackHTTPStatus, getClientNavigationRenderContext, getClientNavigationState, getClientParams, getCurrentInterceptionContext, getCurrentNextUrl, getLayoutSegmentContext, getMountedSlotsHeader, getNavigationContext, getPrefetchCache, getPrefetchedUrls, isHTTPAccessFallbackError, navigateClientSide, notFound, permanentRedirect, prefetchRscResponse, pushHistoryStateWithoutNotify, redirect, renderServerInsertedHTML, replaceClientParamsWithoutNotify, replaceHistoryStateWithoutNotify, restoreRscResponse, setClientParams, setMountedSlotsHeader, setNavigationContext, setPendingPathname, snapshotRscResponse, storePrefetchResponse, unauthorized, useParams, usePathname, useRouter, useSearchParams, useSelectedLayoutSegment, useSelectedLayoutSegments, useServerInsertedHTML };
|
|
966
974
|
|
|
967
975
|
//# sourceMappingURL=navigation.js.map
|